/* =========================================================
   家和题库 · 婚育知识 600 题
   ========================================================= */

:root {
  --paper: #f5efe3;
  --paper-deep: #ede4d4;
  --card: #fffdf8;
  --ink: #24302a;
  --ink-soft: #4f5a52;
  --muted: #8a8172;
  --muted-light: #a89e8c;
  --line: #e6dccb;
  --line-strong: #d8cbb6;
  --green: #2f6b5e;
  --green-deep: #1f5148;
  --green-soft: #e7f2ec;
  --coral: #c0503f;
  --coral-soft: #fbeae5;
  --gold: #b9904e;
  --gold-soft: #f7efdd;
  --hy: #b45f47;
  --hy-soft: #f7e8e1;
  --jt: #2f6b5e;
  --jt-soft: #e7f2ec;
  --shadow-sm: 0 10px 30px -24px rgba(47, 54, 44, .45);
  --shadow-md: 0 24px 60px -36px rgba(47, 54, 44, .42);
  --shadow-lg: 0 36px 90px -48px rgba(47, 54, 44, .5);
  --serif: "Noto Serif CJK SC", "Songti SC", "STSong", "SimSun", serif;
  --sans: "PingFang SC", "Noto Sans CJK SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --radius: 20px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  overflow-x: clip;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(ellipse 60% 42% at 8% -4%, rgba(193, 154, 88, .18), transparent 62%),
    radial-gradient(ellipse 56% 40% at 100% 2%, rgba(47, 107, 94, .13), transparent 64%),
    radial-gradient(ellipse 60% 44% at 88% 100%, rgba(180, 95, 71, .09), transparent 62%),
    linear-gradient(180deg, #f8f3e9 0%, var(--paper) 46%, #f1e9db 100%);
}

button {
  font: inherit;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 3px;
}

::selection {
  background: rgba(47, 107, 94, .18);
}

#app {
  min-height: 100vh;
  min-height: 100dvh;
}

.page-enter {
  animation: pageIn .38s cubic-bezier(.2, .7, .3, 1) both;
}

@keyframes pageIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* =========================================================
   Home
   ========================================================= */

.home {
  width: 100%;
  max-width: 740px;
  margin: 0 auto;
  padding: 26px 20px 64px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .18em;
  color: var(--muted);
}

.brand-seal {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: var(--green);
  color: #fbf6ea;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 700;
  box-shadow: 0 10px 24px -14px rgba(31, 81, 72, .8);
}

.brand-name {
  color: var(--ink-soft);
  font-size: 13px;
  letter-spacing: .14em;
}

.brand-tag {
  margin-left: auto;
  padding: 4px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: .12em;
  font-weight: 500;
}

.hero {
  position: relative;
  margin-top: 34px;
  padding-bottom: 2px;
}

.hero::after {
  content: "600";
  position: absolute;
  top: -42px;
  right: -14px;
  z-index: -1;
  color: rgba(47, 107, 94, .055);
  font-family: var(--serif);
  font-size: clamp(110px, 22vw, 176px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -.06em;
  user-select: none;
}

.eyebrow {
  margin: 0;
  color: var(--hy);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .2em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 9px 0 10px;
  font-family: var(--serif);
  font-size: clamp(36px, 9.4vw, 54px);
  font-weight: 700;
  line-height: 1.14;
  letter-spacing: .01em;
}

.hero h1 .accent {
  color: var(--green);
}

.hero-sub {
  max-width: 30em;
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.75;
}

.stats-card {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 26px;
  padding: 17px 6px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 253, 248, .82);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(8px);
}

.stat {
  padding: 0 9px;
  text-align: center;
}

.stat + .stat {
  border-left: 1px solid var(--line);
}

.stat strong {
  display: block;
  font-family: var(--serif);
  font-size: 27px;
  font-weight: 700;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.stat strong .unit {
  margin-left: 1px;
  color: var(--muted-light);
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
}

.stat em {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  letter-spacing: .04em;
}

.library-progress {
  margin-top: 11px;
  padding: 0 2px;
}

.library-progress .lp-top {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  color: var(--muted-light);
  font-size: 10.5px;
  letter-spacing: .04em;
}

.library-progress .lp-track {
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(216, 203, 182, .45);
}

.library-progress .lp-track i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--green), #5f9384);
  transition: width .5s cubic-bezier(.2, .7, .3, 1);
}

.resume-card {
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  margin-top: 16px;
  padding: 14px 16px;
  border: 1px dashed #c8b693;
  border-radius: 16px;
  background: rgba(255, 250, 240, .74);
  text-align: left;
  cursor: pointer;
  transition: border-color .2s, background .2s, transform .2s;
}

.resume-card:hover {
  border-color: var(--gold);
  background: #fffaf0;
  transform: translateY(-1px);
}

.resume-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: var(--gold-soft);
  color: var(--gold);
  font-size: 15px;
}

.resume-text {
  min-width: 0;
  flex: 1;
}

.resume-text strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
}

.resume-text span {
  display: block;
  margin-top: 1px;
  color: var(--muted);
  font-size: 11px;
}

.resume-arrow {
  color: var(--gold);
  font-size: 18px;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin: 34px 0 14px;
}

.section-head h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: .01em;
}

.section-head .section-note {
  color: var(--muted-light);
  font-size: 11px;
  letter-spacing: .02em;
}

.set-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.subject-hy {
  --subject-color: var(--hy);
  --subject-soft: var(--hy-soft);
}

.subject-jt {
  --subject-color: var(--jt);
  --subject-soft: var(--jt-soft);
}

.set-card {
  position: relative;
  overflow: hidden;
  padding: 15px 15px 13px 17px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
  box-shadow: var(--shadow-sm);
  text-align: left;
  cursor: pointer;
  transition: transform .22s cubic-bezier(.2, .7, .3, 1), box-shadow .22s, border-color .22s;
}

.set-card::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 3px;
  background: var(--subject-color, var(--green));
  opacity: .82;
}

.set-card:hover {
  transform: translateY(-3px);
  border-color: var(--line-strong);
  box-shadow: 0 20px 44px -30px rgba(47, 54, 44, .5);
}

.set-card:active {
  transform: translateY(-1px) scale(.995);
}

.set-card.is-done {
  background: linear-gradient(160deg, #fffdf8 30%, rgba(231, 242, 236, .55));
}

.set-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.set-no {
  color: var(--muted-light);
  font-family: var(--serif);
  font-size: 23px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}

.subject-pill {
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--subject-soft, var(--green-soft));
  color: var(--subject-color, var(--green));
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .04em;
  white-space: nowrap;
}

.set-title {
  margin: 13px 0 2px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
}

.set-sub {
  color: var(--muted-light);
  font-size: 10.5px;
  letter-spacing: .02em;
}

.set-track {
  height: 5px;
  margin: 14px 0 9px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--paper-deep);
}

.set-track i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--subject-color, var(--green));
  transition: width .5s cubic-bezier(.2, .7, .3, 1);
}

.set-foot {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted-light);
  font-size: 10.5px;
}

.set-foot strong {
  color: var(--subject-color, var(--green));
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.set-foot strong .score-unit {
  margin-left: 1px;
  font-size: 9.5px;
  font-weight: 500;
}

.wrong-entry {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  margin-top: 16px;
  padding: 15px 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
  box-shadow: var(--shadow-sm);
  text-align: left;
  cursor: pointer;
  transition: transform .2s, border-color .2s, box-shadow .2s;
}

.wrong-entry:hover {
  transform: translateY(-2px);
  border-color: #e5c4ba;
  box-shadow: var(--shadow-md);
}

.we-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 43px;
  height: 43px;
  border-radius: 13px;
  background: var(--coral-soft);
  color: var(--coral);
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 700;
}

.we-text {
  min-width: 0;
  flex: 1;
}

.we-text strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
}

.we-text span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.we-count {
  display: flex;
  flex: none;
  align-items: baseline;
  gap: 2px;
  color: var(--coral);
  font-variant-numeric: tabular-nums;
}

.we-count strong {
  font-family: var(--serif);
  font-size: 24px;
  line-height: 1;
}

.we-count span {
  color: var(--muted-light);
  font-size: 10px;
}

.rule-note {
  display: flex;
  gap: 10px;
  margin-top: 30px;
  padding: 14px 15px;
  border-radius: 14px;
  background: rgba(255, 253, 248, .56);
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.75;
}

.rule-note b {
  color: var(--ink-soft);
  font-weight: 600;
}

.rule-note .rule-icon {
  flex: none;
  color: var(--gold);
  font-family: var(--serif);
  font-size: 15px;
}

.foot-note {
  margin-top: 34px;
  color: var(--muted-light);
  font-size: 10.5px;
  line-height: 1.9;
  text-align: center;
  letter-spacing: .02em;
}

/* =========================================================
   Quiz
   ========================================================= */

.quiz-head {
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 1px solid rgba(216, 203, 182, .72);
  background: rgba(247, 242, 232, .9);
  backdrop-filter: blur(18px) saturate(1.15);
  -webkit-backdrop-filter: blur(18px) saturate(1.15);
}

.quiz-head-inner {
  width: 100%;
  max-width: 780px;
  margin: 0 auto;
  padding: 10px 18px 9px;
}

.quiz-nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-btn {
  display: grid;
  flex: none;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 253, 248, .72);
  color: var(--ink-soft);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  transition: background .2s, border-color .2s;
}

.icon-btn:hover {
  border-color: var(--line-strong);
  background: var(--card);
}

.quiz-set-name {
  min-width: 0;
  flex: 1;
}

.quiz-set-name small {
  display: block;
  color: var(--muted-light);
  font-size: 9.5px;
  line-height: 1.2;
  letter-spacing: .14em;
}

.quiz-set-name strong {
  display: block;
  overflow: hidden;
  margin-top: 1px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quiz-timer {
  flex: none;
  color: var(--muted);
  font-family: var(--serif);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  letter-spacing: .04em;
}

.quiz-progress {
  margin-top: 9px;
}

.quiz-progress-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 10.5px;
  letter-spacing: .02em;
}

.quiz-progress-top b {
  color: var(--ink);
  font-family: var(--serif);
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.quiz-progress-top .score-now b {
  color: var(--green);
}

.quiz-track {
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(216, 203, 182, .44);
}

.quiz-track i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--green), #5f9384);
  transition: width .4s cubic-bezier(.2, .7, .3, 1);
}

.quiz-counters {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 7px;
  color: var(--muted);
  font-size: 10.5px;
  letter-spacing: .02em;
}

.counter {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
}

.counter b {
  font-family: var(--serif);
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.counter.ok b {
  color: #2f7d5f;
}

.counter.bad b {
  color: var(--coral);
}

.counter.rest {
  margin-left: auto;
  color: var(--muted-light);
}

.quiz-body {
  width: 100%;
  max-width: 780px;
  margin: 0 auto;
  padding: 18px 18px 54px;
}

.question-card {
  padding: 22px 19px 20px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--card);
  box-shadow: var(--shadow-md);
  animation: questionIn .34s cubic-bezier(.2, .7, .3, 1) both;
}

@keyframes questionIn {
  from { opacity: 0; transform: translateY(9px); }
  to { opacity: 1; transform: translateY(0); }
}

.q-top {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 13px;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--gold-soft);
  color: #96723c;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .06em;
  white-space: nowrap;
}

.tag.multi {
  background: #efe8f7;
  color: #6f5490;
}

.q-index {
  color: var(--muted-light);
  font-size: 10.5px;
  letter-spacing: .04em;
}

.q-hint {
  margin-left: auto;
  color: var(--muted-light);
  font-size: 10px;
  letter-spacing: .02em;
}

.q-stem {
  margin: 0 0 19px;
  font-family: var(--serif);
  font-size: clamp(18px, 4.6vw, 21px);
  font-weight: 600;
  line-height: 1.72;
  letter-spacing: .01em;
}

.options {
  display: grid;
  gap: 9px;
}

.option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  padding: 13px 14px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: #fcf8f0;
  text-align: left;
  cursor: pointer;
  transition: border-color .18s, background .18s, transform .18s, box-shadow .18s;
}

.option:hover:not(:disabled) {
  border-color: #b9c9bd;
  background: #fffefa;
  transform: translateX(2px);
}

.option:active:not(:disabled) {
  transform: translateX(2px) scale(.998);
}

.option:disabled {
  cursor: default;
}

.opt-letter {
  display: grid;
  flex: none;
  place-items: center;
  width: 29px;
  height: 29px;
  margin-top: 1px;
  border: 1.5px solid #d8ccb8;
  border-radius: 50%;
  background: rgba(255, 253, 248, .7);
  color: #857a68;
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1;
  transition: background .18s, border-color .18s, color .18s;
}

.option.multi .opt-letter {
  border-radius: 8px;
}

.opt-text {
  flex: 1;
  color: var(--ink-soft);
  font-size: 14.5px;
  line-height: 1.65;
  word-break: break-word;
}

.option.selected {
  border-color: var(--green);
  background: var(--green-soft);
  box-shadow: 0 8px 20px -18px rgba(31, 81, 72, .55);
}

.option.selected .opt-letter {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.option.correct {
  border-color: #2f7d5f;
  background: #e8f5ee;
}

.option.correct .opt-letter {
  border-color: #2f7d5f;
  background: #2f7d5f;
  color: #fff;
}

.option.wrong {
  border-color: var(--coral);
  background: var(--coral-soft);
}

.option.wrong .opt-letter {
  border-color: var(--coral);
  background: var(--coral);
  color: #fff;
}

.confirm-btn {
  width: 100%;
  margin-top: 18px;
  padding: 14px 16px;
  border: 0;
  border-radius: 14px;
  background: var(--green);
  color: #fff;
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: .04em;
  cursor: pointer;
  box-shadow: 0 14px 28px -18px rgba(31, 81, 72, .72);
  transition: background .2s, opacity .2s, transform .2s;
}

.confirm-btn:hover:not(:disabled) {
  background: var(--green-deep);
  transform: translateY(-1px);
}

.confirm-btn:disabled {
  background: #ddd5c7;
  color: #968d7d;
  box-shadow: none;
  cursor: not-allowed;
}

.feedback {
  display: none;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding: 11px 14px;
  border-radius: 12px;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.5;
}

.feedback.show {
  display: flex;
  animation: feedbackIn .26s cubic-bezier(.2, .7, .3, 1) both;
}

@keyframes feedbackIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

.feedback b {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 11px;
}

.feedback.ok {
  background: var(--green-soft);
  color: #256b50;
}

.feedback.ok b {
  background: #2f7d5f;
  color: #fff;
}

.feedback.bad {
  background: var(--coral-soft);
  color: #a84536;
}

.feedback.bad b {
  background: var(--coral);
  color: #fff;
}

.kbd-hint {
  margin: 18px 0 0;
  color: var(--muted-light);
  font-size: 10.5px;
  text-align: center;
  letter-spacing: .03em;
}

@media (hover: none) {
  .kbd-hint {
    display: none;
  }
}

/* =========================================================
   Shared page nav
   ========================================================= */

.page-nav {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(216, 203, 182, .72);
  background: rgba(247, 242, 232, .9);
  backdrop-filter: blur(18px) saturate(1.15);
  -webkit-backdrop-filter: blur(18px) saturate(1.15);
}

.page-nav-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 780px;
  margin: 0 auto;
  padding: 12px 18px;
}

.page-nav h1 {
  flex: 1;
  margin: 0;
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: .02em;
}

.page-nav .nav-count {
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

/* =========================================================
   Result
   ========================================================= */

.result-page,
.wrong-page {
  width: 100%;
  max-width: 780px;
  margin: 0 auto;
  padding-bottom: 60px;
}

.result-hero {
  margin: 16px 18px 0;
  padding: 27px 20px 23px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background:
    radial-gradient(ellipse 80% 55% at 50% -12%, rgba(193, 154, 88, .17), transparent 66%),
    linear-gradient(180deg, #fffdf8 0%, #faf4e8 100%);
  box-shadow: var(--shadow-md);
  text-align: center;
}

.result-hero .eyebrow {
  color: var(--muted);
  font-size: 10.5px;
  letter-spacing: .14em;
}

.score-ring {
  --p: 0;
  --ring: var(--green);
  position: relative;
  display: grid;
  place-items: center;
  width: 174px;
  height: 174px;
  margin: 20px auto 17px;
  border-radius: 50%;
  background: conic-gradient(var(--ring) calc(var(--p) * 1%), #ebe2d2 0);
  box-shadow: 0 18px 40px -30px rgba(47, 54, 44, .6);
}

.score-ring::before {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  background: #fffdf8;
}

.score-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 146px;
  height: 146px;
  border: 1px solid #f0e8d9;
  border-radius: 50%;
  background: #fffdf8;
}

.score-inner strong {
  font-family: var(--serif);
  font-size: 58px;
  font-weight: 700;
  line-height: .95;
  letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
}

.score-inner span {
  margin-top: 6px;
  color: var(--muted-light);
  font-size: 10px;
  letter-spacing: .26em;
}

.result-grade {
  margin: 0;
  font-family: var(--serif);
  font-size: 27px;
  font-weight: 700;
  line-height: 1.25;
}

.result-sub {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.result-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
  margin: 13px 18px 0;
}

.rs {
  padding: 12px 7px 11px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 253, 248, .8);
  text-align: center;
}

.rs strong {
  display: block;
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 700;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.rs span {
  display: block;
  margin-top: 2px;
  color: var(--muted-light);
  font-size: 10px;
  letter-spacing: .04em;
}

.rs.ok strong {
  color: #2f7d5f;
}

.rs.bad strong {
  color: var(--coral);
}

.review-section {
  padding: 28px 18px 0;
}

.review-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 5px;
}

.review-head h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 700;
}

.review-head .count-pill {
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--coral-soft);
  color: var(--coral);
  font-size: 10.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.review-sub {
  margin: 0 0 15px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.7;
}

.review-list {
  display: grid;
  gap: 13px;
}

.review-item {
  padding: 17px 15px 15px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
  box-shadow: var(--shadow-sm);
}

.review-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  margin-bottom: 10px;
  color: var(--muted-light);
  font-size: 10px;
  letter-spacing: .02em;
}

.review-meta .meta-sep {
  width: 1px;
  height: 10px;
  background: var(--line-strong);
}

.review-meta .meta-right {
  margin-left: auto;
  color: var(--muted-light);
  font-variant-numeric: tabular-nums;
}

.review-item h3 {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.7;
  word-break: break-word;
}

.review-options {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.review-option {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: #faf6ee;
  font-size: 13px;
  line-height: 1.55;
}

.review-option .letter {
  display: grid;
  flex: none;
  place-items: center;
  width: 23px;
  height: 23px;
  border-radius: 50%;
  background: #ece4d5;
  color: #827665;
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1;
}

.review-option .text {
  flex: 1;
  color: var(--ink-soft);
  word-break: break-word;
}

.review-option.is-correct {
  border-color: #c9e5d7;
  background: #eef8f2;
}

.review-option.is-correct .letter {
  background: #2f7d5f;
  color: #fff;
}

.review-option.is-wrong {
  border-color: #f0ccc2;
  background: #fdf1ed;
}

.review-option.is-wrong .letter {
  background: var(--coral);
  color: #fff;
}

.badges {
  display: flex;
  flex: none;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
  margin-left: auto;
}

.badge {
  padding: 2px 6px;
  border-radius: 5px;
  font-size: 9px;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
}

.badge.ok {
  background: #d8eee2;
  color: #256b50;
}

.badge.bad {
  background: #f6d8d1;
  color: #a84536;
}

.explain {
  margin-top: 12px;
  padding: 11px 13px;
  border-left: 3px solid #d2b37c;
  border-radius: 4px 11px 11px 4px;
  background: #f7f1e5;
}

.explain b {
  display: block;
  margin-bottom: 3px;
  color: #9c783d;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .18em;
}

.explain p {
  margin: 0;
  color: #556057;
  font-size: 12.5px;
  line-height: 1.8;
  word-break: break-word;
}

.perfect-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 30px 20px;
  border: 1px solid #cfe6d9;
  border-radius: 20px;
  background: linear-gradient(160deg, #f2faf5, #fffdf8);
  text-align: center;
}

.perfect-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin-bottom: 12px;
  border-radius: 50%;
  background: #d9efe3;
  color: #2f7d5f;
  font-size: 25px;
}

.perfect-card h3 {
  margin: 0 0 5px;
  font-family: var(--serif);
  font-size: 20px;
}

.perfect-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.result-actions {
  display: grid;
  gap: 9px;
  padding: 26px 18px 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  padding: 14px 18px;
  border: 1px solid transparent;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .03em;
  cursor: pointer;
  transition: transform .18s, background .18s, border-color .18s, box-shadow .18s;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn.primary {
  background: var(--green);
  color: #fff;
  box-shadow: 0 16px 32px -22px rgba(31, 81, 72, .8);
}

.btn.primary:hover {
  background: var(--green-deep);
}

.btn.ghost {
  border-color: var(--line-strong);
  background: var(--card);
  color: var(--ink-soft);
}

.btn.ghost:hover {
  border-color: #c5b59b;
}

.btn.quiet {
  background: transparent;
  color: var(--muted);
}

.btn.quiet:hover {
  background: rgba(255, 253, 248, .6);
}

/* =========================================================
   Wrong book
   ========================================================= */

.wrong-summary {
  padding: 16px 18px 0;
}

.wrong-summary p {
  margin: 0 0 13px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.75;
}

.filters {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding-bottom: 3px;
  scrollbar-width: none;
}

.filters::-webkit-scrollbar {
  display: none;
}

.chip {
  flex: none;
  padding: 7px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 253, 248, .72);
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.5;
  cursor: pointer;
  transition: background .18s, color .18s, border-color .18s;
}

.chip:hover {
  border-color: var(--line-strong);
}

.chip.active {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.chip .chip-count {
  margin-left: 5px;
  opacity: .7;
  font-variant-numeric: tabular-nums;
}

.wrong-list-wrap {
  padding: 14px 18px 0;
}

.wrong-list-wrap .review-item {
  margin-bottom: 13px;
}

.load-more {
  width: 100%;
  margin: 2px 0 10px;
  padding: 12px;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  transition: background .18s, border-color .18s;
}

.load-more:hover {
  border-color: var(--gold);
  background: rgba(255, 253, 248, .55);
}

.empty-state {
  padding: 66px 24px 40px;
  text-align: center;
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 78px;
  height: 78px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: var(--paper-deep);
  color: #b4a78f;
  font-family: var(--serif);
  font-size: 31px;
}

.empty-state h2 {
  margin: 0 0 7px;
  font-family: var(--serif);
  font-size: 21px;
}

.empty-state p {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.75;
}

.danger-zone {
  padding: 26px 18px 0;
  text-align: center;
}

.danger-link {
  padding: 8px 14px;
  border: 0;
  background: transparent;
  color: var(--muted-light);
  font-size: 11px;
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
}

.danger-link:hover {
  color: var(--coral);
}

/* =========================================================
   Toast + modal
   ========================================================= */

.toast {
  position: fixed;
  bottom: calc(26px + env(safe-area-inset-bottom));
  left: 50%;
  z-index: 120;
  max-width: calc(100vw - 40px);
  padding: 10px 17px;
  border-radius: 999px;
  background: rgba(36, 48, 42, .94);
  color: #fff;
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity .24s, transform .24s;
  box-shadow: 0 16px 40px -18px rgba(0, 0, 0, .5);
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(30, 36, 31, .46);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: fadeIn .18s ease both;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  width: 100%;
  max-width: 360px;
  padding: 24px 22px 17px;
  border: 1px solid rgba(255, 255, 255, .4);
  border-radius: 20px;
  background: var(--card);
  box-shadow: 0 34px 90px -30px rgba(0, 0, 0, .45);
  animation: modalIn .22s cubic-bezier(.2, .8, .3, 1) both;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(8px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal h3 {
  margin: 0 0 7px;
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 700;
}

.modal p {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.75;
}

.modal-actions {
  display: flex;
  gap: 9px;
}

.modal-actions button {
  flex: 1;
  padding: 11px 12px;
  border: 0;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .18s;
}

.modal-cancel {
  background: #f0e8da;
  color: #5e665e;
}

.modal-cancel:hover {
  background: #e9dfcf;
}

.modal-ok {
  background: var(--green);
  color: #fff;
}

.modal-ok:hover {
  background: var(--green-deep);
}

.modal-ok.danger {
  background: #b84c3b;
}

.modal-ok.danger:hover {
  background: #a13f30;
}

/* =========================================================
   Responsive
   ========================================================= */

@media (min-width: 680px) {
  .home {
    padding-top: 34px;
  }

  .set-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .set-card {
    padding: 17px 16px 14px 19px;
  }

  .result-actions {
    grid-template-columns: 1.2fr 1fr 1fr;
  }

  .btn {
    width: auto;
  }

  .quiz-head-inner,
  .quiz-body,
  .page-nav-inner {
    padding-right: 24px;
    padding-left: 24px;
  }
}

@media (max-width: 380px) {
  .home {
    padding-right: 15px;
    padding-left: 15px;
  }

  .hero h1 {
    font-size: 33px;
  }

  .set-grid {
    gap: 9px;
  }

  .set-card {
    padding-right: 11px;
    padding-left: 14px;
  }

  .set-title {
    font-size: 14px;
  }

  .stat strong {
    font-size: 24px;
  }

  .quiz-body {
    padding-right: 13px;
    padding-left: 13px;
  }

  .question-card {
    padding: 18px 14px 16px;
    border-radius: 18px;
  }

  .q-stem {
    font-size: 17.5px;
  }

  .opt-text {
    font-size: 13.5px;
  }

  .result-hero {
    margin-right: 13px;
    margin-left: 13px;
  }

  .result-stats,
  .review-section,
  .wrong-summary,
  .wrong-list-wrap,
  .result-actions {
    padding-right: 13px;
    padding-left: 13px;
  }

  .result-stats {
    margin-right: 13px;
    margin-left: 13px;
  }

  .score-ring {
    width: 158px;
    height: 158px;
  }

  .score-inner {
    width: 132px;
    height: 132px;
  }

  .score-inner strong {
    font-size: 52px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

.count-pill.zero {
  background: var(--green-soft);
  color: #2f7d5f;
}
