:root {
  --bg: #05070c;
  --ink: #e9edf2;
  --ink-2: #aab3bf;
  --ink-3: #6f7a88;
  --amber: #ffb547;
  --amber-2: #ff8a2a;
  --cyan: #5cc8ff;
  --red: #ff4a3d;
  --green: #4fe08a;
  --glass: rgba(10, 14, 20, 0.62);
  --glass-2: rgba(18, 24, 33, 0.78);
  --line: rgba(255, 255, 255, 0.09);
  --line-2: rgba(255, 255, 255, 0.16);
  --sans: "SF Pro Display", "SF Pro Text", -apple-system, "Segoe UI Variable", "Segoe UI", Inter, Roboto, system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --r: 14px;
  --gut: 20px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font-family: var(--sans); overflow: hidden; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
button:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }

#gl { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; touch-action: none; outline: none; }

.ui { transition: opacity .6s ease, transform .6s cubic-bezier(.2,.8,.2,1); }
body.film .ui.hide-in-film, body.ui-hidden .ui { opacity: 0; pointer-events: none; }

/* ---------- top bar ---------- */
#topbar {
  position: fixed; top: 0; left: 0; right: 0; height: 64px; display: flex; align-items: center; gap: 16px;
  padding: 0 var(--gut); z-index: 20;
  background: linear-gradient(to bottom, rgba(3,5,9,.75), rgba(3,5,9,0));
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark { width: 18px; height: 18px; border-radius: 50%; position: relative;
  background: radial-gradient(circle at 50% 50%, #fff 0 12%, var(--cyan) 13% 30%, transparent 31%),
              conic-gradient(from 0deg, var(--amber) 0 60deg, transparent 60deg 120deg, var(--amber) 120deg 180deg, transparent 180deg 240deg, var(--amber) 240deg 300deg, transparent 300deg);
  box-shadow: 0 0 14px rgba(92,200,255,.5); }
.brand-name { font-weight: 800; letter-spacing: .28em; font-size: 14px; }
#modes { margin: 0 auto; display: flex; gap: 2px; padding: 4px; border-radius: 999px; background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
#modes button { padding: 8px 16px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--ink-2); letter-spacing: .01em; transition: background .25s, color .25s; }
#modes button:hover { color: var(--ink); }
#modes button.on { background: var(--ink); color: #0a0d12; }
.top-right { display: flex; gap: 8px; align-items: center; }
.icon-btn { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); color: var(--ink-2); }
.icon-btn:hover { color: var(--ink); border-color: var(--line-2); }
.icon-btn.text { width: auto; padding: 0 12px; border-radius: 999px; font-family: var(--mono); font-size: 11px; letter-spacing: .08em; }
.icon-btn svg { width: 16px; height: 16px; }

/* ---------- HUD ---------- */
#hud { position: fixed; left: var(--gut); top: 84px; width: 360px; z-index: 10; pointer-events: none; }
.kicker { font-family: var(--mono); font-size: 10.5px; letter-spacing: .14em; color: var(--amber); text-transform: uppercase; }
#hud h1 { margin: 8px 0 6px; font-size: 30px; line-height: 1.05; font-weight: 750; letter-spacing: -.02em; text-wrap: balance; }
.bignum { display: flex; align-items: baseline; gap: 10px; margin: 8px 0 4px; }
#hud-big { font-size: 64px; font-weight: 700; letter-spacing: -.04em; font-variant-numeric: tabular-nums; line-height: 1; transition: color .4s; }
#hud-big-unit { font-family: var(--mono); font-size: 12px; color: var(--ink-2); }
#hud-desc { margin: 6px 0 14px; font-size: 13.5px; line-height: 1.45; color: var(--ink-2); max-width: 330px; text-wrap: pretty; }
#hud-stats { display: grid; grid-template-columns: minmax(64px, max-content) 1fr; gap: 5px 10px; margin: 0; font-family: var(--mono); font-size: 11.5px; }
#hud-stats dt { color: var(--ink-3); letter-spacing: .08em; }
#hud-stats dd { margin: 0; color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
#hud-stats .hot { color: #ff8a5c; } #hud-stats .cold { color: #7cc6ff; }
.tag { display: inline-block; padding: 1px 6px; border-radius: 4px; font-size: 10px; letter-spacing: .06em; margin-left: 6px; background: rgba(79,224,138,.14); color: var(--green); }
.tag.warn { background: rgba(255,181,71,.15); color: var(--amber); }
.tag.bad { background: rgba(255,74,61,.18); color: var(--red); }

/* ---------- right panel ---------- */
#panel {
  position: fixed; right: var(--gut); top: 84px; width: 300px; max-height: calc(100vh - 170px); overflow: auto; z-index: 12;
  background: var(--glass); border: 1px solid var(--line); border-radius: var(--r); backdrop-filter: blur(18px) saturate(1.2); -webkit-backdrop-filter: blur(18px) saturate(1.2);
  padding: 14px; scrollbar-width: thin;
}
#panel:empty { display: none; }
#panel.hidden, #card.hidden { opacity: 0; transform: translateX(16px); pointer-events: none; }
.p-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.p-title { font-family: var(--mono); font-size: 10.5px; letter-spacing: .14em; color: var(--ink-3); text-transform: uppercase; }
.p-sec { padding: 12px 0; border-top: 1px solid var(--line); }
.p-sec:first-of-type { border-top: 0; padding-top: 2px; }
.p-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12.5px; color: var(--ink-2); margin: 6px 0; }
.p-row b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; font-family: var(--mono); font-size: 12px; }
.p-note { font-size: 11.5px; color: var(--ink-3); line-height: 1.45; margin: 6px 0 0; }
.partlist { display: grid; gap: 2px; }
.partlist button { text-align: left; padding: 8px 10px; border-radius: 8px; font-size: 13px; color: var(--ink-2); display: flex; justify-content: space-between; align-items: center; }
.partlist button:hover, .partlist button.on { background: rgba(255,255,255,.06); color: var(--ink); }
.partlist button .sys { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.partlist .grp { font-family: var(--mono); font-size: 10px; letter-spacing: .12em; color: var(--ink-3); padding: 10px 10px 4px; }

.slider-v { display: flex; gap: 14px; align-items: stretch; }
.vtrack { position: relative; width: 44px; height: 170px; border-radius: 12px; background: linear-gradient(to bottom, #0d1a2a, #10314f); border: 1px solid var(--line-2); overflow: hidden; touch-action: none; cursor: ns-resize; flex: none; }
.vtrack .vfill { position: absolute; left: 0; right: 0; top: 0; background: repeating-linear-gradient(to right, #2a2f36 0 5px, #1a1d22 5px 8px); border-bottom: 2px solid var(--amber); }
.vtrack .vknob { position: absolute; left: 4px; right: 4px; height: 14px; margin-top: -7px; border-radius: 4px; background: #f3f5f7; box-shadow: 0 2px 8px rgba(0,0,0,.6); }
.vside { display: flex; flex-direction: column; justify-content: space-between; min-width: 0; flex: 1; }
.vbig { font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.vbig small { font-size: 12px; color: var(--ink-3); font-weight: 500; margin-left: 4px; }

.hslider { width: 100%; -webkit-appearance: none; appearance: none; height: 4px; border-radius: 4px; background: rgba(255,255,255,.12); outline: none; margin: 8px 0 2px; }
.hslider::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--ink); box-shadow: 0 0 0 4px rgba(255,255,255,.08); cursor: pointer; }
.hslider::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: var(--ink); border: 0; cursor: pointer; }

.btn { padding: 9px 12px; border-radius: 10px; background: rgba(255,255,255,.07); border: 1px solid var(--line); font-size: 12.5px; font-weight: 600; color: var(--ink); transition: background .2s, border-color .2s; }
.btn:hover { background: rgba(255,255,255,.12); border-color: var(--line-2); }
.btn.on { background: var(--ink); color: #0a0d12; }
.btn-row { display: flex; gap: 6px; flex-wrap: wrap; }
.btn-row .btn { flex: 1; }
.scram { width: 100%; padding: 13px; border-radius: 12px; font-weight: 800; letter-spacing: .2em; font-size: 13px; color: #fff; background: linear-gradient(#ff5a4a, #d02a1e); box-shadow: 0 6px 22px rgba(255,60,40,.35), inset 0 1px 0 rgba(255,255,255,.35); margin-top: 10px; }
.scram:active { transform: translateY(1px); }
.scram.tripped { background: #3a1512; color: #ff8a80; box-shadow: none; }
.toggle-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.toggle-grid button { padding: 8px 0; border-radius: 8px; border: 1px solid var(--line); font-family: var(--mono); font-size: 11px; color: var(--ink-3); }
.toggle-grid button.on { color: var(--green); border-color: rgba(79,224,138,.4); background: rgba(79,224,138,.08); }
.annun { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.annun div { font-family: var(--mono); font-size: 9px; letter-spacing: .06em; text-align: center; padding: 6px 2px; border-radius: 5px; background: rgba(255,255,255,.03); color: #3e4652; border: 1px solid rgba(255,255,255,.04); line-height: 1.2; }
.annun div.on { color: #ffd0a0; background: rgba(255,138,42,.16); border-color: rgba(255,138,42,.45); }
.annun div.alarm { color: #fff; background: rgba(255,60,40,.5); border-color: #ff5a4a; animation: blink 0.8s steps(2) infinite; }
.annun div.ok { color: #b8ffd2; background: rgba(79,224,138,.12); border-color: rgba(79,224,138,.35); }
@keyframes blink { 50% { opacity: .45; } }
canvas.chart { width: 100%; height: 70px; display: block; border-radius: 8px; background: rgba(0,0,0,.25); }
.challenge { margin-top: 8px; padding: 10px; border-radius: 10px; background: rgba(255,181,71,.07); border: 1px solid rgba(255,181,71,.25); font-size: 12px; color: var(--ink-2); line-height: 1.45; }
.challenge .big { font-family: var(--mono); font-size: 22px; color: var(--ink); }

/* ---------- x-ray + camera chips ---------- */
#xray, #cammode { position: fixed; bottom: 24px; z-index: 12; display: flex; gap: 2px; padding: 4px; border-radius: 999px; background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); align-items: center; }
#xray { left: var(--gut); }
#cammode { left: 50%; transform: translateX(-50%); }
.xray-label { font-family: var(--mono); font-size: 10px; letter-spacing: .14em; color: var(--ink-3); padding: 0 8px 0 10px; }
#xray button, #cammode button { padding: 7px 12px; border-radius: 999px; font-size: 12px; font-weight: 600; color: var(--ink-2); }
#xray button.on, #cammode button.on { background: rgba(255,255,255,.9); color: #0a0d12; }

/* ---------- info card ---------- */
#card {
  position: fixed; right: var(--gut); top: 84px; width: 340px; max-height: calc(100vh - 170px); overflow: auto; z-index: 14;
  background: var(--glass-2); border: 1px solid var(--line-2); border-radius: var(--r); backdrop-filter: blur(20px) saturate(1.3); -webkit-backdrop-filter: blur(20px) saturate(1.3);
  box-shadow: 0 30px 80px rgba(0,0,0,.5);
}
#card:empty { display: none; }
.card-top { padding: 16px 16px 0; }
.card-sys { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }
.card-sys i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.card-close { position: absolute; top: 12px; right: 12px; width: 28px; height: 28px; border-radius: 50%; color: var(--ink-3); font-size: 18px; line-height: 1; }
.card-close:hover { color: var(--ink); background: rgba(255,255,255,.08); }
#card h2 { margin: 8px 0 2px; font-size: 22px; letter-spacing: -.01em; }
.card-sub { color: var(--ink-2); font-size: 13px; margin: 0 0 12px; }
.card-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.card-stats div { background: rgba(8,11,16,.6); padding: 10px 12px; }
.card-stats b { display: block; font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.card-stats span { font-family: var(--mono); font-size: 9.5px; color: var(--ink-3); letter-spacing: .06em; text-transform: uppercase; }
.card-body { padding: 12px 16px 4px; font-size: 13.5px; line-height: 1.55; color: var(--ink-2); }
.card-body p { margin: 0 0 10px; }
.card-dyk { margin: 4px 16px 14px; padding: 10px 12px; border-left: 2px solid var(--amber); background: rgba(255,181,71,.06); font-size: 12.5px; color: var(--ink-2); line-height: 1.5; border-radius: 0 8px 8px 0; }
.card-dyk b { color: var(--amber); font-family: var(--mono); font-size: 10px; letter-spacing: .12em; display: block; margin-bottom: 3px; }
.card-nav { display: flex; justify-content: space-between; padding: 0 12px 12px; gap: 8px; }
.card-nav button { font-size: 12px; color: var(--ink-3); padding: 6px 8px; border-radius: 8px; }
.card-nav button:hover { color: var(--ink); background: rgba(255,255,255,.06); }

/* ---------- labels ---------- */
#leaders { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 5; }
#leaders line, #leaders polyline { stroke: rgba(255,255,255,.55); stroke-width: 1; fill: none; }
#labels { position: fixed; inset: 0; pointer-events: none; z-index: 6; }
.lbl { position: absolute; left: 0; top: 0; pointer-events: auto; cursor: pointer; transform: translate(-9999px, 0); white-space: nowrap; transition: opacity .35s; }
.lbl .t { font-family: var(--mono); font-size: 10.5px; letter-spacing: .12em; color: var(--ink); text-transform: uppercase; font-weight: 600; text-shadow: 0 1px 6px rgba(0,0,0,.9); }
.lbl .s { font-size: 11px; color: var(--ink-2); text-shadow: 0 1px 6px rgba(0,0,0,.9); }
.lbl:hover .t { color: var(--amber); }
.lbl.right { text-align: left; }
.lbl.left { text-align: right; }
.dot { position: absolute; width: 7px; height: 7px; margin: -3.5px 0 0 -3.5px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 3px rgba(255,255,255,.18), 0 0 10px rgba(255,255,255,.6); transform: translate(-9999px, 0); }

/* ---------- letterbox, captions, titles ---------- */
.letterbox { position: fixed; left: 0; right: 0; height: 0; background: #000; z-index: 30; transition: height 1.2s cubic-bezier(.6,0,.2,1); pointer-events: none; }
#lb-top { top: 0; } #lb-bot { bottom: 0; }
body.letterbox-on .letterbox { height: 9vh; }
#caption { position: fixed; left: 50%; bottom: 13vh; transform: translateX(-50%); z-index: 31; max-width: min(760px, 88vw); text-align: center; pointer-events: none; }
#caption span { display: inline; font-size: clamp(15px, 1.6vw, 21px); line-height: 1.5; font-weight: 500; color: #fff; text-shadow: 0 2px 12px rgba(0,0,0,.9), 0 0 2px rgba(0,0,0,.8); opacity: 0; transition: opacity .5s; text-wrap: balance; }
#caption span.on { opacity: 1; }
#caption b { color: var(--amber); font-weight: 650; }
body:not(.letterbox-on) #caption { bottom: 96px; }
#titlecard { position: fixed; inset: 0; display: grid; place-content: center; text-align: center; z-index: 32; pointer-events: none; opacity: 0; transition: opacity 1.2s; }
#titlecard.on { opacity: 1; }
.tc-kicker { font-family: var(--mono); font-size: 12px; letter-spacing: .4em; color: var(--amber); margin-bottom: 14px; }
.tc-title { font-size: clamp(40px, 7vw, 104px); font-weight: 800; letter-spacing: -.035em; line-height: .95; text-shadow: 0 10px 50px rgba(0,0,0,.6); }
.tc-sub { margin-top: 16px; font-size: clamp(14px, 1.4vw, 18px); color: var(--ink-2); }

/* ---------- timeline ---------- */
#timeline { position: fixed; left: 50%; bottom: 2.2vh; transform: translateX(-50%); width: min(980px, 92vw); z-index: 33; display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: 999px; background: rgba(0,0,0,.35); border: 1px solid var(--line); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); opacity: 0; pointer-events: none; }
body.film #timeline { opacity: .35; pointer-events: auto; }
body.film #timeline:hover, body.film.paused #timeline { opacity: 1; }
#tl-track { position: relative; flex: 1; height: 26px; cursor: pointer; }
#tl-track::before { content: ""; position: absolute; left: 0; right: 0; top: 12px; height: 2px; background: rgba(255,255,255,.15); border-radius: 2px; }
#tl-fill { position: absolute; left: 0; top: 12px; height: 2px; background: var(--amber); width: 0; border-radius: 2px; }
#tl-head { position: absolute; top: 7px; width: 12px; height: 12px; margin-left: -6px; border-radius: 50%; background: #fff; box-shadow: 0 0 12px rgba(255,181,71,.8); }
#tl-chapters { position: absolute; inset: 0; }
#tl-chapters i { position: absolute; top: 9px; width: 2px; height: 8px; background: rgba(255,255,255,.45); }
#tl-chapters i span { position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); font-style: normal; font-size: 10.5px; white-space: nowrap; color: var(--ink-2); opacity: 0; transition: opacity .2s; background: rgba(0,0,0,.7); padding: 3px 7px; border-radius: 6px; pointer-events: none; }
#tl-chapters i:hover span { opacity: 1; }
#tl-time { font-family: var(--mono); font-size: 11px; color: var(--ink-2); min-width: 72px; text-align: right; }
.pill { padding: 6px 12px; border-radius: 999px; font-size: 12px; font-weight: 600; background: rgba(255,255,255,.1); }
.pill:hover { background: rgba(255,255,255,.2); }

/* ---------- toast, scale bar, hint ---------- */
#toast { position: fixed; top: 76px; left: 50%; transform: translate(-50%, -10px); z-index: 40; padding: 10px 16px; border-radius: 12px; background: var(--glass-2); border: 1px solid var(--line-2); font-size: 13px; opacity: 0; transition: opacity .4s, transform .4s; pointer-events: none; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); max-width: 90vw; text-align: center; }
#toast.on { opacity: 1; transform: translate(-50%, 0); }
#toast.alarm { border-color: rgba(255,74,61,.6); background: rgba(60,10,8,.85); }
#scalebar { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); z-index: 9; text-align: center; opacity: 0; transition: opacity .6s; pointer-events: none; }
#scalebar.on { opacity: 1; }
body.letterbox-on #scalebar { bottom: calc(13vh + 78px); }
.sb-line { width: 120px; height: 8px; margin: 0 auto 6px; border: 1px solid rgba(255,255,255,.7); border-top: 0; }
.sb-text { font-family: var(--mono); font-size: 13px; letter-spacing: .06em; }
.sb-stage { font-family: var(--mono); font-size: 10px; color: var(--amber); letter-spacing: .16em; margin-top: 4px; text-transform: uppercase; }
#hint { font-size: 12px; line-height: 18px; color: var(--ink-3); pointer-events: none; white-space: nowrap; overflow: hidden; max-width: calc(50vw - 264px); }   /* one line that never reaches the centred Orbit/Fly toggle */
#hint.nofit { display: none; }
#hint kbd { font-family: var(--mono); font-size: 10.5px; padding: 1px 5px; border-radius: 4px; border: 1px solid var(--line-2); color: var(--ink-2); }

/* ---------- start screen ---------- */
#start { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: radial-gradient(1200px 700px at 50% 60%, rgba(30,60,90,.35), transparent 70%), radial-gradient(800px 400px at 50% 110%, rgba(255,140,50,.18), transparent 70%), #04060a; transition: opacity 1.4s ease, visibility 1.4s; }
#start.gone { opacity: 0; visibility: hidden; }
.start-inner { width: min(860px, 92vw); text-align: center; }
.start-kicker { font-family: var(--mono); font-size: 11px; letter-spacing: .42em; color: var(--amber); }
.start-title { display: inline-block; white-space: nowrap; font-size: clamp(54px, 11vw, 132px); font-weight: 850; letter-spacing: .06em; margin: 10px 0 6px; padding: 0 .08em; line-height: 1; background: linear-gradient(180deg, #fff 30%, #8fb7d8); -webkit-background-clip: text; background-clip: text; color: transparent; text-shadow: 0 0 80px rgba(92,200,255,.25); }
.start-sub { color: var(--ink-2); font-size: clamp(14px, 1.6vw, 17px); line-height: 1.55; margin: 0 auto 26px; max-width: 520px; text-wrap: balance; }
.start-progress { height: 2px; width: 220px; margin: 0 auto 10px; background: rgba(255,255,255,.1); border-radius: 2px; overflow: hidden; }
#start-bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--cyan), var(--amber)); transition: width .3s; }
#start-status { font-family: var(--mono); font-size: 11px; color: var(--ink-3); letter-spacing: .08em; min-height: 16px; margin-bottom: 26px; }
.start-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.cta { padding: 14px 24px; border-radius: 999px; background: var(--ink); color: #06080c; font-weight: 700; font-size: 15px; display: inline-flex; gap: 10px; align-items: center; transition: transform .2s, opacity .3s, box-shadow .3s; box-shadow: 0 10px 40px rgba(255,255,255,.12); }
.cta span { font-family: var(--mono); font-size: 11px; opacity: .55; font-weight: 500; }
.cta.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line-2); box-shadow: none; }
.cta:hover:not(:disabled) { transform: translateY(-1px); }
.cta:disabled { opacity: .3; cursor: default; }
.start-foot { margin-top: 28px; font-size: 11.5px; color: var(--ink-3); }

/* ---------- mode visibility ---------- */
body.film #panel, body.film #xray, body.film #cammode, body.film #hint, body.film #card { opacity: 0; pointer-events: none; }
body.film #hud { opacity: 0; }
body.film.show-hud #hud { opacity: 1; }
/* in the film the HUD sits below the letterbox bar and stays compact */
body.film #hud { top: calc(9vh + 22px); }
body.film #hud-title, body.film #hud-desc { display: none; }
body.film .bignum { margin-top: 6px; }
body.film #topbar { opacity: 0; pointer-events: none; }
body.film.paused #topbar, body.film #topbar:hover { opacity: 1; pointer-events: auto; }
body.atom #xray, body.atom #cammode { opacity: 0; pointer-events: none; }
body.atom .bignum, body.atom #hud-stats { display: none; }

/* ---------- mobile ---------- */
@media (max-width: 820px) {
  :root { --gut: 14px; }
  #topbar { height: auto; padding-top: max(10px, env(safe-area-inset-top)); flex-wrap: wrap; gap: 8px; }
  #modes { order: 3; width: 100%; overflow-x: auto; justify-content: space-between; }
  #modes button { padding: 7px 10px; font-size: 12px; flex: 1; }
  #hud { top: 104px; width: calc(100vw - 28px); }
  #hud h1 { font-size: 20px; }
  #hud-big { font-size: 40px; }
  #hud-desc { display: none; }
  #hud-stats { grid-template-columns: minmax(54px, max-content) 1fr; font-size: 10.5px; gap: 3px 8px; }
  #panel, #card { top: auto; bottom: 68px; right: 14px; left: 14px; width: auto; max-height: 46vh; }
  #panel { transition: max-height .4s ease, opacity .6s, transform .6s; }
  #panel.collapsed { max-height: 44px; overflow: hidden; }
  #panel .p-head { cursor: pointer; }
  #panel .p-head::after { content: "▾"; color: var(--ink-3); font-size: 12px; margin-left: 8px; }
  #panel.collapsed .p-head::after { content: "▴"; }
  #xray { bottom: 14px; left: 14px; right: auto; overflow-x: auto; max-width: calc(100vw - 28px); }
  .xray-label { display: none; }
  #cammode { display: none; }
  #hint { display: none; }
  .lbl .s { display: none; }
  #caption { bottom: 12vh; }
}
@media (max-width: 820px) and (orientation: portrait) {
  body.letterbox-on .letterbox { height: 6vh; }
  body.film #hud { top: calc(6vh + 14px); }
}
@media (prefers-reduced-motion: reduce) {
  .ui, .letterbox, #titlecard { transition: none; }
}

/* ---------- export dialog ---------- */
.modal { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; background: rgba(2,4,8,.55); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); transition: opacity .3s; }
.modal.hidden { opacity: 0; pointer-events: none; }
.modal.rendering { background: rgba(2,4,8,.15); backdrop-filter: none; -webkit-backdrop-filter: none; place-items: end center; padding-bottom: 4vh; }
.modal-card { position: relative; width: min(560px, 92vw); max-height: 88vh; overflow: auto; background: var(--glass-2); border: 1px solid var(--line-2); border-radius: 18px; padding: 22px 22px 18px; box-shadow: 0 40px 100px rgba(0,0,0,.6); backdrop-filter: blur(20px) saturate(1.3); -webkit-backdrop-filter: blur(20px) saturate(1.3); }
.modal-card h2 { margin: 6px 0 6px; font-size: 24px; letter-spacing: -.01em; }
.modal-sub { color: var(--ink-2); font-size: 13.5px; line-height: 1.55; margin: 0 0 14px; }
.modal-sub b { color: var(--ink); }
.modal-grid { display: grid; grid-template-columns: 92px 1fr; gap: 10px 12px; align-items: center; margin: 6px 0 12px; font-size: 12.5px; color: var(--ink-3); }
.modal-grid .btn-row .btn { flex: 0 1 auto; }
.modal-actions { justify-content: flex-end; margin-top: 14px; }
.modal-actions .btn, .modal-actions .cta { flex: 0 0 auto; }
.modal-actions .cta { padding: 11px 20px; font-size: 14px; }
.ex-bar { height: 6px; border-radius: 6px; background: rgba(255,255,255,.1); overflow: hidden; margin: 14px 0 10px; }
#ex-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--cyan), var(--amber)); transition: width .3s; }
@media (max-width: 820px) { .modal-grid { grid-template-columns: 1fr; gap: 4px; } }

.start-lang { margin-top: 14px; display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px; border: 1px solid var(--line); }
.start-lang button { padding: 5px 12px; border-radius: 999px; font-size: 12px; color: var(--ink-3); }
.start-lang button.on { background: rgba(255,255,255,.12); color: var(--ink); }
.cta b { font-weight: 700; }

/* ---------- guided tours ---------- */
.tour-card { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: rgba(255,255,255,.03); }
.tour-card + .tour-card { margin-top: 10px; }
.tour-art { height: 92px; background: #061223; border-bottom: 1px solid var(--line); }
.tour-art svg { display: block; width: 100%; height: 100%; }
.tour-meta { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 12px 12px 0; }
.tour-meta b { font-size: 15px; font-weight: 700; letter-spacing: -.005em; }
.tour-meta span { font-family: var(--mono); font-size: 10.5px; color: var(--ink-3); white-space: nowrap; }
.tour-card p { margin: 6px 12px 12px; font-size: 12.5px; line-height: 1.5; color: var(--ink-2); text-wrap: pretty; }
.tour-go { display: block; width: calc(100% - 24px); margin: 0 12px 12px; background: var(--ink); color: #0a0d12; border-color: transparent; }
.tour-go:hover { background: #fff; }
.tour-link { width: 100%; text-align: left; background: rgba(255,181,71,.08); border-color: rgba(255,181,71,.3); color: var(--amber); }
.tour-link:hover { background: rgba(255,181,71,.14); border-color: rgba(255,181,71,.5); }
.start-tour { margin-top: 18px; font-size: 13.5px; color: var(--ink-2); padding: 6px 10px; border-radius: 8px; transition: color .2s, opacity .3s; }
.start-tour b { color: var(--amber); font-weight: 650; }
.start-tour:hover:not(:disabled) { color: var(--ink); }
.start-tour:disabled { opacity: .3; cursor: default; }
@media (max-width: 820px) {
  #modes { justify-content: flex-start; scrollbar-width: none; }
  #modes::-webkit-scrollbar { display: none; }
  #modes button { flex: 1 0 auto; padding: 7px 9px; }
  .tour-art { height: 70px; }
  .tour-card p { font-size: 12px; margin-bottom: 10px; }
}

/* ---------- tour browser (centred overlay) ---------- */
#tours {
  position: fixed; inset: 0; z-index: 16; display: grid; place-items: center; padding: 92px 32px 36px; overflow-y: auto;
  background: radial-gradient(1200px 680px at 50% 48%, rgba(4,7,12,.38), rgba(3,5,9,.86) 74%);
  backdrop-filter: blur(4px) saturate(1.1); -webkit-backdrop-filter: blur(4px) saturate(1.1);
  opacity: 0; pointer-events: none; transition: opacity .45s ease; scrollbar-width: thin;
}
#tours.on { opacity: 1; pointer-events: auto; }
.tours-inner { width: min(1200px, 100%); transform: translateY(14px); transition: transform .7s cubic-bezier(.2,.8,.2,1); }
#tours.on .tours-inner { transform: none; }
.tours-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.tours-kicker { font-family: var(--mono); font-size: 11px; letter-spacing: .22em; color: var(--amber); }
.tours-head h2 { margin: 10px 0 8px; font-size: clamp(32px, 3.6vw, 50px); font-weight: 700; letter-spacing: -.028em; line-height: 1; }
.tours-head p { margin: 0; max-width: 600px; font-size: 15px; line-height: 1.5; color: var(--ink-2); text-wrap: pretty; }
.tours-close { flex: none; width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line-2); background: rgba(255,255,255,.04); font-size: 22px; line-height: 1; color: var(--ink-2); transition: background .2s, color .2s, transform .3s; }
.tours-close:hover { background: rgba(255,255,255,.1); color: var(--ink); transform: rotate(90deg); }
.tours-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.tcard {
  position: relative; display: flex; flex-direction: column; text-align: left; padding: 0; border-radius: 20px; overflow: hidden; isolation: isolate;
  background: linear-gradient(180deg, rgba(22,28,38,.94), rgba(8,11,17,.96));
  border: 1px solid rgba(255,255,255,.09);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.07), 0 34px 70px -30px rgba(0,0,0,.9);
  transition: transform .5s cubic-bezier(.2,.8,.2,1), border-color .35s, box-shadow .5s;
  opacity: 0; animation: tcard-in .8s cubic-bezier(.2,.8,.2,1) forwards;
}
.tcard:nth-child(2) { animation-delay: .08s; }
.tcard:nth-child(3) { animation-delay: .16s; }
@keyframes tcard-in { from { opacity: 0; transform: translateY(22px); } to { opacity: 1; transform: none; } }
.tcard::before { content: ""; position: absolute; inset: 0 0 auto; height: 2px; z-index: 3; background: linear-gradient(90deg, transparent, var(--acc), transparent); opacity: .9; }
.tcard::after { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: 0; transition: opacity .5s;
  background: radial-gradient(460px 260px at 50% 0%, color-mix(in srgb, var(--acc) 24%, transparent), transparent 70%); }
.tcard:hover, .tcard:focus-visible { transform: translateY(-6px); border-color: color-mix(in srgb, var(--acc) 50%, transparent);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.09), 0 44px 80px -30px rgba(0,0,0,.95), 0 0 0 1px color-mix(in srgb, var(--acc) 18%, transparent); outline: none; }
.tcard:hover::after, .tcard:focus-visible::after { opacity: 1; }
.tcard-art { position: relative; display: block; aspect-ratio: 16 / 9; overflow: hidden; background: #061223; }
.tcard-art svg, .tcard-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 1.4s cubic-bezier(.2,.8,.2,1); }
.tcard:hover .tcard-art img, .tcard:focus-visible .tcard-art img { transform: scale(1.06); }
.tcard-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(8,11,17,.25), rgba(8,11,17,0) 30%, rgba(8,11,17,0) 55%, rgba(14,18,26,.96)); }
.tcard-top { position: absolute; top: 14px; left: 16px; right: 14px; z-index: 3; display: flex; justify-content: space-between; align-items: center; }
.tcard-num { font-family: var(--mono); font-size: 11px; letter-spacing: .16em; color: rgba(255,255,255,.8); text-shadow: 0 1px 6px rgba(0,0,0,.8); }
.tcard-tag { font-family: var(--mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--acc); padding: 5px 10px; border-radius: 999px;
  background: rgba(5,8,12,.62); border: 1px solid color-mix(in srgb, var(--acc) 38%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.tcard-body { position: relative; z-index: 2; flex: 1; display: flex; flex-direction: column; gap: 8px; padding: 0 22px 22px; margin-top: -30px; }
.tcard-title { font-size: 22px; font-weight: 700; letter-spacing: -.018em; line-height: 1.12; text-wrap: balance; }
.tcard-meta { font-family: var(--mono); font-size: 11px; letter-spacing: .05em; color: var(--ink-3); }
.tcard-desc { flex: 1; font-size: 13.5px; line-height: 1.58; color: var(--ink-2); text-wrap: pretty; }
.tcard-go { margin-top: 10px; display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-radius: 12px; font-size: 14px; font-weight: 600;
  color: #0a0d12; background: var(--ink); transition: background .3s, box-shadow .3s; }
.tcard-go i { font-style: normal; transition: transform .35s cubic-bezier(.2,.8,.2,1); }
.tcard:hover .tcard-go, .tcard:focus-visible .tcard-go { background: #fff; box-shadow: 0 8px 26px -10px color-mix(in srgb, var(--acc) 70%, transparent); }
.tcard:hover .tcard-go i, .tcard:focus-visible .tcard-go i { transform: translateX(5px); }
.tours-foot { margin-top: 24px; text-align: center; font-family: var(--mono); font-size: 11px; letter-spacing: .08em; color: var(--ink-3); }
body.tours-mode #hud, body.tours-mode #xray, body.tours-mode #cammode, body.tours-mode #hint, body.tours-mode #labels, body.tours-mode #leaders, body.tours-mode #card, body.tours-mode #panel { opacity: 0; pointer-events: none; }
@media (max-width: 1060px) {
  .tours-grid { grid-template-columns: 1fr; max-width: 600px; margin: 0 auto; }
  .tours-head { max-width: 600px; margin-left: auto; margin-right: auto; }
  .tcard-art { aspect-ratio: 2.4 / 1; }
}
@media (max-width: 820px) {
  #tours { place-items: start center; padding: 128px 14px 28px; }
  .tours-head { margin-bottom: 18px; gap: 12px; }
  .tours-head h2 { font-size: 30px; }
  .tours-head p { font-size: 13.5px; }
  .tours-grid { gap: 14px; }
  .tcard-body { padding: 0 16px 16px; margin-top: -22px; }
  .tcard-title { font-size: 19px; }
  .tcard-desc { font-size: 13px; }
  .tours-foot { display: none; }
}
@media (prefers-reduced-motion: reduce) { .tcard, .tours-inner { animation: none; opacity: 1; transform: none; transition: none; } }

/* ---------- bottom-right corner: controls hint + design credit ---------- */
#corner {
  position: fixed; right: var(--gut); bottom: 34px; z-index: 101;   /* above the start screen and the film letterbox */
  display: flex; align-items: flex-end; gap: 16px; pointer-events: none;
}
#credit {
  flex: none; font-family: var(--mono); font-size: 10px; letter-spacing: .16em; line-height: 18px; white-space: nowrap;
  color: var(--ink-3); text-decoration: none; pointer-events: auto; transition: color .2s, opacity .6s;
}
#credit:hover, #credit:focus-visible { color: var(--amber); }
#hint:empty { display: none; }
body:has(.modal:not(.hidden)) #hint, body:has(#start:not(.gone)) #hint { opacity: 0; }
body.film #corner { bottom: 7px; }              /* below the film timeline, on the letterbox */
@media (max-width: 820px) {
  #corner { right: 14px; bottom: max(5px, env(safe-area-inset-bottom)); }
  #credit { font-size: 9px; letter-spacing: .12em; line-height: 1; }
  #xray { bottom: 24px; }
}
