:root, html[data-theme="dark"] {
  --bg: #110f0c;
  --bg-raise: #1a1612;
  --bg-card: #201b16;
  --line: rgba(243, 232, 214, 0.12);
  --line-strong: rgba(243, 232, 214, 0.22);
  --cream: #f4ecdf;
  --cream-dim: #c9bba8;
  --muted: #9b8f80;
  --amber: #e7a15a;
  --amber-2: #ffd7a8;
  --ink: #1a120c;
  --phosphor: #d5e7a8;
  --shadow: 0 24px 50px rgba(0, 0, 0, 0.35);
  --serif: "Oxanium", "Outfit", "Avenir Next", sans-serif;
  --glow: rgba(231, 161, 90, 0.35);
  --sans: "Outfit", "Avenir Next", "Segoe UI", sans-serif;
  --radius: 22px;
  --header: 76px;
  --rail: min(1320px, 85%);
}

html[data-theme="light"] {
  --bg: #e6d8c4;
  --bg-raise: #f7f0e4;
  --bg-card: #fff8ee;
  --line: rgba(48, 28, 12, 0.12);
  --line-strong: rgba(48, 28, 12, 0.22);
  --cream: #24180f;
  --cream-dim: #4d3a2a;
  --muted: #746049;
  --amber: #b85a16;
  --amber-2: #8c3d09;
  --ink: #fff8ee;
  --phosphor: #1f6a38;
  --shadow: 0 18px 36px rgba(80, 46, 12, 0.12);
  --glow: rgba(184, 90, 22, 0.28);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--cream);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.5;
  background:
    radial-gradient(1000px 480px at 8% -10%, rgba(231, 161, 90, 0.16), transparent 55%),
    radial-gradient(800px 500px at 110% 8%, rgba(213, 231, 168, 0.07), transparent 50%),
    var(--bg);
}
body::before {
  content: "";
  pointer-events: none;
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.015),
    rgba(255, 255, 255, 0.015) 1px,
    transparent 1px,
    transparent 4px
  );
  mix-blend-mode: overlay;
  opacity: 0.35;
  z-index: 0;
}
a { color: inherit; }
img { max-width: 100%; display: block; }
button, input { font: inherit; color: inherit; }
.skip {
  position: absolute;
  left: 12px;
  top: -40px;
  background: var(--amber);
  color: var(--ink);
  padding: 8px 12px;
  border-radius: 8px;
  z-index: 20;
}
.skip:focus { top: 12px; }

.wrap {
  width: var(--rail);
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  height: var(--header);
  display: flex;
  align-items: center;
  backdrop-filter: blur(16px);
  background: rgba(17, 15, 12, 0.78);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}
.brand-mark { flex: 0 0 auto; filter: drop-shadow(0 0 8px rgba(61, 220, 120, 0.45)); }
.brand-name {
  display: inline-flex;
  align-items: baseline;
  gap: 0.28em;
  font-family: var(--serif);
  font-weight: 560;
  font-size: 1.25rem;
  letter-spacing: 0.01em;
  line-height: 1;
  white-space: nowrap;
}
.brand-word { display: inline-block; }
.brand-accent { color: #3DDC78; }
html[data-theme="light"] .brand-accent { color: #128A42; }
.brand-sub {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.nav a {
  text-decoration: none;
  color: var(--cream-dim);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 0.92rem;
}
.nav a:hover, .nav a[aria-current="page"] {
  color: var(--ink);
  background: var(--amber);
  border-color: var(--amber);
}

.hero { padding: 18px 0 8px; }
.kicker {
  margin: 0 0 14px;
  color: var(--amber-2);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.75rem;
  font-weight: 600;
}
.hero h1 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 560;
  font-size: clamp(1.7rem, 2.6vw, 2.4rem);
  letter-spacing: -0.03em;
  line-height: 1.12;
  max-width: 28ch;
}
.hero h1 em {
  font-style: italic;
  font-weight: 560;
  color: var(--amber-2);
}
.lede {
  max-width: 58ch;
  color: var(--cream-dim);
  font-size: 0.98rem;
  margin: 8px 0 0;
}
.hero-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.toolbar {
  display: grid;
  gap: 10px;
  margin: 14px 0 10px;
}
.search {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-raise);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  padding: 12px 14px;
}
.search:focus-within { border-color: var(--amber); box-shadow: 0 0 0 3px rgba(231, 161, 90, 0.18); }
.search input {
  flex: 1;
  background: transparent;
  border: 0;
  outline: none;
  min-width: 0;
}
.search input::placeholder { color: var(--muted); }
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-bottom: 4px;
}
.chips button {
  flex: 0 0 auto;
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--cream-dim);
  cursor: pointer;
}
.chips button:hover { border-color: var(--amber); color: var(--cream); }
.chips button[aria-pressed="true"] {
  background: var(--amber);
  border-color: var(--amber);
  color: var(--ink);
}
.results-line {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 0.9rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 18px;
  padding-bottom: 28px;
}
.card {
  background: linear-gradient(180deg, rgba(255,255,255,0.025), transparent 40%), var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 10px 14px;
  display: flex;
  flex-direction: column;
  min-width: 0;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}
.card:hover { transform: translateY(-4px); border-color: rgba(231, 161, 90, 0.55); box-shadow: var(--shadow); }
.card-link { text-decoration: none; display: flex; flex-direction: column; gap: 10px; min-width: 0; flex: 1; }
.cover {
  position: relative;
  aspect-ratio: 1;
  border-radius: 16px;
  overflow: hidden;
  background: #0c0b09;
}
/* Keep catalog cards from letting portrait covers crowd out their text. */
.card .cover {
  aspect-ratio: 16 / 10;
}
.cover-blur {
  position: absolute;
  inset: -8%;
  width: 116%;
  height: 116%;
  object-fit: cover;
  filter: blur(18px) saturate(0.85);
  opacity: 0.7;
}
.cover-main {
  position: relative;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.card .cover-main {
  object-fit: cover;
  object-position: center;
}
.card h2 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 560;
  font-size: 1.28rem;
  letter-spacing: -0.03em;
  line-height: 1.15;
}
.meta { margin: 0; color: var(--muted); font-size: 0.86rem; }
.blurb {
  margin: 0;
  color: var(--cream-dim);
  font-size: 0.92rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.badge-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 600;
  border: 1px solid transparent;
}
.badge-nso { background: rgba(213, 231, 168, 0.16); color: var(--phosphor); }
.badge-re { background: rgba(231, 161, 90, 0.16); color: var(--amber-2); }
.badge-sw { background: rgba(244, 236, 223, 0.1); color: var(--cream); }
.badge-check { background: transparent; border-color: var(--line-strong); color: var(--cream-dim); }
.rawg-mini {
  margin: 10px 2px 0;
  font-size: 0.75rem;
  color: var(--muted);
}
.rawg-mini a { color: var(--amber-2); }
.empty {
  display: none;
  border: 1px dashed var(--line-strong);
  border-radius: 16px;
  padding: 28px;
  color: var(--cream-dim);
  margin-bottom: 28px;
}
.empty.is-on { display: block; }

.detail {
  width: var(--rail);
  margin-inline: auto;
  padding: 36px 0 20px;
  display: grid;
  grid-template-columns: minmax(220px, 380px) minmax(0, 1fr);
  column-gap: 42px;
  row-gap: 8px;
  align-items: start;
}
.detail-cover,
.detail-copy,
.detail-wide { min-width: 0; }
.detail-wide { grid-column: 1 / -1; }
.detail-cover .cover { border-radius: 22px; box-shadow: var(--shadow); width: 100%; }
.back { color: var(--cream-dim); text-decoration: none; font-size: 0.92rem; }
.back:hover { color: var(--amber-2); }
.detail h1 {
  font-family: var(--serif);
  font-weight: 560;
  letter-spacing: -0.04em;
  font-size: clamp(2.2rem, 4vw, 3.6rem);
  line-height: 1;
  margin: 14px 0 10px;
}
.facts { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; padding: 0; list-style: none; }
.facts li {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  color: var(--cream-dim);
  font-size: 0.88rem;
}
.prose { color: var(--cream-dim); font-size: 1.05rem; max-width: 68ch; }
.prose p { margin: 0 0 12px; }
.section-title {
  font-family: var(--serif);
  font-size: 1.8rem;
  letter-spacing: -0.03em;
  margin: 28px 0 12px;
}
.routes { display: grid; gap: 12px; }
.route {
  background: var(--bg-raise);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px 16px 14px;
}
.route h3 { margin: 8px 0 6px; font-size: 1.05rem; font-weight: 600; }
.route p { margin: 0; color: var(--cream-dim); }
.route-top { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.cta {
  display: inline-flex;
  margin-top: 12px;
  text-decoration: none;
  background: var(--amber);
  color: var(--ink);
  font-weight: 600;
  border-radius: 999px;
  padding: 9px 14px;
}
.cta:hover { background: var(--amber-2); }
.cta span { font-weight: 500; margin-left: 6px; opacity: 0.75; }
.fine {
  margin-top: 18px;
  padding: 14px 16px;
  border-left: 3px solid var(--amber);
  color: var(--muted);
  background: rgba(231, 161, 90, 0.06);
  border-radius: 0 12px 12px 0;
}
.credit-line { margin-top: 12px; color: var(--muted); font-size: 0.88rem; }
.credit-line a { color: var(--amber-2); }

.about { padding: 48px 0 24px; max-width: 68ch; }
.about h1 {
  font-family: var(--serif);
  font-size: clamp(2.4rem, 5vw, 4rem);
  letter-spacing: -0.04em;
  line-height: 0.98;
  margin: 0 0 16px;
}
.about p { color: var(--cream-dim); font-size: 1.06rem; }

.site-footer {
  border-top: 1px solid var(--line);
  margin-top: 20px;
  padding: 28px 0 40px;
  position: relative;
  z-index: 1;
  color: var(--muted);
  font-size: 0.92rem;
}
.site-footer .wrap { display: grid; gap: 8px; }
.site-footer strong { color: var(--cream); font-weight: 600; }
.site-footer a { color: var(--amber-2); }

:focus-visible { outline: 2px solid var(--amber-2); outline-offset: 3px; }
@media (max-width: 1080px) {
  .detail { grid-template-columns: minmax(0, 1fr); row-gap: 22px; }
  .detail-wide { grid-column: auto; }
  .detail-cover { max-width: 460px; }
  .hero { padding-top: 36px; }
}
@media (max-width: 640px) {
  .detail-cover { max-width: none; }
  .grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .card h2 { font-size: 1.05rem; }
  .blurb { display: none; }
  body { font-size: 16px; }
  .chips { flex-wrap: wrap; overflow: visible; }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}

.system-select {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.88rem;
}
.system-select select {
  background: var(--bg-raise);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 10px 12px;
  min-width: min(100%, 280px);
}
.plat-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin: 0 0 10px;
  overflow: visible;
}
.plat-links a { white-space: nowrap; }
.plat-links a {
  color: var(--amber-2);
  font-size: 0.88rem;
}
.crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 0.88rem;
}
.crumbs a { color: var(--cream-dim); text-decoration: none; }
.crumbs a:hover { color: var(--amber-2); }
.crumbs li:not(:last-child)::after { content: "/"; margin-left: 6px; color: var(--muted); }
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
}
.stat {
  background: var(--bg-raise);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  color: var(--cream-dim);
  font-size: 0.92rem;
}
.stat b {
  display: block;
  margin-bottom: 4px;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}
.shot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}
.shot-grid img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  border-radius: 12px;
  background: #0c0b09;
}

html[data-theme="light"] body::before {
  opacity: 0.2;
  mix-blend-mode: multiply;
}
.site-header {
  box-shadow: inset 0 -1px 0 var(--line-strong);
}
.brand-mark { filter: drop-shadow(0 0 8px rgba(61, 220, 120, 0.4)); }
.cover {
  box-shadow: inset 0 0 0 3px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(231, 161, 90, 0.35);
}
html[data-theme="light"] .cover {
  box-shadow: inset 0 0 0 3px rgba(40, 22, 8, 0.18), 0 0 0 1px rgba(140, 61, 9, 0.28);
}
.nav { display: flex; align-items: center; gap: 8px; }
.theme-toggle {
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 8px 14px;
  color: var(--cream-dim);
  cursor: pointer;
}
.theme-toggle:hover { border-color: var(--amber); color: var(--cream); }
.theme-toggle[aria-pressed="true"] {
  box-shadow: inset 0 0 0 1px var(--amber);
}
.rel-h {
  margin: 14px 0 6px;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.rel-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px 18px;
  grid-template-columns: 1fr;
}
@media (min-width: 720px) {
  .rel-list { grid-template-columns: 1fr 1fr; }
}
.rel-list a { color: var(--amber-2); text-decoration: none; }
.rel-list a:hover { text-decoration: underline; }
.rel-list span { color: var(--muted); font-size: 0.86rem; }

/* Header bar stays dark in both themes. Pin type so light-theme ink is not brown-on-brown. Phosphor stays on "NES", not on the pills. */
.site-header { color: #f6efe4; }
.site-header .brand-name { color: #f6efe4; }
.site-header .brand-accent,
html[data-theme="light"] .site-header .brand-accent { color: #3DDC78; }
.site-header .brand-sub { color: #e4d5c0; }
.site-header .nav a,
.site-header .theme-toggle {
  color: #fff8ee;
  background: rgba(255, 248, 238, 0.12);
  border: 1.5px solid rgba(255, 248, 238, 0.62);
  box-shadow: none;
}
.site-header .nav a:hover,
.site-header .nav a[aria-current="page"],
.site-header .theme-toggle:hover {
  color: #1a120c;
  background: #e7a15a;
  border-color: #ffd7a8;
}
.site-header .theme-toggle[aria-pressed="true"] {
  box-shadow: inset 0 0 0 1px rgba(61, 220, 120, 0.55);
}

/* Home shelves: landscape carts on a console ledge. The row wraps. No scrollbar. */
.shelf { margin: 10px 0 28px; }
.shelf-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 8px;
}
.shelf-head h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.35rem;
  letter-spacing: -0.03em;
  font-weight: 560;
}
.see-all {
  color: var(--amber-2);
  text-decoration: none;
  font-size: 0.92rem;
  white-space: nowrap;
}
.see-all:hover { text-decoration: underline; }
.rail {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px 12px;
  overflow: visible;
  padding: 12px 2px 0;
  margin: 0;
  align-items: end;
}
.rail::after {
  content: "";
  display: block;
  grid-column: 1 / -1;
  height: 16px;
  margin: 4px 0 0;
  border-radius: 2px 2px 8px 8px;
  background:
    linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.22) 16%, transparent 34%, rgba(0, 0, 0, 0.08) 64%, transparent 86%),
    linear-gradient(180deg, #f3eee6 0%, #cfc8bc 18%, #8e8982 58%, #5e5a55 84%, #3c3935 100%);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.75),
    0 3px 0 #2c2926,
    0 12px 18px rgba(40, 24, 8, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    inset 0 -4px 6px rgba(20, 16, 12, 0.35);
}
html[data-theme="dark"] .rail::after {
  background:
    linear-gradient(90deg, transparent 0%, rgba(61, 220, 120, 0.12) 18%, transparent 42%, rgba(0, 0, 0, 0.28) 72%, transparent),
    linear-gradient(180deg, #3c4a42 0%, #24302a 40%, #101614 100%);
  box-shadow:
    0 1px 0 rgba(61, 220, 120, 0.32),
    0 3px 0 #070a08,
    0 12px 20px rgba(0, 0, 0, 0.48),
    inset 0 1px 0 rgba(170, 255, 196, 0.14),
    inset 0 -4px 6px rgba(0, 0, 0, 0.45);
}
.rail .card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  min-width: 0;
}
.rail .card:hover {
  transform: none;
  border-color: transparent;
  box-shadow: none;
}
.rail .card-link { gap: 6px; }
.rail .cover {
  border-radius: 8px 8px 3px 3px;
  transform-origin: 50% 100%;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow:
    0 0 0 2px #141814,
    0 0 0 4px #3a4038,
    0 8px 14px rgba(20, 12, 6, 0.22);
}
.rail .card:nth-child(6n+1) .cover { transform: rotate(-1deg); }
.rail .card:nth-child(6n+2) .cover { transform: rotate(0.7deg); }
.rail .card:nth-child(6n+3) .cover { transform: rotate(-0.35deg); }
.rail .card:nth-child(6n+4) .cover { transform: rotate(0.9deg); }
.rail .card:nth-child(6n+5) .cover { transform: rotate(-0.55deg); }
.rail .card:nth-child(6n) .cover { transform: rotate(0.4deg); }
.rail .card:hover .cover,
.rail .card:focus-within .cover {
  transform: rotate(0deg) translateY(-6px);
  box-shadow:
    0 0 0 2px #141814,
    0 0 0 4px #3ddc78,
    0 14px 22px rgba(20, 12, 6, 0.3);
}
.rail .card h2 {
  font-size: 0.92rem;
  text-align: center;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.rail .meta {
  text-align: center;
  font-size: 0.72rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.rail .blurb,
.rail .badge-row { display: none; }
.rail .rawg-mini {
  margin: 0;
  text-align: center;
  font-size: 0.68rem;
}
@media (max-width: 1100px) {
  .rail { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 800px) {
  .rail { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .rail { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  .rail .cover { transform: none !important; }
}
.search-hits {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  display: grid;
  gap: 6px;
}
.search-hits a { color: var(--amber-2); text-decoration: none; }
.search-hits a:hover { text-decoration: underline; }
.search-hits span { color: var(--muted); font-size: 0.86rem; }
