/* ==========================================================================
   African Safari Odyssey — full stylesheet
   ========================================================================== */

/* ---- Base / reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    background: #1e130b;
    color: rgba(255, 255, 255, 0.92);
    font-family: 'Segoe UI', system-ui, Arial, sans-serif;
    overflow: hidden;
    min-height: 100vh;
}

#app {
    width: 100vw;
    height: 100vh;
    position: relative;
    overflow: hidden;
}

#game-container {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

#hud {
    position: absolute;
    inset: 0;
    z-index: 10;
    pointer-events: none;
    display: flex;
    flex-direction: column;
}

#hud > * { pointer-events: auto; }

/* ---- RTL ---- */
.rtl { direction: rtl; }
.rtl .top-bar { flex-direction: row-reverse; }
.rtl .option-card { flex-direction: row-reverse; }
.rtl .fact-banner { flex-direction: row-reverse; }

/* ---- Overlay base ---- */
.overlay {
    position: absolute;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(30, 19, 11, 0.88);
    z-index: 20;
    overflow-y: auto;
    padding: 16px;
}

/* ---- Menu ---- */
.menu-overlay {
    background: linear-gradient(180deg, #1e130b 0%, #451a03 60%, #1e130b 100%);
}

.menu-card {
    width: 100%;
    max-width: 520px;
    background: rgba(61, 43, 31, 0.95);
    border: 2px solid #f59e0b;
    border-radius: 20px;
    box-shadow: 0 0 60px rgba(245, 158, 11, 0.25);
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
}

.menu-top { text-align: center; }

.title-text {
    font-size: clamp(22px, 5vw, 36px);
    color: #fbbf24;
    line-height: 1.15;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6);
}

.subtitle { font-size: 14px; color: #d4a574; margin-top: 4px; }

/* Language switcher */
.lang-switch {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    margin-top: 10px;
}

.lang-switch button {
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid #78350f;
    background: rgba(0, 0, 0, 0.3);
    color: #d4a574;
    font-size: 13px;
    cursor: pointer;
    min-height: 36px;
    transition: background 0.2s, border-color 0.2s;
}

.lang-switch button.active {
    background: #f59e0b;
    color: #1e130b;
    border-color: #f59e0b;
    font-weight: bold;
}

/* Tab row */
.tab-row {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.tab-row button {
    flex: 1;
    min-width: 80px;
    padding: 8px 6px;
    border-radius: 10px;
    border: 1px solid #78350f;
    background: rgba(0, 0, 0, 0.25);
    color: #d4a574;
    font-size: 12px;
    cursor: pointer;
    min-height: 44px;
    transition: background 0.2s;
}

.tab-row button.active {
    background: #78350f;
    color: #fbbf24;
    border-color: #f59e0b;
    font-weight: bold;
}

.tab-body { display: flex; flex-direction: column; gap: 12px; }

/* Mode buttons */
.mode-buttons { display: flex; flex-direction: column; gap: 10px; }

.mode-btn {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    min-height: 64px;
    transition: transform 0.15s, box-shadow 0.15s;
    text-align: start;
}

.mode-btn:hover { transform: scale(1.02); box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4); }
.mode-btn:active { transform: scale(0.98); }

.mode-btn.primary     { background: linear-gradient(135deg, #f59e0b, #d97706); color: #1e130b; }
.mode-btn.secondary   { background: linear-gradient(135deg, #dc2626, #991b1b); color: #fff; }
.mode-btn.tertiary    { background: linear-gradient(135deg, #16a34a, #15803d); color: #fff; }
.mode-btn.quaternary  { background: linear-gradient(135deg, #7c3aed, #6d28d9); color: #fff; }
.mode-btn.daily       { background: linear-gradient(135deg, #0ea5e9, #0284c7); color: #fff; }

.mode-icon { font-size: 28px; flex-shrink: 0; }
.mode-text { display: flex; flex-direction: column; gap: 2px; }
.mode-text strong { font-size: 16px; }
.mode-text small  { font-size: 12px; opacity: 0.8; }

/* Menu action chips */
.menu-actions-row { display: flex; gap: 8px; flex-wrap: wrap; }

.chip-btn {
    padding: 8px 14px;
    border-radius: 20px;
    border: 1px solid #78350f;
    background: rgba(0, 0, 0, 0.3);
    color: #d4a574;
    font-size: 13px;
    cursor: pointer;
    min-height: 40px;
    transition: background 0.2s;
}

.chip-btn:hover { background: rgba(120, 53, 15, 0.6); }
.chip-btn.highlight { background: #f59e0b; color: #1e130b; border-color: #f59e0b; font-weight: bold; }

.instructions { font-size: 12px; color: #a8a29e; text-align: center; }

/* ---- Notebook ---- */
.notebook-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.nb-stat {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    padding: 10px;
    text-align: center;
    border: 1px solid #78350f;
}

.nb-stat strong { display: block; font-size: 22px; color: #fbbf24; }
.nb-stat span   { font-size: 12px; color: #a8a29e; }

.badge-row { display: flex; gap: 8px; flex-wrap: wrap; }

.badge {
    padding: 4px 10px;
    border-radius: 14px;
    background: rgba(245, 158, 11, 0.2);
    border: 1px solid #f59e0b;
    font-size: 12px;
    color: #fbbf24;
}

.country-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
    gap: 6px;
    max-height: 240px;
    overflow-y: auto;
    padding: 4px;
}

.nb-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 4px;
    border-radius: 8px;
    border: 2px solid #78350f;
    background: rgba(0, 0, 0, 0.3);
    cursor: pointer;
    font-size: 10px;
    color: #d4a574;
    min-height: 56px;
    transition: transform 0.15s;
}

.nb-cell:hover { transform: scale(1.08); }
.nb-cell.good   { border-color: #16a34a; background: rgba(22, 163, 74, 0.15); }
.nb-cell.weak   { border-color: #dc2626; background: rgba(220, 38, 38, 0.1); }
.nb-cell.unseen { opacity: 0.55; }

.flag-mini { width: 36px; height: 24px; border-radius: 3px; overflow: hidden; }

/* ---- Flashcards ---- */
.flashcards { align-items: center; gap: 16px; }

.fc-nav {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 16px;
    color: #fbbf24;
    font-weight: bold;
}

.fc-nav button {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid #78350f;
    background: rgba(0, 0, 0, 0.3);
    color: #fbbf24;
    font-size: 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.flashcard {
    width: 280px;
    height: 380px;
    perspective: 1000px;
    cursor: pointer;
}

.flashcard.flipped .fc-inner { transform: rotateY(180deg); }

.fc-inner {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.55s cubic-bezier(0.4, 0, 0.2, 1);
}

.fc-face {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: 18px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-align: center;
}

.fc-front {
    background: linear-gradient(135deg, #451a03, #78350f);
    border: 2px solid #f59e0b;
}

.fc-back {
    background: linear-gradient(135deg, #1e130b, #3d2b1f);
    border: 2px solid #22c55e;
    transform: rotateY(180deg);
}

.flag-big { width: 100px; height: 66px; border-radius: 6px; overflow: hidden; box-shadow: 0 4px 12px rgba(0,0,0,0.4); }

.fc-hint { font-size: 12px; color: #a8a29e; margin-top: auto; }

.region-pill {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: bold;
    color: #fff;
}

.phonetic { font-size: 13px; color: #d4a574; font-style: italic; }

.speak-btn {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 6px;
    transition: background 0.2s;
}

.speak-btn:hover { background: rgba(245, 158, 11, 0.2); }

.fact { font-size: 12px; color: #a8a29e; line-height: 1.4; }

.mastered-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    cursor: pointer;
    font-size: 13px;
    color: #22c55e;
}

.mastered-toggle input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: #22c55e;
    cursor: pointer;
}

/* ---- Leaderboard ---- */
.leaderboard { gap: 16px; }
.leaderboard h3 { color: #fbbf24; font-size: 16px; }

.lb-list { display: flex; flex-direction: column; gap: 6px; }

.lb-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 8px;
    border: 1px solid #78350f;
    font-size: 14px;
}

.lb-row.me { border-color: #f59e0b; background: rgba(245, 158, 11, 0.1); }
.lb-medal { font-size: 18px; min-width: 28px; }
.lb-name  { flex: 1; color: #d4a574; }
.lb-score { font-weight: bold; color: #fbbf24; }

.muted { font-size: 13px; color: #a8a29e; font-style: italic; }

/* ---- Countdown ---- */
.countdown-overlay { background: rgba(30, 19, 11, 0.92); flex-direction: column; gap: 16px; }

.countdown-number {
    font-size: clamp(80px, 20vw, 140px);
    font-weight: bold;
    color: #fbbf24;
    text-shadow: 0 0 40px rgba(245, 158, 11, 0.7);
    animation: pulse 0.9s ease-in-out infinite;
    line-height: 1;
}

.countdown-text { font-size: 22px; color: #d4a574; }

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

/* ---- Playing layout ---- */
.playing-layout {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    padding: 8px 12px;
    gap: 8px;
    overflow-y: auto;
    z-index: 5;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 14px;
    background: rgba(61, 43, 31, 0.95);
    border-radius: 12px;
    border: 1px solid #78350f;
    flex-shrink: 0;
}

.tb-left  { display: flex; flex-direction: column; gap: 2px; }
.tb-right { display: flex; align-items: center; gap: 10px; }

.question-counter { font-size: 13px; color: #f59e0b; font-weight: bold; }
.score-display    { font-size: 15px; color: #fff; font-weight: bold; }
.streak-display   { font-size: 13px; color: #f97316; font-weight: bold; }
.lives-mini       { font-size: 16px; letter-spacing: 2px; }

.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid #78350f;
    background: rgba(0, 0, 0, 0.3);
    color: #fbbf24;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.icon-btn:hover { background: rgba(120, 53, 15, 0.6); }

/* Timer gauge */
.timer-gauge {
    height: 10px;
    background: rgba(61, 43, 31, 0.8);
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
}

.timer-bar-fill {
    height: 100%;
    border-radius: 6px;
    transition: width 0.9s linear, background 0.5s;
}

/* Question panel */
.question-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
}

.country-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 10px 18px;
    background: linear-gradient(135deg, #78350f, #451a03);
    border-radius: 14px;
    border: 2px solid #f59e0b;
    flex-shrink: 0;
}

.flag-icon  { font-size: 28px; }
.flag-badge { width: 48px; height: 32px; border-radius: 4px; overflow: hidden; }
.country-name { font-size: 20px; color: #fbbf24; font-weight: bold; }

.question-text {
    text-align: center;
    font-size: clamp(15px, 3.5vw, 20px);
    color: #fff;
    padding: 0 8px;
    flex-shrink: 0;
}

/* Options grid */
.options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    flex-shrink: 0;
}

@media (max-width: 380px) {
    .options-grid { grid-template-columns: 1fr; }
}

.option-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: rgba(61, 43, 31, 0.95);
    border: 2px solid #78350f;
    border-radius: 12px;
    cursor: pointer;
    min-height: 56px;
    text-align: start;
    color: #fff;
    font-size: 15px;
    transition: transform 0.12s, border-color 0.12s, background 0.12s;
}

.option-card:hover:not(:disabled) { transform: scale(1.02); border-color: #f59e0b; background: rgba(120, 53, 15, 0.9); }
.option-card:active:not(:disabled) { transform: scale(0.97); }
.option-card:disabled { cursor: default; }

.option-label { font-size: 18px; font-weight: bold; color: #f59e0b; min-width: 22px; flex-shrink: 0; }
.option-text  { flex: 1; }
.opt-flag     { font-size: 18px; }

.option-card.correct   { background: rgba(22, 163, 74, 0.35); border-color: #4ade80; }
.option-card.incorrect { background: rgba(153, 27, 27, 0.35); border-color: #f87171; }
.option-card.faded     { opacity: 0.45; }
.option-card.disabled  { opacity: 0.3; transform: scale(0.95); pointer-events: none; }

/* Locator panel */
.locator-panel {
    flex: 1;
    min-height: 200px;
    border-radius: 14px;
    overflow: hidden;
    border: 2px solid #f59e0b;
}

/* Power-up bar */
.powerup-bar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.power-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 8px 12px;
    border-radius: 12px;
    border: 2px solid #78350f;
    background: rgba(61, 43, 31, 0.9);
    cursor: pointer;
    min-height: 52px;
    min-width: 52px;
    transition: transform 0.15s, border-color 0.15s, opacity 0.2s;
    color: #fff;
}

.power-btn:hover:not(:disabled) { transform: scale(1.08); border-color: #f59e0b; }
.power-btn:active:not(:disabled) { transform: scale(0.93); }
.power-btn:disabled { opacity: 0.35; cursor: default; }
.power-btn.spent    { border-color: #3d2b1f; }

.pu-icon  { font-size: 22px; }
.pu-count { font-size: 10px; color: #a8a29e; }

.map-toggle { border-color: #0ea5e9; }

/* Fact banner */
.fact-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(61, 43, 31, 0.98);
    border-radius: 12px;
    border: 2px solid #f59e0b;
    flex-shrink: 0;
    animation: slideUp 0.3s ease-out;
}

.fact-correct   { border-color: #4ade80; }
.fact-incorrect { border-color: #f87171; }

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

.fact-icon   { font-size: 28px; flex-shrink: 0; }
.fact-content { flex: 1; min-width: 0; }
.fact-title  { font-size: 16px; font-weight: bold; color: #fbbf24; margin-bottom: 2px; }
.fact-detail { font-size: 13px; color: #d4a574; line-height: 1.3; }
.fact-points { font-size: 14px; color: #22c55e; font-weight: bold; margin-top: 2px; }

.next-btn {
    padding: 10px 18px;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #1e130b;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    min-height: 44px;
    white-space: nowrap;
    flex-shrink: 0;
    transition: transform 0.15s;
}

.next-btn:hover  { transform: scale(1.05); }
.next-btn:active { transform: scale(0.95); }

/* ---- Africa Map ---- */
.africa-map {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 200px;
    background: linear-gradient(180deg, #0c1e3d 0%, #1a3a5c 100%);
    border-radius: 12px;
    overflow: hidden;
    touch-action: none;
    user-select: none;
}

.map-transform {
    width: 100%;
    height: 100%;
    transform-origin: center center;
    will-change: transform;
}

.africa-svg { width: 100%; height: 100%; display: block; }

.africa-land { fill: #2d5a27; stroke: #1a3a1a; stroke-width: 0.4; }

.region-tint { pointer-events: none; transition: opacity 0.4s; }
.region-tint.north    { fill: #f59e0b; }
.region-tint.east     { fill: #16a34a; }
.region-tint.west     { fill: #38bdf8; }
.region-tint.central  { fill: #a855f7; }
.region-tint.southern { fill: #dc2626; }
.region-tint.island   { fill: #fbbf24; }

.country-dot { cursor: pointer; }
.country-dot .dot-core { transition: r 0.2s, opacity 0.2s; }
.country-dot.r-north    .dot-core { fill: #f59e0b; }
.country-dot.r-east     .dot-core { fill: #16a34a; }
.country-dot.r-west     .dot-core { fill: #38bdf8; }
.country-dot.r-central  .dot-core { fill: #a855f7; }
.country-dot.r-southern .dot-core { fill: #dc2626; }
.country-dot.r-island   .dot-core { fill: #fbbf24; }
.country-dot.island .dot-core { opacity: 0.85; }
.country-dot.pinned .dot-core { fill: #fff; stroke: #f59e0b; stroke-width: 0.5; }

.dot-hit { fill: transparent; }

.dot-ripple {
    fill: none;
    stroke: #f59e0b;
    stroke-width: 0.3;
    animation: ripple 1.2s ease-out infinite;
}

@keyframes ripple {
    0%   { r: 2;   opacity: 1; }
    100% { r: 10;  opacity: 0; }
}

.map-controls {
    position: absolute;
    bottom: 10px;
    right: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    z-index: 5;
}

.map-controls button {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid #78350f;
    background: rgba(30, 19, 11, 0.85);
    color: #fbbf24;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.map-controls button:hover { background: rgba(120, 53, 15, 0.9); }

.island-jump {
    position: absolute;
    bottom: 10px;
    left: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    max-width: 60%;
    z-index: 5;
}

.island-jump button {
    padding: 4px 8px;
    border-radius: 12px;
    border: 1px solid #f59e0b;
    background: rgba(30, 19, 11, 0.85);
    color: #fbbf24;
    font-size: 10px;
    cursor: pointer;
    white-space: nowrap;
    min-height: 28px;
}

.locator-hint {
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(14, 165, 233, 0.9);
    color: #fff;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: bold;
    white-space: nowrap;
    z-index: 5;
}

/* Map drawer (slide-over) */
.map-drawer {
    position: absolute;
    inset: 0;
    z-index: 30;
    background: rgba(12, 30, 61, 0.97);
    animation: slideIn 0.3s ease-out;
    display: flex;
    flex-direction: column;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}

.drawer-close {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 40;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid #78350f;
    background: rgba(61, 43, 31, 0.9);
    color: #fbbf24;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ---- Info Drawer ---- */
.info-drawer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 70vh;
    background: rgba(61, 43, 31, 0.98);
    border-top: 3px solid #f59e0b;
    border-radius: 20px 20px 0 0;
    z-index: 40;
    overflow-y: auto;
    animation: slideUpDrawer 0.35s ease-out;
    box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.6);
}

@keyframes slideUpDrawer {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
}

.drawer-body {
    padding: 24px 20px 32px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
    text-align: center;
}

.drawer-body h2 {
    font-size: 22px;
    color: #fbbf24;
    display: flex;
    align-items: center;
    gap: 8px;
}

.drawer-rows {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.drawer-rows > div {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 8px;
    font-size: 14px;
}

.drawer-rows span { color: #a8a29e; }
.drawer-rows strong { color: #fff; display: flex; align-items: center; gap: 6px; }

/* ---- Pause ---- */
.paused-overlay { background: rgba(30, 19, 11, 0.95); z-index: 50; }

.pause-card {
    text-align: center;
    padding: 32px 28px;
    background: rgba(61, 43, 31, 0.98);
    border-radius: 20px;
    border: 2px solid #f59e0b;
    width: 100%;
    max-width: 360px;
}

.pause-card h2 { font-size: 28px; color: #fbbf24; margin-bottom: 20px; }

/* ---- Finished ---- */
.finished-overlay { background: linear-gradient(180deg, #1e130b 0%, #451a03 60%, #1e130b 100%); }

.summary-card {
    width: 100%;
    max-width: 440px;
    text-align: center;
    padding: 28px 20px;
    background: rgba(61, 43, 31, 0.98);
    border-radius: 20px;
    border: 2px solid #f59e0b;
    box-shadow: 0 0 60px rgba(245, 158, 11, 0.35);
}

.summary-card h2 { font-size: 26px; color: #fbbf24; margin-bottom: 8px; }

.rank-display {
    font-size: 22px;
    font-weight: bold;
    color: #fbbf24;
    text-shadow: 0 0 20px rgba(245, 158, 11, 0.6);
    margin-bottom: 20px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.stat-item {
    padding: 14px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    border: 1px solid #78350f;
}

.stat-value { font-size: 26px; font-weight: bold; color: #fbbf24; }
.stat-label { font-size: 12px; color: #a8a29e; margin-top: 4px; }

.summary-actions { display: flex; flex-direction: column; gap: 10px; }

/* ---- Action buttons ---- */
.action-btn {
    display: block;
    width: 100%;
    padding: 14px 20px;
    font-size: 16px;
    font-weight: bold;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    min-height: 52px;
    transition: transform 0.15s;
}

.action-btn:hover  { transform: scale(1.03); }
.action-btn:active { transform: scale(0.97); }

.action-btn.primary   { background: linear-gradient(135deg, #f59e0b, #d97706); color: #1e130b; }
.action-btn.secondary { background: linear-gradient(135deg, #78350f, #451a03); color: #fff; }
.action-btn.tertiary  { background: linear-gradient(135deg, #dc2626, #991b1b); color: #fff; }

/* ---- Modals ---- */
.modal-overlay { z-index: 60; background: rgba(0, 0, 0, 0.75); align-items: flex-start; padding-top: 40px; }

.modal-card {
    width: 100%;
    max-width: 520px;
    background: rgba(61, 43, 31, 0.99);
    border: 2px solid #f59e0b;
    border-radius: 20px;
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
}

.modal-card h2 { font-size: 22px; color: #fbbf24; }
.modal-card h3 { font-size: 14px; color: #d4a574; text-transform: uppercase; letter-spacing: 0.5px; }

.chip-grid { display: flex; flex-wrap: wrap; gap: 8px; }

.toggle-chip {
    padding: 8px 14px;
    border-radius: 20px;
    border: 2px solid #78350f;
    background: rgba(0, 0, 0, 0.25);
    color: #d4a574;
    font-size: 13px;
    cursor: pointer;
    min-height: 40px;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.toggle-chip.on {
    background: rgba(245, 158, 11, 0.2);
    border-color: #f59e0b;
    color: #fbbf24;
    font-weight: bold;
}

.toggle-chip:disabled { opacity: 0.5; cursor: default; }

.modal-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.modal-actions .action-btn { flex: 1; min-width: 120px; }

.validation { font-size: 12px; color: #f87171; text-align: center; }

.link-box {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid #78350f;
    border-radius: 8px;
    padding: 8px 12px;
    overflow: hidden;
}

.link-box code { font-size: 11px; color: #38bdf8; word-break: break-all; }

/* ---- Toasts ---- */
.toast-stack {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
    width: 100%;
    max-width: 360px;
    padding: 0 12px;
}

.toast {
    padding: 10px 16px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: bold;
    animation: toastIn 0.25s ease-out;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

@keyframes toastIn {
    from { transform: translateY(-12px); opacity: 0; }
    to   { transform: translateY(0);     opacity: 1; }
}

.toast-info    { background: rgba(14, 165, 233, 0.9); color: #fff; }
.toast-success { background: rgba(22, 163, 74, 0.9);  color: #fff; }
.toast-error   { background: rgba(220, 38, 38, 0.9);  color: #fff; }
.toast-power   { background: rgba(245, 158, 11, 0.9); color: #1e130b; }

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.2); }
::-webkit-scrollbar-thumb { background: #78350f; border-radius: 3px; }

/* ---- Mobile portrait tweaks ---- */
@media (max-width: 400px) {
    .menu-card { padding: 16px 12px; border-radius: 16px; }
    .mode-btn  { padding: 12px 14px; min-height: 56px; }
    .options-grid { gap: 8px; }
    .option-card  { padding: 10px 12px; font-size: 14px; min-height: 52px; }
    .power-btn    { padding: 6px 8px; min-width: 44px; min-height: 44px; }
    .pu-icon      { font-size: 18px; }
}

/* ---- Landscape (phone) ---- */
@media (orientation: landscape) and (max-height: 500px) {
    .menu-card { max-height: calc(100vh - 16px); }
    .playing-layout { padding: 4px 8px; gap: 4px; }
    .top-bar { padding: 4px 10px; }
    .question-text { font-size: 14px; }
    .options-grid { grid-template-columns: 1fr 1fr; gap: 6px; }
    .option-card { min-height: 44px; padding: 8px 10px; font-size: 13px; }
    .fact-banner { padding: 8px 12px; }
    .powerup-bar { gap: 6px; }
    .power-btn { min-height: 44px; min-width: 44px; padding: 6px 8px; }
}

/* ---- Flag SVG base ---- */
.flag-svg { display: block; }

/* ---- High scores in menu ---- */
.high-scores { margin-top: 8px; }
.high-scores h3 { color: #f59e0b; margin-bottom: 8px; font-size: 15px; }
.hs-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    margin-bottom: 4px;
    font-size: 13px;
    color: #d4a574;
}
