/* ================================================================
   听力口语 9 分训练营 — Editorial Redesign
   风格基准：The Guardian（衬线标题/顶线栏目）、BBC（报头栏/激活下划线/
   深色页脚）、NYT + FT（居中报头、双规则线表格、暖报纸底色）。
   约束：类名与 CSS 变量名与旧版一致（main/practice/placement.js 与
   各页内联样式均依赖），仅重写视觉层。不加载任何外部字体（境内可达）。
   ================================================================ */

:root {
  --accent: #c22113;        /* 编辑红（Kicker/激活/按钮） */
  --accent-strong: #8e1508;
  --accent-soft: #f9ece8;
  --link: #0b4f8a;          /* 正文链接：NYT/Guardian 式蓝 */
  --ink: #1a1a1a;
  --muted: #63605a;
  --bg: #f7f4ee;            /* 暖报纸底 */
  --card: #fffdf9;
  --line: #ddd6c9;
  --masthead: #101418;      /* 报头近黑（BBC） */
  --masthead-ink: #c7cdd4;
  --ok: #1d7a46;
  --warn: #9a6b08;
  --hard: #b3261e;
  --radius: 2px;
  --shadow: 0 1px 0 rgba(26, 26, 26, .04);
  --serif: Georgia, "Times New Roman", "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", "Helvetica Neue", Arial, sans-serif;
  --rule: var(--ink);
}

@media (prefers-color-scheme: dark) {
  :root {
    --accent: #e0574e;
    --accent-strong: #c6483f;
    --accent-soft: #2b1b18;
    --link: #6fa8dc;
    --ink: #e7e3da;
    --muted: #9ba1a9;
    --bg: #0f1216;
    --card: #161b22;
    --line: #2a313b;
    --rule: #e7e3da;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.78;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--link); text-decoration: none; }
a:hover { color: var(--accent-strong); text-decoration: underline; text-underline-offset: 3px; }

::selection { background: var(--accent); color: #fff; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------------- 报头（居中刊头 + 下划线导航） ---------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--masthead);
  border-top: 4px solid var(--accent);
  box-shadow: 0 1px 0 rgba(0, 0, 0, .35);
}

.topbar-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px 20px 0;
  text-align: center;
}

.brand {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 25px;
  line-height: 1.15;
  color: #fff;
  letter-spacing: .04em;
  white-space: nowrap;
}
.brand span { color: #e0574e; font-style: italic; padding: 0 2px; }

.brand::after {
  content: "IELTS LISTEN & SPEAK LAB · EST. 2026";
  display: block;
  font-family: var(--sans);
  font-size: 9.5px;
  font-weight: 400;
  letter-spacing: .38em;
  color: #8b929c;
  margin: 4px 0 12px;
}

.topbar nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  border-top: 1px solid #2a3038;
  gap: 0;
}

.topbar nav a {
  padding: 9px 13px;
  color: var(--masthead-ink);
  font-size: 13.5px;
  font-weight: 500;
  border-radius: 0;
  box-shadow: inset 0 -3px 0 transparent;
}
.topbar nav a:hover {
  color: #fff;
  background: transparent;
  text-decoration: none;
  box-shadow: inset 0 -3px 0 var(--accent);
}
.topbar nav a.active {
  color: #fff;
  font-weight: 700;
  background: transparent;
  box-shadow: inset 0 -3px 0 var(--accent);
}

@media (max-width: 720px) {
  .brand { font-size: 20px; }
  .brand::after { letter-spacing: .22em; }
  .topbar nav a { padding: 8px 9px; font-size: 12.5px; }
}

/* ---------------- 版式 ---------------- */
.wrap { max-width: 1100px; margin: 0 auto; padding: 34px 20px 56px; }

/* 头版式英雄区：顶部墨线 + 眉题 + 衬线大标题 */
.hero {
  background: var(--card);
  border: 1px solid var(--line);
  border-top: 4px solid var(--rule);
  border-radius: var(--radius);
  padding: 30px 32px 28px;
  margin-bottom: 34px;
}

.kicker {
  color: var(--accent);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .32em;
  text-transform: uppercase;
  margin: 0 0 12px;
}

.hero h1 {
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(27px, 4.3vw, 42px);
  line-height: 1.22;
  margin: 0 0 12px;
  letter-spacing: .01em;
}
.hero p.lead { margin: 0 0 8px; font-size: 16.5px; color: var(--muted); max-width: 46em; }
.hero .cta { margin-top: 20px; display: flex; gap: 12px; flex-wrap: wrap; }

h2 {
  font-family: var(--serif);
  font-size: 25px;
  line-height: 1.3;
  margin: 46px 0 6px;
  padding-top: 14px;
  border-top: 3px solid var(--rule);
  scroll-margin-top: 120px;
}
h2 + p.sub { color: var(--muted); margin-top: 2px; }
h3 { font-family: var(--serif); font-size: 18.5px; margin: 26px 0 8px; line-height: 1.4; }

.btn {
  display: inline-block;
  padding: 11px 22px;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: .12em;
  text-transform: uppercase;
  border: 1px solid var(--accent);
  cursor: pointer;
}
.btn:hover { background: var(--accent-strong); border-color: var(--accent-strong); color: #fff; text-decoration: none; }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--rule); }
.btn.ghost:hover { color: var(--accent); border-color: var(--accent); background: transparent; }

/* ---------------- 卡片（顶线式，替代投影） ---------------- */
.grid { display: grid; gap: 18px; margin: 18px 0; }
.grid.c2 { grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); }
.grid.c3 { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-top: 3px solid var(--rule);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow);
  transition: border-top-color .15s ease;
}
.card:hover { border-top-color: var(--accent); }
.card h3 { margin-top: 0; }
.card .meta { color: var(--muted); font-size: 13px; }
.card .tags { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 6px; }

/* 徽章 → 小型全大写线框标签 */
.badge {
  display: inline-block;
  padding: 1px 9px;
  border: 1px solid currentColor;
  border-radius: var(--radius);
  background: transparent;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .08em;
  line-height: 1.7;
  white-space: nowrap;
  vertical-align: 2px;
}
.badge.ez { color: var(--ok); }
.badge.mid { color: var(--warn); }
.badge.hard { color: var(--hard); }
.badge.tool { color: var(--link); }

/* 提示框：Guardian 式左侧粗规则 */
.callout {
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  background: var(--card);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 14px 18px;
  margin: 18px 0;
  font-size: 15px;
}
.callout.warn { border-left-color: var(--warn); }
.callout.ok { border-left-color: var(--ok); }

/* 表格：FT 双规则线 */
.table-wrap { overflow-x: auto; margin: 16px 0; border-bottom: 2px solid var(--rule); }
table { border-collapse: collapse; width: 100%; background: var(--card); font-size: 14.5px; }
th {
  background: transparent;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  border-top: 2px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
th, td { padding: 10px 13px; text-align: left; vertical-align: top; }
td { border-bottom: 1px solid var(--line); }
tr:last-child td { border-bottom: none; }

/* 步骤：墨块衬线序号 */
.steps { counter-reset: step; margin: 18px 0; padding: 0; list-style: none; }
.steps li {
  position: relative;
  padding: 13px 18px 13px 62px;
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 3px solid var(--rule);
  border-radius: var(--radius);
  margin-bottom: 10px;
}
.steps li::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 15px; top: 13px;
  width: 30px; height: 30px;
  background: var(--rule);
  color: var(--bg);
  font-family: var(--serif);
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
  border-radius: var(--radius);
}
.steps b { display: block; }

/* 代码 */
code, pre {
  font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  font-size: 13px;
  border-radius: var(--radius);
}
code { padding: 2px 6px; background: color-mix(in srgb, var(--muted) 16%, transparent); }
pre {
  padding: 14px 16px;
  overflow-x: auto;
  line-height: 1.65;
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
}
pre code { background: none; padding: 0; }

/* ---------------- 打卡器 ---------------- */
.checkin {
  background: var(--card);
  border: 1px solid var(--line);
  border-top: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin: 20px 0;
}
.checkin .date { font-family: var(--serif); font-weight: 700; font-size: 17px; }
.checkin .streak { float: right; color: var(--accent); font-family: var(--serif); font-weight: 700; font-size: 17px; }
.checkin label {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius); cursor: pointer; font-size: 15px;
  border-bottom: 1px solid var(--line);
}
.checkin label:last-of-type { border-bottom: none; }
.checkin label:hover { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.checkin input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); }
.checkin .hint { color: var(--muted); font-size: 13px; margin-top: 10px; }

/* 今日推荐 */
.daily { display: flex; gap: 16px; align-items: flex-start; }
.daily .emoji { font-size: 36px; line-height: 1.1; }

/* ---------------- 听写工作台 ---------------- */
.bench { display: grid; gap: 20px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .bench { grid-template-columns: 5fr 4fr; align-items: start; } }

.bench audio { width: 100%; margin: 8px 0; }
.bench-controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.bench button {
  padding: 8px 14px; border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--card); color: var(--ink);
  font-size: 13.5px; font-weight: 600; cursor: pointer;
}
.bench button:hover { border-color: var(--accent); color: var(--accent); }
.bench button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.bench button.primary:hover { background: var(--accent-strong); color: #fff; }
.bench button:disabled { opacity: .45; cursor: not-allowed; }
.bench .marks { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.bench select {
  padding: 7px 10px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--card); color: var(--ink); font-size: 14px;
}
.bench textarea, .bench input[type=text] {
  width: 100%; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 12px; font-size: 15px; background: var(--card); color: var(--ink);
  font-family: inherit; line-height: 1.7;
}
.bench textarea:focus, .bench input[type=text]:focus { border-color: var(--accent); outline: none; }
.bench textarea { min-height: 130px; resize: vertical; }
.answer-box { min-height: 58px; }
.answer-box .answer {
  background: transparent;
  border: 1px dashed var(--ok);
  color: var(--ok);
  border-radius: var(--radius);
  padding: 10px 14px; font-size: 16px;
  font-family: var(--serif);
}
.answer-box .empty { color: var(--muted); font-size: 14px; padding: 10px 2px; }
.stat-row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 12px; }
.stat {
  flex: 1; min-width: 90px; text-align: center;
  background: transparent;
  border: 1px solid var(--line);
  border-top: 3px solid var(--accent);
  border-radius: var(--radius); padding: 12px 6px 10px;
}
.stat b { display: block; font-family: var(--serif); font-size: 23px; color: var(--ink); }
.stat span { font-size: 12px; color: var(--muted); }
.kbd {
  font-size: 11.5px; border: 1px solid var(--line); border-bottom-width: 2px;
  border-radius: 3px; padding: 1px 6px; background: var(--card);
}

/* 最新素材 */
.feed-box { margin-top: 10px; }
.feed-box ul { margin: 6px 0 0; padding-left: 20px; }
.feed-box li { margin-bottom: 4px; }
.feed-date { color: var(--muted); font-size: 12px; margin-left: 6px; font-variant-numeric: tabular-nums; }

/* ---------------- 页脚（BBC 式深色） ---------------- */
footer {
  background: var(--masthead);
  border-top: 4px solid var(--accent);
  color: #9aa1aa;
  font-size: 13.5px;
  padding: 34px 20px 44px;
  text-align: center;
  margin-top: 56px;
}
footer p { max-width: 840px; margin: 6px auto; }
footer b { color: #fff; font-family: var(--serif); letter-spacing: .05em; }

hr.sep { border: none; border-top: 1px solid var(--line); margin: 36px 0; }

.toc {
  color: var(--muted); font-size: 12.5px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  margin-bottom: 22px;
  letter-spacing: .02em;
}
.toc a { margin-right: 12px; }
.small { font-size: 13px; color: var(--muted); }
