/* Layout: an exercise-book page (vở ô li) — sidebar of tabs on wide iPad, bottom tab bar on portrait. Purple school ink for actions, red teacher's pen for marks. */
:root {
  --paper: #F6F6FB; --sheet: #FFFFFF; --grid: rgba(74, 58, 168, .055); --margin: rgba(210, 56, 47, .22);
  --ink: #1C1A33; --ink-2: #57557A; --ink-3: #8C8AA8; --line: #E2E0EF;
  --tim: #4A3AA8; --tim-2: #3A2C8E; --tim-soft: #ECE9FB; --on-tim: #FFFFFF;
  --red: #CF3A2E; --red-soft: #FCE9E6; --green: #1D8556; --green-soft: #E3F4EB; --amber: #B26A00; --amber-soft: #FDF1DC;
  --hl: #FFE36E; --on-hl: #1C1A33;
  --f-body: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-hand: "Patrick Hand", "Comic Sans MS", "Chalkboard SE", cursive;
  --r: 14px; --r-sm: 10px;
  --shadow: 0 1px 2px rgba(28, 26, 51, .06), 0 6px 20px rgba(28, 26, 51, .06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #13121D; --sheet: #1C1B2A; --grid: rgba(169, 155, 255, .05); --margin: rgba(255, 107, 94, .18);
    --ink: #ECEAF7; --ink-2: #B0AEC9; --ink-3: #7F7D9C; --line: #2E2C43;
    --tim: #A99BFF; --tim-2: #C2B8FF; --tim-soft: #2A2546; --on-tim: #15132A;
    --red: #FF7A6E; --red-soft: #3A1E1C; --green: #4FCB8F; --green-soft: #17322A; --amber: #F2B04B; --amber-soft: #352914;
    --hl: #E8C547; --on-hl: #1C1A33;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #13121D; --sheet: #1C1B2A; --grid: rgba(169, 155, 255, .05); --margin: rgba(255, 107, 94, .18);
  --ink: #ECEAF7; --ink-2: #B0AEC9; --ink-3: #7F7D9C; --line: #2E2C43;
  --tim: #A99BFF; --tim-2: #C2B8FF; --tim-soft: #2A2546; --on-tim: #15132A;
  --red: #FF7A6E; --red-soft: #3A1E1C; --green: #4FCB8F; --green-soft: #17322A; --amber: #F2B04B; --amber-soft: #352914;
  --hl: #E8C547; --on-hl: #1C1A33;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0; font-family: var(--f-body); font-size: 17px; line-height: 1.55; color: var(--ink);
  background-color: var(--paper);
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 24px 24px;
  -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent;
}
button, input, textarea, select { font: inherit; color: inherit; }
h1, h2, h3 { line-height: 1.2; text-wrap: balance; margin: 0; }
h1 { font-size: 1.9rem; font-weight: 800; letter-spacing: -.01em; }
h2 { font-size: 1.3rem; font-weight: 700; }
h3 { font-size: 1.05rem; font-weight: 700; }
p { margin: 0; }
a { color: var(--tim); }
:focus-visible { outline: 3px solid var(--tim); outline-offset: 2px; border-radius: 6px; }
.num { font-variant-numeric: tabular-nums; }
.hand { font-family: var(--f-hand); }
.muted { color: var(--ink-2); }
.small { font-size: .88rem; }
.eyebrow { font-size: .74rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--ink-3); }

/* ---------- shell ---------- */
.app { display: grid; grid-template-columns: 1fr; min-height: 100%; }
.side {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; justify-content: space-around;
  background: var(--sheet); border-top: 1px solid var(--line);
  padding: 6px max(8px, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
}
.side .brand, .side .sync { display: none; }
.nav-btn {
  display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 64px; padding: 6px 8px; border: 0; background: none;
  border-radius: 12px; color: var(--ink-2); font-size: .74rem; font-weight: 600; cursor: pointer;
}
.nav-btn svg { width: 26px; height: 26px; }
.nav-btn[aria-current="page"] { color: var(--tim); background: var(--tim-soft); }
main {
  min-width: 0; padding-block: calc(20px + env(safe-area-inset-top)) calc(110px + env(safe-area-inset-bottom));
  padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right));
}
.page { max-width: 1040px; margin: 0 auto; display: grid; gap: 20px; }
@media (min-width: 960px) {
  .app { grid-template-columns: 236px 1fr; }
  .side {
    position: sticky; top: 0; height: 100vh; flex-direction: column; justify-content: flex-start; gap: 4px; border-top: 0;
    border-right: 1px solid var(--line); padding: calc(24px + env(safe-area-inset-top)) 14px 20px max(14px, env(safe-area-inset-left));
  }
  .side .brand { display: block; padding: 0 10px 18px; }
  .side .sync { display: block; margin-top: auto; padding: 10px; }
  .nav-btn { flex-direction: row; gap: 12px; font-size: 1rem; padding: 12px 14px; min-height: 52px; }
  .nav-btn svg { width: 24px; height: 24px; }
  main { padding-bottom: 40px; padding-left: 32px; padding-right: max(32px, env(safe-area-inset-right)); }
}
.brand-name { font-weight: 800; font-size: 1.25rem; color: var(--tim); letter-spacing: -.01em; }
.brand-sub { font-size: .8rem; color: var(--ink-3); }

/* ---------- building blocks ---------- */
.card { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; box-shadow: var(--shadow); min-width: 0; }
.card.flat { box-shadow: none; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.stack { display: grid; gap: 10px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 10px 18px;
  border-radius: 12px; border: 1px solid transparent; background: var(--tim); color: var(--on-tim); font-weight: 700; cursor: pointer;
  text-decoration: none; touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
.btn:active { transform: translateY(1px); }
.btn.ghost { background: var(--sheet); color: var(--tim); border-color: var(--line); }
.btn.soft { background: var(--tim-soft); color: var(--tim); }
.btn.red { background: var(--red); color: #fff; }
.btn.sm { min-height: 40px; padding: 6px 14px; font-size: .92rem; border-radius: 10px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn svg { width: 20px; height: 20px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .8rem; font-weight: 600; background: var(--tim-soft); color: var(--tim); white-space: nowrap; }
.chip.good { background: var(--green-soft); color: var(--green); }
.chip.mid { background: var(--amber-soft); color: var(--amber); }
.chip.bad { background: var(--red-soft); color: var(--red); }
.chip.grey { background: var(--paper); color: var(--ink-2); border: 1px solid var(--line); }
.empty { padding: 18px; border: 1.5px dashed var(--line); border-radius: var(--r-sm); color: var(--ink-2); text-align: center; }
.notice { padding: 12px 14px; border-radius: var(--r-sm); background: var(--amber-soft); color: var(--ink); font-size: .92rem; }
.notice.info { background: var(--tim-soft); }
input[type=text], input[type=number], input[type=date], input[type=password], input:not([type]), textarea, select {
  width: 100%; min-height: 48px; padding: 10px 14px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--sheet);
  font-size: 1.05rem; outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--tim); }
textarea { resize: vertical; line-height: 1.7; }
textarea.lined {
  background-image: linear-gradient(transparent calc(1.7em - 1px), var(--grid) calc(1.7em - 1px), var(--grid) 1.7em, transparent 1.7em);
  background-size: 100% 1.7em; background-attachment: local; background-position: 0 10px;
}
label.field { display: grid; gap: 6px; font-weight: 600; font-size: .95rem; }

/* ---------- today ---------- */
.hero { display: grid; gap: 18px; grid-template-columns: 1fr; align-items: stretch; }
@media (min-width: 720px) { .hero { grid-template-columns: 1.4fr 1fr; } }
.count { display: flex; align-items: baseline; gap: 10px; }
.count b { font-size: 3.4rem; font-weight: 800; color: var(--tim); line-height: 1; letter-spacing: -.03em; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { padding: 12px; border-radius: var(--r-sm); background: var(--paper); border: 1px solid var(--line); }
.stat b { display: block; font-size: 1.5rem; font-weight: 800; line-height: 1.1; }
.stat span { font-size: .78rem; color: var(--ink-2); }
.task { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
.task:first-child { border-top: 0; }
.check {
  width: 34px; height: 34px; border-radius: 10px; border: 2px solid var(--line); background: var(--sheet); display: grid; place-items: center;
  cursor: pointer; padding: 0;
}
.check svg { width: 20px; height: 20px; opacity: 0; }
.task.done .check { background: var(--green); border-color: var(--green); color: #fff; }
.task.done .check svg { opacity: 1; }
.task.done .task-label { text-decoration: line-through; color: var(--ink-3); }
.task-label { font-weight: 600; }
.coach-sum { font-size: 1.02rem; }
.focus-item { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 12px; border-radius: var(--r-sm); background: var(--paper); border: 1px solid var(--line); }

/* ---------- plan ---------- */
.timeline { display: grid; gap: 0; }
.stage { display: grid; grid-template-columns: 28px 1fr; gap: 14px; }
.stage .dot { width: 16px; height: 16px; border-radius: 50%; border: 3px solid var(--line); background: var(--sheet); margin: 6px auto 0; position: relative; z-index: 1; }
.stage .rail { display: grid; grid-template-rows: auto 1fr; justify-items: center; }
.stage .rail::after { content: ""; width: 2px; background: var(--line); }
.stage:last-child .rail::after { display: none; }
.stage.now .dot { border-color: var(--tim); background: var(--tim); box-shadow: 0 0 0 5px var(--tim-soft); }
.stage.past .dot { border-color: var(--green); background: var(--green); }
.stage-body { padding-bottom: 22px; display: grid; gap: 6px; min-width: 0; }
.stage-body ul { margin: 4px 0 0; padding-left: 20px; color: var(--ink-2); }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .95rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .76rem; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); font-weight: 700; }

/* ---------- topics ---------- */
.topic { display: grid; gap: 10px; padding: 16px; border-radius: var(--r); background: var(--sheet); border: 1px solid var(--line); text-align: left; cursor: pointer; min-height: 112px; align-content: space-between; }
.topic:active { background: var(--tim-soft); }
.topic .bar { height: 6px; border-radius: 3px; background: var(--paper); overflow: hidden; }
.topic .bar i { display: block; height: 100%; border-radius: 3px; background: var(--tim); }
.feature { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: center; }
.feature .ico { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: var(--tim-soft); color: var(--tim); }
.feature .ico svg { width: 26px; height: 26px; }

/* ---------- runner (exam / drill) ---------- */
.runner { position: fixed; inset: 0; z-index: 40; background: var(--paper); display: grid; grid-template-rows: auto auto 1fr; }
.runbar {
  display: flex; align-items: center; gap: 10px; background: var(--sheet); border-bottom: 1px solid var(--line);
  padding: calc(10px + env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
}
.runbar .title { flex: 1; min-width: 0; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.timer { font-variant-numeric: tabular-nums; font-weight: 800; font-size: 1.15rem; padding: 6px 12px; border-radius: 10px; background: var(--tim-soft); color: var(--tim); }
.timer.low { background: var(--red-soft); color: var(--red); }
.tabs { display: flex; gap: 6px; overflow-x: auto; background: var(--sheet); border-bottom: 1px solid var(--line); padding: 8px max(16px, env(safe-area-inset-right)) 8px max(16px, env(safe-area-inset-left)); }
.tab { flex: none; border: 0; background: none; padding: 10px 16px; border-radius: 10px; font-weight: 700; color: var(--ink-2); cursor: pointer; min-height: 44px; }
.tab[aria-selected="true"] { background: var(--tim); color: var(--on-tim); }
.tab .chip { margin-left: 6px; }
.runbody { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 20px max(16px, env(safe-area-inset-right)) calc(40px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
.runbody > .inner { max-width: 860px; margin: 0 auto; display: grid; gap: 18px; }
.q { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; display: grid; gap: 12px; scroll-margin-top: 12px; min-width: 0; }
.q-num { display: inline-grid; place-items: center; min-width: 34px; height: 34px; border-radius: 10px; background: var(--tim-soft); color: var(--tim); font-weight: 800; margin-right: 10px; padding: 0 6px; }
.q-text { font-size: 1.08rem; font-weight: 500; white-space: pre-line; }
.opts { display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 700px) { .opts.two { grid-template-columns: 1fr 1fr; } }
.opt {
  display: grid; grid-template-columns: 36px 1fr; gap: 12px; align-items: center; text-align: left; min-height: 56px; padding: 10px 14px;
  border-radius: 12px; border: 1.5px solid var(--line); background: var(--sheet); cursor: pointer; touch-action: manipulation;
}
.opt .letter { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; background: var(--paper); border: 1.5px solid var(--line); }
.opt[aria-pressed="true"] { border-color: var(--tim); background: var(--tim-soft); }
.opt[aria-pressed="true"] .letter { background: var(--tim); border-color: var(--tim); color: var(--on-tim); }
.opt.right { border-color: var(--green); background: var(--green-soft); }
.opt.right .letter { background: var(--green); border-color: var(--green); color: #fff; }
.opt.wrong { border-color: var(--red); background: var(--red-soft); }
.opt.wrong .letter { background: var(--red); border-color: var(--red); color: #fff; }
.opt[disabled] { cursor: default; }
.navgrid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 6px; }
.navgrid button { min-height: 40px; border-radius: 8px; border: 1.5px solid var(--line); background: var(--sheet); font-weight: 700; cursor: pointer; font-size: .9rem; }
.navgrid button.on { background: var(--tim); border-color: var(--tim); color: var(--on-tim); }
.passage { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r); padding: 20px 22px 20px 34px; white-space: pre-line; line-height: 1.75; position: relative; font-size: 1.04rem; }
.passage::before { content: ""; position: absolute; left: 18px; top: 0; bottom: 0; width: 2px; background: var(--margin); }
.passage.poem { font-style: italic; }
.gap-row { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: center; }
.tf { display: flex; gap: 8px; }
.tf .opt { grid-template-columns: 1fr; text-align: center; min-width: 96px; }
.wc { font-size: .85rem; font-weight: 700; color: var(--ink-3); }
.wc.over { color: var(--red); }
.mark { font-family: var(--f-hand); color: var(--red); font-size: 1.35rem; line-height: 1; }
.fb { border-radius: 12px; padding: 12px 14px; display: grid; gap: 6px; font-size: .97rem; }
.fb.ok { background: var(--green-soft); }
.fb.no { background: var(--red-soft); }
.fb.ai { background: var(--tim-soft); }
.fb.wait { background: var(--paper); border: 1px dashed var(--line); }
.vi { padding: 10px 14px; border-left: 3px solid var(--tim); background: var(--paper); border-radius: 0 10px 10px 0; font-size: 1rem; }
.photo-thumb { max-height: 160px; border-radius: 10px; border: 1px solid var(--line); }
.foot-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.drill-card { max-width: 720px; margin: 0 auto; width: 100%; }
.progress-line { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.progress-line i { display: block; height: 100%; background: var(--tim); transition: width .3s; }

/* ---------- results ---------- */
.score-hero { display: grid; gap: 16px; grid-template-columns: 1fr; align-items: center; }
@media (min-width: 700px) { .score-hero { grid-template-columns: auto 1fr; } }
.big-mark { font-family: var(--f-hand); color: var(--red); font-size: 5.2rem; line-height: .9; transform: rotate(-4deg); display: inline-block; padding: 8px 18px 4px; border: 3px solid var(--red); border-radius: 50% 46% 52% 44%; }
.big-mark small { font-size: 2rem; }
.parts { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.part { padding: 12px; border-radius: var(--r-sm); background: var(--paper); border: 1px solid var(--line); }
.part b { font-size: 1.4rem; }

/* ---------- scratchpad ---------- */
.scratch { position: fixed; inset: 0; z-index: 60; background: var(--sheet); display: grid; grid-template-rows: auto 1fr; }
.scratch canvas { width: 100%; height: 100%; touch-action: none; display: block;
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px); background-size: 24px 24px; }
.tool[aria-pressed="true"] { background: var(--tim); color: var(--on-tim); }

/* ---------- vocab ---------- */
.flash { min-height: 240px; display: grid; place-items: center; text-align: center; cursor: pointer; padding: 28px; border-radius: 20px; background: var(--sheet); border: 1px solid var(--line); box-shadow: var(--shadow); }
.flash .word { font-size: 2.2rem; font-weight: 800; color: var(--tim); }
.flash .mean { font-size: 1.4rem; margin-top: 10px; }

/* ---------- chart ---------- */
.chart svg { width: 100%; height: auto; display: block; }
.chart text { fill: var(--ink-3); font-size: 14px; font-family: var(--f-body); }
.tagbar { display: grid; grid-template-columns: minmax(120px, 1.2fr) 2fr auto; gap: 12px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.tagbar:first-child { border-top: 0; }
.tagbar .track { height: 10px; border-radius: 5px; background: var(--paper); border: 1px solid var(--line); overflow: hidden; }
.tagbar .track i { display: block; height: 100%; }

/* ---------- overlays ---------- */
.modal-back { position: fixed; inset: 0; z-index: 80; background: rgba(20, 18, 40, .45); display: grid; place-items: center; padding: 16px; }
.modal { background: var(--sheet); border-radius: 18px; padding: 24px; max-width: 460px; width: 100%; display: grid; gap: 14px; box-shadow: var(--shadow); }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(96px + env(safe-area-inset-bottom)); z-index: 90; background: var(--ink); color: var(--paper); padding: 12px 18px; border-radius: 12px; font-weight: 600; max-width: calc(100% - 32px); }
.spin { width: 18px; height: 18px; border: 2.5px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: sp .8s linear infinite; display: inline-block; vertical-align: -3px; }
@keyframes sp { to { transform: rotate(360deg); } }
@media (max-width: 600px) { .hide-sm { display: none; } .runbar { gap: 6px; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- exam paper: looks like the printed Sở GD&ĐT paper (always white paper, black ink) ---------- */
.runbody.desk { background: color-mix(in srgb, var(--paper) 70%, #8a8aa0 30%); padding-left: max(10px, env(safe-area-inset-left)); padding-right: max(10px, env(safe-area-inset-right)); }
.paper { max-width: 860px; margin: 0 auto; display: grid; gap: 18px; padding-bottom: 60px; }
.psheet {
  --pink: #111; background: #fff; color: #111; color-scheme: light; font-family: "Tinos", "Times New Roman", Times, serif; font-size: 17px; line-height: 1.5;
  padding: clamp(18px, 4vw, 44px) clamp(16px, 4.5vw, 52px) 26px; box-shadow: 0 2px 10px rgba(0,0,0,.18); border-radius: 2px; position: relative; min-width: 0;
}
.psheet b { font-weight: 700; }
.ph { width: 100%; border-collapse: collapse; font-size: 14px; margin-bottom: 14px; }
.ph td { border: 1px solid #111; padding: 6px 8px; vertical-align: top; color: #111; }
.ph-l { text-align: center; width: 36%; }
.ph-r { text-align: center; }
.ph-badge { display: block; width: fit-content; border: 1.5px solid #111; padding: 1px 10px; margin: 6px auto 2px; font-weight: 700; }
.ph-sub { border-top: 1px solid #111; margin: 6px -8px 0; padding: 6px 8px 0; }
.ph-name { line-height: 2; }
.ph-score { width: 26%; text-align: center; font-weight: 700; }
.hw { font-family: var(--f-hand); font-size: 1.3em; color: #1f3fa8; font-weight: 400; }
.hw.red { color: #c8281e; font-size: 2em; }
.pcode { width: fit-content; margin: 8px auto 14px; border: 1.5px solid #111; padding: 4px 26px; font-weight: 700; }
.pinstr { font-weight: 700; margin-bottom: 14px; }
.grid-title { text-align: center; font-weight: 700; margin: 10px 0 6px; scroll-margin-top: 10px; }
.agrid { border-collapse: collapse; margin: 0 auto; }
.agrid th, .agrid td { border: 1px solid #111; padding: 2px 3px; text-align: center; vertical-align: middle; color: #111; font-size: 15px; }
.agrid th { text-transform: none; letter-spacing: 0; font-size: 15px; }
.agrid td.n { font-weight: 700; min-width: 34px; }
.agrid .gap { border: 0; width: 22px; }
.bub {
  width: 44px; height: 44px; border-radius: 50%; border: 1.5px solid #111; background: #fff; color: #111; font: 600 15px/1 "Tinos", serif;
  display: grid; place-items: center; cursor: pointer; padding: 0; touch-action: manipulation;
}
.bub.on { background: #2b2b2b; color: #fff; box-shadow: inset 0 0 0 2px #555; }
.bub[disabled] { cursor: default; }
.nowrite { position: relative; height: 120px; border: 1.5px solid #111; margin-bottom: 18px; display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr auto; text-align: center; font-weight: 700; font-size: 14px; overflow: hidden;
  background: linear-gradient(to top right, transparent calc(50% - 1px), #111 calc(50% - .5px), #111 calc(50% + .5px), transparent calc(50% + 1px)), linear-gradient(to bottom right, transparent calc(50% - 1px), #111 calc(50% - .5px), #111 calc(50% + .5px), transparent calc(50% + 1px)); }
.nowrite span:first-child { grid-column: 1 / 3; align-self: end; }
.nowrite small { grid-column: 1 / 3; font-weight: 400; padding-bottom: 8px; background: #fff; justify-self: center; padding-inline: 8px; }
.pq { margin: 10px 0; }
.pq.row-q { display: flex; gap: 8px 22px; flex-wrap: wrap; align-items: baseline; }
.popts { display: grid; gap: 2px 12px; margin: 4px 0 0 18px; }
.popts.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.popts.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.popts.c1, .popts.one { grid-template-columns: 1fr; }
@media (max-width: 640px) { .popts.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .popts.c2 { grid-template-columns: 1fr; } }
.psign { width: fit-content; margin: 8px auto; padding: 10px 18px; border: 3px solid #1d4fb8; border-radius: 10px; color: #1d4fb8; font: 700 15px/1.2 system-ui, sans-serif; text-transform: uppercase; letter-spacing: .04em; text-align: center; }
.ptable { border-collapse: collapse; margin: 8px auto; }
.ptable th, .ptable td { border: 1px solid #111; padding: 2px 14px; text-align: center; color: #111; font-size: 15px; text-transform: none; letter-spacing: 0; }
.ppass { white-space: pre-line; text-indent: 0; margin: 8px 0; text-align: justify; }
.ppass.poem { text-align: left; font-style: italic; padding-left: 20%; }
.psrc { text-align: right; font-style: italic; font-size: 15px; }
.ptitle { text-align: center; font-weight: 700; margin: 6px 0; }
.ppart { font-weight: 700; margin: 16px 0 4px; }
.pp { margin: 4px 0; }
.psubq { margin: 4px 0 0 18px; }
.pans { margin-top: 6px; }
.pend { text-align: center; font-weight: 700; margin-top: 14px; }
.pfoot { text-align: right; font-size: 13px; margin-top: 16px; }
.pen-trans { margin: 6px 0 0 18px; padding: 6px 10px; border-left: 3px solid #4A3AA8; background: #f3f1fc; font-family: var(--f-body); font-size: 15px; color: #222; }
.arrow-line { display: flex; gap: 6px; align-items: baseline; margin-top: 4px; }
input.blank {
  display: inline-block; width: 10em; min-height: 0; height: 34px; padding: 2px 6px; border: 0; border-bottom: 1.5px dotted #111; border-radius: 0;
  background: #fffbe6; color: #1f3fa8; font: 400 1.15em var(--f-hand); vertical-align: baseline; box-shadow: none;
}
input.blank:focus { border-bottom: 2px solid #1f3fa8; background: #fff4bf; }
input.blank.wide { width: 13em; max-width: 100%; }
input.blank.mid { width: 9em; }
input.blank.short { width: 6em; }
input.blank.letter { width: 2.4em; text-align: center; }
input.blank.full { flex: 1; width: auto; min-width: 0; }
textarea.dotted {
  width: 100%; border: 0; border-radius: 0; background-color: #fffdf2; color: #1f3fa8; font: 400 1.2rem/2.1rem var(--f-hand); padding: 0 6px; margin-top: 4px;
  background-image: repeating-linear-gradient(transparent 0 calc(2.1rem - 2px), #999 calc(2.1rem - 2px) calc(2.1rem - 1px), transparent calc(2.1rem - 1px) 2.1rem);
  background-attachment: local; resize: vertical;
}
textarea.dotted:focus { outline: 2px solid #1f3fa8; }
.psheet .wc { font-family: var(--f-body); }
.psheet .btn { font-family: var(--f-body); }
.fab { position: fixed; right: max(12px, env(safe-area-inset-right)); bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 45; box-shadow: var(--shadow); width: 52px; height: 52px; padding: 0; border-radius: 50%; font-size: 1.4rem; }
.paper { padding-bottom: 90px; }

/* tappable options on the practice paper: tapping circles the letter like a pencil mark */
.popt { all: unset; box-sizing: border-box; display: block; padding: 6px 6px; margin: -2px 0; border-radius: 8px; cursor: pointer; font: inherit; color: #111; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.popt:active { background: #f1effa; }
.popt:focus-visible { outline: 2px solid #1f3fa8; }
.popt .pl { display: inline-grid; place-items: center; width: 1.45em; height: 1.45em; border-radius: 50%; border: 2px solid transparent; margin: -.2em -.15em -.2em -.3em; line-height: 1; }
.popt.on { background: #eef1ff; }
.popt.on .pl { border-color: #1f3fa8; color: #1f3fa8; font-weight: 700; }
.popt[disabled] { cursor: default; }
.ptip { font-family: var(--f-body); font-size: 13px; color: #555; text-align: center; margin-top: 8px; }

/* answer-sheet bubbles on a phone-width screen */
@media (max-width: 560px) { .bub { width: 36px; height: 36px; } }
/* quick-tap answers next to the written blanks */
.qbtns { display: inline-flex; gap: 6px; margin-left: 6px; vertical-align: middle; }
.qbtn { min-width: 44px; height: 40px; padding: 0 10px; border-radius: 10px; border: 1.5px solid #999; background: #fff; color: #111; font: 600 15px var(--f-body); cursor: pointer; touch-action: manipulation; }
.qbtn.on { background: #1f3fa8; border-color: #1f3fa8; color: #fff; }
.pimgq { margin: 8px 0; text-align: center; }
.pimgq img { max-width: min(100%, 520px); max-height: 360px; height: auto; border-radius: 4px; }
.listen-box { display: grid; gap: 8px; margin: 6px 0 12px; padding: 10px 12px; border: 1px dashed #bbb; border-radius: 10px; font-family: var(--f-body); }
.task .check, .check { width: 44px; height: 44px; }
.popt:not(.on) .pl { width: auto; border: 0; margin: 0; }

/* Today: weekly goals and quick practice */
.goal { display: grid; gap: 6px; }
.goal-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-weight: 600; }
.goal-top > span { display: inline-flex; align-items: center; gap: 6px; }
.goal-top svg { width: 18px; height: 18px; color: var(--green); }
.goal-top b { font-size: 1.05rem; white-space: nowrap; }
.goal-top b .muted { font-weight: 500; font-size: .9rem; }
.gbar { height: 12px; border-radius: 6px; background: var(--paper); border: 1px solid var(--line); overflow: hidden; }
.gbar i { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--tim), #7c6cf0); transition: width .6s ease; min-width: 0; }
.goal.ok .gbar i { background: var(--green); }
.goal-cheer { font-size: 1.3rem; color: var(--green); margin: 0; }
.qtiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.qtile { display: flex; align-items: center; gap: 12px; text-align: left; padding: 12px; min-height: 64px; border-radius: var(--r-sm); background: var(--paper); border: 1px solid var(--line); color: var(--ink); font: inherit; cursor: pointer; }
.qtile:hover { border-color: var(--tim); }
.qtile:active { transform: scale(.98); }
.qtile b { display: block; font-weight: 700; }
.qtile .small { display: block; }
.qi { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--sheet); color: var(--tim); border: 1px solid var(--line); }
.qi svg { width: 22px; height: 22px; }
.stage-track { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.stage-track .st { display: grid; gap: 6px; font-size: .72rem; color: var(--ink-3); line-height: 1.2; }
.stage-track .st i { height: 8px; border-radius: 4px; background: var(--paper); border: 1px solid var(--line); }
.stage-track .st.past i { background: var(--tim-soft); border-color: var(--tim-soft); }
.stage-track .st.now i { background: var(--tim); border-color: var(--tim); }
.stage-track .st.now span { color: var(--tim); font-weight: 700; }
.qtile { padding: 10px 12px; gap: 10px; }
@media (min-width: 1100px) { .qtiles { grid-template-columns: repeat(2, 1fr); } }
