
    :root {
        --gold: #e8c47c;
        --gold-soft: rgba(232,196,124,.35);
        --panel: rgba(255,255,255,.03);
        --panel-border: rgba(255,255,255,.07);
        --txt-dim: rgba(255,255,255,.38);
        --txt-mid: rgba(255,255,255,.62);
        --danger: #ff7a6b;
        --ok: #6fd29b;
        --warn: #f0c674;
    }

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

    html, body { height: 100%; }

    body {
        overflow: hidden;
        background: #07080c;
        font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
        color: #fff;
        user-select: none;
    }

    #scene { position: fixed; inset: 0; }
    #scene canvas { display: block; }

    /* soft cinematic vignette */
    .vignette {
        position: fixed; inset: 0;
        pointer-events: none;
        background: radial-gradient(ellipse at 50% 42%, rgba(0,0,0,0) 55%, rgba(0,0,0,.42) 100%);
        z-index: 50;
    }

    /* ---------- Header ---------- */
    .header {
        position: fixed; top: 0; left: 0; right: 0;
        padding: 18px 32px;
        display: flex; justify-content: space-between; align-items: flex-start;
        gap: 16px;
        z-index: 100;
        background: linear-gradient(180deg, rgba(7,8,12,.94) 0%, rgba(7,8,12,0) 100%);
    }
    .brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
    .brand-mark {
        width: 38px; height: 38px; flex: none;
        background: linear-gradient(135deg, #e8c47c 0%, #c9a045 100%);
        border-radius: 7px;
        display: flex; align-items: center; justify-content: center;
        box-shadow: 0 2px 10px rgba(200,160,70,.35), inset 0 1px 0 rgba(255,255,255,.35);
    }
    .brand-mark svg { width: 21px; height: 21px; fill: #201a0e; }
    .brand-name { font-size: 1rem; font-weight: 650; letter-spacing: .3px; white-space: nowrap; }
    .brand-model {
        font-size: .68rem; color: var(--txt-dim); letter-spacing: 1.4px;
        text-transform: uppercase; margin-top: 2px; font-variant-numeric: tabular-nums;
    }

    .header-right { display: flex; align-items: center; gap: 26px; flex-wrap: wrap; justify-content: flex-end; }

    .status-pill {
        display: flex; align-items: center; gap: 8px;
        font-size: .68rem; letter-spacing: 1.2px; text-transform: uppercase;
        color: var(--txt-mid);
        background: var(--panel); border: 1px solid var(--panel-border);
        padding: 7px 13px; border-radius: 999px;
    }
    .status-dot { width: 8px; height: 8px; border-radius: 50%; background: #666; transition: background .3s, box-shadow .3s; }
    .status-dot.ready  { background: var(--ok);  box-shadow: 0 0 8px var(--ok); }
    .status-dot.warn   { background: var(--warn); box-shadow: 0 0 8px var(--warn); }
    .status-dot.danger { background: var(--danger); box-shadow: 0 0 8px var(--danger); animation: blink 1s ease infinite; }
    @keyframes blink { 50% { opacity: .35; } }

    .metrics { display: flex; gap: 24px; }
    .metric { text-align: right; }
    .metric-label {
        font-size: .62rem; color: var(--txt-dim);
        letter-spacing: .9px; text-transform: uppercase; margin-bottom: 3px;
    }
    .metric-value { font-size: 1.05rem; font-weight: 500; font-variant-numeric: tabular-nums; }
    .metric-value.accent { color: var(--gold); }
    .metric-value.hot { color: var(--danger); }
    .metric-unit { font-size: .72rem; color: rgba(255,255,255,.5); margin-left: 2px; font-weight: 400; }

    /* ---------- Info panel ---------- */
    .info-panel {
        position: fixed; left: 32px; top: 50%; transform: translateY(-50%);
        z-index: 100; width: 262px;
        max-height: calc(100vh - 160px);
        display: flex; flex-direction: column; gap: 12px;
        overflow-y: auto;
        overscroll-behavior: contain;
        scrollbar-width: thin;
        scrollbar-color: rgba(255,255,255,.18) transparent;
    }
    .info-title { font-size: 1.5rem; font-weight: 300; line-height: 1.25; }
    .info-subtitle { font-size: .78rem; color: var(--txt-mid); line-height: 1.55; margin-top: 8px; }

    .group {
        background: var(--panel);
        border: 1px solid var(--panel-border);
        border-radius: 10px;
        padding: 13px 14px;
        backdrop-filter: blur(6px);
    }
    .group-title {
        font-size: .62rem; color: var(--txt-dim); letter-spacing: 1.2px;
        text-transform: uppercase; margin-bottom: 8px;
        display: flex; justify-content: space-between; align-items: baseline;
    }
    .group-title .hint { color: rgba(255,255,255,.22); letter-spacing: .4px; }

    .spec-row {
        display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
        padding: 5.5px 0; border-bottom: 1px solid rgba(255,255,255,.045);
    }
    .spec-row:last-child { border-bottom: none; }
    .spec-name { font-size: .78rem; color: var(--txt-mid); }
    .spec-val { font-size: .78rem; font-weight: 520; color: #fff; text-align: right; }

    /* workload line */
    .workload-line {
        display: flex; justify-content: space-between; gap: 12px; align-items: baseline;
        font-size: .74rem; color: var(--txt-mid);
        padding-bottom: 9px; margin-bottom: 2px;
        border-bottom: 1px solid rgba(255,255,255,.045);
    }
    .workload-line .wl-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .workload-line .wl-pct { color: var(--gold); font-variant-numeric: tabular-nums; flex: none; }

    .tele-row { padding: 5px 0 7px; }
    .tele-top { display: flex; justify-content: space-between; align-items: baseline; font-size: .74rem; }
    .tele-top .tt-name { color: var(--txt-mid); }
    .tele-top .tt-val { color: #fff; font-variant-numeric: tabular-nums; }
    .bar { margin-top: 4px; height: 3px; background: rgba(255,255,255,.08); border-radius: 2px; overflow: hidden; }
    .bar-fill { height: 100%; width: 0%; background: linear-gradient(90deg, #c9a045, var(--gold)); border-radius: 2px; }
    .bar-fill.pwr { background: linear-gradient(90deg, #4a7fd6, #7fb3ff); }
    .trends { display: flex; gap: 10px; margin-top: 2px; }
    .trend { flex: 1; min-width: 0; }
    .trend-label { font-size: .58rem; color: var(--txt-dim); letter-spacing: .8px; text-transform: uppercase; margin-bottom: 2px; }
    .trend canvas { width: 100%; height: 30px; display: block; opacity: .9; }

    /* ---------- Right control panel ---------- */
    .control-panel {
        position: fixed; right: 32px; top: 50%; transform: translateY(-50%);
        z-index: 100; width: 186px;
        max-height: calc(100vh - 180px);
        display: flex; flex-direction: column; gap: 12px;
        overflow-y: auto;               /* keep every control reachable on short windows */
        overscroll-behavior: contain;
        scrollbar-width: thin;
        scrollbar-color: rgba(255,255,255,.18) transparent;
    }
    .control-group { padding: 12px; }
    .control-group-title {
        font-size: .62rem; color: var(--txt-dim); letter-spacing: 1.2px; text-transform: uppercase;
        margin-bottom: 9px; padding-left: 4px;
    }
    .control-btn {
        width: 100%;
        padding: 9px 11px;
        background: transparent;
        border: 1px solid rgba(255,255,255,.08);
        border-radius: 7px;
        color: var(--txt-mid);
        font-size: .74rem; font-family: inherit;
        cursor: pointer;
        transition: all .2s ease;
        text-align: left;
        margin-bottom: 5px;
        display: flex; align-items: center; gap: 8px;
    }
    .control-btn:last-child { margin-bottom: 0; }
    .control-btn:hover { background: rgba(255,255,255,.05); border-color: rgba(255,255,255,.16); color: #fff; }
    .control-btn:active { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.28); transform: scale(.985); }
    .control-btn.active:active { background: rgba(232,196,124,.18); }
    .control-btn.active { background: rgba(232,196,124,.09); border-color: var(--gold-soft); color: var(--gold); }
    .control-btn .icon { width: 16px; text-align: center; font-size: .86rem; flex: none; }
    .control-btn.danger.active { background: rgba(255,122,107,.1); border-color: rgba(255,122,107,.45); color: var(--danger); }

    .seg { display: flex; gap: 5px; }
    .seg .control-btn { margin-bottom: 0; justify-content: center; padding: 9px 4px; text-align: center; }

    /* ---------- Bottom nav ---------- */
    .controls {
        position: fixed; bottom: 0; left: 0; right: 0;
        padding: 18px 32px;
        display: flex; justify-content: center; gap: 8px; flex-wrap: wrap;
        z-index: 100;
        background: linear-gradient(0deg, rgba(7,8,12,.95) 0%, rgba(7,8,12,0) 100%);
    }
    .nav-link {
        padding: 9px 18px;
        background: transparent;
        border: 1px solid rgba(255,255,255,.12);
        border-radius: 6px;
        color: var(--txt-mid);
        font-size: .76rem;
        font-family: inherit;
        cursor: pointer;
        transition: all .22s ease;
        letter-spacing: .3px;
        text-decoration: none;
        display: inline-block;
    }
    .nav-link:hover {
        background: rgba(232,196,124,.12);
        border-color: var(--gold-soft);
        color: var(--gold);
        transform: translateY(-2px);
        box-shadow: 0 8px 20px rgba(0,0,0,.3);
    }
    .nav-link .nav-icon { margin-right: 6px; }

    /* ---------- Event feed (console) ---------- */
    #feed {
        position: fixed; bottom: 92px; left: 50%; transform: translateX(-50%);
        z-index: 90; width: min(560px, 70vw);
        display: flex; flex-direction: column; gap: 3px; align-items: center;
        pointer-events: none;
    }
    .feed-line {
        font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
        font-size: .66rem;
        color: rgba(255,255,255,.5);
        background: rgba(10,12,16,.55);
        border: 1px solid rgba(255,255,255,.06);
        border-radius: 4px;
        padding: 3px 10px;
        white-space: nowrap;
        backdrop-filter: blur(4px);
        animation: feedIn .3s ease;
        font-variant-numeric: tabular-nums;
    }
    .feed-line .t { color: rgba(255,255,255,.28); margin-right: 8px; }
    .feed-line.ok    { color: rgba(140,220,170,.8); }
    .feed-line.warn  { color: rgba(240,198,116,.85); }
    .feed-line.err   { color: rgba(255,122,107,.9); }
    .feed-line.info  { color: rgba(200,205,220,.75); }
    @keyframes feedIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

    /* ---------- Hover inspect ---------- */
    #hover-tip {
        position: fixed; z-index: 120; pointer-events: none;
        transform: translate(-50%, -130%);
        background: rgba(10,11,15,.82);
        border: 1px solid var(--gold-soft);
        border-radius: 8px;
        padding: 7px 11px;
        backdrop-filter: blur(8px);
        display: none;
        max-width: 260px;
        box-shadow: 0 6px 24px rgba(0,0,0,.5);
    }
    #hover-tip .tip-name { font-size: .74rem; font-weight: 600; color: var(--gold); letter-spacing: .3px; }
    #hover-tip .tip-spec { font-size: .68rem; color: var(--txt-mid); margin-top: 2px; line-height: 1.4; }
    #hover-tip .tip-live { font-size: .66rem; margin-top: 4px; line-height: 1.5; font-variant-numeric: tabular-nums; color: var(--txt-mid); border-top: 1px solid rgba(255,255,255,.07); padding-top: 3px; }
    #hover-tip .tip-live b { color: #fff; font-weight: 550; }
    #hover-tip .tip-live .hot { color: var(--danger); }
    #hover-tip.visible { display: block; }

    /* ---------- Boot ---------- */
    #boot {
        position: fixed; inset: 0; background: #06070b;
        display: flex; align-items: center; justify-content: center;
        z-index: 1000;
        transition: opacity .55s ease;
    }
    #boot.hidden { opacity: 0; pointer-events: none; }
    .boot-card { width: 420px; max-width: calc(100vw - 60px); }
    .boot-head { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; justify-content: center; }
    .boot-logo {
        width: 46px; height: 46px;
        background: linear-gradient(135deg, #e8c47c, #c9a045);
        border-radius: 9px;
        display: flex; align-items: center; justify-content: center;
        box-shadow: 0 0 26px rgba(200,160,70,.25);
        animation: spin 3.2s linear infinite;
    }
    .boot-logo svg { width: 24px; height: 24px; fill: #201a0e; }
    @keyframes spin { to { transform: rotate(360deg); } }
    .boot-title { font-size: .85rem; letter-spacing: .5px; font-weight: 550; text-align: left; }
    .boot-sub { font-size: .66rem; color: var(--txt-dim); letter-spacing: 1.6px; text-transform: uppercase; margin-top: 3px; }
    #boot-log {
        background: rgba(255,255,255,.025);
        border: 1px solid rgba(255,255,255,.06);
        border-radius: 8px;
        padding: 13px 15px;
        min-height: 164px;
        font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
        font-size: .7rem; line-height: 1.85;
        color: rgba(255,255,255,.55);
    }
    #boot-log .ln { white-space: nowrap; overflow: hidden; }
    #boot-log .st { color: var(--ok); margin-left: 6px; }
    .boot-progress { margin-top: 14px; display: flex; align-items: center; gap: 14px; }
    .boot-bar { flex: 1; height: 3px; background: rgba(255,255,255,.09); border-radius: 2px; overflow: hidden; }
    .boot-bar-fill { height: 100%; width: 0%; background: linear-gradient(90deg, #c9a045, var(--gold)); transition: width .2s ease; }
    .boot-pct { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .72rem; color: var(--gold); width: 38px; text-align: right; font-variant-numeric: tabular-nums; }

    /* ---------- Responsive ---------- */
    @media (max-width: 1240px) { .info-panel { width: 240px; } }
    @media (max-width: 1100px) {
        .control-panel { display: none; }
        .info-panel { left: 24px; }
    }
    @media (max-width: 860px) {
        .info-panel { display: none; }
        .metrics { gap: 14px; }
        .status-pill { display: none; }
    }
    @media (max-width: 600px) {
        .metrics { display: none; }
        .header, .controls { padding: 14px 18px; }
        .nav-link { padding: 8px 13px; font-size: .7rem; }
        #feed { bottom: 86px; }
    }
    /* Short windows: anchor the side panels in the gap between the header and
       the bottom nav (instead of centering), so every control stays reachable
       and never hides underneath the bottom nav bar. */
    @media (max-height: 760px) {
        .control-panel, .info-panel {
            top: 88px; bottom: 96px;
            transform: none;
            max-height: none;
        }
    }
    @media (max-height: 680px) {
        .control-panel { gap: 8px; }
        .control-group { padding: 8px 10px; }
        .control-group-title { margin-bottom: 5px; }
        .control-btn { padding: 6px 9px; margin-bottom: 3px; }
        .seg .control-btn { padding: 7px 4px; }
    }

    /* ---------- A11y & motion preferences ---------- */
    .control-btn:focus-visible,
    .nav-link:focus-visible {
        outline: 2px solid var(--gold-soft);
        outline-offset: 2px;
    }

    @media (prefers-reduced-motion: reduce) {
        .boot-logo { animation: none; }
        .status-dot.danger { animation: none; }
        .feed-line { animation: none; }
        .control-btn, .nav-link { transition: none; }
    }
