/* ==========================================================================
   KRS pupil app — Phase 0
   Look: a maths exercise book. Faint 5mm grid paper, ink-navy text,
   one marker-yellow accent. Big tap targets (classroom tablets).
   ========================================================================== */

:root {
  --paper:      #fdfdfa;
  --grid-line:  rgba(30, 60, 110, 0.07);
  --ink:        #1b2a4a;   /* deep exercise-book ink */
  --ink-soft:   #5a6a8a;
  --marker:     #ffd23f;   /* highlighter yellow — the one accent */
  --marker-ink: #3a2f00;
  --green:      #1e7d45;
  --amber:      #b0700a;
  --red:        #b3372e;
  --card-bg:    #ffffff;
  --radius:     14px;
  --shadow:     0 2px 10px rgba(27, 42, 74, 0.10);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background-color: var(--paper);
  /* 5mm squared paper */
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 22px 22px;
  min-height: 100vh;
}

.screen {
  max-width: 560px;
  margin: 0 auto;
  padding: 16px;
}

/* ---------- Buttons: big thumbs, honest labels ---------- */

.btn {
  font: inherit;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: var(--card-bg);
  color: var(--ink);
  padding: 12px 18px;
  cursor: pointer;
  min-height: 48px;                 /* tap target floor */
  transition: transform 0.06s ease, background 0.15s ease;
}
.btn:active { transform: scale(0.98); }
.btn:focus-visible { outline: 3px solid var(--marker); outline-offset: 2px; }
.btn:disabled { opacity: 0.45; cursor: default; }

.btn-primary { background: var(--ink); color: #fff; }
.btn-big { width: 100%; font-size: 1.1rem; padding: 16px; margin-top: 16px; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--ink-soft); }

/* ---------- Login ---------- */

.login-card {
  margin-top: 14vh;
  background: var(--card-bg);
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 24px;
}
.brand { text-align: center; margin-bottom: 20px; }
.brand h1 { margin: 8px 0 4px; font-size: 1.5rem; }
.brand-sub { margin: 0; color: var(--ink-soft); font-size: 0.95rem; }
.brand-tick {
  display: inline-grid; place-items: center;
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--marker); color: var(--marker-ink);
  font-size: 1.6rem; font-weight: 700;
}
label { display: block; font-weight: 600; margin: 12px 0 6px; }
input[type="text"] {
  width: 100%; font: inherit; font-size: 1.15rem;
  padding: 12px 14px; border: 2px solid var(--ink); border-radius: 10px;
  background: #fff; color: var(--ink);
}
input[type="text"]:focus-visible { outline: 3px solid var(--marker); outline-offset: 1px; }
.error { color: var(--red); font-weight: 600; }

/* ---------- Dashboard ---------- */

.app-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 0 14px;
}
.alias-chip, .progress-chip, .strand-chip {
  background: var(--ink); color: #fff;
  padding: 6px 14px; border-radius: 999px; font-weight: 600; font-size: 0.9rem;
}
.strand-chip { background: var(--marker); color: var(--marker-ink); }

.today-tile {
  background: var(--card-bg); border: 2px solid var(--ink);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px;
}
.today-numbers { display: flex; gap: 28px; justify-content: center; }
.stat { text-align: center; }
.stat-n { display: block; font-size: 2.6rem; font-weight: 800; line-height: 1; }
.stat-label { color: var(--ink-soft); font-size: 0.9rem; }

.section-title { font-size: 1.05rem; margin: 24px 0 10px; }
.strength-map { display: grid; gap: 10px; }
.strand-block {
  background: var(--card-bg); border: 2px solid var(--ink);
  border-radius: var(--radius); padding: 12px 16px;
}
.strand-block h3 { margin: 0 0 8px; font-size: 0.95rem; }
.kc-dots { display: flex; flex-wrap: wrap; gap: 8px; }
.kc-dot {
  width: 16px; height: 16px; border-radius: 50%;
  border: 1.5px solid rgba(0,0,0,0.25);
}
.kc-dot.green { background: var(--green); }
.kc-dot.amber { background: var(--amber); }
.kc-dot.red   { background: var(--red); }
.muted { color: var(--ink-soft); }

/* ---------- Retrieval loop ---------- */

.card-panel {
  background: var(--card-bg); border: 2px solid var(--ink);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 22px; min-height: 300px;
}
.card-face { font-size: 1.15rem; line-height: 1.55; }
.card-face .katex { font-size: 1.15em; }
.card-back { border-top: 3px solid var(--marker); margin-top: 18px; padding-top: 16px; }

.block-steps { margin: 10px 0 0; padding-left: 22px; }
.block-steps li { margin: 4px 0; }
.block-pitfall {
  margin-top: 12px; padding: 10px 14px;
  background: #fff6f5; border-left: 4px solid var(--red);
  border-radius: 6px; font-size: 1rem;
}
.block-pitfall::before { content: "⚠ Watch out: "; font-weight: 700; color: var(--red); }
.accept-note { color: var(--ink-soft); font-size: 0.95rem; margin: 10px 0 0; }
.accept-note::before { content: "Also accepted: "; font-weight: 600; }

.phase { margin-top: 20px; }
.phase-question { font-weight: 700; margin: 14px 0 10px; }

/* Think-time ring — the signature element */
.think-gate { display: flex; align-items: center; gap: 14px; margin-top: 8px; }
.think-ring { width: 52px; height: 52px; transform: rotate(-90deg); flex: 0 0 auto; }
.ring-track { fill: none; stroke: var(--grid-line); stroke-width: 5; }
.ring-fill  {
  fill: none; stroke: var(--marker); stroke-width: 5; stroke-linecap: round;
  stroke-dasharray: 119.4;                       /* 2πr, r=19 */
  stroke-dashoffset: 119.4;
}
.think-hint { color: var(--ink-soft); font-size: 0.95rem; }

.choice-row { display: flex; gap: 10px; }
.choice-row .btn-choice { flex: 1; display: grid; gap: 4px; justify-items: center; padding: 12px 6px; }
.face { font-size: 1.5rem; }
.choice-col { display: grid; gap: 10px; }

.outcome-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn-outcome { font-weight: 600; }
.btn-outcome.o1 { border-color: var(--green); color: var(--green); }
.btn-outcome.o2 { border-color: var(--green); color: var(--green); border-style: dashed; }
.btn-outcome.o3 { border-color: var(--amber); color: var(--amber); }
.btn-outcome.o4 { border-color: var(--red);   color: var(--red); }

/* ---------- Done + sync banner ---------- */

.done-card {
  margin-top: 16vh; text-align: center;
  background: var(--card-bg); border: 2px solid var(--ink);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 36px 24px;
}
.done-tick {
  display: inline-grid; place-items: center;
  width: 64px; height: 64px; border-radius: 50%;
  background: var(--marker); color: var(--marker-ink);
  font-size: 2rem; font-weight: 800;
}

.sync-banner {
  position: sticky; top: 0; z-index: 10;
  background: var(--marker); color: var(--marker-ink);
  text-align: center; padding: 8px 14px; font-weight: 600; font-size: 0.95rem;
}

@media (max-width: 400px) {
  .outcome-grid { grid-template-columns: 1fr; }
  .today-numbers { gap: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  .btn, .ring-fill { transition: none !important; }
}
