/* ============================================================
   Science Jeopardy 2027 — Study App
   Kid-friendly, visual, interactive learning.
   ============================================================ */

:root {
  --bg: #FDFBF7;
  --bg-card: #FFFFFF;
  --text: #1F2933;
  --text-soft: #52606D;
  --border: #E4E7EB;
  --accent: #FF6B6B;
  --accent-2: #4ECDC4;
  --accent-3: #FFD93D;
  --shadow-sm: 0 2px 6px rgba(20, 30, 50, 0.06);
  --shadow-md: 0 8px 24px rgba(20, 30, 50, 0.08);
  --shadow-lg: 0 16px 48px rgba(20, 30, 50, 0.12);
  --radius: 14px;
  --radius-lg: 22px;
  --radius-sm: 8px;
  --topic-color: #4ECDC4;
  --topic-color-light: #E6F7F5;
  --font-body: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  --font-head: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 17px;
}

h1, h2, h3, h4 {
  font-family: var(--font-head);
  margin: 0 0 0.6em;
  line-height: 1.2;
  letter-spacing: -0.015em;
}

h1 { font-size: 3rem; font-weight: 800; }
h2 { font-size: 2rem; font-weight: 700; }
h3 { font-size: 1.3rem; font-weight: 700; }
h4 { font-size: 1.08rem; font-weight: 700; }

p { margin: 0 0 1em; }

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

/* ============================================================
   Navigation
   ============================================================ */

.site-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 32px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
  box-shadow: var(--shadow-sm);
}
.nav-logo {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--text);
  letter-spacing: -0.01em;
}
.nav-logo::before {
  content: "⚡";
  margin-right: 8px;
  color: var(--accent-3);
}
.nav-links { display: flex; gap: 20px; }
.nav-links a {
  color: var(--text-soft);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}
.nav-links a:hover { background: var(--bg); text-decoration: none; color: var(--text); }
.nav-links a.active { background: var(--accent); color: white; }
.nav-links a.active:hover { background: var(--accent); color: white; }

/* ============================================================
   Landing page
   ============================================================ */

.landing-hero {
  max-width: 1100px; margin: 0 auto;
  padding: 80px 32px 40px;
  text-align: center;
}
.landing-hero h1 {
  font-size: 3.6rem;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 0.3em;
}
.landing-hero .subtitle {
  font-size: 1.3rem; color: var(--text-soft);
  max-width: 700px; margin: 0 auto 2em;
}
.landing-hero .cta-row {
  display: flex; gap: 16px; justify-content: center; flex-wrap: wrap;
}
.btn {
  display: inline-block;
  padding: 14px 28px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 1rem;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.15s;
  text-decoration: none;
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); text-decoration: none; }
.btn-primary {
  background: var(--accent); color: white;
}
.btn-secondary {
  background: var(--bg-card); color: var(--text); border-color: var(--border);
}

.topic-grid {
  max-width: 1200px; margin: 20px auto 80px;
  padding: 0 32px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 22px;
}
.topic-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 26px 24px;
  text-decoration: none;
  color: var(--text);
  display: block;
  position: relative;
  overflow: hidden;
  transition: transform 0.15s, box-shadow 0.15s;
}
.topic-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  text-decoration: none;
}
.topic-card::before {
  content: "";
  position: absolute; top: 0; left: 0; right: 0; height: 6px;
  background: var(--topic-color);
}
.topic-card .topic-icon {
  width: 56px; height: 56px;
  background: var(--topic-color-light);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem; font-weight: 800;
  color: var(--topic-color);
  margin-bottom: 18px;
}
.topic-card .topic-tag {
  display: inline-block;
  background: var(--topic-color-light);
  color: var(--topic-color);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 10px;
}
.topic-card h3 { font-size: 1.3rem; margin-bottom: 8px; }
.topic-card p { color: var(--text-soft); font-size: 0.95rem; margin: 0; }
.topic-card .priority-badge {
  position: absolute; top: 18px; right: 18px;
  background: var(--accent-3); color: #5A4300;
  font-size: 0.7rem; font-weight: 700;
  padding: 3px 9px; border-radius: 999px;
  text-transform: uppercase; letter-spacing: 0.05em;
}

/* ============================================================
   Topic sidebar (injected by app.js on topic pages)
   ============================================================ */

.topic-sidebar {
  position: fixed;
  left: 0; top: 68px; bottom: 0;
  width: 240px;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 20px 14px;
  z-index: 5;
}
.topic-sidebar-header { padding: 0 8px 18px; border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.sidebar-back {
  display: inline-block; color: var(--text-soft); font-weight: 700;
  font-size: 0.9rem; text-decoration: none;
  padding: 8px 12px; border-radius: 10px; transition: all 0.1s;
}
.sidebar-back:hover { background: var(--bg); color: var(--accent); text-decoration: none; }
.sidebar-topics { display: flex; flex-direction: column; gap: 4px; }
.sidebar-topic {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 10px;
  color: var(--text-soft); text-decoration: none;
  font-weight: 600; font-size: 0.88rem;
  transition: background 0.12s, color 0.12s;
  line-height: 1.3;
}
.sidebar-topic:hover { background: var(--bg); color: var(--text); text-decoration: none; }
.sidebar-topic .dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--topic-color);
  flex-shrink: 0;
}
.sidebar-topic.active {
  background: var(--topic-color); color: white;
}
.sidebar-topic.active:hover { background: var(--topic-color); color: white; }
.sidebar-topic.active .dot { background: white; }

/* Push topic content to the right of the sidebar */
body.has-sidebar .topic-page { margin-left: 240px; }

@media (max-width: 900px) {
  .topic-sidebar {
    position: relative; top: 0; width: auto;
    border-right: none; border-bottom: 1px solid var(--border);
    padding: 12px 16px; max-height: 240px;
  }
  .topic-sidebar-header { padding: 0 0 10px; margin-bottom: 10px; }
  .sidebar-topics { flex-direction: row; flex-wrap: wrap; }
  .sidebar-topic { flex: 0 0 auto; }
  body.has-sidebar .topic-page { margin-left: 0; }
}

/* ============================================================
   Topic pages
   ============================================================ */

.topic-page {
  max-width: 1000px; margin: 0 auto;
  padding: 40px 32px 80px;
}
.topic-hero {
  margin-bottom: 50px;
  padding-bottom: 30px;
  border-bottom: 2px solid var(--topic-color-light);
}
.topic-hero .topic-tag {
  display: inline-block;
  background: var(--topic-color-light);
  color: var(--topic-color);
  font-size: 0.8rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  padding: 6px 14px; border-radius: 999px;
  margin-bottom: 18px;
}
.topic-hero h1 {
  color: var(--topic-color);
}
.topic-hero .hook {
  font-size: 1.25rem; color: var(--text-soft);
  margin-top: 0.5em;
  max-width: 750px;
}

.section { margin-bottom: 60px; }
.section h2 {
  font-size: 1.8rem;
  margin-bottom: 20px;
  display: flex; align-items: center;
}
.section h2::before {
  content: "";
  display: inline-block;
  width: 6px; height: 28px;
  background: var(--topic-color);
  border-radius: 3px;
  margin-right: 14px;
}
.section-intro {
  color: var(--text-soft);
  font-size: 1.05rem;
  margin-bottom: 20px;
}

/* Advanced Deep Dive section */
.college-dive {
  border-top: 4px dashed var(--topic-color);
  margin-top: 60px;
  padding-top: 40px;
  position: relative;
}
.college-dive h2 { display: flex; align-items: center; gap: 12px; }
.college-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--topic-color);
  color: white;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  vertical-align: middle;
}
.college-dive .section-intro {
  background: var(--topic-color-light);
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-weight: 500;
}
.college-dive .concept-card {
  border-left: 3px solid var(--topic-color);
}
.college-dive h3 { margin-top: 36px; color: var(--topic-color); font-size: 1.4rem; }
.college-dive .worked-example {
  background: #1F2933; color: #E4E7EB;
  padding: 20px 24px; border-radius: var(--radius);
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.9rem; line-height: 1.6;
  margin: 16px 0;
  overflow-x: auto;
}
.college-dive .worked-example .label {
  color: var(--accent-3); font-weight: 700;
  display: block; margin-bottom: 8px;
  font-family: var(--font-body); font-size: 0.75rem;
  letter-spacing: 0.1em; text-transform: uppercase;
}

/* Study Resources section */
.study-resources .study-reading {
  background: var(--bg-card);
  border-left: 5px solid var(--topic-color);
  padding: 24px 28px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  font-size: 1.02rem;
  line-height: 1.7;
  margin-bottom: 18px;
}
.study-resources .study-reading p { margin: 0 0 14px; }
.study-resources .study-reading p:last-child { margin: 0; }
.study-resources .study-links { display: flex; flex-wrap: wrap; gap: 10px; }
.study-resources .resource-link {
  display: inline-block;
  padding: 10px 18px;
  background: var(--topic-color-light);
  color: var(--topic-color);
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
  border: 2px solid transparent;
  transition: all 0.15s;
}
.study-resources .resource-link:hover {
  background: var(--topic-color);
  color: white;
  text-decoration: none;
  transform: translateY(-1px);
}

/* Big idea */
.big-idea-card {
  background: linear-gradient(135deg, var(--topic-color-light), var(--bg-card));
  border-left: 5px solid var(--topic-color);
  padding: 28px 32px;
  border-radius: var(--radius);
  font-size: 1.15rem;
  line-height: 1.7;
}

/* Analogy / Diagram */
.analogy-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 28px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.ascii-diagram {
  margin-top: 20px;
  background: #1F2933;
  color: #E4E7EB;
  padding: 24px;
  border-radius: var(--radius);
  overflow-x: auto;
}
.ascii-diagram pre {
  margin: 0;
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.85rem;
  line-height: 1.4;
  color: #E4E7EB;
}

/* New SVG-based diagrams (replaces ascii-diagram) */
.svg-diagram {
  margin-top: 20px;
  background: var(--bg);
  padding: 24px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow-x: auto;
}
.svg-diagram svg {
  display: block;
  width: 100%;
  height: auto;
  max-width: 820px;
  margin: 0 auto;
}
.svg-diagram-caption {
  margin-top: 12px;
  font-size: 0.85rem;
  color: var(--text-soft);
  text-align: center;
  font-style: italic;
}
.svg-diagram-wiki {
  display: inline-block;
  margin-top: 10px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--topic-color-light);
  color: var(--topic-color);
  font-size: 0.8rem;
  font-weight: 700;
  text-decoration: none;
}
.svg-diagram-wiki:hover { text-decoration: none; opacity: 0.9; }

/* Concept grid — wider cards (2 columns on typical laptop widths with sidebar)
   for easier reading of full sentences; aligned-row heights so cards don't
   look ragged. */
.concept-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 24px;
  align-items: stretch;
}
.concept-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px 20px;
  position: relative;
  box-shadow: var(--shadow-sm);
  transition: transform 0.1s, box-shadow 0.15s;
  display: flex;
  flex-direction: column;
}
.concept-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}
.concept-card h3 {
  color: var(--topic-color);
  font-size: 1.15rem;
  margin-bottom: 10px;
}
.concept-card p {
  color: var(--text);
  font-size: 0.98rem;
  margin: 0;
}

/* Leveled concept tiers (Essentials / Building Blocks / Advanced Depth) */
.tier-head { display: flex; align-items: baseline; gap: 10px; margin: 32px 0 14px; padding-bottom: 8px; border-bottom: 2px dashed var(--border); }
.tier-head h3 { font-size: 1.35rem; margin: 0; color: var(--text); }
.tier-head .tier-sub { font-size: 0.85rem; color: var(--text-soft); font-weight: 600; }
.tier-head.essentials h3 { color: #D97706; }
.tier-head.essentials { border-bottom-color: #FCD34D; }
.tier-head.blocks h3 { color: #2563EB; }
.tier-head.blocks { border-bottom-color: #BFDBFE; }
.tier-head.depth h3 { color: #7C3AED; }
.tier-head.depth { border-bottom-color: #DDD6FE; }
.tier-head .count-pill { background: var(--bg); padding: 2px 10px; border-radius: 999px; font-size: 0.72rem; font-weight: 800; color: var(--text-soft); letter-spacing: 0.04em; }

.concept-card.essential { border-left: 5px solid #F59E0B; background: linear-gradient(135deg, #FFFBEB, #FFFFFF 40%); padding-top: 32px; position: relative; }
.concept-card.block { border-left: 5px solid #3B82F6; padding-top: 32px; position: relative; }
.concept-card.depth { border-left: 5px solid #8B5CF6; background: linear-gradient(135deg, #F5F3FF, #FFFFFF 50%); padding-top: 32px; position: relative; }

.card-icon {
  position: absolute;
  top: -18px;
  left: 18px;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  background: var(--bg-card);
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(20, 30, 50, 0.12);
  border: 3px solid var(--topic-color);
  z-index: 1;
}
.concept-card.essential .card-icon { border-color: #F59E0B; background: #FFFBEB; }
.concept-card.block .card-icon { border-color: #3B82F6; background: #EFF6FF; }
.concept-card.depth .card-icon { border-color: #8B5CF6; background: #F5F3FF; }

/* Photo banner at top of concept card */
.card-image-wrap { margin: -32px -24px 14px; position: relative; overflow: hidden; border-top-left-radius: var(--radius); border-top-right-radius: var(--radius); background: #EFF2F6; }
.card-image-wrap img { display: block; width: 100%; height: 200px; object-fit: cover; object-position: center 25%; }
.card-image-wrap .caption { position: absolute; bottom: 0; left: 0; right: 0; padding: 6px 12px; background: linear-gradient(to top, rgba(0,0,0,0.78), rgba(0,0,0,0)); color: white; font-size: 0.78rem; font-weight: 600; line-height: 1.35; }
.card-image-wrap .credit { position: absolute; top: 6px; right: 8px; padding: 2px 6px; background: rgba(0,0,0,0.5); color: white; font-size: 0.6rem; border-radius: 4px; text-decoration: none; opacity: 0.85; }
.card-image-wrap .credit:hover { opacity: 1; text-decoration: underline; }

/* Multi-image grid inside a concept card (e.g. mammal orders) */
.card-gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 10px 0; }
.card-gallery figure { margin: 0; position: relative; overflow: hidden; border-radius: 8px; background: var(--border); aspect-ratio: 1 / 1; }
.card-gallery figure img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-gallery figcaption { position: absolute; bottom: 0; left: 0; right: 0; padding: 4px 6px; background: linear-gradient(to top, rgba(0,0,0,0.78), rgba(0,0,0,0)); color: white; font-size: 0.7rem; font-weight: 700; line-height: 1.2; text-align: center; }

/* Compact quick-ref grid (used for the "27 More Scientists" section) */
.quickref-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 14px; }
.quickref-card { display: grid; grid-template-columns: 72px 1fr; gap: 12px; align-items: start; padding: 10px 12px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; }
.quickref-portrait { width: 72px; height: 72px; border-radius: 8px; object-fit: cover; object-position: center 20%; background: var(--bg); }
.quickref-card .meta { min-width: 0; }
.quickref-card h4 { margin: 0 0 4px; font-size: 0.95rem; color: var(--topic-color); line-height: 1.25; }
.quickref-card .dates { font-size: 0.72rem; color: var(--text-soft); font-weight: 600; }
.quickref-card p { margin: 6px 0 0; font-size: 0.85rem; line-height: 1.4; color: var(--text); }
.quickref-card p strong { font-weight: 700; }

.concept-card .quick-def { font-size: 1rem; font-weight: 700; color: var(--text); margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px dotted var(--border); }
.concept-card .example-line { font-size: 0.9rem; color: var(--text-soft); margin-top: 8px; padding: 6px 10px; background: var(--bg); border-radius: 6px; }
.concept-card .example-line::before { content: "💡 "; font-size: 0.85rem; }

.dig-deeper { margin-top: 12px; border-top: 1px dotted var(--border); padding-top: 10px; }
.dig-deeper > summary { cursor: pointer; font-size: 0.82rem; font-weight: 700; color: var(--topic-color); padding: 4px 0; list-style: none; user-select: none; }
.dig-deeper > summary::marker { display: none; }
.dig-deeper > summary::-webkit-details-marker { display: none; }
.dig-deeper > summary::before { content: "▸ "; display: inline-block; transition: transform 0.15s; margin-right: 4px; }
.dig-deeper[open] > summary::before { transform: rotate(90deg); }
.dig-deeper .deeper-body { margin-top: 8px; padding: 10px 12px; background: var(--bg); border-radius: 8px; font-size: 0.88rem; line-height: 1.5; }
.dig-deeper .deeper-body > div { margin-bottom: 8px; }
.dig-deeper .deeper-body > div:last-child { margin-bottom: 0; }
.dig-deeper .deeper-body .label { font-weight: 800; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; margin-right: 6px; }
.dig-deeper .mnemo .label { color: #D97706; }
.dig-deeper .trap .label { color: #DC2626; }
.dig-deeper .confuse .label { color: #7C3AED; }
.dig-deeper .jep .label { color: #0F766E; }

/* Vocabulary */
.vocab-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 18px;
  margin: 0;
}
.vocab-list dt {
  font-weight: 800;
  color: var(--topic-color);
  font-size: 1.1rem;
  margin-bottom: 4px;
}
.vocab-list dd {
  margin: 0 0 16px;
  padding: 14px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
}

/* Memory tricks */
.memory-list {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}
.memory-list li {
  background: #FFF9E6;
  border-left: 4px solid var(--accent-3);
  padding: 18px 22px;
  border-radius: var(--radius-sm);
  font-size: 1rem;
}
.memory-list li strong {
  color: #8A6D00;
  display: block;
  margin-bottom: 4px;
}

/* Traps */
.traps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 18px;
}
.trap-card {
  background: #FFF1F1;
  border: 1px solid #FFD6D6;
  padding: 20px 24px;
  border-radius: var(--radius);
}
.trap-card h4 {
  color: #C62828;
  margin-bottom: 12px;
  font-size: 1.1rem;
}
.trap-card p { font-size: 0.95rem; margin-bottom: 8px; }
.trap-tip {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed #FFB4B4;
  font-size: 0.9rem;
  color: #8E3D3D;
}

/* Numbers table */
.numbers-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.numbers-table th {
  background: var(--topic-color);
  color: white;
  padding: 14px 18px;
  text-align: left;
  font-weight: 700;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.numbers-table td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
  vertical-align: top;
}
.numbers-table td:first-child {
  font-weight: 800;
  color: var(--topic-color);
  font-size: 1.05rem;
  min-width: 140px;
}
.numbers-table tr:last-child td { border-bottom: none; }

/* Jeopardy clues */
.clues-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
}
@media (max-width: 900px) {
  .clues-grid { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
}
.tier h3 {
  text-align: center;
  background: var(--topic-color);
  color: white;
  padding: 10px;
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
  font-size: 1.1rem;
}
.clue-card, .drill-card {
  background: var(--bg-card);
  border: 2px solid var(--border);
  padding: 16px 18px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  margin-bottom: 10px;
  min-height: 80px;
  transition: all 0.2s;
  position: relative;
}
.clue-card:hover, .drill-card:hover {
  border-color: var(--topic-color);
  box-shadow: var(--shadow-sm);
}
.clue-card.revealed, .drill-card.revealed {
  background: var(--topic-color-light);
  border-color: var(--topic-color);
}
.clue-card p, .drill-card p { margin: 0; font-size: 0.95rem; }
.clue-card .answer, .drill-card .answer {
  display: none;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--topic-color);
  font-weight: 700;
  color: var(--topic-color);
  font-size: 1rem;
}
.clue-card.revealed .answer, .drill-card.revealed .answer {
  display: block;
}

/* Speed drill */
.drill-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

/* Footer nav */
.topic-footer-nav {
  display: flex; justify-content: space-between;
  margin-top: 60px;
  padding-top: 30px;
  border-top: 2px solid var(--topic-color-light);
}
.topic-footer-nav a {
  color: var(--topic-color);
  font-weight: 700;
  font-size: 1.05rem;
  padding: 10px 20px;
  border-radius: 999px;
  background: var(--topic-color-light);
}
.topic-footer-nav a:hover { text-decoration: none; }

/* ============================================================
   Jeopardy board page
   ============================================================ */

.jeopardy-board {
  max-width: 1400px; margin: 40px auto;
  padding: 0 20px;
}
.jeopardy-header {
  text-align: center;
  margin-bottom: 30px;
}
.jeopardy-header h1 {
  font-size: 3rem;
  background: linear-gradient(135deg, #FFD93D, #FF6B6B);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.scoreboard {
  display: flex; justify-content: center; gap: 20px;
  margin-bottom: 24px;
}
.score-pill {
  background: var(--bg-card);
  padding: 12px 24px;
  border-radius: 999px;
  border: 2px solid var(--border);
  font-weight: 700;
}
.score-pill .score-value {
  color: var(--accent);
  margin-left: 8px;
  font-size: 1.2rem;
}

.board {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  background: #060D4A;
  padding: 10px;
  border-radius: var(--radius);
}
.board-category {
  background: #0A1570;
  color: #FFD93D;
  padding: 24px 12px;
  text-align: center;
  font-family: var(--font-head);
  font-size: 1rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: var(--radius-sm);
  min-height: 90px;
  display: flex; align-items: center; justify-content: center;
}
.board-cell {
  background: #0A1570;
  color: #FFD93D;
  text-align: center;
  padding: 36px 12px;
  font-family: var(--font-head);
  font-size: 2rem;
  font-weight: 800;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: transform 0.1s, background 0.15s;
  user-select: none;
}
.board-cell:hover { transform: scale(1.05); background: #142099; }
.board-cell.done {
  background: #0A1570;
  color: transparent;
  cursor: default;
  opacity: 0.4;
}
.board-cell.done:hover { transform: none; background: #0A1570; }

/* Modal for Jeopardy clue */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(10, 21, 112, 0.82);
  display: none;
  align-items: center; justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: #0A1570;
  color: #FFD93D;
  padding: 48px 56px;
  border-radius: var(--radius-lg);
  max-width: 820px; width: 100%;
  text-align: center;
  border: 3px solid #FFD93D;
}
.modal .modal-value {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  margin-bottom: 20px;
  text-transform: uppercase;
  opacity: 0.8;
}
.modal .modal-clue {
  font-size: 2rem;
  line-height: 1.3;
  font-family: var(--font-head);
  font-weight: 700;
  color: white;
  margin-bottom: 40px;
}
.modal .modal-timer {
  font-size: 1.5rem;
  font-weight: 800;
  color: #FFD93D;
  margin-bottom: 30px;
}
.modal .modal-answer {
  display: none;
  background: rgba(255, 217, 61, 0.15);
  padding: 20px;
  border-radius: var(--radius);
  color: #FFD93D;
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 30px;
}
.modal .modal-answer.show { display: block; }
.modal .modal-actions {
  display: flex; gap: 14px; justify-content: center; flex-wrap: wrap;
}
.modal button {
  padding: 12px 28px;
  font-weight: 700;
  font-size: 1rem;
  border: 2px solid #FFD93D;
  border-radius: 999px;
  cursor: pointer;
  background: transparent;
  color: #FFD93D;
}
.modal button.primary { background: #FFD93D; color: #0A1570; }

/* ============================================================
   Flashcards page
   ============================================================ */

.flashcards-page {
  max-width: 820px; margin: 60px auto;
  padding: 0 32px;
}
.flashcards-header {
  text-align: center;
  margin-bottom: 30px;
}
.topic-filter {
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: center;
  margin-bottom: 30px;
}
.topic-filter button {
  padding: 8px 16px;
  border: 2px solid var(--border);
  border-radius: 999px;
  background: var(--bg-card);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  color: var(--text);
}
.topic-filter button.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.flashcard {
  perspective: 1200px;
  width: 100%;
  max-width: 600px;
  margin: 0 auto 30px;
  cursor: pointer;
  min-height: 300px;
}
.flashcard-inner {
  position: relative;
  width: 100%;
  min-height: 300px;
  text-align: center;
  transition: transform 0.6s;
  transform-style: preserve-3d;
}
.flashcard.flipped .flashcard-inner {
  transform: rotateY(180deg);
}
.flashcard-face {
  position: absolute;
  width: 100%; height: 100%; min-height: 300px;
  backface-visibility: hidden;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 40px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  font-size: 1.4rem;
  font-weight: 700;
}
.flashcard-front {
  background: var(--bg-card);
  color: var(--text);
  border: 2px solid var(--border);
}
.flashcard-back {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  transform: rotateY(180deg);
}
.flashcard-hint {
  color: var(--text-soft);
  font-size: 0.9rem;
  font-weight: 500;
  margin-top: 12px;
}
.flashcard-controls {
  display: flex; gap: 14px; justify-content: center;
  margin-top: 30px; flex-wrap: wrap;
}
.flashcard-progress {
  text-align: center;
  font-weight: 700;
  color: var(--text-soft);
  margin-bottom: 14px;
}

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 720px) {
  h1 { font-size: 2.2rem; }
  h2 { font-size: 1.5rem; }
  .landing-hero { padding: 40px 20px 20px; }
  .landing-hero h1 { font-size: 2.6rem; }
  .board { grid-template-columns: repeat(5, 1fr); gap: 4px; padding: 6px; }
  .board-category { padding: 10px 4px; font-size: 0.72rem; min-height: 60px; }
  .board-cell { padding: 20px 4px; font-size: 1.1rem; }
  .modal { padding: 24px 20px; }
  .modal .modal-clue { font-size: 1.2rem; }
  .site-nav { flex-direction: column; gap: 10px; padding: 14px; }
  .topic-page { padding: 24px 18px 50px; }
}

/* ============================================================
   Print-to-PDF — triggered by browser Print (Cmd/Ctrl+P or the
   floating "🖨 Print / Save as PDF" button injected by app.js).
   Goal: clean, ink-friendly, no cropped tables, all content visible.
   ============================================================ */
@media print {
  @page {
    size: letter;
    margin: 0.5in 0.4in 0.6in;
    @bottom-right {
      content: "Page " counter(page) " of " counter(pages);
      font-family: Georgia, serif;
      font-size: 9pt;
      color: #666;
    }
    @bottom-left {
      content: "Science Jeopardy 2027 · Study Book";
      font-family: Georgia, serif;
      font-size: 9pt;
      color: #999;
    }
  }
  @page :first {
    @bottom-left { content: ""; }
  }

  /* Hide chrome */
  .site-nav,
  .topic-sidebar,
  .topic-footer-nav,
  .modal-backdrop,
  .print-controls,
  .svg-diagram-wiki,
  .sidebar-topics,
  .nav-links,
  .study-links,
  .resource-link,
  .credit,
  .real-ref-panel,
  button,
  .timer-start, .timer-reset,
  [data-speed-timer] .timer-controls { display: none !important; }

  /* Reset layout — no sidebar offset */
  body { background: white !important; color: #111 !important; font-size: 10.5pt; line-height: 1.4; }
  body.has-sidebar { padding-left: 0 !important; }
  .topic-page, main, .landing-hero { max-width: 100% !important; padding: 0 !important; margin: 0 !important; }

  /* Open every <details> so revealed content prints */
  details { display: block !important; }
  details > summary { display: none !important; }
  details > *:not(summary) { display: block !important; }

  /* Reveal flipped cards */
  .clue-card .answer,
  .drill-card .answer { display: block !important; opacity: 1 !important; visibility: visible !important; }
  .clue-card, .drill-card { background: white !important; border: 1px solid #ccc !important; color: #111 !important; }

  /* Headings & section breaks */
  h1 { font-size: 20pt; color: #111; page-break-after: avoid; }
  h2 { font-size: 15pt; color: #333; page-break-after: avoid; border-bottom: 1px solid #333; padding-bottom: 2pt; }
  h3 { font-size: 12pt; color: #222; page-break-after: avoid; }
  .section { page-break-inside: auto; break-inside: auto; margin-bottom: 14pt; }
  .section > h2 { page-break-before: auto; }
  .topic-hero, .topic-hero + .section { page-break-before: avoid; }

  /* Tables stay together */
  table { page-break-inside: avoid; break-inside: avoid; width: 100% !important; border-collapse: collapse; font-size: 9.5pt; }
  table th, table td { border: 1px solid #666 !important; padding: 3pt 5pt !important; background: white !important; color: #111 !important; }
  table thead th { background: #eee !important; font-weight: bold; }

  /* Cards: keep each whole */
  .concept-card, .trap-card, .numbers-row, .vocab-list dt, .memory-list li { page-break-inside: avoid; break-inside: avoid; }
  .concept-card { border: 1px solid #bbb !important; background: white !important; color: #111 !important; margin-bottom: 8pt !important; padding: 8pt !important; }
  .concept-grid { display: block !important; }
  .trap-card { border: 1px solid #c62828 !important; background: #fff5f5 !important; color: #111 !important; margin-bottom: 6pt !important; padding: 6pt !important; }
  .traps-grid { display: block !important; }

  /* Vocab: 2-column dense */
  .vocab-list { column-count: 2; column-gap: 20pt; }
  .vocab-list dt { font-weight: bold; color: #111 !important; margin-top: 4pt; }
  .vocab-list dd { margin: 0 0 3pt 10pt; color: #333 !important; }

  /* Memory tricks list */
  .memory-list li { margin-bottom: 4pt; color: #111 !important; }
  .memory-list li strong { color: #000 !important; }

  /* SVG & images — show full image without cropping */
  img, svg { max-width: 100% !important; height: auto !important; width: auto !important; page-break-inside: avoid; }
  .svg-diagram { page-break-inside: avoid; }
  .svg-diagram svg { max-height: 3in !important; }
  /* Reset the on-screen 200px fixed-height crop so print shows the full photo */
  .card-image-wrap { margin: 0 0 6pt 0 !important; overflow: visible !important; max-height: none !important; background: transparent !important; }
  .card-image-wrap img { height: auto !important; max-height: 1.6in !important; max-width: 100% !important; object-fit: contain !important; object-position: center !important; display: block; margin: 0 auto; }
  /* Overlay caption/credit were white-on-dark for screen — recolor + reposition for print */
  .card-image-wrap .caption { position: static !important; background: none !important; color: #444 !important; font-size: 8.5pt !important; font-weight: 500 !important; padding: 2pt 0 0 0 !important; text-align: center; }
  .card-image-wrap .credit { display: none !important; }

  /* Hide the hero's huge margin + the floating "Study Resources" box with external links */
  .topic-hero { padding: 0 !important; margin-bottom: 8pt !important; }
  .study-reading { page-break-inside: auto; }

  /* Hide the Round-1 / Round-2 badges and emoji tier spinners that clutter print */
  .priority-badge { display: none !important; }

  /* Hide-images print mode — triggered by body.print-no-images (toggle button) */
  body.print-no-images .card-image-wrap,
  body.print-no-images .svg-diagram,
  body.print-no-images img,
  body.print-no-images svg { display: none !important; }

  /* Tier headers */
  .tier-head { margin-top: 10pt !important; padding: 4pt 6pt !important; background: #f3f3f3 !important; color: #111 !important; border-left: 3px solid #666 !important; }

  /* Links: show URL inline for reference */
  a[href]:after { content: ""; }  /* keep clean by default; uncomment next line to print URLs */
  /* a[href^="http"]:after { content: " (" attr(href) ")"; font-size: 8pt; color: #666; } */

  /* Links in nav/sidebar — hidden; inline links stay dark */
  a { color: #111 !important; text-decoration: none; }

  /* Book mode: force a page break between topics when rendered in print_book.html */
  .book-topic { page-break-before: always; }
  .book-topic:first-of-type { page-break-before: auto; }
}

/* ============================================================
   Competition scaffolding: pill labels + hot-topic star marker
   ============================================================ */

/* Colored pill labels for inner content types inside <details> blocks */
.label-pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-right: 8px;
  vertical-align: middle;
  white-space: nowrap;
}
.label-pill.jeopardy  { background: #DBEAFE; color: #1E40AF; border: 1px solid #93C5FD; }
.label-pill.trap      { background: #FEE2E2; color: #991B1B; border: 1px solid #FCA5A5; }
.label-pill.mnemonic  { background: #FEF3C7; color: #92400E; border: 1px solid #FCD34D; }
.label-pill.watchout  { background: #FED7AA; color: #9A3412; border: 1px solid #FDBA74; }
.label-pill.cheatsheet{ background: #D1FAE5; color: #065F46; border: 1px solid #6EE7B7; }
.label-pill.final     { background: #E9D5FF; color: #6B21A8; border: 1px solid #C4B5FD; }

/* Content-aware summary (replaces plain "Dig deeper") — shows what's inside */
.concept-card details > summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--topic-color);
  padding: 6px 0 4px;
  list-style: none;
  user-select: none;
  font-size: 0.88rem;
}
.concept-card details > summary::-webkit-details-marker { display: none; }
.concept-card details > summary::before {
  content: "▸ ";
  display: inline-block;
  margin-right: 4px;
  transition: transform 0.15s;
}
.concept-card details[open] > summary::before { content: "▾ "; }

/* Hot-topic star marker — appears next to frequently-tested concept titles */
.hot-topic-star {
  display: inline-block;
  color: #F59E0B;
  font-size: 0.95rem;
  margin-left: 6px;
  vertical-align: middle;
  filter: drop-shadow(0 1px 1px rgba(251, 191, 36, 0.35));
  cursor: help;
}
.hot-topic-star::after {
  content: "";   /* placeholder; actual star is the element text */
}

/* Print adjustments — pills stay visible but ink-friendly */
@media print {
  .label-pill {
    border: 1px solid #333 !important;
    background: white !important;
    color: #000 !important;
    font-size: 8pt;
  }
  .hot-topic-star { color: #c88a00 !important; filter: none !important; }
  .concept-card details > summary { display: none !important; }
  .concept-card details > *:not(summary) { display: block !important; }
}

/* ============================================================
   Study-image figures — downloaded Wikimedia Commons images
   embedded inline near relevant content for easy understanding
   ============================================================ */
figure.study-image {
  margin: 16px 0;
  padding: 12px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  text-align: center;
  break-inside: avoid;
}
figure.study-image img,
figure.study-image svg {
  max-width: 100%;
  height: auto;
  max-height: 320px;
  border-radius: 6px;
  display: block;
  margin: 0 auto;
  background: white;
}
figure.study-image figcaption {
  margin-top: 10px;
  font-size: 0.86rem;
  color: #374151;
  line-height: 1.45;
  text-align: left;
}
figure.study-image figcaption .credit {
  display: block;
  margin-top: 4px;
  font-size: 0.72rem;
  color: #6b7280;
  font-style: italic;
}
figure.study-image figcaption .credit a { color: #6b7280; text-decoration: underline; }

/* Image gallery grid for topics that benefit from multiple side-by-side visuals */
.image-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin: 16px 0;
}
.image-gallery figure.study-image { margin: 0; }
.image-gallery figure.study-image img { max-height: 200px; object-fit: contain; }

/* When a <figure class="study-image"> is placed directly inside a .concept-grid,
   span the full row so it appears as a banner between concept-card rows
   rather than being auto-placed into an empty grid cell (which looks like
   a headerless card). */
.concept-grid > figure.study-image {
  grid-column: 1 / -1;
  max-width: 820px;
  margin: 4px auto 18px;
}
.concept-grid > figure.study-image img {
  max-height: 260px;
  object-fit: contain;
}

@media print {
  figure.study-image { background: white !important; border: 1px solid #ccc !important; break-inside: avoid; }
  figure.study-image img, figure.study-image svg { max-height: 2.4in !important; }
  figure.study-image figcaption { font-size: 9pt !important; color: #333 !important; }
  figure.study-image figcaption .credit { display: none !important; }
}

/* ============================================================
   Floating print button (screen only; hidden in print)
   ============================================================ */
.print-controls {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  gap: 8px;
}
.print-controls button {
  background: #1f2937;
  color: white;
  border: none;
  padding: 10px 16px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  transition: transform 0.15s, background 0.15s;
}
.print-controls button:hover { background: #111827; transform: translateY(-1px); }


/* Dense-paragraph bullet lists inside concept cards */
.concept-card ul.concept-list {
  margin: 8px 0 12px 0;
  padding-left: 20px;
  list-style: disc;
}
.concept-card ul.concept-list li {
  margin: 3px 0;
  line-height: 1.45;
  color: var(--text-main);
}
.concept-card p + p { margin-top: 8px; }
.concept-card p + ul.concept-list { margin-top: 4px; }
.concept-card ul.concept-list + p { margin-top: 10px; }
