/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    background: #f5f7fa;
}

/* Game Container */
.game-container {
    width: 100vw;
    height: 100vh;
    position: relative;
    overflow: hidden;
}

/* Screens */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.screen.active {
    display: flex;
    opacity: 1;
}

/* Menu Screen */
.menu-screen {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    align-items: center;
    justify-content: center;
}

.menu-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
}

.floating-icons {
    position: absolute;
    width: 100%;
    height: 100%;
}

.float-icon {
    position: absolute;
    font-size: 3rem;
    opacity: 0.1;
    animation: float-up 20s infinite linear;
    animation-delay: var(--delay);
}

@keyframes float-up {
    0% {
        transform: translateY(100vh) rotate(0deg);
    }
    100% {
        transform: translateY(-100px) rotate(360deg);
    }
}

.float-icon:nth-child(1) { left: 10%; }
.float-icon:nth-child(2) { left: 30%; }
.float-icon:nth-child(3) { left: 50%; }
.float-icon:nth-child(4) { left: 70%; }
.float-icon:nth-child(5) { left: 90%; }

/* Content Container */
.content {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    text-align: center;
}

/* Game Title */
.game-title {
    font-size: clamp(2.5rem, 7vw, 4rem);
    color: #fff;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
    margin-bottom: 10px;
    animation: pulse 2s ease-in-out infinite;
}

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

.title-icon {
    display: inline-block;
    animation: sparkle 1.5s ease-in-out infinite;
}

@keyframes sparkle {
    0%, 100% { transform: rotate(0deg) scale(1); }
    50% { transform: rotate(180deg) scale(1.2); }
}

.subtitle {
    font-size: clamp(1rem, 3vw, 1.5rem);
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 40px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 15px 30px;
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    color: #fff;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    margin: 10px;
}

.btn:active {
    transform: scale(0.95);
}

.btn-primary {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #f5576c 0%, #f093fb 100%);
    box-shadow: 0 6px 20px rgba(245, 87, 108, 0.4);
}

.btn-secondary {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #00f2fe 0%, #4facfe 100%);
    box-shadow: 0 6px 20px rgba(79, 172, 254, 0.4);
}

.btn-icon {
    font-size: 1.3rem;
}

/* Menu Options */
.menu-options {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    margin-bottom: 40px;
}

/* Dedication */
.dedication {
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
    max-width: 400px;
    margin: 0 auto;
}

.dedication p {
    color: #fff;
    margin: 5px 0;
}

.dedication .small {
    font-size: 0.9rem;
    opacity: 0.8;
}

/* Mode Selection Screen */
.mode-screen {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    align-items: center;
    justify-content: center;
}

.mode-screen h2 {
    color: #fff;
    font-size: 2.5rem;
    margin-bottom: 30px;
}

.game-modes {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
    width: 100%;
}

.mode-card {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    border: 2px solid transparent;
}

.mode-card:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-5px);
    border-color: rgba(255, 255, 255, 0.3);
}

.mode-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.mode-card h3 {
    color: #fff;
    font-size: 1.5rem;
    margin-bottom: 10px;
}

.mode-card p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
    margin-bottom: 15px;
}

.difficulty-stars {
    color: #ffd700;
    font-size: 1.2rem;
}

/* Game Header */
.game-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.3) 0%, transparent 100%);
    z-index: 100;
}

.score-display, .timer-display, .streak-display, .lives-display,
.reputation-display, .patients-display {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.9);
    padding: 8px 15px;
    border-radius: 25px;
    font-weight: 700;
    font-size: 1.1rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.score-icon, .timer-icon, .streak-icon, .rep-icon, .patients-icon {
    font-size: 1.3rem;
}

.pause-btn {
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.pause-btn:hover {
    transform: scale(1.1);
}

/* Anatomy Game */
.anatomy-screen {
    background: #f5f7fa;
    flex-direction: column;
    padding-top: 80px;
}

.anatomy-game {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 10px 20px;
    overflow-y: auto;
}

.anatomy-display {
    background: white;
    border-radius: 20px;
    padding: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    width: 100%;
    margin-bottom: 15px;
}

/* 4-view grid layout */
.anatomy-display.anatomy-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    max-width: 900px;
}

.anatomy-view-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #f8f9fa;
    border-radius: 12px;
    padding: 8px;
    transition: all 0.2s ease;
}

.anatomy-view-container:hover {
    background: #e9ecef;
    transform: translateY(-2px);
}

.view-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #6a1b9a;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.anatomy-view {
    width: 100%;
    height: auto;
    cursor: pointer;
}

/* Responsive: 2x2 grid on smaller screens */
@media (max-width: 768px) {
    .anatomy-display.anatomy-grid {
        grid-template-columns: repeat(2, 1fr);
        max-width: 500px;
    }
}

/* Muscle hover and click effects - applies to all anatomy views */
.anatomy-view .muscle {
    cursor: pointer;
    transition: all 0.2s ease;
}

.anatomy-view .muscle:hover {
    filter: brightness(1.3) saturate(1.2);
    stroke-width: 3;
    transform-origin: center;
}

.anatomy-view .muscle.correct {
    fill: #4CAF50 !important;
    animation: correctPulse 0.5s ease;
}

.anatomy-view .muscle.incorrect {
    fill: #f44336 !important;
    animation: shake 0.5s ease;
}

.anatomy-view .muscle.highlight {
    fill: #FFD700 !important;
    stroke: #FFA000;
    stroke-width: 3;
    animation: glow 1s ease-in-out infinite;
}

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

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

@keyframes glow {
    0%, 100% { filter: brightness(1) drop-shadow(0 0 5px #FFD700); }
    50% { filter: brightness(1.2) drop-shadow(0 0 15px #FFD700); }
}

.anatomy-question {
    text-align: center;
    margin-bottom: 20px;
}

.anatomy-question h3 {
    font-size: 1.5rem;
    color: #333;
    margin-bottom: 10px;
}

.hint-container {
    margin-top: 15px;
}

.hint-btn {
    background: linear-gradient(135deg, #ffd89b 0%, #19547b 100%);
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.hint-btn:hover {
    transform: scale(1.05);
}

.hint-text {
    margin-top: 10px;
    color: #666;
    font-style: italic;
}

.hidden {
    display: none;
}

.anatomy-feedback {
    text-align: center;
    font-size: 1.2rem;
    font-weight: 600;
    padding: 10px;
    border-radius: 10px;
    margin-top: 10px;
}

.anatomy-feedback.correct {
    background: #d4edda;
    color: #155724;
}

.anatomy-feedback.incorrect {
    background: #f8d7da;
    color: #721c24;
}

/* Exercise Game */
.exercise-screen {
    background: #f5f7fa;
    flex-direction: column;
    padding-top: 80px;
}

.exercise-game {
    flex: 1;
    padding: 20px;
    max-width: 1000px;
    width: 100%;
    margin: 0 auto;
}

.exercise-instruction {
    text-align: center;
    font-size: 1.3rem;
    color: #333;
    margin-bottom: 30px;
}

.exercise-board {
    display: flex;
    gap: 40px;
    justify-content: center;
    margin-bottom: 30px;
}

.exercise-column, .muscle-column {
    flex: 1;
    max-width: 400px;
}

.exercise-column h4, .muscle-column h4 {
    text-align: center;
    color: #666;
    margin-bottom: 20px;
    font-size: 1.2rem;
}

.exercise-cards, .muscle-cards {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.exercise-card, .muscle-card {
    background: white;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    font-weight: 600;
}

.exercise-card:hover, .muscle-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.exercise-card.selected, .muscle-card.selected {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.exercise-card.matched, .muscle-card.matched {
    background: #d4edda;
    color: #155724;
    pointer-events: none;
}

/* Patient Care Game */
.patient-screen {
    background: #f5f7fa;
    flex-direction: column;
    padding-top: 80px;
}

.patient-game {
    flex: 1;
    padding: 20px;
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
}

.patient-card {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.patient-avatar {
    font-size: 4rem;
    text-align: center;
    margin-bottom: 20px;
}

.patient-name {
    text-align: center;
    font-size: 1.8rem;
    color: #333;
    margin-bottom: 20px;
}

.patient-info p {
    margin: 10px 0;
    font-size: 1.1rem;
    color: #666;
}

.patient-info strong {
    color: #333;
}

.treatment-options h4 {
    text-align: center;
    color: #333;
    margin-bottom: 20px;
    font-size: 1.3rem;
}

.treatment-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.treatment-card {
    background: white;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.treatment-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.treatment-card h5 {
    color: #333;
    margin-bottom: 10px;
}

.treatment-card p {
    color: #666;
    font-size: 0.9rem;
}

/* Reflex Challenge */
.reflex-screen {
    background: #f5f7fa;
    flex-direction: column;
    padding-top: 80px;
}

.reflex-game {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.reflex-question-card {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    max-width: 600px;
    width: 100%;
    margin-bottom: 30px;
    text-align: center;
}

.reflex-question-card h3 {
    font-size: 1.5rem;
    color: #333;
    margin-bottom: 20px;
    min-height: 60px;
}

.reflex-timer-bar {
    height: 10px;
    background: #e0e0e0;
    border-radius: 5px;
    overflow: hidden;
}

.reflex-timer-fill {
    height: 100%;
    background: linear-gradient(90deg, #4facfe 0%, #00f2fe 100%);
    transition: width 0.1s linear;
    width: 100%;
}

.reflex-answers {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    max-width: 600px;
    width: 100%;
}

.reflex-btn {
    background: white;
    border: 2px solid #e0e0e0;
    padding: 20px;
    border-radius: 15px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.reflex-btn:hover {
    background: #f5f7fa;
    border-color: #667eea;
}

.reflex-btn:active {
    transform: scale(0.95);
}

.reflex-btn.correct {
    background: #d4edda;
    border-color: #28a745;
}

.reflex-btn.incorrect {
    background: #f8d7da;
    border-color: #dc3545;
}

/* Study Guide */
.study-screen {
    background: #f5f7fa;
    overflow-y: auto;
}

.study-content {
    padding: 40px 20px;
}

.study-screen h2 {
    text-align: center;
    color: #333;
    margin-bottom: 30px;
}

.study-tabs {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.study-tab {
    background: white;
    border: 2px solid #e0e0e0;
    padding: 10px 20px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    color: #666;
}

.study-tab:hover {
    background: #f5f7fa;
}

.study-tab.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: transparent;
}

.study-content-area {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    min-height: 400px;
    margin-bottom: 30px;
}

/* Progress Screen */
.progress-screen {
    background: #f5f7fa;
    overflow-y: auto;
}

.progress-screen h2 {
    text-align: center;
    color: #333;
    margin-bottom: 30px;
}

.progress-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: white;
    border-radius: 20px;
    padding: 30px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.stat-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.stat-card h3 {
    color: #666;
    font-size: 1rem;
    margin-bottom: 10px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: #333;
}

.achievements {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.achievements h3 {
    color: #333;
    margin-bottom: 20px;
}

.achievement-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 20px;
}

.achievement-item {
    text-align: center;
    padding: 20px;
    border-radius: 15px;
    background: #f5f7fa;
    transition: all 0.3s ease;
}

.achievement-item.unlocked {
    background: linear-gradient(135deg, #ffd89b 0%, #19547b 100%);
    color: white;
}

.achievement-icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.achievement-item h4 {
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.achievement-item p {
    font-size: 0.8rem;
    opacity: 0.8;
}

/* Pause Screen */
.pause-screen {
    background: rgba(0, 0, 0, 0.8);
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.pause-content {
    background: white;
    padding: 40px;
    border-radius: 30px;
    text-align: center;
    max-width: 400px;
    width: 90%;
}

.pause-content h2 {
    color: #333;
    margin-bottom: 30px;
}

.pause-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
}

/* Game Over Screen */
.gameover-screen {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    align-items: center;
    justify-content: center;
}

.gameover-title {
    color: white;
    font-size: 3rem;
    margin-bottom: 30px;
}

.gameover-stats {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 40px;
    backdrop-filter: blur(10px);
    margin-bottom: 30px;
}

.final-score {
    text-align: center;
    margin-bottom: 20px;
}

.final-score h3 {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.2rem;
    margin-bottom: 10px;
}

.score-value {
    font-size: 3rem;
    font-weight: 700;
    color: #ffd700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.performance-message {
    text-align: center;
    color: white;
    font-size: 1.3rem;
    margin-bottom: 20px;
}

.gameover-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
}

/* Responsive Design */
@media (max-width: 768px) {
    .game-modes {
        grid-template-columns: 1fr;
    }
    
    .exercise-board {
        flex-direction: column;
    }
    
    .treatment-cards {
        grid-template-columns: 1fr;
    }
    
    .reflex-answers {
        grid-template-columns: 1fr;
    }
    
    .progress-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .game-title {
        font-size: 2rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .btn {
        padding: 12px 25px;
        font-size: 1rem;
    }
    
    .game-header {
        flex-wrap: wrap;
        gap: 10px;
        justify-content: center;
    }
    
    .progress-stats {
        grid-template-columns: 1fr;
    }
}