/* ============================================================
   CSS: The Lost Expedition
   Oregon Trail-inspired theme with parchment/frontier aesthetic
   ============================================================ */

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --parchment: #f4e8c1;
  --parchment-dark: #e6d5a0;
  --ink: #2c1810;
  --ink-light: #5c4033;
  --leather: #8b4513;
  --leather-dark: #5c2e0a;
  --forest: #2d5016;
  --forest-light: #4a7c2e;
  --river: #3a6b8c;
  --river-light: #5a9bbc;
  --campfire: #d4760a;
  --campfire-glow: #f5a623;
  --danger: #8b1a1a;
  --trail-brown: #6b4423;
  --font-heading: 'Georgia', 'Times New Roman', serif;
  --font-body: 'Georgia', serif;
  --font-journal: 'Georgia', italic, serif;
  --font-ui: system-ui, -apple-system, sans-serif;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.25);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.3);
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  color: var(--ink);
  background: #1a0f08;
  min-height: 100vh;
  line-height: 1.6;
}

/* --- Screen containers --- */
.screen {
  display: none !important;
  min-height: 100vh;
  animation: fadeIn 0.6s ease;
}
.screen.active { display: block !important; }
#title-screen.active { display: flex !important; }
#completion-screen.active { display: flex !important; }

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

/* ============================================================
   TITLE SCREEN
   ============================================================ */
#title-screen {
  background: linear-gradient(180deg, #0d0805 0%, #1a0f08 30%, #2c1810 60%, #1a0f08 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
  position: relative;
  overflow: hidden;
}

#title-screen::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: radial-gradient(ellipse at 50% 80%, rgba(212, 118, 10, 0.15) 0%, transparent 60%);
  pointer-events: none;
}

.title-stars {
  position: absolute;
  top: 0; left: 0; right: 0; height: 40%;
  background: radial-gradient(1px 1px at 20% 15%, #fff 50%, transparent 100%),
              radial-gradient(1px 1px at 60% 25%, #fff 50%, transparent 100%),
              radial-gradient(1px 1px at 80% 10%, #fff 50%, transparent 100%),
              radial-gradient(1px 1px at 40% 30%, #ccc 50%, transparent 100%),
              radial-gradient(1px 1px at 10% 20%, #ccc 50%, transparent 100%),
              radial-gradient(1px 1px at 90% 35%, #fff 50%, transparent 100%),
              radial-gradient(1px 1px at 30% 8%, #fff 50%, transparent 100%),
              radial-gradient(1px 1px at 70% 18%, #ccc 50%, transparent 100%),
              radial-gradient(1px 1px at 50% 5%, #fff 50%, transparent 100%),
              radial-gradient(1px 1px at 15% 32%, #fff 50%, transparent 100%);
  opacity: 0.6;
}

.title-content {
  position: relative;
  z-index: 1;
  max-width: 700px;
}

.title-year {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  color: var(--campfire-glow);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.title-main {
  font-family: var(--font-heading);
  font-size: clamp(2.5rem, 6vw, 4rem);
  color: var(--parchment);
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
  line-height: 1.2;
  margin-bottom: 0.5rem;
}

.title-subtitle {
  font-family: var(--font-heading);
  font-size: clamp(1rem, 2.5vw, 1.4rem);
  color: var(--campfire);
  font-style: italic;
  margin-bottom: 2rem;
}

.title-intro {
  color: var(--parchment-dark);
  font-size: 1rem;
  max-width: 550px;
  margin: 0 auto 2.5rem;
  line-height: 1.7;
}

.title-divider {
  width: 120px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--campfire), transparent);
  margin: 0 auto 2rem;
}

/* Level selector on title screen */
.level-select {
  margin-bottom: 2rem;
}

.level-select-label {
  display: block;
  color: var(--parchment-dark);
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
  letter-spacing: 0.05em;
}

.level-buttons {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
}

.level-btn {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  padding: 0.5rem 1.2rem;
  border: 1px solid var(--leather);
  background: transparent;
  color: var(--parchment-dark);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.level-btn:hover {
  background: rgba(139, 69, 19, 0.3);
  color: var(--parchment);
}

.level-btn.active {
  background: var(--leather);
  color: var(--parchment);
  border-color: var(--campfire);
}

/* Start button */
.btn-start {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  padding: 0.85rem 3rem;
  background: linear-gradient(180deg, var(--leather) 0%, var(--leather-dark) 100%);
  color: var(--parchment);
  border: 2px solid var(--campfire);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
  box-shadow: var(--shadow-md), 0 0 20px rgba(212, 118, 10, 0.2);
}

.btn-start:hover {
  background: linear-gradient(180deg, var(--campfire) 0%, var(--leather) 100%);
  box-shadow: var(--shadow-lg), 0 0 30px rgba(212, 118, 10, 0.4);
  transform: translateY(-2px);
}

/* ============================================================
   TOP NAV BAR (in-game)
   ============================================================ */
.top-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: linear-gradient(180deg, #1a0f08, #2c1810);
  border-bottom: 2px solid var(--leather);
  padding: 0.5rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.game-title-small {
  font-family: var(--font-heading);
  color: var(--parchment);
  font-size: 1rem;
  white-space: nowrap;
}

.station-indicator {
  font-family: var(--font-ui);
  color: var(--campfire-glow);
  font-size: 0.8rem;
  background: rgba(212, 118, 10, 0.15);
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  border: 1px solid rgba(212, 118, 10, 0.3);
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.nav-btn {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  padding: 0.35rem 0.85rem;
  background: rgba(255,255,255,0.08);
  color: var(--parchment-dark);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.nav-btn:hover {
  background: rgba(255,255,255,0.15);
  color: var(--parchment);
}

.nav-btn.active-tab {
  background: var(--leather);
  color: var(--parchment);
  border-color: var(--leather);
}

/* Level toggle in top bar */
.level-toggle {
  display: flex;
  border: 1px solid var(--leather);
  border-radius: 4px;
  overflow: hidden;
}

.level-toggle button {
  font-family: var(--font-ui);
  font-size: 0.7rem;
  padding: 0.25rem 0.6rem;
  background: transparent;
  color: var(--parchment-dark);
  border: none;
  border-right: 1px solid var(--leather);
  cursor: pointer;
  transition: all 0.2s;
}

.level-toggle button:last-child { border-right: none; }

.level-toggle button:hover { background: rgba(139, 69, 19, 0.3); }

.level-toggle button.active {
  background: var(--leather);
  color: var(--parchment);
}

/* ============================================================
   MAIN GAME AREA
   ============================================================ */
#game-screen {
  background: #1a0f08;
}

.game-body {
  display: none;
  max-width: 900px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
  animation: slideUp 0.4s ease;
}

.game-body.active { display: block; }

/* ============================================================
   TRAIL MAP VIEW
   ============================================================ */
.map-container {
  background: var(--parchment);
  border: 3px solid var(--leather);
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: var(--shadow-lg);
  position: relative;
}

.map-title {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  color: var(--ink);
  text-align: center;
  margin-bottom: 1rem;
}

.map-svg-wrap {
  width: 100%;
  overflow-x: auto;
}

.map-svg-wrap svg {
  width: 100%;
  height: auto;
  min-width: 700px;
}

#segment-tooltip {
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.map-station {
  cursor: pointer;
}

.map-station:hover circle {
  filter: brightness(1.3);
}

.map-station:hover text {
  fill: #000;
}

.map-station-dot {
  fill: var(--trail-brown);
  stroke: var(--leather-dark);
  stroke-width: 1.5;
  transition: all 0.3s;
}

.map-station.visited .map-station-dot {
  fill: var(--campfire-glow);
  stroke: var(--campfire);
}

.map-station.current .map-station-dot {
  fill: var(--danger);
  stroke: #fff;
  stroke-width: 2;
}

.map-legend {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  margin-top: 1rem;
  font-size: 0.8rem;
  color: var(--ink-light);
  flex-wrap: wrap;
}

.map-legend-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.map-legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1.5px solid;
}

/* ============================================================
   STATION VIEW
   ============================================================ */
.station-card {
  background: var(--parchment);
  border: 3px solid var(--leather);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.station-header {
  background: linear-gradient(135deg, var(--leather-dark), var(--leather));
  padding: 1.25rem 1.5rem;
  color: var(--parchment);
}

.station-number {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  opacity: 0.8;
  margin-bottom: 0.25rem;
}

.station-title {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  line-height: 1.3;
}

.station-date {
  font-size: 0.85rem;
  opacity: 0.8;
  margin-top: 0.25rem;
  font-style: italic;
}

.station-body {
  padding: 1.5rem;
}

.station-context {
  font-size: 1rem;
  line-height: 1.7;
  margin-bottom: 1.5rem;
  color: var(--ink);
}

.station-context p { margin-bottom: 0.75rem; }

.vocab-word {
  border-bottom: 1px dashed var(--campfire);
  cursor: help;
  position: relative;
  color: var(--leather-dark);
  font-weight: 600;
}

.vocab-tooltip {
  display: none;
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--parchment);
  padding: 0.4rem 0.75rem;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: normal;
  white-space: nowrap;
  z-index: 10;
  box-shadow: var(--shadow-sm);
}

.vocab-word:hover .vocab-tooltip,
.vocab-word:focus .vocab-tooltip {
  display: block;
}

/* Journal entry styling */
.journal-entry {
  background: linear-gradient(135deg, #fdf6e3, #f5eed5);
  border-left: 4px solid var(--leather);
  padding: 1.25rem 1.5rem;
  margin: 1.25rem 0;
  border-radius: 0 6px 6px 0;
  position: relative;
}

.journal-entry::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: url("data:image/svg+xml,%3Csvg width='100' height='100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='0.8' numOctaves='4'/%3E%3C/filter%3E%3Crect width='100' height='100' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  border-radius: 0 6px 6px 0;
}

.journal-date {
  font-family: var(--font-heading);
  font-weight: bold;
  color: var(--leather-dark);
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
}

.journal-text {
  font-family: var(--font-body);
  font-style: italic;
  line-height: 1.8;
  color: var(--ink-light);
  font-size: 0.95rem;
}

.journal-text p { margin-bottom: 0.5rem; }

.journal-author {
  font-family: var(--font-heading);
  font-weight: bold;
  color: var(--leather);
  margin-top: 0.75rem;
  font-style: normal;
  text-align: right;
}

/* Question / reflection area */
.station-reflection {
  background: rgba(45, 80, 22, 0.08);
  border: 1px solid rgba(45, 80, 22, 0.2);
  border-radius: 6px;
  padding: 1.25rem;
  margin-top: 1.5rem;
}

.reflection-label {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--forest);
  margin-bottom: 0.5rem;
  font-weight: 700;
}

.reflection-question {
  font-size: 1rem;
  color: var(--ink);
  margin-bottom: 0.75rem;
  line-height: 1.5;
}

.reflection-textarea {
  width: 100%;
  min-height: 80px;
  padding: 0.75rem;
  font-family: var(--font-body);
  font-size: 0.9rem;
  border: 1px solid var(--parchment-dark);
  border-radius: 4px;
  background: #fff;
  color: var(--ink);
  resize: vertical;
  line-height: 1.5;
}

.reflection-textarea:focus {
  outline: none;
  border-color: var(--forest-light);
  box-shadow: 0 0 0 2px rgba(45, 80, 22, 0.15);
}

/* Journal entry prompts (in-station) */
.journal-prompts {
  background: linear-gradient(135deg, rgba(139, 69, 19, 0.08), rgba(139, 69, 19, 0.03));
  border: 1.5px solid rgba(139, 69, 19, 0.25);
  border-radius: 6px;
  padding: 1.25rem;
  margin-top: 1.5rem;
}

.journal-prompts-label {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  color: var(--leather-dark);
  margin-bottom: 0.25rem;
  font-weight: 700;
}

.journal-prompts-hint {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--ink-light);
  margin-bottom: 1rem;
  font-style: italic;
}

.journal-field {
  margin-bottom: 0.85rem;
}

.journal-field:last-child {
  margin-bottom: 0;
}

.journal-field-label {
  display: block;
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 0.3rem;
}

.journal-field-input,
.journal-field-textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  font-family: var(--font-body);
  font-size: 0.9rem;
  border: 1px solid var(--parchment-dark);
  border-radius: 4px;
  background: #fff;
  color: var(--ink);
  line-height: 1.5;
}

.journal-field-input:focus,
.journal-field-textarea:focus {
  outline: none;
  border-color: var(--leather);
  box-shadow: 0 0 0 2px rgba(139, 69, 19, 0.12);
}

.journal-field-textarea {
  min-height: 70px;
  resize: vertical;
}

/* Station navigation */
.station-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--parchment-dark);
}

.btn-station-nav {
  font-family: var(--font-ui);
  font-size: 0.9rem;
  padding: 0.6rem 1.5rem;
  background: var(--leather);
  color: var(--parchment);
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}

.btn-station-nav:hover {
  background: var(--leather-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-station-nav:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.btn-station-nav.primary {
  background: var(--forest);
}

.btn-station-nav.primary:hover {
  background: var(--forest-light);
}

/* ============================================================
   JOURNAL / TRACKER VIEW
   ============================================================ */
.journal-tracker {
  background: var(--parchment);
  border: 3px solid var(--leather);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  padding: 1.5rem;
}

.journal-tracker-title {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  color: var(--ink);
  text-align: center;
  margin-bottom: 0.5rem;
}

.journal-tracker-subtitle {
  text-align: center;
  color: var(--ink-light);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

.tracker-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.tracker-table th {
  background: var(--leather);
  color: var(--parchment);
  padding: 0.6rem 0.5rem;
  text-align: left;
  font-family: var(--font-ui);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.tracker-table td {
  padding: 0.5rem;
  border-bottom: 1px solid var(--parchment-dark);
  vertical-align: top;
}

.tracker-table tr:nth-child(even) {
  background: rgba(0,0,0,0.03);
}

.tracker-table input,
.tracker-table textarea {
  width: 100%;
  font-family: var(--font-body);
  font-size: 0.8rem;
  border: 1px solid transparent;
  background: transparent;
  padding: 0.25rem;
  border-radius: 3px;
  color: var(--ink);
}

.tracker-table input:focus,
.tracker-table textarea:focus {
  outline: none;
  border-color: var(--leather);
  background: #fff;
}

.tracker-table textarea {
  min-height: 50px;
  resize: vertical;
}

.tracker-station-num {
  font-weight: bold;
  color: var(--leather);
  text-align: center;
  font-size: 1rem;
}

.tracker-station-num.visited {
  color: var(--forest);
}

.tracker-station-num.visited::after {
  content: ' \2605';
  color: var(--campfire-glow);
}

/* ============================================================
   TRAIL EVENT OVERLAY
   ============================================================ */
.trail-event-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 200;
  justify-content: center;
  align-items: center;
  padding: 2rem;
}

.trail-event-overlay.active {
  display: flex;
}

.trail-event-box {
  background: var(--parchment);
  border: 3px solid var(--leather);
  border-radius: 8px;
  max-width: 500px;
  width: 100%;
  padding: 2rem;
  text-align: center;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.4s ease;
}

.trail-event-icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

.trail-event-title {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  color: var(--ink);
  margin-bottom: 0.75rem;
}

.trail-event-text {
  color: var(--ink-light);
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

.trail-event-btn {
  font-family: var(--font-ui);
  font-size: 0.9rem;
  padding: 0.6rem 2rem;
  background: var(--leather);
  color: var(--parchment);
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.2s;
}

.trail-event-btn:hover {
  background: var(--leather-dark);
}

/* ============================================================
   COMPLETION SCREEN
   ============================================================ */
#completion-screen {
  background: linear-gradient(180deg, #0d0805, #1a0f08 40%, #2c1810);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
}

.completion-content {
  max-width: 600px;
}

.completion-title {
  font-family: var(--font-heading);
  font-size: clamp(2rem, 5vw, 3rem);
  color: var(--parchment);
  margin-bottom: 1rem;
}

.completion-text {
  color: var(--parchment-dark);
  line-height: 1.7;
  margin-bottom: 2rem;
}

.btn-restart {
  font-family: var(--font-heading);
  font-size: 1rem;
  padding: 0.75rem 2rem;
  background: var(--leather);
  color: var(--parchment);
  border: 2px solid var(--campfire);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s;
  margin: 0.5rem;
}

.btn-restart:hover {
  background: var(--campfire);
}

.btn-restart.btn-export {
  background: var(--forest);
  border-color: var(--forest-light);
}

.btn-restart.btn-export:hover {
  background: var(--forest-light);
}

.btn-restart.btn-secondary {
  background: transparent;
  border-color: rgba(244, 232, 193, 0.3);
  font-size: 0.9rem;
}

.btn-restart.btn-secondary:hover {
  background: rgba(244, 232, 193, 0.1);
}

/* ============================================================
   STATION IMAGE GALLERY
   ============================================================ */
.station-gallery {
  position: relative;
  background: #1a0f08;
}

.gallery-slide {
  display: none;
  position: relative;
}

.gallery-slide.active {
  display: block;
  animation: fadeIn 0.4s ease;
}

.gallery-img-wrap {
  width: 100%;
  max-height: 320px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0d0805;
}

.gallery-img-wrap img {
  width: 100%;
  height: 300px;
  object-fit: cover;
  display: block;
}

.gallery-caption {
  background: rgba(0,0,0,0.7);
  color: var(--parchment-dark);
  font-size: 0.72rem;
  padding: 0.35rem 0.75rem;
  font-family: var(--font-ui);
  text-align: center;
  line-height: 1.4;
}

/* Gallery navigation */
.gallery-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.5rem;
  background: rgba(0,0,0,0.5);
}

.gallery-arrow {
  font-size: 1.5rem;
  background: rgba(255,255,255,0.1);
  color: var(--parchment);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 0;
}

.gallery-arrow:hover {
  background: rgba(255,255,255,0.25);
  border-color: var(--campfire);
}

.gallery-dots {
  display: flex;
  gap: 0.4rem;
}

.gallery-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255,255,255,0.25);
  border: 1px solid rgba(255,255,255,0.3);
  cursor: pointer;
  padding: 0;
  transition: all 0.2s;
}

.gallery-dot.active {
  background: var(--campfire-glow);
  border-color: var(--campfire);
}

.gallery-dot:hover {
  background: rgba(255,255,255,0.5);
}

/* ============================================================
   INTERACTIVE CHALLENGES
   ============================================================ */
.challenge-box {
  background: linear-gradient(135deg, #2c1810, #3d2518);
  border: 2px solid var(--campfire);
  border-radius: 8px;
  padding: 1.25rem;
  margin: 1.5rem 0;
  color: var(--parchment);
}

.challenge-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.challenge-icon {
  font-size: 1.3rem;
}

.challenge-label {
  font-family: var(--font-ui);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--campfire-glow);
  font-weight: 700;
}

.challenge-question {
  font-size: 1rem;
  line-height: 1.5;
  margin-bottom: 1rem;
  color: var(--parchment);
}

.challenge-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.challenge-option {
  font-family: var(--font-ui);
  font-size: 0.9rem;
  padding: 0.65rem 1rem;
  background: rgba(255,255,255,0.08);
  color: var(--parchment-dark);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
}

.challenge-option:hover {
  background: rgba(255,255,255,0.15);
  border-color: var(--campfire);
  color: var(--parchment);
}

.challenge-option.correct {
  background: rgba(45, 80, 22, 0.4);
  border-color: var(--forest-light);
  color: #b5e8a0;
  cursor: default;
}

.challenge-option.incorrect {
  background: rgba(139, 26, 26, 0.3);
  border-color: var(--danger);
  color: #e8a0a0;
  cursor: default;
}

.challenge-option:disabled {
  cursor: default;
  opacity: 0.7;
}

.challenge-feedback {
  margin-top: 0.75rem;
  padding: 0.75rem;
  border-radius: 6px;
  font-size: 0.9rem;
  line-height: 1.5;
  display: none;
}

.challenge-feedback.show { display: block; }

.challenge-feedback.correct {
  background: rgba(45, 80, 22, 0.25);
  border: 1px solid rgba(74, 124, 46, 0.4);
  color: #b5e8a0;
}

.challenge-feedback.incorrect {
  background: rgba(139, 26, 26, 0.2);
  border: 1px solid rgba(139, 26, 26, 0.4);
  color: #e8a0a0;
}

/* ============================================================
   SCORE DISPLAY
   ============================================================ */
.score-display {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--campfire-glow);
  background: rgba(212, 118, 10, 0.15);
  padding: 0.2rem 0.6rem;
  border-radius: 10px;
  border: 1px solid rgba(212, 118, 10, 0.25);
}

/* ============================================================
   TRAVEL TRANSITION SCREEN
   ============================================================ */
.travel-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(180deg, #0d0805, #1a0f08 40%, #2c1810 70%, #1a0f08);
  z-index: 200;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
}

.travel-overlay.active { display: flex; }

.travel-scene {
  max-width: 500px;
  width: 100%;
}

.travel-title {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  color: var(--parchment);
  margin-bottom: 0.75rem;
}

.travel-text {
  color: var(--parchment-dark);
  line-height: 1.6;
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

.travel-progress {
  width: 100%;
  height: 8px;
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
  margin-bottom: 1rem;
  overflow: hidden;
}

.travel-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--campfire), var(--campfire-glow));
  border-radius: 4px;
  width: 0%;
  transition: width 0.3s ease;
}

.travel-distance {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  color: var(--campfire);
  margin-bottom: 1.5rem;
}

.travel-event {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 10px;
  padding: 1.25rem;
  margin-bottom: 1rem;
  animation: slideUp 0.4s ease;
}

.travel-event-emoji {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.travel-event-msg {
  color: var(--parchment);
  font-size: 1.1rem;
  line-height: 1.5;
  margin-bottom: 0.25rem;
}

.travel-event-desc {
  color: var(--parchment-dark);
  font-size: 0.95rem;
  line-height: 1.5;
  margin-bottom: 1rem;
}

.travel-arrival {
  border-color: var(--campfire);
  background: rgba(212, 118, 10, 0.1);
}

.travel-score-line {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  color: var(--campfire-glow);
  margin-bottom: 1rem;
  min-height: 1.2em;
}

/* --- Travel choice buttons --- */
.travel-choices {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.travel-choice-btn {
  font-family: var(--font-ui);
  font-size: 0.95rem;
  padding: 0.7rem 1rem;
  background: rgba(255,255,255,0.08);
  color: var(--parchment-dark);
  border: 1.5px solid rgba(255,255,255,0.2);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
}

.travel-choice-btn:hover {
  background: rgba(255,255,255,0.15);
  border-color: var(--campfire);
  color: var(--parchment);
  transform: translateX(4px);
}

.travel-choice-btn:disabled {
  cursor: default;
  opacity: 0.6;
  transform: none;
}

.travel-choice-btn.choice-good {
  background: rgba(45, 80, 22, 0.35);
  border-color: var(--forest-light);
  color: #b5e8a0;
  opacity: 1;
}

.travel-choice-btn.choice-bad {
  background: rgba(139, 26, 26, 0.3);
  border-color: var(--danger);
  color: #e8a0a0;
  opacity: 1;
}

/* --- Travel result feedback --- */
.travel-result {
  margin-top: 0.75rem;
  padding: 0.7rem 0.9rem;
  border-radius: 6px;
  font-size: 0.9rem;
  line-height: 1.5;
  animation: slideUp 0.3s ease;
}

.result-good {
  background: rgba(45, 80, 22, 0.2);
  border: 1px solid rgba(74, 124, 46, 0.4);
  color: #b5e8a0;
}

.result-bad {
  background: rgba(139, 26, 26, 0.15);
  border: 1px solid rgba(139, 26, 26, 0.4);
  color: #e8a0a0;
}

.result-points {
  font-weight: bold;
  font-family: var(--font-ui);
  margin-right: 0.3rem;
}

/* --- Tap/swat mini-game --- */
.swat-arena {
  margin-top: 0.75rem;
}

.swat-timer {
  font-family: var(--font-ui);
  font-size: 1.4rem;
  font-weight: bold;
  color: var(--campfire-glow);
  text-align: center;
}

.swat-counter {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  color: var(--parchment-dark);
  text-align: center;
  margin-bottom: 0.5rem;
}

.swat-field {
  position: relative;
  width: 100%;
  height: 160px;
  background: rgba(255,255,255,0.03);
  border: 1px dashed rgba(255,255,255,0.15);
  border-radius: 8px;
  overflow: hidden;
}

.swat-target {
  position: absolute;
  font-size: 2rem;
  background: none;
  border: none;
  cursor: pointer;
  animation: swatPop 0.3s ease;
  transition: transform 0.1s;
  padding: 0.2rem;
  line-height: 1;
}

.swat-target:hover {
  transform: scale(1.3);
}

.swat-target:active {
  transform: scale(0.8);
}

.swat-hit {
  transform: scale(0) !important;
  opacity: 0;
  transition: all 0.2s;
}

.swat-miss {
  opacity: 0;
  transition: opacity 0.3s;
}

@keyframes swatPop {
  from { transform: scale(0); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* --- Continue button --- */
.btn-travel-continue {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  padding: 0.8rem 2.5rem;
  background: var(--leather);
  color: var(--parchment);
  border: 2px solid var(--campfire);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s;
  margin-top: 1rem;
}

.btn-travel-continue:hover {
  background: var(--campfire);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(212, 118, 10, 0.3);
}

/* ============================================================
   CONTINUE / SAVE INDICATOR ON TITLE
   ============================================================ */
.title-continue {
  margin-top: 1rem;
}

.btn-continue {
  font-family: var(--font-heading);
  font-size: 1rem;
  padding: 0.7rem 2.5rem;
  background: transparent;
  color: var(--campfire-glow);
  border: 1px solid var(--campfire);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s;
}

.btn-continue:hover {
  background: rgba(212, 118, 10, 0.2);
}

.save-info {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: rgba(244,232,193,0.4);
  margin-top: 0.5rem;
}

/* ============================================================
   PRIMARY SOURCES (per-station — collapsible)
   ============================================================ */
.primary-sources {
  margin-top: 1.25rem;
  border: 1px solid rgba(58, 107, 140, 0.15);
  border-radius: 5px;
}

.primary-sources-label {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--river);
  cursor: pointer;
  padding: 0.6rem 0.8rem;
  list-style: none;
  font-weight: 600;
}

.primary-sources-label::-webkit-details-marker { display: none; }
.primary-sources-label::marker { display: none; content: ''; }
.primary-sources-label::after { content: ' \25BE'; }
.primary-sources[open] .primary-sources-label::after { content: ' \25B4'; }

.primary-sources-links {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0 0.8rem 0.6rem;
}

.source-link {
  display: block;
  padding: 0.4rem 0.6rem;
  background: rgba(255, 255, 255, 0.4);
  border: 1px solid rgba(58, 107, 140, 0.1);
  border-radius: 4px;
  text-decoration: none;
  color: var(--ink);
  font-size: 0.8rem;
  transition: all 0.2s;
}

.source-link:hover {
  background: rgba(58, 107, 140, 0.08);
  border-color: var(--river);
}

.source-host {
  font-family: var(--font-ui);
  font-size: 0.65rem;
  color: var(--river-light);
  margin-left: 0.5rem;
}

/* ============================================================
   MAP ATLAS LINK
   ============================================================ */
.map-atlas-link {
  text-align: center;
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--parchment-dark);
}

.atlas-btn {
  display: inline-block;
  font-family: var(--font-ui);
  font-size: 0.85rem;
  padding: 0.5rem 1.25rem;
  background: var(--river);
  color: var(--parchment);
  border-radius: 5px;
  text-decoration: none;
  transition: all 0.2s;
}

.atlas-btn:hover {
  background: var(--river-light);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.atlas-credit {
  display: block;
  font-family: var(--font-ui);
  font-size: 0.7rem;
  color: var(--ink-light);
  margin-top: 0.4rem;
  opacity: 0.7;
}

/* ============================================================
   TEACHER RESOURCES (title screen — uses <details>/<summary>)
   ============================================================ */
.teacher-resources {
  margin-top: 2rem;
  max-width: 420px;
  width: 100%;
}

.teacher-toggle {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: rgba(244, 232, 193, 0.4);
  cursor: pointer;
  list-style: none;
  text-align: center;
  padding: 0.4rem 0;
  letter-spacing: 0.05em;
}

.teacher-toggle::-webkit-details-marker { display: none; }
.teacher-toggle::marker { display: none; content: ''; }

.teacher-toggle:hover {
  color: var(--parchment-dark);
}

.teacher-toggle::after {
  content: ' \25BE';
}

.teacher-resources[open] .teacher-toggle::after {
  content: ' \25B4';
}

.teacher-links {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.5rem;
  text-align: left;
}

.teacher-links a {
  display: block;
  padding: 0.4rem 0.75rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 4px;
  text-decoration: none;
  color: rgba(244, 232, 193, 0.6);
  font-family: var(--font-ui);
  font-size: 0.78rem;
  transition: all 0.2s;
}

.teacher-links a:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--campfire);
  color: var(--parchment);
}

.teacher-links a span {
  display: block;
  font-size: 0.65rem;
  color: rgba(244, 232, 193, 0.3);
  margin-top: 0.1rem;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  .top-bar { padding: 0.4rem 0.75rem; }
  .game-title-small { display: none; }
  .station-body { padding: 1rem; }
  .station-header { padding: 1rem; }
  .station-title { font-size: 1.2rem; }
  .journal-entry { padding: 1rem; }
  .tracker-table { font-size: 0.75rem; }
  .level-toggle button { font-size: 0.65rem; padding: 0.2rem 0.4rem; }
}

@media (max-width: 480px) {
  .top-bar-right { width: 100%; justify-content: space-between; }
  .station-nav { flex-direction: column; gap: 0.5rem; }
  .btn-station-nav { width: 100%; text-align: center; }
  .source-link { flex-wrap: wrap; }
  .source-host { width: 100%; margin-left: 1.8rem; }
}

/* Print styles for journal */
@media print {
  .top-bar, .station-nav, .nav-btn, .level-toggle { display: none !important; }
  .screen { display: block !important; min-height: auto !important; }
  .game-body { display: block !important; }
  body { background: #fff; }
  .station-card, .journal-tracker { box-shadow: none; border: 1px solid #ccc; }
}
