/* 
   Ants & Atlases 
   Premium Geographic Dashboard
*/

:root {
    --bg-dark: #0a0c10;
    --navy-deep: #0f172a;
    --primary-blue: #3b82f6;
    --accent-gold: #f59e0b;
    --accent-emerald: #10b981;
    --text-primary: #f8fafc;
    --text-muted: #94a3b8;
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.1);
    --font-main: 'Outfit', sans-serif;
    --font-display: 'Playfair Display', serif;
    --transition: cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: var(--font-main);
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
    line-height: 1.6;
}

#app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header & Branding */
#main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 40px;
    background: linear-gradient(to bottom, rgba(10, 12, 16, 0.9), transparent);
    z-index: 100;
}

.brand {
    display: flex;
    flex-direction: column;
}

.logo-text {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: 6px;
    color: var(--text-primary);
}

.tagline {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 4px;
    color: var(--primary-blue);
    opacity: 0.8;
}

.header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

/* Segmented view switcher (Continents · Countries · Oceans) */
.view-segment {
    display: inline-flex;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 50px;
    overflow: hidden;
}
.seg-btn {
    background: transparent;
    border: none;
    color: var(--text-primary);
    padding: 10px 18px;
    font-family: var(--font-main);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    cursor: pointer;
    transition: 0.2s var(--transition);
    border-right: 1px solid var(--glass-border);
}
.seg-btn:last-child { border-right: none; }
.seg-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}
.seg-btn.active {
    background: rgba(59, 130, 246, 0.2);
    color: var(--primary-blue);
}

/* More menu */
.nav-menu { position: relative; }
.nav-menu-trigger {
    font-size: 1.3rem;
    font-weight: 700;
    padding: 8px 16px;
    line-height: 1;
}
.nav-menu-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 200px;
    background: rgba(15, 23, 42, 0.96);
    backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    padding: 8px;
    display: none;
    z-index: 200;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
}
.nav-menu-dropdown.open { display: block; }
.menu-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 10px 14px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 1px;
    cursor: pointer;
    text-decoration: none;
    transition: 0.15s var(--transition);
}
.menu-item:hover {
    background: rgba(59, 130, 246, 0.12);
    color: var(--primary-blue);
}

.action-btn {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    padding: 10px 24px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    cursor: pointer;
    transition: 0.4s var(--transition);
    text-decoration: none;
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
    border-color: var(--primary-blue);
}

.action-btn.accent {
    background: var(--primary-blue);
    border-color: var(--primary-blue);
    color: #fff;
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.3);
}

.action-btn.subtle {
    opacity: 0.6;
    border: none;
}

/* Main Content: The Globe & Viewport */
#globe-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    padding: 12px 24px 24px;
}

#status-display {
    text-align: center;
    margin-bottom: 10px;
}

.status-label {
    font-size: 0.55rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 4px;
    color: var(--text-muted);
    margin-bottom: 3px;
}

#current-region-name {
    font-family: var(--font-display);
    font-size: clamp(1.4rem, 2.6vw, 2rem);
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--text-primary);
    text-transform: capitalize;
    line-height: 1.15;
}

#globe-viewport {
    width: 100%;
    max-width: min(1600px, 96vw);
    position: relative;
    perspective: 2000px;
}

#globe-wrap {
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, #1e40af, #0f172a); /* Deeper, vibrant ocean blue */
    border-radius: 18px;
    padding: 22px;
    position: relative;
    box-shadow: 0 0 100px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--glass-border);
}

/* SVG Map Styling */
#world-map {
    width: 100%;
    height: auto;
    max-height: calc(100vh - 210px); /* status + header + footer ≈ 210px, rest goes to the map */
    display: block;
    filter: drop-shadow(0 15px 25px rgba(0, 0, 0, 0.4)); /* 3D floating effect */
}

/* Hide the "PLANET EARTH" status when we're looking at country-level detail —
   it's redundant. Override when Geocode is active so the mystery banner still shows. */
#app[data-view="countries"] #status-display { display: none; }
body.geocode-active #status-display { display: block !important; }

/* Tier picker — global level selector. Hidden during an active quiz. */
#tier-picker {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    width: 100%;
    max-width: min(1600px, 96vw);
    margin: 0 auto 10px;
    flex-wrap: wrap;
}
body.mission-active #tier-picker,
body.geocode-active #tier-picker { display: none; }

.tier-label {
    font-size: 0.55rem;
    font-weight: 800;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--text-muted);
}
.tier-chips {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}
.tier-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    padding: 6px 14px;
    border-radius: 18px;
    font-family: var(--font-main);
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s var(--transition);
}
.tier-chip .tier-num {
    font-family: var(--font-display);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0;
}
.tier-chip .tier-name {
    letter-spacing: 1px;
    text-transform: uppercase;
    font-size: 0.65rem;
}
.tier-chip:hover:not(:disabled) {
    background: rgba(245, 158, 11, 0.12);
    border-color: var(--accent-gold);
    transform: translateY(-1px);
}
.tier-chip.active {
    background: var(--accent-gold);
    border-color: var(--accent-gold);
    color: var(--bg-dark);
}
.tier-chip.active .tier-num,
.tier-chip.active .tier-name { color: var(--bg-dark); }
.tier-chip.disabled,
.tier-chip:disabled {
    opacity: 0.38;
    cursor: not-allowed;
}

/* Region focus chips — only in Countries view, hidden during a quiz */
#region-focus {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 14px;
    width: 100%;
    max-width: min(1600px, 96vw);
    margin: 0 auto 10px;
    flex-wrap: wrap;
}
#app[data-view="countries"] #region-focus { display: flex; }
body.mission-active #region-focus,
body.geocode-active #region-focus { display: none; }

.focus-label {
    font-size: 0.55rem;
    font-weight: 800;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--text-muted);
}
.focus-chips {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
}
.focus-chip {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    padding: 5px 12px;
    border-radius: 16px;
    font-family: var(--font-main);
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s var(--transition);
}
.focus-chip:hover {
    background: rgba(59, 130, 246, 0.15);
    border-color: var(--primary-blue);
    transform: translateY(-1px);
}
.focus-chip.active {
    background: var(--accent-gold);
    border-color: var(--accent-gold);
    color: var(--bg-dark);
}

/* Edge-to-edge mode on wide screens — reclaim the remaining gutters for the map */
@media (min-width: 1600px) {
    #globe-container { padding: 12px 12px 18px; }
    #globe-viewport { max-width: calc(100vw - 24px); }
    #globe-wrap { padding: 16px; }
    #mission-strip { max-width: calc(100vw - 24px); }
    #region-focus { max-width: calc(100vw - 24px); }
}

.ocean-bg {
    fill: transparent;
}

.region-path {
    fill: rgba(255, 255, 255, 0.95); /* Glossy silver/white landmass */
    stroke: rgba(255, 255, 255, 0.5);
    stroke-width: 15;
    cursor: pointer;
    transition: 0.4s var(--transition);
}

.region-path:hover {
    fill: #fff;
    stroke: var(--primary-blue);
    transform: translateY(-2px); /* Slight hover lift */
    filter: drop-shadow(0 10px 15px rgba(59, 130, 246, 0.4));
}

.region-path.active {
    fill: var(--accent-gold);
}

/* Sophisticated Modal / Overlay */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 12, 16, 0.85);
    backdrop-filter: blur(12px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
}

.overlay.visible {
    display: flex;
}

.modal-content.glass {
    width: 100%;
    max-width: 800px;
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.4), rgba(15, 23, 42, 0.6));
    border: 1px solid var(--glass-border);
    border-radius: 30px;
    padding: 60px;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transform: translateY(20px);
    transition: 0.6s var(--transition);
}

.overlay.visible .modal-content {
    transform: translateY(0);
}

#close-modal,
.modal-content > button[aria-label="Close"] {
    position: absolute;
    top: 24px;
    right: 24px;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    font-weight: 300;
    line-height: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 50%;
    color: var(--text-muted);
    cursor: pointer;
    transition: 0.2s var(--transition);
    z-index: 2;
}
#close-modal:hover,
.modal-content > button[aria-label="Close"]:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text-primary);
    border-color: var(--text-primary);
}

.modal-body {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 50px;
    align-items: center;
}

#modal-image-wrap {
    background: var(--glass-bg);
    aspect-ratio: 1;
    border-radius: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 6rem;
    border: 1px solid var(--glass-border);
}

.tag {
    font-size: 0.6rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 3px;
    color: var(--primary-blue);
    margin-bottom: 10px;
}

#modal-title {
    font-family: var(--font-display);
    font-size: 3rem;
    font-weight: 400;
    margin-bottom: 20px;
}

.stats-row {
    display: flex;
    gap: 30px;
    margin-bottom: 25px;
    border-top: 1px solid var(--glass-border);
    padding-top: 20px;
}

.stat-item {
    display: flex;
    flex-direction: column;
}

.stat-item .lbl {
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
}

.stat-item .val {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
}

#modal-description {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 40px;
}

.primary-action {
    background: var(--text-primary);
    color: var(--bg-dark);
    border: none;
    padding: 16px 36px;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    cursor: pointer;
    transition: 0.4s var(--transition);
}

.primary-action:hover {
    background: #fff;
    transform: scale(1.05);
}

.secondary-action {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
    padding: 15px 30px;
    border-radius: 50px;
    font-family: var(--font-main);
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    cursor: pointer;
    transition: 0.3s var(--transition);
}
.secondary-action:hover {
    background: var(--glass-bg);
    border-color: var(--text-primary);
    color: var(--text-primary);
}

/* Footer Section */
#main-footer {
    padding: 12px 20px;
    text-align: center;
    font-size: 0.55rem;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--text-muted);
    opacity: 0.5;
}

/* Responsive Overrides */
@media (max-width: 900px) {
    #main-header { padding: 20px; }
    #current-region-name { font-size: 2.2rem; }
    .modal-body { grid-template-columns: 1fr; gap: 30px; }
    .modal-content.glass { padding: 40px; }
}

@media (max-width: 650px) {
    #main-header {
        flex-direction: column;
        align-items: center;
        gap: 15px;
        padding: 15px;
    }
    
    .header-actions {
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }
    
    .action-btn {
        padding: 8px 12px;
        font-size: 0.65rem;
    }
    
    #globe-container {
        padding: 15px; /* Maximizes the map area on mobile */
    }
    
    #current-region-name { 
        font-size: 1.8rem; 
    }
}

.map-label {
    fill: #fff;
    font-size: 200px;
    font-weight: 700;
    pointer-events: none;
    opacity: 0.6;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    filter: drop-shadow(0 0 2px rgba(0,0,0,0.8));
}

/* Country-level paths (Countries view) */
.country-path {
    fill: rgba(255, 255, 255, 0.55);
    stroke: rgba(15, 23, 42, 0.6);
    stroke-width: 3;
    cursor: default;
    transition: 0.25s var(--transition);
    vector-effect: non-scaling-stroke;
}

.country-path.in-atlas {
    fill: rgba(255, 255, 255, 0.95);
    cursor: pointer;
}

.country-path.dim {
    fill: rgba(148, 163, 184, 0.35);
    pointer-events: none;
}

.country-path.in-atlas:hover {
    fill: var(--accent-gold);
    stroke: #fff;
    filter: drop-shadow(0 0 25px rgba(245, 158, 11, 0.5));
}

.country-label {
    fill: var(--bg-dark);
    font-family: var(--font-main);
    font-size: 140px;
    font-weight: 800;
    letter-spacing: 2px;
    pointer-events: none;
    paint-order: stroke;
    stroke: rgba(255, 255, 255, 0.6);
    stroke-width: 8;
}

/* During a Mission or Geocode, hide the ISO country labels — they'd be a cheat helper. */
body.mission-active .country-label,
body.geocode-active .country-label { display: none; }

.ocean-node {
    fill: rgba(59, 130, 246, 0.1);
    stroke: var(--primary-blue);
    stroke-dasharray: 4;
    transition: 0.4s var(--transition);
}

.ocean-node:hover {
    fill: rgba(59, 130, 246, 0.4);
    stroke-dasharray: 0;
}

.correct-flash {
    fill: #22c55e !important;
    filter: drop-shadow(0 0 30px #22c55e) !important;
    transition: all 0.3s;
}

.incorrect-flash {
    fill: #ef4444 !important;
    filter: drop-shadow(0 0 30px #ef4444) !important;
    transition: all 0.3s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    50% { transform: translateX(10px); }
    75% { transform: translateX(-10px); }
}

.shake {
    animation: shake 0.4s ease-in-out;
    color: #ef4444 !important;
}

/* Utility */
.hidden { display: none !important; }

/* ===========================================================
   MISSION — HUD strip + summary modal
   =========================================================== */
#mission-strip {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    width: 100%;
    max-width: min(1600px, 96vw);
    margin: 0 auto 14px;
    padding: 16px 28px;
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.6), rgba(15, 23, 42, 0.85));
    border: 1px solid var(--glass-border);
    border-radius: 18px;
    backdrop-filter: blur(10px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
    animation: mission-strip-in 0.4s var(--transition);
}
#mission-strip.active { display: flex; }

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

.mission-left {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 110px;
}
.mission-tag {
    font-size: 0.6rem;
    font-weight: 800;
    letter-spacing: 4px;
    text-transform: uppercase;
    color: var(--accent-gold);
}
.mission-round {
    font-family: var(--font-display);
    display: flex;
    align-items: baseline;
    gap: 4px;
    line-height: 1;
}
#mission-round-current {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
}
.round-divider, #mission-round-total {
    font-size: 1.2rem;
    color: var(--text-muted);
    font-weight: 600;
}

.mission-target {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    text-align: center;
}
.target-label {
    font-size: 0.6rem;
    font-weight: 800;
    letter-spacing: 4px;
    text-transform: uppercase;
    color: var(--text-muted);
}
.target-name {
    font-family: var(--font-display);
    font-size: 2.4rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
    line-height: 1.1;
    margin-top: 2px;
    text-transform: uppercase;
}

.mission-right {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 140px;
    justify-content: flex-end;
}
.mission-score-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(34, 197, 94, 0.13);
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-radius: 24px;
    color: #4ade80;
    font-weight: 700;
}
.mission-score-chip .score-value { font-size: 1.05rem; }
.mission-score-chip .score-icon { font-size: 0.9rem; }

.mission-exit-btn {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    padding: 7px 16px;
    border-radius: 24px;
    font-family: var(--font-main);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    cursor: pointer;
    transition: 0.2s;
}
.mission-exit-btn:hover {
    background: rgba(239, 68, 68, 0.25);
    color: #fff;
}

/* Mission summary modal */
.overlay.mission-summary .modal-content {
    max-width: 620px;
    padding: 50px;
    text-align: center;
}
.summary-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
}
.summary-trophy { font-size: 4.5rem; line-height: 1; }
.summary-inner h2 {
    font-family: var(--font-display);
    font-size: 2.4rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}
.summary-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    width: 100%;
    margin-top: 8px;
}
.summary-stat {
    padding: 16px 12px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}
.summary-val {
    font-family: var(--font-display);
    font-size: 1.7rem;
    font-weight: 700;
    color: var(--accent-gold);
    line-height: 1;
}
.summary-lbl {
    font-size: 0.55rem;
    font-weight: 800;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--text-muted);
}
.summary-detail {
    width: 100%;
    max-height: 220px;
    overflow-y: auto;
    padding: 8px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.summary-row {
    display: grid;
    grid-template-columns: 36px 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 8px 14px;
    font-size: 0.88rem;
    border-radius: 6px;
}
.summary-row:hover { background: rgba(255, 255, 255, 0.03); }
.summary-row-num { color: var(--text-muted); font-weight: 700; }
.summary-row-name { color: var(--text-primary); font-weight: 600; }
.summary-row-tries {
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.summary-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 4px;
}

/* When mission HUD is shown, dim the original status display rather than removing entirely */
#status-display.hidden { display: none; }

/* ===========================================================
   ATLAS DATA TABLE — overlay showing every country + soft-data coverage
   =========================================================== */
.overlay.atlas-data .modal-content.atlas-data-modal {
    max-width: 1400px;
    width: 96vw;
    max-height: 90vh;
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.atlas-data-header {
    padding: 32px 40px 20px;
    border-bottom: 1px solid var(--glass-border);
    flex-shrink: 0;
}
.atlas-data-header h2 {
    font-family: var(--font-display);
    font-size: 1.8rem;
    margin-top: 8px;
}
.atlas-stats {
    display: flex;
    gap: 18px;
    margin-top: 14px;
    flex-wrap: wrap;
}
.atlas-stats .stat {
    font-size: 0.78rem;
    color: var(--text-muted);
}
.atlas-stats .stat strong {
    font-family: var(--font-display);
    font-size: 1.2rem;
    color: var(--accent-gold);
    margin-right: 6px;
}
.atlas-filters {
    display: flex;
    gap: 14px;
    margin-top: 16px;
    align-items: center;
    flex-wrap: wrap;
}
.atlas-filters input[type="text"],
.atlas-filters select {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 0.8rem;
    padding: 8px 14px;
    border-radius: 22px;
    outline: none;
    transition: 0.2s;
}
.atlas-filters input[type="text"] {
    min-width: 260px;
}
.atlas-filters input[type="text"]:focus,
.atlas-filters select:focus {
    border-color: var(--primary-blue);
    background: rgba(59, 130, 246, 0.08);
}
.atlas-filters .filter-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
    color: var(--text-muted);
    cursor: pointer;
}
.atlas-filters .filter-toggle input { accent-color: var(--accent-gold); }

.atlas-table-wrap {
    overflow: auto;
    flex: 1;
    min-height: 0;
}
#atlas-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
}
#atlas-table thead th {
    position: sticky;
    top: 0;
    background: var(--bg-dark);
    text-align: left;
    padding: 10px 12px;
    font-size: 0.6rem;
    font-weight: 800;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--text-muted);
    border-bottom: 1px solid var(--glass-border);
    z-index: 2;
}
#atlas-table tbody td {
    padding: 8px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    vertical-align: middle;
    color: var(--text-primary);
}
#atlas-table tbody tr:hover td { background: rgba(59, 130, 246, 0.05); }
#atlas-table .lvl {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.78rem;
    width: 36px;
    text-align: center;
}
#atlas-table .iso {
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
    font-size: 0.72rem;
    color: var(--text-muted);
    width: 44px;
}
#atlas-table .name { font-weight: 600; min-width: 160px; }
#atlas-table .missing {
    color: rgba(239, 68, 68, 0.55);
    font-style: italic;
}
#atlas-table tr.level-1 .lvl { color: #4ade80; }
#atlas-table tr.level-2 .lvl { color: #60a5fa; }
#atlas-table tr.level-3 .lvl { color: #a78bfa; }
#atlas-table tr.level-4 .lvl { color: var(--text-muted); }

/* ===========================================================
   ROADMAP — overlay listing all ideas, status-tagged
   =========================================================== */
.overlay.roadmap .modal-content.roadmap-modal {
    max-width: 920px;
    max-height: 88vh;
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.roadmap-header {
    padding: 40px 50px 28px;
    border-bottom: 1px solid var(--glass-border);
    flex-shrink: 0;
}
.roadmap-header h2 {
    font-family: var(--font-display);
    font-size: 1.9rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    margin-top: 8px;
}
.roadmap-sub {
    margin-top: 10px;
    font-size: 0.85rem;
    color: var(--text-muted);
}
.roadmap-body {
    padding: 24px 50px 50px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}
/* Latest-update callout at the top of the roadmap body */
.roadmap-update {
    margin-bottom: 32px;
    padding: 20px 24px;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.12), rgba(245, 158, 11, 0.04));
    border: 1px solid rgba(245, 158, 11, 0.35);
    border-radius: 14px;
    color: var(--text-primary);
}
.roadmap-update .update-tag {
    display: inline-block;
    margin-bottom: 8px;
    font-size: 0.6rem;
    font-weight: 800;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--accent-gold);
}
.roadmap-update p {
    font-size: 0.9rem;
    line-height: 1.55;
    color: var(--text-primary);
}
.roadmap-update strong { color: var(--accent-gold); }

/* "Needs testing" inline badge — pin it next to an item's title */
.item-badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin-left: 6px;
    vertical-align: middle;
}
.item-badge.needs-testing {
    background: rgba(245, 158, 11, 0.18);
    border: 1px solid rgba(245, 158, 11, 0.45);
    color: var(--accent-gold);
}

.roadmap-section { margin-bottom: 32px; }
.roadmap-section:last-child { margin-bottom: 0; }
.roadmap-section h3 {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 4px;
    text-transform: uppercase;
    color: var(--text-primary);
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--glass-border);
}
.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 12px currentColor;
    display: inline-block;
}
.status-built     h3 { color: #22c55e; }
.status-next      h3 { color: var(--accent-gold); }
.status-ideated   h3 { color: var(--primary-blue); }
.status-curriculum h3 { color: #a78bfa; }
.status-print     h3 { color: #38bdf8; }
.status-polish    h3 { color: var(--text-muted); }

.roadmap-section ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.roadmap-section ul li {
    position: relative;
    padding-left: 22px;
    font-size: 0.9rem;
    line-height: 1.55;
    color: var(--text-primary);
}
.roadmap-section ul li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 9px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.25);
}
.status-built ul li::before     { background: #22c55e; }
.status-next ul li::before      { background: var(--accent-gold); }
.status-ideated ul li::before   { background: var(--primary-blue); }
.status-curriculum ul li::before { background: #a78bfa; }
.status-print ul li::before     { background: #38bdf8; }
.status-polish ul li::before    { background: rgba(148, 163, 184, 0.5); }

.roadmap-section ul li strong {
    color: var(--text-primary);
    font-weight: 700;
}
.roadmap-section ul.sub-list {
    margin-top: 8px;
    margin-left: 4px;
    gap: 6px;
}
.roadmap-section ul.sub-list li {
    font-size: 0.85rem;
    color: var(--text-muted);
}
.roadmap-section ul.sub-list li::before {
    width: 5px;
    height: 5px;
    top: 11px;
    background: rgba(148, 163, 184, 0.6);
}
.roadmap-section ul li em {
    color: var(--accent-gold);
    font-style: normal;
    font-weight: 600;
}
.roadmap-section ul li code {
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
    font-size: 0.82rem;
    color: var(--primary-blue);
    background: rgba(59, 130, 246, 0.1);
    padding: 1px 6px;
    border-radius: 4px;
}

/* ===========================================================
   GEOCODE — side panel, clue cards, breadcrumbs, distance toast
   =========================================================== */
#geocode-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 360px;
    background: linear-gradient(180deg, rgba(10, 12, 16, 0.95), rgba(15, 23, 42, 0.95));
    backdrop-filter: blur(16px);
    border-left: 1px solid var(--glass-border);
    box-shadow: -20px 0 60px rgba(0, 0, 0, 0.4);
    transform: translateX(100%);
    transition: transform 0.4s var(--transition);
    z-index: 200;
    display: grid;
    grid-template-rows: auto auto auto 1fr auto;
    overflow: hidden;
}

#geocode-panel .gc-header,
#geocode-panel .gc-stats,
#geocode-panel .gc-footer { flex-shrink: 0; }

#geocode-panel .gc-scroll {
    overflow-y: auto;
    min-height: 0;
}

#geocode-panel.open { transform: translateX(0); }

.gc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 24px 16px;
    border-bottom: 1px solid var(--glass-border);
}

.gc-title { display: flex; align-items: center; gap: 14px; }
.gc-eye { font-size: 2rem; }
.gc-title h2 {
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: 4px;
    color: var(--text-primary);
    line-height: 1;
}
.gc-sub {
    font-size: 0.6rem;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--primary-blue);
    opacity: 0.85;
}

#geocode-exit {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 2rem;
    font-weight: 200;
    line-height: 1;
    cursor: pointer;
    transition: 0.2s;
}
#geocode-exit:hover { color: var(--text-primary); }

.gc-tier {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-bottom: 1px solid var(--glass-border);
    flex-wrap: wrap;
}
.gc-tier-label {
    font-size: 0.55rem;
    font-weight: 800;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--text-muted);
}
.gc-tier-chips { display: flex; gap: 4px; }
.gc-tier-chip {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    padding: 4px 10px;
    border-radius: 14px;
    font-family: var(--font-display);
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
    transition: 0.2s var(--transition);
}
.gc-tier-chip:hover:not(.active) {
    background: rgba(245, 158, 11, 0.12);
    border-color: var(--accent-gold);
}
.gc-tier-chip.active {
    background: var(--accent-gold);
    border-color: var(--accent-gold);
    color: var(--bg-dark);
}
.gc-tier-hint {
    font-size: 0.58rem;
    color: var(--text-muted);
    margin-left: auto;
    font-style: italic;
    opacity: 0.7;
}

.gc-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 16px 24px;
    border-bottom: 1px solid var(--glass-border);
}
.gc-stat {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 12px 14px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
}
.gc-stat-val {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1;
    color: var(--accent-gold);
}
.gc-stat-lbl {
    font-size: 0.55rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-top: 6px;
}

.gc-section {
    padding: 16px 24px;
    border-bottom: 1px solid var(--glass-border);
}

.gc-section-title {
    font-size: 0.6rem;
    font-weight: 800;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.hint-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.hint-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}
.hint-chip:hover:not(:disabled) {
    background: rgba(59, 130, 246, 0.15);
    border-color: var(--primary-blue);
    transform: translateY(-1px);
}
.hint-chip .chip-icon { font-size: 0.95rem; }
.hint-chip.used {
    background: rgba(16, 185, 129, 0.12);
    border-color: rgba(16, 185, 129, 0.4);
    color: var(--accent-emerald);
    opacity: 0.85;
}
.hint-chip.disabled { opacity: 0.3; cursor: not-allowed; }

.clue-list, .guess-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.clue-card {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    background: rgba(59, 130, 246, 0.08);
    border-left: 3px solid var(--primary-blue);
    border-radius: 8px;
    animation: clue-in 0.3s var(--transition);
}
.clue-card.no-data {
    background: rgba(148, 163, 184, 0.08);
    border-left-color: rgba(148, 163, 184, 0.5);
    opacity: 0.85;
}
.clue-card.no-data .clue-text { color: var(--text-muted); font-style: italic; }
.clue-icon { font-size: 1.1rem; line-height: 1.2; }
.clue-body { display: flex; flex-direction: column; gap: 2px; }
.clue-cat {
    font-size: 0.55rem;
    font-weight: 800;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--text-muted);
}
.clue-text { font-size: 0.85rem; color: var(--text-primary); line-height: 1.4; }

@keyframes clue-in {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.guess-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--glass-bg);
    border-left: 3px solid var(--text-muted);
    border-radius: 8px;
    font-size: 0.85rem;
}
.guess-emoji { font-size: 1.1rem; }
.guess-name { color: var(--text-primary); font-weight: 600; }
.guess-dist { color: var(--text-muted); font-size: 0.75rem; font-weight: 600; }

.guess-row.burning { border-left-color: #ef4444; }
.guess-row.warm    { border-left-color: var(--accent-gold); }
.guess-row.cool    { border-left-color: #38bdf8; }
.guess-row.cold    { border-left-color: #475569; }

.gc-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--glass-border);
    display: flex;
    gap: 8px;
}

.gc-btn-secondary {
    flex: 1;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    padding: 10px;
    border-radius: 24px;
    font-family: var(--font-main);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    cursor: pointer;
    transition: 0.2s;
}
.gc-btn-secondary:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: #ef4444;
    color: #ef4444;
}

/* Distance toast — floats over the map */
.distance-toast {
    position: fixed;
    top: 110px;
    left: 50%;
    transform: translate(-50%, -10px);
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 22px;
    background: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 50px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    color: var(--text-primary);
    opacity: 0;
    pointer-events: none;
    transition: 0.3s var(--transition);
    z-index: 150;
}
.distance-toast.visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

/* Recenter toast over the visible map area when the panel is open */
#app:has(#geocode-panel.open) .distance-toast { left: calc(50% - 180px); }
.toast-emoji { font-size: 1.6rem; }
.toast-text { display: flex; flex-direction: column; line-height: 1.1; }
.toast-label {
    font-size: 0.85rem;
    font-weight: 800;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}
.toast-sub {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 3px;
}
.distance-toast.burning { border-color: #ef4444; }
.distance-toast.burning .toast-label { color: #fca5a5; }
.distance-toast.warm    { border-color: var(--accent-gold); }
.distance-toast.warm .toast-label { color: var(--accent-gold); }
.distance-toast.cool    { border-color: #38bdf8; }
.distance-toast.cool .toast-label { color: #38bdf8; }
.distance-toast.cold    { border-color: #475569; }
.distance-toast.cold .toast-label { color: #94a3b8; }

/* Map breadcrumb markers (SVG) */
.breadcrumb-dot {
    stroke: rgba(255, 255, 255, 0.9);
    stroke-width: 8;
    opacity: 0.85;
}
.breadcrumb-dot.burning { fill: #ef4444; }
.breadcrumb-dot.warm    { fill: var(--accent-gold); }
.breadcrumb-dot.cool    { fill: #38bdf8; }
.breadcrumb-dot.cold    { fill: #475569; }

.breadcrumb-label {
    font-size: 120px;
    font-weight: 800;
    fill: #fff;
    paint-order: stroke;
    stroke: rgba(0, 0, 0, 0.7);
    stroke-width: 6;
    pointer-events: none;
}

/* Geocode result modal */
.overlay.geocode-result .modal-content { max-width: 560px; padding: 50px; text-align: center; }
.result-inner { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.result-flag { font-size: 5rem; line-height: 1; }
.result-name {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--accent-gold);
    margin-top: -4px;
}
.result-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}
.result-fact {
    font-size: 0.95rem;
    color: var(--text-primary);
    line-height: 1.5;
    max-width: 400px;
}
.result-stats {
    font-size: 0.7rem;
    color: var(--text-muted);
    letter-spacing: 2px;
    text-transform: uppercase;
}
#geocode-result-title {
    font-family: var(--font-display);
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

/* When the geocode panel is open, give the map room to breathe */
@media (min-width: 900px) {
    #app:has(#geocode-panel.open) #globe-container { padding-right: 380px; }
}
