/*
 * Speakband on the web.
 *
 * One column, centred, at most 560px wide. This is a page somebody opens to
 * speak into for two minutes, not a site to browse: everything that is not the
 * question, the button and the verdict is in the way of that.
 *
 * The palette is the brand's own (docs/brand/brand-guide.md). Amber is reserved
 * for progress and streaks and does not appear here.
 */

:root {
  --green: #0b7a63;
  --green-dark: #08594a;
  --green-light: #14907a;
  --mint: #e3f0eb;
  --ink: #10221d;
  --muted: #5c6f69;
  --line: #d7e5df;
  --paper: #ffffff;
  --ground: #f6faf8;
  --danger: #b3261e;
}

@media (prefers-color-scheme: dark) {
  :root {
    --mint: #123029;
    --ink: #eaf3f0;
    --muted: #9db3ac;
    --line: #24403a;
    --paper: #12211d;
    --ground: #0c1714;
  }
}

* { box-sizing: border-box; }

/*
 * Everything on this page is shown and hidden through the `hidden` attribute,
 * and the browser's own `[hidden] { display: none }` is the weakest rule there
 * is: any class below that sets `display` beats it on specificity alone. The
 * first run of this page showed "Plans" and "Sign out" to a signed-out
 * visitor for exactly that reason — `.link { display: block }`. So the
 * attribute is made to win, once, here.
 */
[hidden] { display: none !important; }

body {
  margin: 0;
  padding: 0 20px 48px;
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--ground);
  overflow-x: hidden;
}

.bar {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 560px;
  margin: 0 auto;
  padding: 16px 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  text-decoration: none;
}

/* The tile, not the bare mark: this header sits on white in the day and on
   near-black at night, and the tile brings its own background to both. */
.mark { width: 26px; height: 26px; display: block; }
.wordmark { font-weight: 600; font-size: 17px; letter-spacing: -0.01em; }

nav { margin-left: auto; display: flex; align-items: center; gap: 14px; }

nav > * { white-space: nowrap; }

.left { font-size: 13px; color: var(--muted); }

/* On a phone the four items do not fit beside the wordmark, and squeezing them
   breaks each one across two lines — "Sign / out". Give them their own row. */
@media (max-width: 460px) {
  .bar { flex-wrap: wrap; row-gap: 10px; padding-bottom: 12px; }
  nav { width: 100%; margin-left: 0; justify-content: flex-start; gap: 18px; }
}

.card {
  max-width: 560px;
  margin: 0 auto;
  padding: 28px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 18px;
}

h1 { font-size: 24px; line-height: 1.2; margin: 0 0 10px; }
h2 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em;
     color: var(--muted); margin: 0 0 6px; }

.lede { color: var(--muted); margin: 0 0 20px; }
.fine { color: var(--muted); font-size: 13px; margin: 16px 0 0; }

.task {
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted); margin: 0 0 6px;
}

/* `pre-line`, because a cue card is written as one: a line, then "You should
   say:", then three bullets, then the line that starts "And explain". The
   server stores it exactly like that and HTML was folding it into a paragraph,
   which is the one layout the exam never uses. */
.question {
  font-size: 21px; line-height: 1.35; margin: 0 0 24px; white-space: pre-line;
}

/* ── The sitting ─────────────────────────────────────────────────────── */

/* Six marks, one per answer of a whole test, above the question. Countable
   rather than a percentage, because a test is a fixed set of questions. */
.sitting { margin: 0 0 18px; }

.marks { display: flex; gap: 4px; }

/* `.tick`, not `.mark`: the brand mark in the header already owns that name,
   and the later rule won — the logo rendered as a 4px line. */
.tick {
  flex: 1; height: 4px; border-radius: 2px; background: var(--line);
}

.tick.done { background: var(--green); }

.sitting-line {
  display: flex; justify-content: space-between; gap: 12px;
  margin: 7px 0 0; font-size: 12px; color: var(--muted);
}

label { display: block; margin-bottom: 14px; font-size: 13px; color: var(--muted); }

input {
  display: block; width: 100%; margin-top: 5px; padding: 12px 14px;
  font: inherit; color: var(--ink); background: var(--ground);
  border: 1px solid var(--line); border-radius: 12px;
}

input:focus { outline: 2px solid var(--green-light); outline-offset: 1px; }

/* The raised pill, the same idiom as the app's own PrimaryButton: the face
   sits above a darker edge and sinks onto it under a press, and the depth is
   paid for out of reserved space so the row never changes height. */
.primary {
  display: block; width: 100%; padding: 14px 20px 18px;
  font: 600 16px/1.2 inherit; color: #fff; background: var(--green);
  border: 0; border-radius: 999px; box-shadow: 0 4px 0 var(--green-dark);
  cursor: pointer; text-align: center; text-decoration: none;
  transition: transform 80ms ease, box-shadow 80ms ease;
}

.primary:active:not(:disabled) {
  transform: translateY(4px); box-shadow: 0 0 0 var(--green-dark);
}

.primary:disabled { opacity: 0.6; cursor: default; }
.record.recording { background: var(--danger); box-shadow: 0 4px 0 #7d1a15; }

.link {
  display: block; width: 100%; margin-top: 12px; padding: 8px;
  font: inherit; color: var(--green); background: none; border: 0;
  cursor: pointer;
}

nav .link { width: auto; margin: 0; padding: 0; font-size: 13px; }

.timer {
  margin: 10px 0 0; text-align: center; color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ── The minute before the long turn ──────────────────────────────────── */

.prep {
  margin: 0 0 20px; padding: 16px; border-radius: 14px;
  background: var(--mint);
}

.prep-line {
  margin: 0 0 10px; font-size: 14px; font-variant-numeric: tabular-nums;
}

.prep textarea {
  display: block; width: 100%; padding: 10px 12px; resize: vertical;
  font: inherit; font-size: 15px; color: var(--ink); background: var(--paper);
  border: 1px solid var(--line); border-radius: 10px;
}

.prep textarea:focus { outline: 2px solid var(--green-light); outline-offset: 1px; }
.prep .fine { margin: 6px 0 12px; font-size: 12px; }
.prep .primary { padding: 10px 16px 14px; font-size: 15px; }

.status {
  margin: 16px 0 0; padding: 12px 14px; border-radius: 12px;
  background: var(--mint);
}

.error { color: var(--danger); margin: 0 0 10px; }

/* ── The verdict ─────────────────────────────────────────────────────── */

.verdict { margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--line); }

.band { display: flex; align-items: baseline; gap: 8px; }
.band-value { font-size: 44px; font-weight: 700; color: var(--green); line-height: 1; }
.band-label { font-size: 12px; text-transform: uppercase; color: var(--muted); }

.criteria, .fixes, .plan-list { list-style: none; margin: 16px 0 0; padding: 0; }

.criteria li {
  display: flex; justify-content: space-between; gap: 16px;
  padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px;
}

.criteria li:last-child { border-bottom: 0; }
.criteria .score { font-variant-numeric: tabular-nums; font-weight: 600; }

/* The card over a verdict that is only half shown. Grey rather than loud: the
   band above it is the good news, and this is the quiet part underneath. */
.locked {
  background: #f4f5f7;
  border: 1px solid #e2e5ea;
  border-radius: 12px;
  padding: 14px;
}
.locked h2 { margin: 0 0 8px; font-size: 15px; }
.locked ul { margin: 0 0 10px; padding-left: 18px; }
.locked li { margin: 3px 0; }
.locked .kept { margin: 0 0 12px; color: #5b6472; }
.locked .primary { width: 100%; }

.hint {
  margin: 12px 0 0; padding: 10px 12px; border-radius: 10px;
  background: var(--ground); border: 1px solid var(--line);
  font-size: 13px; color: var(--muted);
}

.block { margin-top: 20px; }
.fixes li { padding: 7px 0; font-size: 15px; }
.fixes del { color: var(--muted); text-decoration-thickness: 1px; }
.fixes ins { color: var(--green); text-decoration: none; font-weight: 600; }

.better { margin: 0; font-style: italic; }
.encouragement { margin: 20px 0 0; color: var(--muted); font-size: 14px; }

/* ── The report ──────────────────────────────────────────────────────── */

/* The band here is the sitting's, not one answer's, so it stands alone above
   the line that says how much of the test it is made of. */
#report .band { margin-bottom: 4px; }
#report .fine { margin-top: 0; }
#report .primary { margin-top: 24px; }

.empty { color: var(--muted); }

.tag {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em;
  padding: 2px 7px; border-radius: 999px; white-space: nowrap;
}

.tag.best { color: var(--green); background: var(--mint); }
.tag.worst { color: var(--danger); background: rgba(179, 38, 30, 0.10); }

.fixes .why { margin: 3px 0 0; font-size: 13px; color: var(--muted); }

/* ── Progress ────────────────────────────────────────────────────────── */

.figures { display: flex; gap: 12px; margin-top: 4px; }

.figure {
  flex: 1; padding: 14px; text-align: center;
  background: var(--ground); border: 1px solid var(--line); border-radius: 14px;
}

.figure-value {
  display: block; font-size: 26px; font-weight: 700; color: var(--green);
  line-height: 1.1; font-variant-numeric: tabular-nums;
}

.figure-label {
  display: block; margin-top: 3px; font-size: 12px; color: var(--muted);
}

/* Two weeks of days, each a column. A day with nothing in it keeps its column
   — a fortnight with three bars in it is the honest picture of a fortnight
   with three days of practice in it. */
.trend {
  display: flex; align-items: flex-end; gap: 4px; height: 118px;
  padding: 10px; background: var(--ground);
  border: 1px solid var(--line); border-radius: 14px;
}

/* `.day`, not `.bar`: the page header is already `.bar`, and the second rule
   won — the header was being laid out as a chart column. Same trap as `.mark`.
   Nothing on this page may reuse a name that is already a layout. */
.day { flex: 1; height: 100%; display: flex; align-items: flex-end; }

.day-fill {
  display: block; width: 100%; border-radius: 3px 3px 0 0;
  background: var(--green); min-height: 2px;
}

.day-fill.empty { background: var(--line); }

.answers { list-style: none; margin: 12px 0 0; padding: 0; }

.answers li {
  display: flex; gap: 14px; align-items: baseline;
  padding: 10px 0; border-bottom: 1px solid var(--line);
}

.answers li:last-child { border-bottom: 0; }

.answer-band {
  font-size: 17px; font-weight: 700; color: var(--green);
  font-variant-numeric: tabular-nums; min-width: 2.2em;
}

.answer-question { margin: 0; font-size: 15px; }
.answer-when { margin: 2px 0 0; font-size: 12px; color: var(--muted); }

#progress .primary { margin-top: 24px; }

/* ── Plans ───────────────────────────────────────────────────────────── */

.plan-list li {
  padding: 16px; margin-bottom: 12px;
  border: 1px solid var(--line); border-radius: 14px;
}

.plan-list .name { font-weight: 600; }
.plan-list .what { color: var(--muted); font-size: 14px; margin: 4px 0 12px; }
.plan-list .primary { padding: 10px 16px 14px; font-size: 15px; }
.plan-list .primary + .primary { margin-left: 8px; }
