/* C-arm Dock Plus · panels: dock tablet sheet / right panel, status rows and chips, detail card, details accordion, end card,
 * hotspot buttons, self-test overlay, no-WebGL card. HUD glass: #0D181B at 92 %, radius 16 px, #22373A hairlines.
 * Round 8: every button follows the one standard at the end of this file (tokens in game.css :root). */
.sheet { position: absolute; z-index: 8; top: calc(var(--top) + 8px); left: 0; right: 0; bottom: 0; display: flex; flex-direction: column;
  background: var(--sheet); border-top: 1px solid var(--hair); border-radius: 16px 16px 0 0; padding: 4px var(--pr) 0 var(--pl); }
body.portrait .sheet { background: rgba(13, 24, 27, 0.97); }
body.land .sheet { left: auto; width: 400px; border-radius: 16px 0 0 0; border-left: 1px solid var(--hair); padding-right: max(16px, var(--sar)); padding-left: 16px; }
@media (min-width: 1200px) { body.land .sheet, body.land .card.in-panel { width: 420px; } }
.sheet-head, .card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 52px; }
.sheet-head h2 { margin: 0; font: 600 1.125rem/1.2 'Space Grotesk', 'Inter', sans-serif; }
.banner { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding-bottom: 8px; }
.tag { display: inline-block; font: 600 0.875rem/1.25 'Inter', sans-serif; color: var(--soft); border: 1px solid #2C4447; border-radius: 999px; padding: 3px 10px; }
.clock { font: 600 0.875rem/1.2 'Space Grotesk', 'Inter', sans-serif; color: var(--soft); letter-spacing: .02em; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding-bottom: 8px; border-bottom: 1px solid var(--hair); }
/* the scroller gets 4 px side padding (and gives it back with a negative margin) so focus rings on full-width rows are not clipped */
.sheet-body { flex: 1 1 auto; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: 4px 4px calc(var(--sab) + 16px); margin: 0 -4px; touch-action: pan-y; }
.mrow { padding: 12px 0; border-bottom: 1px solid var(--hair); }
.mh { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 10px; margin-bottom: 6px; }
.mn { font: 600 1rem/1.3 'Space Grotesk', 'Inter', sans-serif; }
.mrow dl { display: grid; grid-template-columns: 6.6rem 1fr; gap: 4px 10px; margin: 0; }
.mrow dt { font-size: 0.875rem; line-height: 1.5rem; color: var(--dim); }
.mrow dd { margin: 0; font-size: 1rem; line-height: 1.35; }
.v-done { color: var(--teal); } .v-run { color: var(--orange); } .v-wait { color: var(--soft); } .v-plain { color: var(--line); }
.schip { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; font: 600 0.875rem/1.2 'Inter', sans-serif; border-radius: 999px; padding: 4px 10px; border: 1.5px solid var(--soft); color: var(--line); }
.schip.connected { border-color: var(--teal); color: var(--teal); }
.schip.progress { background: var(--orange); border-color: var(--orange); color: var(--bg); }
.schip.attention { border-color: var(--soft); color: var(--line); }
.schip.notdocked { border-color: #2C4447; color: var(--dim); }
.reqs h3 { margin: 14px 0 6px; font: 600 1rem/1.2 'Space Grotesk', 'Inter', sans-serif; }
.reqs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.reqs li { display: flex; gap: 10px; align-items: baseline; font-size: 1rem; line-height: 1.35; color: var(--line); }
.reqs li .g { flex: none; width: 1.1em; color: var(--soft); } .reqs li.done .g { color: var(--teal); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.foot { margin: 14px 0 0; font-size: 0.8125rem; line-height: 1.4; color: var(--dim); font-style: italic; }
.ptag { margin-bottom: 4px; }

/* detail card: portrait under the chip (≤ 45 % of the height, scrolls); landscape + desktop in the right panel */
.card { position: absolute; z-index: 5; top: var(--cardtop, 120px); left: var(--pl); right: var(--pr); max-height: min(45%, calc(100% - var(--cardtop, 120px) - 150px - var(--sab))); overflow-y: auto; overscroll-behavior: contain;
  background: var(--sheet); border: 1px solid var(--hair); border-radius: 16px; padding: 4px 16px 14px; }
body.land .card { left: auto; right: 0; top: calc(var(--top) + 8px); bottom: 0; width: 400px; max-height: none; border-radius: 16px 0 0 0; border-right: 0; border-bottom: 0; padding-right: max(16px, var(--sar)); }
.card p { margin: 0 0 8px; font-size: 1rem; line-height: 1.4; }
.card .small { font-size: 0.8125rem; color: var(--dim); }
.kick { font: 600 0.875rem/1.2 'Space Grotesk', 'Inter', sans-serif; color: var(--soft); letter-spacing: .03em; }
.ctitle { margin: 0 0 8px; font: 600 1.125rem/1.25 'Space Grotesk', 'Inter', sans-serif; }
.dchip { display: inline-flex; gap: 4px; align-items: center; font: 600 0.875rem/1.2 'Inter', sans-serif; border-radius: 999px; padding: 3px 10px; border: 1.5px solid var(--soft); color: var(--line); white-space: normal; }
.dchip.question { border-color: var(--orange); }
.dbanner { padding: 10px 0 6px; }
.acc .cat { border-bottom: 1px solid var(--hair); }
.cath .chev { color: var(--soft); font-size: 1.25rem; }
.items { display: flex; flex-direction: column; gap: 8px; padding: 0 0 10px; }
.acc .cat + .cat { margin-top: 8px; }
.it { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.seen { display: inline-flex; gap: 4px; align-items: center; font: 600 0.8125rem/1.2 'Inter', sans-serif; color: var(--teal); }
.itemb { padding: 8px 10px 4px; } .itemb p { margin: 0 0 8px; }

/* end card */
.endcard { position: absolute; z-index: 9; left: 50%; top: 50%; transform: translate(-50%, -50%); width: calc(100% - 32px); max-width: 420px;
  background: var(--sheet); border: 1px solid var(--hair); border-radius: 16px; padding: 18px 18px 16px; box-shadow: 0 10px 40px rgba(0, 0, 0, .45); }
.endcard h2 { margin: 0 0 8px; font: 600 1.25rem/1.25 'Space Grotesk', 'Inter', sans-serif; }
.endcard p { margin: 0 0 10px; line-height: 1.4; }
.endcard .demo { color: var(--soft); font-size: 0.875rem; }
.endcard .q { font: 600 1.0625rem/1.35 'Space Grotesk', 'Inter', sans-serif; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
/* the end-card pair shares the row while both labels fit, and stacks (full width) when they would not */
.endcard .row { display: flex; flex-wrap: wrap; }
.endcard .row > .btn { flex: 1 1 0; min-width: max-content; }

/* hotspot buttons over the 3D markers (scene markers: their own 48 px round target, not a button variant) */
#hots { position: absolute; inset: 0; pointer-events: none; z-index: 4; }
.hot { position: absolute; left: 0; top: 0; width: 48px; height: 48px; border: 0; border-radius: 50%; background: transparent; pointer-events: auto; cursor: pointer; padding: 0; }
.hot::before { content: 'i'; position: absolute; left: 12px; top: 12px; width: 24px; height: 24px; border-radius: 50%; background: radial-gradient(circle, rgba(220,230,228,.95) 0 55%, rgba(220,230,228,0) 72%);
  color: var(--bg); font: 700 15px/24px Georgia, serif; text-align: center; opacity: .5; }
.hot:hover::before, .hot:focus-visible::before { opacity: .9; }
body.sheet-open.portrait #hots { display: none; }

.nogl-card { position: absolute; z-index: 7; left: 16px; right: 16px; top: calc(var(--top) + 90px); max-width: 420px; margin: 0 auto; background: var(--sheet); border: 1px solid var(--hair); border-radius: 16px; padding: 16px; }
.nogl-card p { margin: 0 0 10px; }
.selftest { position: absolute; z-index: 30; inset: calc(var(--top) + 8px) 12px calc(12px + var(--sab)) 12px; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; touch-action: pan-y; background: rgba(10, 19, 21, .96); border: 1px solid var(--hair); border-radius: 16px; padding: 14px; font-size: 0.875rem; }
.selftest h2 { margin: 0 0 8px; font: 600 1.125rem/1.2 'Space Grotesk', 'Inter', sans-serif; }
.selftest table { width: 100%; border-collapse: collapse; } .selftest td { padding: 4px 6px; border-bottom: 1px solid var(--hair); vertical-align: top; }
.selftest .pass { color: var(--teal); font-weight: 600; } .selftest .fail { color: var(--orange); font-weight: 600; }
.selftest pre { white-space: pre-wrap; word-break: break-word; color: var(--soft); margin: 8px 0 0; font-size: 0.8125rem; }

/* landscape + desktop: with the right panel open the scene stays playable, so the buttons move left of it */
body.land.panel-open #actions { right: calc(400px + 16px); }
@media (min-width: 1200px) { body.land.panel-open #actions { right: calc(420px + 16px); } }
body.land.panel-open .hintpill { display: none; }
.selftest .sum { position: sticky; top: -14px; margin: -14px -14px 10px; padding: 12px 14px; background: #0D181B; border-bottom: 1px solid var(--hair); font: 600 0.9375rem/1.3 'Space Grotesk', 'Inter', sans-serif; }

/* ===== round 3 UX ===== */
/* U7: the tablet panel is opaque and, in portrait, the HUD is hidden behind it */
.sheet, body.portrait .sheet, body.land .sheet { background: #0D181B; }
body.sheet-open.portrait #under, body.sheet-open.portrait #actions, body.sheet-open.portrait #tags, body.sheet-open.portrait #labels,
body.sheet-open.portrait #hots, body.sheet-open.portrait #hint, body.sheet-open.portrait #joyzone, body.sheet-open.portrait #hpeek { visibility: hidden; }
body.end-open #hpeek, body.end-open #peek { display: none !important; }
/* U6: the concept strip sits above the buttons; only its Read button takes pointer events (the joystick zone always wins) */
#hpeek.hpeek { position: fixed; z-index: 5; left: var(--pl); right: var(--pr); bottom: calc(var(--pb) + 124px); width: auto; max-width: 560px; margin-left: auto;
  pointer-events: none; cursor: default; align-items: flex-start; }
#hpeek .st { flex: 1 1 auto; } #hpeek small { display: block; margin-top: 4px; font-size: 0.8125rem; color: var(--soft); }
#hpeek .sopen { pointer-events: auto; flex: none; }
body.land #hpeek.hpeek { left: auto; width: min(380px, 44vw); }
/* BUG-5 / BUG-1: compact landscape HUD — chip + pill on one row, the tablet peek beside (above) the buttons, joystick zone fixed bottom-left */
body.land #under { flex-direction: row; flex-wrap: wrap; align-items: flex-start; width: min(700px, calc(100vw - 300px)); }
body.land #under .task-chip { flex: 1 1 280px; max-width: 420px; }
body.land #under .pill { align-self: flex-start; }
body.land #peek { position: fixed; z-index: 5; right: var(--pr); bottom: calc(var(--pb) + 124px); width: min(340px, 44vw); max-height: calc(100vh - var(--top) - 150px); overflow-y: auto; }
body.land:not(.fine) #joyzone { top: 34%; width: 40%; }
/* U4: no touch ring for mouse users (the key chips themselves follow the standard below) */
body.fine #joy-ghost, body.fine #joy-base, body.fine #joy-knob { display: none; }
/* U9: tags anchored near the base with a short leader line; screen-space dock names (≥ 12 px) */
.mtag::after { content: ''; position: absolute; left: 50%; top: 100%; width: 1.5px; height: 14px; background: var(--soft); transform: translateX(-50%); opacity: .8; }
.mtag.off::after { display: none; }
.dname { position: absolute; left: 0; top: 0; white-space: nowrap; font: 600 0.8125rem/1.2 'Space Grotesk', 'Inter', sans-serif; letter-spacing: .03em; color: var(--soft);
  text-shadow: 0 0 6px #0A1315, 0 0 2px #0A1315; opacity: 0; will-change: transform; transition: opacity .2s ease; }
.dname.on { opacity: 1; }
/* U2: edge chevron toward an off-screen target (scoped to #tags: the tablet accordion's ".cath .chev" arrows stay small inline glyphs) */
#tags .chev { position: absolute; left: 0; top: 0; white-space: nowrap; padding: 5px 12px; border-radius: 999px; border: 1.5px solid var(--teal); background: rgba(13, 24, 27, .9);
  color: var(--line); font: 600 0.875rem/1.2 'Space Grotesk', 'Inter', sans-serif; will-change: transform; }

/* ===== round 4: peek pinned to the top-right corner (compact, auto-dismissed); the concept strip sits under the task chip ===== */
#peek.peek, body.land #peek.peek { position: fixed; z-index: 5; top: var(--peektop, 120px); right: var(--pr); left: auto; bottom: auto; width: min(260px, 66vw); max-height: none; overflow: visible; padding: 6px 10px; }
body.land #peek.peek { top: calc(var(--top) + 8px); }
#peek .ptag { font-size: 0.8125rem; line-height: 1.3; color: var(--soft); margin-bottom: 2px; }
#peek .pl { min-height: 22px; font-size: 0.9375rem; }
#peek .acts { margin-top: 4px; }
#hpeek.hpeek, body.land #hpeek.hpeek { top: var(--peektop, 120px); bottom: auto; left: var(--pl); right: var(--pr); width: auto; max-width: 560px; margin-left: 0; }
body.land #hpeek.hpeek { right: auto; width: min(420px, 50vw); }
.tdone { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 8px 0 4px; padding: 10px 12px; border: 1.5px solid var(--teal); border-radius: 12px; font-weight: 600; }
.tdone .btn { flex: none; }
/* round 4: the top-bar pill sizes to its text (8 px gaps); below 420 px it reads "Tablet" (accessible name stays "Dock tablet") */
.tabpill { flex: none; margin: 0; }
.tabpill .sm { display: none; }
@media (max-width: 419.98px) { .tabpill .lg { display: none; } .tabpill .sm { display: inline; } }
#topbar { gap: 8px; } #topbar .chip { flex: none; } .tb { flex: none; }
/* round 8: with the 52 px / 17 px standard the Restart label no longer fits next to the chip and Tablet below 480 px, so it is icon-only there (name stays "Restart") */
@media (max-width: 479.98px) { .tb .rl { display: none; } }
/* round 5: peek machine names never wrap; the status wraps below the name instead */
#peek .pl { flex-wrap: wrap; row-gap: 0; } #peek .pl .n { white-space: nowrap; flex: none; } #peek .pl .s { margin-left: auto; white-space: nowrap; }

/* ===== round 8: one button standard (tokens: game.css :root) =====
 * primary   .act.pri · .btn.pri                                               teal filled, dark text
 * secondary .act.sec · .act.pri.outline · .btn · .lnk · .tabb · .task-chip · .itemh   outlined 1.5 px #2C4447, light text
 * quiet     .tb · .x · .ui-close · .cath                                      text or icon only (top bar, close, accordion)
 * Dock C-arm n (.act.pri.orange) is a primary like the other forward actions. The fixed slots keep their positions and widths. */
.tb, .act, .btn, .lnk, .tabb, .x, .ui-close, .cath, .itemh, .task-chip {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--btn-gap);
  min-height: var(--btn-h); padding: var(--btn-pad); border-radius: var(--btn-radius);
  font: var(--btn-font); letter-spacing: normal; text-transform: none; white-space: nowrap; cursor: pointer; touch-action: manipulation; }
/* variants */
.act.pri, .btn.pri { background: var(--btn-pri-bg); border: var(--btn-bw) solid var(--btn-pri-bg); color: var(--btn-pri-fg); }
.act.sec, .act.pri.outline, .btn, .lnk, .tabb, .task-chip, .itemh { background: var(--btn-sec-bg); border: var(--btn-bw) solid var(--btn-sec-border); color: var(--btn-sec-fg); }
.tb, .x, .ui-close, .cath { background: var(--btn-quiet-bg); border: 0; color: var(--btn-quiet-fg); }
/* states: hover (pointer devices only), pressed, selected/expanded, disabled; focus-visible is the 2 px teal ring (game.css) */
@media (hover: hover) {
  .act.pri:hover, .btn.pri:hover { background: var(--btn-pri-hover); border-color: var(--btn-pri-hover); }
  .act.sec:hover, .act.pri.outline:hover, .btn:not(.pri):hover, .lnk:hover, .tabb:hover, .task-chip:hover, .itemh:hover { background: var(--btn-sec-hover-bg); border-color: var(--btn-sec-hover-border); }
  .tb:hover, .x:hover, .ui-close:hover, .cath:hover { background: var(--btn-quiet-hover-bg); }
}
.act.pri:active, .btn.pri:active { background: var(--btn-pri-active); border-color: var(--btn-pri-active); }
.act.sec:active, .act.pri.outline:active, .btn:not(.pri):active, .lnk:active, .tabb:active, .task-chip:active, .itemh:active { background: var(--btn-sec-active-bg); }
.tb:active, .x:active, .ui-close:active, .cath:active { background: var(--btn-quiet-active-bg); }
.tabb[aria-selected="true"], .itemh[aria-expanded="true"], .item.on .itemh { background: var(--btn-sec-on-bg); border-color: var(--btn-sec-on-border); }
.task-chip.done { border-color: var(--teal); }
.act.act[aria-disabled="true"], .act.act[aria-disabled="true"]:hover, .act.act[aria-disabled="true"]:active { background: var(--btn-sec-bg); border-color: var(--btn-off-border); color: var(--btn-off-fg); cursor: default; }
/* layouts that keep the tokens: multi-line secondaries (task chip, detail items) wrap left-aligned; accordion headers span the row */
.task-chip, .itemh { display: flex; justify-content: flex-start; width: 100%; padding: 8px var(--btn-pad-x); white-space: normal; text-align: left; line-height: 1.3; }
.itemh { flex-direction: column; align-items: flex-start; justify-content: center; }
.cath { display: flex; width: 100%; justify-content: space-between; text-align: left; }
/* icon-only quiet buttons: square, same height as the row */
.x { flex: none; width: var(--btn-h); padding: 0; margin-right: -8px; font-size: var(--btn-icon-size); line-height: 1; }
/* the × close inside info blocks (the block is position: relative): 40 px visual, 48 px hit area, top-right */
.ui-close { position: absolute; top: var(--close-inset); right: var(--close-inset); z-index: 2; width: var(--close-size); height: var(--close-size); min-height: var(--close-size);
  padding: 0; font-size: var(--btn-icon-size); line-height: 1; pointer-events: auto; }
.ui-close::before { content: ''; position: absolute; inset: calc((var(--close-size) - var(--close-hit)) / 2); border-radius: inherit; }
/* a block that carries the × keeps its own content (Read, Done, text) clear of it: 40 px + 2 × 6 px on the right */
:has(> .ui-close) { padding-right: calc(var(--close-size) + 2 * var(--close-inset)) !important; }
/* key chips ("E", "Q", "T"): one small outlined rounded rect, 12 px */
button kbd, .kbd { display: inline-flex; align-items: center; justify-content: center; min-width: var(--kbd-h); height: var(--kbd-h); margin: 0; padding: var(--kbd-pad);
  border: var(--kbd-bw) solid currentColor; border-radius: var(--kbd-radius); background: transparent; color: inherit; font: 600 var(--kbd-size)/1 var(--btn-font-family); }
@media (max-width: 300px) { #under .task-chip { gap: 6px; } }
