/* ============================================
   GeoScope — Global Styles
   Mono-only: JetBrains Mono / SF Mono
   ============================================ */

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

/* ---- Custom Properties ---- */
:root {
    --font: 'SF Mono', 'JetBrains Mono', 'Fira Code', 'Cascadia Code',
            'Menlo', 'Consolas', monospace;

    --transition-speed: 0.4s;
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --panel-width: 360px;
    --header-h: 56px;
    --radius: 10px;
    --radius-lg: 14px;
}

/* ---- Dark Theme (default) ---- */
[data-theme="dark"] {
    --bg-primary: #06060b;
    --bg-secondary: #0e0e18;
    --bg-tertiary: #161622;
    --bg-panel: rgba(10, 10, 18, 0.94);
    --bg-input: rgba(255, 255, 255, 0.04);
    --text-primary: #dcdce6;
    --text-secondary: #6a6a82;
    --text-accent: #6ec6ff;
    --border: rgba(255, 255, 255, 0.06);
    --border-strong: rgba(255, 255, 255, 0.10);
    --highlight: #6ec6ff;
    --highlight-dim: rgba(110, 198, 255, 0.08);
    --highlight-mid: rgba(110, 198, 255, 0.15);
    --shadow-panel: -4px 0 60px rgba(0, 0, 0, 0.5);
    --shadow-dropdown: 0 12px 40px rgba(0, 0, 0, 0.5);
    --spinner: #6ec6ff;
    --fact-bg: rgba(110, 198, 255, 0.04);
    --fact-border: rgba(110, 198, 255, 0.08);
    --bar-track: rgba(255, 255, 255, 0.06);
    --bar-fill: #6ec6ff;
    --kbd-bg: rgba(255, 255, 255, 0.06);
    --kbd-border: rgba(255, 255, 255, 0.12);
    --hud-bg: rgba(10, 10, 18, 0.7);
    --pin-active: #6ec6ff;
    --search-focus: rgba(110, 198, 255, 0.2);
}

/* ---- Beige Theme ---- */
[data-theme="beige"] {
    --bg-primary: #f2eddf;
    --bg-secondary: #e8e1d0;
    --bg-tertiary: #ddd5c0;
    --bg-panel: rgba(236, 229, 214, 0.95);
    --bg-input: rgba(0, 0, 0, 0.04);
    --text-primary: #2a2218;
    --text-secondary: #8a7e6a;
    --text-accent: #b5722a;
    --border: rgba(0, 0, 0, 0.06);
    --border-strong: rgba(0, 0, 0, 0.10);
    --highlight: #b5722a;
    --highlight-dim: rgba(181, 114, 42, 0.06);
    --highlight-mid: rgba(181, 114, 42, 0.12);
    --shadow-panel: -4px 0 60px rgba(0, 0, 0, 0.06);
    --shadow-dropdown: 0 12px 40px rgba(0, 0, 0, 0.12);
    --spinner: #b5722a;
    --fact-bg: rgba(181, 114, 42, 0.04);
    --fact-border: rgba(181, 114, 42, 0.10);
    --bar-track: rgba(0, 0, 0, 0.06);
    --bar-fill: #b5722a;
    --kbd-bg: rgba(0, 0, 0, 0.04);
    --kbd-border: rgba(0, 0, 0, 0.12);
    --hud-bg: rgba(236, 229, 214, 0.75);
    --pin-active: #b5722a;
    --search-focus: rgba(181, 114, 42, 0.15);
}

/* ---- Base ---- */
html, body {
    height: 100%;
    width: 100%;
    overflow: hidden;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font);
    transition:
        background var(--transition-speed) var(--ease),
        color var(--transition-speed) var(--ease);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.app {
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* ============================================
   HEADER
   ============================================ */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-h);
    padding: 0 24px;
    z-index: 30;
    position: relative;
    border-bottom: 1px solid var(--border);
    transition: border-color var(--transition-speed) var(--ease);
}

.logo {
    display: flex;
    align-items: center;
    gap: 9px;
    flex-shrink: 0;
}

.logo-icon {
    font-size: 18px;
    color: var(--highlight);
    transition: color var(--transition-speed) var(--ease);
}

.logo h1 {
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    transition: color var(--transition-speed) var(--ease);
}

/* Header Controls */
.header-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition:
        background 0.2s ease,
        border-color 0.2s ease,
        color 0.2s ease,
        transform 0.15s ease;
    font-family: var(--font);
}

.header-btn:hover {
    background: var(--highlight-dim);
    color: var(--text-primary);
    border-color: var(--border-strong);
}

.header-btn:active {
    transform: scale(0.94);
}

/* ============================================
   SEARCH
   ============================================ */
.search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 220px;
    height: 36px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-input);
    padding: 0 10px;
    gap: 7px;
    transition:
        border-color 0.2s ease,
        background 0.2s ease,
        box-shadow 0.2s ease,
        width 0.3s var(--ease);
}

.search-wrapper:focus-within {
    border-color: var(--highlight);
    box-shadow: 0 0 0 3px var(--search-focus);
    width: 280px;
}

.search-icon {
    font-size: 14px;
    color: var(--text-secondary);
    flex-shrink: 0;
    transition: color 0.2s ease;
}

.search-wrapper:focus-within .search-icon {
    color: var(--highlight);
}

.search-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 12px;
    letter-spacing: 0.01em;
    caret-color: var(--highlight);
}

.search-input::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

.search-kbd {
    font-family: var(--font);
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--kbd-bg);
    border: 1px solid var(--kbd-border);
    color: var(--text-secondary);
    line-height: 1;
    flex-shrink: 0;
    transition:
        background var(--transition-speed) var(--ease),
        border-color var(--transition-speed) var(--ease),
        color var(--transition-speed) var(--ease);
}

/* Search Dropdown */
.search-results {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    max-height: 260px;
    overflow-y: auto;
    background: var(--bg-panel);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    box-shadow: var(--shadow-dropdown);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: none;
    z-index: 50;
}

.search-results.open {
    display: block;
}

.search-result-item {
    padding: 10px 12px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.15s ease;
    border-bottom: 1px solid var(--border);
}

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

.search-result-item:hover,
.search-result-item.active {
    background: var(--highlight-dim);
}

.search-result-item .sr-name {
    color: var(--text-primary);
    font-weight: 500;
}

.search-result-item .sr-cont {
    color: var(--text-secondary);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.search-no-results {
    padding: 14px 12px;
    font-size: 11px;
    color: var(--text-secondary);
    text-align: center;
}

.search-results::-webkit-scrollbar { width: 3px; }
.search-results::-webkit-scrollbar-track { background: transparent; }
.search-results::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 2px; }

/* ============================================
   MAIN LAYOUT
   ============================================ */
.main {
    flex: 1;
    display: flex;
    position: relative;
    overflow: hidden;
}

/* ============================================
   GLOBE CONTAINER
   ============================================ */
.globe-container {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.globe-container canvas { cursor: grab; }
.globe-container canvas:active { cursor: grabbing; }

/* Loading */
.globe-loading {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    z-index: 5;
    transition: opacity 0.4s ease;
}

.globe-loading p {
    font-size: 11px;
    color: var(--text-secondary);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border-strong);
    border-top-color: var(--spinner);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

/* ============================================
   HUD OVERLAY
   ============================================ */
.hud {
    position: absolute;
    bottom: 16px;
    left: 16px;
    display: flex;
    gap: 16px;
    background: var(--hud-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 8px 14px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    z-index: 8;
    transition:
        background var(--transition-speed) var(--ease),
        border-color var(--transition-speed) var(--ease);
}

.hud-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.hud-label {
    font-size: 8px;
    font-weight: 600;
    letter-spacing: 0.14em;
    color: var(--text-secondary);
    text-transform: uppercase;
    transition: color var(--transition-speed) var(--ease);
}

.hud-value {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    transition: color var(--transition-speed) var(--ease);
}

/* ============================================
   VISIT COUNTER
   ============================================ */
.visit-counter {
    position: absolute;
    bottom: 16px;
    right: calc(var(--panel-width) + 16px);
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--hud-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 8px 14px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    z-index: 8;
    transition:
        background var(--transition-speed) var(--ease),
        border-color var(--transition-speed) var(--ease);
}

.vc-label {
    font-size: 8px;
    font-weight: 600;
    letter-spacing: 0.14em;
    color: var(--text-secondary);
    text-transform: uppercase;
    transition: color var(--transition-speed) var(--ease);
}

.vc-value {
    font-size: 12px;
    font-weight: 500;
    color: var(--highlight);
    font-variant-numeric: tabular-nums;
    transition: color var(--transition-speed) var(--ease);
}

/* ============================================
   INFO PANEL
   ============================================ */
.info-panel {
    width: var(--panel-width);
    padding: 24px 22px;
    background: var(--bg-panel);
    border-left: 1px solid var(--border);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    overflow-y: auto;
    transition:
        background var(--transition-speed) var(--ease),
        border-color var(--transition-speed) var(--ease);
    z-index: 10;
    box-shadow: var(--shadow-panel);
}

/* Default State */
.info-default {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 10px;
    opacity: 0.55;
}

.info-icon {
    font-size: 44px;
    margin-bottom: 8px;
}

.info-default h2 {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.info-subtitle {
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.7;
    max-width: 220px;
}

/* Shortcuts Hint */
.shortcuts-hint {
    margin-top: 20px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.shortcut {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 10px;
    color: var(--text-secondary);
}

.shortcut kbd, kbd {
    font-family: var(--font);
    font-size: 9px;
    padding: 2px 5px;
    border-radius: 4px;
    background: var(--kbd-bg);
    border: 1px solid var(--kbd-border);
    color: var(--text-secondary);
    line-height: 1.1;
}

/* Country Info Content */
.info-content {
    animation: fadeSlideIn 0.3s var(--ease);
}

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

/* ============================================
   FLAG
   ============================================ */
.flag-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 2;
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 18px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    transition:
        background var(--transition-speed) var(--ease),
        border-color var(--transition-speed) var(--ease);
}

.flag-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.flag-img.loaded {
    opacity: 1;
}

.flag-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: var(--text-secondary);
    opacity: 0.35;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.flag-img.loaded + .flag-placeholder {
    opacity: 0;
}

/* Header row with pin */
.info-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 4px;
}

.country-name {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.25;
    color: var(--text-primary);
    transition: color var(--transition-speed) var(--ease);
}

.country-continent {
    font-size: 10px;
    color: var(--text-accent);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 500;
    margin-top: 4px;
    transition: color var(--transition-speed) var(--ease);
}

.pin-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition:
        background 0.2s ease,
        color 0.2s ease,
        border-color 0.2s ease;
    font-family: var(--font);
}

.pin-btn:hover {
    background: var(--highlight-dim);
}

.pin-btn.pinned {
    color: var(--pin-active);
    border-color: var(--pin-active);
    background: var(--highlight-dim);
}

/* ============================================
   POPULATION BAR
   ============================================ */
.pop-bar-wrapper {
    margin: 20px 0;
    padding: 14px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    transition: border-color var(--transition-speed) var(--ease);
}

.pop-bar-label {
    display: flex;
    justify-content: space-between;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
    transition: color var(--transition-speed) var(--ease);
}

.pop-bar-pct {
    color: var(--highlight);
    font-weight: 600;
    transition: color var(--transition-speed) var(--ease);
}

.pop-bar-track {
    height: 4px;
    border-radius: 2px;
    background: var(--bar-track);
    overflow: hidden;
    transition: background var(--transition-speed) var(--ease);
}

.pop-bar-fill {
    height: 100%;
    border-radius: 2px;
    background: var(--bar-fill);
    transition:
        width 0.6s var(--ease),
        background var(--transition-speed) var(--ease);
    width: 0%;
}

/* ============================================
   INFO GRID
   ============================================ */
.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px 14px;
    margin-bottom: 22px;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.info-item:nth-child(odd):last-child {
    grid-column: span 2;
}

.info-label {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-secondary);
    font-weight: 500;
    transition: color var(--transition-speed) var(--ease);
}

.info-value {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.45;
    transition: color var(--transition-speed) var(--ease);
}

/* ============================================
   FUN FACT CARD
   ============================================ */
.fun-fact {
    background: var(--fact-bg);
    border-radius: var(--radius-lg);
    padding: 16px;
    border: 1px solid var(--fact-border);
    transition:
        background var(--transition-speed) var(--ease),
        border-color var(--transition-speed) var(--ease);
}

.fact-label {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-accent);
    font-weight: 600;
    display: block;
    margin-bottom: 8px;
    transition: color var(--transition-speed) var(--ease);
}

.fact-text {
    font-size: 12.5px;
    line-height: 1.7;
    color: var(--text-primary);
    font-weight: 400;
    transition: color var(--transition-speed) var(--ease);
}

/* ============================================
   CONFLICT MODE
   ============================================ */

/* Toggle button active state */
.header-btn.conflict-active {
    background: rgba(255, 60, 60, 0.15);
    border-color: rgba(255, 60, 60, 0.3);
    color: #ff4444;
    box-shadow: 0 0 12px rgba(255, 60, 60, 0.2);
}

[data-theme="beige"] .header-btn.conflict-active {
    background: rgba(200, 35, 35, 0.12);
    border-color: rgba(200, 35, 35, 0.25);
    color: #c82323;
    box-shadow: 0 0 12px rgba(200, 35, 35, 0.15);
}

/* Legend overlay */
.conflict-legend {
    position: absolute;
    bottom: 20px;
    left: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 16px;
    background: var(--hud-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: var(--font);
    z-index: 10;
    animation: fadeSlideIn 0.3s var(--ease);
}

.legend-title {
    font-size: 10px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    font-weight: 600;
    color: #ff4444;
}

[data-theme="beige"] .legend-title {
    color: #c82323;
}

.legend-items {
    display: flex;
    gap: 14px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 10.5px;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    font-weight: 500;
}

.legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.legend-dot.high {
    background: #ff3c3c;
    box-shadow: 0 0 6px rgba(255, 60, 60, 0.5);
}

.legend-dot.medium {
    background: #ff8c28;
    box-shadow: 0 0 6px rgba(255, 140, 40, 0.5);
}

.legend-dot.low {
    background: #ffc832;
    box-shadow: 0 0 6px rgba(255, 200, 50, 0.5);
}

/* Conflict info in panel */
.conflict-info {
    margin-top: 18px;
    padding: 14px 16px;
    border-radius: var(--radius);
    border: 1px solid rgba(255, 60, 60, 0.15);
    background: rgba(255, 60, 60, 0.04);
    transition: all var(--transition-speed) var(--ease);
}

.conflict-info.severity-high {
    border-color: rgba(255, 60, 60, 0.25);
    background: rgba(255, 60, 60, 0.06);
}

.conflict-info.severity-medium {
    border-color: rgba(255, 140, 40, 0.25);
    background: rgba(255, 140, 40, 0.05);
}

.conflict-info.severity-low {
    border-color: rgba(255, 200, 50, 0.2);
    background: rgba(255, 200, 50, 0.04);
}

.conflict-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.conflict-icon {
    font-size: 14px;
    line-height: 1;
}

.severity-high .conflict-icon { color: #ff4444; }
.severity-medium .conflict-icon { color: #ff8c28; }
.severity-low .conflict-icon { color: #e0b020; }

.conflict-badge {
    font-family: var(--font);
    font-size: 10px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 4px;
}

.severity-high .conflict-badge {
    background: rgba(255, 60, 60, 0.12);
    color: #ff4444;
}

.severity-medium .conflict-badge {
    background: rgba(255, 140, 40, 0.12);
    color: #ff8c28;
}

.severity-low .conflict-badge {
    background: rgba(255, 200, 50, 0.12);
    color: #e0b020;
}

[data-theme="beige"] .severity-high .conflict-badge {
    background: rgba(200, 35, 35, 0.1);
    color: #c82323;
}

[data-theme="beige"] .severity-medium .conflict-badge {
    background: rgba(200, 110, 20, 0.1);
    color: #b06e14;
}

[data-theme="beige"] .severity-low .conflict-badge {
    background: rgba(180, 140, 20, 0.1);
    color: #9a7a14;
}

.conflict-type {
    font-family: var(--font);
    font-size: 9.5px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-weight: 600;
    margin-bottom: 8px;
}

.severity-high .conflict-type { color: #ff4444; }
.severity-medium .conflict-type { color: #ff8c28; }
.severity-low .conflict-type { color: #e0b020; }

[data-theme="beige"] .severity-high .conflict-type { color: #c82323; }
[data-theme="beige"] .severity-medium .conflict-type { color: #b06e14; }
[data-theme="beige"] .severity-low .conflict-type { color: #9a7a14; }

.conflict-desc {
    font-size: 12px;
    line-height: 1.65;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.conflict-meta {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.conflict-meta-item {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
}

.conflict-meta-label {
    font-size: 10px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-secondary);
    font-weight: 600;
    flex-shrink: 0;
}

.conflict-meta-value {
    font-size: 11px;
    color: var(--text-primary);
    text-align: right;
    line-height: 1.5;
}

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

/* ============================================
   QUIZ MODAL
   ============================================ */
.quiz-backdrop {
    background: rgba(0,0,0,0.65);
}

.quiz-modal {
    width: 90%;
    max-width: 460px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.quiz-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    width: 100%;
    max-width: 420px;
    padding: 32px 28px;
}

.quiz-logo {
    font-size: 36px;
    color: var(--highlight);
    line-height: 1;
}

.quiz-title {
    font-family: var(--font);
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.02em;
}

.quiz-sub {
    font-size: 12px;
    color: rgba(255,255,255,0.5);
    letter-spacing: 0.06em;
    margin-bottom: 6px;
}

.quiz-modes {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    width: 100%;
}

.quiz-pro-notice {
    font-family: var(--font);
    font-size: 11px;
    letter-spacing: 0.04em;
    color: #f0c040;
    text-align: center;
    padding: 10px 16px;
    background: rgba(240, 192, 64, 0.08);
    border: 1px solid rgba(240, 192, 64, 0.2);
    border-radius: var(--radius);
    animation: fadeSlideIn 0.25s var(--ease);
    width: 100%;
}

.qmode-btn {
    font-family: var(--font);
    font-size: 11px;
    padding: 10px 12px;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius);
    background: rgba(255,255,255,0.04);
    color: rgba(255,255,255,0.6);
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    letter-spacing: 0.03em;
}

.qmode-btn:hover:not(.locked) { background: rgba(255,255,255,0.08); color: #fff; }
.qmode-btn.active { border-color: var(--highlight); color: var(--highlight); background: rgba(110,198,255,0.08); }
.qmode-btn.locked { opacity: 0.45; cursor: not-allowed; }

.pro-tag {
    display: inline-block;
    font-size: 8px;
    font-weight: 800;
    padding: 2px 5px;
    border-radius: 3px;
    background: linear-gradient(135deg, #f0c040, #e08020);
    color: #1a1000;
    letter-spacing: 0.08em;
    vertical-align: middle;
    margin-left: 4px;
}

.quiz-go {
    font-family: var(--font);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 12px 40px;
    border: none;
    border-radius: var(--radius);
    background: var(--highlight);
    color: #06060b;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 6px;
}

.quiz-go:hover { transform: translateY(-1px); box-shadow: 0 4px 20px rgba(110,198,255,0.3); }

.quiz-close {
    font-family: var(--font);
    font-size: 12px;
    letter-spacing: 0.08em;
    padding: 10px 28px;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: var(--radius);
    background: transparent;
    color: rgba(255,255,255,0.6);
    cursor: pointer;
    transition: all 0.2s;
}

.quiz-close:hover { background: rgba(255,255,255,0.06); color: #fff; }

.quiz-best {
    font-size: 11px;
    color: rgba(255,255,255,0.35);
    letter-spacing: 0.06em;
}

/* Quiz HUD */
.quiz-hud {
    display: flex;
    align-items: center;
    gap: 20px;
    width: 100%;
    justify-content: center;
    padding-bottom: 8px;
}

.qh-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.qh-label {
    font-size: 9px;
    letter-spacing: 0.14em;
    color: rgba(255,255,255,0.35);
    text-transform: uppercase;
}

.qh-item span:last-child {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
}

.qh-timer {
    font-size: 28px;
    font-weight: 800;
    color: var(--highlight);
    min-width: 40px;
    text-align: center;
    transition: color 0.3s;
}

.qh-timer.timer-low { color: #ff4444; }

.quiz-streak {
    font-size: 13px;
    font-weight: 600;
    color: #ffa040;
    transition: opacity 0.3s;
    min-height: 20px;
}

.quiz-prompt {
    font-size: 15px;
    font-weight: 500;
    color: #fff;
    text-align: center;
    margin: 8px 0 16px;
    letter-spacing: 0.02em;
}

.quiz-opts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    width: 100%;
}

.qopt-btn {
    font-family: var(--font);
    font-size: 12px;
    padding: 14px 12px;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius);
    background: rgba(255,255,255,0.05);
    color: rgba(255,255,255,0.85);
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    letter-spacing: 0.02em;
}

.qopt-btn:hover:not(:disabled) { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.2); }
.qopt-btn.qopt-correct { background: rgba(40,200,80,0.25); border-color: rgba(40,200,80,0.5); color: #4ade80; }
.qopt-btn.qopt-wrong { background: rgba(255,60,60,0.2); border-color: rgba(255,60,60,0.4); color: #ff6b6b; }
.qopt-btn:disabled { cursor: default; }

.header-btn.quiz-active {
    background: rgba(110,198,255,0.12);
    border-color: rgba(110,198,255,0.25);
    color: var(--highlight);
}

/* Quiz Results */
.quiz-end-icon { font-size: 40px; color: var(--highlight); }

.quiz-final {
    font-size: 48px;
    font-weight: 800;
    color: #fff;
    line-height: 1;
}

.quiz-final-label {
    font-size: 10px;
    letter-spacing: 0.2em;
    color: rgba(255,255,255,0.35);
    margin-bottom: 8px;
}

.quiz-stats {
    display: flex;
    gap: 24px;
    margin: 12px 0;
}

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

.qs-val {
    font-size: 20px;
    font-weight: 700;
    color: #fff;
}

.qs-lbl {
    font-size: 10px;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,0.4);
    text-transform: uppercase;
}

.quiz-end-btns {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}

/* ============================================
   ACHIEVEMENTS MODAL
   ============================================ */
.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    animation: fadeSlideIn 0.2s var(--ease);
}

.achieve-modal, .compare-modal {
    width: 90%;
    max-width: 520px;
    max-height: 80vh;
    overflow-y: auto;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 80px rgba(0,0,0,0.4);
    padding: 24px;
    font-family: var(--font);
}

.ach-header, .cmp-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.ach-header h3, .cmp-header h3 {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.02em;
    flex: 1;
}

.ach-progress {
    font-size: 11px;
    color: var(--text-secondary);
    letter-spacing: 0.06em;
}

.cmp-close {
    font-size: 20px;
    color: var(--text-secondary);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.2s;
    line-height: 1;
}

.cmp-close:hover { background: var(--bg-input); color: var(--text-primary); }

.ach-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.ach-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-input);
    opacity: 0.4;
    transition: all 0.3s;
}

.ach-card.unlocked {
    opacity: 1;
    border-color: var(--highlight);
    background: var(--highlight-dim);
}

.ach-card.pro-locked {
    border-style: dashed;
}

.ach-icon {
    font-size: 22px;
    line-height: 1;
    flex-shrink: 0;
}

.ach-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.ach-name {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 0.02em;
}

.ach-desc {
    font-size: 10px;
    color: var(--text-secondary);
    letter-spacing: 0.03em;
    line-height: 1.4;
}

/* Badge dot on header button */
.badge-dot {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #ff4444;
    pointer-events: none;
}

.header-btn { position: relative; }

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 200;
    display: flex;
    flex-direction: column-reverse;
    gap: 10px;
    pointer-events: none;
}

.toast {
    font-family: var(--font);
    padding: 14px 18px;
    background: var(--bg-panel);
    border: 1px solid var(--highlight);
    border-radius: var(--radius);
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    gap: 3px;
    transform: translateY(20px);
    opacity: 0;
    transition: all 0.35s var(--ease);
    pointer-events: auto;
    max-width: 300px;
}

.toast.show { transform: translateY(0); opacity: 1; }

.toast-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.02em;
}

.toast-msg {
    font-size: 10.5px;
    color: var(--text-secondary);
    letter-spacing: 0.03em;
    line-height: 1.4;
}

/* ============================================
   COUNTRY COMPARISON MODAL
   ============================================ */
.cmp-search-row {
    position: relative;
    margin-bottom: 16px;
}

.cmp-search {
    font-family: var(--font);
    font-size: 12px;
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-input);
    color: var(--text-primary);
    outline: none;
    letter-spacing: 0.03em;
    transition: border-color 0.2s;
}

.cmp-search:focus { border-color: var(--highlight); }
.cmp-search::placeholder { color: var(--text-secondary); }

.cmp-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 5;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 0 0 var(--radius) var(--radius);
    max-height: 200px;
    overflow-y: auto;
}

.cmp-results:empty { display: none; }

.cmp-result-item {
    font-size: 12px;
    padding: 8px 14px;
    cursor: pointer;
    color: var(--text-primary);
    transition: background 0.15s;
    letter-spacing: 0.02em;
}

.cmp-result-item:hover { background: var(--highlight-dim); }

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

.cmp-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.cmp-flag {
    width: 64px;
    height: 42px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid var(--border);
}

.cmp-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
    letter-spacing: 0.02em;
}

.cmp-vs {
    font-size: 11px;
    font-weight: 800;
    color: var(--text-secondary);
    letter-spacing: 0.15em;
}

.cmp-row {
    margin-bottom: 14px;
}

.cmp-label {
    font-size: 10px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-secondary);
    font-weight: 600;
    margin-bottom: 6px;
}

.cmp-bar-pair {
    display: flex;
    gap: 8px;
}

.cmp-bar-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
}

.cmp-bar-wrap.left { flex-direction: row-reverse; }
.cmp-bar-wrap.right { flex-direction: row; }

.cmp-bar-track {
    flex: 1;
    height: 8px;
    background: var(--bar-track);
    border-radius: 4px;
    overflow: hidden;
}

.cmp-bar-wrap.left .cmp-bar-track { direction: rtl; }

.cmp-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.6s var(--ease);
}

.cmp-bar-fill.a { background: var(--highlight); }
.cmp-bar-fill.b { background: #a78bfa; }

.cmp-val {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-primary);
    min-width: 55px;
    letter-spacing: 0.02em;
}

.cmp-bar-wrap.left .cmp-val { text-align: left; }
.cmp-bar-wrap.right .cmp-val { text-align: right; }

/* Info btn group */
.info-btn-group {
    display: flex;
    gap: 6px;
    align-items: center;
}

.compare-btn {
    opacity: 0.6;
    transition: opacity 0.2s;
}

.compare-btn:hover { opacity: 1; }

/* ============================================
   SCROLLBAR
   ============================================ */
.info-panel::-webkit-scrollbar { width: 3px; }
.info-panel::-webkit-scrollbar-track { background: transparent; }
.info-panel::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 2px; }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 900px) {
    .main {
        flex-direction: column;
    }

    .info-panel {
        width: 100%;
        max-height: 45vh;
        border-left: none;
        border-top: 1px solid var(--border);
        border-radius: 18px 18px 0 0;
        box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.12);
    }

    .visit-counter {
        right: 16px;
    }

    .info-default { padding: 16px 0; height: auto; }
    .info-icon { font-size: 32px; }
    .shortcuts-hint { display: none; }

    .search-wrapper { width: 180px; }
    .search-wrapper:focus-within { width: 220px; }

    .ach-grid { grid-template-columns: 1fr; }
    .achieve-modal, .compare-modal { max-width: 95%; padding: 18px; }
    .quiz-opts { grid-template-columns: 1fr; }
}

@media (max-width: 500px) {
    .header { padding: 0 14px; }
    .logo h1 { font-size: 12px; }
    .search-wrapper { width: 140px; }
    .search-wrapper:focus-within { width: 180px; }
    .hud { display: none; }
    :root { --panel-width: 100%; }

    .quiz-modes { grid-template-columns: 1fr; }
    .quiz-stats { gap: 14px; }
    .toast-container { right: 12px; bottom: 12px; }
}
