/* ---------- tokens ---------- */
:root {
  --bg: #f6f1e7;            /* exam-paper cream */
  --bg-2: #fffdf8;
  --ink: #1b1a17;
  --ink-2: #5b574d;
  --line: #e2d9c8;
  --red: #c8102e;
  --red-bg: #fbe9ec;
  --amber: #b45309;
  --amber-bg: #fdf1dc;
  --green: #15803d;
  --green-bg: #e6f4ea;
  --blue: #1d4ed8;
  --blue-bg: #e6ecfb;
  --purple: #6d28d9;
  --purple-bg: #efe9fb;
  --gold: #a16207;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 8px 24px rgba(40,30,10,.08);
  --radius: 14px;
  --font-head: "Bebas Neue", Impact, sans-serif;
  --font-body: "DM Sans", system-ui, -apple-system, sans-serif;
  --font-dev: "Baloo 2", var(--font-body);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15140f; --bg-2: #1e1c15; --ink: #f3eee2; --ink-2: #b7b09e; --line: #2f2c22;
    --red: #ff4d63; --red-bg: #3a1218; --amber: #f5a524; --amber-bg: #3a2a0f;
    --green: #3ddc84; --green-bg: #0f2e1c; --blue: #7aa2ff; --blue-bg: #14204a;
    --purple: #b794f6; --purple-bg: #261a45; --gold: #f2c14e;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
  }
}
:root[data-theme="dark"] {
  --bg: #15140f; --bg-2: #1e1c15; --ink: #f3eee2; --ink-2: #b7b09e; --line: #2f2c22;
  --red: #ff4d63; --red-bg: #3a1218; --amber: #f5a524; --amber-bg: #3a2a0f;
  --green: #3ddc84; --green-bg: #0f2e1c; --blue: #7aa2ff; --blue-bg: #14204a;
  --purple: #b794f6; --purple-bg: #261a45; --gold: #f2c14e;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font-body); line-height: 1.5; -webkit-font-smoothing: antialiased;
  background-image: radial-gradient(rgba(0,0,0,.035) 1px, transparent 1px);
  background-size: 18px 18px;
}
a { color: inherit; }
h1, h2, h3 { font-family: var(--font-head); font-weight: 400; letter-spacing: .02em; margin: 0; }
h2 { font-size: clamp(30px, 4vw, 44px); line-height: 1; }
main { max-width: 1180px; margin: 0 auto; padding: 0 16px 60px; }
section { margin-top: 56px; }
.section-lede { color: var(--ink-2); margin: 6px 0 18px; max-width: 60ch; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; border: 1.5px solid var(--ink);
  background: var(--bg-2); color: var(--ink); padding: 10px 16px; border-radius: 10px;
  font: 600 14px/1 var(--font-body); cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: transform .08s ease, box-shadow .12s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--ink); color: var(--bg); }
.btn-ghost { border-color: var(--line); }
.dev { font-family: var(--font-dev); }

/* ---------- hero ---------- */
.hero { padding: 48px 16px 28px; border-bottom: 3px double var(--line); position: relative; }
.hero-inner { max-width: 820px; margin: 0 auto; text-align: center; position: relative; }
.theme-toggle {
  position: absolute; right: 0; top: -20px; background: none; border: 1.5px solid var(--line);
  color: var(--ink); border-radius: 999px; width: 36px; height: 36px; cursor: pointer; font-size: 18px;
}
.kicker { text-transform: uppercase; letter-spacing: .18em; font-size: 12px; color: var(--ink-2); margin: 0 0 6px; }
.kicker .dev { text-transform: none; letter-spacing: 0; font-size: 15px; color: var(--red); }
.title { font-size: clamp(64px, 13vw, 132px); line-height: .9; margin: 0; }
.stamp-inline {
  display: inline-block; color: var(--red); border: .06em solid var(--red); border-radius: .08em;
  padding: 0 .12em; transform: rotate(-4deg); position: relative; top: -.03em;
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='300' height='300'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 -1.4 1.6'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='300' height='300'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 -1.4 1.6'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
.tagline { font-family: var(--font-head); font-size: clamp(22px, 3.4vw, 32px); margin: 8px 0 12px; letter-spacing: .04em; }
.lede { color: var(--ink-2); max-width: 64ch; margin: 0 auto 24px; font-size: 16px; }

.search {
  display: flex; align-items: center; gap: 8px; background: var(--bg-2); border: 2px solid var(--ink);
  border-radius: 14px; padding: 6px 6px 6px 14px; box-shadow: var(--shadow); max-width: 640px; margin: 0 auto;
}
.search-icon { font-size: 18px; }
.search input {
  flex: 1; min-width: 0; border: 0; background: transparent; color: var(--ink);
  font: 500 17px var(--font-body); outline: none; padding: 10px 0;
}
.search-verdict { margin: 16px auto 0; max-width: 640px; text-align: left; }
.verdict {
  display: flex; gap: 14px; align-items: center; padding: 14px 16px; border-radius: var(--radius);
  background: var(--bg-2); border: 1.5px solid var(--line); box-shadow: var(--shadow);
  animation: pop .25s cubic-bezier(.2,1.4,.4,1);
}
.verdict .stamp { flex-shrink: 0; }
.verdict-text strong { display: block; font-size: 16px; }
.verdict-text span { color: var(--ink-2); font-size: 14px; }
.verdict .btn { margin-left: auto; }
.verdict-list .verdict { margin-bottom: 8px; cursor: pointer; }
.verdict-list .verdict:hover { border-color: var(--ink); }
@keyframes pop { from { transform: scale(.96); opacity: 0 } to { transform: none; opacity: 1 } }

/* ---------- ticker ---------- */
.ticker { overflow: hidden; background: var(--ink); color: var(--bg); font-family: var(--font-head); font-size: 18px; letter-spacing: .04em; white-space: nowrap; }
.ticker-track { display: inline-block; padding: 8px 0; animation: ticker 90s linear infinite; }
.ticker-track span { margin: 0 24px; }
.ticker-track .t-sealed { color: #ff6b7f; } .ticker-track .t-redeemed { color: #6ee7a0; } .ticker-track .t-notice { color: #fbbf24; } .ticker-track .t-court { color: #93b4ff; }
@keyframes ticker { from { transform: translateX(0) } to { transform: translateX(-50%) } }
.ticker:hover .ticker-track { animation-play-state: paused; }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin-top: 28px; }
.stat { background: var(--bg-2); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 16px 14px; text-align: center; }
.stat-num { font-family: var(--font-head); font-size: clamp(34px, 4vw, 48px); line-height: 1; }
.stat-label { color: var(--ink-2); font-size: 13px; margin-top: 4px; }
.stat-red .stat-num { color: var(--red); } .stat-amber .stat-num { color: var(--amber); } .stat-green .stat-num { color: var(--green); }
@media (max-width: 900px) { .stats { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 520px) { .stats { grid-template-columns: repeat(2, 1fr); } }

/* ---------- board ---------- */
.board-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.count { font-family: var(--font-body); font-size: 14px; color: var(--ink-2); letter-spacing: 0; margin-left: 6px; }
.view-toggle { display: inline-flex; border: 1.5px solid var(--ink); border-radius: 10px; overflow: hidden; }
.vt { background: var(--bg-2); border: 0; color: var(--ink); padding: 8px 16px; font: 600 14px var(--font-body); cursor: pointer; }
.vt.active { background: var(--ink); color: var(--bg); }
.filters { margin: 16px 0 18px; display: flex; flex-direction: column; gap: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1.5px solid var(--line); background: var(--bg-2); color: var(--ink); border-radius: 999px;
  padding: 7px 14px; font: 600 13px var(--font-body); cursor: pointer;
}
.chip.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip-sealed.active { background: var(--red); border-color: var(--red); color: #fff; }
.chip-notice.active { background: var(--amber); border-color: var(--amber); color: #fff; }
.chip-redeemed.active { background: var(--green); border-color: var(--green); color: #fff; }
.chip-court.active { background: var(--blue); border-color: var(--blue); color: #fff; }
.chip-contested.active { background: var(--purple); border-color: var(--purple); color: #fff; }
.chip-iconic.active { background: var(--gold); border-color: var(--gold); color: #fff; }
.selects { display: flex; flex-wrap: wrap; gap: 8px; }
select {
  border: 1.5px solid var(--line); background: var(--bg-2); color: var(--ink); border-radius: 10px;
  padding: 8px 12px; font: 500 14px var(--font-body); max-width: 100%;
}

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.card {
  position: relative; background: var(--bg-2); border: 1.5px solid var(--line); border-radius: var(--radius);
  padding: 18px 16px 14px; box-shadow: var(--shadow); cursor: pointer; overflow: hidden;
  transition: transform .12s ease, border-color .12s ease; display: flex; flex-direction: column; gap: 8px;
  animation: rise .3s ease both;
}
.card:hover { transform: translateY(-3px); border-color: var(--ink); }
@keyframes rise { from { opacity: 0; transform: translateY(8px) } to { opacity: 1; transform: none } }
.card .stamp { position: absolute; top: 12px; right: 12px; }
.card-type { font-size: 12px; text-transform: uppercase; letter-spacing: .12em; color: var(--ink-2); }
.card-name { font-family: var(--font-head); font-size: 26px; line-height: 1; padding-right: 96px; }
.card-name .star { color: var(--gold); font-size: 18px; vertical-align: top; }
.card-area { color: var(--ink-2); font-size: 14px; }
.card-blurb { font-size: 14px; margin: 2px 0 0; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 6px; }
.tag { font-size: 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 2px 7px; }
.card-foot { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--ink-2); border-top: 1px dashed var(--line); padding-top: 8px; }
.empty { grid-column: 1/-1; text-align: center; padding: 40px; color: var(--ink-2); }

/* ---------- stamp ---------- */
.stamp {
  display: inline-block; font-family: var(--font-head); font-size: 22px; line-height: 1; letter-spacing: .06em;
  padding: 4px 8px 3px; border: 3px solid currentColor; border-radius: 6px; transform: rotate(-8deg);
  text-transform: uppercase; user-select: none; white-space: nowrap;
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='1.1' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 -1.2 1.5'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='1.1' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 -1.2 1.5'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
.stamp-lg { font-size: 34px; border-width: 4px; padding: 6px 12px 4px; }
.stamp-sealed { color: var(--red); } .stamp-notice { color: var(--amber); } .stamp-redeemed { color: var(--green); }
.stamp-court { color: var(--blue); } .stamp-contested { color: var(--purple); } .stamp-passed { color: var(--green); } .stamp-unknown { color: var(--ink-2); }
.card.slam .stamp { animation: slam .35s cubic-bezier(.2,1.6,.4,1) both; }
@keyframes slam { 0% { transform: rotate(-8deg) scale(2.4); opacity: 0 } 60% { transform: rotate(-8deg) scale(.92); opacity: 1 } 100% { transform: rotate(-8deg) scale(1) } }

/* ---------- map ---------- */
.map-wrap { border: 1.5px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--bg-2); }
#map { height: 70vh; min-height: 420px; }
.map-dark .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.9) contrast(.9) saturate(.6); }
.map-note { margin: 0; padding: 8px 12px; font-size: 12px; color: var(--ink-2); border-top: 1px solid var(--line); }
.pin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 2px rgba(0,0,0,.25); }
.pin-sealed { background: var(--red); } .pin-notice { background: var(--amber); } .pin-redeemed { background: var(--green); }
.pin-court { background: var(--blue); } .pin-contested { background: var(--purple); } .pin-passed { background: var(--green); }
.pin-iconic { width: 18px; height: 18px; box-shadow: 0 0 0 3px var(--gold); }
.leaflet-popup-content-wrapper { background: var(--bg-2); color: var(--ink); border-radius: 12px; font-family: var(--font-body); }
.leaflet-popup-tip { background: var(--bg-2); }
.leaflet-popup-content { margin: 12px 14px; }
.popup-name { font-family: var(--font-head); font-size: 20px; line-height: 1; margin-bottom: 4px; }
.popup-area { color: var(--ink-2); font-size: 13px; margin-bottom: 8px; }
.popup .stamp { font-size: 16px; border-width: 2px; margin-bottom: 8px; }
.popup .btn { padding: 6px 10px; font-size: 12px; margin-right: 6px; }

/* ---------- bars ---------- */
.bars { display: flex; flex-direction: column; gap: 8px; }
.bar { display: grid; grid-template-columns: 150px 1fr 48px; align-items: center; gap: 10px; font-size: 14px; }
.bar-label { text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { height: 22px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--red); width: 0; transition: width .8s cubic-bezier(.2,.8,.2,1); }
.bar-amber .bar-fill { background: var(--amber); }
.bar-num { font-family: var(--font-head); font-size: 20px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; }
@media (max-width: 820px) { .two-col { grid-template-columns: 1fr; } .bar { grid-template-columns: 110px 1fr 44px; } }

/* ---------- timeline ---------- */
.tl { list-style: none; padding: 0; margin: 20px 0 0; border-left: 3px solid var(--line); }
.tl li { position: relative; padding: 0 0 22px 24px; }
.tl li::before { content: ""; position: absolute; left: -9px; top: 6px; width: 14px; height: 14px; border-radius: 50%; background: var(--red); border: 3px solid var(--bg); }
.tl-date { font-size: 12px; text-transform: uppercase; letter-spacing: .12em; color: var(--ink-2); }
.tl-title { font-family: var(--font-head); font-size: 24px; line-height: 1.05; margin: 2px 0 4px; }
.tl-text { margin: 0; color: var(--ink-2); font-size: 15px; max-width: 70ch; }

/* ---------- about / tip / footer ---------- */
.about-card { display: grid; grid-template-columns: 180px 1fr; gap: 24px; background: var(--bg-2); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 24px; align-items: start; }
.about-stamp { display: grid; place-items: center; height: 100%; }
.about-stamp .stamp { font-size: 40px; border-width: 5px; padding: 8px 14px 6px; }
.about p { margin: 10px 0 0; }
.quote { font-style: italic; color: var(--ink-2); }
@media (max-width: 700px) { .about-card { grid-template-columns: 1fr; } .about-stamp .stamp { transform: rotate(-4deg); } }
.tip { text-align: center; background: var(--ink); color: var(--bg); border-radius: var(--radius); padding: 36px 20px; }
.tip p { color: inherit; opacity: .8; margin: 6px 0 18px; }
.tip .btn-primary { background: var(--bg); color: var(--ink); border-color: var(--bg); }
.footer { border-top: 3px double var(--line); padding: 28px 16px 40px; max-width: 1180px; margin: 0 auto; font-size: 13px; color: var(--ink-2); }
.footer-small { font-size: 12px; }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 16px; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(20,15,5,.55); backdrop-filter: blur(2px); }
.modal-card {
  position: relative; width: min(680px, 100%); max-height: 90vh; overflow: auto; background: var(--bg-2);
  border: 2px solid var(--ink); border-radius: 18px; padding: 28px 24px 22px; box-shadow: 0 30px 80px rgba(0,0,0,.35);
  animation: pop .22s cubic-bezier(.2,1.4,.4,1);
}
.modal-close { position: absolute; top: 10px; right: 12px; background: none; border: 0; font-size: 30px; line-height: 1; cursor: pointer; color: var(--ink-2); }
.m-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding-right: 20px; }
.m-title { font-family: var(--font-head); font-size: clamp(30px, 5vw, 44px); line-height: .95; }
.m-sub { color: var(--ink-2); margin-top: 4px; }
.m-blurb { margin: 14px 0 0; font-size: 16px; }
.m-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 0; }
.m-section { margin-top: 20px; }
.m-section h3 { font-size: 20px; margin-bottom: 8px; }
.m-tl { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--line); }
.m-tl li { position: relative; padding: 0 0 12px 16px; font-size: 14px; }
.m-tl li::before { content: ""; position: absolute; left: -6px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--ink-2); }
.m-tl .d { font-weight: 700; margin-right: 6px; }
.m-tl a { color: var(--blue); font-size: 13px; }
.m-disclaimer { margin-top: 18px; font-size: 12px; color: var(--ink-2); border-top: 1px dashed var(--line); padding-top: 10px; }
body.modal-open { overflow: hidden; }

@media (max-width: 600px) {
  .hero { padding-top: 36px; }
  .search { border-radius: 12px; }
  .search .btn { padding: 10px 12px; }
  .card-name { font-size: 24px; }
}
