:root {
  --bg: #0a1208;
  --panel: #0f1a0c;
  --green: #5dff5a;
  --green-dim: #2a9a28;
  --green-dark: #163f14;
  --amber: #ffc857;
  --red: #ff6b6b;
  --muted: #6a9a68;
  --border: #2d6b2a;
  --shadow: rgba(0, 0, 0, 0.55);
  --font-display: "VT323", monospace;
  --font-body: "Share Tech Mono", ui-monospace, monospace;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
  background: #020402;
  color: var(--green);
  font-family: var(--font-body);
  font-size: 19px;
  line-height: 1.5;
}

body {
  display: flex;
  justify-content: center;
  align-items: stretch;
  min-height: 100vh;
  padding: 16px;
}

#crt {
  position: relative;
  width: min(1280px, 96vw);
  margin: auto;
  background:
    radial-gradient(ellipse at center, #122010 0%, var(--bg) 70%),
    var(--bg);
  border: 3px solid var(--border);
  border-radius: 14px;
  box-shadow:
    0 0 0 4px #061006,
    0 0 40px rgba(93, 255, 90, 0.12),
    inset 0 0 60px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  min-height: min(860px, calc(100vh - 32px));
}

#scanlines {
  pointer-events: none;
  position: absolute;
  inset: 0;
  z-index: 50;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 2px,
    rgba(0, 0, 0, 0.12) 2px,
    rgba(0, 0, 0, 0.12) 4px
  );
  mix-blend-mode: multiply;
  opacity: 0.55;
}

#app {
  position: relative;
  z-index: 1;
  padding: 28px 32px 24px;
  min-height: inherit;
}

.mute-btn {
  position: absolute;
  bottom: 10px;
  right: 10px;
  z-index: 60;
  width: 34px;
  height: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-body);
  font-size: 0.95rem;
  line-height: 1;
  color: var(--muted);
  background: rgba(6, 16, 6, 0.75);
  border: 1px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  opacity: 0.72;
  transition: color 0.15s, border-color 0.15s, background 0.15s, opacity 0.15s;
}

.mute-btn:hover {
  color: var(--green);
  border-color: var(--green);
  opacity: 1;
  background: rgba(6, 16, 6, 0.92);
}

.mute-btn.muted {
  color: var(--red);
  border-color: rgba(255, 107, 107, 0.45);
  opacity: 0.9;
}

.screen {
  display: none;
  animation: fadeIn 0.25s ease;
}

.screen.active {
  display: block;
}

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

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: 0.04em;
  margin: 0 0 0.4em;
  text-shadow: 0 0 12px rgba(93, 255, 90, 0.35);
}

h1 {
  font-size: 4rem;
  text-align: center;
  color: var(--amber);
  text-shadow: 0 0 18px rgba(255, 200, 87, 0.4);
}

h2 {
  font-size: 2.6rem;
  color: var(--amber);
}

h3 {
  font-size: 1.65rem;
  color: var(--green);
}

.subtitle, .flavor, .hint, .muted {
  color: var(--muted);
}

.subtitle {
  text-align: center;
  margin-top: 0;
  margin-bottom: 1.5rem;
  font-size: 1.15rem;
}

.flavor {
  margin-bottom: 1rem;
}

.hint {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.9rem;
}

.title-art {
  text-align: center;
  margin-bottom: 1rem;
}

.title-trail {
  display: flex;
  justify-content: center;
  margin: 0 auto 0.35rem;
  max-width: 460px;
  filter: drop-shadow(0 0 14px rgba(93, 255, 90, 0.16));
}

.trail-title-svg {
  width: min(420px, 92vw);
  height: auto;
  overflow: visible;
}

.trail-title-svg .tt-hill {
  fill: #1a3014;
  stroke: none;
  opacity: 0.85;
}

.trail-title-svg .tt-hill.far {
  fill: #142410;
  opacity: 0.95;
}

.trail-title-svg .tt-ground {
  fill: #1e3818;
}

.trail-title-svg .tt-path-dust {
  stroke: rgba(200, 170, 90, 0.22);
  stroke-width: 14;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.trail-title-svg .tt-path {
  stroke: var(--amber);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.9;
  stroke-dasharray: 420;
  stroke-dashoffset: 420;
  animation: trail-draw 2.4s ease-out forwards;
}

.trail-title-svg .tt-path-rut {
  stroke: var(--green-dim);
  stroke-width: 1.6;
  stroke-linecap: round;
  opacity: 0.55;
}

.trail-title-svg .tt-scrub line {
  stroke: var(--green);
  stroke-width: 2;
  stroke-linecap: round;
  opacity: 0.55;
}

.trail-title-svg .tt-dot {
  fill: var(--amber);
  stroke: var(--green);
  stroke-width: 1.2;
}

.trail-title-svg .tt-dot.end {
  fill: var(--green);
  stroke: var(--amber);
}

.trail-title-svg .tt-label {
  fill: var(--muted);
  font-family: "Share Tech Mono", monospace;
  font-size: 11px;
  text-anchor: middle;
}

@keyframes trail-draw {
  to { stroke-dashoffset: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .trail-title-svg .tt-path {
    animation: none;
    stroke-dashoffset: 0;
  }
}

.menu {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 520px;
  margin: 0 auto;
}

.menu-btn,
.trail-actions button,
.modal-actions button,
.card {
  font-family: var(--font-body);
  font-size: 1.08rem;
  color: var(--green);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 18px;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.menu-btn:hover,
.trail-actions button:hover,
.modal-actions button:hover,
.card:hover {
  background: var(--green-dark);
  border-color: var(--green);
  box-shadow: 0 0 12px rgba(93, 255, 90, 0.15);
}

.menu-btn.primary,
.modal-actions button.primary {
  border-color: var(--amber);
  color: var(--amber);
}

.menu-btn:disabled,
.trail-actions button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}

.card-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 720px;
  max-height: min(560px, 62vh);
  overflow-y: auto;
  padding-right: 6px;
}

.occupation-layout {
  display: grid;
  grid-template-columns: minmax(300px, 1fr) minmax(340px, 1.1fr);
  gap: 22px;
  align-items: stretch;
  min-height: 420px;
}

@media (max-width: 900px) {
  .occupation-layout {
    grid-template-columns: 1fr;
  }

  .occupation-story {
    order: -1;
    max-height: none;
  }
}

.occupation-cards {
  max-width: none;
  max-height: min(620px, 68vh);
}

.occupation-story {
  background: rgba(0, 0, 0, 0.32);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 320px;
  max-height: min(620px, 68vh);
  overflow-y: auto;
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.25);
}

.occupation-story.has-story {
  border-color: var(--green-dim);
  box-shadow:
    inset 0 0 30px rgba(0, 0, 0, 0.25),
    0 0 16px rgba(93, 255, 90, 0.08);
}

.occupation-story h3 {
  color: var(--amber);
  font-size: 1.85rem;
  margin: 0;
}

.occ-story-blurb {
  color: var(--green);
  font-size: 1.05rem;
  margin: 0;
}

.occ-story-body {
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.55;
  flex: 1;
}

.occ-story-body p {
  margin: 0 0 0.9em;
}

.occ-story-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 4px 0 0;
  padding-top: 10px;
  border-top: 1px dashed var(--green-dark);
}

.occ-story-stats div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.occ-story-stats dt {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.occ-ability-tag {
  color: var(--amber);
}

.occ-ability-stat {
  grid-column: 1 / -1;
}

.occ-ability-stat dd {
  font-size: 0.92rem;
  line-height: 1.35;
  color: var(--muted);
  font-weight: 400;
  margin-top: 4px;
}

.trail-actions .ability-btn {
  border-color: var(--amber);
  color: var(--amber);
}

.trail-actions .ability-btn:disabled {
  opacity: 0.55;
}

.occ-story-stats dd {
  margin: 0;
  color: var(--amber);
  font-size: 1.05rem;
}

.skill-row {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 8px;
  align-items: center;
  margin-bottom: 6px;
  font-size: 0.82rem;
  color: var(--muted);
}

.skill-bar {
  height: 8px;
  background: #061006;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.skill-bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--green-dark), var(--green));
  border-radius: 999px;
  box-shadow: 0 0 8px rgba(93, 255, 90, 0.35);
}

.card {
  width: 100%;
}

.card.is-hovered,
.card:focus-visible {
  background: var(--green-dark);
  border-color: var(--green);
  box-shadow: 0 0 12px rgba(93, 255, 90, 0.18);
}

.card strong {
  color: var(--amber);
  display: block;
  font-size: 1.28rem;
  margin-bottom: 4px;
}

.card .detail {
  color: var(--muted);
  font-size: 1rem;
}

.screen-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 0.2em;
}

.screen-header-row h2 {
  margin-bottom: 0;
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 0.5em;
}

.form-actions .menu-btn {
  width: auto;
  flex: 1 1 140px;
}

.menu-btn.compact {
  width: auto;
  flex: 0 0 auto;
  padding: 8px 14px;
  font-size: 0.92rem;
  text-align: center;
  white-space: nowrap;
}

.names-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 520px;
}

.names-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--muted);
  font-size: 1rem;
}

.names-form input,
#score-name {
  font-family: var(--font-body);
  font-size: 1.15rem;
  color: var(--green);
  background: #061006;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 12px 14px;
  outline: none;
}

.names-form input:focus,
#score-name:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 2px rgba(93, 255, 90, 0.15);
}

.scroll-box {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px 22px;
  margin-bottom: 16px;
  max-height: 420px;
  overflow-y: auto;
  font-size: 1.05rem;
}

.scroll-box p {
  margin: 0 0 0.9em;
}

.score-list {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 12px 12px 36px;
  margin: 0 0 16px;
  max-width: 480px;
}

.score-list li {
  padding: 6px 0;
  border-bottom: 1px dashed var(--green-dark);
}

.score-list li:last-child {
  border-bottom: none;
}

/* Store */
.store-layout {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 20px;
}

@media (max-width: 800px) {
  .store-layout {
    grid-template-columns: 1fr;
  }
}

.store-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.store-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: center;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px 16px;
  font-size: 1.02rem;
}

.store-row .name {
  color: var(--amber);
}

.store-row .price {
  color: var(--muted);
  font-size: 0.9rem;
}

.store-row .qty-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.store-row button {
  width: 40px;
  height: 40px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--green);
  font-size: 1.25rem;
  cursor: pointer;
  font-family: var(--font-body);
}

.store-row button:hover:not(:disabled) {
  border-color: var(--green);
  background: var(--green-dark);
}

.store-row button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.store-delta {
  display: inline-block;
  margin-top: 4px;
  font-size: 0.85rem;
}

.store-delta.buy {
  color: var(--amber);
}

.store-delta.sell {
  color: #7ec8ff;
}

.store-qty {
  min-width: 5.5em;
  text-align: right;
}

.store-tip {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.3;
}

.bill-pay {
  color: var(--amber);
}

.bill-credit {
  color: #7ec8ff;
}

#store-buy-row,
#store-sell-row {
  font-size: 1.02rem;
}

.store-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.store-actions .menu-btn {
  text-align: center;
  width: 100%;
}

.store-actions .menu-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}

#store-purchase:not(:disabled) {
  border-color: var(--amber);
  color: var(--amber);
}

#store-sell:not(:disabled) {
  border-color: #7ec8ff;
  color: #7ec8ff;
}

.store-summary {
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: fit-content;
  font-size: 1.05rem;
}

.stat-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.95rem;
}

.inventory-preview {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.88rem;
  color: var(--muted);
}

.inventory-preview li {
  padding: 2px 0;
}

/* Trail HUD */
.hud {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 18px;
  background: rgba(0, 0, 0, 0.3);
  margin-bottom: 14px;
}

.hud-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 22px;
  justify-content: space-between;
  font-size: 1.08rem;
}

.hud-row.supplies {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--green-dark);
  color: var(--muted);
}

.hud-row.supplies b {
  color: var(--green);
  font-weight: 400;
}

.hud-row.supplies .sup-low b {
  color: var(--amber);
}

.hud-row.supplies .sup-critical b {
  color: var(--red);
  animation: pulse-text 1.2s ease-in-out infinite;
}

/* Status alerts */
.alert-banner {
  border: 1px solid var(--amber);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 12px;
  background: rgba(80, 40, 0, 0.35);
  box-shadow: 0 0 16px rgba(255, 200, 87, 0.12);
}

.alert-banner.level-warn {
  border-color: var(--amber);
  background: rgba(80, 50, 0, 0.38);
}

.alert-banner.level-critical {
  border-color: var(--red);
  background: rgba(80, 10, 10, 0.45);
  box-shadow: 0 0 18px rgba(255, 107, 107, 0.2);
  animation: alert-glow 1.6s ease-in-out infinite;
}

.alert-title {
  font-family: var(--font-display);
  font-size: 1.55rem;
  color: var(--amber);
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.alert-banner.level-critical .alert-title {
  color: var(--red);
}

#alert-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

#alert-list li {
  font-size: 1.02rem;
  color: var(--green);
  padding: 3px 0;
}

#alert-list li::before {
  content: "• ";
  color: var(--amber);
}

#alert-list li.critical {
  color: #ffb4b4;
}

#alert-list li.critical::before {
  content: "⚠ ";
  color: var(--red);
}

#alert-list li .tip {
  color: var(--muted);
  font-size: 0.85rem;
}

@keyframes pulse-text {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

@keyframes alert-glow {
  0%, 100% { box-shadow: 0 0 12px rgba(255, 107, 107, 0.15); }
  50% { box-shadow: 0 0 22px rgba(255, 107, 107, 0.35); }
}

/* HUD: segment progress to next landmark */
.waypoint-progress {
  margin-bottom: 12px;
}

.waypoint-labels {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.95rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.waypoint-labels #waypoint-from {
  color: var(--green-dim);
}

.waypoint-labels #waypoint-to {
  color: var(--amber);
  text-align: right;
}

.waypoint-track {
  position: relative;
  height: 18px;
  background: #061006;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: visible;
}

.waypoint-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--green-dark), var(--green));
  border-radius: 999px;
  transition: width 0.35s ease;
  box-shadow: 0 0 10px rgba(93, 255, 90, 0.35);
}

.waypoint-marker {
  position: absolute;
  top: 50%;
  left: 0%;
  transform: translate(-50%, -50%);
  font-size: 1.35rem;
  transition: left 0.35s ease;
  filter: drop-shadow(0 0 4px rgba(0, 0, 0, 0.8));
  pointer-events: none;
  line-height: 1;
}

.waypoint-segment {
  color: var(--muted);
}

/* Full map only appears in Look at map modal */
.trail-map-frame {
  width: 100%;
  border: 2px solid #8a7040;
  border-radius: 6px;
  background: #d9c89a;
  box-shadow:
    inset 0 0 0 1px rgba(60, 40, 15, 0.25),
    0 0 16px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}

.trail-map-frame svg {
  display: block;
  width: 100%;
  height: auto;
}

/* Vintage parchment map */
.trail-map-svg .tm-paper-wash {
  fill: rgba(210, 180, 100, 0.18);
}

.trail-map-svg .tm-ocean-fill {
  fill: rgba(120, 150, 150, 0.22);
}

.trail-map-svg .tm-usa {
  fill: #e2d2a4;
  stroke: none;
}

.trail-map-svg .tm-usa-stroke {
  stroke: #5a4020;
  stroke-width: 1.6;
  stroke-linejoin: round;
}

.trail-map-svg .tm-grid {
  stroke: rgba(90, 60, 20, 0.12);
  stroke-width: 0.5;
}

.trail-map-svg .tm-hachure {
  stroke: #6a5030;
  stroke-width: 1.1;
  opacity: 0.45;
}

.trail-map-svg .tm-river {
  fill: none;
  stroke: #4a7088;
  stroke-width: 1.6;
  stroke-linecap: round;
  opacity: 0.75;
}

.trail-map-svg .tm-path-bg {
  fill: none;
  stroke: rgba(120, 70, 20, 0.2);
  stroke-width: 6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.trail-map-svg .tm-path {
  fill: none;
  stroke: #8b4518;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 5 3;
  opacity: 0.95;
}

.trail-map-svg .tm-path-done {
  fill: none;
  stroke: #2d5a28;
  stroke-width: 2.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.95;
}

.trail-map-svg .tm-dot {
  fill: #f5ead0;
  stroke: #4a3020;
  stroke-width: 1.1;
}

.trail-map-svg .tm-dot.passed {
  fill: #3d6b35;
  stroke: #1a3014;
}

.trail-map-svg .tm-dot.next {
  fill: #c45c12;
  stroke: #3a2008;
  stroke-width: 1.4;
}

.trail-map-svg .tm-label {
  fill: #4a3520;
  font-family: "Share Tech Mono", Georgia, serif;
  font-size: 8px;
  text-anchor: middle;
  pointer-events: none;
}

.trail-map-svg .tm-label.major {
  fill: #2a1c10;
  font-weight: 700;
  font-size: 9px;
}

.trail-map-svg .tm-territory {
  fill: #6a5030;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 11px;
  font-style: italic;
  text-anchor: middle;
  letter-spacing: 0.12em;
  opacity: 0.55;
}

.trail-map-svg .tm-territory.faint {
  font-size: 8px;
  opacity: 0.4;
  letter-spacing: 0.08em;
}

.trail-map-svg .tm-ocean {
  fill: #3a5a68;
  font-family: Georgia, serif;
  font-size: 9px;
  font-style: italic;
  text-anchor: middle;
  opacity: 0.45;
  letter-spacing: 0.1em;
}

.trail-map-svg .tm-you {
  fill: #c41e1e;
  stroke: #2a1008;
  stroke-width: 1.3;
  filter: drop-shadow(0 0 3px rgba(180, 40, 20, 0.55));
}

.trail-map-svg .tm-you-ring {
  fill: none;
  stroke: rgba(180, 40, 20, 0.55);
  stroke-width: 1.4;
  animation: map-pulse 1.6s ease-in-out infinite;
}

.trail-map-svg .tm-title {
  fill: #5a3820;
  font-family: Georgia, serif;
  font-size: 7px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.trail-map-svg .tm-cartouche-bg {
  fill: rgba(245, 230, 190, 0.92);
  stroke: #5a4020;
  stroke-width: 1.2;
}

.trail-map-svg .tm-cartouche-title {
  fill: #3a2810;
  font-family: Georgia, serif;
  font-size: 9px;
  font-weight: 700;
  text-anchor: middle;
  letter-spacing: 0.06em;
}

.trail-map-svg .tm-cartouche-sub {
  fill: #6a5030;
  font-family: Georgia, serif;
  font-size: 7.5px;
  font-style: italic;
  text-anchor: middle;
}

.trail-map-svg .tm-rose-ring {
  fill: none;
  stroke: #5a4020;
  stroke-width: 1.2;
}

.trail-map-svg .tm-rose-ring.inner {
  stroke-width: 0.7;
  opacity: 0.6;
}

.trail-map-svg .tm-rose-n {
  fill: #8b1a1a;
}

.trail-map-svg .tm-rose-s,
.trail-map-svg .tm-rose-e,
.trail-map-svg .tm-rose-w {
  fill: #5a4020;
}

.trail-map-svg .tm-rose-label {
  fill: #3a2810;
  font-family: Georgia, serif;
  font-size: 8px;
  font-weight: 700;
  text-anchor: middle;
}

.trail-map-svg .tm-scale-line {
  stroke: #4a3020;
  stroke-width: 1.2;
}

.trail-map-svg .tm-scale-label {
  fill: #4a3020;
  font-family: Georgia, serif;
  font-size: 7.5px;
  text-anchor: middle;
}

.trail-map-svg .tm-border {
  stroke: #5a4020;
  stroke-width: 2.2;
}

.trail-map-svg .tm-border-inner {
  stroke: #8a7040;
  stroke-width: 0.8;
  opacity: 0.7;
}

.trail-map-svg.is-full {
  cursor: grab;
  touch-action: none;
}

.trail-map-svg.is-full.is-panning {
  cursor: grabbing;
}

.map-viewer-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.map-zoom-btn {
  width: 36px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(20, 40, 15, 0.85);
  color: var(--amber);
  font-family: inherit;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}

.map-zoom-btn.text {
  width: auto;
  padding: 0 10px;
  font-size: 0.85rem;
}

.map-zoom-btn:hover {
  border-color: var(--amber);
  background: rgba(40, 60, 20, 0.95);
}

.map-zoom-label {
  min-width: 3.2em;
  text-align: center;
  color: var(--amber);
  font-size: 0.95rem;
}

.map-zoom-hint {
  margin-left: auto;
  font-size: 0.8rem;
  color: var(--muted);
}

@keyframes map-pulse {
  0%, 100% { opacity: 0.85; }
  50% { opacity: 0.3; }
}

@media (prefers-reduced-motion: reduce) {
  .trail-map-svg .tm-you-ring {
    animation: none;
  }
}

/* Full map in Look at map modal */
.modal-map-wrap {
  margin: 0.4em 0 0.8em;
  border: 2px solid #8a7040;
  border-radius: 6px;
  background: #d9c89a;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(60, 40, 15, 0.2);
}

.modal-map-wrap svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: 280px;
}

.modal-map-wrap.large svg {
  max-height: min(52vh, 420px);
}

/* Modal panel wider for the full United States chart */
.modal-panel.map-modal {
  width: min(760px, 96vw);
  max-width: 96vw;
}

.modal-map-list {
  font-size: 0.88rem;
  max-height: 140px;
  overflow: auto;
  color: var(--muted);
  margin-top: 0.4em;
}

.modal-map-list .here {
  color: var(--amber);
}

.modal-map-list .done {
  color: var(--green-dim);
}

.miles-line {
  font-size: 1.05rem;
  color: var(--muted);
  margin-top: 6px;
}



.trail-main {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 16px;
  margin-bottom: 14px;
  min-height: 280px;
}

@media (max-width: 800px) {
  .trail-main {
    grid-template-columns: 1fr;
  }
}

.log {
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 18px;
  height: 300px;
  overflow-y: auto;
  font-size: 1.05rem;
}

.log .entry {
  margin-bottom: 0.55em;
  padding-bottom: 0.45em;
  border-bottom: 1px dashed rgba(45, 107, 42, 0.45);
}

.log .entry:last-child {
  border-bottom: none;
}

.log .entry.bad {
  color: var(--red);
}

.log .entry.good {
  color: var(--amber);
}

.log .entry.date {
  color: var(--muted);
  font-size: 0.85rem;
}

.party-panel {
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
}

.party-panel ul {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
}

.party-panel li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 0;
  font-size: 1.02rem;
  border-bottom: 1px dashed var(--green-dark);
}

.party-panel li .status {
  color: var(--muted);
  font-size: 0.92rem;
}

.party-panel li.dead {
  opacity: 0.45;
  text-decoration: line-through;
}

.party-panel li.sick .status {
  color: var(--red);
}

.party-panel li.weak .status {
  color: var(--amber);
}

.settings {
  font-size: 0.88rem;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.settings strong {
  color: var(--green);
  font-weight: 400;
}

.trail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.trail-actions button {
  flex: 1 1 140px;
  text-align: center;
  padding: 14px 10px;
  font-size: 1.02rem;
}

/* Modal — title + body + always-visible buttons (buttons never scroll away) */
.modal {
  position: absolute;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(2, 8, 2, 0.88);
  padding: 12px;
}

.modal.hidden {
  display: none !important;
  pointer-events: none;
}

.modal-panel {
  width: min(560px, 100%);
  max-height: 85vh;
  background: #0c160a;
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 0;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.5),
    0 12px 40px rgba(0, 0, 0, 0.65),
    0 0 30px rgba(93, 255, 90, 0.1);
  font-size: 1.02rem;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-panel h2 {
  font-size: 1.7rem;
  margin: 0;
  padding: 14px 18px 10px;
  flex: 0 0 auto;
  border-bottom: 1px solid var(--border);
  background: #0c160a;
}

#modal-body {
  margin: 0;
  padding: 12px 18px;
  color: var(--green);
  font-size: 0.98rem;
  overflow-y: auto;
  /* Cap height so action buttons always fit below on short screens */
  max-height: min(42vh, 360px);
  flex: 0 1 auto;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
}

#modal-body p {
  margin: 0 0 0.55em;
}

#modal-body .muted {
  color: var(--muted);
}

.history-block {
  margin: 0.75em 0 1em;
  padding: 10px 12px;
  border-left: 3px solid var(--amber);
  background: rgba(0, 0, 0, 0.22);
  border-radius: 0 6px 6px 0;
}

.history-block .history-label {
  font-family: var(--font-display);
  font-size: 1.35rem;
  color: var(--amber);
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.history-block p {
  margin: 0 0 0.65em !important;
  font-size: 1rem;
  line-height: 1.5;
}

.history-block p:last-child {
  margin-bottom: 0 !important;
}

.history-block .history-short {
  margin-bottom: 0.35em !important;
}

.history-block .history-more {
  margin-top: 0.35em;
}

.history-block .history-more.hidden {
  display: none;
}

.history-toggle {
  display: inline-block;
  margin-top: 8px;
  padding: 4px 0;
  border: none;
  background: none;
  color: var(--amber);
  font-family: inherit;
  font-size: 0.95rem;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.history-toggle:hover {
  color: #ffe09a;
}

/* history may also appear on end screen */
.scroll-box .history-block {
  margin-top: 0.5em;
}

/* Death on the trail event */
.death-event {
  text-align: center;
}

.death-headstone {
  display: inline-block;
  margin: 0 auto 14px;
  padding: 14px 22px 16px;
  min-width: 180px;
  border: 2px solid var(--muted);
  border-radius: 50% 50% 8px 8px / 28% 28% 8px 8px;
  background: linear-gradient(180deg, #1a2218 0%, #0c120a 100%);
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.45);
}

.death-rip {
  font-family: var(--font-display);
  color: var(--muted);
  font-size: 1.1rem;
  letter-spacing: 0.2em;
}

.death-name {
  font-family: var(--font-display);
  color: var(--amber);
  font-size: 1.8rem;
  margin: 4px 0;
  text-shadow: 0 0 10px rgba(255, 200, 87, 0.25);
}

.death-dates,
.death-mile {
  color: var(--muted);
  font-size: 0.85rem;
}

.death-event .epitaph {
  font-style: italic;
  margin: 0.6em 0 0.8em;
}

.death-event .bad-line {
  color: var(--red);
}

.death-event p {
  text-align: left;
}

.fallen-list {
  margin: 0.8em 0;
  padding: 10px 12px;
  border-left: 3px solid var(--red);
  background: rgba(40, 0, 0, 0.25);
  border-radius: 0 6px 6px 0;
  text-align: left;
}

.fallen-list .history-label {
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--red);
  margin-bottom: 6px;
}

.fallen-list ul {
  margin: 0;
  padding-left: 1.1em;
  color: var(--muted);
  font-size: 0.9rem;
}

.fallen-list li {
  margin-bottom: 4px;
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 0 0 auto;
  padding: 12px 18px 14px;
  border-top: 2px solid var(--amber);
  background: #0a1408;
}

.modal-actions button {
  width: 100%;
  text-align: center;
  padding: 12px 14px;
  font-size: 1.05rem;
  cursor: pointer;
}

/* Hunt — top-down */
.hunt-carry-warn {
  border: 1px solid var(--amber);
  border-radius: 6px;
  background: rgba(80, 50, 0, 0.38);
  color: var(--amber);
  padding: 10px 12px;
  margin-bottom: 10px;
  font-size: 0.95rem;
  line-height: 1.35;
}

.hunt-carry-warn strong {
  color: #ffe09a;
}

.hunt-stats {
  display: flex;
  gap: 18px 24px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 10px;
  color: var(--muted);
}

.hunt-stats b {
  color: var(--amber);
  font-weight: 400;
}

.hunt-hint-inline {
  margin-left: auto;
  font-size: 0.88rem;
  color: var(--green-dim);
}

#hunt-meat-wrap.over-limit b {
  color: var(--red);
  animation: pulse-text 1.2s ease-in-out infinite;
}

.hunt-over-limit {
  color: var(--red);
  margin: 0 0 10px;
  font-size: 0.92rem;
}

.hunt-stage {
  position: relative;
  width: 100%;
  margin-bottom: 8px;
}

#hunt-canvas {
  display: block;
  width: 100%;
  height: auto;
  max-height: 560px;
  background: #2a4a1c;
  border: 2px solid var(--border);
  border-radius: 10px;
  cursor: crosshair;
  box-shadow:
    inset 0 0 50px rgba(0, 0, 0, 0.35),
    0 0 20px rgba(93, 255, 90, 0.08);
  touch-action: none;
}

.hunt-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-top: 8px;
  font-size: 0.9rem;
  color: var(--muted);
}

.hunt-howto {
  margin: 0.5em 0 0.9em;
  padding-left: 1.2em;
  color: var(--green);
}

.hunt-howto li {
  margin-bottom: 0.35em;
}

.hunt-howto strong {
  color: var(--amber);
}

/* River crossing mini-game */
.river-conditions {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(20, 40, 55, 0.45);
  padding: 10px 12px;
  margin-bottom: 10px;
}

.river-conditions.cond-calm {
  border-color: var(--green-dim);
  background: rgba(20, 50, 30, 0.4);
}

.river-conditions.cond-fair {
  border-color: var(--border);
}

.river-conditions.cond-rough {
  border-color: var(--amber);
  background: rgba(80, 50, 0, 0.35);
}

.river-conditions.cond-hazard,
.river-conditions.cond-peril {
  border-color: var(--red);
  background: rgba(80, 15, 15, 0.4);
}

.river-cond-title,
.river-cond-heading {
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--amber);
  margin-bottom: 6px;
  letter-spacing: 0.03em;
}

.river-cond-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  color: var(--muted);
  font-size: 0.98rem;
}

.river-cond-grid b {
  color: var(--green);
  font-weight: 400;
}

.river-cond-grid .cond-calm,
.river-cond-grid b.cond-calm {
  color: var(--green);
}

.river-cond-grid .cond-fair,
.river-cond-grid b.cond-fair {
  color: var(--amber);
}

.river-cond-grid .cond-rough,
.river-cond-grid b.cond-rough {
  color: #ffb347;
}

.river-cond-grid .cond-hazard,
.river-cond-grid b.cond-hazard,
.river-cond-grid .cond-peril,
.river-cond-grid b.cond-peril {
  color: var(--red);
}

.river-cond-effect {
  flex: 1 1 100%;
}

.river-cond-effect b {
  color: var(--amber);
}

/* Short conditions blurb inside river arrival modal */
.river-cond-summary {
  margin: 0 0 0.75em !important;
  padding: 8px 10px;
  border-left: 3px solid var(--amber);
  background: rgba(0, 0, 0, 0.28);
  border-radius: 0 6px 6px 0;
  line-height: 1.4;
  font-size: 0.95rem;
}

.river-cond-summary.cond-calm {
  border-left-color: var(--green);
}

.river-cond-summary.cond-rough {
  border-left-color: var(--amber);
}

.river-cond-summary.cond-hazard,
.river-cond-summary.cond-peril {
  border-left-color: var(--red);
}

.river-cond-summary strong {
  color: var(--amber);
  font-weight: 400;
}

.river-cond-summary.cond-calm strong {
  color: var(--green);
}

.river-cond-summary.cond-hazard strong,
.river-cond-summary.cond-peril strong {
  color: var(--red);
}

.river-stats {
  display: flex;
  gap: 18px 24px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 10px;
  color: var(--muted);
}

.river-stats b {
  color: var(--amber);
  font-weight: 400;
}

.river-status {
  color: var(--green);
}

.river-status.warn {
  color: var(--amber);
}

.river-status.bad {
  color: var(--red);
}

.river-stage {
  position: relative;
  width: 100%;
  margin-bottom: 8px;
}

#river-canvas {
  display: block;
  width: 100%;
  height: auto;
  max-height: 580px;
  background: #1a3a55;
  border: 2px solid var(--border);
  border-radius: 10px;
  cursor: default;
  box-shadow:
    inset 0 0 50px rgba(0, 0, 0, 0.35),
    0 0 20px rgba(93, 255, 90, 0.08);
  touch-action: none;
}

/* Fishing mini-game */
.fish-status {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(20, 40, 55, 0.45);
  color: var(--green);
  padding: 10px 12px;
  margin-bottom: 10px;
  font-size: 0.98rem;
  line-height: 1.35;
  min-height: 1.4em;
}

.fish-status.bite {
  border-color: var(--amber);
  background: rgba(80, 50, 0, 0.42);
  color: var(--amber);
  animation: pulse-text 0.55s ease-in-out infinite;
}

.fish-status.good {
  border-color: var(--green);
  color: var(--green);
}

.fish-status.bad {
  border-color: var(--red);
  color: var(--red);
}

.fish-bite-label {
  color: var(--amber);
  font-weight: 400;
}

.fish-bite-label.active {
  color: #ffc857;
  animation: pulse-text 0.5s ease-in-out infinite;
}

.fish-stage {
  position: relative;
  width: 100%;
  margin-bottom: 8px;
}

#fish-canvas {
  display: block;
  width: 100%;
  height: auto;
  max-height: 560px;
  background: #1a3a55;
  border: 2px solid var(--border);
  border-radius: 10px;
  cursor: crosshair;
  box-shadow:
    inset 0 0 50px rgba(0, 0, 0, 0.35),
    0 0 20px rgba(93, 255, 90, 0.08);
  touch-action: none;
}

.hidden {
  display: none !important;
}

/* Utility status colors */
.health-good { color: var(--green); }
.health-fair { color: var(--amber); }
.health-poor { color: #ff9f43; }
.health-very-poor { color: var(--red); }

::-webkit-scrollbar {
  width: 10px;
}
::-webkit-scrollbar-track {
  background: #061006;
}
::-webkit-scrollbar-thumb {
  background: var(--green-dark);
  border-radius: 4px;
}

/* Extra room on large monitors */
@media (min-width: 1500px) {
  html, body {
    font-size: 20px;
  }

  #crt {
    width: min(1400px, 94vw);
    min-height: min(920px, calc(100vh - 32px));
  }
}

@media (max-width: 700px) {
  html, body {
    font-size: 16px;
  }

  #app {
    padding: 18px 14px 16px;
  }

  h1 {
    font-size: 2.6rem;
  }

  h2 {
    font-size: 2rem;
  }
}
