:root {
  color-scheme: light;
  --paper: #f4f1ea;
  --paper-deep: #ebe5da;
  --card: #fffdf8;
  --ink: #1f2421;
  --muted: #6f746f;
  --line: #d9d4c9;
  --accent: #e8522e;
  --accent-soft: #f8d7ca;
  --green: #27675b;
  --green-soft: #dbe9e3;
  --blue: #3d628c;
  --blue-soft: #dfe8f2;
  --yellow: #a06e17;
  --yellow-soft: #f2e7c9;
  --shadow: 0 18px 50px rgba(54, 43, 28, 0.08);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
}

[data-theme="dark"] {
  color-scheme: dark;
  --paper: #171a18;
  --paper-deep: #202420;
  --card: #222623;
  --ink: #f2f0e9;
  --muted: #a8afa9;
  --line: #3a403b;
  --accent: #ff7654;
  --accent-soft: #593125;
  --green: #82c9ba;
  --green-soft: #263f39;
  --blue: #99bce6;
  --blue-soft: #293b50;
  --yellow: #e2b65f;
  --yellow-soft: #493b22;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.2);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background:
    radial-gradient(circle at 92% 2%, color-mix(in srgb, var(--accent-soft) 65%, transparent) 0, transparent 24rem),
    var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  line-height: 1.65;
}
button, input, select { font: inherit; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }

.page-shell { width: min(1500px, 100%); margin: 0 auto; padding: 0 42px; }
.topbar {
  height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 75%, transparent);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  font-family: Georgia, serif;
  font-size: 20px;
}
.brand strong, .brand small { display: block; }
.brand strong { letter-spacing: .04em; }
.brand small { color: var(--muted); font-size: 11px; letter-spacing: .1em; }
.topbar-actions, .toolbar { display: flex; align-items: center; gap: 10px; }
.quiet-button, .icon-button, .filter-toggle, select, .text-button {
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--card) 72%, transparent);
  border-radius: 999px;
  cursor: pointer;
  transition: border-color .2s, transform .2s, background .2s;
}
.quiet-button, .filter-toggle, select { min-height: 42px; padding: 0 17px; }
.quiet-button, .filter-toggle, select { white-space: nowrap; }
.icon-button { width: 42px; height: 42px; }
.quiet-button:hover, .icon-button:hover, .filter-toggle:hover, select:hover { border-color: var(--ink); }
.quiet-button:active, .icon-button:active, .theme-card:active { transform: scale(.98); }
.text-button { border: 0; background: transparent; color: var(--accent); padding: 8px 0; }

.hero {
  min-height: 480px;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, .65fr);
  align-items: center;
  gap: 80px;
  padding: 72px 5vw 68px;
  border-bottom: 1px solid var(--line);
}
.eyebrow, .section-kicker {
  margin: 0 0 18px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .18em;
}
.hero h1 {
  margin: 0;
  font-family: Georgia, "Songti SC", serif;
  font-size: clamp(46px, 5.2vw, 82px);
  font-weight: 500;
  line-height: 1.08;
  letter-spacing: -.045em;
}
.hero h1 span { color: var(--accent); }
.hero-description { max-width: 660px; margin: 30px 0 0; color: var(--muted); font-size: 17px; }
.hero-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  background: color-mix(in srgb, var(--card) 80%, transparent);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.hero-stats div { padding: 30px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.hero-stats div:nth-child(2) { border-right: 0; }
.hero-stats div:last-child { grid-column: 1 / -1; border: 0; }
.hero-stats strong { display: block; font-family: Georgia, serif; font-size: 42px; font-weight: 500; line-height: 1; }
.hero-stats span { display: block; margin-top: 9px; color: var(--muted); font-size: 13px; }

.theme-section { padding: 92px 0; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 34px; }
.section-heading h2 { margin: 0; font-family: Georgia, "Songti SC", serif; font-size: clamp(32px, 4vw, 54px); font-weight: 500; }
.theme-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 16px; }
.theme-card {
  position: relative;
  grid-column: span 4;
  min-height: 220px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--card);
  overflow: hidden;
  cursor: pointer;
  text-align: left;
  transition: transform .22s, box-shadow .22s, border-color .22s;
}
.theme-card:nth-child(4), .theme-card:nth-child(5) { grid-column: span 6; }
.theme-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--theme-color) 60%, var(--line)); }
.theme-card.active { border-color: var(--theme-color); box-shadow: 0 0 0 2px color-mix(in srgb, var(--theme-color) 20%, transparent); }
.theme-card::after {
  content: attr(data-index);
  position: absolute;
  right: -8px;
  bottom: -38px;
  color: color-mix(in srgb, var(--theme-color) 16%, transparent);
  font-family: Georgia, serif;
  font-size: 150px;
  line-height: 1;
}
.theme-card .theme-icon { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 12px; background: color-mix(in srgb, var(--theme-color) 15%, transparent); color: var(--theme-color); font-weight: 800; }
.theme-card h3 { margin: 36px 0 2px; font-size: 22px; }
.theme-card p { margin: 0; color: var(--muted); font-size: 13px; }
.theme-card .theme-progress { position: absolute; left: 26px; right: 26px; bottom: 22px; display: flex; align-items: center; gap: 10px; font-size: 11px; color: var(--muted); z-index: 1; }
.progress-track { height: 4px; flex: 1; background: var(--paper-deep); border-radius: 999px; overflow: hidden; }
.progress-track i { display: block; height: 100%; background: var(--theme-color); border-radius: inherit; }

.study-section { padding: 0 0 90px; }
.search-panel {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 17px 0;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}
.search-box {
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(650px, 100%);
  min-height: 54px;
  padding: 0 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 15px;
  box-shadow: 0 5px 20px rgba(54, 43, 28, .04);
}
.search-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-box span { font-size: 28px; line-height: 1; }
.search-box input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); }
.search-box kbd { padding: 2px 7px; border: 1px solid var(--line); border-radius: 6px; color: var(--muted); font-size: 11px; white-space: nowrap; }
.filter-toggle { display: none; }

.study-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 50px; padding-top: 42px; align-items: start; }
.filters { position: sticky; top: 96px; max-height: calc(100vh - 118px); overflow-y: auto; padding-right: 12px; }
.filter-header { display: flex; align-items: center; justify-content: space-between; padding: 0 10px 16px; }
.filter-group { padding: 16px 0; border-top: 1px solid var(--line); }
.filter-group-title { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 8px 10px; border: 0; background: transparent; cursor: pointer; text-align: left; font-weight: 700; }
.filter-group-title span { color: var(--muted); font-size: 11px; font-weight: 500; }
.filter-item { display: flex; width: 100%; justify-content: space-between; gap: 12px; padding: 8px 10px 8px 20px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); cursor: pointer; text-align: left; font-size: 13px; }
.filter-item:hover { background: var(--paper-deep); color: var(--ink); }
.filter-item.active { background: var(--ink); color: var(--paper); }
.filter-item span:last-child { opacity: .65; }

.result-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.result-heading p { margin: 0; color: var(--muted); font-size: 13px; }
.result-heading h2 { margin: 2px 0 0; font-family: Georgia, serif; font-size: 34px; font-weight: 500; }
.active-filters { display: flex; flex-wrap: wrap; gap: 8px; padding: 16px 0 4px; }
.filter-chip { padding: 5px 10px; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--muted); font-size: 12px; cursor: pointer; }

.question-list { display: grid; gap: 14px; padding-top: 20px; }
.question-card {
  scroll-margin-top: 100px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--card) 92%, transparent);
  transition: border-color .2s, box-shadow .2s;
  overflow: clip;
}
.question-card:hover { border-color: color-mix(in srgb, var(--ink) 40%, var(--line)); }
.question-card:target { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.question-main { display: grid; grid-template-columns: 58px minmax(0, 1fr) auto; gap: 16px; align-items: start; padding: 22px 22px 20px; }
.question-number { color: var(--accent); font-family: Georgia, serif; font-size: 14px; font-weight: 700; }
.question-copy h3 { margin: 0; font-size: 17px; line-height: 1.65; font-weight: 650; }
.question-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-top: 11px; color: var(--muted); font-size: 11px; }
.meta-dot::before { content: "·"; margin-right: 7px; }
.framework-badge { padding: 2px 7px; border-radius: 999px; background: var(--yellow-soft); color: var(--yellow); }
.card-actions { display: flex; gap: 6px; }
.card-action { display: grid; width: 34px; height: 34px; place-items: center; border: 1px solid transparent; border-radius: 9px; background: transparent; color: var(--muted); cursor: pointer; }
.card-action:hover { border-color: var(--line); color: var(--ink); }
.card-action.starred { color: var(--yellow); background: var(--yellow-soft); }
.answer-details { border-top: 1px solid var(--line); }
.answer-details summary { display: flex; align-items: center; gap: 10px; padding: 13px 22px 13px 96px; color: var(--green); cursor: pointer; font-size: 13px; font-weight: 700; list-style: none; }
.answer-details summary::-webkit-details-marker { display: none; }
.answer-details summary::before { content: "+"; display: grid; width: 20px; height: 20px; place-items: center; border: 1px solid currentColor; border-radius: 50%; font-weight: 400; }
.answer-details[open] summary::before { content: "−"; }
.answer-body { padding: 2px 24px 22px 96px; color: color-mix(in srgb, var(--ink) 86%, var(--muted)); }
.answer-body p { margin: 0; }
.answer-note { margin-top: 12px !important; color: var(--muted); font-size: 12px; }
.study-status { display: flex; gap: 7px; margin-top: 18px; }
.status-button { padding: 5px 10px; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--muted); cursor: pointer; font-size: 11px; }
.status-button:hover { color: var(--ink); }
.status-button.active[data-status="learning"] { border-color: var(--yellow); background: var(--yellow-soft); color: var(--yellow); }
.status-button.active[data-status="mastered"] { border-color: var(--green); background: var(--green-soft); color: var(--green); }
mark { background: var(--accent-soft); color: inherit; border-radius: 3px; }
.load-more { display: block; width: 100%; margin-top: 18px; padding: 15px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); cursor: pointer; }
.empty-state { padding: 80px 20px; text-align: center; color: var(--muted); }
.empty-state span { font-family: Georgia, serif; font-size: 56px; }
.empty-state h3 { margin: 8px 0 0; color: var(--ink); }
.empty-state p { margin: 4px 0; }

footer { display: flex; justify-content: space-between; gap: 30px; padding: 32px 0 50px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.toast { position: fixed; left: 50%; bottom: 28px; z-index: 100; transform: translate(-50%, 20px); padding: 10px 16px; border-radius: 999px; background: var(--ink); color: var(--paper); opacity: 0; pointer-events: none; transition: .2s; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.mobile-only { display: none; }

@media (max-width: 1050px) {
  .page-shell { padding: 0 24px; }
  .hero { grid-template-columns: 1fr; gap: 45px; padding: 65px 2vw; }
  .hero-stats { max-width: 650px; }
  .theme-card { grid-column: span 6; }
  .theme-card:last-child { grid-column: span 12; }
  .study-layout { grid-template-columns: 235px minmax(0, 1fr); gap: 28px; }
}

@media (max-width: 760px) {
  .page-shell { padding: 0 16px; }
  .topbar { height: 72px; }
  .topbar .quiet-button { display: none; }
  .hero { min-height: auto; padding: 54px 0; }
  .hero h1 { font-size: clamp(42px, 13vw, 64px); }
  .hero-stats div { padding: 22px; }
  .theme-section { padding: 64px 0; }
  .section-heading { align-items: start; }
  .theme-grid { display: grid; grid-template-columns: 1fr; }
  .theme-card, .theme-card:nth-child(4), .theme-card:nth-child(5), .theme-card:last-child { grid-column: auto; min-height: 220px; }
  .theme-card p { max-width: 82%; }
  .search-panel { align-items: stretch; flex-direction: column; }
  .toolbar { overflow-x: auto; }
  .filter-toggle { display: inline-block; }
  .search-box kbd { display: none; }
  .study-layout { display: block; padding-top: 26px; }
  .filters { position: fixed; inset: 0 10% 0 0; z-index: 50; max-height: none; padding: 24px 18px; background: var(--card); box-shadow: 20px 0 60px rgba(0, 0, 0, .25); transform: translateX(-110%); transition: transform .25s; }
  .filters.open { transform: translateX(0); }
  .mobile-only { display: grid; }
  .question-main { grid-template-columns: 42px minmax(0, 1fr); padding: 18px 16px; gap: 10px; }
  .card-actions { grid-column: 2; }
  .answer-details summary, .answer-body { padding-left: 68px; padding-right: 18px; }
  .result-heading { align-items: start; }
  footer { flex-direction: column; gap: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
