:root {
  --bg: #f5efe3;
  --surface: #fffdf8;
  --surface-2: #efe4cf;
  --ink: #2d251d;
  --muted: #74695e;
  --brand: #6b4f2a;
  --brand-2: #956f3f;
  --green: #287a4b;
  --red: #b34239;
  --line: #dfd1bc;
  --shadow: 0 12px 34px rgba(73, 52, 29, .11);
  --radius: 24px;
  --font: 17px;
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; min-height: 100vh; color: var(--ink); background: radial-gradient(circle at 10% 0%, #fffaf1 0, transparent 36%), var(--bg); font: var(--font)/1.55 system-ui, -apple-system, "Noto Sans SC", "Microsoft YaHei", sans-serif; }
button, select { font: inherit; }
button { color: inherit; }
.app-shell { width: min(1120px, 100%); margin: 0 auto; min-height: 100vh; padding-bottom: 92px; }
.topbar { position: sticky; z-index: 20; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px clamp(16px, 4vw, 28px); background: rgba(245,239,227,.93); backdrop-filter: blur(15px); border-bottom: 1px solid rgba(107,79,42,.12); }
.brand { border: 0; background: transparent; display: flex; align-items: center; gap: 11px; text-align: left; cursor: pointer; padding: 0; }
.brand img { width: 48px; height: 48px; border-radius: 14px; box-shadow: 0 4px 12px rgba(0,0,0,.15); }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 1.1rem; }
.brand small { color: var(--muted); }
.top-actions { display: flex; gap: 8px; }
.soft-btn, .primary-btn, .ghost-btn { border-radius: 14px; padding: 10px 14px; cursor: pointer; }
.soft-btn { border: 1px solid var(--line); background: var(--surface); }
.primary-btn { border: 0; background: var(--brand); color: white; font-weight: 700; }
.ghost-btn { border: 1px solid var(--brand); background: transparent; color: var(--brand); font-weight: 700; }
.hidden { display: none !important; }
main { padding: clamp(18px, 4vw, 34px); }
.hero { background: linear-gradient(135deg, #5d4022, #8b673d); color: white; border-radius: 30px; padding: clamp(25px, 6vw, 52px); box-shadow: var(--shadow); display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: center; }
.hero h1 { margin: 5px 0 10px; font-size: clamp(2rem, 6vw, 3.7rem); line-height: 1.12; }
.hero p { margin: 0; max-width: 650px; opacity: .92; }
.hero-stat { text-align: center; min-width: 132px; padding: 18px; border: 1px solid rgba(255,255,255,.28); border-radius: 22px; background: rgba(255,255,255,.1); }
.hero-stat strong { display: block; font-size: 2.6rem; line-height: 1; }
.section-title { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin: 34px 0 14px; }
.section-title h2 { margin: 0; font-size: 1.45rem; }
.section-title p { margin: 0; color: var(--muted); }
.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: 0 8px 24px rgba(73,52,29,.06); }
.click-card { cursor: pointer; transition: transform .18s ease, box-shadow .18s ease; text-align: left; width: 100%; }
.click-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.card h3 { margin: 8px 0 6px; }
.card p { margin: 0; color: var(--muted); }
.badge { display: inline-flex; align-items: center; min-width: 36px; justify-content: center; padding: 6px 10px; border-radius: 12px; background: #f1dfb5; color: #684a1d; font-weight: 800; }
.mini-stat { margin-top: 20px; color: var(--green); font-weight: 700; }
.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.feature-card { display: flex; gap: 14px; align-items: center; }
.feature-card .symbol { font-size: 2rem; min-width: 44px; text-align: center; }
.filter-panel { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 18px; }
.filter-panel label { font-weight: 700; }
.filter-panel select { width: 100%; margin-top: 6px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.quiz-header { display: flex; justify-content: space-between; gap: 14px; align-items: center; margin-bottom: 16px; }
.progress-bar { height: 10px; border-radius: 999px; background: #e5d9c6; overflow: hidden; }
.progress-bar > span { display: block; height: 100%; background: var(--brand-2); transition: width .3s ease; }
.question-card { margin-top: 16px; }
.question-meta { display: flex; gap: 8px; flex-wrap: wrap; color: var(--muted); font-size: .92rem; }
.question-card h2 { font-size: clamp(1.45rem, 4vw, 2rem); margin: 18px 0; }
.options { display: grid; gap: 12px; }
.option { display: grid; grid-template-columns: 40px 1fr; align-items: center; gap: 12px; width: 100%; border: 1px solid var(--line); border-radius: 16px; background: white; padding: 14px; text-align: left; cursor: pointer; }
.option:hover { border-color: var(--brand-2); }
.option .letter { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); font-weight: 800; }
.option.correct { border-color: var(--green); background: #eef8f1; }
.option.wrong { border-color: var(--red); background: #fff0ef; }
.option:disabled { cursor: default; opacity: 1; }
.feedback { margin-top: 18px; padding: 18px; border-radius: 18px; background: #f2eadb; }
.feedback.good { border-left: 6px solid var(--green); }
.feedback.bad { border-left: 6px solid var(--red); }
.feedback h3 { margin: 0 0 8px; }
.feedback p { margin: 6px 0; }
.feedback .reflection { margin-top: 12px; padding-top: 12px; border-top: 1px solid #d8cab5; font-style: italic; }
.action-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.result-score { font-size: clamp(3.5rem, 13vw, 7rem); line-height: 1; color: var(--brand); font-weight: 900; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.stat-card strong { display: block; font-size: 2rem; color: var(--brand); }
.chart-list { display: grid; gap: 12px; }
.chart-row { display: grid; grid-template-columns: 110px 1fr 54px; align-items: center; gap: 10px; }
.chart-row .track { height: 12px; background: #eadfce; border-radius: 999px; overflow: hidden; }
.chart-row .fill { height: 100%; background: var(--brand-2); }
.empty { text-align: center; padding: 50px 20px; }
.bottom-nav { position: fixed; z-index: 30; bottom: 0; left: 50%; transform: translateX(-50%); width: min(1120px, 100%); display: grid; grid-template-columns: repeat(4, 1fr); background: rgba(255,253,248,.96); border-top: 1px solid var(--line); backdrop-filter: blur(15px); padding-bottom: env(safe-area-inset-bottom); }
.bottom-nav button { border: 0; background: transparent; padding: 10px 4px; color: var(--muted); cursor: pointer; }
.bottom-nav span { display: block; font-size: 1.45rem; line-height: 1.1; }
.bottom-nav button.active { color: var(--brand); font-weight: 800; }
body.large-text { --font: 21px; }
body.large-text .option { padding: 18px; }
@media (max-width: 850px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
  .feature-grid, .filter-panel, .stat-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .topbar { align-items: flex-start; }
  .brand small { display: none; }
  .soft-btn { padding: 8px 10px; }
  .hero { grid-template-columns: 1fr; }
  .hero-stat { text-align: left; }
  .grid, .feature-grid, .filter-panel, .stat-grid { grid-template-columns: 1fr; }
  .section-title { display: block; }
  .chart-row { grid-template-columns: 85px 1fr 45px; }
}


/* Audio accessibility controls */
.question-title-row { display:flex; align-items:flex-start; justify-content:space-between; gap:14px; }
.question-title-row h2 { flex:1; margin-top:0; }
.audio-row { display:flex; align-items:center; gap:10px; flex-wrap:wrap; margin:4px 0 14px; }
.audio-btn { border:1px solid #b7c9bf; background:#eef7f1; color:#214c38; border-radius:999px; padding:9px 13px; font-weight:750; cursor:pointer; white-space:nowrap; }
.audio-btn:hover { background:#e1f1e8; }
.audio-btn.secondary { background:#fff; }
.audio-help { color:var(--muted); font-size:.88rem; }
.large-text .audio-btn { font-size:1.08rem; padding:12px 16px; }
@media (max-width:640px) {
  .question-title-row { display:block; }
  .question-title-row .audio-btn { margin:0 0 12px; }
  .top-actions { flex-wrap:wrap; justify-content:flex-end; }
}
