/* Layout: one planner page per child. Dates run down the left edge as blocks, subjects are coloured dots, flashcards are ruled exercise paper with a red margin. */
:root {
  --paper: #f2f5fa; --sheet: #ffffff; --wash: #e7ecf5; --ink: #15233b; --ink2: #55637d; --rule: #d2dae8;
  --biro: #2450c8; --biro-ink: #ffffff; --hi: #ffe04a; --hi-ink: #2e2600; --margin: #cf3f34; --ok: #16794f; --warn: #a86400;
  --display: "Bricolage Grotesque", "Trebuchet MS", system-ui, sans-serif;
  --body: "Atkinson Hyperlegible", "Segoe UI", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0e1420; --sheet: #171f30; --wash: #1f2a42; --ink: #e8edf8; --ink2: #9daac2; --rule: #2c3853;
    --biro: #8eadff; --biro-ink: #0e1420; --hi: #ffe04a; --hi-ink: #2e2600; --margin: #ff8a80; --ok: #63d3a2; --warn: #f2b450; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0e1420; --sheet: #171f30; --wash: #1f2a42; --ink: #e8edf8; --ink2: #9daac2; --rule: #2c3853;
  --biro: #8eadff; --biro-ink: #0e1420; --hi: #ffe04a; --hi-ink: #2e2600; --margin: #ff8a80; --ok: #63d3a2; --warn: #f2b450; color-scheme: dark;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--body); font-size: 16px; line-height: 1.5; }
.wrap { max-width: 860px; margin: 0 auto; padding-inline: 16px; padding-block: 20px 56px; display: flex; flex-direction: column; gap: 20px; }
h1, h2, h3 { font-family: var(--display); font-weight: 700; line-height: 1.15; margin: 0; text-wrap: balance; }
h1 { font-size: 1.9rem; letter-spacing: -0.01em; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.02rem; }
p { margin: 0; }
a { color: var(--biro); }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--biro); outline-offset: 2px; }
.muted { color: var(--ink2); }
.small { font-size: 0.875rem; }
.label { font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink2); font-weight: 700; }

.top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.brand { font-family: var(--display); font-weight: 700; font-size: 1.05rem; display: flex; align-items: center; gap: 8px; }
.brand i { width: 14px; height: 20px; background: var(--hi); border-radius: 2px; transform: rotate(-8deg); display: inline-block; }
.kids { display: flex; background: var(--wash); border-radius: 999px; padding: 4px; gap: 2px; }
.kids button { border: 0; background: transparent; border-radius: 999px; padding: 7px 16px; font-weight: 700; display: flex; align-items: baseline; gap: 6px; }
.kids button span { font-size: 0.75rem; font-weight: 400; color: var(--ink2); }
.kids button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.kids button[aria-pressed="true"] span { color: var(--paper); opacity: 0.75; }

.tabs { display: flex; flex-wrap: wrap; gap: 4px 20px; border-bottom: 2px solid var(--rule); }
.tabs button { border: 0; background: transparent; padding: 8px 0; font-weight: 700; color: var(--ink2); border-bottom: 3px solid transparent; margin-bottom: -2px; }
.tabs button[aria-current="page"] { color: var(--ink); border-bottom-color: var(--biro); }

.stack { display: flex; flex-direction: column; gap: 12px; }
.section { display: flex; flex-direction: column; gap: 10px; }
.sechead { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 12px; }
.hero { display: flex; flex-direction: column; gap: 4px; }

.count { display: flex; flex-wrap: wrap; gap: 8px; }
.countchip { background: var(--sheet); border: 1px solid var(--rule); border-radius: 10px; padding: 8px 12px; display: flex; align-items: center; gap: 10px; min-width: 0; }
.countchip b { font-family: var(--display); font-size: 1.5rem; line-height: 1; font-variant-numeric: tabular-nums; }
.countchip.soon { background: var(--hi); color: var(--hi-ink); border-color: transparent; }
.countchip.soon .muted { color: var(--hi-ink); opacity: 0.8; }
.countchip > div, .countchip .chipbody { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
button.countchip { font: inherit; color: inherit; text-align: left; cursor: pointer; }
button.countchip:hover { border-color: var(--biro); }
button.countchip.soon:hover { box-shadow: inset 0 0 0 2px var(--hi-ink); }

.list { background: var(--sheet); border: 1px solid var(--rule); border-radius: 12px; overflow: hidden; }
.item { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; align-items: start; padding: 12px 14px; border-top: 1px solid var(--rule); }
.item:first-child { border-top: 0; }
.item.nodate { grid-template-columns: minmax(0, 1fr); }
.dateblock { width: 46px; text-align: center; line-height: 1.1; font-variant-numeric: tabular-nums; }
.dateblock b { display: block; font-family: var(--display); font-size: 1.45rem; }
.dateblock span { font-size: 0.7rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink2); }
.check { width: 24px; height: 24px; margin: 4px 0 0; accent-color: var(--ok); cursor: pointer; }
.itemmain { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.ititle { border: 0; background: transparent; padding: 0; text-align: left; font-family: var(--display); font-weight: 700; font-size: 1.02rem; line-height: 1.25; }
.ititle:hover { color: var(--biro); }
.meta { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; font-size: 0.875rem; color: var(--ink2); }
.subj { display: inline-flex; align-items: center; gap: 6px; color: var(--ink); font-weight: 700; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.pill { font-size: 0.75rem; font-weight: 700; border-radius: 999px; padding: 1px 9px; border: 1px solid var(--rule); color: var(--ink2); white-space: nowrap; }
.pill.test { background: var(--ink); color: var(--paper); border-color: transparent; }
.pill.hot { background: var(--hi); color: var(--hi-ink); border-color: transparent; }
.detail { display: flex; flex-direction: column; gap: 10px; padding-top: 4px; max-width: 65ch; }
.note { border-left: 3px solid var(--hi); background: var(--wash); padding: 8px 12px; border-radius: 0 8px 8px 0; font-size: 0.9rem; }
.note.warn { border-left-color: var(--margin); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btn { border: 1px solid var(--biro); background: var(--biro); color: var(--biro-ink); border-radius: 8px; padding: 8px 14px; font-weight: 700; text-decoration: none; display: inline-block; }
.btn.ghost { background: transparent; color: var(--biro); }
.btn.quiet { background: transparent; color: var(--ink); border-color: var(--rule); }
.btn.sm { padding: 5px 11px; font-size: 0.875rem; }
.btn[disabled] { opacity: 0.5; cursor: default; }

.meter { display: inline-block; height: 6px; border-radius: 3px; background: var(--wash); overflow: hidden; width: 96px; flex: none; }
.meter i { display: block; height: 100%; background: var(--ok); }
.setrow { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 14px; align-items: center; padding: 12px 14px; border-top: 1px solid var(--rule); }
.setrow:first-child { border-top: 0; }
.setrow .actions { justify-content: flex-end; }
@media (max-width: 560px) { .setrow { grid-template-columns: minmax(0, 1fr); } .setrow .actions { justify-content: flex-start; } }

.subtabs { display: flex; flex-wrap: wrap; gap: 6px; }
.subtabs button { border: 1px solid var(--rule); background: var(--sheet); border-radius: 999px; padding: 6px 16px; font-weight: 700; }
.subtabs button[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.back { border: 0; background: transparent; color: var(--biro); padding: 0; font-weight: 700; align-self: flex-start; }
.panel { background: var(--sheet); border: 1px solid var(--rule); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.panel ul { margin: 0; padding-left: 1.2em; display: flex; flex-direction: column; gap: 4px; max-width: 65ch; }
.qa { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 4px 20px; padding: 10px 0; border-top: 1px solid var(--rule); }
.qa:first-of-type { border-top: 0; }
.qa b { font-weight: 700; }
@media (max-width: 560px) { .qa { grid-template-columns: minmax(0, 1fr); } }
.prose { white-space: pre-wrap; overflow-wrap: anywhere; max-width: 65ch; }

.lesson .step { border-top: 1px solid var(--rule); padding: 14px 0 2px; display: flex; flex-direction: column; gap: 10px; }
.lesson .step.speaking { box-shadow: -12px 0 0 var(--sheet), -16px 0 0 var(--hi); }
.stephead { display: flex; align-items: center; gap: 10px; }
.stephead h3 { flex: 1; min-width: 0; font-size: 1.1rem; }
.stepno { width: 26px; height: 26px; border-radius: 50%; background: var(--ink); color: var(--paper); font-weight: 700; font-size: 0.85rem; display: grid; place-items: center; flex: none; font-variant-numeric: tabular-nums; }
.say { max-width: 65ch; font-size: 1.05rem; }
.visual { margin: 0; background: var(--paper); border: 1px solid var(--rule); border-radius: 10px; padding: 14px; overflow-x: auto; }
.v-flow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.v-box { border: 2px solid var(--ink); border-radius: 8px; padding: 8px 12px; font-weight: 700; background: var(--sheet); max-width: 230px; overflow-wrap: anywhere; }
.v-arrow { font-size: 1.3rem; font-weight: 700; color: var(--biro); }
.v-compare { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.v-col { background: var(--sheet); border-radius: 8px; padding: 10px 12px; border-top: 4px solid var(--biro); display: flex; flex-direction: column; gap: 6px; }
.v-col + .v-col { border-top-color: var(--hi); }
.v-parts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.v-part { background: var(--sheet); border: 1px solid var(--rule); border-radius: 8px; padding: 8px 10px; font-size: 0.92rem; overflow-wrap: anywhere; }
.v-part b { display: block; font-size: 1rem; }
.v-eq { font-family: var(--display); font-size: 1.7rem; font-weight: 700; text-align: center; padding: 4px 0 10px; overflow-wrap: anywhere; }
.v-legend { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 14px; margin: 0; }
.v-legend dt { font-family: var(--display); font-weight: 700; }
.v-legend dd { margin: 0; }
.v-worked { display: grid; grid-template-columns: minmax(0, auto) minmax(0, 1fr); gap: 8px 20px; align-items: baseline; }
.v-math { font-family: var(--display); font-weight: 500; font-size: 1.2rem; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.v-why { color: var(--ink2); font-size: 0.9rem; }
.v-bars { display: grid; grid-template-columns: minmax(0, auto) minmax(60px, 1fr) auto; gap: 8px 10px; align-items: center; font-variant-numeric: tabular-nums; }
.v-track { display: block; }
.v-bar { display: block; height: 16px; background: var(--biro); border-radius: 3px; min-width: 2px; }
.v-time { list-style: none; margin: 0 0 0 6px; padding: 0 0 0 18px; border-left: 3px solid var(--rule); display: flex; flex-direction: column; gap: 10px; max-width: 65ch; }
.v-time li { position: relative; }
.v-time li::before { content: ""; position: absolute; left: -26px; top: 0.45em; width: 11px; height: 11px; border-radius: 50%; background: var(--biro); }
.v-svg { display: block; width: 100%; max-width: 560px; height: auto; margin: 0 auto; }
.v-svg.v-small { max-width: 240px; }
.v-shellwrap { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.reveal summary { cursor: pointer; font-weight: 700; }
.reveal p { margin-top: 6px; max-width: 65ch; }
@media (max-width: 520px) { .v-compare, .v-worked { grid-template-columns: minmax(0, 1fr); } .v-worked { gap: 2px; } .v-why { margin-bottom: 8px; } .v-eq { font-size: 1.35rem; } }
.loading { display: flex; align-items: center; gap: 12px; }
.spinner { width: 24px; height: 24px; border-radius: 50%; border: 3px solid var(--rule); border-top-color: var(--biro); flex: none; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: pulse 1.6s ease-in-out infinite; } }
.voicepick { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.voicepick select { max-width: 240px; }
.report { gap: 18px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.tile { background: var(--paper); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tlabel { font-size: 0.85rem; color: var(--ink2); }
.tvalue { font-size: 1.6rem; font-weight: 700; line-height: 1.15; }
.chart { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.plot { position: relative; padding-top: 18px; }
.gridlabel { position: absolute; top: 0; left: 0; }
.cols { display: flex; align-items: flex-end; gap: 2px; height: 120px; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.col { flex: 1; min-width: 0; height: 100%; display: flex; align-items: flex-end; justify-content: center; border: 0; background: transparent; padding: 0; border-radius: 4px; }
.col:hover, .col:focus-visible { background: var(--wash); }
.bar { display: block; width: 100%; max-width: 24px; background: var(--biro); border-radius: 4px 4px 0 0; }
.xaxis { display: flex; gap: 2px; padding-top: 4px; }
.xaxis span { flex: 1; text-align: center; }
.xaxis .now { color: var(--ink); font-weight: 700; }
.readout { min-height: 1.4em; }
.tablewrap { overflow-x: auto; margin-top: 8px; }
.tablewrap table { border-collapse: collapse; font-size: 0.875rem; font-variant-numeric: tabular-nums; }
.tablewrap th, .tablewrap td { text-align: right; padding: 4px 12px; border-bottom: 1px solid var(--rule); white-space: nowrap; }
.tablewrap th:first-child { text-align: left; }
.ready { display: flex; flex-direction: column; gap: 12px; }
.rrow { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.3fr) 128px; gap: 6px 16px; align-items: center; }
.rname { display: flex; flex-direction: column; min-width: 0; }
.rmeter { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.meter.wide { width: 100%; height: 8px; border-radius: 4px; }
.meter.m-warn i { background: var(--warn); } .meter.m-bad i { background: var(--margin); } .meter.m-ok i, .meter.m-none i { background: var(--biro); }
.meter.m-good { background: color-mix(in srgb, var(--ok) 18%, var(--sheet)); } .meter.m-warn { background: color-mix(in srgb, var(--warn) 18%, var(--sheet)); }
.meter.m-bad { background: color-mix(in srgb, var(--margin) 18%, var(--sheet)); } .meter.m-ok, .meter.m-none { background: color-mix(in srgb, var(--biro) 18%, var(--sheet)); }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 0.875rem; font-weight: 700; white-space: nowrap; }
.sicon { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 0.75rem; font-weight: 700; color: var(--sheet); flex: none; }
.s-good { background: var(--ok); } .s-ok { background: var(--biro); } .s-warn { background: var(--warn); } .s-bad { background: var(--margin); } .s-none { background: transparent; color: var(--ink2); border: 2px solid var(--ink2); font-size: 0; }
ul.plain { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; }
@media (max-width: 560px) { .rrow { grid-template-columns: minmax(0, 1fr) auto; } .rrow .rname { grid-row: 1; grid-column: 1; } .rrow .status { grid-row: 1; grid-column: 2; align-self: start; } .rrow .rmeter { grid-row: 2; grid-column: 1 / -1; } }
.card { position: relative; width: 100%; min-height: 230px; border: 1px solid var(--rule); border-radius: 6px; color: var(--ink); text-align: left;
  background-color: var(--sheet); background-image: repeating-linear-gradient(to bottom, transparent 0 31px, var(--rule) 31px 32px); background-position: 0 18px;
  padding: 26px 20px 26px 58px; display: flex; flex-direction: column; justify-content: center; gap: 10px; }
.card::before { content: ""; position: absolute; left: 42px; top: 0; bottom: 0; width: 2px; background: var(--margin); opacity: 0.55; }
.card .side { font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink2); font-weight: 700; }
.card .face { font-family: var(--display); font-weight: 500; font-size: 1.35rem; line-height: 32px; overflow-wrap: anywhere; }
.card.flipped .face { font-family: var(--body); font-weight: 400; font-size: 1.12rem; }
.deckbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; }

.question { font-family: var(--display); font-weight: 500; font-size: 1.25rem; line-height: 1.35; overflow-wrap: anywhere; }
.opts { display: flex; flex-direction: column; gap: 8px; }
.opt { text-align: left; border: 1px solid var(--rule); background: var(--sheet); border-radius: 10px; padding: 10px 14px; display: flex; gap: 10px; overflow-wrap: anywhere; }
.opt:not([disabled]):hover { border-color: var(--biro); }
.opt[disabled] { cursor: default; }
.opt.right { border-color: var(--ok); box-shadow: inset 0 0 0 1px var(--ok); }
.opt.wrong { border-color: var(--margin); box-shadow: inset 0 0 0 1px var(--margin); }
.opt .tag { font-weight: 700; flex: none; }
.opt.right .tag { color: var(--ok); }
.opt.wrong .tag { color: var(--margin); }
.score { font-family: var(--display); font-size: 2.4rem; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }

.chat { display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 62ch; padding: 10px 14px; border-radius: 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.you { align-self: flex-end; background: var(--biro); color: var(--biro-ink); border-bottom-right-radius: 3px; }
.msg.coach { align-self: flex-start; background: var(--wash); border-bottom-left-radius: 3px; }
.composer { display: flex; gap: 8px; align-items: flex-end; }
.composer textarea { flex: 1; min-width: 0; font: inherit; color: var(--ink); background: var(--sheet); border: 1px solid var(--rule); border-radius: 10px; padding: 10px 12px; resize: vertical; min-height: 48px; }
select { font: inherit; color: var(--ink); background: var(--sheet); border: 1px solid var(--rule); border-radius: 8px; padding: 8px 10px; max-width: 100%; }
footer { color: var(--ink2); font-size: 0.8rem; border-top: 1px solid var(--rule); padding-top: 12px; display: flex; flex-direction: column; gap: 4px; }
@media (max-width: 480px) { h1 { font-size: 1.55rem; } .kids button { padding: 7px 12px; } .card { padding-left: 46px; } .card::before { left: 32px; } }
@media (prefers-reduced-motion: no-preference) { .btn, .opt, .kids button { transition: background-color 0.12s, border-color 0.12s; } }

/* Hosted version additions: PIN and password screens, parents' conversation list. */
.pinpanel { max-width: 360px; margin: 40px auto 0; width: 100%; }
.pinpanel label { font-weight: 700; }
.pinbox { font: inherit; font-size: 1.6rem; letter-spacing: 0.3em; text-align: center; color: var(--ink); background: var(--sheet); border: 1px solid var(--rule); border-radius: 10px; padding: 10px 12px; width: 100%; }
.pinbox.wide { letter-spacing: normal; font-size: 1.1rem; text-align: left; }
.msg.err { background: transparent; border: 1px dashed var(--margin); color: var(--ink2); }
.chatrow .chat { padding-top: 6px; }
.kids:empty, .tabs:empty { display: none; }
/* Phones: more air between sections so each screen reads as a few clear blocks rather than one long run. */
@media (max-width: 560px) {
  .wrap { gap: 24px; padding-block: 16px 64px; }
  #view.stack { gap: 32px; }
  .section { gap: 12px; }
  .report { gap: 28px; }
  .count { gap: 10px; }
  footer { margin-top: 12px; gap: 8px; }
  .item, .setrow { padding: 16px; }
  .setrow { gap: 12px; }
  .itemmain { gap: 8px; }
  .meta { row-gap: 8px; }
}

/* Whole cards are the tap target: a task card opens its details, a topic card opens the topic on Learn. */
.item.tap { cursor: pointer; }
.item.tap:not(.open):hover { background: var(--wash); }
.item.tap .detail { cursor: auto; }
.ihead { border: 0; background: transparent; padding: 0; margin: 0; width: 100%; text-align: left; color: inherit; font: inherit; display: flex; flex-direction: column; gap: 6px; cursor: pointer; }
.ihead .ititle, .setlink .ititle { display: block; }
.item.tap:hover .ititle, .setlink:hover .ititle { color: var(--biro); }
.setrow.setlink { width: 100%; border: 0; border-top: 1px solid var(--rule); background: transparent; text-align: left; color: inherit; font: inherit; grid-template-columns: minmax(0, 1fr) auto; cursor: pointer; }
.setrow.setlink:first-child { border-top: 0; }
.setrow.setlink:hover { background: var(--wash); }
.setlink .itemmain { display: flex; }
.chev { font-family: var(--display); font-size: 1.6rem; line-height: 1; color: var(--ink2); }
.subtabs + .list { margin-top: -4px; }
.srcline.ok b { color: var(--ok); }
.note.small { font-size: 0.85rem; }
.item { scroll-margin-top: 16px; }
/* Open task card: topics, the teacher's links and the actions each sit in their own block. */
.dsec { display: flex; flex-direction: column; gap: 8px; padding-top: 12px; border-top: 1px solid var(--rule); }
.topiclist, .linklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.topicrow { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 9px 0; border: 0; border-top: 1px solid var(--wash); background: transparent; text-align: left; color: inherit; font: inherit; cursor: pointer; }
.topiclist li:first-child .topicrow { border-top: 0; }
.topicrow:hover .topicname { color: var(--biro); }
.topicname { font-weight: 700; min-width: 0; }
.topicmeta { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.topicmeta .meter { width: 56px; }
.topicrow .chev { font-size: 1.3rem; }
.linklist { gap: 6px; }
.linklist a { overflow-wrap: anywhere; }
@media (max-width: 420px) { .topicmeta .meter { display: none; } }
/* Opened details run under the whole card, beside nothing, so topics and buttons have the full width. */
.item > .detail { grid-column: 1 / -1; max-width: none; padding-top: 0; }
@media (min-width: 561px) { .item:not(.nodate) > .detail { grid-column: 2; } }

/* Calmer layout: more room around and inside everything, so each screen reads as a few clear blocks rather than a wall of text.
   This layer comes last and sets spacing for all screen sizes. */
body { line-height: 1.6; }
p { max-width: 65ch; }
.wrap { gap: 32px; padding-block: 28px 80px; }
#view.stack { gap: 40px; }
.hero { gap: 8px; }
.section { gap: 16px; }
.sechead { gap: 8px 16px; }
.tabs { gap: 4px 28px; }
.tabs button { padding: 10px 0; }
.subtabs { gap: 8px; }
.subtabs button { padding: 8px 18px; }
.count { gap: 12px; }
.countchip { padding: 12px 16px; gap: 12px; }
.list { border-radius: 14px; }
.item, .setrow { padding: 20px; gap: 14px; }
.itemmain { gap: 10px; }
.meta { gap: 8px 14px; }
.detail { gap: 18px; }
.detail p { line-height: 1.65; }
.dsec { padding-top: 18px; gap: 12px; }
.topicrow { padding: 12px 0; }
.actions { gap: 10px; }
.note { padding: 12px 16px; line-height: 1.6; }
.panel { padding: 22px; gap: 18px; border-radius: 14px; }
.panel ul { gap: 8px; }
.qa { padding: 14px 0; gap: 6px 24px; }
.lesson .step { padding: 22px 0 8px; gap: 14px; }
.say { line-height: 1.7; }
.visual { padding: 18px; }
.card { min-height: 250px; }
.deckbar { margin-bottom: 4px; }
.question { line-height: 1.45; }
.opts { gap: 12px; }
.opt { padding: 14px 16px; }
.chat { gap: 14px; }
.msg { padding: 12px 16px; line-height: 1.6; }
.report { gap: 28px; }
.tiles { gap: 12px; }
.tile { padding: 14px 16px; }
.ready { gap: 16px; }
ul.plain { gap: 8px; }
footer { padding-top: 18px; gap: 6px; }
@media (max-width: 560px) {
  .wrap { gap: 28px; padding-block: 18px 72px; }
  #view.stack { gap: 40px; }
  .item, .setrow { padding: 18px 16px; }
  .panel { padding: 18px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tvalue { font-size: 1.35rem; }
}

/* A page's heading block (title, date, back link, filters or topic buttons, test countdowns) stays together as one unit;
   the bigger gaps are between that block and the sections below it. */
.pagehead { display: flex; flex-direction: column; gap: 16px; }
.pagehead > .back { margin-bottom: -4px; }
.pagehead .subtabs + .list, .subtabs + .list { margin-top: 0; }
.code { font-family: var(--display); font-size: 1.3rem; letter-spacing: 0.08em; }

/* Join, admin and privacy pages. */
.joinsteps { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 0.85rem; color: var(--ink2); counter-reset: s; }
.joinsteps li { counter-increment: s; display: flex; align-items: center; gap: 6px; }
.joinsteps li::before { content: counter(s); width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--rule); display: grid; place-items: center; font-size: 0.75rem; font-weight: 700; }
.joinsteps li.now { color: var(--ink); font-weight: 700; } .joinsteps li.now::before { background: var(--biro); border-color: var(--biro); color: var(--biro-ink); }
.joinsteps li.done::before { content: "✓"; background: var(--ok); border-color: var(--ok); color: var(--sheet); }
.panel label { display: flex; flex-direction: column; gap: 6px; }
.agree { flex-direction: row !important; align-items: flex-start; gap: 12px !important; }
.agree .check { margin-top: 2px; flex: none; }
.howto { margin: 0; padding-left: 1.3em; display: flex; flex-direction: column; gap: 14px; }
.kidrow { display: flex; flex-direction: column; gap: 12px; padding-top: 16px; border-top: 1px solid var(--rule); }
.kidfields { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1.4fr); gap: 12px; }
@media (max-width: 560px) { .kidfields { grid-template-columns: minmax(0, 1fr); } }
.linkrows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.linkrows li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; }
.linkrows li b { grid-column: 1 / -1; }
.linktext { overflow-wrap: anywhere; color: var(--ink2); font-family: ui-monospace, Menlo, monospace; }
.capbox { width: 90px; font-size: 1rem; letter-spacing: normal; text-align: right; padding: 6px 10px; }
.btn.danger { color: var(--margin); border-color: var(--margin); }
.panel.off { opacity: 0.6; }
.prose-page .panel p, .prose-page .panel li { line-height: 1.7; }
.note.viewer { border-left-color: var(--biro); }
.countchip b.today { font-size: 1.1rem; }

/* Learn to earn */
.earnline { font-size: 1.05rem; } .earnline b { font-family: var(--display); font-size: 1.6rem; }
.earned { font-weight: 700; color: var(--ok); }
.pastweeks { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; } .pastweek { display: flex; flex-direction: column; gap: 10px; } .pastweek .actions { margin: 0; align-items: center; }
.payrates { list-style: none; padding: 0 !important; margin: 0; display: flex; flex-direction: column; gap: 10px !important; }
.payrates li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: baseline; border-top: 1px solid var(--wash); padding-top: 10px; }
.payrates li:first-child { border-top: 0; padding-top: 0; }
#toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; background: var(--ok); color: #fff; font-weight: 700; padding: 10px 18px; border-radius: 999px; box-shadow: 0 8px 24px rgba(0,0,0,0.2); max-width: calc(100vw - 32px); text-align: center; }
#toast.quiet { background: var(--ink); color: var(--paper); font-weight: 400; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (prefers-reduced-motion: no-preference) { #toast { transition: opacity 0.25s, transform 0.25s; } }

/* Family leaderboard */
.board { display: flex; flex-direction: column; gap: 10px; padding-top: 14px; border-top: 1px solid var(--rule); }
.boardlist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.boardlist li { display: grid; grid-template-columns: 40px minmax(0, 1fr) minmax(60px, 1.2fr) auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 10px; background: var(--paper); }
.boardlist li.me { background: color-mix(in srgb, var(--biro) 12%, var(--sheet)); box-shadow: inset 0 0 0 1.5px var(--biro); }
.boardlist .place { font-family: var(--display); font-weight: 700; font-size: 0.9rem; text-align: center; border-radius: 999px; padding: 2px 0; }
.boardlist li.p1 .place { background: var(--hi); color: var(--hi-ink); }
.boardlist li.p2 .place { background: var(--wash); }
.boardlist .who { font-weight: 700; min-width: 0; overflow-wrap: anywhere; }
.boardlist .bar { height: 8px; border-radius: 4px; background: var(--wash); overflow: hidden; }
.boardlist .bar i { display: block; height: 100%; background: var(--ok); }
.boardlist b { font-variant-numeric: tabular-nums; }
