/* Tokens adapted from beautifului.dev (MIT) */
:root {
  --canvas: oklch(23.1% .004 264.487);
  --surface: oklch(26% .006 271.191);
  --surface-2: oklch(29% .006 271.191);
  --ink: oklch(96.4% .002 247.839);
  --ink-2: oklch(73.1% .008 260.731);
  --ink-3: oklch(60% .009 264.505);
  --line: oklch(30.8% .006 258.354);
  --line-strong: oklch(35.6% .007 264.474);
  --accent: oklch(68% .173 253.301);
  --accent-tint: oklch(68% .173 253.301 / .16);
  --green: oklch(72% .17 150);
  --green-tint: oklch(72% .17 150 / .14);
  --red: oklch(66% .2 25);
  --red-tint: oklch(66% .2 25 / .14);
  --gold: oklch(80% .14 85);
  --gold-tint: oklch(80% .14 85 / .14);
  --radius: 12px;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", monospace;
  --sans: "Inter", ui-sans-serif, system-ui, sans-serif;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --canvas: oklch(96.1% .002 247.84);
  --surface: oklch(100% 0 0);
  --surface-2: oklch(97.5% .002 247.84);
  --ink: oklch(24.7% .006 258.361);
  --ink-2: oklch(50.6% .01 264.477);
  --ink-3: oklch(58% .01 264.484);
  --line: oklch(92.5% .003 264.542);
  --line-strong: oklch(88% .005 258.326);
  --accent: oklch(62.6% .205 254.947);
  --accent-tint: oklch(96% .019 252.878);
  --green: oklch(55% .15 150);
  --green-tint: oklch(95% .05 150);
  --red: oklch(55% .2 25);
  --red-tint: oklch(95% .04 25);
  --gold: oklch(60% .13 75);
  --gold-tint: oklch(95% .05 85);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--canvas);
  color: var(--ink);
  font: 14px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; letter-spacing: -.02em; }
.wrap { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--ink-3); }
.mono { font-family: var(--mono); }
main.wrap { flex: 1; padding-top: 28px; padding-bottom: 60px; }

/* Top bar */
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in oklch, var(--canvas) 85%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.topbar-inner { display: flex; align-items: center; gap: 20px; height: 58px; }
.logo { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 16px; letter-spacing: -.02em; }
.logo-mark { display: block; width: 28px; height: 28px; border-radius: 6px; image-rendering: pixelated; }
.nav { display: flex; gap: 2px; }
.nav a { padding: 6px 10px; border-radius: 8px; color: var(--ink-2); font-weight: 500; font-size: 13.5px; }
.nav a:hover { color: var(--ink); }
.nav a.active { color: var(--ink); background: var(--surface-2); }
.search { margin-left: auto; }
.search input { width: 200px; height: 34px; padding: 0 12px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 500 13px var(--mono); outline: none; }
.search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint); }
.icon-btn { width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); cursor: pointer; font-size: 15px; }
.icon-btn:hover { color: var(--ink); }

/* Generic */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.section { margin-top: 36px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section-head h2 { font-size: 17px; }
.eyebrow { font: 600 11.5px var(--sans); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.green { color: var(--green); background: var(--green-tint); }
.pill.red { color: var(--red); background: var(--red-tint); }
.pill.gold { color: var(--gold); background: var(--gold-tint); }
.pill.plain { color: var(--ink-2); background: var(--surface-2); }
.pill.plain::before, .pill.gold::before { display: none; }
.btn { display: inline-flex; align-items: center; justify-content: center; height: 38px; padding: 0 16px; border-radius: 10px; font-weight: 500; font-size: 13.5px; border: 0; cursor: pointer; background: var(--surface-2); color: var(--ink); }
.btn:hover { background: var(--line-strong); }
.btn.primary { background: var(--ink); color: var(--canvas); }
.btn.primary:hover { opacity: .88; }
.pixel { image-rendering: pixelated; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stat { padding: 16px 18px; }
.stat b { display: block; font: 700 26px var(--mono); letter-spacing: -.03em; }
.stat span { color: var(--ink-3); font-size: 12.5px; }

/* Hero / featured */
.hero { display: grid; grid-template-columns: 1fr 1.25fr; gap: 0; overflow: hidden; }
.hero-left { padding: 28px; display: flex; flex-direction: column; gap: 14px; }
.hero-left h1 { font: 700 64px/1 var(--mono); letter-spacing: -.04em; }
.hero-left p { margin: 0; color: var(--ink-2); max-width: 46ch; }
.hero-right { background: var(--surface-2); border-left: 1px solid var(--line); display: flex; align-items: center; justify-content: center; padding: 20px; }
.video { position: relative; width: 100%; aspect-ratio: 16/9; border-radius: 10px; overflow: hidden; background: #000; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.cape-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* Filters */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.chip { height: 30px; padding: 0 11px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font: 500 12.5px var(--sans); cursor: pointer; }
.chip:hover { color: var(--ink); }
.chip.on { background: var(--ink); color: var(--canvas); border-color: var(--ink); }
.toolbar select { height: 30px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); padding: 0 8px; font: 500 12.5px var(--sans); margin-left: auto; }

/* Name grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.tile { position: relative; padding: 14px; display: flex; flex-direction: column; gap: 10px; transition: border-color .15s, transform .15s; }
.tile:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.tile-top { display: flex; align-items: center; gap: 12px; }
.tile-name { font: 700 22px/1 var(--mono); letter-spacing: -.02em; }
.tile-meta { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--ink-3); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.green { background: var(--green); }
.dot.red { background: var(--red); }
.tile-capes { display: flex; gap: 3px; min-height: 16px; }
.tile-capes canvas { width: 10px; height: 16px; border-radius: 1px; }

/* Head (face + hat layer, cropped with CSS from the raw skin) */
.head { position: relative; flex: none; width: var(--s, 40px); height: var(--s, 40px); border-radius: 6px; overflow: hidden; background: var(--surface-2); }
.head i { position: absolute; inset: 0; background-repeat: no-repeat; image-rendering: pixelated; background-size: calc(var(--s, 40px) * 8) auto; }
.head i:first-child { background-position: calc(var(--s, 40px) * -1) calc(var(--s, 40px) * -1); }
.head i:last-child { background-position: calc(var(--s, 40px) * -5) calc(var(--s, 40px) * -1); }

/* Profile */
.profile { display: grid; grid-template-columns: 340px 1fr; gap: 20px; align-items: start; }
.viewer { padding: 0; overflow: hidden; }
@media (max-width: 860px) { .viewer { top: auto; } }
.viewer canvas.sv { display: block; width: 100% !important; height: 420px !important; cursor: grab; }
.viewer-bar { display: flex; gap: 6px; padding: 10px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.profile-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.profile-head h1 { font: 700 56px/1 var(--mono); letter-spacing: -.04em; }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 16px; }
.fact { padding: 14px 16px; border-right: 1px solid var(--line); min-width: 0; }
.fact:last-child { border-right: 0; }
.fact b { display: block; font-weight: 600; margin-top: 2px; overflow-wrap: anywhere; }
.fact small { color: var(--ink-3); display: block; font-size: 12px; }
.story { padding: 18px 20px; border-left: 3px solid var(--gold); }
.story h3 { font-size: 14.5px; margin-bottom: 6px; }
.story p { margin: 0; color: var(--ink-2); }
.capes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.cape-card { padding: 14px 10px 12px; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; position: relative; }
.cape-card canvas { width: 50px; height: 80px; border-radius: 3px; }
.cape-card b { font-size: 12.5px; font-weight: 600; line-height: 1.25; }
.cape-card small { color: var(--ink-3); font-size: 11.5px; }
.cape-card .eq { position: absolute; top: 8px; right: 8px; font-size: 10px; font-weight: 700; color: var(--accent); background: var(--accent-tint); padding: 2px 6px; border-radius: 99px; }
.skins { display: flex; gap: 8px; flex-wrap: wrap; }
.skin-thumb { padding: 6px; cursor: pointer; border-radius: 10px; }
.skin-thumb.on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint); }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: 14px; align-items: baseline; padding: 11px 16px; border-bottom: 1px solid var(--line); }
.timeline li:last-child { border-bottom: 0; }
.timeline .when { width: 120px; flex: none; color: var(--ink-3); font: 500 12px var(--mono); }
.links { display: flex; gap: 8px; flex-wrap: wrap; }
.empty { padding: 18px; color: var(--ink-3); text-align: center; }

/* Cape catalog */
.cape-cat { padding: 16px; display: flex; gap: 16px; align-items: center; }
.cape-cat canvas { width: 40px; height: 64px; flex: none; border-radius: 3px; }
.cape-cat b { display: block; font-size: 14px; }
.cape-cat small { color: var(--ink-3); }
.catalog { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }

/* History */
.feed li { gap: 12px; }
.prose { max-width: 70ch; color: var(--ink-2); }

/* 404 — layout after kobbe.io */
.notfound { min-height: calc(100vh - 160px); display: flex; flex-direction: column; justify-content: space-between; padding-top: 50px; }
.notfound .eyebrow { text-transform: none; letter-spacing: 0; font-size: 14px; font-weight: 500; }
.notfound p.lead { font-size: 26px; line-height: 1.4; letter-spacing: -.015em; color: var(--ink-3); max-width: 34em; margin: 14px 0 26px; }
.notfound p.lead strong { color: var(--ink); font-weight: 500; }
.notfound .actions { display: flex; gap: 10px; flex-wrap: wrap; }
.island { width: 100%; max-width: 900px; margin: 40px 0 0 auto; display: block; }

@media (max-width: 860px) {
  .hero, .profile { grid-template-columns: 1fr; }
  .hero-right { border-left: 0; border-top: 1px solid var(--line); }
  .viewer { position: static; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .facts { grid-template-columns: 1fr; }
  .fact { border-right: 0; border-bottom: 1px solid var(--line); }
  .topbar-inner { flex-wrap: wrap; height: auto; padding-top: 10px; padding-bottom: 6px; gap: 10px; }
  .nav { order: 3; width: 100%; }
  .search input { width: 140px; }
  .viewer canvas.sv { height: 360px !important; }
  .hero-left h1, .profile-head h1 { font-size: 44px; }
  .notfound p.lead { font-size: 20px; }
}

/* Browse: presets, facets, groups */
.presets { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.chip.preset { border-style: dashed; }
.facets { padding: 6px 14px; margin-bottom: 18px; }
.facet-row { display: flex; gap: 14px; align-items: flex-start; padding: 9px 0; border-bottom: 1px solid var(--line); }
.facet-row:last-child { border-bottom: 0; }
.facet-label { width: 78px; flex: none; padding-top: 6px; font-size: 12px; font-weight: 600; color: var(--ink-3); }
.facet-opts { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.facet-opts select { height: 30px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); padding: 0 8px; font: 500 12.5px var(--sans); }
.group { margin-bottom: 26px; }
.group-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.group-head h3 { font-size: 15px; }
.group-head canvas { width: 12px; height: 19px; }
@media (max-width: 860px) { .facet-row { flex-direction: column; gap: 6px; } }
.head.ghost { display: grid; place-items: center; color: var(--ink-3); font: 700 calc(var(--s, 40px) * .45) var(--mono); border: 1px dashed var(--line-strong); }
.sv-empty { height: 420px; display: grid; place-items: center; text-align: center; color: var(--ink-3); padding: 20px; }

/* NameMC-style sidebar: skin + cape icon grids under the viewer */
.side-block { border-top: 1px solid var(--line); padding: 12px; }
.side-head { display: flex; justify-content: space-between; font-size: 12px; font-weight: 600; color: var(--ink-2); margin-bottom: 8px; }
.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 6px; }
.icon-cell { height: 48px; display: grid; place-items: center; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2); cursor: pointer; padding: 0; transition: border-color .12s, transform .12s; }
.icon-cell:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.icon-cell.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-tint); }
.cape-cell canvas { width: 20px; height: 32px; border-radius: 2px; }
.viewer canvas.sv { cursor: grab; }
.viewer canvas.sv:active { cursor: grabbing; }
.tip { position: fixed; z-index: 50; display: none; pointer-events: none; padding: 5px 9px; border-radius: 7px; background: var(--ink); color: var(--canvas); font-size: 12px; font-weight: 500; white-space: nowrap; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
.pager .btn { height: 34px; gap: 6px; }
.profile-head h1.long { font-size: 38px; overflow-wrap: anywhere; }
.released { display: flex; gap: 12px; align-items: center; padding: 12px 16px; margin-top: 14px; color: var(--ink-2); flex-wrap: wrap; }
.released b { color: var(--ink); }
canvas.cape-big { width: 35px; height: 56px; border-radius: 3px; }
.cape-cell { text-decoration: none; }

/* Cape page — after namemc.com/cape/… */
.cape-page { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; align-items: center; gap: 16px; }
.cape-title { text-align: center; display: grid; gap: 4px; }
.cape-title h1 { font-size: 30px; }
.cape-stage { width: 100%; max-width: 360px; overflow: hidden; }
.cape-stage canvas.sv { display: block; width: 100% !important; height: 420px !important; cursor: grab; }
.cape-desc { text-align: center; margin: 0; font-size: 13.5px; }
.name-list { width: 100%; padding: 10px; display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 2px; }
.name-list a { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 7px; font-size: 15px; font-weight: 700; }
.name-list a:hover { background: var(--surface-2); }
.name-list .dot { width: 6px; height: 6px; }
.nc-list li:not(.nc-chain) { border-bottom: 0; padding-bottom: 2px; align-items: center; }
.nc-main { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.nc-main b { font-size: 15px; overflow-wrap: anywhere; }
.nc-short { font-size: 18px !important; }
.nc-status { flex: none; }
.nc-chain { padding-top: 0 !important; font-size: 12px; }
.nc-chain span.muted { padding-left: 38px; }
.nc-chain .nw { white-space: nowrap; }
.tile-now { font-size: 11.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: -4px; }
.dot.grey { background: var(--ink-3); }
.story.rare { border-left-color: var(--accent); }
button.stat { text-align: left; font: inherit; color: inherit; cursor: pointer; transition: border-color .15s; }
.stat:hover { border-color: var(--line-strong); }
.stat.on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint); }
.stat-panel { margin-top: 16px; }

/* IGNs: Arial bold, tight spacing */
.tile-name, .profile-head h1, .hero-left h1, .name-list a .mono, .nc-main b, .released b, .pager .mono, .ign-hist {
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 700;
  letter-spacing: -0.045em;
}
/* Digits inside IGNs: lighter than Arial Bold, a touch heavier than regular */
.dg { font-weight: 400; -webkit-text-stroke: 0.03em currentColor; letter-spacing: 0.02em; }
.ign-hist { font-size: 15px; }

/* Trivia game */
.game { max-width: 640px; margin: 0 auto; }
.game-top { display: flex; align-items: end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.game-score { display: flex; gap: 14px; color: var(--ink-3); font-size: 13px; }
.game-score b { color: var(--ink); font-family: var(--mono); }
.game-card { padding: 28px; text-align: center; }
.game-head { display: flex; justify-content: center; margin-bottom: 16px; }
.game-q { font-size: 20px; line-height: 1.4; margin: 0 0 20px; letter-spacing: -.01em; }
.game-q .ign, .game-opt .ign { font-family: Arial, Helvetica, sans-serif; font-weight: 700; letter-spacing: -0.045em; }
.game-blurb { display: block; margin-top: 12px; font-size: 15px; color: var(--ink-2); font-style: italic; }
.game-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.game-opt { min-height: 52px; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); font: 600 15px var(--sans); cursor: pointer; transition: border-color .12s, background .12s; }
.game-opt:hover:not(:disabled) { border-color: var(--accent); }
.game-opt.right { background: var(--green-tint); border-color: var(--green); color: var(--green); }
.game-opt.wrong { background: var(--red-tint); border-color: var(--red); color: var(--red); }
.game-opt:disabled { cursor: default; }
.game-after { display: flex; gap: 10px; justify-content: center; align-items: center; margin-top: 20px; flex-wrap: wrap; min-height: 38px; }
.game-after .ok { color: var(--green); font-weight: 600; }
.game-after .no { color: var(--red); font-weight: 600; }
.hero-right canvas.sv { width: 100% !important; height: 380px !important; cursor: grab; }
@media (max-width: 560px) { .game-opts { grid-template-columns: 1fr; } }
.video-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.video-card { margin: 0; }
.video-card figcaption { display: flex; flex-direction: column; gap: 2px; margin-top: 8px; font-size: 13px; line-height: 1.35; }
@media (max-width: 860px) { .video-grid { grid-template-columns: 1fr; } }
/* Phones: date on its own line, names never break mid-word. */
@media (max-width: 560px) {
  .nc-list li:not(.nc-chain) { flex-wrap: wrap; row-gap: 6px; }
  .nc-list li:not(.nc-chain) .when { width: auto; flex: 1; }
  .nc-list .nc-status { order: 1; }
  .nc-list .nc-main { order: 2; flex-basis: 100%; }
  .nav a { white-space: nowrap; }
  .nav { overflow-x: auto; scrollbar-width: none; }
  .nc-list .nc-chain .when { display: none; }
  .nc-main b { overflow-wrap: normal; white-space: nowrap; }
  .nc-main { flex-wrap: wrap; }
  .nc-chain span.muted { padding-left: 0; }
}
