:root {
  --paper: #f7f1e4; --paper-2: #efe6d3; --card: #fffdf7;
  --ink: #1c2a25; --muted: #5c6a63; --line: #dccfb6;
  --board: #123c33; --board-2: #0d2e27; --chalk: #f4f1e6; --chalk-dim: #b9c9c0;
  --red: #b5271f; --red-dark: #8f1c15; --gold: #e0a825; --blue: #245c8a; --green: #2f7d4f;
  --radius: 10px;
  --stitch: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='16' viewBox='0 0 48 16'%3E%3Cg fill='%23b5271f'%3E%3Cpath d='M8 0l8 8-8 8-8-8zM40 0l8 8-8 8-8-8z'/%3E%3C/g%3E%3Cpath d='M24 2l6 6-6 6-6-6z' fill='%231c2a25'/%3E%3Cpath d='M8 5l3 3-3 3-3-3zM40 5l3 3-3 3-3-3z' fill='%23e0a825'/%3E%3C/svg%3E");
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 18px/1.55 "Sofia Sans", system-ui, sans-serif; }
[hidden] { display: none !important; }
h1, h2, h3 { line-height: 1.12; margin: 0 0 .5em; font-weight: 800; }
h1 { font-size: clamp(2rem, 4.6vw, 3.2rem); letter-spacing: -.01em; }
h2 { font-size: 1.45rem; margin-top: 1.4em; }
h3 { font-size: 1.15rem; }
a { color: var(--red-dark); }
p { margin: 0 0 .8em; }
.muted { color: var(--muted); }
.wrap { max-width: 1120px; margin: 0 auto; padding: 32px 20px; }
.wrap.narrow { max-width: 760px; }
.center { text-align: center; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.lead { font-size: 1.22rem; color: #37463f; }
.crumb { font-size: .95rem; color: var(--muted); }
.err { background: #fbe4e1; color: var(--red-dark); padding: 10px 14px; border-radius: 8px; }
.stitch { height: 16px; background: var(--stitch) repeat-x center; }

.btn { display: inline-block; background: var(--red); color: #fff; border: 0; border-radius: 8px; padding: 11px 20px; font: 700 1rem "Sofia Sans", sans-serif; text-decoration: none; cursor: pointer; }
.btn:hover { background: var(--red-dark); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.big { padding: 15px 28px; font-size: 1.12rem; }
.btn.small { padding: 7px 14px; font-size: .92rem; }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }
.btn.ghost:hover { background: var(--paper-2); }
.btn.danger, .link.danger { color: var(--red-dark); box-shadow: none; }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--red-dark); text-decoration: underline; cursor: pointer; }

.top { display: flex; justify-content: space-between; align-items: center; padding: 14px 24px; flex-wrap: wrap; gap: 8px; }
.top nav { display: flex; align-items: center; gap: 20px; }
.top nav a:not(.btn) { color: var(--ink); text-decoration: none; font-weight: 600; }
.top nav form { margin: 0; display: inline; }
.top .link { color: var(--ink); font-weight: 600; text-decoration: none; }
.logo { font-weight: 900; font-size: 1.45rem; text-decoration: none; color: var(--ink); display: flex; align-items: center; gap: 9px; }
.mark { width: 20px; height: 20px; display: inline-block; background: conic-gradient(var(--red) 25%, var(--gold) 0 50%, var(--red) 0 75%, var(--board) 0); transform: rotate(45deg); border-radius: 3px; }
.foot { padding: 20px; text-align: center; color: var(--muted); }
.foot p { margin-top: 10px; }

.hero { max-width: 1120px; margin: 0 auto; padding: 44px 20px 48px; display: grid; grid-template-columns: 1.5fr 1fr; gap: 44px; align-items: center; }
.hero h1 { font-size: clamp(2.6rem, 6.2vw, 4.6rem); font-weight: 900; }
.hero em { font-style: normal; color: var(--red); }
.eyebrow { font-weight: 700; letter-spacing: .06em; text-transform: uppercase; font-size: .9rem; color: var(--muted); }
.cta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 20px; }
.joincard { background: var(--board); color: var(--chalk); padding: 28px; border-radius: 14px; box-shadow: 0 16px 34px -18px rgba(18, 60, 51, .75); }
.joincard h2 { margin-top: 0; font-size: 1.6rem; }
.joincard label { display: block; margin-bottom: 6px; color: var(--chalk-dim); }
.joincard input { width: 100%; font: 800 2.2rem "Sofia Sans", sans-serif; text-align: center; letter-spacing: .2em; padding: 10px; border-radius: 8px; border: 0; background: var(--chalk); color: var(--ink); margin-bottom: 12px; }
.joincard .btn { width: 100%; }
.joincard .muted { color: var(--chalk-dim); font-size: .92rem; margin: 12px 0 0; text-align: center; }
.how { display: grid; grid-template-columns: repeat(4, 1fr); gap: 26px; padding-top: 44px; padding-bottom: 54px; }
.how h3 { font-size: 1.22rem; }
.how .num { display: block; font: 900 2.5rem "Sofia Sans Extra Condensed", sans-serif; color: var(--red); margin-bottom: 4px; }
.band { background: var(--board); color: var(--chalk); }
.stats { display: flex; justify-content: space-around; gap: 20px; flex-wrap: wrap; text-align: center; }
.stats strong { display: block; font: 900 3.2rem/1 "Sofia Sans Extra Condensed", sans-serif; color: var(--gold); }
.stats.small { justify-content: flex-start; gap: 44px; text-align: left; margin: 18px 0 26px; }
.stats.small strong { color: var(--red); }

.matrix-scroll { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-top: 24px; }
.matrix { border-collapse: collapse; width: 100%; min-width: 760px; }
.matrix th, .matrix td { padding: 6px 4px; text-align: center; border-bottom: 1px solid var(--line); }
.matrix tbody tr:last-child th, .matrix tbody tr:last-child td { border-bottom: 0; }
.matrix th[scope=row] { text-align: left; font-weight: 600; padding-left: 14px; position: sticky; left: 0; background: var(--card); white-space: nowrap; }
.matrix thead th { font: 800 1.1rem "Sofia Sans", sans-serif; padding-top: 12px; }
.matrix thead th:first-child { text-align: left; padding-left: 14px; }
.cell { display: inline-flex; width: 34px; height: 34px; border-radius: 50%; align-items: center; justify-content: center; color: var(--red); text-decoration: none; font-size: 1.1rem; }
.cell:hover, .cell:focus { background: var(--red); color: #fff; }

.topics { list-style: none; padding: 0; margin: 20px 0 0; counter-reset: t; }
.topics li { counter-increment: t; display: flex; justify-content: space-between; gap: 14px; align-items: center; flex-wrap: wrap; padding: 14px 0; border-bottom: 1px solid var(--line); }
.topics li > div:first-child { flex: 1 1 280px; }
.topics li > div:first-child::before { content: counter(t) ". "; color: var(--muted); font-weight: 700; }
.tag { display: inline-block; background: var(--gold); color: var(--ink); border-radius: 20px; padding: 0 10px; font-size: .78rem; font-weight: 800; margin-left: 8px; }

.form-card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; margin-top: 30px; }
form label, .field { display: block; margin-bottom: 14px; font-weight: 600; }
input, select, textarea { font: 400 1.02rem "Sofia Sans", sans-serif; }
form label input, form label select, .field input, .field select, .field textarea { display: block; width: 100%; margin-top: 4px; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 7px; background: #fff; color: var(--ink); font-weight: 400; }
.field small { display: block; font-weight: 400; margin-top: 3px; }
.check { display: flex !important; gap: 8px; align-items: center; font-weight: 400; }
.check input { width: auto !important; margin: 0 !important; }
.inline { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 20px; }
.inline input, .inline select { padding: 7px 10px; border: 1.5px solid var(--line); border-radius: 7px; background: #fff; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 44px; }
.grid2.wide-left { grid-template-columns: minmax(0, 2.1fr) minmax(280px, 1fr); }
.list { list-style: none; padding: 0; margin: 0 0 10px; }
.list li { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; flex-wrap: wrap; padding: 10px 0; border-bottom: 1px solid var(--line); }
.list li a { color: var(--ink); text-decoration: none; }
.list li a:hover { text-decoration: underline; }
.list form { margin: 0; }

.side { position: sticky; top: 16px; align-self: start; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 22px; }
.side h2 { margin-top: 0; }
.side .row { margin-top: 14px; }
.side form { margin: 0; }
.modes { border: 0; padding: 0; margin: 0 0 14px; }
.modes legend { font-weight: 600; margin-bottom: 8px; padding: 0; }
.modes label { display: flex; gap: 10px; align-items: flex-start; border: 1.5px solid var(--line); border-radius: 8px; padding: 10px; margin-bottom: 8px; cursor: pointer; }
.modes label input { width: auto; margin-top: 5px; }
.modes label small { display: block; color: var(--muted); font-weight: 400; }
.modes label:has(input:checked) { border-color: var(--red); background: #fdf2ef; }
.side .btn.big { width: 100%; }

.stepcard { background: var(--card); border: 1px solid var(--line); border-radius: 11px; padding: 18px 20px; margin-bottom: 14px; }
.stephead { display: flex; justify-content: space-between; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.stepcard h3 { margin-bottom: .4em; }
.phase-tag { display: inline-block; padding: 2px 11px; border-radius: 20px; font-size: .82rem; font-weight: 800; color: #fff; }
.phase-tag.ph-warm, .seg.ph-warm { background: #c8701e; }
.phase-tag.ph-learn, .seg.ph-learn { background: var(--blue); }
.phase-tag.ph-practice, .seg.ph-practice { background: var(--green); }
.phase-tag.ph-check, .seg.ph-check { background: var(--red); }
.phase-tag.ph-exit, .seg.ph-exit { background: #6a4a8c; }
.prev-opts { list-style: none; padding: 0; margin: 0; }
.prev-opts li { padding: 7px 11px; border-radius: 7px; margin-bottom: 4px; background: var(--paper); }
.prev-opts li.ok { background: #dcefd9; font-weight: 700; }
.prev-opts small { display: block; color: var(--muted); font-weight: 400; margin-top: 2px; }
.whyline { background: #fdf0d3; padding: 8px 12px; border-radius: 7px; font-size: .96rem; margin-top: 8px; }
.bridge { margin-top: 10px; border-left: 3px solid var(--gold); padding-left: 12px; }
.bridge summary { font-weight: 700; cursor: pointer; }
.correct ol, .correct ul { margin: 6px 0; padding-left: 22px; }
.correct .pairs { list-style: none; padding: 0; }
.correct .arrow { margin: 0 8px; opacity: .6; }
.bucket-result { margin-bottom: 4px; }
.bucket-result strong { margin-right: 6px; }
.bucket-result strong::after { content: ":"; }
.big-answer { font-size: 1.5rem; font-weight: 800; margin: 4px 0; }
.report-rate { display: flex; align-items: center; gap: 12px; margin: 8px 0; }
.report-rate .level { flex: 1; }
.level { height: 12px; background: rgba(120, 120, 120, .22); border-radius: 8px; overflow: hidden; }
.level span { display: block; height: 100%; transition: width .5s; }
.level.low span { background: var(--red); }
.level.mid span { background: var(--gold); }
.level.high span { background: #3f9b63; }

.updown { display: inline-flex; gap: 4px; }
.updown button { width: 42px; height: 38px; border-radius: 7px; border: 1.5px solid var(--line); background: #fff; cursor: pointer; font-size: .95rem; color: var(--ink); }
.updown button:disabled { opacity: .3; }
.ed-steps { margin: 14px 0; }
.ed-steps .stephead select { padding: 6px 8px; border-radius: 7px; border: 1.5px solid var(--line); background: #fff; }
.ed-steps .stephead .updown button { width: 34px; height: 34px; }
#editor .row > .field { flex: 1 1 200px; }
#editor > .row select { padding: 10px; border-radius: 8px; border: 1.5px solid var(--ink); background: #fff; font-weight: 700; margin-bottom: 14px; }

/* Shared answer widgets (student screen and board). */
.opts { display: grid; gap: 10px; }
.opts.two { grid-template-columns: 1fr 1fr; }
.opt { display: flex; align-items: center; gap: 12px; text-align: left; padding: 15px 16px; background: #fff; color: var(--ink); border: 2px solid var(--line); border-radius: 10px; font: 600 1.1rem "Sofia Sans", sans-serif; cursor: pointer; width: 100%; }
.opts.two .opt { justify-content: center; font-size: 1.3rem; }
.opt.picked { border-color: var(--red); background: #fdeeea; }
.letter { flex: none; width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; background: var(--paper-2); border-radius: 7px; }
.orderlist { list-style: none; padding: 0; margin: 0 0 12px; counter-reset: o; }
.orderlist li { counter-increment: o; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 11px; background: #fff; border: 2px solid var(--line); border-radius: 9px; margin-bottom: 7px; font-weight: 600; color: var(--ink); }
.orderlist li > span:first-child::before { content: counter(o) ". "; color: var(--muted); }
.hint { color: var(--muted); font-size: .95rem; margin-bottom: 10px; }
.match { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.tile { display: block; width: 100%; min-height: 50px; padding: 9px 10px; margin-bottom: 8px; border-radius: 9px; border: 2px solid var(--line); background: #fff; color: var(--ink); font: 600 1rem "Sofia Sans", sans-serif; cursor: pointer; }
.tile.sel { border-color: var(--ink); box-shadow: 0 0 0 2px var(--ink); }
.tile.c1 { background: #ffd9b3; border-color: #c8701e; } .tile.c2 { background: #cfe2f4; border-color: var(--blue); }
.tile.c3 { background: #d4ecd2; border-color: var(--green); } .tile.c4 { background: #f7d2ce; border-color: var(--red); }
.tile.c5 { background: #e3d7f0; border-color: #6a4a8c; } .tile.c6 { background: #fbecb2; border-color: var(--gold); }
.chip { display: inline-block; padding: 8px 13px; margin: 3px; border-radius: 20px; border: 2px solid var(--line); background: #fff; color: var(--ink); font: 600 1rem "Sofia Sans", sans-serif; cursor: pointer; }
.chip.sel { border-color: var(--ink); background: var(--gold); }
.pool { min-height: 46px; margin-bottom: 12px; }
.buckets { display: grid; grid-template-columns: repeat(auto-fit, minmax(135px, 1fr)); gap: 10px; margin-bottom: 12px; }
.bucket { background: var(--paper-2); color: var(--ink); border: 2px dashed #b9a988; border-radius: 10px; padding: 11px; min-height: 104px; cursor: pointer; }
.bucket h4 { margin: 0 0 6px; }
.typed { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.typed input, .typed textarea { flex: 1; width: 100%; font: 600 1.3rem "Sofia Sans", sans-serif; padding: 12px; border: 2px solid var(--line); border-radius: 9px; background: #fff; color: var(--ink); }
.unit { font-weight: 700; }
.send { width: 100%; padding: 14px; font-size: 1.1rem; }

/* Student screen. */
.student-page { background: var(--board); min-height: 100dvh; color: var(--chalk); }
.s-screen { max-width: 560px; margin: 0 auto; padding: 18px 16px 40px; min-height: 100dvh; }
.s-logo { font-weight: 900; font-size: 1.5rem; text-align: center; padding: 30px 0 18px; }
.s-card { background: var(--card); color: var(--ink); border-radius: 14px; padding: 24px; }
.s-card h1 { font-size: 1.7rem; }
.s-card label { font-weight: 600; display: block; margin-bottom: 8px; }
.s-card input { width: 100%; font: 700 1.5rem "Sofia Sans", sans-serif; padding: 12px; text-align: center; border-radius: 9px; border: 2px solid var(--line); margin-bottom: 14px; }
.s-card .btn { width: 100%; }
.s-head { display: flex; justify-content: space-between; color: var(--chalk-dim); font-weight: 700; font-size: .95rem; padding-bottom: 12px; }
.s-q h1, .s-revq { font-size: clamp(1.35rem, 5.4vw, 1.75rem); font-weight: 800; margin-bottom: .75em; }
.s-bridge { background: rgba(224, 168, 37, .16); border-left: 3px solid var(--gold); padding: 10px 12px; margin-bottom: 14px; border-radius: 0 8px 8px 0; }
.s-sent { color: var(--chalk-dim); margin-top: 14px; text-align: center; min-height: 1.5em; }
.s-wait { text-align: center; padding: 28vh 12px 0; }
.s-wait h1 { font-size: 1.8rem; }
.pulse { width: 22px; height: 22px; margin: 0 auto 22px; background: var(--gold); transform: rotate(45deg); animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { transform: rotate(45deg) scale(1.5); opacity: .5; } }
.s-info h1 { font-size: 1.7rem; }
.s-info { font-size: 1.12rem; }
.s-result { text-align: center; padding: 26px 12px; border-radius: 12px; font-size: 1.8rem; font-weight: 900; margin: 14px 0; }
.s-result.good { background: #2f8a55; } .s-result.bad { background: var(--red); } .s-result.neutral { background: rgba(255, 255, 255, .12); font-size: 1.2rem; }
.s-correct { background: rgba(255, 255, 255, .08); padding: 12px 16px; border-radius: 10px; }
.s-correct h2 { margin: 0 0 6px; font-size: 1rem; color: var(--chalk-dim); }
.s-off { position: fixed; left: 0; right: 0; bottom: 0; background: var(--red); color: #fff; padding: 8px; text-align: center; }

/* Board. */
.board-page { background: var(--board); color: var(--chalk); overflow: hidden; }
#board { display: flex; flex-direction: column; height: 100dvh; position: relative; }
.b-top { display: flex; align-items: center; gap: 22px; padding: 10px 22px; background: var(--board-2); flex: none; }
.b-title { font-weight: 800; display: flex; align-items: center; gap: 10px; max-width: 34%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.b-progress { flex: 1; display: flex; gap: 4px; }
.seg { flex: 1; height: 10px; border-radius: 2px; opacity: .3; transform: skewX(-20deg); }
.seg.done { opacity: .75; } .seg.now { opacity: 1; outline: 2px solid var(--chalk); }
.b-code { text-align: right; line-height: 1; }
.b-code small { display: block; color: var(--chalk-dim); font-size: .72rem; }
.b-code b { font-size: 1.4rem; letter-spacing: .05em; }
.b-stage { flex: 1; overflow-y: auto; padding: 26px clamp(20px, 5vw, 76px); display: flex; }
.item { margin: auto; width: 100%; max-width: 1180px; }
.item h1 { font-size: clamp(1.9rem, 3.6vw, 3.1rem); font-weight: 800; }
.item .phase-tag { margin-bottom: 14px; font-size: .95rem; }
.info-body { font-size: clamp(1.25rem, 2.2vw, 1.8rem); line-height: 1.42; }
.info-body p { margin-bottom: .6em; }
.bridge-body { background: rgba(224, 168, 37, .15); border-left: 5px solid var(--gold); padding: 14px 20px; margin-bottom: 22px; font-size: 1.32rem; }
.bars { display: grid; gap: 11px; }
.bar { position: relative; display: flex; align-items: center; gap: 14px; background: rgba(255, 255, 255, .08); border-radius: 10px; padding: 14px 18px; overflow: hidden; font-size: clamp(1.15rem, 2vw, 1.6rem); font-weight: 600; transition: opacity .3s; }
.bar .fill { position: absolute; inset: 0 auto 0 0; background: rgba(255, 255, 255, .15); transition: width .5s; }
.bar > :not(.fill) { position: relative; }
.bar .letter { background: rgba(255, 255, 255, .17); color: var(--chalk); }
.bar .lbl { flex: 1; }
.bar .cnt { font-size: 1.15rem; }
.bar.right { background: rgba(63, 155, 99, .42); outline: 2px solid #79cf9c; }
.bar.right .fill { background: rgba(63, 155, 99, .6); }
.bar.dim { opacity: .68; }
.bars.slim .bar { padding: 10px 18px; }
.tally { display: flex; align-items: center; gap: 10px; }
.tally button { width: 44px; height: 44px; border-radius: 8px; border: 0; background: rgba(255, 255, 255, .2); color: var(--chalk); font-size: 1.5rem; cursor: pointer; }
.tally b { min-width: 34px; text-align: center; font-size: 1.5rem; }
.meter { margin-top: 20px; }
.meter .count { font-size: 1.3rem; font-weight: 700; margin-bottom: 8px; color: var(--chalk-dim); }
.item .hint { color: var(--chalk-dim); }
.board-solve { color: var(--ink); margin-bottom: 18px; }
.board-solve .hint, .board-solve .bucket h4 { color: var(--chalk-dim); }
.board-solve .bucket { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.3); color: var(--chalk); }
.board-solve .bucket h4 { color: var(--chalk); }
.board-solve .send, .board-solve .typed { display: none; }
.reveal-correct { background: rgba(255, 255, 255, .08); border-radius: 10px; padding: 14px 20px; margin-top: 16px; font-size: 1.3rem; }
.reveal-correct h2 { margin: 0 0 6px; font-size: 1rem; color: var(--chalk-dim); }
.cloud { display: flex; flex-wrap: wrap; gap: 8px 22px; align-items: center; justify-content: center; min-height: 240px; }
.cloud span { font-weight: 800; color: var(--gold); }
.cloud span:nth-child(3n) { color: var(--chalk); }
.cloud span:nth-child(3n+1) { color: #9fd9b6; }
.openlist { display: grid; gap: 10px; justify-items: start; }
.open-entry { display: flex; gap: 14px; justify-content: space-between; width: 100%; background: rgba(255,255,255,.09); padding: 11px 16px; border-radius: 9px; font-size: 1.3rem; }
.open-entry .link { color: var(--chalk-dim); text-decoration: none; font-size: 1.4rem; }
.tile-note .muted { color: var(--chalk-dim); font-size: 1.15rem; }
.b-bar { position: relative; z-index: 6; flex: none; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 18px; background: var(--board-2); flex-wrap: wrap; }
.b-main-ctl, .b-tools { display: flex; gap: 8px; flex-wrap: wrap; }
.bb { border: 0; border-radius: 8px; padding: 11px 16px; background: rgba(255, 255, 255, .14); color: var(--chalk); font: 700 1.02rem "Sofia Sans", sans-serif; cursor: pointer; text-decoration: none; }
.bb:hover { background: rgba(255, 255, 255, .24); }
.bb.primary { background: var(--gold); color: var(--ink); }
.bb.primary:hover { background: #efc14f; }
.bb.off { opacity: .4; pointer-events: none; }
.bb.bridge { background: var(--red); color: #fff; margin: 0; border-left: 0; padding-left: 16px; }
.bb.notify { box-shadow: inset 0 0 0 2px var(--gold); }
.pulse-btn { animation: glow 1.4s infinite; }
@keyframes glow { 50% { box-shadow: 0 0 0 7px rgba(181, 39, 31, .35); } }
.b-notes { position: absolute; right: 16px; bottom: 76px; width: min(430px, calc(100% - 32px)); max-height: 66vh; overflow-y: auto; background: var(--card); color: var(--ink); border-radius: 12px; padding: 20px 22px; box-shadow: 0 20px 44px rgba(0, 0, 0, .5); z-index: 5; }
.b-notes h3 { color: var(--red-dark); margin: 12px 0 4px; font-size: 1rem; }
.b-notes h3:first-of-type { margin-top: 0; }
.b-notes .why { font-size: 1.1rem; }
.b-notes .close { float: right; background: none; border: 0; font-size: 1.6rem; line-height: 1; cursor: pointer; color: var(--ink); }
.b-toolbox { position: absolute; left: 16px; bottom: 76px; width: 320px; background: var(--card); color: var(--ink); border-radius: 12px; padding: 18px; z-index: 5; box-shadow: 0 20px 44px rgba(0, 0, 0, .5); }
.b-toolbox h3 { font-size: .95rem; margin: 12px 0 6px; }
.b-toolbox h3:first-child { margin-top: 0; }
.b-toolbox .bb { background: var(--paper-2); color: var(--ink); padding: 8px 11px; font-size: .92rem; }
.b-toolbox input { width: 70px; padding: 7px; border: 1.5px solid var(--line); border-radius: 7px; }
.tool-out { font-size: 1.5rem; font-weight: 800; min-height: 1.3em; color: var(--red-dark); }
.b-ink { position: absolute; inset: 0; z-index: 4; cursor: crosshair; touch-action: none; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); top: 20px; background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 8px; z-index: 9; }
.lobby { margin: auto; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 54px; align-items: center; width: 100%; max-width: 1180px; }
.lobby.center { display: block; text-align: center; }
.lobby-join { text-align: center; }
.lobby .lead { color: var(--chalk-dim); margin-bottom: 4px; font-size: 1.3rem; }
.huge-code { font: 900 clamp(4.4rem, 10vw, 8.6rem)/1 "Sofia Sans Extra Condensed", sans-serif; letter-spacing: .05em; color: var(--gold); }
.qr { width: 196px; height: 196px; border-radius: 10px; margin-top: 12px; image-rendering: pixelated; }
.chips { display: flex; flex-wrap: wrap; }
.chip.person { background: rgba(255, 255, 255, .12); border: 0; color: var(--chalk); font-size: 1.2rem; }

/* Remote control: a phone beside the board, notes first. */
.remote .b-stage { display: none; }
.remote .b-notes { position: static; flex: 1; width: auto; max-height: none; margin: 12px; }
.remote .b-notes .close { display: none; }
.remote .b-title { display: none; }
.remote .b-bar { flex-direction: column; align-items: stretch; }
.remote .b-main-ctl .bb { flex: 1; padding: 18px 10px; }

/* Labs. */
.lab-host { background: rgba(255, 255, 255, .06); border-radius: 12px; padding: 16px; margin-top: 8px; }
.lab-host.light { background: var(--board); color: var(--chalk); }
.lab-stage { display: flex; justify-content: center; }
.lab-out { text-align: center; font-size: 1.5rem; font-weight: 800; margin: 10px 0; color: var(--gold); }
.lab-controls { display: flex; flex-wrap: wrap; gap: 16px; justify-content: center; align-items: center; }
.lab-slider { display: flex; align-items: center; gap: 10px; font-weight: 600; margin: 0; }
.lab-slider input { width: 180px; accent-color: var(--gold); }
.lab-slider output { min-width: 36px; font-weight: 800; }
.lab-pie { width: min(280px, 60vw); }
.lab-pie path, .lab-pie circle { stroke: var(--board); stroke-width: 2; }
.lab-pie .on { fill: var(--gold); } .lab-pie .off { fill: rgba(255, 255, 255, .14); }
.lab-line { width: 100%; max-width: 900px; }
.lab-line line { stroke: var(--chalk); stroke-width: 2; }
.lab-line text { fill: var(--chalk); font-size: 15px; }
.lab-line .dot { fill: var(--gold); }
.lab-line .hop { fill: none; stroke: var(--gold); stroke-width: 2.5; }
.lab-canvas { display: block; width: 100%; max-width: 800px; margin: 0 auto; background: rgba(0, 0, 0, .2); border-radius: 8px; }
.lab-expr { display: flex; align-items: center; gap: 8px; font-weight: 800; margin: 0; }
.lab-expr input { padding: 8px 10px; border-radius: 7px; border: 0; width: 230px; font-size: 1.15rem; }
.lab-clock { width: min(320px, 60vw); }
.lab-clock .face { fill: rgba(255, 255, 255, .08); stroke: var(--chalk); stroke-width: 3; }
.lab-clock text { fill: var(--chalk); font-size: 20px; font-weight: 700; }
.lab-clock .tick { stroke: var(--chalk-dim); }
.lab-clock .hour { stroke: var(--gold); stroke-width: 7; stroke-linecap: round; }
.lab-clock .min { stroke: var(--chalk); stroke-width: 4; stroke-linecap: round; }
.lab-clock .pin { fill: var(--gold); }
.lab-angle { width: min(460px, 80vw); }
.lab-angle line { stroke: var(--chalk); stroke-width: 4; stroke-linecap: round; }
.lab-angle .arc { fill: var(--gold); opacity: .7; }
.lab-angle circle { fill: var(--gold); }
.ptable { display: grid; grid-template-columns: repeat(18, minmax(0, 1fr)); grid-template-rows: repeat(7, auto) 8px repeat(2, auto); gap: 2px; }
.pel { padding: 2px 0; border: 0; border-radius: 3px; background: rgba(255, 255, 255, .13); color: var(--chalk); cursor: pointer; display: flex; flex-direction: column; align-items: center; line-height: 1.05; }
.pel small { font-size: .55rem; opacity: .75; }
.pel b { font-size: clamp(.65rem, 1.15vw, 1.05rem); }
.pel.hl, .pel:hover { background: var(--gold); color: var(--ink); }
.lab-circuit { width: min(520px, 90vw); }
.lab-circuit .wire { fill: none; stroke: var(--chalk); stroke-width: 3; }
.lab-circuit .bulb { stroke: var(--chalk); stroke-width: 3; }
.lab-circuit .res { fill: var(--board); stroke: var(--chalk); stroke-width: 3; }
.lab-circuit text { fill: var(--chalk); font-size: 17px; font-weight: 700; }
.piano { display: flex; justify-content: center; overflow-x: auto; padding-bottom: 6px; }
.piano .white { position: relative; flex: 0 0 56px; height: 210px; background: #fbf8ef; color: #333; border: 1px solid #555; border-radius: 0 0 6px 6px; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 8px; font-weight: 700; cursor: pointer; touch-action: none; }
.piano .black { position: absolute; top: 0; right: -17px; width: 34px; height: 128px; background: #1b1b1b; border-radius: 0 0 4px 4px; z-index: 2; }
.lab-wheel { width: min(320px, 70vw); cursor: pointer; }
.swatches { display: flex; flex-wrap: wrap; gap: 18px; justify-content: center; font-size: 1rem; font-weight: 600; color: var(--chalk); }
.swatch { text-align: center; }
.swatch span { display: block; width: 88px; height: 56px; border-radius: 7px; margin-bottom: 4px; }
.beats { display: flex; justify-content: center; gap: 18px; margin: 24px 0; }
.beats span { width: 44px; height: 44px; background: rgba(255, 255, 255, .13); transform: rotate(45deg); }
.beats span.on { background: var(--gold); }

.prose p { margin-bottom: .8em; }
@media (max-width: 880px) {
  .hero, .grid2, .grid2.wide-left, .how { grid-template-columns: 1fr; }
  .hero { padding-top: 20px; }
  .side { position: static; }
  .lobby { grid-template-columns: 1fr; gap: 22px; }
  .b-title { display: none; }
}
@media (prefers-reduced-motion: reduce) { .pulse, .pulse-btn { animation: none; } .level span, .bar .fill { transition: none; } }
@media print {
  .top, .foot, .no-print { display: none !important; }
  body { background: #fff; font-size: 12pt; }
  .stepcard { break-inside: avoid; border-color: #aaa; }
}
