/* TP Timer. Mobile first: one column, thumb-sized buttons, a teach screen that is mostly one big number. */
/* The Coursebook look, shared with TPfolio (~/Documents/Software/tpfolio/src/styles.css): its tokens, fonts, pill buttons
   and soft shadowed cards. The older token names below are kept as aliases so the rules read as before. */
:root {
  --paper: #f6faf9; --surface: #ffffff; --surface-2: #eaf3f2; --line: #d2e2e0;
  --ink: #102a2d; --ink-2: #38555a; --ink-3: #5f777a;
  --teal: #0a7470; --orange: #e85f24; --blue: #2380c2; --berry: #bf2466; --green: #2a8f52; --sun: #ffc23b;
  --teal-s: #d7eeec; --orange-s: #fde5d9; --blue-s: #dcecf7; --berry-s: #f8dce8; --green-s: #dcf0e2; --sun-s: #fff1c9;
  --on-color: #ffffff; --on-sun: #102a2d;
  --red: #cc4127; --red-s: #fde4de;
  --amber: #a8620a; --hl: #ffe08f;
  --shadow: 0 2px 4px rgba(16, 42, 45, .05), 0 12px 30px rgba(10, 116, 112, .12);
  --shadow-up: 0 -2px 4px rgba(16, 42, 45, .04), 0 -10px 28px rgba(10, 116, 112, .10);
  --f-display: "Nunito", "Arial Rounded MT Bold", Arial, sans-serif;
  --f-body: "Nunito Sans", "Segoe UI", system-ui, sans-serif;
  --f-hand: "Kalam", "Marker Felt", "Comic Sans MS", cursive;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --paper: #0a1a1c; --surface: #102629; --surface-2: #163236; --line: #24474b;
  --ink: #e6f3f2; --ink-2: #afcaca; --ink-3: #7f9b9c;
  --teal: #4fc4bf; --orange: #ff8a55; --blue: #63b5ef; --berry: #ef6aa3; --green: #5fcb88; --sun: #ffc94f;
  --teal-s: #10393a; --orange-s: #3b2418; --blue-s: #132f42; --berry-s: #3a1a29; --green-s: #14321f; --sun-s: #3a3010;
  --on-color: #0a1a1c; --on-sun: #0a1a1c;
  --red: #ff8b72; --red-s: #3b1f19;
  --amber: #ffc94f; --hl: #4a3f14;
  --shadow: 0 2px 4px rgba(0, 0, 0, .3), 0 12px 30px rgba(0, 0, 0, .4);
  --shadow-up: 0 -2px 4px rgba(0, 0, 0, .25), 0 -10px 28px rgba(0, 0, 0, .35);
  color-scheme: dark; } }
:root[data-theme="dark"] {
  --paper: #0a1a1c; --surface: #102629; --surface-2: #163236; --line: #24474b;
  --ink: #e6f3f2; --ink-2: #afcaca; --ink-3: #7f9b9c;
  --teal: #4fc4bf; --orange: #ff8a55; --blue: #63b5ef; --berry: #ef6aa3; --green: #5fcb88; --sun: #ffc94f;
  --teal-s: #10393a; --orange-s: #3b2418; --blue-s: #132f42; --berry-s: #3a1a29; --green-s: #14321f; --sun-s: #3a3010;
  --on-color: #0a1a1c; --on-sun: #0a1a1c;
  --red: #ff8b72; --red-s: #3b1f19;
  --amber: #ffc94f; --hl: #4a3f14;
  --shadow: 0 2px 4px rgba(0, 0, 0, .3), 0 12px 30px rgba(0, 0, 0, .4);
  --shadow-up: 0 -2px 4px rgba(0, 0, 0, .25), 0 -10px 28px rgba(0, 0, 0, .35);
  color-scheme: dark; }
:root {
  --bg: var(--paper); --panel: var(--surface); --fg: var(--ink); --muted: var(--ink-3); --soft: var(--surface-2);
  --accent: var(--teal); --accent-fg: var(--on-color); --go: var(--orange);
  --ok: var(--green); --late: var(--red); --early: var(--blue); --warn: var(--amber);
  --hi: var(--hl); --hi-fg: var(--ink);
  --ui: var(--f-body); --hand: var(--f-hand);
  /* Board text is drawn on the canvas in Patrick Hand (HAND in app.js); the typing box over the board must match it. */
  --board-hand: "Patrick Hand", "Comic Sans MS", cursive;
  --gutter: max(16px, env(safe-area-inset-left, 0px));
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 16px/1.45 var(--ui); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; overscroll-behavior-y: none; }
h1, h2 { font-family: var(--f-display); font-weight: 900; letter-spacing: -.01em; line-height: 1.15; }
h1 { font-size: 23px; margin: 0; }
h2 { font-size: 20px; margin: 0 0 12px; }
a { color: var(--accent); }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.fine { color: var(--muted); font-size: 14px; }
.ok { color: var(--ok); } .late { color: var(--late); } .early { color: var(--early); }

.page { max-width: 640px; margin: 0 auto; padding: calc(10px + env(safe-area-inset-top, 0px)) var(--gutter) 32px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.title-in, .st-name { width: 0; }
/* Canvases report their pixel size as their width; keep every grid column shrinkable so thumbnails never widen the page. */
.cards, .actions, .stages, .stage, .st-more, .fld, .tnotes, .thumb-btn, .sheet, .list { grid-template-columns: minmax(0, 1fr); }
canvas { max-width: 100%; }
.page.has-foot { padding-bottom: calc(100px + env(safe-area-inset-bottom, 0px)); }
.top { display: flex; align-items: center; gap: 8px; min-height: 48px; }
.top h1 { flex: 1; }
.lede { margin: 0; color: var(--muted); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 46px; padding: 10px 18px; border-radius: 999px; border: 2px solid var(--line); background: var(--panel); color: var(--fg); font-family: var(--f-display); font-weight: 800; text-decoration: none; cursor: pointer; transition: background-color .15s ease, border-color .15s ease, filter .15s ease; }
.btn:hover:not(:disabled) { border-color: var(--accent); }
.btn.primary { background: var(--go); border-color: var(--go); color: var(--on-color); }
.btn.primary:hover:not(:disabled) { border-color: var(--go); filter: brightness(1.07); }
.btn.danger { color: var(--late); }
.btn.sm { min-height: 38px; padding: 6px 14px; font-size: 14px; }
.btn.wide { width: 100%; }
.btn.dashed { border-style: dashed; background: transparent; color: var(--accent); }
.btn svg, .icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon circle { fill: currentColor; stroke: none; }
.btn:disabled, .icon:disabled { opacity: .35; cursor: default; }
.icon { flex: none; width: 44px; height: 44px; display: inline-grid; place-items: center; border-radius: 999px; border: 2px solid transparent; background: transparent; color: var(--fg); cursor: pointer; font-weight: 700; font-size: 18px; text-decoration: none; }
.icon.sm { width: 38px; height: 38px; }
.icon:hover:not(:disabled) { background: var(--soft); }
.icon.on { background: var(--teal-s); color: var(--accent); }
:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }

.card { background: var(--panel); border-radius: 20px; box-shadow: var(--shadow); }
.card.pad { padding: 16px 18px; }
.cards, .actions, .stages { display: grid; gap: 10px; }
.lesson-card { display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 16px; }
.lc-main { flex: 1; min-width: 0; display: grid; gap: 2px; color: inherit; text-decoration: none; padding: 4px 0; }
.lc-main b { font-family: var(--f-display); font-weight: 900; font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lc-main .muted { font-size: 14px; }
.live { color: var(--late); font-weight: 700; }

/* editor */
.title-in { flex: 1; min-width: 0; font-family: var(--f-display); font-size: 21px; font-weight: 900; border: 2px solid transparent; background: transparent; border-radius: 14px; padding: 6px 10px; }
.title-in:focus { border-color: var(--accent); background: var(--panel); outline: none; }
.sumbar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; padding: 8px 14px 8px 16px; background: var(--panel); border-radius: 18px; box-shadow: var(--shadow); position: sticky; top: max(6px, env(safe-area-inset-top, 0px)); z-index: 3; }
.sumbar .ok, .sumbar .late, .sumbar .early { font-weight: 700; font-size: 15px; }
.sumbar .btn { margin-left: auto; }
.inline-num input { width: 58px; padding: 5px 6px; border: 2px solid var(--line); border-radius: 12px; background: var(--bg); text-align: center; font-family: var(--f-display); font-weight: 800; }
.inline-num input:focus { border-color: var(--accent); outline: none; }
.stage { padding: 10px 10px 10px 12px; display: grid; gap: 2px; border-left: 6px solid var(--blue); }
.st-head { display: flex; align-items: center; gap: 8px; }
.st-no { flex: none; width: 28px; height: 28px; border-radius: 9px; background: var(--blue); display: grid; place-items: center; font-family: var(--f-display); font-size: 14px; font-weight: 900; color: var(--on-color); }
.st-name { flex: 1; min-width: 0; font-family: var(--f-display); font-weight: 800; border: 2px solid transparent; background: transparent; padding: 5px 6px; border-radius: 12px; }
.st-name:focus, .st-min input:focus { border-color: var(--accent); background: var(--bg); outline: none; }
.st-min { flex: none; display: flex; align-items: center; gap: 3px; color: var(--muted); font-size: 14px; }
.st-min input { width: 52px; padding: 6px 4px; border: 2px solid var(--line); border-radius: 12px; background: var(--bg); text-align: center; font-family: var(--f-display); font-weight: 800; font-size: 16px; color: var(--fg); }
.st-sub { padding-left: 36px; font-size: 13px; font-variant-numeric: tabular-nums; }
.st-more { display: none; gap: 12px; padding: 10px 0 2px 36px; }
.stage.open .st-more { display: grid; }
.stage.open [data-act="toggle"] svg { transform: rotate(180deg); }
.st-tools { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.st-tools .danger { margin-left: auto; }
.fld { display: grid; gap: 5px; }
.fld > span { font-family: var(--f-display); font-size: 12px; font-weight: 900; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-2); }
.fld input, .fld textarea, .fld select { width: 100%; padding: 9px 12px; border: 2px solid var(--line); border-radius: 14px; background: var(--bg); font-size: 16px; }
.fld input:focus, .fld textarea:focus, .fld select:focus { border-color: var(--accent); outline: none; }
.fld textarea { resize: none; min-height: 42px; overflow: hidden; line-height: 1.35; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { min-height: 36px; padding: 4px 12px; border-radius: 999px; border: 2px solid var(--line); background: var(--panel); color: var(--ink-2); font-size: 14px; font-weight: 800; cursor: pointer; }
.chip:hover { border-color: var(--accent); color: var(--fg); }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.chip-in { width: 84px; min-height: 36px; padding: 4px 10px; border-radius: 999px; border: 2px solid var(--line); background: var(--panel); font-size: 14px; }
.chip-in:focus { border-color: var(--accent); outline: none; }
.thumb-btn { display: grid; gap: 4px; padding: 0; border: 0; background: none; cursor: pointer; text-align: left; width: 100%; }
.thumb { width: 100%; aspect-ratio: 16 / 9; border-radius: 8px; border: 4px solid #8b96a3; background: #fdfdfb; display: block; }
.thumb-cap { font-size: 14px; color: var(--accent); font-weight: 800; }

.foot { position: fixed; left: 0; right: 0; bottom: 0; z-index: 4; background: color-mix(in srgb, var(--paper) 92%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-top: 1px solid var(--line); padding: 10px var(--gutter) calc(10px + env(safe-area-inset-bottom, 0px)); }
.foot .btn { max-width: 640px; margin: 0 auto; display: flex; }
.big-btn { min-height: 56px; font-size: 19px; }

/* sheets */
.modal { position: fixed; inset: 0; z-index: 20; background: rgb(6 22 24 / .5); display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
.sheet { width: 100%; max-width: 560px; max-height: 92dvh; overflow: auto; background: var(--panel); border-radius: 26px 26px 0 0; box-shadow: var(--shadow-up); padding: 20px var(--gutter) calc(18px + env(safe-area-inset-bottom, 0px)); display: grid; gap: 14px; }
.sheet.wide-sheet { max-width: 1100px; }
.list { display: grid; gap: 6px; }
.row-btn { text-align: left; min-height: 48px; padding: 10px 14px; border-radius: 16px; border: 2px solid var(--line); background: var(--bg); cursor: pointer; display: grid; gap: 2px; font-weight: 800; }
.row-btn:hover { border-color: var(--accent); }
.row-btn small { color: var(--muted); font-weight: 400; font-size: 13px; }
.row-btn.on { border-color: var(--accent); background: var(--teal-s); }
.row-btn.danger { color: var(--late); }
.row2 { display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.row2 .btn { flex: 1; }
.row2 .muted { flex: 2; }
.howto { margin: 0; padding-left: 20px; display: grid; gap: 8px; }
.mini { margin: 6px 0 0; padding-left: 20px; }
.bview canvas { width: 100%; aspect-ratio: 16 / 9; border: 6px solid #8b96a3; border-radius: 12px; display: block; }
@keyframes fade { from { opacity: 0; } }

#toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 30; background: var(--fg); color: var(--bg); padding: 10px 18px; border-radius: 999px; box-shadow: var(--shadow); font-size: 15px; font-weight: 700; max-width: calc(100% - 32px); transition: opacity .2s, transform .2s; }
#toast.on { opacity: 1; transform: translate(-50%, 0); }

/* teach */
.teach { min-height: 100dvh; display: flex; flex-direction: column; max-width: 720px; margin: 0 auto; padding: env(safe-area-inset-top, 0px) var(--gutter) 0; }
.tbar { display: flex; align-items: center; gap: 6px; min-height: 52px; }
.tttl { flex: 1; min-width: 0; text-align: center; font-family: var(--f-display); font-weight: 800; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seg { display: flex; gap: 3px; height: 10px; }
.seg i { position: relative; border-radius: 999px; background: var(--soft); overflow: hidden; min-width: 4px; }
.seg i.done { background: var(--muted); opacity: .55; }
.seg b { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--accent); }
.seg i.over b { background: var(--late); }
.tmain { flex: 1; display: flex; flex-direction: column; gap: 10px; padding: 18px 0 calc(120px + env(safe-area-inset-bottom, 0px)); }
.sname { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; font-family: var(--f-display); font-size: 22px; font-weight: 900; line-height: 1.2; }
.sno { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ia { font-size: 14px; font-weight: 800; padding: 2px 10px; border-radius: 999px; background: var(--soft); color: var(--ink-2); }
.big { font-family: var(--f-display); font-size: clamp(72px, 25vw, 200px); font-weight: 900; line-height: .95; letter-spacing: -.03em; font-variant-numeric: tabular-nums; margin-top: 4px; }
.big { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: .12em; }
.big .of { font-size: .3em; font-weight: 800; letter-spacing: 0; color: var(--muted); }
.big.idle { color: var(--muted); }
.big.warn { color: var(--warn); }
.big.over { color: var(--late); }
.bigsub { color: var(--muted); font-size: 15px; font-variant-numeric: tabular-nums; margin-top: -4px; }
.drift { align-self: flex-start; font-family: var(--f-display); font-size: 18px; font-weight: 900; padding: 8px 14px; border-radius: 999px; background: var(--soft); color: var(--muted); font-variant-numeric: tabular-nums; }
.drift.ok { color: var(--ok); background: var(--green-s); }
.drift.late { color: var(--on-color); background: var(--late); }
.drift.early { color: var(--early); background: var(--blue-s); }
.cut { font-size: 17px; font-weight: 800; color: var(--late); background: var(--red-s); border: 2px solid var(--late); border-radius: 16px; padding: 9px 14px; }
.resume-bar { font: 900 17px var(--f-display); padding: 12px; border-radius: 999px; border: 2px dashed var(--warn); background: var(--sun-s); color: var(--warn); cursor: pointer; }
.tnotes { display: grid; gap: 10px; margin-top: 6px; }
.n-write { font-family: var(--hand); font-size: 23px; line-height: 1.3; background: var(--hi); color: var(--hi-fg); padding: 6px 12px; border-radius: 12px; white-space: pre-line; }
.n-say { font-size: 17px; white-space: pre-line; }
.n-ask { border: 2px dashed var(--line); border-radius: 16px; padding: 8px 12px; white-space: pre-line; }
.n-ask summary { font-family: var(--f-display); font-weight: 900; color: var(--muted); cursor: pointer; }
.tnotes .thumb { max-width: 420px; }
.nextup { color: var(--muted); font-size: 15px; border-top: 1px dashed var(--line); padding-top: 10px; }
.nextup b { color: var(--fg); }
.hand { font-family: var(--hand); font-size: 18px; color: var(--fg); }
.tfoot { position: fixed; left: 0; right: 0; bottom: 0; z-index: 4; display: grid; grid-template-columns: 1fr 2.4fr; gap: 10px; padding: 10px var(--gutter) calc(12px + env(safe-area-inset-bottom, 0px)); background: var(--panel); box-shadow: var(--shadow-up); border-radius: 24px 24px 0 0; }
.tbtn { min-height: 76px; font-size: 20px; border-radius: 24px; }
.tnext { font-size: 28px; font-weight: 900; }
@media (min-width: 760px) { .tfoot { left: 50%; right: auto; width: min(720px, 100%); transform: translateX(-50%); } }

/* runs */
.totals { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; }
.totals div { display: grid; }
.totals b { font-family: var(--f-display); font-weight: 900; font-size: 26px; font-variant-numeric: tabular-nums; }
.runs { width: 100%; border-collapse: collapse; font-size: 15px; font-variant-numeric: tabular-nums; }
.runs th, .runs td { padding: 9px 8px; text-align: right; border-bottom: 1px solid var(--line); vertical-align: top; }
.runs th:first-child, .runs td:first-child { text-align: left; padding-left: 14px; }
.runs th:last-child, .runs td:last-child { padding-right: 14px; font-weight: 700; }
.runs tr:last-child td { border-bottom: 0; }
.runs th { font-family: var(--f-display); font-weight: 900; font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.bars { display: grid; gap: 2px; margin-top: 5px; }
.bars i { display: block; height: 6px; border-radius: 999px; background: var(--soft); }
.bars i.act { background: var(--muted); }
.bars i.act.late { background: var(--late); } .bars i.act.ok { background: var(--ok); } .bars i.act.early { background: var(--early); }

/* board editor */
.bed { height: 100dvh; display: flex; flex-direction: column; padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px); }
.btools { display: flex; align-items: center; gap: 4px; padding: 6px 10px; overflow-x: auto; background: var(--panel); box-shadow: var(--shadow); flex: none; scrollbar-width: none; }
.btools > * { flex: none; }
.bsep { width: 1px; height: 26px; background: var(--line); margin: 0 4px; }
.sw { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--panel); background: var(--c); box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.sw.on { box-shadow: 0 0 0 3px var(--accent); }
.bstage { padding: 4px 12px; font-size: 13px; flex: none; }
@media (orientation: landscape) { .rot { display: none; } }
@media (max-height: 500px) { .bstage { display: none; } .btools { padding-block: 4px; } }
.bwrap { flex: 1; min-height: 0; position: relative; display: grid; place-items: center; padding: 8px; }
#bc { border: 6px solid #8b96a3; border-radius: 12px; touch-action: none; background: #fdfdfb; cursor: crosshair; box-sizing: content-box; }
#bc[data-tool="text"] { cursor: text; }
#bc[data-tool="erase"] { cursor: cell; }
.btext { position: absolute; z-index: 2; margin: 0; padding: 0 2px; border: 1px dashed #8b96a3; background: rgb(255 255 255 / .85); font-family: var(--board-hand); line-height: 1.12; resize: none; overflow: hidden; outline: none; min-width: 60px; white-space: pre; transform: translate(6px, 6px); }

/* ---------- v2: livelier, with the controls out in the open ---------- */
.btn svg { width: 20px; height: 20px; }
.act { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 58px; padding: 8px 6px; border-radius: 18px; border: 2px solid var(--line); background: var(--panel); color: var(--fg); font: 800 13px var(--f-display); text-decoration: none; cursor: pointer; text-align: center; }
.act svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.act:hover { border-color: var(--accent); }
.act.danger { color: var(--late); }
.act:active, .ctl:active, .btn:active { transform: scale(.97); }

/* home */
.hero-top { display: flex; align-items: center; gap: 14px; padding-top: 8px; }
.app-icon { flex: none; border-radius: 16px; box-shadow: 0 6px 16px rgb(10 107 103 / .28); }
.hero-top h1 { font-size: 28px; letter-spacing: -.02em; }
.hero-top h1 i { font-style: normal; color: var(--accent); }
.hero-top .lede { font-size: 15px; margin-top: 2px; }
.how { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 20px; border: 0; background: var(--teal-s); cursor: pointer; text-align: left; color: var(--fg); font-family: var(--f-display); }
.how:hover { filter: brightness(.98); }
.how b { font-weight: 900; }
.how svg { width: 28px; height: 28px; flex: none; fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.how span { display: grid; } .how small { color: var(--ink-2); font-family: var(--f-body); font-size: 13px; }
.lesson-card { align-items: stretch; padding: 14px 14px 14px 18px; }
.lc-main { gap: 4px; }
.mini-seg { display: flex; gap: 3px; height: 8px; margin-top: 6px; }
.mini-seg i { border-radius: 999px; background: var(--orange); }
.mini-seg i:nth-child(5n+2) { background: var(--blue); } .mini-seg i:nth-child(5n+3) { background: var(--green); }
.mini-seg i:nth-child(5n+4) { background: var(--berry); } .mini-seg i:nth-child(5n) { background: var(--teal); }
.lc-run { font-size: 13px; font-weight: 800; }
.teach-btn { flex: none; flex-direction: column; gap: 2px; min-width: 78px; border-radius: 20px; font-size: 14px; }
.teach-btn svg { fill: currentColor; stroke: none; width: 22px; height: 22px; }
.actions.two { grid-template-columns: 1fr 1fr; }

/* editor */
.lactions { display: grid; grid-template-columns: repeat(auto-fit, minmax(64px, 1fr)); gap: 8px; }

/* teach */
.teach .tbar .btn.sm { min-height: 34px; }
.tmain { gap: 12px; padding-top: 14px; }
.hero { --tone: var(--accent); background: var(--panel); border: 2px solid transparent; border-radius: 26px; padding: 14px 18px 18px; display: grid; gap: 6px; box-shadow: var(--shadow); transition: background .4s, border-color .4s; }
.hero.good { --tone: var(--ok); background: color-mix(in srgb, var(--green-s) 55%, var(--panel)); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.hero.warn { --tone: var(--warn); background: var(--sun-s); border-color: color-mix(in srgb, var(--sun) 80%, transparent); }
.hero.over { --tone: var(--late); background: var(--red-s); border-color: color-mix(in srgb, var(--late) 60%, transparent); }
.hero.paused { --tone: var(--muted); border-color: var(--line); border-style: dashed; }
.h-top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.h-top .sno { font-family: var(--f-display); font-size: 12px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; color: var(--tone); }
.seg-ctl { margin-left: auto; display: inline-flex; padding: 4px; border-radius: 999px; background: var(--soft); }
.seg-ctl button { border: 0; background: none; padding: 6px 12px; border-radius: 999px; font: 800 12.5px var(--f-display); color: var(--ink-2); cursor: pointer; }
.seg-ctl button.on { background: var(--panel); color: var(--accent); box-shadow: 0 1px 3px rgb(0 0 0 / .14); }
.hero .sname { font-size: 25px; }
.hero .big { margin-top: 0; color: var(--fg); }
.hero.warn .big { color: var(--warn); } .hero.over .big { color: var(--late); } .hero.idle .big, .hero.paused .big { color: var(--muted); }
.pbar { height: 10px; border-radius: 999px; background: color-mix(in srgb, var(--tone) 15%, var(--soft)); overflow: hidden; }
.pbar i { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--tone); transition: width .25s linear; }
.hero .bigsub { margin-top: 2px; }
.drift { align-self: stretch; text-align: center; }
.ctrls { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ctl { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 50px; padding: 0 8px; border-radius: 999px; border: 2px solid var(--line); background: var(--panel); color: var(--fg); font: 800 14.5px var(--f-display); white-space: nowrap; cursor: pointer; }
@media (max-width: 360px) { .ctl { font-size: 13px; gap: 4px; } .ctl svg { width: 17px; height: 17px; } }
.ctl:hover { border-color: var(--accent); }
.ctl svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.ctl.on { background: var(--sun); border-color: var(--sun); color: var(--on-sun); }
#tReset { color: var(--late); }
.resume-bar { display: flex; align-items: center; justify-content: center; gap: 8px; }
.resume-bar svg { width: 18px; height: 18px; fill: currentColor; }
.n-card { background: var(--panel); border-radius: 20px; box-shadow: var(--shadow); padding: 12px 14px; display: grid; gap: 6px; }
.n-lbl { font-family: var(--f-display); font-size: 11.5px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.n-card .n-write { margin: 0; }
.n-ask { background: var(--panel); }
.nextup { border-top: 0; background: var(--teal-s); color: var(--ink-2); border: 0; border-radius: 20px; padding: 12px 14px; }
.timeline { background: var(--panel); border-radius: 20px; box-shadow: var(--shadow); padding: 12px 14px; }
.tl-head { display: flex; justify-content: space-between; font-family: var(--f-display); font-size: 11.5px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding-bottom: 6px; }
.timeline ol { list-style: none; margin: 0; padding: 0; display: grid; }
.timeline li { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 7px 0; border-top: 1px solid var(--soft); font-size: 15px; }
.timeline li:first-child { border-top: 0; }
.tl-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-val { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; text-align: right; }
.tl-val em { font-style: normal; font-weight: 800; margin-left: 4px; }
.dot { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; font-size: 9px; font-weight: 900; line-height: 1; justify-self: center; }
.timeline li.done { color: var(--muted); }
.timeline li.done .dot { background: var(--ok); border-color: var(--ok); color: var(--on-color); }
.timeline li.now { font-weight: 800; font-family: var(--f-display); }
.timeline li.now .dot { border-color: var(--accent); background: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 25%, transparent); }
.timeline li.now .tl-val { color: var(--accent); font-weight: 700; }

/* board editor */
.bactions { flex: none; display: flex; gap: 8px; padding: 0 10px 8px; overflow-x: auto; }
.bactions .act { flex-direction: row; min-height: 40px; padding: 6px 12px; font-size: 13px; white-space: nowrap; }
.bactions .act svg { width: 18px; height: 18px; }
@media (max-height: 500px) { .bactions { padding-bottom: 4px; } .bactions .act { min-height: 34px; padding: 4px 10px; } }
.hero .big { font-size: clamp(64px, 22vw, 180px); }
/* v3: the editor's lesson actions live in a clearly labelled Options menu */
.menu-btn { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 42px; padding: 6px 16px; border-radius: 999px; border: 2px solid var(--line); background: var(--panel); color: var(--fg); font: 800 14px var(--f-display); cursor: pointer; }
.menu-btn:hover { border-color: var(--accent); }
.menu-btn svg { width: 20px; height: 20px; }
.menu-btn circle { fill: currentColor; stroke: none; }
.row-btn.with-icon { display: flex; align-items: center; gap: 12px; }
.row-btn.with-icon svg { flex: none; width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* "Don't forget" card: a stage's ICQs / CCQs pop up on reaching it. Drag by the top strip, minimize to a chip, × to close. */
.qshow { justify-self: start; min-height: 44px; padding: 8px 16px; border-radius: 999px; border: 2px solid var(--berry); background: var(--berry-s); color: var(--berry); font-family: var(--f-display); font-weight: 900; cursor: pointer; }
.qcard { position: fixed; z-index: 8; width: min(340px, calc(100vw - 32px)); display: grid; background: var(--panel); color: var(--fg); border: 2px solid var(--berry); border-radius: 20px; box-shadow: 0 12px 32px rgba(10, 30, 32, .3); }
.qhead { display: flex; align-items: center; gap: 4px; padding: 4px 4px 4px 14px; background: var(--berry); color: var(--on-color); border-radius: 17px 17px 0 0; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.qhead.dragging { cursor: grabbing; }
.qgrip { opacity: .6; font-size: 14px; letter-spacing: -2px; }
.qttl { flex: 1; min-width: 0; font-family: var(--f-display); font-size: 15px; font-weight: 900; line-height: 1.2; }
.qttl small { display: block; font-weight: 400; font-size: 12px; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qhead button { flex: none; width: 44px; height: 44px; border: 0; border-radius: 999px; background: transparent; color: inherit; font-size: 24px; font-weight: 700; line-height: 1; cursor: pointer; }
.qlist { list-style: none; margin: 0; padding: 6px; display: grid; gap: 2px; max-height: 42vh; overflow-y: auto; }
.qlist button { width: 100%; display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 8px; align-items: start; text-align: left; padding: 8px; border: 0; border-radius: 12px; background: transparent; font-size: 17px; line-height: 1.35; cursor: pointer; }
.qlist button:hover { background: var(--soft); }
.qbox { width: 18px; height: 18px; margin-top: 2px; display: grid; place-items: center; border: 2px solid var(--berry); border-radius: 5px; font-size: 13px; font-weight: 700; color: var(--on-color); }
.qlist .did .qbox { background: var(--ok); border-color: var(--ok); }
.qlist .did .qtext { color: var(--muted); text-decoration: line-through; }
.qtag { display: inline-block; margin-right: 6px; padding: 1px 7px; border: 1.5px solid currentColor; border-radius: 999px; font-family: var(--f-display); font-size: 11px; font-weight: 900; letter-spacing: .06em; vertical-align: 2px; }
.qtag.icq { color: var(--blue); } .qtag.ccq { color: var(--berry); }
.qfoot { padding: 0 12px 8px; color: var(--muted); font-size: 12px; }
.qchip { position: fixed; z-index: 8; display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 16px; border: 2px solid var(--berry); border-radius: 999px; background: var(--berry); color: var(--on-color); font-family: var(--f-display); font-weight: 900; box-shadow: 0 8px 20px rgba(10, 30, 32, .28); cursor: pointer; touch-action: none; user-select: none; -webkit-user-select: none; }
.qchip span { font-weight: 400; font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: no-preference) {
  .qcard.pop { animation: qpop .28s ease-out; }
  @keyframes qpop { from { transform: scale(.92); opacity: .4; } to { transform: none; opacity: 1; } }
}

/* Task timer: a countdown within a stage (planned on the stage, or set on the spot), under the stage clock */
.tk-rows { display: grid; gap: 6px; }
.tk-rows:empty { display: none; }
.tk-row { display: flex; align-items: center; gap: 6px; }
.tk-row > input { flex: 1; min-width: 0; }
.tk-row .st-min input { width: 58px; padding: 8px 4px; }
.tk-row > input { padding: 9px 12px; border: 2px solid var(--line); border-radius: 14px; background: var(--bg); }
.tk-row > input:focus { border-color: var(--accent); outline: none; }
.tk-row .icon { color: var(--muted); }
.tk-add { justify-self: start; display: inline-flex; align-items: center; gap: 6px; }
.task { --tone: var(--accent); background: var(--panel); border: 2px solid transparent; border-radius: 22px; box-shadow: var(--shadow); padding: 12px 14px; display: grid; gap: 8px; transition: background .3s, border-color .3s; }
.task.on { border-color: color-mix(in srgb, var(--accent) 45%, transparent); background: color-mix(in srgb, var(--teal-s) 55%, var(--panel)); }
.task.tk-warn { --tone: var(--warn); border-color: var(--sun); background: var(--sun-s); }
.task.tk-up { --tone: var(--late); border-color: var(--late); background: var(--red-s); }
.task.tk-paused { --tone: var(--muted); border-color: var(--line); border-style: dashed; }
.tk-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.tk-go { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 6px 16px 6px 12px; border-radius: 999px; border: 2px solid var(--accent); background: var(--panel); color: var(--accent); font: 800 15px var(--f-display); text-align: left; cursor: pointer; }
.tk-go svg { flex: none; width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.tk-go b { font-family: var(--f-body); font-weight: 600; color: var(--muted); white-space: nowrap; }
.tk-go.other { border-style: dashed; border-color: var(--line); color: var(--fg); }
.tk-go:active { transform: scale(.97); }
.tk-main { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; padding: 0; border: 0; background: none; color: var(--fg); font: inherit; text-align: left; cursor: pointer; }
.tk-lbl { flex-basis: 100%; font-family: var(--f-display); font-size: 12px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; color: var(--tone); }
.tk-n { font-family: var(--f-display); font-size: clamp(48px, 14vw, 88px); font-weight: 900; line-height: 1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; color: var(--tone); }
.task.tk-run .tk-n { color: var(--fg); }
.tk-sub { font-weight: 700; color: var(--muted); }
.task.tk-up .tk-sub { color: var(--late); }
.task .pbar { height: 8px; }
.tk-btns { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.tk-btns .btn { padding-inline: 4px; }
#tkStop { color: var(--late); }
.task.tk-up #tkStop { color: var(--fg); }
/* "Show class": the task countdown full screen, for the learners to see */
.tkfull { position: fixed; inset: 0; z-index: 30; display: grid; place-content: center; justify-items: center; gap: 10px; padding: 24px; background: var(--bg); color: var(--fg); text-align: center; cursor: pointer; }
.tkf-lbl { font-family: var(--f-display); font-size: clamp(24px, 6vw, 48px); font-weight: 900; }
.tkf-n { font-family: var(--f-display); font-size: min(34vw, 62vh); font-weight: 900; line-height: .9; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.tkf-sub { min-height: 1.2em; font-family: var(--f-display); font-size: clamp(22px, 5vw, 40px); font-weight: 900; }
.tkf-hint { font-size: 14px; color: var(--muted); }
.tkfull.tk-warn .tkf-n { color: var(--warn); }
.tkfull.tk-up { background: var(--late); color: var(--on-color); }
.tkfull.tk-up .tkf-hint { color: color-mix(in srgb, var(--on-color) 80%, transparent); }
.tkfull.tk-paused .tkf-n { color: var(--muted); }
.tk-btns .btn { white-space: nowrap; font-size: 13.5px; }
.task.pre { border-style: dashed; }
.tk-go:disabled { opacity: .55; cursor: default; }
.tk-go:disabled:active { transform: none; }
.tnext { font-size: 24px; }
.tback { padding-inline: 6px; font-size: 18px; }

/* ---------- steps and the typed board (folded in from Board Steps, 2026-12-05) ---------- */
/* The typed board is a whiteboard, so like the drawn one it stays light in dark mode; marker colors match the pens. */
.steps-btn { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 58px; padding: 10px 14px; border-radius: 18px; border: 2px dashed var(--line); background: var(--bg); color: var(--fg); cursor: pointer; text-align: left; font-family: var(--f-display); }
.steps-btn:hover { border-color: var(--accent); }
.steps-btn svg { width: 26px; height: 26px; flex: none; fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.steps-btn span { display: grid; gap: 1px; min-width: 0; }
.steps-btn b { font-weight: 900; color: var(--accent); }
.steps-btn small { font-family: var(--f-body); font-size: 13px; color: var(--muted); }

.cue { background: var(--panel); border-radius: 20px; box-shadow: var(--shadow); border-left: 6px solid var(--orange); padding: 10px 14px 12px; display: grid; gap: 8px; }
.cue-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cue-head .n-lbl { color: var(--orange); font-size: 13px; }
.cue-nav { display: flex; gap: 4px; }
.cue-nav .icon { border-color: var(--line); }
.cue .n-write { margin: 0; }
.cue-next { border-top: 1px dashed var(--line); padding-top: 8px; font-size: 15px; color: var(--muted); }

.tboard { --tb-ink: #1f2a37; --tb-muted: #6b7785; --tb-line: #c9d1db; --tb-hi: #fff1a8;
  background: #fdfdfb; border: 6px solid #8b96a3; border-radius: 12px; padding: 12px; display: grid; gap: 10px 12px; font-family: var(--board-hand); font-size: 19px; color: var(--tb-ink); user-select: none; -webkit-user-select: none; cursor: pointer; min-width: 0; }
.tboard .zone { min-width: 0; display: grid; align-content: start; gap: 6px; }
.tboard .z-left { border-right: 1px dashed var(--tb-line); color: var(--tb-muted); font-size: 15px; }
.tboard .z-b { border-left: 1px dashed var(--tb-line); padding-left: 10px; }
.tboard .z-right { border-left: 1px dashed var(--tb-line); padding-left: 10px; font-size: 17px; }
.tboard .z-strip { border-top: 2px dashed #8b96a3; padding-top: 6px; gap: 4px; min-height: 34px; }
.tboard .tag { font-family: var(--f-display); font-size: 10.5px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; color: var(--tb-muted); }
.tboard .ln { line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.tboard .ln.has-st { line-height: 2.2; }
.tboard .ln.gone { display: none; }
.tboard .it.big { font-size: 1.15em; }
.tboard .c-r { color: #c0392b; } .tboard .c-b { color: #1f5fbf; } .tboard .c-g { color: #19804a; } .tboard .c-o { color: #c2610c; } .tboard .c-m { color: var(--tb-muted); } .tboard .c-k { color: var(--tb-ink); }
.tboard .box { border: 2px solid currentColor; padding: 0 5px; border-radius: 3px; color: #1f5fbf; }
.tboard .st { position: relative; }
.tboard .st::before { content: "●"; position: absolute; left: 50%; top: -1em; transform: translateX(-50%); font-size: 13px; line-height: 1; color: #c0392b; }
.tboard .it.off { visibility: hidden; }
.tboard .it.gone { display: none; }
.tboard .it.new { background: var(--tb-hi); border-radius: 4px; box-shadow: 0 0 0 3px var(--tb-hi); }
.tb-empty { margin: 0; font-family: var(--f-body); font-size: 14px; color: var(--tb-muted); }
.tboard.sm { font-size: 15px; padding: 8px; border-width: 4px; cursor: default; }
.tboard.sm .z-right { font-size: 14px; }
@media (prefers-reduced-motion: no-preference) { .tboard .it { transition: background .25s, box-shadow .25s; } }
/* On a phone the board's areas stack, as in Board Steps (the names column is dropped). */
@media (max-width: 560px) {
  .tboard { grid-template-columns: minmax(0, 1fr) !important; grid-template-areas: none !important; font-size: 17px; padding: 10px; }
  .tboard .zone { grid-area: auto !important; }
  .tboard .z-left { display: none; }
  .tboard .z-b, .tboard .z-right { border-left: none; border-top: 1px dashed var(--tb-line); padding: 8px 0 0; }
  .tboard .z-strip { order: 5; }
}

/* steps editor */
.steps-h1 { display: grid; flex: 1; min-width: 0; font-size: 21px; }
.steps-h1 small { font-size: 12px; font-weight: 900; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.steps { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr); }
.step { padding: 8px 10px 8px 12px; border-left: 6px solid var(--orange); display: grid; grid-template-columns: minmax(0, 1fr); }
.step .st-no { background: var(--orange); }
.sp-head { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 2px 0; border: 0; background: none; cursor: pointer; text-align: left; color: var(--fg); }
.sp-head > svg { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; color: var(--muted); }
.step.open .sp-head > svg { transform: rotate(180deg); }
.sp-title { flex: 1; min-width: 0; display: grid; }
.sp-title b { font-family: var(--f-display); font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-title small { color: var(--muted); font-size: 13px; }
.sp-more { display: none; gap: 12px; padding: 8px 0 4px 38px; grid-template-columns: minmax(0, 1fr); }
.step.open .sp-more { display: grid; }
.item { display: grid; gap: 6px; padding: 10px; border-radius: 16px; background: var(--soft); grid-template-columns: minmax(0, 1fr); }
.item textarea { font-family: var(--board-hand); font-size: 18px; }
.it-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.it-row select { flex: 1 1 120px; width: auto; min-width: 0; }
.item select { max-width: 100%; text-overflow: ellipsis; }
.chk { display: inline-flex; align-items: center; gap: 5px; font-size: 14px; font-weight: 700; color: var(--ink-2); min-height: 36px; }
.chk input { width: 18px; height: 18px; accent-color: var(--teal); }
.pill { display: inline-block; padding: 1px 9px; border-radius: 999px; background: var(--soft); font-size: 13px; }
.help summary { cursor: pointer; font-family: var(--f-display); }
.help { display: grid; gap: 10px; }
.help code { background: var(--soft); padding: 1px 5px; border-radius: 6px; font-size: 14px; }
.stage-nav .btn { flex: 0 1 auto; max-width: 48%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 420px) { .sp-more { padding-left: 0; } }

/* old address banner and the TPfolio footer */
.moved { display: grid; gap: 10px; border: 2px solid var(--sun); background: var(--sun-s); box-shadow: none; }
.moved p { margin: 0; }
.moved .btn.sm { justify-self: start; }
.brand-foot { display: flex; justify-content: center; padding-top: 10px; }
.brand-foot a { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); text-decoration: none; font-size: 14px; }
.brand-foot a:hover { color: var(--fg); }
.brand-foot svg { width: 20px; height: 20px; flex: none; }
.brand-foot b { font-family: var(--f-display); font-weight: 900; color: var(--fg); }
.draw-too { justify-self: start; }
