:root {
  --ink: #1e293b;
  --bg: #f5f4ef;
  --surface: #ffffff;
  --line: #ded8cb;
  --ocean-dark: #1e293b;
  --famine-ochre: #b45309;
  --famine-green: #15803d;
  --famine-red: #b91c1c;
  --font-display: "Bricolage Grotesque", system-ui, sans-serif;
  --font-body: "Lexend", system-ui, sans-serif;
  --shadow: 0 8px 24px rgba(30, 41, 59, 0.08);
  --shadow-hover: 0 16px 36px rgba(30, 41, 59, 0.16);
  --radius-lg: 20px;
  --radius-md: 12px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  background: #1c2633;
  color: #fff;
  padding: 0.9rem 1.4rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  border-bottom: 3px solid #d97706;
  position: sticky;
  top: 0;
  z-index: 50;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  text-decoration: none;
  color: #fff;
}

.brand-icon {
  font-size: 2.2rem;
  background: rgba(217, 119, 6, 0.2);
  padding: 0.4rem;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand h1 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
  color: #fde68a;
  letter-spacing: -0.01em;
}

.brand p {
  font-size: 0.8rem;
  color: #cbd5e1;
}

.controls-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.tab-pills {
  display: flex;
  background: rgba(0, 0, 0, 0.25);
  padding: 0.25rem;
  border-radius: 999px;
  gap: 0.3rem;
}

.tab-btn {
  background: transparent;
  border: none;
  color: #cbd5e1;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.45rem 1rem;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s;
}

.tab-btn:hover {
  color: #fff;
}

.tab-btn.active {
  background: #d97706;
  color: #1c2633;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.btn-header {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  transition: all 0.2s;
}

.btn-header:hover {
  background: rgba(255, 255, 255, 0.25);
}

.game-container {
  max-width: 1200px;
  margin: 1.5rem auto;
  padding: 0 1.2rem;
  width: 100%;
  flex: 1;
}

.tab-pane {
  display: none;
  animation: fadeIn 0.25s ease-out;
}

.tab-pane.active {
  display: block;
}

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

.section-intro {
  margin-bottom: 1.5rem;
}

.section-intro h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: #1e293b;
}

.section-desc {
  color: #556272;
  font-size: 0.95rem;
  margin-top: 0.3rem;
}

/* ================== TAB 1: SHIP & WORKHOUSE TOUR ================== */
.tour-header {
  margin-bottom: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.view-toggle {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.toggle-btn {
  background: var(--surface);
  border: 2px solid var(--line);
  padding: 0.65rem 1.4rem;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-weight: 800;
  font-size: 0.95rem;
  cursor: pointer;
  color: var(--ink);
  transition: all 0.2s;
}

.toggle-btn.active {
  background: #1e293b;
  color: #fff;
  border-color: #1e293b;
  box-shadow: 0 4px 14px rgba(30, 41, 59, 0.2);
}

.tour-stage {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 1.5rem;
  align-items: start;
}

.diagram-wrap {
  background: #ffffff;
  border: 2px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.2rem;
  box-shadow: var(--shadow);
  min-height: 440px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.diagram-wrap svg {
  width: 100%;
  max-height: 480px;
}

.hotspot-node {
  cursor: pointer;
}

.hotspot-node:hover circle {
  fill: #f59e0b;
  transform: scale(1.15);
  transform-origin: center;
}

.detail-card {
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.8rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.detail-badge {
  align-self: flex-start;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  padding: 0.3rem 0.8rem;
  border-radius: 999px;
  background: #fef3c7;
  color: #92400e;
}

.detail-card h2 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  color: #1e293b;
}

.detail-ga {
  font-size: 1.05rem;
  font-style: italic;
  color: #0369a1;
  font-weight: 600;
  border-left: 3px solid #0369a1;
  padding-left: 0.8rem;
}

.history-quote {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 1rem;
  font-size: 0.9rem;
  color: #334155;
  line-height: 1.45;
}

/* ================== TAB 2: BLIGHT INVESTIGATION ================== */
.blight-stage {
  display: flex;
  flex-direction: column;
  gap: 1.8rem;
}

.blight-compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.crop-box {
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.box-healthy { border-color: #86efac; background: #f0fdf4; }
.box-diseased { border-color: #fca5a5; background: #fef2f2; }

.crop-header {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.crop-icon {
  font-size: 2.4rem;
}

.crop-header h3 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: #1e293b;
}

.crop-header small {
  color: #64748b;
}

.crop-facts {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.9rem;
  color: #334155;
}

.timeline-famine-strip {
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}

.timeline-famine-strip h3 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: #1e293b;
  margin-bottom: 1rem;
}

.famine-years-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.year-card {
  background: #f8fafc;
  border: 1.5px solid #cbd5e1;
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.year-card strong {
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: #d97706;
}

.year-card small {
  font-weight: 800;
  color: #475569;
}

.year-card p {
  font-size: 0.85rem;
  color: #64748b;
  margin-top: 0.2rem;
}

.year-card.highlight-bad {
  background: #fef2f2;
  border-color: #f87171;
}

.year-card.highlight-bad strong {
  color: #dc2626;
}

/* ================== TAB 3: EMIGRANT VOYAGE MAP ================== */
.voyage-stage {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.map-wrap {
  background: #ffffff;
  border: 2px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.atlantic-map-svg {
  width: 100%;
  height: 360px;
  display: block;
}

.map-port {
  cursor: pointer;
  transition: transform 0.2s;
}

.map-port:hover circle {
  transform: scale(1.25);
  transform-origin: center;
}

.map-port.active circle {
  stroke: #ffffff;
  stroke-width: 3.5px;
  filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.8));
}

.voyage-info-card {
  background: #ffffff;
  border: 2px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.8rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.voyage-badge {
  align-self: flex-start;
  font-size: 0.8rem;
  font-weight: 800;
  padding: 0.3rem 0.8rem;
  border-radius: 999px;
  background: #e0f2fe;
  color: #0369a1;
  text-transform: uppercase;
}

.voyage-info-card h3 {
  font-family: var(--font-display);
  font-size: 1.45rem;
  color: #1e293b;
}

.voyage-info-card p {
  font-size: 1rem;
  color: #334155;
  line-height: 1.5;
}

/* ================== TAB 4: QUIZ ================== */
.quiz-stage {
  max-width: 760px;
  margin: 0 auto;
}

.quiz-hud {
  display: flex;
  justify-content: space-between;
  background: #ffffff;
  padding: 0.8rem 1.4rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  margin-bottom: 1.2rem;
}

.quiz-card {
  background: #ffffff;
  border: 2px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 2.2rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.quiz-badge {
  align-self: flex-start;
  font-size: 0.8rem;
  font-weight: 800;
  padding: 0.3rem 0.8rem;
  border-radius: 999px;
  background: #fef3c7;
  color: #92400e;
  text-transform: uppercase;
}

.quiz-question {
  font-family: var(--font-display);
  font-size: 1.45rem;
  color: #1e293b;
  line-height: 1.3;
}

.quiz-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.quiz-opt-btn {
  background: #f8fafc;
  border: 2px solid #cbd5e1;
  border-radius: var(--radius-md);
  padding: 1rem;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
}

.quiz-opt-btn:hover {
  background: #f1f5f9;
  border-color: #1e293b;
  transform: translateY(-2px);
}

.quiz-opt-btn.correct {
  background: #dcfce7 !important;
  border-color: #16a34a !important;
  color: #14532d !important;
}

.quiz-opt-btn.wrong {
  background: #fee2e2 !important;
  border-color: #dc2626 !important;
  color: #7f1d1d !important;
}

.quiz-feedback {
  background: #f8fafc;
  border: 1.5px solid #cbd5e1;
  border-radius: var(--radius-md);
  padding: 1rem;
  font-size: 0.95rem;
  color: #334155;
  line-height: 1.4;
}

.quiz-footer {
  display: flex;
  justify-content: flex-end;
}

.btn-action {
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 800;
  background: #1e293b;
  color: #fff;
  border: none;
  padding: 0.6rem 1.4rem;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-action:hover {
  background: #0f172a;
  transform: translateY(-2px);
}

@media (max-width: 900px) {
  .tour-stage, .blight-compare-grid, .quiz-options {
    grid-template-columns: 1fr;
  }
}
