/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', 'PingFang SC', sans-serif;
    background: linear-gradient(135deg, #e3f2fd 0%, #f8bbd9 100%);
    height: 100vh;
    overflow: hidden;
    user-select: none;
}

/* Main game container - responsive height based on environment */
.game-container {
    width: 100%;
    height: 450px; /* Default for iframe */
    max-width: 800px;
    margin: 0 auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
}

/* Adjust height for standalone browser tab */
@media (min-height: 500px) {
    .game-container {
        height: 90vh;
        gap: 12px;
        padding: 15px;
    }
}

/* Patient panel styling */
.patient-panel {
    background: white;
    border-radius: 15px;
    padding: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    flex: 1;
    min-height: 80px;
}

.patient-card {
    display: flex;
    align-items: center;
    gap: 15px;
    height: 100%;
}

.patient-icon {
    font-size: 2.5em;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.patient-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.case-number {
    font-size: 1.1em;
    font-weight: bold;
    color: #2196f3;
}

.sentence-display {
    font-size: 1.2em;
    line-height: 1.4;
    color: #333;
    background: #f5f5f5;
    padding: 10px;
    border-radius: 8px;
    border-left: 4px solid #ff9800;
}

/* Highlight incorrect character in sentence */
.incorrect-char {
    background: #ffebee;
    color: #d32f2f;
    padding: 2px 4px;
    border-radius: 4px;
    font-weight: bold;
    text-decoration: underline;
    text-decoration-color: #d32f2f;
}

/* Diagnosis panel with medicine options */
.diagnosis-panel {
    background: white;
    border-radius: 15px;
    padding: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.diagnosis-title {
    font-size: 1.1em;
    font-weight: bold;
    color: #4caf50;
    margin-bottom: 12px;
    text-align: center;
}

.medicine-options {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.medicine-btn {
    background: linear-gradient(145deg, #ffffff, #f0f0f0);
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    min-width: 80px;
    position: relative;
}

.medicine-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
    border-color: #4caf50;
}

.medicine-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.medicine-btn.correct {
    background: linear-gradient(145deg, #c8e6c9, #4caf50);
    border-color: #4caf50;
    color: white;
    animation: correctPulse 0.6s ease;
}

.medicine-btn.incorrect {
    background: linear-gradient(145deg, #ffcdd2, #f44336);
    border-color: #f44336;
    color: white;
    animation: shake 0.5s ease;
}

@keyframes correctPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.medicine-icon {
    font-size: 1.5em;
}

.medicine-label {
    font-size: 1.2em;
    font-weight: bold;
}

/* Feedback panel */
.feedback-panel {
    background: white;
    border-radius: 15px;
    padding: 12px 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 50px;
}

.feedback-message {
    font-size: 1em;
    font-weight: bold;
    flex: 1;
}

.feedback-message.correct {
    color: #4caf50;
}

.feedback-message.incorrect {
    color: #f44336;
}

.progress-info {
    display: flex;
    gap: 15px;
    font-size: 0.9em;
}

.progress-info > div {
    text-align: center;
}

.progress-info span {
    font-weight: bold;
    color: #2196f3;
}

/* Action panel */
.action-panel {
    display: flex;
    justify-content: center;
}

.next-btn {
    background: linear-gradient(145deg, #4caf50, #45a049);
    color: white;
    border: none;
    border-radius: 25px;
    padding: 12px 30px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

.next-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
}

.next-btn:disabled {
    background: #cccccc;
    cursor: not-allowed;
    box-shadow: none;
}

/* Injection check modal */
.injection-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.injection-modal.show {
    display: flex;
}

.injection-content {
    background: white;
    border-radius: 20px;
    padding: 25px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    animation: modalAppear 0.3s ease;
}

@keyframes modalAppear {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.injection-title {
    font-size: 1.3em;
    font-weight: bold;
    color: #ff9800;
    margin-bottom: 15px;
}

.injection-question {
    font-size: 1.1em;
    margin-bottom: 20px;
    color: #333;
    line-height: 1.4;
}

.injection-options {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.injection-option {
    background: linear-gradient(145deg, #2196f3, #1976d2);
    color: white;
    border: none;
    border-radius: 25px;
    padding: 12px 25px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 80px;
}

.injection-option:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(33, 150, 243, 0.4);
}

/* Tooltip styling */
.tooltip {
    position: absolute;
    background: rgba(0,0,0,0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.9em;
    max-width: 250px;
    z-index: 1001;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    line-height: 1.3;
}

.tooltip.show {
    opacity: 1;
}

/* Mobile optimizations */
@media (max-width: 600px) {
    .game-container {
        padding: 8px;
        gap: 6px;
    }
    
    .patient-card {
        gap: 10px;
    }
    
    .patient-icon {
        font-size: 2em;
    }
    
    .sentence-display {
        font-size: 1.1em;
        padding: 8px;
    }
    
    .medicine-btn {
        min-width: 70px;
        padding: 10px 12px;
    }
    
    .medicine-icon {
        font-size: 1.3em;
    }
    
    .medicine-label {
        font-size: 1.1em;
    }
    
    .progress-info {
        gap: 10px;
        font-size: 0.8em;
    }
    
    .next-btn {
        padding: 10px 25px;
        font-size: 0.9em;
    }
}

/* Touch-friendly target sizes */
@media (pointer: coarse) {
    .medicine-btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    .next-btn {
        min-height: 44px;
    }
    
    .injection-option {
        min-height: 44px;
    }
}