/* Modelling Book. Fonts are in fonts.css (built by tools/build_fonts.py). */

:root {
  --ui: "Poppins", system-ui, -apple-system, "Segoe UI", sans-serif;
  --hand: "Playpen Sans", "Comic Sans MS", system-ui, sans-serif;
  --ink: #1f2430;
  --muted: #667085;
  --line: #e4e2dd;
  --bg: #ebe7e0;
  --card: #ffffff;
  --accent: #157a55;
  --accent-soft: #e2f3ea;
  --pencil: #33363d;
  --danger: #d6404a;
  --radius: 10px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font-family: var(--ui); color: var(--ink); background: var(--bg); display: flex; flex-direction: column; overflow: hidden; font-size: 14px; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
svg.ic { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- top bar */
.bar { display: flex; align-items: center; gap: 10px; padding: 8px 14px; background: var(--card); border-bottom: 1px solid var(--line); min-height: 58px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 15px; white-space: nowrap; color: var(--accent); }
.brand svg.ic { width: 22px; height: 22px; }
.lesson-btn { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); background: #faf9f7; border-radius: 12px; padding: 6px 12px 6px 6px; cursor: pointer; min-width: 0; max-width: 560px; text-align: left; }
.lesson-btn:hover { border-color: #cfcac1; background: #fff; }
.subj-chip { flex: none; font-size: 12px; font-weight: 600; color: #fff; background: #3b6fd8; border-radius: 8px; padding: 5px 9px; }
.lb-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.lb-lo { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.date-chip { position: relative; display: flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; cursor: pointer; white-space: nowrap; color: var(--ink); }
.date-chip:hover { background: #faf9f7; }
.date-chip input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.date-chip input::-webkit-calendar-picker-indicator { position: absolute; inset: 0; width: 100%; height: 100%; cursor: pointer; }
.grow { flex: 1; }
.saved { font-size: 12px; color: var(--muted); white-space: nowrap; }
.ibtn { display: flex; align-items: center; gap: 6px; background: none; border: 1px solid transparent; border-radius: 10px; padding: 8px 10px; cursor: pointer; }
.ibtn:hover { background: #f3f1ed; }

/* ---------- toolbar */
.tools { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; padding: 6px 12px; background: var(--card); border-bottom: 1px solid var(--line); }
.grp { display: flex; align-items: center; gap: 2px; }
.sep { width: 1px; height: 26px; background: var(--line); margin: 0 4px; }
.tbtn { display: flex; align-items: center; gap: 5px; border: 1px solid transparent; background: none; border-radius: 9px; padding: 7px 7px; cursor: pointer; white-space: nowrap; font-size: 12.5px; }
.tbtn:hover { background: #f3f1ed; }
.tbtn.on { background: var(--accent-soft); border-color: #b9e0cb; color: var(--accent); font-weight: 600; }
.tbtn:disabled { opacity: .4; cursor: default; }
.pens { gap: 4px; }
.pen { width: 34px; height: 34px; border-radius: 50%; border: 2px solid transparent; background: none; display: grid; place-items: center; cursor: pointer; padding: 0; }
.pen span { width: 22px; height: 22px; border-radius: 50%; background: var(--c); box-shadow: inset 0 -3px 0 rgba(0,0,0,.18); display: grid; place-items: center; color: #fff; }
.pen span svg.ic { width: 13px; height: 13px; stroke-width: 2.4; }
.pen.on { border-color: var(--c); }
.pen:hover span { transform: scale(1.08); }
.pen-name { font-size: 12px; color: var(--muted); margin-left: 4px; min-width: 52px; }
@media (max-width: 1640px) { .tools .tbtn .lbl2 { display: none; } }
@media (max-width: 1280px) { .tools .tbtn .lbl { display: none; } .tools .tbtn { padding: 8px; } .pen-name { display: none; } }
@media (max-width: 1100px) { .bar .lbl, .brand-t, .saved { display: none; } }

/* ---------- main layout */
.main { flex: 1; display: flex; min-height: 0; }
.stage { flex: 1; overflow: auto; position: relative; scroll-behavior: smooth; }
.sheet-wrap { padding: 22px 24px 60px; }
.panel { width: 340px; flex: none; background: var(--card); border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
body.no-panel .panel { display: none; }
@media (max-width: 980px) { .panel { position: fixed; right: 0; top: 112px; bottom: 0; z-index: 30; box-shadow: -10px 0 30px rgba(0,0,0,.12); } }

/* ---------- the page */
.sheet {
  --u: 1; --L: 34px; --fs: 22px; --base: 24px; --top: 68px; --ml: 70px; --tx: 84px;
  position: relative; margin: 0 auto; width: calc(var(--u) * 1000px); min-height: calc(var(--u) * 1414px);
  background: #fff; border-radius: 3px 7px 7px 3px;
  box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 8px 28px rgba(60,45,20,.13);
}
.sheet::before { /* the fold of the book */
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: calc(var(--u) * 46px); pointer-events: none; z-index: 1;
  background: linear-gradient(to right, rgba(0,0,0,.13), rgba(0,0,0,.035) 40%, transparent);
  border-radius: 3px 0 0 3px;
}
.sheet::after { /* stitching */
  content: ""; position: absolute; left: calc(var(--u) * 7px); top: calc(var(--u) * 30px); bottom: calc(var(--u) * 30px); width: 2px; pointer-events: none;
  background: repeating-linear-gradient(to bottom, rgba(120,130,160,.45) 0 calc(var(--u) * 9px), transparent 0 calc(var(--u) * 26px));
}
.rules { position: absolute; left: 0; right: 0; top: var(--top); bottom: calc(var(--L) * .6); pointer-events: none; }
.paper-lined .rules { background-image: linear-gradient(to bottom, transparent calc(var(--L) - 1.25px), rgba(38,40,58,.62) calc(var(--L) - 1.25px));
  background-size: 100% var(--L); background-position: 0 calc(var(--base) + 2.25px - var(--L)); }
.paper-squared .rules { background-image:
  linear-gradient(to bottom, transparent calc(var(--L) - 1px), rgba(70,110,170,.30) calc(var(--L) - 1px)),
  linear-gradient(to right, transparent calc(var(--L) - 1px), rgba(70,110,170,.30) calc(var(--L) - 1px));
  background-size: 100% var(--L), var(--L) 100%; background-position: 0 calc(var(--base) + 2px - var(--L)), calc(var(--ml) - 1px) 0; }
.paper-plain .rules { background: none; }
.margin-line { position: absolute; top: 0; bottom: 0; left: var(--ml); width: 1.3px; background: rgba(38,40,58,.62); pointer-events: none; }
.paper-plain .margin-line { display: none; }
.margin-right { position: absolute; top: 0; bottom: 0; left: calc(var(--u) * 962px); width: 1px; background: rgba(38,40,58,.11); pointer-events: none; }
.page-break { position: absolute; left: 0; right: 0; height: 0; border-top: 2px dashed rgba(120,110,95,.35); pointer-events: none; }
.page-break span { position: absolute; right: calc(var(--u) * 10px); top: 2px; font: 500 calc(var(--u) * 11px)/1 var(--ui); color: #a39b8e; background: #fff; padding: 2px 4px; }

.editor {
  position: relative; z-index: 2; outline: none; min-height: calc(var(--u) * 1414px);
  padding: var(--top) calc(var(--u) * 46px) calc(var(--L) * 2) var(--tx);
  font-family: var(--hand); font-size: var(--fs); line-height: var(--L); color: var(--pencil); font-weight: 400;
  caret-color: #1d5bd8; word-wrap: break-word; overflow-wrap: break-word; white-space: pre-wrap;
  font-variant-ligatures: none;
}
.font-print .editor { font-family: var(--ui); font-size: calc(var(--fs) * .92); }
.editor > div { min-height: var(--L); }
.editor [data-role="lo"], .editor .sub { text-decoration: underline; text-decoration-thickness: max(1.6px, calc(var(--u) * 2px)); text-underline-offset: max(2px, calc(var(--u) * 3px)); text-decoration-color: currentColor; }
.editor [data-role="lo"] { font-weight: 500; }
.editor .medal { background: #bce8cf; border-radius: 4px; padding: 0 .12em; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.editor [data-role="pink"] { color: #e0338a; }
.editor [data-pen="blue"] { color: #1f4fb5; }
.editor [data-pen="purple"] { color: #7b2fc0; }
.editor [data-pen="pink"] { color: #e0338a; }
.editor [data-pen="green"] { color: #16884a; }
.editor [data-pen="pencil"] { color: var(--pencil); }
.editor mark { color: inherit; border-radius: 3px; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.editor u { text-decoration-thickness: max(1.5px, calc(var(--u) * 2px)); }

/* stuck-in pictures and tables */
.fig, .tbl { position: relative; display: flex; align-items: center; user-select: none; -webkit-user-select: none; }
.fig[data-align="left"] { justify-content: flex-start; }
.fig[data-align="center"], .tbl { justify-content: center; }
.fig[data-align="wrap"] { float: right; clear: right; width: 44%; margin-left: 3%; justify-content: center; }
.fig-in { position: relative; cursor: pointer; }
.fig img { display: block; width: 100%; height: auto; border-radius: 2px; box-shadow: 0 1px 4px rgba(0,0,0,.18); background: #f4f4f4; }
.fig[data-tilt="1"] .fig-in { transform: rotate(-.7deg); }
.fig[data-tape="1"] .fig-in::before, .fig[data-tape="1"] .fig-in::after {
  content: ""; position: absolute; top: calc(var(--u) * -10px); width: calc(var(--u) * 74px); height: calc(var(--u) * 22px);
  background: rgba(238,232,205,.72); box-shadow: 0 1px 2px rgba(0,0,0,.1); z-index: 2;
}
.fig[data-tape="1"] .fig-in::before { left: calc(var(--u) * -18px); transform: rotate(-33deg); }
.fig[data-tape="1"] .fig-in::after { right: calc(var(--u) * -18px); transform: rotate(31deg); }
.fig.sel .fig-in, .tbl.sel table { outline: 3px solid #4c8df6; outline-offset: 4px; border-radius: 3px; }
.fig .grip { position: absolute; right: -9px; bottom: -9px; width: 18px; height: 18px; border-radius: 50%; background: #4c8df6; border: 3px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.3); cursor: nwse-resize; display: none; z-index: 3; }
.fig.sel .grip { display: block; }
.tbl table { border-collapse: separate; border-spacing: 0; background: #fff; font-family: var(--ui); font-size: calc(var(--fs) * .66);
  box-shadow: inset 1px 1px 0 #444, 0 1px 4px rgba(0,0,0,.15); }
.tbl tr { height: var(--L); }
.tbl td { border-right: 1px solid #444; border-bottom: 1px solid #444; padding: 0 .7em; min-width: 7.5em; line-height: 1.2; vertical-align: middle; outline: none; }
.tbl tr:first-child td { font-weight: 600; background: #f1f4f8; }
.tbl td:focus { background: #fffbe6; }

/* margin hints, colour key, ink */
.marks { position: absolute; left: 0; top: 0; width: var(--ml); bottom: 0; z-index: 3; pointer-events: none; }
.mdot { position: absolute; left: calc(var(--ml) * .32); width: calc(var(--u) * 20px); height: calc(var(--u) * 20px); margin-top: calc(var(--u) * -10px);
  border-radius: 50%; background: #e5484d; color: #fff; font: 600 calc(var(--u) * 11px)/calc(var(--u) * 20px) var(--ui); text-align: center;
  box-shadow: 0 0 0 calc(var(--u) * 3px) rgba(229,72,77,.18); animation: pop .3s ease; }
@keyframes pop { from { transform: scale(.2); opacity: 0; } }
.key { position: absolute; left: var(--tx); top: calc(var(--u) * 12px); z-index: 3; display: flex; flex-wrap: wrap; justify-content: flex-start; gap: calc(var(--u) * 6px);
  max-width: 62%; font: 500 calc(var(--u) * 12px)/1.3 var(--ui); color: #555; }
.key span { display: inline-flex; align-items: center; gap: calc(var(--u) * 5px); background: #fff; border: 1px solid #ece9e3; border-radius: 99px; padding: calc(var(--u) * 1px) calc(var(--u) * 7px); font-size: calc(var(--u) * 11px); }
.key i { width: calc(var(--u) * 14px); height: calc(var(--u) * 8px); border-radius: 3px; display: inline-block; }
.ink { position: absolute; left: 0; top: 0; width: 100%; height: 100%; z-index: 4; pointer-events: none; overflow: visible; mix-blend-mode: multiply; }
body.drawing .ink { pointer-events: auto; cursor: crosshair; touch-action: none; -webkit-user-select: none; user-select: none; }
body.drawing.pencil .ink { touch-action: pan-x pan-y; }     /* an Apple Pencil writes; fingers scroll */
body.drawing.erasing .ink { cursor: cell; }
.ink path, .ink line, .ink text { pointer-events: visibleStroke; }
.ink text { font-family: var(--hand); pointer-events: visiblePainted; }

/* cover and spotlight */
.cover-note { display: none; position: absolute; left: 50%; top: calc(var(--u) * 300px); transform: translateX(-50%); z-index: 6;
  background: #1f2430; color: #fff; padding: 12px 18px; border-radius: 12px; font: 500 15px var(--ui); box-shadow: 0 8px 24px rgba(0,0,0,.25); }
body.covered .cover-note { display: block; }
body.covered .editor > :not([data-role]) { filter: blur(calc(var(--u) * 9px)); }
body.covered .ink, body.covered .key { visibility: hidden; }
.editor > * { transition: opacity .25s, filter .25s; }
.editor.spotlit > :not(.active):not([data-role]) { opacity: .2; }

/* ---------- HUD: mistake counter, timer */
.hud { position: sticky; top: 0; height: 0; z-index: 20; }
.counter { position: absolute; right: 22px; top: 14px; background: #fff; border-radius: 16px; padding: 12px 14px 10px; min-width: 190px;
  box-shadow: 0 6px 24px rgba(0,0,0,.16); border: 2px solid #ffd6d6; text-align: center; transition: border-color .3s; }
.counter.zero { border-color: #bfe8cf; }
.counter .num { font: 700 46px/1 var(--ui); color: var(--danger); font-variant-numeric: tabular-nums; }
.counter.zero .num { color: var(--accent); }
.counter .cap { font-size: 13px; font-weight: 500; margin-top: 2px; }
.counter .types { margin-top: 8px; display: flex; flex-direction: column; gap: 3px; font-size: 12px; text-align: left; }
.counter .types div { display: flex; justify-content: space-between; gap: 10px; background: #fff5f5; border-radius: 6px; padding: 3px 8px; }
.counter .hints { display: flex; gap: 3px; margin-top: 10px; justify-content: center; }
.counter .hints button { border: 1px solid var(--line); background: #faf9f7; border-radius: 7px; font-size: 11px; padding: 4px 7px; cursor: pointer; }
.counter .hints button.on { background: #1f2430; color: #fff; border-color: #1f2430; }
.counter.bump { animation: bump .45s ease; }
@keyframes bump { 30% { transform: scale(1.12); } }
.timer-pill { position: absolute; left: 50%; top: 14px; transform: translateX(-50%); background: #1f2430; color: #fff; border-radius: 99px; padding: 8px 10px 8px 18px;
  display: flex; align-items: center; gap: 12px; box-shadow: 0 6px 24px rgba(0,0,0,.25); }
.timer-pill .t { font: 600 34px/1 var(--ui); font-variant-numeric: tabular-nums; min-width: 3.1ch; }
.timer-pill .lab { font-size: 12px; opacity: .75; }
.timer-pill button { background: rgba(255,255,255,.14); border: 0; color: #fff; border-radius: 99px; width: 34px; height: 34px; display: grid; place-items: center; cursor: pointer; }
.timer-pill.done { background: var(--accent); animation: bump .6s ease 3; }
.timer-pill .bar { position: absolute; left: 18px; right: 18px; bottom: 4px; height: 3px; border-radius: 3px; background: rgba(255,255,255,.15); overflow: hidden; }
.timer-pill .bar i { display: block; height: 100%; background: #7ee0b0; }

/* ---------- side panel */
.tabs { display: flex; border-bottom: 1px solid var(--line); padding: 0 6px; }
.tabs button { flex: 1; background: none; border: 0; padding: 12px 4px 10px; cursor: pointer; font-weight: 500; color: var(--muted); border-bottom: 2px solid transparent; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--accent); }
.tab-body { flex: 1; overflow: auto; padding: 14px 16px 30px; }
.pcard { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin-bottom: 12px; background: #fff; }
.pcard h4 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pcard p { margin: 4px 0; line-height: 1.45; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.lo-big { font-weight: 600; font-size: 15px; line-height: 1.4; }
.sc-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px dashed var(--line); }
.sc-row:first-of-type { border-top: 0; }
.medal-dot { width: 26px; height: 26px; border-radius: 50%; flex: none; display: grid; place-items: center; font: 700 11px var(--ui); color: #fff; box-shadow: inset 0 -3px 0 rgba(0,0,0,.18); }
.m-bronze { background: #c47a3a; } .m-silver { background: #9aa0a8; } .m-gold { background: #d6a91c; } .m-purple { background: #7b2fc0; }
.sc-row .t { flex: 1; line-height: 1.35; }
.mini { border: 1px solid var(--line); background: #faf9f7; border-radius: 8px; padding: 5px 9px; font-size: 12px; cursor: pointer; white-space: nowrap; }
.mini:hover { background: #fff; border-color: #cfcac1; }
.mini.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: #faf9f7; border-radius: 99px; padding: 5px 11px; cursor: pointer; font-size: 13px; }
.chip:hover { border-color: #cfcac1; background: #fff; }
.chip.used { background: var(--accent-soft); border-color: #b9e0cb; color: var(--accent); }
.chip.used::after { content: " ✓"; }
.pink-card { border-left: 4px solid #e0338a; }
.pink-q { color: #e0338a; font-weight: 600; }
.purple-a { color: #7b2fc0; }
.thumbs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.thumbs img { width: 100%; border-radius: 6px; border: 1px solid var(--line); cursor: pointer; display: block; }
.thumbs img:hover { outline: 3px solid #4c8df6; }
.thumbs .deck { grid-column: 1 / -1; font-size: 12px; color: var(--muted); margin-top: 4px; }

.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { display: none; }
.switch i { width: 38px; height: 22px; border-radius: 99px; background: #d5d2cc; position: relative; transition: background .2s; flex: none; }
.switch i::after { content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(16px); }
.frow { display: flex; align-items: center; gap: 8px; padding: 7px 4px; border-radius: 8px; }
.frow:hover { background: #faf9f7; }
.frow .sw { width: 16px; height: 16px; border-radius: 5px; flex: none; border: 1px solid rgba(0,0,0,.08); }
.frow .nm { flex: 1; }
.frow .ct { font: 600 15px var(--ui); min-width: 26px; text-align: right; font-variant-numeric: tabular-nums; }
.frow button { background: none; border: 1px solid transparent; border-radius: 7px; padding: 4px; cursor: pointer; color: var(--muted); display: grid; place-items: center; }
.frow button:hover { border-color: var(--line); color: var(--ink); }
.frow button.off { opacity: .35; }
.frow.disabled .ct { color: #c9c4bb; }
.hl-list { display: flex; flex-wrap: wrap; gap: 6px; }
.hl { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 5px 9px; font-size: 13px; cursor: pointer; }
.hl i { width: 14px; height: 10px; border-radius: 3px; }
.hl kbd { font: 500 10px var(--ui); color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; }

.ck-level { margin-bottom: 12px; }
.ck-head { display: flex; align-items: center; gap: 8px; font-weight: 600; margin-bottom: 4px; }
.ck-item { display: flex; align-items: flex-start; gap: 9px; padding: 6px 6px; border-radius: 8px; cursor: pointer; line-height: 1.35; }
.ck-item:hover { background: #faf9f7; }
.ck-box { width: 20px; height: 20px; border-radius: 6px; border: 2px solid #c9c4bb; flex: none; display: grid; place-items: center; margin-top: 1px; background: #fff; }
.ck-item.done .ck-box { background: var(--accent); border-color: var(--accent); color: #fff; }
.ck-item.done .ck-box svg.ic { width: 13px; height: 13px; stroke-width: 3; }
.ck-item.auto .ck-src { font-size: 10px; color: var(--accent); background: var(--accent-soft); border-radius: 4px; padding: 0 5px; margin-left: 6px; white-space: nowrap; }
.ck-item .x { margin-left: auto; opacity: 0; border: 0; background: none; cursor: pointer; color: var(--muted); }
.ck-item:hover .x { opacity: 1; }
.ck-add { display: flex; gap: 6px; margin-top: 4px; }
.ck-add input { flex: 1; border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; font: inherit; font-size: 12px; }

.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stat { background: #faf9f7; border-radius: 10px; padding: 10px; }
.stat b { display: block; font-size: 24px; line-height: 1.1; }
.stat span { font-size: 12px; color: var(--muted); }
.opener { display: inline-flex; gap: 5px; align-items: center; background: #faf9f7; border: 1px solid var(--line); border-radius: 99px; padding: 3px 10px; font-size: 13px; }
.opener.rep { background: #fff4e5; border-color: #ffd9a8; }
.opener b { font-size: 11px; }

/* ---------- selection bubble, figure bar, tips */
.bubble, .fig-bar, .tip { position: fixed; z-index: 50; background: #fff; border-radius: 14px; box-shadow: 0 10px 34px rgba(0,0,0,.2), 0 0 0 1px rgba(0,0,0,.05); padding: 8px; }
.bubble { max-width: 560px; }
.b-row { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.b-row + .b-row { margin-top: 6px; padding-top: 6px; border-top: 1px solid #f0eee9; }
.b-lab { font-size: 11px; color: var(--muted); margin-right: 4px; text-transform: uppercase; letter-spacing: .05em; }
.bchip { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 5px 8px; font-size: 12px; cursor: pointer; }
.bchip:hover { border-color: #b8b2a7; }
.bchip i { width: 12px; height: 9px; border-radius: 3px; }
.bpen { width: 24px; height: 24px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.up-tier { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.up-tier .medal-dot { width: 20px; height: 20px; font-size: 9px; }
.fig-bar { display: flex; gap: 4px; padding: 6px; border-radius: 12px; }
.fig-bar button { border: 1px solid transparent; background: none; border-radius: 8px; padding: 6px 8px; cursor: pointer; font-size: 12px; display: flex; align-items: center; gap: 5px; }
.fig-bar button:hover { background: #f3f1ed; }
.fig-bar button.on { background: var(--accent-soft); color: var(--accent); }
.fig-bar .sep { height: 22px; }
.tip { font-size: 13px; padding: 10px 12px; max-width: 300px; }
.tip .msg { font-weight: 500; margin-bottom: 8px; }

/* ---------- modals */
.modal-back { position: fixed; inset: 0; background: rgba(28,26,22,.42); z-index: 60; display: grid; place-items: center; padding: 24px; }
.modal { background: #fff; border-radius: 18px; width: min(940px, 100%); max-height: 88vh; overflow: auto; box-shadow: 0 24px 70px rgba(0,0,0,.3); }
.m-head { position: sticky; top: 0; background: #fff; z-index: 2; display: flex; align-items: center; gap: 10px; padding: 18px 22px 12px; border-bottom: 1px solid var(--line); }
.m-head h2 { margin: 0; font-size: 19px; flex: 1; }
.m-body { padding: 16px 22px 22px; }
.m-close { border: 0; background: #f3f1ed; border-radius: 10px; width: 36px; height: 36px; display: grid; place-items: center; cursor: pointer; }
.week-nav { display: flex; align-items: center; gap: 6px; }
.week-nav button { border: 1px solid var(--line); background: #fff; border-radius: 9px; height: 34px; min-width: 34px; display: grid; place-items: center; cursor: pointer; padding: 0 10px; }
.week-title { font-weight: 600; min-width: 210px; text-align: center; }
.subj-block { margin-bottom: 18px; }
.subj-block h3 { margin: 0 0 8px; font-size: 13px; display: flex; align-items: center; gap: 8px; }
.subj-block h3 .unit { font-weight: 400; color: var(--muted); }
.lgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.lcard { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; text-align: left; background: #fff; cursor: pointer; display: flex; flex-direction: column; gap: 6px; position: relative; }
.lcard:hover { border-color: #b8b2a7; box-shadow: 0 4px 14px rgba(0,0,0,.07); }
.lcard.today { border: 2px solid var(--accent); }
.lcard .top { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.lcard .n { font-weight: 700; color: var(--ink); }
.lcard .lo { font-weight: 600; line-height: 1.35; }
.lcard .done-tag { position: absolute; right: 10px; top: 10px; font-size: 11px; color: var(--accent); background: var(--accent-soft); border-radius: 6px; padding: 2px 6px; }
.lcard .today-tag { font-size: 11px; color: #fff; background: var(--accent); border-radius: 6px; padding: 2px 6px; }
.blank-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding-top: 6px; border-top: 1px solid var(--line); margin-top: 6px; }
.blank-row input, .blank-row select, .field { border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; font: inherit; }
.blank-row input { flex: 1; min-width: 220px; }
.btn { border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 9px 14px; cursor: pointer; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; }
.btn:hover { border-color: #b8b2a7; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.danger { color: var(--danger); }
.book-list { display: flex; flex-direction: column; gap: 8px; }
.book-item { display: flex; align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.book-item .info { flex: 1; min-width: 0; }
.book-item .info b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crop-wrap { position: relative; user-select: none; display: inline-block; max-width: 100%; }
.crop-wrap img { display: block; max-width: 100%; max-height: 62vh; border-radius: 6px; }
.crop-box { position: absolute; border: 3px solid #4c8df6; background: rgba(76,141,246,.1); box-shadow: 0 0 0 9999px rgba(0,0,0,.35); pointer-events: none; }
.crop-help { margin: 8px 0 12px; color: var(--muted); }
.timer-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.timer-grid button { width: 92px; height: 72px; border-radius: 14px; border: 1px solid var(--line); background: #faf9f7; font: 600 22px var(--ui); cursor: pointer; }
.timer-grid button span { display: block; font-size: 11px; font-weight: 500; color: var(--muted); }
.timer-grid button:hover { border-color: var(--accent); }
.set-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.set-row .nm { width: 170px; font-weight: 500; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { border: 0; background: #fff; padding: 7px 12px; cursor: pointer; border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; }
.seg button.on { background: #1f2430; color: #fff; }
.help-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 22px; }
.help-grid h4 { margin: 0 0 4px; }
.help-grid p { margin: 0; color: #444; line-height: 1.5; }
kbd.k { font: 500 12px var(--ui); border: 1px solid #d9d5ce; border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; background: #faf9f7; }
.replay-bar { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 70; background: #1f2430; color: #fff; border-radius: 16px; padding: 10px 14px; display: flex; align-items: center; gap: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.3); }
.replay-bar button { background: rgba(255,255,255,.12); border: 0; color: #fff; border-radius: 10px; padding: 8px 10px; cursor: pointer; display: flex; align-items: center; gap: 6px; }
.replay-bar button.on { background: #fff; color: #1f2430; }
.replay-bar input[type=range] { width: 260px; }
body.replaying .editor { pointer-events: none; }
body.replaying .tools, body.replaying .panel { opacity: .35; pointer-events: none; }

.draw-bar { position: fixed; left: 50%; top: 128px; transform: translateX(-50%); z-index: 40; background: #fff; border-radius: 14px; padding: 6px; display: flex; gap: 4px; box-shadow: 0 10px 30px rgba(0,0,0,.18);
  align-items: center; flex-wrap: wrap; justify-content: center; width: max-content; max-width: calc(100vw - 24px); }
.draw-bar[hidden] { display: none; }
.draw-bar .sep { width: 1px; height: 24px; background: var(--line); margin: 0 3px; }
.draw-bar button.sz { width: 34px; height: 34px; padding: 0; justify-content: center; }
.draw-bar button.sz i { display: block; border-radius: 50%; }
.draw-bar button.cdot { width: 26px; height: 26px; padding: 0; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.18); margin: 0 1px; }
.draw-bar button.cdot.on { box-shadow: 0 0 0 2.5px var(--accent); }
.draw-bar button.cdot:hover { background-clip: padding-box; filter: brightness(1.08); }
.draw-bar button.done { font-weight: 600; }
@media (max-width: 980px) { .draw-bar .lb { display: none; } .draw-bar { gap: 2px; padding: 5px; } .draw-bar .sep { margin: 0 1px; } .draw-bar button { padding: 8px 9px; } .draw-bar button.sz { width: 34px; } .draw-bar button.cdot { margin: 0; } }
@media (pointer: coarse) { .draw-bar button { padding: 10px 11px; } .draw-bar button.sz { width: 40px; height: 42px; } .draw-bar button.cdot { width: 30px; height: 30px; } }
.draw-bar button { border: 1px solid transparent; background: none; border-radius: 9px; padding: 7px 10px; cursor: pointer; display: flex; align-items: center; gap: 6px; font-size: 13px; }
.draw-bar button.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.draw-bar button:hover { background: #f3f1ed; }
.draw-bar .dot { width: 16px; height: 16px; border-radius: 50%; }

.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); background: #1f2430; color: #fff; padding: 11px 18px; border-radius: 12px; z-index: 80; box-shadow: 0 8px 24px rgba(0,0,0,.25); font-weight: 500; }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 90; width: 100%; height: 100%; }

/* ---------- focus mode */
.focus-exit { display: none; position: fixed; right: 16px; top: 12px; z-index: 45; }
.focus-exit button { display: flex; align-items: center; gap: 6px; background: rgba(31,36,48,.85); color: #fff; border: 0; border-radius: 99px; padding: 8px 14px; cursor: pointer; opacity: .35; transition: opacity .2s; }
.focus-exit button:hover { opacity: 1; }
body.focus .bar, body.focus .tools, body.focus .panel { display: none; }
body.focus .focus-exit { display: block; }
body.focus .counter { right: 22px; top: 56px; }

/* ---------- printing */
@media print {
  @page { size: A4 portrait; margin: 8mm; }
  body { display: block; overflow: visible; background: #fff; height: auto; }
  .bar, .tools, .panel, .hud, .bubble, .fig-bar, .tip, .modal-back, .toast, .focus-exit, .draw-bar, .marks, .confetti, .cover-note, .replay-bar { display: none !important; }
  .main, .stage { display: block; overflow: visible; height: auto; }
  .sheet-wrap { padding: 0; }
  .sheet { box-shadow: none; margin: 0; }
  .sheet::before, .sheet::after { display: none; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body.covered .editor > * { filter: none; }
  .fig.sel .fig-in, .tbl.sel table { outline: none; }
}

/* the class question (first visit to the website) and Page settings' My class */
.class-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.class-grid .btn { min-width: 132px; justify-content: center; }
.class-grid.small-grid { margin-top: 0; gap: 6px; }
.class-grid.small-grid .btn { min-width: 0; padding: 5px 10px; font-size: 13px; }
.subj-block h3 .whose { font: 500 12px var(--ui); color: var(--muted); background: #f1efec; border-radius: 999px; padding: 2px 9px; margin-left: 4px; }
.subj-block.not-mine .lcard { opacity: .72; }

/* ---------- pictures and tables on top of the page (objects.js, 17 Nov 2026) */
html { touch-action: manipulation; -webkit-text-size-adjust: 100%; }
.flow { position: relative; z-index: 2; display: flow-root; }
.wrap-l, .wrap-r { display: none; pointer-events: none; height: 0; }
.wrap-l { float: left; }
.wrap-r { float: right; }
.objs { position: absolute; left: 0; top: 0; right: 0; bottom: 0; z-index: 3; pointer-events: none; }
.obj { position: absolute; pointer-events: auto; touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; box-sizing: border-box; }
.obj.sel, .obj.dragging { touch-action: none; }
.obj.sel { outline: 2px solid #4c8df6; outline-offset: 3px; border-radius: 2px; }
.obj.dragging { opacity: .93; }
.obj.pic { cursor: grab; }
.obj.pic.dragging { cursor: grabbing; }
.pic-in { position: absolute; inset: 0; }
.pic-in img { display: block; width: 100%; height: 100%; border-radius: 2px; box-shadow: 0 1px 4px rgba(0,0,0,.18); background: #f4f4f4; -webkit-user-drag: none; pointer-events: none; }
.obj.pic[data-tilt="1"] .pic-in { transform: rotate(-.7deg); }
.obj.pic[data-tape="1"] .pic-in::before, .obj.pic[data-tape="1"] .pic-in::after {
  content: ""; position: absolute; top: calc(var(--u) * -10px); width: calc(var(--u) * 74px); height: calc(var(--u) * 22px);
  background: rgba(238,232,205,.72); box-shadow: 0 1px 2px rgba(0,0,0,.1); z-index: 2;
}
.obj.pic[data-tape="1"] .pic-in::before { left: calc(var(--u) * -18px); transform: rotate(-33deg); }
.obj.pic[data-tape="1"] .pic-in::after { right: calc(var(--u) * -18px); transform: rotate(31deg); }
.obj.tab { padding: calc(var(--u) * 8px); cursor: move; }
.obj.tab table { width: 100%; table-layout: fixed; border-collapse: separate; border-spacing: 0; background: #fff; font-family: var(--ui);
  font-size: calc(var(--fs) * .66 * var(--s, 1)); box-shadow: inset 1px 1px 0 #444, 0 1px 4px rgba(0,0,0,.15); cursor: auto; }
.obj.tab tr { height: calc(var(--L) * var(--s, 1)); }
.obj.tab td { border-right: 1px solid #444; border-bottom: 1px solid #444; padding: 0 .6em; line-height: 1.2; vertical-align: middle; outline: none;
  overflow-wrap: anywhere; cursor: text; user-select: text; -webkit-user-select: text; -webkit-touch-callout: default; }
.obj.tab tr:first-child td { font-weight: 600; background: #f1f4f8; }
.obj.tab td:focus { background: #fffbe6; }
/* handles: four corners; a table also has side handles */
.hd { position: absolute; width: 16px; height: 16px; margin: -8px; background: #fff; border: 2.5px solid #4c8df6; border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0,0,0,.28); z-index: 5; touch-action: none; box-sizing: border-box; }
.hd::after { content: ""; position: absolute; inset: -12px; }
.hd-nw { left: 0; top: 0; cursor: nwse-resize; } .hd-se { left: 100%; top: 100%; cursor: nwse-resize; }
.hd-ne { left: 100%; top: 0; cursor: nesw-resize; } .hd-sw { left: 0; top: 100%; cursor: nesw-resize; }
.hd-e, .hd-w { top: 50%; width: 10px; height: 26px; margin: -13px -5px; border-radius: 6px; cursor: ew-resize; }
.hd-e { left: 100%; } .hd-w { left: 0; }
.mv { position: absolute; left: 0; top: -38px; background: #4c8df6; color: #fff; border-radius: 9px; padding: 5px 10px 5px 8px;
  font: 600 12px var(--ui); display: flex; gap: 5px; align-items: center; cursor: move; touch-action: none; box-shadow: 0 2px 6px rgba(0,0,0,.2); white-space: nowrap; }
.mv svg { width: 14px; height: 14px; }
@media (pointer: coarse) {
  .hd { width: 26px; height: 26px; margin: -13px; }
  .hd-e, .hd-w { width: 14px; height: 36px; margin: -18px -7px; }
  .mv { top: -46px; padding: 8px 14px 8px 11px; font-size: 14px; }
}
.guides { position: absolute; inset: 0; pointer-events: none; z-index: 6; }
.guide { position: absolute; }
.guide.gv { top: 0; bottom: 0; border-left: 1.5px dashed #e0338a; }
.guide.gh { left: 0; right: 0; border-top: 1.5px dashed #e0338a; }
body.covered .objs .obj { filter: blur(calc(var(--u) * 9px)); }
@media print {
  .hd, .mv, .guides { display: none !important; }
  .obj.sel { outline: none; }
}

/* ---------- replay: the page written out by hand */
body.replaying .editor .rc { visibility: hidden; }
body.replaying .editor .rc.on { visibility: visible; }
body.replaying .editor .rc.rp-new { animation: rp-write .17s linear; }
@keyframes rp-write { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
body.replaying .editor mark:not(.rp-on), body.replaying .editor .medal:not(.rp-on) { background: none !important; box-shadow: none !important; }
body.replaying .editor mark.rp-on, body.replaying .editor .medal.rp-on { animation: rp-hl .5s ease-out; }
@keyframes rp-hl { from { filter: saturate(0) brightness(1.15); } to { filter: none; } }
.obj.rp-wait, .ink.rp-wait { opacity: 0; }
.obj.rp-in { animation: rp-stick .6s cubic-bezier(.2,.9,.3,1.2); }
@keyframes rp-stick { from { opacity: 0; transform: translateY(calc(var(--u) * -18px)) scale(1.06) rotate(1.5deg); } to { opacity: 1; transform: none; } }
.rp-nib { position: absolute; left: 0; top: 0; width: calc(var(--u) * 40px); height: calc(var(--u) * 40px); z-index: 7; pointer-events: none;
  opacity: 0; transition: left .07s linear, top .07s linear, opacity .3s; filter: drop-shadow(0 2px 2px rgba(0,0,0,.18)); }
.rp-nib.on { opacity: 1; }
.rp-nib svg { width: 100%; height: 100%; display: block; }
body.replaying .ink { pointer-events: none; }
@media (pointer: coarse) { .replay-bar { bottom: max(22px, env(safe-area-inset-bottom)); } .replay-bar button { padding: 10px 12px; } }

/* ---------- the maths book (17 Nov 2026): squares, the margin two squares in, a heavy rule under the date */
.paper-maths .rules { top: 0; bottom: 0; background-image:
  linear-gradient(to bottom, transparent calc(var(--L) - 1px), rgba(70,110,170,.36) calc(var(--L) - 1px)),
  linear-gradient(to right, transparent calc(var(--L) - 1px), rgba(70,110,170,.36) calc(var(--L) - 1px));
  background-size: 100% var(--L), var(--L) 100%;
  background-position: 0 calc(var(--top) + var(--base) + 2px - var(--L)), calc(var(--ml) + 1px) 0; }
.paper-maths .margin-line { width: 2.5px; background: #2b3550; }
.paper-maths .margin-right { display: none; }
.date-rule { display: none; }
.paper-maths .date-rule { display: block; position: absolute; left: 0; right: 0; top: calc(var(--top) + var(--base) + 0.5px); height: 2.5px; background: #2b3550; pointer-events: none; z-index: 1; }

/* ---------- Present: teach from the slides */
.present-btn { display: inline-flex; align-items: center; gap: 7px; background: var(--accent); color: #fff; border: 0; border-radius: 12px;
  padding: 9px 15px; font: 600 14px var(--ui); cursor: pointer; white-space: nowrap; box-shadow: 0 2px 8px rgba(30,60,140,.18); }
.present-btn:hover { filter: brightness(1.08); }
.present-btn[disabled] { opacity: .4; cursor: default; box-shadow: none; filter: none; }
.present-btn svg { width: 18px; height: 18px; }
.present-btn .pb-pos { font-weight: 500; opacity: .85; }
.present-btn .pb-pos:empty { display: none; }
@media (max-width: 1100px) { .present-btn .pb-pos { display: none; } }
.pres-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 8px; }
.pres { position: fixed; inset: 0; z-index: 200; background: #000; color: #fff; user-select: none; -webkit-user-select: none; touch-action: none; overflow: hidden; }
.pres.idle { cursor: none; }
.pres-stage { position: absolute; inset: 0; }
.pres-img { position: absolute; display: block; -webkit-user-drag: none; }
.pres-links { position: absolute; pointer-events: none; }
.pres-links a { position: absolute; display: block; border-radius: 6px; pointer-events: auto; cursor: pointer; }
.pres-links a:hover { box-shadow: 0 0 0 3px rgba(76,141,246,.75); background: rgba(76,141,246,.12); }
.pres-x { position: absolute; top: max(12px, env(safe-area-inset-top)); right: 14px; width: 44px; height: 44px; border-radius: 50%; border: 0;
  background: rgba(255,255,255,.07); color: #fff; opacity: .3; cursor: pointer; display: grid; place-items: center; z-index: 6; transition: opacity .2s, background .2s; }
.pres-x:hover { opacity: 1; background: rgba(255,255,255,.18); }
.pres-x svg { width: 20px; height: 20px; }
.pres-ui { position: absolute; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; gap: 4px; align-items: center;
  background: rgba(20,22,30,.78); border-radius: 14px; padding: 6px 8px; opacity: 0; transition: opacity .3s; pointer-events: none; z-index: 6; }
.pres.ui-on .pres-ui { opacity: 1; pointer-events: auto; }
.pres-ui button { background: none; border: 0; color: #fff; border-radius: 9px; padding: 8px 10px; cursor: pointer; display: flex; align-items: center; gap: 6px; font: 500 13px var(--ui); white-space: nowrap; }
.pres-ui button:hover { background: rgba(255,255,255,.14); }
.pres-ui button:disabled { opacity: .3; cursor: default; background: none; }
.pres-ui svg { width: 18px; height: 18px; }
.pres-n { font: 600 13px var(--ui); min-width: 64px; text-align: center; }
.pres-sep { width: 1px; height: 22px; background: rgba(255,255,255,.2); margin: 0 4px; }
.pres-black { position: absolute; inset: 0; background: #000; z-index: 7; }
.pres-grid { position: absolute; inset: 0; z-index: 8; background: rgba(12,14,20,.97); overflow: auto; padding: 70px 40px 40px;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; align-content: start; touch-action: pan-y; }
.pres-grid[hidden] { display: none; }
.pres-grid button { background: none; border: 3px solid transparent; border-radius: 10px; padding: 0; cursor: pointer; position: relative; }
.pres-grid button.on { border-color: #4c8df6; }
.pres-grid img { width: 100%; display: block; border-radius: 7px; }
.pres-grid span { position: absolute; left: 8px; bottom: 8px; background: rgba(0,0,0,.65); color: #fff; font: 600 12px var(--ui); padding: 2px 7px; border-radius: 6px; }
@media (pointer: coarse) { .pres-x { width: 52px; height: 52px; opacity: .45; } .pres-ui button { padding: 11px 13px; } }
body.presenting .toast { z-index: 260; }

/* ---------- the pen on the slides (present.js, pen.js) */
.pres-ink { position: absolute; pointer-events: none; overflow: hidden; mix-blend-mode: multiply; }
.pres.pen-on .pres-ink { pointer-events: auto; cursor: crosshair; touch-action: none; }
.pres.pen-on .pres-links { display: none; }
.pres.pen-on .pres-ui { display: none; }
.pres-penbar { position: absolute; left: 50%; bottom: max(14px, env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; gap: 3px; align-items: center;
  flex-wrap: wrap; justify-content: center; width: max-content; max-width: calc(100vw - 24px);
  background: rgba(20,22,30,.84); border-radius: 14px; padding: 5px 8px; z-index: 6; }
.pres-penbar[hidden] { display: none; }
.pres-penbar button { background: none; border: 0; color: #fff; border-radius: 9px; padding: 8px 9px; cursor: pointer; display: flex; align-items: center; gap: 6px; font: 500 13px var(--ui); }
.pres-penbar button:hover { background: rgba(255,255,255,.14); }
.pres-penbar button:disabled { opacity: .3; cursor: default; background: none; }
.pres-penbar button.on { background: rgba(255,255,255,.22); }
.pres-penbar svg { width: 18px; height: 18px; }
.pres-penbar .pres-n { font: 600 13px var(--ui); min-width: 54px; text-align: center; }
.pres-penbar button.pres-c { width: 24px; height: 24px; padding: 0; border-radius: 50%; border: 2px solid rgba(255,255,255,.9); margin: 0 2px; }
.pres-penbar button.pres-c.on { box-shadow: 0 0 0 3px #4c8df6; }
.pres-penbar button[data-a="size"] { width: 36px; height: 36px; padding: 0; justify-content: center; }
.pres-sz { display: block; border-radius: 50%; box-shadow: 0 0 0 1.5px rgba(255,255,255,.7); }
.pres-penbar .pres-done { font-weight: 600; padding-left: 12px; padding-right: 12px; }
@media (pointer: coarse) { .pres-penbar button { padding: 11px 12px; } .pres-penbar button.pres-c { width: 32px; height: 32px; } .pres-penbar button[data-a="size"] { width: 44px; height: 44px; } }

/* ---------- the class iPads (live.js): the header pill, the panel, the class QR */
.live-pill { display: inline-flex; align-items: center; gap: 7px; border: 1px solid #b7e2cd; background: var(--accent-soft); color: var(--accent);
  border-radius: 12px; padding: 8px 12px; font: 600 13px var(--ui); cursor: pointer; white-space: nowrap; }
.lp-dot { width: 9px; height: 9px; border-radius: 50%; background: #19a463; box-shadow: 0 0 0 3px rgba(25,164,99,.22); animation: lpPulse 2s ease-in-out infinite; flex: none; }
@keyframes lpPulse { 50% { box-shadow: 0 0 0 6px rgba(25,164,99,.08); } }
.live-panel { position: fixed; right: 16px; top: 64px; z-index: 300; width: 400px; max-width: calc(100vw - 24px); background: #fff; color: var(--ink);
  border-radius: 16px; padding: 16px 16px 12px; box-shadow: 0 18px 50px rgba(0,0,0,.28); font: 14px var(--ui); }
.live-panel.in-pres { top: auto; right: auto; left: 50%; bottom: 84px; transform: translateX(-50%); }
.live-panel h3 { margin: 0 34px 6px 0; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.live-panel h3 svg { width: 18px; height: 18px; }
.live-panel p { margin: 6px 0; line-height: 1.45; color: #4a5160; }
.live-panel .btn svg { width: 16px; height: 16px; }
.live-panel .btn.on { background: #1f2430; color: #fff; border-color: #1f2430; }
.lp-x { position: absolute; right: 10px; top: 10px; width: 32px; height: 32px; border: 0; background: none; border-radius: 8px; cursor: pointer; color: #6b7280; display: grid; place-items: center; }
.lp-x:hover { background: #f1efeb; }
.lp-x svg { width: 16px; height: 16px; }
.lp-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 4px; }
.lp-count { font-size: 15px; } .lp-count b { font-size: 20px; color: var(--ink); }
.lp-seg { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin: 10px 0 4px; }
.lp-seg button { border: 0; background: #faf9f7; padding: 11px 8px; font: 600 14px var(--ui); cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 7px; color: #4a5160; }
.lp-seg button + button { border-left: 1px solid var(--line); }
.lp-seg button.on { background: var(--accent); color: #fff; }
.lp-seg svg { width: 16px; height: 16px; }
.lp-note { font-size: 12.5px; color: var(--muted) !important; }
.lp-warn { background: #fff4e5; color: #8a4b00 !important; border-radius: 10px; padding: 8px 10px; font-size: 13px; }
.pres-ui button.live-on { background: rgba(25,164,99,.28); }
.live-qr { position: fixed; inset: 0; z-index: 320; background: rgba(15,17,22,.88); display: grid; place-items: center; padding: 24px; }
.lq-card { background: #fff; color: var(--ink); border-radius: 22px; padding: 28px; display: flex; gap: 32px; align-items: center; max-width: 1000px; font-family: var(--ui); }
.lq-code { width: min(46vh, 420px); flex: none; }
.lq-code svg { width: 100%; height: auto; display: block; }
.lq-text h2 { font-size: 40px; margin: 0 0 10px; }
.lq-text p { font-size: 20px; margin: 8px 0; color: #4a5160; line-height: 1.4; }
.lq-text .lq-url { font: 600 18px var(--ui); color: var(--ink); word-break: break-all; }
.lq-text .lq-tip { font-size: 15px; color: var(--muted); }
.lq-text .btn { margin-top: 12px; font-size: 16px; padding: 11px 22px; }
@media (max-width: 760px) { .lq-card { flex-direction: column; text-align: center; } }
.lp-auto { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #4a5160; margin: 8px 0 2px; cursor: pointer; }
.lp-auto input { width: 16px; height: 16px; accent-color: var(--accent); }

/* the one-tap Lock / Free switch beside the iPads pill and the present bar's iPads button (19 Nov 2026) */
.live-lock { display: inline-flex; align-items: center; gap: 2px; padding: 3px; border-radius: 12px; background: #eceae5; }
.live-lock button { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; border-radius: 9px; padding: 6px 12px; font: 600 13px var(--ui); color: #5b6472; cursor: pointer; white-space: nowrap; }
.live-lock button svg { width: 15px; height: 15px; }
.live-lock button:hover:not(.on) { background: rgba(0,0,0,.06); }
.live-lock button.on[data-a="lklock"] { background: #1f2430; color: #fff; }
.live-lock button.on[data-a="lkfree"] { background: #19a463; color: #fff; }
.pres-lock { display: inline-flex; align-items: center; gap: 2px; padding: 3px; border-radius: 11px; background: rgba(255,255,255,.1); }
.pres-ui .pres-lock button, .pres-penbar .pres-lock button { padding: 6px 11px; font-weight: 600; }
.pres-ui .pres-lock button.on[data-a="lklock"], .pres-penbar .pres-lock button.on[data-a="lklock"] { background: #fff; color: #15171d; }
.pres-ui .pres-lock button.on[data-a="lkfree"], .pres-penbar .pres-lock button.on[data-a="lkfree"] { background: #19a463; color: #fff; }
@media (pointer: coarse) { .live-lock button { padding: 9px 14px; } .pres-ui .pres-lock button, .pres-penbar .pres-lock button { padding: 9px 13px; } }

/* Book on iPads (mirror.js, 20 Nov 2026): one button in the header */
.book-live { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: #faf9f7; color: var(--ink);
  border-radius: 12px; padding: 8px 12px; font: 600 13px var(--ui); cursor: pointer; white-space: nowrap; }
.book-live:hover { border-color: #cfcac1; background: #fff; }
.book-live svg.ic { width: 17px; height: 17px; }
.book-live.on { background: #19a463; border-color: #19a463; color: #fff; }
.book-live.on .lp-dot { background: #fff; box-shadow: 0 0 0 3px rgba(255,255,255,.3); }
.book-live .bl-n { background: rgba(255,255,255,.25); border-radius: 8px; padding: 1px 7px; font-size: 12px; }
.book-live:disabled { opacity: .6; cursor: default; }
@media (pointer: coarse) { .book-live { padding: 10px 14px; } }

/* the lesson library (22 Nov 2026): subjects along the top, a strip of every week, W12 L1 on each card */
.subj-bar { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.subj-bar button { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 12px; font: 500 13px var(--ui); cursor: pointer; color: var(--ink); }
.subj-bar button i { width: 9px; height: 9px; border-radius: 50%; background: var(--sc); }
.subj-bar button:hover { border-color: #b8b2a7; }
.subj-bar button.on { background: #1f2430; border-color: #1f2430; color: #fff; }
.subj-bar button.on i { box-shadow: 0 0 0 2px #fff; }
.wk-strip { display: flex; gap: 6px; overflow-x: auto; padding: 2px 2px 10px; margin: 0 0 14px; border-bottom: 1px solid var(--line); scrollbar-width: thin; }
.wk-strip button { flex: none; display: flex; flex-direction: column; align-items: center; gap: 1px; min-width: 58px; border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 6px 8px; cursor: pointer; font: 400 11px var(--ui); color: var(--muted); position: relative; }
.wk-strip button b { font: 700 14px var(--ui); color: var(--ink); }
.wk-strip button.now::after { content: ""; position: absolute; top: 5px; right: 5px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.wk-strip button.on { background: #1f2430; border-color: #1f2430; color: #c9ccd4; }
.wk-strip button.on b { color: #fff; }
.lcard { border-left: 4px solid var(--sc, var(--line)); }
.lcard .wl-tag { font: 700 15px var(--ui); color: var(--sc, var(--ink)); letter-spacing: .01em; }
.lcard .has-slides { margin-left: auto; color: var(--muted); display: inline-flex; }
.lcard .has-slides svg.ic { width: 15px; height: 15px; }
.lcard .top .done-tag { position: static; }
.subj-block h3 .wk-head { font: 700 15px var(--ui); color: var(--ink); }
.unit-line { margin: 6px 0 6px; font-size: 12px; color: var(--muted); }
.lgrid.not-mine .lcard { opacity: .72; }

/* the exit ticket (exit.js, 22 Nov 2026): launch, then live results; at the side when presenting */
.exit-panel { position: fixed; right: 16px; top: 64px; z-index: 310; width: 420px; max-width: calc(100vw - 24px); max-height: calc(100vh - 90px); overflow-y: auto;
  background: #fff; color: var(--ink); border-radius: 18px; padding: 16px 18px 14px; box-shadow: 0 18px 50px rgba(0,0,0,.3); font: 14px var(--ui); }
.exit-panel.in-pres { top: 18px; right: 18px; max-height: calc(100vh - 120px); }
.exit-panel.min { width: auto; padding: 8px 10px 8px 14px; border-radius: 999px; }
.exit-panel.min .ex-head h3 { font-size: 15px; }
.ex-head { display: flex; align-items: center; gap: 9px; margin-bottom: 6px; }
.ex-head h3 { margin: 0; font-size: 17px; flex: 1; line-height: 1.25; }
.ex-head > svg.ic { color: var(--accent); width: 20px; height: 20px; }
.ex-ic { width: 32px; height: 32px; border: 0; background: none; border-radius: 8px; cursor: pointer; color: #6b7280; display: grid; place-items: center; flex: none; }
.ex-ic:hover { background: #f1efeb; }
.ex-ic svg.ic { width: 16px; height: 16px; }
.exit-panel p { margin: 6px 0; line-height: 1.45; color: #4a5160; }
.ex-row { display: flex; gap: 8px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.ex-row input, .ex-row select { flex: 1; min-width: 0; height: 40px; border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; font: 15px var(--ui); background: #fff; }
.ex-row input { letter-spacing: .3em; font-weight: 600; }
.ex-row .btn svg.ic { width: 16px; height: 16px; }
.ex-card { display: flex; align-items: center; gap: 12px; border: 2px solid var(--accent); border-radius: 14px; padding: 10px 12px; margin: 10px 0 4px; }
.ex-card > div { flex: 1; min-width: 0; }
.ex-card b { display: block; font-size: 15px; }
.ex-card span { font-size: 12px; color: var(--muted); }
.ex-small { font-size: 12px !important; color: var(--muted) !important; }
.ex-link { border: 0; background: none; padding: 0; color: var(--muted); text-decoration: underline; cursor: pointer; font: inherit; }
.ex-warn { color: #b42318 !important; font-weight: 500; }
.ex-big { display: flex; align-items: baseline; gap: 8px; margin: 6px 0 8px; }
.ex-big b { font: 700 44px/1 var(--ui); color: var(--ink); }
.ex-big span { color: var(--muted); font-size: 15px; }
.ex-big .ex-time { margin-left: auto; font-variant-numeric: tabular-nums; }
.ex-bar { display: flex; height: 12px; border-radius: 6px; background: #eceae5; overflow: hidden; }
.ex-bar i { display: block; height: 100%; transition: width .4s; }
.ex-bar .ok { background: #19a463; } .ex-bar .no { background: #e8a33d; }
.ex-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0; }
.ex-tiles div { background: #f6f5f2; border-radius: 12px; padding: 8px 10px; font-size: 12px; color: var(--muted); }
.ex-tiles b { display: block; font: 700 24px/1.1 var(--ui); color: var(--ink); }
.ex-tiles .ok b { color: #128a52; } .ex-tiles .no b { color: #b86e0a; }
.ex-why { background: #fff8ec; border-radius: 12px; padding: 8px 12px; }
.ex-why h4 { margin: 0 0 2px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: #8a5a10; }
.ex-why p { margin: 3px 0 !important; color: var(--ink) !important; }
.ex-why b { display: inline-block; min-width: 20px; }
.ex-names { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.ex-p { display: inline-flex; flex-direction: column; border-radius: 10px; padding: 5px 9px; font-size: 13px; background: #f1f0ec; color: #8a8f99; }
.ex-p.ok { background: #e2f3ea; color: #0f6b40; }
.ex-p.no { background: #fdf0dc; color: #8a4b05; }
.ex-p i { font-style: normal; font-size: 11px; opacity: .85; }
.pres-ui button[data-a="exit"].live-on { background: rgba(25,164,99,.28); }
.exit-panel a.btn { text-decoration: none; color: inherit; }

/* reveals (22 Nov 2026): a slide's answer hidden under a cover in the slide's own colour until the teacher shows it */
.pres-rev { position: absolute; pointer-events: none; }
.pres-rev .rv { position: absolute; pointer-events: auto; cursor: pointer; border-radius: 4px; box-shadow: inset 0 0 0 1.5px rgba(31,36,48,.10);
  transition: opacity .45s ease, transform .45s ease; }
.pres-rev .rv::after { content: "?"; position: absolute; right: 4px; top: 50%; transform: translateY(-50%); font: 700 13px var(--ui); color: rgba(31,36,48,.22); }
.pres-rev .rv.gone { opacity: 0; transform: translateY(-3px); pointer-events: none; }
.pres.pen-on .pres-rev .rv { pointer-events: none; }
.pres-ui button.rv-next, .pres-penbar button.rv-next { background: rgba(255,214,0,.28); box-shadow: inset 0 0 0 1.5px rgba(255,214,0,.7); }

/* printouts (22 Nov 2026): a lesson that needs one shows Print beside Present, in the Lesson panel and on Present's bar */
.print-btn { display: inline-flex; align-items: center; gap: 7px; border: 1px solid #e6cf9f; background: #fbf4e6; color: #6f4e0e;
  border-radius: 12px; padding: 8px 12px; font: 600 13px var(--ui); cursor: pointer; white-space: nowrap; text-decoration: none; }
.print-btn:hover { border-color: #d4b26c; background: #fff; }
.print-btn svg.ic { width: 17px; height: 17px; }
.print-btn .pr-n { background: #6f4e0e; color: #fff; border-radius: 8px; padding: 0 7px; font-size: 12px; }
@media (max-width: 1280px) { .print-btn .pr-l { display: none; } }   /* an iPad in landscape: the LO keeps its room */
@media (pointer: coarse) { .print-btn { padding: 10px 14px; } }
.print-card { border-color: #ecd9b1; background: #fffaf0; }
a.btn.print-open { text-decoration: none; color: var(--ink); }
a.btn.print-open svg.ic { color: #6f4e0e; }
@media (pointer: coarse) { a.btn.print-open { padding: 11px 16px; } }
.lcard .has-print { margin-left: auto; color: #8a6418; display: inline-flex; }
.lcard .has-slides + .has-print { margin-left: 0; }
.lcard .has-print svg.ic { width: 15px; height: 15px; }
.pres-ui a.pres-print { color: #fff; text-decoration: none; border-radius: 9px; padding: 8px 10px; display: flex; align-items: center; gap: 6px; font: 500 13px var(--ui); white-space: nowrap; }
.pres-ui a.pres-print:hover { background: rgba(255,255,255,.14); }
@media (max-width: 1100px) { .pres-ui .pp-l { display: none; } }
@media (pointer: coarse) { .pres-ui a.pres-print { padding: 11px 13px; } }
