/* ECON 132 Learning Site — Stiglitz/Rosengard Chapters 1-5 */
/* ---------- Design tokens ---------- */
:root {
  --bg: #fafaf7;
  --bg-elevated: #ffffff;
  --bg-soft: #f3f0e8;
  --ink: #1a1a1a;
  --ink-soft: #5a5a5a;
  --ink-muted: #8a8a85;
  --line: #e6e3da;
  --line-strong: #d0ccc0;
  --accent: #7c2d12;
  --accent-soft: #fdf4e7;
  --accent-bright: #c2410c;
  --accent-2: #1e3a5f;
  --accent-2-soft: #e8eef5;
  --success: #166534;
  --success-soft: #dcfce7;
  --warning: #92400e;
  --error: #991b1b;
  --error-soft: #fee2e2;
  --radius: 8px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 4px 16px rgba(0,0,0,0.06);
  --shadow-lg: 0 12px 36px rgba(0,0,0,0.10);
  --max-width: 1180px;
  --font-display: "Newsreader", "Iowan Old Style", "Georgia", serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { padding: 0; margin: 0; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.6;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 100;
  background: rgba(250, 250, 247, 0.92);
  backdrop-filter: saturate(150%) blur(8px);
  -webkit-backdrop-filter: saturate(150%) blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 14px 28px;
  display: flex;
  align-items: center;
  gap: 24px;
}
.topbar .brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 19px;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.topbar .brand span {
  color: var(--accent);
}
.topbar nav {
  display: flex;
  gap: 4px;
  margin-left: auto;
}
.topbar nav a {
  padding: 6px 12px;
  border-radius: 6px;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 500;
}
.topbar nav a:hover {
  background: var(--bg-soft);
  color: var(--ink);
  text-decoration: none;
}
.topbar nav a.active {
  background: var(--accent-soft);
  color: var(--accent);
}

/* ---------- Hero (home) ---------- */
.hero {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 80px 28px 60px;
}
.hero-eyebrow {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 14px;
}
.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(36px, 6vw, 64px);
  line-height: 1.05;
  letter-spacing: -0.025em;
  font-weight: 700;
  margin: 0 0 24px;
  color: var(--ink);
}
.hero h1 .accent {
  color: var(--accent);
  font-style: italic;
}
.hero p.lead {
  font-size: 20px;
  line-height: 1.55;
  color: var(--ink-soft);
  max-width: 720px;
  margin: 0 0 36px;
}
.hero-meta {
  display: flex;
  gap: 28px;
  flex-wrap: wrap;
  padding-top: 36px;
  border-top: 1px solid var(--line);
  margin-top: 36px;
}
.hero-meta .item {
  display: flex;
  flex-direction: column;
}
.hero-meta .num {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 700;
  color: var(--accent);
}
.hero-meta .lbl {
  font-size: 13px;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ---------- Chapter cards ---------- */
.chapters {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 40px 28px 120px;
}
.section-title {
  font-family: var(--font-display);
  font-size: 28px;
  letter-spacing: -0.01em;
  font-weight: 700;
  margin: 0 0 28px;
}
.chapter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 20px;
}
.chapter-card {
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 28px;
  transition: all 0.18s ease;
  position: relative;
  overflow: hidden;
  display: block;
  color: var(--ink);
}
.chapter-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent), var(--accent-bright));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s ease;
}
.chapter-card:hover {
  text-decoration: none;
  transform: translateY(-3px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-lg);
}
.chapter-card:hover::before {
  transform: scaleX(1);
}
.chapter-card .num {
  font-family: var(--font-display);
  font-size: 50px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 12px;
  letter-spacing: -0.03em;
}
.chapter-card h3 {
  font-family: var(--font-display);
  font-size: 22px;
  margin: 0 0 12px;
  line-height: 1.2;
  letter-spacing: -0.01em;
}
.chapter-card p {
  margin: 0 0 18px;
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.55;
}
.chapter-card .topics {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chapter-card .topic {
  font-size: 12px;
  padding: 3px 9px;
  background: var(--bg-soft);
  border-radius: 100px;
  color: var(--ink-muted);
  font-weight: 500;
}
.chapter-card .arrow {
  position: absolute;
  bottom: 28px;
  right: 28px;
  color: var(--accent);
  font-size: 20px;
  transition: transform 0.2s ease;
}
.chapter-card:hover .arrow {
  transform: translateX(4px);
}

/* ---------- Chapter page ---------- */
.chapter-hero {
  background: linear-gradient(180deg, var(--accent-soft) 0%, transparent 100%);
  border-bottom: 1px solid var(--line);
  padding: 48px 0 36px;
}
.chapter-hero .inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 28px;
}
.chapter-hero .eyebrow {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
}
.chapter-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(32px, 5vw, 48px);
  line-height: 1.1;
  letter-spacing: -0.025em;
  font-weight: 700;
  margin: 0 0 14px;
}
.chapter-hero p {
  font-size: 18px;
  color: var(--ink-soft);
  max-width: 700px;
  margin: 0;
}
.chapter-hero .chap-nav {
  display: flex;
  gap: 6px;
  margin-top: 32px;
  flex-wrap: wrap;
}
.chapter-hero .chap-nav a {
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 100px;
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  font-weight: 500;
}
.chapter-hero .chap-nav a.current {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.chapter-hero .chap-nav a:hover { text-decoration: none; }

/* ---------- Tabs ---------- */
.tab-bar {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 28px;
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  margin-top: 24px;
  flex-wrap: wrap;
}
.tab-btn {
  background: transparent;
  border: none;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-muted);
  padding: 14px 18px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: color 0.15s ease;
}
.tab-btn:hover { color: var(--ink); }
.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.tab-btn .icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.tab-btn .count {
  font-size: 11px;
  background: var(--bg-soft);
  color: var(--ink-muted);
  padding: 2px 7px;
  border-radius: 100px;
  font-weight: 600;
}
.tab-btn.active .count {
  background: var(--accent-soft);
  color: var(--accent);
}

/* ---------- Tab panels ---------- */
.tab-panel {
  display: none;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 48px 28px 96px;
}
.tab-panel.active { display: block; }

/* ---------- Reading content ---------- */
.reading {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 56px;
}
.reading-toc {
  position: sticky;
  top: 96px;
  align-self: start;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  padding-right: 12px;
}
.reading-toc h4 {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin: 0 0 14px;
}
.reading-toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: toc-counter;
}
.reading-toc li {
  counter-increment: toc-counter;
  margin: 0;
}
.reading-toc a {
  display: block;
  padding: 7px 0 7px 28px;
  font-size: 14px;
  color: var(--ink-soft);
  border-left: 2px solid var(--line);
  position: relative;
  line-height: 1.4;
}
.reading-toc a::before {
  content: counter(toc-counter, decimal-leading-zero);
  position: absolute;
  left: 9px;
  top: 7px;
  font-size: 11px;
  color: var(--ink-muted);
  font-family: var(--font-mono);
}
.reading-toc a:hover {
  color: var(--accent);
  border-left-color: var(--accent);
  text-decoration: none;
}
.reading-toc a.current {
  color: var(--accent);
  font-weight: 600;
  border-left-color: var(--accent);
}

.reading-main {
  max-width: 720px;
  font-family: var(--font-body);
}
.reading-main h2 {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin: 56px 0 16px;
  scroll-margin-top: 80px;
}
.reading-main h2:first-child { margin-top: 0; }
.reading-main h3 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 36px 0 12px;
  color: var(--ink);
}
.reading-main h4 {
  font-size: 15px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 28px 0 10px;
  color: var(--accent);
}
.reading-main p {
  font-size: 17px;
  line-height: 1.75;
  color: var(--ink);
  margin: 0 0 18px;
}
.reading-main ul, .reading-main ol {
  margin: 0 0 18px;
  padding-left: 28px;
  line-height: 1.75;
  font-size: 17px;
}
.reading-main li { margin-bottom: 8px; }
.reading-main strong { color: var(--ink); font-weight: 600; }
.reading-main em { font-style: italic; }
.reading-main .lead {
  font-size: 19px;
  line-height: 1.7;
  color: var(--ink-soft);
  font-family: var(--font-display);
  font-weight: 400;
  margin-bottom: 28px;
}

/* ---------- Callouts ---------- */
.callout {
  border-radius: var(--radius);
  padding: 22px 24px;
  margin: 28px 0;
  font-size: 16px;
  line-height: 1.65;
  border-left: 4px solid;
}
.callout-key {
  background: var(--accent-soft);
  border-left-color: var(--accent);
}
.callout-key .label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 8px;
  display: block;
}
.callout-def {
  background: var(--accent-2-soft);
  border-left-color: var(--accent-2);
}
.callout-def .label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-2);
  margin-bottom: 8px;
  display: block;
}
.callout-example {
  background: #fefce8;
  border-left-color: #ca8a04;
}
.callout-example .label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #92400e;
  margin-bottom: 8px;
  display: block;
}
.callout p:last-child { margin-bottom: 0; }

/* ---------- Figure ---------- */
figure {
  margin: 32px 0;
}
figure img {
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  display: block;
}
figcaption {
  font-size: 14px;
  color: var(--ink-soft);
  margin-top: 12px;
  line-height: 1.5;
  font-style: italic;
}
figcaption strong {
  color: var(--accent);
  font-style: normal;
  font-weight: 700;
  margin-right: 6px;
}

/* ---------- Flashcards ---------- */
.cards-intro {
  max-width: 720px;
  margin-bottom: 32px;
}
.cards-intro h2 {
  font-family: var(--font-display);
  font-size: 28px;
  margin: 0 0 10px;
  letter-spacing: -0.01em;
}
.cards-intro p {
  font-size: 16px;
  color: var(--ink-soft);
  margin: 0;
}

.flashcard-deck {
  display: flex;
  justify-content: center;
  margin: 32px 0;
}
.flashcard {
  width: min(100%, 640px);
  aspect-ratio: 8 / 5;
  perspective: 1500px;
  cursor: pointer;
  user-select: none;
}
.flashcard-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.55s cubic-bezier(0.4, 0, 0.2, 1);
}
.flashcard.flipped .flashcard-inner {
  transform: rotateY(180deg);
}
.flashcard-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: var(--radius-lg);
  padding: 40px 48px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.flashcard-front {
  background: var(--bg-elevated);
  border: 1px solid var(--line);
}
.flashcard-back {
  background: linear-gradient(140deg, var(--accent) 0%, #5b1f0c 100%);
  color: white;
  transform: rotateY(180deg);
}
.flashcard .stage {
  position: absolute;
  top: 22px;
  left: 24px;
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--ink-muted);
}
.flashcard-back .stage { color: rgba(255,255,255,0.6); }
.flashcard .term {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.015em;
  text-align: center;
}
.flashcard .definition {
  font-size: 18px;
  line-height: 1.55;
}
.flashcard .hint {
  position: absolute;
  bottom: 18px;
  left: 0; right: 0;
  text-align: center;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
  font-weight: 600;
}
.flashcard-back .hint { color: rgba(255,255,255,0.55); }

.deck-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  margin: 28px 0;
}
.deck-btn {
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  transition: all 0.15s ease;
}
.deck-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: scale(1.04);
}
.deck-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}
.deck-counter {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--ink-muted);
  min-width: 80px;
  text-align: center;
}
.deck-counter .current {
  color: var(--ink);
  font-weight: 600;
}

/* ---------- Quiz ---------- */
.quiz-header {
  margin-bottom: 28px;
}
.quiz-header h2 {
  font-family: var(--font-display);
  font-size: 28px;
  margin: 0 0 10px;
  letter-spacing: -0.01em;
}
.quiz-header p {
  font-size: 16px;
  color: var(--ink-soft);
  margin: 0;
}

.quiz-progress {
  background: var(--bg-soft);
  height: 6px;
  border-radius: 100px;
  overflow: hidden;
  margin: 24px 0 32px;
}
.quiz-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-bright));
  border-radius: 100px;
  width: 0%;
  transition: width 0.4s ease;
}

.quiz-card {
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 36px 40px;
  box-shadow: var(--shadow);
}
.quiz-counter {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-muted);
  margin-bottom: 16px;
  letter-spacing: 0.04em;
}
.quiz-question {
  font-family: var(--font-display);
  font-size: 23px;
  line-height: 1.35;
  letter-spacing: -0.01em;
  margin: 0 0 28px;
  font-weight: 600;
}
.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.quiz-option {
  background: var(--bg);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 20px;
  cursor: pointer;
  font-size: 16px;
  line-height: 1.5;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  text-align: left;
  font-family: inherit;
  color: var(--ink);
  transition: all 0.12s ease;
}
.quiz-option:hover:not(:disabled) {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.quiz-option .letter {
  font-family: var(--font-mono);
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 13px;
  flex-shrink: 0;
}
.quiz-option.correct {
  background: var(--success-soft);
  border-color: var(--success);
  color: var(--success);
}
.quiz-option.correct .letter {
  background: var(--success);
  color: white;
  border-color: var(--success);
}
.quiz-option.incorrect {
  background: var(--error-soft);
  border-color: var(--error);
  color: var(--error);
}
.quiz-option.incorrect .letter {
  background: var(--error);
  color: white;
  border-color: var(--error);
}
.quiz-option:disabled { cursor: default; }

.quiz-explanation {
  margin-top: 20px;
  padding: 20px;
  background: var(--accent-2-soft);
  border-radius: var(--radius);
  border-left: 4px solid var(--accent-2);
  display: none;
  font-size: 15px;
  line-height: 1.6;
}
.quiz-explanation.show { display: block; }
.quiz-explanation .label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-2);
  margin-bottom: 8px;
  display: block;
}

.quiz-actions {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-top: 24px;
}
.btn {
  background: var(--accent);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn:hover { background: var(--accent-bright); transform: translateY(-1px); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.btn.secondary {
  background: var(--bg-elevated);
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn.secondary:hover { border-color: var(--accent); color: var(--accent); }

.quiz-results {
  text-align: center;
  padding: 48px 24px;
}
.quiz-results .score {
  font-family: var(--font-display);
  font-size: 72px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.03em;
  line-height: 1;
  margin-bottom: 8px;
}
.quiz-results .of {
  font-size: 24px;
  color: var(--ink-muted);
}
.quiz-results .verdict {
  font-family: var(--font-display);
  font-size: 24px;
  margin: 24px 0 8px;
  font-weight: 600;
}
.quiz-results .feedback {
  color: var(--ink-soft);
  margin-bottom: 32px;
  font-size: 16px;
}

/* ---------- Problem set ---------- */
.problems-intro {
  max-width: 720px;
  margin-bottom: 32px;
}
.problems-intro h2 {
  font-family: var(--font-display);
  font-size: 28px;
  margin: 0 0 10px;
  letter-spacing: -0.01em;
}
.problems-intro p {
  font-size: 16px;
  color: var(--ink-soft);
  margin: 0;
}

.problem-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.problem {
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.problem summary {
  padding: 22px 28px;
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  gap: 18px;
  list-style: none;
  font-weight: 500;
}
.problem summary::-webkit-details-marker { display: none; }
.problem summary::after {
  content: "▾";
  margin-left: auto;
  color: var(--ink-muted);
  font-size: 14px;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}
.problem[open] summary::after {
  transform: rotate(180deg);
}
.problem summary:hover { background: var(--bg-soft); }
.problem-num {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
  line-height: 1.3;
  min-width: 40px;
}
.problem-question {
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
}
.problem-body {
  padding: 0 28px 28px 86px;
  font-size: 15px;
  line-height: 1.7;
  border-top: 1px solid var(--line);
  padding-top: 24px;
  margin-top: 4px;
}
.problem-body p { margin: 0 0 14px; }
.problem-body ul, .problem-body ol { padding-left: 22px; margin: 0 0 14px; }
.problem-body li { margin-bottom: 6px; }
.problem-body h4 {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin: 18px 0 10px;
}
.problem-body h4:first-child { margin-top: 0; }
.problem-body .note {
  font-size: 13px;
  color: var(--ink-muted);
  background: var(--bg-soft);
  padding: 14px 16px;
  border-radius: 6px;
  margin-top: 14px;
}

/* ---------- Footer ---------- */
.footer {
  border-top: 1px solid var(--line);
  margin-top: 60px;
  padding: 36px 28px;
  text-align: center;
  color: var(--ink-muted);
  font-size: 13px;
}
.footer p { margin: 4px 0; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .reading {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .reading-toc {
    position: relative;
    top: auto;
    max-height: none;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px;
  }
  .flashcard-face {
    padding: 28px 24px;
  }
  .flashcard .term { font-size: 24px; }
  .flashcard .definition { font-size: 16px; }
  .quiz-card { padding: 24px; }
  .quiz-question { font-size: 19px; }
  .problem-body { padding-left: 28px; padding-right: 28px; }
  .topbar nav { gap: 0; }
  .topbar nav a { padding: 4px 8px; font-size: 13px; }
}

/* ---------- Animations ---------- */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.tab-panel.active > * { animation: fade-up 0.4s ease backwards; }
.tab-panel.active > *:nth-child(2) { animation-delay: 0.05s; }
.tab-panel.active > *:nth-child(3) { animation-delay: 0.1s; }

/* Print-friendly */
@media print {
  .topbar, .tab-bar, .deck-controls, .quiz-actions { display: none; }
  .tab-panel { display: block !important; page-break-after: always; }
}
