/* HomeTutor — "maths copybook" look: graph paper, ballpoint blue, highlighter yellow, teacher's red pen. Light only. */
:root {
  color-scheme: only light;
  --paper: #f7faff;      /* exercise-book white with a hint of blue */
  --grid: #e3ecf9;       /* graph-paper squares */
  --ink: #1f2a44;        /* pencil/ink text */
  --muted: #5b6785;
  --line: #d8e2f2;
  --card: #ffffff;
  --blue: #3d5afe;       /* ballpoint blue: main actions */
  --blue-deep: #2a3eb1;
  --blue-soft: #e8edff;
  --yellow: #ffd23f;     /* highlighter */
  --yellow-soft: #fff6d6;
  --green: #17a673;      /* ticks */
  --green-soft: #e2f7ee;
  --red: #e5484d;        /* teacher's red pen */
  --red-soft: #fde8e8;
  --amber: #c27c0e;
  --amber-soft: #fff1d6;
  --radius: 18px;

  /* aliases used by the pages */
  --bg: var(--paper); --text: var(--ink); --brand: var(--blue); --brand-text: #ffffff;
  --brand-soft: var(--blue-soft); --accent: var(--yellow);
  --good: var(--green); --good-soft: var(--green-soft);
  --mid: var(--amber); --mid-soft: var(--amber-soft);
  --bad: var(--red); --bad-soft: var(--red-soft);

  --font-display: "Baloo 2", "Trebuchet MS", sans-serif;
  --font-body: "Lexend", "Segoe UI", sans-serif;
  --font-hand: "Gochi Hand", "Comic Sans MS", cursive;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  color: var(--ink);
  font: 16px/1.55 var(--font-body);
  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-font-smoothing: antialiased;
}
a { color: var(--blue); }
/* Samsung Internet ignores "color-scheme: only light" and force-darkens pages when the phone is in
   dark mode, unless the site has its own dark-mode styles. This block is our "dark mode": it keeps
   the same light copybook look, so Samsung leaves the page alone. */
@media (prefers-color-scheme: dark) {
  html, body { color-scheme: only light; background-color: var(--paper); color: var(--ink); }
  input, select, textarea { background-color: #fff; color: var(--ink); }
}
main { max-width: 640px; margin: 0 auto; padding: 18px 16px 100px; }
h1, h2, h3, .headline, .logo { font-family: var(--font-display); letter-spacing: -0.01em; }
h1 { font-size: 30px; line-height: 1.15; font-weight: 800; margin: 10px 0 6px; }
h2 { font-size: 20px; line-height: 1.2; font-weight: 700; margin: 0 0 8px; }
h3 { font-size: 16px; font-weight: 700; margin: 14px 0 4px; }
p { margin: 6px 0; }
.muted { color: var(--muted); font-size: 14px; }
.small { font-size: 13px; }
.hidden { display: none !important; }
:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; border-radius: 6px; }

/* ---------- top bar: like the top of a copybook page ---------- */
.topbar { position: sticky; top: 0; z-index: 5; background: var(--card); border-bottom: 2px solid var(--line); }
.topbar::after { content: ""; display: block; height: 2px; background: var(--red); opacity: .55; }
.topbar-inner { max-width: 640px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 10px; }
.logo { font-weight: 800; font-size: 24px; color: var(--ink); text-decoration: none; line-height: 1; }
.logo span { color: var(--blue); }
.child-pill { margin-left: auto; background: var(--yellow); color: var(--ink); border-radius: 999px; padding: 6px 14px;
  font-family: var(--font-display); font-size: 16px; font-weight: 700; text-decoration: none; white-space: nowrap; }

/* ---------- bottom nav ---------- */
.bottomnav { position: fixed; bottom: 0; left: 0; right: 0; background: var(--card); border-top: 2px solid var(--line); z-index: 5;
  padding-bottom: env(safe-area-inset-bottom); }
.bottomnav-inner { max-width: 640px; margin: 0 auto; display: grid; grid-template-columns: repeat(4, 1fr); }
.bottomnav a { text-align: center; padding: 8px 4px 10px; font-size: 12px; color: var(--muted); text-decoration: none; font-weight: 500; }
.bottomnav a .ic { display: block; font-size: 22px; line-height: 1.25; }
.bottomnav a.active { color: var(--blue); font-weight: 700; }
.bottomnav a.active .ic { transform: scale(1.12); }

/* ---------- cards ---------- */
.card { background: var(--card); border: 2px solid var(--line); border-radius: var(--radius); padding: 18px; margin: 14px 0; }
.card.tint-good { background: var(--green-soft); border-color: #bfe9d6; }
.card.tint-bad { background: var(--red-soft); border-color: #f7c9ca; }
.card.tint-mid { background: var(--amber-soft); border-color: #f5dca6; }
.card.tint-brand { background: var(--yellow-soft); border-color: #f7e39a; }

/* ---------- forms ---------- */
label { display: block; font-size: 14px; font-weight: 500; color: var(--muted); margin: 14px 0 6px; }
input[type=text], input[type=email], input[type=password], select {
  width: 100%; padding: 13px 14px; font-size: 16px; font-family: var(--font-body);
  border: 2px solid var(--line); border-radius: 14px; background: #fff; color: var(--ink); }
input:focus, select:focus { border-color: var(--blue); outline: none; }
.check { display: flex; gap: 10px; align-items: flex-start; margin-top: 16px; font-size: 14px; }
.check input { margin-top: 3px; width: 20px; height: 20px; flex: none; accent-color: var(--blue); }

/* ---------- buttons: chunky, press down when tapped ---------- */
.btn { display: inline-block; padding: 14px 20px; font: 700 17px/1.2 var(--font-display); border-radius: 16px; border: none;
  cursor: pointer; background: var(--blue); color: #fff; text-decoration: none; text-align: center;
  box-shadow: 0 4px 0 var(--blue-deep); transition: transform .06s, box-shadow .06s; }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--blue-deep); }
.btn.block { display: block; width: 100%; }
.btn.ghost { background: #fff; color: var(--ink); border: 2px solid var(--line); box-shadow: 0 4px 0 var(--line); }
.btn.ghost:active { box-shadow: 0 1px 0 var(--line); }
.btn.small { padding: 9px 14px; font-size: 15px; border-radius: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1; }

.tabs { display: flex; background: var(--blue-soft); border-radius: 16px; padding: 5px; margin: 14px 0; }
.tabs button { flex: 1; padding: 11px; border: none; background: transparent; border-radius: 12px; font: 700 16px var(--font-display);
  color: var(--muted); cursor: pointer; }
.tabs button.on { background: #fff; color: var(--ink); box-shadow: 0 2px 0 var(--line); }

.msg { margin-top: 12px; font-size: 14px; }
.msg.err { color: var(--red); font-weight: 500; }
.msg.ok { color: var(--green); font-weight: 500; }
.toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); background: var(--ink); color: #fff;
  padding: 11px 18px; border-radius: 14px; font-size: 14px; z-index: 20; max-width: 90vw; }

/* ---------- lists, chips, dots ---------- */
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 2px dashed var(--line); }
.list-item:first-child { border-top: none; }
.list-item .grow { flex: 1; min-width: 0; }
.dot { width: 14px; height: 14px; border-radius: 50%; flex: none; }
.dot.good { background: var(--green); } .dot.mid { background: var(--yellow); box-shadow: inset 0 0 0 2px var(--amber); } .dot.bad { background: var(--red); }
.chip { display: inline-block; border-radius: 999px; padding: 3px 11px; font-size: 13px; font-weight: 600; background: var(--blue-soft); color: var(--blue-deep); }
.chip.good { background: var(--green-soft); color: #0f7a54; }
.chip.mid { background: var(--yellow); color: var(--ink); }
.chip.bad { background: var(--red-soft); color: #b42328; }

/* ---------- dashboard numbers ---------- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { background: var(--card); border: 2px solid var(--line); border-radius: 16px; padding: 12px 6px; text-align: center; font-size: 13px; }
.stat b { display: block; font: 800 34px/1.1 var(--font-display); }
.stat.good b { color: var(--green); } .stat.mid b { color: var(--amber); } .stat.bad b { color: var(--red); }

/* ---------- upload ---------- */
.drop { border: 3px dashed #9fb3ec; border-radius: 22px; padding: 30px 16px; text-align: center; background: var(--blue-soft);
  color: var(--ink); font-size: 14px; margin: 0; }
.drop b { color: var(--blue-deep); }
.drop b { font: 800 22px var(--font-display); display: block; }
.drop .big { font-size: 48px; line-height: 1.1; }
.preview { max-width: 100%; max-height: 300px; border-radius: 14px; display: block; margin: 14px auto 0; border: 2px solid var(--line); }
.file-card { display: flex; align-items: center; gap: 12px; margin: 14px 0 0; }
.file-card.hidden { display: none; }
.file-ic { font-size: 34px; line-height: 1; }
.spinner { width: 54px; height: 54px; margin: 8px auto 12px; border-radius: 50%;
  border: 6px solid var(--blue-soft); border-top-color: var(--blue); border-right-color: var(--yellow); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } .btn { transition: none; } }

/* ---------- confirm screen: the child's answers look handwritten ---------- */
.q { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; padding: 12px 0; border-top: 2px dashed var(--line); }
.q:first-child { border-top: none; }
.q .num { color: var(--muted); font-size: 13px; font-weight: 600; }
.q .text { font-family: var(--font-display); font-weight: 700; font-size: 19px; }
.q input { width: 84px; padding: 4px 8px; font: 26px/1.2 var(--font-hand); color: var(--blue-deep); text-align: center;
  border: none; border-bottom: 2px solid #b9c8ef; border-radius: 0; background: transparent; }
.q input:focus { border-bottom-color: var(--blue); outline: none; background: var(--blue-soft); }
.q .low input { background: var(--yellow); border-radius: 6px; }
.mark { width: 48px; height: 46px; border-radius: 14px; border: none; font: 32px/1 var(--font-hand); cursor: pointer; }
.mark.right { background: var(--green-soft); color: var(--green); }
.mark.wrong { background: var(--red-soft); color: var(--red); }
.q .ans-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.q .correct-note { font: 20px var(--font-hand); color: var(--red); }

/* ---------- report ---------- */
.headline { font-size: 28px; font-weight: 800; line-height: 1.15; margin: 4px 0; }
/* the score is written the way a teacher does: red pen, circled, a little tilted */
.score-big { display: inline-block; font: 34px/1 var(--font-hand); color: var(--red); border: 3px solid var(--red);
  border-radius: 50%; padding: 18px 14px; transform: rotate(-8deg); white-space: nowrap; }
.score-big:empty { display: none; }
ul.clean { padding-left: 20px; margin: 6px 0; }
ul.clean li { margin: 5px 0; }
.plan-item { display: flex; gap: 12px; padding: 7px 0; align-items: baseline; }
.plan-item .min { flex: none; width: 56px; font: 800 18px var(--font-display); color: var(--ink); background: var(--yellow);
  border-radius: 8px; text-align: center; padding: 1px 0; }
.seen { font-size: 14px; color: #b42328; font-weight: 600; }
.hand { font-family: var(--font-hand); font-size: 22px; color: var(--blue-deep); }
.hand.struck { text-decoration: line-through; text-decoration-color: var(--red); text-decoration-thickness: 2px; }
.empty { text-align: center; padding: 28px 12px; color: var(--muted); }
.empty .big { font-size: 48px; }

/* ---------- big choice buttons (purpose, test format) ---------- */
.choice { display: flex; gap: 14px; align-items: flex-start; width: 100%; text-align: left; margin: 12px 0; padding: 16px;
  background: #fff; border: 2px solid var(--line); border-radius: var(--radius); box-shadow: 0 4px 0 var(--line);
  font: inherit; color: var(--ink); cursor: pointer; }
.choice:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--line); }
.choice b { display: block; font: 800 21px/1.2 var(--font-display); margin-bottom: 2px; }
.choice .muted { display: block; }
.choice-ic { font-size: 34px; line-height: 1; flex: none; }
.choice.on { border-color: var(--blue); background: var(--blue-soft); box-shadow: 0 4px 0 var(--blue); }
.choice-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.choice-row .choice { flex-direction: column; gap: 8px; margin: 0; }
.choice-row .choice b { font-size: 19px; }

/* ---------- in-app test (child mode) ---------- */
.progress { display: flex; gap: 6px; margin: 6px 0 16px; }
.progress span { flex: 1; height: 8px; border-radius: 99px; background: var(--line); }
.progress span.done { background: var(--blue); }
.progress span.now { background: var(--yellow); }
.test-q { font: 700 26px/1.3 var(--font-display); margin: 6px 0 18px; }
.opt { display: block; width: 100%; text-align: left; margin: 10px 0; padding: 15px 16px; font: 600 19px/1.3 var(--font-body);
  background: #fff; border: 2px solid var(--line); border-radius: 16px; box-shadow: 0 4px 0 var(--line); color: var(--ink); cursor: pointer; }
.opt.on { border-color: var(--blue); background: var(--blue-soft); box-shadow: 0 4px 0 var(--blue); }
.answer-box { width: 100%; padding: 12px 14px; font: 30px/1.2 var(--font-hand); color: var(--blue-deep); background: #fff;
  border: 2px solid var(--line); border-radius: 16px; }
.answer-box:focus { border-color: var(--blue); outline: none; }
.result-q { padding: 12px 0; border-top: 2px dashed var(--line); }
.result-q:first-child { border-top: none; }
.result-q .explain { font-size: 14px; color: var(--muted); margin-top: 2px; }
.big-score { text-align: center; margin: 10px 0 4px; }
.big-score .score-big { font-size: 46px; padding: 26px 18px; }

/* ---------- printable test ---------- */
.print-sheet { background: #fff; border: 2px solid var(--line); border-radius: var(--radius); padding: 22px; }
.print-sheet h1 { font-size: 26px; margin-top: 0; }
.print-meta { display: flex; gap: 18px; flex-wrap: wrap; margin: 6px 0 14px; font-size: 15px; }
.print-meta span { flex: 1; min-width: 140px; border-bottom: 1.5px solid var(--ink); padding-bottom: 2px; }
.pq { padding: 12px 0; border-top: 1px dashed #b9c8ef; break-inside: avoid; }
.pq:first-of-type { border-top: none; }
.pq .qtext { font-weight: 600; }
.pq .opts { display: flex; flex-wrap: wrap; gap: 6px 22px; margin-top: 6px; }
.pq .opts span::before { content: "○ "; font-size: 18px; }
.pq .line { border-bottom: 1.5px solid #9aa6c2; height: 34px; margin-top: 4px; }
.pq .line.short { width: 45%; }
.key { margin-top: 18px; }
.key-list { columns: 2; font-size: 14px; }
@media print {
  body { background: #fff; }
  .topbar, .bottomnav, .no-print { display: none !important; }
  main { padding: 0; max-width: none; }
  .print-sheet { border: none; padding: 0; }
  .key { break-before: page; }
}
.mark-inline { font: 30px/1 var(--font-hand); width: 26px; text-align: center; }
.mark-inline.right { color: var(--green); } .mark-inline.wrong { color: var(--red); }
textarea { width: 100%; padding: 13px 14px; font: 17px/1.5 var(--font-body); border: 2px solid var(--line); border-radius: 14px;
  background: #fff; color: var(--ink); resize: vertical; }
textarea:focus { border-color: var(--blue); outline: none; }
.examples { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.examples .chip { border: none; cursor: pointer; font-family: var(--font-body); padding: 7px 12px; font-size: 14px; }

/* ---------- subjects on the progress page ---------- */
.subject-block { padding: 12px 0; border-top: 2px dashed #f5dca6; }
.subject-block:first-child { border-top: none; padding-top: 4px; }
.subject-head { display: flex; justify-content: space-between; align-items: baseline; font-family: var(--font-display); font-size: 18px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 10px; }
details.subject { border-top: 2px dashed var(--line); }
details.subject:first-of-type { border-top: none; }
details.subject summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center;
  padding: 12px 0; font: 700 19px var(--font-display); }
details.subject summary::-webkit-details-marker { display: none; }
details.subject summary::after { content: "▾"; margin-left: 10px; color: var(--muted); transition: transform .15s; }
details.subject[open] summary::after { transform: rotate(180deg); }
details.subject summary .counts { margin-left: auto; display: flex; gap: 4px; }
details.subject summary .counts .chip { min-width: 28px; text-align: center; }
.bottomnav-inner { grid-template-columns: repeat(5, 1fr); }
.bottomnav a { font-size: 11px; }

/* ---------- progress page v2 ---------- */
.card.focus { border-color: #f7c9ca; background: #fff; }
.focus-item { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-top: 2px dashed var(--line); }
.focus-item:first-child { border-top: none; padding-top: 4px; }
.focus-rank { flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--red-soft); color: #b42328;
  font: 800 17px/30px var(--font-display); text-align: center; }
.focus-item .why { font-size: 14px; margin-top: 4px; color: var(--ink); }
.subject-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.mastery { text-align: right; }
.mastery b { display: block; font: 800 34px/1 var(--font-display); color: var(--blue-deep); }
.stackbar { display: flex; height: 14px; border-radius: 99px; overflow: hidden; margin: 14px 0 6px; background: var(--line); gap: 2px; }
.stackbar span { display: block; }
.sb-good { background: var(--green); } .sb-mid { background: var(--yellow); } .sb-bad { background: var(--red); }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--muted); }
.legend .dot { display: inline-block; width: 10px; height: 10px; margin-right: 5px; vertical-align: middle; }
.summary-line { margin: 10px 0 4px; }
details.area { border-top: 2px dashed var(--line); }
details.area summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 11px 0; }
details.area summary::-webkit-details-marker { display: none; }
details.area summary .area-name { flex: 1; font-weight: 600; }
details.area summary .minibar { width: 70px; height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; }
details.area summary .minibar span { display: block; height: 100%; background: var(--blue); }
details.area summary .area-pct { width: 40px; text-align: right; font: 700 15px var(--font-display); }
details.area summary::after { content: "▾"; color: var(--muted); transition: transform .15s; }
details.area[open] summary::after { transform: rotate(180deg); }
details.area .topic { padding-left: 6px; }

/* ---------- exam prep ---------- */
input[type=date] { width: 100%; padding: 12px 14px; font: 16px var(--font-body); border: 2px solid var(--line); border-radius: 14px; background: #fff; color: var(--ink); }
.prep-subject h3 { font: 800 19px var(--font-display); margin: 10px 0 4px; }
.prep-area { border-top: 2px dashed var(--line); padding: 6px 0; }
.prep-area-head { display: flex; gap: 10px; align-items: center; margin: 6px 0; color: var(--ink); font-weight: 600; font-size: 15px; }
.prep-topic { display: flex; gap: 10px; align-items: center; margin: 4px 0 4px 26px; color: var(--ink); font-size: 15px; }
.prep-area input, .prep-topic input { width: 20px; height: 20px; accent-color: var(--blue); flex: none; }
.revision { background: #fff; border: 2px solid var(--line); border-radius: var(--radius); padding: 20px; }
.revision h1 { margin-top: 4px; }
.countdown { font: 700 17px var(--font-display); color: #b42328; }
.rev-section { border-top: 2px dashed #b9c8ef; padding: 10px 0 6px; break-inside: avoid; }
.rev-section h2 { font-size: 22px; margin: 6px 0; }
.rev-section h3 { color: var(--blue-deep); }
.rev-example { background: var(--blue-soft); border-radius: 12px; padding: 10px 14px; margin: 10px 0; }
.rev-example ol { margin: 6px 0; padding-left: 20px; }
.rev-watch { border-left: 4px solid var(--red); background: var(--red-soft); border-radius: 0 12px 12px 0; padding: 8px 12px; margin: 10px 0; }
.rev-check { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 6px 0; }
.reveal { border: none; background: var(--yellow); border-radius: 10px; padding: 6px 10px; font: 600 13px var(--font-body); cursor: pointer; flex: none; }
.rev-box { border-radius: 14px; padding: 12px 16px; margin: 14px 0; border: 2px solid var(--line); }
.rev-box.tint-brand { background: var(--yellow-soft); border-color: #f7e39a; }
.print-only { display: none; }
@media print {
  .print-only { display: block; }
  .revision { border: none; padding: 0; }
  .rev-answers { break-before: page; }
}
