/* WritSpeak IELTS Checker — house style: navy + gold on cream, Roboto / Roboto Slab.
   Layout: brand bar with plan chip, compact hero, six-module switcher, workspace (form 7fr + guidance 5fr on laptops,
   one column on phones), full-width results, then Plans and My progress sections. */
/* WritSpeak brand (update 4): navy, off-white, charcoal, burnt orange. Variable names kept from the first design
   (--gold* now hold the burnt-orange accent) so every existing component picks up the new palette. */
:root {
  --bg: #f7f5f0; --surface: #ffffff; --surface-2: #f2efe8; --ink: #23262d; --muted: #565c67; --line: #e1dcd1;
  --band: #12223f; --band-ink: #f7f5f0; --band-muted: #c3cad6; --band-accent: #f4a271;
  --gold: #c4571b; --gold-ink: #9a4210; --gold-soft: #fbeadf; --btn-bg: #b04e18; --btn-ink: #ffffff; --badge-ink: #ffffff;
  --rec: #b3261e; --rec-ink: #ffffff;
  --good: #1f7a4a; --good-bg: #e3f3ea; --warn: #8f5300; --warn-bg: #fbf0d9; --bad: #b3261e; --bad-bg: #fbe6e4;
  --font-body: 'Roboto', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
  --font-display: 'Roboto Slab', Georgia, 'Times New Roman', serif;
  --radius: 12px; --tap: 44px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1320; --surface: #161d2c; --surface-2: #1c2436; --ink: #eceae5; --muted: #a2aab8; --line: #2a3346;
    --band: #0a1222; --band-ink: #eceae5; --band-muted: #a2aab8; --band-accent: #f4a271; --gold: #f08a4b; --gold-ink: #f6a878; --gold-soft: #2d1d12;
    --btn-bg: #f08a4b; --btn-ink: #10141c; --badge-ink: #10141c; --rec: #f08a83; --rec-ink: #0f141c;
    --good: #5fcf92; --good-bg: #12291d; --warn: #e6b04d; --warn-bg: #2b2210; --bad: #f08a83; --bad-bg: #2e1615;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1320; --surface: #161d2c; --surface-2: #1c2436; --ink: #eceae5; --muted: #a2aab8; --line: #2a3346;
  --band: #0a1222; --band-ink: #eceae5; --band-muted: #a2aab8; --band-accent: #f4a271; --gold: #f08a4b; --gold-ink: #f6a878; --gold-soft: #2d1d12;
  --btn-bg: #f08a4b; --btn-ink: #10141c; --badge-ink: #10141c; --rec: #f08a83; --rec-ink: #0f141c;
  --good: #5fcf92; --good-bg: #12291d; --warn: #e6b04d; --warn-bg: #2b2210; --bad: #f08a83; --bad-bg: #2e1615;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: auto; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 16px; line-height: 1.6; }
[hidden] { display: none !important; }
.gutter { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.inner { max-width: 1200px; margin: 0 auto; }
button, select, textarea, input { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
a { color: var(--gold-ink); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mt { margin-top: 16px; }

/* Brand bar */
.site-bar { background: var(--band); color: var(--band-ink); border-bottom: 3px solid var(--btn-bg); padding-top: env(safe-area-inset-top, 0px); }
.site-bar .inner { display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; min-height: 60px; flex-wrap: wrap; padding-block: 8px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .01em; color: inherit; text-decoration: none; }
.brand-mark { width: 34px; height: 34px; border-radius: 8px; background: var(--btn-bg); color: var(--badge-ink); display: grid; place-items: center; font-family: var(--font-display); font-size: 17px; flex: 0 0 auto; }
.brand small { display: block; font-weight: 400; color: var(--band-muted); font-size: 12px; letter-spacing: .04em; text-transform: uppercase; line-height: 1.2; }
.bar-right { display: flex; align-items: center; gap: 6px 14px; flex-wrap: wrap; }
.top-nav { display: flex; gap: 2px; }
.top-nav a { color: var(--band-ink); text-decoration: none; min-height: var(--tap); display: inline-flex; align-items: center; padding: 0 10px; border-radius: 6px; font-size: 15px; }
.top-nav a:hover { background: rgba(255,255,255,.08); }
.chip { min-height: var(--tap); border: 1px solid var(--band-accent); background: transparent; color: var(--band-ink); border-radius: 999px; padding: 4px 14px; cursor: pointer; font-size: 14px; font-weight: 500; text-align: left; line-height: 1.25; }
.chip b { color: var(--band-accent); font-weight: 700; }
@media (max-width: 560px) { .top-nav { display: none; } }

/* Hero */
.hero { padding-block: 28px 8px; }
.hero h1 { font-family: var(--font-display); font-size: clamp(27px, 4.2vw, 44px); line-height: 1.12; margin: 0 0 10px; text-wrap: balance; max-width: 22ch; }
.hero p.lead { margin: 0 0 16px; color: var(--muted); font-size: clamp(16px, 1.6vw, 18px); max-width: 62ch; }
.facts { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 0; padding: 0; list-style: none; font-size: 14px; color: var(--muted); }
.facts li::before { content: "■ "; color: var(--gold); font-size: 10px; vertical-align: 2px; }

/* Module switcher */
.modules { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 0 0 16px; padding: 0; max-width: 560px; }
.mod { min-height: var(--tap); padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 500; cursor: pointer; line-height: 1.25; text-align: center; }
.mod small { display: block; font-size: 12px; color: var(--muted); font-weight: 400; }
.mod:hover { border-color: var(--gold); }
.mod[aria-pressed="true"] { background: var(--band); color: var(--band-ink); border-color: var(--band); box-shadow: inset 0 -3px 0 var(--band-accent); }
.mod[aria-pressed="true"] small { color: var(--band-muted); }

/* Workspace */
.workspace { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
@media (min-width: 1024px) { .workspace { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 24px; } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
@media (min-width: 768px) { .card { padding: 22px; } }
.card h2 { font-family: var(--font-display); font-size: 20px; margin: 0; line-height: 1.25; }
.card h3 { margin: 0; font-size: 17px; }
.lbl { display: block; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.lbl .opt { text-transform: none; letter-spacing: 0; font-weight: 400; }
.help { font-size: 14px; color: var(--muted); margin: 6px 0 0; }
textarea { width: 100%; min-height: 220px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); line-height: 1.65; resize: vertical; }
textarea.short { min-height: 88px; }
textarea.mid { min-height: 140px; }
select, input[type=text], input[type=password], input[type=number] { width: 100%; min-height: var(--tap); padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); }
textarea:focus, select:focus, input:focus { border-color: var(--gold); outline: none; box-shadow: 0 0 0 3px var(--gold-soft); }
input[type=file] { width: 100%; min-height: var(--tap); padding: 8px; border: 1px dashed var(--line); border-radius: 8px; background: var(--surface-2); }
input[type=file]::file-selector-button { min-height: 32px; margin-right: 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); padding: 4px 12px; cursor: pointer; }
audio { width: 100%; margin-top: 8px; }
.meta { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.meta .under { color: var(--warn); font-weight: 500; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.btn { min-height: var(--tap); border: 1px solid var(--line); background: var(--surface); color: var(--ink); padding: 8px 18px; border-radius: 8px; cursor: pointer; font-weight: 500; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.btn:hover { border-color: var(--gold); }
.btn.primary { background: var(--btn-bg); border-color: var(--btn-bg); color: var(--btn-ink); font-weight: 700; padding-inline: 24px; }
.btn.rec { background: var(--rec); border-color: var(--rec); color: var(--rec-ink); font-weight: 700; min-width: 170px; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.stop { color: var(--bad); border-color: var(--bad); }
.status { font-size: 14px; color: var(--muted); margin: 0; }
@media (max-width: 480px) { .row .btn.primary { flex: 1 1 100%; } }

/* Segmented control */
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.seg button { min-height: var(--tap); border: 1px solid var(--line); background: var(--surface); border-radius: 8px; cursor: pointer; font-weight: 500; padding: 6px 8px; line-height: 1.25; }
.seg button[aria-pressed="true"] { background: var(--band); color: var(--band-ink); border-color: var(--band); }
.seg.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.seg small { display: block; font-size: 12px; font-weight: 400; opacity: .8; }

/* Upload */
.upload { border: 1px dashed var(--gold); border-radius: 8px; padding: 14px; background: var(--gold-soft); display: flex; flex-direction: column; gap: 10px; }
.upload p { margin: 0; }
.upload .btn { background: var(--surface); }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.thumbs img { width: 72px; height: 96px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); }
.unclear { background: var(--warn-bg); color: var(--warn); border-radius: 6px; padding: 8px 10px; font-size: 14px; }

/* Speaking recorder */
.qbox { background: var(--surface-2); border-left: 4px solid var(--gold); border-radius: 6px; padding: 14px 16px; }
.qbox p { margin: 0; font-size: 18px; font-weight: 500; }
.qbox ul { margin: 8px 0 0; padding-left: 20px; }
.timer { font-family: var(--font-display); font-size: 28px; font-variant-numeric: tabular-nums; min-width: 92px; }
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--rec); margin-right: 6px; vertical-align: 2px; }
@media (prefers-reduced-motion: no-preference) { .dot { animation: pulse 1.2s infinite; } @keyframes pulse { 50% { opacity: .3; } } }
.transcript { background: var(--surface-2); border-radius: 8px; padding: 12px 14px; white-space: pre-wrap; overflow-wrap: anywhere; }

/* Side panel */
.side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
details.profile summary { min-height: var(--tap); display: flex; align-items: center; cursor: pointer; font-weight: 500; list-style: none; }
details.profile summary::-webkit-details-marker { display: none; }
details.profile summary::before { content: "▸"; color: var(--gold-ink); margin-right: 8px; }
details.profile[open] summary::before { content: "▾"; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-top: 8px; }
.howto ol { margin: 0; padding-left: 20px; }
.howto li { margin: 4px 0; }
.marked { font-size: 14px; border-top: 1px solid var(--line); padding-top: 12px; color: var(--muted); margin: 0; }
.marked strong { color: var(--ink); }
.allow { font-size: 15px; }
.allow .big { font-family: var(--font-display); font-size: 26px; font-weight: 700; color: var(--gold-ink); font-variant-numeric: tabular-nums; }
.meter { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; border: 1px solid var(--line); }
.meter span { display: block; height: 100%; background: var(--gold); width: 0; }

.notice { border-radius: 8px; padding: 12px 14px; font-size: 15px; margin: 0; }
.notice.warn { background: var(--warn-bg); color: var(--warn); }
.notice.bad { background: var(--bad-bg); color: var(--bad); }
.notice.good { background: var(--good-bg); color: var(--good); }
.notice.info { background: var(--gold-soft); color: var(--ink); border-left: 3px solid var(--gold); }

/* Results */
.results { margin-top: 24px; scroll-margin-top: 16px; }
.scores { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.score { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 12px; text-align: center; }
.score .n { font-family: var(--font-display); font-size: 30px; font-weight: 700; color: var(--gold-ink); line-height: 1.1; font-variant-numeric: tabular-nums; }
.score .c { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.score.overall { background: var(--band); border-color: var(--band); color: var(--band-ink); }
@media (max-width: 600px) { .score.overall { grid-column: 1 / -1; } }
.score.overall .n { color: var(--gold); }
.score.overall .c { color: var(--band-muted); }
.agree { font-size: 14px; padding: 10px 12px; border-radius: 6px; margin-top: 10px; }
.agree.ok { background: var(--good-bg); color: var(--good); }
.agree.diff { background: var(--warn-bg); color: var(--warn); }
.agree.wait { background: var(--surface-2); color: var(--muted); }
.stamp { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; margin: 0; }
.report { min-width: 0; overflow-wrap: anywhere; max-width: 80ch; }
.report h2 { font-family: var(--font-display); font-size: 19px; margin: 24px 0 8px; padding-bottom: 4px; border-bottom: 2px solid var(--gold); text-wrap: balance; }
.report h2:first-child { margin-top: 0; }
.report h3 { font-size: 16px; margin: 16px 0 6px; }
.report p { margin: 6px 0; }
.report ul, .report ol { margin: 6px 0; padding-left: 22px; }
.report li { margin: 4px 0; }
.report code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; font-size: 14px; }
.report hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
.tbl { overflow-x: auto; margin: 8px 0; max-width: 100%; }
.report table, .data table { border-collapse: collapse; width: 100%; font-size: 15px; }
.report th, .report td, .data th, .data td { border: 1px solid var(--line); padding: 7px 9px; text-align: left; vertical-align: top; overflow-wrap: normal; word-break: normal; }
.report td:first-child { white-space: nowrap; }
.report th, .data th { background: var(--surface-2); font-weight: 700; }
.ok-cell { color: var(--good); font-weight: 700; }
.bad-cell { color: var(--bad); font-weight: 700; }
.thinking { color: var(--muted); font-style: italic; }

/* Listening library */
.lib-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px; }
.lib-item { min-height: var(--tap); text-align: left; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); cursor: pointer; }
.lib-item strong { display: block; font-weight: 700; }
.lib-item span { font-size: 13px; color: var(--muted); }
.lib-item[aria-pressed="true"] { border-color: var(--gold); box-shadow: inset 0 0 0 2px var(--gold); }
.lib-test { display: flex; flex-direction: column; gap: 14px; border-top: 1px solid var(--line); padding-top: 14px; }
.instr { font-size: 14px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--gold-ink); margin: 4px 0 0; }
.q { display: flex; gap: 10px; align-items: flex-start; }
.q .num { flex: 0 0 28px; height: 28px; border-radius: 50%; background: var(--band); color: var(--band-ink); display: grid; place-items: center; font-size: 13px; font-weight: 700; margin-top: 8px; }
.q .body { flex: 1 1 auto; min-width: 0; }
.q .body p { margin: 0 0 6px; }
.q input[type=text] { max-width: 280px; }
.opt-label { display: flex; align-items: center; gap: 10px; min-height: var(--tap); padding: 4px 10px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 6px; cursor: pointer; }
.opt-label input { width: 20px; height: 20px; accent-color: var(--btn-bg); flex: 0 0 auto; }
.credit { font-size: 13px; color: var(--muted); margin: 0; }

/* Sections below the checker */
.section { margin-top: 48px; scroll-margin-top: 12px; }
.section > h2 { font-family: var(--font-display); font-size: clamp(24px, 3vw, 32px); margin: 0 0 6px; line-height: 1.2; }
.section > p.lead { color: var(--muted); margin: 0 0 18px; max-width: 70ch; }
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.plan { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; gap: 10px; }
.plan.featured { border: 2px solid var(--gold); box-shadow: 0 6px 18px rgba(17, 28, 43, .08); }
.plan h3 { margin: 0; font-family: var(--font-display); font-size: 21px; }
.plan .tag { align-self: flex-start; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; background: var(--btn-bg); color: var(--badge-ink); padding: 2px 10px; border-radius: 99px; }
.plan .price { font-family: var(--font-display); font-size: 30px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.plan .price small { font-family: var(--font-body); font-size: 15px; font-weight: 400; color: var(--muted); }
.plan .alt { font-size: 14px; color: var(--muted); margin: 0; }
.plan ul { margin: 0; padding-left: 20px; font-size: 15px; }
.plan li { margin: 3px 0; }
.plan p.blurb { margin: 0; font-size: 15px; }
.steps { counter-reset: s; list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.steps li { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 14px 14px 14px 52px; position: relative; font-size: 15px; }
.steps li::before { counter-increment: s; content: counter(s); position: absolute; left: 14px; top: 12px; width: 28px; height: 28px; border-radius: 50%; background: var(--band); color: var(--gold); display: grid; place-items: center; font-weight: 700; }
.progress-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
@media (min-width: 900px) { .progress-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.usage-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.usage-list li { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; font-size: 15px; }
.usage-list .meter { grid-column: 1 / -1; }
.spark { width: 100%; height: 140px; display: block; }
.spark .ax { stroke: var(--line); stroke-width: 1; }
.spark .ln { fill: none; stroke: var(--gold); stroke-width: 2.5; }
.spark .pt { fill: var(--gold); }
.spark text { fill: var(--muted); font-size: 11px; font-family: var(--font-body); }
.rev { border-top: 1px solid var(--line); padding-top: 12px; }
.rev:first-child { border-top: 0; padding-top: 0; }
.pending { color: var(--muted); font-style: italic; }

/* Dialog */
dialog { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); padding: 22px; width: min(440px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(10, 16, 24, .55); }
dialog h2 { font-family: var(--font-display); font-size: 20px; margin: 0 0 10px; }
dialog form { display: flex; flex-direction: column; gap: 12px; }
dialog input[type=text] { font-size: 20px; letter-spacing: .08em; text-transform: uppercase; font-variant-numeric: tabular-nums; }

/* Footer */
.site-foot { margin-top: 48px; background: var(--band); color: var(--band-ink); padding-block: 22px calc(28px + env(safe-area-inset-bottom, 0px)); }
.site-foot .inner { display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.site-foot .muted { color: var(--band-muted); }
.site-foot a { color: var(--band-accent); }
.contact { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.contact b { color: var(--band-accent); user-select: all; font-variant-numeric: tabular-nums; font-size: 16px; }
.contact .btn { background: transparent; color: var(--band-ink); border-color: var(--band-muted); }
@media (prefers-reduced-motion: no-preference) { .btn, .mod, .chip { transition: background .15s, border-color .15s; } }

/* Admin */
.admin-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 16px 0; }
.admin-tabs button { min-height: var(--tap); border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 6px 14px; cursor: pointer; font-weight: 500; }
.admin-tabs button[aria-selected="true"] { background: var(--band); color: var(--band-ink); border-color: var(--band); }
.data { overflow-x: auto; }
.data td.num { font-variant-numeric: tabular-nums; text-align: right; }
.codes-out { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-wrap; background: var(--surface-2); border-radius: 8px; padding: 12px; overflow-wrap: anywhere; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; }
.kpi .v { font-family: var(--font-display); font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi .k { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.crit-inputs { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; }
.essay { white-space: pre-wrap; background: var(--surface-2); border-radius: 8px; padding: 12px 14px; max-height: 420px; overflow: auto; }

/* Phase 2: checks before sending, confirmation, structured feedback */
.invalid { border-color: var(--bad) !important; box-shadow: 0 0 0 3px var(--bad-bg) !important; }
.issues { margin: 6px 0 0; padding-left: 20px; }
.issues li { margin: 4px 0; }
.confirm { border: 1px solid var(--gold); border-radius: 8px; padding: 14px 16px; background: var(--gold-soft); margin-top: 10px; }
.confirm h3 { margin: 0 0 6px; font-size: 17px; }
.confirm p { margin: 4px 0; }
#checkPanel { display: flex; flex-direction: column; gap: 10px; }
.btn.small { min-height: 36px; padding: 4px 12px; font-size: 14px; }
.fixes { list-style: none; padding: 0; margin: 8px 0; display: flex; flex-direction: column; gap: 10px; counter-reset: fx; }
.fix { border: 1px solid var(--line); border-left: 4px solid var(--gold); border-radius: 8px; padding: 12px 14px; background: var(--surface); }
.fix .tag { display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--gold-ink); }
.fix p { margin: 6px 0; }
.change { font-size: 16px; }
.was { text-decoration: line-through; text-decoration-color: var(--bad); color: var(--muted); }
.now { font-weight: 700; color: var(--good); }
.ups .was { text-decoration: none; }
.ex { font-size: 15px; }
.crits { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
@media (min-width: 900px) { .crits { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.crit { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; background: var(--surface-2); }
.crit h3 { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin: 0 0 6px; font-size: 16px; }
.crit h3 .b { font-family: var(--font-display); font-size: 24px; color: var(--gold-ink); }
.crit p { margin: 6px 0; font-size: 15px; }
.report blockquote { margin: 6px 0; padding: 6px 10px; border-left: 3px solid var(--gold); background: var(--surface); font-style: italic; }
.ups { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.ups li { border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.ups p { margin: 2px 0; }
.prose { max-width: 820px; padding-block: 24px 40px; }
.prose h1 { font-family: var(--font-display); font-size: clamp(28px, 4vw, 38px); margin: 0 0 8px; }
.prose h2 { font-family: var(--font-display); font-size: 21px; margin: 28px 0 8px; }
.prose .data { overflow-x: auto; display: block; }
.prose li { margin: 6px 0; }
.report .fixes, .report .ups { padding-left: 0; }

/* Update 3: focused result, filters, folds, fix-and-resubmit, recurring mistakes */
.fchips { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 10px; }
.fchip { min-height: var(--tap); padding: 4px 14px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-size: 14px; cursor: pointer; }
.fchip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.fchip:focus-visible, .linkbtn:focus-visible, .fold summary:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.fix[hidden] { display: none; }
.recurring { margin: 10px 0 0; padding: 10px 14px; border-radius: 8px; background: var(--gold-soft); border-left: 3px solid var(--gold); font-size: 15px; }
.resub { margin: 14px 0 4px; align-items: center; }
.resub .help { flex: 1 1 220px; }
.trust { margin: 12px 0; font-size: 13px; color: var(--muted); }
.focus { border: 1px solid var(--gold); border-left: 6px solid var(--gold); border-radius: 10px; padding: 14px 16px; background: var(--gold-soft); margin: 0 0 12px; }
.focus h2 { margin: 0 0 4px; font-size: 19px; }
.focus p { margin: 6px 0; }
.focus-tag { font-size: 13px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--gold-ink); }
.focus .action { font-size: 16px; }
.integrity { padding: 4px 0 8px; }
.integrity h3 { font-size: 15px; margin: 12px 0 4px; }
.integrity ul { margin: 4px 0; padding-left: 20px; }
.parts li.not strong { color: var(--bad); } .parts li.partly strong { color: var(--warn); } .parts li.fully strong { color: var(--good); }
.lesson-body { padding: 4px 0 12px; }
.lesson-body h3 { margin: 10px 0 6px; }
.ex-prompt { background: var(--surface-2); border: 1px dashed var(--line); border-radius: 8px; padding: 8px 12px; }
textarea.short { min-height: 84px; }
.ok-box { background: var(--good-bg); color: var(--ink); border: 1px solid var(--good); }
.fold { border: 1px solid var(--line); border-radius: 8px; background: var(--surface); margin: 10px 0; }
.fold > summary { cursor: pointer; padding: 12px 14px; min-height: var(--tap); font-weight: 700; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.fold > summary .sum { font-weight: 400; color: var(--muted); font-size: 14px; }
.fold[open] > summary { border-bottom: 1px solid var(--line); }
.fold > :not(summary) { margin-left: 14px; margin-right: 14px; }
.fold > .crits { margin: 12px 14px 14px; }
.compare { border: 1px solid var(--good); border-radius: 8px; padding: 12px 14px; margin: 0 0 14px; background: var(--good-bg); color: var(--ink); }
.compare h2 { margin-top: 0; }
.cmp { list-style: none; padding: 0; margin: 8px 0; display: grid; gap: 6px; }
.cmp .mark { display: inline-block; width: 1.2em; font-weight: 700; }
.cmp .fixed .mark { color: var(--good); }
.cmp .still .mark { color: var(--bad); }
.draft-note { margin: 6px 0 8px; }
.linkbtn { background: none; border: 0; padding: 0 2px; color: var(--gold-ink); text-decoration: underline; font: inherit; cursor: pointer; min-height: 0; }

/* Update 4: studios, question bank, full test, model answers, highlights, drills, frameworks, install */
.studios { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 18px 0 12px; }
.studio { min-height: 64px; padding: 10px 12px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-weight: 700; font-size: 16px; cursor: pointer; text-align: left; text-decoration: none; display: flex; flex-direction: column; justify-content: center; line-height: 1.25; }
.studio small { font-weight: 400; font-size: 13px; color: var(--muted); margin-top: 2px; }
.studio:hover { border-color: var(--gold); }
.studio[aria-pressed="true"] { background: var(--band); color: var(--band-ink); border-color: var(--band); box-shadow: inset 0 -4px 0 var(--band-accent); }
.studio[aria-pressed="true"] small { color: var(--band-muted); }
@media (max-width: 560px) { .studios { grid-template-columns: 1fr 1fr; } .studios a.studio { grid-column: 1 / -1; min-height: var(--tap); flex-direction: row; gap: 8px; align-items: center; justify-content: flex-start; } .studios a.studio small { margin: 0; } }
.more-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 18px 0 0; font-size: 14px; color: var(--muted); }
.more-row .mod.more { min-height: var(--tap); padding: 6px 14px; font-size: 14px; }
.chip.install { border-color: var(--band-accent); font-weight: 700; }
.test-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-weight: 700; }
.tag-part { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; background: var(--gold-soft); color: var(--gold-ink); padding: 4px 10px; border-radius: 99px; }
.test-bar { height: 8px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.test-bar span { display: block; height: 100%; width: 0; background: var(--btn-bg); }
@media (prefers-reduced-motion: no-preference) { .test-bar span { transition: width .3s; } }
.transcript mark, .marked mark { background: var(--gold-soft); color: inherit; border-bottom: 2px solid var(--gold); padding: 0 2px; border-radius: 3px; }
.transcript mark[data-n]::before { content: attr(data-n); font-size: 11px; font-weight: 700; color: var(--gold-ink); vertical-align: super; margin-right: 2px; }
.model-wrap { margin: 12px 0; }
.model-box .model-text { background: var(--surface-2); border-left: 4px solid var(--good); border-radius: 8px; padding: 4px 16px; margin-top: 8px; }
.drillBtn { margin-top: 6px; }
.drill { margin-top: 10px; padding: 12px; border: 1px dashed var(--gold); border-radius: 8px; background: var(--surface-2); }
.drill h4 { margin: 0 0 6px; }
.drill-items { margin: 0 0 10px; padding-left: 22px; display: grid; gap: 10px; }
.drill-items input.gap { display: inline-block; width: 9em; min-height: 36px; margin: 0 6px; padding: 4px 8px; }
.ok-mark { color: var(--good); font-weight: 700; } .bad-mark { color: var(--bad); font-weight: 700; }
.framework { border: 1px solid var(--line); border-left: 4px solid var(--band); border-radius: 8px; padding: 12px 14px; margin: 14px 0; background: var(--surface); }
.framework h2 { margin-top: 0; font-size: 18px; } .framework h3 { font-size: 16px; margin: 10px 0 4px; }
.framework ol { margin: 4px 0; padding-left: 20px; }
.mistakes { margin: 0; padding-left: 20px; display: grid; gap: 10px; }
.mistakes .btn.small { min-height: var(--tap); margin-left: 6px; }
.drillBtn, .drillCheck { min-height: var(--tap) !important; }

.test-summary { margin: 8px 0; padding-left: 0; list-style: none; display: grid; gap: 6px; }
.test-summary li { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.test-summary .btn.small { min-height: var(--tap); }

/* Guides (server-rendered articles) */
.guide-wrap { max-width: 760px; padding-block: 18px 8px; }
.crumbs { font-size: 14px; color: var(--muted); margin: 8px 0 4px; }
.crumbs a { color: var(--muted); }
.guide h1 { font-family: var(--font-display); font-size: clamp(26px, 4vw, 38px); line-height: 1.15; margin: 6px 0 8px; text-wrap: balance; }
.guide .byline { font-size: 14px; color: var(--muted); margin: 0 0 18px; }
.guide h2 { font-family: var(--font-display); font-size: 22px; margin: 28px 0 8px; line-height: 1.25; }
.guide h3 { font-size: 18px; margin: 20px 0 6px; }
.guide p, .guide li { font-size: 17px; line-height: 1.7; }
.guide blockquote { margin: 12px 0; padding: 10px 14px; border-left: 4px solid var(--gold); background: var(--surface-2); border-radius: 6px; }
.guide-cta { margin: 24px 0; padding: 16px 18px; border-radius: var(--radius); background: var(--band); color: var(--band-ink); }
.guide-cta p { margin: 0 0 8px; font-size: 16px; } .guide-cta strong { font-size: 18px; }
.guide-cta .btn.primary { margin-top: 4px; }
.guide-faq { margin-top: 28px; border-top: 1px solid var(--line); }
.guide-list { list-style: none; padding: 0; margin: 16px 0; display: grid; gap: 14px; }
.guide-list li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.guide-list a { color: var(--ink); text-decoration: none; font-size: 18px; } .guide-list a:hover { text-decoration: underline; }
.guide-list p { margin: 6px 0 0; }
.related ul { padding-left: 20px; } .related li { margin: 6px 0; }

/* update 5 */
.guide-refs { margin-top: 24px; border-top: 1px solid var(--line); } .guide-refs ul { padding-left: 20px; } .guide-refs li { margin: 6px 0; }
#nextPractice p { margin: 0 0 10px; }
/* update 6: free tools and comparison pages */
.tool { margin: 16px 0 8px; }
.tool textarea { width: 100%; }
.tool-out .big { font-family: var(--font-display); font-size: clamp(26px, 5vw, 34px); font-weight: 700; margin: 4px 0; }
.tool-out .status.under { color: var(--warn); font-weight: 500; }
.band-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 600px) { .band-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.band-grid label { display: flex; flex-direction: column; gap: 6px; font-weight: 500; }
.timer { font-variant-numeric: tabular-nums; font-size: clamp(44px, 12vw, 72px) !important; margin: 6px 0 !important; }
.tool .help input[type=checkbox] { width: 22px; height: 22px; vertical-align: middle; margin-right: 6px; }
.tool .help { display: inline-flex; align-items: center; min-height: var(--tap); }
.tool-list { list-style: none; padding: 0; display: grid; gap: 12px; }
.tool-list li { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; background: var(--surface); }
.tool-list li p { margin: 4px 0 0; color: var(--muted); }
.guide .data td, .guide .data th { font-size: 15px; }

/* Download PDF (print the result only) */
.print-head { border-bottom: 2px solid var(--btn-bg); margin-bottom: 12px; padding-bottom: 8px; }
.print-head p { margin: 2px 0; } .print-head .ph-brand { font-family: var(--font-display); font-size: 22px; font-weight: 700; }
.print-head .ph-note { font-size: 13px; color: var(--muted); }
@media print {
  @page { margin: 14mm; }
  .pr-hide, .no-print, .site-bar, .site-foot, #resultPanel audio, #resultPanel button { display: none !important; }
  html, body { background: #fff !important; color: #000 !important; }
  #resultPanel { border: 0 !important; box-shadow: none !important; margin: 0 !important; padding: 0 !important; }
  #resultPanel * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  #resultPanel details > summary { list-style: none; font-weight: 700; }
  #resultPanel .fold, #resultPanel li, #resultPanel .crit { break-inside: avoid; }
  .score:not(.overall) .n { color: #000 !important; }
  .score.overall .n, .score.overall .c { color: #fff !important; }
}

/* Speaking upgrade: fluency tiles */
.ftiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 10px; margin: 8px 0; }
.ftile { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: var(--surface); }
.ftile strong { display: block; font-size: 20px; }
.ftile small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.ftile.good strong { color: var(--good); }
.ftile.warn strong { color: var(--warn); }

/* Recording waveform (recorder-ui.js) and pronunciation card */
.wave-wrap { margin: 12px 0 0; }
.wave { display: block; width: 100%; height: 64px; background: var(--band, #12223f); border-radius: 8px; }
.wave-msg { min-height: 1.4em; margin: 4px 0 0; color: var(--warn, #b4410f); font-weight: 500; }
.wave-words { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.timer.near-end { color: var(--gold, #c4571b); }
.avatar-slot { max-width: 160px; }
.avatar-slot svg, .avatar-video { width: 100%; height: auto; border-radius: 14px; display: block; }
.ftile .of { font-size: 12px; font-weight: 400; color: var(--muted); }

/* Online checkout (PayPal) */
.pay-box { margin-top: 18px; padding: 16px; }
.pay-sum { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 14px 0; }
.pay-sum dt { color: var(--muted); } .pay-sum dd { margin: 0; overflow-wrap: anywhere; }
.pay-agree { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; }
.pay-agree input { margin-top: 4px; width: 20px; height: 20px; flex: none; }
.pay-code { font-size: 26px; font-weight: 700; letter-spacing: .06em; user-select: all; padding: 12px 14px; background: var(--surface-2); border-radius: var(--radius); display: inline-block; }
@media (max-width: 560px) { .pay-sum { grid-template-columns: 1fr; gap: 0 } .pay-sum dd { margin-bottom: 8px } }
.mono-area { width: 100%; font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
