/* FreedomCore - Dark Theme with Sparkle */

:root {
    /* Base colors */
    --bg-dark: #0a0a0f;
    --bg-darker: #050508;
    --bg-panel: rgba(20, 20, 35, 0.85);
    --bg-panel-hover: rgba(30, 30, 50, 0.9);

    /* Text */
    --text-primary: #e8e8f0;
    --text-secondary: #8888aa;
    --text-muted: #555577;

    /* Sparkle colors */
    --cyan: #00d4ff;
    --cyan-glow: rgba(0, 212, 255, 0.4);
    --purple: #a855f7;
    --purple-glow: rgba(168, 85, 247, 0.4);
    --green: #00ff88;
    --green-glow: rgba(0, 255, 136, 0.4);
    --coral: #ff6b6b;
    --coral-glow: rgba(255, 107, 107, 0.4);
    --gold: #ffd700;
    --gold-glow: rgba(255, 215, 0, 0.4);

    /* Connections */
    --line-default: #2a2a4a;
    --line-active: #4a4a8a;

    /* Sizing */
    --header-height: 64px;
    --side-nav-width: 320px;
    /* Animation */
    --transition-fast: 0.15s ease;
    --transition-medium: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* Links — green on dark backgrounds, globally */
a { color: lightgreen; }
a:visited { color: #66BB6A; }
a:hover { color: #90ee90; }

/* Reset */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    height: 100%;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--bg-dark);
    -webkit-font-smoothing: antialiased;
}

/* Shell layout: left nav + content, sized for desktop monitors. */
.shell {
    height: calc(100vh - var(--header-height));
    margin-top: var(--header-height);
    display: grid;
    grid-template-columns: var(--side-nav-width) 1fr;
}

.docs-body {
    overflow: hidden;
}

/* ═══════════════════════════════════════════════════════════════
   HEADER
   ═══════════════════════════════════════════════════════════════ */

#header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 18px;
    background: linear-gradient(to bottom, rgba(10, 10, 15, 0.95), rgba(10, 10, 15, 0.7));
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.logo-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    filter: drop-shadow(0 0 8px var(--cyan-glow));
}

.logo-text {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 0.5px;
    background: linear-gradient(135deg, var(--cyan), var(--purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-version {
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.12em;
    margin-left: 10px;
    opacity: 0.6;
    -webkit-text-fill-color: rgba(255, 255, 255, 0.6);
    color: rgba(255, 255, 255, 0.6);
}

.header-center {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    padding: 0 20px;
}
.header-center:empty { display: none; }

.nav-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-shrink: 0;
}

/* Legacy ghost buttons (still used in some panels). */
.btn-ghost {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-fast);
    text-decoration: none;
    font-size: 16px;
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

/* Header controls: larger hit targets + more presence. */
.btn-hicon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.10);
    background:
        radial-gradient(circle at 30% 20%, rgba(0, 212, 255, 0.18), transparent 60%),
        radial-gradient(circle at 70% 80%, rgba(168, 85, 247, 0.16), transparent 55%),
        rgba(15, 15, 26, 0.55);
    color: rgba(232, 232, 240, 0.9);
    cursor: pointer;
    transition: var(--transition-fast);
    text-decoration: none;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.btn-hicon:hover {
    transform: translateY(-1px);
    border-color: rgba(0, 212, 255, 0.35);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.42), 0 0 24px rgba(0, 212, 255, 0.12);
}

.btn-cta {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    height: 44px;
    padding: 0 16px 0 14px;
    border-radius: 999px;
    border: 1px solid rgba(0, 212, 255, 0.28);
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.18), rgba(168, 85, 247, 0.14));
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 650;
    letter-spacing: 0.2px;
    transition: var(--transition-fast);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
}

.btn-cta:hover {
    transform: translateY(-1px);
    border-color: rgba(0, 212, 255, 0.5);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45), 0 0 30px rgba(0, 212, 255, 0.16);
}

.btn-cta-icon {
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.10);
    color: var(--cyan);
    text-shadow: 0 0 10px var(--cyan-glow);
}

.btn-cta-label {
    font-size: 15px;
}

/* Primary download CTA (TestFlight) */
.btn-download {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    height: 44px;
    padding: 0 18px 0 14px;
    border-radius: 999px;
    border: 1px solid rgba(0, 212, 255, 0.45);
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.28), rgba(0, 180, 220, 0.18));
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 650;
    letter-spacing: 0.2px;
    transition: var(--transition-fast);
    box-shadow:
        0 10px 28px rgba(0, 0, 0, 0.35),
        0 0 16px rgba(0, 212, 255, 0.12);
}

.btn-download:hover {
    transform: translateY(-1px);
    border-color: rgba(0, 212, 255, 0.7);
    box-shadow:
        0 12px 36px rgba(0, 0, 0, 0.45),
        0 0 30px rgba(0, 212, 255, 0.25);
}

.btn-download-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--cyan);
    filter: drop-shadow(0 0 6px var(--cyan-glow));
}

.btn-download-label {
    font-size: 15px;
}

/* ═══════════════════════════════════════════════════════════════
   LEFT NAV
   ═══════════════════════════════════════════════════════════════ */

.side-nav {
    position: relative;
    overflow: hidden;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    background:
        radial-gradient(circle at 20% 10%, rgba(0, 212, 255, 0.12), transparent 55%),
        radial-gradient(circle at 80% 85%, rgba(168, 85, 247, 0.10), transparent 60%),
        linear-gradient(to bottom, rgba(5, 5, 8, 0.92), rgba(10, 10, 15, 0.86));
    backdrop-filter: blur(12px);
}

.side-nav-inner {
    height: 100%;
    padding: 18px 14px 18px 18px;
    overflow: auto;
}

.side-nav-brand {
    padding: 10px 10px 14px 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    margin-bottom: 16px;
}

.side-nav-brand-title {
    font-size: 18px;
    font-weight: 720;
    letter-spacing: 0.3px;
    color: rgba(232, 232, 240, 0.95);
    text-decoration: none;
    display: inline-flex;
    align-items: baseline;
    gap: 10px;
}

.btn-hicon.is-active {
    border-color: rgba(0, 212, 255, 0.45);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.42), 0 0 32px rgba(0, 212, 255, 0.14);
}

.side-nav-brand-sub {
    font-size: 13px;
    color: var(--text-secondary);
    display: flex;
    gap: 10px;
    align-items: center;
}

/* (side-nav-version removed — no longer shown) */

.side-nav-section {
    margin-top: 14px;
}

.side-nav-section-label {
    font-size: 11px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(232, 232, 240, 0.42);
    margin: 0 0 6px 12px;
    font-weight: 600;
}

/* (side-nav-links removed — replaced by nav-list/nav-item) */

/* Navigation list (grouped links). */
.nav-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item {
    display: block;
    padding: 8px 12px;
    border-radius: 8px;
    color: rgba(232, 232, 240, 0.78);
    text-decoration: none;
    font-size: 14px;
    font-weight: 480;
    transition: var(--transition-fast);
}

.nav-item:hover {
    color: rgba(232, 232, 240, 0.95);
    background: rgba(0, 212, 255, 0.06);
}

.nav-item.is-active {
    color: var(--cyan);
    background: rgba(0, 212, 255, 0.10);
}

.nav-tree-item {
    display: flex;
    flex-direction: column;
}

.nav-children {
    display: none;
    flex-direction: column;
    gap: 1px;
    padding-left: 14px;
    margin: 2px 0 4px;
    border-left: 1px solid rgba(255, 255, 255, 0.08);
}

.nav-children.is-expanded {
    display: flex;
}

.nav-item-child {
    font-size: 13px;
    font-weight: 420;
    padding: 5px 10px;
    color: rgba(232, 232, 240, 0.62);
}

.nav-item-child:hover {
    color: rgba(232, 232, 240, 0.90);
}

.nav-item-child.is-active {
    color: var(--cyan);
    background: rgba(0, 212, 255, 0.08);
}

.nav-item-back {
    margin-top: 4px;
    color: var(--text-secondary);
    font-size: 13px;
}

.nav-item-back::before {
    content: "\2190  ";
}

/* ═══════════════════════════════════════════════════════════════
   MAIN CANVAS AREA
   ═══════════════════════════════════════════════════════════════ */

#main {
    position: relative;
    height: 100%;
    background: var(--bg-darker);
    overflow: hidden;
}

/* Home page uses full-viewport canvas under the header. */
.home-body #main {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    height: auto;
}

/* MapLibre map container - always visible, full size */
#map {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 0;
}

/* Black mask that fades to reveal map */
#map-mask {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
    background: var(--bg-darker);
    transition: opacity 1.5s ease;
}

#map-mask.fade-out {
    opacity: 0;
    pointer-events: none;
}

#canvas {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    cursor: grab;
    z-index: 2;
    pointer-events: none;
    /* Map handles interactions until local view */
}

#canvas.active {
    pointer-events: auto;
    /* background removed - keep canvas transparent so map shows through */
}

#canvas:active {
    cursor: grabbing;
}

/* ═══════════════════════════════════════════════════════════════
   LIGHTHOUSE INTRO
   ═══════════════════════════════════════════════════════════════ */

#lighthouse-intro {
    position: absolute;
    inset: 0;
    z-index: 5;
    pointer-events: none;
    transition: opacity 1s ease;
}

#lighthouse-intro .beam {
    position: fixed;
    inset: 0;
    pointer-events: none;
    --x: 50vw;
    --y: 50vh;
    --rot: 0deg;
    --beam-width: 16deg;
    --beam-length: 140vmax;
    --beam-alpha: 0.18;

    background: conic-gradient(from var(--rot) at var(--x) var(--y),
            rgba(255, 255, 255, 0) 0deg,
            rgba(255, 255, 255, var(--beam-alpha)) 6deg,
            rgba(255, 255, 255, 0) var(--beam-width),
            rgba(255, 255, 255, 0) 360deg);

    mask-image: radial-gradient(circle at var(--x) var(--y),
            black 0,
            black 120px,
            transparent var(--beam-length));

    mix-blend-mode: screen;
}

#lighthouse-intro .lighthouse {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 120px;
    transition: all 1.5s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 11;
}

#lighthouse-intro .lighthouse svg {
    display: block;
    width: 100%;
    height: auto;
}

/* Intro visibility is controlled via opacity by IntroController.show()/hide()
   No display:none — keeps animation state preserved for zoom-based toggle */

/* ═══════════════════════════════════════════════════════════════
   TRUST BEAM RADAR - Incoming Actors
   ═══════════════════════════════════════════════════════════════ */

#actors {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 4;
}

.actor {
    position: absolute;
    width: 32px;
    height: 32px;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: bold;
    font-family: system-ui, sans-serif;
    color: #fbbf24;
    text-shadow: 0 0 12px rgba(251, 191, 36, 0.8), 0 0 4px rgba(251, 191, 36, 0.5);
    opacity: 0.95;
    transition: opacity 2.5s ease-out, color 0.3s, text-shadow 0.3s;
}

.actor.scanned {
    opacity: 1;
}

.actor.fading {
    opacity: 0;
}

.actor.trusted {
    color: #4ade80;
    text-shadow: 0 0 12px rgba(74, 222, 128, 0.8), 0 0 4px rgba(74, 222, 128, 0.5);
}

.actor.malicious {
    color: #f87171;
    text-shadow: 0 0 12px rgba(248, 113, 113, 0.8), 0 0 4px rgba(248, 113, 113, 0.5);
}

.actor.scanning {
    animation: actorScanFlash 0.3s ease-out;
}

@keyframes actorScanFlash {
    0% {
        filter: brightness(3) drop-shadow(0 0 15px white);
        transform: scale(1.3);
    }

    100% {
        filter: none;
        transform: scale(1);
    }
}

/* Shockwave pulse effects */
.shockwave {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    animation: shockwaveExpand 0.8s ease-out forwards;
}

.shockwave.breach {
    border: 3px solid rgba(248, 113, 113, 0.9);
    box-shadow: 0 0 20px rgba(248, 113, 113, 0.6), inset 0 0 20px rgba(248, 113, 113, 0.3);
}

.shockwave.safe {
    border: 2px solid rgba(74, 222, 128, 0.7);
    box-shadow: 0 0 15px rgba(74, 222, 128, 0.4), inset 0 0 15px rgba(74, 222, 128, 0.2);
}

@keyframes shockwaveExpand {
    0% {
        width: 60px;
        height: 60px;
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }

    100% {
        width: 60px;
        height: 60px;
        opacity: 0;
        transform: translate(-50%, -50%) scale(6);
    }
}

/* Beam danger state (red tint on breach) */
#lighthouse-intro .beam.danger {
    background: conic-gradient(from var(--rot) at var(--x) var(--y),
            rgba(255, 100, 100, 0) 0deg,
            rgba(255, 100, 100, 0.25) 6deg,
            rgba(255, 100, 100, 0) var(--beam-width),
            rgba(255, 100, 100, 0) 360deg);
}

/* Canvas grid background via CSS (subtle overlay for LOCAL state) */
#main::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        radial-gradient(circle at center, rgba(0, 212, 255, 0.03) 0%, transparent 70%),
        linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    background-size: 100% 100%, 50px 50px, 50px 50px;
    pointer-events: none;
    z-index: 0;
    /* Behind mask - won't show until mask fades */
}

/* ═══════════════════════════════════════════════════════════════
   UI OVERLAY PANELS
   ═══════════════════════════════════════════════════════════════ */

#ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 10;
}

.panel {
    pointer-events: auto;
    background: var(--bg-panel);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    box-shadow:
        0 4px 20px rgba(0, 0, 0, 0.4),
        0 0 1px rgba(255, 255, 255, 0.1);
}

.hidden {
    display: none !important;
}

/* ═══════════════════════════════════════════════════════════════
   BOOK (Docs + Home Overlay)
   ═══════════════════════════════════════════════════════════════ */

.docs-main {
    overflow: hidden;
    padding: 8px;
}

.doc-reader {
    width: 100%;
    height: 100%;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.07);
    background: rgba(10, 10, 20, 0.45);
    overflow: hidden;
}

.book {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.book-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.book-kicker {
    font-size: 12px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(232, 232, 240, 0.62);
}

.book-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.book-action {
    display: inline-flex;
    align-items: center;
    height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.10);
    background: rgba(0, 0, 0, 0.18);
    color: rgba(232, 232, 240, 0.9);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
}

.book-action:hover {
    border-color: rgba(0, 212, 255, 0.35);
    background: rgba(0, 212, 255, 0.10);
}

.book-action-primary {
    border-color: rgba(0, 212, 255, 0.28);
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.18), rgba(168, 85, 247, 0.14));
}

.book-spread {
    height: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    padding: 16px;
    overflow: auto;
}

.page {
    position: relative;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(0, 0, 0, 0.12)),
        radial-gradient(circle at 20% 10%, rgba(255, 255, 255, 0.06), transparent 55%),
        rgba(10, 10, 20, 0.55);
    box-shadow:
        0 14px 48px rgba(0, 0, 0, 0.45),
        0 0 1px rgba(255, 255, 255, 0.10);
    padding: 22px 22px 26px;
    overflow: hidden;
}

.page::after {
    content: "";
    position: absolute;
    top: 10px;
    bottom: 10px;
    right: 10px;
    width: 2px;
    background: linear-gradient(to bottom, transparent, rgba(0, 212, 255, 0.28), transparent);
    opacity: 0.35;
    pointer-events: none;
}

.page h1,
.page h2,
.page h3 {
    font-family: ui-serif, "Iowan Old Style", "Palatino", "Book Antiqua", "Times New Roman", serif;
    letter-spacing: 0.2px;
}

.page h1 {
    font-size: 34px;
    line-height: 1.05;
    margin-bottom: 10px;
}

.page h2 {
    font-size: 18px;
    margin-top: 18px;
    margin-bottom: 8px;
    color: rgba(232, 232, 240, 0.92);
}

.page p,
.page li {
    font-size: 16px;
    color: rgba(232, 232, 240, 0.86);
}

.page p + p {
    margin-top: 10px;
}

.page ul {
    margin: 10px 0 0 18px;
}

.page a {
    color: var(--cyan);
    text-decoration: none;
    border-bottom: 1px solid rgba(0, 212, 255, 0.35);
}

.page a:hover {
    border-bottom-color: rgba(0, 212, 255, 0.7);
}

.lede {
    font-size: 18px;
    color: rgba(232, 232, 240, 0.90);
}

.cta-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 14px;
}

.btn-secondary {
    padding: 10px 20px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.25);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
    text-decoration: none;
}

.btn-secondary:hover {
    border-color: rgba(0, 212, 255, 0.35);
    box-shadow: 0 0 22px rgba(0, 212, 255, 0.12);
    transform: translateY(-1px);
}

.fineprint {
    margin-top: 14px;
    font-size: 13px;
    color: rgba(232, 232, 240, 0.65);
}

/* Docs: desktop-first master/detail split (resizable). */
.doc-surface {
    width: 100%;
    height: 100%;
    margin: 0;
    border-radius: 12px;
    overflow: hidden;
}

.doc-split {
    display: grid;
    grid-template-columns: var(--doc-left, minmax(420px, 1fr)) 14px minmax(420px, 1fr);
    padding: 8px;
    height: 100%;
}

.doc-pane {
    min-width: 0;
    min-height: 0;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.07);
    background: rgba(10, 10, 20, 0.45);
    overflow: hidden;
}

.doc-splitter {
    width: 14px;
    border-radius: 10px;
    cursor: col-resize;
    align-self: stretch;
    justify-self: stretch;
    background:
        linear-gradient(to bottom, rgba(0, 0, 0, 0.10), rgba(0, 0, 0, 0.25)),
        radial-gradient(circle at 50% 18%, rgba(0, 212, 255, 0.24), transparent 55%),
        radial-gradient(circle at 50% 82%, rgba(168, 85, 247, 0.18), transparent 60%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.28);
    position: relative;
}

.doc-splitter::after {
    content: "";
    position: absolute;
    top: 20%;
    bottom: 20%;
    left: 50%;
    width: 2px;
    transform: translateX(-50%);
    background: linear-gradient(to bottom, transparent, rgba(0, 212, 255, 0.35), transparent);
    opacity: 0.5;
}

.doc-splitter:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.18), 0 10px 24px rgba(0, 0, 0, 0.35);
    border-color: rgba(0, 212, 255, 0.30);
}

.doc-prose {
    height: 100%;
    overflow: auto;
    padding: 32px 48px 48px;
    font-size: 16px;
    line-height: 1.65;
    color: rgba(232, 232, 240, 0.86);
}

.doc-prose h1,
.doc-prose h2,
.doc-prose h3 {
    font-family: ui-serif, "Iowan Old Style", "Palatino", "Book Antiqua", "Times New Roman", serif;
    color: rgba(232, 232, 240, 0.95);
    break-inside: avoid;
}

.doc-prose h1 {
    font-size: 38px;
    line-height: 1.06;
    margin: 0 0 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.doc-prose h2 {
    font-size: 20px;
    margin: 32px 0 12px;
    padding: 12px 16px 10px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    border-left: 3px solid rgba(0, 212, 255, 0.25);
}

.doc-prose h3 {
    font-size: 16px;
    margin: 22px 0 8px;
    letter-spacing: 0.2px;
    color: rgba(232, 232, 240, 0.88);
}

.doc-prose p {
    margin: 0 0 12px;
}

.doc-prose a {
    color: var(--cyan);
    text-decoration: none;
    border-bottom: 1px solid rgba(0, 212, 255, 0.35);
}

.doc-prose a:hover {
    border-bottom-color: rgba(0, 212, 255, 0.7);
}

.doc-prose code {
    background: rgba(255, 255, 255, 0.08);
    padding: 2px 6px;
    border-radius: 6px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    font-size: 0.92em;
    color: rgba(232, 232, 240, 0.92);
}

.doc-prose blockquote {
    margin: 16px 0;
    padding: 14px 18px;
    background: rgba(0, 212, 255, 0.04);
    border-left: 3px solid rgba(0, 212, 255, 0.30);
    border-radius: 0 8px 8px 0;
    color: rgba(232, 232, 240, 0.90);
}

.doc-prose blockquote p:last-child {
    margin-bottom: 0;
}

.doc-prose pre {
    break-inside: avoid;
    background: rgba(0, 0, 0, 0.40);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 10px;
    padding: 16px 18px;
    overflow: auto;
    margin: 12px 0 16px;
}

.doc-prose pre code {
    background: transparent;
    padding: 0;
}

.doc-prose ul,
.doc-prose ol {
    break-inside: avoid;
    margin: 0 0 14px 20px;
}

.doc-prose li {
    margin: 6px 0;
}

.doc-prose table {
    break-inside: avoid;
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 12px 0 18px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.07);
}

.doc-prose th,
.doc-prose td {
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    padding: 9px 12px;
    text-align: left;
    vertical-align: top;
}

.doc-prose tr:last-child td {
    border-bottom: none;
}

.doc-prose th {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(232, 232, 240, 0.92);
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.10);
}

.doc-prose hr {
    border: none;
    height: 1px;
    background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.08), transparent);
    margin: 28px 0;
}

/* Home collapsed right sidebar (SEO + trust + funding). */
.home-drawer-wrap {
    position: absolute;
    top: 18px;
    right: 18px;
    width: min(520px, calc(100% - 36px));
    height: min(760px, calc(100% - 36px));
    z-index: 12;
    pointer-events: none;
}

.home-drawer-toggle {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.home-drawer {
    pointer-events: auto;
    height: 100%;
    border-radius: 16px;
    overflow: hidden;
    background:
        radial-gradient(circle at 20% 10%, rgba(0, 212, 255, 0.12), transparent 55%),
        radial-gradient(circle at 80% 85%, rgba(168, 85, 247, 0.10), transparent 60%),
        rgba(12, 12, 18, 0.72);
    /* Fully off-canvas by default; only the "Info" pill is visible. */
    transform: translateX(110%);
    transition: transform 260ms ease, opacity 260ms ease;
    opacity: 0.98;
    position: relative;
    z-index: 1;
}

.home-drawer-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 16px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.home-drawer-kicker {
    font-size: 12px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(232, 232, 240, 0.62);
}

.home-drawer-close {
    display: inline-flex;
    align-items: center;
    height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.10);
    background: rgba(0, 0, 0, 0.18);
    color: rgba(232, 232, 240, 0.9);
    font-size: 13px;
    font-weight: 650;
    cursor: pointer;
    transition: var(--transition-fast);
}

.home-drawer-close:hover {
    border-color: rgba(0, 212, 255, 0.35);
    background: rgba(0, 212, 255, 0.10);
}

.home-drawer-body {
    height: calc(100% - 58px);
    overflow: auto;
    padding: 18px 18px 22px;
}

.home-drawer-body h1,
.home-drawer-body h2 {
    font-family: ui-serif, "Iowan Old Style", "Palatino", "Book Antiqua", "Times New Roman", serif;
}

.home-drawer-body h1 {
    font-size: 28px;
    line-height: 1.08;
    margin: 0 0 10px;
}

.home-drawer-body h2 {
    font-size: 16px;
    margin: 18px 0 8px;
}

.home-drawer-body p,
.home-drawer-body li {
    font-size: 16px;
    color: rgba(232, 232, 240, 0.86);
}

.home-drawer-body a {
    color: var(--cyan);
    text-decoration: none;
    border-bottom: 1px solid rgba(0, 212, 255, 0.35);
}

.home-drawer-body a:hover {
    border-bottom-color: rgba(0, 212, 255, 0.7);
}

/* Drawer brand row (icon + title) */
.home-drawer-brand {
    display: flex;
    align-items: center;
    gap: 8px;
}

.home-drawer-icon {
    width: 24px;
    height: 24px;
    border-radius: 5px;
}

/* Drawer provider list */
.drawer-provider-hint {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.drawer-provider-list {
    margin-bottom: 16px;
}

.drawer-provider-group {
    padding: 4px 0;
}

.drawer-provider-group + .drawer-provider-group {
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    margin-top: 4px;
    padding-top: 8px;
}

.drawer-provider-group-label {
    padding: 4px 0;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.drawer-provider-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 7px 10px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: rgba(232, 232, 240, 0.78);
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition-fast);
}

.drawer-provider-option:hover {
    background: rgba(0, 212, 255, 0.06);
    color: rgba(232, 232, 240, 0.95);
}

.drawer-provider-option.active {
    background: rgba(0, 212, 255, 0.10);
    color: var(--cyan);
}

.drawer-provider-count {
    font-size: 12px;
    font-family: 'SF Mono', Monaco, monospace;
    color: var(--text-muted);
}

.drawer-provider-option.active .drawer-provider-count {
    color: var(--cyan);
}

.home-drawer-toggle:checked + .home-drawer {
    transform: translateX(0);
}

.home-drawer-peek {
    position: absolute;
    top: 12px;
    right: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 42px;
    width: 64px;
    border-radius: 14px;
    border: 1px solid rgba(0, 212, 255, 0.28);
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.18), rgba(168, 85, 247, 0.14));
    color: rgba(232, 232, 240, 0.95);
    font-weight: 750;
    letter-spacing: 0.2px;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45), 0 0 24px rgba(0, 212, 255, 0.12);
    transition: var(--transition-fast);
    pointer-events: auto;
    z-index: 2;
}

.home-drawer-peek:hover {
    transform: translateY(-1px);
    border-color: rgba(0, 212, 255, 0.5);
}

.home-drawer-toggle:checked ~ .home-drawer-peek {
    opacity: 0;
    pointer-events: none;
}

@media (max-width: 1100px) {
    .shell {
        grid-template-columns: 280px 1fr;
    }
    :root {
        --side-nav-width: 280px;
    }
}

@media (max-width: 1200px) {
    .doc-split {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr 1fr;
        padding: 8px;
        gap: 12px;
    }
    .doc-splitter {
        display: none;
    }
}

@media (max-width: 920px) {
    .shell {
        grid-template-columns: 1fr;
    }
    .side-nav {
        display: none;
    }
    .book-spread {
        grid-template-columns: 1fr;
    }
    .doc-split {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr 1fr;
        padding: 12px;
        gap: 12px;
    }
    .doc-splitter {
        display: none;
    }
    .home-drawer-wrap {
        top: 12px;
        right: 12px;
        width: calc(100% - 24px);
        height: min(820px, calc(100% - 24px));
    }
}

/* Action Panel */
#action-panel {
    position: absolute;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 4px;
    padding: 6px;
}

.action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-fast);
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

.action-btn:hover .btn-icon {
    transform: scale(1.1);
}

.action-btn.active {
    background: rgba(0, 212, 255, 0.15);
    color: var(--cyan);
}

.btn-icon {
    font-size: 20px;
    transition: var(--transition-fast);
}

.btn-label {
    font-size: 11px;
    white-space: nowrap;
}

/* Trace Panel */
#trace-panel {
    position: absolute;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 320px;
}

#trace-input {
    padding: 10px 14px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.3);
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    transition: var(--transition-fast);
}

#trace-input:focus {
    border-color: var(--cyan);
    box-shadow: 0 0 0 2px var(--cyan-glow);
}

#trace-input::placeholder {
    color: var(--text-muted);
}

.btn-primary {
    padding: 12px 22px;
    border: none;
    border-radius: 6px;
    background: linear-gradient(135deg, var(--cyan), var(--purple));
    color: white;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px var(--cyan-glow);
}

.quick-picks {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.pick-btn {
    padding: 6px 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
    transition: var(--transition-fast);
}

.pick-btn:hover {
    border-color: var(--cyan);
    color: var(--cyan);
}

/* Info Panel */
#info-panel {
    position: absolute;
    top: 16px;
    right: 16px;
    padding: 14px;
    min-width: 240px;
    max-width: 320px;
}

#info-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--cyan);
}

#info-content {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.6;
}

#info-content .info-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

#info-content .info-label {
    color: var(--text-muted);
}

#info-content .info-value {
    color: var(--text-primary);
    font-family: 'SF Mono', Monaco, monospace;
}

#info-content .info-value.warning {
    color: var(--coral);
}

#info-content .info-value.secure {
    color: var(--green);
}

/* Zoom Panel (LAN mode only) */
#zoom-panel {
    position: absolute;
    bottom: 16px;
    left: 16px;
    display: none;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
}

.zoom-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    transition: var(--transition-fast);
}

.zoom-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

#zoom-level {
    font-size: 12px;
    color: var(--text-muted);
    min-width: 40px;
    text-align: center;
}


/* ═══════════════════════════════════════════════════════════════
   LOADING OVERLAY
   ═══════════════════════════════════════════════════════════════ */

#loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-darker);
    z-index: 50;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

#loading-overlay.fade-out {
    opacity: 0;
    visibility: hidden;
}

.loading-content {
    text-align: center;
    max-width: 400px;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    margin: 0 auto 24px;
    border: 3px solid var(--line-default);
    border-top-color: var(--cyan);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-content h1 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--cyan), var(--purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.loading-content p {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.loading-items {
    text-align: left;
    display: inline-block;
}

.loading-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    color: var(--text-muted);
    transition: var(--transition-medium);
}

.loading-item.active {
    color: var(--text-primary);
}

.loading-item.complete {
    color: var(--green);
}

.loading-item.complete .check-icon {
    color: var(--green);
}

.loading-item.warning {
    color: var(--coral);
}

.check-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

/* ═══════════════════════════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════════════════════════ */

#footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    padding: 8px 16px;
    pointer-events: none;
}


/* Provider Picker */
#provider-picker {
    position: relative;
    display: inline-block;
    pointer-events: auto;
}

.provider-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--bg-panel);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition-fast);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4), 0 0 1px rgba(255, 255, 255, 0.1);
}

.provider-toggle:hover {
    background: var(--bg-panel-hover);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.15);
}

.provider-toggle.open {
    border-color: var(--cyan);
    color: var(--text-primary);
}

.provider-btn-icon {
    font-size: 16px;
}

#provider-btn-label {
    font-weight: 500;
}

.provider-btn-count {
    font-size: 11px;
    color: var(--cyan);
    font-family: 'SF Mono', Monaco, monospace;
}

.provider-btn-arrow {
    font-size: 10px;
    transition: transform 0.2s ease;
}

.provider-toggle.open .provider-btn-arrow {
    transform: rotate(180deg);
}

/* Popup menu (opens upward) */
.provider-menu {
    display: none;
    position: absolute;
    bottom: calc(100% + 6px);
    left: 0;
    min-width: 200px;
    background: var(--bg-panel);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 1px rgba(255, 255, 255, 0.1);
    padding: 6px;
    max-height: 360px;
    overflow-y: auto;
}

.provider-menu.open {
    display: block;
    animation: provider-menu-in 0.15s ease-out;
}

@keyframes provider-menu-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.provider-group {
    padding: 4px 0;
}

.provider-group + .provider-group {
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.provider-group-label {
    padding: 6px 10px 4px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.provider-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 8px 10px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition-fast);
    text-align: left;
}

.provider-option:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

.provider-option.active {
    background: rgba(0, 212, 255, 0.12);
    color: var(--cyan);
}

.provider-name {
    font-weight: 500;
}

.provider-count {
    font-size: 11px;
    color: var(--text-muted);
    font-family: 'SF Mono', Monaco, monospace;
}

.provider-option.active .provider-count {
    color: var(--cyan);
}

/* Hide provider picker in LAN mode */
body.lan-mode #provider-picker {
    display: none;
}

/* ═══════════════════════════════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════════════════════════════ */

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

@keyframes pulse-glow {

    0%,
    100% {
        text-shadow: 0 0 10px var(--cyan-glow);
    }

    50% {
        text-shadow: 0 0 20px var(--cyan-glow), 0 0 30px var(--cyan-glow);
    }
}

@keyframes node-appear {
    from {
        transform: scale(0);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes connection-draw {
    from {
        stroke-dashoffset: 1000;
    }

    to {
        stroke-dashoffset: 0;
    }
}

@keyframes data-flow {
    0% {
        stroke-dashoffset: 20;
    }

    100% {
        stroke-dashoffset: 0;
    }
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    :root {
        --header-height: 44px;
    }

    .logo-text {
        display: none;
    }

    #action-panel {
        flex-wrap: wrap;
        max-width: 90vw;
    }

    .action-btn {
        padding: 8px 12px;
    }

    .btn-label {
        display: none;
    }

    #info-panel {
        top: auto;
        bottom: 60px;
        right: 8px;
        left: 8px;
        max-width: none;
    }
}

/* ═══════════════════════════════════════════════════════════════
   UTILITY CLASSES
   ═══════════════════════════════════════════════════════════════ */

.text-cyan {
    color: var(--cyan);
}

.text-purple {
    color: var(--purple);
}

.text-green {
    color: var(--green);
}

.text-coral {
    color: var(--coral);
}

.text-gold {
    color: var(--gold);
}

.glow-cyan {
    text-shadow: 0 0 10px var(--cyan-glow);
}

.glow-purple {
    text-shadow: 0 0 10px var(--purple-glow);
}

.glow-green {
    text-shadow: 0 0 10px var(--green-glow);
}

.glow-coral {
    text-shadow: 0 0 10px var(--coral-glow);
}

/* ═══════════════════════════════════════════════════════════════
   HOME MARKER (Map)
   ═══════════════════════════════════════════════════════════════ */

.home-marker {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: auto;
    z-index: 100;
}

.home-marker-pulse {
    position: absolute;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--cyan-glow) 0%, transparent 70%);
    animation: home-pulse 2s ease-in-out infinite;
    pointer-events: none;
}

.home-marker-icon {
    font-size: 32px;
    filter: drop-shadow(0 0 10px var(--cyan)) drop-shadow(0 4px 8px rgba(0, 0, 0, 0.5));
    transition: transform 0.3s ease;
    z-index: 1;
}

.home-marker:hover .home-marker-icon {
    transform: scale(1.2);
}

.home-marker-label {
    margin-top: 4px;
    padding: 4px 10px;
    background: var(--bg-panel);
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    color: var(--cyan);
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    transition: all 0.3s ease;
}

/* Estimated location state (draggable) */
.home-marker.estimated .home-marker-label {
    background: rgba(255, 215, 0, 0.15);
    border-color: var(--gold);
    color: var(--gold);
}

.home-marker.estimated .home-marker-pulse {
    background: radial-gradient(circle, rgba(255, 215, 0, 0.4) 0%, transparent 70%);
}

.home-marker.estimated .home-marker-icon {
    filter: drop-shadow(0 0 10px var(--gold)) drop-shadow(0 4px 8px rgba(0, 0, 0, 0.5));
    cursor: grab;
}

.home-marker.estimated .home-marker-icon:active {
    cursor: grabbing;
}

.home-marker-hint {
    margin-top: 2px;
    font-size: 9px;
    color: var(--gold);
    opacity: 0.8;
    animation: hint-pulse 2s ease-in-out infinite;
}

@keyframes hint-pulse {

    0%,
    100% {
        opacity: 0.6;
    }

    50% {
        opacity: 1;
    }
}

/* Confirmed location state */
.home-marker.confirmed .home-marker-label {
    background: var(--bg-panel);
    border-color: var(--green);
    color: var(--green);
}

.home-marker.confirmed .home-marker-pulse {
    background: radial-gradient(circle, var(--green-glow) 0%, transparent 70%);
}

.home-marker:hover .home-marker-label {
    background: var(--cyan);
    color: var(--bg-dark);
    border-color: var(--cyan);
    box-shadow: 0 0 20px var(--cyan-glow);
}

@keyframes home-pulse {

    0%,
    100% {
        transform: scale(0.8);
        opacity: 0.6;
    }

    50% {
        transform: scale(1.2);
        opacity: 0.2;
    }
}

/* ═══════════════════════════════════════════════════════════════
   LAN MODE
   ═══════════════════════════════════════════════════════════════ */

/* When in LAN mode, canvas has semi-transparent dark background */
#canvas.lan-mode {
    background: radial-gradient(ellipse at center,
            rgba(10, 10, 20, 0.85) 0%,
            rgba(5, 5, 10, 0.95) 100%);
}

/* Show zoom controls in LAN mode */
body.lan-mode #zoom-panel {
    display: flex;
}

/* Exit LAN mode button */
#btn-exit-lan {
    position: absolute;
    top: 16px;
    right: 16px;
    display: none;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--bg-panel);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 20;
    pointer-events: auto;
}

body.lan-mode #btn-exit-lan {
    display: flex;
}

#btn-exit-lan:hover {
    background: var(--bg-panel-hover);
    color: var(--text-primary);
    border-color: var(--cyan);
}

/* Add device button (floating action) */
#btn-add-device {
    position: absolute;
    bottom: 20px;
    right: 20px;
    display: none;
    width: 56px;
    height: 56px;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--cyan), var(--purple));
    border: none;
    border-radius: 50%;
    font-size: 28px;
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 20px var(--cyan-glow);
    transition: all 0.3s ease;
    z-index: 20;
    pointer-events: auto;
}

body.lan-mode #btn-add-device {
    display: flex;
}

#btn-add-device:hover {
    transform: scale(1.1) rotate(90deg);
    box-shadow: 0 6px 30px var(--cyan-glow);
}

/* Device discovery animation */
@keyframes device-discover {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    50% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.device-discovered {
    animation: device-discover 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* ═══════════════════════════════════════════════════════════════
   MAP MARKERS (Connection Path)
   ═══════════════════════════════════════════════════════════════ */

.map-marker {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.map-marker:hover {
    transform: scale(1.15);
}

.map-marker .marker-icon {
    font-size: 28px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

/* Lighthouse SVG (used by intro element only — map uses GeoJSON symbol layer) */
.lighthouse-svg-marker {
    width: 50px;
    height: auto;
    filter: drop-shadow(0 0 12px var(--gold)) drop-shadow(0 4px 8px rgba(0, 0, 0, 0.5));
}

.lighthouse-svg-marker svg {
    width: 100%;
    height: auto;
}

/* Lighthouse marker fallback (emoji) */
.lighthouse-icon-marker {
    animation: marker-pulse 2s ease-in-out infinite;
}

.lighthouse-icon-marker .marker-icon {
    filter: drop-shadow(0 0 8px var(--gold)) drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

/* CF Edge marker - larger Cloudflare logo */
.cf-edge-marker {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: auto;
    height: auto;
}

.cf-edge-marker .cf-logo {
    width: 48px;
    height: 48px;
    filter: drop-shadow(0 0 12px var(--cyan)) drop-shadow(0 4px 8px rgba(0, 0, 0, 0.5));
    animation: cf-pulse 2s ease-in-out infinite;
}

.cf-edge-marker .marker-label {
    margin-top: 4px;
    padding: 3px 8px;
    background: var(--bg-panel);
    border: 1px solid rgba(0, 212, 255, 0.4);
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    color: var(--cyan);
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    font-family: 'SF Mono', Monaco, monospace;
}

@keyframes cf-pulse {

    0%,
    100% {
        transform: scale(1);
        filter: drop-shadow(0 0 12px var(--cyan)) drop-shadow(0 4px 8px rgba(0, 0, 0, 0.5));
    }

    50% {
        transform: scale(1.05);
        filter: drop-shadow(0 0 20px var(--cyan)) drop-shadow(0 4px 8px rgba(0, 0, 0, 0.5));
    }
}

/* ISP marker with label */
.isp-marker {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: auto;
    height: auto;
}

.isp-marker .marker-icon {
    font-size: 32px;
    filter: drop-shadow(0 0 8px var(--purple)) drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

.isp-marker .marker-label {
    margin-top: 4px;
    padding: 3px 8px;
    background: var(--bg-panel);
    border: 1px solid rgba(168, 85, 247, 0.3);
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    color: var(--purple);
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

@keyframes marker-pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.08);
    }
}

/* ═══════════════════════════════════════════════════════════════
   MAP POPUPS (Info Cards)
   ═══════════════════════════════════════════════════════════════ */

.maplibregl-popup.info-popup {
    z-index: 50;
}

.maplibregl-popup.info-popup .maplibregl-popup-content {
    background: var(--bg-panel);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 0;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(16px);
    overflow: hidden;
}

.maplibregl-popup.info-popup .maplibregl-popup-tip {
    border-top-color: var(--bg-panel);
}

.maplibregl-popup.info-popup .maplibregl-popup-close-button {
    color: var(--text-muted);
    font-size: 20px;
    padding: 8px 12px;
    right: 4px;
    top: 4px;
}

.maplibregl-popup.info-popup .maplibregl-popup-close-button:hover {
    color: var(--text-primary);
    background: transparent;
}

.popup-content {
    min-width: 220px;
}

.popup-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.15), rgba(255, 215, 0, 0.05));
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.popup-header.cf {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.15), rgba(0, 212, 255, 0.05));
}

.popup-header.isp {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.15), rgba(168, 85, 247, 0.05));
}

.popup-header .popup-icon {
    font-size: 24px;
}

.popup-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.popup-body {
    padding: 12px 16px;
}

.popup-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.popup-row:last-child {
    border-bottom: none;
}

.popup-row.highlight {
    background: rgba(0, 212, 255, 0.08);
    margin: 4px -16px;
    padding: 8px 16px;
    border-bottom: 1px solid rgba(0, 212, 255, 0.1);
}

.popup-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.popup-value {
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 500;
}

.popup-value.mono {
    font-family: 'SF Mono', Monaco, Consolas, monospace;
    font-size: 11px;
    color: var(--cyan);
}

.popup-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.03);
}

.popup-status {
    font-size: 11px;
    font-weight: 500;
}

.popup-status.online {
    color: var(--green);
}

.popup-status.offline {
    color: var(--coral);
}

.popup-note {
    font-size: 11px;
    color: var(--text-muted);
    font-style: italic;
}

/* Ping button and result in popup footer */
.popup-ping-group {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.popup-ping-btn {
    padding: 3px 12px;
    border: 1px solid var(--cyan);
    border-radius: 12px;
    background: transparent;
    color: var(--cyan);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
    letter-spacing: 0.3px;
}

.popup-ping-btn:hover {
    background: rgba(0, 212, 255, 0.15);
}

.popup-ping-btn:disabled {
    opacity: 0.5;
    cursor: default;
}

.popup-ping-result {
    font-size: 12px;
    font-weight: 600;
    font-family: 'SF Mono', Monaco, Consolas, monospace;
    min-width: 50px;
}

.popup-ping-result.success {
    color: var(--green);
}

.popup-ping-result.error {
    color: var(--coral);
}

/* ═══════════════════════════════════════════════════════════════
   STAGE INDICATOR (Progressive Reveal)
   ═══════════════════════════════════════════════════════════════ */

#stage-indicator {
    position: absolute;
    top: 22px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 26px;
    background: rgba(10, 10, 20, 0.9);
    border: 1px solid rgba(0, 212, 255, 0.2);
    border-radius: 34px;
    backdrop-filter: blur(16px);
    z-index: 15;
    pointer-events: auto;
    opacity: 0;
    transform: translateX(-50%) translateY(-20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4), 0 0 40px rgba(0, 212, 255, 0.1);
}

#stage-indicator.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.stage-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--text-muted);
    transition: all 0.4s ease;
    min-width: 70px;
}

.stage-step.active {
    color: var(--cyan);
}

.stage-step.active .step-icon {
    animation: stage-bounce 0.6s ease;
    filter: drop-shadow(0 0 8px var(--cyan));
}

.stage-step.complete {
    color: var(--green);
}

.stage-step.complete .step-icon {
    filter: drop-shadow(0 0 6px var(--green));
}

.stage-step .step-icon {
    font-size: 26px;
    transition: transform 0.3s ease, filter 0.3s ease;
}

.stage-step .step-icon-svg {
    display: flex;
    align-items: center;
    justify-content: center;
}

.stage-step .step-icon-svg svg,
.stage-step .step-icon-svg img {
    display: block;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
    transition: filter 0.3s ease, transform 0.3s ease;
}

.stage-step.active .step-icon-svg svg,
.stage-step.active .step-icon-svg img {
    filter: drop-shadow(0 0 8px var(--cyan)) drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

.stage-step.complete .step-icon-svg svg,
.stage-step.complete .step-icon-svg img {
    filter: drop-shadow(0 0 6px var(--green)) drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

.stage-step .step-label {
    white-space: nowrap;
    font-weight: 500;
    letter-spacing: 0.3px;
}

.stage-connector {
    width: 32px;
    height: 3px;
    background: var(--text-muted);
    opacity: 0.2;
    border-radius: 2px;
    transition: all 0.4s ease;
    position: relative;
    overflow: hidden;
}

.stage-connector.active {
    background: linear-gradient(90deg, var(--green), var(--cyan));
    opacity: 1;
}

/* Animated pulse along connector when active */
.stage-connector.active::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
    animation: connector-pulse 1.5s ease-in-out infinite;
}

@keyframes connector-pulse {
    0% {
        left: -100%;
    }

    100% {
        left: 100%;
    }
}

@keyframes stage-bounce {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.3);
    }
}
.home-drawer-wrap > * {
    pointer-events: auto;
}

/* ===============================================================
   ONBOARDING PAGE (/mac-mini)
   =============================================================== */

.onboard-body {
    overflow-y: auto;
    overflow-x: hidden;
    height: 100vh;
}

.onboard-body #header {
    position: sticky;
}

.onboard-main {
    max-width: 1400px;
    margin: calc(var(--header-height) + 24px) auto 60px;
    padding: 0 40px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: start;
}

.onboard-main .onboard-diag {
    grid-column: 1 / -1;
}

.onboard-card {
    background:
        radial-gradient(circle at 20% 10%, rgba(0, 212, 255, 0.06), transparent 55%),
        rgba(12, 12, 22, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    overflow: hidden;
    backdrop-filter: blur(12px);
}

.onboard-card.hidden { display: none; }

.onboard-card-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.onboard-card-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.onboard-step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--cyan), var(--purple));
    color: white;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}

.onboard-card-body {
    padding: 20px;
}

.onboard-card-body h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 16px 0 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.onboard-card-body h3:first-child { margin-top: 0; }

.onboard-os-icon {
    font-size: 48px;
    text-align: center;
    margin-bottom: 8px;
}

.onboard-os-name {
    text-align: center;
    font-size: 16px;
    color: var(--text-primary);
    font-weight: 500;
}

.onboard-card-body input[type="text"] {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.3);
    color: var(--text-primary);
    font-size: 16px;
    outline: none;
    margin-bottom: 12px;
    transition: var(--transition-fast);
    box-sizing: border-box;
}

.onboard-card-body input[type="text"]:focus {
    border-color: var(--cyan);
    box-shadow: 0 0 0 2px var(--cyan-glow);
}

.onboard-code {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 14px 16px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 12px;
    line-height: 1.5;
    color: var(--green);
    overflow-x: auto;
    max-height: 300px;
    overflow-y: auto;
    white-space: pre;
    tab-size: 2;
    margin: 0;
}

.yaml-comment { color: var(--text-muted); }
.yaml-key { color: var(--cyan); }
.yaml-string { color: #fbbf24; }

.onboard-vpn-ip {
    margin-bottom: 12px;
    font-size: 16px;
    color: var(--text-secondary);
}

.onboard-vpn-ip code {
    background: rgba(0, 212, 255, 0.15);
    border: 1px solid rgba(0, 212, 255, 0.3);
    padding: 4px 10px;
    border-radius: 8px;
    font-weight: 600;
    color: var(--cyan);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.onboard-btn-row {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}

.onboard-btn-row .btn-secondary,
.onboard-btn-row .btn-primary {
    flex: 1;
}

.onboard-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.onboard-info-item {
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.onboard-info-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.onboard-info-value {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    word-break: break-all;
}

.onboard-card-body textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.3);
    color: var(--text-primary);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 13px;
    resize: vertical;
    outline: none;
    margin-bottom: 12px;
    box-sizing: border-box;
}

.onboard-card-body textarea:focus {
    border-color: var(--cyan);
    box-shadow: 0 0 0 2px var(--cyan-glow);
}

.onboard-result {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: 10px;
    font-size: 14px;
    font-weight: 600;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.onboard-result.success { color: var(--green); }
.onboard-result.error { color: var(--coral); }
.onboard-result.pending { color: var(--text-muted); }

.onboard-test-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.onboard-qr-toggle {
    position: fixed;
    top: calc(var(--header-height) + 16px);
    right: 16px;
    z-index: 50;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(20, 20, 35, 0.85);
    color: var(--text-primary);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(12px);
}

.onboard-qr-toggle:hover {
    border-color: var(--cyan);
}

.onboard-qr-modal {
    position: fixed;
    top: calc(var(--header-height) + 70px);
    right: 16px;
    z-index: 50;
    background: rgba(20, 20, 35, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 20px;
    text-align: center;
    backdrop-filter: blur(12px);
}

.onboard-qr-modal.hidden { display: none; }

.onboard-qr-modal p {
    margin: 10px 0 0;
    font-size: 13px;
    color: var(--text-secondary);
}

.onboard-diag {
    border-color: rgba(168, 85, 247, 0.2);
}

.onboard-diag .onboard-step-num {
    background: linear-gradient(135deg, var(--purple), var(--coral));
}

.onboard-instructions ol {
    margin: 0 0 0 20px;
    padding: 0;
    color: var(--text-primary);
}

.onboard-instructions li {
    margin: 8px 0;
    line-height: 1.6;
}

.onboard-instructions code {
    background: rgba(255, 255, 255, 0.08);
    padding: 2px 6px;
    border-radius: 6px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.9em;
    color: var(--green);
}

.onboard-instructions a {
    color: var(--cyan);
    text-decoration: none;
    border-bottom: 1px solid rgba(0, 212, 255, 0.35);
}

.onboard-instructions a:hover {
    border-bottom-color: var(--cyan);
}

.onboard-status {
    margin-top: 8px;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 14px;
}

.onboard-status.success {
    background: rgba(0, 255, 136, 0.1);
    border: 1px solid rgba(0, 255, 136, 0.2);
    color: var(--green);
}

.onboard-status.error {
    background: rgba(255, 107, 107, 0.1);
    border: 1px solid rgba(255, 107, 107, 0.2);
    color: var(--coral);
}

.onboard-status.loading {
    background: rgba(0, 212, 255, 0.1);
    border: 1px solid rgba(0, 212, 255, 0.2);
    color: var(--cyan);
}

@media (max-width: 768px) {
    .onboard-main {
        margin-top: calc(var(--header-height) + 12px);
        padding: 0 12px;
    }

    .onboard-info-grid {
        grid-template-columns: 1fr;
    }

    .onboard-btn-row {
        flex-direction: column;
    }

    .onboard-qr-toggle {
        top: calc(var(--header-height) + 8px);
        right: 8px;
    }

    .onboard-qr-modal {
        right: 8px;
        left: 8px;
        top: calc(var(--header-height) + 58px);
    }
}

/* ── Noah onboarding page ──────────────────────────────────────── */

.noah-main {
    grid-template-columns: 1fr;
    max-width: 720px;
}

.noah-welcome {
    grid-column: 1 / -1;
}

.noah-hero-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 12px;
}

.noah-hero-text {
    font-size: 15px;
    line-height: 1.7;
    color: var(--text-secondary);
    margin: 0 0 10px;
}

.noah-hero-text:last-child {
    margin-bottom: 0;
}

.noah-hero-text strong {
    color: var(--cyan);
}

.noah-platform-cards {
    display: flex;
    gap: 12px;
}

.noah-platform-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px 16px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: var(--transition-fast);
    color: var(--text-primary);
    font-family: inherit;
    font-size: inherit;
}

.noah-platform-card:hover {
    border-color: rgba(0, 212, 255, 0.3);
    background: rgba(0, 212, 255, 0.05);
}

.noah-platform-card.selected {
    border-color: var(--cyan);
    background: rgba(0, 212, 255, 0.1);
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.15);
}

.noah-platform-icon {
    font-size: 36px;
}

.noah-platform-label {
    font-size: 16px;
    font-weight: 600;
}

.noah-instructions {
    margin-bottom: 8px;
}

.noah-instructions.hidden {
    display: none;
}

.noah-instructions h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 0 0 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.noah-steps {
    margin: 0 0 0 20px;
    padding: 0;
    color: var(--text-primary);
}

.noah-steps li {
    margin: 12px 0;
    line-height: 1.6;
}

.noah-steps code {
    background: rgba(255, 255, 255, 0.08);
    padding: 2px 6px;
    border-radius: 6px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.9em;
    color: var(--green);
}

.noah-steps a {
    color: var(--cyan);
    text-decoration: none;
    border-bottom: 1px solid rgba(0, 212, 255, 0.35);
}

.noah-steps a:hover {
    border-bottom-color: var(--cyan);
}

.noah-steps .onboard-code {
    margin: 8px 0 0;
    font-size: 13px;
}

.noah-checklist {
    list-style: none;
    margin: 0;
    padding: 0;
}

.noah-checklist li {
    margin: 8px 0;
}

.noah-checklist label {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.5;
    cursor: pointer;
}

.noah-checklist input[type="checkbox"] {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    accent-color: var(--cyan);
}

.noah-checklist code {
    background: rgba(255, 255, 255, 0.08);
    padding: 2px 6px;
    border-radius: 6px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.9em;
    color: var(--green);
}

@media (max-width: 768px) {
    .noah-main {
        padding: 0 12px;
    }

    .noah-platform-cards {
        flex-direction: column;
    }

    .noah-hero-title {
        font-size: 24px;
    }
}

/* ═══════════════════════════════════════════════════════════════
   SETUP PAGE — /setup wizard installer
   ═══════════════════════════════════════════════════════════════ */

.setup-body {
    overflow: hidden;
}

/* Three-column grid: sidebar | main wizard | help panel */
.setup-shell {
    height: calc(100vh - var(--header-height));
    margin-top: var(--header-height);
    display: grid;
    grid-template-columns: 260px 1fr 320px;
    font-size: 17px;
}

/* ── Left sidebar ── */

.setup-sidebar {
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    background:
        radial-gradient(circle at 20% 10%, rgba(0, 212, 255, 0.12), transparent 55%),
        radial-gradient(circle at 80% 85%, rgba(168, 85, 247, 0.10), transparent 60%),
        linear-gradient(to bottom, rgba(5, 5, 8, 0.92), rgba(10, 10, 15, 0.86));
    overflow-y: auto;
}

.setup-sidebar-inner {
    padding: 24px 18px;
}

.setup-sidebar-brand {
    margin-bottom: 28px;
}

.setup-sidebar-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.setup-sidebar-desc {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-secondary);
    margin: 0;
}

/* ── Sidebar step list ── */

.setup-steps {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.setup-step {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid transparent;
    background: none;
    color: var(--text-muted);
    cursor: default;
    transition: var(--transition-fast);
    font: inherit;
    font-size: 15px;
    font-weight: 500;
    text-align: left;
}

.setup-step.is-clickable {
    cursor: pointer;
    color: var(--text-secondary);
}

.setup-step.is-clickable:hover {
    background: rgba(255, 255, 255, 0.04);
}

.setup-step.is-current {
    border-color: rgba(0, 212, 255, 0.25);
    background: rgba(0, 212, 255, 0.06);
    color: var(--text-primary);
}

.setup-step-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.15);
    background: transparent;
    flex-shrink: 0;
    transition: var(--transition-fast);
}

.setup-step.is-done .setup-step-dot {
    border-color: var(--cyan);
    background: var(--cyan);
    box-shadow: 0 0 10px var(--cyan-glow);
}

.setup-step.is-current .setup-step-dot {
    border-color: var(--cyan);
}

.setup-step-label {
    white-space: nowrap;
}

/* ── Center: wizard main area ── */

.setup-main {
    overflow-y: auto;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 40px 32px;
}

.setup-wizard-step {
    width: 100%;
    max-width: 580px;
}

.setup-wizard-header {
    margin-bottom: 28px;
}

.setup-wizard-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 10px;
}

.setup-wizard-header p {
    font-size: 17px;
    line-height: 1.6;
    color: var(--text-secondary);
    margin: 0;
}

.setup-wizard-body {
    margin-bottom: 28px;
}

.setup-wizard-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

/* ── Nav buttons (Back / Continue) ── */

.setup-btn-next {
    padding: 12px 28px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--cyan), rgba(0, 180, 220, 0.9));
    color: #0a0a0f;
    font: inherit;
    font-size: 16px;
    font-weight: 650;
    cursor: pointer;
    transition: var(--transition-fast);
}

.setup-btn-next:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px var(--cyan-glow);
}

.setup-btn-next:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.setup-btn-back {
    padding: 10px 20px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    background: none;
    color: var(--text-secondary);
    font: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
}

.setup-btn-back:hover {
    border-color: rgba(255, 255, 255, 0.25);
    color: var(--text-primary);
}

/* ── Platform selector ── */

.setup-platforms {
    display: flex;
    gap: 12px;
}

.setup-platform {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 24px 16px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    background: rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: var(--transition-fast);
    color: var(--text-secondary);
    font: inherit;
}

.setup-platform:hover {
    border-color: rgba(0, 212, 255, 0.3);
    background: rgba(0, 212, 255, 0.05);
    color: var(--text-primary);
}

.setup-platform.selected {
    border-color: var(--cyan);
    background: rgba(0, 212, 255, 0.1);
    box-shadow: 0 0 24px rgba(0, 212, 255, 0.15);
    color: var(--text-primary);
}

.setup-platform-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
}

.setup-platform-icon svg {
    opacity: 0.6;
    transition: opacity var(--transition-fast);
}

.setup-platform.selected .setup-platform-icon svg,
.setup-platform:hover .setup-platform-icon svg {
    opacity: 1;
}

.setup-platform-label {
    font-size: 16px;
    font-weight: 600;
}

.setup-detected {
    margin-top: 12px;
    font-size: 12px;
    color: var(--text-muted);
}

/* ── Input ── */

.setup-input {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.3);
    color: var(--text-primary);
    font-size: 16px;
    outline: none;
    margin-bottom: 14px;
    transition: var(--transition-fast);
    box-sizing: border-box;
}

.setup-input:focus {
    border-color: var(--cyan);
    box-shadow: 0 0 0 2px var(--cyan-glow);
}

.setup-btn-full {
    width: 100%;
}

/* ── Download button ── */

.setup-download-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 16px 20px;
    border: 1px solid rgba(0, 212, 255, 0.4);
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.2), rgba(168, 85, 247, 0.12));
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
    font-family: inherit;
}

.setup-download-btn:hover {
    transform: translateY(-1px);
    border-color: rgba(0, 212, 255, 0.6);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3), 0 0 20px rgba(0, 212, 255, 0.15);
}

.setup-download-btn svg {
    color: var(--cyan);
}

.setup-hint {
    color: var(--text-secondary);
    font-size: 14px;
    margin: 16px 0 8px;
}

/* ── Command block ── */

.setup-command-wrap {
    position: relative;
}

.setup-command {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 12px 50px 12px 16px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 14px;
    color: var(--green);
    margin: 0;
    overflow-x: auto;
    white-space: pre;
}

.setup-copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.3);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.setup-copy-btn:hover {
    border-color: var(--cyan);
    color: var(--cyan);
}

/* ── macOS TestFlight ── */

.setup-mac-steps {
    margin: 0 0 16px 20px;
    padding: 0;
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.8;
}

.setup-mac-config {
    margin-bottom: 16px;
}

.setup-testflight-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 16px 20px;
    border: 1px solid rgba(0, 212, 255, 0.4);
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.2), rgba(168, 85, 247, 0.12));
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition-fast);
}

.setup-testflight-btn:hover {
    transform: translateY(-1px);
    border-color: rgba(0, 212, 255, 0.6);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3), 0 0 20px rgba(0, 212, 255, 0.15);
}

/* ── Connection status checklist ── */

.setup-checklist {
    list-style: none;
    margin: 0;
    padding: 0;
}

.setup-check-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    font-size: 15px;
    color: var(--text-secondary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.setup-check-item:last-child {
    border-bottom: none;
}

.setup-check-icon {
    width: 22px;
    text-align: center;
    font-size: 15px;
    color: var(--text-muted);
}

.setup-check-item.is-ok .setup-check-icon {
    color: var(--green);
}

.setup-check-item.is-ok {
    color: var(--text-primary);
}

/* ── Mac option styles ── */

.setup-mac-option {
    margin-bottom: 4px;
}

.setup-option-label {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 6px;
}

.setup-config-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
}

.setup-action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.2);
    color: var(--text-primary);
    font: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
}

.setup-action-btn:hover {
    border-color: rgba(0, 212, 255, 0.35);
    background: rgba(0, 212, 255, 0.06);
}

.setup-action-btn svg {
    color: var(--cyan);
    flex-shrink: 0;
}

.setup-option-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 20px 0;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.setup-option-divider::before,
.setup-option-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
}

/* ── Right: contextual help panel ── */

.setup-help-panel {
    border-left: 1px solid rgba(255, 255, 255, 0.06);
    background:
        radial-gradient(circle at 80% 20%, rgba(168, 85, 247, 0.08), transparent 55%),
        linear-gradient(to bottom, rgba(5, 5, 8, 0.90), rgba(10, 10, 15, 0.84));
    overflow-y: auto;
    padding: 28px 20px;
}

.setup-help-content h3 {
    font-size: 15px;
    font-weight: 650;
    color: var(--text-primary);
    margin: 0 0 10px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.setup-help-content p {
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-secondary);
    margin: 0 0 10px;
}

.setup-help-content p:last-child {
    margin-bottom: 0;
}

.setup-help-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.06);
    margin: 18px 0;
}

/* ── Accordion (troubleshooting in help panel) ── */

.setup-accordion {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.setup-accordion-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 0;
    border: none;
    background: none;
    color: var(--text-primary);
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.setup-accordion-btn:hover {
    color: var(--cyan);
}

.setup-accordion-arrow {
    font-size: 11px;
    color: var(--text-muted);
    width: 14px;
    text-align: center;
    flex-shrink: 0;
}

.setup-accordion-body {
    display: none;
    padding: 6px 0 10px 22px;
}

.setup-accordion-body.is-open {
    display: block;
}

.setup-accordion-body p {
    font-size: 12px;
    line-height: 1.6;
    color: var(--text-secondary);
    margin: 0 0 6px;
}

.setup-accordion-body p:last-child {
    margin-bottom: 0;
}

.setup-accordion-body code {
    background: rgba(255, 255, 255, 0.08);
    padding: 2px 6px;
    border-radius: 6px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.9em;
    color: var(--green);
}

.setup-accordion-body .onboard-code {
    margin: 6px 0;
    font-size: 11px;
}

/* ── Responsive ── */

@media (max-width: 1200px) {
    .setup-shell {
        grid-template-columns: 1fr;
    }

    .setup-sidebar {
        display: none;
    }

    .setup-help-panel {
        display: none;
    }

    .setup-main {
        padding: 24px 16px;
    }
}

@media (max-width: 768px) {
    .setup-main {
        padding: 16px 12px;
    }

    .setup-platforms {
        flex-direction: column;
    }

    .setup-wizard-header h1 {
        font-size: 20px;
    }
}
