/* IELTS practice — design system.
   Institutional, editorial, confident. Brand red + navy ink on white. */

:root {
  --brand: #a4123f;
  --brand-dark: #7d0e30;
  --brand-tint: #fdf2f5;
  --ink: #16233f;
  --ink-soft: #5a6683;
  --ink-faint: #8b93a8;
  --bg: #ffffff;
  --bg-alt: #f6f7fa;
  --border: #e4e7ef;
  --border-strong: #cdd3e0;
  --ok: #0f7a52;
  --ok-tint: #eaf6f0;
  --warn: #9a5b00;
  --warn-tint: #fdf5e7;
  --bad: #b3261e;
  --bad-tint: #fdecea;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(22, 35, 63, .06), 0 1px 3px rgba(22, 35, 63, .05);
  --shadow: 0 8px 24px rgba(22, 35, 63, .10);
  --maxw: 1160px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { line-height: 1.2; letter-spacing: -0.02em; }
h1 { font-size: clamp(1.9rem, 4vw, 2.7rem); }
h2 { font-size: clamp(1.4rem, 3vw, 1.9rem); }
h3 { font-size: 1.15rem; }
p { text-wrap: pretty; }
a { color: var(--brand); }
a:hover { color: var(--brand-dark); }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.wrap-narrow { max-width: 780px; }
.wrap-mid { max-width: 960px; }
main { padding: 40px 0 80px; }
.stack > * + * { margin-top: 16px; }
.muted { color: var(--ink-soft); }
.small { font-size: .88rem; }
.tiny { font-size: .78rem; }
.center { text-align: center; }

/* ── Header ─────────────────────────────────────────────────────────── */
.site-head {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.site-head-inner { display: flex; align-items: center; gap: 20px; height: 68px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 800; font-size: 1.1rem; letter-spacing: -.02em; }
.brand:hover { color: var(--ink); }
.brand-mark { width: 32px; height: 32px; flex: 0 0 auto; }
.site-nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.site-nav a {
  color: var(--ink-soft); text-decoration: none; font-size: .92rem; font-weight: 600;
  padding: 8px 12px; border-radius: var(--radius-sm);
}
.site-nav a:hover { color: var(--ink); background: var(--bg-alt); }
.site-nav a.active { color: var(--brand); background: var(--brand-tint); }
/* `.site-nav a` (0,1,1) outranks `.btn-primary` (0,1,0), which would leave the
   sign-in button with muted grey text on the red fill. */
.site-nav a.btn-primary { color: #fff; }
.site-nav a.btn-primary:hover { color: #fff; background: var(--brand-dark); }
/* Two-class selector so this beats `.btn { display: inline-flex }`, which has
   equal specificity and would otherwise win by coming later in the file. */
.site-head .nav-toggle { display: none; }
@media (max-width: 900px) {
  .site-nav { display: none; }
  .site-nav.open { display: flex; position: absolute; top: 68px; left: 0; right: 0; flex-direction: column; align-items: stretch; background: #fff; border-bottom: 1px solid var(--border); padding: 8px 16px 16px; gap: 2px; box-shadow: var(--shadow); }
  .site-head .nav-toggle { display: inline-flex; margin-left: auto; }
}

/* ── Buttons ────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: inherit; font-size: .95rem; font-weight: 700; text-decoration: none;
  padding: 12px 22px; border-radius: var(--radius-sm); border: 1px solid transparent;
  cursor: pointer; transition: background .12s, border-color .12s, transform .06s, color .12s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--brand-dark); color: #fff; }
.btn-secondary { background: #fff; color: var(--ink); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--bg-alt); color: var(--ink); }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { background: #0e1832; color: #fff; }
.btn-sm { padding: 8px 14px; font-size: .86rem; }
.btn-block { width: 100%; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }

/* ── Cards / panels ─────────────────────────────────────────────────── */
.card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; box-shadow: var(--shadow-sm);
}
.card-link { text-decoration: none; color: inherit; display: block; transition: border-color .12s, box-shadow .12s, transform .12s; }
.card-link:hover { border-color: var(--brand); box-shadow: var(--shadow); transform: translateY(-2px); color: inherit; }
.panel { background: var(--bg-alt); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.grid { display: grid; gap: 20px; }
.cols-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.cols-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.cols-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

/* Fixed column count (set inline per grid via `--n`) instead of auto-fit, so a
   row is never left with one oddly-stretched leftover card — the column count
   always matches how many cards there actually are. */
.grid-fixed { grid-template-columns: repeat(var(--n, 2), 1fr); }
@media (max-width: 900px) { .grid-fixed { grid-template-columns: repeat(2, 1fr) !important; } }
@media (max-width: 560px) { .grid-fixed { grid-template-columns: 1fr !important; } }

.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .74rem; font-weight: 800; color: var(--brand); }
.section-head { margin-bottom: 28px; }
.section-head p { color: var(--ink-soft); margin-top: 8px; max-width: 62ch; }

.badge {
  display: inline-flex; align-items: center; gap: 5px; font-size: .72rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: .06em; padding: 3px 9px; border-radius: 999px;
  background: var(--bg-alt); color: var(--ink-soft); border: 1px solid var(--border);
}
.badge-brand { background: var(--brand-tint); color: var(--brand); border-color: #f3d3dd; }
.badge-ok { background: var(--ok-tint); color: var(--ok); border-color: #cfe9dd; }
.badge-lock { background: var(--warn-tint); color: var(--warn); border-color: #f0e0bf; }

.notice { border-radius: var(--radius); padding: 14px 18px; border: 1px solid var(--border); background: var(--bg-alt); font-size: .92rem; }
.notice-warn { background: var(--warn-tint); border-color: #f0e0bf; color: #6d4100; }
.notice-info { background: var(--brand-tint); border-color: #f3d3dd; color: var(--brand-dark); }
.notice-ok { background: var(--ok-tint); border-color: #cfe9dd; color: #0b5c3e; }

/* ── Hero ───────────────────────────────────────────────────────────── */
.hero { padding: 72px 0 56px; border-bottom: 1px solid var(--border); }
.hero-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 56px; align-items: center; }
.hero h1 { margin: 16px 0 18px; }
.hero .lede { font-size: 1.15rem; color: var(--ink-soft); max-width: 56ch; }
.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 28px; }
.hero-meta { display: flex; gap: 28px; flex-wrap: wrap; margin-top: 32px; }
.hero-meta strong { display: block; font-size: 1.4rem; letter-spacing: -.02em; }
.hero-meta span { font-size: .84rem; color: var(--ink-soft); }
@media (max-width: 900px) { .hero-grid { grid-template-columns: 1fr; gap: 32px; } }

/* structure table used on the landing page */
.spec-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.spec-table th, .spec-table td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.spec-table thead th { font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-soft); background: var(--bg-alt); }
.spec-table tbody tr:last-child td { border-bottom: none; }
.spec-table td strong { color: var(--ink); }
.table-wrap { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }

/* ── Test-type switch ───────────────────────────────────────────────── */
.type-switch { display: inline-flex; background: var(--bg-alt); border: 1px solid var(--border); border-radius: 999px; padding: 4px; gap: 4px; }
.type-switch a {
  text-decoration: none; font-size: .88rem; font-weight: 700; color: var(--ink-soft);
  padding: 7px 16px; border-radius: 999px;
}
.type-switch a.active { background: #fff; color: var(--brand); box-shadow: var(--shadow-sm); }

/* ── Practice / exam runner ─────────────────────────────────────────── */
.runner { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 28px; align-items: start; }
@media (max-width: 1000px) { .runner { grid-template-columns: 1fr; } }
.source { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.source-body { font-size: 1rem; line-height: 1.75; max-height: 62vh; overflow-y: auto; }
.source-body p { margin-bottom: 14px; }
.para-letter { font-weight: 800; color: var(--brand); margin-right: 8px; }
.transcript-line { margin-bottom: 10px; }
.transcript-line b { color: var(--ink); }
.qpanel { position: sticky; top: 92px; }
.qlist { display: flex; flex-direction: column; gap: 18px; max-height: 62vh; overflow-y: auto; padding-right: 6px; }
.q {
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px;
  background: #fff;
}
.q:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(164, 18, 63, .12); }
.q-num { font-size: .76rem; font-weight: 800; color: var(--brand); letter-spacing: .05em; }
.q-prompt { font-weight: 600; margin: 6px 0 12px; }
.q-type { font-size: .72rem; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .06em; }
.opts { display: flex; flex-direction: column; gap: 8px; }
.opt { display: flex; gap: 10px; align-items: flex-start; padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; font-size: .93rem; }
.opt:hover { background: var(--bg-alt); }
.opt input { margin-top: 4px; flex: 0 0 auto; accent-color: var(--brand); }
.opt-letter { font-weight: 800; color: var(--ink-soft); flex: 0 0 auto; }
.gap-input {
  width: 100%; font-family: inherit; font-size: .95rem; padding: 10px 12px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); color: var(--ink);
}
.gap-input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(164, 18, 63, .12); }

.runner-bar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 14px 0 22px; border-bottom: 1px solid var(--border); margin-bottom: 24px;
}
.runner-bar h1 { font-size: 1.3rem; }
.timer { font-variant-numeric: tabular-nums; font-weight: 800; font-size: 1.05rem; padding: 6px 14px; border-radius: 999px; background: var(--ink); color: #fff; }
.timer.low { background: var(--bad); }

/* audio player */
.player { background: var(--ink); color: #fff; border-radius: var(--radius); padding: 18px 20px; }
.player h3 { color: #fff; font-size: 1rem; margin-bottom: 4px; }
.player p { color: #b9c2d6; font-size: .85rem; }
.player-controls { display: flex; align-items: center; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.player .now { font-size: .84rem; color: #d7ddea; min-height: 1.2em; }
.progress { height: 6px; background: rgba(255,255,255,.2); border-radius: 999px; overflow: hidden; margin-top: 12px; }
.progress span { display: block; height: 100%; background: #fff; width: 0; transition: width .25s linear; }

/* ── Results ────────────────────────────────────────────────────────── */
.band-hero { display: flex; align-items: center; gap: 28px; flex-wrap: wrap; }
.band-circle {
  width: 128px; height: 128px; border-radius: 50%; flex: 0 0 auto;
  display: grid; place-items: center; background: var(--brand-tint);
  border: 3px solid var(--brand); color: var(--brand);
}
.band-circle strong { font-size: 2.5rem; line-height: 1; letter-spacing: -.03em; }
.band-circle span { font-size: .7rem; text-transform: uppercase; letter-spacing: .1em; font-weight: 800; }
.criteria-list { display: flex; flex-direction: column; gap: 14px; }
.criterion { display: grid; grid-template-columns: 1fr auto; gap: 6px 14px; align-items: center; }
.criterion b { grid-column: 1; font-size: .92rem; font-weight: 600; }
.criterion .val { grid-column: 2; font-weight: 800; color: var(--brand); font-variant-numeric: tabular-nums; }
.meter { grid-column: 1 / -1; height: 7px; background: var(--bg-alt); border-radius: 999px; overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--brand); border-radius: 999px; }

.review { display: flex; flex-direction: column; gap: 10px; }
.review-item { border: 1px solid var(--border); border-left-width: 4px; border-radius: var(--radius-sm); padding: 12px 14px; font-size: .92rem; }
.review-item.ok { border-left-color: var(--ok); background: var(--ok-tint); }
.review-item.no { border-left-color: var(--bad); background: var(--bad-tint); }
.review-item .ans { font-size: .86rem; color: var(--ink-soft); margin-top: 4px; }
.review-item .ans b { color: var(--ink); }

/* ── Practice set chips ─────────────────────────────────────────────── */
.set-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.set-chip {
  display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: inherit;
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; background: #fff;
  transition: border-color .12s, box-shadow .12s;
}
.set-chip:hover { border-color: var(--brand); box-shadow: var(--shadow-sm); color: inherit; }
.set-chip b { font-size: .95rem; }
.set-chip span { font-size: .76rem; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.set-chip.locked { background: var(--bg-alt); opacity: .85; }

/* ── Dashboard tiles ────────────────────────────────────────────────── */
.tile { border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; background: #fff; }
.tile .label { font-size: .76rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-soft); font-weight: 700; }
.tile .value { font-size: 1.9rem; font-weight: 800; letter-spacing: -.02em; margin-top: 4px; }
.tile .hint { font-size: .8rem; color: var(--ink-faint); }

/* ── Pricing ────────────────────────────────────────────────────────── */
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 24px; align-items: start; }
.plan { border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; background: #fff; position: relative; }
.plan.featured { border-color: var(--brand); border-width: 2px; box-shadow: var(--shadow); }
.plan .flag { position: absolute; top: -12px; left: 28px; background: var(--brand); color: #fff; font-size: .7rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; padding: 4px 12px; border-radius: 999px; }
.plan .price { font-size: 2.6rem; font-weight: 800; letter-spacing: -.03em; }
.plan .price small { font-size: .95rem; font-weight: 600; color: var(--ink-soft); letter-spacing: 0; }
.plan ul { list-style: none; margin: 20px 0; display: flex; flex-direction: column; gap: 10px; }
.plan li { padding-left: 26px; position: relative; font-size: .93rem; }
.plan li::before { content: "✓"; position: absolute; left: 0; color: var(--ok); font-weight: 800; }

/* ── Footer ─────────────────────────────────────────────────────────── */
.site-foot { border-top: 1px solid var(--border); background: var(--bg-alt); padding: 44px 0 32px; margin-top: 40px; }
.foot-grid { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 32px; }
.foot-grid h4 { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-soft); margin-bottom: 12px; }
.foot-grid ul { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.foot-grid a { color: var(--ink); text-decoration: none; font-size: .9rem; }
.foot-grid a:hover { color: var(--brand); }
.disclaimer { margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--border-strong); font-size: .78rem; color: var(--ink-faint); max-width: 90ch; }
@media (max-width: 800px) { .foot-grid { grid-template-columns: 1fr 1fr; } }

/* ── Admin ──────────────────────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; font-size: .87rem; }
.data-table th { text-align: left; padding: 10px 12px; background: var(--bg-alt); font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); border-bottom: 1px solid var(--border); white-space: nowrap; }
.data-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); }
.data-table tbody tr:hover { background: var(--bg-alt); }
.spark { display: flex; align-items: flex-end; gap: 3px; height: 60px; }
.spark i { flex: 1; background: var(--brand); border-radius: 2px 2px 0 0; min-height: 2px; display: block; }

/* writing composer */
.composer { display: flex; flex-direction: column; gap: 10px; }
.composer textarea {
  width: 100%; min-height: 340px; font-family: var(--font); font-size: 1rem; line-height: 1.7;
  padding: 16px; border: 1px solid var(--border-strong); border-radius: var(--radius); resize: vertical; color: var(--ink);
}
.composer textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(164, 18, 63, .12); }
.composer-meta { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: .86rem; color: var(--ink-soft); flex-wrap: wrap; }
.wc.under { color: var(--bad); font-weight: 700; }
.wc.ok { color: var(--ok); font-weight: 700; }

/* auth forms (login / signup) */
.field { text-align: left; margin-bottom: 14px; }
.field label { display: block; font-size: .82rem; font-weight: 700; color: var(--ink-soft); margin-bottom: 6px; }
.field input {
  width: 100%; font: inherit; font-size: .95rem; padding: 10px 12px;
  border: 1px solid var(--border-strong); border-radius: var(--radius); color: var(--ink);
}
.field input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(164, 18, 63, .12); }
.auth-divider { display: flex; align-items: center; gap: 12px; margin: 22px 0; color: var(--ink-faint); font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.auth-toggle { display: flex; justify-content: center; gap: 6px; font-size: .86rem; margin-top: 18px; }

.cue-card { border: 2px solid var(--ink); border-radius: var(--radius); padding: 24px; background: #fff; }
.cue-card h3 { margin-bottom: 12px; }
.cue-card ul { list-style: none; display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.cue-card li { padding-left: 20px; position: relative; }
.cue-card li::before { content: "•"; position: absolute; left: 4px; color: var(--brand); font-weight: 800; }

.qa-list { display: flex; flex-direction: column; gap: 12px; }
.qa-list li { list-style: none; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; }

.data-figure { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.data-figure caption { caption-side: top; text-align: left; padding: 12px 14px; font-weight: 700; font-size: .9rem; background: var(--bg-alt); border-bottom: 1px solid var(--border); }
.data-figure table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.data-figure th, .data-figure td { padding: 9px 14px; border-bottom: 1px solid var(--border); text-align: right; }
.data-figure th:first-child, .data-figure td:first-child { text-align: left; font-weight: 600; }
.data-figure thead th { background: #fff; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-soft); }

@media print { .site-head, .site-foot, .btn { display: none !important; } }

/* ── Task groups (real papers group questions by task type) ───────────── */
.task-group { border-top: 1px solid var(--border); padding-top: 18px; margin-top: 22px; }
.task-group:first-child { border-top: none; padding-top: 0; margin-top: 0; }
.task-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.task-head b { font-size: .95rem; }
.task-instruction { font-size: .88rem; color: var(--ink-soft); background: var(--bg-alt);
  border-left: 3px solid var(--brand); padding: 10px 14px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.heading-bank { border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 14px 16px 14px 32px; margin: 14px 0; background: #fff; }
.heading-bank ol { display: flex; flex-direction: column; gap: 6px; font-size: .9rem; }

/* running order + section markers on the demo */
.run-order { list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px; counter-reset: step; }
.run-order li { counter-increment: step; border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px 14px; background: #fff; }
.run-order li::before { content: counter(step); display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 50%; background: var(--brand); color: #fff;
  font-size: .72rem; font-weight: 800; margin-right: 8px; }
.run-order li b { font-size: .95rem; }
.run-order li span { display: block; font-size: .76rem; color: var(--ink-soft); margin-top: 3px; }
.sec-marker { display: flex; align-items: center; gap: 12px; font-weight: 800; font-size: 1.15rem;
  letter-spacing: -.02em; }
.sec-marker span { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px;
  border-radius: 50%; background: var(--brand); color: #fff; font-size: .9rem; flex: 0 0 auto; }
