:root {
  --bg: #f4efe6;
  --surface: #fffaf2;
  --surface-strong: #ffffff;
  --ink: #201d1a;
  --muted: #6d6259;
  --line: #d9ccbd;
  --brand: #7b1f2b;
  --brand-2: #9f3c2f;
  --gold: #b8832f;
  --teal: #1e6b67;
  --soft-brand: #f2dfe0;
  --soft-gold: #f5ead5;
  --soft-teal: #deeeec;
  --danger: #9b2d30;
  --success: #24705d;
  --shadow: 0 16px 45px rgba(71, 46, 33, .12);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --sidebar: 286px;
  --header: 76px;
}

html[data-theme="dark"] {
  --bg: #161514;
  --surface: #211f1d;
  --surface-strong: #282522;
  --ink: #f8f0e5;
  --muted: #c4b8aa;
  --line: #4a433d;
  --brand: #e17c86;
  --brand-2: #ef9a7a;
  --gold: #dcb267;
  --teal: #78c6bd;
  --soft-brand: #3a2529;
  --soft-gold: #372f21;
  --soft-teal: #203634;
  --danger: #ff9da0;
  --success: #8ed8c5;
  --shadow: 0 18px 50px rgba(0, 0, 0, .3);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background:
    radial-gradient(circle at 15% 10%, color-mix(in srgb, var(--gold) 10%, transparent), transparent 30%),
    radial-gradient(circle at 90% 15%, color-mix(in srgb, var(--teal) 8%, transparent), transparent 27%),
    var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
}

button, select { font: inherit; }
button { color: inherit; }
a { color: var(--brand); }
button:focus-visible, a:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--teal) 70%, white);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  z-index: 1000;
  left: 16px;
  top: -60px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--ink);
  color: var(--bg);
  text-decoration: none;
}
.skip-link:focus { top: 12px; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 12px 24px;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 80%, transparent);
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(16px);
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50% 50% 45% 55% / 45% 45% 55% 55%;
  background: var(--brand);
  color: white;
  font-family: Georgia, serif;
  font-size: 1.4rem;
  box-shadow: inset 0 0 0 4px color-mix(in srgb, white 22%, transparent);
}
.brand strong, .brand small { display: block; }
.brand strong { line-height: 1.2; letter-spacing: .01em; }
.brand small { color: var(--muted); margin-top: 2px; }

.header-actions { display: flex; align-items: center; gap: 8px; }
.icon-button, .lang-button {
  border: 1px solid var(--line);
  background: var(--surface);
  cursor: pointer;
}
.icon-button {
  width: 40px;
  height: 40px;
  border-radius: 12px;
}
.language-switch {
  display: inline-flex;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}
.lang-button {
  border: 0;
  background: transparent;
  border-radius: 9px;
  padding: 6px 10px;
  color: var(--muted);
}
.lang-button.active { background: var(--ink); color: var(--bg); }

.layout {
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  min-height: calc(100vh - var(--header));
}

.sidebar {
  position: sticky;
  top: var(--header);
  align-self: start;
  height: calc(100vh - var(--header));
  overflow-y: auto;
  padding: 24px 18px;
  border-right: 1px solid var(--line);
}

.progress-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}
.progress-topline { display: flex; justify-content: space-between; gap: 12px; font-size: .9rem; }
.progress-topline strong { color: var(--brand); }
.progress-track {
  height: 8px;
  margin: 12px 0 9px;
  border-radius: 99px;
  background: color-mix(in srgb, var(--line) 70%, transparent);
  overflow: hidden;
}
.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), var(--gold));
  transition: width .35s ease;
}
.progress-card small { color: var(--muted); }

.study-nav { display: grid; gap: 8px; margin-top: 20px; }
.nav-item {
  display: grid;
  grid-template-columns: 34px 1fr;
  align-items: center;
  text-align: left;
  gap: 10px;
  width: 100%;
  padding: 11px 12px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  cursor: pointer;
  color: var(--muted);
}
.nav-item span:first-child {
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .08em;
  color: color-mix(in srgb, var(--muted) 72%, transparent);
}
.nav-item:hover { background: color-mix(in srgb, var(--surface) 75%, transparent); color: var(--ink); }
.nav-item.active { background: var(--soft-brand); color: var(--brand); font-weight: 750; }
.nav-item.visited span:first-child::after { content: " ✓"; color: var(--success); }

.reset-button {
  width: 100%;
  margin-top: 22px;
  padding: 10px;
  border: 1px dashed var(--line);
  border-radius: 11px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

main {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 34px clamp(20px, 4vw, 56px) 70px;
}
.view-panel[hidden] { display: none !important; }
.view-panel.active { animation: fadeIn .35s ease; }

.hero-card {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(260px, .82fr);
  align-items: center;
  min-height: 430px;
  padding: clamp(28px, 5vw, 60px);
  border: 1px solid color-mix(in srgb, var(--brand) 22%, var(--line));
  border-radius: var(--radius-xl);
  background:
    linear-gradient(125deg, color-mix(in srgb, var(--surface-strong) 92%, transparent), color-mix(in srgb, var(--soft-gold) 88%, transparent));
  box-shadow: var(--shadow);
}
.hero-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(color-mix(in srgb, var(--brand) 18%, transparent) 1px, transparent 1px);
  background-size: 18px 18px;
  mask-image: linear-gradient(to right, transparent, black);
  opacity: .35;
  pointer-events: none;
}
.hero-copy, .hero-visual { position: relative; z-index: 1; }
.hero-copy h1 {
  max-width: 760px;
  margin: 7px 0 18px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.4rem, 6vw, 5rem);
  line-height: .98;
  letter-spacing: -.045em;
}
.hero-lead { max-width: 670px; font-size: clamp(1.05rem, 2vw, 1.27rem); color: var(--muted); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.hero-visual { color: var(--brand); }
.hero-visual svg { width: 100%; max-height: 330px; filter: drop-shadow(0 18px 20px color-mix(in srgb, var(--brand) 18%, transparent)); }

.eyebrow {
  margin: 0;
  color: var(--brand);
  font-size: .76rem;
  font-weight: 850;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.primary-button, .secondary-button, .text-button, .round-button, .rating-button {
  border-radius: 12px;
  cursor: pointer;
  font-weight: 750;
}
.primary-button {
  border: 1px solid var(--brand);
  background: var(--brand);
  color: white;
  padding: 12px 18px;
  box-shadow: 0 8px 22px color-mix(in srgb, var(--brand) 24%, transparent);
}
.primary-button:hover { transform: translateY(-1px); }
.primary-button:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.secondary-button {
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 12px 18px;
}
.secondary-button.compact { padding: 9px 13px; }
.text-button { border: 0; background: transparent; color: var(--brand); padding: 6px; }

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin: 54px 0 18px;
}
.section-heading h2, .section-heading h3 { margin: 6px 0 0; font-family: Georgia, serif; line-height: 1.08; }
.section-heading h2 { font-size: clamp(1.9rem, 4vw, 3rem); }
.section-heading h3 { font-size: clamp(1.45rem, 3vw, 2rem); }
.section-heading.smaller { margin-top: 42px; }
.section-intro { max-width: 830px; margin: -5px 0 26px; color: var(--muted); font-size: 1.05rem; }
.status-chip {
  flex: 0 0 auto;
  padding: 7px 11px;
  border-radius: 999px;
  background: var(--soft-teal);
  color: var(--teal);
  font-size: .78rem;
  font-weight: 800;
}
.status-chip.warning { background: var(--soft-gold); color: var(--gold); }

.insight-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.insight-card {
  min-height: 230px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: 0 10px 25px rgba(71,46,33,.06);
}
.insight-card .tag { display: inline-flex; padding: 5px 9px; border-radius: 999px; background: var(--soft-brand); color: var(--brand); font-size: .74rem; font-weight: 800; }
.insight-card h3 { margin: 17px 0 9px; font-size: 1.15rem; }
.insight-card p { margin: 0; color: var(--muted); }
.insight-card strong { color: var(--ink); }

.memory-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 22px;
  padding: 20px 22px;
  border-radius: var(--radius-lg);
  background: linear-gradient(110deg, var(--brand), var(--brand-2));
  color: white;
}
.memory-strip p { margin: 4px 0 0; color: rgba(255,255,255,.82); }
.memory-strip .text-button { color: white; white-space: nowrap; }

.timeline { position: relative; display: grid; gap: 14px; margin-top: 28px; }
.timeline::before { content: ""; position: absolute; left: 82px; top: 10px; bottom: 10px; width: 2px; background: var(--line); }
.timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 66px 1fr;
  gap: 30px;
  align-items: start;
}
.timeline-year { padding-top: 16px; font-weight: 850; color: var(--brand); text-align: right; }
.timeline-card {
  position: relative;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}
.timeline-card::before { content: ""; position: absolute; left: -22px; top: 24px; width: 12px; height: 12px; border: 3px solid var(--bg); border-radius: 50%; background: var(--brand); }
.timeline-card h3 { margin: 0 0 5px; font-size: 1.05rem; }
.timeline-card p { margin: 0; color: var(--muted); }
.timeline-card .precision { display: inline-flex; margin-top: 10px; padding: 4px 8px; border-radius: 8px; background: var(--soft-gold); color: var(--gold); font-size: .72rem; font-weight: 800; }

.timeline-game { margin-top: 28px; padding: 22px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
.game-header { display: flex; align-items: start; justify-content: space-between; gap: 18px; }
.game-header h3 { margin: 0; }
.game-header p { margin: 5px 0 0; color: var(--muted); }
.sortable-list { display: grid; gap: 10px; margin: 20px 0; padding: 0; list-style: none; }
.sortable-item {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-strong);
  cursor: grab;
}
.sortable-item.dragging { opacity: .45; }
.drag-handle { color: var(--muted); }
.order-buttons { display: inline-flex; gap: 5px; }
.order-buttons button { width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); cursor: pointer; }
.game-actions { display: flex; align-items: center; gap: 16px; }
.feedback { color: var(--muted); font-weight: 700; }
.feedback.success { color: var(--success); }
.feedback.error { color: var(--danger); }
.feedback.centered { text-align: center; min-height: 24px; }

.system-layout { display: grid; grid-template-columns: minmax(300px, 1fr) minmax(280px, .8fr); gap: 20px; }
.institution-map { display: grid; gap: 9px; align-content: start; }
.institution-node {
  position: relative;
  width: calc(100% - var(--indent, 0px));
  margin-left: var(--indent, 0px);
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  text-align: left;
  cursor: pointer;
}
.institution-node::before { content: ""; position: absolute; left: calc(-1 * var(--indent, 0px) / 2); top: -10px; bottom: calc(100% - 5px); width: 1px; background: var(--line); }
.institution-node.active { border-color: var(--brand); background: var(--soft-brand); color: var(--brand); }
.institution-node small { display: block; color: var(--muted); font-weight: 500; margin-top: 2px; }
.detail-card { min-height: 310px; padding: 24px; border-radius: var(--radius-lg); background: var(--ink); color: var(--bg); }
.detail-card .detail-kicker { color: color-mix(in srgb, var(--gold) 85%, white); font-size: .74rem; font-weight: 850; text-transform: uppercase; letter-spacing: .12em; }
.detail-card h3 { margin: 8px 0 10px; font-family: Georgia, serif; font-size: 1.8rem; }
.detail-card p { color: color-mix(in srgb, var(--bg) 78%, transparent); }
.detail-card ul { padding-left: 18px; }

.economy-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 30px; }
.economy-card { padding: 18px; border-radius: var(--radius-md); border: 1px solid var(--line); background: var(--surface); }
.economy-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; background: var(--soft-gold); color: var(--gold); font-weight: 900; }
.economy-card h3 { margin: 14px 0 7px; font-size: 1rem; }
.economy-card p { margin: 0; color: var(--muted); font-size: .93rem; }
.context-note { display: grid; grid-template-columns: 34px 1fr; gap: 12px; align-items: start; margin-top: 16px; padding: 15px 17px; border-left: 4px solid var(--gold); background: var(--soft-gold); border-radius: 0 12px 12px 0; }
.context-note > span { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: var(--gold); color: white; font-weight: 900; }
.context-note p { margin: 0; }

.lens-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.lens-card { padding: 22px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
.lens-card .lens-number { font-family: Georgia, serif; font-size: 2.4rem; line-height: 1; color: var(--brand); opacity: .7; }
.lens-card h3 { margin: 14px 0 8px; }
.lens-card p { margin: 0; color: var(--muted); }
.people-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.person-card { position: relative; overflow: hidden; min-height: 240px; padding: 20px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--line); }
.person-card::after { content: attr(data-initial); position: absolute; right: -5px; bottom: -35px; font-family: Georgia, serif; font-size: 8rem; color: var(--soft-brand); z-index: 0; }
.person-card > * { position: relative; z-index: 1; }
.person-role { display: inline-flex; padding: 5px 8px; border-radius: 999px; background: var(--soft-teal); color: var(--teal); font-size: .72rem; font-weight: 800; }
.person-card h3 { margin: 14px 0 8px; }
.person-card p { margin: 0; color: var(--muted); }

.reform-meter { padding: 22px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
.meter-labels { display: flex; justify-content: space-between; font-size: .8rem; font-weight: 800; color: var(--muted); }
.meter-track { position: relative; height: 15px; margin: 12px 0 8px; border-radius: 99px; background: var(--soft-gold); overflow: hidden; }
.meter-track span { display: block; width: 100%; height: 100%; background: linear-gradient(90deg, color-mix(in srgb, var(--gold) 25%, transparent) 0 38%, var(--gold) 68%, var(--brand) 100%); clip-path: polygon(0 75%, 15% 69%, 35% 54%, 52% 34%, 70% 12%, 100% 0, 100% 100%, 0 100%); }
.reform-meter p { margin: 0; color: var(--muted); font-size: .9rem; }
.impact-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 15px; margin-top: 20px; }
.impact-card { display: grid; grid-template-columns: 48px 1fr; gap: 14px; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); }
.impact-icon { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 14px; background: var(--soft-brand); color: var(--brand); font-size: 1.2rem; font-weight: 900; }
.impact-card h3 { margin: 0 0 5px; font-size: 1rem; }
.impact-card p { margin: 0; color: var(--muted); }
.cause-effect { display: grid; grid-template-columns: 1fr auto 1fr; gap: 18px; align-items: center; margin-top: 20px; padding: 22px; border-radius: var(--radius-lg); background: var(--ink); color: var(--bg); }
.cause-effect div { display: grid; gap: 4px; }
.cause-effect div:last-child { text-align: right; }
.cause-effect span { color: color-mix(in srgb, var(--bg) 60%, transparent); font-size: .78rem; text-transform: uppercase; letter-spacing: .12em; }
.cause-arrow { font-size: 2rem !important; color: var(--gold) !important; }


/* Independence section */
.independence-date { background: linear-gradient(110deg, var(--brand), var(--brand-2)); color: white; }
.independence-facts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 24px 0; }
.independence-fact { position: relative; overflow: hidden; min-height: 175px; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
.independence-fact::after { content: attr(data-mark); position: absolute; right: -8px; bottom: -34px; font-family: Georgia, serif; font-size: 7.3rem; line-height: 1; color: var(--soft-brand); z-index: 0; }
.independence-fact > * { position: relative; z-index: 1; }
.independence-fact span { display: block; color: var(--brand); font-size: .73rem; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }
.independence-fact strong { display: block; margin: 11px 0 7px; font-family: Georgia, serif; font-size: 1.35rem; }
.independence-fact p { margin: 0; color: var(--muted); font-size: .92rem; }
.proclamation-card { display: grid; grid-template-columns: 120px 1fr; gap: 28px; align-items: center; padding: clamp(24px, 4vw, 38px); border-radius: var(--radius-xl); background: var(--ink); color: var(--bg); box-shadow: var(--shadow); }
.proclamation-symbol { width: 110px; height: 146px; display: grid; grid-template-columns: 1fr 1fr 1fr; overflow: hidden; border: 5px solid color-mix(in srgb, var(--bg) 80%, transparent); border-radius: 8px; box-shadow: 0 13px 30px rgba(0,0,0,.22); }
.proclamation-symbol span:nth-child(1), .proclamation-symbol span:nth-child(3) { background: #c92d36; }
.proclamation-symbol span:nth-child(2) { background: #fff; }
.proclamation-card .eyebrow { color: color-mix(in srgb, var(--gold) 90%, white); }
.proclamation-card blockquote { margin: 12px 0 14px; font-family: Georgia, serif; font-size: clamp(1.35rem, 3vw, 2.15rem); line-height: 1.32; }
.quote-attribution { margin: 0; color: color-mix(in srgb, var(--bg) 70%, transparent); font-weight: 750; }
.quote-translation { margin-top: 18px; color: color-mix(in srgb, var(--bg) 75%, transparent); }
.quote-translation summary { cursor: pointer; font-weight: 750; }
.quote-translation p { margin-bottom: 0; }
.independence-context { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 22px 0; }
.context-step { padding: 17px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); }
.context-step time { color: var(--brand); font-weight: 900; }
.context-step h3 { margin: 7px 0 6px; font-size: 1rem; }
.context-step p { margin: 0; color: var(--muted); font-size: .9rem; }
.quote-practice { margin-top: 28px; padding: 24px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
.quote-workspace { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 20px 0; }
.workspace-label { display: block; margin-bottom: 8px; color: var(--muted); font-size: .78rem; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.quote-chip-area { min-height: 145px; display: flex; flex-wrap: wrap; align-content: flex-start; gap: 8px; padding: 14px; border: 1px dashed var(--line); border-radius: 13px; background: var(--surface-strong); }
.quote-chip-area.selected { border-style: solid; background: var(--soft-gold); }
.quote-chip { padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); cursor: pointer; text-align: left; }
.quote-chip:hover { border-color: var(--brand); }
.quote-chip-area:empty::after { content: "…"; color: var(--muted); font-size: 1.4rem; }
.independence-memory { background: linear-gradient(110deg, var(--teal), color-mix(in srgb, var(--teal) 58%, var(--brand))); }

.flashcard-shell { display: grid; grid-template-columns: auto minmax(0, 760px) auto; justify-content: center; gap: 18px; align-items: center; margin-top: 30px; }
.round-button { width: 48px; height: 48px; border: 1px solid var(--line); background: var(--surface); }
.flashcard {
  min-height: 350px;
  width: 100%;
  padding: 34px;
  border: 1px solid color-mix(in srgb, var(--brand) 35%, var(--line));
  border-radius: var(--radius-xl);
  background:
    linear-gradient(145deg, var(--surface-strong), var(--soft-brand));
  box-shadow: var(--shadow);
  text-align: left;
  cursor: pointer;
}
.flashcard-label { display: block; color: var(--brand); font-size: .76rem; text-transform: uppercase; letter-spacing: .14em; font-weight: 850; }
.flashcard > strong { display: block; max-width: 650px; margin: 50px auto 30px; text-align: center; font-family: Georgia, serif; font-size: clamp(1.6rem, 4vw, 2.6rem); line-height: 1.15; }
.flip-hint { display: block; color: var(--muted); text-align: center; font-size: .9rem; }
.flashcard-answer { max-width: 650px; margin: 24px auto 0; padding-top: 22px; border-top: 1px solid var(--line); color: var(--ink); font-size: 1.08rem; }
.rating-row { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; margin: 24px 0 5px; }
.rating-button { min-width: 110px; padding: 10px 14px; border: 1px solid var(--line); background: var(--surface); }
.rating-button[data-rating="again"]:hover { border-color: var(--danger); color: var(--danger); }
.rating-button[data-rating="good"]:hover { border-color: var(--success); color: var(--success); }

.exam-builder { display: grid; grid-template-columns: minmax(300px, .9fr) minmax(360px, 1.1fr); gap: 22px; }
.field-label { display: block; margin-bottom: 7px; font-weight: 800; }
.select-input { width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); }
.evidence-fieldset { margin: 22px 0; padding: 0; border: 0; }
.evidence-fieldset legend { margin-bottom: 10px; font-weight: 800; }
.evidence-list { display: grid; gap: 9px; }
.evidence-option { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); cursor: pointer; }
.evidence-option:has(input:checked) { border-color: var(--brand); background: var(--soft-brand); }
.evidence-option input { margin-top: 4px; }
.answer-output { min-height: 440px; padding: 26px; border-radius: var(--radius-lg); background: var(--ink); color: var(--bg); }
.answer-output .placeholder { color: color-mix(in srgb, var(--bg) 55%, transparent); }
.answer-output h3 { margin-top: 0; font-family: Georgia, serif; font-size: 1.65rem; }
.answer-output ol { padding-left: 22px; }
.answer-output li { margin-bottom: 14px; color: color-mix(in srgb, var(--bg) 82%, transparent); }
.answer-output strong { color: var(--bg); }
.answer-output .linking-bank { margin-top: 20px; padding: 15px; border-radius: 12px; background: color-mix(in srgb, var(--bg) 8%, transparent); }

.quiz-card { max-width: 850px; padding: clamp(22px, 4vw, 38px); border: 1px solid var(--line); border-radius: var(--radius-xl); background: var(--surface); box-shadow: var(--shadow); }
.quiz-kicker { margin: 0 0 8px; color: var(--brand); font-size: .75rem; font-weight: 850; text-transform: uppercase; letter-spacing: .13em; }
.quiz-card h3 { margin: 0 0 24px; font-family: Georgia, serif; font-size: clamp(1.45rem, 3vw, 2.2rem); }
.quiz-options { display: grid; gap: 10px; }
.quiz-option { padding: 13px 15px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-strong); text-align: left; cursor: pointer; }
.quiz-option:hover:not(:disabled) { border-color: var(--brand); }
.quiz-option.correct { border-color: var(--success); background: var(--soft-teal); color: var(--success); }
.quiz-option.incorrect { border-color: var(--danger); background: var(--soft-brand); color: var(--danger); }
.quiz-explanation { margin-top: 18px; padding: 15px 17px; border-radius: 12px; background: var(--soft-gold); color: var(--ink); }
.quiz-actions { display: flex; justify-content: space-between; gap: 12px; margin-top: 24px; }
.quiz-result { max-width: 700px; text-align: center; padding: 40px; border: 1px solid var(--line); border-radius: var(--radius-xl); background: var(--surface); }
.result-ring { width: 145px; height: 145px; margin: 0 auto 20px; display: grid; place-items: center; border: 14px solid var(--soft-gold); border-top-color: var(--brand); border-radius: 50%; }
.result-ring strong { font-size: 1.9rem; }

.sources-panel { margin-top: 58px; }
.sources-panel details { border-top: 1px solid var(--line); padding-top: 20px; }
.sources-panel summary { cursor: pointer; font-weight: 800; color: var(--muted); }
.sources-content { padding: 10px 0 0; color: var(--muted); }
.sources-content ul { padding-left: 20px; }
.sources-content li { margin: 7px 0; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

html.reduce-motion *, html.reduce-motion *::before, html.reduce-motion *::after {
  animation-duration: .001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: .001ms !important;
  scroll-behavior: auto !important;
}

@media (max-width: 1000px) {
  :root { --sidebar: 240px; }
  .hero-card { grid-template-columns: 1fr; }
  .hero-visual { display: none; }
  .insight-grid, .lens-grid { grid-template-columns: 1fr 1fr; }
  .economy-grid, .people-grid, .independence-facts, .independence-context { grid-template-columns: 1fr 1fr; }
  .system-layout, .exam-builder { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  :root { --header: auto; }
  .site-header { position: relative; padding: 12px 16px; }
  .brand small { display: none; }
  .layout { display: block; }
  .sidebar { position: static; height: auto; overflow: visible; padding: 14px 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .study-nav { display: flex; overflow-x: auto; padding-bottom: 6px; }
  .nav-item { flex: 0 0 auto; width: auto; grid-template-columns: auto 1fr; white-space: nowrap; }
  .reset-button { display: none; }
  main { padding: 22px 16px 50px; }
  .hero-card { min-height: auto; padding: 30px 24px; border-radius: 22px; }
  .insight-grid, .lens-grid, .people-grid, .economy-grid, .impact-grid, .independence-facts, .independence-context { grid-template-columns: 1fr; }
  .section-heading { align-items: start; flex-direction: column; gap: 12px; }
  .memory-strip { align-items: start; flex-direction: column; }
  .timeline::before { left: 16px; }
  .timeline-item { grid-template-columns: 1fr; gap: 8px; padding-left: 34px; }
  .timeline-year { text-align: left; padding-top: 0; }
  .timeline-card::before { left: -24px; top: 22px; }
  .cause-effect { grid-template-columns: 1fr; }
  .proclamation-card { grid-template-columns: 1fr; }
  .proclamation-symbol { width: 82px; height: 108px; }
  .quote-workspace { grid-template-columns: 1fr; }
  .cause-effect div:last-child { text-align: left; }
  .cause-arrow { transform: rotate(90deg); justify-self: start; }
  .flashcard-shell { grid-template-columns: 1fr; }
  .round-button { display: none; }
  .flashcard { min-height: 330px; }
  .quiz-actions { flex-direction: column-reverse; }
}

@media (max-width: 480px) {
  .brand strong { font-size: .92rem; }
  .icon-button { display: none; }
  .hero-copy h1 { font-size: 2.45rem; }
  .hero-actions { display: grid; }
  .primary-button, .secondary-button { width: 100%; }
  .status-chip { white-space: normal; }
  .flashcard { padding: 24px 18px; }
}
