:root {
  --bg: #f3f1eb;
  --bg-2: #fffdf8;
  --ink: #1c1917;
  --muted: #57534e;
  --line: #e7e0d4;
  --card: #fffdf8;
  --shadow: 0 18px 40px rgba(28, 25, 23, 0.08);
  --accent: #0f766e;
  --accent-2: #134e4a;
  --warn: #c2410c;
  --radius: 22px;
  --font: "Sora", system-ui, sans-serif;
  --serif: "Fraunces", Georgia, serif;
}

[data-theme="dark"] {
  --bg: #12100e;
  --bg-2: #1c1917;
  --ink: #f5f0e8;
  --muted: #a8a29e;
  --line: #3f3a36;
  --card: #1c1917;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
  --accent: #2dd4bf;
  --accent-2: #99f6e4;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font);
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(15, 118, 110, 0.12), transparent 50%),
    radial-gradient(900px 400px at 100% 0%, rgba(194, 65, 12, 0.08), transparent 45%),
    var(--bg);
  color: var(--ink);
  min-height: 100vh;
}

button,
input {
  font-family: inherit;
}

.wrap {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 0 8px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #fff;
  font-size: 22px;
  box-shadow: var(--shadow);
}

.brand h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 600;
}

.brand p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.icon-btn {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  width: 42px;
  height: 42px;
  border-radius: 12px;
  cursor: pointer;
}

.hero {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 28px;
  align-items: center;
  padding: 18px 0 28px;
}

.hero h2 {
  font-family: var(--serif);
  font-size: clamp(2rem, 5vw, 3.4rem);
  line-height: 1.05;
  margin: 0 0 12px;
  font-weight: 600;
}

.hero h2 em {
  font-style: italic;
  color: var(--accent);
}

.hero .lead {
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.65;
  margin: 0 0 18px;
  max-width: 52ch;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.search {
  flex: 1;
  min-width: 220px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  border-radius: 14px;
  padding: 12px 14px;
  outline: none;
}

.chip {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  border-radius: 999px;
  padding: 10px 14px;
  cursor: pointer;
}

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

.figure {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 32px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.figure svg {
  width: 100%;
  height: auto;
  display: block;
}

.hotspot {
  cursor: pointer;
  transition: opacity 0.2s;
}

.hotspot:hover,
.hotspot:focus {
  opacity: 0.85;
  outline: none;
}

.disclaimer {
  background: color-mix(in srgb, var(--warn) 10%, var(--card));
  border: 1px solid color-mix(in srgb, var(--warn) 35%, var(--line));
  color: var(--ink);
  border-radius: 16px;
  padding: 12px 14px;
  font-size: 0.86rem;
  line-height: 1.55;
  margin-bottom: 22px;
}

.progress {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 0.88rem;
}

.bar {
  flex: 1;
  height: 8px;
  background: var(--line);
  border-radius: 99px;
  overflow: hidden;
}

.bar span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  text-align: left;
  cursor: pointer;
  color: inherit;
  box-shadow: var(--shadow);
  min-height: 168px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.card:hover {
  transform: translateY(-2px);
}

.card .emoji {
  font-size: 1.5rem;
}

.card h3 {
  margin: 0;
  font-size: 1.02rem;
}

.card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.5;
}

.card .meta {
  margin-top: auto;
  font-size: 0.75rem;
  color: var(--accent);
  font-weight: 600;
}

.quiz-panel,
.detail {
  margin: 28px 0 48px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 22px;
  box-shadow: var(--shadow);
}

.quiz-panel h2,
.detail h2 {
  font-family: var(--serif);
  margin: 0 0 8px;
}

.q-box {
  margin-top: 16px;
}

.options {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}

.options button {
  text-align: left;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  border-radius: 14px;
  padding: 12px 14px;
  cursor: pointer;
}

.options button.correct {
  border-color: #059669;
  background: color-mix(in srgb, #059669 16%, var(--card));
}

.options button.wrong {
  border-color: #dc2626;
  background: color-mix(in srgb, #dc2626 14%, var(--card));
}

.explain {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
}

.nav-q {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 16px;
}

.primary,
.ghost {
  border-radius: 14px;
  padding: 10px 14px;
  cursor: pointer;
  border: 1px solid var(--line);
}

.primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.ghost {
  background: transparent;
  color: var(--ink);
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 16, 12, 0.55);
  display: none;
  align-items: flex-end;
  justify-content: center;
  z-index: 20;
  padding: 16px;
}

.overlay.open {
  display: flex;
}

.sheet {
  width: min(860px, 100%);
  max-height: min(90vh, 900px);
  overflow: auto;
  background: var(--bg-2);
  color: var(--ink);
  border-radius: 24px;
  padding: 22px;
  border: 1px solid var(--line);
}

.sheet-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.sheet h2 {
  font-family: var(--serif);
  margin: 0;
}

.kicker {
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 16px;
}

.block {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
}

.block h3 {
  margin: 0 0 8px;
  font-size: 0.95rem;
}

.block ul,
.block ol {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.55;
}

.organ li {
  margin-bottom: 8px;
}

.organ strong {
  color: var(--ink);
}

footer {
  padding: 10px 0 40px;
  color: var(--muted);
  font-size: 0.82rem;
}

@media (max-width: 800px) {
  .hero,
  .columns {
    grid-template-columns: 1fr;
  }

  .figure {
    order: -1;
  }
}
