/* VOICE   occasion for children: a bright, friendly school recording studio, calm enough to read
   IDEA    a music studio's step sequencer: lit pads on a dark console, one glowing playhead
   PICTURE the note grid itself, with its target row above and the drum strip below
   COLOUR  deep navy console (fixed, both themes), five note colors, a warm white playhead
   TYPE    Baloo 2 for titles, Atkinson Hyperlegible for reading, JetBrains Mono for code
   LAYOUT  app shell: header, one focused scene, a fixed action bar. Score left, code right. */

:root {
  color-scheme: dark;
  --bg: #0d1226;
  --panel: #161e3f;
  --panel2: #1c2550;
  --well: #0a0f22;
  --line: #2b3668;
  --ink: #f3f5ff;
  --muted: #b3bbe0;
  --dim: #7d88b8;
  --hot: #fff3a6;
  --go: #ffd84a;
  --ok: #3ad683;
  --bad: #ff8292;
  --red: #ff6578;
  --orange: #ffa23d;
  --green: #3ad683;
  --blue: #4aa9ff;
  --purple: #b98aff;
  --lab: clamp(80px, 24%, 150px);
  --rh: 42px;
  --rr: 36px;
  --th: 38px;
  --dh: 34px;
  --display: "Baloo 2", "Trebuchet MS", system-ui, sans-serif;
  --text: "Atkinson Hyperlegible", "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
}
* { box-sizing: border-box; min-width: 0; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; display: flex; flex-direction: column; height: 100dvh; overflow: hidden; background: var(--bg); background-image: radial-gradient(1200px 500px at 70% -120px, #22306a 0%, transparent 70%); background-repeat: no-repeat; color: var(--ink); font: 17px/1.5 var(--text); }
h1, h2, h3, h4 { font-family: var(--display); line-height: 1.1; margin: 0 0 .4em; letter-spacing: -.01em; }
h2 { font-size: 22px; }
h3 { font-size: 19px; }
p { margin: 0 0 .6em; }
code { font-family: var(--mono); font-size: .92em; background: #0a0f22; border: 1px solid var(--line); border-radius: 7px; padding: .05em .4em; color: #ffe9a8; white-space: nowrap; }
a { color: #9fd0ff; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 15px; }
.warn { color: #ffe7a0; font-weight: 700; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--go); color: #111; padding: 10px 14px; border-radius: 10px; font-weight: 700; }
.skip:focus { left: 12px; }
:focus-visible { outline: 3px solid #fff; outline-offset: 2px; border-radius: 8px; }
.ic { width: 20px; height: 20px; flex: none; }

/* header */
.top { flex: none; position: relative; z-index: 20; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 6px max(1.5vw, 12px); background: rgba(11, 16, 36, .96); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; }
.brand b { display: block; font: 800 18px/1 var(--display); }
.brand span { font-size: 12.5px; color: var(--muted); }
.stagenav { overflow: hidden; }
.stages { display: flex; gap: 3px; list-style: none; margin: 0; padding: 3px 2px; overflow-x: auto; scrollbar-width: thin; }
.stages li { flex: none; }
.stages .day { align-self: center; font: 700 12.5px var(--display); color: var(--dim); padding: 0 3px 0 8px; }
.stage { display: flex; align-items: center; gap: 6px; min-height: 40px; padding: 4px 10px 4px 5px; border-radius: 999px; border: 1px solid transparent; background: none; color: var(--muted); font: 700 14px var(--text); cursor: pointer; }
.stage .dot { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--panel2); color: var(--ink); font-size: 13px; }
.stage .dot .ic { width: 15px; height: 15px; }
.stage.done .dot { background: var(--ok); color: #06210f; }
.stage.cur { background: var(--panel2); border-color: #5d6cb8; color: var(--ink); }
.stage.cur .dot { background: var(--go); color: #1a1530; }
.stage:disabled { opacity: .5; cursor: not-allowed; }
.stage:not(.cur) .nm { display: none; }
.stage:not(.cur) { padding-right: 5px; }
.tools { display: flex; align-items: center; gap: 6px; }
.avchip { display: flex; align-items: center; gap: 6px; min-height: 44px; padding: 2px 12px 2px 4px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); font: 700 15px var(--text); cursor: pointer; }
.vol { display: flex; align-items: center; gap: 4px; }
.vol input { width: 80px; accent-color: var(--go); }
.iconbtn { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); cursor: pointer; }
.preview-bar { flex: none; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; justify-content: center; padding: 2px 16px; font-size: 15px; background: #3b2a00; color: #ffe7a0; font-weight: 700; border-bottom: 2px solid var(--go); }
.warnbar { flex: none; margin: 0; padding: 6px 16px; background: #3b2a00; color: #ffe7a0; font-weight: 700; text-align: center; }

/* main scene and action bar */
main { position: relative; flex: 1 1 auto; min-height: 0; overflow: auto; padding: 12px max(1.5vw, 12px); outline: none; scroll-padding: 12px; }
.scene { max-width: 1340px; min-height: 100%; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; }
.actbar { flex: none; position: relative; z-index: 15; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 9px max(1.5vw, 12px); background: rgba(11, 16, 36, .98); border-top: 1px solid var(--line); box-shadow: 0 -8px 24px rgba(0, 0, 0, .35); }
.actbar:empty { display: none; }
.ab-l, .ab-r { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ab-r { margin-left: auto; justify-content: flex-end; }
.ab-note { color: var(--muted); font-size: 15px; }
.slot { min-width: 196px; }
.titlefield { display: flex; align-items: center; gap: 8px; }
.titlefield span { font-weight: 700; font-size: 15px; white-space: nowrap; }
.titlefield input { width: 220px; min-height: 44px; padding: 6px 12px; border-radius: 12px; border: 2px solid var(--line); background: var(--well); color: var(--ink); font: 17px var(--text); }
.titlefield input:focus { border-color: #8fbfff; outline: none; box-shadow: 0 0 0 3px rgba(143, 191, 255, .3); }

.preview-bar .btn { min-height: 32px; padding: 2px 10px; }

/* scroll cues */
.more-pill { position: absolute; right: 10px; bottom: 8px; z-index: 3; display: inline-flex; align-items: center; gap: 4px; padding: 3px 12px; border-radius: 999px; border: 1px solid #5d6cb8; background: #24306a; color: var(--ink); font: 700 13px var(--text); cursor: pointer; box-shadow: 0 4px 14px rgba(0, 0, 0, .45); }
.more-pill .ic { width: 15px; height: 15px; }
.more-pill.page { position: fixed; right: auto; left: 50%; transform: translateX(-50%); z-index: 16; }
.sw { position: relative; }
.scrolly.more-below:not(main) { -webkit-mask-image: linear-gradient(#000 calc(100% - 34px), rgba(0, 0, 0, .25)); mask-image: linear-gradient(#000 calc(100% - 34px), rgba(0, 0, 0, .25)); }

/* layout */
.ws { display: grid; grid-template-columns: minmax(0, 11fr) minmax(0, 9fr); gap: 14px; align-items: stretch; }
.ws.even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
.ws.quiz { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
.ws.badge { grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); align-items: start; }
.card { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 14px 16px; }
.card-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.card-top h2 { margin: 0; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 10px 0 4px; }
.row.tight { margin: 0; gap: 6px; }
.row .lab { font-weight: 700; color: var(--muted); font-size: 15px; }
.note { background: var(--panel2); border-radius: 12px; padding: 8px 12px; }
.legend { display: flex; align-items: center; gap: 6px; margin: 6px 0 0; color: var(--muted); font-size: 14.5px; }
.legend .ic { color: var(--go); width: 16px; height: 16px; }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font: 700 14px var(--text); }
.tag .ic { width: 15px; height: 15px; }
.tag.bad { background: #4a1f2a; color: var(--bad); }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 44px; padding: 8px 15px; border-radius: 12px; border: 2px solid #3c4a8c; background: var(--panel2); color: var(--ink); font: 700 16px var(--text); cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover:not(:disabled) { border-color: #7d8ce0; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--go); border-color: var(--go); color: #1a1530; }
.btn.primary:hover:not(:disabled) { border-color: #fff; }
.btn.run { background: #2759b8; border-color: #4f8af0; }
.btn.ghost { background: transparent; }
.btn.lg { min-height: 52px; padding: 10px 22px; font-size: 18px; border-radius: 14px; }
.btn.sm { min-height: 40px; padding: 5px 11px; font-size: 14.5px; }
.btn.right { background: #1f6f4a; border-color: var(--ok); }
.btn.wrong { border-color: var(--bad); border-style: dashed; }
.btn .di { width: 18px; height: 18px; }
.drumsbtn[aria-pressed="false"] { color: var(--muted); border-style: dashed; }
.linkbtn { background: none; border: 0; color: #9fd0ff; font: inherit; text-decoration: underline; cursor: pointer; padding: 10px 4px; min-height: 44px; }

/* scene head: avatar, one line from the partner, the current instruction */
.sh { flex: none; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 8px 14px 8px 8px; border-radius: 20px; background: #f6f3ea; color: #18183a; }
.sh-av { display: grid; place-items: center; width: 84px; height: 84px; border-radius: 18px; background: #1b2148; }
.sh-av.yay { animation: hop .5s ease 2; }
.sh-av.hmm { animation: tilt .6s ease 1; }
@keyframes hop { 40% { transform: translateY(-8px); } }
@keyframes tilt { 30% { transform: rotate(-7deg); } 70% { transform: rotate(5deg); } }
.sh-top { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.scr-title { font-size: 21px; margin: 0; outline: none; color: #2b2f66; }
.sh-step { font: 700 14px var(--text); color: #5b5f86; background: #e7e2d2; border-radius: 999px; padding: 1px 10px; }
.sh-line { margin: 2px 0 2px; font-size: 16px; color: #3b3f5e; font-style: italic; }
.sh-line .who { font-style: normal; font-weight: 700; color: #1b2148; }
.sh-ins { margin: 0; font: 700 19px/1.35 var(--text); color: #14143a; text-wrap: pretty; }
.sh code { background: #1b2148; color: #ffe9a8; border-color: #1b2148; }
.sh-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.sh .say-ctl { margin: 0; flex-wrap: nowrap; }
.sh .btn, .side .btn { background: #e7e2d2; border-color: #c9c1a8; color: #1d1d3a; }
.sh .btn.say, .side .btn.say { background: #1b2148; border-color: #1b2148; color: #fff; }
.say-ctl { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 2px; }
.reading { background: rgba(255, 216, 74, .4); border-radius: 6px; box-shadow: 0 0 0 4px rgba(255, 216, 74, .4); }
.card .reading, .fb .reading, .hint .reading { background: rgba(255, 216, 74, .18); box-shadow: 0 0 0 4px rgba(255, 216, 74, .18); }

/* studio track strip */
.strip { display: flex; align-items: center; gap: 8px; padding: 4px 10px; border-radius: 12px; background: #1b2148; color: #e9ecff; }
.ss-lab { font: 700 12.5px var(--text); color: #b3bbe0; }
.ss-cells { display: flex; align-items: center; gap: 3px; }
.ss-cells i { width: 2px; height: 16px; background: #8c96c8; margin: 0 2px; }
.ss-c { display: grid; place-items: center; width: 14px; height: 18px; border-radius: 4px; background: var(--c); font: 700 11px var(--text); }
.ss-rest { background: #2b3880; }
.ss-miss { background: transparent; border: 1px dashed #6b76aa; color: #8c96c8; }
.ss-st { display: inline-flex; align-items: center; gap: 3px; font: 700 12.5px var(--text); color: #ffd84a; white-space: nowrap; }
.strip.ready .ss-st { color: var(--ok); }
.ss-st .ic { width: 14px; height: 14px; }

/* partner choice */
.pick { display: grid; grid-template-columns: repeat(2, minmax(0, 300px)); justify-content: center; gap: 22px; margin: auto; }
.av-card { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px; border-radius: 22px; border: 3px solid var(--line); background: var(--panel); color: var(--ink); cursor: pointer; font: inherit; }
.av-card:hover { border-color: #7d8ce0; }
.av-card.sel { border-color: var(--go); background: var(--panel2); }
.av-art { display: grid; place-items: center; width: 100%; padding: 6px 0; border-radius: 16px; background: radial-gradient(circle at 50% 60%, #27326a, transparent 70%); }
.av-name { font: 800 26px var(--display); }
.av-desc { color: var(--muted); text-align: center; font-size: 15.5px; }
.av-sel { display: inline-flex; align-items: center; gap: 6px; margin-top: 4px; padding: 5px 14px; border-radius: 999px; background: var(--panel2); font-weight: 700; }
.av-card.sel .av-sel { background: var(--go); color: #1a1530; }
.pick.small { gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pick.small .av-card { padding: 10px; }

/* mode toggle and backing choice */
.modes { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--well); border: 1px solid var(--line); }
.mode { min-height: 38px; padding: 4px 12px; border-radius: 9px; border: 0; background: none; color: var(--muted); font: 700 14.5px var(--text); cursor: pointer; white-space: nowrap; }
.mode[aria-pressed="true"] { background: #f6f3ea; color: #1a1530; }

/* music grid */
.gridwrap { container-type: inline-size; margin: 2px 0 4px; }
.grid { position: relative; display: grid; column-gap: 5px; row-gap: 5px; padding: 8px 10px 8px; background: var(--well); border-radius: 16px; border: 1px solid var(--line); }
.gpart { display: flex; align-items: baseline; justify-content: center; gap: 8px; padding: 0 0 3px; border-bottom: 2px solid #34407a; font-family: var(--display); color: var(--muted); }
.gpart b { color: var(--ink); font-size: 16px; }
.gpart span { font-size: 13.5px; }
.gpart.pn-bad { border-bottom-color: #a33d52; }
.gpart.pn-bad .pn { color: var(--bad); font: 700 13px var(--text); }
.gdiv { justify-self: center; width: 4px; border-radius: 2px; background: repeating-linear-gradient(#e9ecff 0 10px, transparent 10px 16px); opacity: .55; }
.glab { display: flex; align-items: center; }
.rowbtn { display: flex; align-items: center; gap: 5px; width: 100%; height: 100%; min-height: 34px; padding: 2px 7px; border-radius: 10px; border: 1px solid #2a3363; background: #141b3a; color: var(--ink); font: 15px var(--text); cursor: pointer; text-align: left; }
.rowbtn:hover { border-color: var(--c); }
.rowbtn .ic { width: 15px; height: 15px; color: var(--muted); }
.rowbtn .rs { width: 17px; height: 17px; fill: var(--c); flex: none; }
.rowbtn .rn { white-space: nowrap; overflow: hidden; }
.rowbtn .rn b { color: var(--c); font-size: 15.5px; }
.rowbtn .alt { color: var(--muted); font-size: 14px; }
.rowbtn.ping { box-shadow: 0 0 0 3px var(--c); }
.rest-lab, .num-lab, .tgt-lab, .drum-lab { gap: 5px; padding-left: 8px; color: var(--muted); font-weight: 700; font-size: 14.5px; }
.tgt-lab { color: var(--go); }
.tgt-lab .ic { width: 17px; height: 17px; }
.drum-lab .di { width: 17px; height: 17px; color: #c9a7ff; }
.drum-lab.off { color: var(--dim); }
.drum-lab.off .di { color: var(--dim); }
.rest-lab .restmark { width: 19px; height: 19px; }
.c-red { --c: var(--red); } .c-orange { --c: var(--orange); } .c-green { --c: var(--green); } .c-blue { --c: var(--blue); } .c-purple { --c: var(--purple); }
.cell { display: flex; align-items: center; justify-content: center; gap: 5px; padding: 0 3px; border-radius: 9px; border: 1px solid #252e5c; background: #121939; color: #0c1020; font: 800 14.5px var(--text); transition: transform .12s, box-shadow .12s; }
button.cell, button.rcell { cursor: pointer; }
button.cell:hover { border-color: var(--c); background: color-mix(in srgb, var(--c) 18%, #121939); }
.cell.on { background: var(--c); border-color: transparent; box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .22), inset 0 2px 0 rgba(255, 255, 255, .35); }
.cell .shape { width: 16px; height: 16px; fill: rgba(10, 14, 32, .78); flex: none; }
.cell.restcol:not(.on) { background: #0f1430; }
.cell.unused, .rcell.unused { opacity: .4; background-image: repeating-linear-gradient(135deg, transparent 0 6px, rgba(255, 255, 255, .05) 6px 12px); }
.cell.miss, .rcell.miss { opacity: .7; border: 1px dashed #a33d52; background: repeating-linear-gradient(135deg, #1a1430 0 7px, #241532 7px 14px); }
.rcell.miss { color: var(--bad); }
.cell.was { outline: 2px dashed var(--c); outline-offset: -5px; }
.cell.lit { transform: scale(1.08); box-shadow: 0 0 0 3px #fff, 0 0 26px var(--c); z-index: 1; }
.cell.hl, .rcell.hl, .tchip.hl { box-shadow: 0 0 0 3px var(--go); animation: pulse 1s ease-in-out 3; }
.cell.land, .dcell.land { box-shadow: 0 0 0 3px #fff, 0 0 22px var(--go); animation: pulse 1s ease-in-out 4; }
.gnum.land span:first-child { background: var(--go); color: #1a1530; border-radius: 6px; padding: 0 6px; }
.rcell { display: flex; align-items: center; justify-content: center; gap: 4px; border-radius: 9px; border: 1px dashed #2c3766; background: transparent; color: var(--muted); font: 700 13.5px var(--text); }
.rcell .restmark { width: 19px; height: 19px; }
.rcell.rmark { background: #1b2350; border: 1px solid #5d6cb8; color: #e9ecff; }
.rcell.lit { box-shadow: 0 0 0 3px #fff; background: #2b3880; }
.tchip { display: flex; align-items: center; justify-content: center; gap: 4px; border-radius: 9px; border: 2px dashed var(--c, #5d6cb8); background: color-mix(in srgb, var(--c, #5d6cb8) 16%, transparent); color: var(--ink); font: 700 13.5px var(--text); }
.tchip .shape { width: 14px; height: 14px; fill: var(--c); flex: none; }
.tchip.trest { --c: #8c96c8; }
.tchip .restmark { width: 16px; height: 16px; }
.tchip.none { border-color: #2c3766; background: none; color: var(--dim); }
.tchip.lit { background: var(--c, #2b3880); color: #0c1020; box-shadow: 0 0 0 3px #fff; }
.tchip.lit .shape { fill: rgba(10, 14, 32, .78); }
.gnum { display: flex; flex-direction: row; align-items: center; justify-content: center; gap: 4px; font: 700 15px var(--display); color: var(--muted); }
.gnum.now { color: var(--hot); }
.gnum .mk { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; }
.gnum .mk .ic { width: 14px; height: 14px; }
.gnum .mk.ok { background: var(--ok); color: #06210f; }
.gnum .mk.no { background: #4a1f2a; color: var(--bad); }
.gnum.chg { color: var(--go); }
.chg-tag { font: 700 11.5px var(--text); background: var(--go); color: #1a1530; border-radius: 6px; padding: 0 4px; }
.dcell { display: flex; align-items: center; justify-content: center; gap: 3px; border-radius: 8px; background: #11163a; border: 1px solid #1f2752; }
.dcell.hit { background: #231c4a; border-color: #4a3d8c; }
.dcell.lit { background: #4a3d8c; box-shadow: 0 0 0 2px #fff; }
.dh { display: flex; align-items: center; gap: 3px; color: #d9c4ff; font: 700 12px var(--text); }
.dh .di { width: 15px; height: 15px; }
.dh.d-kick .di { color: #ff9ed0; }
.dh.d-clap .di { color: #ffd27a; }
.dh.d-hat .di { color: #9fe7ff; width: 14px; height: 14px; }
.ph { position: absolute; border-radius: 13px; border: 3px solid var(--hot); box-shadow: 0 0 22px rgba(255, 243, 166, .55), inset 0 0 18px rgba(255, 243, 166, .14); pointer-events: none; opacity: 0; transition: left .09s ease, opacity .12s; z-index: 2; }
.ph.show { opacity: 1; }
.g8 .cell { flex-direction: column; gap: 0; }
.g8 .cell .tl { font-size: 12px; line-height: 1.05; }
.g8 .cell .shape { width: 13px; height: 13px; }
.g8 .tchip { flex-direction: column; gap: 0; font-size: 11.5px; line-height: 1.05; }
.g8 .dh { flex-direction: column; gap: 0; font-size: 10.5px; line-height: 1; }
@container (max-width: 640px) {
  .g8 .rowbtn .ic { display: none; }
  .g8 .rowbtn .alt { display: none; }
}
@container (max-width: 520px) {
  .cell .tl, .rcell .tl, .tchip .tl { display: none; }
  .rowbtn .alt, .rowbtn .ic { display: none; }
  .dh .dl { display: none; }
}
@container (max-width: 380px) {
  .rowbtn { padding: 2px 4px; gap: 3px; }
  .rowbtn .rn b { font-size: 13.5px; }
  .grid { padding: 6px; column-gap: 3px; }
}
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(255, 216, 74, .45); } }

/* code */
.code { font: 500 16px/1.7 var(--mono); background: var(--well); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; margin: 6px 0; color: #eaf0ff; overflow-x: auto; white-space: pre; }
.code .cl { display: inline-block; min-width: 100%; border-radius: 6px; padding: 0 4px; margin: 0 -4px; }
.code .cl.on { background: rgba(255, 243, 166, .2); box-shadow: inset 3px 0 0 var(--hot); }
.tryrow { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 6px; }
.tryrow .code { flex: 1 1 200px; margin: 0; }
.edwrap { flex: none; display: flex; flex-direction: column; min-height: 0; }
.ed-title { display: flex; align-items: center; gap: 8px; margin: 0 0 4px; font: 800 19px var(--display); color: #fff3a6; }
.ed-title .ic { width: 22px; height: 22px; color: var(--go); }
.ed-note { margin: -2px 0 6px; font-size: 15.5px; color: var(--ink); }
.ed { flex: 0 1 auto; min-height: 148px; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; background: #fffdf4; border: 3px solid #4aa9ff; border-radius: 14px; font: 500 17px/28px var(--mono); overflow-x: hidden; overflow-y: auto; box-shadow: 0 0 0 4px rgba(74, 169, 255, .18); }
.ed:focus-within { border-color: var(--go); box-shadow: 0 0 0 5px rgba(255, 216, 74, .55); }
.ed-gut { padding: 10px 9px 10px 11px; text-align: right; color: #6b6f8e; background: #ecebe0; border-right: 2px solid #d6d3c2; user-select: none; min-height: 100%; }
.ed-gut span { display: block; height: 28px; }
.ed-gut span.err { color: #c2263f; font-weight: 700; }
.ed-gut span.hint { color: #9a6a00; font-weight: 700; }
.ed-gut span.play { color: #1f5fbf; font-weight: 700; }
.ed-main { position: relative; }
.ed textarea { position: relative; z-index: 1; display: block; width: 100%; margin: 0; border: 0; background: transparent; color: #14143a; font: inherit; line-height: 28px; padding: 10px 12px; resize: none; outline: none; white-space: pre; overflow-x: auto; overflow-y: hidden; tab-size: 4; caret-color: #d9480f; }
.ed textarea::placeholder { color: #8b8fa8; font-style: italic; }
.ed-hl { position: absolute; inset: 0; pointer-events: none; }
.ed-hl .ln { position: absolute; left: 0; right: 0; height: 28px; }
.ed-hl .ln.err { background: rgba(232, 69, 90, .2); box-shadow: inset 4px 0 0 #e8455a; }
.ed-hl .ln.hint { background: rgba(255, 200, 0, .28); box-shadow: inset 4px 0 0 #e0a800; }
.ed-hl .ln.play { background: rgba(74, 169, 255, .18); }
.ed-hl .ln.task { background: rgba(255, 216, 74, .42); box-shadow: inset 5px 0 0 #f0a400, 0 0 0 2px #f0a400; border-radius: 4px; animation: taskglow 1.4s ease-in-out 3; }
@keyframes taskglow { 50% { background: rgba(255, 216, 74, .7); } }
.ln-tag { position: absolute; right: 8px; top: 3px; display: inline-flex; align-items: center; gap: 3px; padding: 0 8px; height: 22px; border-radius: 999px; background: #1b2148; color: #fff3a6; font: 700 13px/22px var(--text); white-space: nowrap; }
.ln-tag .ic { width: 14px; height: 14px; transform: rotate(180deg); }
.edrun { margin-top: 6px; }
.ed-help { flex: none; font-size: 13.5px; color: var(--dim); margin: 4px 0 0; }
.ex { position: relative; }
.ex-tag { display: inline-block; font: 700 11px var(--text); letter-spacing: .06em; text-transform: uppercase; color: #b3bbe0; background: #26306a; border-radius: 6px; padding: 1px 7px; }
.ex > .ex-tag { position: absolute; top: 5px; right: 6px; z-index: 1; pointer-events: none; }
.ex .code { padding-right: 84px; }
.cmdcard .ex-tag { border-radius: 6px; }
.cmdcard { flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; background: var(--panel2); border: 1px dashed #5d6cb8; border-radius: 12px; padding: 6px 12px; margin-bottom: 8px; font-size: 15.5px; }
.codecard { display: flex; flex-direction: column; }

/* coach panel: feedback, hints, prediction */
.coach { position: relative; margin-top: 8px; padding-right: 2px; overflow: auto; max-height: 46vh; }
.coach-empty { margin: 4px 0 0; padding: 10px 12px; border-radius: 12px; border: 1px dashed var(--line); color: var(--dim); font-size: 15px; }
.coach:has(.fb.show) .coach-empty, .coach:has(.hint:not([hidden])) .coach-empty, .ctop:not(:empty) ~ .coach-empty { display: none; }
.fb { display: none; }
.fb.show { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; margin-top: 8px; padding: 10px 12px; border-radius: 14px; border: 2px solid var(--line); background: var(--panel2); }
.fb.good { border-color: var(--ok); background: #123326; }
.fb.try { border-color: var(--go); background: #2c2817; }
.fb.err { border-color: var(--bad); background: #331a24; }
.fb-kind { display: flex; align-items: center; gap: 6px; font: 800 17px var(--display); margin-bottom: .2em; }
.fb p { margin-bottom: .45em; }
.fix { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.fix span { font-weight: 700; }
.fix code { font-size: 16px; padding: .2em .6em; }
.hint { margin-top: 8px; padding: 10px 12px; border-radius: 14px; background: #29254a; border: 2px solid #8a7cff; }
.hint-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.hint-top b { display: flex; align-items: center; gap: 6px; font: 800 17px var(--display); color: #d9d2ff; }
.tip { margin-top: 8px; padding: 8px 10px; border-radius: 12px; background: rgba(0, 0, 0, .22); }
.tip h4 { font-size: 17px; margin: 2px 0; }
.tip-pass { font-weight: 700; color: #a8f0c6; margin: 0; }
.predict { padding: 10px 12px; border-radius: 14px; background: var(--panel2); border: 2px solid var(--go); }
.predict .row { margin: 6px 0; }
.pchip { border-color: var(--c); }
.pchip .rs { width: 16px; height: 16px; fill: var(--c); }
.pchip.sel { background: var(--c); color: #0c1020; }
.pchip.sel .rs { fill: #0c1020; }
.shortcut { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 4px 0; }
.shortcut p { margin: 0; color: var(--muted); }
.checkpoint { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; align-items: start; padding: 10px 12px; border-radius: 14px; background: #123326; border: 2px solid var(--ok); }
.cp-mark { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; background: var(--ok); color: #06210f; }
.cp-mark .ic { width: 28px; height: 28px; }
.checkpoint h3 { font-size: 22px; margin: 0 0 2px; }
.checkpoint p { margin: 0; }
.cp-mini { display: flex; align-items: center; gap: 6px; font-weight: 700; color: #a8f0c6; }
.fullcode { padding: 4px 0; }
.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.checklist li { display: flex; align-items: center; gap: 10px; padding: 5px 10px; border-radius: 10px; background: var(--panel2); font-size: 15.5px; }
.checklist .gk { display: grid; place-items: center; flex: none; width: 26px; height: 26px; border-radius: 50%; border: 2px solid #5d6cb8; }
.checklist li.done .gk { background: #1f8a55; border-color: #1f8a55; color: #fff; }
.checklist li.done { color: #a8f0c6; }

/* words */
.anat { display: flex; justify-content: center; align-items: baseline; font: 700 clamp(28px, 4.4vw, 40px) var(--mono); margin: 4px 0 10px; padding: 10px; background: var(--well); border-radius: 14px; }
.a-cmd { color: #9fd0ff; } .a-par { color: #ffa23d; } .a-q { color: #3ad683; } .a-name { color: #ffe9a8; }
.anat-key { list-style: none; padding: 0; margin: 0 0 6px; display: grid; gap: 6px; }
.anat-key li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
#loopkey li { display: block; }
.card-top .say-ctl { margin: 0; }
.qdemo-body { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; align-items: start; }
.qdemo-body .code { margin: 4px 0; font-size: 15px; }
.anat-key .k { font: 700 17px var(--mono); padding: 0 6px; border-radius: 6px; background: var(--well); }
.order { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; margin-bottom: 10px; }
.o-code, .o-grid { position: relative; padding: 10px; border-radius: 12px; background: var(--well); }
.o-code span { display: block; font: 500 14.5px/1.8 var(--mono); }
.o-code i { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: var(--go); }
.o-code i .ic, .o-grid i .ic { width: 26px; height: 26px; }
.o-grid { display: flex; align-items: center; gap: 8px; padding-bottom: 34px; }
.o-grid span { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 9px; background: var(--c); color: #0c1020; font-weight: 800; }
.o-grid .o-rest { background: #1b2350; border: 1px solid #5d6cb8; color: var(--ink); }
.o-grid i { position: absolute; left: 12px; bottom: 6px; color: var(--go); }
.vocab { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.vcard { padding: 10px 12px; border-radius: 14px; background: var(--panel2); border-top: 6px solid var(--c, #5d6cb8); }
.vcard p { margin: 0; font-size: 16px; }
.vcard:nth-child(1) { --c: var(--purple); } .vcard:nth-child(2) { --c: var(--blue); } .vcard:nth-child(3) { --c: var(--green); } .vcard:nth-child(4) { --c: var(--orange); }
.vcard h3 { font-size: 22px; margin-bottom: 2px; }

/* quiz */
.qtop { display: flex; justify-content: space-between; align-items: center; gap: 8px; color: var(--muted); font-weight: 700; margin-bottom: 8px; }
.qdots { display: flex; gap: 6px; }
.qd { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--panel2); font-size: 14px; color: var(--ink); }
.qd.cur { box-shadow: 0 0 0 2px var(--go); }
.qd.ok { background: var(--ok); color: #06210f; }
.qd .ic { width: 16px; height: 16px; }
.quizcard h2 { font-size: 23px; line-height: 1.25; outline: none; }
.choices { display: grid; gap: 8px; margin: 10px 0; }
.choice { display: flex; align-items: center; gap: 12px; min-height: 54px; padding: 6px 14px; border-radius: 14px; border: 2px solid #3c4a8c; background: var(--panel2); color: var(--ink); font: 700 18px var(--text); text-align: left; cursor: pointer; }
.choice:hover:not(:disabled) { border-color: var(--go); }
.choice .letter { display: grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 10px; background: var(--well); font-family: var(--display); font-size: 19px; }
.choice .ct { flex: 1; }
.choice .cm { display: grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: 50%; }
.choice.right { border-color: var(--ok); background: #123326; opacity: 1; }
.choice.right .cm { background: var(--ok); color: #06210f; }
.choice.wrong { border-color: var(--bad); border-style: dashed; }
.choice.wrong .cm { background: #4a1f2a; color: var(--bad); }
.choice:disabled { cursor: default; }
.choice:disabled:not(.right) { opacity: .55; }
.qfb { padding: 8px 12px; border-radius: 12px; margin-bottom: 8px; }
.qfb p { margin: 0; }
.qfb.good { background: #123326; border: 2px solid var(--ok); }
.qfb.try { background: #2c2817; border: 2px solid var(--go); }
.qfb b { display: inline-flex; align-items: center; gap: 4px; }
.replay-offer { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 8px 12px; border-radius: 12px; background: var(--panel2); margin-bottom: 8px; }
.replay-offer p { margin: 0; }
.qdone { padding: 10px 12px; border-radius: 14px; background: #123326; border: 2px solid var(--ok); margin: 8px 0; }
.qdone p { margin: 0; }

/* badge */
.badgecard { padding: 16px 18px; border-radius: 24px; background: linear-gradient(160deg, #1d2a66, #121838 60%); border: 3px solid #5d6cb8; box-shadow: 0 0 0 5px #0d1226, 0 0 0 7px #2b3668; }
.bc-top { display: grid; grid-template-columns: auto auto minmax(0, 1fr); align-items: center; gap: 14px; margin-bottom: 6px; }
.bc-title { font-size: clamp(30px, 3.6vw, 44px); margin: 0; color: #fff; }
.bc-sub { font: 700 20px var(--display); color: var(--hot); margin: 0 0 4px; }
.bc-remix { font-size: 18px; margin: 0; }
.bc-remix b { color: var(--go); }
.bc-done { font: 700 18px/1.3 var(--display); text-align: center; margin: 8px 0 2px; }
.bonus { display: flex; justify-content: center; align-items: center; gap: 6px; color: #a8f0c6; font-weight: 700; margin: 2px 0; }
.bc-foot { text-align: center; color: var(--dim); font-size: 13.5px; margin: 4px 0 0; }
.side { padding: 14px; border-radius: 20px; background: #f6f3ea; color: #18183a; }
.side .sh-av { width: 72px; height: 72px; margin-bottom: 6px; }
.side .sh-ins { font-size: 18px; margin: 6px 0; }
.shots { margin: 4px 0 6px; padding-left: 20px; font-size: 15.5px; }
.reqs { list-style: none; margin: 0 auto; padding: 0; display: grid; gap: 8px; max-width: 560px; width: 100%; }
.reqs li { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 12px; background: var(--panel); }
.reqs .gk { display: grid; place-items: center; flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--panel2); }
.reqs li.done .gk { background: #1f8a55; color: #fff; }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 60; overflow: hidden; }
.cf { position: absolute; top: -40px; width: 26px; height: 26px; animation: fall 2.4s ease-in forwards; }
.cf .shape { width: 100%; height: 100%; fill: var(--c); }
@keyframes fall { to { transform: translateY(110vh) rotate(var(--rot)); opacity: .8; } }

/* tips, echo */
.tipgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.cool { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.coolcard { padding: 12px; border-radius: 14px; background: var(--panel2); }
.coolcard svg { width: 64px; height: 48px; }
.coolcard h3 { font-size: 19px; margin-top: 4px; }
.loopex { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; align-items: center; margin-bottom: 6px; }
.anatloop { font-size: 16px; margin: 0; }
.anatloop .kw { color: #9fd0ff; }
mark { color: inherit; border-radius: 5px; padding: 0 3px; }
mark.n { background: var(--go); color: #1a1530; font-weight: 700; }
mark.body { background: rgba(58, 214, 131, .2); box-shadow: inset 3px 0 0 var(--green); }
#predict-fb { font-weight: 700; min-height: 1.4em; margin: 0; }

/* dialogs and toasts */
.dlg { max-width: min(680px, calc(100vw - 24px)); width: 100%; max-height: calc(100dvh - 24px); padding: 20px; border-radius: 22px; border: 2px solid #5d6cb8; background: var(--panel); color: var(--ink); }
.dlg.wide { max-width: min(980px, calc(100vw - 24px)); }
.dlg.small { max-width: min(460px, calc(100vw - 24px)); }
.dlg::backdrop { background: rgba(5, 8, 20, .7); }
.dlg .x { position: absolute; right: 12px; top: 12px; }
.dlg-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; }
.dlg-head h2 { margin: 0; }
#cfm-msg { font-size: 19px; font-weight: 700; }
.wb { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 14px; align-items: center; padding-right: 40px; }
.tp { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 12px; }
.menu { display: grid; gap: 8px; margin: 10px 0; }
.vsel { display: grid; gap: 2px; font-weight: 700; font-size: 15px; }
.vsel select { min-height: 42px; max-width: 360px; border-radius: 10px; border: 2px solid var(--line); background: var(--well); color: var(--ink); font: 15px var(--text); padding: 4px 8px; }
.script summary { cursor: pointer; font-weight: 700; padding: 8px 0; }
.nscript { width: 100%; border-collapse: collapse; font-size: 14px; }
.nscript td, .nscript th { text-align: left; vertical-align: top; padding: 4px 6px; border-bottom: 1px solid var(--line); }
.nscript code { white-space: nowrap; }
.key { padding-left: 20px; }
.key li { margin-bottom: 5px; }
.toast { position: fixed; left: 50%; bottom: 86px; transform: translateX(-50%); z-index: 70; max-width: calc(100vw - 32px); padding: 12px 18px; border-radius: 14px; background: #f6f3ea; color: #18183a; font-weight: 700; box-shadow: 0 8px 30px rgba(0, 0, 0, .4); }

/* Fit mode: on a laptop screen the whole scene fits between the header and the action bar.
   The coach panel scrolls inside its card instead of pushing anything out of view. */
@media (min-width: 900px) and (min-height: 640px) {
  .scene.fit { height: 100%; min-height: 0; }
  .scene.fit .ws { flex: 1 1 auto; min-height: 0; }
  .scene.fit .ws > .card { min-height: 0; overflow: auto; }
  .scene.fit .codecard .sw { flex: 1 1 0; min-height: 96px; display: flex; flex-direction: column; }
  .scene.fit .codecard .edwrap { flex: 0 1 auto; }
  .scene.fit .coach { flex: 1 1 auto; max-height: none; min-height: 0; }
  .scene-welcome .pick { margin: auto; }
}
/* Shorter laptop screens (1280×720 and similar). */
@media (max-height: 800px) {
  :root { --rh: 34px; --rr: 30px; --th: 32px; --dh: 30px; }
  .sh { padding: 5px 12px 5px 6px; gap: 12px; }
  .sh-av { width: 60px; height: 60px; border-radius: 14px; }
  .sh-av svg { width: 54px; height: 54px; }
  .row { margin: 6px 0 2px; }
  main { padding-top: 10px; padding-bottom: 10px; }
  .sh-ins { font-size: 18px; }
  .sh-line { font-size: 15px; }
  .ed-title { font-size: 17px; }
  .ed-help { display: none; }
  .av-art svg { width: 120px; height: 120px; }
  .grid { row-gap: 4px; padding: 6px 8px; }
  .card { padding: 10px 14px; }
  .scene { gap: 8px; }
  .card-top { margin-bottom: 4px; }
  .card > p:last-child { margin-bottom: 0; }
  .tryrow { margin-bottom: 2px; }
  .anat { margin-bottom: 6px; padding: 6px; }
  .vcard h3 { font-size: 20px; }
}
@media (max-height: 680px) {
  .ws.even .card .row .btn.primary { min-height: 40px; }
}

/* narrower screens */
@media (max-width: 1440px) {
  .brand div { display: none; }
}
@media (max-width: 1240px) {
  .narr span { display: none; }
  .avchip span { display: none; }
  .avchip { padding-right: 4px; }
}
@media (max-width: 1100px) {
  .sh { grid-template-columns: auto minmax(0, 1fr); }
  .sh-side { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; }
  .slot { min-width: 0; }
  .titlefield input { width: 170px; }
  .vocab { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .top { grid-template-columns: auto auto; }
  .stagenav { grid-column: 1 / -1; grid-row: 2; }
  .tools { justify-self: end; }
  .ws, .ws.even, .ws.quiz, .ws.badge { grid-template-columns: minmax(0, 1fr); }
  .coach { max-height: 40vh; }
}
@media (max-width: 600px) {
  body { font-size: 16px; }
  .vol input { width: 60px; }
  .sh { grid-template-columns: minmax(0, 1fr); }
  .sh-av { display: none; }
  .strip { display: none; }
  .pick { grid-template-columns: minmax(0, 1fr); }
  .bc-top { grid-template-columns: auto minmax(0, 1fr); }
  .bc-medal { display: none; }
  .order, .loopex { grid-template-columns: minmax(0, 1fr); }
  .card { padding: 12px; }
  .titlefield { width: 100%; }
  .titlefield input { flex: 1; width: auto; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .confetti { display: none; }
}
@media print {
  body { display: block; height: auto; overflow: visible; background: #0d1226; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  main { overflow: visible; }
  .top, .actbar, .say-ctl, .row, .sh, .side, .preview-bar, .more-pill { display: none !important; }
}

/* narration, next-step buttons, free play studio, final screen */
.narr[aria-pressed="false"] { color: var(--muted); border-style: dashed; }
.narr .ic { width: 18px; height: 18px; }
.startsound { animation: pulse 1.4s ease-in-out 4; }
.next-here { margin: 8px 0 4px; }
.qfb .btn { margin-top: 6px; }
.checkpoint .btn { margin-top: 8px; }
.gdiv.minor { opacity: .25; }
.gridwrap.wide { overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; padding-bottom: 2px; }
.g16 .cell .tl, .g16 .rcell .tl, .g16 .tchip .tl, .g16 .dh .dl { display: none; }
.g16 .rowbtn .alt, .g16 .rowbtn .ic { display: none; }
.backing { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 15px; color: var(--muted); }
.backing select { min-height: 40px; border-radius: 10px; border: 2px solid #3c4a8c; background: var(--panel2); color: var(--ink); font: 700 15px var(--text); padding: 2px 8px; }
.badgecheck .bc-h { margin: 0 0 4px; display: flex; align-items: center; gap: 6px; }
.badgecheck .bc-h .ic { color: var(--ok); }
.badgecheck .muted { margin: 6px 0 0; }
.choose { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin: auto 0; }
.startcard { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 16px; border-radius: 18px; border: 3px solid var(--line); background: var(--panel); color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.startcard:hover:not(:disabled) { border-color: #7d8ce0; }
.startcard b { font: 800 21px var(--display); }
.startcard span:not(.mini) { color: var(--muted); font-size: 15.5px; }
.startcard.keep { border-color: var(--go); background: var(--panel2); }
.startcard:disabled { opacity: .5; cursor: not-allowed; }
.mini { display: flex; gap: 3px; margin-bottom: 4px; }
.mini i { width: 18px; height: 26px; border-radius: 5px; background: var(--c); }
.mini i.me { background: transparent; border: 1px dashed #4a5590; }
.mini i.mr { background: #2b3880; }
.side-title { font-size: 24px; line-height: 1.2; color: #14143a; margin: 4px 0 8px; }
.bc-kicker { margin: 0; font: 700 14px var(--text); color: #b3bbe0; letter-spacing: .02em; }
.side .btn.primary { background: var(--go); border-color: #d4a900; color: #1a1530; }
@media (max-height: 740px) {
  :root { --rh: 32px; --rr: 28px; --th: 31px; --dh: 29px; }
}
.gridwrap.wide .glab { position: sticky; left: 0; z-index: 3; background: var(--well); box-shadow: 6px 0 8px -4px rgba(0, 0, 0, .6); }

/* attention cues: one strong outline, one gentle pulse, and a small label with an arrow */
.cue { outline: 4px solid #ffd84a !important; outline-offset: 3px; border-radius: 10px; position: relative; z-index: 4; }
.ln.cue { outline-offset: 1px; }
.cue-pulse { animation: cuepulse .9s ease-out 1; }
@keyframes cuepulse { 0% { box-shadow: 0 0 0 0 rgba(255, 216, 74, .75); } 100% { box-shadow: 0 0 0 16px rgba(255, 216, 74, 0); } }
.cue-tag { position: fixed; z-index: 80; display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px 3px 6px; border-radius: 999px; background: #ffd84a; color: #1a1530; font: 800 14px var(--text); box-shadow: 0 4px 14px rgba(0, 0, 0, .45); pointer-events: none; white-space: nowrap; }
.cue-tag .cue-ar { display: grid; place-items: center; }
.cue-tag .ic { width: 16px; height: 16px; }
.cue-tag.below .cue-ar { transform: rotate(180deg); }
.ln.cuezone { background: transparent; border-radius: 6px; }

/* Level 5: Target Track and Your Track */
.twin-grids { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.trk { border-radius: 14px; padding: 0 0 2px; }
.trk-h { display: flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 12px 12px 0 0; font: 800 16px var(--display); }
.trk-h .ic { width: 18px; height: 18px; }
.trk.tgt { background: rgba(255, 216, 74, .08); border: 2px solid #c9a32a; }
.trk.tgt .trk-h { background: #4a3d10; color: #ffe07a; }
.trk.you { background: rgba(74, 169, 255, .08); border: 2px solid #3f7fd0; }
.trk.you .trk-h { background: #173a6a; color: #bfe0ff; }
.trk .gridwrap { margin: 0; }
.trk .grid { border-radius: 0 0 12px 12px; border: 0; }

/* quiz: locked while the explanation is read */
.choices.locked .choice { cursor: default; }
.choices.locked .choice:not(.picked):not(.right) { opacity: .55; }
.choice.picked { box-shadow: 0 0 0 3px #fff; }
.qwait { margin: 6px 0 0; font-style: italic; }
.replaycue { margin: 6px 0; }

/* Unit 1 finish and Unit 2 */
.d2link { margin-top: 10px; width: 100%; background: #1b2148 !important; color: #fff3a6 !important; border-color: #1b2148 !important; }
.panel-lab { display: flex; align-items: center; gap: 6px; margin: 6px 0 4px; font: 800 15px var(--display); color: #fff3a6; letter-spacing: .02em; }
.panel-lab .ic { width: 18px; height: 18px; }
.outp { min-height: 58px; max-height: 120px; overflow: auto; padding: 8px 12px; border-radius: 12px; background: #050816; border: 2px solid #2f8f5b; font: 500 16px/1.6 var(--mono); color: #b7ffcf; }
.outp.flash { animation: outflash 1.2s ease-out 1; }
@keyframes outflash { 0% { background: #12402a; } 100% { background: #050816; } }
.out-line { display: flex; gap: 10px; align-items: baseline; }
.out-ln { font: 700 11.5px var(--text); color: #5fbf86; text-transform: uppercase; white-space: nowrap; }
.out-empty { margin: 0; color: #6f8f7c; font: italic 15px var(--text); }
.d2out .gridwrap { margin-top: 0; }
.defcall { padding: 8px 12px; border-radius: 12px; background: var(--panel2); border-left: 4px solid var(--go); }
.defcall p { margin: 0 0 2px; }
.calls { width: 100%; border-collapse: collapse; margin-bottom: 8px; font-size: 15px; }
.calls caption { text-align: left; font-weight: 700; padding-bottom: 4px; }
.calls td { padding: 3px 6px; border-bottom: 1px solid var(--line); }
.d2card { background: linear-gradient(160deg, #1d2a66, #121838 60%); border: 3px solid #5d6cb8; }
.announce { font: 700 24px/1.3 var(--display); color: var(--go); text-align: center; margin: 10px 0; }
.stage.back1 .dot { background: #1b2148; }
.pchip.sel, .predict .btn.sel { background: var(--go); color: #1a1530; border-color: var(--go); }
@media (prefers-reduced-motion: reduce) {
  .cue-pulse, .outp.flash, .ln.task { animation: none !important; }
}
@media (min-width: 900px) and (min-height: 640px) {
  .scene.fit .ws > .card.score:has(.sw) { display: flex; flex-direction: column; }
  .scene.fit .card.score .sw { flex: 1 1 0; min-height: 90px; display: flex; flex-direction: column; }
  .scene.fit .card.score .coach { flex: 1 1 auto; max-height: none; min-height: 0; }
}
.cue-tag.side .cue-ar { transform: rotate(90deg); }

/* Unit 2: Level 5 hand-off, Free Play, badge and the unit menu */
.sh-insrow { display: flex; align-items: center; gap: 10px 16px; flex-wrap: wrap; }
.sh-insrow .sh-ins { flex: 1 1 380px; }
.sh-act { flex: none; }
.sh .btn.primary { background: var(--go); border-color: #d4a900; color: #1a1530; }
.btn.big { font-size: 19px; padding: 12px 20px; border-radius: 16px; box-shadow: 0 4px 0 #b08d00; }
.praise { font: 700 19px/1.4 var(--text); color: #14143a; margin: 0 0 10px; }
.side .row.three { flex-wrap: wrap; }
.ann-lab { display: block; font: 700 13px var(--text); color: #b3bbe0; letter-spacing: .02em; text-transform: uppercase; margin-bottom: 2px; }
.badgecard.bp { border-color: #d4a900; box-shadow: 0 0 0 5px #0d1226, 0 0 0 7px #8a6d00; }
.units { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; align-content: start; max-width: 1100px; margin: 0 auto; width: 100%; }
.unitcard { display: flex; flex-direction: column; gap: 6px; border-width: 3px; }
.unitcard h2 { margin: 0; font-size: 26px; }
.unitcard p { margin: 0; }
.unitcard.done { border-color: #1f8a55; }
.unitcard.locked { opacity: .75; }
.u-kicker { font: 700 14px var(--text); color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }
.u-status { font-weight: 700; display: flex; align-items: center; gap: 6px; color: var(--muted); }
.u-status.done { color: #a8f0c6; }
.u-status .ic { width: 18px; height: 18px; }
.u-proj { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.u-proj .mini { margin: 0; }
.unitcard .row { margin-top: 6px; }
/* Long grids: stack the "new" tag under the step number so they never overlap. */
.g16 .gnum { flex-direction: column; gap: 1px; line-height: 1.1; }
.g16 .chg-tag { font-size: 10.5px; padding: 0 3px; line-height: 1.35; }
