/* Theme matched to lear-harness.cubeworks.ai: deep navy, orange accent, glass panels, spaced uppercase eyebrows. */
:root {
  --bg: #0b111a; --panel: #121c2b; --panel2: #142739; --line: #303a48; --line2: #4b5969; --edge: #3c5970;
  --txt: #ecf1f8; --soft: #acbaca; --dim: #8994a4;
  --red: #f26a2f; --or: #f26a2f; --or2: #f88e3b; --ortxt: #ffac75; --ok: #56d3a1; --warn: #ffd23f; --err: #ff8a80;
  --glass: rgba(11, 18, 29, .83);
  --inter: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: clamp(14px, 0.55vw + 9px, 24px);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--txt); font: 1rem/1.45 var(--inter);
  display: grid; grid-template-rows: auto 1fr auto; grid-template-columns: minmax(0, 1fr); min-height: 100vh;
}
.skip { position: absolute; left: -999px; }
.skip:focus { left: 8px; top: 8px; z-index: 50; background: var(--or); color: #161d28; padding: .4rem .7rem; border-radius: .5rem; }
:focus-visible { outline: 3px solid var(--warn); outline-offset: 2px; }
[hidden] { display: none !important; }

/* top bar: brand | modes | context | settings. One line; the 3D view gets the rest. */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
header {
  display: flex; align-items: center; gap: .5rem 1rem; padding: .4rem 1rem;
  background: #0d131e; border-bottom: 1px solid #1c2636; position: relative; z-index: 20;
}
.brand { display: flex; gap: .6rem; align-items: center; flex: none; }
.brand strong { display: block; font-size: .85rem; letter-spacing: .12em; line-height: 1.1; }
.brand strong i { color: #f88a3e; font-style: normal; }
.brand small { display: block; color: var(--dim); font-size: .56rem; letter-spacing: .2em; text-transform: uppercase; }
.logo { display: grid; place-items: center; width: 2.1rem; height: 2.1rem; font-size: 1.1rem; color: #fff; border-radius: .5rem; background: linear-gradient(140deg, #f88e3b, #dc5215); }
nav { display: flex; align-items: center; gap: .15rem; flex: none; }
#ctx { flex: 1; min-width: 0; margin: 0; text-align: center; color: var(--soft); font-size: .8rem; letter-spacing: .04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body.kiosk #ctx { color: var(--ortxt); }
.hset { display: flex; align-items: center; gap: .4rem; flex: none; }
.langSel { display: inline-flex; align-items: center; gap: .4rem; font-size: .72rem; color: var(--dim); }
.hset button, .hset select { font-size: .78rem; padding: .25rem .6rem; min-height: 2rem; }
.hset select { width: 7rem; }
#wLang { width: 100%; max-width: 18rem; }
button[aria-pressed=false]#voiceBtn { color: var(--dim); text-decoration: line-through; }
#refMenu { position: relative; }
#refMenu summary { list-style: none; cursor: pointer; color: var(--soft); font-weight: 700; font-size: .78rem; padding: .5rem .9rem; border-radius: .5rem; user-select: none; }
#refMenu summary::-webkit-details-marker { display: none; }
#refMenu summary::after { content: " \25BE"; }
#refMenu summary:hover, #refMenu[open] summary { color: var(--txt); background: rgba(255, 255, 255, .05); }
#refMenu summary.on { background: var(--or); color: #161d28; }
.refList { position: absolute; top: calc(100% + .3rem); left: 0; min-width: 14rem; display: grid; gap: .15rem; padding: .35rem; background: #101b2a; border: 1px solid var(--line2); border-radius: .6rem; box-shadow: 0 12px 36px rgba(0, 0, 0, .5); }
.refList button { text-align: left; background: transparent; border: 0; color: var(--soft); font-weight: 600; font-size: .8rem; }
.refList button:hover { background: rgba(255, 255, 255, .06); color: var(--txt); }
.refList button[aria-current=true] { background: var(--or); color: #161d28; }
button, select, input[type=text], #scanIn, #showIn {
  font: inherit; color: var(--txt); background: #101b2a; border: 1px solid var(--line);
  border-radius: .5rem; padding: .4rem .75rem; min-height: 2.3rem; cursor: pointer;
}
button:hover { border-color: var(--or2); }
button:disabled { opacity: .45; cursor: not-allowed; }
nav button { background: transparent; border: 0; color: var(--soft); font-weight: 700; font-size: .78rem; padding: .5rem .9rem; border-radius: .5rem; }
nav button:hover { color: var(--txt); background: rgba(255, 255, 255, .05); }
nav button[aria-current=true], button.on { background: var(--or); border-color: var(--or); color: #161d28; font-weight: 700; }
button.primary { background: linear-gradient(110deg, #ff9e56, #eb6732); border-color: #f2945f; color: #1b2630; font-weight: 750; }
input[type=range] { accent-color: var(--or); vertical-align: middle; }
#scanIn { cursor: text; flex: 1; min-width: 0; }
#scanIn, #showIn { background: #101b2a; border: 1px solid #587088; border-radius: .45rem; cursor: text; }
#scanIn:focus, #showIn:focus { outline: none; border-color: var(--or2); box-shadow: 0 0 0 2px rgba(242, 106, 47, .35); }

main { display: grid; grid-template-columns: minmax(0, 1fr) clamp(19rem, 24vw, 26rem); min-height: 0; }
#stage { min-width: 0; min-height: 0; display: flex; background: radial-gradient(at 52% 43%, #334155 0%, #1b2735 37%, #0b121d 85%); }
.pane { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.toolbar {
  display: flex; flex-wrap: wrap; gap: .4rem .7rem; align-items: center; padding: .4rem .7rem;
  background: #0d131e; border-bottom: 1px solid var(--line); font-size: .82rem; color: var(--soft);
}
.toolbar button { padding: .25rem .65rem; min-height: 2rem; font-size: .78rem; font-weight: 700; color: var(--soft); }
.sagbox { margin-left: auto; color: var(--dim); position: relative; }
.sagbox summary { cursor: pointer; font-weight: 700; color: var(--soft); }
.sagbox[open] { display: flex; flex-wrap: wrap; gap: .3rem .8rem; align-items: center; }
.sagbox em { color: var(--ortxt); font-size: .72rem; letter-spacing: .08em; }

.boardWrap { flex: 1; display: flex; min-height: 0; gap: 6px; padding: .7rem; }
#board { flex: 1; min-width: 0; width: 100%; height: 100%; background: #0b121d; border: 1px solid var(--line2); border-radius: .9rem; box-shadow: 0 16px 48px rgba(0, 0, 0, .45); touch-action: none; cursor: grab; user-select: none; }
#board text { font-family: Verdana, Arial, sans-serif; fill: #111; pointer-events: none; }
#board .b { font-weight: 700; }
#board .plate { font-family: "Arial Black", Impact, "Helvetica Neue", Arial, sans-serif; fill: #0a0a0a; }
#board .lbl { fill: #33415c; }
#board .hit { cursor: pointer; }
#board .hit:hover, #board .hit:focus-visible { filter: drop-shadow(0 0 2.5px #f88e3b) drop-shadow(0 0 1px #f88e3b); outline: none; }
#board .hit.sel { filter: drop-shadow(0 0 3px var(--or)) drop-shadow(0 0 1.5px var(--or)); }
#cmpSide { flex: 1; margin: 0; min-width: 0; display: flex; flex-direction: column; background: #070b11; border-radius: .9rem; overflow: hidden; }
#cmpSide img { flex: 1; min-height: 0; width: 100%; object-fit: contain; }
#cmpSide figcaption { font-size: .72rem; color: var(--dim); padding: .25rem .6rem; }

.glWrap { position: relative; flex: 1; min-height: 0; overflow: hidden; }
#gl { width: 100%; height: 100%; display: block; touch-action: none; }
#labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
#labels > * {
  position: absolute; left: 0; top: 0; transform: translate(-50%, -50%); white-space: nowrap;
  font-size: .62rem; line-height: 1.1; min-height: 0;
}
/* hotspot: ringed orange dot + dark glass label, as on the reference */
#labels .hs { pointer-events: auto; display: inline-flex; align-items: center; gap: .4rem; padding: .4rem .55rem; border-radius: .4rem; background: rgba(14, 22, 33, .92); border: 1px solid #5d7286; color: #ebf2fa; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
#labels .hs::before { content: ""; width: .55rem; height: .55rem; border-radius: 50%; border: 1px solid #f78744; background: #101a25; box-shadow: 0 0 0 3px rgba(247, 135, 68, .14); flex: none; }
#labels .hs.sel { background: rgba(242, 106, 47, .22); border-color: var(--or2); }
#labels .dm { padding: .3rem .5rem; border-radius: .4rem; background: rgba(14, 22, 33, .92); color: #8ee3c5; border: 1px solid #517369; font-weight: 600; }
#labels .dm.vf { border-color: #b8860b; color: var(--warn); }
#labels .no { display: grid; place-items: center; min-width: 1.7rem; height: 1.7rem; padding: 0 .3rem; border-radius: 50%; background: rgba(16, 26, 37, .93); color: var(--ortxt); border: 1px solid #f78744; box-shadow: 0 0 0 4px rgba(247, 135, 68, .1), 0 4px 16px rgba(0, 0, 0, .47); font-weight: 800; font-size: .74rem; }
.note { position: absolute; left: .9rem; bottom: .55rem; margin: 0; font-size: .56rem; letter-spacing: .12em; text-transform: uppercase; color: #aab6c6; background: rgba(11, 18, 29, .78); padding: .25rem .55rem; border-radius: .3rem; max-width: 34%; z-index: 4; }
.fail { margin: 2rem; padding: 1rem; border: 1px solid var(--or); background: #2a1710; border-radius: .6rem; }
.glWrap .fail { position: absolute; inset: 0; margin: auto; height: max-content; max-width: 32rem; }

#galGrid { flex: 1; overflow: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: .7rem; padding: .8rem; align-content: start; }
#galGrid figure, .thumbs figure { margin: 0; background: linear-gradient(155deg, #172333, #0f1927 65%); border: 1px solid var(--line); border-radius: .65rem; overflow: hidden; }
#galGrid img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; }
#galGrid button.ph, .thumbs button { padding: 0; border: 0; border-radius: 0; background: none; display: block; width: 100%; min-height: 0; }
figcaption { font-size: .72rem; color: var(--dim); padding: .35rem .5rem; }
.chips { display: flex; flex-wrap: wrap; gap: .3rem; padding: 0 .5rem .5rem; }
.chips button, .chip { font-size: .68rem; padding: .1rem .55rem; min-height: 1.6rem; border-radius: 999px; }

#side { background: linear-gradient(155deg, #172333, #0f1927 65%); border-left: 1px solid #1c2636; box-shadow: -13px 0 45px rgba(0, 0, 0, .22); overflow: auto; padding: .9rem 1rem 1.5rem; min-height: 0; }
#side h2 { margin: 0 0 .25rem; font-size: 1.2rem; font-weight: 700; }
#side h3 { margin: 1.1rem 0 .35rem; font-size: .62rem; text-transform: uppercase; letter-spacing: .18em; color: #ff9459; font-weight: 750; }
.pn { font: 700 1.02rem ui-monospace, Menlo, Consolas, monospace; color: var(--ortxt); letter-spacing: .04em; }
.badge { display: inline-block; font-size: .6rem; font-weight: 700; padding: .1rem .5rem; border-radius: 999px; background: #1e2a3a; color: var(--soft); text-transform: uppercase; letter-spacing: .1em; vertical-align: middle; border: 1px solid var(--line2); }
.badge.drawing { background: #123d2f; border-color: #2f7a60; color: #8ee3c5; } .badge.photo { background: #14295a; border-color: #2f4f9a; color: #a9c4ff; }
.badge.general { background: #4a3a10; border-color: #8a6d1a; color: #ffd98a; } .badge.verify { background: #54201a; border-color: #a0443a; color: #ffb0a5; }
table { width: 100%; border-collapse: collapse; font-size: .8rem; }
th, td { text-align: left; padding: .3rem .4rem; border-bottom: 1px solid #243042; vertical-align: top; }
th { color: var(--dim); font-weight: 500; width: 42%; }
td.num { font-family: ui-monospace, Menlo, monospace; white-space: nowrap; }
.row { display: flex; flex-wrap: wrap; gap: .45rem; margin: .65rem 0; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(5.5rem, 1fr)); gap: .4rem; }
.thumbs img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; }

ol.steps { list-style: none; margin: .4rem 0; padding: 0; counter-reset: s; }
ol.steps li { counter-increment: s; margin: .2rem 0; }
ol.steps button { width: 100%; text-align: left; display: flex; gap: .6rem; align-items: baseline; font-size: .85rem; }
ol.steps button::before { content: counter(s); font-weight: 800; color: var(--ortxt); min-width: 1.2rem; }
ol.steps button.done::after { content: "✓"; color: var(--ok); margin-left: auto; font-weight: 800; }
ol.steps button[aria-current=step] { border-color: var(--or2); background: rgba(242, 106, 47, .13); }
.stepText { background: var(--panel2); border: 1px solid var(--edge); border-left: 3px solid var(--or); border-radius: .65rem; padding: .6rem .8rem; margin: .6rem 0; }
progress { width: 100%; accent-color: var(--or); height: .5rem; }
fieldset { border: 1px solid var(--edge); background: var(--panel2); border-radius: .7rem; margin: .65rem 0; padding: .45rem .8rem .65rem; }
fieldset label { display: block; padding: .25rem 0; }
.right { color: var(--ok); } .wrong { color: var(--err); }
.score { font-size: 1.3rem; font-weight: 800; }

#qrs { display: grid; grid-template-columns: repeat(2, 1fr); gap: .55rem; margin: .65rem 0; }
#qrs figure { margin: 0; background: var(--panel2); border: 1px solid var(--edge); border-radius: .7rem; padding: .5rem; text-align: center; }
#qrs canvas { width: 100%; max-width: 9rem; height: auto; image-rendering: pixelated; background: #fff; border-radius: .35rem; }
#qrs figcaption { padding: .25rem 0; color: var(--txt); }
#qrs a { color: var(--ortxt); font-size: .75rem; }
#scanForm label { font-size: .78rem; color: var(--dim); }
#scanForm .row { margin-top: .2rem; }
#cam { width: 100%; border-radius: .6rem; background: #000; }
#scanMsg { min-height: 1.4rem; font-weight: 700; margin: .4rem 0; }
#scanMsg.err { color: var(--err); } #scanMsg.ok { color: var(--ok); }

#narr { display: grid; gap: .35rem; padding: .5rem 1rem .6rem; background: #0d131e; border-top: 1px solid #1c2636; font-size: .82rem; }
.ctlRow { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.2rem; }
.ctlBtns { display: flex; flex-wrap: wrap; gap: .4rem; }
.ctlBtns button { min-width: 5rem; min-height: 2.5rem; font-weight: 700; }
.ctlOpts { margin-left: auto; display: flex; align-items: center; gap: .8rem; color: var(--soft); }
#lessonInfo { display: flex; flex-direction: column; gap: .2rem; min-width: 11rem; color: var(--soft); font-size: .78rem; font-weight: 700; }
#narrText { margin: 0; color: var(--txt); font-size: .95rem; line-height: 1.4; max-height: 6.4em; overflow: auto; }

dialog.sheet { border: 1px solid var(--line2); border-radius: .8rem; background: #0f1927; color: var(--txt); padding: 1.3rem 1.5rem; width: min(34rem, 92vw); max-height: 90vh; overflow: auto; box-shadow: 0 24px 80px rgba(0, 0, 0, .6); }
dialog.sheet::backdrop { background: rgba(5, 9, 15, .75); }
dialog.sheet h2 { margin: 0 0 .5rem; font-size: 1.3rem; }
dialog.sheet h3 { margin: 1rem 0 .3rem; font-size: .62rem; text-transform: uppercase; letter-spacing: .18em; color: #ff9459; }
dialog.sheet ul, dialog.sheet ol { margin: .2rem 0; padding-left: 1.2rem; }
dialog.sheet li { margin: .25rem 0; }
.wActions { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1rem 0 .4rem; }
.wActions .primary { order: -1; }
.langNote { min-height: 1.3em; margin: .3rem 0 0; font-size: .78rem; color: var(--soft); }
.safety { margin: .8rem 0 0; padding-top: .7rem; border-top: 1px solid var(--line); font-size: .76rem; color: var(--soft); }
#transList li { color: var(--soft); }
.stepText .warnBasis { margin: .4rem 0 0; font-size: .78rem; color: #ffd98a; }

dialog#lightbox { border: 0; padding: 0; background: rgba(5, 9, 15, .95); color: #fff; width: 100vw; height: 100vh; max-width: none; max-height: none; }
dialog#lightbox[open] { display: grid; grid-template-columns: auto 1fr auto; align-items: center; }
dialog#lightbox figure { margin: 0; height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 0; }
#lbImg { max-width: 100%; max-height: calc(100vh - 4rem); object-fit: contain; border-radius: .5rem; }
#lbCap { font-size: .9rem; color: var(--soft); text-align: center; }
#lbClose { position: absolute; right: .8rem; top: .8rem; z-index: 2; }
#lbPrev, #lbNext { font-size: 2rem; margin: .5rem; border-radius: 999px; }

@media (max-width: 900px) {
  body { display: block; }
  header { flex-wrap: wrap; }
  .brand { order: 1; } .hset { order: 2; margin-left: auto; } nav { order: 3; width: 100%; overflow-x: auto; } #ctx { order: 4; width: 100%; flex: none; text-align: left; }
  .langSel span { display: none; }
  main { display: block; }
  #stage { height: 62vh; min-height: 22rem; }
  #side { border-left: 0; border-top: 1px solid var(--line2); overflow: visible; }
  .sagbox { margin-left: 0; }
  #narr { position: sticky; bottom: 0; z-index: 10; }
  .ctlOpts { margin-left: 0; }
  .note { max-width: 95%; }
}
@media (min-width: 901px) { body { height: 100vh; overflow: hidden; } }
@media (pointer: coarse) {
  button, select, input[type=text], #scanIn, #showIn, #refMenu summary { min-height: 44px; }
  .chips button, .chip { min-height: 40px; }
}

body.kiosk .toolbar, body.kiosk .skip, body.kiosk .hset, body.kiosk .ctlRow { display: none; }
body.kiosk #tabs { pointer-events: none; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }

/* showcase: always-ready scan dock over the 3D view */
#showBar { position: absolute; left: 50%; top: .7rem; transform: translateX(-50%); display: flex; gap: .6rem; align-items: center; background: #0d1927; border: 1px solid #537087; border-radius: .6rem; box-shadow: 0 16px 48px rgba(0, 0, 0, .6); padding: .6rem .8rem; width: min(42rem, 94%); z-index: 5; }
#showBar:focus-within { border-color: var(--or2); box-shadow: 0 16px 48px rgba(0, 0, 0, .6), 0 0 0 3px rgba(242, 106, 47, .3); }
#showBar label { font-weight: 800; white-space: nowrap; font-size: .6rem; letter-spacing: .16em; text-transform: uppercase; color: #ff9d62; }
#showIn { flex: 1; min-width: 6rem; }
#showStatus { font-size: .6rem; letter-spacing: .1em; text-transform: uppercase; color: #8ee3c5; border: 1px solid #517369; border-radius: .3rem; padding: .3rem .45rem; white-space: nowrap; }
#showStatus.err { color: var(--err); border-color: #a0443a; }
#showPanel ol.steps button:disabled { opacity: 1; cursor: default; }
#showPanel .cur { background: rgba(242, 106, 47, .13); }

/* practice (phase 1: identify the connectors) */
#practicePanel .scope { color: var(--soft); font-size: .8rem; margin: .2rem 0 .6rem; }
.prPrompt { font-size: 1.05rem; font-weight: 700; margin: .5rem 0; }
.prFb { min-height: 1.4em; margin: .5rem 0; font-weight: 700; }
.prFb.right { color: var(--ok); } .prFb.wrong { color: var(--err); } .prFb.info { color: var(--soft); }
.pimg { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: .5rem; border: 1px solid var(--line2); display: block; margin: .4rem 0; }
.prOpts { display: grid; gap: .35rem; margin: .5rem 0; }
.prOpts button { text-align: left; }
.prRows { list-style: none; margin: .4rem 0; padding: 0; }
.prRows li { display: flex; gap: .5rem; align-items: baseline; padding: .3rem 0; border-bottom: 1px solid #243042; font-size: .82rem; }
.prRows .mark { font-weight: 800; min-width: 4.6rem; } .prRows .ok { color: var(--ok); } .prRows .miss { color: var(--err); }
#practicePanel details { margin: .5rem 0; font-size: .8rem; color: var(--soft); }
#practicePanel details summary { cursor: pointer; }
.safetyLine { margin-top: .8rem; padding-top: .6rem; border-top: 1px solid var(--line); font-size: .76rem; color: var(--soft); }

.fid { margin: .2rem 0 .6rem; font-size: .76rem; color: var(--soft); }

/* less crowded: audio menu, inline notes, collapsible detail sections */
#voiceMenu { position: relative; }
#voiceMenu summary { list-style: none; cursor: pointer; user-select: none; font: inherit; font-size: .78rem; color: var(--txt); background: #101b2a; border: 1px solid var(--line); border-radius: .5rem; padding: .25rem .7rem; min-height: 2rem; display: inline-flex; align-items: center; }
#voiceMenu summary::-webkit-details-marker { display: none; }
#voiceMenu summary::after { content: " \25BE"; }
#voiceMenu summary:hover, #voiceMenu[open] summary { border-color: var(--or2); }
.menuPanel { position: absolute; right: 0; top: calc(100% + .3rem); z-index: 30; width: 15rem; display: grid; gap: .6rem; padding: .7rem; background: #101b2a; border: 1px solid var(--line2); border-radius: .6rem; box-shadow: 0 12px 36px rgba(0, 0, 0, .5); font-size: .8rem; color: var(--soft); }
.menuPanel label { display: flex; align-items: center; gap: .5rem; }
.menuPanel input[type=range] { flex: 1; min-width: 0; }
.menuPanel button { text-align: left; }
.menuPanel button#voiceBtn[aria-pressed=false] { text-decoration: none; color: var(--dim); }
#side details.more { border-top: 1px solid #243042; margin: .1rem 0; }
#side details.more > summary { cursor: pointer; padding: .55rem 0; font-size: .64rem; font-weight: 750; letter-spacing: .16em; text-transform: uppercase; color: #ff9459; list-style: none; }
#side details.more > summary::-webkit-details-marker { display: none; }
#side details.more > summary::before { content: "\25B8"; display: inline-block; width: 1.1em; }
#side details.more[open] > summary::before { content: "\25BE"; }
#side details.more > *:not(summary) { margin-bottom: .6rem; }
.chips.flush { padding: 0 0 .5rem; }
.verifyNote { margin: .3rem 0; padding: .4rem .6rem; font-size: .76rem; color: #ffd98a; background: #3a2f0e; border-left: 3px solid #b8860b; border-radius: .3rem; }
#narrText { font-size: .88rem; color: var(--soft); max-height: 3.4em; }
#narr { padding: .4rem 1rem .5rem; }
.note { max-width: none; font-size: .6rem; padding: .2rem .5rem; opacity: .85; }

/* the panel already shows the step or task text, so the caption bar would repeat it on wide screens */
@media (min-width: 901px) { body[data-mode=train] #narrText, body[data-mode=practice] #narrText { display: none; } }
nav button, #refMenu summary { white-space: nowrap; }
@media (max-width: 900px) { nav button, #refMenu summary { padding: .5rem .6rem; } }

/* training journey: progress marks on the mode tabs, the single Next button, the Progress screen */
nav button { display: inline-flex; align-items: center; gap: .4rem; }
.jm { font-size: .68rem; font-weight: 800; color: var(--ok); letter-spacing: .02em; }
.jm:empty { display: none; }
nav button[aria-current=true] .jm { color: #161d28; }
#nextBtn { font-size: .78rem; padding: .25rem .8rem; min-height: 2rem; white-space: nowrap; max-width: 22rem; overflow: hidden; text-overflow: ellipsis; }
#debriefPanel .scope { color: var(--soft); font-size: .8rem; margin: .2rem 0 .6rem; }
#debriefPanel .prRows .idle { color: var(--dim); }
#debriefPanel .prRows .mark { min-width: 5.4rem; }
#debriefPanel .stages > li { align-items: flex-start; }
#debriefPanel .stages > li.col { flex-direction: column; gap: .3rem; }
#debriefPanel .stages .line { display: flex; gap: .5rem; align-items: baseline; }
#debriefPanel .sub { margin: 0 0 0 1rem; }
#debriefPanel .sub li { align-items: center; }
#debriefPanel .sub li span:nth-child(2) { flex: 1; }
#debriefPanel .sub button { font-size: .72rem; min-height: 1.8rem; padding: .15rem .6rem; }
#debriefPanel .score2 { color: var(--soft); }
#debriefPanel .quiet { background: transparent; color: var(--soft); font-size: .78rem; }
#debriefPanel .dbAsk { border: 1px solid var(--edge); border-radius: .6rem; padding: .3rem .8rem; background: var(--panel2); }
#debriefPanel .stages strong { display: block; }

/* Reference interface, measured against the supplied 1672 × 941 mockup.
   --u scales its spacing/type together; no scene/model rendering is changed. */
:root { font-size: 16px; --u: clamp(.5px, .0598086vw, 1.3px); --sidebar: 23.25vw; --or: #ff6b24; }
body { height: 100dvh; min-height: 0; overflow: hidden; grid-template-columns: minmax(0, 1fr) var(--sidebar); grid-template-rows: calc(58 * var(--u)) minmax(0, 1fr) 0; }
body.captioning, body[data-mode=train], body[data-mode=familiar] { grid-template-rows: calc(58 * var(--u)) minmax(0, 1fr) calc(124 * var(--u)); }
main { display: contents; }
header { grid-area: 1 / 1 / 2 / 3; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 0; padding: 0 calc(22 * var(--u)) 0 calc(30 * var(--u)); background: #0d151f; border-bottom: 1px solid #70747a; }
.brand { display: flex; gap: calc(25 * var(--u)); white-space: nowrap; }
.brand .learWordmark { font-size: calc(29 * var(--u)); font-weight: 850; letter-spacing: .045em; line-height: 1; color: #f8f9fb; }
.brandDivider { display: block; width: 1px; height: calc(31 * var(--u)); background: #717a83; }
.trainerName { font-size: calc(23 * var(--u)); font-weight: 600; letter-spacing: -.035em; }
#tabs { height: 100%; gap: calc(44 * var(--u)); width: auto; overflow: visible; }
#tabs button { position: relative; padding: 0 calc(7 * var(--u)); height: 100%; min-height: 0; border-radius: 0; font-size: calc(22 * var(--u)); font-weight: 450; background: transparent; color: #c1c5cd; }
#tabs button[aria-current=true] { background: transparent; color: #fff; font-weight: 650; }
#tabs button[aria-current=true]::after { content: ''; position: absolute; left: calc(-5 * var(--u)); right: calc(-5 * var(--u)); bottom: calc(3 * var(--u)); height: calc(6 * var(--u)); border-radius: 4px; background: var(--or); }
#tabs .jm { display: none; }
#ctx { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
#nextBtn { display: none !important; }
.hset { justify-self: end; gap: calc(23 * var(--u)); align-items: center; }
#refMenu summary { border-radius: 0; padding: 0 calc(25 * var(--u)) 0 0; border-right: 1px solid #67717d; font-size: calc(21 * var(--u)); line-height: calc(31 * var(--u)); font-weight: 450; color: #f1f3f6; }
#refMenu summary::after { content: none; }
#refMenu summary.on, #refMenu[open] summary, #refMenu summary:hover { color: #fff; background: transparent; }
.refList { left: auto; right: 0; min-width: 245px; }
.langSel#langWrap { position: relative; display: flex; }
#lang { width: calc(61 * var(--u)); min-height: 0; padding: 0 calc(22 * var(--u)) 0 0; appearance: none; border: 0; border-radius: 0; background: transparent; font-size: calc(20 * var(--u)); line-height: calc(30 * var(--u)); }
#langWrap::after, .captionChevron { content: ''; display: block; width: 7px; height: 7px; border: solid #d6dce4; border-width: 0 2px 2px 0; transform: rotate(45deg); pointer-events: none; }
#langWrap::after { position: absolute; right: 4px; top: 9px; }
.uiSymbols { position: absolute; width: 0; height: 0; overflow: hidden; pointer-events: none; }
.uiIcon { display: inline-block; flex: none; width: calc(22 * var(--u)); height: calc(22 * var(--u)); fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
#voiceMenu summary, #helpBtn { display: grid; place-items: center; width: calc(29 * var(--u)); height: calc(32 * var(--u)); min-height: 0; padding: 0; border: 0; background: transparent; color: #f4f6fa; }
#voiceMenu summary::after { content: none; }
#voiceMenu summary .uiIcon { width: calc(25 * var(--u)); height: calc(25 * var(--u)); }
#helpBtn .uiIcon { width: calc(28 * var(--u)); height: calc(28 * var(--u)); }
#stage { grid-area: 2 / 1 / 3 / 2; }
#side { grid-area: 2 / 2 / 4 / 3; padding: calc(17 * var(--u)) calc(26 * var(--u)) calc(36 * var(--u)); border-left: 1px solid #64707b; background: #0d151f; box-shadow: none; }
#familiarPanel { display: flex; flex-direction: column; min-height: 100%; padding: 0; }
.fmEyebrow { margin: 0; color: #b6bbc3; font-size: calc(16 * var(--u)); line-height: calc(20 * var(--u)); letter-spacing: -.02em; }
#familiarPanel h2 { margin: calc(8 * var(--u)) 0 calc(4 * var(--u)); color: #f8f9fb; font-size: calc(30 * var(--u)); line-height: calc(36 * var(--u)); font-weight: 750; letter-spacing: -.035em; }
.fmCode { margin: 0; color: #c2c7cf; font-size: calc(17 * var(--u)); line-height: calc(22 * var(--u)); }
.fmProgress { display: flex; align-items: center; gap: calc(12 * var(--u)); margin: calc(11 * var(--u)) 0 calc(10 * var(--u)); }
.fmSegments { display: flex; gap: calc(2 * var(--u)); flex: 1; min-width: 0; }
.fmSegments span { height: calc(11 * var(--u)); flex: 1; border-radius: calc(3 * var(--u)); background: #49515e; }
.fmSegments .filled { background: #f4773e; }
.fmStep { flex: none; color: #f4f6fa; font-size: calc(14 * var(--u)); white-space: nowrap; }
#familiarPanel h3 { max-width: calc(310 * var(--u)); margin: 0; color: #f2f4f7; font-size: calc(20 * var(--u)); line-height: calc(27 * var(--u)); text-transform: none; letter-spacing: -.015em; font-weight: 700; }
.fmInstruction { margin: calc(6 * var(--u)) 0 calc(8 * var(--u)); font-size: calc(17 * var(--u)); line-height: calc(22 * var(--u)); color: #c7cbd2; letter-spacing: -.01em; }
.fmEvidence { display: flex; gap: calc(7 * var(--u)); flex-wrap: nowrap; }
.fmEvidence .badge { display: flex; align-items: center; gap: calc(7 * var(--u)); white-space: nowrap; padding: calc(5 * var(--u)) calc(8 * var(--u)); font-size: calc(12 * var(--u)); line-height: calc(18 * var(--u)); font-weight: 450; letter-spacing: -.025em; text-transform: none; border: 1px solid #5a6572; border-radius: calc(7 * var(--u)); color: #e6e9ed; background: #303a46; }
.fmEvidence .uiIcon { width: calc(17 * var(--u)); height: calc(17 * var(--u)); }
.fmSteps { list-style: none; padding: 0; margin: calc(14 * var(--u)) 0 calc(17 * var(--u)); }
.fmSteps li { display: flex; align-items: center; gap: calc(10 * var(--u)); height: calc(34 * var(--u)); padding: calc(3 * var(--u)) calc(4 * var(--u)); border-radius: calc(8 * var(--u)); color: #f4f5f7; font-size: calc(16 * var(--u)); letter-spacing: -.015em; }
.fmNumber { display: inline-grid; place-items: center; flex: none; width: calc(29 * var(--u)); height: calc(29 * var(--u)); border-radius: 50%; background: #343d49; color: #f4f6fa; font-size: calc(17 * var(--u)); }
.fmStepLabel { flex: 1; }
.fmSteps li.current { background: #43271a; color: #fff; font-weight: 600; }
.fmSteps li.current .fmNumber { background: #fa6d29; }
.fmSteps .fmComplete { width: calc(20 * var(--u)); height: calc(20 * var(--u)); color: #2eae72; fill: #2eae72; }
.fmSteps .fmComplete path { stroke: #112d23; stroke-width: 2.5; }
.fmPhoto { display: block; flex: none; position: relative; width: 100%; padding: 0; overflow: hidden; border: 1px solid #626c76; border-radius: calc(11 * var(--u)); background: #232c35; text-align: left; }
.fmPhoto img { display: block; width: 100%; height: calc(216 * var(--u)); object-fit: cover; object-position: 50% 50%; }
.fmPhoto span { position: absolute; left: calc(6 * var(--u)); top: calc(6 * var(--u)); padding: calc(2 * var(--u)) calc(8 * var(--u)); border: 1px solid #7b8088; border-radius: 6px; color: #fff; background: #151a20e8; font-size: calc(14 * var(--u)); line-height: calc(20 * var(--u)); }
.fmSourceLink { display: flex; align-items: center; gap: calc(9 * var(--u)); align-self: flex-start; margin: calc(9 * var(--u)) 0 calc(15 * var(--u)); padding: 0; min-height: calc(23 * var(--u)); border: 0; background: transparent; color: #b8d8ee; font-size: calc(16 * var(--u)); line-height: calc(22 * var(--u)); text-decoration: underline; text-underline-offset: 3px; }
.fmSourceLink .uiIcon { width: calc(18 * var(--u)); height: calc(18 * var(--u)); }
.fmScope { margin: auto 0 0; padding-top: calc(16 * var(--u)); border-top: 1px solid #747d87; color: #b6bbc3; font-size: calc(14 * var(--u)); line-height: calc(22 * var(--u)); font-style: italic; }
.fmHint, .fmFeedback { font-size: calc(15 * var(--u)); line-height: 1.5; }
.fmHint { color: var(--dim); }
.fmFeedback { border-left: 3px solid var(--or); background: #f26a2f12; padding: .6rem; }
.fmAnswers { display: flex; gap: .5rem; }
.fmAnswers button { min-height: 44px; flex: 1; }
.fmReference { font-size: .8rem; margin: .4rem 0; background: transparent; color: var(--soft); }
.instructorCameras { position: absolute; z-index: 6; top: calc(19 * var(--u)); left: calc(20 * var(--u)); display: flex; gap: 0; padding: 1px; border: 1px solid #3b434c; border-radius: calc(11 * var(--u)); background: #10161ef5; overflow: hidden; }
.instructorCameras button { width: calc(100 * var(--u)); height: calc(39 * var(--u)); min-height: 0; padding: 0; border: 0; border-radius: calc(9 * var(--u)); background: transparent; color: #f2f4f8; font-size: calc(16 * var(--u)); font-weight: 600; }
.instructorCameras button:nth-child(2) { width: calc(118 * var(--u)); }
.instructorCameras button:nth-child(3) { width: calc(132 * var(--u)); }
.instructorCameras button[aria-pressed=true] { background: #fc6b24; color: #fff; box-shadow: inset 0 0 0 1px #ff9d66; }
.instructorReplicaNote { position: absolute; right: calc(14 * var(--u)); bottom: calc(16 * var(--u)); margin: 0; padding: calc(4 * var(--u)) calc(8 * var(--u)); border-radius: 5px; color: #eef0f3; background: #34383dd9; font-size: calc(14 * var(--u)); line-height: calc(21 * var(--u)); pointer-events: none; }
.viewportTools { position: absolute; left: calc(20 * var(--u)); bottom: calc(16 * var(--u)); display: flex; gap: calc(12 * var(--u)); }
.viewportTools button { display: grid; place-items: center; width: calc(40 * var(--u)); height: calc(40 * var(--u)); min-height: 0; padding: 0; color: #fff; border: 1px solid #68737b; border-radius: 6px; background: #171d24da; }
.viewportTools .uiIcon { width: calc(27 * var(--u)); height: calc(27 * var(--u)); }
body[data-mode=familiar] #glNote { display: none; }
#narr { grid-area: 3 / 1 / 4 / 2; display: flex; flex-direction: column; gap: calc(11 * var(--u)); min-width: 0; padding: calc(10 * var(--u)) calc(12 * var(--u)) calc(8 * var(--u)) calc(20 * var(--u)); border-top: 1px solid #63707b; background: #101820; }
#familiarControls { display: flex; flex: none; align-items: center; gap: calc(30 * var(--u)); height: calc(45 * var(--u)); padding: 0 calc(8 * var(--u)) 0 calc(10 * var(--u)); }
#familiarControls button, .fmSpeed select { display: inline-flex; justify-content: center; align-items: center; flex: none; gap: calc(10 * var(--u)); height: calc(43 * var(--u)); min-height: 0; padding: 0 calc(12 * var(--u)); border: 1px solid #404b58; border-radius: calc(9 * var(--u)); color: #f5f7fa; background: #242d38; box-shadow: inset 0 1px 0 #ffffff09; font-size: calc(19 * var(--u)); line-height: 1; font-weight: 450; }
.fmTransport, .fmPlayback { display: flex; align-items: center; flex: none; gap: calc(30 * var(--u)); }
.fmTransport button:first-child { width: calc(132 * var(--u)); }
.fmTransport button:nth-child(2) { width: calc(152 * var(--u)); }
.fmDivider { flex: none; width: 1px; height: calc(35 * var(--u)); margin-left: calc(16 * var(--u)); margin-right: calc(24 * var(--u)); background: #7d8793; }
.fmPlayback button { width: calc(150 * var(--u)); }
.fmSpeed { display: flex; position: relative; }
.fmSpeed select { width: calc(100 * var(--u)); cursor: pointer; }
#familiarControls .fmReset { width: calc(178 * var(--u)); margin-left: calc(50 * var(--u)); }
#familiarControls .fmNext { width: calc(139 * var(--u)); margin-left: auto; color: #fff; font-weight: 650; background: #ff6b24; border-color: #ff8d50; }
.fmPauseIcon { color: #f47a3c; }
.captionBar { display: flex; align-items: center; gap: 12px; flex: 1; min-height: calc(50 * var(--u)); padding: calc(5 * var(--u)) calc(12 * var(--u)); border: 1px solid #303c48; border-radius: calc(10 * var(--u)); background: #0c141d; }
#narrText, body[data-mode=familiar] #narrText { display: block; flex: 1; min-width: 0; margin: 0; color: #f2f4f7; font-size: calc(21 * var(--u)); line-height: 1.35; max-height: 3.1em; }
#captionToggle { display: inline-flex; justify-content: center; align-items: center; gap: calc(7 * var(--u)); flex: none; margin-left: auto; min-width: calc(172 * var(--u)); min-height: calc(36 * var(--u)); padding: calc(3 * var(--u)) calc(8 * var(--u)); border: 1px solid #5b6775; border-radius: 7px; background: #242e3b; color: #f2f4f7; font-size: calc(16 * var(--u)); white-space: nowrap; }
#captionToggle .uiIcon { width: calc(24 * var(--u)); height: calc(24 * var(--u)); }
.captionChevron { width: calc(7 * var(--u)); height: calc(7 * var(--u)); margin: 0 2px 4px; }
@media (min-width: 901px) { body[data-mode=train] #narrText, body[data-mode=practice] #narrText { display: block; } }
@media (max-width: 900px) {
  :root { --u: .9px; }
  body, body.captioning, body[data-mode=train], body[data-mode=familiar] { display: block; height: auto; min-height: 100dvh; overflow: auto; }
  header { display: flex; flex-wrap: wrap; padding: 12px 16px 0; gap: 10px; }
  .brand { order: 1; gap: 12px; } .trainerName { font-size: 17px; } .brand .learWordmark { font-size: 23px; } .brandDivider { height: 25px; }
  .hset { order: 2; margin-left: auto; gap: 14px; } #refMenu summary { font-size: 16px; padding-right: 14px; }
  #tabs { order: 3; width: 100%; height: 44px; justify-content: center; gap: 40px; } #tabs button { font-size: 18px; }
  #stage { height: 58dvh; min-height: 300px; } #side { padding: 22px; border-left: 0; border-top: 1px solid #57616d; }
  #familiarPanel { min-height: auto; } .fmScope { margin-top: 24px; }
  .fmPhoto { max-width: 420px; } .fmPhoto img { height: 200px; }
  #narr { position: sticky; bottom: 0; z-index: 10; padding: 10px; gap: 8px; }
  #familiarControls { height: auto; gap: 8px; padding: 0; flex-wrap: wrap; }
  .fmTransport, .fmPlayback { gap: 8px; } .fmDivider { display: none; }
  .fmTransport button:first-child, .fmTransport button:nth-child(2), .fmPlayback button, #familiarControls .fmReset, #familiarControls .fmNext { width: auto; min-width: 72px; margin-left: 0; }
  #familiarControls button, .fmSpeed select { min-height: 40px; font-size: 15px; gap: 7px; padding: 0 10px; }
  .fmSpeed select { width: 70px; }
  #narrText, body[data-mode=familiar] #narrText { font-size: 15px; }
  #captionToggle { min-width: 0; font-size: 13px; padding: 5px; } #captionToggle .captionChevron { display: none; }
  .captionBar { padding: 8px; min-height: 48px; }
}
@media (max-width: 560px) {
  .hset { width: 100%; justify-content: flex-end; }
  .brand { margin-right: auto; } #tabs { gap: 28px; }
}

#narratorVoice { width: 100%; min-width: 0; }
#voiceStatus:empty { display: none; }

/* Guidance uses only a warm glow; instructions stay in the lesson panel. */
#hintLayer { position: fixed; inset: 0; z-index: 45; pointer-events: none; }
#hintLayer [hidden] { display: none !important; }
.hintTargetGlow { box-shadow: 0 0 10px 3px #ffe5b566, 0 0 24px 7px #ffe5b533; animation: hintGlow 2.4s ease-in-out infinite; }
.hintCard { pointer-events: auto; position: absolute; left: 24px; bottom: 118px; width: min(340px, calc(100vw - 48px)); padding: 14px; border: 1px solid #aa7544; border-radius: 12px; background: #111b27f5; color: #edf1f5; box-shadow: 0 6px 24px #0005; font-size: .9rem; }
.hintHeading { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: #ffd09c; }
.hintHeading button { min-width: 32px; padding: 2px 8px; font-size: 21px; }
.hintCard p { margin: 10px 0; line-height: 1.45; }
.hintLocation { display: block; color: #b5c1ce; font-size: .75rem; }
.hintActions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.hintActions button { font-size: .77rem; padding: 6px 9px; }
.hintMore { border-color: #bd763b; }
@keyframes hintGlow { 0%,100% { box-shadow: 0 0 8px 2px #ffe5b555, 0 0 18px 5px #ffe5b522; } 50% { box-shadow: 0 0 12px 4px #ffe5b588, 0 0 28px 8px #ffe5b544; } }
@media (prefers-reduced-motion: reduce) { .hintTargetGlow { animation: none; } }
@media (max-width: 900px) { .hintCard { left: 12px; bottom: 100px; width: min(320px,calc(100vw - 24px)); } }

.feedbackNotice { position: sticky; top: 0; z-index: 5; margin: 0 0 16px; padding: 14px; border: 1px solid #45bd82; border-radius: 12px; background: #102a23; color: #f5fff9; box-shadow: 0 4px 16px #0003; animation: feedbackEnter .23s ease-out; }
.feedbackNotice[hidden] { display: none; }
.feedbackNotice[data-tone="retry"] { background: #302415; border-color: #dbab61; color: #fff8ed; }
.feedbackHeading { display: flex; align-items: center; gap: 9px; font-size: 1rem; line-height: 1.3; }
#feedbackIcon { display: grid; place-items: center; flex: 0 0 28px; height: 28px; border-radius: 50%; background: #38bd7b; color: #062416; font-size: 20px; }
[data-tone="retry"] #feedbackIcon { background: #e9b363; color: #34230b; }
#feedbackSpoken { margin: 10px 0 5px; font-size: 1rem; font-weight: 650; }
#feedbackDetail { margin: 7px 0; color: inherit; font-size: .83rem; line-height: 1.45; }
.feedbackFooter { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 11px; }
#feedbackWait { flex: 1; font-size: .72rem; opacity: .85; }
#feedbackContinue { padding: 7px 10px; font-size: .75rem; border-color: #ffffff55; }
@keyframes feedbackEnter { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) { .feedbackNotice { animation: none; } }
@media (max-width: 900px) { .feedbackNotice { position: relative; } }
