:root {
  --paper: #E8EDF1;      /* low-glare blue-grey page */
  --sheet: #F6F8FA;      /* reading surface */
  --ink: #1F2A44;        /* navy text, parent panel */
  --muted: #5B6780;
  --marigold: #F2B134;   /* record */
  --sage: #3E8E6A;       /* correct */
  --brick: #B8482E;      /* error */
  --line: #C9D2DC;
  --ui: "Atkinson Hyperlegible", "Verdana", system-ui, sans-serif;
  --word: "Lexend", "Verdana", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--paper); color: var(--ink); font-family: var(--ui);
  font-size: 18px; line-height: 1.5;
  padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px);
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--marigold); outline-offset: 2px; }

#app { min-height: 100%; display: flex; flex-direction: column; }

/* top bar */
.bar { display: flex; align-items: center; gap: 1rem; padding: .75rem 1.25rem; border-bottom: 1px solid var(--line); }
.bar .who { font-family: var(--word); font-weight: 600; }
.bar .where { color: var(--muted); flex: 1; }
.bar button { background: none; border: none; color: var(--muted); padding: .25rem .5rem; }
.bar button:hover { color: var(--ink); }

/* student stage */
.stage { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 2rem 1.25rem; text-align: center; gap: 1.5rem; }
.step-name { color: var(--muted); }
.word { font-family: var(--word); font-weight: 400; font-size: clamp(3.5rem, 13vw, 8rem);
  letter-spacing: .06em; line-height: 1.1; margin: 0; word-break: break-word; }
.prompt { font-family: var(--word); font-size: clamp(1.4rem, 3.5vw, 2rem); max-width: 30ch; margin: 0; }
.reading { background: var(--sheet); border: 1px solid var(--line); border-radius: 6px; padding: 1.5rem 1.75rem;
  max-width: 62ch; text-align: left; font-size: 1.3rem; line-height: 1.8; letter-spacing: .02em; }
.concept { max-width: 50ch; text-align: left; font-size: 1.25rem; }
.concept p { margin: 0 0 1rem; }

.round { width: 5.5rem; height: 5.5rem; border-radius: 50%; border: none; background: var(--marigold);
  color: var(--ink); font-weight: 700; display: grid; place-items: center; font-size: .95rem; }
.round.on { background: var(--brick); color: #fff; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.06); } }
@media (prefers-reduced-motion: reduce) { .round.on { animation: none; } }
.quiet { background: none; border: 1px solid var(--line); border-radius: 6px; padding: .6rem 1.1rem; color: var(--ink); }
.quiet:hover { border-color: var(--muted); }
.big { font-size: 1.15rem; padding: .9rem 1.6rem; border-radius: 6px; border: none; background: var(--ink); color: #fff;
  display: inline-block; text-decoration: none; }

.dev-banner { background: var(--marigold); color: var(--ink); font-weight: 700; text-align: center;
  padding: .4rem; font-size: .9rem; letter-spacing: .04em; }

/* parent panel */
.parent { background: var(--ink); color: #E6EBF2; padding: 1.1rem 1.25rem 1.4rem; }
.parent .inner { max-width: 60rem; margin: 0 auto; display: grid; gap: .8rem; }
.parent .label { color: #A9B4C7; font-size: .95rem; }
.parent .expect { font-size: .95rem; color: #CBD3E0; }
.parent details summary { cursor: pointer; color: #A9B4C7; }
.parent details[open] summary { margin-bottom: .3rem; }
.parent .row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.parent input[type=text], .parent input[type=number] { background: #2C3958; border: 1px solid #45547A;
  border-radius: 6px; padding: .55rem .75rem; color: #fff; min-width: 12rem; }
.parent input[type=number] { min-width: 6rem; width: 6rem; }
.mark { border: 1px solid #45547A; background: #2C3958; color: #fff; border-radius: 6px; padding: .55rem .9rem; }
.mark:hover { border-color: #8090B0; }
.mark.ok { background: var(--sage); border-color: var(--sage); font-weight: 700; }
.mark.go { background: var(--marigold); border-color: var(--marigold); color: var(--ink); font-weight: 700; }
.parent ol { margin: 0; padding-left: 1.3rem; }
.progress-dots { color: #A9B4C7; font-size: .9rem; }

/* home, login, progress */
.page { max-width: 44rem; margin: 0 auto; padding: 2.5rem 1.25rem; width: 100%; }
.page h1 { font-family: var(--word); font-weight: 600; font-size: 2.2rem; margin: 0 0 .25rem; }
.page h2 { font-family: var(--word); font-weight: 600; font-size: 1.3rem; margin: 2rem 0 .75rem; }
.page .sub { color: var(--muted); margin: 0 0 1.75rem; }
.field { display: grid; gap: .4rem; margin-bottom: 1rem; }
.field input, .field select { background: var(--sheet); border: 1px solid var(--line); border-radius: 6px; padding: .7rem .8rem; }
.check { display: flex; gap: .6rem; align-items: center; margin: 1rem 0; }
.note { color: var(--muted); font-size: .95rem; }
.error { color: var(--brick); }
.unit-list { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--line); }
.unit-list li { display: flex; gap: 1rem; padding: .6rem 0; border-bottom: 1px solid var(--line); }
.unit-list .n { width: 2rem; color: var(--muted); }
.unit-list .here { font-weight: 700; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .95rem; }
th, td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 400; }
.score { font-family: var(--word); font-size: 3rem; margin: 0; }

#toast { position: fixed; left: 50%; bottom: calc(1rem + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: .6rem 1rem; border-radius: 6px; opacity: 0; transition: opacity .2s; pointer-events: none; }
#toast.show { opacity: 1; }

@media (max-width: 600px) {
  body { font-size: 17px; }
  .bar .where { display: none; }
}
