/* KS2 Practice client area (v2): design/client-area/project/*.dc.html, exercise-book look.
   Loaded after fonts/fonts.css, public.css and the player's styles.css. No inline styles anywhere
   (the page's CSP has no 'unsafe-inline'). */
:root {
  --ink: #1f2d4d;
  --muted: #4f5d7a;
  --paper: #f6f8fc;
  --surface: #ffffff;
  --rule: #d6e1f0;
  --margin: #d24a45;
  --pencil: #f6c443;
  --pencil-soft: #fdf3d4;
  --good: #2e7d4f;
  --font-display: "Lexend", "Segoe UI", system-ui, sans-serif;
  --font-body: "Atkinson Hyperlegible", "Segoe UI", system-ui, sans-serif;
  /* the shared player follows the site's tokens */
  --ks2-ink: var(--ink);
  --ks2-ink-2: var(--muted);
  --ks2-feint: var(--rule);
  --ks2-pencil: var(--pencil);
  --ks2-pencil-ink: var(--ink);
  --ks2-font-display: var(--font-display);
  --ks2-font-body: var(--font-body);
}

body.ks2-page-app { background: var(--paper); color: var(--ink); font: 1.0625rem/1.55 var(--font-body); }
.ks2-app { min-height: 60vh; }
.ks2-wrap { width: min(1120px, 100% - 32px); margin-inline: auto; }
.ks2-main { padding: 28px 0 24px; outline: none; }
.ks2-main h1 { font-family: var(--font-display); font-weight: 600; font-size: clamp(1.8rem, 3.4vw, 2.2rem); line-height: 1.2; margin: 0 0 14px; outline: none; }
.ks2-main h2 { font-family: var(--font-display); font-weight: 600; font-size: 1.3rem; margin: 0 0 8px; }
.ks2-main h3 { font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; margin: 16px 0 6px; }
.ks2-sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.ks2-small { font-size: 0.925rem; color: var(--muted); }
.ks2-lead { font-size: 1.15rem; max-width: 60ch; }
.ks2-loading { color: var(--muted); }
.ks2-narrow { max-width: 720px; }

/* header and footer */
.ks2-header { background: var(--surface); border-bottom: 1px solid var(--rule); }
.ks2-header-row { display: flex; align-items: center; justify-content: space-between; gap: 12px 24px; flex-wrap: wrap; padding: 14px 0; }
.ks2-header nav { display: flex; gap: 22px; flex-wrap: wrap; align-items: center; }
.ks2-header a { color: var(--ink); }
.ks2-header .brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-family: var(--font-display); font-weight: 600; font-size: 1.2rem; color: var(--ink); }
.ks2-who-am-i { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-display); font-weight: 600; }
.ks2-grownups { font-size: 0.95rem; }
.ks2-footer { margin-top: 40px; padding: 22px 16px 32px; background: var(--surface); border-top: 1px solid var(--rule); color: var(--muted); font-size: 0.92rem; }
.ks2-footer p { max-width: 1088px; margin: 6px auto; }
.ks2-footer a { color: var(--muted); }
.ks2-footer .footer-credit { color: var(--ink); font-weight: 700; }
.ks2-footer .footer-credit a { color: var(--ink); }

/* buttons and links */
.ks2-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 10px 20px; border: 2px solid var(--ink); border-radius: 10px; background: var(--surface); color: var(--ink); font: 600 1rem/1.2 var(--font-display); text-decoration: none; cursor: pointer; }
.ks2-btn:hover { background: var(--rule); }
.ks2-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.ks2-btn-primary { background: var(--pencil); border-color: var(--pencil); }
.ks2-btn-primary:hover { background: color-mix(in srgb, var(--pencil) 82%, var(--ink)); }
.ks2-btn-plain { border-color: transparent; background: transparent; text-decoration: underline; text-decoration-color: var(--pencil); text-decoration-thickness: 3px; text-underline-offset: 3px; }
.ks2-btn-big { min-height: 56px; padding: 14px 28px; font-size: 1.1rem; }
/* The hidden attribute always wins (S16: a field hidden in script was still shown, because .ks2-field sets display). */
body.ks2-page-app [hidden], .ks2-app [hidden], .ks2-modal [hidden] { display: none !important; }
.ks2-btn-danger { border-color: #a32d28; color: #a32d28; } /* 6.6:1 on white (the margin red alone is 4:1: too faint for text) */
.ks2-btn[aria-pressed="true"] { background: var(--ink); color: var(--surface); }
.ks2-back { display: inline-block; margin-bottom: 12px; color: var(--ink); }
.ks2-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 12px; }
.ks2-main a:hover { background: color-mix(in srgb, var(--pencil) 30%, transparent); }
.ks2-main a.ks2-btn:hover { background: var(--rule); }
.ks2-main a.ks2-btn-primary:hover { background: color-mix(in srgb, var(--pencil) 82%, var(--ink)); }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }

/* notices and cards */
.ks2-notice { border-radius: 10px; padding: 12px 16px; border: 2px solid var(--rule); background: var(--surface); margin: 0 0 14px; }
.ks2-notice-error { border-color: var(--margin); }
.ks2-notice-info { border-color: var(--pencil); }
.ks2-notice-success { border-color: var(--good); }
.ks2-card { background: var(--surface); border: 1px solid var(--rule); border-radius: 16px; padding: 22px 24px; margin: 0 0 20px; }
.ks2-tip { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.ks2-tip p { margin: 4px 0 0; }

/* forms */
.ks2-form { display: grid; gap: 14px; max-width: 560px; }
.ks2-field { display: grid; gap: 4px; margin: 0; }
.ks2-field label, .ks2-label, .ks2-fieldset legend { font-weight: 700; }
.ks2-main input[type="text"], .ks2-main input[type="email"], .ks2-main input[type="password"], .ks2-main input[type="date"], .ks2-main select, .ks2-main textarea, .ks2-modal input {
  width: 100%; max-width: 28rem; min-height: 48px; padding: 10px 12px; border: 2px solid var(--rule); border-radius: 10px; font: inherit; color: var(--ink); background: var(--surface);
}
.ks2-main input:focus-visible, .ks2-main select:focus-visible, .ks2-main textarea:focus-visible { border-color: var(--ink); }
.ks2-fieldset { border: 0; padding: 0; margin: 0; }
.ks2-check { display: flex; gap: 10px; align-items: center; margin: 8px 0; }
.ks2-check input { width: 22px; height: 22px; }
.ks2-more summary { cursor: pointer; font-weight: 700; }
.ks2-avatars { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }
.ks2-av-choice { width: 64px; height: 64px; padding: 6px; border: 3px solid var(--rule); border-radius: 50%; background: var(--surface); cursor: pointer; }
.ks2-av-choice[aria-checked="true"] { border-color: var(--ink); background: var(--pencil-soft); }

/* avatars */
.ks2-avatar { width: 48px; height: 48px; display: block; flex: none; }
.ks2-avatar-sm { width: 32px; height: 32px; }
.ks2-avatar-md { width: 64px; height: 64px; }
.ks2-avatar-lg { width: 96px; height: 96px; }

/* family home */
.ks2-banner { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; background: var(--pencil-soft); border: 1px solid var(--pencil); border-radius: 14px; padding: 18px 22px; margin: 0 0 22px; }
.ks2-banner > div { display: flex; flex-direction: column; gap: 2px; }
.ks2-banner-title { font-family: var(--font-display); font-weight: 600; font-size: 1.3rem; }
.ks2-kids { display: flex; flex-wrap: wrap; gap: 24px; }
.ks2-kid { flex: 1 1 340px; min-width: 0; background: var(--surface); border: 1px solid var(--rule); border-radius: 16px; padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.ks2-kid-head { display: flex; gap: 14px; align-items: center; }
.ks2-kid-head h2 { margin: 0; }
.ks2-chips { display: flex; flex-wrap: wrap; gap: 10px; }
.ks2-chip { display: flex; flex-direction: column; min-width: 120px; padding: 10px 12px; border: 1px solid var(--rule); border-radius: 12px; background: var(--paper); }
.ks2-chip strong { font-family: var(--font-display); font-size: 1.4rem; }
.ks2-chip.is-empty strong { font-size: 1rem; color: var(--muted); }
.ks2-chip-label, .ks2-chip-hint { font-size: 0.85rem; color: var(--muted); }
.ks2-spark-row { display: flex; align-items: center; gap: 10px; }
.ks2-spark { width: 124px; height: 32px; }
.ks2-spark-line { fill: none; stroke: var(--ink); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.ks2-kid p { margin: 0; }
.ks2-handover { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 28px; padding: 24px; border-radius: 16px; background: var(--ink); color: var(--surface); }
.ks2-handover h2 { color: var(--surface); }
.ks2-handover p { margin: 0; }

/* who's practising and the PIN pad */
.ks2-who h1 { text-align: center; }
.ks2-picker { display: flex; flex-wrap: wrap; justify-content: center; gap: 20px; margin: 20px 0; padding: 0; list-style: none; }
.ks2-picker > li { display: flex; }
.ks2-pick { display: flex; flex-direction: column; align-items: center; gap: 10px; min-width: 150px; padding: 18px; border: 3px solid var(--rule); border-radius: 18px; background: var(--surface); cursor: pointer; font: 600 1.2rem var(--font-display); color: var(--ink); }
.ks2-pick[aria-pressed="true"] { border-color: var(--ink); background: var(--pencil-soft); }
.ks2-pinpad { max-width: 360px; margin: 0 auto; text-align: center; }
.ks2-pin-input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.ks2-pin-input:focus-visible + .ks2-dots { outline: 3px solid var(--ink); outline-offset: 6px; border-radius: 12px; }
.ks2-dots { display: flex; justify-content: center; gap: 16px; margin: 14px 0; }
.ks2-dot { width: 20px; height: 20px; border-radius: 50%; border: 3px solid var(--ink); }
.ks2-dot.is-on { background: var(--ink); }
.ks2-keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.ks2-key { min-height: 64px; border: 2px solid var(--rule); border-radius: 14px; background: var(--surface); font: 600 1.6rem var(--font-display); color: var(--ink); cursor: pointer; }
.ks2-key:active { background: var(--pencil-soft); }
.ks2-pin-msg { min-height: 1.6em; font-weight: 700; }

/* grown-up check */
.ks2-gate { max-width: 520px; margin: 10px auto; background: var(--surface); border: 1px solid var(--rule); border-radius: 16px; padding: 26px; display: grid; gap: 14px; }
.ks2-gate-msg { min-height: 1.5em; color: var(--margin); font-weight: 700; margin: 0; }
.ks2-gate-notes { color: var(--muted); font-size: 0.95rem; margin: 0; padding-left: 1.2rem; }

/* child home */
.ks2-hello p { margin: 0 0 18px; font-size: 1.15rem; }
.ks2-carry, .ks2-setcard { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; background: var(--surface); border: 2px solid var(--pencil); border-radius: 18px; padding: 20px 22px; margin-bottom: 18px; }
.ks2-setcard { border-color: var(--rule); }
.ks2-carry h2, .ks2-setcard h2 { margin: 2px 0; }
.ks2-carry p, .ks2-setcard p { margin: 0; }
.ks2-eyebrow { font-size: 0.9rem; color: var(--muted); font-weight: 700; }
.ks2-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; margin: 10px 0 18px; }
.ks2-tile { display: flex; flex-direction: column; gap: 6px; min-height: 130px; padding: 22px; border-radius: 18px; border: 2px solid var(--rule); background: var(--surface); color: var(--ink); text-decoration: none; }
.ks2-tile strong { font-family: var(--font-display); font-size: 1.45rem; }
.ks2-tile-maths { border-top: 8px solid #4a68a8; }
.ks2-tile-gps { border-top: 8px solid #ad4f3f; }
.ks2-tile-reading { border-top: 8px solid #3c7a5b; }
.ks2-tile-mtc { border-top: 8px solid var(--pencil); }
.ks2-choices { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.ks2-choice { display: flex; flex-direction: column; gap: 4px; padding: 22px; border: 2px solid var(--rule); border-radius: 16px; background: var(--surface); color: var(--ink); text-decoration: none; }
.ks2-choice strong { font-family: var(--font-display); font-size: 1.3rem; }
.ks2-topic-pick, .ks2-paper-list, .ks2-plain-list, .ks2-topic-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.ks2-topic, .ks2-paper > a { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 56px; padding: 12px 16px; border: 2px solid var(--rule); border-radius: 12px; background: var(--surface); color: var(--ink); text-decoration: none; }
.ks2-paper { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.ks2-paper > a { flex: 1 1 280px; }
.ks2-stars { color: #b8860b; letter-spacing: 2px; font-size: 1.2rem; }
.ks2-year h2 { margin-top: 20px; }

/* doing a paper or topic */
.ks2-runbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px 16px; margin: -8px 0 10px; }
.ks2-runbar-title { font-family: var(--font-display); font-weight: 600; }
.ks2-save { font-size: 0.95rem; color: var(--muted); }
.ks2-save[data-state="saved"] { color: var(--good); }
.ks2-save[data-state="offline"] { color: var(--ink); }
.ks2-run-paper .ks2p-stop, .ks2-run-spelling .ks2p-stop { display: none; }
.ks2-paused { max-width: 520px; margin: 30px auto; text-align: center; background: var(--surface); border: 1px solid var(--rule); border-radius: 16px; padding: 28px; }
.ks2-paused .ks2-actions { justify-content: center; }

/* results and look back */
.ks2-results { max-width: 640px; margin: 10px auto; text-align: center; background: var(--surface); border: 1px solid var(--rule); border-radius: 18px; padding: 30px; }
.ks2-scores { display: flex; justify-content: center; gap: 28px; flex-wrap: wrap; margin: 18px 0; }
.ks2-score { display: flex; flex-direction: column; margin: 0; }
.ks2-score strong { font-family: var(--font-display); font-size: 2rem; }
.ks2-results .ks2-actions { justify-content: center; }
.ks2-review { padding-left: 1.2rem; }
.ks2-review-item { margin: 0 0 18px; padding: 14px; background: var(--surface); border: 1px solid var(--rule); border-radius: 12px; }
.ks2-note { background: var(--pencil-soft); padding: 8px 12px; border-radius: 8px; }

/* marking */
.ks2-mark-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.ks2-count { color: var(--muted); font-weight: 700; }
.ks2-mark-heading { font-weight: 700; margin-top: 0; }
.ks2-q { margin: 12px 0; }
.ks2-q-img { display: block; max-width: 100%; height: auto; border: 1px solid var(--rule); border-radius: 8px; background: #fff; }
.ks2-answer { margin: 14px 0; padding: 14px 16px; border-left: 5px solid var(--margin); background: var(--paper); border-radius: 0 10px 10px 0; }
.ks2-answer-text { font-size: 1.4rem; font-family: var(--font-display); margin: 4px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.ks2-method { font-weight: 700; }
.ks2-scheme { margin: 14px 0; padding: 14px 18px; border: 1px solid var(--rule); border-radius: 12px; }
.ks2-mark-buttons { display: flex; flex-wrap: wrap; gap: 12px; margin: 8px 0; }
.ks2-btn-mark { min-width: 110px; min-height: 56px; font-size: 1.1rem; }
.ks2-mark-status { font-weight: 700; color: var(--good); min-height: 1.4em; }

/* progress */
.ks2-tabs { display: flex; flex-wrap: wrap; gap: 6px 20px; border-bottom: 1px solid var(--rule); margin: 6px 0 20px; }
.ks2-tabs a { padding: 8px 0; color: var(--ink); text-decoration: none; }
.ks2-tabs a[aria-current="page"] { box-shadow: inset 0 -4px 0 var(--pencil); font-weight: 700; }
.ks2-big-number strong { font-family: var(--font-display); font-size: 2.4rem; margin-right: 8px; }
.ks2-chart { width: 100%; max-width: 560px; height: auto; display: block; }
.ks2-chart-std { stroke: var(--margin); stroke-dasharray: 6 5; stroke-width: 1.5; }
.ks2-chart-label { fill: var(--muted); font-size: 12px; font-family: var(--font-body); }
.ks2-chart-line { fill: none; stroke: var(--ink); stroke-width: 3; }
.ks2-chart-dot { fill: var(--pencil); stroke: var(--ink); stroke-width: 2; }
.ks2-topic-list li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--rule); }
.ks2-table-wrap { overflow-x: auto; }
.ks2-table { width: 100%; border-collapse: collapse; }
.ks2-table th, .ks2-table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--rule); vertical-align: top; }

/* settings and dialogs */
.ks2-child-settings { border: 1px solid var(--rule); border-radius: 12px; padding: 12px 16px; margin: 0 0 12px; }
.ks2-child-settings summary { cursor: pointer; font-family: var(--font-display); font-weight: 600; display: flex; align-items: center; gap: 8px; }
.ks2-child-settings > *:not(summary) { margin-top: 12px; }
.ks2-modal { position: fixed; inset: 0; background: rgba(31, 45, 77, 0.55); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 1000; }
.ks2-modal-box { background: var(--surface); border-radius: 16px; padding: 24px; max-width: 460px; width: 100%; display: grid; gap: 12px; }
.ks2-codes { columns: 2; font-size: 1.1rem; }
.ks2-key-code { font-size: 1.2rem; letter-spacing: 1px; }
.ks2-allset { text-align: center; margin: 0 auto; }
.ks2-allset .ks2-avatar-lg { margin: 0 auto 8px; }
.ks2-allset .ks2-actions { justify-content: center; }

/* family preferences on html */
.ks2-reduce-motion *, .ks2-reduce-motion *::before, .ks2-reduce-motion *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
.ks2-dys body.ks2-page-app { letter-spacing: 0.02em; word-spacing: 0.08em; line-height: 1.7; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
@media (max-width: 600px) {
  .ks2-header-row { padding: 10px 0; }
  .ks2-card, .ks2-kid { padding: 16px; }
  .ks2-handover { padding: 18px; }
  .ks2-codes { columns: 1; }
}

/* S7: unfinished work waiting under a subject tile. */
.ks2-tile-note { display: inline-block; margin-top: 6px; padding: 2px 10px; border-radius: 999px; background: var(--ink); color: #fff; font: 600 0.875rem/1.4 var(--font-display); }

/* Two-step set-up in Family settings (S20): a QR code made on this site, and actions for recovery codes. */
.ks2-qr { display: block; width: 220px; height: 220px; max-width: 100%; border: 1px solid var(--ks2-line, #d6e1f0); border-radius: 8px; background: #fff; }
.ks2-code-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.ks2-btn-small { padding: 0.3rem 0.7rem; font-size: 0.95rem; min-height: 0; }
.ks2-topic-more { width: 100%; }
.ks2-topic-more summary { cursor: pointer; }
.ks2-topic-more p { margin: 0.25rem 0 0.5rem; }
