/* Harry Academy brand tokens (from the poster site) */
:root {
  --paper: #f5f7f8;
  --panel: #ffffff;
  --ink: #101826;
  --ink-soft: #4b5666;
  --line: #dfe4e7;
  --accent: #1aa5be;
  --accent-ink: #0b6e80;
  --accent-tint: #e6f5f8;
  --danger: #c14343;
  --ok: #2f8a4c;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16,24,38,.06), 0 8px 24px -12px rgba(16,24,38,.18);
  --font: 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Playfair Display', Georgia, serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #12171d;
    --panel: #1a2028;
    --ink: #eef1f4;
    --ink-soft: #a9b3bf;
    --line: #2a323c;
    --accent: #3fc3da;
    --accent-ink: #8fe3f0;
    --accent-tint: #182b30;
    --danger: #e07070;
    --ok: #62c283;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px -12px rgba(0,0,0,.5);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.55 var(--font);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.brand-mark {
  width: 34px;
  height: 43px;
  padding: 3px;
  border-radius: 6px;
  background: #fff; /* logo has black strokes; keep a light chip in dark mode */
}
.brand-name { font-weight: 700; letter-spacing: .01em; }
.brand-sub { font-size: 13px; color: var(--ink-soft); }

main {
  max-width: 720px;
  margin: 24px auto;
  padding: 0 16px;
}
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}
h1 {
  font-family: var(--font-display);
  font-size: 28px;
  line-height: 1.2;
  margin: 0 0 8px;
}
.muted { color: var(--ink-soft); }

.btn {
  appearance: none;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font: 600 16px/1 var(--font);
  padding: 14px 20px;
  min-height: 48px;
  cursor: pointer;
}
.btn:hover { filter: brightness(1.05); }
.btn:focus-visible { outline: 3px solid var(--accent-ink); outline-offset: 2px; }
.btn[disabled] { opacity: .55; cursor: default; }
@media (prefers-color-scheme: dark) { .btn { color: #0b1a1f; } }

.status {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--accent-tint);
  font-size: 15px;
  white-space: pre-wrap;
  word-break: break-word;
}
.status.is-ok { border-left: 4px solid var(--ok); }
.status.is-error { border-left: 4px solid var(--danger); }
.status[hidden] { display: none; }

.footer { max-width: 720px; margin: 0 auto 24px; padding: 0 16px; font-size: 13px; }

/* ---------- test flow ---------- */
p { margin: 0 0 12px; }
.small { font-size: 14px; }
.eyebrow { font-size: 13px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--accent-ink); margin-bottom: 4px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; justify-content: flex-end; margin-top: 16px; }
.btn-ghost { background: transparent; color: var(--accent-ink); border: 1px solid var(--line); }
@media (prefers-color-scheme: dark) { .btn-ghost { color: var(--accent-ink); } }
.btn-sm { min-height: 36px; padding: 8px 12px; font-size: 14px; }

.form { display: grid; gap: 14px; margin-top: 16px; }
.form label { display: grid; gap: 6px; font-weight: 600; font-size: 15px; }
.form input:not([type=checkbox]) {
  font: 16px/1.4 var(--font); color: var(--ink); background: var(--paper);
  border: 1px solid var(--line); border-radius: 8px; padding: 12px; width: 100%;
}
.form input:focus, .answer:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.notice { background: var(--accent-tint); border-radius: 8px; padding: 14px; font-size: 14px; }
.notice p { margin: 6px 0 10px; }
.form .check { display: flex; gap: 10px; align-items: center; font-weight: 600; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }

.plan { border-collapse: collapse; width: 100%; margin: 4px 0 16px; }
.plan td { padding: 8px 0; border-bottom: 1px solid var(--line); }
.plan td:last-child { text-align: right; color: var(--ink-soft); }
.rules { padding-left: 20px; margin: 0 0 20px; }
.rules li { margin-bottom: 6px; }
.directions { font-size: 16px; }
.prompt { font-size: 17px; font-weight: 500; padding: 14px; border-left: 4px solid var(--accent); background: var(--accent-tint); border-radius: 0 8px 8px 0; }

.testbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; justify-content: space-between; align-items: center;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 16px; margin-bottom: 12px; font-weight: 600; font-size: 15px;
}
.timer { font-variant-numeric: tabular-nums; font-size: 20px; color: var(--accent-ink); }
.timer.is-low { color: var(--danger); }

.qnav { display: flex; gap: 8px; margin-bottom: 16px; }
.qnav button {
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--panel); color: var(--ink); font: 600 16px var(--font); cursor: pointer;
}
.qnav button.is-done { background: var(--accent-tint); border-color: var(--accent); }
.qnav button.is-current { background: var(--accent); border-color: var(--accent); color: #fff; }

.picture { margin: 0 0 12px; }
.picture img { display: block; width: 100%; max-height: 360px; object-fit: contain; border-radius: 8px; background: #fff; border: 1px solid var(--line); }
.words { text-align: center; font-size: 20px; font-weight: 700; margin-bottom: 12px; }
.words i { font-style: normal; color: var(--ink-soft); margin: 0 12px; font-weight: 400; }

.email { border: 1px solid var(--line); border-radius: 8px; padding: 14px; margin-bottom: 12px; background: var(--paper); font-size: 15px; }
.email dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin: 0 0 10px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.email dt { font-weight: 600; color: var(--ink-soft); }
.email dd { margin: 0; }
.email-body { white-space: pre-wrap; }

.answer {
  display: block; width: 100%; min-height: 260px; resize: vertical;
  font: 16px/1.6 var(--font); color: var(--ink); background: var(--paper);
  border: 1px solid var(--line); border-radius: 8px; padding: 12px;
}
.answer.short { min-height: 110px; }
.answer-meta { text-align: right; font-size: 13px; color: var(--ink-soft); margin-top: 4px; }

.modal { position: fixed; inset: 0; z-index: 20; background: rgba(16,24,38,.45); display: grid; place-items: center; padding: 16px; }
.modal-card { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; max-width: 420px; width: 100%; }

.progress { height: 8px; background: var(--accent-tint); border-radius: 4px; overflow: hidden; margin: 16px 0 8px; }
.progress div { height: 100%; background: var(--accent); transition: width .4s; }

.plan.summary td:last-child { color: var(--accent-ink); font-weight: 700; }
.estimate { text-align: center; background: var(--accent-tint); border-radius: var(--radius); padding: 18px 16px; margin: 8px 0 16px; }
.estimate-label { font-size: 14px; font-weight: 600; color: var(--ink-soft); }
.estimate-range { font-family: var(--font-display); font-size: 44px; line-height: 1.15; color: var(--accent-ink); }
.estimate-range span { font-family: var(--font); font-size: 18px; color: var(--ink-soft); margin-left: 6px; }
.estimate-level { font-weight: 700; margin-top: 2px; }
.result { border-top: 1px solid var(--line); padding: 16px 0; }
.result header { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.result h3 { margin: 0 0 8px; font-size: 17px; }
.score { font-weight: 700; color: var(--accent-ink); white-space: nowrap; }
.result details { font-size: 15px; }
.result summary { cursor: pointer; font-weight: 600; color: var(--accent-ink); }
.errs { padding-left: 20px; }
.errs li { margin: 8px 0; }
.errs s { color: var(--danger); }
.flag { font-size: 14px; color: var(--ink-soft); font-style: italic; }

@media (max-width: 480px) {
  main { margin: 16px auto; }
  .card { padding: 18px; }
  h1 { font-size: 24px; }
  .btn { width: 100%; }
  .row .btn { flex: 1; width: auto; }
  .qnav { justify-content: space-between; }
}

/* ---------- microphone ---------- */
.step-title { font-size: 17px; margin: 24px 0 10px; }
.meter { height: 10px; background: var(--accent-tint); border-radius: 5px; overflow: hidden; margin: 14px 0 6px; }
.meter div { height: 100%; width: 0; background: var(--ok); transition: width .08s linear; }
.field { display: grid; gap: 6px; font-weight: 600; font-size: 15px; margin-bottom: 4px; }
.field input { font: 16px/1.4 var(--font); color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 12px; width: 100%; }
.row-start { justify-content: flex-start; align-items: center; }
audio { width: 100%; margin-top: 12px; }
.uploads { padding-left: 20px; margin: 0 0 12px; }
.uploads li { margin: 8px 0; font-size: 15px; }
.uploads .err { color: var(--danger); }

/* ---------- speaking ---------- */
.choice { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; margin: 0; display: grid; gap: 10px; }
.choice legend { font-weight: 600; font-size: 15px; padding: 0 4px; }
.phase { font-weight: 700; font-size: 17px; color: var(--accent-ink); margin-bottom: 10px; }
.phase.is-rec { color: var(--danger); }
.phase.is-rec::before { content: ''; display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--danger); margin-right: 8px; vertical-align: 1px; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .3; } }
.read-text { font-size: 18px; line-height: 1.7; background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 16px; }
.context { font-style: italic; color: var(--ink-soft); }
.info { border: 1px solid var(--line); border-radius: 8px; padding: 14px; background: var(--paper); }
.info h3 { margin: 0 0 2px; font-size: 18px; }
.info table { border-collapse: collapse; width: 100%; margin: 10px 0; font-size: 15px; }
.info td { padding: 6px 4px; border-top: 1px solid var(--line); vertical-align: top; }
.info td:first-child { white-space: nowrap; font-weight: 600; padding-right: 12px; }
.section-title { font-family: var(--font-display); font-size: 24px; margin: 28px 0 8px; padding-top: 16px; border-top: 2px solid var(--accent); }
.transcript { font-style: italic; color: var(--ink-soft); }
