:root {
  --ink: #191d21; --ink2: #454c53; --mute: #6d757d; --paper: #f6f4ef; --panel: rgba(247, 245, 240, 0.93);
  --rule: rgba(20, 24, 28, 0.1); --accent: #b23a1e; --blue: #2f7de1;
  --sans: "Inter", "Helvetica Neue", Helvetica, "Segoe UI", system-ui, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --side-w: 328px; --info-w: 300px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #c9d6e0; color: var(--ink); font: 13px/1.45 var(--sans); -webkit-font-smoothing: antialiased; }
#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; }
button, select, input { font: inherit; color: inherit; }
kbd { font: 10px/1 var(--mono); padding: 2px 4px; border: 1px solid var(--rule); border-radius: 3px; background: rgba(255, 255, 255, 0.6); color: var(--mute); margin-left: 6px; }
h1, h2 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }

/* ---------- side panel ---------- */
#side { position: fixed; top: 12px; left: 12px; bottom: 12px; width: var(--side-w); display: flex; flex-direction: column; gap: 0;
  background: var(--panel); border: 1px solid var(--rule); border-radius: 10px; box-shadow: 0 10px 40px rgba(20, 30, 40, 0.16);
  backdrop-filter: blur(14px) saturate(1.1); -webkit-backdrop-filter: blur(14px) saturate(1.1); overflow: hidden auto; z-index: 5; scrollbar-width: thin; }
#side header { padding: 16px 16px 12px; border-bottom: 1px solid var(--rule); }
#side h1 { font-size: 19px; }
#side .sub { margin: 2px 0 0; color: var(--mute); font-size: 11.5px; }
#side .lede { margin: 10px 0 0; color: var(--ink2); font-size: 12.2px; }
#side section { padding: 12px 12px 10px; border-bottom: 1px solid var(--rule); }
#side h2 { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--mute); margin: 0 4px 8px; display: flex; justify-content: space-between; align-items: baseline; }
#side h2 small { font-weight: 400; text-transform: none; letter-spacing: 0; font-size: 10.5px; opacity: 0.85; }
#side footer { padding: 10px 16px 14px; color: var(--mute); font-size: 11px; margin-top: auto; }
#side footer p { margin: 0 0 6px; }
.prov-legend i, .facts i, .lbl em { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin: 0 4px 0 8px; vertical-align: 1px; }
i.pub, .facts i.pub { background: #2e9e5b; } i.approx, .facts i.approx { background: #d9941a; } i.demo, .facts i.demo { background: #8b8f94; }
.facts i { margin: 0 0 0 6px; font-style: normal; font-size: 9.5px; padding: 1px 6px 1px 14px; width: auto; height: auto; border-radius: 9px; color: #fff; line-height: 1.4; background-position: 5px center; background-repeat: no-repeat; background-size: 6px; }
.facts i.pub { background-color: #2e9e5b; } .facts i.approx { background-color: #d9941a; } .facts i.demo { background-color: #8b8f94; }

/* ---------- systems list ---------- */
.systems ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.sys { display: grid; grid-template-columns: 22px 1fr auto; align-items: center; gap: 6px; padding: 5px 6px; border-radius: 7px; transition: background 0.15s, opacity 0.2s; }
.sys:hover { background: rgba(20, 24, 28, 0.045); }
.sys.dim { opacity: 0.5; }
.sys.off { opacity: 0.42; }
.sys.off .sw { background: transparent; box-shadow: inset 0 0 0 2px var(--c); }
.sys.active { background: #fff; box-shadow: 0 0 0 1px var(--rule), 0 4px 14px rgba(20, 30, 40, 0.08); }
.sys .sw { width: 14px; height: 14px; border-radius: 50%; border: 0; background: var(--c); cursor: pointer; margin: 0 auto; padding: 0; }
.sys .meta { text-align: left; background: none; border: 0; padding: 0; cursor: pointer; min-width: 0; }
.sys .meta b { display: block; font-weight: 600; font-size: 12.8px; }
.sys .meta span { display: block; color: var(--mute); font-size: 11px; line-height: 1.35; }
.sys .iso { background: none; border: 1px solid var(--rule); border-radius: 6px; padding: 4px 8px; font-size: 11px; cursor: pointer; color: var(--ink2); white-space: nowrap; }
.sys .iso:hover { border-color: var(--ink); color: var(--ink); }
.sys.active .iso { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ---------- isolation banner ---------- */
.banner { margin: 10px 12px 0; padding: 10px; border-radius: 8px; background: #fff; border: 1px solid var(--rule); box-shadow: 0 4px 16px rgba(20, 30, 40, 0.08); }
.banner[hidden] { display: none; }
.banner .b-t { display: flex; align-items: center; gap: 8px; font-size: 12.5px; margin-bottom: 8px; }
.banner .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--blue); }
.banner .primary { width: 100%; background: var(--ink); color: #fff; border: 0; border-radius: 6px; padding: 8px 10px; cursor: pointer; font-weight: 600; font-size: 12.5px; display: flex; justify-content: center; align-items: center; }
.banner .primary:hover { background: #000; }
.banner .primary kbd { color: #cfd3d7; border-color: rgba(255, 255, 255, 0.25); background: rgba(255, 255, 255, 0.08); }
.banner .b-c { margin-top: 8px; font-size: 11px; color: var(--mute); line-height: 2; }
.banner .b-c button, .chips button { border: 1px solid var(--rule); background: #fff; border-radius: 10px; padding: 1px 8px 1px 6px; font-size: 11px; cursor: pointer; margin: 0 3px 2px 0; }
.banner .b-c button::before, .chips button::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--c); margin-right: 5px; }
.banner .b-c button:hover, .chips button:hover { border-color: var(--ink); }

/* ---------- tools ---------- */
.tool { display: flex; align-items: center; gap: 8px; padding: 4px 4px; }
.tool label { min-width: 74px; color: var(--ink2); }
.tool input[type=range] { flex: 1; accent-color: var(--ink); min-width: 0; }
.tool output { font: 11px var(--mono); color: var(--mute); min-width: 48px; text-align: right; }
.tool select { border: 1px solid var(--rule); border-radius: 6px; padding: 3px 6px; background: #fff; }
.chk { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; min-width: 0 !important; }
.chk input { accent-color: var(--ink); margin: 0; }
.tool.checks { flex-wrap: wrap; gap: 6px 14px; padding-top: 6px; }
.seg { display: inline-flex; border: 1px solid var(--rule); border-radius: 6px; overflow: hidden; margin-left: auto; }
.seg button { border: 0; background: #fff; padding: 3px 9px; font-size: 11px; cursor: pointer; color: var(--ink2); }
.seg button + button { border-left: 1px solid var(--rule); }
.seg button.on { background: var(--ink); color: #fff; }

/* ---------- camera presets ---------- */
#views { position: fixed; left: calc(var(--side-w) + 28px); right: calc(var(--info-w) + 28px); bottom: 14px; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; z-index: 5; pointer-events: none; }
.pill { pointer-events: auto; border: 1px solid var(--rule); background: var(--panel); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-radius: 16px; padding: 5px 11px; font-size: 11.5px; cursor: pointer; color: var(--ink2); box-shadow: 0 2px 10px rgba(20, 30, 40, 0.08); }
.pill:hover { color: var(--ink); border-color: var(--ink); }
.pill.ride { background: var(--ink); color: #fff; border-color: var(--ink); }
.pill.ride.on { background: var(--blue); border-color: var(--blue); }
.banner .b-f { margin-top: 6px; line-height: 1.6; }
.banner .b-f i { display: inline-block; width: 14px; height: 4px; border-radius: 2px; background: var(--c); margin: 0 5px 0 10px; vertical-align: 2px; }
.chips button.ride-t { padding-left: 8px; }

/* ---------- info panel ---------- */
#info { position: fixed; top: 12px; right: 12px; bottom: 12px; width: var(--info-w); display: flex; flex-direction: column; gap: 10px; overflow: hidden auto; z-index: 5; scrollbar-width: thin; pointer-events: none; }
.card { pointer-events: auto; background: var(--panel); border: 1px solid var(--rule); border-radius: 10px; padding: 12px 14px; box-shadow: 0 10px 40px rgba(20, 30, 40, 0.14); backdrop-filter: blur(14px) saturate(1.1); -webkit-backdrop-filter: blur(14px) saturate(1.1); }
.card h2 { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--mute); margin-bottom: 8px; display: flex; justify-content: space-between; align-items: baseline; }
.card h2 small { font-weight: 400; text-transform: none; letter-spacing: 0; font-size: 10.5px; }
.card h2 i { font-style: normal; font-size: 9.5px; padding: 1px 7px; border-radius: 9px; color: #fff; letter-spacing: 0; text-transform: none; }
.card h2 i.pub { background: #2e9e5b; } .card h2 i.approx { background: #d9941a; }
.hint { margin: 0 0 6px; color: var(--ink2); font-size: 12px; }
.where { margin: 0 0 8px; color: var(--ink2); font-size: 12px; }
.card dl { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; margin: 0 0 8px; font-size: 12px; }
.card dt { color: var(--mute); } .card dd { margin: 0; }
.levels { list-style: none; margin: 0; padding: 0; font-size: 11.5px; }
.levels li { display: grid; grid-template-columns: 34px 1fr auto; gap: 6px; padding: 2px 6px; border-radius: 4px; cursor: pointer; }
.levels li:hover { background: #fff; box-shadow: 0 0 0 1px var(--rule); }
.levels b { font: 600 11px var(--mono); } .levels span { color: var(--ink2); } .levels em { font: normal 10.5px var(--mono); color: var(--mute); }
.facts { list-style: none; margin: 0; padding: 0; font-size: 11.5px; }
.facts li { padding: 4px 0; border-top: 1px solid var(--rule); }
.facts li:first-child { border-top: 0; }
.facts .k { display: block; color: var(--mute); font-size: 10.5px; }
.facts .v { font-weight: 600; }
.src { margin: 8px 0 0; font-size: 10.5px; color: var(--mute); line-height: 1.5; }
.src a { color: var(--blue); }

/* ---------- labels ---------- */
#labels { position: fixed; inset: 0; pointer-events: none; z-index: 4; overflow: hidden; }
.lbl { position: absolute; left: 0; top: 0; pointer-events: auto; cursor: pointer; white-space: nowrap; padding: 3px 8px 3px 7px; border-radius: 6px; background: rgba(25, 29, 33, 0.84); color: #fff; font-size: 11px; line-height: 1.3; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25); will-change: transform; margin: -14px 0 0 10px; }
.lbl::before { content: ""; position: absolute; left: -10px; top: 14px; width: 10px; height: 1px; background: rgba(25, 29, 33, 0.84); }
.lbl i { position: absolute; left: -14px; top: 11px; width: 7px; height: 7px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.9); }
.lbl b { font-weight: 600; } .lbl span { display: block; color: rgba(255, 255, 255, 0.72); font-size: 10px; }
.lbl em { font-style: normal; font-size: 9px; margin-left: 6px; }
.lbl:hover { background: #000; }

/* ---------- loading ---------- */
#loading { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; background: linear-gradient(#dfe8ee, #c3d1dc); transition: opacity 0.5s; }
#loading.done { opacity: 0; pointer-events: none; }
#loading .box { text-align: center; width: min(360px, 80vw); }
#loading .t { font-size: 26px; font-weight: 650; letter-spacing: -0.02em; }
#loading .s { color: var(--ink2); margin: 4px 0 18px; }
#loading .bar { height: 3px; background: rgba(20, 24, 28, 0.12); border-radius: 2px; overflow: hidden; }
#loading .bar i { display: block; height: 100%; width: 0; background: var(--ink); transition: width 0.25s; }
#loadmsg { margin-top: 8px; font: 11px var(--mono); color: var(--mute); }

body.no-ui #side, body.no-ui #info, body.no-ui #views, body.no-ui #labels { display: none; }

@media (max-width: 1100px) { :root { --side-w: 290px; --info-w: 250px; } .card.facts-card { display: none; } }
@media (max-width: 820px) {
  #info { display: none; } #views { right: 12px; left: 12px; bottom: 8px; }
  #side { width: min(320px, 86vw); }
}
