@font-face {
  font-family: "Press Start";
  src: url("/fonts/PressStart2P-Regular.ttf") format("truetype");
  font-display: swap;
}

:root {
  --ink: #1d3557;
  --paper: #e8f4fb;
  --accent: #e63946;
  --snow: #f7fbff;
  --pine: #1b4332;
  --gold: #e9c46a;
  --leather: #6b2d3c;
  --page: #f6ecd4;
  --line: #14213d;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  min-height: 100vh;
  font-family: "Segoe UI", "Noto Sans", sans-serif;
  color: var(--line);
  background:
    radial-gradient(circle at 20% 10%, #fff 0 2px, transparent 3px) 0 0 / 48px 48px,
    radial-gradient(circle at 70% 40%, #fff 0 2px, transparent 3px) 0 0 / 64px 64px,
    linear-gradient(#b9dff3, var(--paper) 40%, #d8efe4);
  padding-bottom: 88px;
}
h1, h2, .logo-text, .brand {
  font-family: "Press Start", monospace;
  line-height: 1.5;
  letter-spacing: 0;
}
h1 { font-size: 16px; }
a { color: var(--ink); }
button, input, textarea, select { font: inherit; color: inherit; }
img { max-width: 100%; }

.top, .foot, .tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 8px;
  background: var(--ink);
  color: var(--snow);
}
.top a, .foot a, .tabs a, .top button { color: var(--snow); text-decoration: none; }
.brand { font-size: 12px; }
.mountain { font-family: "Press Start", monospace; font-size: 10px; color: var(--gold); }
.who { font-size: 14px; }
.spacer { flex: 1; }
.foot { justify-content: center; }
.tabs {
  position: sticky;
  bottom: 0;
  z-index: 5;
}
.tabs a { flex: 1; background: #16324f; }

button, .tap {
  min-height: 48px;
  min-width: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 14px;
  border: 3px solid var(--line);
  background: var(--snow);
  color: var(--line);
  text-decoration: none;
  box-shadow: 4px 4px 0 var(--line);
  cursor: pointer;
}
.tap.ghost, button.ghost { background: transparent; color: var(--snow); box-shadow: none; border-color: var(--snow); }
/* Header and footer links sit on the ink bar: snow text, no snow tile behind it (that made white-on-white boxes). */
.top a.tap, .foot a.tap { background: transparent; color: var(--snow); box-shadow: none; border-color: transparent; }
.top a.tap:focus-visible, .foot a.tap:focus-visible { border-color: var(--snow); }
.cta { background: var(--gold); font-weight: 700; }
.selected { background: var(--gold); }
main { padding: 16px; max-width: 880px; margin: 0 auto; }
.hero { text-align: center; padding: 12px 0 4px; }
.logo-text { font-size: 22px; margin: 8px 0; color: var(--ink); }
.tagline { font-size: 18px; max-width: 28ch; margin: 12px auto; }
.ink-stamp {
  width: 120px;
  height: 120px;
  margin: 8px auto;
  border: 6px solid var(--accent);
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--accent);
  font-family: "Press Start", monospace;
  transform: rotate(-8deg);
  background: rgba(255,255,255,.55);
  box-shadow: inset 0 0 0 4px rgba(230,57,70,.35);
}
.panel, .card {
  background: rgba(255,255,255,.82);
  border: 3px solid var(--line);
  padding: 12px;
  margin: 8px 0;
}
.stack { display: grid; gap: 8px; }
.stack label, .search { display: grid; gap: 4px; }
input, textarea, select {
  min-height: 48px;
  padding: 8px;
  border: 3px solid var(--line);
  background: #fff;
  width: 100%;
}
.inline { display: inline; }
.picker { list-style: none; padding: 0; display: grid; gap: 8px; }
.picker a.card { display: flex; }
.error { background: #ffd6d6; border: 3px solid var(--accent); padding: 8px; }

.book {
  display: flex;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  gap: 12px;
  padding-bottom: 12px;
}
.page {
  flex: 0 0 100%;
  min-width: 100%;
  scroll-snap-align: start;
  min-height: 70vh;
  border: 4px solid var(--line);
  padding: 16px;
}
.cover {
  background: var(--leather);
  color: var(--gold);
  text-align: center;
}
.cover h1, .cover a { color: var(--gold); }
.cover-logo { width: 160px; height: 160px; object-fit: contain; background: transparent; }
.sheet { background: var(--page); }
.spots { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.spot { min-height: 140px; text-align: center; }
.badge {
  width: 72px;
  height: 72px;
  margin: 0 auto;
  background: var(--snow);
  border: 3px solid var(--line);
}
.badge svg { width: 72px; height: 72px; image-rendering: pixelated; }
.spot.earned .badge { transform: rotate(var(--rot)); background: #fffdf6; }
.spot.empty .badge { opacity: .35; outline: 3px dashed #8d7a5a; outline-offset: 4px; }
.spot-title { font-weight: 700; margin: 6px 0; }
.faint { color: #8d7a5a; }
.earned-meta { font-size: 14px; }
.avatar { width: 64px; height: 64px; object-fit: cover; border: 3px solid var(--line); }
.avatar.xl { width: 128px; height: 128px; }
.crew { list-style: none; padding: 0; }
.crew-row { display: grid; gap: 8px; }
progress { width: 100%; height: 16px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.prose { font-size: 18px; line-height: 1.45; }
.prose img { image-rendering: auto; background: #fff; border: 3px solid var(--line); }

.level-map { position: relative; height: 520px; margin-top: 12px; }
.map-summit {
  position: absolute;
  inset: 0 10% 0 10%;
  background:
    linear-gradient(#fff, #fff) 50% 0 / 40% 18% no-repeat,
    linear-gradient(var(--pine), #2d6a4f) 50% 100% / 100% 88% no-repeat;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  border-bottom: 4px solid var(--line);
}
.trail { position: absolute; inset: 0; }
.flag {
  position: absolute;
  left: 18%;
  right: 18%;
  background: var(--snow);
}
.flag.filled { background: var(--gold); }
.rider-marker {
  position: absolute;
  left: 8%;
  width: 36px;
  height: 48px;
  background:
    linear-gradient(#f4a261, #f4a261) 0 0 / 100% 14px no-repeat,
    linear-gradient(var(--ink), var(--ink)) 8px 16px / 20px 14px no-repeat,
    linear-gradient(#e9c46a, #e9c46a) 0 32px / 36px 8px no-repeat;
  image-rendering: pixelated;
}

#sparkle[hidden] { display: none; }
#sparkle.is-sparkling {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 20;
  background-image:
    radial-gradient(circle, #fff 3px, transparent 4px),
    radial-gradient(circle, #fff 2px, transparent 3px),
    radial-gradient(circle, #e0f7ff 3px, transparent 4px);
  background-size: 80px 80px, 50px 50px, 110px 110px;
  animation: drift 1.1s linear;
}
@keyframes drift {
  from { background-position: 0 -40px, 20px -20px, 10px -60px; }
  to { background-position: 0 80px, 20px 70px, 10px 90px; }
}
.noscript-stamp { display: none; }
@media (prefers-reduced-motion: reduce) {
  #sparkle.is-sparkling { animation: none; }
}
@media (min-width: 800px) {
  .crew-row { grid-template-columns: 72px 1fr auto auto auto; align-items: center; }
  .logo-text { font-size: 28px; }
}
