/* ═══════════════════════════════════════════
   GeoVaqt · map.css
   Futuristic dark geo-game aesthetic
   ═══════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Exo+2:wght@300;400;600&display=swap');

:root {
    --c-bg:       #020810;
    --c-panel:    rgba(4, 16, 32, 0.92);
    --c-border:   rgba(0, 200, 255, 0.25);
    --c-accent:   #00c8ff;
    --c-accent2:  #00ff88;
    --c-danger:   #ff4466;
    --c-warn:     #ffb300;
    --c-text:     #cce8ff;
    --c-muted:    #4a7090;
    --c-gold:     #ffd700;
    --radius:     14px;
    --safe-top:   env(safe-area-inset-top, 0px);
    --safe-bottom:env(safe-area-inset-bottom, 0px);
    --font-head:  'Orbitron', monospace;
    --font-body:  'Exo 2', sans-serif;
}

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

html, body {
    width: 100vw; height: 100vh;
    overflow: hidden;
    background: var(--c-bg);
    font-family: var(--font-body);
    color: var(--c-text);
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    overscroll-behavior: none;
}

/* iOS Safari — address bar hisobga olinishi */
@supports (-webkit-touch-callout: none) {
    html, body { height: -webkit-fill-available; }
}

/* ── NAVBAR — globe canvas ustida ko'rinsin ── */
body > .header {
    position: relative;
    z-index: 1200;
}

/* ── GLOBUS ── */
#globeViz {
    position: absolute;
    inset: 0;
    width: 100%; height: 100%;
    touch-action: none;   /* brauzer gesture (pull-to-refresh, scroll) ni bloklash */
    -webkit-user-select: none;
    user-select: none;
}

/* ── SCANLINE OVERLAY ── */
body::after {
    content: '';
    position: fixed; inset: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 200, 255, 0.012) 2px,
        rgba(0, 200, 255, 0.012) 4px
    );
    pointer-events: none;
    z-index: 5;
}

/* ── PANEL BASE ── */
.gv-panel {
    background: var(--c-panel);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 0 40px rgba(0, 200, 255, 0.06), 0 8px 32px rgba(0,0,0,0.6);
}

/* ── TITLE BOX ── */
.title-box {
    position: fixed;
    top: calc(80px + var(--safe-top));
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    text-align: center;
    pointer-events: none;
    padding: 10px 28px 12px;
    white-space: nowrap;
    transition: opacity 0.3s, transform 0.3s;
}
/* O'yin faol bo'lganda title-box yashirinsin */
.title-box.hidden-game {
    opacity: 0;
    transform: translateX(-50%) translateY(-20px);
    pointer-events: none;
}
.title-box h2 {
    font-family: var(--font-head);
    font-size: 22px;
    font-weight: 900;
    color: var(--c-accent);
    letter-spacing: 3px;
    text-shadow: 0 0 20px rgba(0, 200, 255, 0.6);
    margin-bottom: 4px;
}
.title-box p {
    font-size: 12px;
    color: var(--c-muted);
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* ── MODE SWITCHER ── */
#mode-switcher {
    position: fixed;
    top: calc(var(--safe-top) + 72px);
    left: 20px;
    z-index: 30;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.mode-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 10px;
    border: 1px solid var(--c-border);
    background: var(--c-panel);
    color: var(--c-muted);
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    backdrop-filter: blur(12px);
    transition: all 0.22s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}
.mode-btn .mode-icon { font-size: 16px; }
.mode-btn:hover {
    border-color: var(--c-accent);
    color: var(--c-text);
    background: rgba(0,200,255,0.08);
}
.mode-btn.active {
    border-color: var(--c-accent);
    color: var(--c-accent);
    background: rgba(0,200,255,0.12);
    box-shadow: 0 0 14px rgba(0,200,255,0.2);
}

/* ── INFO PANEL (Oddiy rejim) ── */
.info-panel {
    position: fixed;
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
    width: 280px;
    z-index: 20;
    padding: 22px 20px;
    transition: transform 0.4s cubic-bezier(0.4,0,0.2,1),
                opacity 0.4s ease;
}
.info-panel.hidden {
    transform: translate(320px, -50%);
    opacity: 0;
    pointer-events: none;
}
.info-panel h3 {
    font-family: var(--font-head);
    font-size: 15px;
    color: var(--c-accent2);
    margin: 0 0 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--c-border);
    letter-spacing: 1px;
}
.info-panel p { line-height: 1.7; margin: 6px 0; font-size: 13px; }
.info-panel p b { color: var(--c-accent); font-weight: 600; }
.close-btn {
    position: absolute;
    top: 12px; right: 12px;
    background: none; border: none;
    color: var(--c-muted);
    font-size: 18px; cursor: pointer;
    width: 32px; height: 32px;
    border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    transition: color 0.2s, background 0.2s;
}
.close-btn:hover { color: var(--c-danger); background: rgba(255,68,102,0.1); }

/* ── GAME HUD ── */
#game-hud {
    position: fixed;
    top: calc(var(--safe-top) + 72px);
    right: 20px;
    z-index: 30;
    width: 300px;
    padding: 18px 20px;
    display: none;
}
#game-hud.visible { display: block; }

.hud-mode-label {
    font-family: var(--font-head);
    font-size: 9px;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--c-accent);
    margin-bottom: 10px;
    display: flex; align-items: center; gap: 8px;
}
.hud-mode-label::before {
    content: '';
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--c-accent2);
    box-shadow: 0 0 6px var(--c-accent2);
    animation: blink 1.4s infinite;
    flex-shrink: 0;
}
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0.2} }

.hud-question {
    font-size: 14px;
    font-weight: 600;
    color: var(--c-text);
    margin-bottom: 14px;
    line-height: 1.5;
}
.hud-target {
    font-family: var(--font-head);
    font-size: 22px;
    font-weight: 900;
    color: var(--c-gold);
    text-shadow: 0 0 20px rgba(255,215,0,0.5);
    margin-bottom: 4px;
    letter-spacing: 2px;
}
.hud-hint {
    font-size: 11px;
    color: var(--c-muted);
    margin-bottom: 16px;
    font-style: italic;
}

/* Score & stats */
.hud-stats {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
}
.hud-stat {
    flex: 1;
    background: rgba(0,200,255,0.06);
    border: 1px solid var(--c-border);
    border-radius: 8px;
    padding: 8px;
    text-align: center;
}
.hud-stat-val {
    font-family: var(--font-head);
    font-size: 20px;
    font-weight: 700;
    color: var(--c-accent);
    line-height: 1;
}
.hud-stat-lbl {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--c-muted);
    margin-top: 4px;
}

/* Timer bar */
.hud-timer-wrap {
    margin-bottom: 14px;
}
.hud-timer-label {
    display: flex; justify-content: space-between;
    font-size: 11px; color: var(--c-muted);
    margin-bottom: 5px;
}
.hud-timer-bar {
    height: 4px;
    border-radius: 2px;
    background: rgba(255,255,255,0.08);
    overflow: hidden;
}
.hud-timer-fill {
    height: 100%;
    border-radius: 2px;
    background: var(--c-accent2);
    transition: width 1s linear, background 0.5s;
    box-shadow: 0 0 8px var(--c-accent2);
}
.hud-timer-fill.warn { background: var(--c-warn); box-shadow: 0 0 8px var(--c-warn); }
.hud-timer-fill.danger { background: var(--c-danger); box-shadow: 0 0 8px var(--c-danger); }

/* Game buttons */
.hud-btn {
    display: flex; align-items: center; justify-content: center; gap: 6px;
    width: 100%; padding: 10px;
    border-radius: 9px;
    border: 1px solid var(--c-border);
    background: rgba(0,200,255,0.08);
    color: var(--c-accent);
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.18s;
    margin-top: 8px;
}
.hud-btn:hover { background: rgba(0,200,255,0.18); box-shadow: 0 0 14px rgba(0,200,255,0.2); }
.hud-btn:active { transform: scale(0.97); }
.hud-btn.danger-btn { border-color: rgba(255,68,102,0.4); color: var(--c-danger); background: rgba(255,68,102,0.06); }
.hud-btn.success-btn { border-color: rgba(0,255,136,0.4); color: var(--c-accent2); background: rgba(0,255,136,0.06); }

/* ── FEEDBACK TOAST ── */
#toast {
    position: fixed;
    bottom: calc(30px + var(--safe-bottom));
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    z-index: 100;
    padding: 14px 28px;
    border-radius: 50px;
    font-family: var(--font-head);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 1px;
    text-align: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    backdrop-filter: blur(12px);
    min-width: 220px;
    max-width: 90vw;
}
#toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
#toast.correct {
    background: rgba(0, 255, 136, 0.15);
    border: 1px solid rgba(0,255,136,0.5);
    color: var(--c-accent2);
    box-shadow: 0 0 30px rgba(0,255,136,0.2);
}
#toast.wrong {
    background: rgba(255,68,102,0.15);
    border: 1px solid rgba(255,68,102,0.5);
    color: var(--c-danger);
    box-shadow: 0 0 30px rgba(255,68,102,0.2);
}
#toast.info {
    background: rgba(0,200,255,0.12);
    border: 1px solid rgba(0,200,255,0.4);
    color: var(--c-accent);
}

/* ── SHAPE GAME: silhouette hint ── */
#shape-hint {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 25;
    padding: 18px 24px;
    text-align: center;
    pointer-events: none;
    display: none;
}
#shape-hint.visible { display: block; }
#shape-hint p {
    font-family: var(--font-head);
    font-size: 11px;
    letter-spacing: 2px;
    color: var(--c-muted);
    text-transform: uppercase;
    margin-top: 8px;
}

/* ── CAPITAL GAME: input ── */
#capital-input-wrap {
    margin-top: 10px;
    display: none;
}
#capital-input-wrap.visible { display: block; }
#capital-input {
    width: 100%;
    background: rgba(0,200,255,0.06);
    border: 1px solid var(--c-border);
    border-radius: 8px;
    padding: 10px 14px;
    color: var(--c-text);
    font-family: var(--font-body);
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
}
#capital-input:focus { border-color: var(--c-accent); }
#capital-input::placeholder { color: var(--c-muted); }

/* ── SCORE SUMMARY MODAL ── */
#score-modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(0,0,0,0.75);
    backdrop-filter: blur(8px);
    display: flex; align-items: center; justify-content: center;
    opacity: 0; pointer-events: none;
    transition: opacity 0.35s;
}
#score-modal.show { opacity: 1; pointer-events: all; }
.score-card {
    width: min(400px, 90vw);
    padding: 36px 32px;
    text-align: center;
    border-top: 3px solid var(--c-gold);
}
.score-card h2 {
    font-family: var(--font-head);
    font-size: 20px;
    color: var(--c-gold);
    letter-spacing: 2px;
    margin-bottom: 8px;
}
.score-card .score-big {
    font-family: var(--font-head);
    font-size: 64px;
    font-weight: 900;
    color: var(--c-accent);
    text-shadow: 0 0 40px rgba(0,200,255,0.5);
    line-height: 1;
    margin: 16px 0;
}
.score-card p { font-size: 14px; color: var(--c-muted); margin-bottom: 24px; }
.score-stars { font-size: 32px; margin-bottom: 8px; letter-spacing: 4px; }

/* ── HUD TOGGLE BAR ──
   Desktopda yashirin, mobilda katta va bosiladigan.               */
.hud-toggle-bar {
    display: none; /* desktop: yashirin */
}

/* Minimized holat: faqat toggle bar ko'rinadi */
#game-hud.minimized {
    overflow: hidden;
}

/* ── RESPONSIVE ── */
@media (max-width: 991px) {
    /* Navbar logosini kichraytirish — globe uchun joy bo'shatish */
    .header.header-6 .navbar-brand img {
        max-height: 44px !important;
        width: auto !important;
    }
    .header.header-6 .navbar {
        padding: 8px 0 !important;
    }
}

@media (max-width: 767px) {
    /* Title box — navbar ostida to'g'ri joylashsin */
    .title-box {
        top: calc(66px + var(--safe-top));
        padding: 7px 20px 9px;
    }
    .title-box h2 { font-size: 15px; letter-spacing: 2px; }
    .title-box p  { display: none; }

    /* ── Mode tugmalari ──
       Pastki qatorda, gorizontal, doim ko'rinadigan joyda.
       z-index: 100 — navbar (1030) dan past, lekin barcha panel (20-30) dan yuqori  */
    #mode-switcher {
        position: fixed;
        top: auto;
        bottom: calc(18px + var(--safe-bottom));
        left: 50%;
        transform: translateX(-50%);
        flex-direction: row;
        flex-wrap: nowrap;
        overflow-x: auto;
        scrollbar-width: none;
        gap: 8px;
        width: calc(100vw - 28px);
        padding: 2px 4px 4px;
        z-index: 100;
    }
    #mode-switcher::-webkit-scrollbar { display: none; }

    .mode-btn {
        padding: 10px 14px;
        font-size: 11px;
        flex-shrink: 0;
        min-width: 48px;
        justify-content: center;
    }
    .mode-btn .mode-label { display: none; }
    .mode-btn .mode-icon  { font-size: 20px; }

    /* ── HUD toggle bar — mobilda katta, bosiladigan ── */
    .hud-toggle-bar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: calc(100% + 32px);   /* padding ni ham qamrab olish */
        margin: -14px -16px 14px;   /* card padding ga teng qarama-qarshi */
        padding: 14px 20px;
        background: linear-gradient(90deg,
            rgba(0,200,255,0.12) 0%,
            rgba(0,200,255,0.06) 100%);
        border: none;
        border-bottom: 1px solid var(--c-border);
        border-radius: var(--radius) var(--radius) 0 0;
        cursor: pointer;
        color: var(--c-text);
        transition: background 0.2s;
        -webkit-tap-highlight-color: transparent;
    }
    .hud-toggle-bar:active {
        background: rgba(0,200,255,0.2);
    }
    .hud-toggle-mode {
        font-family: var(--font-head);
        font-size: 11px;
        letter-spacing: 2px;
        color: var(--c-accent);
        text-transform: uppercase;
    }
    .hud-toggle-arrow {
        font-size: 22px;
        color: var(--c-accent);
        line-height: 1;
        width: 44px;
        height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: rgba(0,200,255,0.1);
        border: 1px solid var(--c-border);
        border-radius: 50%;
        font-style: normal;
    }

    /* ── Game HUD ──
       Mode tugmalari ustida, maksimal balandlik chegaralangan, scroll bor */
    #game-hud {
        position: fixed;
        top: auto;
        bottom: calc(76px + var(--safe-bottom));
        left: 8px;
        right: 8px;
        width: auto;
        max-height: 55vh;
        overflow-y: auto;
        scrollbar-width: none;
        padding: 14px 16px;
        transition: max-height 0.35s cubic-bezier(0.4,0,0.2,1);
    }
    #game-hud::-webkit-scrollbar { display: none; }

    /* Minimized: faqat toggle bar balandligi */
    #game-hud.minimized {
        max-height: 56px !important;
        overflow: hidden;
    }

    /* HUD ichidagi siluet kichikroq */
    #game-hud svg { width: 120px !important; height: 120px !important; }

    /* ── Info panel ── */
    .info-panel {
        position: fixed;
        top: auto;
        right: auto;
        bottom: calc(76px + var(--safe-bottom));
        left: 8px;
        right: 8px;
        width: auto;
        transform: none;
        padding: 14px 16px;
        max-height: 50vh;
        overflow-y: auto;
    }
    .info-panel.hidden {
        transform: translateY(250px);
        opacity: 0;
        pointer-events: none;
    }

    /* Toast yuqori ko'tarilsin (mode tugmalar ustida) */
    #toast { bottom: calc(140px + var(--safe-bottom)); }
}

@media (min-width: 768px) {
    .mode-btn .mode-icon { font-size: 14px; }
}