/* ============================================================
   GeoFreak — Games Stylesheet
   ============================================================ */

/* ─── Settings Overlay ─────────────────────────────────────── */
.game-settings-overlay {
    min-height: calc(100vh - 64px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
    background: linear-gradient(135deg, #0a2540 0%, #0c2d5a 50%, #0a3d6b 100%);
}

.game-settings-card {
    background: var(--white);
    border-radius: var(--radius-xl);
    padding: 40px 36px;
    max-width: 480px;
    width: 100%;
    text-align: center;
    box-shadow: var(--shadow-xl);
}

.game-settings-icon {
    font-size: 3rem;
    margin-bottom: 8px;
}

.game-settings-card h2 {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 8px;
}

.game-settings-desc {
    color: var(--gray-500);
    font-size: 0.95rem;
    margin-bottom: 28px;
    line-height: 1.5;
}

.settings-form {
    text-align: left;
    margin-bottom: 28px;
}

.setting-group {
    margin-bottom: 16px;
}

.setting-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.setting-group select {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: var(--font-sans);
    color: var(--gray-800);
    background: var(--white);
    cursor: pointer;
    transition: border-color 0.2s;
}

.setting-group select:focus {
    outline: none;
    border-color: var(--blue-500);
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.1);
}

/* ─── Game setting groups (difficulty, countdown) ──────────── */
.game-setting-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
    text-align: left;
}

.game-setting-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    margin-right: 12px;
}

/* Difficulty inline dropdown */
.diff-dropdown {
    position: relative;
    display: inline-block;
}

.diff-dropdown-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius);
    background: var(--white);
    color: var(--primary);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.15s;
    font-family: var(--font-sans);
}

.diff-dropdown-toggle:hover { border-color: var(--primary); }

.diff-arrow {
    font-size: 0.7rem;
    transition: transform 0.2s;
}

.diff-dropdown-menu.open + .diff-arrow,
.diff-dropdown-menu.open ~ .diff-arrow { transform: rotate(180deg); }

.diff-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    min-width: 140px;
    background: var(--white);
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    z-index: 100;
    list-style: none;
    margin: 0;
    padding: 4px 0;
}

.diff-dropdown-menu.open { display: block; }

.diff-dropdown-menu li {
    padding: 7px 16px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--gray-600);
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
}

.diff-dropdown-menu li:hover {
    background: var(--gray-50);
    color: var(--primary);
}

.diff-dropdown-menu li.selected {
    color: var(--primary);
    font-weight: 700;
}

/* Slide switch toggle */
.switch-toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

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

.switch-slider {
    position: absolute;
    inset: 0;
    background: var(--gray-300);
    border-radius: 24px;
    cursor: pointer;
    transition: background 0.2s;
}

.switch-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    bottom: 3px;
    background: var(--white);
    border-radius: 50%;
    transition: transform 0.2s;
}

.switch-toggle input:checked + .switch-slider {
    background: var(--primary);
}

.switch-toggle input:checked + .switch-slider::before {
    transform: translateX(20px);
}

.game-start-btn {
    width: 100%;
    padding: 14px 28px;
    font-size: 1.1rem;
}

/* ─── Game HUD ─────────────────────────────────────────────── */
.game-hud {
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    z-index: 900;
    background: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 32px;
    padding: 10px 24px;
    color: white;
    font-family: var(--font-display);
    font-size: 0.95rem;
}

.hud-timer {
    font-weight: 700;
    font-size: 1.1rem;
    min-width: 100px;
    text-align: center;
}

.hud-timer.warning { color: #ffd54f; }
.hud-timer.danger { color: #ef5350; animation: pulse 1s infinite; }

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

.hud-score {
    font-weight: 600;
}

.hud-quit {
    position: absolute;
    right: 16px;
    background: none;
    border: 1px solid rgba(255,255,255,0.2);
    color: rgba(255,255,255,0.7);
    padding: 4px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.8rem;
    font-family: var(--font-sans);
    transition: all 0.2s;
}

.hud-quit:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

/* ─── Game Area ────────────────────────────────────────────── */
.game-area {
    padding-top: calc(64px + 44px);
    height: calc(100vh);
    overflow: hidden;
    box-sizing: border-box;
}

/* ─── Quiz Games (flags, outline) ──────────────────────────── */
.quiz-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 12px 16px 8px;
    text-align: center;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 64px - 44px);
    box-sizing: border-box;
    overflow: hidden;
}

.quiz-progress {
    font-size: 0.85rem;
    color: var(--gray-500);
    margin-bottom: 8px;
    font-weight: 500;
    flex-shrink: 0;
}

.quiz-display {
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.quiz-flag {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    transition: opacity 0.3s;
}

.outline-map-container {
    width: 100%;
    height: 100%;
    background: var(--gray-50);
}

.quiz-input-area {
    display: flex;
    gap: 8px;
    margin-bottom: 6px;
    flex-shrink: 0;
}

.quiz-input-area input {
    flex: 1;
    padding: 12px 18px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-md);
    font-size: 1.05rem;
    font-family: var(--font-sans);
    transition: border-color 0.2s;
}

.quiz-input-area input:focus {
    outline: none;
    border-color: var(--blue-500);
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.12);
}

.quiz-input-area input.correct {
    border-color: #4caf50;
    background: rgba(76, 175, 80, 0.06);
}

.quiz-input-area input.wrong {
    border-color: #ef5350;
    animation: shake 0.4s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}

.btn-skip {
    padding: 10px 14px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-md);
    background: var(--white);
    color: var(--gray-600);
    font-size: 0.85rem;
    font-family: var(--font-sans);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
    flex-shrink: 0;
}

.btn-skip:hover {
    border-color: var(--gray-400);
    background: var(--gray-50);
}

.btn-reveal {
    padding: 10px 14px;
    border: 2px solid #ef535050;
    border-radius: var(--radius-md);
    background: #fff5f5;
    color: #c62828;
    font-size: 0.85rem;
    font-family: var(--font-sans);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
    flex-shrink: 0;
}

.btn-reveal:hover {
    border-color: #ef5350;
    background: #ffebee;
}

.btn-reveal-map {
    background: rgba(239,83,80,0.2);
    border: none;
    color: white;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.9rem;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background 0.2s;
}

.btn-reveal-map:hover {
    background: rgba(239,83,80,0.4);
}

.btn-reveal-map-bar {
    padding: 12px 14px;
    border: 2px solid #ef535080;
    border-radius: var(--radius-lg);
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(8px);
    color: #c62828;
    font-size: 0.85rem;
    font-family: var(--font-sans);
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    box-shadow: var(--shadow-lg);
    transition: all 0.2s;
}

.btn-reveal-map-bar:hover {
    border-color: #ef5350;
    background: #ffebee;
}

.btn-reveal-map-bar:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    border-color: #ccc;
    color: #999;
    background: rgba(255,255,255,0.7);
}

/* Reveal tooltip on map */
.reveal-tooltip {
    background: #c62828 !important;
    color: white !important;
    border: none !important;
    font-weight: 600;
    font-size: 0.8rem;
    padding: 3px 8px !important;
    border-radius: 4px !important;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2) !important;
}
.reveal-tooltip::before { border: none !important; }

.quiz-feedback {
    min-height: 28px;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s;
    flex-shrink: 0;
}

.quiz-feedback.correct { color: #4caf50; }
.quiz-feedback.wrong { color: #ef5350; }
.quiz-feedback.skipped { color: #ff9800; }

/* ─── Map Games ────────────────────────────────────────────── */
.map-game-container {
    height: calc(100vh - 64px - 44px);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.map-game-prompt {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 800;
    background: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(8px);
    color: white;
    padding: 12px 20px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow-lg);
    max-width: 500px;
    width: 90%;
}

.prompt-country {
    font-weight: 700;
    font-size: 1rem;
    white-space: nowrap;
}

.prompt-label {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.6);
    white-space: nowrap;
}

.map-game-prompt input {
    flex: 1;
    padding: 8px 14px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: var(--font-sans);
    background: rgba(255,255,255,0.15);
    color: white;
    min-width: 0;
}

.map-game-prompt input::placeholder {
    color: rgba(255,255,255,0.4);
}

.map-game-prompt input:focus {
    outline: none;
    background: rgba(255,255,255,0.22);
}

.map-game-input-bar {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 800;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 460px;
    width: 90%;
}

.map-game-input-bar input {
    flex: 1;
    padding: 12px 18px;
    border: 2px solid rgba(255,255,255,0.8);
    border-radius: var(--radius-lg);
    font-size: 1rem;
    font-family: var(--font-sans);
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(8px);
    box-shadow: var(--shadow-lg);
    transition: border-color 0.2s;
}

.map-game-input-bar input:focus {
    outline: none;
    border-color: var(--blue-500);
}

.map-game-input-bar input.correct-flash {
    border-color: #4caf50;
    background: rgba(76,175,80,0.1);
}

.map-game-input-bar input.wrong-flash {
    border-color: #ef5350;
    animation: shake 0.4s;
}

.input-feedback {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    text-align: center;
    padding: 4px;
    font-size: 0.82rem;
    font-weight: 600;
    pointer-events: none;
}

.input-feedback.correct { color: #4caf50; }
.input-feedback.wrong { color: #ef5350; }

.game-map {
    flex: 1;
    z-index: 1;
    position: relative;
}

/* ─── Map Loading Spinner ──────────────────────────────────── */
.map-spinner-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255, 255, 255, 0.85);
    z-index: 900;
    display: flex;
    align-items: center;
    justify-content: center;
}
.map-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #e2e8f0;
    border-top-color: #1a73e8;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ─── Results Overlay ──────────────────────────────────────── */
.game-results-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.4s ease;
}

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

.game-results-card {
    position: relative;
    background: var(--white);
    border-radius: var(--radius-xl);
    padding: 40px;
    max-width: 500px;
    width: 90%;
    text-align: center;
    box-shadow: var(--shadow-xl);
    animation: slideUp 0.4s ease;
}

.results-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    color: var(--gray-400);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius);
    transition: color 0.15s, background 0.15s;
}

.results-close:hover {
    color: var(--gray-700);
    background: var(--gray-100);
}

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

.results-icon {
    font-size: 3.5rem;
    margin-bottom: 8px;
}

.game-results-card h2 {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 24px;
}

.results-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 32px;
}

.result-stat-value {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--blue-600);
}

.result-stat-label {
    font-size: 0.75rem;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px;
}

.results-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.btn-outline-dark {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 12px 24px;
    border: 2px solid var(--gray-300);
    border-radius: var(--radius-lg);
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--gray-700);
    background: transparent;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-outline-dark:hover {
    border-color: var(--gray-500);
    background: var(--gray-50);
}

/* ─── Results Summary Table (GeoStats) ─────────────────────── */
.results-toggle-btn {
    margin: 16px auto 0;
    padding: 8px 20px;
    font-size: 0.85rem;
    display: block;
}

.gs-summary-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
    font-size: 0.85rem;
    text-align: left;
}

.gs-summary-table th {
    font-weight: 600;
    color: var(--gray-600);
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.5px;
    padding: 8px 6px;
    border-bottom: 2px solid var(--gray-200);
}

.gs-summary-table td {
    padding: 8px 6px;
    border-bottom: 1px solid var(--gray-100);
    white-space: nowrap;
}

.gs-row-correct { background: rgba(76, 175, 80, 0.06); }
.gs-row-wrong { background: rgba(239, 83, 80, 0.04); }

/* ─── Daily Challenge Results ──────────────────────────────── */
.daily-stars {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-bottom: 20px;
}

.daily-stars svg {
    display: block;
}

.daily-metrics {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-bottom: 24px;
}

.daily-metric {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.daily-metric-value {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--gray-900);
}

.daily-metric-label {
    font-size: 0.75rem;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.daily-actions {
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.daily-share-row {
    display: flex;
    gap: 8px;
    width: 100%;
    max-width: 320px;
}

.btn-daily-share {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    background: var(--blue-600);
    color: #fff;
    border: none;
    border-radius: var(--radius-lg);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-daily-share:hover {
    background: var(--blue-700);
}

.btn-daily-copy {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 16px;
    background: var(--gray-100);
    color: var(--gray-700);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-daily-copy:hover {
    background: var(--gray-200);
}

.daily-countdown-wrap {
    text-align: center;
}

.daily-countdown {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--blue-600);
}

.btn-daily-register {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 36px;
    background: linear-gradient(135deg, var(--blue-600), #7c3aed);
    color: #fff;
    border: none;
    border-radius: var(--radius-lg);
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.15s, box-shadow 0.15s;
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.35);
}

.btn-daily-register:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.45);
}

.daily-register-hint {
    font-size: 0.8rem;
    color: var(--gray-500);
    margin-top: -8px;
    text-align: center;
}

.btn-daily-stats {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 24px;
    background: var(--gray-50);
    color: var(--gray-700);
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-lg);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
}

.btn-daily-stats:hover {
    border-color: var(--gray-400);
    background: var(--gray-100);
}

.daily-other-games {
    font-size: 0.82rem;
    color: var(--gray-400);
    text-decoration: none;
    transition: color 0.2s;
}

.daily-other-games:hover {
    color: var(--gray-600);
    text-decoration: underline;
}

/* ─── Games Dashboard ──────────────────────────────────────── */
.games-dashboard {
    padding-top: 100px;
    padding-bottom: 60px;
    min-height: 100vh;
    background: var(--gray-50);
}

.dashboard-header {
    text-align: center;
    margin-bottom: 48px;
}

.dashboard-header h1 {
    font-family: var(--font-display);
    font-size: 2.4rem;
    font-weight: 800;
    color: var(--gray-900);
    margin-bottom: 8px;
}

.dashboard-header p {
    color: var(--gray-500);
    font-size: 1.05rem;
}

.dashboard-category {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--gray-800);
    max-width: 1100px;
    margin: 32px auto 16px;
    padding: 0 24px;
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
}

.game-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 28px 24px;
    text-decoration: none;
    color: inherit;
    transition: all 0.25s;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.game-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--card-color, var(--blue-500));
}

.game-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: transparent;
}

.game-card-icon {
    font-size: 2.2rem;
    margin-bottom: 12px;
}

.game-card h3 {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 6px;
}

.game-card p {
    color: var(--gray-500);
    font-size: 0.9rem;
    line-height: 1.5;
    flex: 1;
}

.game-card-play {
    margin-top: 16px;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--blue-500);
}

/* ─── Admin ────────────────────────────────────────────────── */
.login-page {
    min-height: calc(100vh - 64px);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-50);
}

.login-card {
    background: var(--white);
    border-radius: var(--radius-xl);
    padding: 40px;
    max-width: 380px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.login-card h2 {
    font-family: var(--font-display);
    font-size: 1.4rem;
    margin-bottom: 24px;
}

.login-card input {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: var(--font-sans);
    margin-bottom: 12px;
}

.login-card input:focus {
    outline: none;
    border-color: var(--blue-500);
}

.login-error {
    color: #ef5350;
    font-size: 0.85rem;
    margin-bottom: 12px;
}

.admin-dashboard {
    padding-top: 100px;
    padding-bottom: 60px;
    max-width: 900px;
    margin: 0 auto;
    padding-left: 24px;
    padding-right: 24px;
}

.admin-dashboard h1 {
    font-family: var(--font-display);
    font-size: 1.8rem;
    margin-bottom: 8px;
}

.admin-subtitle {
    color: var(--gray-500);
    margin-bottom: 32px;
}

.admin-game-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 16px;
}

.admin-game-card h3 {
    font-size: 1.1rem;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.admin-game-card .form-row {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.admin-game-card .form-row > * {
    flex: 1;
    min-width: 150px;
}

.admin-game-card input,
.admin-game-card textarea,
.admin-game-card select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: 0.9rem;
}

.admin-game-card textarea {
    resize: vertical;
    min-height: 60px;
}

.admin-game-card .btn-save {
    padding: 8px 20px;
    background: var(--blue-500);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
}

.admin-game-card .btn-save:hover {
    background: var(--blue-600);
}

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

.admin-logout {
    color: var(--gray-500);
    font-size: 0.85rem;
}

@media (max-width: 640px) {
    .results-stats { grid-template-columns: repeat(2, 1fr); }
    .quiz-input-area { flex-direction: column; }
    .game-hud { gap: 16px; font-size: 0.85rem; }
}

/* ============================================================
   RESPONSIVE — Tablets & large phones (≤ 900px)
   ============================================================ */
@media (max-width: 900px) {
    /* Navbar thinner */
    .navbar { height: 52px; }
    .game-hud { top: 52px; padding: 6px 12px; gap: 16px; font-size: 0.85rem; }
    .hud-timer { font-size: 0.95rem; min-width: 80px; }
    .hud-quit { right: 8px; padding: 3px 10px; font-size: 0.75rem; }

    .game-area {
        padding-top: calc(52px + 36px);
        height: 100vh;
    }

    .quiz-container {
        height: calc(100vh - 52px - 36px);
        padding: 8px 12px 6px;
    }

    .map-game-container {
        height: calc(100vh - 52px - 36px);
    }

    /* Settings overlay */
    .game-settings-overlay { padding: 16px 12px; min-height: calc(100vh - 52px); }
    .game-settings-card { padding: 24px 20px; }
    .game-settings-icon { font-size: 2.2rem; }
    .game-settings-card h2 { font-size: 1.3rem; }
    .game-settings-desc { font-size: 0.85rem; margin-bottom: 16px; }
    .game-start-btn { padding: 12px 20px; font-size: 1rem; }
    .game-setting-group { flex-direction: column; align-items: flex-start; gap: 6px; }
    .difficulty-selector { justify-content: flex-start; }

    /* Quiz */
    .quiz-display { margin-bottom: 8px; }
    .quiz-progress { margin-bottom: 6px; font-size: 0.8rem; }
    .quiz-feedback { min-height: 24px; font-size: 0.82rem; }

    /* Map prompt */
    .map-game-prompt { top: 8px; padding: 8px 12px; gap: 8px; width: 94%; }
    .map-game-input-bar { top: 8px; width: 94%; gap: 6px; }
    .map-game-input-bar input { padding: 10px 14px; font-size: 0.9rem; }

    /* Results */
    .game-results-card { padding: 24px 20px; }
    .results-icon { font-size: 2.5rem; }
    .game-results-card h2 { font-size: 1.4rem; margin-bottom: 16px; }
    .result-stat-value { font-size: 1.4rem; }

    /* Dashboard */
    .games-dashboard { padding-top: 72px; }
    .games-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
}

/* ============================================================
   RESPONSIVE — Phones (≤ 640px)
   ============================================================ */
@media (max-width: 640px) {
    .navbar { height: 48px; }
    .nav-title { font-size: 1.1rem; }
    .nav-links { gap: 8px; }
    .nav-link { font-size: 0.8rem; padding: 4px 6px; }

    .game-hud {
        top: 48px;
        padding: 5px 10px;
        gap: 10px;
        font-size: 0.78rem;
    }
    .hud-timer { font-size: 0.88rem; min-width: 70px; }
    .hud-quit { padding: 2px 8px; font-size: 0.7rem; }

    .game-area {
        padding-top: calc(48px + 32px);
        height: 100vh;
    }

    /* ── Quiz on phone ─── */
    .quiz-container {
        height: calc(100vh - 48px - 32px);
        padding: 6px 10px 4px;
        max-width: 100%;
    }

    .quiz-progress { margin-bottom: 4px; font-size: 0.75rem; }

    .quiz-display {
        margin-bottom: 6px;
        border-radius: 8px;
    }

    .quiz-input-area {
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 6px;
    }

    .quiz-input-area input {
        padding: 10px 12px;
        font-size: 0.9rem;
        min-width: 0;
    }

    .btn-skip, .btn-reveal {
        padding: 10px 10px;
        font-size: 0.75rem;
    }

    .quiz-feedback { min-height: 20px; font-size: 0.78rem; }

    /* ── Map on phone ─── */
    .map-game-container {
        height: calc(100vh - 48px - 32px);
    }

    .map-game-prompt {
        top: 6px;
        padding: 6px 10px;
        gap: 6px;
        width: 96%;
        flex-wrap: wrap;
    }

    .prompt-country { font-size: 0.85rem; }
    .prompt-label { font-size: 0.72rem; }

    .map-game-prompt input {
        padding: 6px 10px;
        font-size: 0.85rem;
    }

    .map-game-input-bar {
        top: 6px;
        width: 96%;
        gap: 5px;
    }

    .map-game-input-bar input {
        padding: 9px 12px;
        font-size: 0.88rem;
    }

    .btn-reveal-map-bar {
        padding: 9px 10px;
        font-size: 0.78rem;
    }

    /* Settings */
    .game-settings-overlay { padding: 12px 8px; }
    .game-settings-card { padding: 20px 16px; }
    .game-settings-icon { font-size: 2rem; margin-bottom: 4px; }
    .game-settings-card h2 { font-size: 1.15rem; margin-bottom: 4px; }
    .game-settings-desc { font-size: 0.82rem; margin-bottom: 12px; }
    .setting-group { margin-bottom: 10px; }
    .setting-group select { padding: 8px 10px; font-size: 0.88rem; }
    .game-start-btn { padding: 10px 16px; font-size: 0.95rem; }
    .diff-btn { padding: 4px 7px; font-size: 0.72rem; }
    .game-setting-group { margin-bottom: 12px; }

    /* Results */
    .game-results-card { padding: 20px 16px; }
    .results-icon { font-size: 2rem; }
    .game-results-card h2 { font-size: 1.2rem; margin-bottom: 12px; }
    .results-stats { grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 20px; }
    .result-stat-value { font-size: 1.2rem; }
    .results-actions { flex-direction: column; gap: 8px; }
    .results-actions .btn { width: 100%; }
    .btn-outline-dark { justify-content: center; }

    /* Daily results on mobile */
    .daily-metrics { gap: 24px; }
    .daily-metric-value { font-size: 1.3rem; }
    .daily-share-row { max-width: 100%; }
    .daily-stars svg { width: 24px; height: 24px; }
    .btn-daily-register { padding: 14px 28px; font-size: 0.95rem; width: 100%; }
    .btn-daily-stats { width: 100%; justify-content: center; }

    /* Dashboard */
    .games-dashboard { padding-top: 64px; padding-bottom: 30px; }
    .dashboard-header { margin-bottom: 24px; }
    .dashboard-header h1 { font-size: 1.6rem; }
    .dashboard-header p { font-size: 0.9rem; }
    .games-grid { grid-template-columns: 1fr; gap: 10px; padding: 0 12px; }
    .game-card { padding: 18px 16px; }
    .game-card-icon { font-size: 1.6rem; margin-bottom: 6px; }
    .game-card h3 { font-size: 1rem; }

    /* Admin */
    .admin-dashboard { padding-top: 64px; }
    .admin-header { flex-direction: column; align-items: flex-start; gap: 8px; }
}

/* ============================================================
   RESPONSIVE — Very small phones (≤ 400px)
   ============================================================ */
@media (max-width: 400px) {
    .quiz-input-area {
        flex-wrap: wrap;
    }
    .quiz-input-area input { width: 100%; flex: 1 1 100%; }
    .btn-skip, .btn-reveal { flex: 1; }

    .map-game-prompt { font-size: 0.78rem; }
    .prompt-country { font-size: 0.8rem; }

    .game-hud { gap: 6px; }
    .hud-timer { min-width: 60px; font-size: 0.82rem; }
}

/* ============================================================
   LANDSCAPE phones — maximize map/display area
   ============================================================ */
@media (max-height: 500px) and (orientation: landscape) {
    .navbar { height: 40px; }
    .game-hud { top: 40px; padding: 4px 10px; }
    .game-area { padding-top: calc(40px + 28px); }

    .quiz-container {
        height: calc(100vh - 40px - 28px);
        flex-direction: row;
        align-items: stretch;
        padding: 4px 8px;
        max-width: 100%;
        gap: 12px;
    }

    .quiz-progress {
        position: absolute;
        top: 2px;
        right: 12px;
        z-index: 10;
        margin: 0;
    }

    .quiz-display {
        flex: 1;
        margin-bottom: 0;
        min-height: 0;
    }

    .quiz-input-area {
        flex-direction: column;
        width: 200px;
        flex-shrink: 0;
        align-self: center;
        gap: 4px;
    }

    .quiz-input-area input { font-size: 0.85rem; padding: 8px 10px; }
    .btn-skip, .btn-reveal { padding: 6px 8px; font-size: 0.72rem; }
    .quiz-feedback { font-size: 0.72rem; min-height: 16px; }

    .map-game-container { height: calc(100vh - 40px - 28px); }
}

/* ============================================================
   Ensure no overflow on html/body during games
   ============================================================ */
.game-page {
    overflow: hidden;
    height: 100vh;
}

/* Hide footer when a game page is active */
.game-page ~ .footer,
body:has(.game-page) .footer {
    display: none !important;
}

/* Prevent body scroll during games */
body:has(.game-page) {
    overflow: hidden;
    overscroll-behavior: none;
}

/* Mobile games: minimal navbar with discreet hamburger */
@media (max-width: 640px) {
    body:has(.game-page) .navbar {
        height: 40px;
        padding: 0 10px;
    }
    /* Hide site name, keep only small logo */
    body:has(.game-page) .nav-title {
        display: none;
    }
    body:has(.game-page) .nav-logo {
        width: 26px !important;
        height: 26px !important;
    }
    /* Discreet hamburger — visible but subdued */
    body:has(.game-page) .nav-hamburger {
        display: flex;
        opacity: 0.4;
        padding: 4px;
        transition: opacity 0.2s;
    }
    body:has(.game-page) .nav-hamburger:active,
    body:has(.game-page) .nav-hamburger.open {
        opacity: 1;
    }
    body:has(.game-page) .nav-hamburger span {
        width: 18px;
        height: 1.5px;
    }
    body:has(.game-page) .nav-hamburger.open span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
    body:has(.game-page) .nav-hamburger.open span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }
    /* Nav overlay — dark, clean overlay for game pages */
    body:has(.game-page) .nav-links {
        background: rgba(15, 23, 42, 0.95);
        backdrop-filter: blur(16px);
    }
    body:has(.game-page) .nav-links.open {
        display: flex;
    }
    body:has(.game-page) .nav-links .nav-link {
        color: rgba(255, 255, 255, 0.9);
        font-size: 1.1rem;
        padding: 14px 32px;
        border-radius: 8px;
        transition: background 0.15s;
    }
    body:has(.game-page) .nav-links .nav-link:hover,
    body:has(.game-page) .nav-links .nav-link:active {
        background: rgba(255, 255, 255, 0.1);
        color: #fff;
    }
    body:has(.game-page) .nav-links .nav-logout {
        color: #ef5350 !important;
    }
    /* HUD & game area sizing */
    body:has(.game-page) .game-hud {
        top: 40px;
        padding: 4px 8px;
        gap: 8px;
        font-size: 0.78rem;
    }
    body:has(.game-page) .game-area {
        padding-top: calc(40px + 30px);
        height: 100vh;
    }
    body:has(.game-page) .quiz-container {
        height: calc(100vh - 40px - 30px);
    }
    body:has(.game-page) .map-game-container {
        height: calc(100vh - 40px - 30px);
    }
    body:has(.game-page) .game-settings-overlay {
        min-height: calc(100vh - 40px);
    }
    /* GeoStats mobile fit */
    body:has(.game-page) .geostats-container {
        height: calc(100vh - 40px - 30px);
        padding: 8px 10px 6px;
    }
    body:has(.game-page) .geostats-header {
        margin-bottom: 4px;
    }
    body:has(.game-page) .geostats-prompt {
        font-size: 0.9rem;
    }
    body:has(.game-page) .geostats-chart-wrapper {
        padding: 8px;
        margin-bottom: 6px;
    }
    body:has(.game-page) .geostats-input-area {
        margin-bottom: 4px;
    }
    body:has(.game-page) .geostats-input-area input {
        padding: 8px 12px;
        font-size: 0.9rem;
    }
    body:has(.game-page) .geostats-status {
        margin-bottom: 2px;
    }
    body:has(.game-page) .geostats-feedback {
        font-size: 0.82rem;
        min-height: 1.2em;
    }
    body:has(.game-page) .geostats-actions {
        padding-bottom: 2px;
    }
}

/* ============================================================
   GeoStats Game
   ============================================================ */
.geostats-container {
    max-width: 720px;
    margin: 0 auto;
    padding: 16px 16px 8px;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 64px - 44px);
    box-sizing: border-box;
}

.geostats-header {
    text-align: center;
    margin-bottom: 10px;
    flex-shrink: 0;
}

.geostats-progress {
    font-size: 0.85rem;
    color: var(--gray-500);
    margin-bottom: 4px;
    font-weight: 500;
}

.geostats-prompt {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--gray-800);
    font-family: var(--font-display);
    line-height: 1.4;
}

.geostats-prompt em {
    font-style: italic;
}

.geostats-chart-wrapper {
    flex: 1;
    min-height: 0;
    position: relative;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 12px;
    margin-bottom: 10px;
}

.geostats-input-area {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    flex-shrink: 0;
}

.geostats-input-area input {
    flex: 1;
    padding: 12px 18px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-md);
    font-size: 1.05rem;
    font-family: var(--font-sans);
    transition: border-color 0.2s;
}

.geostats-input-area input:focus {
    outline: none;
    border-color: var(--blue-500);
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.12);
}

.geostats-input-area input:disabled {
    background: var(--gray-50);
    color: var(--gray-400);
}

.geostats-status {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-bottom: 6px;
    flex-shrink: 0;
}

.attempt-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--gray-200);
    display: inline-block;
    transition: background 0.3s;
}

.attempt-dot.used {
    background: #ef5350;
}

.geostats-feedback {
    text-align: center;
    font-weight: 600;
    font-size: 0.95rem;
    min-height: 1.5em;
    flex-shrink: 0;
}

.geostats-feedback.correct { color: #4caf50; }
.geostats-feedback.wrong { color: #ef5350; }
.geostats-feedback.warning { color: #ff9800; }

.geostats-actions {
    text-align: center;
    flex-shrink: 0;
}

/* ============================================================
   Ordering Game
   ============================================================ */
.ordering-container {
    max-width: 560px;
    margin: 0 auto;
    padding: 24px 16px;
}

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

.ordering-progress {
    font-size: 0.85rem;
    color: var(--gray-500);
    margin-bottom: 8px;
}

.ordering-prompt {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--gray-800);
    font-family: var(--font-display);
}

.ordering-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.ordering-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--white);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm);
    cursor: grab;
    transition: border-color 0.2s, background 0.2s;
    user-select: none;
}

.ordering-item:active { cursor: grabbing; }
.ordering-item.dragging { opacity: 0.5; border-color: var(--blue-500); }
.ordering-item.correct { border-color: #4caf50; background: rgba(76, 175, 80, 0.08); }
.ordering-item.wrong { border-color: #ef5350; background: rgba(239, 83, 80, 0.08); }

.ordering-rank {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--gray-100);
    color: var(--gray-600);
    font-size: 0.8rem;
    font-weight: 700;
    flex-shrink: 0;
    transition: background 0.2s, color 0.2s;
}
.ordering-rank.rank-correct {
    background: #4caf50;
    color: #fff;
}
.ordering-rank.rank-wrong {
    background: #ef5350;
    color: #fff;
}

.ordering-handle {
    color: var(--gray-400);
    font-size: 1.1rem;
    cursor: grab;
}

.ordering-flag { font-size: 1.5rem; }

.ordering-name {
    flex: 1;
    font-weight: 500;
    color: var(--gray-800);
}

.ordering-value {
    font-size: 0.85rem;
    color: var(--gray-500);
    font-weight: 600;
    margin-left: auto;
    white-space: nowrap;
}

.ordering-actions { text-align: center; margin-bottom: 16px; }

.ordering-feedback {
    text-align: center;
    font-weight: 600;
    font-size: 1rem;
    min-height: 1.5em;
    transition: color 0.2s;
}
.ordering-feedback.correct { color: #4caf50; }
.ordering-feedback.wrong { color: #ef5350; }

/* ============================================================
   Comparison Game
   ============================================================ */
.comparison-container {
    max-width: 640px;
    margin: 0 auto;
    padding: 24px 16px;
}

.comparison-header {
    text-align: center;
    margin-bottom: 32px;
}

.comparison-progress {
    font-size: 0.85rem;
    color: var(--gray-500);
    margin-bottom: 8px;
}

.comparison-prompt {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--gray-800);
    font-family: var(--font-display);
}

.comparison-cards {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.comparison-card {
    flex: 1;
    min-width: 200px;
    max-width: 280px;
    padding: 32px 24px;
    background: var(--white);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-lg, 12px);
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, transform 0.15s, box-shadow 0.2s;
}

.comparison-card:hover {
    border-color: var(--blue-500);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}

.comparison-card.correct {
    border-color: #4caf50;
    background: rgba(76, 175, 80, 0.08);
}
.comparison-card.wrong {
    border-color: #ef5350;
    background: rgba(239, 83, 80, 0.08);
}

.comparison-flag { font-size: 3rem; margin-bottom: 12px; }

.comparison-name {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 8px;
}

.comparison-value {
    display: none;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--blue-600, #1565c0);
    margin-top: 8px;
    font-family: var(--font-display);
}

.comparison-feedback {
    text-align: center;
    font-weight: 600;
    font-size: 1rem;
    min-height: 1.5em;
}
.comparison-feedback.correct { color: #4caf50; }
.comparison-feedback.wrong { color: #ef5350; }

/* ─── Outline Game Map ─────────────────────────────────────── */
.outline-map-wrapper {
    width: 100%;
    height: 100%;
    background: #f8fafc;
    border-radius: 12px;
}
.outline-map-wrapper .leaflet-container { background: #f8fafc !important; }

/* ─── Stat Description Tooltip ─────────────────────────────── */
.stat-tooltip-trigger {
    cursor: help;
    border-bottom: 1.5px dotted #9ca3af;
    position: relative;
    text-decoration: none;
}
.stat-tooltip-popup {
    max-width: 300px;
    padding: 10px 14px;
    background: var(--gray-900, #1a1a2e);
    color: #fff;
    font-size: 0.82rem;
    line-height: 1.45;
    font-weight: 400;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.25);
    z-index: 9999;
    animation: tooltipFade 0.15s ease-out;
}
@keyframes tooltipFade {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.stat-tooltip-popup.flash {
    pointer-events: none;
}
.stat-tooltip-popup.fade-out {
    opacity: 0;
    transition: opacity 0.5s ease;
}

/* Stat tooltip italic styling */
.ordering-prompt em,
.comparison-prompt em {
    font-style: italic;
}
