/* C-arm Dock Plus · play layout: top bar, task chip, pill, hint, action buttons, joystick, look zone, tags, labels.
 * Tokens from the deployed game.css. Colours on #0A1315: #DCE6E4 15:1, teal 7.4:1, #7F9896 6:1, orange 5.8:1.
 * Round 8: one button standard. Every button token is here (--btn-*, --kbd-*, --close-*); the variants are at the end of panels.css. */
:root {
  --bg: #0A1315; --sheet: rgba(13, 24, 27, 0.92); --hair: #22373A; --line: #DCE6E4; --soft: #A9BDBB; --dim: #7F9896;
  --teal: #19B5B0; --orange: #EC6602; --asleep: #41595A;
  --sat: env(safe-area-inset-top, 0px); --sar: env(safe-area-inset-right, 0px); --sab: env(safe-area-inset-bottom, 0px); --sal: env(safe-area-inset-left, 0px);
  --pl: max(16px, var(--sal)); --pr: max(16px, var(--sar)); --pb: max(20px, var(--sab));
  --panel: 400px;
  /* buttons · sizing: 48 px (52 px on touch), radius 14, Space Grotesk 600 16 px (17 px on touch), padding 0 20, 8 px icon-label gap */
  --btn-h: 48px; --btn-radius: 14px; --btn-pad-x: 20px; --btn-pad: 0 var(--btn-pad-x); --btn-gap: 8px; --btn-bw: 1.5px;
  --btn-font-family: 'Space Grotesk', 'Inter', system-ui, sans-serif; --btn-font-weight: 600; --btn-font-size: 16px; --btn-lh: 1.2;
  --btn-font: var(--btn-font-weight) var(--btn-font-size)/var(--btn-lh) var(--btn-font-family);
  --btn-icon-size: 22px;
  /* primary: teal filled, dark text (7.4:1; hover 9.1:1, pressed 5.9:1) */
  --btn-pri-bg: #19B5B0; --btn-pri-fg: #0A1315; --btn-pri-hover: #3CC7C2; --btn-pri-active: #13A19C;
  /* secondary: outlined 1.5 px #2C4447, light text (15:1) on the HUD glass, so it stays legible over the 3D scene */
  --btn-sec-bg: rgba(13, 24, 27, 0.92); --btn-sec-fg: #DCE6E4; --btn-sec-border: #2C4447;
  --btn-sec-hover-bg: #16282B; --btn-sec-hover-border: #4A6467; --btn-sec-active-bg: #1D3236; --btn-sec-on-bg: #1A2C2F; --btn-sec-on-border: #19B5B0;
  /* quiet: text or icon only (top bar, close); a faint scrim keeps it at >= 4.5:1 even over a light part of the scene */
  --btn-quiet-bg: rgba(10, 19, 21, 0.7); --btn-quiet-fg: #DCE6E4; --btn-quiet-hover-bg: rgba(26, 44, 47, 0.85); --btn-quiet-active-bg: rgba(36, 58, 62, 0.9);
  /* disabled (6:1), focus ring, key chips, the × close (40 px visual, 48 px hit) */
  --btn-off-fg: #7F9896; --btn-off-border: #22373A;
  --btn-focus: 2px solid #19B5B0; --btn-focus-offset: 2px;
  --kbd-size: 12px; --kbd-h: 20px; --kbd-pad: 0 5px; --kbd-radius: 6px; --kbd-bw: 1px;
  --close-size: 40px; --close-hit: 48px; --close-inset: 6px;
  --top: calc(var(--btn-h) + var(--sat));
}
@media (pointer: coarse) { :root { --btn-h: 52px; --btn-font-size: 17px; } }
* { 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; touch-action: none; }
[hidden] { display: none !important; }
button { font-family: inherit; }
button:focus { outline: none; }
button:focus-visible, [tabindex]:focus-visible { outline: var(--btn-focus); outline-offset: var(--btn-focus-offset); }

/* top bar: chip + Dock tablet left, Restart right (quiet buttons, styled with the standard in panels.css) */
#topbar { position: absolute; top: 0; left: 0; right: 0; height: var(--top); padding: var(--sat) var(--pr) 0 var(--pl);
  display: flex; align-items: center; gap: 8px; z-index: 6; pointer-events: none; }
#topbar > * { pointer-events: auto; }
#topbar .grow { flex: 1; pointer-events: none; }
.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; }

/* under the top bar: task chip, status pill, peeks (portrait: full width; landscape: max 420 px at the left) */
#under { position: absolute; top: calc(var(--top) + 8px); left: var(--pl); right: var(--pr); z-index: 5; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
#under > * { pointer-events: auto; }
body.land #under { right: auto; width: min(420px, calc(100vw - var(--panel) - 48px)); }
.task-chip { transition: border-color .3s ease, opacity .3s ease; }
.task-chip .g { flex: none; width: 1.1em; text-align: center; color: var(--soft); }
.task-chip .tt { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.task-chip.done { border-color: var(--teal); }
.task-chip.done .g { color: var(--teal); }
.task-chip.fade .tt { opacity: 0; }
.task-chip .tt { transition: opacity .3s ease; }
body.still .task-chip, body.still .task-chip .tt { transition: none; }

.pill { align-self: center; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; max-width: 100%;
  padding: 5px 12px 5px 10px; border-radius: 999px; border: 1.5px solid var(--soft); background: var(--sheet);
  font: 600 1rem/1.25 'Space Grotesk', 'Inter', sans-serif; color: var(--line); }
.pill .glyph { font-family: 'Inter', system-ui, sans-serif; width: 1em; text-align: center; flex: none; }
.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); }
.pill.grey .glyph { color: var(--soft); }

.peek { border-radius: 14px; border: 1px solid var(--hair); background: var(--sheet); padding: 8px 12px; font-size: 1rem; }
.peek .pl { display: flex; justify-content: space-between; gap: 10px; min-height: 26px; align-items: center; }
.peek .pl .n { font-weight: 600; } .peek .pl .s { color: var(--soft); white-space: nowrap; }
.peek .acts { display: flex; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.hpeek { display: flex; gap: 10px; align-items: center; width: 100%; text-align: left; color: var(--line); cursor: pointer; min-height: 48px; font: 400 1rem/1.3 'Inter', sans-serif; }
.hpeek .ic { flex: none; width: 28px; height: 28px; border-radius: 50%; background: rgba(220, 230, 228, .85); color: var(--bg);
  font: 700 1rem/28px Georgia, serif; text-align: center; }
.hpeek strong { font-weight: 600; }

/* minimal hint: a glass pill above the joystick zone */
.hintpill { position: absolute; z-index: 5; left: var(--pl); bottom: calc(var(--sab) + 178px); max-width: min(320px, calc(100vw - 32px));
  padding: 9px 14px; border-radius: 999px; border: 1px solid var(--hair); background: var(--sheet); color: var(--line); font-size: 1rem; line-height: 1.3;
  transition: opacity .3s ease; pointer-events: none; }
.hintpill.out { opacity: 0; }
body.land .hintpill { bottom: calc(var(--sab) + 178px); }

/* action buttons: right edge max(16 px, safe-right), bottom max(20 px, safe-bottom); secondary 8 px above.
 * The slot widths stay; look, height and states come from the button standard (primary / secondary) in panels.css. */
#actions { position: absolute; z-index: 5; right: var(--pr); bottom: var(--pb); display: flex; flex-direction: column; align-items: flex-end; gap: 8px; pointer-events: none; }
.act { pointer-events: auto; min-width: 140px; max-width: 220px; transition: opacity .2s ease; }
.act.gone { opacity: 0; pointer-events: none; visibility: hidden; transition: opacity .2s ease, visibility 0s linear .2s; }
body.still .act { transition: none; }

/* joystick zone (left half below the chip on touch; a corner pad on desktop) and look zone (everything else) */
#lookzone { position: absolute; inset: 0; z-index: 2; touch-action: none; cursor: grab; }
#lookzone:active { cursor: grabbing; }
#joyzone { position: absolute; z-index: 3; left: 0; bottom: 0; width: 50%; top: var(--joytop, 160px); touch-action: none; }
body.fine #joyzone { width: 260px; height: 280px; top: auto; }
#joy-ghost, #joy-base { position: absolute; width: 112px; height: 112px; border-radius: 50%; border: 2px solid var(--line); pointer-events: none; }
#joy-ghost { left: calc(var(--sal) + 88px - 56px); bottom: calc(var(--sab) + 112px - 56px); opacity: .3; }
#joy-base { left: 0; top: 0; opacity: 0; background: rgba(13, 24, 27, .35); }
#joy-knob { position: absolute; left: 0; top: 0; width: 44px; height: 44px; border-radius: 50%; background: rgba(220, 230, 228, .55); opacity: 0; pointer-events: none; }
body.joy-on #joy-base { opacity: .55; } body.joy-on #joy-knob { opacity: 1; } body.joy-on #joy-ghost { opacity: 0; }
body.sheet-open.portrait #joyzone, body.sheet-open.portrait #lookzone { pointer-events: none; }

/* machine tags (HTML, re-projected every frame) */
#tags, #labels { position: absolute; inset: 0; pointer-events: none; z-index: 4; }
.mtag { position: absolute; left: 0; top: 0; white-space: nowrap; padding: 4px 10px; border-radius: 999px; border: 1px solid #2C4447; background: rgba(13, 24, 27, .82);
  font: 600 0.875rem/1.2 'Space Grotesk', 'Inter', sans-serif; color: var(--line); will-change: transform; opacity: 0; transition: opacity .2s ease; }
.mtag.on { opacity: 1; }
.mtag .d { margin-left: 6px; color: var(--soft); } .mtag.docked .d { color: var(--teal); }
.mtag.hl { border-color: var(--line); }
.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; 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.on { opacity: 1; }
body.still .lbl, body.still .mtag { transition: none; }

#veil { position: absolute; inset: 0; background: var(--bg); opacity: 0; pointer-events: none; transition: opacity .15s linear; z-index: 20; }
#veil.on { opacity: 1; }
body.nogl #scene, body.nogl #joyzone, body.nogl #lookzone, body.nogl #actions, body.nogl #hint { display: none; }
body.poster #topbar, body.poster #under, body.poster #actions, body.poster #hint, body.poster #joyzone, body.poster #tags, body.poster #labels { display: none !important; }
.noscript { position: fixed; left: 16px; right: 16px; bottom: 24px; font-size: 1rem; color: var(--line); }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* round 3 */
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
@media (max-width: 300px) { :root { --btn-pad-x: 8px; } #under { left: 8px; right: 8px; } .task-chip { gap: 6px; } }
