/* CSCA-style training site — shared styles */

:root {
  --navy: #16283f;
  --navy-soft: #233b58;
  --ink: #1c1c1c;
  --muted: #6d6a63;
  --line: #e5e0d5;
  --line-strong: #d3cbb9;
  --bg: #f7f5f0;
  --card: #ffffff;
  --paper: #fbf9f4;
  --gold: #b07a3c;
  --brick: #a6402f;
  --green: #2f6b4f;
  --blue: #2f5d8f;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(22, 40, 63, .04), 0 8px 24px rgba(22, 40, 63, .05);
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Times New Roman", "Times", Georgia, serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

.wrap { max-width: 1160px; margin: 0 auto; padding: 0 24px; }

/* ---------- nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav-inner { display: flex; align-items: center; gap: 28px; height: 68px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; letter-spacing: -.01em; }
.logo-mark {
  width: 30px; height: 30px; border-radius: 9px; background: var(--navy); color: #fff;
  display: grid; place-items: center; font-size: 15px; font-weight: 700;
}
.logo span { color: var(--muted); font-weight: 500; }
.nav-links { display: flex; gap: 22px; margin-left: 8px; }
.nav-links a { font-size: 14.5px; color: #48453f; padding: 6px 0; border-bottom: 2px solid transparent; }
.nav-links a:hover { color: var(--navy); }
.nav-links a.active { color: var(--navy); border-bottom-color: var(--navy); font-weight: 600; }
.nav-links a.soon { color: #a9a49a; cursor: default; }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.lang { font-size: 13px; color: var(--muted); letter-spacing: .06em; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: 12px;
  font-family: inherit; font-size: 15px; font-weight: 600;
  padding: 13px 22px; cursor: pointer; transition: .18s ease;
  white-space: nowrap;
}
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: #1e3355; transform: translateY(-1px); }
.btn-ghost { background: #fff; border-color: var(--line-strong); color: var(--navy); }
.btn-ghost:hover { border-color: var(--navy); }
.btn-sm { padding: 8px 14px; font-size: 13.5px; border-radius: 10px; }
.btn-lg { padding: 16px 26px; font-size: 16px; border-radius: 13px; }
.btn:disabled, .btn[aria-disabled="true"] {
  cursor: not-allowed; opacity: 1; background: #ece8df; color: #6f6a5f; border-color: #ded8ca;
  transform: none;
}
.btn .badge-soon {
  font-size: 10px; letter-spacing: .08em; text-transform: uppercase; font-weight: 700;
  background: #fff; color: #7a7468; border: 1px solid #d8d1c2; border-radius: 999px; padding: 2px 7px;
}
.btn-primary .badge-soon { background: rgba(255,255,255,.14); color: #fff; border-color: rgba(255,255,255,.25); }

/* ---------- hero ---------- */
.hero { padding: 64px 0 56px; background: linear-gradient(180deg, #fbfaf6 0%, var(--bg) 100%); border-bottom: 1px solid var(--line); }
.hero-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 56px; align-items: center; }
.eyebrow {
  font-size: 11.5px; letter-spacing: .18em; text-transform: uppercase; color: var(--gold);
  font-weight: 650; margin: 0 0 14px;
}
h1.hero-title { font-size: 44px; line-height: 1.08; letter-spacing: -.02em; margin: 0 0 18px; color: var(--navy); font-weight: 700; }
.hero-lead { font-size: 17.5px; color: #4f4c45; max-width: 540px; margin: 0 0 28px; line-height: 1.55; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 30px; }
.hero-note { font-size: 13px; color: var(--muted); }
.hero-stats { display: flex; gap: 30px; margin-top: 26px; }
.hero-stat b { display: block; font-size: 22px; color: var(--navy); line-height: 1.1; }
.hero-stat span { font-size: 12.5px; color: var(--muted); }

.exam-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 20px;
  box-shadow: var(--shadow); padding: 26px; position: relative; overflow: hidden;
}
.exam-card::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 4px;
  background: linear-gradient(90deg, var(--navy), #4a6d99, var(--gold));
}
.exam-card h3 { margin: 6px 0 4px; font-size: 15px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 650; }
.exam-title { font-size: 22px; font-weight: 700; color: var(--navy); margin: 0 0 18px; }
.exam-rows { display: grid; gap: 10px; margin-bottom: 20px; }
.exam-row { display: flex; justify-content: space-between; align-items: baseline; padding-bottom: 10px; border-bottom: 1px dashed var(--line); font-size: 14.5px; }
.exam-row b { color: var(--navy); font-size: 15.5px; }
.exam-row span { color: var(--muted); }
.exam-card .btn { width: 100%; }
.exam-hint { text-align: center; font-size: 12px; color: var(--muted); margin: 10px 0 0; }

/* ---------- sections ---------- */
.section { padding: 64px 0; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.section-head h2 { font-size: 30px; letter-spacing: -.015em; margin: 0 0 6px; color: var(--navy); }
.section-head p { margin: 0; color: var(--muted); font-size: 15px; }
.section-link { font-size: 14px; color: var(--navy); font-weight: 600; border-bottom: 1px solid var(--line-strong); padding-bottom: 2px; }

.topic-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.topic-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 20px 16px; display: flex; flex-direction: column; min-height: 176px;
  transition: .18s ease; position: relative;
}
a.topic-card:hover { border-color: #bfc6d2; box-shadow: var(--shadow); transform: translateY(-2px); }
.topic-card.is-soon { background: #fbfaf6; }
.topic-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.rank { font-size: 11.5px; font-weight: 700; letter-spacing: .06em; color: var(--muted); }
.rank b { color: var(--navy); }
.weight { font-size: 12px; font-weight: 650; color: var(--gold); }
.weight.dim { color: #b3ada2; font-weight: 500; }
.topic-card h3 { margin: 0 0 2px; font-size: 18.5px; color: var(--navy); letter-spacing: -.01em; }
.topic-cn { margin: 0 0 8px; font-size: 12.5px; color: #9a9488; letter-spacing: .04em; }
.topic-desc { margin: 0 0 14px; font-size: 13.5px; color: #5f5c55; line-height: 1.45; }
.topic-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; font-size: 12.5px; color: var(--muted); }
.go { color: var(--navy); font-weight: 600; }
.tag-soon { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: #8a8579; border: 1px solid #ded8ca; border-radius: 999px; padding: 2px 8px; }

.how { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.how-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.how-num {
  width: 30px; height: 30px; border-radius: 9px; background: #eef1f5; color: var(--navy);
  display: grid; place-items: center; font-weight: 700; font-size: 14px; margin-bottom: 12px;
}
.how-card h3 { margin: 0 0 6px; font-size: 16.5px; color: var(--navy); }
.how-card p { margin: 0; font-size: 14px; color: #5f5c55; }

/* ---------- footer ---------- */
.footer { border-top: 1px solid var(--line); background: #fff; padding: 40px 0 34px; margin-top: 72px; }
.footer-grid { display: flex; justify-content: space-between; gap: 40px; flex-wrap: wrap; }
.footer-brand { max-width: 320px; }
.footer-brand p { font-size: 12.5px; color: var(--muted); line-height: 1.5; margin: 10px 0 0; }
.footer-cols { display: flex; gap: 56px; }
.footer-col h4 { margin: 0 0 10px; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: #9a9488; font-weight: 650; }
.footer-col a { display: block; font-size: 13.5px; color: #4f4c45; margin-bottom: 6px; }
.footer-col a:hover { color: var(--navy); }
.footer-bottom { margin-top: 30px; padding-top: 18px; border-top: 1px solid var(--line); font-size: 12px; color: #8f8a80; display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }

/* ---------- topic page ---------- */
.topic-main { padding: 26px 0 0; }
.topic-main.compact { padding-top: 16px; }
.topic-main.compact .topic-head { grid-template-columns: 1fr; }
.topic-main.compact .topic-stats, .topic-main.compact .topic-intro, .topic-main.compact .meta-row { display: none; }
.topic-main.compact .topic-head h1 { font-size: 28px; margin-bottom: 2px; }
.topic-main.compact .topic-sub { margin-bottom: 14px; }
.topic-main.compact .tabs { margin-bottom: 20px; }
.crumb { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--muted); margin-bottom: 22px; }
.crumb:hover { color: var(--navy); }
.topic-head { display: grid; grid-template-columns: 1.3fr .7fr; gap: 40px; align-items: start; }
.topic-head h1 { font-size: 40px; line-height: 1.1; letter-spacing: -.02em; margin: 0 0 6px; color: var(--navy); }
.topic-head h1 .zh { font-size: 20px; color: #9a9488; font-weight: 500; letter-spacing: .06em; margin-left: 10px; vertical-align: 6px; }
.topic-sub { margin: 0 0 14px; font-size: 14px; color: var(--muted); letter-spacing: .02em; }
.topic-intro { margin: 0; font-size: 15.5px; color: #4f4c45; line-height: 1.6; max-width: 640px; }

.topic-stats { display: grid; gap: 10px; }
.stat-box { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; display: flex; align-items: baseline; gap: 12px; }
.stat-v { font-size: 22px; font-weight: 700; color: var(--navy); letter-spacing: -.01em; min-width: 74px; }
.stat-l { font-size: 12px; color: var(--muted); line-height: 1.3; }
.stat-box.highlight { border-color: #d9c9ac; background: #fdfaf2; }

.meta-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 22px 0 26px; }
.pill {
  font-size: 12.5px; color: #4f4c45; background: #fff; border: 1px solid var(--line);
  border-radius: 999px; padding: 6px 12px; display: inline-flex; gap: 7px; align-items: center;
}
.pill b { color: var(--navy); font-weight: 650; }
.pill.warm { background: #fdf6ea; border-color: #e8d9bd; color: #7a5a2a; }

.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 28px; }
.tab {
  appearance: none; background: none; border: 0; border-bottom: 2px solid transparent;
  font-family: inherit; font-size: 14.5px; color: var(--muted); padding: 12px 14px;
  cursor: pointer; font-weight: 550; margin-bottom: -1px;
}
.tab:hover { color: var(--navy); }
.tab.active { color: var(--navy); border-bottom-color: var(--navy); font-weight: 650; }
.tab .tab-count {
  font-size: 11px; background: #eef1f5; color: #55627a; border-radius: 999px;
  padding: 1px 7px; margin-left: 6px; font-weight: 600;
}

/* ---------- theory ---------- */
.theory-grid { display: grid; grid-template-columns: 1.25fr .75fr; gap: 28px; align-items: start; }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 24px 26px; }
.card h3 { margin: 0 0 16px; font-size: 17px; color: var(--navy); letter-spacing: -.01em; }
.kp-list { list-style: none; margin: 0; padding: 0; counter-reset: kp; }
.kp-list li { position: relative; padding: 0 0 0 44px; margin-bottom: 18px; }
.kp-list li:last-child { margin-bottom: 0; }
.kp-list li::before {
  counter-increment: kp; content: counter(kp);
  position: absolute; left: 0; top: 0; width: 28px; height: 28px; border-radius: 8px;
  background: #eef1f5; color: var(--navy); font-size: 13px; font-weight: 700;
  display: grid; place-items: center;
}
.kp-list b { display: block; font-size: 15px; color: var(--navy); margin-bottom: 3px; }
.kp-list span { font-size: 13.5px; color: #5f5c55; line-height: 1.5; }

.freq-list { display: grid; gap: 12px; }
.freq-item { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; font-size: 13.5px; }
.freq-item .bar { grid-column: 1 / -1; height: 6px; background: #f0ece3; border-radius: 999px; overflow: hidden; }
.freq-item .bar i { display: block; height: 100%; background: linear-gradient(90deg, #4a6d99, var(--navy)); border-radius: 999px; }
.freq-item b { font-weight: 600; color: #3c3a34; }
.freq-item span { color: var(--muted); font-size: 12.5px; }

.tip {
  border-left: 3px solid var(--gold); background: #fbf7ee; border-radius: 0 10px 10px 0;
  padding: 14px 16px; font-size: 13.5px; color: #514c43; line-height: 1.55;
}
.tip b { color: #6d4c1e; }

/* ---------- practice ---------- */
.practice-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  appearance: none; font-family: inherit; font-size: 12.5px; color: #4f4c45;
  background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; cursor: pointer;
}
.chip:hover { border-color: var(--line-strong); }
.chip.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.chip .n { opacity: .65; margin-left: 5px; font-size: 11px; }

.progress-row { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.progress-text { font-size: 13px; color: var(--muted); white-space: nowrap; }
.progress-track { flex: 1; height: 6px; background: #ebe7de; border-radius: 999px; overflow: hidden; }
.progress-track i { display: block; height: 100%; background: var(--navy); border-radius: 999px; }
.score-chip { font-size: 12.5px; color: var(--green); font-weight: 650; white-space: nowrap; }

.q-card { background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 30px 32px 26px; box-shadow: var(--shadow); }
.q-meta { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.q-num { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 650; }
.q-topic { font-size: 11.5px; color: #7a5a2a; background: #fbf3e2; border-radius: 999px; padding: 3px 10px; }
.q-stars { color: var(--gold); font-size: 12px; letter-spacing: .1em; }
.q-stars .off { color: #e3dccd; }

.q-text { font-family: var(--font-serif); font-size: 22px; line-height: 1.55; margin: 0 0 22px; color: #1b1b1b; }
.frac { display: inline-block; vertical-align: -.5em; text-align: center; font-size: .92em; line-height: 1.05; margin: 0 .08em; }
.frac .fn { display: block; padding: 0 .2em .03em; border-bottom: .9px solid currentColor; }
.frac .fd { display: block; padding: .03em .2em 0; }
sup, sub { font-size: .64em; line-height: 0; }

.opts { display: grid; gap: 10px; margin-bottom: 22px; }
.opt {
  display: flex; align-items: center; gap: 14px; text-align: left;
  background: #fff; border: 1.5px solid var(--line); border-radius: 13px;
  padding: 11px 16px; font-family: var(--font-serif); font-size: 18px; color: var(--ink);
  cursor: pointer; transition: .15s ease; width: 100%;
}
.opt:hover:not(.locked) { border-color: #c3b9a4; background: #fdfcf9; }
.opt .letter {
  flex: 0 0 30px; width: 30px; height: 30px; border-radius: 50%; border: 1.5px solid #cfc6b3;
  display: grid; place-items: center; font-family: var(--font-ui); font-size: 12.5px; font-weight: 650; color: #6d665a;
}
.opt.selected { border-color: var(--navy); background: #f2f5f9; }
.opt.selected .letter { background: var(--navy); border-color: var(--navy); color: #fff; }
.opt.correct { border-color: var(--green); background: #f0f7f2; }
.opt.correct .letter { background: var(--green); border-color: var(--green); color: #fff; }
.opt.wrong { border-color: var(--brick); background: #fbf0ec; }
.opt.wrong .letter { background: var(--brick); border-color: var(--brick); color: #fff; }
.opt.locked { cursor: default; }

.feedback { border-radius: 13px; padding: 16px 18px; margin-bottom: 20px; font-size: 14.5px; display: none; }
.feedback.show { display: block; }
.feedback.ok { background: #f0f7f2; border: 1px solid #cfe3d6; color: #24543d; }
.feedback.no { background: #fbf0ec; border: 1px solid #ecd2c9; color: #7d2f1f; }
.feedback b { font-weight: 700; }

.solution { display: none; background: #fbf9f4; border: 1px solid var(--line); border-left: 3px solid var(--gold);
  border-radius: 10px; padding: 16px 18px; font-size: 14.5px; color: #3c3a34; line-height: 1.6; margin-bottom: 20px; }
.solution.show { display: block; }
.solution .sol-label { font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--gold); font-weight: 700; margin-bottom: 8px; }
.solution .frac { display: inline-block; vertical-align: -.5em; text-align: center; font-size: .95em; line-height: 1.05; margin: 0 .08em; }

.q-actions { display: flex; gap: 10px; align-items: center; margin-top: 4px; }
.q-actions .spacer { flex: 1; }
.q-actions .btn { padding: 11px 20px; font-size: 14.5px; }
.hint-keys { font-size: 12px; color: #a09a8e; }

/* ---------- results ---------- */
.result-head { display: grid; grid-template-columns: auto 1fr; gap: 28px; align-items: center; }
.score-ring { width: 132px; height: 132px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--navy) var(--p), #ece7dc 0); }
.score-ring .inner { width: 104px; height: 104px; border-radius: 50%; background: #fff; display: grid; place-items: center; text-align: center; }
.score-ring .inner b { font-size: 26px; color: var(--navy); line-height: 1; }
.score-ring .inner span { font-size: 11px; color: var(--muted); display: block; margin-top: 3px; }
.result-title { font-size: 24px; color: var(--navy); margin: 0 0 6px; letter-spacing: -.01em; }
.result-sub { margin: 0; color: var(--muted); font-size: 14px; }

.breakdown { display: grid; gap: 10px; margin-top: 22px; }
.bd-row { display: grid; grid-template-columns: 180px 1fr 52px; gap: 16px; align-items: center; font-size: 13.5px; }
.bd-row .bar { height: 7px; background: #efeade; border-radius: 999px; overflow: hidden; }
.bd-row .bar i { display: block; height: 100%; background: var(--green); border-radius: 999px; }
.bd-row .bar.low i { background: var(--brick); }
.bd-row .val { text-align: right; color: var(--muted); font-size: 12.5px; }

.mistakes { display: grid; gap: 10px; margin-top: 6px; }
.mistake { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; background: #fff; }
.mistake-head { display: flex; gap: 10px; align-items: baseline; font-size: 13.5px; color: var(--muted); margin-bottom: 6px; }
.mistake-head b { color: var(--navy); font-size: 14px; }
.mistake-q { font-family: var(--font-serif); font-size: 16.5px; margin-bottom: 8px; }
.mistake-ans { font-size: 13px; color: var(--brick); }
.mistake-ans b { color: var(--green); }

.empty-state { text-align: center; padding: 56px 20px; color: var(--muted); }
.empty-state .big { font-size: 40px; margin-bottom: 12px; }

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  .hero-grid { grid-template-columns: 1fr; gap: 36px; }
  h1.hero-title { font-size: 36px; }
  .topic-grid { grid-template-columns: repeat(2, 1fr); }
  .topic-head { grid-template-columns: 1fr; gap: 24px; }
  .topic-stats { grid-template-columns: repeat(3, 1fr); }
  .theory-grid { grid-template-columns: 1fr; }
  .how { grid-template-columns: 1fr; }
  .nav-links { display: none; }
}
@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  h1.hero-title { font-size: 30px; }
  .hero { padding: 40px 0 36px; }
  .topic-grid { grid-template-columns: 1fr; }
  .topic-stats { grid-template-columns: 1fr; }
  .q-card { padding: 22px 18px; }
  .q-text { font-size: 19px; }
  .opt { font-size: 17px; }
  .result-head { grid-template-columns: 1fr; justify-items: start; gap: 18px; }
  .section { padding: 44px 0; }
  .section-head h2 { font-size: 24px; }
  .footer-cols { gap: 32px; flex-wrap: wrap; }
  .bd-row { grid-template-columns: 1fr 70px 40px; }
  .tabs { overflow-x: auto; }
}
