/* Human Body Explorer - Styles */

:root {
    --safe-area-bottom: env(safe-area-inset-bottom, 0px);
    --safe-area-top: env(safe-area-inset-top, 0px);
    --primary: #4A90D9;
    --primary-dark: #3A7BC8;
    --secondary: #5CB85C;
    --accent: #F5A623;
    --danger: #D9534F;
    --bg: #F5F7FA;
    --card: #FFFFFF;
    --text: #333333;
    --text-light: #666666;
    --border: #E0E0E0;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --radius: 12px;
    --radius-sm: 8px;
}

.dark-mode {
    --bg: #1A1A2E;
    --card: #16213E;
    --card-bg: #16213E;
    --text: #EAEAEA;
    --text-light: #B0B0B0;
    --border: #2A2A4A;
    --border-color: #2A2A4A;
    --bg-color: #1E2A45;
    --hover-bg: #243352;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
}

#app {
    max-width: 500px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
}

/* Header */
header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    padding-top: calc(12px + var(--safe-area-top));
    background: var(--primary);
    color: white;
    position: sticky;
    top: 0;
    z-index: 100;
}

header h1 {
    font-size: 18px;
    font-weight: 600;
    flex: 1;
    text-align: center;
}

.header-btn {
    width: 44px;
    height: 44px;
    border: none;
    background: rgba(255,255,255,0.2);
    color: white;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    transition: background 0.2s;
}

.header-btn:hover {
    background: rgba(255,255,255,0.3);
}

/* Focus visible for keyboard navigation */
:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
button:focus:not(:focus-visible),
.btn:focus:not(:focus-visible) {
    outline: none;
}

#headerRight {
    width: 44px;
}

/* Connection Status Bar */
.connection-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    background: #ff6b6b;
    color: white;
    font-size: 13px;
    font-weight: 500;
    animation: slideDown 0.3s ease-out;
}

.connection-status.hidden {
    display: none;
}

.connection-status.reconnecting {
    background: #ffa502;
}

.connection-status.offline {
    background: #ff6b6b;
}

.connection-icon {
    font-size: 14px;
}

.connection-retry {
    opacity: 0.8;
    font-size: 12px;
}

.connection-retry::after {
    content: '';
    animation: dots 1.5s infinite;
}

@keyframes dots {
    0%, 20% { content: ''; }
    40% { content: '.'; }
    60% { content: '..'; }
    80%, 100% { content: '...'; }
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* XP Bar */
#xpBarContainer {
    padding: 10px 16px;
    background: var(--card);
    border-bottom: 1px solid var(--border);
}

.xp-bar {
    display: flex;
    align-items: center;
    gap: 10px;
}

.xp-bar.large {
    flex-direction: column;
    gap: 5px;
}

.level-badge {
    width: 44px;
    height: 44px;
    padding: 4px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 16px;
}

.xp-track {
    flex: 1;
    height: 20px;
    background: var(--border);
    border-radius: 10px;
    position: relative;
    overflow: hidden;
}

.xp-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 10px;
    transition: width 0.5s ease;
}

.xp-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
}

/* Screens */
#screens {
    flex: 1;
    position: relative;
}

.screen {
    display: none;
    padding: 16px;
    animation: fadeIn 0.3s ease;
}

.screen.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Main Menu */
.menu-header {
    text-align: center;
    padding: 40px 20px;
}

.app-icon {
    font-size: 80px;
    margin-bottom: 16px;
}

.menu-header h2 {
    font-size: 28px;
    margin-bottom: 8px;
    color: var(--text);
}

.menu-header p {
    color: var(--text-light);
    font-size: 16px;
}

/* ===== NEW MENU DESIGN ===== */

/* Hero Button - Main CTA */
.menu-btn-hero {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 16px;
    margin-top: 10px;
    border: none;
    border-radius: var(--radius);
    background: linear-gradient(135deg, #4A90D9 0%, #3A7BC8 50%, #2D6BB5 100%);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 3px 10px rgba(74, 144, 217, 0.35);
    position: relative;
    overflow: hidden;
}

.menu-btn-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
}

.menu-btn-hero:hover::before {
    left: 100%;
}

.menu-btn-hero:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(74, 144, 217, 0.5);
}

.menu-btn-hero:active {
    transform: scale(0.98);
}

.hero-icon {
    font-size: 28px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

.hero-content {
    flex: 1;
    text-align: left;
}

.hero-title {
    display: block;
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 2px;
}

.hero-subtitle {
    display: block;
    font-size: 12px;
    opacity: 0.85;
}

.hero-arrow {
    font-size: 20px;
    opacity: 0.7;
    transition: transform 0.3s ease;
}

.menu-btn-hero:hover .hero-arrow {
    transform: translateX(5px);
    opacity: 1;
}

/* Menu Grid */
.menu-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 16px;
}

/* Menu Cards */
.menu-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 20px 16px;
    border: none;
    border-radius: var(--radius);
    color: white;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.menu-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.1) 0%, transparent 50%);
    pointer-events: none;
}

.menu-card:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 8px 20px rgba(0,0,0,0.2);
}

.menu-card:active {
    transform: scale(0.96);
}

.card-icon {
    font-size: 36px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

.card-title {
    font-size: 16px;
    font-weight: 700;
}

.card-stat {
    font-size: 12px;
    opacity: 0.8;
    background: rgba(0,0,0,0.2);
    padding: 3px 10px;
    border-radius: 10px;
}

/* Card Colors */
.menu-card.campaign {
    background: linear-gradient(145deg, #5CB85C, #449d44);
}
.menu-card.challenges {
    background: linear-gradient(145deg, #F5A623, #d4910e);
}
.menu-card.pvp {
    background: linear-gradient(145deg, #e74c3c, #c0392b);
}
.menu-card.coop {
    background: linear-gradient(145deg, #FF5722, #E64A19);
}

/* Section Label */
.menu-section-label {
    margin-top: 20px;
    margin-bottom: 4px;
    padding-left: 4px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-light);
    opacity: 0.7;
}

/* Meta Section */
.menu-meta {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.meta-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 20px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-light);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    flex: 1;
    max-width: 100px;
}

.meta-btn span:first-child {
    font-size: 20px;
}

.meta-btn:hover {
    background: var(--border);
    color: var(--text);
    transform: translateY(-2px);
}

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

/* Desktop - larger screens */
@media (min-width: 600px) {
    .menu-btn-hero {
        padding: 14px 20px;
    }

    .hero-icon {
        font-size: 32px;
    }

    .hero-title {
        font-size: 17px;
    }

    .hero-subtitle {
        font-size: 13px;
    }

    .menu-grid {
        gap: 16px;
    }

    .menu-card {
        padding: 28px 20px;
    }

    .card-icon {
        font-size: 42px;
    }

    .card-title {
        font-size: 18px;
    }

    .meta-btn {
        padding: 14px 24px;
        max-width: 120px;
    }
}

/* OLD MENU - Keep for compatibility but hidden */
.menu-buttons {
    display: none;
}

.menu-btn {
    display: none;
}

.settings-btn {
    display: none;
}

/* Campaign */
.campaign-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: var(--radius);
    color: white;
    margin-bottom: 16px;
}

.campaign-icon {
    font-size: 36px;
}

.campaign-info h3 {
    font-size: 20px;
    margin-bottom: 4px;
}

.campaign-info p {
    font-size: 14px;
    opacity: 0.9;
}

.campaign-info span {
    font-weight: 600;
}

.chapter-info p {
    font-size: 14px;
    opacity: 0.9;
}

.chapter-progress {
    margin-left: auto;
    background: rgba(255,255,255,0.2);
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 14px;
}

.lessons-list {
    padding: 8px;
}

.chapter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    margin-top: 16px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: var(--radius-sm);
    color: white;
}

.chapter-header:first-child {
    margin-top: 0;
}

.chapter-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chapter-icon {
    font-size: 20px;
}

.chapter-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: white;
}

.chapter-progress {
    font-size: 13px;
    color: white;
    background: rgba(255,255,255,0.2);
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: 600;
}

/* PRO Badge i Locked styles */
.pro-badge {
    display: inline-block;
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: #333;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.chapter-header.pro-locked {
    background: linear-gradient(135deg, #666, #444);
    opacity: 0.7;
}

.challenge-section-header.pro-locked {
    opacity: 0.7;
}

.challenge-section-header.pro-locked .difficulty-name {
    color: #888;
}

.chapter-progress.complete {
    background: rgba(92, 184, 92, 0.8);
}

.lesson-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.2s;
}

.lesson-item:hover {
    background: var(--bg);
}

.lesson-item.locked {
    opacity: 0.5;
    cursor: not-allowed;
}

.lesson-item.completed {
    background: rgba(92, 184, 92, 0.1);
}

.lesson-number {
    width: 32px;
    height: 32px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
}

.lesson-item.completed .lesson-number {
    background: var(--secondary);
}

.lesson-item.locked .lesson-number {
    background: var(--text-light);
}

.lesson-item.boss {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeeba 100%);
    border: 2px solid #ffc107;
}

.lesson-item.boss .lesson-number {
    background: linear-gradient(135deg, #ffc107 0%, #ff9800 100%);
    font-size: 18px;
    width: 40px;
    height: 40px;
}

.dark-mode .lesson-item.locked {
    opacity: 1;
    background: rgba(255, 255, 255, 0.045);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.dark-mode .lesson-item.locked .lesson-info h4 {
    color: rgba(234, 234, 234, 0.82);
}

.dark-mode .lesson-item.locked .lesson-info p {
    color: rgba(234, 234, 234, 0.62);
}

.dark-mode .lesson-item.locked .lesson-status {
    color: rgba(234, 234, 234, 0.82);
}

.dark-mode .lesson-item.locked .lesson-number {
    background: rgba(255, 255, 255, 0.18);
    color: rgba(255, 255, 255, 0.86);
}

.dark-mode .lesson-item.boss {
    background: linear-gradient(135deg, rgba(126, 84, 15, 0.44) 0%, rgba(76, 52, 17, 0.72) 100%);
    border-color: rgba(255, 193, 7, 0.68);
}

.dark-mode .lesson-item.boss .lesson-info h4 {
    color: #ffe7a3;
}

.dark-mode .lesson-item.boss .lesson-info p {
    color: rgba(255, 245, 214, 0.74);
}

.dark-mode .lesson-item.boss.locked {
    background: linear-gradient(135deg, rgba(119, 86, 28, 0.36) 0%, rgba(60, 48, 35, 0.68) 100%);
}

.lesson-info {
    flex: 1;
}

.lesson-info h4 {
    font-size: 15px;
    margin-bottom: 2px;
}

.lesson-info p {
    font-size: 12px;
    color: var(--text-light);
}

.lesson-status {
    font-size: 20px;
}

/* Lesson */
.slide-container {
    text-align: center;
    padding: 20px 0;
}

.slide-image {
    font-size: 120px;
    margin-bottom: 24px;
}

.slide-title {
    font-size: 24px;
    margin-bottom: 16px;
    color: var(--text);
}

.slide-content {
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-light);
    padding: 0 10px;
}
/* Lekcje z listą (numeracja/numery alarmowe od nowej linii) czytają się lepiej do lewej,
   jak kroki w Mechanizmach — zamiast wyśrodkowanego bloku. */
.slide-content.has-list {
    text-align: left;
    max-width: 540px;
    margin-left: auto;
    margin-right: auto;
}
.slide-content.has-list br + br { content: ''; }
.slide-content strong { font-weight: 700; }

.slide-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 0;
    margin-top: 20px;
    border-top: 1px solid var(--border);
}

.nav-btn {
    padding: 12px 24px;
    border: 1px solid var(--border);
    background: var(--card);
    border-radius: var(--radius-sm);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.nav-btn:hover {
    background: var(--bg);
}

.nav-btn.primary {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.nav-btn.primary:hover {
    background: var(--primary-dark);
}

.slide-counter {
    color: var(--text-light);
    font-size: 14px;
}

/* Quiz */
.quiz-progress {
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    margin-bottom: 24px;
    overflow: hidden;
}

.quiz-progress-fill {
    height: 100%;
    background: var(--secondary);
    transition: width 0.3s;
}

.quiz-container {
    text-align: center;
}

/* Quiz Animation */
.quiz-animation-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.quiz-animation-wrapper canvas {
    background: linear-gradient(145deg, #1a2a3a, #0d1520);
    border-radius: var(--radius);
    border: 2px solid var(--border);
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.quiz-question {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 24px;
    line-height: 1.4;
}

.quiz-answers {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.answer-btn {
    padding: 16px 20px;
    background: var(--card);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 16px;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
}

.answer-btn:hover {
    border-color: var(--primary);
    background: rgba(74, 144, 217, 0.05);
}

.answer-btn.correct {
    border-color: var(--secondary);
    background: rgba(92, 184, 92, 0.15);
}

.answer-btn.incorrect {
    border-color: var(--danger);
    background: rgba(217, 83, 79, 0.15);
}

.answer-btn.disabled {
    pointer-events: none;
}

/* Dark mode quiz answers */
.dark-mode .answer-btn {
    color: #FFFFFF;
    background: var(--card);
    border-color: var(--border);
}

.dark-mode .answer-btn:hover {
    color: #FFFFFF;
    background: rgba(74, 144, 217, 0.15);
}

.dark-mode .answer-btn.correct {
    color: #FFFFFF;
    background: rgba(92, 184, 92, 0.25);
}

.dark-mode .answer-btn.incorrect {
    color: #FFFFFF;
    background: rgba(217, 83, 79, 0.25);
}

.quiz-feedback {
    text-align: center;
    padding: 20px;
    margin-top: 20px;
    border-radius: var(--radius);
    animation: fadeIn 0.3s;
}

.quiz-feedback.correct {
    background: rgba(92, 184, 92, 0.15);
}

.quiz-feedback.incorrect {
    background: rgba(217, 83, 79, 0.15);
}

.feedback-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 8px;
}

.feedback-text {
    font-size: 16px;
    color: var(--text);
}

/* Results */
.results-container {
    text-align: center;
    padding: 40px 20px;
}

.results-icon {
    font-size: 80px;
    margin-bottom: 16px;
}

.results-title {
    font-size: 28px;
    margin-bottom: 16px;
}

.results-score {
    font-size: 20px;
    color: var(--text-light);
    margin-bottom: 8px;
}

.results-xp {
    font-size: 24px;
    color: var(--secondary);
    font-weight: bold;
    margin-bottom: 24px;
}

.results-time {
    font-size: 16px;
    color: var(--text-light);
    margin-bottom: 8px;
}

.stars {
    font-size: 36px;
    margin: 16px 0;
}

/* Body Viewer */
.breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
    padding: 10px;
    background: var(--card);
    border-radius: var(--radius-sm);
}

.crumb {
    padding: 6px 12px;
    background: var(--bg);
    border-radius: 16px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s;
}

.crumb:hover {
    background: var(--primary);
    color: white;
}

.crumb:last-child {
    background: var(--primary);
    color: white;
}

.body-parts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

/* Root level exploration (Części Ciała / Układy Ciała) - full width like Basic/Advanced */
.body-parts-grid.root-categories {
    display: flex;
    gap: 12px;
}

.body-parts-grid.root-categories .body-part-card {
    flex: 1;
    min-width: 0;
    padding: 16px 8px;
    overflow: hidden;
}

.parts-grid-header {
    grid-column: 1 / -1;
    font-size: 13px;
    color: var(--text-light);
    padding: 8px 0;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--border);
}

.parts-grid-header strong {
    color: var(--primary);
}

.deepest-level-hint {
    grid-column: 1 / -1;
    width: 100%;
    text-align: center;
    font-size: 12px;
    color: var(--text-muted, rgba(255,255,255,0.4));
    font-style: italic;
    padding: 16px 0;
    margin: 0;
    background: none;
    border: none;
    box-shadow: none;
}

.body-part-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 20px 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow);
    border: 2px solid transparent;
}

.body-part-card:hover {
    transform: translateY(-3px);
    border-color: var(--primary);
    background: rgba(74, 144, 226, 0.08);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.body-part-card:active {
    transform: translateY(-1px);
}

.body-part-card.discovered {
    border-color: var(--secondary);
    background: rgba(92, 184, 92, 0.05);
}

.body-part-card.new::after {
    content: 'NEW';
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--accent);
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
}

.body-part-icon {
    font-size: 48px;
    margin-bottom: 8px;
}

.body-part-name {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
}

.body-parts-grid.root-categories .body-part-name {
    font-size: 12px;
}

.body-parts-grid.root-categories .body-part-type,
.body-parts-grid.root-categories .name-extras {
    font-size: 10px;
}

.body-part-name .name-extras {
    font-size: 12px;
    font-weight: 400;
    color: var(--text-light);
    display: block;
    margin-top: 2px;
    font-style: italic;
}

.body-part-type {
    font-size: 12px;
    color: var(--text-light);
}

.body-part-card.has-children::after {
    content: '▶';
    position: absolute;
    bottom: 8px;
    right: 8px;
    color: var(--text-light);
    font-size: 12px;
}

.body-part-card {
    position: relative;
}

/* Info Panel */
.info-panel {
    margin-top: 16px;
    padding: 20px;
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    animation: slideUp 0.3s ease;
    border-top: 3px solid var(--primary);
}

.info-panel-header {
    font-size: 12px;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.info-panel h3 {
    font-size: 22px;
    margin-bottom: 4px;
}

.info-latin {
    font-style: italic;
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 4px;
}

.info-type {
    color: var(--primary);
    font-size: 14px;
    margin-bottom: 12px;
}

.info-desc {
    font-size: 15px;
    line-height: 1.5;
    color: var(--text);
    margin-bottom: 16px;
}

.info-details {
    border-top: 1px solid var(--border);
    padding-top: 16px;
}

.detail {
    margin-bottom: 12px;
}

.detail-label {
    display: block;
    font-size: 12px;
    color: var(--text-light);
    margin-bottom: 4px;
}

.detail span:last-child {
    font-size: 14px;
}

.fun-fact {
    background: rgba(245, 166, 35, 0.1);
    padding: 12px;
    border-radius: var(--radius-sm);
}

#infoMechanismContainer {
    background: rgba(100, 180, 255, 0.1);
    padding: 12px;
    border-radius: var(--radius-sm);
}

#infoMechanism {
    white-space: pre-line;
}

#infoProcessContainer {
    background: rgba(100, 255, 180, 0.1);
    padding: 12px;
    border-radius: var(--radius-sm);
}

#infoProcess {
    white-space: pre-line;
}

/* Challenges */
.section-title {
    font-size: 20px;
    margin-bottom: 16px;
}

.challenges-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.challenge-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: all 0.2s;
}

.challenge-card:hover {
    transform: translateY(-2px);
}

.challenge-card.completed {
    opacity: 0.6;
}

.challenge-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.challenge-icon {
    font-size: 32px;
}

.challenge-info h4 {
    font-size: 16px;
    margin-bottom: 2px;
}

.challenge-info p {
    font-size: 13px;
    color: var(--text-light);
}

.challenge-meta {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: var(--text-light);
}

.challenge-xp {
    color: var(--secondary);
    font-weight: 600;
}

/* Challenge Section Headers */
.section-subtitle {
    font-size: 14px;
    color: var(--text-light);
    margin-top: -12px;
    margin-bottom: 16px;
}

.challenge-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: var(--card);
    border-radius: var(--radius-sm);
    border-left: 4px solid var(--primary);
    margin-top: 8px;
}

.challenge-section-header:first-child {
    margin-top: 0;
}

.difficulty-name {
    font-weight: 600;
    font-size: 15px;
}

.difficulty-progress {
    font-size: 13px;
    color: var(--text-light);
    background: var(--bg);
    padding: 4px 10px;
    border-radius: 12px;
}

/* Difficulty-specific colors */
.difficulty-easy {
    border-left: 3px solid #4CAF50;
}

.difficulty-medium {
    border-left: 3px solid #FF9800;
}

.difficulty-hard {
    border-left: 3px solid #f44336;
}

.difficulty-expert {
    border-left: 3px solid #9C27B0;
}

.difficulty-nightmare {
    border-left: 3px solid #FF1744;
    background: linear-gradient(135deg, rgba(255,23,68,0.1), transparent);
}

/* Challenge Categories (Starter / Advanced) */
.challenge-categories {
    display: flex;
    gap: 12px;
    margin: 16px 0 8px;
}

.challenge-category-btn {
    flex: 1;
    padding: 16px 12px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.challenge-category-btn:hover {
    border-color: var(--cat-color);
    transform: translateY(-2px);
}

.challenge-category-btn.active {
    border-color: var(--cat-color);
    background: linear-gradient(135deg, color-mix(in srgb, var(--cat-color) 15%, transparent), transparent);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.challenge-category-btn .cat-icon {
    font-size: 24px;
    line-height: 1;
}

.challenge-category-btn .cat-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.challenge-category-btn .cat-progress {
    font-size: 12px;
    color: var(--text-light);
    background: var(--bg);
    padding: 4px 8px;
    border-radius: 12px;
}

.challenge-category-btn.active .cat-name {
    color: var(--cat-color);
}

/* Clinical Cases Button */
.clinical-cases-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px 20px;
    margin: 16px 0;
    background: linear-gradient(135deg, #00897B, #26A69A);
    border: none;
    border-radius: var(--radius);
    color: white;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
}

.clinical-cases-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 137, 123, 0.4);
}

.clinical-cases-btn .btn-icon {
    font-size: 24px;
}

.clinical-cases-btn .btn-badge {
    background: #FF5722;
    color: white;
    font-size: 10px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 8px;
    animation: pulse-badge 2s infinite;
}

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

/* Clinical Cases */
.clinical-cases-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 16px 0;
}

.clinical-case-cards-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.clinical-case-card {
    background: var(--card);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s;
}

.clinical-case-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.clinical-case-card.completed {
    border-color: var(--success);
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.1), transparent);
}

.case-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.case-patient {
    display: flex;
    align-items: center;
    gap: 12px;
}

.case-patient-icon {
    font-size: 32px;
}

.case-patient-info h4 {
    margin: 0;
    font-size: 16px;
    color: var(--text);
}

.case-patient-info span {
    font-size: 12px;
    color: var(--text-light);
}

.case-difficulty {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.case-difficulty.easy { background: rgba(76, 175, 80, 0.2); color: #4CAF50; }
.case-difficulty.medium { background: rgba(255, 152, 0, 0.2); color: #FF9800; }
.case-difficulty.hard { background: rgba(244, 67, 54, 0.2); color: #f44336; }

.case-symptoms {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.case-symptom {
    background: var(--bg);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    color: var(--text-light);
}

.case-xp {
    text-align: right;
    font-size: 14px;
    color: var(--primary);
    font-weight: 600;
    margin-top: 12px;
}

.case-xp.penalty {
    color: #f44336;
}

.case-xp.penalty .original {
    color: #999;
    margin-right: 6px;
    text-decoration: line-through;
}

.case-xp.completed {
    color: var(--success);
}

/* Cases Progress Header */
.cases-progress-header {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 16px;
    color: white;
}

.cases-progress-header .progress-info {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.cases-progress-header .progress-icon {
    font-size: 24px;
}

.cases-progress-header .progress-text {
    font-weight: 600;
    font-size: 16px;
}

.cases-progress-header .progress-bar-container {
    height: 8px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    overflow: hidden;
}

.cases-progress-header .progress-bar-fill {
    height: 100%;
    background: white;
    border-radius: 4px;
    transition: width 0.3s;
}

/* Active Clinical Case */
.clinical-case-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 16px;
}

.case-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.case-errors {
    display: flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, #f44336, #d32f2f);
    padding: 8px 14px;
    border-radius: 20px;
    color: white;
    font-weight: 600;
}

.case-errors .errors-icon {
    font-size: 16px;
}

.case-errors .errors-value {
    font-size: 14px;
}

.case-progress {
    background: var(--bg);
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    color: var(--text);
}

/* Clinical Case Results */
.results-score {
    font-size: 18px;
    color: var(--text);
    margin: 8px 0;
}

.results-errors {
    font-size: 14px;
    color: #f44336;
    margin: 4px 0;
}

.results-diagnosis {
    font-size: 14px;
    color: var(--text-light);
    margin: 12px 0;
    padding: 12px;
    background: var(--bg);
    border-radius: var(--radius);
}

.case-content {
    background: var(--card);
    border-radius: var(--radius);
    padding: 24px;
    min-height: 300px;
}

.case-info-card {
    text-align: center;
}

.case-info-card .patient-avatar {
    font-size: 64px;
    margin-bottom: 16px;
}

.case-info-card h3 {
    margin: 0 0 8px;
    color: var(--text);
}

.case-info-card .patient-details {
    color: var(--text-light);
    margin-bottom: 24px;
}

.case-info-card .info-text {
    background: var(--bg);
    padding: 16px;
    border-radius: var(--radius);
    margin-bottom: 24px;
    text-align: left;
    line-height: 1.6;
    color: var(--text);
}

.case-symptoms-list {
    text-align: left;
    margin-bottom: 24px;
}

.case-symptoms-list h4 {
    margin: 0 0 12px;
    color: var(--text);
}

.case-symptoms-list ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.case-symptoms-list li {
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    color: var(--text-light);
}

.case-symptoms-list li::before {
    content: "• ";
    color: var(--primary);
}

.case-navigate-prompt {
    text-align: center;
}

.case-navigate-prompt h3 {
    margin: 0 0 16px;
    color: var(--text);
}

.case-navigate-prompt .hint {
    background: var(--bg);
    padding: 12px 20px;
    border-radius: var(--radius);
    color: var(--text-light);
    margin-bottom: 24px;
    display: inline-block;
}

.case-quiz-container h3 {
    margin: 0 0 24px;
    color: var(--text);
    text-align: center;
}

.case-quiz-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.case-quiz-option {
    padding: 16px;
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    font-size: 15px;
    color: var(--text);
}

.case-quiz-option:hover {
    border-color: var(--primary);
    background: var(--card);
}

.case-quiz-option.selected {
    border-color: var(--primary);
    background: rgba(33, 150, 243, 0.1);
}

.case-quiz-option.correct {
    border-color: var(--success);
    background: rgba(76, 175, 80, 0.1);
}

.case-quiz-option.incorrect {
    border-color: var(--danger);
    background: rgba(244, 67, 54, 0.1);
}

.case-action-btn {
    margin-top: 24px;
    width: 100%;
}

/* ==================== MECHANISM CHALLENGES ==================== */

.mechanism-challenges-list,
.mechanism-challenges-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.mechanism-challenge-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    gap: 16px;
}

.mechanism-challenge-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.mechanism-challenge-card.completed {
    opacity: 0.7;
}

.mechanism-challenge-card .card-icon {
    font-size: 32px;
    min-width: 48px;
    text-align: center;
}

.mechanism-challenge-card .card-info {
    flex: 1;
}

.mechanism-challenge-card .card-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.mechanism-challenge-card .card-meta {
    font-size: 12px;
    color: var(--text-light);
    display: flex;
    gap: 12px;
}

.mechanism-challenge-card .challenge-xp {
    margin-left: auto;
    font-size: 14px;
    color: var(--accent);
    font-weight: 600;
}

.mechanism-challenge-card .challenge-xp.completed {
    color: var(--secondary);
    font-size: 18px;
}

.mechanism-challenge-card .challenge-xp.penalty {
    color: #f44336;
}

.mechanism-challenge-card .challenge-xp.penalty .original {
    color: #999;
    margin-right: 6px;
    text-decoration: line-through;
}

/* Active Mechanism Challenge */
.mechanism-challenge-header {
    text-align: center;
    margin-bottom: 24px;
}

.mechanism-title {
    margin-top: 12px;
    font-size: 20px;
    font-weight: 600;
}

.mechanism-challenge-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 20px;
}

.mechanism-animation-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px;
}

#mechanismAnimationCanvas {
    width: 150px;
    height: 150px;
    background: linear-gradient(135deg, rgba(26, 26, 46, 0.8), rgba(26, 26, 46, 1));
    border-radius: var(--radius);
}

.mechanism-steps-panel {
    padding: 0 16px;
}

.mechanism-steps-panel h4 {
    margin-bottom: 12px;
    color: var(--text-light);
    font-size: 14px;
    font-weight: 500;
}

.mechanism-slots {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mechanism-slot {
    min-height: 48px;
    border: 2px dashed var(--border);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    padding: 8px 12px;
    transition: all 0.2s;
    position: relative;
}

.mechanism-slot .slot-number {
    font-size: 16px;
    font-weight: bold;
    color: var(--text-light);
    margin-right: 12px;
    min-width: 24px;
}

.mechanism-slot .slot-content {
    flex: 1;
    min-height: 36px;
    display: flex;
    align-items: center;
}

.mechanism-slot.drag-over {
    border-color: var(--primary);
    background: rgba(78, 205, 196, 0.15);
    transform: scale(1.01);
}

.mechanism-slot.filled {
    border-style: solid;
    border-color: var(--secondary);
    background: rgba(39, 174, 96, 0.08);
}

.mechanism-slot.correct {
    border-color: var(--secondary);
    background: rgba(39, 174, 96, 0.15);
}

.mechanism-slot.wrong {
    border-color: #f44336;
    background: rgba(244, 67, 54, 0.15);
    animation: shake 0.4s ease;
}

.mechanism-slot .result-icon {
    position: absolute;
    right: 16px;
    font-size: 22px;
}

/* Source Steps Panel */
.mechanism-source-panel {
    padding: 0 16px;
    margin-bottom: 16px;
}

.mechanism-source-panel p {
    color: var(--text-light);
    margin-bottom: 10px;
    font-size: 14px;
    font-weight: 500;
}

.mechanism-source-steps {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 60px;
    padding: 12px;
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    align-items: flex-start;
}

.mechanism-step {
    padding: 10px 14px;
    background: var(--primary);
    color: white;
    border-radius: var(--radius-sm);
    cursor: grab;
    user-select: none;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
}

.mechanism-step:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.mechanism-step.dragging {
    opacity: 0.6;
    cursor: grabbing;
}

.mechanism-step.in-slot {
    background: var(--secondary);
    cursor: default;
}

.mechanism-check-btn {
    display: block;
    width: calc(100% - 32px);
    margin: 0 16px;
    padding: 14px;
    font-size: 16px;
    font-weight: 600;
}

.mechanism-check-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Shake animation */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-5px); }
    40%, 80% { transform: translateX(5px); }
}

/* Guest Notice */
.guest-notice {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    margin: 16px 0;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border-radius: var(--radius);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.guest-notice:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.3);
}

.guest-notice .notice-icon {
    font-size: 24px;
}

.guest-notice .notice-text {
    color: white;
    font-weight: 500;
    flex: 1;
}

/* Challenges Overall Stats */
.challenges-overall-stats {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 16px;
    color: white;
}

.overall-progress-text {
    text-align: center;
    margin-bottom: 10px;
    font-size: 16px;
}

.overall-progress-text strong {
    font-size: 20px;
}

.overall-progress-bar {
    height: 10px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 5px;
    overflow: hidden;
}

.overall-progress-fill {
    height: 100%;
    background: white;
    border-radius: 5px;
    transition: width 0.5s ease;
}

/* XP Earned Badge */
.xp-earned {
    display: inline-block;
    background: rgba(76, 175, 80, 0.2);
    color: #4CAF50;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    margin-left: 6px;
    font-weight: 600;
}

.challenges-overall-stats .xp-earned {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.category-progress .xp-earned {
    display: block;
    margin-left: 0;
    margin-top: 4px;
}

/* Challenges Menu */
.challenges-menu {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 16px 0;
}

.challenge-category-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: var(--card);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.challenge-category-card:hover {
    border-color: var(--primary);
    transform: translateX(4px);
}

.challenge-category-card .category-icon {
    font-size: 40px;
}

.challenge-category-card .category-info {
    flex: 1;
}

.challenge-category-card .category-info h4 {
    margin: 0 0 4px;
    color: var(--text);
    font-size: 18px;
}

.challenge-category-card .category-info p {
    margin: 0;
    color: var(--text-light);
    font-size: 14px;
}

.challenge-category-card .category-progress {
    font-size: 14px;
    color: var(--primary);
    font-weight: 600;
}

.challenge-category-card .category-arrow {
    font-size: 24px;
    color: var(--text-light);
}

.challenge-category-card.completed {
    border-color: var(--success);
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.1), transparent);
}

.challenge-category-card.completed .category-progress {
    color: var(--success);
}

.challenge-category-card.locked,
.challenge-category-btn.locked,
.clinical-case-card.locked,
.mechanism-challenge-card.locked {
    opacity: 0.5;
    cursor: not-allowed;
}

.challenge-category-card.locked:hover,
.challenge-category-btn.locked:hover,
.clinical-case-card.locked:hover,
.mechanism-challenge-card.locked:hover {
    border-color: var(--border);
    transform: none;
}

/* Specialty cards container */
.specialty-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Challenge Tabs */
.challenge-tabs {
    display: flex;
    gap: 8px;
    margin: 16px 0;
    padding: 8px;
    background: var(--card);
    border-radius: var(--radius);
    overflow-x: auto;
}

.challenge-tab {
    flex: 1;
    min-width: 60px;
    padding: 12px 8px;
    border: none;
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
    border-bottom: 3px solid transparent;
}

.challenge-tab:hover:not(.locked) {
    background: rgba(0,0,0,0.05);
}

.challenge-tab.active {
    background: rgba(0,0,0,0.08);
    border-bottom-color: var(--tab-color);
}

.challenge-tab.locked {
    opacity: 0.5;
    cursor: not-allowed;
}

.challenge-tab .tab-icon {
    font-size: 24px;
}

.challenge-tab .tab-progress {
    font-size: 12px;
    color: var(--text-light);
    font-weight: 500;
}

.challenge-cards-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Challenge card adjustments */
.challenge-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 0;
}

.challenge-card .challenge-xp {
    margin-left: auto;
    font-size: 14px;
}

.challenge-card .challenge-xp.penalty {
    color: #f44336;
}

.challenge-card .challenge-xp.penalty .original {
    color: #999;
    margin-right: 6px;
    text-decoration: line-through;
}

.challenge-card .challenge-xp.completed {
    color: #4CAF50;
    font-size: 18px;
}

/* Challenges Summary */
.challenges-summary {
    margin-top: 20px;
    padding: 16px;
    background: var(--card);
    border-radius: var(--radius);
    text-align: center;
}

.summary-text {
    font-size: 14px;
    margin-bottom: 10px;
}

.summary-bar {
    height: 8px;
    background: var(--bg);
    border-radius: 4px;
    overflow: hidden;
}

.summary-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--secondary), var(--primary));
    border-radius: 4px;
    transition: width 0.5s ease;
}

/* Active Challenge */
.challenge-header {
    text-align: center;
    margin-bottom: 20px;
}

.timer {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--card);
    padding: 12px 24px;
    border-radius: 30px;
    box-shadow: var(--shadow);
}

.timer-icon {
    font-size: 24px;
}

.timer-value {
    font-size: 32px;
    font-weight: bold;
    min-width: 60px;
}

.timer.warning .timer-value {
    color: var(--accent);
}

.timer.danger .timer-value {
    color: var(--danger);
    animation: pulse 0.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.challenge-target {
    text-align: center;
    margin-bottom: 20px;
}

.challenge-target p {
    color: var(--text-light);
    margin-bottom: 8px;
}

.target-name {
    font-size: 28px;
    font-weight: bold;
}

/* Case Navigation Hint */
.case-nav-hint {
    text-align: center;
    margin-bottom: 16px;
}

.case-nav-hint .hint {
    display: inline-block;
    padding: 10px 16px;
    background: rgba(245, 166, 35, 0.15);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text);
}

.challenge-body-parts {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.hint-btn {
    display: block;
    width: 100%;
    padding: 14px;
    background: var(--card);
    border: 2px solid var(--accent);
    border-radius: var(--radius-sm);
    color: var(--accent);
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
}

.hint-btn:hover {
    background: var(--accent);
    color: white;
}

.hint-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.hint-text {
    margin-top: 12px;
    padding: 12px;
    background: rgba(245, 166, 35, 0.15);
    border-radius: var(--radius-sm);
    font-size: 14px;
    animation: fadeIn 0.3s;
}

/* Profile */
.profile-header {
    text-align: center;
    padding: 20px;
}

.avatar {
    font-size: 64px;
    margin-bottom: 12px;
}

.profile-header h3 {
    font-size: 24px;
    margin-bottom: 4px;
}

.player-level {
    color: var(--primary);
    font-size: 16px;
}

.profile-xp {
    padding: 0 20px;
    margin-bottom: 24px;
}

.xp-bar.large .xp-track {
    width: 100%;
    height: 12px;
}

.xp-label {
    text-align: center;
    font-size: 13px;
    color: var(--text-light);
    margin-top: 8px;
}

.profile-tabs {
    display: flex;
    gap: 8px;
    padding: 0 16px;
    margin-bottom: 16px;
}

.tab-btn {
    flex: 1;
    padding: 12px;
    background: var(--card);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn.active {
    border-color: var(--primary);
    background: rgba(74, 144, 217, 0.1);
    color: var(--primary);
}

.profile-tab-content {
    padding: 0 16px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
    font-size: 15px;
}

.stat-row span:last-child {
    font-weight: 600;
}

.achievements-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.achievement-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    background: var(--card);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
}

.achievement-item.locked {
    opacity: 0.5;
}

.achievement-icon {
    font-size: 32px;
}

.achievement-info {
    flex: 1;
}

.achievement-info h4 {
    font-size: 15px;
    margin-bottom: 2px;
}

.achievement-info p {
    font-size: 12px;
    color: var(--text-light);
}

.achievement-check {
    font-size: 20px;
    color: var(--secondary);
}

/* Settings */
.settings-list {
    background: var(--card);
    border-radius: var(--radius);
    padding: 8px 0;
    margin-bottom: 24px;
}

.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.setting-row:last-child {
    border-bottom: none;
}

.setting-row select {
    padding: 8px 12px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    cursor: pointer;
    min-width: 120px;
}

.setting-row select:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-color: var(--primary);
}

.switch {
    position: relative;
    width: 56px;
    height: 34px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--border);
    transition: 0.3s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background: white;
    transition: 0.3s;
    border-radius: 50%;
}

input:checked + .slider {
    background: var(--secondary);
}

input:checked + .slider:before {
    transform: translateX(22px);
}

.app-info {
    text-align: center;
    color: var(--text-light);
    font-size: 13px;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 14px 32px;
    background: var(--card);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn:hover {
    background: var(--bg);
}

.btn.primary {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.btn.primary:hover {
    background: var(--primary-dark);
}

.btn.danger {
    background: var(--card);
    border-color: var(--danger);
    color: var(--danger);
}

.btn.danger:hover {
    background: var(--danger);
    color: white;
}

/* Popups */
.popup {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s;
}

.popup-content {
    background: var(--card);
    border-radius: var(--radius);
    padding: 32px 24px;
    text-align: center;
    max-width: 320px;
    width: 90%;
    animation: popIn 0.3s;
}

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

.popup-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.popup-content h3 {
    font-size: 22px;
    margin-bottom: 12px;
}

.achievement-name {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 4px;
}

.achievement-desc {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 8px;
}

.achievement-xp {
    font-size: 20px;
    color: var(--secondary);
    font-weight: bold;
    margin-bottom: 20px;
}

.new-level {
    font-size: 48px;
    font-weight: bold;
    color: var(--primary);
    margin-bottom: 20px;
}

/* XP Gain Animation */
.xp-gain {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--secondary);
    color: white;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 16px;
    font-weight: bold;
    z-index: 1000;
    animation: xpFloat 2s forwards;
}

@keyframes xpFloat {
    0% { opacity: 0; transform: translateX(-50%) translateY(20px); }
    20% { opacity: 1; transform: translateX(-50%) translateY(0); }
    80% { opacity: 1; transform: translateX(-50%) translateY(-20px); }
    100% { opacity: 0; transform: translateX(-50%) translateY(-40px); }
}

/* Utilities */
.hidden {
    display: none !important;
}

/* Responsive */
@media (min-width: 600px) {
    .body-parts-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

/* Pro Mode Styles */
.pro-label {
    font-size: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 8px;
    font-weight: 600;
}

.pro-setting {
    border: 1px solid #764ba2;
    border-radius: var(--radius-sm);
    padding: 12px !important;
    margin: 8px 0;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
}

/* ==================== LEADERBOARD ==================== */
.leaderboard-tabs {
    display: flex;
    gap: 8px;
    padding: 0 15px 12px;
}
.leaderboard-tab {
    flex: 1;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text);
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}
.leaderboard-tab.active {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #0f172a;
    border-color: transparent;
}
.leaderboard-list {
    padding: 0 15px 20px;
}
.leaderboard-row {
    display: grid;
    grid-template-columns: 48px 1fr auto auto;
    gap: 10px;
    align-items: center;
    padding: 10px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
    font-size: 14px;
}
.leaderboard-row .lb-rank { font-size: 18px; text-align: center; font-weight: 700; }
.leaderboard-row .lb-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leaderboard-row .lb-value { font-weight: 700; color: #f59e0b; }
.leaderboard-row .lb-detail { color: var(--text-light); font-size: 12px; min-width: 70px; text-align: right; }
.leaderboard-loading { text-align: center; padding: 40px; color: var(--text-light); }
.leaderboard-row.unqualified { opacity: 0.5; }
.leaderboard-row.unqualified .lb-value { color: var(--text-light); }
.leaderboard-row.is-me {
    background: linear-gradient(135deg, rgba(251,191,36,0.15), rgba(245,158,11,0.15));
    border-color: rgba(251,191,36,0.6);
}

.my-rank-banner {
    margin: 8px 15px 12px;
    padding: 10px 12px;
    background: linear-gradient(135deg, rgba(251,191,36,0.12), rgba(245,158,11,0.08));
    border: 1px solid rgba(251,191,36,0.4);
    border-radius: var(--radius);
}
.my-rank-banner .my-rank-label {
    font-size: 11px;
    font-weight: 700;
    color: #f59e0b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}
.my-rank-banner .leaderboard-row { margin: 0; }

.leaderboard-search {
    padding: 0 15px 10px;
}
.leaderboard-search input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    box-sizing: border-box;
}
.leaderboard-search input:focus {
    outline: none;
    border-color: #f59e0b;
}

/* ==================== COMING SOON CARD ==================== */
.coming-soon-card {
    margin: 16px 15px 20px;
    padding: 18px;
    background: linear-gradient(135deg, rgba(139,92,246,0.12), rgba(59,130,246,0.12));
    border: 1px dashed rgba(139,92,246,0.5);
    border-radius: var(--radius);
    text-align: center;
}
.coming-soon-icons {
    display: flex;
    justify-content: center;
    gap: 14px;
    font-size: 36px;
    margin-bottom: 8px;
    opacity: 0.75;
}
.coming-soon-icons .cs-icon {
    filter: grayscale(0.3);
}
.coming-soon-title {
    font-weight: 700;
    font-size: 16px;
    color: var(--text);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}
.cs-badge {
    background: linear-gradient(135deg, #8b5cf6, #3b82f6);
    color: #fff;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.coming-soon-desc {
    font-size: 13px;
    color: var(--text-light);
    margin: 0;
    line-height: 1.4;
}

/* ==================== SOLO MINIGAMES ==================== */

.menu-btn-hero.minigames-hero {
    background: linear-gradient(135deg, #8b5cf6 0%, #d946ef 50%, #ec4899 100%);
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
}
.menu-btn-hero.minigames-hero:hover {
    box-shadow: 0 8px 25px rgba(139, 92, 246, 0.5);
}

.menu-btn-hero.campaign-hero {
    background: linear-gradient(135deg, #f59e0b 0%, #ef4444 50%, #dc2626 100%);
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
}
.menu-btn-hero.campaign-hero:hover {
    box-shadow: 0 8px 25px rgba(239, 68, 68, 0.5);
}

.menu-btn-hero.challenges-hero {
    background: linear-gradient(135deg, #10b981 0%, #059669 50%, #047857 100%);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
}
.menu-btn-hero.challenges-hero:hover {
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.5);
}

.menu-btn-hero.explorer3d-hero {
    background: linear-gradient(135deg, #06b6d4 0%, #0e8aa8 50%, #6d28d9 100%);
    box-shadow: 0 4px 15px rgba(13, 148, 200, 0.4);
}
.menu-btn-hero.explorer3d-hero:hover {
    box-shadow: 0 8px 25px rgba(13, 148, 200, 0.5);
}

.minigames-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    padding: 10px 0 20px;
}

.minigame-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px 12px;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    text-align: center;
    color: var(--text);
    font-family: inherit;
}

.minigame-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.2);
    border-color: #8b5cf6;
}

.minigame-card:active { transform: translateY(0); }

.minigame-card .mg-icon { font-size: 32px; margin-bottom: 4px; }
.minigame-card .mg-title { font-weight: 700; font-size: 14px; }
.minigame-card .mg-desc { font-size: 11px; color: var(--text-light); line-height: 1.3; }
.minigame-card .mg-duration { font-size: 11px; color: #8b5cf6; margin-top: 4px; }

.minigame-player-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px 16px;
    gap: 12px;
}

.minigame-player-header h3 { margin: 0; font-size: 16px; }

.minigame-player-stats {
    display: flex;
    gap: 12px;
}

.minigame-stat {
    background: var(--bg-card);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    border: 1px solid var(--border);
}

.minigame-container {
    width: 100%;
    min-height: 400px;
    background: #0f172a;
    border-radius: var(--radius-sm);
    overflow: hidden;
    position: relative;
}

.result-big-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 16px;
}

#minigameResult .result-header {
    text-align: center;
    padding: 12px 16px 4px;
}

#minigameResult .result-header h2 {
    margin-bottom: 6px;
}

#minigameResult .result-subtitle {
    margin: 0;
    color: var(--text-light);
    font-weight: 700;
}

.minigame-result-breakdown {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    padding: 12px 16px 0;
}

.mini-result-pill {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-align: center;
}

.mini-result-pill span {
    color: var(--text-light);
    font-size: 12px;
}

.mini-result-pill strong {
    color: var(--text);
    font-size: 15px;
}

@media (max-width: 420px) {
    .minigame-result-breakdown {
        grid-template-columns: 1fr;
    }
}

.result-big-score .value {
    font-size: 48px;
    font-weight: 900;
    background: linear-gradient(135deg, #8b5cf6, #ec4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.pro-purchase-row {
    border: 1px solid #764ba2;
    border-radius: var(--radius-sm);
    padding: 14px !important;
    margin: 8px 0;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.08) 0%, rgba(118, 75, 162, 0.08) 100%);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.buy-pro-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.1s;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
}

.buy-pro-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(118, 75, 162, 0.4);
}

.buy-pro-btn:active {
    transform: translateY(0);
}

.pro-active-badge {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.setting-hint {
    font-size: 12px;
    color: var(--text-light);
    margin: 8px 0 16px;
    line-height: 1.4;
}

.pro-badge {
    font-size: 9px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1px 4px;
    border-radius: 3px;
    font-weight: 600;
    vertical-align: middle;
}

.body-part-card.pro-content {
    border: 2px solid transparent;
    background-image: linear-gradient(var(--card), var(--card)),
                      linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-origin: border-box;
    background-clip: padding-box, border-box;
}

.body-part-card.pro-content .body-part-icon {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* ==================== AUTH SCREEN ==================== */

.auth-container {
    padding: 20px;
    max-width: 400px;
    margin: 0 auto;
}

.auth-header {
    text-align: center;
    margin-bottom: 24px;
}

.auth-icon {
    font-size: 60px;
    margin-bottom: 12px;
}

.auth-header h2 {
    font-size: 24px;
    margin-bottom: 8px;
}

.auth-header p {
    color: var(--text-light);
    font-size: 14px;
}

.auth-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    background: var(--bg);
    border-radius: var(--radius);
    padding: 4px;
}

.auth-tab {
    flex: 1;
    padding: 12px;
    border: none;
    background: transparent;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-light);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.auth-tab.active {
    background: var(--card);
    color: var(--primary);
    box-shadow: var(--shadow);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
}

.form-group input {
    padding: 14px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 16px;
    background: var(--card);
    color: var(--text);
    transition: border-color 0.2s;
}

.form-group input:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-color: var(--primary);
}

.form-group input::placeholder {
    color: var(--text-light);
}

.auth-message {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    text-align: center;
    margin-bottom: 16px;
}

.auth-message.error {
    background: rgba(217, 83, 79, 0.1);
    color: var(--danger);
    border: 1px solid var(--danger);
}

.auth-message.success {
    background: rgba(92, 184, 92, 0.1);
    color: var(--secondary);
    border: 1px solid var(--secondary);
}

.auth-divider {
    display: flex;
    align-items: center;
    margin: 20px 0;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.auth-divider span {
    padding: 0 16px;
    color: var(--text-light);
    font-size: 13px;
}

.guest-note {
    text-align: center;
    font-size: 12px;
    color: var(--text-light);
    margin-top: 8px;
}

/* ==================== SETTINGS SECTIONS ==================== */

.settings-section {
    background: var(--card);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 16px;
}

.settings-section-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text);
}

.account-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.account-email {
    flex: 1;
    font-size: 14px;
    color: var(--text-light);
}

.btn.small {
    padding: 8px 16px;
    font-size: 13px;
}

.danger-zone {
    border: 1px solid rgba(217, 83, 79, 0.3);
}

.danger-zone .settings-section-title {
    color: var(--danger);
}

/* ==================== LEADERBOARD ==================== */

.leaderboard-header {
    text-align: center;
    padding: 20px;
    background: linear-gradient(135deg, #FFD700, #FFA500);
    border-radius: var(--radius);
    margin-bottom: 16px;
    color: #333;
}

.leaderboard-header h3 {
    font-size: 24px;
    margin-bottom: 4px;
}

.leaderboard-header p {
    font-size: 14px;
    opacity: 0.8;
}

.leaderboard-list {
    background: var(--card);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 16px;
}

.leaderboard-loading {
    text-align: center;
    padding: 40px;
    color: var(--text-light);
}

.leaderboard-item {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    gap: 12px;
    border-bottom: 1px solid var(--border);
}

.leaderboard-item:last-child {
    border-bottom: none;
}

.leaderboard-rank {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    border-radius: 50%;
    background: var(--bg);
    color: var(--text-light);
}

.leaderboard-item:nth-child(1) .leaderboard-rank {
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: #333;
}

.leaderboard-item:nth-child(2) .leaderboard-rank {
    background: linear-gradient(135deg, #C0C0C0, #A0A0A0);
    color: #333;
}

.leaderboard-item:nth-child(3) .leaderboard-rank {
    background: linear-gradient(135deg, #CD7F32, #8B4513);
    color: white;
}

.leaderboard-info {
    flex: 1;
}

.leaderboard-name {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 2px;
}

.last-active {
    font-size: 12px;
    font-weight: 400;
    color: var(--text-light);
    opacity: 0.7;
}

.leaderboard-stats {
    font-size: 12px;
    color: var(--text-light);
}

.leaderboard-xp {
    font-weight: 700;
    font-size: 16px;
    color: var(--primary);
}

.leaderboard-level {
    font-size: 12px;
    color: var(--text-light);
}

/* Button full-width */
.btn.full-width {
    width: 100%;
}

.btn.secondary {
    background: var(--bg);
    color: var(--text);
    border: 2px solid var(--border);
}

.btn.secondary:hover {
    background: var(--card);
    border-color: var(--primary);
}

/* ==================== BOTTOM NAVIGATION ==================== */

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    display: flex;
    justify-content: space-around;
    background: var(--card);
    border-top: 1px solid var(--border);
    padding: 8px 0 calc(8px + var(--safe-area-bottom));
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    min-height: calc(56px + env(safe-area-inset-bottom, 0px));
    z-index: 200;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
}

.bottom-nav.hidden {
    display: none;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 6px 8px;
    border: none;
    background: transparent;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.2s;
    border-radius: var(--radius-sm);
    flex: 1;
    min-width: 0;
}

.nav-item:hover {
    background: var(--bg);
}

.nav-item.active {
    color: var(--primary);
}

.nav-item.active .nav-icon {
    transform: scale(1.1);
}

.nav-icon {
    font-size: 22px;
    transition: transform 0.2s;
}

.nav-label {
    font-size: 9px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.2px;
    white-space: nowrap;
}

/* Adjust main content for bottom nav + safe area */
#screens {
    padding-bottom: calc(80px + var(--safe-area-bottom));
}

/* Dark mode adjustments */
.dark-mode .bottom-nav {
    box-shadow: 0 -2px 10px rgba(0,0,0,0.3);
}

/* ==================== PVP STYLES ==================== */

/* PvP Menu Button */
.menu-btn.pvp {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
}

.menu-btn.pvp:hover {
    background: linear-gradient(135deg, #c0392b, #a93226);
}

/* PvP Lobby */
.pvp-lobby-header {
    text-align: center;
    padding: 20px;
    margin-bottom: 20px;
}

.pvp-icon {
    font-size: 64px;
    margin-bottom: 10px;
}

.pvp-lobby-header h2 {
    font-size: 24px;
    margin-bottom: 5px;
}

.pvp-lobby-header p {
    color: var(--text-light);
}

/* PvP Stats Mini */
.pvp-stats-mini {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 30px;
    padding: 15px;
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.pvp-stat {
    text-align: center;
}

.pvp-stat .stat-value {
    display: block;
    font-size: 24px;
    font-weight: bold;
    color: var(--primary);
}

.pvp-stat .stat-label {
    font-size: 12px;
    color: var(--text-light);
    text-transform: uppercase;
}

/* PvP Buttons */
.pvp-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 0 20px;
    margin-bottom: 20px;
}

.pvp-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    background: var(--card);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
}

.pvp-btn:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.pvp-btn .btn-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.pvp-btn .btn-text {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
}

.pvp-btn .btn-desc {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 4px;
}

.pvp-btn.create:hover { border-color: #27ae60; }
.pvp-btn.join:hover { border-color: #3498db; }
.pvp-btn.random:hover { border-color: #9b59b6; }
.pvp-btn.rejoin {
    border-color: #e74c3c;
    background: linear-gradient(135deg, rgba(231, 76, 60, 0.2), rgba(231, 76, 60, 0.1));
    animation: rejoinPulse 2s ease-in-out infinite;
}
.pvp-btn.rejoin:hover { border-color: #c0392b; }

.coop-rejoin-section {
    margin-bottom: 20px;
    width: 100%;
    max-width: 320px;
}

@keyframes rejoinPulse {
    0%, 100% { box-shadow: 0 0 5px rgba(231, 76, 60, 0.3); }
    50% { box-shadow: 0 0 20px rgba(231, 76, 60, 0.6); }
}

/* PvP Waiting Screen */
.waiting-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    padding: 20px;
    text-align: center;
}

.waiting-icon {
    font-size: 64px;
    margin-bottom: 20px;
    animation: pulse 2s infinite;
}

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

.room-code-display {
    font-size: 48px;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    letter-spacing: 8px;
    color: var(--primary);
    background: var(--card);
    padding: 20px 40px;
    border-radius: var(--radius);
    margin: 20px 0;
    box-shadow: var(--shadow);
}

.room-code-display.hidden {
    display: none;
}

.room-code-hint {
    color: var(--text-light);
    margin-bottom: 30px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 30px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* PvP Battle Header */
.pvp-battle-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: var(--card);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.pvp-player {
    text-align: center;
    flex: 1;
}

.pvp-player .player-name {
    display: block;
    font-size: 14px;
    color: var(--text-light);
}

.pvp-player .player-score {
    display: block;
    font-size: 28px;
    font-weight: bold;
}

.pvp-player.me .player-score {
    color: var(--primary);
}

.pvp-player.opponent .player-score {
    color: var(--danger);
}

.pvp-vs {
    font-size: 20px;
    font-weight: bold;
    color: var(--text-light);
    padding: 0 15px;
}

/* PvP Question Area */
.pvp-question-area {
    padding: 20px;
    flex: 1;
}

.pvp-countdown {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
}

.countdown-number {
    font-size: 120px;
    font-weight: bold;
    color: var(--primary);
    animation: countdown-pulse 1s ease-in-out;
}

@keyframes countdown-pulse {
    0% { transform: scale(0.5); opacity: 0; }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 1; }
}

/* PvP Question Container */
.pvp-question-container {
    background: var(--card);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.question-number {
    font-size: 14px;
    color: var(--text-light);
    font-weight: 600;
}

.opponent-indicator {
    font-size: 12px;
    color: #f39c12;
    font-weight: 600;
    padding: 4px 8px;
    background: rgba(243, 156, 18, 0.1);
    border-radius: var(--radius-sm);
    animation: flash 0.5s;
}

.opponent-indicator.hidden {
    display: none;
}

@keyframes flash {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* PvP Timer */
.pvp-timer-bar {
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 10px;
}

.timer-fill {
    height: 100%;
    background: var(--secondary);
    border-radius: 4px;
    transition: width 0.1s linear, background-color 0.3s;
}

.timer-text {
    text-align: center;
    font-size: 24px;
    font-weight: bold;
    color: var(--text);
    margin-bottom: 20px;
}

/* PvP Question */
.question-text {
    font-size: 18px;
    font-weight: 600;
    text-align: center;
    margin-bottom: 20px;
    line-height: 1.4;
}

/* PvP Answers */
.pvp-answers {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.pvp-answer-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px;
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.pvp-answer-btn:hover:not(:disabled) {
    border-color: var(--primary);
    background: rgba(74, 144, 217, 0.1);
}

.pvp-answer-btn:disabled {
    cursor: default;
    opacity: 0.8;
}

.pvp-answer-btn.selected {
    border-color: var(--primary);
    background: rgba(74, 144, 217, 0.2);
}

.answer-letter {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--primary);
    color: white;
    font-weight: bold;
    border-radius: 50%;
    flex-shrink: 0;
}

.answer-text {
    font-size: 16px;
    color: var(--text);
}

/* PvP Mechanism */
.pvp-mechanism-container,
.pvp-clinical-container {
    background: var(--card);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.mechanism-title {
    text-align: center;
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
}

.mechanism-icon {
    font-size: 24px;
    margin-right: 6px;
}

.mechanism-instruction {
    text-align: center;
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 16px;
}

.mechanism-steps {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.mechanism-step-btn {
    padding: 12px 16px;
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    font-size: 14px;
    color: var(--text);
    line-height: 1.3;
}

.mechanism-step-btn:hover:not(:disabled) {
    border-color: var(--secondary);
    background: rgba(46, 204, 113, 0.1);
}

.mechanism-step-btn:disabled {
    cursor: default;
    opacity: 0.4;
}

.mechanism-step-btn.selected {
    border-color: var(--secondary);
    background: rgba(46, 204, 113, 0.15);
}

.mechanism-order {
    margin-bottom: 16px;
}

.mechanism-order h4 {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 8px;
}

.mechanism-order-list {
    min-height: 40px;
    background: var(--bg);
    border-radius: var(--radius);
    padding: 8px;
}

.mechanism-order-empty {
    text-align: center;
    color: var(--text-light);
    padding: 8px;
}

.mechanism-order-item {
    display: flex;
    gap: 8px;
    padding: 6px 8px;
    font-size: 13px;
    color: var(--text);
    border-bottom: 1px solid var(--border);
}

.mechanism-order-item:last-child {
    border-bottom: none;
}

.order-number {
    font-weight: 600;
    color: var(--secondary);
    min-width: 24px;
}

.mechanism-actions {
    display: flex;
    gap: 12px;
}

.pvp-undo-btn {
    flex: 1;
    padding: 12px;
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 14px;
    color: var(--text);
    transition: all 0.2s;
}

.pvp-undo-btn:hover:not(:disabled) {
    border-color: var(--text-light);
}

.pvp-undo-btn:disabled {
    opacity: 0.4;
    cursor: default;
}

.pvp-submit-btn {
    flex: 2;
    padding: 12px;
    background: var(--secondary);
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    color: white;
    transition: all 0.2s;
}

.pvp-submit-btn:hover:not(:disabled) {
    opacity: 0.9;
}

.pvp-submit-btn:disabled {
    opacity: 0.4;
    cursor: default;
}

/* PvP Clinical */
.clinical-header {
    text-align: center;
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 12px;
}

.clinical-context {
    background: rgba(52, 152, 219, 0.08);
    border-left: 3px solid var(--primary);
    padding: 12px 16px;
    border-radius: 0 var(--radius) var(--radius) 0;
    margin-bottom: 16px;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
}

/* PvP Result (after each question) */
.pvp-result {
    text-align: center;
    padding: 20px;
}

.pvp-result h3 {
    color: var(--text-light);
    margin-bottom: 20px;
}

.result-comparison {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
}

.result-player {
    padding: 15px 25px;
    border-radius: var(--radius);
    background: var(--card);
    box-shadow: var(--shadow);
    min-width: 120px;
}

.result-player.correct {
    border: 2px solid var(--secondary);
}

.result-player.wrong {
    border: 2px solid var(--danger);
}

.result-label {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 5px;
}

.result-icon {
    font-size: 32px;
    margin: 10px 0;
}

.result-player.correct .result-icon {
    color: var(--secondary);
}

.result-player.wrong .result-icon {
    color: var(--danger);
}

.result-points {
    font-size: 18px;
    font-weight: bold;
    color: var(--primary);
}

.result-time {
    font-size: 12px;
    color: var(--text-light);
}

.result-vs {
    font-size: 18px;
    font-weight: bold;
    color: var(--text-light);
}

.correct-answer {
    padding: 15px;
    background: rgba(92, 184, 92, 0.1);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 14px;
}

/* PvP Final Results */
.pvp-results-content {
    padding: 20px;
    text-align: center;
}

.pvp-final-result {
    padding: 30px;
}

.pvp-final-result .result-emoji {
    font-size: 80px;
    margin-bottom: 15px;
}

.pvp-final-result h2 {
    font-size: 32px;
    margin-bottom: 30px;
}

.pvp-final-result.win h2 {
    color: var(--secondary);
}

.pvp-final-result.loss h2 {
    color: var(--danger);
}

.pvp-final-result.draw h2 {
    color: var(--accent);
}

.final-scores {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    margin-bottom: 30px;
}

.final-score-player {
    text-align: center;
}

.final-score-player .player-name {
    font-size: 16px;
    color: var(--text-light);
    margin-bottom: 5px;
}

.final-score-player .player-score {
    font-size: 48px;
    font-weight: bold;
    color: var(--primary);
}

.final-score-player .player-correct {
    font-size: 14px;
    color: var(--text-light);
}

.score-separator {
    font-size: 32px;
    color: var(--text-light);
}

.xp-reward {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 15px 30px;
    background: linear-gradient(135deg, #f39c12, #e67e22);
    color: white;
    border-radius: 30px;
    font-size: 24px;
    font-weight: bold;
}

.xp-icon {
    font-size: 28px;
}

.pvp-results-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 20px;
}

/* PvP Leaderboard specific */
#pvpLeaderboard .leaderboard-row {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    background: var(--card);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
}

#pvpLeaderboard .rank {
    font-weight: bold;
    width: 30px;
    color: var(--text-light);
}

#pvpLeaderboard .username {
    flex: 1;
    font-weight: 600;
}

#pvpLeaderboard .wins {
    color: var(--secondary);
    font-weight: 600;
    margin-right: 10px;
}

#pvpLeaderboard .losses {
    color: var(--danger);
    margin-right: 10px;
}

#pvpLeaderboard .winrate {
    color: var(--primary);
    font-weight: bold;
}

#pvpLeaderboard .current-user {
    background: rgba(74, 144, 217, 0.1);
    border: 2px solid var(--primary);
}

/* Dark mode PvP adjustments */
.dark-mode .pvp-btn {
    background: var(--card);
}

.dark-mode .room-code-display {
    background: var(--card);
}

.dark-mode .pvp-question-container {
    background: var(--card);
}

.dark-mode .pvp-answer-btn {
    background: var(--bg);
}

/* ==================== CO-OP STYLES ==================== */

.menu-btn.coop {
    background: linear-gradient(135deg, #FF5722, #E64A19);
}

.menu-btn.coop:hover {
    background: linear-gradient(135deg, #E64A19, #D84315);
    transform: translateY(-2px);
}

/* Co-op Lobby */
.pvp-header {
    text-align: center;
    padding: 30px 20px;
    margin-bottom: 20px;
}

.pvp-header h2 {
    font-size: 28px;
    margin-bottom: 10px;
    color: var(--text);
}

.pvp-header p {
    color: var(--text-light);
    font-size: 14px;
}

.pvp-options {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 0 20px;
    margin-bottom: 30px;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.pvp-options .btn.primary.large {
    width: 100%;
    padding: 18px 24px;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.room-join {
    display: flex;
    gap: 10px;
    align-items: center;
}

.room-code-input {
    flex: 1;
    padding: 15px;
    font-size: 18px;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 4px;
    font-weight: bold;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
    color: var(--text);
}

.room-code-input::placeholder {
    color: var(--text-light);
    letter-spacing: 4px;
}

.room-join .btn {
    padding: 15px 24px;
    font-size: 16px;
    white-space: nowrap;
}

/* Co-op Waiting Room */
.pvp-waiting {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 30px 20px;
    gap: 25px;
}

.room-code-display {
    text-align: center;
    padding: 30px 50px;
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.room-code-display span:first-child {
    display: block;
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 10px;
    text-transform: uppercase;
}

.room-code-display .code {
    display: block;
    font-size: 48px;
    font-weight: bold;
    letter-spacing: 8px;
    color: var(--primary);
    font-family: monospace;
}

.players-list {
    width: 100%;
    max-width: 350px;
}

.player-slot, .coop-player {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 20px;
    background: var(--card);
    border-radius: var(--radius);
    margin-bottom: 10px;
    border: 2px solid var(--border);
    transition: all 0.3s;
}

.player-slot .player-icon, .coop-player .player-avatar {
    font-size: 28px;
}

.player-slot .player-name, .coop-player .player-name {
    flex: 1;
    font-size: 16px;
    color: var(--text);
}

.coop-player .player-level {
    font-size: 12px;
    color: var(--text-light);
    background: var(--bg);
    padding: 4px 8px;
    border-radius: 12px;
}

.coop-player.ready {
    border-color: #27ae60;
    background: rgba(39, 174, 96, 0.1);
}

.coop-player .ready-badge {
    color: #27ae60;
    font-size: 20px;
    font-weight: bold;
}

.pvp-waiting .btn {
    min-width: 150px;
}

.coop-waiting-buttons {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}

.coop-waiting-buttons .btn {
    min-width: 120px;
}

.coop-player.waiting {
    opacity: 0.6;
    border-style: dashed;
}

/* Co-op header */
.coop-header {
    text-align: center;
    padding: 20px;
}

/* Mission list */
.mission-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 20px;
    max-height: 60vh;
    overflow-y: auto;
}

.mission-card {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: var(--card);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s ease;
}

.mission-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.mission-icon {
    font-size: 2.5rem;
}

.mission-info {
    flex: 1;
}

.mission-name {
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 4px;
}

.mission-desc {
    font-size: 0.85rem;
    color: var(--text-light);
}

.mission-meta {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}

.mission-difficulty {
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--primary);
    color: white;
}

.mission-difficulty.easy { background: #4CAF50; }
.mission-difficulty.medium { background: #FF9800; }
.mission-difficulty.hard { background: #f44336; }

.mission-time {
    font-size: 0.75rem;
    color: var(--text-light);
}

/* Co-op game area */
.coop-phase-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: var(--card);
    border-bottom: 1px solid var(--border);
}

.phase-info {
    display: flex;
    flex-direction: column;
}

.phase-name {
    font-weight: 600;
    font-size: 1.1rem;
}

.phase-progress {
    font-size: 0.85rem;
    color: var(--text-light);
}

.coop-timer {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary);
}

.coop-scores {
    display: flex;
    justify-content: space-around;
    padding: 15px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}

.score-player, .score-total {
    text-align: center;
}

.score-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-light);
    margin-bottom: 4px;
}

.score-value {
    font-size: 1.5rem;
    font-weight: bold;
}

.score-total .score-value {
    color: var(--primary);
}

.coop-game-area {
    flex: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    min-height: 300px;
}

/* Co-op results */
.coop-results-content {
    text-align: center;
    padding: 30px 20px;
}

.stars-display {
    font-size: 3rem;
    margin: 20px 0;
}

.result-stats {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin: 20px 0;
}

.result-stats .stat {
    text-align: center;
}

.result-stats .stat-label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 5px;
}

.result-stats .stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary);
}

.player-scores {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-top: 20px;
}

.player-score-card {
    padding: 15px 25px;
    background: var(--card);
    border-radius: var(--radius);
    text-align: center;
}

.player-score-name {
    font-weight: 600;
    margin-bottom: 5px;
}

.player-score-value {
    font-size: 1.2rem;
    color: var(--secondary);
}

.result-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 20px;
}

/* Dark mode Co-op */
.dark-mode .mission-card {
    background: var(--card);
}

.dark-mode .coop-game-area {
    background: var(--bg);
}

/* ==================== UNIVERSAL MODAL ==================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

.modal-overlay.hidden {
    display: none;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-container {
    background: var(--card);
    border-radius: var(--radius);
    padding: 30px;
    max-width: 400px;
    width: 100%;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.modal-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text);
}

.modal-message {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 20px;
    line-height: 1.5;
}

.modal-input-container {
    margin-bottom: 20px;
}

.modal-input-container.hidden {
    display: none;
}

.modal-input {
    width: 100%;
    padding: 15px;
    font-size: 18px;
    text-align: center;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
    font-weight: bold;
}
.modal-input.code-input {
    font-size: 24px;
    letter-spacing: 8px;
    text-transform: uppercase;
    font-family: 'Courier New', monospace;
}

.modal-input:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-color: var(--primary);
}

.modal-buttons {
    display: flex;
    gap: 10px;
}

.modal-buttons .btn {
    flex: 1;
}

/* Danger modal variant */
.modal-container.danger .modal-icon {
    color: var(--danger);
}

.modal-container.danger .btn.primary {
    background: var(--danger);
}

/* Completed Lesson Modal */
.completed-lesson-stats {
    background: var(--bg);
    border-radius: var(--radius);
    padding: 15px;
    margin-bottom: 20px;
    text-align: left;
}

.completed-lesson-stats p {
    margin: 8px 0;
    font-size: 14px;
    color: var(--text);
}

.completed-lesson-stats .xp-earned {
    color: var(--success);
    font-weight: 600;
    text-align: center;
    margin-top: 12px;
}

/* ==================== COMBINED HEADER (Main Menu) ==================== */

.menu-header-combined {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: var(--radius);
    padding: 15px;
    margin: 15px 15px 10px;
    color: white;
    box-shadow: 0 4px 15px rgba(74, 144, 217, 0.3);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.menu-header-combined .app-icon {
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}

.header-text h2 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 2px;
}

.header-text p {
    font-size: 12px;
    opacity: 0.9;
}

.player-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.15);
    padding: 8px 12px;
    border-radius: 20px;
    cursor: pointer;
    transition: background 0.2s;
}

.player-badge:hover {
    background: rgba(255, 255, 255, 0.25);
}

.player-avatar {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.player-badge-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.player-username {
    font-size: 13px;
    font-weight: 600;
}

.player-level-badge {
    display: inline-flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    width: fit-content;
}

/* Menu XP Bar */
.menu-xp-bar {
    position: relative;
    height: 20px;
    background: var(--border);
    border-radius: 10px;
    margin: 0 15px 15px;
    overflow: hidden;
}

.menu-xp-fill {
    height: 100%;
    background: linear-gradient(90deg, #f39c12, #f1c40f);
    border-radius: 10px;
    transition: width 0.5s ease;
}

.menu-xp-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.5);
}

/* ==================== QUICK STATS ==================== */

.quick-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin: 0 15px 20px;
}

.quick-stat {
    background: var(--card);
    border-radius: var(--radius);
    padding: 12px 8px;
    text-align: center;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: var(--shadow);
}

.quick-stat:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.quick-stat:active {
    transform: scale(0.95);
}

.quick-stat .stat-icon {
    display: block;
    font-size: 24px;
    margin-bottom: 4px;
}

.quick-stat .stat-value {
    display: block;
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
}

.quick-stat .stat-label {
    display: block;
    font-size: 10px;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Dark mode adjustments for combined header */
.dark-mode .menu-header-combined {
    background: linear-gradient(135deg, #2c3e50, #1a252f);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.dark-mode .menu-xp-bar {
    background: rgba(255, 255, 255, 0.1);
}

.dark-mode .menu-xp-text {
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* Toast Notifications */
.toast-notification {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px;
    border-radius: 8px;
    background: #333;
    color: white;
    font-weight: 500;
    z-index: 10000;
    animation: slideDown 0.3s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.toast-info {
    background: #2196F3;
}

.toast-warning {
    background: #FF9800;
}

.toast-error {
    background: #f44336;
}

.toast-success {
    background: #4CAF50;
}

.toast-notification.fade-out {
    animation: fadeOut 0.3s ease forwards;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateX(-50%) translateY(-20px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* ==================== CO-OP MINIGAMES ==================== */

/* Base minigame container */
.coop-game-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    padding: 10px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    border-radius: var(--radius);
    position: relative;
    overflow: hidden;
    min-height: 280px;
}

.coop-game-area::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(circle at 20% 80%, rgba(78, 205, 196, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 107, 107, 0.1) 0%, transparent 50%);
    pointer-events: none;
}

/* ==================== CO-OP PHASE HEADER ==================== */

.coop-phase-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    border-radius: var(--radius);
    margin-bottom: 8px;
}

.phase-info {
    display: flex;
    flex-direction: column;
}

.phase-name {
    font-size: 18px;
    font-weight: bold;
    color: white;
}

.phase-progress {
    font-size: 14px;
    color: #4ecdc4;
}

.coop-timer {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(145deg, #ff6b6b, #ee5a5a);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: bold;
    color: white;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
}

.coop-timer.warning {
    animation: timerWarning 0.5s ease infinite;
}

@keyframes timerWarning {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); background: linear-gradient(145deg, #ff4444, #cc3333); }
}

/* ==================== CO-OP SCORES ==================== */

.coop-scores {
    display: flex;
    justify-content: space-around;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius);
    margin-bottom: 10px;
}

.score-player,
.score-total {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.score-label {
    font-size: 10px;
    color: #888;
    text-transform: uppercase;
}

.score-value {
    font-size: 22px;
    font-weight: bold;
    color: #4ecdc4;
}

.score-total .score-value {
    color: #ffd93d;
    font-size: 26px;
}

/* ==================== CO-OP WAITING ROOM ==================== */

.coop-player {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius);
    margin-bottom: 10px;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.coop-player.ready {
    border-color: #4ecdc4;
    background: rgba(78, 205, 196, 0.1);
}

.coop-player.waiting {
    opacity: 0.5;
}

.coop-player .player-avatar {
    font-size: 32px;
}

.coop-player .player-name {
    flex: 1;
    font-weight: bold;
    color: var(--text);
}

.coop-player .player-level {
    font-size: 12px;
    color: #888;
    background: rgba(255, 255, 255, 0.1);
    padding: 4px 10px;
    border-radius: 10px;
}

.ready-badge {
    color: #4ecdc4;
    font-size: 20px;
    animation: badgePop 0.3s ease;
}

@keyframes badgePop {
    0% { transform: scale(0); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

/* ==================== CO-OP RESULTS ==================== */

.coop-results-content {
    text-align: center;
    padding: 30px;
}

.coop-results-content h2 {
    font-size: 28px;
    color: var(--text);
    margin-bottom: 20px;
}

.stars-display {
    font-size: 48px;
    margin: 20px 0;
    animation: starsAppear 0.5s ease;
}

@keyframes starsAppear {
    0% { transform: scale(0); opacity: 0; }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 1; }
}

.result-stats {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin: 25px 0;
}

.result-stats .stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.result-stats .stat-label {
    font-size: 14px;
    color: #888;
}

.result-stats .stat-value {
    font-size: 32px;
    font-weight: bold;
    color: #4ecdc4;
}

.player-scores {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-top: 20px;
}

.result-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 20px;
}

/* ==================== CO-OP MISSION SELECT ==================== */

.mission-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 20px;
}

.mission-card {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px;
    background: linear-gradient(135deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02));
    border: 2px solid rgba(255,255,255,0.1);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.3s ease;
}

.mission-card:hover {
    border-color: #4ecdc4;
    background: rgba(78, 205, 196, 0.1);
    transform: translateX(5px);
}

.mission-icon {
    font-size: 48px;
}

.mission-info {
    flex: 1;
}

.mission-name {
    font-size: 18px;
    font-weight: bold;
    color: var(--text);
    margin-bottom: 5px;
}

.mission-desc {
    font-size: 14px;
    color: var(--text-light);
}

.mission-difficulty {
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
}

.mission-difficulty.easy {
    background: rgba(76, 175, 80, 0.2);
    color: #4CAF50;
}

.mission-difficulty.medium {
    background: rgba(255, 152, 0, 0.2);
    color: #FF9800;
}

.mission-difficulty.hard {
    background: rgba(244, 67, 54, 0.2);
    color: #f44336;
}

/* ==================== PHASE RESULT OVERLAY ==================== */

.phase-result-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    animation: overlayFadeIn 0.3s ease;
    z-index: 100;
}

@keyframes overlayFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.phase-result-overlay .result-icon {
    font-size: 80px;
    animation: iconBounce 0.5s ease;
}

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

.phase-result-overlay .result-score {
    font-size: 48px;
    font-weight: bold;
    color: #4ecdc4;
    text-shadow: 0 0 20px rgba(78, 205, 196, 0.6);
}

/* ==================== PLAYER SCORE CARDS ==================== */

.player-score-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 15px 25px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius);
}

.player-score-card .player-name {
    font-size: 14px;
    color: #888;
}

.player-score-card .player-score {
    font-size: 28px;
    font-weight: bold;
    color: #4ecdc4;
}

/* ==================== CO-OP EXTRA STYLES ==================== */

#coopReadyBtn {
    width: 100%;
    padding: 15px;
    font-size: 18px;
    font-weight: bold;
    border: none;
    border-radius: var(--radius);
    background: linear-gradient(135deg, #4ecdc4, #44a08d);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(78, 205, 196, 0.3);
}

#coopReadyBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(78, 205, 196, 0.4);
}

#coopReadyBtn.ready {
    background: linear-gradient(135deg, #ffd93d, #ffcd00);
    color: #333;
    animation: readyPulse 1.5s ease-in-out infinite;
}

@keyframes readyPulse {
    0%, 100% { box-shadow: 0 4px 15px rgba(255, 217, 61, 0.3); }
    50% { box-shadow: 0 4px 30px rgba(255, 217, 61, 0.6); }
}

#coopRoomCodeDisplay {
    font-size: 48px;
    font-weight: bold;
    font-family: 'Courier New', monospace;
    color: #2a9d8f;
    letter-spacing: 8px;
    text-align: center;
    padding: 20px;
    background: rgba(42, 157, 143, 0.1);
    border-radius: var(--radius);
    margin: 15px 0;
}

.dark-mode #coopRoomCodeDisplay {
    color: #4ecdc4;
    text-shadow: 0 0 20px rgba(78, 205, 196, 0.4);
    background: rgba(78, 205, 196, 0.1);
}

#coopWaitingMessage {
    text-align: center;
    font-size: 16px;
    color: #888;
    margin-bottom: 20px;
}

/* ==================== CO-OP PHASE INSTRUCTION ==================== */

.phase-instruction {
    background: linear-gradient(135deg, rgba(78, 205, 196, 0.3), rgba(69, 183, 209, 0.2));
    border: 3px solid rgba(78, 205, 196, 0.6);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
    text-align: center;
    animation: instructionFadeIn 0.5s ease;
    color: #ffffff !important;
    font-size: 20px;
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.phase-instruction p {
    font-size: 16px;
    line-height: 1.6;
    color: #1a1a2e !important;
    margin: 0;
    text-shadow: none;
}

.dark-mode .phase-instruction {
    background: linear-gradient(135deg, rgba(78, 205, 196, 0.4), rgba(69, 183, 209, 0.3));
    border-color: rgba(78, 205, 196, 0.8);
}

.dark-mode .phase-instruction p {
    color: #ffffff !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

@keyframes instructionFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==================== CO-OP MINIGAME CONTAINER ==================== */

.minigame-container {
    background: transparent;
    border-radius: var(--radius);
    padding: 0;
    min-height: 250px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    width: 100%;
    box-sizing: border-box;
}

.dark-mode .minigame-container {
    background: rgba(0, 0, 0, 0.2);
}

/* ==================== CANVAS MINIGAMES - MOBILE FIX ==================== */

.minigame-wrapper {
    position: relative;
    width: 100%;
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.minigame-canvas {
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    cursor: pointer;
}

.minigame-stats {
    position: absolute;
    top: 5px;
    left: 10px;
    z-index: 10;
    color: #fff;
    font-weight: bold;
    text-shadow: 1px 1px 2px #000;
    pointer-events: none;
}

/* ==================== CO-OP PAUSED OVERLAY ==================== */

.coop-paused-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.paused-content {
    text-align: center;
    color: white;
}

.paused-icon {
    font-size: 80px;
    margin-bottom: 20px;
    animation: pausePulse 2s ease-in-out infinite;
}

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

.paused-message {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 30px;
}

.paused-spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: #4ecdc4;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ==================== CO-OP PLAYER CONNECTION STATUS ==================== */

.coop-player.disconnected {
    opacity: 0.5;
}

.coop-player.disconnected .player-name::after {
    content: ' (rozłączony)';
    font-size: 12px;
    color: #ff6b6b;
}

.coop-player .connection-status {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #4ecdc4;
    margin-left: 8px;
}

.coop-player.disconnected .connection-status {
    background: #ff6b6b;
}

/* ==================== CO-OP REJOIN DIALOG ==================== */

.coop-rejoin-dialog {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.rejoin-content {
    background: var(--card);
    border-radius: var(--radius);
    padding: 30px;
    max-width: 350px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.rejoin-icon {
    font-size: 60px;
    margin-bottom: 15px;
}

.rejoin-message {
    font-size: 18px;
    font-weight: bold;
    color: var(--text);
    margin-bottom: 15px;
}

.rejoin-info {
    font-size: 16px;
    color: var(--text);
    margin-bottom: 10px;
}

.rejoin-info strong {
    color: #4ecdc4;
    font-size: 20px;
}

.rejoin-hint {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 20px;
}

.rejoin-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.rejoin-btn {
    padding: 15px 30px;
    background: linear-gradient(145deg, #4ecdc4, #3ba99c);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
}

.rejoin-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(78, 205, 196, 0.4);
}

.rejoin-cancel {
    padding: 12px 20px;
    background: transparent;
    color: var(--text-light);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    cursor: pointer;
}

.rejoin-cancel:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* ==================== PAUSE OVERLAY WITH BUTTONS ==================== */

.paused-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 30px;
}

.paused-wait-btn {
    padding: 15px 30px;
    background: rgba(78, 205, 196, 0.2);
    border: 2px solid #4ecdc4;
    color: #4ecdc4;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
}

.paused-leave-btn {
    padding: 12px 25px;
    background: rgba(255, 107, 107, 0.2);
    border: 2px solid #ff6b6b;
    color: #ff6b6b;
    border-radius: var(--radius);
    font-size: 14px;
    cursor: pointer;
}

.paused-leave-btn:hover {
    background: rgba(255, 107, 107, 0.4);
}

/* ==================== LEADERBOARD TABS ==================== */

.leaderboard-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    padding: 0 16px;
}

.leaderboard-tab {
    flex: 1;
    padding: 12px 20px;
    border: none;
    background: var(--card);
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 600;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow);
}

.leaderboard-tab:hover {
    background: var(--primary);
    color: white;
}

.leaderboard-tab.active {
    background: var(--primary);
    color: white;
}

/* ==================== STREAK SECTION ==================== */

.streak-section {
    margin: 20px 16px;
    padding: 16px;
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.streak-section h4 {
    margin: 0 0 16px 0;
    font-size: 18px;
    color: var(--text);
}

.streak-cards {
    display: flex;
    gap: 12px;
}

.streak-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 8px;
    background: linear-gradient(135deg, rgba(255, 107, 107, 0.1), rgba(255, 217, 61, 0.1));
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 107, 107, 0.2);
}

.streak-icon {
    font-size: 24px;
    margin-bottom: 4px;
}

.streak-value {
    font-size: 28px;
    font-weight: bold;
    color: #ff6b6b;
}

.streak-label {
    font-size: 12px;
    color: var(--text-light);
    text-align: center;
}

.dark-mode .streak-card {
    background: linear-gradient(135deg, rgba(255, 107, 107, 0.15), rgba(255, 217, 61, 0.15));
    border-color: rgba(255, 107, 107, 0.3);
}

/* ==================== ORGAN PREVIEW (Animated Explorer) ==================== */

/* Dark Theme when organ preview is active */
#bodyViewer.organ-preview-mode {
    background: linear-gradient(180deg, #f0f4f8 0%, #e8eef5 100%);
    min-height: 100vh;
}

#bodyViewer.organ-preview-mode .breadcrumbs {
    background: transparent;
    padding: 12px 16px;
}

#bodyViewer.organ-preview-mode .crumb {
    background: rgba(0,0,0,0.08);
    color: #666;
}

#bodyViewer.organ-preview-mode .crumb:hover {
    background: rgba(0,0,0,0.12);
    color: #333;
}

#bodyViewer.organ-preview-mode .crumb:last-child {
    background: rgba(220,60,60,0.15);
    color: #d43c3c;
}

/* Dark mode overrides for organ-preview */
.dark-mode #bodyViewer.organ-preview-mode {
    background: linear-gradient(180deg, #0f1829 0%, #1a2744 100%);
}

.dark-mode #bodyViewer.organ-preview-mode .crumb {
    background: rgba(255,255,255,0.1);
    color: #aaa;
}

.dark-mode #bodyViewer.organ-preview-mode .crumb:hover {
    background: rgba(255,255,255,0.2);
    color: #fff;
}

.dark-mode #bodyViewer.organ-preview-mode .crumb:last-child {
    background: rgba(255,107,107,0.3);
    color: #ff6b6b;
}

/* Preview Card Container */
.organ-preview-card {
    background: #fff;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 20px;
    overflow: hidden;
    margin: 0 16px 16px;
}

.organ-preview-card .canvas-container {
    position: relative;
    height: 280px;
    background: radial-gradient(ellipse at center, #e8eef5 0%, #dce4ed 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.dark-mode .organ-preview-card {
    background: rgba(255,255,255,0.03);
    border-color: rgba(255,255,255,0.1);
}

.dark-mode .organ-preview-card .canvas-container {
    background: radial-gradient(ellipse at center, #1a2744 0%, #0f1829 100%);
}

.organ-preview-card #organCanvas {
    max-width: 100%;
    max-height: 100%;
}

/* Rate Indicator (heart rate, breathing rate, etc.) */
.organ-rate {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0,0,0,0.6);
    padding: 8px 14px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #fff;
}

.dark-mode .organ-rate {
    background: rgba(0,0,0,0.6);
}

.organ-rate .rate-icon {
    animation: ratePulse 1s infinite;
}

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

/* Highlight Indicator */
.highlight-indicator {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.7);
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 12px;
    color: #ffcc66;
    opacity: 0;
    transition: opacity 0.3s;
    white-space: nowrap;
}

.dark-mode .highlight-indicator {
    background: rgba(0,0,0,0.7);
}

.highlight-indicator.show {
    opacity: 1;
}

/* View Tabs */
.view-tabs {
    display: flex;
    background: rgba(0,0,0,0.06);
    padding: 8px;
    gap: 6px;
}

.view-tab {
    flex: 1;
    padding: 10px 5px;
    background: transparent;
    border: none;
    border-radius: 10px;
    color: #888;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.view-tab span:first-child {
    font-size: 18px;
}

.view-tab:hover {
    background: rgba(0,0,0,0.08);
    color: #555;
}

.view-tab.active {
    background: rgba(0,0,0,0.12);
    color: #333;
}

.dark-mode .view-tabs {
    background: rgba(0,0,0,0.3);
}

.dark-mode .view-tab:hover {
    background: rgba(255,255,255,0.05);
    color: #aaa;
}

.dark-mode .view-tab.active {
    background: rgba(255,255,255,0.1);
    color: white;
}

/* Organ Stats Grid */
.organ-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    padding: 0 16px 16px;
}

.stat-box {
    background: rgba(0,0,0,0.05);
    padding: 12px;
    border-radius: 12px;
    text-align: center;
}

.stat-value {
    font-size: 18px;
    font-weight: 700;
    color: #d43c3c;
}

.stat-label {
    font-size: 10px;
    color: #888;
    margin-top: 4px;
}

.dark-mode .stat-box {
    background: rgba(0,0,0,0.4);
}

.dark-mode .stat-value {
    color: #ff6b6b;
}

/* Organ Preview Cards */
#bodyViewer.organ-preview-mode .body-parts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    padding: 0 16px 16px;
}

#bodyViewer.organ-preview-mode .body-part-card {
    background: #fff;
    border: 2px solid rgba(0,0,0,0.08);
    border-radius: 16px;
    padding: 15px 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    color: #333;
    transition: all 0.3s;
}

#bodyViewer.organ-preview-mode .body-part-card:hover {
    background: #f0f7ff !important;
    border-color: rgba(60,130,220,0.4) !important;
    transform: translateY(-3px) !important;
}

#bodyViewer.organ-preview-mode .body-part-card.discovered {
    background: #fff !important;
    border-color: rgba(0,0,0,0.08) !important;
}

#bodyViewer.organ-preview-mode .body-part-card.discovered:hover {
    background: #f0f7ff !important;
    border-color: rgba(60,130,220,0.4) !important;
    transform: translateY(-3px) !important;
}

#bodyViewer.organ-preview-mode .body-part-card.highlighted {
    border-color: rgba(200,150,50,0.8);
    box-shadow: 0 0 20px rgba(200,150,50,0.2);
}

#bodyViewer.organ-preview-mode .body-part-icon {
    font-size: 40px;
    margin-bottom: 8px;
    background: none;
}

#bodyViewer.organ-preview-mode .body-part-name {
    font-size: 13px;
    font-weight: 600;
    color: #333;
}

#bodyViewer.organ-preview-mode .body-part-name .latin-subtitle {
    color: #999;
}

#bodyViewer.organ-preview-mode .body-part-type {
    font-size: 10px;
    color: #888;
}

/* Children badge */
#bodyViewer.organ-preview-mode .child-badge {
    display: inline-block;
    background: rgba(60,160,60,0.12);
    color: #3a8a3a;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 9px;
    margin-top: 6px;
}

/* Info Panel */
#bodyViewer.organ-preview-mode .info-panel {
    background: #fff;
    border-radius: 16px;
    margin: 0 16px 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    color: #333;
}

#bodyViewer.organ-preview-mode .info-panel-header {
    color: #d43c3c;
}

#bodyViewer.organ-preview-mode .info-panel h3 {
    color: #333;
}

#bodyViewer.organ-preview-mode .info-latin {
    color: #999;
}

#bodyViewer.organ-preview-mode .info-type {
    display: inline-block;
    background: rgba(220,60,60,0.1);
    color: #d43c3c;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
}

#bodyViewer.organ-preview-mode .info-desc {
    color: #555;
}

#bodyViewer.organ-preview-mode .detail-label {
    color: #888;
}

#bodyViewer.organ-preview-mode .detail span:last-child {
    color: #555;
}

#bodyViewer.organ-preview-mode .fun-fact {
    background: rgba(200,160,60,0.08);
    border-left: 3px solid #c8a03c;
    padding: 12px 15px;
    border-radius: 0 10px 10px 0;
}

#bodyViewer.organ-preview-mode .fun-fact .detail-label {
    color: #c8a03c;
}

/* Dark mode overrides for organ-preview cards & info */
.dark-mode #bodyViewer.organ-preview-mode .body-part-card {
    background: rgba(255,255,255,0.05);
    border-color: rgba(255,255,255,0.1);
    box-shadow: none;
    color: #fff;
}

.dark-mode #bodyViewer.organ-preview-mode .body-part-card:hover {
    background: rgba(255,255,255,0.1) !important;
    border-color: rgba(100,200,255,0.5) !important;
    box-shadow: none !important;
}

.dark-mode #bodyViewer.organ-preview-mode .body-part-card.discovered {
    background: rgba(255,255,255,0.05) !important;
    border-color: rgba(255,255,255,0.1) !important;
    box-shadow: none !important;
}

.dark-mode #bodyViewer.organ-preview-mode .body-part-card.discovered:hover {
    background: rgba(255,255,255,0.1) !important;
    border-color: rgba(100,200,255,0.5) !important;
    box-shadow: none !important;
}

.dark-mode #bodyViewer.organ-preview-mode .body-part-card.highlighted {
    border-color: rgba(255,200,100,0.8);
    box-shadow: 0 0 20px rgba(255,200,100,0.3);
}

.dark-mode #bodyViewer.organ-preview-mode .body-part-name {
    color: #fff;
}

.dark-mode #bodyViewer.organ-preview-mode .body-part-name .latin-subtitle {
    color: #888;
}

.dark-mode #bodyViewer.organ-preview-mode .child-badge {
    background: rgba(100,200,100,0.2);
    color: #6c6;
}

.dark-mode #bodyViewer.organ-preview-mode .info-panel {
    background: rgba(0,0,0,0.4);
    box-shadow: none;
    color: #fff;
}

.dark-mode #bodyViewer.organ-preview-mode .info-panel-header {
    color: #ff6b6b;
}

.dark-mode #bodyViewer.organ-preview-mode .info-panel h3 {
    color: #fff;
}

.dark-mode #bodyViewer.organ-preview-mode .info-latin {
    color: #888;
}

.dark-mode #bodyViewer.organ-preview-mode .info-type {
    background: rgba(255,107,107,0.2);
    color: #ff6b6b;
}

.dark-mode #bodyViewer.organ-preview-mode .info-desc {
    color: #ccc;
}

.dark-mode #bodyViewer.organ-preview-mode .detail span:last-child {
    color: #ccc;
}

.dark-mode #bodyViewer.organ-preview-mode .fun-fact {
    background: rgba(255,200,100,0.1);
    border-left-color: #ffcc66;
}

.dark-mode #bodyViewer.organ-preview-mode .fun-fact .detail-label {
    color: #ffcc66;
}

/* Section header in children grid */
.children-section-header {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #4fc3f7;
    font-size: 14px;
    padding: 8px 0;
}

/* Responsive */
@media (max-width: 400px) {
    #bodyViewer.organ-preview-mode .body-parts-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .organ-stats {
        grid-template-columns: repeat(3, 1fr);
    }

    .view-tab {
        padding: 8px 3px;
        font-size: 10px;
    }

    .view-tab span:first-child {
        font-size: 16px;
    }
}

/* Co-op Mission Locked */
.mission-card.locked {
    opacity: 0.5;
    pointer-events: none;
    position: relative;
}

.mission-card.locked .mission-icon {
    filter: grayscale(1);
}

.mission-stars {
    font-size: 12px;
    margin-top: 4px;
    letter-spacing: 1px;
}

.mission-best-score {
    font-size: 12px;
    color: #888;
    margin-top: 2px;
}

/* Co-op Combo Display (rendered in canvas, no CSS needed) */

/* Co-op Results Combo */
#coopMaxCombo {
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    color: #ff8800;
    margin-top: 8px;
    display: none;
}

/* ==================== DAILY/WEEKLY CHALLENGES ==================== */

.daily-weekly-section {
    background: var(--card-bg, #f8f9fa);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    border: 1px solid var(--border-color, #e0e0e0);
}

.daily-weekly-section.weekly {
    border-color: var(--primary, #4a90d9);
    border-width: 1px;
}

.daily-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.daily-header h4 {
    margin: 0;
    font-size: 16px;
}

.daily-streak {
    font-size: 14px;
    color: #ff6600;
    font-weight: 600;
}

.daily-challenge-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    margin-bottom: 6px;
    background: var(--bg-color, #fff);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
    gap: 12px;
}

.daily-challenge-item:hover:not(.completed) {
    background: var(--hover-bg, #e8f0fe);
}

.daily-challenge-item.completed {
    opacity: 0.6;
    cursor: default;
}

.daily-challenge-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.daily-challenge-info {
    flex: 1;
    min-width: 0;
}

.daily-challenge-name {
    font-weight: 500;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.daily-challenge-type {
    font-size: 12px;
    color: var(--text-secondary, #666);
}

.daily-challenge-check {
    font-size: 18px;
    flex-shrink: 0;
}

.daily-bonus {
    text-align: center;
    padding: 8px;
    font-size: 13px;
    margin-top: 8px;
}

.bonus-claimed {
    color: #28a745;
    font-weight: 600;
}

.bonus-pending {
    color: var(--text-secondary, #888);
}

/* ==================== LIGA / ELO ==================== */

.my-liga-tier {
    background: var(--card-bg, #f8f9fa);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    border: 1px solid var(--border-color, #e0e0e0);
}

.my-liga-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.tier-icon {
    font-size: 36px;
}

.tier-name {
    font-size: 18px;
    font-weight: 700;
}

.tier-rating {
    font-size: 14px;
    color: var(--text-secondary, #666);
}

.tier-badge {
    margin-right: 4px;
}

/* ELO change in PvP results */
.elo-change-display {
    display: flex;
    justify-content: center;
    gap: 12px;
    align-items: center;
    margin-top: 8px;
    font-size: 16px;
}

.elo-change {
    font-weight: 700;
}

.elo-change.positive {
    color: #28a745;
}

.elo-change.negative {
    color: #dc3545;
}

.elo-new {
    color: var(--text-secondary, #888);
    font-size: 14px;
}

/* ==================== SEASON ==================== */

.season-info {
    background: var(--card-bg, #f8f9fa);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    border: 1px solid var(--border-color, #e0e0e0);
}

.season-header-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.season-number {
    font-size: 16px;
    font-weight: 700;
}

.season-dates {
    font-size: 12px;
    color: var(--text-secondary, #888);
}

.season-my-points {
    font-size: 14px;
    color: var(--text-color, #333);
}

/* Credits System */
.challenges-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.credits-display {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 15px;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.reset-btn {
    font-size: 14px;
    padding: 10px 20px;
    color: #e67e22;
    border-color: #e67e22;
}

.reset-btn:hover {
    background: #e67e22;
    color: white;
}

.card-reset-btn {
    cursor: pointer;
    font-size: 16px;
    padding: 4px 6px;
    border-radius: 50%;
    transition: background 0.2s;
    flex-shrink: 0;
}

.card-reset-btn:hover {
    background: rgba(230, 126, 34, 0.15);
}

.results-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
    margin-top: 8px;
}

/* Leaderboard tabs responsive for 5 tabs */
.leaderboard-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.leaderboard-tabs .leaderboard-tab {
    white-space: nowrap;
    font-size: 13px;
    padding: 8px 12px;
    flex-shrink: 0;
}

/* BETA badge */
.beta-badge {
    background: #ff6b35;
    color: white;
    font-size: 9px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 8px;
    margin-left: 6px;
    text-transform: uppercase;
    vertical-align: middle;
}

/* ==================== PAYWALL ==================== */
#paywallOverlay {
    position: fixed; inset: 0; z-index: 10000;
    background: rgba(0,0,0,0.85);
    display: flex; align-items: center; justify-content: center;
    padding: 16px;
}
#paywallModal {
    background: #1a1a2e; border-radius: 20px;
    padding: 28px 24px; max-width: 400px; width: 100%;
    border: 1px solid #333; position: relative;
    max-height: 90vh; overflow-y: auto;
}
#paywallClose {
    position: absolute; top: 14px; right: 14px;
    background: none; border: none; color: #888;
    font-size: 20px; cursor: pointer; padding: 4px 8px;
}
.paywall-header { text-align: center; margin-bottom: 20px; }
.paywall-icon { font-size: 48px; margin-bottom: 8px; }
.paywall-header h2 { color: #fff; margin: 0 0 8px; font-size: 22px; }
.paywall-header p { color: #aaa; font-size: 14px; margin: 0; }
.paywall-features { margin-bottom: 20px; }
.paywall-feature { color: #ccc; font-size: 14px; padding: 4px 0; }
.paywall-plans { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.paywall-plan {
    background: #2a2a3e; border: 1px solid #444; border-radius: 14px;
    padding: 14px 16px; cursor: pointer; text-align: center;
    display: flex; flex-direction: column; gap: 2px;
    transition: border-color 0.2s;
}
.paywall-plan:hover, .paywall-plan:active { border-color: #7c4dff; }
.paywall-plan.best-value { border-color: #7c4dff; background: #2a1a4e; position: relative; }
.plan-badge {
    position: absolute; top: -10px; left: 50%; transform: translateX(-50%);
    background: #7c4dff; color: #fff; font-size: 10px; font-weight: bold;
    padding: 2px 10px; border-radius: 10px; white-space: nowrap;
}
.plan-title { color: #fff; font-size: 16px; font-weight: 600; }
.plan-price { color: #7c4dff; font-size: 20px; font-weight: bold; }
.plan-sub { color: #4caf50; font-size: 12px; }
.paywall-restore {
    width: 100%; background: none; border: none;
    color: #666; font-size: 13px; cursor: pointer; padding: 8px;
    text-decoration: underline;
}
.paywall-legal { color: #555; font-size: 12px; text-align: center; margin: 8px 0 0; }

/* BETA badge */
.beta-badge {
    background: #ff9800; color: #000; font-size: 10px; font-weight: bold;
    padding: 2px 6px; border-radius: 6px; margin-left: 6px;
    text-transform: uppercase; vertical-align: middle;
}

/* ==================== RTL Support (Arabic) ==================== */
[dir="rtl"] {
    text-align: right;
}

[dir="rtl"] .breadcrumbs {
    direction: rtl;
}

[dir="rtl"] .breadcrumbs .crumb::after {
    content: ' ‹ ';
}

[dir="rtl"] .back-btn {
    transform: scaleX(-1);
}

[dir="rtl"] .info-panel .detail-label {
    text-align: right;
}

[dir="rtl"] .body-part-card {
    text-align: center;
}

[dir="rtl"] .nav-header h2 {
    text-align: right;
}

[dir="rtl"] .beta-badge {
    margin-left: 0;
    margin-right: 6px;
}

[dir="rtl"] .menu-card .card-content {
    text-align: right;
}

[dir="rtl"] .setting-row {
    flex-direction: row-reverse;
}

[dir="rtl"] .leaderboard-entry .rank {
    margin-left: 12px;
    margin-right: 0;
}

[dir="rtl"] .challenge-hints li::before {
    margin-left: 8px;
    margin-right: 0;
}

/* ==================== ACCESSIBILITY ==================== */

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Light theme is the default; this documents the intent */
@media (prefers-color-scheme: light) {
    body:not(.dark-mode) {
        /* Already light by default */
    }
}

/* Screen reader only - visually hidden but accessible */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ==================== CLASSES (Teacher Free + Class plan) ==================== */

.classes-header { margin-bottom: 16px; }
.classes-header h2 { margin: 0 0 4px; }
.screen-sub { color: var(--text-muted, #888); font-size: 0.92em; margin: 0; }

.classes-actions {
    display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0 24px;
}
.classes-actions .btn { flex: 1; min-width: 140px; }

.classes-section { margin-bottom: 24px; }
.classes-section h3 { font-size: 1em; margin: 0 0 8px; color: var(--text-muted, #aaa); }
.classes-list { display: flex; flex-direction: column; gap: 8px; }

.class-card {
    display: flex; gap: 12px; padding: 12px;
    background: var(--card-bg, #1e293b); border-radius: 10px;
    cursor: pointer; transition: transform 0.15s, background 0.15s;
    border: 1px solid var(--border, rgba(255,255,255,0.08));
}
.class-card:hover { transform: translateY(-1px); background: var(--card-bg-hover, #263448); }
.class-card-icon { font-size: 28px; flex-shrink: 0; }
.class-card-body { flex: 1; min-width: 0; }
.class-card-name { font-weight: 600; font-size: 1.05em; }
.class-card-meta { font-size: 0.85em; color: var(--text-muted, #aaa); margin: 2px 0; }
.class-card-stats { font-size: 0.85em; color: var(--text-muted, #888); }

.classes-empty {
    text-align: center; padding: 40px 20px; color: var(--text-muted, #888);
}

/* Class detail */
.class-detail-header { margin-bottom: 12px; }
.class-detail-header h2 { margin: 0 0 4px; }
.class-teacher-bar, .class-student-bar {
    display: flex; align-items: center; justify-content: space-between;
    gap: 10px; flex-wrap: wrap;
    background: var(--card-bg, #1e293b); padding: 12px; border-radius: 10px;
    margin-bottom: 16px;
}
.class-code-display {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.class-code-label { font-size: 0.9em; color: var(--text-muted, #aaa); }
.class-code-value {
    font-family: 'Courier New', monospace; font-weight: 700; font-size: 1.4em;
    letter-spacing: 4px; padding: 6px 12px;
    background: var(--bg-strong, #0f172a); border-radius: 6px;
}
.class-members-list { display: flex; flex-direction: column; gap: 6px; }
.class-member-row {
    display: flex; align-items: center; gap: 10px; padding: 8px 12px;
    background: var(--card-bg, #1e293b); border-radius: 8px;
}
.class-member-row.is-me { background: var(--accent-bg, rgba(59,130,246,0.15)); border: 1px solid var(--accent, #3b82f6); }
.class-member-row .member-rank {
    font-weight: 700; min-width: 36px; color: var(--text-muted, #aaa);
}
.class-member-row .member-name { flex: 1; font-weight: 500; }
.class-member-row .member-stats { font-size: 0.85em; color: var(--text-muted, #aaa); }

/* Modal field label (already used elsewhere) */
.modal-field-label { display:block; font-size: 0.85em; color: var(--text-muted, #aaa); margin-top: 8px; }
.modal-actions { display:flex; gap:8px; justify-content: flex-end; margin-top: 12px; }
.modal-actions .btn { flex: 1; }

/* ==================== ADMIN NOTIFICATIONS (user-facing) ==================== */

.notif-bell {
    position: relative;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    color: inherit;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    font-size: 20px;
    cursor: pointer;
    margin-right: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, transform 0.15s;
}
.notif-bell:hover { background: rgba(255,255,255,0.15); transform: scale(1.05); }
.notif-bell:active { transform: scale(0.95); }
.notif-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    background: #ef4444;
    color: white;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    box-sizing: border-box;
    box-shadow: 0 0 0 2px var(--bg-dark, #0f172a);
}

.notifications-list { display: flex; flex-direction: column; gap: 10px; }
.notif-card {
    display: flex;
    gap: 12px;
    padding: 14px;
    background: var(--card-bg, #1e293b);
    border-radius: 10px;
    border-left: 3px solid var(--accent, #3b82f6);
    cursor: pointer;
    transition: transform 0.15s, background 0.15s;
    position: relative;
}
.notif-card:hover { background: var(--card-bg-hover, #263448); transform: translateY(-1px); }
.notif-card.is-read { opacity: 0.6; border-left-color: var(--border, rgba(255,255,255,0.12)); }
.notif-card.type-warning { border-left-color: #f59e0b; }
.notif-card.type-announcement { border-left-color: #8b5cf6; }
.notif-card.type-update { border-left-color: #10b981; }
.notif-card.type-success { border-left-color: #10b981; }

.notif-icon { font-size: 26px; flex-shrink: 0; line-height: 1; padding-top: 2px; }
.notif-body { flex: 1; min-width: 0; }
.notif-head { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.notif-title { font-weight: 600; }
.notif-time { font-size: 0.78em; color: var(--text-muted, #888); flex-shrink: 0; }
.notif-text { font-size: 0.92em; color: var(--text-muted-2, #b7c0d0); line-height: 1.4; white-space: pre-wrap; }

.notif-dot {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ef4444;
}

/* Markdown in notification body (user side) */
.notif-text strong { font-weight: 700; }
.notif-text em { font-style: italic; }
.notif-text a {
    color: var(--accent, #3b82f6);
    text-decoration: underline;
}
.notif-text ul { padding-left: 20px; margin: 6px 0; }
.notif-text li { margin: 2px 0; }
.notif-text blockquote {
    border-left: 3px solid var(--accent, #3b82f6);
    padding-left: 10px;
    color: var(--text-muted, #aaa);
    margin: 6px 0;
}

/* Hide focus outline on programmatically-focused screen headings (WCAG focus
   management adds tabindex="-1" to h1/h2/h3 on screen change so screen readers
   announce them — but for sighted users the outline is just visual noise). */
[tabindex="-1"]:focus { outline: none; }

/* Support tickets */
.ticket-status {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.78em;
    font-weight: 600;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
}
.ticket-status.status-open { background: rgba(251,191,36,0.15); color: #fbbf24; border-color: rgba(251,191,36,0.3); }
.ticket-status.status-in_progress { background: rgba(59,130,246,0.15); color: #60a5fa; border-color: rgba(59,130,246,0.3); }
.ticket-status.status-resolved { background: rgba(16,185,129,0.15); color: #34d399; border-color: rgba(16,185,129,0.3); }
.ticket-status.status-closed { background: rgba(107,114,128,0.15); color: #9ca3af; border-color: rgba(107,114,128,0.3); }

.ticket-reply {
    margin-top: 10px;
    padding: 10px 12px;
    background: rgba(59,130,246,0.08);
    border-left: 3px solid var(--accent, #3b82f6);
    border-radius: 0 6px 6px 0;
    font-size: 0.92em;
    line-height: 1.4;
}

/* ==================== APP MODAL OVERLAY (.modal pattern used by joinClass/createClass/support) ==================== */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
    box-sizing: border-box;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}
.modal.hidden { display: none !important; }
.modal > .modal-content {
    background: var(--bg-card, #1e293b);
    color: inherit;
    border-radius: 14px;
    padding: 24px;
    max-width: 520px;
    width: 100%;
    max-height: 92vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    border: 1px solid var(--border, rgba(255,255,255,0.08));
}
.modal > .modal-content h3 {
    margin: 0 0 8px;
    font-size: 1.25em;
}
.modal > .modal-content input[type="text"],
.modal > .modal-content input[type="password"],
.modal > .modal-content input[type="datetime-local"],
.modal > .modal-content select,
.modal > .modal-content textarea {
    background: var(--bg-strong, #0f172a);
    color: inherit;
    border: 1px solid var(--border, rgba(255,255,255,0.1));
    border-radius: 8px;
}
.modal > .modal-content input:focus,
.modal > .modal-content select:focus,
.modal > .modal-content textarea:focus {
    outline: 2px solid var(--accent, #3b82f6);
    outline-offset: -1px;
}

/* Offline content preload progress */
.offline-preload-status {
    position: fixed;
    top: calc(14px + env(safe-area-inset-top));
    right: calc(14px + env(safe-area-inset-right));
    width: min(340px, calc(100vw - 28px));
    z-index: 9998;
    pointer-events: none;
    opacity: 0;
    transform: translateY(-8px) scale(0.98);
    background:
        linear-gradient(135deg, rgba(12, 23, 34, 0.93), rgba(13, 54, 58, 0.89));
    color: #fff;
    border: 1px solid rgba(132, 246, 225, 0.24);
    border-radius: 16px;
    padding: 10px 12px 11px;
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.22);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    font: 12px system-ui, sans-serif;
    transition: opacity 0.18s ease, transform 0.18s ease;
}
.offline-preload-status.is-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}
.offline-preload-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
    line-height: 1.25;
}
#offlinePreloadLabel {
    font-weight: 650;
    letter-spacing: 0.01em;
}
#offlinePreloadCount {
    color: rgba(210, 255, 247, 0.9);
    font-variant-numeric: tabular-nums;
}
.offline-preload-progress {
    width: 100%;
    height: 5px;
    appearance: none;
    -webkit-appearance: none;
    border: 0;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.16);
}
.offline-preload-progress::-webkit-progress-bar {
    background: rgba(255, 255, 255, 0.16);
    border-radius: 999px;
}
.offline-preload-progress::-webkit-progress-value {
    background: linear-gradient(90deg, #54f4d3, #9fffb8);
    border-radius: 999px;
    transition: width 0.2s ease;
}
.offline-preload-progress::-moz-progress-bar {
    background: linear-gradient(90deg, #54f4d3, #9fffb8);
    border-radius: 999px;
}
@media (max-width: 560px) {
    .offline-preload-status {
        top: calc(10px + env(safe-area-inset-top));
        left: 10px;
        right: 10px;
        width: auto;
        padding: 9px 10px 10px;
    }
}

/* ==================== PODGLĄD 3D NARZĄDU (eksploracja) ==================== */

.view-3d-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    width: 100%;
    margin-top: 10px;
    padding: 11px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: linear-gradient(135deg, #6a3df0, #3b6fe2);
    color: #fff;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(90, 70, 240, 0.35);
    transition: transform .12s, box-shadow .12s;
}
.view-3d-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(90, 70, 240, 0.45); }
.view-3d-btn:active { transform: translateY(0); }
.view-3d-btn.hidden { display: none; }

.organ3d-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    background: #0a0d14;
}
.organ3d-modal.hidden { display: none; }

.organ3d-header {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.organ3d-title { color: #eef2f7; font-weight: 700; font-size: 17px; }
.organ3d-close {
    width: 38px; height: 38px; border-radius: 50%;
    border: 1px solid rgba(255,255,255,.15);
    background: rgba(255,255,255,.08); color: #fff; font-size: 18px; cursor: pointer;
}
.organ3d-close:hover { background: rgba(255,255,255,.18); }

.organ3d-viewer { flex: 1 1 auto; position: relative; min-height: 0; }
.organ3d-loading {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    color: #8aa; font-size: 14px;
}

.organ3d-controls {
    flex: 0 0 auto;
    display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; justify-content: center;
    padding: 10px 12px;
    background: rgba(14,18,26,.85);
    border-top: 1px solid rgba(255,255,255,.08);
}
.o3d-btn {
    display: flex; align-items: center; gap: 6px;
    padding: 8px 12px; border-radius: 10px;
    border: 1px solid rgba(255,255,255,.14);
    background: rgba(255,255,255,.08); color: #eef2f7; font-weight: 600; font-size: 13px; cursor: pointer;
}
.o3d-btn:hover { background: rgba(255,255,255,.16); }
.o3d-btn.active { background: #3b6fe2; border-color: #3b6fe2; color: #fff; }
.o3d-cross { display: flex; align-items: center; gap: 6px; color: #9fb0c4; font-size: 12px; }
.o3d-cross input[type=range] { width: 110px; accent-color: #e23b3b; }

.organ3d-credit {
    flex: 0 0 auto;
    padding: 6px 12px calc(8px + env(safe-area-inset-bottom));
    text-align: center;
    font-size: 11px; color: #6f7f93;
    background: rgba(14,18,26,.85);
}
.organ3d-credit:empty { display: none; }

/* Eksplorator 3D - pasek warstw (układów ciała) */
.explorer-layers {
    flex: 0 0 auto;
    display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center;
    padding: 10px 12px 4px;
    background: rgba(14,18,26,.85);
}
.explorer-chip {
    padding: 7px 14px; border-radius: 100px;
    border: 1px solid rgba(255,255,255,.16);
    background: rgba(255,255,255,.06); color: #c7d2e0;
    font-weight: 600; font-size: 13px; cursor: pointer;
    transition: background .15s, border-color .15s, color .15s;
}
.explorer-chip:hover { background: rgba(255,255,255,.12); }
.explorer-chip.active { background: #6a3df0; border-color: #6a3df0; color: #fff; }
.explorer-chip.loading { opacity: .75; cursor: progress; }
.explorer-chip.loading::after {
    content: ''; display: inline-block; width: 9px; height: 9px; margin-left: 7px;
    vertical-align: -1px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff;
    border-radius: 50%; animation: bxspin .7s linear infinite;
}
@keyframes bxspin { to { transform: rotate(360deg); } }

/* ===================== CLINICAL REASONING SIMULATOR ===================== */

/* Patient file (Teczka) button on case screens */
.case-file-btn {
    background: var(--card);
    border: 1px solid var(--border, rgba(0,0,0,.12));
    border-radius: var(--radius);
    padding: 6px 12px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    white-space: nowrap;
    transition: transform .15s, box-shadow .15s;
}
.case-file-btn:hover { transform: translateY(-1px); box-shadow: 0 2px 8px rgba(0,0,0,.15); }
.case-file-btn.has-new { animation: caseFilePulse 1.2s ease-out 2; }
@keyframes caseFilePulse {
    0%   { box-shadow: 0 0 0 0 rgba(76,175,80,.55); }
    100% { box-shadow: 0 0 0 14px rgba(76,175,80,0); }
}

/* Patient file modal */
.case-file-modal {
    position: fixed; inset: 0; z-index: 2000;
    background: rgba(0,0,0,.55);
    display: flex; align-items: center; justify-content: center;
    padding: 16px;
}
.case-file-modal.hidden { display: none; }
.case-file-card {
    background: var(--card);
    border-radius: var(--radius);
    max-width: 460px; width: 100%;
    max-height: 80vh; overflow-y: auto;
    box-shadow: 0 12px 40px rgba(0,0,0,.4);
}
.case-file-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 18px; border-bottom: 1px solid var(--border, rgba(0,0,0,.1));
    position: sticky; top: 0; background: var(--card);
}
.case-file-head h3 { margin: 0; font-size: 17px; }
.case-file-close {
    background: none; border: none; font-size: 20px; cursor: pointer;
    color: var(--text-light); line-height: 1;
}
.case-file-body { padding: 14px 18px; }
.case-file-section { margin-bottom: 16px; }
.case-file-section h4 { margin: 0 0 6px; font-size: 16px; }
.case-file-section h5 { margin: 0 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-light); }
.case-file-section ul { margin: 0; padding-left: 20px; }
.case-file-section li { margin: 4px 0; font-size: 14px; line-height: 1.5; }
.case-file-section li.muted { color: var(--text-light); font-style: italic; list-style: none; margin-left: -20px; }
.case-file-history-section { background: color-mix(in srgb, var(--accent, #4caf50) 8%, transparent); border-radius: var(--radius); padding: 10px 12px; }
.case-file-history { margin: 0; font-size: 14px; line-height: 1.6; color: var(--text); white-space: pre-line; }

/* Step tags + subtitles (differential / tests / exam) */
.case-step-tag {
    display: inline-block;
    font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
    color: var(--accent, #4caf50);
    background: color-mix(in srgb, var(--accent, #4caf50) 12%, transparent);
    padding: 3px 10px; border-radius: 999px; margin-bottom: 10px;
}
.case-step-sub { font-size: 13px; color: var(--text-light); margin: 0 0 14px; line-height: 1.5; }
.case-examine-instruction { font-size: 14px; color: var(--text-light); margin: 8px 0 16px; line-height: 1.6; }

/* Paid hint button on navigation */
.case-hint-btn { font-size: 13px; padding: 6px 14px; opacity: .9; }

/* Tests step */
.case-tests-options { display: flex; flex-direction: column; gap: 8px; margin: 6px 0 16px; }
.case-test-option {
    text-align: left; padding: 12px 14px;
    background: var(--card); color: var(--text);
    border: 1.5px solid var(--border, rgba(0,0,0,.15));
    border-radius: var(--radius); font-size: 15px; cursor: pointer;
    transition: border-color .15s, background .15s;
}
.case-test-option:hover { border-color: var(--accent, #4caf50); }
.case-test-option.selected { border-color: var(--accent, #4caf50); background: color-mix(in srgb, var(--accent, #4caf50) 10%, transparent); }
.case-test-option .test-check { font-size: 16px; margin-right: 4px; }
.case-test-option:disabled { opacity: .65; cursor: default; }
.case-tests-result { margin-top: 14px; display: flex; flex-direction: column; gap: 6px; }
.case-tests-result.hidden { display: none; }
.test-finding { font-size: 14px; padding: 8px 12px; border-radius: var(--radius); line-height: 1.45; }
.test-finding.ok    { background: rgba(76,175,80,.12);  border-left: 3px solid #4caf50; }
.test-finding.waste { background: rgba(255,152,0,.12);  border-left: 3px solid #ff9800; }
.test-finding.miss  { background: rgba(244,67,54,.12);  border-left: 3px solid #f44336; }

/* Educational explanation on the result screen */
.case-explanation {
    text-align: left;
    margin: 16px 0;
    padding: 14px 16px;
    background: var(--bg);
    border-left: 4px solid var(--accent, #4caf50);
    border-radius: var(--radius);
}
.case-explanation-title { margin: 0 0 8px; font-size: 15px; color: var(--text); }
.case-explanation-body {
    margin: 0; font-size: 14px; line-height: 1.65;
    color: var(--text-light); white-space: pre-line;
}
