/* ================================================================
   GeoTraceroute — Modern Globe CSS
   ================================================================ */

:root {
    --bg:           #00000e;
    --glass:        rgba(6, 9, 24, 0.75);
    --glass-heavy:  rgba(4, 6, 18, 0.75);
    --glass-light:  rgba(255, 255, 255, 0.055);
    --border:       rgba(255, 255, 255, 0.09);
    --text:         #dde3f0;
    --text-muted:   rgba(200, 212, 235, 0.58);
    --text-dim:     rgba(200, 212, 235, 0.32);
    --accent:       #4fc3f7;
    --hop-normal:   #b0bec5;
    --hop-dest:     #66bb6a;
    --hop-error:    #ef5350;
    --topbar-h:     48px;
    --sidebar-w:    280px;
    --r:            10px;
    --ease:         180ms ease;
    --font:         'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --mono:         'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
}

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

html, body {
    height: 100%; width: 100%;
    overflow: hidden;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.5;
}

a { color: #5ba3e8; text-decoration: none; }
a:hover { color: #a8d4f8; text-decoration: none; }
button { font-family: var(--font); }

/* ── Loader ─────────────────────────────────────────────────────── */
#loadpage {
    position: fixed; inset: 0;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9000;
}

.loader-inner {
    display: flex;
    align-items: center;
    gap: 28px;
    max-width: 480px;
    padding: 0 20px;
}

.loader-spinner {
    flex-shrink: 0;
    width: 52px; height: 52px;
    border-radius: 50%;
    border: 3px solid rgba(79, 195, 247, 0.18);
    border-top-color: var(--accent);
    animation: gt-spin 0.85s linear infinite;
}

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

.loader-text h2 {
    font-size: 18px; font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
}
.loader-text p {
    color: var(--text-muted);
    font-size: 13px;
    margin: 2px 0;
}
.loader-text .hint {
    color: var(--text-dim);
    font-style: italic;
    font-size: 12px;
    margin-top: 6px;
}

/* ── Main shell ─────────────────────────────────────────────────── */
#main { position: fixed; inset: 0; }

#container {
    position: absolute; inset: 0;
    background: radial-gradient(ellipse at calc(50% + var(--sidebar-w) / 2) 50%, #090f2e 0%, #00000a 68%);
    cursor: grab;
    overflow: hidden;
}
#container::before {
    content: '';
    position: absolute; inset: 0;
    pointer-events: none;
    z-index: 0;
}
#stars-canvas {
    position: absolute !important;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
    z-index: 0;
    pointer-events: none;
}
/* Keep canvas at its natural renderer size, shift it right so globe
   appears centred in the visible area (right of sidebar) */
#container canvas:not(#stars-canvas) {
    display: block;
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    transform: translateX(calc(var(--sidebar-w) / 2));
    transition: transform 0.3s ease;
}
body.sidebar-collapsed #container canvas:not(#stars-canvas) {
    transform: translateX(0);
}

/* ── Top nav bar ────────────────────────────────────────────────── */
#topbar {
    position: absolute;
    top: 0; left: 0; right: 0;
    height: var(--topbar-h);
    background: var(--glass-heavy);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 14px;
    gap: 10px;
    z-index: 100;
}

.topbar-brand {
    display: flex;
    align-items: baseline;
    gap: 6px;
    white-space: nowrap;
    flex-shrink: 0;
}
.topbar-brand a {
    font-weight: 700;
    font-size: 15px;
    color: var(--text);
    letter-spacing: -0.01em;
}
.topbar-brand a:hover { text-decoration: none; color: var(--accent); }
.topbar-brand a:visited { color: var(--text); }
.topbar-brand a:active  { color: var(--text); }
.topbar-version {
    font-size: 11px;
    color: var(--text-dim);
}

.topbar-spacer { flex: 1; }

.topbar-nav {
    display: flex;
    align-items: center;
    gap: 0;
}
.topbar-nav a {
    color: var(--text-muted);
    font-size: 13px;
    padding: 5px 10px;
    border-radius: 6px;
    white-space: nowrap;
    transition: color var(--ease), background var(--ease);
}
.topbar-nav a:hover {
    color: var(--text);
    background: var(--glass-light);
    text-decoration: none;
}
.topbar-sep {
    width: 1px; height: 14px;
    background: var(--border);
    margin: 0 2px;
    flex-shrink: 0;
}

.sidebar-toggle {
    display: none;
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 16px;
    line-height: 1;
    transition: color var(--ease);
}
.sidebar-toggle:hover { color: var(--text); }

/* ── Sidebar ────────────────────────────────────────────────────── */
#sidebar {
    position: absolute;
    top: var(--topbar-h);
    left: 0;
    width: var(--sidebar-w);
    bottom: 0;
    overflow-y: auto;
    background: var(--glass);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-right: 1px solid rgba(79, 195, 247, 0.28);
    box-shadow: 2px 0 32px rgba(0,0,0,0.5), 6px 0 40px rgba(79,195,247,0.22);
    padding: 16px 14px 28px;
    z-index: 50;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.12) transparent;
    transition: transform var(--ease);
}
#sidebar::-webkit-scrollbar { width: 5px; }
#sidebar::-webkit-scrollbar-track { background: transparent; }
#sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.14); border-radius: 9px; }
#sidebar.collapsed { transform: translateX(-100%); }

/* ── Sidebar collapse tab ───────────────────────────────────────── */
#sidebar-tab {
    position: absolute;
    top: 50%;
    left: var(--sidebar-w);
    transform: translateY(-50%);
    z-index: 51;
    background: var(--glass);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid rgba(79, 195, 247, 0.28);
    border-left: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 10px 5px;
    border-radius: 0 6px 6px 0;
    font-size: 18px;
    line-height: 1;
    transition: left var(--ease), color var(--ease);
}
#sidebar-tab:hover { color: var(--text); }
#sidebar.collapsed + #sidebar-tab { left: 0; }
.sidebar-tab-icon {
    display: inline-block;
    transition: transform var(--ease);
}
#sidebar.collapsed + #sidebar-tab .sidebar-tab-icon { transform: rotate(180deg); }

/* ── Route header ───────────────────────────────────────────────── */
.route-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 12px;
}
.route-header .dest-flag {
    height: 32px;
    border-radius: 3px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.5);
    flex-shrink: 0;
}
.route-header .dest-host {
    font-size: 15px;
    font-weight: 600;
    word-break: break-all;
    line-height: 1.3;
}

/* ── Hop list ───────────────────────────────────────────────────── */
.hops-list {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.hop-item {
    display: flex;
    align-items: flex-start;
    gap: 7px;
    padding: 5px 5px;
    border-radius: 7px;
    transition: background var(--ease), opacity 0.4s ease, transform 0.4s ease;
    opacity: 0;
    transform: translateX(-12px);
}
.hop-item.hop-revealed {
    opacity: 1;
    transform: none;
}
.hop-item:hover { background: var(--glass-light); }

/* ── hop-slider bar ──────────────────────────────────────── */
#hop-slider-bar {
    position: fixed;
    bottom: 0;
    left: var(--sidebar-w);
    right: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 28px 12px;
    background: linear-gradient(to top, rgba(0,0,10,0.82) 0%, transparent 100%);
    backdrop-filter: blur(6px);
    pointer-events: auto;
}
#hop-chip {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px 5px 9px;
    background: rgba(10,20,40,0.92);
    border: 1px solid rgba(79,195,247,0.4);
    border-radius: 20px;
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 16px rgba(0,0,0,0.5);
    font-size: 12px;
    color: #e0f7fa;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.25s ease, transform 0.25s ease;
}
#hop-chip.chip-visible {
    opacity: 1;
    transform: none;
}
#hop-chip img {
    width: 18px;
    height: 12px;
    object-fit: cover;
    border-radius: 2px;
    flex-shrink: 0;
}
.chip-num     { color: var(--accent); font-weight: 700; font-size: 11px; }
.chip-city    { font-weight: 600; color: #fff; }
.chip-country { color: var(--text-dim); font-size: 11px; }
#hop-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    border-radius: 2px;
    background: rgba(79,195,247,0.18);
    outline: none;
    cursor: pointer;
    accent-color: var(--accent);
}
#hop-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 8px rgba(79,195,247,0.7);
    cursor: pointer;
}
#hop-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 8px rgba(79,195,247,0.7);
    border: none;
    cursor: pointer;
}
#hop-animate-btn {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid rgba(79,195,247,0.4);
    background: rgba(79,195,247,0.12);
    color: var(--accent);
    font-size: 11px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, box-shadow 0.2s;
    padding: 0;
}
#hop-animate-btn:hover {
    background: rgba(79,195,247,0.25);
    box-shadow: 0 0 10px rgba(79,195,247,0.4);
}
#hop-animate-btn.anim-playing {
    background: rgba(79,195,247,0.3);
    box-shadow: 0 0 12px rgba(79,195,247,0.6);
}

/* ── hop toast (removed, kept for reference) ─────────────── */

.hop-num {
    font-size: 11px;
    color: var(--text-muted);
    min-width: 22px;
    text-align: right;
    padding-top: 3px;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}
.hop-item.hop-is-dest .hop-num { color: var(--hop-dest); }

.hop-flag {
    height: 15px;
    border-radius: 2px;
    margin-top: 3px;
    flex-shrink: 0;
    box-shadow: 0 1px 4px rgba(0,0,0,0.4);
}

.hop-right { flex: 1; min-width: 0; }

.hop-label {
    background: none;
    border: none;
    padding: 0;
    color: var(--text);
    cursor: pointer;
    font-size: 13px;
    text-align: left;
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 3px;
    transition: color var(--ease);
}
.hop-label:hover { color: var(--accent); }
.hop-item.hop-is-dest .hop-label { color: var(--hop-dest); }
.hop-item.hop-is-dest .hop-label:hover { color: #81c784; }

.hop-country { font-weight: 600; }
.hop-city    { color: var(--text-muted); }
.hop-dist    { color: var(--text-dim); font-size: 11px; }
.hop-dist-row { padding: 2px 0 4px; border-bottom: 1px solid rgba(255,255,255,0.06); margin-bottom: 3px; }
.hop-rtt     { margin-left: auto; color: #66bb6a; font-size: 11px; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* IP detail rows */
.hop-ips {
    display: none;
    flex-direction: column;
    gap: 0;
    margin-top: 4px;
    padding-left: 1px;
}
.hop-ips.open { display: flex; }

.hop-ip {
    font-family: var(--mono);
    font-size: 11.5px;
    color: var(--hop-normal);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    gap: 5px;
    align-items: center;
    padding: 1px 0;
}
.hop-ip.ip-dest  { color: var(--hop-dest); }
.hop-ip.ip-error { color: var(--hop-error); }

.ip-as { opacity: 0.65; font-size: 10.5px; }
.ip-ms { opacity: 0.7;  font-size: 10.5px; }

/* ── Route stats ────────────────────────────────────────────────── */
.route-stats {
    margin-top: 14px;
    padding: 12px 8px;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 12px;
    color: var(--text-muted);
}
.route-stats .stat-val { color: var(--text); }

/* ── Sidebar actions ────────────────────────────────────────────── */
.sidebar-actions {
    margin-top: 14px;
    padding: 0 2px;
}
.btn-run {
    display: block;
    width: 100%;
    padding: 9px 14px;
    background: linear-gradient(135deg, #1565c0 0%, #0d47a1 100%);
    color: #d6eaff;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    letter-spacing: 0.01em;
    box-shadow: 0 2px 10px rgba(21,101,192,0.4);
    transition: opacity var(--ease);
}
.btn-run:hover {
    opacity: 0.88;
    text-decoration: none;
    color: #d6eaff;
}
.btn-map-removed { display: none; } /* legacy placeholder */
.btn-map:hover {
    background: rgba(79, 195, 247, 0.10);
    border-color: rgba(79, 195, 247, 0.75);
    color: #fff;
    text-decoration: none;
}

/* ── View-switcher pill toggle ──────────────────────────────────── */
#view-switcher {
    position: fixed;
    top: calc(var(--topbar-h) + 12px);
    left: calc(var(--sidebar-w) + 12px);
    z-index: 20;
    display: flex;
    flex-direction: row;
    gap: 0;
    padding: 3px;
    border-radius: 11px;
    background: rgba(15, 22, 40, 0.85);
    border: 1px solid rgba(79,195,247,0.22);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 10px rgba(0,0,0,0.55), 0 0 8px rgba(79,195,247,0.08);
    transition: left var(--ease);
}
#view-switcher.sidebar-collapsed { left: 12px; }

.vs-pill {
    padding: 4px 14px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: rgba(180,196,220,0.55);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.06em;
    cursor: pointer;
    transition: background 180ms ease, color 180ms ease, box-shadow 180ms ease;
    outline: none;
    user-select: none;
}
.vs-pill:hover {
    color: rgba(180,196,220,0.85);
    background: rgba(79,195,247,0.07);
}
.vs-pill.vs-active {
    background: rgba(79,195,247,0.15);
    color: #4fc3f7;
    box-shadow: 0 0 8px rgba(79,195,247,0.35), 0 0 2px rgba(79,195,247,0.6);
    cursor: default;
}
.vs-pill.vs-active:hover {
    background: rgba(79,195,247,0.15);
    color: #4fc3f7;
}

/* ── Recent searches ────────────────────────────────────────────── */
.recent-searches {
    margin-top: 18px;
    padding: 0 2px;
    font-size: 12px;
}
.recent-title {
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--text-dim);
    margin-bottom: 8px;
}

/* ── Globe tooltip ──────────────────────────────────────────────── */
#sidebar-tooltip {
    position: fixed;
    pointer-events: none;
    z-index: 9500;
    background: rgba(4, 6, 18, 0.75);
    border: 1px solid rgba(79, 195, 247, 0.35);
    border-radius: 6px;
    padding: 5px 10px;
    font-size: 12px;
    color: var(--text);
    white-space: nowrap;
    display: none;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.6);
}

#globe-tooltip {
    position: absolute;
    pointer-events: none;
    z-index: 250;
    background: rgba(4, 6, 18, 0.75);
    border: 1px solid rgba(79, 195, 247, 0.35);
    border-radius: 6px;
    padding: 5px 10px;
    font-size: 12px;
    color: rgba(200, 212, 235, 0.75);
    white-space: nowrap;
    display: none;
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.6);
    transform: translate(12px, -50%);
    align-items: center;
    gap: 7px;
}
#globe-tooltip img {
    width: 18px;
    height: 12px;
    object-fit: cover;
    border-radius: 2px;
    flex-shrink: 0;
}

/* ── Warning toast ──────────────────────────────────────────────── */
#warn {
    position: absolute;
    top: calc(var(--topbar-h) + 14px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--glass-heavy);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 167, 38, 0.35);
    border-radius: var(--r);
    padding: 12px 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    z-index: 200;
    min-width: 220px;
    max-width: 360px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.6);
}
.warn-row { display: flex; align-items: center; gap: 10px; }
.warn-msg  { color: #ffa726; font-size: 13px; }
.warn-hint { font-size: 11px; color: var(--text-dim); font-style: italic; }

/* ── Modal panels ───────────────────────────────────────────────── */
.panel {
    position: absolute;
    top: calc(var(--topbar-h) + 16px);
    left: calc(var(--sidebar-w) + (100vw - var(--sidebar-w)) / 2);
    transform: translateX(-50%);
    min-width: 280px;
    max-width: min(560px, calc(100vw - 32px));
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    background: var(--glass-heavy);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(79, 195, 247, 0.30);
    border-radius: var(--r);
    padding: 20px;
    z-index: 300;
    box-shadow: 0 12px 48px rgba(0,0,0,0.72), 0 0 0 1px rgba(79,195,247,0.08),
                0 0 18px rgba(79,195,247,0.30), 0 0 48px rgba(79,195,247,0.12);
    display: none;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.12) transparent;
}

/* ── Methodology panel — wider ───────────────────────────────────── */
#methodo.panel {
    max-width: min(900px, calc(100vw - var(--sidebar-w) - 48px));
    width: calc(100vw - var(--sidebar-w) - 48px);
}
/* ── Prefs panel — taller ────────────────────────────────────────── */
#prefs.panel {
    height: 600px;
    max-height: calc(100vh - 100px);
    width: min(450px, calc((100vw - var(--sidebar-w)) * 0.9));
    max-width: min(450px, calc((100vw - var(--sidebar-w)) * 0.9));
    display: none;
    flex-direction: column;
}
#prefs.panel.open { display: flex; }
#prefs.panel > form { flex: 1; overflow-y: auto; overflow-x: hidden; min-height: 0; }
.panel.open  { display: block; }
.panel.open + .panel-backdrop { display: block; }

.panel-backdrop {
    position: absolute; inset: 0;
    background: rgba(0,0,0,0.3);
    z-index: 290;
    display: none;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}
.panel-header h3 {
    font-size: 15px; font-weight: 600;
    color: var(--text);
}
.panel-close {
    background: none;
    border: none;
    color: var(--accent);
    cursor: pointer;
    font-size: 17px;
    padding: 2px 6px;
    border-radius: 5px;
    line-height: 1;
    transition: color var(--ease), background var(--ease);
}
.panel-close:hover { color: #fff; background: rgba(79,195,247,0.15); }

/* panel content theming */
.panel table { border-spacing: 0; color: var(--text); }
.panel td { padding: 5px 8px; vertical-align: middle; }
.panel img { border-radius: 3px; }
.panel ul {
    padding-left: 1.4em;
    display: flex;
    flex-direction: column;
    gap: 8px;
    color: var(--text-muted);
    font-size: 13.5px;
    line-height: 1.5;
}
.panel ul li { padding-left: 4px; }
.panel b, .panel strong { color: var(--text); }
.panel-list {
    list-style: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.panel-list li {
    display: flex;
    align-items: baseline;
    gap: 8px;
    font-size: 13.5px;
    color: var(--text-muted);
    line-height: 1.5;
}
.panel-list li::before {
    content: '•';
    color: var(--text-muted);
    flex-shrink: 0;
}
.panel-list a { font-weight: 500; }
.panel-note {
    margin-top: 14px;
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.6;
}
.panel-label {
    color: var(--text-dim);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
}
.panel select {
    background: rgba(15, 22, 40, 0.85);
    border: 1px solid rgba(79, 195, 247, 0.22);
    border-radius: 7px;
    color: var(--text);
    padding: 7px 32px 7px 11px;
    font-size: 13px;
    font-family: var(--font);
    cursor: pointer;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    /* custom chevron arrow */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%234fc3f7' stroke-width='1.6' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.04);
    transition: border-color 0.18s, box-shadow 0.18s;
    min-width: 160px;
    color-scheme: dark;
    accent-color: #0d1f3c;
}
.panel select:hover {
    border-color: rgba(79, 195, 247, 0.50);
    box-shadow: 0 2px 12px rgba(79,195,247,0.12), inset 0 1px 0 rgba(255,255,255,0.04);
}
.panel select:focus {
    border-color: rgba(79, 195, 247, 0.75);
    box-shadow: 0 0 0 3px rgba(79,195,247,0.15), 0 2px 8px rgba(0,0,0,0.35);
}
.panel select option {
    background: #0d1526;
    color: var(--text);
}
/* ── Prefs panel custom combo boxes ─────────────────────────────── */
.pf-field {
    margin-bottom: 14px;
}
.pf-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: rgba(200,212,235,0.5);
    margin-bottom: 5px;
}
/* Wrapper — position:relative so dropdown can be absolute */
.pf-combo {
    position: relative;
}
/* The visible trigger button */
.pf-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 11px;
    background: rgba(15,22,40,0.85);
    border: 1px solid rgba(79,195,247,0.22);
    border-radius: 7px;
    cursor: pointer;
    font-size: 13px;
    color: #dde3f0;
    user-select: none;
    transition: border-color 150ms ease, box-shadow 150ms ease;
}
.pf-trigger:hover,
.pf-combo.open .pf-trigger {
    border-color: rgba(79,195,247,0.55);
    box-shadow: 0 0 0 3px rgba(79,195,247,0.10);
}
.pf-trigger-val {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pf-chevron {
    color: rgba(79,195,247,0.55);
    font-size: 30px;
    transition: transform 180ms ease;
    flex-shrink: 0;
}
.pf-combo.open .pf-chevron { transform: rotate(180deg); }
/* Floating dropdown */
.pf-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 9999;
    background: rgba(6,10,24,0.97);
    border: 1px solid rgba(79,195,247,0.25);
    border-radius: 8px;
    padding: 4px;
    max-height: 220px;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0,0,0,0.7), 0 0 0 1px rgba(79,195,247,0.08);
    scrollbar-width: thin;
    scrollbar-color: rgba(79,195,247,0.2) transparent;
}
.pf-dropdown::-webkit-scrollbar { width: 4px; }
.pf-dropdown::-webkit-scrollbar-thumb { background: rgba(79,195,247,0.2); border-radius: 4px; }
.pf-combo.open .pf-dropdown { display: flex; flex-direction: column; gap: 2px; }

/* ── Geek-mode glow toggle ───────────────────────────────────────── */
.pf-toggle-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    background: rgba(15,22,40,0.6);
    border: 1px solid rgba(79,195,247,0.14);
    border-radius: 10px;
    cursor: pointer;
    user-select: none;
    transition: border-color 150ms ease, background 150ms ease;
}
.pf-toggle-card:hover {
    border-color: rgba(79,195,247,0.30);
    background: rgba(79,195,247,0.05);
}
.pf-toggle-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}
.pf-toggle-title {
    font-size: 14px;
    font-weight: 600;
    color: #dde3f0;
}
.pf-toggle-sub {
    font-size: 12px;
    color: rgba(180,196,220,0.55);
}
.pf-toggle-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}
.pf-toggle-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}
.pf-toggle-track {
    position: relative;
    width: 40px;
    height: 22px;
    border-radius: 11px;
    background: rgba(15,22,40,0.85);
    border: 1px solid rgba(79,195,247,0.22);
    transition: background 200ms ease, border-color 200ms ease, box-shadow 200ms ease;
    flex-shrink: 0;
}
.pf-toggle-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: rgba(79,195,247,0.4);
    transition: transform 200ms ease, background 200ms ease, box-shadow 200ms ease;
}
.pf-toggle-input:checked + .pf-toggle-track {
    background: rgba(79,195,247,0.15);
    border-color: rgba(79,195,247,0.7);
    box-shadow: 0 0 8px rgba(79,195,247,0.35), 0 0 2px rgba(79,195,247,0.6);
}
.pf-toggle-input:checked + .pf-toggle-track .pf-toggle-thumb {
    transform: translateX(18px);
    background: #4fc3f7;
    box-shadow: 0 0 6px rgba(79,195,247,0.9);
}
.pf-toggle-label:hover .pf-toggle-track {
    border-color: rgba(79,195,247,0.45);
    box-shadow: 0 0 0 3px rgba(79,195,247,0.08);
}
.pf-toggle-text {
    font-size: 13px;
    color: #dde3f0;
}
/* ── Prefs footer ────────────────────────────────────────────────── */
.pf-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid rgba(79,195,247,0.10);
}
.pf-footer-hint {
    font-size: 12px;
    color: rgba(180,196,220,0.45);
    font-style: italic;
}
.pf-save-btn {
    padding: 8px 22px;
    background: #1976d2;
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 150ms ease, box-shadow 150ms ease;
    flex-shrink: 0;
}
.pf-save-btn:hover {
    background: #2196f3;
    box-shadow: 0 0 12px rgba(33,150,243,0.45);
}
/* Items */
.pf-opt {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    color: rgba(200,212,235,0.75);
    transition: background 100ms ease, color 100ms ease;
    user-select: none;
    white-space: nowrap;
}
.pf-opt:hover    { background: rgba(79,195,247,0.10); color: #dde3f0; }
.pf-opt.selected { background: rgba(79,195,247,0.18); color: #4fc3f7; font-weight: 600; }
.pf-opt img      { height: 14px; border-radius: 2px; flex-shrink: 0; }

.panel input[type="text"] {
    background: rgba(255,255,255,0.07);
    border: 1px solid var(--border);
    border-radius: 5px;
    color: var(--text);
    padding: 4px 8px;
    font-size: 13px;
}
.panel input[type="submit"],
.panel button[type="submit"] {
    background: #1565c0;
    border: none;
    color: #d6eaff;
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-family: var(--font);
    transition: opacity var(--ease);
}
.panel input[type="submit"]:hover,
.panel button[type="submit"]:hover { opacity: 0.85; }

/* ── Mobile wall ───────────────────────────────────────────────── */
#mobile-wall {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: var(--bg);
    align-items: center;
    justify-content: center;
}
#mobile-wall-inner {
    text-align: center;
    padding: 28px 24px;
    max-width: 320px;
    background: var(--glass-heavy);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(79, 195, 247, 0.30);
    border-radius: var(--r);
    box-shadow: 0 12px 48px rgba(0,0,0,0.72), 0 0 0 1px rgba(79,195,247,0.08),
                0 0 18px rgba(79,195,247,0.30), 0 0 48px rgba(79,195,247,0.12);
}
#mobile-wall-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 12px;
}
#mobile-wall-msg {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.6;
}
@media (max-width: 680px) {
    #mobile-wall { display: flex; }
}

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 680px) {
    :root {
        --sidebar-w: 100vw;
        --topbar-h: 44px;
    }
    /* Allow browser pull-to-refresh (blocked by the global overflow:hidden) */
    html, body {
        overflow-y: auto;
        overscroll-behavior-y: auto;
    }

    /* Hide globe entirely on small screens */
    #container,
    #globe-tooltip {
        display: none !important;
    }

    #sidebar {
        top: var(--topbar-h);
        bottom: 0;
        left: 0; right: 0;
        width: 100%;
        height: calc(100vh - var(--topbar-h));
        border-right: none;
        border-top: none;
        transform: none;
        transition: none;
        overflow-y: auto;
    }
    #sidebar.collapsed {
        transform: none;
    }
    .topbar-nav { display: none; }
    .sidebar-toggle { display: none; }
    #sidebar-tab { display: none; }
    .panel {
        top: var(--topbar-h);
        left: 8px; right: 8px;
        transform: none;
        max-width: 100%;
    }
}
