:root {
  --bg: #f2eee6;
  --paper: #fffdf9;
  --paper-strong: #ffffff;
  --ink: #16202b;
  --muted: #5d6873;
  --line: rgba(22, 32, 43, 0.12);
  --accent: #17446e;
  --accent-soft: rgba(23, 68, 110, 0.1);
  --accent-warm: #cf6a21;
  --success: #1c7c54;
  --danger: #a73333;
  --danger-soft: rgba(167, 51, 51, 0.08);
  --shadow: 0 18px 40px rgba(26, 39, 52, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "Microsoft YaHei UI", "PingFang SC", "Segoe UI Variable Text", sans-serif;
  overflow-x: hidden;
  background:
    radial-gradient(circle at top left, rgba(207, 106, 33, 0.14), transparent 32%),
    radial-gradient(circle at top right, rgba(23, 68, 110, 0.16), transparent 30%),
    linear-gradient(180deg, #f8f4eb 0%, var(--bg) 100%);
}

.page-shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 24px auto 40px;
}

.hero,
.exam-panel,
.side-card {
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.hero {
  position: relative;
  overflow: hidden;
  padding: 28px;
  border-radius: 28px;
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto -12% -36px auto;
  width: 340px;
  height: 340px;
  background:
    repeating-linear-gradient(
      -40deg,
      rgba(23, 68, 110, 0.08) 0 14px,
      rgba(255, 255, 255, 0) 14px 28px
    );
  border-radius: 50%;
  pointer-events: none;
}

.hero-copy,
.hero-actions,
.stats-grid,
.layout {
  position: relative;
  z-index: 1;
}

.hero-copy,
.hero-actions,
.panel-topbar > div,
.knowledge-head > div,
.side-card,
.exam-panel {
  min-width: 0;
}

.eyebrow,
.panel-kicker,
.stat-label {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 12px;
  color: var(--muted);
}

.hero h1,
.exam-panel h2,
.side-card h3,
.knowledge-head h3 {
  margin: 8px 0 0;
  font-family: "STZhongsong", "Songti SC", "Noto Serif CJK SC", serif;
  letter-spacing: 0.02em;
}

.hero h1 {
  font-size: clamp(28px, 4vw, 44px);
}

.hero-note {
  max-width: 720px;
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: end;
  justify-content: space-between;
  margin-top: 24px;
}

.field {
  display: grid;
  gap: 8px;
  min-width: 220px;
}

.field span,
.muted-text,
.knowledge-reason {
  color: var(--muted);
}

select,
input,
button {
  font: inherit;
}

select,
input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--paper-strong);
  color: var(--ink);
}

.button-row,
.nav-row,
.jump-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.button-row > *,
.jump-row > *,
.nav-row > * {
  min-width: 0;
}

button {
  cursor: pointer;
  border-radius: 999px;
  padding: 11px 18px;
  border: 1px solid transparent;
  transition: transform 120ms ease, border-color 120ms ease, background-color 120ms ease;
}

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

.solid-btn {
  background: var(--accent);
  color: #fff;
}

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

.ghost-btn.danger {
  border-color: rgba(167, 51, 51, 0.28);
  color: var(--danger);
  background: var(--danger-soft);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 24px;
}

.stat-card {
  padding: 16px 18px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(23, 68, 110, 0.08), rgba(23, 68, 110, 0.02));
  border: 1px solid rgba(23, 68, 110, 0.12);
}

.stat-card strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(280px, 0.9fr);
  gap: 22px;
  margin-top: 24px;
}

.exam-panel {
  padding: 26px;
  border-radius: 28px;
}

.panel-topbar {
  display: flex;
  gap: 16px;
  justify-content: space-between;
  align-items: start;
}

.panel-topbar h2 {
  font-size: clamp(24px, 2.6vw, 34px);
  line-height: 1.55;
}

.meta-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: end;
}

.meta-tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 8px 12px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 14px;
}

.meta-tag.subtle {
  background: rgba(22, 32, 43, 0.06);
  color: var(--muted);
}

.options-list {
  display: grid;
  gap: 14px;
  margin-top: 24px;
}

.option-btn {
  width: 100%;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  text-align: left;
  padding: 18px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--paper-strong);
}

.option-key {
  display: inline-grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 16px;
  background: rgba(22, 32, 43, 0.05);
  font-weight: 700;
}

.option-btn.correct {
  border-color: rgba(28, 124, 84, 0.25);
  background: rgba(28, 124, 84, 0.08);
}

.option-btn.wrong {
  border-color: rgba(167, 51, 51, 0.28);
  background: rgba(167, 51, 51, 0.08);
}

.option-btn.selected:not(.correct):not(.wrong) {
  border-color: rgba(23, 68, 110, 0.3);
  background: var(--accent-soft);
}

.option-btn:disabled {
  cursor: default;
}

.feedback-card,
.knowledge-panel,
.side-card {
  margin-top: 22px;
  padding: 20px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
}

.answer-feedback {
  line-height: 1.7;
  margin-bottom: 14px;
}

.feedback-ok {
  color: var(--success);
}

.feedback-bad {
  color: var(--danger);
}

.knowledge-head {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  align-items: end;
}

.knowledge-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.knowledge-tag {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(207, 106, 33, 0.12);
  color: #8b470f;
}

.knowledge-details {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.knowledge-item {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(22, 32, 43, 0.04);
}

.knowledge-item span {
  color: var(--muted);
  font-size: 13px;
}

.nav-row {
  justify-content: space-between;
  margin-top: 24px;
}

.side-panel {
  display: grid;
  gap: 22px;
  align-content: start;
}

.side-card {
  margin-top: 0;
}

.collapsible-card {
  padding: 0;
  overflow: hidden;
}

.collapse-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.collapse-toggle strong {
  display: block;
  margin-top: 8px;
  font-size: 22px;
  font-family: "STZhongsong", "Songti SC", "Noto Serif CJK SC", serif;
  letter-spacing: 0.02em;
}

.collapse-icon {
  position: relative;
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
}

.collapse-icon::before,
.collapse-icon::after {
  content: "";
  position: absolute;
  top: 8px;
  left: 1px;
  width: 16px;
  height: 2px;
  border-radius: 999px;
  background: var(--muted);
  transition: transform 120ms ease;
}

.collapse-icon::after {
  transform: rotate(90deg);
}

.collapsible-card.is-expanded .collapse-icon::after {
  transform: rotate(0deg);
}

.side-card-body {
  padding: 0 20px 20px;
}

.outline-list,
.shortcut-list {
  margin: 14px 0 0;
}

.outline-list {
  display: grid;
  gap: 12px;
}

.outline-list div {
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.outline-list div:first-child {
  border-top: 0;
  padding-top: 0;
}

.outline-list dt {
  color: var(--muted);
  font-size: 13px;
}

.outline-list dd {
  margin: 6px 0 0;
  line-height: 1.6;
}

.shortcut-list {
  padding-left: 18px;
  line-height: 1.8;
}

kbd {
  padding: 3px 8px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(22, 32, 43, 0.06);
  font-family: "Consolas", "SFMono-Regular", monospace;
}

@media (max-width: 960px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .hero-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .field {
    min-width: 0;
  }

  .hero-actions .button-row {
    width: 100%;
  }

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

  .panel-topbar {
    flex-direction: column;
  }

  .meta-tags {
    justify-content: start;
  }
}

@media (max-width: 640px) {
  .page-shell {
    width: min(100vw - 20px, 100%);
    margin: 10px auto 24px;
  }

  .hero,
  .exam-panel,
  .side-card {
    border-radius: 22px;
    padding: 18px;
  }

  .hero {
    padding-top: 20px;
  }

  .hero::after {
    width: 220px;
    height: 220px;
    inset: auto -18% -54px auto;
  }

  .hero h1 {
    font-size: clamp(24px, 8vw, 32px);
    line-height: 1.25;
  }

  .hero-note,
  .answer-feedback,
  .outline-list dd,
  .shortcut-list {
    font-size: 14px;
    line-height: 1.65;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .stat-card strong {
    font-size: 22px;
  }

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

  .panel-topbar h2 {
    font-size: clamp(20px, 6.2vw, 26px);
    line-height: 1.45;
  }

  .meta-tags {
    width: 100%;
  }

  .meta-tag {
    font-size: 13px;
    padding: 7px 10px;
  }

  .option-btn {
    grid-template-columns: 40px minmax(0, 1fr);
    padding: 14px;
    gap: 12px;
    border-radius: 18px;
  }

  .option-key {
    width: 40px;
    height: 40px;
    border-radius: 14px;
  }

  .feedback-card,
  .knowledge-panel,
  .side-card {
    margin-top: 18px;
    border-radius: 18px;
  }

  .feedback-card,
  .knowledge-panel {
    padding: 16px;
  }

  .knowledge-head {
    align-items: start;
  }

  .nav-row {
    position: sticky;
    bottom: 10px;
    z-index: 5;
    justify-content: stretch;
    padding-top: 8px;
    backdrop-filter: blur(10px);
  }

  .button-row,
  .jump-row,
  .nav-row {
    display: grid;
    grid-template-columns: 1fr;
  }

  .button-row button,
  .jump-row button,
  .nav-row button {
    width: 100%;
  }

  .jump-row input {
    min-width: 0;
  }

  .side-panel {
    gap: 16px;
  }

  .collapse-toggle {
    padding: 16px;
  }

  .collapse-toggle strong {
    font-size: 18px;
  }

  .side-card-body {
    padding: 0 16px 16px;
  }

  .collapsible-card:not(.is-expanded) .side-card-body {
    display: none;
  }

  .shortcut-list {
    padding-left: 16px;
  }
}

@media (max-width: 420px) {
  .page-shell {
    width: calc(100vw - 12px);
    margin: 6px auto 18px;
  }

  .hero,
  .exam-panel,
  .side-card {
    padding: 14px;
    border-radius: 18px;
  }

  .collapsible-card {
    padding: 0;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .panel-topbar h2 {
    font-size: 19px;
  }

  .option-btn {
    grid-template-columns: 36px minmax(0, 1fr);
    padding: 12px;
  }

  .option-key {
    width: 36px;
    height: 36px;
    font-size: 14px;
  }

  .collapse-toggle {
    padding: 14px;
  }

  .side-card-body {
    padding: 0 14px 14px;
  }
}
