/* ============================================================
   IELTS Speaking Mock — design tokens
   A calm exam room: deep teal ink on warm paper. Amber is reserved
   for the LIVE recording state and timers; teal-green marks the
   examiner (authoritative); indigo marks the candidate's own voice
   (self-assessment), so the two reads never blur in the comparison.
   ============================================================ */
:root {
  --ink:        #143b3a;
  --ink-deep:   #0c2a29;
  --paper:      #f3efe7;
  --surface:    #fbf9f4;
  --surface-2:  #efe9dd;
  --muted:      #5c6b69;
  --line:       rgba(20, 59, 58, 0.14);
  --line-strong:rgba(20, 59, 58, 0.28);
  --accent:     #cf6a1f;   /* LIVE / record / countdown only */
  --accent-soft:#f6e2d2;
  --good:       #2f7d68;   /* examiner / authoritative / positive */
  --good-soft:  #d9ece5;
  --self:       #5a4aa6;   /* candidate self-assessment */
  --self-soft:  #e6e1f4;
  --warn:       #b0521f;

  --radius:   14px;
  --radius-sm:10px;
  --shadow:   0 1px 2px rgba(12,42,41,.06), 0 8px 24px rgba(12,42,41,.07);
  --maxw: 760px;

  --display: "Fraunces", Georgia, "Times New Roman", serif;
  --ui: "Inter", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

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

/* ---------- layout ---------- */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 24px 20px 64px; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 18px 20px; max-width: var(--maxw); margin: 0 auto;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: -0.01em; }
.brand .mark {
  width: 26px; height: 26px; border-radius: 7px;
  background: var(--ink); color: var(--paper);
  display: grid; place-items: center; font-family: var(--display); font-size: 15px;
}
.brand small { color: var(--muted); font-weight: 500; }
.topnav { display: flex; gap: 16px; }
.topbar a, .topnav a { color: var(--muted); text-decoration: none; font-size: 14px; }
.topbar a:hover { color: var(--ink); }
.mode-badge {
  font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink); background: var(--surface-2); padding: 5px 12px; border-radius: 999px;
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.grid-2 > .card { margin: 0; }

/* ---------- typography ---------- */
.eyebrow {
  text-transform: uppercase; letter-spacing: 0.16em; font-size: 12px;
  font-weight: 600; color: var(--accent);
}
h1, h2, h3 { letter-spacing: -0.02em; line-height: 1.12; margin: 0 0 .4em; }
h1 { font-family: var(--display); font-weight: 500; font-size: clamp(30px, 6vw, 44px); }
h2 { font-family: var(--display); font-weight: 500; font-size: clamp(22px, 4vw, 28px); }
h3 { font-size: 18px; font-weight: 600; }
.lede { color: var(--muted); font-size: 18px; max-width: 56ch; }
.fineprint { color: var(--muted); font-size: 13px; }

/* ---------- cards & surfaces ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow);
}
.card + .card { margin-top: 18px; }
.stack > * + * { margin-top: 14px; }

/* ---------- buttons ---------- */
.btn {
  appearance: none; cursor: pointer; font: inherit; font-weight: 600;
  border-radius: 999px; border: 1px solid var(--ink);
  background: var(--ink); color: var(--paper); text-decoration: none; display: inline-block;
  padding: 12px 22px; transition: transform .06s ease, opacity .15s ease, background .15s ease;
}
.btn:hover { background: var(--ink-deep); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .4; cursor: not-allowed; }
.btn.secondary { background: transparent; color: var(--ink); }
.btn.secondary:hover { background: var(--surface-2); }
.btn.accent { background: var(--accent); border-color: var(--accent); }
.btn.accent:hover { background: var(--warn); }
.btn.lg { padding: 15px 30px; font-size: 17px; }
.btn.small { padding: 8px 14px; font-size: 13px; }
.btn-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.icon-btn {
  appearance: none; cursor: pointer; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--muted); border-radius: 999px;
  width: 32px; height: 32px; font-size: 14px; line-height: 1;
}
.icon-btn:hover { color: var(--warn); border-color: var(--warn); }
.file-btn { display: inline-block; cursor: pointer; }

/* ---------- inputs ---------- */
label.field { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
input[type=text], input[type=number], textarea, select {
  width: 100%; font: inherit; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); padding: 11px 13px;
}
textarea { min-height: 88px; resize: vertical; }
input:focus, textarea:focus, select:focus, .btn:focus-visible, a:focus-visible, .chip:focus-visible, .band-card:focus-visible {
  outline: 3px solid var(--accent); outline-offset: 2px;
}

/* ---------- exam stage ---------- */
.stage { text-align: center; padding: 14px 0 6px; }
.part-track {
  display: flex; gap: 10px; justify-content: center; margin: 0 0 22px;
  list-style: none; padding: 0;
}
.part-track li { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
.part-track .dot { width: 11px; height: 11px; border-radius: 50%; background: var(--surface-2); border: 1.5px solid var(--line-strong); }
.part-track li.active { color: var(--ink); }
.part-track li.active .dot { background: var(--accent); border-color: var(--accent); }
.part-track li.done .dot { background: var(--good); border-color: var(--good); }

.part-title { font-family: var(--display); font-weight: 500; font-size: clamp(34px, 8vw, 56px); margin: 4px 0 2px; }
.part-sub { color: var(--muted); margin-bottom: 18px; }

.rec {
  display: inline-flex; align-items: center; gap: 10px;
  font-weight: 600; font-size: 15px; padding: 9px 16px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface);
}
.rec .led { width: 12px; height: 12px; border-radius: 50%; background: var(--line-strong); }
.rec.live { color: var(--accent); border-color: var(--accent-soft); background: var(--accent-soft); }
.rec.live .led { background: var(--accent); animation: pulse 1.3s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .25; } }

.timer { font-family: var(--display); font-variant-numeric: tabular-nums; font-size: clamp(40px, 12vw, 72px); letter-spacing: -0.02em; }
.timer.urgent { color: var(--accent); }

.cue { text-align: left; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; margin: 0 auto; max-width: 540px; }
.cue h3 { font-family: var(--display); font-size: 22px; margin-bottom: 12px; }
.cue ul { margin: 0; padding-left: 20px; }
.cue li { margin: 4px 0; }
.qlist { text-align: left; max-width: 540px; margin: 0 auto; }
.qlist li { margin: 10px 0; }

.idbox { display: inline-flex; flex-direction: column; gap: 4px; align-items: center; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 18px; margin: 4px auto; }
.idbox code { font-size: 15px; font-weight: 600; letter-spacing: .02em; }

.meter { height: 7px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--ink); border-radius: 999px; }

/* ---------- listening / audio ---------- */
.play audio { width: 100%; margin-top: 12px; }
.prompts { margin-top: 8px; }
.prompts summary { cursor: pointer; font-size: 14px; color: var(--muted); font-weight: 600; }
.prompts ul { margin: 8px 0 0; padding-left: 20px; }
.prompts li { margin: 4px 0; }

/* ---------- the rubric: signature element ---------- */
.criterion-head { display: flex; gap: 14px; align-items: flex-start; }
.criterion-head h2, .criterion-head h3 { margin: 0 0 2px; }
.crit-tag {
  display: grid; place-items: center; width: 40px; height: 40px; flex: 0 0 auto;
  border-radius: 10px; background: var(--ink); color: var(--paper);
  font-family: var(--display); font-size: 15px; font-weight: 500;
}
.crit-score {
  margin-left: auto; font-family: var(--display); font-size: 34px; line-height: 1;
  font-variant-numeric: tabular-nums; min-width: 1.6em; text-align: right;
}
.listen-for { margin: 14px 0 4px; padding-left: 18px; color: var(--muted); font-size: 14px; }
.listen-for li { margin: 3px 0; }

.scale { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 16px; }
.chip {
  appearance: none; cursor: pointer; font: inherit; font-weight: 600; font-size: 14px;
  font-variant-numeric: tabular-nums; min-width: 40px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  border-radius: 999px; padding: 7px 0; text-align: center;
}
.chip:hover { border-color: var(--ink); }
.chip.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }

.band-cards { display: grid; gap: 8px; }
.band-card {
  display: grid; grid-template-columns: 44px 1fr; gap: 14px; align-items: start;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 12px 14px; background: var(--surface); cursor: pointer;
  transition: border-color .12s ease, background .12s ease, opacity .12s ease;
}
.band-card:hover { border-color: var(--line-strong); }
.band-card .b { font-family: var(--display); font-size: 26px; line-height: 1; color: var(--muted); }
.band-card .d { font-size: 14.5px; }
.band-card.on { border-color: var(--ink); background: var(--good-soft); }
.band-card.on .b { color: var(--ink); }
.band-card.reach { border-color: var(--good); border-style: dashed; }
.band-card.static { cursor: default; }
.band-card.static:hover { border-color: var(--line); }

/* ---------- results / comparison ---------- */
.bands { display: grid; gap: 12px; }
.overall { display: flex; align-items: baseline; gap: 14px; padding: 18px 0; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.overall .big { font-family: var(--display); font-size: 56px; line-height: 1; font-variant-numeric: tabular-nums; }
.sticky-overall { position: sticky; top: 8px; z-index: 5; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; box-shadow: var(--shadow); }

.overall-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.overall-cell { display: flex; align-items: baseline; gap: 12px; padding: 14px 0; }
.overall-cell .big { font-family: var(--display); font-size: 48px; line-height: 1; font-variant-numeric: tabular-nums; }

.tag { display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 4px 10px; border-radius: 999px; }
.tag.examiner { background: var(--good-soft); color: var(--good); }
.tag.self { background: var(--self-soft); color: var(--self); }
.tag.ai { background: var(--accent-soft); color: var(--warn); }

.compare { display: grid; gap: 0; }
.compare-row { display: grid; grid-template-columns: 1fr 80px 80px 70px; align-items: center; gap: 8px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.compare-row:last-child { border-bottom: none; }
.compare-row.head { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.compare-row.head .c-val { font-family: var(--ui); font-size: 12px; }
.c-name { font-size: 14px; }
.c-val { text-align: center; font-family: var(--display); font-size: 24px; font-variant-numeric: tabular-nums; }
.c-val.examiner { color: var(--good); }
.c-val.self { color: var(--self); }
.c-val.gap { font-size: 16px; font-family: var(--ui); font-weight: 700; color: var(--muted); }
.c-val.gap.up { color: var(--warn); }
.c-val.gap.down { color: var(--self); }

.desc-row { padding: 12px 0; border-bottom: 1px solid var(--line); }
.desc-row:last-child { border-bottom: none; }
.desc-row p { margin: 6px 0 0; }
.band-pill { display: inline-grid; place-items: center; min-width: 30px; height: 24px; padding: 0 6px; border-radius: 999px; background: var(--good-soft); color: var(--good); font-weight: 700; font-size: 13px; font-variant-numeric: tabular-nums; }

/* ---------- session list ---------- */
.session-list { display: grid; gap: 10px; margin-top: 8px; }
.session-row { display: flex; gap: 14px; align-items: center; justify-content: space-between; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.session-main { min-width: 220px; }
.session-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.badge { font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.badge.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.badge.examiner.on { background: var(--good); border-color: var(--good); }
.badge.self.on { background: var(--self); border-color: var(--self); }

/* ---------- misc ---------- */
.notice { font-size: 14px; background: var(--surface-2); border-left: 3px solid var(--ink); padding: 12px 14px; border-radius: 8px; margin-top: 12px; }
.disclaimer { font-size: 13px; color: var(--muted); background: var(--surface-2); border-left: 3px solid var(--accent); padding: 12px 14px; border-radius: 8px; }
.status { font-size: 14px; color: var(--muted); min-height: 1.4em; }
.status.error { color: var(--warn); }
.hidden { display: none !important; }
.center { text-align: center; }
.mt { margin-top: 18px; } .mt-lg { margin-top: 28px; }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
@media (max-width: 600px) {
  .wrap { padding: 18px 16px 56px; }
  .grid-2 { grid-template-columns: 1fr; }
  .overall-grid { grid-template-columns: 1fr; }
  .compare-row { grid-template-columns: 1fr 56px 56px 52px; }
  .c-val { font-size: 20px; }
  .sticky-overall { position: static; }
}

/* ---- Strict Part 2 flow (v9.17) ---- */
.p2flow { display: flex; flex-direction: column; gap: 1rem; }
.p2flow__card { min-height: 120px; }
.p2flow__controls { display: flex; flex-direction: column; align-items: center; gap: .75rem; }
.p2flow__timer {
  font-variant-numeric: tabular-nums; font-weight: 700; font-size: 32px;
  color: var(--ink); letter-spacing: .02em;
}
.p2flow__timer.urgent { color: var(--accent); }
.p2flow__dots { font-size: 28px; letter-spacing: .4em; color: var(--line-strong); animation: pulse 1.3s ease-in-out infinite; }
.p2flow__cue { font-size: 22px; font-weight: 600; text-align: center; }
.p2flow__thanks { margin: .25rem 0 0; }

/* ── Provisional AI evaluation (v9.23) — finish screen + examiner reference ── */
.ai-prov { text-align: left; border-top: 1px solid var(--line, #e3e6ee); padding-top: 1rem; }
.ai-prov .eyebrow { margin-bottom: .25rem; }
.ai-band { font-size: 30px; font-weight: 700; margin: .25rem 0 .5rem; }
.crit-row { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: .5rem; padding: .45rem 0; border-bottom: 1px dashed var(--line, #e3e6ee); }
.crit-row .crit-name { font-weight: 600; }
.crit-row .crit-band { font-size: 1.15rem; font-weight: 700; }
.crit-row .crit-fb { grid-column: 1 / -1; margin: .15rem 0 0; font-size: .9rem; color: var(--muted, #5a6072); }
