/* Layout: one centered column. Student screens are big-target game cards; teacher screens are dense tables on the same dark ground.
   The accent pair (--acc, --acc2) is swapped at runtime by the child's chosen world. */
:root {
  color-scheme: dark;
  --bg: #11121a; --panel: #1a1c28; --panel2: #232638; --line: #32364c; --text: #f4f1e8; --muted: #a4a9bd; --ink: #14151c;
  --acc: #ff8a1f; --acc2: #4f8dff; --good: #57d98a; --bad: #ff6f6f; --warn: #ffd166;
  --f0: #ff7a90; --f1: #ffc857; --f2: #6ee7a8; --f3: #6ab8ff; --f4: #c9a0ff;
  --paper: #ffffff; --pen: #111111; --rule: #9aa0aa;
  --display: 'Chakra Petch', 'Trebuchet MS', 'Segoe UI', system-ui, sans-serif;
  --body: 'Nunito', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --r: 14px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 17px/1.5 var(--body); }
#app { max-width: 980px; margin: 0 auto; padding-block: 20px 56px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); display: flex; flex-direction: column; gap: 22px; }
h1, h2, h3 { font-family: var(--display); margin: 0; line-height: 1.15; text-wrap: balance; }
h1 { font-size: clamp(1.6rem, 4.5vw, 2.3rem); } h2 { font-size: 1.3rem; } h3 { font-size: 1.05rem; }
p { margin: 0; } ol, ul { margin: 0; padding: 0; }
.eyebrow { font: 700 .78rem var(--display); letter-spacing: .12em; text-transform: uppercase; color: var(--acc); }
.muted { color: var(--muted); } .small { font-size: .85rem; } .lead { font-size: 1.15rem; color: var(--muted); }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
section, article { display: flex; flex-direction: column; gap: 12px; min-width: 0; }

.btn { font: 800 1rem var(--body); color: var(--ink); background: var(--acc); border: 0; border-radius: 12px; padding: 10px 16px; cursor: pointer; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-align: center; }
.btn:hover { filter: brightness(1.08); } .btn:active { transform: translateY(1px); }
.btn:focus-visible, .task:focus-visible, .tile:focus-visible, .unit:focus-visible, .choice:focus-visible, .chip:focus-visible, .who-card:focus-visible, .tabs button:focus-visible, .pillbtn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--text); outline-offset: 2px; }
.btn.ghost { background: transparent; color: var(--text); border: 1.5px solid var(--line); }
.btn.alt { background: var(--acc2); } .btn.bad { background: var(--bad); }
.btn.big { font-size: 1.2rem; padding: 16px 26px; border-radius: 16px; min-width: 190px; }
.btn.big small { font: 600 .78rem var(--body); opacity: .8; max-width: 22ch; }
.btn.sm { font-size: .82rem; padding: 5px 10px; border-radius: 9px; }
.btn[disabled], .choice[disabled], .chip[disabled] { opacity: .65; cursor: default; }
.acts { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; } .acts.left { justify-content: flex-start; align-items: center; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.panel.win { border-color: var(--good); color: var(--good); font-weight: 800; text-align: center; }
.panel.tip { border-left: 5px solid var(--acc2); align-items: flex-start; } .panel.read { font-size: 1.12rem; line-height: 1.7; align-items: flex-start; } .panel.read p { max-width: 65ch; }
.panel.proj { border-style: dashed; align-items: flex-start; } .panel.left { text-align: left; align-self: stretch; }
.pill { display: inline-block; font: 800 .78rem var(--body); padding: 2px 10px; border-radius: 99px; background: var(--panel2); color: var(--warn); white-space: nowrap; }
.pill.good { color: var(--ink); background: var(--good); }
.bar { height: 14px; background: var(--panel2); border-radius: 99px; overflow: hidden; flex: 1; min-width: 60px; }
.bar > i { display: block; height: 100%; background: var(--acc); border-radius: 99px; transition: width .3s; }
.bar.thin { height: 8px; } .bar.hp > i { background: var(--bad); } .bar.boss > i { background: var(--acc2); }

label { font-weight: 800; font-size: .92rem; }
input, select, textarea { font: 600 1.05rem var(--body); color: var(--text); background: var(--bg); border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 12px; width: 100%; min-width: 0; }
textarea { resize: vertical; line-height: 1.5; } input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--acc); }
.ansrow { display: flex; gap: 10px; flex-wrap: wrap; } .ansrow input { flex: 1 1 200px; font-size: 1.4rem; padding: 14px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; } .two > div { display: flex; flex-direction: column; gap: 4px; }
.stack { display: flex; flex-direction: column; gap: 8px; }

/* player select */
.who { align-items: center; text-align: center; gap: 22px; padding-top: 6vh; }
.who-grid { display: flex; flex-wrap: wrap; gap: 18px; justify-content: center; }
.who-card { font: inherit; color: var(--text); background: var(--panel); border: 2px solid var(--line); border-radius: 22px; padding: 26px 34px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 180px; }
.who-card:hover { border-color: var(--acc); } .who-card b { font: 700 1.5rem var(--display); } .who-card small { color: var(--muted); }
.who-av { font-size: 4rem; line-height: 1; } .who-av.sm { font-size: 2.8rem; }
.pinrow { justify-content: center; } .pinrow input { max-width: 220px; text-align: center; letter-spacing: .3em; }

/* home */
.hero { background: linear-gradient(135deg, color-mix(in srgb, var(--acc) 22%, var(--panel)), var(--panel) 60%); border: 1px solid var(--line); border-radius: 22px; padding: 20px; display: grid; grid-template-columns: 1fr auto; gap: 14px 20px; align-items: center; }
.hero-id { display: flex; gap: 14px; align-items: center; min-width: 0; } .rank { color: var(--acc); font-weight: 800; }
.hero-stats { display: flex; gap: 18px; } .hero-stats div { display: flex; flex-direction: column; align-items: center; } .hero-stats b { font: 700 1.4rem var(--display); } .hero-stats small { color: var(--muted); font-size: .75rem; }
.hero-xp { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; } .hero-xp small { color: var(--muted); white-space: nowrap; }
.row-h { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.mission { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.task { width: 100%; font: inherit; color: var(--text); text-align: left; background: var(--panel); border: 2px solid var(--line); border-radius: 18px; padding: 14px 16px; cursor: pointer; display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; }
.task-ic { font-size: 2rem; } .task-t { display: flex; flex-direction: column; min-width: 0; } .task-t b { font-size: 1.15rem; } .task-t small { color: var(--muted); }
.task-go { font: 700 .95rem var(--display); color: var(--muted); padding: 8px 14px; border-radius: 12px; border: 1.5px solid var(--line); }
.task.next { border-color: var(--acc); box-shadow: 0 0 0 4px color-mix(in srgb, var(--acc) 22%, transparent); } .task.next .task-go { background: var(--acc); color: var(--ink); border-color: var(--acc); font-size: 1.15rem; }
.task.done { opacity: .6; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.tile { font: inherit; color: var(--text); background: var(--panel); border: 1.5px solid var(--line); border-radius: 18px; padding: 14px; cursor: pointer; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; text-align: left; min-width: 0; }
.tile:hover, .tile.sel { border-color: var(--acc); } .tile-ic { font-size: 1.9rem; } .tile small { color: var(--muted); } .tile .bar { width: 100%; flex: none; }
.foot { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.top, .qtop { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; } .top h2 { text-align: center; }
.units { display: flex; flex-direction: column; gap: 8px; } .units h3 { margin-top: 14px; color: var(--muted); }
.unit { font: inherit; color: var(--text); text-align: left; background: var(--panel); border: 1.5px solid var(--line); border-radius: 14px; padding: 12px 14px; cursor: pointer; display: grid; grid-template-columns: 28px 1fr auto; gap: 10px; align-items: center; }
.unit.next { border-color: var(--acc); } .unit.done b { color: var(--muted); font-weight: 600; }
.lesson { max-width: 720px; width: 100%; margin: 0 auto; gap: 16px; } .lesson ol { padding-left: 22px; }
.vocab { margin: 0; } .vocab dt { font: 700 1.1rem var(--display); margin-top: 10px; } .vocab dd { margin: 0; color: var(--muted); }
.words { font-size: 1.15rem; line-height: 2; } summary { cursor: pointer; font-weight: 800; }
.stem { font-size: 1.1rem; font-weight: 600; margin-top: 6px; } .stem b { color: var(--acc); }

/* quiz */
.bossbar { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 14px; }
.boss-em { font-size: 2.6rem; } .bossbar > div { display: flex; flex-direction: column; gap: 6px; }
.qcard { max-width: 720px; width: 100%; margin: 0 auto; gap: 18px; }
.qtext { font: 700 clamp(1.4rem, 4vw, 2rem)/1.3 var(--body); }
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.choice { font: 700 1.2rem var(--body); color: var(--text); background: var(--panel); border: 2px solid var(--line); border-radius: 16px; padding: 16px; cursor: pointer; text-align: left; display: flex; gap: 12px; align-items: center; }
.choice:hover:not([disabled]) { border-color: var(--acc); } .choice kbd { font: 700 .8rem var(--display); color: var(--muted); border: 1.5px solid var(--line); border-radius: 7px; padding: 1px 7px; }
.choice.right { border-color: var(--good); background: color-mix(in srgb, var(--good) 18%, var(--panel)); opacity: 1; } .choice.wrong { border-color: var(--bad); }
.ord-line { min-height: 66px; border-bottom: 3px solid var(--line); display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 8px 0; } .ord-bank { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { font: 700 1.15rem var(--body); color: var(--text); background: var(--panel2); border: 2px solid var(--line); border-radius: 12px; padding: 9px 14px; cursor: pointer; } .chip.used { visibility: hidden; }
.flash, .copyword { font: 700 2.4rem var(--display); letter-spacing: .06em; min-height: 1.2em; color: var(--acc); }
.fb { border-radius: var(--r); padding: 14px 16px; display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; font-size: 1.1rem; }
.fb.ok { background: color-mix(in srgb, var(--good) 20%, var(--panel)); border: 1.5px solid var(--good); } .fb.no { background: color-mix(in srgb, var(--bad) 16%, var(--panel)); border: 1.5px solid var(--bad); }
.fb p { flex-basis: 100%; color: var(--muted); } .fb .btn { margin-left: auto; }
.result { align-items: center; text-align: center; gap: 14px; padding-top: 3vh; } .big-em { font-size: 4.5rem; line-height: 1; } .xp { font: 700 1.6rem var(--display); color: var(--acc); }
.misses { list-style: none; display: flex; flex-direction: column; gap: 6px; } .misses b { color: var(--good); }

/* typing */
.ty-tip { text-align: center; font-weight: 800; color: var(--acc2); min-height: 1.5em; }
.ty-text { font: 600 clamp(1.3rem, 3.4vw, 1.9rem)/1.9 ui-monospace, 'Cascadia Mono', Consolas, monospace; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; white-space: pre-wrap; overflow-wrap: anywhere; }
.ty-ok { color: var(--good); } .ty-bad { color: var(--bad); text-decoration: underline; } .ty-cur { background: var(--acc); color: var(--ink); border-radius: 4px; }
.shake { animation: shake .18s; } @keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.hands { display: flex; justify-content: center; align-items: flex-end; gap: 6px; } .hands em { width: 26px; }
.finger { width: 20px; height: 44px; border-radius: 10px 10px 4px 4px; opacity: .3; background: var(--muted); }
.finger:nth-of-type(1), .finger:nth-of-type(10) { height: 32px; } .finger:nth-of-type(5), .finger:nth-of-type(6) { height: 22px; width: 26px; }
.finger.on { opacity: 1; transform: translateY(-5px); }
.finger.f0, .key.f0 { --fc: var(--f0); } .finger.f1, .key.f1 { --fc: var(--f1); } .finger.f2, .key.f2 { --fc: var(--f2); } .finger.f3, .key.f3 { --fc: var(--f3); } .finger.f4, .key.f4 { --fc: var(--f4); }
.finger { background: var(--fc, var(--muted)); }
.kb { display: flex; flex-direction: column; gap: 5px; align-items: center; max-width: 100%; overflow-x: auto; padding-bottom: 4px; }
.kr { display: flex; gap: 5px; } .kr1 { margin-left: 18px; } .kr2 { margin-left: 30px; }
.key { width: clamp(22px, 5.6vw, 44px); height: clamp(26px, 5.6vw, 44px); border-radius: 8px; background: var(--panel2); border-bottom: 3px solid var(--fc, var(--line)); display: grid; place-items: center; font: 700 clamp(.7rem, 2vw, 1rem) var(--display); text-transform: uppercase; color: var(--muted); flex: none; }
.key.wide { width: clamp(38px, 9vw, 76px); font-size: .7rem; } .key.space { width: min(320px, 60vw); font-size: .7rem; }
.key.bump::after { content: ''; width: 10px; height: 2px; background: var(--muted); position: relative; top: -6px; grid-area: 1 / 1; align-self: end; }
.key.on { background: var(--fc, var(--acc)); color: var(--ink); transform: scale(1.12); }

/* reading */
.wordlist { list-style: none; display: flex; flex-direction: column; gap: 8px; } .wordlist li { display: grid; grid-template-columns: minmax(80px, 140px) 1fr auto; gap: 10px; align-items: center; } .wordlist b { overflow-wrap: anywhere; }

/* teacher */
.t-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.pills, .tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; } .pills.wrap { flex-wrap: wrap; }
.pillbtn, .tabs button { font: 800 .95rem var(--body); color: var(--muted); background: transparent; border: 1.5px solid var(--line); border-radius: 99px; padding: 7px 14px; cursor: pointer; white-space: nowrap; }
.pillbtn.on { background: var(--acc); color: var(--ink); border-color: var(--acc); }
.tabs { border-bottom: 1px solid var(--line); gap: 2px; } .tabs button { border: 0; border-radius: 10px 10px 0 0; border-bottom: 3px solid transparent; } .tabs button.on { color: var(--text); border-bottom-color: var(--acc); }
.t-body { display: flex; flex-direction: column; gap: 16px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; display: flex; flex-direction: column; } .stat b { font: 700 1.35rem var(--display); } .stat small { color: var(--muted); }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.plain { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.chart { display: flex; gap: 6px; align-items: flex-end; height: 130px; } .cb { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; } .cb i { width: 100%; background: var(--acc2); border-radius: 5px 5px 0 0; min-height: 2px; } .cb small { color: var(--muted); font-size: .7rem; }
.prog { display: flex; flex-direction: column; gap: 10px; } .prow { display: grid; grid-template-columns: minmax(130px, 190px) minmax(60px, 1fr) auto minmax(0, 1.4fr); gap: 12px; align-items: center; } .prow .muted { font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prow.print { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) auto; padding: 10px 0; border-top: 1px solid var(--line); }
.scroll { overflow-x: auto; } table { border-collapse: collapse; width: 100%; font-size: .93rem; } th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; } th { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; }
tr.grp td { font: 700 .95rem var(--display); color: var(--acc); background: var(--panel); } .rowacts { display: flex; gap: 6px; flex-wrap: wrap; min-width: 250px; }
.sched td, .sched th { text-align: center; } .sched td:first-child, .sched th:first-child { text-align: left; white-space: nowrap; }
.entry { border-top: 1px solid var(--line); padding-top: 10px; display: flex; flex-direction: column; gap: 4px; }
.writing { font: 600 1.05rem/1.6 var(--body); white-space: pre-wrap; background: var(--bg); border-radius: 10px; padding: 12px; margin: 0; overflow-wrap: anywhere; }
.inline { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; } .inline input { flex: 1 1 140px; width: auto; } .inline input[type=checkbox] { flex: none; } .chk { display: inline-flex; gap: 6px; align-items: center; white-space: nowrap; }
.formgrid { display: grid; grid-template-columns: minmax(120px, 220px) 1fr; gap: 10px 14px; align-items: center; }

#toast { position: fixed; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--text); color: var(--ink); font-weight: 800; padding: 10px 18px; border-radius: 99px; z-index: 40; max-width: 90vw; text-align: center; }
#modal { position: fixed; inset: 0; background: rgba(8, 9, 14, .78); display: grid; place-items: center; z-index: 30; padding: 16px; }
.modal-box { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 20px; width: min(520px, 100%); display: flex; flex-direction: column; gap: 12px; }

/* printables */
#print { background: var(--rule); min-height: 100vh; padding: 0 0 30px; }
.print-bar { position: sticky; top: env(safe-area-inset-top, 0px); background: var(--panel); color: var(--text); padding: 10px 16px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; z-index: 5; font-size: .85rem; }
.sheet { background: var(--paper); color: var(--pen); width: min(8.5in, 100%); min-height: 11in; margin: 18px auto; padding: .6in; font: 15px/1.5 Georgia, 'Times New Roman', serif; display: flex; flex-direction: column; gap: 12px; }
.sheet h1 { font: 700 22px Georgia, serif; } .sheet h3 { font: 700 15px Georgia, serif; margin-top: 8px; }
.sh-head { display: flex; justify-content: space-between; gap: 16px; border-bottom: 2px solid var(--pen); padding-bottom: 8px; } .sh-head p { font-size: 12px; max-width: 46ch; } .sh-meta { display: flex; flex-direction: column; gap: 4px; font-size: 13px; white-space: nowrap; }
.qlist { padding-left: 24px; columns: 2; column-gap: 34px; } .qlist.one { columns: 2; } .qlist li { break-inside: avoid; margin-bottom: 12px; }
.opts { display: flex; flex-wrap: wrap; gap: 4px 18px; } .work { height: 46px; } .wl { border-bottom: 1px solid var(--rule); height: 32px; }
.wl.ruled { height: 40px; border-bottom: 1.5px solid var(--pen); background: linear-gradient(to bottom, transparent 49%, var(--rule) 49%, var(--rule) 51%, transparent 51%); background-size: 8px 100%; }
.model { font: 22px 'Comic Sans MS', 'Segoe Print', cursive; margin-top: 10px; } .dotted { letter-spacing: 1px; overflow: hidden; white-space: nowrap; }
.keylist { padding-left: 24px; columns: 3; } .sh-table { color: var(--pen); font-size: 13px; } .sh-table th { color: var(--pen); } .sh-table th, .sh-table td { border: 1px solid var(--pen); height: 34px; } .sh-table.tall td { height: 38px; }
body.printing #app { display: none; }
@media (max-width: 620px) { .hero { grid-template-columns: 1fr; } .prow { grid-template-columns: 1fr auto; } .prow .bar { grid-column: 1 / -1; order: 3; } .prow > .muted { grid-column: 1 / -1; order: 4; } .prow.print { grid-template-columns: 1fr; } .formgrid { grid-template-columns: 1fr; } .qlist, .keylist { columns: 1; } .sheet { padding: 20px; } .kr1, .kr2 { margin-left: 0; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
@media print { body { background: #fff; } #app, #toast, #modal, .print-bar { display: none !important; } #print { background: none; padding: 0; min-height: 0; } .sheet { margin: 0; width: auto; min-height: 0; padding: 0; page-break-after: always; } @page { margin: .6in; } }
.bossbar .bar { flex: none; width: 100%; }
.prow > * { min-width: 0; }
.loginbox { width: min(360px, 100%); text-align: left; }
.pill.warn { color: var(--ink); background: var(--warn); }
.warnbox { border-color: var(--warn); color: var(--warn); }
.track { position: relative; height: 22px; background: var(--panel2); border-radius: 99px; margin: 10px 0 4px; }
.track > i { display: block; height: 100%; background: var(--acc); border-radius: 99px; min-width: 6px; }
.track > em { position: absolute; top: -7px; bottom: -7px; width: 4px; margin-left: -2px; background: var(--text); border-radius: 2px; }
.jnums { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.jnums div { display: flex; flex-direction: column; } .jnums b { font: 700 1.25rem var(--display); } .jnums small { color: var(--muted); }
.grade { display: inline-grid; place-items: center; min-width: 30px; height: 26px; padding: 0 6px; border-radius: 8px; font: 700 .9rem var(--display); color: var(--ink); background: var(--good); }
.grade.gC, .grade.gD { background: var(--warn); } .grade.gHelp { background: var(--bad); }
