/* ---- Tokens: sharp black + worn-out yellow ---- */
:root {
  --black: #0a0a09;
  --panel: #17150f;
  --panel-line: #2c2818;
  --yellow: #c9a227;   /* worn hazard yellow — primary accent */
  --yellow-dim: #8a7220; /* for borders / quiet accents */
  --yellow-pale: #e4d9a8; /* rare, for stamped highlights only */
  --rust: #a83c2e;      /* danger/survival stat — not a "happy" red */
  --bone: #c7c2b0;      /* body text on black */

  --font-display: 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
  --font-mono: 'IBM Plex Mono', 'Courier New', monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--black);
  color: var(--bone);
  font-family: var(--font-mono);
  line-height: 1.5;
}

/* ---- Header ---- */
.site-header {
  text-align: center;
  padding: 4rem 1.5rem 2rem;
  border-bottom: 3px solid var(--yellow);
  background-image: repeating-linear-gradient(
    -45deg,
    var(--black) 0 14px,
    #100f0b 14px 28px
  );
}

.site-header h1 {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 6vw, 3.6rem);
  letter-spacing: 0.02em;
  margin: 0;
  color: var(--yellow);
}

.subtitle {
  color: var(--bone);
  font-size: 0.95rem;
  margin-top: 0.6rem;
  opacity: 0.8;
}

.credit {
  font-family: 'Great Vibes', cursive;
  font-size: 1.8rem;
  color: var(--yellow-dim);
  margin-top: 0.75rem;
  opacity: 0.85;
  transform: rotate(-2deg);
}

main {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
}

h2 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--yellow);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-bottom: 1px solid var(--panel-line);
  padding-bottom: 0.5rem;
  margin-top: 2.5rem;
}

/* ---- World map ---- */
.world-map {
  width: 100%;
  height: auto;
  margin-top: 1rem;
}

.map-region {
  fill: #2b271c; /* lighter than the page background on purpose — needs to actually be visible */
  stroke: var(--yellow-dim);
  stroke-width: 0.5;
  cursor: pointer;
  transition: fill 0.15s ease;
}

.map-region.region-hover {
  fill: var(--yellow);
}

.world-map {
  background: rgba(255,255,255,0.02); /* faint panel so the "ocean" reads as a shape too */
  border: 1px solid var(--panel-line);
  transition: filter 0.2s ease;
}

/* While a result is on screen the map is frozen — no hover glow, no
   clicks (enforced in JS). This dims it so it visibly reads as "not
   your turn" rather than just quietly failing to respond. */
.world-map.map-locked {
  filter: grayscale(0.6) brightness(0.7);
}

.world-map.map-locked .map-region {
  cursor: default;
}

.map-label {
  fill: var(--bone);
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.05em;
  text-anchor: middle;
  pointer-events: none; /* clicks pass through to the shape underneath */
  transition: fill 0.15s ease;
}

/* text sits right after its path in the markup, so this catches the hover */
.map-region:hover + .map-label {
  fill: var(--black);
  font-weight: bold;
}

/* ---- Result card ---- */
#result-card.hidden { display: none; }

.case-file {
  background: var(--panel);
  color: var(--bone);
  margin-top: 2rem;
  padding: 2rem;
  border: 1px solid var(--panel-line);
  border-top: 4px solid var(--yellow);
  box-shadow: 0 12px 30px rgba(0,0,0,0.6);
}

.case-label {
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  color: var(--rust);
  margin: 0 0 0.5rem;
}

#result-year {
  font-family: var(--font-display);
  font-size: 1.8rem;
  margin: 0 0 0.75rem;
  color: var(--yellow-pale);
}

#result-summary {
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
  opacity: 0.85;
}

/* Blinking caret shown on whichever prose field is currently
   typewriter-ing itself out (result-summary or stat-life). */
.typing::after {
  content: "▌";
  margin-left: 1px;
  color: var(--yellow);
  animation: caret-blink 0.8s step-start infinite;
}

@keyframes caret-blink {
  50% { opacity: 0; }
}

.stat-list { margin: 0; }

.stat-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 0;
  border-top: 1px dashed var(--panel-line);
}

.stat-row dt { color: #857b5e; font-size: 0.85rem; }
.stat-row dd { margin: 0; font-weight: bold; text-align: right; color: var(--bone); }
.stat-row dd.danger { color: var(--rust); }

#spin-again {
  margin-top: 1.5rem;
  background: var(--yellow);
  color: var(--black);
  border: none;
  padding: 0.7rem 1.2rem;
  font-family: var(--font-mono);
  font-weight: bold;
  cursor: pointer;
}

#spin-again:hover { background: var(--yellow-pale); }

/* ---- Motion (respect reduced-motion preference) ---- */
@media (prefers-reduced-motion: no-preference) {
  .case-file { animation: stamp-in 0.25s ease-out; }
}

@keyframes stamp-in {
  from { opacity: 0; transform: translateY(6px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
