/* FMV Index — 1990s Sega CD look.
   Palette: black #0C0C12, panel #161624, line #2A2A40, Sega blue #1E5BFF, cyan #3AE0FF, red #FF2A3C, yellow #FFD23F, grey #9AA0B4, white #F4F4F8 */
:root {
  --bg: #0C0C12;
  --panel: #161624;
  --panel-2: #1D1D30;
  --line: #2A2A40;
  --ink: #F4F4F8;
  --ink-dim: #9AA0B4;
  --blue: #1E5BFF;
  --cyan: #3AE0FF;
  --red: #FF2A3C;
  --yellow: #FFD23F;
  --pixel: "Press Start 2P", "Courier New", monospace;
  --ui: "Chakra Petch", "Segoe UI", sans-serif;
  --gutter: clamp(16px, 4vw, 48px);
  --dither: repeating-conic-gradient(rgba(255,255,255,.07) 0 25%, transparent 0 50%) 0 0 / 4px 4px;
}
* { box-sizing: border-box; }
html { color-scheme: dark; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--ui); font-size: 16px; line-height: 1.5;
  background-image:
    linear-gradient(90deg, rgba(30,91,255,.06) 1px, transparent 1px),
    linear-gradient(rgba(30,91,255,.06) 1px, transparent 1px);
  background-size: 32px 32px;
}
/* CRT scanlines over everything, very faint, never on text contrast */
body::after {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 50;
  background: repeating-linear-gradient(180deg, rgba(0,0,0,0) 0 2px, rgba(0,0,0,.18) 2px 3px);
  mix-blend-mode: multiply;
}
a { color: var(--cyan); }
button, input, select, textarea { font: inherit; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }

/* ---------- Hero: a box-front. Disc on the right spins; title is pixel type with a dithered fill. ---------- */
.hero {
  position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 32px; align-items: center;
  padding: clamp(28px, 6vw, 72px) var(--gutter) 32px;
  border-bottom: 4px solid var(--blue);
  background:
    linear-gradient(180deg, #11112A 0%, var(--bg) 70%),
    var(--dither);
}
.hero::before { /* the blue "stripe" Sega CD boxes carried down the side */
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 14px;
  background: repeating-linear-gradient(180deg, var(--blue) 0 10px, #0F3FB8 10px 20px);
}
.hero-kicker {
  margin: 0 0 14px; max-width: 70ch; font-family: var(--pixel); font-size: 10px; line-height: 1.9; color: var(--cyan);
}
.hero-title {
  margin: 0; font-family: var(--pixel); font-weight: 400; line-height: 1.15;
  font-size: clamp(26px, 5.6vw, 64px); letter-spacing: -.02em;
  color: var(--ink);
  text-shadow: 4px 4px 0 var(--blue), 8px 8px 0 #0A1D5C;
}
.hero-lede { max-width: 60ch; margin: 24px 0 0; font-size: 17px; color: var(--ink-dim); }
.hero-lede span { color: var(--yellow); font-weight: 600; }
.hero-disc { width: clamp(140px, 22vw, 260px); aspect-ratio: 1; }
.hero-disc svg { width: 100%; height: 100%; display: block; animation: spin 14s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .hero-disc svg { animation: none; } }
@media (max-width: 720px) { .hero { grid-template-columns: 1fr; } .hero-disc { order: -1; width: 120px; } }

/* ---------- Stats: a scoreboard ---------- */
.stats {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 2px;
  margin: 0 var(--gutter); padding: 0; transform: translateY(-2px);
  background: var(--line); border: 2px solid var(--line);
}
.stat-scope { grid-column: 1 / -1; margin: 0; padding: 8px 14px; background: var(--panel); font-family: var(--pixel); font-size: 10px; line-height: 1.6; color: var(--ink-dim); }
.stat-scope b { color: var(--yellow); font-weight: 400; }
.stat { padding: 14px 14px 12px; background: var(--panel); }
.stat b { display: block; font-family: var(--pixel); font-size: 22px; line-height: 1.2; color: var(--cyan); }
.stat span { display: block; margin-top: 6px; color: var(--ink-dim); font-size: 13px; }
.stat em { font-style: normal; color: var(--ink); }
.stat-bar { grid-column: 1 / -1; height: 10px; background: var(--bg); position: relative; }
.stat-bar i { display: block; height: 100%; width: 0; background: repeating-linear-gradient(90deg, var(--yellow) 0 8px, #C9A32B 8px 10px); transition: width .4s ease; }
@media (max-width: 860px) { .stats { grid-template-columns: repeat(2, 1fr); } .stat b { font-size: 18px; } }

/* ---------- Controls ---------- */
.controls { position: sticky; top: 0; z-index: 5; background: var(--bg); padding: 18px var(--gutter) 10px; border-bottom: 2px solid var(--line); }
.search input {
  width: 100%; padding: 12px 14px; background: var(--panel); border: 2px solid var(--line); color: var(--ink); font-size: 16px;
}
.search input:focus { border-color: var(--blue); outline: none; }
.search input::placeholder { color: var(--ink-dim); }
.filters { display: flex; flex-wrap: wrap; gap: 10px 16px; margin-top: 12px; align-items: end; }
.filters label { display: flex; flex-direction: column; gap: 4px; font-family: var(--pixel); font-size: 9px; color: var(--ink-dim); }
.filters select { padding: 8px; background: var(--panel); color: var(--ink); border: 2px solid var(--line); min-width: 150px; font-family: var(--ui); font-size: 15px; }
.btn, .btn-ghost {
  padding: 10px 14px; border: 2px solid var(--yellow); background: var(--yellow); color: #14110a;
  font-family: var(--pixel); font-size: 10px; line-height: 1.4; cursor: pointer; text-decoration: none; display: inline-block;
  box-shadow: 3px 3px 0 #7a6213;
}
.btn-ghost { background: transparent; color: var(--yellow); box-shadow: 3px 3px 0 #3a3a55; }
.btn:active, .btn-ghost:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 #3a3a55; }
.result-count { margin: 10px 0 0; font-family: var(--pixel); font-size: 9px; color: var(--ink-dim); }

/* ---------- List: each row is a case spine with a disc-label thumbnail ---------- */
main { padding: 10px var(--gutter) 48px; }
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.row {
  display: grid; grid-template-columns: 64px minmax(0, 1fr) 64px 150px 110px 90px 120px; gap: 16px; align-items: center;
  padding: 8px 12px 8px 8px; background: var(--panel); border: 2px solid var(--line); cursor: pointer;
}
.row:hover, .row:focus-visible { border-color: var(--blue); background: var(--panel-2); outline: none; }
.row.owned { border-left: 8px solid var(--yellow); padding-left: 2px; }
.row.unobtainable { opacity: .5; }
.thumb { width: 64px; height: 64px; display: block; background: #000; border: 2px solid var(--line); image-rendering: pixelated; }
.thumb img, .thumb svg { width: 100%; height: 100%; display: block; object-fit: cover; }
.row-title .t { font-family: var(--pixel); font-size: 13px; line-height: 1.5; display: block; }
.row-title .alt { color: var(--ink-dim); font-size: 13px; }
.row-meta { display: flex; gap: 14px; color: var(--ink-dim); font-size: 13px; margin-top: 4px; flex-wrap: wrap; }
.row-meta .year { color: var(--ink); }
.row-meta .sys { color: var(--cyan); }
.row-fmv { display: flex; align-items: center; gap: 8px; }
.meter { display: block; flex: 1; height: 10px; background: var(--bg); border: 1px solid var(--line); }
.meter b { display: block; height: 100%; background: repeating-linear-gradient(90deg, var(--cyan) 0 6px, #1E9ABF 6px 8px); }
.row-fmv .n { font-family: var(--pixel); font-size: 14px; width: 2ch; text-align: right; color: var(--cyan); }
.row-price { font-variant-numeric: tabular-nums; text-align: right; font-weight: 600; }
.row-price small { display: block; color: var(--ink-dim); font-size: 12px; font-weight: 400; }
.row-grade { font-family: var(--pixel); font-size: 12px; text-align: center; color: var(--ink-dim); }
.row-grade.good { color: #5CF27A; } .row-grade.bad { color: var(--red); }
.row-flags { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.flag { font-family: var(--pixel); font-size: 8px; line-height: 1.6; padding: 3px 6px; border: 1px solid var(--line); color: var(--ink-dim); }
.flag.own { border-color: var(--yellow); color: var(--yellow); }
.flag.play { border-color: var(--cyan); color: var(--cyan); }
.flag.cid { border-color: var(--red); color: var(--red); }
.flag.proto { border-color: #9A7BFF; color: #B9A4FF; }
@media (max-width: 860px) {
  .row { grid-template-columns: 56px minmax(0,1fr) 100px; grid-template-areas: "thumb main titan" "thumb price fmv" "thumb flags flags"; }
  .row-titan { grid-area: titan; justify-self: end; }
  .thumb { grid-area: thumb; width: 56px; height: 56px; }
  .row-main { grid-area: main; } .row-fmv { grid-area: fmv; } .row-price { grid-area: price; text-align: left; } .row-flags { grid-area: flags; }
  .row-grade { display: none; }
  .row-price small { display: inline; margin-left: 6px; }
}

/* ---------- Drawer: the back of the box ---------- */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(4,4,10,.7); z-index: 20; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(680px, 100%); background: var(--panel); z-index: 21;
  transform: translateX(100%); visibility: hidden; transition: transform .25s ease, visibility 0s linear .25s; border-left: 4px solid var(--blue);
}
.drawer.open { transform: none; visibility: visible; transition: transform .25s ease; }
@media (prefers-reduced-motion: reduce) { .drawer { transition: none; } }
.drawer-close { position: absolute; top: 12px; right: 14px; width: 40px; height: 40px; border: 2px solid var(--line); background: var(--bg); color: var(--ink); font-size: 24px; cursor: pointer; z-index: 1; }
.drawer-scroll { height: 100%; overflow-y: auto; padding: 24px 28px 48px; }
.d-head { display: grid; grid-template-columns: 128px 1fr; gap: 20px; align-items: start; margin-bottom: 16px; padding-right: 48px; }
.d-art { width: 128px; height: 128px; background: #000; border: 2px solid var(--line); image-rendering: pixelated; }
.d-art img, .d-art svg { width: 100%; height: 100%; display: block; object-fit: cover; }
.d-cat { color: var(--cyan); font-family: var(--pixel); font-size: 9px; line-height: 1.8; margin: 0; }
.d-title { font-family: var(--pixel); font-weight: 400; font-size: clamp(16px, 3.2vw, 22px); line-height: 1.4; margin: 6px 0 4px; text-shadow: 3px 3px 0 var(--blue); }
.d-alt { color: var(--ink-dim); margin: 0; font-size: 14px; }
.d-hook { font-size: 17px; line-height: 1.45; margin: 0 0 20px; padding: 12px 14px; background: var(--bg); border-left: 6px solid var(--red); }
.d-track { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; padding: 16px; margin: 0 0 24px; background: var(--bg); border: 2px solid var(--line); }
.d-track label { display: flex; flex-direction: column; gap: 4px; font-family: var(--pixel); font-size: 8px; color: var(--ink-dim); }
.d-track label.check { flex-direction: row; align-items: center; gap: 10px; font-size: 10px; color: var(--ink); }
.d-track input[type="text"], .d-track input[type="url"], .d-track input[type="date"], .d-track input[type="number"], .d-track select, .d-track textarea {
  padding: 8px; background: var(--panel); color: var(--ink); border: 2px solid var(--line); font-family: var(--ui); font-size: 15px;
}
.d-track label, .d-track input, .d-track select, .d-track textarea { min-width: 0; width: 100%; }
.d-track label.check { width: auto; }
.d-track textarea { grid-column: 1 / -1; min-height: 64px; resize: vertical; }
.d-track .span2 { grid-column: 1 / -1; }
.d-track input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--yellow); }
.d-saved { grid-column: 1 / -1; font-family: var(--pixel); font-size: 8px; color: #5CF27A; min-height: 1em; }
.d-facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0 0 24px; font-size: 14px; }
.d-facts dt { color: var(--ink-dim); } .d-facts dd { margin: 0; }
.d-section h3 { font-family: var(--pixel); font-size: 10px; margin: 20px 0 6px; color: var(--yellow); }
.d-section p { margin: 0 0 8px; color: #D6D6E0; }
.d-route b { color: var(--ink); }
.d-route > span { color: #9AA0B4; }
.d-prices { display: flex; gap: 20px; margin: 0 0 8px; }
.d-prices b { display: block; font-family: var(--pixel); font-size: 16px; line-height: 1.4; color: var(--cyan); }
.d-prices span { font-size: 12px; color: var(--ink-dim); }
.d-links { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 10px 0 0; }
.d-warn { color: var(--red); }
/* Fetched covers keep their whole box in the square thumbs; pictures sit in a row with their credit under each. */
.thumb img.cover, .d-art img.cover { object-fit: contain; image-rendering: auto; }
.art-gallery { display: flex; flex-wrap: wrap; gap: 12px; margin: 0 0 8px; }
.art-fig { margin: 0; width: 200px; max-width: 100%; }
.art-fig.is-cover { width: 128px; }
.art-fig img { display: block; width: auto; height: auto; max-width: 100%; max-height: 180px; border: 2px solid var(--line); }
.art-fig figcaption { margin-top: 4px; font-size: 11px; line-height: 1.4; color: var(--ink-dim); overflow-wrap: anywhere; }

/* ---------- Footer ---------- */
.foot { padding: 32px var(--gutter) 64px; border-top: 4px solid var(--blue); color: var(--ink-dim); font-size: 14px; max-width: 900px; }
.foot-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.foot code { color: var(--ink); }
.foot p { margin: 8px 0; }

/* ---------- Site nav: a strip of pixel tabs above every page ---------- */
.site-nav { display: flex; gap: 4px; align-items: stretch; padding: 0 var(--gutter); background: #08080D; border-bottom: 2px solid var(--line); }
.site-nav a { padding: 12px 14px 10px; font-family: var(--pixel); font-size: 9px; line-height: 1.4; color: var(--ink-dim); text-decoration: none; border-bottom: 3px solid transparent; }
.site-nav a:hover { color: var(--ink); }
.site-nav a[aria-current="page"] { color: var(--yellow); border-bottom-color: var(--yellow); }
.site-nav .site-nav-home { margin-right: auto; padding-left: 0; color: var(--cyan); }
.site-nav a { white-space: nowrap; }
@media (max-width: 560px) { .site-nav { overflow-x: auto; gap: 0; scrollbar-width: none; } .site-nav a { padding: 12px 8px 10px; } }

/* ---------- Timeline page ---------- */
.tl-hero { grid-template-columns: minmax(0, 1fr); padding-bottom: 28px; }

/* Chart: one bar per year, new games only. Single series, so the title names it and there's no legend. */
.tl-chart { position: relative; margin: 0 var(--gutter); padding: 18px 18px 12px; background: var(--panel); border: 2px solid var(--line); border-top: 0; }
.tl-chart-title { margin: 0; font-family: var(--pixel); font-weight: 400; font-size: 11px; color: var(--yellow); }
.tl-chart-sub { margin: 6px 0 14px; color: var(--ink-dim); font-size: 13px; }
.tl-bars { display: flex; gap: 2px; align-items: stretch; height: 170px; }
.tl-bar { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: stretch; gap: 4px; padding: 0; background: none; border: 0; color: var(--ink-dim); cursor: pointer; }
.tl-bar:disabled { cursor: default; }
.tl-bar-n { font-family: var(--pixel); font-size: 9px; line-height: 1; height: 10px; text-align: center; color: var(--ink); }
.tl-bar-col { flex: 1; display: flex; align-items: flex-end; justify-content: center; border-bottom: 1px solid var(--line); }
.tl-bar-col i { display: block; width: min(70%, 36px); min-height: 0; border-radius: 4px 4px 0 0; background: repeating-linear-gradient(180deg, var(--cyan) 0 6px, #1E9ABF 6px 8px); }
.tl-bar-y { font-family: var(--pixel); font-size: 8px; line-height: 1; text-align: center; }
.tl-bar:hover .tl-bar-col, .tl-bar:focus-visible .tl-bar-col { background: rgba(58,224,255,.08); }
.tl-bar:hover .tl-bar-y, .tl-bar:focus-visible .tl-bar-y { color: var(--ink); }
.tl-tip { position: absolute; transform: translate(-50%, -100%); padding: 6px 10px; background: var(--bg); border: 2px solid var(--cyan); font-size: 13px; white-space: nowrap; pointer-events: none; z-index: 2; }
@media (max-width: 560px) { .tl-bar-n { font-size: 7px; } .tl-bar-y { font-size: 6px; } .tl-bars { height: 130px; } }

.tl-controls { position: static; border-bottom: 0; }

/* Year jump bar: stays at the top while scrolling */
.tl-years { position: sticky; top: 0; z-index: 6; display: flex; gap: 4px; overflow-x: auto; padding: 8px var(--gutter); background: var(--bg); border-top: 2px solid var(--line); border-bottom: 2px solid var(--line); scrollbar-width: thin; }
.tl-years a { flex: none; padding: 6px 8px; border: 2px solid var(--line); background: var(--panel); color: var(--ink-dim); font-family: var(--pixel); font-size: 9px; line-height: 1.2; text-decoration: none; }
.tl-years a small { margin-left: 6px; font-size: 7px; color: var(--cyan); }
.tl-years a:hover { color: var(--ink); border-color: var(--blue); }
.tl-years a.on { color: #14110a; background: var(--yellow); border-color: var(--yellow); }
.tl-years a.on small { color: #14110a; }

/* The spine: year heads on the left, a dithered blue rail running down through the nodes */
.tl-main { padding-top: 24px; }
.tl { list-style: none; margin: 0; padding: 0; position: relative; }
.tl::before { content: ""; position: absolute; left: 11px; top: 0; bottom: 0; width: 6px; background: repeating-linear-gradient(180deg, var(--blue) 0 10px, #0F3FB8 10px 20px); }
.tl-year { position: relative; display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 20px; padding-bottom: 40px; scroll-margin-top: 56px; }
.tl-year-head { position: sticky; top: 64px; align-self: start; padding-left: 40px; }
.tl-node { position: absolute; left: 0; top: 2px; width: 28px; height: 28px; border-radius: 50%; background: conic-gradient(var(--cyan), var(--blue), var(--red), var(--cyan)); border: 3px solid var(--bg); box-shadow: 0 0 0 2px var(--blue); }
.tl-node::after { content: ""; position: absolute; inset: 8px; border-radius: 50%; background: var(--bg); }
.tl-year-head h2 { margin: 0; font-family: var(--pixel); font-weight: 400; font-size: 24px; line-height: 1.3; text-shadow: 3px 3px 0 var(--blue); }
.tl-year-head p { margin: 6px 0 0; color: var(--ink-dim); font-size: 13px; }
.tl-year-body { min-width: 0; }
.tl-games { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 8px; align-items: start; }

/* A game card: case spine with disc art, system badges, and a port track for multi-system games */
.tl-game { background: var(--panel); border: 2px solid var(--line); padding: 8px 10px 10px 8px; scroll-margin-top: 80px; }
.tl-game:hover, .tl-game:focus-within { border-color: var(--blue); background: var(--panel-2); }
.tl-game.multi { border-left: 6px solid var(--cyan); padding-left: 4px; }
.tl-game.open { grid-column: 1 / -1; border-color: var(--blue); }
.tl-game.flash { border-color: var(--yellow); box-shadow: 4px 4px 0 #7a6213; }
.tl-card { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto auto; gap: 12px; align-items: center; width: 100%; padding: 0; background: none; border: 0; color: inherit; text-align: left; cursor: pointer; }
.tl-card .thumb { grid-area: auto; width: 52px; height: 52px; }
.tl-title { display: block; font-family: var(--pixel); font-size: 11px; line-height: 1.5; }
.tl-sub { display: block; margin-top: 2px; color: var(--ink-dim); font-size: 13px; }
.tl-own { color: var(--yellow); }
.tl-count { font-family: var(--pixel); font-size: 12px; color: var(--cyan); }
.tl-badges { display: flex; flex-wrap: wrap; gap: 4px; margin: 8px 0 0 64px; }
.sysb { display: inline-flex; gap: 4px; align-items: baseline; padding: 3px 6px; border: 2px solid var(--sys); color: var(--ink); font-family: var(--pixel); font-size: 8px; line-height: 1.4; text-decoration: none; }
.sysb.debut { background: var(--sys); color: #0C0C12; }
.sysb i { font-style: normal; color: var(--ink-dim); }
.sysb:hover { outline: 2px solid var(--ink); outline-offset: 1px; }

.track { position: relative; height: 12px; margin: 8px 4px 0 68px; }
.track .rail { position: absolute; left: 0; right: 0; top: 5px; height: 2px; background: var(--line); }
.track .run { position: absolute; top: 4px; height: 4px; background: var(--ink-dim); }
.track .pip { position: absolute; top: 0; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 2px; }
.track .pip b { width: 12px; height: 12px; border-radius: 50%; background: var(--sys); border: 2px solid var(--panel); }
.track .pip b + b { margin-top: -10px; }
.track .pip em { font-style: normal; font-family: var(--pixel); font-size: 7px; line-height: 1.6; color: var(--ink-dim); text-align: center; white-space: nowrap; }
.track.labelled { height: 52px; margin: 10px 40px 4px; max-width: 560px; }

.tl-more { margin: 14px 0 0 64px; }
.tl-hook { margin: 0 0 14px; padding: 10px 12px; background: var(--bg); border-left: 6px solid var(--red); font-size: 16px; line-height: 1.45; }
.tl-facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 0 0 12px; font-size: 14px; }
.tl-facts dt { color: var(--ink-dim); } .tl-facts dd { margin: 0; }
.tl-more h3 { margin: 16px 0 6px; font-family: var(--pixel); font-weight: 400; font-size: 9px; line-height: 1.6; color: var(--yellow); }
.tl-versions { list-style: none; margin: 8px 0 0; padding: 0; font-size: 14px; }
.tl-versions li { padding: 4px 0; border-top: 1px solid var(--line); }
.tl-versions a { margin-left: 8px; }
.sysdot { display: inline-block; width: 10px; height: 10px; margin-right: 8px; border-radius: 50%; background: var(--sys); }

.tl-ports { margin-top: 12px; padding: 10px 12px; border: 2px dashed var(--line); }
.tl-ports h3 { margin: 0 0 8px; font-family: var(--pixel); font-weight: 400; font-size: 9px; line-height: 1.6; color: var(--ink-dim); }
.tl-ports ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.port-chip { display: inline-flex; gap: 6px; align-items: baseline; padding: 5px 8px; background: var(--bg); border: 1px solid var(--line); border-left: 4px solid var(--sys); color: var(--ink); font-size: 13px; cursor: pointer; text-align: left; }
.port-chip b { font-family: var(--pixel); font-weight: 400; font-size: 8px; color: var(--ink); }
.port-chip i { font-style: normal; color: var(--ink-dim); font-size: 12px; }
.port-chip:hover { border-color: var(--blue); border-left-color: var(--sys); }
.tl-empty { margin: 24px 0; color: var(--ink-dim); }

@media (max-width: 760px) {
  .tl-year { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .tl-year-head { position: relative; top: 0; display: flex; gap: 14px; align-items: baseline; }
  .tl-year-head p br { display: none; }
  .tl-year-body { padding-left: 40px; }
  .tl-games { grid-template-columns: minmax(0, 1fr); }
  .tl-badges, .tl-more { margin-left: 0; }
  .track { margin-left: 4px; }
  .track.labelled { margin: 10px 32px 4px; }
}
.sysb.best { box-shadow: 0 0 0 2px var(--yellow); }
.flag.best { border-color: var(--yellow); color: var(--yellow); }
.d-versions { list-style: none; margin: 0 0 8px; padding: 0; }
.d-versions li { padding: 4px 0; border-bottom: 1px solid var(--line); color: #D6D6E0; }
.d-versions li.here b { color: var(--yellow); }
.d-versions button { font: inherit; font-weight: 700; color: var(--cyan); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; }
.d-versions .flag { margin-left: 4px; }

/* ---------- System identity dot (same colors as the timeline badges) ---------- */
.row-meta .sys { display: inline-flex; align-items: center; }
.row-meta .sysdot, .d-versions .sysdot { width: 8px; height: 8px; margin-right: 6px; }

/* Every version: sits under the hook so the lineage is the first thing after the pitch */
.d-lineage { margin: 0 0 20px; padding: 12px 14px; background: var(--bg); border: 2px solid var(--line); }
.d-lineage h3 { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; justify-content: space-between; margin: 0 0 8px; font-family: var(--pixel); font-weight: 400; font-size: 10px; color: var(--yellow); }
.d-lineage h3 a { font-family: var(--ui); font-size: 13px; }
.d-versions li:last-child { border-bottom: 0; }
.d-best { margin: 8px 0 0; color: #D6D6E0; font-size: 14px; }

@media (max-width: 560px) {
  .drawer-scroll { padding: 20px 16px 40px; }
  .d-head { grid-template-columns: 72px 1fr; gap: 14px; padding-right: 44px; }
  .d-art { width: 72px; height: 72px; }
  .d-track { grid-template-columns: minmax(0, 1fr); padding: 12px; }
  .d-facts { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .d-facts dd { margin-bottom: 8px; }
  .row-meta { gap: 4px 12px; }
  .hero-lede { font-size: 16px; }
}

/* ---------- Timeline: chart labels thin out on narrow screens; the tooltip still names every year ---------- */
@media (max-width: 760px) {
  .tl-bar-n { visibility: hidden; }
  .tl-bar.minor .tl-bar-y { visibility: hidden; }
  .tl-bar-y { font-size: 7px; overflow: visible; white-space: nowrap; }
}

/* Compact layout: one line per game, no art or port track, so a busy year fits on a screen or two */
.tl.compact .tl-games { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 4px; }
.tl.compact .tl-game { padding: 6px 8px; }
.tl.compact .tl-game:not(.open) .thumb, .tl.compact .tl-game:not(.open) .tl-sub, .tl.compact .tl-game:not(.open) > .track { display: none; }
.tl.compact .tl-game:not(.open) .tl-card { grid-template-columns: minmax(0, 1fr) auto auto; }
.tl.compact .tl-game:not(.open) .tl-badges { margin: 6px 0 0; }
.tl.compact .tl-title { font-size: 10px; }
.flag { white-space: nowrap; }
.hero-kicker span { white-space: nowrap; }
.stat span i { font-style: normal; }
/* On a phone the filters wrap to half the screen, so they scroll away with the page instead of sticking */
@media (max-width: 760px) {
  .controls { position: static; }
  .filters label { flex: 1 1 140px; }
  .filters select { min-width: 0; width: 100%; }
}
@media (max-width: 560px) {
  .row { grid-template-columns: 56px minmax(0, 1fr) auto; grid-template-areas: "thumb main titan" "thumb fmv price" "thumb flags flags"; gap: 6px 12px; align-items: start; }
  .row-title .t { font-size: 11px; }
  .row-fmv { max-width: 140px; }
  .row-price { text-align: right; }
  .row-flags { justify-content: flex-start; }
  .row-flags:empty { display: none; }
}

/* ---------- Titans page: a ranked chart, one row per game ---------- */
.ti-how { margin: 0 var(--gutter); padding: 18px; background: var(--panel); border: 2px solid var(--line); border-top: 0; }
.ti-how h2 { margin: 0 0 12px; font-family: var(--pixel); font-weight: 400; font-size: 11px; color: var(--yellow); }
.ti-parts { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 20px; margin: 0; }
.ti-parts dt { font-family: var(--pixel); font-size: 9px; line-height: 1.6; color: var(--ink); }
.ti-parts dd { margin: 4px 0 0; color: var(--ink-dim); font-size: 14px; }
.ti-key { display: inline-block; width: 10px; height: 10px; margin-right: 8px; background: var(--k); }
.ti-formula { margin: 14px 0 0; font-family: var(--pixel); font-size: 9px; line-height: 1.8; color: var(--cyan); }
.q { --k: var(--cyan); } .c { --k: var(--yellow); } .s { --k: #9A7BFF; } .f { --k: var(--red); }
.ti-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.ti-row { display: grid; grid-template-columns: 3.5ch 64px minmax(0, 1fr) 72px; gap: 16px; align-items: start; padding: 10px 12px 10px 10px; background: var(--panel); border: 2px solid var(--line); }
.ti-row:hover, .ti-row:focus-within { border-color: var(--blue); background: var(--panel-2); }
.ti-rank { font-family: var(--pixel); font-size: 14px; line-height: 64px; text-align: right; color: var(--ink-dim); }
.ti-row:nth-child(-n+10) .ti-rank { color: var(--yellow); }
.ti-title { font-family: var(--pixel); font-size: 13px; line-height: 1.5; color: var(--ink); text-decoration: none; }
.ti-title:hover { color: var(--cyan); }
.ti-sub { display: block; margin-top: 2px; color: var(--ink-dim); font-size: 13px; }
.ti-bars { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 4px 16px; margin-top: 8px; }
.ti-bar { display: grid; grid-template-columns: 6ch minmax(0, 1fr) 6ch; gap: 8px; align-items: center; font-size: 12px; color: var(--ink-dim); }
.ti-bar i { display: block; height: 8px; background: var(--bg); border: 1px solid var(--line); }
.ti-bar b { display: block; height: 100%; background: var(--k); }
.ti-bar em { font-style: normal; font-variant-numeric: tabular-nums; color: var(--ink); }
.ti-why { margin-top: 6px; font-size: 14px; }
.ti-why summary { cursor: pointer; color: var(--cyan); font-size: 13px; }
.ti-why p { margin: 6px 0 0; color: #D6D6E0; }
.ti-why a { margin-left: 6px; font-size: 13px; }
.ti-score { font-family: var(--pixel); font-size: 22px; line-height: 64px; text-align: right; color: var(--cyan); text-shadow: 3px 3px 0 var(--blue); }
@media (max-width: 640px) {
  .ti-row { grid-template-columns: 3ch 48px minmax(0, 1fr) 48px; gap: 10px; }
  .ti-row .thumb { width: 48px; height: 48px; }
  .ti-rank, .ti-score { line-height: 48px; } .ti-score { font-size: 16px; }
}
.d-titan { display: flex; gap: 16px; align-items: center; margin: 0 0 8px; }
.d-titan > b { font-family: var(--pixel); font-size: 24px; line-height: 1.2; color: var(--cyan); text-shadow: 3px 3px 0 var(--blue); }
.d-titan .ti-bars { flex: 1; margin: 0; }
.d-titan .ti-bars { grid-template-columns: 1fr 1fr; }

/* Titan badge: the score in pixel type with the rank under it, on every row, card and drawer. Top 50 get a yellow frame. */
.titan-badge { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; min-width: 52px; padding: 5px 6px 4px; background: var(--bg); border: 2px solid var(--blue); box-shadow: 3px 3px 0 #0A1D5C; line-height: 1; }
.titan-badge b { font-family: var(--pixel); font-weight: 400; font-size: 16px; color: var(--cyan); }
.titan-badge small { margin-top: 4px; font-family: var(--pixel); font-size: 7px; color: var(--ink-dim); }
.titan-badge.top { border-color: var(--yellow); box-shadow: 3px 3px 0 #7a6213; }
.titan-badge.top small { color: var(--yellow); }
.row-titan { display: flex; justify-content: center; }
.d-head .titan-badge { margin-top: 10px; }
.tl-card .titan-badge { min-width: 44px; padding: 4px 5px 3px; }
.tl-card .titan-badge b { font-size: 12px; }

/* speedrun: board facts per game (tools/speedrun), attempts per release in the tracker */
.d-speedrun { margin: 0 0 20px; padding: 12px 14px; background: var(--bg); border: 2px solid var(--line); }
.d-speedrun h3 { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; margin: 0 0 8px; font-family: var(--pixel); font-weight: 400; font-size: 10px; color: var(--yellow); }
.d-speedrun p { margin: 0 0 6px; color: #D6D6E0; font-size: 14px; }
.d-board { padding: 6px 0; border-bottom: 1px solid var(--line); }
.d-board:last-of-type { border-bottom: 0; }
.d-board.other { opacity: .7; }
.d-board ul { margin: 0 0 4px; padding-left: 18px; color: #D6D6E0; font-size: 14px; }
.d-board .flag { margin-left: 4px; }
.d-board-note { color: var(--ink-dim) !important; font-size: 13px !important; }
.d-runs summary { cursor: pointer; font-family: var(--pixel); font-size: 8px; color: var(--ink-dim); }
.d-runs > div { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; margin-top: 12px; }
@media (max-width: 640px) { .d-runs > div { grid-template-columns: minmax(0, 1fr); } }

/* Site pass for 14 systems */
/* The list's thumb grid area is for index rows only; the Titans and timeline rows place their own thumb. */
@media (max-width: 860px) { .thumb { grid-area: auto; } .row .thumb { grid-area: thumb; } }
.tl-sep { display: none; }
@media (max-width: 760px) { .tl-sep { display: inline; } }
/* Each system name in the hero opens the index filtered to it */
.hero-kicker a { color: inherit; text-decoration: none; }
.hero-kicker a:hover, .hero-kicker a:focus-visible { color: var(--ink); text-decoration: underline; }
.hero-kicker a[aria-current] { color: var(--yellow); }
@media (max-width: 560px) { .hero-kicker { font-size: 8px; line-height: 2; } }
/* Recommended version, first thing under the title */
.d-pick { margin: 0 0 14px; padding: 10px 14px; background: var(--bg); border: 2px solid var(--yellow); color: #D6D6E0; font-size: 14px; }
.d-pick > span { color: var(--yellow); }
.d-pick b { color: var(--ink); }
.d-pick button, .d-route button { font: inherit; font-weight: 700; color: var(--cyan); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; }
/* Titan breakdown, boxed like the versions and speedrun blocks */
.d-titanbox { margin: 0 0 20px; padding: 12px 14px; background: var(--bg); border: 2px solid var(--line); }
.d-titanbox h3 { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; justify-content: space-between; margin: 0 0 10px; font-family: var(--pixel); font-weight: 400; font-size: 10px; color: var(--yellow); }
.d-titanbox h3 a { font-family: var(--ui); font-size: 13px; }
.d-titanbox p { margin: 0; color: #D6D6E0; font-size: 14px; }
@media (max-width: 560px) { .d-titan { flex-direction: column; align-items: stretch; gap: 8px; } .d-titan .ti-bars { grid-template-columns: minmax(0, 1fr); } }
/* Rows off screen skip layout and paint until scrolled near; the browser remembers each row's real height once drawn. */
.row { content-visibility: auto; contain-intrinsic-size: auto 84px; }
@media (max-width: 860px) { .row { contain-intrinsic-size: auto 120px; } }
