/* =====================================================
   SPACE MATH - Theme Spatial Mobile-First
   ===================================================== */

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

:root {
    /* Couleurs spatiales */
    --space-dark: #0d0d2b;
    --space-purple: #1a1a3e;
    --space-blue: #2d3a8c;
    --nebula-pink: #ff6b9d;
    --nebula-purple: #c56cf0;
    --star-gold: #ffd700;
    --star-silver: #e8e8e8;

    /* Couleurs de jeu */
    --gold: #FFD700;
    --gold-dark: #DAA520;
    --silver: #C0C0C0;

    /* UI */
    --success: #00C853;
    --error: #FF1744;
    --bg-dark: #12122a;
    --bg-card: rgba(255, 255, 255, 0.95);
    --text-dark: #1a1a2e;
    --text-light: #666;
    --shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
    --shadow-strong: 0 12px 40px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 30px rgba(197, 108, 240, 0.3);
    --radius: 20px;
    --radius-sm: 12px;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: linear-gradient(150deg, var(--space-dark) 0%, var(--space-purple) 40%, #1a0a2e 70%, #0a0a1a 100%);
    min-height: 100vh;
    min-height: 100dvh;
    color: var(--text-dark);
    padding: 12px;
    padding-bottom: env(safe-area-inset-bottom, 20px);
    position: relative;
}

/* Etoiles en arriere-plan */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        radial-gradient(2px 2px at 20px 30px, white, transparent),
        radial-gradient(2px 2px at 40px 70px, rgba(255,255,255,0.8), transparent),
        radial-gradient(1px 1px at 90px 40px, white, transparent),
        radial-gradient(2px 2px at 160px 120px, rgba(255,255,255,0.9), transparent),
        radial-gradient(1px 1px at 230px 80px, white, transparent),
        radial-gradient(2px 2px at 300px 150px, rgba(255,255,255,0.7), transparent),
        radial-gradient(1px 1px at 100px 200px, white, transparent),
        radial-gradient(2px 2px at 200px 250px, rgba(255,255,255,0.8), transparent),
        radial-gradient(1px 1px at 350px 200px, white, transparent);
    background-size: 400px 300px;
    pointer-events: none;
    z-index: 0;
    animation: twinkle 4s ease-in-out infinite alternate;
}

@keyframes twinkle {
    0% { opacity: 0.5; }
    100% { opacity: 1; }
}

.container {
    max-width: 500px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

/* =====================================================
   HEADER
   ===================================================== */
header {
    background: var(--bg-card);
    padding: 18px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-strong), var(--shadow-glow);
    margin-bottom: 15px;
    position: relative;
    border: 2px solid rgba(197, 108, 240, 0.2);
}

.header-top {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.header-icon {
    font-size: 2.2em;
}

header h1 {
    color: var(--space-purple);
    font-size: 1.5em;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    background: linear-gradient(135deg, var(--space-blue) 0%, var(--nebula-purple) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

header p {
    color: var(--text-light);
    font-size: 0.8em;
    margin-top: 5px;
    text-align: center;
}

/* User info bar */
.user-info {
    display: flex;
    align-items: center;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 2px dashed #ddd;
    gap: 10px;
}

.user-avatar {
    font-size: 2em;
}

.user-details {
    flex: 1;
}

.user-name {
    font-weight: 800;
    color: var(--space-purple);
    font-size: 1.05em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.user-coins {
    display: flex;
    gap: 10px;
    margin-top: 4px;
    font-size: 0.9em;
    flex-wrap: wrap;
}

.coins-gold, .coins-silver, .coins-progress {
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: 700;
    font-size: 0.9em;
    padding: 4px 8px;
    border-radius: 12px;
}

.coins-gold {
    color: #b8860b;
    background: linear-gradient(135deg, #fff8dc 0%, #ffeeba 100%);
}

.coins-silver {
    color: #e67e00;
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
}

.coins-progress {
    color: var(--space-blue);
    background: linear-gradient(135deg, #e8e0f0 0%, #d4c4e8 100%);
    font-size: 0.85em;
}

.stat-clickable {
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-clickable:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

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

.user-actions {
    display: flex;
    gap: 8px;
}

/* =====================================================
   SCREENS
   ===================================================== */
.screen {
    display: none;
    background: var(--bg-card);
    padding: 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-strong), var(--shadow-glow);
    border: 2px solid rgba(197, 108, 240, 0.2);
}

.screen.active {
    display: block;
    animation: slideUp 0.3s ease;
}

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

/* =====================================================
   BUTTONS
   ===================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 28px;
    font-size: 1.05em;
    font-weight: 700;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--nebula-purple) 0%, #9b4dca 100%);
    color: white;
    box-shadow: 0 6px 20px rgba(197, 108, 240, 0.5);
}

.btn-primary:hover, .btn-primary:active {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 10px 30px rgba(197, 108, 240, 0.6);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--space-blue) 0%, #1a2a6c 100%);
    color: white;
    box-shadow: 0 6px 20px rgba(45, 58, 140, 0.4);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--space-purple);
    color: var(--space-purple);
    padding: 13px 22px;
}

.btn-outline:hover {
    background: var(--space-purple);
    color: white;
    transform: translateY(-2px);
}

.btn-danger {
    background: transparent;
    border: 2px solid var(--error);
    color: var(--error);
}

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

.btn-block { width: 100%; }
.btn-sm { padding: 8px 14px; font-size: 0.85em; }
.btn-icon { padding: 8px 12px; }

/* =====================================================
   LOGIN SCREEN
   ===================================================== */
.login-form {
    text-align: center;
}

.login-form h2 {
    color: var(--space-purple);
    margin-bottom: 5px;
    font-size: 1.6em;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.login-welcome {
    font-size: 4em;
    margin-bottom: 15px;
}

.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-dark);
    font-size: 0.95em;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 16px 18px;
    border: 3px solid #d0d5dd;
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-weight: 500;
    transition: all 0.25s ease;
    background: #FAFBFC;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--nebula-purple);
    box-shadow: 0 0 0 4px rgba(197, 108, 240, 0.15);
    background: white;
}

/* =====================================================
   SETUP SCREEN
   ===================================================== */
.game-options {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.option-group h3 {
    margin-bottom: 10px;
    color: var(--space-purple);
    font-size: 0.95em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.mode-cards-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px;
}

.mode-cards-grid .option-card {
    flex: none;
    width: 100%;
    min-height: 80px;
    padding: 8px 4px;
}

.mode-cards-grid .option-card .card-icon {
    font-size: 1.4em;
}

.mode-cards-grid .option-card .card-content h4 {
    font-size: 0.7em;
    white-space: nowrap;
}

.mode-cards-grid .option-card .card-content p {
    font-size: 0.6em;
    white-space: nowrap;
}

.option-cards {
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
}

.option-cards .option-card {
    flex: 1;
    min-width: 0;
}

.option-card {
    padding: 12px 8px;
    border: 3px solid #d0d5dd;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 4px;
    background: white;
}

.option-card:hover {
    border-color: var(--nebula-purple);
    transform: translateY(-2px);
}

.option-card.selected {
    border-color: var(--nebula-purple);
    background: linear-gradient(135deg, #f5e6ff 0%, #fff 100%);
    box-shadow: 0 4px 15px rgba(197, 108, 240, 0.3);
    transform: translateY(-2px);
}

.option-card .card-icon {
    font-size: 1.6em;
}

.option-card .card-content h4 {
    font-size: 0.8em;
    color: var(--text-dark);
    font-weight: 700;
}

.option-card .card-content p {
    font-size: 0.65em;
    color: var(--text-light);
    margin-top: 1px;
    line-height: 1.2;
}

/* Tables selection */
.tables-grid {
    grid-template-columns: repeat(5, 1fr) !important;
}

.pack-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.pack-card {
    padding: 14px 10px;
    border: 3px solid #d0d5dd;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.25s ease;
    text-align: center;
    font-weight: 700;
    font-size: 0.95em;
}

.pack-card:hover {
    border-color: var(--nebula-purple);
    transform: scale(1.05);
}

.pack-card.selected {
    border-color: var(--nebula-purple);
    background: linear-gradient(135deg, var(--nebula-purple) 0%, #9b4dca 100%);
    color: white;
    transform: scale(1.08);
    box-shadow: 0 4px 15px rgba(197, 108, 240, 0.4);
}

/* =====================================================
   GAME SCREEN
   ===================================================== */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 12px;
    border-bottom: 2px dashed #eee;
}

.game-stats {
    display: flex;
    gap: 15px;
}

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

.stat-value {
    font-size: 1.3em;
    font-weight: 800;
    color: var(--space-purple);
}

.stat-label {
    font-size: 0.7em;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.progress-bar {
    height: 10px;
    background: #d0d5dd;
    border-radius: 5px;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--space-blue), var(--nebula-purple), var(--nebula-pink));
    border-radius: 5px;
    transition: width 0.4s ease;
    box-shadow: 0 2px 8px rgba(197, 108, 240, 0.4);
}

/* Question area */
.question-area {
    text-align: center;
    padding: 15px 0;
}

.question-instruction {
    font-size: 0.95em;
    color: var(--text-light);
    margin-bottom: 12px;
}

.question-prompt {
    font-size: 2.2em;
    font-weight: 800;
    color: var(--space-purple);
    margin: 15px 0;
    padding: 25px;
    background: linear-gradient(135deg, #f0e6ff 0%, #e8f0ff 100%);
    border-radius: var(--radius-sm);
    border: 3px solid rgba(197, 108, 240, 0.2);
    font-family: 'Courier New', monospace;
}

/* Answer area */
.answer-area {
    margin-top: 20px;
}

.answer-input input {
    width: 100%;
    padding: 16px;
    font-size: 1.3em;
    border: 3px solid #e0e0e0;
    border-radius: var(--radius-sm);
    text-align: center;
    font-family: 'Courier New', monospace;
    font-weight: 700;
}

.answer-input input:focus {
    outline: none;
    border-color: var(--nebula-purple);
}

/* QCM */
.qcm-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.qcm-option {
    padding: 18px 12px;
    border: 4px solid #d0d5dd;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.25s ease;
    font-size: 1.2em;
    font-weight: 700;
    background: white;
    text-align: center;
    font-family: 'Courier New', monospace;
}

.qcm-option:hover {
    border-color: var(--nebula-purple);
    transform: scale(1.03);
}

.qcm-option:active {
    transform: scale(0.97);
}

.qcm-option.correct {
    border-color: var(--success);
    background: linear-gradient(135deg, #c8f7d6 0%, #d4edda 100%);
    color: #00802b;
    box-shadow: 0 4px 15px rgba(0, 200, 83, 0.3);
}

.qcm-option.incorrect {
    border-color: var(--error);
    background: linear-gradient(135deg, #ffe0e3 0%, #f8d7da 100%);
    color: #cc0022;
    box-shadow: 0 4px 15px rgba(255, 23, 68, 0.3);
}

.qcm-option.disabled {
    pointer-events: none;
    opacity: 0.7;
}

/* Feedback */
.feedback {
    margin-top: 20px;
    padding: 22px;
    border-radius: var(--radius-sm);
    text-align: center;
    font-weight: 700;
    font-size: 1.15em;
    display: none;
    border: 3px solid transparent;
}

.feedback.show {
    display: block;
    animation: bounceIn 0.4s ease;
}

@keyframes bounceIn {
    0% { transform: scale(0.5); opacity: 0; }
    70% { transform: scale(1.05); }
    100% { transform: scale(1); opacity: 1; }
}

.feedback.correct {
    background: linear-gradient(135deg, #c8f7d6 0%, #b8f0c8 100%);
    color: #00802b;
    border-color: var(--success);
    box-shadow: 0 6px 20px rgba(0, 200, 83, 0.3);
}

.feedback.incorrect {
    background: linear-gradient(135deg, #ffe0e3 0%, #f5c6cb 100%);
    color: #cc0022;
    border-color: var(--error);
    box-shadow: 0 6px 20px rgba(255, 23, 68, 0.3);
}

.feedback .coins-earned {
    margin-top: 8px;
    font-size: 1.3em;
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
}

.feedback .coins-earned.gold {
    background: linear-gradient(135deg, #fff8dc 0%, #ffeeba 100%);
    color: #b8860b;
}

.feedback .coins-earned.stars {
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
    color: #e67e00;
}

.correct-answer {
    margin-top: 8px;
    font-weight: normal;
    font-size: 0.9em;
}

/* Next button */
.next-btn {
    margin-top: 15px;
    display: none;
}

.next-btn.show {
    display: block;
}

/* =====================================================
   RESULTS SCREEN
   ===================================================== */
.results-summary {
    text-align: center;
}

.results-emoji {
    font-size: 5em;
    margin-bottom: 15px;
    animation: bounce 1s ease infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.results-title {
    font-size: 1.8em;
    font-weight: 800;
    color: var(--space-purple);
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.results-coins {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin: 25px 0;
    padding: 25px;
    background: linear-gradient(135deg, #f0e6ff 0%, #e8f0ff 100%);
    border-radius: var(--radius-sm);
    border: 3px solid rgba(197, 108, 240, 0.2);
}

.coin-display {
    text-align: center;
    padding: 15px 20px;
    border-radius: var(--radius-sm);
}

.coin-display.gold {
    background: linear-gradient(135deg, #fff8dc 0%, #ffeeba 100%);
}

.coin-display.stars {
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
}

.coin-display .coin-icon {
    font-size: 2.8em;
}

.coin-display .coin-value {
    font-size: 1.6em;
    font-weight: 800;
    margin-top: 8px;
}

.coin-display.gold .coin-value {
    color: #b8860b;
}

.coin-display.stars .coin-value {
    color: #e67e00;
}

.coin-display .coin-label {
    font-size: 0.75em;
    color: var(--text-light);
}

.results-stats {
    margin: 15px 0;
    padding: 15px;
    background: #f8f4ff;
    border-radius: var(--radius-sm);
    font-size: 0.95em;
}

.results-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

/* =====================================================
   SOLAR SYSTEM MAP SCREEN
   ===================================================== */
.map-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.map-title {
    color: var(--space-purple);
    font-size: 1.2em;
    font-weight: 800;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 10px;
}

.map-scroll {
    overflow-x: auto;
    overflow-y: hidden;
    padding: 10px 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--nebula-purple) #e0e0e0;
}

.map-scroll::-webkit-scrollbar {
    height: 8px;
}

.map-scroll::-webkit-scrollbar-track {
    background: #e0e0e0;
    border-radius: 4px;
}

.map-scroll::-webkit-scrollbar-thumb {
    background: var(--nebula-purple);
    border-radius: 4px;
}

.map-path.solar-system {
    position: relative;
    height: 320px;
    min-width: 1100px;
    background: linear-gradient(180deg,
        rgba(13, 13, 43, 0.8) 0%,
        rgba(26, 26, 62, 0.6) 50%,
        rgba(13, 13, 43, 0.8) 100%
    );
    border-radius: var(--radius);
    padding: 20px;
    border: 3px solid rgba(197, 108, 240, 0.3);
}

/* Orbites en arriere-plan */
.map-path.solar-system::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 40px;
    right: 40px;
    height: 4px;
    background: linear-gradient(90deg,
        transparent,
        rgba(197, 108, 240, 0.3) 10%,
        rgba(197, 108, 240, 0.5) 50%,
        rgba(197, 108, 240, 0.3) 90%,
        transparent
    );
    transform: translateY(-50%);
    border-radius: 2px;
}

.map-location {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: transform 0.2s ease;
    z-index: 2;
}

.map-location:hover {
    transform: scale(1.1);
}

/* Positionnement des planetes */
.map-location:nth-child(1) { left: 30px; top: 120px; }
.map-location:nth-child(2) { left: 130px; top: 140px; }
.map-location:nth-child(3) { left: 230px; top: 100px; }
.map-location:nth-child(4) { left: 330px; top: 160px; }
.map-location:nth-child(5) { left: 430px; top: 80px; }
.map-location:nth-child(6) { left: 550px; top: 140px; }
.map-location:nth-child(7) { left: 680px; top: 100px; }
.map-location:nth-child(8) { left: 810px; top: 160px; }
.map-location:nth-child(9) { left: 920px; top: 120px; }
.map-location:nth-child(10) { left: 1020px; top: 140px; }

.location-marker {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2em;
    background: linear-gradient(180deg, #555 0%, #333 100%);
    border: 4px solid #444;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5), inset 0 -5px 15px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.map-location.unlocked .location-marker {
    background: linear-gradient(180deg, var(--space-blue) 0%, #1a2a6c 100%);
    border-color: var(--nebula-purple);
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(197, 108, 240, 0.4), inset 0 -5px 15px rgba(0, 0, 0, 0.2);
}

.map-location.unlocked:hover .location-marker {
    box-shadow: 0 8px 30px rgba(197, 108, 240, 0.6), 0 0 20px rgba(197, 108, 240, 0.3);
}

.map-location.current .location-marker {
    background: linear-gradient(180deg, var(--gold) 0%, var(--gold-dark) 100%);
    border-color: #ffd700;
    animation: pulse 2s ease infinite;
    width: 70px;
    height: 70px;
    font-size: 2.2em;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 6px 20px rgba(255, 215, 0, 0.6), inset 0 -5px 15px rgba(0, 0, 0, 0.2); }
    50% { box-shadow: 0 6px 20px rgba(255, 215, 0, 0.6), 0 0 0 15px rgba(255, 215, 0, 0.2), inset 0 -5px 15px rgba(0, 0, 0, 0.2); }
}

.map-location.locked .location-marker {
    background: linear-gradient(180deg, #666 0%, #444 100%);
    border-color: #555;
    cursor: not-allowed;
    filter: grayscale(0.5);
}

.location-name-label {
    margin-top: 8px;
    font-size: 0.75em;
    font-weight: 700;
    color: white;
    background: rgba(0, 0, 0, 0.7);
    padding: 4px 10px;
    border-radius: 10px;
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* =====================================================
   MODAL
   ===================================================== */
.location-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    animation: fadeIn 0.3s ease;
}

.location-modal-overlay.show {
    display: flex;
}

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

.location-modal {
    background: var(--bg-card);
    border-radius: var(--radius);
    max-width: 340px;
    width: 100%;
    overflow: hidden;
    box-shadow: var(--shadow-strong), var(--shadow-glow);
    animation: slideUp 0.3s ease;
}

.location-modal-header,
.location-modal-header.planet-header {
    height: 80px;
    background: linear-gradient(135deg, var(--space-dark) 0%, var(--space-purple) 50%, var(--nebula-purple) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5em;
    overflow: hidden;
}

.location-modal-content {
    padding: 20px;
}

.location-modal-title {
    font-size: 1.4em;
    font-weight: 800;
    color: var(--space-purple);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.location-modal-desc {
    color: var(--text-dark);
    font-size: 0.95em;
    line-height: 1.6;
    margin-bottom: 18px;
}

.location-modal-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 15px;
    background: #f0f0f0;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.9em;
    margin-bottom: 15px;
}

.location-modal-status.unlocked {
    background: linear-gradient(135deg, #c8f7d6 0%, #d4edda 100%);
    color: #00802b;
}

.location-modal-status.locked {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeeba 100%);
    color: #856404;
}

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

.location-modal-actions .btn {
    flex: 1;
    padding: 12px 16px;
    font-size: 0.9em;
}

/* =====================================================
   HIGHSCORES
   ===================================================== */
.highscores-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.highscores-title {
    color: var(--space-purple);
    font-size: 1.1em;
}

.highscores-filters {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
}

.highscores-filters select {
    flex: 1;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: var(--radius-sm);
    font-size: 0.85em;
}

.highscores-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85em;
}

.highscores-table th,
.highscores-table td {
    padding: 10px 6px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.highscores-table th {
    background: #f0e6ff;
    font-weight: 600;
    color: var(--space-purple);
    font-size: 0.8em;
}

.rank-1 { color: var(--gold-dark); }
.rank-2 { color: var(--silver); }
.rank-3 { color: #cd7f32; }

/* =====================================================
   REVIEW SCREEN
   ===================================================== */
.review-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.review-title {
    color: var(--space-purple);
    font-size: 1.1em;
}

.pack-selector,
.tables-selector {
    display: flex;
    gap: 6px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.pack-tab {
    flex: 1;
    min-width: 50px;
    padding: 10px 8px;
    border: 2px solid #d0d5dd;
    border-radius: var(--radius-sm);
    background: white;
    font-weight: 600;
    font-size: 0.75em;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pack-tab:hover {
    border-color: var(--nebula-purple);
}

.pack-tab.active {
    background: var(--nebula-purple);
    border-color: var(--nebula-purple);
    color: white;
}

.tables-list {
    max-height: 400px;
    overflow-y: auto;
}

.table-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    margin-bottom: 8px;
    background: #f8f4ff;
    border-radius: var(--radius-sm);
    border-left: 4px solid var(--nebula-purple);
    font-family: 'Courier New', monospace;
    font-size: 1.1em;
    font-weight: 600;
}

.table-card .operation {
    color: var(--space-purple);
}

.table-card .result {
    color: var(--nebula-purple);
    font-weight: 800;
}

/* =====================================================
   UTILS
   ===================================================== */
.loading {
    text-align: center;
    padding: 30px;
    color: var(--text-light);
}

.loading::after {
    content: '';
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 3px solid var(--nebula-purple);
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
    margin-left: 10px;
    vertical-align: middle;
}

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

/* Toast */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    color: white;
    font-weight: 600;
    z-index: 1000;
    font-size: 0.95em;
    opacity: 0;
    transition: all 0.3s ease;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast.success { background: var(--success); }
.toast.error { background: var(--error); }

/* =====================================================
   GAME MODE - HIDDEN HEADER
   ===================================================== */
body.game-active header {
    display: none;
}

body.game-active {
    padding-top: 8px;
}

body.game-active .screen {
    padding-top: 18px;
}

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-height: 700px) {
    body {
        padding: 8px;
    }

    header {
        padding: 10px 12px;
        margin-bottom: 8px;
    }

    .header-icon {
        font-size: 1.3em;
    }

    header h1 {
        font-size: 1em;
    }

    header > p {
        display: none;
    }

    .user-info {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 8px 0 0 0;
        gap: 6px;
    }

    .user-identity {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
    }

    .user-avatar {
        font-size: 1.4em;
    }

    .user-name {
        font-size: 0.95em;
    }

    .user-coins {
        justify-content: center;
        gap: 6px;
    }

    .user-coins span {
        padding: 3px 6px;
        font-size: 0.7em;
    }

    .user-actions {
        position: absolute;
        top: 10px;
        right: 12px;
        gap: 4px;
    }

    .btn-icon {
        width: 30px;
        height: 30px;
        font-size: 0.85em;
    }

    .question-prompt {
        font-size: 1.8em;
        padding: 15px;
    }

    .qcm-option {
        padding: 14px 10px;
        font-size: 1.1em;
    }
}

@media (max-height: 600px) {
    .question-prompt {
        font-size: 1.5em;
        padding: 12px;
    }

    .qcm-option {
        padding: 12px 8px;
        font-size: 1em;
    }
}

@media (min-width: 500px) {
    body {
        padding: 20px;
    }

    .container {
        max-width: 550px;
    }

    .results-actions {
        flex-direction: row;
        justify-content: center;
    }
}
