/* =====================================================================
   ROOKSPELL — design system
   "Midnight grimoire": a candlelit wooden chessboard in an ink-violet
   study. Warm objects (board, gold, parchment) against cool night air.
   Rarity colours are lifted directly from the game's card_data.gd.
   ===================================================================== */

:root {
  /* night */
  --ink-0: #0c0913;
  --ink-1: #130e1d;
  --ink-2: #1a1428;
  --ink-3: #241b38;
  --line:  #2b2143;
  --line-soft: #221a36;

  /* warm light */
  --parchment: #ecdcb4;
  --candle: #e9b04a;
  --candle-bright: #f6c96e;
  --candle-deep: #b97f2a;

  /* arcane */
  --arcane: #a678f0;
  --arcane-soft: #c5a5f7;
  --arcane-deep: #5d3f96;

  /* body text */
  --text: #c9bfd8;
  --dim: #9c92ae;
  --faint: #736887;

  /* the table */
  --wood-light: #e4ca96;
  --wood-dark: #8a5636;
  --wood-frame: #46291a;
  --wood-frame-hi: #6b4227;

  /* rarity — the exact RARITY colours from card_data.gd */
  --r-common: #a3abb8;
  --r-uncommon: #66cc76;
  --r-rare: #529af5;
  --r-epic: #b06eed;
  --r-legendary: #f7ad3d;

  /* type */
  --font-display: "Jacquard 12", "Pixelify Sans", serif;
  --font-pixel: "Pixelify Sans", "Trebuchet MS", sans-serif;
  --font-body: "Alegreya", Georgia, "Times New Roman", serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

  --container: 1120px;

  /* pixel-notched corners — the one shape language of the whole site */
  --px-corners: polygon(
    0 6px, 3px 6px, 3px 3px, 6px 3px, 6px 0,
    calc(100% - 6px) 0, calc(100% - 6px) 3px, calc(100% - 3px) 3px, calc(100% - 3px) 6px, 100% 6px,
    100% calc(100% - 6px), calc(100% - 3px) calc(100% - 6px), calc(100% - 3px) calc(100% - 3px), calc(100% - 6px) calc(100% - 3px), calc(100% - 6px) 100%,
    6px 100%, 6px calc(100% - 3px), 3px calc(100% - 3px), 3px calc(100% - 6px), 0 calc(100% - 6px)
  );
}

/* ------------------------------------------------ reset / base */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--ink-0);
  background-image:
    radial-gradient(1200px 700px at 76% -10%, rgba(93, 63, 150, .18), transparent 60%),
    radial-gradient(900px 620px at -8% 24%, rgba(233, 176, 74, .055), transparent 55%);
  background-repeat: no-repeat;
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1.08rem;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; }
h1, h2, h3, h4, h5, p { margin: 0; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
::selection { background: var(--arcane-deep); color: #fff; }

.container { width: min(100% - 2.5rem, var(--container)); margin-inline: auto; }

:focus-visible { outline: 2px solid var(--candle); outline-offset: 3px; border-radius: 2px; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 300;
  padding: .6rem 1rem; background: var(--ink-2);
  border: 1px solid var(--line); text-decoration: none;
  font-family: var(--font-mono); font-size: .85rem; color: var(--parchment);
}
.skip-link:focus { left: 12px; top: 12px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ------------------------------------------------ type */
.eyebrow {
  display: inline-flex; align-items: baseline; gap: .55em; flex-wrap: wrap;
  font-family: var(--font-mono); font-size: .78rem; letter-spacing: .04em;
  color: var(--candle); margin-bottom: 1rem;
}
.eyebrow .sep { color: var(--faint); }
.eyebrow .alt { color: var(--arcane-soft); }

.section-title {
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(2.5rem, 1.7rem + 3.6vw, 4.4rem);
  line-height: .98; letter-spacing: .01em;
  color: var(--parchment); text-wrap: balance;
  margin-bottom: 1rem;
}
.section-title--sm { font-size: clamp(2rem, 1.5rem + 2.2vw, 3rem); }

.section-lead {
  font-size: clamp(1.05rem, 1rem + .3vw, 1.19rem);
  color: var(--dim); max-width: 62ch; text-wrap: pretty;
}
.section-lead b, .section-lead strong { color: var(--text); font-weight: 700; }
.section-lead em { color: var(--candle-bright); font-style: italic; }

.center { text-align: center; }
.center .section-lead { margin-inline: auto; }
.center .eyebrow { justify-content: center; }
.muted { color: var(--dim); }
.small { font-size: .88rem; }
.text-candle { color: var(--candle); }
.text-arcane { color: var(--arcane-soft); }

.kbd {
  font-family: var(--font-mono); font-size: .82em;
  background: var(--ink-3); border: 1px solid var(--line); border-bottom-width: 2px;
  border-radius: 4px; padding: .08em .45em; color: var(--parchment);
}

/* ------------------------------------------------ nav */
.nav {
  position: sticky; top: 0; z-index: 100;
  border-bottom: 1px solid transparent;
  transition: background .3s, border-color .3s;
}
.nav.scrolled {
  background: color-mix(in srgb, var(--ink-0) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom-color: var(--line-soft);
}
.nav__inner { display: flex; align-items: center; gap: 1.4rem; padding-block: .8rem; position: relative; }

.brand { display: inline-flex; align-items: center; gap: .55rem; text-decoration: none; }
.brand img { width: 30px; height: 30px; image-rendering: pixelated; }
.brand span {
  font-family: var(--font-display); font-size: 1.6rem; line-height: 1;
  color: var(--parchment); letter-spacing: .02em; transform: translateY(1px);
}
.brand b { color: var(--candle); font-weight: 400; }

.nav__links { display: flex; gap: 1.3rem; margin-left: auto; }
.nav__links a {
  font-family: var(--font-mono); font-size: .82rem; letter-spacing: .02em;
  color: var(--dim); text-decoration: none; padding: .3rem 0;
  border-bottom: 1px solid transparent;
  transition: color .2s, border-color .2s;
}
.nav__links a:hover { color: var(--parchment); }
.nav__links a[aria-current="page"] { color: var(--candle); border-bottom-color: var(--candle); }

.nav__toggle { display: none; width: 42px; height: 42px; margin-left: auto; position: relative; }
.nav__toggle span,
.nav__toggle span::before,
.nav__toggle span::after {
  content: ""; position: absolute; left: 10px; width: 22px; height: 2px;
  background: var(--parchment); transition: transform .25s, top .25s, background .2s;
}
.nav__toggle span { top: 20px; }
.nav__toggle span::before { left: 0; top: -7px; }
.nav__toggle span::after { left: 0; top: 7px; }
.nav.open .nav__toggle span { background: transparent; }
.nav.open .nav__toggle span::before { top: 0; transform: rotate(45deg); }
.nav.open .nav__toggle span::after { top: 0; transform: rotate(-45deg); }

/* ------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .55rem;
  font-family: var(--font-mono); font-size: .88rem; font-weight: 600; letter-spacing: .01em;
  text-decoration: none; padding: .78rem 1.35rem; white-space: nowrap;
  transition: transform .18s, filter .18s, background .18s, border-color .18s, color .18s;
}
.btn svg { width: 17px; height: 17px; flex: none; }
.btn:active { transform: translateY(1px); }

.btn--primary {
  background: linear-gradient(180deg, var(--candle-bright), var(--candle) 55%, var(--candle-deep));
  color: #241503; clip-path: var(--px-corners);
}
.btn--primary:hover { filter: brightness(1.08); }

.btn--ghost {
  border: 1px solid var(--line); border-radius: 5px; color: var(--text);
  background: color-mix(in srgb, var(--ink-2) 55%, transparent);
}
.btn--ghost:hover { border-color: var(--arcane-deep); color: var(--parchment); background: var(--ink-2); }

.btn--lg { padding: .95rem 1.7rem; font-size: .94rem; }
.btn--sm { padding: .5rem .95rem; font-size: .79rem; }

.wrap-cta { display: flex; flex-wrap: wrap; gap: .9rem; }

/* ------------------------------------------------ sections & panels */
.section { padding-block: clamp(3.6rem, 3rem + 4vw, 6.5rem); }
/* the nav is sticky, so anchored sections must clear it rather than slide under */
:where(section, .legal h2)[id] { scroll-margin-top: 5.5rem; }
.section--tight { padding-top: 0; }
.section-head { max-width: 720px; margin-bottom: clamp(2rem, 4vw, 3.2rem); }
.section-head.center { margin-inline: auto; }

.divider {
  border: 0; height: 1px; margin: 0;
  background: linear-gradient(90deg, transparent, var(--line) 20%, var(--line) 80%, transparent);
}

.panel {
  background: linear-gradient(165deg, var(--ink-2), var(--ink-1) 72%);
  border: 1px solid var(--line-soft);
  border-radius: 7px;
}
.panel--pad { padding: clamp(1.3rem, 3vw, 2rem); }

.grid { display: grid; gap: 1.1rem; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* ------------------------------------------------ hero */
.hero { position: relative; padding-block: clamp(2.6rem, 2rem + 4vw, 5rem) clamp(3.4rem, 3rem + 4vw, 6rem); overflow: hidden; }
.hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: conic-gradient(from 0deg,
    rgba(236, 220, 180, .022) 90deg, transparent 90deg 180deg,
    rgba(236, 220, 180, .022) 180deg 270deg, transparent 270deg);
  background-size: 116px 116px;
  mask-image: radial-gradient(820px 540px at 68% 42%, #000, transparent 74%);
  -webkit-mask-image: radial-gradient(820px 540px at 68% 42%, #000, transparent 74%);
}
.hero__grid {
  position: relative;
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
  gap: clamp(2rem, 5vw, 4rem); align-items: center;
}

.hero__badge {
  display: inline-flex; align-items: center; gap: .55rem;
  font-family: var(--font-mono); font-size: .77rem; letter-spacing: .04em;
  color: var(--arcane-soft); text-decoration: none;
  border: 1px solid var(--line); border-radius: 999px;
  padding: .38rem .95rem; margin-bottom: 1.4rem;
  background: color-mix(in srgb, var(--ink-2) 60%, transparent);
  transition: border-color .2s, color .2s;
}
a.hero__badge:hover { border-color: var(--arcane-deep); color: var(--parchment); }
.hero__badge .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--r-uncommon); box-shadow: 0 0 8px var(--r-uncommon);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: .4; } }

.hero__title {
  font-family: var(--font-display); font-weight: 400;
  /* Jacquard 12 is a wide bitmap face: ROOKSPELL must fit the hero column
     (~554px at the 1120px container) without clipping, so the cap is low. */
  font-size: clamp(3.1rem, 1.8rem + 6vw, 5.4rem);
  line-height: .9; letter-spacing: .015em;
  margin: 0 0 .5rem -.03em;
  background: linear-gradient(172deg, #f9f0d8 28%, var(--candle) 76%, var(--candle-deep));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 3px 0 rgba(0, 0, 0, .45)) drop-shadow(0 0 28px rgba(233, 176, 74, .2));
}
.hero__tagline {
  font-family: var(--font-body); font-style: italic;
  font-size: clamp(1.25rem, 1.05rem + 1vw, 1.72rem);
  color: var(--arcane-soft); margin-bottom: 1.05rem; text-wrap: balance;
}
.hero__lead { color: var(--dim); max-width: 52ch; margin-bottom: 1.7rem; text-wrap: pretty; }
.hero__lead b { color: var(--text); font-weight: 700; }

.hero__facts { display: flex; flex-wrap: wrap; gap: .5rem .55rem; margin: 1.6rem 0 0; padding: 0; list-style: none; }
.hero__facts li {
  display: inline-flex; align-items: center; gap: .5rem;
  font-family: var(--font-mono); font-size: .75rem;
  color: var(--dim);
  border: 1px solid var(--line-soft); border-radius: 999px;
  padding: .34rem .8rem;
  background: color-mix(in srgb, var(--ink-1) 70%, transparent);
}
.hero__facts svg { width: 14px; height: 14px; flex: none; color: var(--candle); }

/* -------- the table: board + drawn card -------- */
.stage { position: relative; margin-inline: auto; width: min(100%, 460px); }
.stage::before {
  content: ""; position: absolute; inset: -14% -10%; pointer-events: none;
  background: radial-gradient(58% 52% at 50% 46%, rgba(233, 176, 74, .14), transparent 70%);
}

.board-frame {
  position: relative;
  background: linear-gradient(160deg, var(--wood-frame-hi), var(--wood-frame) 55%);
  border: 1px solid #2a1408; border-radius: 9px;
  padding: clamp(15px, 3.4vw, 23px);
  box-shadow:
    inset 0 1px 0 rgba(255, 220, 160, .14),
    0 18px 46px -18px rgba(0, 0, 0, .78),
    0 4px 14px rgba(0, 0, 0, .4);
}
.board {
  display: grid; grid-template-columns: repeat(8, 1fr);
  aspect-ratio: 1; border-radius: 3px; overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(30, 14, 4, .55), inset 0 2px 10px rgba(30, 14, 4, .35);
}
.sq { position: relative; }
.sq.light { background: var(--wood-light); }
.sq.dark  { background: var(--wood-dark); }
.sq.last::after {
  content: ""; position: absolute; inset: 0;
  background: rgba(233, 176, 74, .3);
  box-shadow: inset 0 0 0 2px rgba(233, 176, 74, .55);
}
.sq.hint::after {
  content: ""; position: absolute; inset: 33%;
  border-radius: 50%; background: rgba(36, 20, 6, .34);
}
.sq.cast::before {
  content: ""; position: absolute; inset: -4px; z-index: 5; pointer-events: none;
  border-radius: 4px;
  box-shadow: 0 0 0 2px var(--arcane), 0 0 24px 5px rgba(166, 120, 240, .55);
  animation: castburst .95s ease-out forwards;
}
@keyframes castburst {
  0%   { opacity: 0; transform: scale(.6); }
  28%  { opacity: 1; }
  100% { opacity: 0; transform: scale(1.28); }
}

.piece {
  position: absolute; inset: 7%; z-index: 2; pointer-events: none;
  transition: transform .45s cubic-bezier(.35, .9, .3, 1);
}
.piece svg { width: 100%; height: 100%; }
.piece.w { color: #f6eed7; filter: drop-shadow(1px 1.5px 0 rgba(26, 10, 2, .5)); }
.piece.b { color: #2a1f3c; filter: drop-shadow(1px 1.5px 0 rgba(244, 228, 190, .28)); }

.board-caption {
  display: flex; justify-content: space-between; align-items: baseline; gap: 1rem;
  margin-top: .75rem;
  font-family: var(--font-mono); font-size: .77rem; color: rgba(236, 220, 180, .75);
}
.board-caption .live { color: var(--candle-bright); }

.draw-card {
  position: absolute; right: -4%; bottom: -8%; z-index: 10;
  width: 132px; opacity: 0; pointer-events: none;
  transform: translateY(26px) rotate(9deg) scale(.7);
  transition: transform .58s cubic-bezier(.2, 1.1, .3, 1), opacity .4s;
}
.draw-card.show { opacity: 1; transform: translateY(0) rotate(4deg) scale(1); }
.draw-card .spell__in { padding: .75rem .7rem .8rem; gap: .4rem; }
.draw-card .spell__art { width: 40px; height: 40px; margin-inline: auto; }
.draw-card .spell__name { font-size: .92rem; text-align: center; line-height: 1.1; }
.draw-card .rarity { display: block; text-align: center; }

/* ------------------------------------------------ spell cards */
.spell {
  --rc: var(--r-common);
  position: relative; display: block;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, .45));
  transition: transform .2s, filter .25s;
}
.spell__in {
  clip-path: var(--px-corners);
  background: linear-gradient(170deg, color-mix(in srgb, var(--rc) 15%, var(--ink-2)), var(--ink-1) 64%);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--rc) 52%, transparent);
  padding: 1rem 1rem 1.05rem;
  display: flex; flex-direction: column; gap: .5rem;
  height: 100%;
}
.spell:hover {
  transform: translateY(-4px);
  filter: drop-shadow(0 11px 22px rgba(0, 0, 0, .5))
          drop-shadow(0 0 15px color-mix(in srgb, var(--rc) 40%, transparent));
}
.spell--common    { --rc: var(--r-common); }
.spell--uncommon  { --rc: var(--r-uncommon); }
.spell--rare      { --rc: var(--r-rare); }
.spell--epic      { --rc: var(--r-epic); }
.spell--legendary { --rc: var(--r-legendary); }

.spell__top { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.spell__art {
  width: 44px; height: 44px; flex: none;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--rc) 14%, var(--ink-3));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--rc) 40%, transparent);
  clip-path: var(--px-corners);
  color: color-mix(in srgb, var(--rc) 72%, #ffffff);
}
.spell__art svg { width: 24px; height: 24px; }

.rarity {
  font-family: var(--font-mono); font-size: .63rem; font-weight: 600;
  letter-spacing: .09em; text-transform: uppercase;
  color: color-mix(in srgb, var(--rc) 78%, #ffffff);
}
.rarity::before { content: "◆ "; font-size: .56rem; }

.spell__name { font-family: var(--font-pixel); font-weight: 600; font-size: 1.13rem; line-height: 1.15; color: var(--parchment); }
.spell__cat  { font-family: var(--font-mono); font-size: .64rem; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
.spell__desc { font-size: .92rem; line-height: 1.5; color: var(--dim); }
.spell.is-hidden { display: none; }

.deck-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(238px, 1fr)); gap: 1rem; }

/* ------------------------------------------------ the odds ladder (real draw weights) */
.ladder { display: grid; gap: .55rem; }
.ladder__row {
  --rc: var(--r-common);
  display: grid; grid-template-columns: 8.5rem 1fr auto; align-items: center; gap: 1rem;
  font-family: var(--font-mono); font-size: .82rem;
}
.ladder__row--uncommon  { --rc: var(--r-uncommon); }
.ladder__row--rare      { --rc: var(--r-rare); }
.ladder__row--epic      { --rc: var(--r-epic); }
.ladder__row--legendary { --rc: var(--r-legendary); }
.ladder__name { display: inline-flex; align-items: center; gap: .55rem; color: var(--text); }
.ladder__name i {
  width: 10px; height: 10px; flex: none; font-style: normal; border-radius: 2px;
  background: var(--rc); box-shadow: 0 0 9px color-mix(in srgb, var(--rc) 70%, transparent);
}
.ladder__bar { height: 9px; background: var(--ink-3); border-radius: 999px; overflow: hidden; }
.ladder__bar span {
  display: block; height: 100%; width: var(--w, 0%);
  background: linear-gradient(90deg, color-mix(in srgb, var(--rc) 55%, transparent), var(--rc));
  border-radius: 999px;
  transition: width .9s cubic-bezier(.2, .8, .3, 1);
}
.ladder__pct { color: var(--dim); min-width: 4.2rem; text-align: right; }
.ladder__pct b { color: var(--parchment); font-weight: 600; }

.ladder-toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 3px; gap: 2px; margin-bottom: 1.4rem; }
.ladder-toggle button {
  font-family: var(--font-mono); font-size: .76rem; color: var(--dim);
  padding: .35rem .95rem; border-radius: 999px; transition: background .2s, color .2s;
}
.ladder-toggle button[aria-pressed="true"] { background: var(--candle); color: var(--ink-0); font-weight: 600; }

/* ------------------------------------------------ feature lists */
.feature-split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(2rem, 5vw, 4.5rem); align-items: center; }
.feature-split--top { align-items: start; }

.feat-list { display: grid; gap: 1.15rem; margin-top: 1.6rem; }
.feat-item { display: flex; gap: .95rem; align-items: flex-start; }
.feat-item .ico {
  flex: none; width: 42px; height: 42px; display: grid; place-items: center;
  background: var(--ink-2); clip-path: var(--px-corners);
  box-shadow: inset 0 0 0 1px var(--line); color: var(--candle);
}
.feat-item .ico svg { width: 20px; height: 20px; }
.feat-item :is(h3,h4) { font-family: var(--font-body); font-weight: 700; font-size: 1.07rem; color: var(--parchment); margin-bottom: .12rem; }
.feat-item p { font-size: .94rem; color: var(--dim); }

/* the loop: three beats of one turn */
.loop { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.1rem; }
.loop-step { padding: 1.6rem 1.5rem 1.5rem; }
.loop-step .beat {
  display: inline-block; margin-bottom: .85rem; padding-bottom: .3rem;
  font-family: var(--font-mono); font-size: .75rem; font-weight: 600; color: var(--candle);
  border-bottom: 1px solid color-mix(in srgb, var(--candle) 40%, transparent);
}
.loop-step :is(h3,h4) { font-family: var(--font-pixel); font-weight: 600; font-size: 1.26rem; color: var(--parchment); margin-bottom: .45rem; }
.loop-step p { font-size: .95rem; color: var(--dim); }

/* ------------------------------------------------ modes & variants */
.mode-card { padding: 1.5rem 1.4rem; display: flex; flex-direction: column; gap: .5rem; }
.mode-card .ico {
  width: 46px; height: 46px; display: grid; place-items: center; margin-bottom: .35rem;
  background: var(--ink-3); clip-path: var(--px-corners); color: var(--candle);
}
.mode-card .ico svg { width: 23px; height: 23px; }
.mode-card :is(h3,h4) { font-family: var(--font-pixel); font-weight: 600; font-size: 1.2rem; color: var(--parchment); }
.mode-card p { font-size: .93rem; color: var(--dim); }
.mode-card .tag { font-family: var(--font-mono); font-size: .66rem; letter-spacing: .07em; text-transform: uppercase; color: var(--arcane-soft); }

.variants { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.variant { padding: 1.3rem 1.25rem; border-left: 3px solid var(--vc, var(--candle)); }
.variant .vtag {
  display: block; margin-bottom: .5rem;
  font-family: var(--font-mono); font-size: .63rem; letter-spacing: .09em; text-transform: uppercase;
  color: var(--vc, var(--candle));
}
.variant :is(h4,h5) { font-family: var(--font-pixel); font-weight: 600; font-size: 1.08rem; color: var(--parchment); margin-bottom: .3rem; }
.variant p { font-size: .89rem; color: var(--dim); }

/* elo slider */
.elo-card { text-align: center; padding: clamp(1.6rem, 4vw, 2.4rem); position: relative; overflow: hidden; }
.elo-card::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(320px 210px at 50% 0%, rgba(166, 120, 240, .13), transparent 70%);
}
.elo-num { font-family: var(--font-display); font-size: clamp(3.6rem, 3rem + 3vw, 5.4rem); color: var(--parchment); line-height: 1; }
.elo-tier { font-family: var(--font-pixel); font-weight: 600; font-size: 1.14rem; color: var(--candle); margin-top: .15rem; }
.elo-desc { font-size: .94rem; color: var(--dim); max-width: 40ch; margin: .7rem auto 1.4rem; min-height: 4.5em; }

.slider {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 8px; border-radius: 999px; outline-offset: 6px;
  background: linear-gradient(90deg, var(--r-uncommon), var(--candle) 55%, #d0543a);
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 21px; height: 21px; background: var(--parchment);
  border: 3px solid var(--ink-0); border-radius: 4px;
  box-shadow: 0 0 0 2px var(--candle), 0 2px 8px rgba(0, 0, 0, .5); cursor: grab;
}
.slider::-moz-range-thumb {
  width: 17px; height: 17px; background: var(--parchment);
  border: 3px solid var(--ink-0); border-radius: 4px;
  box-shadow: 0 0 0 2px var(--candle), 0 2px 8px rgba(0, 0, 0, .5); cursor: grab;
}
.slider-scale { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: .71rem; color: var(--faint); margin-top: .6rem; }

/* ------------------------------------------------ glance list */
.glance { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem 2rem; }
.glance li { display: flex; gap: .7rem; align-items: flex-start; font-size: .97rem; color: var(--dim); }
.glance li b { color: var(--text); font-weight: 700; }
.glance .tick { flex: none; width: 19px; height: 19px; color: var(--r-uncommon); margin-top: .18em; }
.glance .tick svg { width: 100%; height: 100%; }

/* ------------------------------------------------ tables */
.sysreq { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.1rem; }
.data-table { width: 100%; border-collapse: collapse; font-size: .94rem; }
.data-table caption {
  text-align: left; padding-bottom: .85rem;
  font-family: var(--font-mono); font-size: .79rem; font-weight: 600; letter-spacing: .04em; color: var(--candle);
}
.data-table th {
  text-align: left; vertical-align: top; width: 36%;
  font-family: var(--font-mono); font-size: .76rem; font-weight: 600; color: var(--faint);
  padding: .55rem 1rem .55rem 0; border-bottom: 1px solid var(--line-soft);
}
.data-table td { padding: .55rem 0; color: var(--dim); border-bottom: 1px solid var(--line-soft); }
.data-table tr:last-child th, .data-table tr:last-child td { border-bottom: none; }

.table-scroll { overflow-x: auto; }

.note {
  display: flex; gap: .7rem; align-items: flex-start; max-width: 76ch;
  font-size: .87rem; color: var(--faint); margin-top: 1.4rem;
}
.note svg { flex: none; width: 17px; height: 17px; margin-top: .15em; color: var(--arcane-soft); }
.note a { color: var(--arcane-soft); }

/* ------------------------------------------------ faq */
.faq { max-width: 800px; margin-inline: auto; display: grid; gap: .65rem; }
.qa { background: linear-gradient(165deg, var(--ink-2), var(--ink-1)); border: 1px solid var(--line-soft); border-radius: 7px; overflow: hidden; }
.qa summary {
  list-style: none; cursor: pointer;
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: 1.05rem 1.3rem;
  font-family: var(--font-body); font-weight: 700; font-size: 1.05rem; color: var(--parchment);
}
.qa summary::-webkit-details-marker { display: none; }
.qa .q-ico { flex: none; width: 14px; height: 14px; color: var(--candle); transition: transform .25s; }
.qa .q-ico svg { width: 100%; height: 100%; }
.qa[open] .q-ico { transform: rotate(45deg); }
.qa__body { padding: 0 1.3rem 1.2rem; max-width: 72ch; font-size: .96rem; color: var(--dim); }
.qa__body b { color: var(--text); }
.qa__body a { color: var(--arcane-soft); }
.qa__body p + p { margin-top: .7rem; }

/* ------------------------------------------------ final cta */
.cta-final {
  position: relative; text-align: center; overflow: hidden;
  padding: clamp(3rem, 6vw, 5rem) clamp(1.4rem, 4vw, 3rem);
  background:
    radial-gradient(560px 320px at 50% 0%, rgba(233, 176, 74, .11), transparent 70%),
    linear-gradient(170deg, var(--ink-2), var(--ink-1));
  border: 1px solid var(--line-soft); border-radius: 11px;
}
.cta-final h2 {
  font-family: var(--font-display); font-weight: 400; line-height: .95;
  font-size: clamp(2.8rem, 2rem + 4.5vw, 5.2rem);
  color: var(--parchment); margin-bottom: 1rem;
}
.cta-final > p { color: var(--dim); max-width: 54ch; margin: 0 auto 1.8rem; }
.cta-final .wrap-cta { justify-content: center; }

/* ------------------------------------------------ footer */
.footer { border-top: 1px solid var(--line-soft); background: var(--ink-1); padding: clamp(2.4rem, 5vw, 3.6rem) 0 2rem; }
.footer__grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 2rem; margin-bottom: 2.4rem; }
.footer__brand p { margin-top: .9rem; font-size: .91rem; color: var(--faint); max-width: 36ch; }
.footer :is(h2,h5) {
  font-family: var(--font-mono); font-size: .71rem; font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase; color: var(--candle); margin-bottom: .85rem;
}
.footer__grid a { display: block; text-decoration: none; font-size: .91rem; color: var(--dim); padding-block: .22rem; }
.footer__grid a:hover { color: var(--parchment); }
.footer__bottom {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: .8rem 2rem;
  border-top: 1px solid var(--line-soft); padding-top: 1.4rem;
  font-size: .83rem; color: var(--faint);
}
.footer__bottom a { color: var(--dim); }
.footer__legal { display: flex; flex-wrap: wrap; gap: .3rem .9rem; }
.footer .heart { color: #d0543a; display: inline; vertical-align: -2px; }

/* ------------------------------------------------ ambience */
.motes { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.mote { position: absolute; bottom: -12px; border-radius: 1px; background: currentColor; opacity: 0; animation: rise linear infinite; }
@keyframes rise {
  0%   { transform: translateY(0) translateX(0); opacity: 0; }
  12%  { opacity: .5; }
  85%  { opacity: .22; }
  100% { transform: translateY(-88vh) translateX(3vw); opacity: 0; }
}

/* ------------------------------------------------ reveal on scroll */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity .7s ease, transform .7s cubic-bezier(.2, .7, .3, 1); }
.reveal.in { opacity: 1; transform: none; }
.d1 { transition-delay: .08s; }
.d2 { transition-delay: .16s; }
.d3 { transition-delay: .24s; }

/* ------------------------------------------------ subpages */
.page-hero { padding-block: clamp(2.4rem, 4vw, 4rem) clamp(1.4rem, 3vw, 2.4rem); }
.back-link {
  display: inline-flex; align-items: center; gap: .5rem; margin-bottom: 1.5rem;
  font-family: var(--font-mono); font-size: .79rem; text-decoration: none; color: var(--dim);
}
.back-link svg { width: 15px; height: 15px; }
.back-link:hover { color: var(--parchment); }

/* codex controls */
.codex-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: 1.5rem; }
.chip {
  --rc: var(--candle);
  font-family: var(--font-mono); font-size: .77rem; color: var(--dim);
  border: 1px solid var(--line); border-radius: 999px; padding: .42rem .95rem;
  transition: color .2s, border-color .2s, background .2s;
}
.chip:hover { color: var(--parchment); border-color: var(--arcane-deep); }
.chip[aria-pressed="true"] { background: var(--rc); border-color: var(--rc); color: var(--ink-0); font-weight: 600; }
.chip .count { opacity: .65; margin-left: .35em; }
.chip--common    { --rc: var(--r-common); }
.chip--uncommon  { --rc: var(--r-uncommon); }
.chip--rare      { --rc: var(--r-rare); }
.chip--epic      { --rc: var(--r-epic); }
.chip--legendary { --rc: var(--r-legendary); }
.codex-meter { margin-left: auto; font-family: var(--font-mono); font-size: .77rem; color: var(--faint); }
.codex-meter b { color: var(--parchment); }

.search {
  font-family: var(--font-mono); font-size: .84rem; width: min(100%, 280px);
  background: var(--ink-2); border: 1px solid var(--line); border-radius: 6px;
  color: var(--parchment); padding: .52rem .9rem;
}
.search::placeholder { color: var(--faint); }

.empty-state { text-align: center; padding: 3rem 1rem; color: var(--faint); font-family: var(--font-mono); font-size: .9rem; }

/* ------------------------------------------------ legal pages */
.legal { max-width: 760px; margin-inline: auto; padding-bottom: clamp(3rem, 6vw, 5rem); }
.legal h1 { font-family: var(--font-display); font-weight: 400; font-size: clamp(2.6rem, 2rem + 3vw, 4rem); color: var(--parchment); margin-bottom: .3rem; }
.legal .updated { font-family: var(--font-mono); font-size: .79rem; color: var(--faint); margin-bottom: 2rem; }
.legal .lead { font-size: 1.09rem; color: var(--text); }
.legal h2 {
  font-family: var(--font-body); font-weight: 700; font-size: 1.32rem; color: var(--parchment);
  margin: 2.6rem 0 .7rem; padding-top: 1.7rem; border-top: 1px solid var(--line-soft);
}
.legal h2 .sec-no { font-family: var(--font-mono); font-size: .82rem; font-weight: 600; color: var(--candle); margin-right: .7rem; }
.legal h3 { font-family: var(--font-body); font-weight: 700; font-size: 1.06rem; color: var(--text); margin: 1.6rem 0 .5rem; }
.legal p, .legal li { color: var(--dim); font-size: .99rem; }
.legal p + p { margin-top: .8rem; }
.legal ul { margin: .8rem 0 0; padding-left: 1.25rem; display: grid; gap: .45rem; }
.legal li::marker { color: var(--faint); }
.legal a { color: var(--arcane-soft); }
.legal b, .legal strong { color: var(--text); font-weight: 700; }
.legal .summary-box {
  margin: 1.5rem 0 .5rem; padding: 1.15rem 1.35rem;
  border-left: 3px solid var(--candle); border-radius: 0 7px 7px 0;
  background: var(--ink-2); font-size: .95rem;
}
.legal .summary-box p { color: var(--text); }
.legal .summary-box .h { font-family: var(--font-mono); font-size: .71rem; letter-spacing: .09em; text-transform: uppercase; color: var(--candle); display: block; margin-bottom: .4rem; }
.legal .data-table { margin-top: 1rem; }
.legal .data-table th { width: 30%; }

.toc { margin: 2rem 0 0; padding: 1.2rem 1.4rem; background: var(--ink-1); border: 1px solid var(--line-soft); border-radius: 7px; }
.toc h2 { all: unset; display: block; font-family: var(--font-mono); font-size: .71rem; letter-spacing: .1em; text-transform: uppercase; color: var(--candle); margin-bottom: .8rem; }
.toc ol { margin: 0; padding-left: 1.3rem; display: grid; gap: .35rem; }
.toc li { font-size: .92rem; }
.toc li::marker { font-family: var(--font-mono); font-size: .8rem; color: var(--faint); }
.toc a { color: var(--dim); text-decoration: none; }
.toc a:hover { color: var(--parchment); text-decoration: underline; text-underline-offset: 3px; }

/* ------------------------------------------------ responsive */
@media (max-width: 980px) {
  .hero__grid { grid-template-columns: 1fr; }
  .stage { width: min(100%, 420px); }
  .feature-split { grid-template-columns: 1fr; }
  .loop { grid-template-columns: 1fr; }
  .variants { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cols-3, .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer__grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 700px) {
  body { font-size: 1.04rem; }
  .nav__toggle { display: block; }
  .nav__links {
    display: none; position: absolute; left: 0; right: 0; top: 100%;
    flex-direction: column; gap: 0;
    background: var(--ink-0); border-bottom: 1px solid var(--line);
    padding: .5rem 1.25rem 1.1rem; margin-left: 0;
  }
  .nav__links a { padding: .7rem 0; font-size: .95rem; }
  .nav.open .nav__links { display: flex; }
  .nav.open { background: var(--ink-0); }
  .nav__cta { display: none; }

  .glance, .sysreq, .cols-2, .cols-3, .cols-4, .variants { grid-template-columns: 1fr; }
  .footer__grid { grid-template-columns: 1fr; gap: 1.5rem; }
  .draw-card { width: 106px; right: 0; }
  .ladder__row { grid-template-columns: 6.6rem 1fr auto; gap: .7rem; font-size: .76rem; }
  .codex-meter { margin-left: 0; width: 100%; }
}

/* ------------------------------------------------ reduced motion */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .reveal { opacity: 1; transform: none; }
  .motes { display: none; }
}

/* ------------------------------------------------ print (legal pages) */
@media print {
  body { background: #fff; color: #000; }
  .nav, .footer, .motes, .back-link, .toc { display: none; }
  .legal h1, .legal h2, .legal h3 { color: #000; }
  .legal p, .legal li { color: #222; }
  .legal a { color: #000; text-decoration: underline; }
}
