/* Scratch Radar: ticket stock, security-ink navy, scratch latex. */
:root {
  --stock: #eef1f4;      /* page: cool ticket stock */
  --paper: #ffffff;
  --ink: #14213d;        /* security-ink navy */
  --ink-2: #46516b;      /* secondary text */
  --rule: #d5dae2;
  --latex: #b9c0c9;      /* scratch coating */
  --win: #0f7b4f;        /* prize green */
  --gone: #b3261e;
  --flash: #ffd23f;      /* ticket yellow, used for one thing at a time */
  --seq-1: #bfe3ce;
  --seq-2: #7cc49d;
  --seq-3: #2e8a5e;
  --seq-4: #0f5e3d;
  --display: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --text: 'Public Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --wrap: 1160px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--stock);
  color: var(--ink);
  font: 400 1.0625rem/1.55 var(--text);
  font-variant-numeric: tabular-nums;
}
img, svg, canvas { display: block; max-width: 100%; }
a { color: var(--ink); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--flash); outline-offset: 2px; box-shadow: 0 0 0 5px var(--ink); border-radius: 2px; }
h1, h2 { font-family: var(--display); font-weight: 800; line-height: 0.98; letter-spacing: -0.005em; margin: 0 0 0.4em; }
h1 { font-size: clamp(2.5rem, 5.4vw, 4.25rem); }
h2 { font-size: clamp(1.75rem, 3vw, 2.25rem); font-weight: 700; }
h3 { font-size: 1.0625rem; font-weight: 700; margin: 0 0 0.35em; }
p { margin: 0 0 1em; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 clamp(1rem, 4vw, 2rem); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: var(--flash); padding: 0.5rem 1rem; z-index: 10; }
.skip:focus { left: 0.5rem; }
.muted { color: var(--ink-2); }
.lede { font-size: 1.1875rem; max-width: 38em; color: var(--ink); }
.hint { font-size: 0.9375rem; color: var(--ink-2); max-width: 46em; margin-top: 0.75rem; }

/* Masthead */
.masthead { background: var(--ink); color: #fff; }
.masthead-row { display: flex; align-items: center; gap: 1.5rem; min-height: 64px; flex-wrap: wrap; padding-block: 0.5rem; }
.wordmark { display: flex; align-items: center; gap: 0.6rem; color: #fff; text-decoration: none; font: 800 1.75rem/1 var(--display); }
.wordmark-ticket { width: 36px; height: 26px; }
.wordmark-ticket path { fill: var(--flash); }
.wordmark-ticket rect { fill: var(--latex); }
.masthead-nav { display: flex; gap: 1.25rem; margin-left: auto; }
.masthead-nav a { color: #fff; text-decoration: none; font-weight: 600; font-size: 0.9375rem; }
.masthead-nav a:hover { text-decoration: underline; }
.state-jump { display: flex; gap: 0.4rem; }
.state-jump select { font: inherit; font-size: 0.9375rem; padding: 0.4rem 0.6rem; border-radius: 6px; border: 0; background: #fff; color: var(--ink); }
.state-jump-go { font: 600 0.9375rem var(--text); border: 1px solid #fff6; background: transparent; color: #fff; border-radius: 6px; padding: 0.4rem 0.7rem; cursor: pointer; }
.js .state-jump-go { display: none; }

/* Buttons */
.btn {
  display: inline-block; font: 700 1rem/1 var(--text); padding: 0.85rem 1.25rem; border-radius: 8px;
  background: var(--ink); color: #fff; border: 0; text-decoration: none; cursor: pointer;
}
.btn:hover { background: #0c1630; }
.link-btn { font: inherit; background: none; border: 0; padding: 0; color: inherit; text-decoration: underline; cursor: pointer; }

/* Hero */
.hero { padding: clamp(2.5rem, 6vw, 5rem) 0 clamp(2.5rem, 5vw, 4rem); }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: clamp(2rem, 5vw, 4.5rem); align-items: center; }
.hero h1 { max-width: 11em; }
.hero-stat { font-size: 1.0625rem; color: var(--ink-2); }
.hero-stat b { color: var(--ink); font: 800 1.5rem/1 var(--display); }
.hero-pick { margin-top: 1.75rem; }
.hero-pick label { display: block; font-weight: 700; margin-bottom: 0.4rem; }
.hero-pick-row { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.hero-pick select { font: inherit; padding: 0.75rem 0.9rem; border-radius: 8px; border: 1.5px solid var(--ink); background: var(--paper); min-width: 15rem; }

/* The ticket: navy stock, perforated top and bottom edges */
.ticket {
  --perf: radial-gradient(circle 5px at 50% 0, #0000 96%, #000) top / 14px 51% repeat-x,
          radial-gradient(circle 5px at 50% 100%, #0000 96%, #000) bottom / 14px 51% repeat-x;
  -webkit-mask: var(--perf); mask: var(--perf);
  background: var(--ink); color: #fff; padding: 1.6rem 1.5rem 1.4rem; border-radius: 6px;
  position: relative; max-width: 30rem; justify-self: end; width: 100%;
}
.ticket-kicker { font: 700 1.125rem/1.1 var(--display); color: var(--flash); margin-bottom: 0.9rem; }
.ticket-field { position: relative; background: var(--paper); color: var(--ink); border-radius: 6px; overflow: hidden; }
.ticket-reveal { padding: 1.1rem 1.2rem 1.2rem; }
.ticket-price { font: 800 1rem/1 var(--display); color: var(--win); margin: 0 0 0.35rem; }
.ticket-name { font: 800 clamp(1.75rem, 3.2vw, 2.4rem)/1 var(--display); margin: 0 0 0.3rem; }
.ticket-name a { text-decoration: none; }
.ticket-name a:hover { text-decoration: underline; }
.ticket-state { font-size: 0.875rem; color: var(--ink-2); margin-bottom: 0.9rem; }
.ticket-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; margin-bottom: 0.9rem; padding-top: 0.75rem; border-top: 1px dashed var(--rule); }
.fact-label { display: block; font-size: 0.8125rem; color: var(--ink-2); }
.fact-value { font: 800 1.6rem/1.1 var(--display); }
.ticket-latex { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; touch-action: none; transition: opacity 0.5s ease; }
.ticket-latex.is-off { opacity: 0; pointer-events: none; }
.ticket-foot { display: flex; gap: 0.35rem; align-items: baseline; margin-top: 0.8rem; font-size: 0.875rem; color: #c9d0dc; }
.ticket-foot p { margin: 0; }
.ticket-empty .ticket-name { color: #fff; }
.ticket-fine { font-size: 0.875rem; color: #c9d0dc; }
.ticket-stub { justify-self: start; max-width: 26rem; }
.ticket-stub .ticket-price { color: var(--flash); }
.ticket-stub .ticket-state { color: #c9d0dc; }
.ticket-stub .ticket-name { color: #fff; }
.ticket-top { margin: 0; padding-top: 0.75rem; border-top: 1px dashed #ffffff40; }
.ticket-stub .fact-label { color: #c9d0dc; }

/* Meters */
.meter { display: inline-flex; align-items: center; gap: 0.6rem; white-space: nowrap; }
.pips { display: inline-flex; gap: 3px; }
.pip { width: 8px; height: 16px; border-radius: 2px; background: #c9cfd8; }
.pip.on { background: var(--win); }
.bar { display: inline-block; width: 92px; height: 10px; border-radius: 5px; background: #d9dee5; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--win); border-radius: 5px; }
.meter-num { font-size: 0.9375rem; color: var(--ink-2); }
.meter-num b { color: var(--ink); }

.verdict { display: inline-flex; gap: 0.4rem; align-items: baseline; font-weight: 700; font-size: 0.9375rem; }
.verdict-good span { color: var(--win); }
.verdict-poor span, .verdict-gone span { color: var(--gone); }
.verdict-even span { color: var(--ink-2); }

.ratio { display: inline-block; font-weight: 700; padding: 0.1rem 0.45rem; border-radius: 4px; }
.ratio-good { background: #dcefe4; }
.ratio-even { background: #e6e9ee; }
.ratio-poor { background: #f6dedc; }

/* Sections */
.section { padding: clamp(2.5rem, 5vw, 4rem) 0; }
.section-tint { background: var(--paper); border-block: 1px solid var(--rule); }
.section-head { max-width: 46em; margin-bottom: 1.5rem; }
.section-head p { color: var(--ink-2); }
.page-head { padding: clamp(2rem, 4vw, 3rem) 0 1.5rem; }
.crumbs { font-size: 0.875rem; color: var(--ink-2); margin-bottom: 1rem; }
.crumbs a { color: var(--ink-2); }
.source-line { font-size: 0.9375rem; color: var(--ink-2); }
.stale { color: var(--gone); }
.empty { background: var(--paper); border: 1.5px dashed var(--latex); border-radius: 8px; padding: 1.5rem; max-width: 40em; }

/* Tile map */
.tilemap-fig { margin: 0; }
.tilemap { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); grid-template-rows: repeat(8, auto); gap: 4px; max-width: 760px; }
.tile {
  aspect-ratio: 1; border-radius: 6px; display: flex; flex-direction: column; justify-content: center; align-items: center;
  text-decoration: none; color: var(--ink); line-height: 1; transition: transform 0.12s ease;
}
.tile:hover { transform: translateY(-2px); }
.tile-code { font: 800 clamp(0.75rem, 1.6vw, 1.125rem)/1 var(--display); }
.tile-val { font-size: clamp(0.5625rem, 1vw, 0.75rem); margin-top: 2px; }
.tile-s1 { background: var(--seq-1); }
.tile-s2 { background: var(--seq-2); }
.tile-s3 { background: var(--seq-3); color: #fff; }
.tile-s4 { background: var(--seq-4); color: #fff; }
.tile-wait { background: var(--paper); box-shadow: inset 0 0 0 1.5px var(--latex); }
.tile-counts { background: var(--paper); box-shadow: inset 0 0 0 2px var(--ink); }
.tile-none { background: repeating-linear-gradient(135deg, #0000 0 4px, #d5dae2 4px 5px); color: var(--ink-2); }
.legend { display: flex; flex-wrap: wrap; gap: 0.5rem 1.1rem; align-items: center; margin-top: 1rem; font-size: 0.875rem; color: var(--ink-2); }
.legend-title { font-weight: 700; color: var(--ink); width: 100%; }
.legend-item { display: inline-flex; align-items: center; gap: 0.35rem; }
.legend i { width: 14px; height: 14px; border-radius: 3px; display: inline-block; }

/* Tables */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.games { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
.games th { text-align: left; font-weight: 700; font-size: 0.8125rem; color: var(--ink-2); padding: 0.6rem 0.75rem; border-bottom: 2px solid var(--ink); white-space: nowrap; }
.games td { padding: 0.7rem 0.75rem; border-bottom: 1px solid var(--rule); vertical-align: middle; }
.games .num { text-align: right; }
table.tiers { max-width: 760px; }
.games .prize { font: 700 1.125rem/1 var(--display); }
.games tr.is-gone td { color: var(--ink-2); }
.games tr.is-gone .game-link { color: var(--ink-2); }
.games tbody tr:hover { background: #f5f7fa; }
.game-link { font-weight: 700; text-decoration: none; }
.game-link:hover { text-decoration: underline; }
.game-no { display: block; font-size: 0.8125rem; color: var(--ink-2); }
.sort-btn { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; display: inline-flex; gap: 0.25rem; align-items: center; }
.sort-btn::after { content: '↕'; opacity: 0.4; font-size: 0.75rem; }
th[aria-sort='ascending'] .sort-btn::after { content: '↑'; opacity: 1; }
th[aria-sort='descending'] .sort-btn::after { content: '↓'; opacity: 1; }
.price-filter { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 1rem; }
.chip { font: 600 0.875rem var(--text); padding: 0.4rem 0.8rem; border-radius: 999px; border: 1.5px solid var(--rule); background: var(--paper); color: var(--ink); cursor: pointer; }
.chip[aria-pressed='true'] { background: var(--ink); border-color: var(--ink); color: #fff; }

/* Best-at-each-price stubs */
.stubs { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.stub {
  display: flex; flex-direction: column; gap: 0.45rem; padding: 1rem 1.1rem 1.1rem; background: var(--paper); text-decoration: none;
  border-radius: 8px; border-left: 6px solid var(--ink);
}
.stub:hover .stub-name { text-decoration: underline; }
.stub-price { font: 800 1.75rem/1 var(--display); color: var(--win); }
.stub-name { font-weight: 700; }
.stub-prize { font-size: 0.875rem; color: var(--ink-2); }

/* Game page */
.game-head { display: grid; grid-template-columns: minmax(0, 26rem) minmax(0, 1fr); gap: 2rem; align-items: center; }
.game-verdict { display: flex; flex-direction: column; gap: 0.75rem; align-items: flex-start; }
.game-verdict .verdict { font-size: 1.25rem; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 1px; background: var(--rule); border: 1px solid var(--rule); border-radius: 8px; overflow: hidden; margin: 0; }
.facts div { background: var(--paper); padding: 1rem 1.1rem; }
.facts dt { font-size: 0.8125rem; color: var(--ink-2); }
.facts dd { margin: 0.2rem 0 0; font: 800 1.75rem/1.1 var(--display); }

/* Chart */
.chart { margin: 0; position: relative; max-width: 760px; }
.chart .grid { stroke: var(--rule); stroke-width: 1; }
.chart .axis { fill: var(--ink-2); font: 12px var(--text); }
.chart .line { fill: none; stroke: var(--win); stroke-width: 2; }
.chart .hit rect { fill: transparent; }
.chart .hit circle { fill: var(--win); stroke: var(--paper); stroke-width: 2; opacity: 0; }
.chart .hit:hover circle, .chart .hit:focus circle { opacity: 1; }
.chart .hit:focus { outline: none; }
.tip { position: absolute; pointer-events: none; background: var(--ink); color: #fff; font-size: 0.8125rem; padding: 0.35rem 0.55rem; border-radius: 4px; transform: translate(-50%, -120%); white-space: nowrap; }
.chart-table { margin-top: 1rem; font-size: 0.9375rem; }
.chart-table summary { cursor: pointer; color: var(--ink-2); }

/* Explainer & prose */
.explain-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2rem; }
.explain-grid p { color: var(--ink-2); }
.prose { max-width: 44rem; padding-block: clamp(2rem, 4vw, 3rem); }
.prose h2 { margin-top: 1.5em; }
.prose li { margin-bottom: 0.4em; }

/* Footer */
.footer { background: var(--ink); color: #c9d0dc; font-size: 0.875rem; padding: 2.5rem 0; margin-top: 0; }
.footer a { color: #fff; }
.footer-grid { display: grid; grid-template-columns: 1fr 1.6fr auto; gap: 2rem; }
.footer-brand { font: 800 1.375rem/1 var(--display); color: #fff; }
.footer nav { display: flex; flex-direction: column; gap: 0.5rem; }

@media (max-width: 860px) {
  .hero-grid, .game-head { grid-template-columns: 1fr; }
  .ticket { justify-self: stretch; max-width: none; }
  .explain-grid { grid-template-columns: 1fr; gap: 1rem; }
  .footer-grid { grid-template-columns: 1fr; }
  .masthead-nav { order: 3; width: 100%; margin-left: 0; overflow-x: auto; }
  .state-jump { margin-left: auto; }
}
@media (max-width: 520px) {
  .tilemap { gap: 2px; }
  .tile-val { display: none; }
  .hero-pick select { min-width: 0; flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
@media (forced-colors: active) {
  .tile, .pip, .bar-fill, .legend i { forced-color-adjust: none; }
}
