/* C-arm Dock game · mobile-first layout (game-design §4, §6). Colours on #0A1315: #DCE6E4 15:1, teal 7.4:1, #7F9896 6:1, orange 5.8:1. */
:root {
  --bg: #0A1315; --sheet: rgba(13, 24, 27, 0.92); --hair: #22373A; --line: #DCE6E4; --soft: #A9BDBB; --dim: #7F9896;
  --teal: #19B5B0; --orange: #EC6602; --asleep: #41595A;
  --top: calc(48px + env(safe-area-inset-top, 0px));
  --pl: max(16px, env(safe-area-inset-left, 0px)); --pr: max(16px, env(safe-area-inset-right, 0px)); --pb: max(16px, env(safe-area-inset-bottom, 0px));
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--line); overflow: hidden; overscroll-behavior: none; }
body { font: 400 1rem/1.35 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif; -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
#app { position: fixed; inset: 0; height: 100vh; height: 100dvh; overflow: hidden; }
#scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
body.park #scene { touch-action: none; cursor: grab; }
body.park #scene:active { cursor: grabbing; }
#poster { position: absolute; left: 0; right: 0; top: var(--top); height: 55%; width: 100%; object-fit: contain; pointer-events: none;
  transition: opacity .4s ease; user-select: none; -webkit-user-drag: none; }
body.ready #poster { opacity: 0; }
body.nogl #scene { background: var(--bg); }

/* top bar: chip top left, Restart top right (outside the thumb arc) */
#topbar { position: absolute; top: 0; left: 0; right: 0; height: var(--top); padding: env(safe-area-inset-top, 0px) var(--pr) 0 var(--pl);
  display: flex; align-items: center; justify-content: space-between; gap: 8px; z-index: 3; pointer-events: none; }
#topbar > * { pointer-events: auto; }
.chip { font: 600 0.8125rem/1 'Space Grotesk', 'Inter', sans-serif; letter-spacing: .04em; color: var(--soft); border: 1px solid #2C4447;
  border-radius: 999px; padding: 7px 12px; background: rgba(10, 19, 21, .7); white-space: nowrap; }
.restart { min-width: 48px; height: 48px; padding: 0 12px; margin-right: -8px; border: 0; background: transparent; color: var(--line);
  font: 600 1rem/1 'Inter', sans-serif; border-radius: 12px; cursor: pointer; white-space: nowrap; }
.restart:hover { background: rgba(220, 230, 228, .06); }

/* bottom HUD sheet (portrait) */
.hud { position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; background: var(--sheet); border-top: 1px solid var(--hair);
  border-radius: 16px 16px 0 0; padding: 14px var(--pr) var(--pb) var(--pl); display: flex; flex-direction: column; gap: 10px; max-height: 62%; }
.hud > * { width: 100%; max-width: 560px; margin-left: auto; margin-right: auto; }
.hud.twin { visibility: hidden; pointer-events: none; top: 0; bottom: auto; height: auto !important; max-height: none; right: auto; }
.hud-body { display: flex; flex-direction: column; gap: 8px; min-height: 0; overflow-y: auto; flex: 0 1 auto; }
.hud-actions { margin-top: auto; display: flex; flex-direction: column; gap: 8px; flex: none; }
.hud p { margin: 0; }
.main { font-size: 1rem; line-height: 1.35; color: var(--line); }
.main.dim { color: var(--dim); }
.small { font-size: 0.875rem; line-height: 1.35; color: var(--soft); }
.main strong { font-weight: 600; }

/* status pill: glyph + words + colour */
.pill { align-self: flex-start; width: auto !important; margin-left: 0 !important; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; max-width: 100%;
  padding: 5px 11px 5px 9px; letter-spacing: -0.01em; border-radius: 999px; border: 1.5px solid var(--soft); font: 600 1.125rem/1.2 'Space Grotesk', 'Inter', sans-serif; color: var(--line); }
.pill[hidden] { display: none; }
.pill .glyph { font-family: 'Inter', system-ui, sans-serif; font-size: 1rem; line-height: 1; width: 1em; text-align: center; flex: none; }
.pill.grey { border-color: var(--soft); }
.pill.orange { border-color: var(--orange); }
.pill.orange .glyph { color: var(--orange); }
.pill.teal { border-color: var(--teal); }
.pill.teal .glyph { color: var(--teal); }
.pill.fill { background: var(--teal); border-color: var(--teal); color: var(--bg); }
.hud > .pill { margin-left: max(0px, calc((100% - 560px) / 2)) !important; }
body.land .hud > .pill { margin-left: 0 !important; }

/* buttons: real <button>s with aria-disabled; ≥ 48 × 48, 8 px apart */
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.row.r1 { grid-template-columns: 1fr; }
.row.r3 { grid-template-columns: 1fr 1fr 1fr; }
.btn { min-height: 56px; min-width: 48px; padding: 6px 12px; border-radius: 12px; border: 1.5px solid var(--soft); background: transparent; color: var(--line);
  font: 600 1rem/1.2 'Inter', sans-serif; cursor: pointer; touch-action: manipulation; }
.row.sec .btn, .row.r3 .btn { min-height: 48px; }
.btn.pri { background: var(--teal); border-color: var(--teal); color: var(--bg); }
.btn[aria-disabled="true"] { background: transparent; border-color: var(--hair); color: var(--dim); cursor: default; }
.btn:not([aria-disabled="true"]):hover { border-color: var(--line); }
.btn.pri:not([aria-disabled="true"]):hover { background: #22C4BF; }
button:focus { outline: none; }
button:focus-visible, [tabindex="-1"]:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

/* compare */
.cmp-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.cmp-title { margin: 0; font: 600 1.125rem/1.25 'Space Grotesk', 'Inter', sans-serif; color: var(--line); }
.tag { font: 600 0.8125rem/1.2 'Inter', sans-serif; color: var(--soft); border: 1px solid #2C4447; border-radius: 999px; padding: 3px 9px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; flex: none; }
.segb { min-height: 48px; border: 1.5px solid #2C4447; border-radius: 12px; background: transparent; color: var(--soft); font: 600 1rem/1.2 'Inter', sans-serif; cursor: pointer; }
.segb[aria-pressed="true"] { background: #1A2C2F; color: var(--line); box-shadow: inset 0 0 0 1.5px var(--teal); }
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.steps li { display: flex; gap: 10px; align-items: baseline; color: var(--dim); font-size: 1rem; line-height: 1.35; }
.steps li .n { font: 600 0.875rem/1 'Space Grotesk', sans-serif; width: 1.5rem; height: 1.5rem; border-radius: 50%; border: 1.5px solid var(--hair);
  display: inline-flex; align-items: center; justify-content: center; flex: none; transform: translateY(2px); }
.steps li.past .t { white-space: nowrap; overflow: hidden; text-overflow: clip; min-width: 0; flex: 1 1 auto; }
.steps li.cur { color: var(--line); }
.steps li.cur .n { border-color: var(--teal); color: var(--teal); }
.foot { font-size: 0.8125rem; font-style: italic; color: var(--dim); }
.q { font: 600 1.125rem/1.3 'Space Grotesk', 'Inter', sans-serif; }
@media (max-height: 700px) and (max-aspect-ratio: 6/5) { .steps li.past { display: none; } .hud { gap: 8px; padding-top: 12px; } }
@media (max-height: 500px) { .steps li.past { display: none; } }

/* 3D labels: HTML, re-projected each frame */
#labels { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
.lbl { position: absolute; left: 0; top: 0; display: flex; align-items: center; gap: 8px; white-space: nowrap; opacity: 0; transition: opacity .25s ease;
  font: 600 0.8125rem/1 'Space Grotesk', 'Inter', sans-serif; letter-spacing: .14em; color: var(--line); will-change: transform; }
.lbl .lt { display: inline-block; padding: 3px 0; transform: translateY(8px); transition: transform .25s ease; text-shadow: 0 0 6px #0A1315, 0 0 2px #0A1315; }
.lbl i { display: block; width: 22px; height: 2px; border-radius: 1px; background: var(--teal); }
.lbl.power i { background: var(--orange); }
#lbl-cable { letter-spacing: .02em; }
#lbl-cable .lt { color: var(--line); }
.lbl.on { opacity: 1; }
.lbl.on .lt { transform: none; }
body.nogl #labels { display: none; }

#veil { position: absolute; inset: 0; background: var(--bg); opacity: 0; pointer-events: none; transition: opacity .15s linear; z-index: 4; }
#veil.on { opacity: 1; }

/* landscape (aspect ≥ 1.2): HUD becomes a left column, buttons at its bottom; the scene shifts right */
body.land .hud { top: var(--top); bottom: 0; right: auto; width: min(380px, 36vw); max-height: none; border-top: 0; border-right: 1px solid var(--hair);
  border-radius: 0 16px 0 0; padding: 14px 16px var(--pb) var(--pl); }
body.land .hud > * { max-width: none; }
body.land .hud.twin { top: 0; bottom: auto; }
body.land #poster { top: var(--top); bottom: 0; height: auto; left: min(380px, 36vw); width: auto; right: 0; }
@media (min-aspect-ratio: 6/5) { #poster { top: var(--top); left: min(380px, 36vw); width: auto; right: 0; height: calc(100% - var(--top)); } }
@media (max-height: 480px) { .hud { gap: 8px; padding-top: 10px; } .btn { min-height: 48px; } .row .btn { min-height: 48px; } }

/* poster capture mode (?poster=1): scene only */
body.poster #topbar, body.poster .hud, body.poster #labels { display: none; }

/* reduced motion: cuts and fades only */
@media (prefers-reduced-motion: reduce) { .lbl .lt { transform: none !important; transition: none; } #poster { transition: none; } }
body.still .lbl .lt { transform: none !important; transition: none; }
.noscript { position: fixed; left: 16px; right: 16px; bottom: 24px; font-size: 1rem; color: var(--line); }

/* top bar: Details sits beside the chip; below 420 px it is a 48 px "i" (aria-label "Concept details") */
.tb-left { display: flex; align-items: center; gap: 8px; min-width: 0; }
.tb-btn { min-width: 48px; height: 48px; padding: 0 6px; border: 0; background: transparent; color: var(--line); font: 600 1rem/1 'Inter', sans-serif;
  border-radius: 12px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 5px; white-space: nowrap; }
.tb-btn:hover { background: rgba(220, 230, 228, .06); }
.tb-i { display: inline-flex; flex: none; width: 20px; height: 20px; border: 1.5px solid var(--soft); border-radius: 50%; font: 600 0.8125rem/1 'Inter', sans-serif; align-items: center; justify-content: center; }
#topbar .chip, #topbar .tb-btn, #topbar .restart { flex: none; }
@media (max-width: 419px) { .chip { padding: 7px 8px; letter-spacing: 0; } .restart { padding: 0 8px; } .tb-btn { padding: 0 4px; } }
@media (max-width: 359px) { .tb-t { display: none; } .tb-btn { width: 48px; padding: 0; } }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Concept details: full-screen dialog sheet; only its body scrolls */
.details { position: fixed; inset: 0; z-index: 10; background: var(--bg); display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
.details[hidden] { display: none; }
.dt-head { flex: none; display: flex; align-items: center; gap: 8px; min-height: var(--top); padding: env(safe-area-inset-top, 0px) var(--pr) 0 var(--pl); border-bottom: 1px solid var(--hair); }
.dt-title { margin: 0; font: 600 1.125rem/1.2 'Space Grotesk', 'Inter', sans-serif; color: var(--line); }
.dt-title[hidden] { display: none; }
.dt-back, .dt-close { min-height: 48px; min-width: 48px; border: 1.5px solid #2C4447; border-radius: 12px; background: transparent; color: var(--line);
  font: 600 1rem/1 'Inter', sans-serif; cursor: pointer; padding: 0 14px; }
.dt-back[hidden] { display: none; }
.dt-close { padding: 0; font-size: 1.125rem; margin-left: auto; }
.dt-back:hover, .dt-close:hover, .dt-cat:hover { border-color: var(--line); }
.dt-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 16px var(--pr) 24px var(--pl); }
.dt-body > * { max-width: 680px; margin-left: auto; margin-right: auto; }
.dt-cats { list-style: none; padding: 0; margin-top: 0; margin-bottom: 0; display: flex; flex-direction: column; gap: 8px; }
.dt-cat { width: 100%; min-height: 56px; display: flex; align-items: center; gap: 10px; padding: 8px 14px; border: 1px solid var(--hair); border-radius: 12px;
  background: #0F1C1F; color: var(--line); font: 600 1rem/1.25 'Inter', sans-serif; text-align: left; cursor: pointer; }
.dt-cname { flex: 1 1 auto; min-width: 0; }
.dt-count { flex: none; font: 400 0.875rem/1 'Inter', sans-serif; color: var(--soft); }
.dt-chev { flex: none; font-size: 1.375rem; line-height: 1; color: var(--soft); }
.dt-cat-title { margin-top: 0; margin-bottom: 12px; font: 600 1.25rem/1.25 'Space Grotesk', 'Inter', sans-serif; color: var(--line); }
.dt-cards { display: flex; flex-direction: column; gap: 12px; }
.dt-card { background: #0F1C1F; border: 1px solid var(--hair); border-radius: 14px; padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; overflow-wrap: break-word; }
.dt-card.target { border-color: var(--soft); }
.dt-ct { margin: 0; font: 600 1.0625rem/1.3 'Space Grotesk', 'Inter', sans-serif; color: var(--line); }
.dt-p { margin: 0; font-size: 1rem; line-height: 1.4; color: var(--line); }
.dt-k { font-weight: 600; color: var(--soft); }
.dt-sl { margin: 2px 0 0; }
.dt-status { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 4px 10px; border: 1.5px solid var(--c); border-radius: 14px;
  font: 600 0.875rem/1.25 'Inter', sans-serif; color: var(--line); }
.dt-status .g { color: var(--c); flex: none; font-family: 'Inter', system-ui, sans-serif; }
.st-proposed { --c: #A9BDBB; } .st-maker { --c: #8FB3E0; } .st-approval { --c: #C1B3E6; } .st-privacy { --c: #D9B8A6; }
.st-test { --c: #D2C08F; border-style: dashed; } .st-open { --c: #EC6602; }
.dt-src { margin: 0; font-size: 0.8125rem; line-height: 1.35; color: var(--dim); }
.dt-foot { flex: none; margin: 0; padding: 10px var(--pr) var(--pb) var(--pl); border-top: 1px solid var(--hair); font-size: 0.8125rem; line-height: 1.35; color: var(--soft); text-align: center; }
.dt-title:focus, .dt-cat-title:focus { outline: none; }
