/* Physics in the Math Classroom · web design system (mirrors src/book.css) */
:root {
  --navy: #0f2c4d; --navy-2: #163d68; --blue: #1f6fb2; --blue-2: #5a9bd5; --sky: #eaf2fb; --sky-2: #d8e7f7;
  --orange: #e8772e; --orange-ink: #b4541a; --cream: #fff4ea;
  --ink: #1d2733; --muted: #5b6675; --rule: #d3dde8; --grid: #c9d7e6; --bg: #f5f8fc; --card: #ffffff;
  --ok: #17734b; --ok-bg: #e6f5ee; --bad: #c2412d; --bad-bg: #fdeceb; --warn: #b4541a; --warn-bg: #fff1e3;
  --review: #6b4fbb; --review-bg: #f0ecfb;
  --radius: 12px; --shadow: 0 1px 2px rgba(15,44,77,.06), 0 4px 14px rgba(15,44,77,.06);
  --head: Lexend, system-ui, sans-serif; --body: "Source Sans 3", system-ui, sans-serif; --mathf: "STIX Two Text", "Times New Roman", serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.5 var(--body); }
a { color: var(--blue); text-decoration-thickness: 1px; text-underline-offset: 2px; }
h1, h2, h3, h4 { font-family: var(--head); color: var(--navy); line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: 1.75rem; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 1.25rem; font-weight: 600; }
h3 { font-size: 1.05rem; font-weight: 600; }
p { margin: 0 0 .7em; }
code { font: .92em ui-monospace, Menlo, monospace; background: var(--sky); padding: 1px 5px; border-radius: 4px; }
:focus-visible { outline: 3px solid var(--blue-2); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); } .tiny { font-size: .82rem; color: var(--muted); } .small { font-size: .92rem; }
.hidden { display: none !important; }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 30; background: var(--navy); color: #fff; }
.topbar-in { max-width: 1180px; margin: 0 auto; display: flex; align-items: center; gap: 18px; padding: 0 20px; height: 58px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font: 600 1rem var(--head); white-space: nowrap; }
.brand-mark { width: 34px; height: 22px; background: linear-gradient(100deg, var(--orange) 0 38%, var(--blue-2) 38.5%, var(--blue) 100%);
  clip-path: polygon(0 0, 100% 0, 78% 100%, 0 100%); border-radius: 2px; }
.brand small { display: block; font: 500 .68rem var(--head); letter-spacing: .14em; text-transform: uppercase; color: #f6a868; }
.nav { display: flex; gap: 4px; margin-left: 8px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav a { color: #cfe0f2; text-decoration: none; font: 500 .92rem var(--head); padding: 8px 12px; border-radius: 8px; white-space: nowrap; }
.nav a:hover, .nav a[aria-current] { color: #fff; background: rgba(255,255,255,.1); }
.who { display: flex; align-items: center; gap: 10px; font-size: .9rem; color: #cfe0f2; white-space: nowrap; }
.who form { margin: 0; }
.topbar .btn-ghost { color: #fff; border-color: rgba(255,255,255,.3); }
.wedge-line { height: 4px; background: linear-gradient(100deg, var(--orange) 0 30%, var(--blue-2) 30.2%, var(--blue) 100%); }

main.wrap { max-width: 1180px; margin: 0 auto; padding: 28px 20px 80px; }
main.narrow { max-width: 760px; }
.crumbs { font-size: .9rem; color: var(--muted); margin-bottom: 10px; }
.crumbs a { color: var(--muted); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { margin: 0; }
.kicker { font: 600 .74rem var(--head); letter-spacing: .14em; text-transform: uppercase; color: var(--orange-ink); margin-bottom: 4px; }

/* ---------- buttons & forms ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: 600 .95rem var(--head); border-radius: 10px;
  padding: 10px 18px; border: 1.5px solid transparent; cursor: pointer; text-decoration: none; background: var(--blue); color: #fff;
  min-height: 44px; transition: background .15s, transform .05s; }
.btn:hover { background: #185d96; } .btn:active { transform: translateY(1px); }
.btn-orange { background: #b4541a; } .btn-orange:hover { background: #96440f; } /* white text needs ≥4.5:1 */
.btn-navy { background: var(--navy); } .btn-navy:hover { background: var(--navy-2); }
.btn-ghost { background: transparent; color: var(--navy); border-color: var(--rule); }
.btn-ghost:hover { background: var(--sky); }
.btn-sm { padding: 6px 12px; min-height: 34px; font-size: .85rem; border-radius: 8px; }
.btn-danger { background: transparent; color: var(--bad); border-color: #f0c4bd; } .btn-danger:hover { background: var(--bad-bg); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
label.lbl { display: block; font: 600 .85rem var(--head); color: var(--navy); margin: 0 0 6px; }
input[type=text], input[type=password], input[type=number], input:not([type]), select, textarea {
  font: 1rem var(--body); color: var(--ink); background: #fff; border: 1.5px solid var(--rule); border-radius: 10px; padding: 10px 12px;
  min-height: 44px; width: 100%; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(31,111,178,.18); }
textarea { min-height: 84px; resize: vertical; line-height: 1.45; }
.field-row { margin-bottom: 16px; }
.err { background: var(--bad-bg); color: var(--bad); border-radius: 10px; padding: 10px 14px; margin-bottom: 14px; font-weight: 600; }
.note { background: var(--sky); border-radius: 10px; padding: 10px 14px; margin-bottom: 14px; }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; color: var(--navy); }
.switch input { width: 42px; height: 24px; appearance: none; background: var(--rule); border-radius: 12px; position: relative; cursor: pointer; min-height: 0; padding: 0; border: 0; transition: background .15s; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: left .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked { background: var(--blue); } .switch input:checked::after { left: 21px; }
.seg { display: inline-flex; background: var(--sky); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { font: 600 .85rem var(--head); color: var(--navy); background: none; border: 0; padding: 7px 12px; border-radius: 8px; cursor: pointer; min-height: 34px; }
.seg button[aria-pressed=true] { background: #fff; box-shadow: var(--shadow); color: var(--blue); }

/* ---------- cards ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid #e4ebf3; padding: 20px 22px; }
.card + .card { margin-top: 16px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.card-link { display: block; text-decoration: none; color: inherit; transition: transform .1s, box-shadow .15s; }
.card-link:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(15,44,77,.08), 0 10px 24px rgba(15,44,77,.1); }
.card h3 { margin-bottom: 4px; }
.card-top { border-top: 5px solid var(--blue); } .card-top.orange { border-top-color: var(--orange); }
.stat { font: 700 1.6rem var(--head); color: var(--navy); line-height: 1; }
.stat small { font: 500 .78rem var(--body); color: var(--muted); display: block; margin-top: 4px; }
.stats { display: flex; gap: 26px; flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; gap: 6px; font: 600 .74rem var(--head); padding: 3px 9px; border-radius: 999px; background: var(--sky); color: var(--navy); white-space: nowrap; }
.pill.ok { background: var(--ok-bg); color: var(--ok); } .pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); } .pill.review { background: var(--review-bg); color: var(--review); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #b9c4d0; display: inline-block; }
.dot.on { background: #2fbf71; box-shadow: 0 0 0 3px rgba(47,191,113,.2); }
.progress { height: 8px; background: var(--sky); border-radius: 4px; overflow: hidden; display: flex; }
.progress i { display: block; height: 100%; background: var(--blue); }
.progress i.ok { background: var(--ok); }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty h3 { color: var(--navy); }

/* ---------- landing ---------- */
.hero { background: radial-gradient(120% 120% at 85% 0%, #1d4f84 0%, var(--navy) 55%, #0a1f37 100%); color: #fff; }
.hero-in { max-width: 1180px; margin: 0 auto; padding: 64px 20px 72px; display: grid; grid-template-columns: 1.2fr 1fr; gap: 40px; align-items: center; }
.hero h1 { color: #fff; font-size: clamp(2rem, 4.2vw, 3rem); line-height: 1.08; margin-bottom: 14px; }
.hero .kicker { color: #f6a868; }
.hero p { color: #d6e4f2; font-size: 1.1rem; max-width: 560px; }
.hero-rule { width: 80px; height: 5px; background: var(--orange); border-radius: 3px; margin: 0 0 18px; }
.role-cards { display: grid; gap: 14px; }
.role { background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.16); border-radius: 16px; padding: 20px 22px; color: #fff; text-decoration: none; display: flex; gap: 16px; align-items: center; transition: background .15s; }
.role:hover { background: rgba(255,255,255,.12); }
.role-ic { width: 48px; height: 48px; border-radius: 12px; background: var(--orange); display: grid; place-items: center; flex: none; font: 700 1.3rem var(--head); }
.role.teacher .role-ic { background: var(--blue); }
.role b { font: 600 1.15rem var(--head); display: block; } .role span { color: #bcd8f3; font-size: .95rem; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; }
.feature h3 { display: flex; gap: 10px; align-items: center; }
.feature .fi { width: 30px; height: 30px; border-radius: 8px; background: var(--sky); color: var(--blue); display: grid; place-items: center; font: 700 .9rem var(--head); flex: none; }
.feature:nth-child(even) .fi { background: var(--cream); color: var(--orange-ink); }

/* ---------- join ---------- */
.join-card { max-width: 440px; margin: 30px auto 0; }
.code-input { font: 700 1.6rem var(--head) !important; letter-spacing: .3em; text-transform: uppercase; text-align: center; }
.pin-input { font: 700 1.4rem var(--head) !important; letter-spacing: .5em; text-align: center; }

/* ---------- chips & book blocks (shared with print) ---------- */
.chip { display: inline-block; font: 600 .74rem var(--head); letter-spacing: .02em; padding: 3px 9px; border-radius: 10px; white-space: nowrap; margin: 1px 0; }
.chip-blue { background: var(--sky); color: var(--navy); border: 1px solid #c3d8ef; }
.chip-orange { background: var(--cream); color: var(--orange-ink); border: 1px solid #f6cfae; }
.math { font-family: var(--mathf); font-size: 1.08em; white-space: nowrap; }
.math i { font-style: italic; } .math sub, .math sup { font-size: .68em; }
.frac { display: inline-flex; flex-direction: column; vertical-align: middle; text-align: center; margin: 0 2px; line-height: 1.05; }
.frac .num { border-bottom: 1px solid currentColor; padding: 0 2px; } .frac .den { padding: 0 2px; }
.bar { text-decoration: overline; }
.formula-bar { background: var(--sky); border-left: 5px solid var(--blue); border-radius: 8px; padding: 10px 14px; margin-bottom: 14px; }
.lead { font-size: 1.02rem; } .small-lead { font-size: .95rem; }
.tip { font-size: .92rem; color: var(--muted); background: #fbfcfe; border: 1px dashed var(--rule); border-radius: 8px; padding: 8px 12px; }
.ex-label { font: 600 .72rem var(--head); letter-spacing: .12em; text-transform: uppercase; color: var(--orange-ink); margin-bottom: 4px; }
.ws-section { font-size: 1.1rem; color: var(--blue); margin: 18px 0 8px; padding-bottom: 4px; border-bottom: 2px solid var(--sky); }
.star { color: var(--orange); font-weight: 700; }
table.data { border-collapse: collapse; font-size: .95rem; margin: 6px 0; }
table.data th { background: var(--navy); color: #fff; font: 500 .85rem var(--head); padding: 6px 12px; text-align: left; }
table.data td { padding: 5px 12px; border-bottom: 1px solid var(--rule); }
table.data tbody tr:nth-child(even) td { background: #f5f8fc; }
table.data.small td { text-align: center; } table.compact, table.conv, table.vocab { width: 100%; }
.conv-wrap { margin: 4px 0 14px; } .conv-title { font: 600 .85rem var(--head); color: var(--navy); margin-bottom: 4px; }
.density-top { display: grid; grid-template-columns: 1fr 240px; gap: 20px; align-items: start; }
.density-side { display: flex; flex-direction: column; align-items: center; }
.cans .can-l { font: 600 9pt Lexend, sans-serif; fill: var(--navy); } .cans .can-m { font: 9pt "Source Sans 3", sans-serif; fill: var(--muted); }
.proof-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; background: var(--sky); border-radius: 10px; padding: 10px 14px; margin: 6px 0 12px; }
.pnum { font: 600 .85rem var(--head); color: #fff; background: var(--blue); border-radius: 10px; padding: 2px 10px; }
.eq-row { display: flex; justify-content: center; align-items: flex-start; gap: 10px; margin: 10px 0 4px; font-size: 1.1rem; flex-wrap: wrap; }
.eq-row .eqf { display: flex; flex-direction: column; align-items: center; }
.eq-row .eqf small { font: .7rem var(--body); color: var(--muted); text-transform: uppercase; letter-spacing: .1em; margin-top: 2px; }
.eq-row > span:not(.eqf) { font-family: var(--mathf); }
svg.graph { display: block; max-width: 100%; height: auto; }
.g-minor { stroke: #e3ebf4; stroke-width: .8; } .g-major { stroke: var(--grid); stroke-width: 1; } .g-axis { stroke: #46566a; stroke-width: 1.4; }
.g-tick { font: 10.5px "Source Sans 3", sans-serif; fill: var(--muted); } .g-label { font: 600 11px Lexend, sans-serif; fill: var(--navy); }
.g-title { font: 600 12px Lexend, sans-serif; fill: var(--navy); }
.g-line { fill: none; stroke: var(--blue); stroke-width: 2.4; stroke-linejoin: round; }
.g-dot { fill: var(--orange); stroke: #fff; stroke-width: 1.2; }
.g-seg { font: italic 600 11px "Source Sans 3", sans-serif; fill: var(--orange-ink); }
.figure { display: flex; justify-content: center; margin: 4px 0 12px; }
.figure svg { width: 100%; max-width: 420px; }

/* ---------- course & lesson ---------- */
.unit { margin-bottom: 28px; }
.unit-h { display: flex; align-items: baseline; gap: 12px; border-bottom: 2px solid var(--sky); padding-bottom: 6px; margin-bottom: 12px; }
.unit-h h2 { margin: 0; color: var(--blue); font-size: 1.05rem; letter-spacing: .04em; }
.lesson-row { display: grid; grid-template-columns: 56px 1fr auto; gap: 16px; align-items: center; padding: 14px 16px; background: #fff; border: 1px solid #e4ebf3; border-radius: 12px; text-decoration: none; color: inherit; margin-bottom: 8px; transition: border-color .15s, box-shadow .15s; }
.lesson-row:hover { border-color: var(--blue-2); box-shadow: var(--shadow); }
.ln { width: 52px; height: 52px; border-radius: 12px; background: var(--navy); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; font: 700 1.3rem var(--head); line-height: 1; }
.ln span { font: 500 .52rem var(--head); letter-spacing: .14em; text-transform: uppercase; opacity: .75; margin-bottom: 3px; }
.ln.orange { background: var(--orange); }
.lesson-row .t { font: 600 1.02rem var(--head); color: var(--navy); } .lesson-row .sub { color: var(--blue); font-weight: 600; font-size: .95rem; }
.lesson-row .chips { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; max-width: 300px; }
.lesson-head { display: flex; gap: 16px; align-items: stretch; margin-bottom: 18px; }
.lesson-head .ln { width: 72px; height: auto; min-height: 72px; font-size: 1.9rem; border-radius: 14px; }
.lesson-head h1 { margin: 2px 0; } .lh-sub { font: 600 1.15rem var(--body); color: var(--blue); }
.two { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.box-title { font: 600 .8rem var(--head); letter-spacing: .1em; text-transform: uppercase; color: var(--navy); margin-bottom: 8px; }
.box-title.blue { color: var(--blue); } .box-title.orange { color: var(--orange-ink); }
.objectives { background: var(--sky); border-radius: 12px; padding: 14px 18px 10px; margin-bottom: 16px; }
.objectives ul { margin: 0; padding-left: 20px; } .objectives li { margin-bottom: 4px; }
.standards { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 16px; }
.std-col { background: #fff; border: 1px solid var(--rule); border-radius: 12px; padding: 12px 14px; }
.std-col.blue { border-top: 4px solid var(--blue); } .std-col.orange { border-top: 4px solid var(--orange); }
.std { display: flex; flex-direction: column; gap: 4px; font-size: .92rem; line-height: 1.4; margin-bottom: 10px; }
.std .chip { align-self: flex-start; } .std:last-child { margin-bottom: 0; }
.notes ol { margin: 0; padding-left: 22px; } .notes li { margin-bottom: 8px; }
.notes li::marker { color: var(--orange); font: 600 1rem var(--head); }
.extra { margin-top: 10px; overflow-x: auto; }
.act-card { border-left: 5px solid var(--orange); }
.act-card + .act-card { margin-top: 12px; }
.act-card .meta { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0 12px; }
.assign-form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.assign-form .full { grid-column: 1 / -1; }
details.key summary { cursor: pointer; font: 600 .95rem var(--head); color: var(--navy); }
details.key p { margin: 8px 0 0; font-size: .95rem; }
.prevnext { display: flex; justify-content: space-between; gap: 12px; margin-top: 30px; }

/* ---------- activity player ---------- */
.player-head { position: sticky; top: 58px; z-index: 20; background: rgba(245,248,252,.94); backdrop-filter: blur(6px); border-bottom: 1px solid #e4ebf3; }
.player-head-in { max-width: 900px; margin: 0 auto; padding: 10px 20px; display: flex; align-items: center; gap: 16px; }
.player-head .title { flex: 1; min-width: 0; }
.player-head .title b { font: 600 1rem var(--head); color: var(--navy); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-head .progress { width: 140px; }
.save-state { font-size: .82rem; color: var(--muted); white-space: nowrap; min-width: 70px; text-align: right; }
.save-state.err { background: none; color: var(--bad); padding: 0; margin: 0; }
main.player { max-width: 900px; }
.block-html { margin-bottom: 16px; }
.stem { background: #fff; border: 1px solid #e4ebf3; border-radius: 12px; padding: 14px 18px; margin: 22px 0 10px; position: relative; padding-left: 56px; }
.stem-n { position: absolute; left: 14px; top: 13px; width: 30px; height: 30px; border-radius: 50%; background: var(--navy); color: #fff; display: grid; place-items: center; font: 600 .9rem var(--head); }
.stem .data { margin-top: 10px; }
.item { background: #fff; border: 1px solid #e4ebf3; border-radius: 14px; padding: 18px 20px 16px; margin-bottom: 14px; box-shadow: 0 1px 2px rgba(15,44,77,.04); position: relative; transition: border-color .2s; }
.item.example { border: 2px solid var(--orange); }
.item[data-status=correct] { border-color: #9fd8bd; } .item[data-status=incorrect], .item[data-status=partial] { border-color: #f3c3a0; }
.item[data-status=review] { border-color: #cdbff0; }
.item-head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 12px; }
.qn { min-width: 34px; height: 30px; padding: 0 8px; border-radius: 15px; background: var(--navy); color: #fff; display: grid; place-items: center; font: 600 .85rem var(--head); flex: none; }
.item.example .qn { background: var(--orange); }
.prompt { flex: 1; padding-top: 3px; }
.fields { display: flex; flex-wrap: wrap; gap: 12px 18px; align-items: flex-start; padding-left: 48px; }
.fields.stack { flex-direction: column; align-items: stretch; }
.fld { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.fld.wide { flex: 1 1 100%; }
.fld-label { font: 600 .8rem var(--head); color: var(--navy); }
.fld-in { display: flex; align-items: center; gap: 8px; }
.fld-in input { width: 150px; font-family: var(--mathf); font-size: 1.1rem; }
.fld-in .unit { font-family: var(--mathf); color: var(--muted); font-size: 1.05rem; white-space: nowrap; }
.fld.expr .fld-in input, .fld.ineq .fld-in input { width: min(420px, 100%); }
.fld.expr, .fld.ineq { flex: 1 1 340px; }
.fld-prefix { font-family: var(--mathf); font-size: 1.15rem; white-space: nowrap; }
.fld .fb { font-size: .86rem; min-height: 0; }
.fld[data-st=correct] input, .fld[data-st=correct] select { border-color: var(--ok); background: #f7fcf9; }
.fld[data-st=incorrect] input, .fld[data-st=invalid] input, .fld[data-st=incorrect] select { border-color: #e59a85; background: #fffaf8; }
.fld[data-st=correct] .fb { color: var(--ok); } .fld[data-st=incorrect] .fb, .fld[data-st=invalid] .fb { color: var(--bad); }
.fld[data-st=review] .fb { color: var(--review); }
.preview { font-size: 1.15rem; min-height: 1.6em; color: var(--navy); padding: 2px 2px; }
.preview:empty::before { content: "Preview appears here"; color: #6b7684; font: italic .85rem var(--body); }
.palette { display: flex; flex-wrap: wrap; gap: 6px; }
.palette button { font: 1.02rem var(--mathf); min-width: 38px; height: 36px; border: 1px solid var(--rule); background: #fff; border-radius: 8px; cursor: pointer; color: var(--navy); padding: 0 8px; }
.palette button:hover { background: var(--sky); border-color: var(--blue-2); }
.palette button.word { font: 600 .82rem var(--head); }
.choices { display: grid; gap: 8px; }
.choice { display: flex; gap: 10px; align-items: flex-start; border: 1.5px solid var(--rule); border-radius: 10px; padding: 10px 12px; cursor: pointer; background: #fff; transition: border-color .15s, background .15s; }
.choice:hover { border-color: var(--blue-2); }
.choice input { margin-top: 4px; accent-color: var(--blue); width: 18px; height: 18px; flex: none; }
.choice:has(input:checked) { border-color: var(--blue); background: var(--sky); }
.fld.choice-fld { flex: 1 1 100%; }
.fld.choice-fld .choices.inline { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.fld select { min-width: 280px; }
.fld.text-fld { flex: 1 1 100%; }
.item-foot { display: flex; align-items: center; gap: 12px; margin-top: 14px; padding-left: 48px; flex-wrap: wrap; }
.verdict { font: 600 .92rem var(--head); display: inline-flex; align-items: center; gap: 6px; }
.verdict.correct { color: var(--ok); } .verdict.incorrect, .verdict.partial { color: var(--warn); } .verdict.review, .verdict.submitted { color: var(--review); }
.attempts { font-size: .82rem; color: var(--muted); }
.hint, .solution, .tcomment { margin: 12px 0 0 48px; border-radius: 10px; padding: 10px 14px; font-size: .95rem; }
.hint { background: var(--cream); border-left: 4px solid var(--orange); }
.solution { background: var(--sky); border-left: 4px solid var(--blue); }
.tcomment { background: var(--review-bg); border-left: 4px solid var(--review); }
.hint b, .solution b.lbl, .tcomment b { font: 600 .74rem var(--head); letter-spacing: .1em; text-transform: uppercase; display: block; margin-bottom: 2px; }
.item.proof .item-head { margin-bottom: 8px; } .item.proof .prompt { font-size: 1.2rem; }
.key-inline { margin: 12px 0 0 48px; font-size: .92rem; background: var(--ok-bg); border-radius: 8px; padding: 8px 12px; }
.key-inline b { color: var(--ok); }
.table-graph { display: grid; grid-template-columns: 220px 1fr; gap: 18px; padding-left: 48px; align-items: start; }
.table-graph .fields { padding-left: 0; flex-direction: column; align-items: stretch; }
.finish { text-align: center; margin-top: 26px; padding: 26px 20px; }
.finish p { color: var(--muted); }

/* graph widgets */
.gw { position: relative; max-width: 420px; width: 100%; }
.gw svg { width: 100%; height: auto; touch-action: none; user-select: none; -webkit-user-select: none; cursor: crosshair; background: #fff; border-radius: 8px; border: 1px solid #e4ebf3; }
.gw .pt { fill: var(--orange); stroke: #fff; stroke-width: 2; cursor: grab; }
.gw .pt.sel { stroke: var(--navy); stroke-width: 2.5; }
.gw .ghost { fill: var(--orange); opacity: .35; pointer-events: none; }
.gw .seg { stroke: var(--blue); stroke-width: 5; stroke-linecap: round; cursor: ns-resize; }
.gw .seg-hit { stroke: transparent; stroke-width: 26; cursor: ns-resize; }
.gw .seg.unset { stroke: #a9b4c1; stroke-dasharray: 6 6; }
.gw .step-v { stroke: var(--blue); stroke-width: 1.4; stroke-dasharray: 3 3; opacity: .55; }
.gw-tools { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; align-items: center; }
.gw-tools input { width: 110px; min-height: 36px; padding: 6px 10px; font-family: var(--mathf); }
.gw-readout { font: .85rem var(--body); color: var(--muted); min-height: 1.4em; }
.step-inputs { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; margin-top: 10px; max-width: 520px; }
.step-inputs label { font: 600 .74rem var(--head); color: var(--muted); display: flex; flex-direction: column; gap: 3px; }
.step-inputs input { min-height: 36px; padding: 6px 10px; font-family: var(--mathf); }

/* paused overlay */
.paused { position: fixed; inset: 0; z-index: 100; background: rgba(15,44,77,.92); color: #fff; display: grid; place-items: center; text-align: center; padding: 30px; }
.paused h2 { color: #fff; font-size: 2.2rem; } .paused p { color: #bcd8f3; font-size: 1.2rem; }

/* ---------- teacher: class & grid ---------- */
.join-banner { display: grid; grid-template-columns: auto 1fr auto; gap: 22px; align-items: center; background: linear-gradient(120deg, var(--navy), #1d4f84); color: #fff; border-radius: 16px; padding: 20px 24px; margin-bottom: 22px; }
.join-banner .code { font: 700 2.4rem var(--head); letter-spacing: .18em; color: #fff; line-height: 1; }
.join-banner .url { font: 600 1rem var(--head); color: #f6a868; word-break: break-all; }
.join-banner .muted { color: #bcd8f3; }
.join-banner img { width: 104px; height: 104px; background: #fff; border-radius: 10px; padding: 4px; }
.roster { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.roster-item { display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid #e4ebf3; border-radius: 10px; padding: 8px 10px; }
.roster-item .nm { flex: 1; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.roster-item button { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 4px; border-radius: 6px; font-size: .85rem; }
.roster-item button:hover { background: var(--sky); color: var(--navy); }
.asg-row { display: grid; grid-template-columns: 1fr 160px auto; gap: 16px; align-items: center; padding: 14px 16px; border: 1px solid #e4ebf3; border-radius: 12px; background: #fff; margin-bottom: 8px; }
.asg-row .t { font: 600 1rem var(--head); color: var(--navy); text-decoration: none; }
.toolbar { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; background: #fff; border: 1px solid #e4ebf3; border-radius: 12px; padding: 12px 16px; margin-bottom: 16px; }
.toolbar .sep { width: 1px; align-self: stretch; background: var(--rule); }
.grid-wrap { overflow: auto; background: #fff; border: 1px solid #e4ebf3; border-radius: 12px; max-height: 70vh; }
table.live { border-collapse: separate; border-spacing: 0; font-size: .9rem; min-width: 100%; }
table.live th, table.live td { padding: 0; border-bottom: 1px solid #eef2f7; text-align: center; }
table.live thead th { position: sticky; top: 0; background: var(--navy); color: #fff; font: 600 .78rem var(--head); padding: 8px 6px; z-index: 2; white-space: nowrap; }
table.live th.sname, table.live td.sname { position: sticky; left: 0; background: #fff; text-align: left; padding: 6px 12px; z-index: 1; white-space: nowrap; font-weight: 600; min-width: 170px; border-right: 1px solid #eef2f7; }
table.live thead th.sname { background: var(--navy); z-index: 3; }
table.live tfoot td { background: #f7f9fc; font-size: .75rem; color: var(--muted); padding: 6px 4px; position: sticky; bottom: 0; }
table.live tfoot td.sname { background: #f7f9fc; }
.cell { width: 40px; height: 34px; margin: 3px auto; border-radius: 8px; border: 0; cursor: pointer; display: grid; place-items: center; font: 700 .8rem var(--head); background: #f1f4f8; color: #9aa7b6; position: relative; }
.cell:hover { outline: 2px solid var(--blue-2); }
.cell.correct { background: #2f9e6b; color: #fff; } .cell.partial { background: #f6b26b; color: #4a2a08; }
.cell.incorrect { background: #b4541a; color: #fff; } .cell.review { background: #8a6fd6; color: #fff; }
.cell.draft { background: var(--sky-2); color: var(--navy); }
.cell .kc { position: absolute; bottom: -4px; right: -4px; font-size: 10px; color: var(--navy); background: #fff; border-radius: 4px; line-height: 1; padding: 1px; }
.cell .ov { position: absolute; top: -3px; right: -3px; width: 9px; height: 9px; border-radius: 50%; background: var(--navy); border: 2px solid #fff; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .82rem; color: var(--muted); margin: 10px 0 0; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }
.bar-mini { display: flex; height: 6px; border-radius: 3px; overflow: hidden; background: #e8eef5; width: 34px; margin: 0 auto; }
.bar-mini i { display: block; height: 100%; }

/* drawer */
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(480px, 100%); background: #fff; z-index: 60; box-shadow: -10px 0 30px rgba(15,44,77,.18); transform: translateX(105%); transition: transform .2s; display: flex; flex-direction: column; }
.drawer.open { transform: none; }
.drawer-h { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid #e4ebf3; }
.drawer-h h3 { flex: 1; margin: 0; }
.drawer-b { padding: 18px 20px; overflow: auto; flex: 1; }
.drawer-b .resp { border: 1px solid #e4ebf3; border-radius: 10px; padding: 10px 12px; margin: 8px 0; }
.drawer-b .resp .v { font-family: var(--mathf); font-size: 1.1rem; white-space: pre-wrap; word-break: break-word; }
.scrim { position: fixed; inset: 0; background: rgba(15,44,77,.3); z-index: 55; }

/* projector */
body.projector { background: radial-gradient(120% 120% at 85% 0%, #1d4f84 0%, var(--navy) 55%, #0a1f37 100%); color: #fff; min-height: 100vh; }
.proj { min-height: 100vh; display: grid; grid-template-columns: 1fr auto; gap: 6vw; align-items: center; padding: 6vh 7vw; }
.proj .kicker { color: #f6a868; font-size: 1.1rem; }
.proj h1 { color: #fff; font-size: 3.2vw; margin: 10px 0 30px; }
.proj .step { font: 500 1.8vw var(--head); color: #d6e4f2; margin-bottom: 14px; }
.proj .step b { color: #fff; }
.proj .big-code { font: 700 9vw var(--head); letter-spacing: .14em; color: #fff; line-height: 1; margin: 20px 0; }
.proj .url { font: 600 2vw var(--head); color: #f6a868; }
.proj img { width: 28vw; max-width: 460px; background: #fff; border-radius: 22px; padding: 14px; }
.proj .count { margin-top: 30px; font: 500 1.4vw var(--head); color: #bcd8f3; }
.proj .names { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; max-width: 50vw; }
.proj .names span { background: rgba(255,255,255,.12); border-radius: 999px; padding: 4px 12px; font: 500 1vw var(--head); }
.proj-exit { position: fixed; top: 14px; right: 14px; }

/* reference */
.ref-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; margin-bottom: 16px; }
.ref-card { background: #fff; border: 1px solid var(--rule); border-top: 4px solid var(--blue); border-radius: 12px; padding: 12px 16px; }
.ref-card:nth-child(even) { border-top-color: var(--orange); }
.ref-card h3 { font-size: 1rem; } .ref-card p { margin: 0 0 6px; }
.ref-h { color: var(--blue); margin-top: 18px; }

.review-banner { background: var(--cream); color: var(--orange-ink); border-bottom: 1px solid #f6cfae; text-align: center; font: 600 .85rem var(--head); padding: 8px 16px; }
.review-banner code { background: #fff; }

/* toast */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 10px 18px; border-radius: 10px; z-index: 120; font-weight: 600; box-shadow: 0 8px 24px rgba(0,0,0,.2); }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .hero-in { grid-template-columns: 1fr; padding: 40px 20px 48px; }
  .two, .standards { grid-template-columns: 1fr; }
  .asg-row { grid-template-columns: 1fr; }
  .join-banner { grid-template-columns: 1fr; text-align: center; }
  .join-banner img { margin: 0 auto; }
  .lesson-row { grid-template-columns: 48px 1fr; } .lesson-row .chips { display: none; }
  .table-graph { grid-template-columns: 1fr; }
  .proj { grid-template-columns: 1fr; text-align: center; } .proj img { width: 60vw; margin: 0 auto; }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  main.wrap { padding: 18px 16px 60px; }
  .topbar-in { padding: 0 14px; gap: 10px; } .brand-text { display: none; }
  .who .who-name { display: none; }
  .item { padding: 14px 14px; }
  .fields, .item-foot, .table-graph { padding-left: 0; }
  .hint, .solution, .tcomment, .key-inline { margin-left: 0; }
  .fld-in input { width: 120px; }
  .density-top { grid-template-columns: 1fr; }
  .player-head .progress { display: none; }
  .assign-form { grid-template-columns: 1fr; }
  .fld select { min-width: 0; width: 100%; }
}
@media print {
  .topbar, .player-head, .item-foot, .palette, .gw-tools, .btn, .wedge-line { display: none !important; }
  body { background: #fff; }
}

/* Feedback: floating button, dialog, digest */
.fb-open { position: fixed; left: 14px; bottom: 14px; z-index: 50; font: 600 .85rem var(--head); color: #fff; background: var(--navy); border: 0; border-radius: 999px; padding: 10px 16px; min-height: 44px; box-shadow: 0 6px 18px rgba(15,44,77,.25); cursor: pointer; }
.fb-open:hover { background: var(--navy-2); }
.fb-open:focus-visible { outline: 3px solid var(--blue-2); outline-offset: 2px; }
dialog.fb { border: 0; border-radius: 14px; padding: 20px 22px; width: min(460px, calc(100% - 32px)); box-shadow: 0 20px 60px rgba(15,44,77,.3); }
dialog.fb::backdrop { background: rgba(15,44,77,.35); }
dialog.fb h2 { font-size: 1.15rem; }
.fb-faces { border: 0; padding: 0; margin: 10px 0 14px; display: flex; gap: 8px; flex-wrap: wrap; }
.fb-faces label { flex: 1 1 0; min-width: 96px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 6px; border: 1px solid var(--rule); border-radius: 10px; cursor: pointer; font: 600 .85rem var(--head); color: var(--navy); }
.fb-faces label span { font-size: 1.6rem; }
.fb-faces input { position: absolute; opacity: 0; }
.fb-faces label:has(input:checked) { border-color: var(--blue); background: var(--sky); box-shadow: 0 0 0 2px var(--blue); }
.fb-faces label:has(input:focus-visible) { outline: 3px solid var(--blue-2); outline-offset: 2px; }
dialog.fb textarea { width: 100%; }
.fb-err { color: var(--orange-ink); min-height: 1.2em; margin: 6px 0; }
.fb-screen { margin-bottom: 14px; }
.fb-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.fb-head h2 { font-size: 1.15rem; margin: 0; }
.fb-bar { display: flex; height: 26px; border-radius: 8px; overflow: hidden; margin: 8px 0 12px; font: 600 .78rem var(--head); }
.fb-bar span { display: flex; align-items: center; padding: 0 8px; white-space: nowrap; overflow: hidden; }
.fb-bar .c { background: #f9d9c3; color: #7a3410; } .fb-bar .o { background: var(--sky-2); color: var(--navy); } .fb-bar .g { background: #cfeadb; color: #0f4d31; }
.fb-comments { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.fb-comments li { border-left: 3px solid var(--sky-2); padding: 2px 0 2px 12px; }
.fb-comments p { margin: 0 0 2px; white-space: pre-wrap; }
.seg { display: flex; gap: 4px; } .seg [aria-current="page"] { background: var(--sky); border-color: var(--blue); }
@media print { .fb-open { display: none; } }
body:has(.fb-open) { padding-bottom: 72px; } /* content can always scroll clear of the Feedback button */
