/* ==========================================================================
   Gridforged — codex-plate storybook theme.
   The art is illustrated bestiary plates: bold flat color, big silhouette,
   minimal interior detail. The site echoes that — thick outlined cards,
   parchment-cream surfaces on a deep indigo page, vivid tribe accents.
   ========================================================================== */

:root {
  /* Page — tuned from game's ForgeSurfaceTheme + lobby/hero art */
  --bg: #15101f;
  --bg-2: #1d1530;
  --bg-deep: #0f0a1a;
  --ink: #1b1430;             /* card border / heavy outline */
  --ink-soft: rgba(27, 20, 48, 0.55);

  /* Parchment / paper surfaces — match game COLOR_PARCHMENT */
  --paper: #ede4cc;
  --paper-2: #e3d6b1;
  --paper-deep: #cbb78a;
  --paper-line: rgba(60, 38, 18, 0.18);

  /* Text — match game GlobalTheme primary text */
  --text: #ede9d1;
  --text-mid: #d4c4a0;
  --text-soft: #ada082;
  --text-on-paper: #2a1c0c;
  --text-on-paper-soft: #5a4326;
  --white: #fff;

  /* Accents — palette of the game's tier card frames + fire/poison vfx */
  --ember: #ff6e36;           /* burn / dragon */
  --ember-deep: #c0431a;
  --ember-glow: rgba(255, 110, 54, 0.45);
  --gold: #f2b84d;            /* ForgeSurfaceTheme accent gold */
  --gold-deep: #c49543;       /* ForgeSurfaceTheme border gold */
  --leaf: #58d68d;            /* tier-2 card frame green */
  --leaf-deep: #2f7a45;
  --rime: #5dade2;            /* tier-3 card frame blue */
  --rime-deep: #1d6072;
  --bruise: #af7ac5;          /* tier-4 card frame purple */
  --bruise-deep: #4d2580;
  --bone: #c9bfa8;            /* neutral */
  --bone-deep: #645b46;

  /* Color hazes — overlays + radial accents */
  --ember-haze: rgba(255, 110, 54, 0.10);
  --gold-haze: rgba(242, 184, 77, 0.18);
  --bruise-haze: rgba(175, 122, 197, 0.10);
  --rime-haze: rgba(93, 173, 226, 0.08);
  --leaf-haze: rgba(88, 214, 141, 0.08);

  /* Tribe parchment-card gradients (used on tribe cards, unit plates, spotlights, ftu) */
  --tribe-bg-Sentinel: linear-gradient(180deg, #fcf0d2, #f1d999);
  --tribe-bg-Beast:    linear-gradient(180deg, #e6f1cf, #b9d59a);
  --tribe-bg-Dragon:   linear-gradient(180deg, #f8d3bd, #e89070);
  --tribe-bg-Mech:     linear-gradient(180deg, #d4ebef, #93cad2);
  --tribe-bg-Undead:   linear-gradient(180deg, #ddc9ee, #b59ad6);
  --tribe-bg-Neutral:  linear-gradient(180deg, #ece4ce, #c8b994);

  /* Boss card dark gradient */
  --boss-bg: linear-gradient(180deg, #2c1830, #16091c);

  /* Tier frame colors. Game uses bright tones against a dark UI; we darken
     them so they read against the parchment paper background. */
  --tier-1: #8a93a3;  /* grey/steel */
  --tier-2: #3aa84d;  /* green */
  --tier-3: #2f6cd9;  /* blue */
  --tier-4: #8636cf;  /* purple */

  /* Tribe theming knobs (overridden per tribe section) */
  --tribe: var(--ember);
  --tribe-deep: var(--ember-deep);

  /* Layout */
  --max-w: 1240px;
  --radius-sm: 6px;
  --radius: 12px;
  --radius-lg: 20px;

  /* Strokes — codex-plate look */
  --stroke: 3px;
  --stroke-thick: 4px;

  /* Type stacks */
  --display: "Cinzel Decorative", "Cinzel", "Trajan Pro", Georgia, serif;
  --serif: "Spectral", "IM Fell English", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  /* Shadows */
  --shadow-card: 0 6px 0 var(--ink), 0 14px 30px -10px rgba(0, 0, 0, 0.55);
  --shadow-soft: 0 14px 30px -10px rgba(0, 0, 0, 0.45);
}

/* ------ Reset / base ------ */

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  background-image:
    radial-gradient(1200px 600px at 70% -10%, var(--ember-haze), transparent 60%),
    radial-gradient(900px 500px at -10% 20%, var(--bruise-haze), transparent 60%),
    radial-gradient(1100px 700px at 110% 80%, var(--rime-haze), transparent 60%);
  color: var(--text);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  min-height: 100vh;
}

img { max-width: 100%; display: block; }

a { color: var(--gold); text-decoration: none; transition: color .15s ease; }
a:hover { color: var(--ember); }

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

.skip-link {
  position: absolute; left: -9999px; top: 0; padding: 10px 14px;
  background: var(--gold); color: var(--text-on-paper); font-weight: 700; z-index: 1000;
}
.skip-link:focus { left: 16px; top: 16px; }

.container { max-width: var(--max-w); margin: 0 auto; padding: 0 24px; }

/* ------ Type ------ */

h1, h2, h3, h4 {
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.1;
  margin: 0 0 0.5em;
  color: var(--text);
}
h1.display { font-size: clamp(2.6rem, 6vw, 4.6rem); letter-spacing: 0.01em; }
h2 { font-size: clamp(1.9rem, 3.4vw, 2.7rem); }
h3 { font-size: 1.3rem; letter-spacing: 0.02em; }
h4 { font-size: 1rem; font-family: var(--sans); text-transform: uppercase; letter-spacing: 0.18em; color: var(--text-mid); }

p { margin: 0 0 1em; color: var(--text-mid); }

.eyebrow {
  font-family: var(--sans);
  text-transform: uppercase;
  letter-spacing: 0.24em;
  font-size: 0.78rem;
  color: var(--gold);
  margin: 0 0 14px;
  font-weight: 600;
}

.accent { color: var(--ember); }
.lede { font-size: clamp(1.05rem, 1.4vw, 1.22rem); color: var(--text-mid); max-width: 60ch; }
.section-sub { color: var(--text-soft); max-width: 62ch; margin-left: auto; margin-right: auto; }

/* ------ Header / nav ------ */

.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(12, 8, 32, 0.85);
  backdrop-filter: blur(10px) saturate(140%);
  -webkit-backdrop-filter: blur(10px) saturate(140%);
  border-bottom: var(--stroke) solid var(--ink);
  box-shadow: 0 6px 0 rgba(0,0,0,0.25);
}

.nav {
  display: flex; align-items: center; justify-content: space-between;
  height: 72px; gap: 24px;
}

.brand {
  display: flex; align-items: center; gap: 12px;
  color: var(--text); font-family: var(--display); font-weight: 700;
}
.brand-logo {
  height: 44px; width: auto; display: block;
  filter: drop-shadow(0 2px 0 rgba(0,0,0,0.5)) drop-shadow(0 0 12px rgba(255, 110, 54, 0.18));
}
.footer-brand .brand-logo { height: 56px; }
@media (max-width: 760px) {
  .brand-logo { height: 36px; }
  .footer-brand .brand-logo { height: 44px; }
}

.nav-links { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.nav-links a {
  color: var(--text-mid); font-family: var(--sans);
  font-weight: 600; font-size: 0.92rem; letter-spacing: 0.06em;
  text-transform: uppercase;
}
.nav-links a:hover, .nav-links a.is-active { color: var(--text); }
.nav-links a.is-active { border-bottom: 2px solid var(--ember); padding-bottom: 2px; }

.nav-cta {
  padding: 10px 18px;
  border: var(--stroke) solid var(--ink);
  background: var(--gold);
  color: var(--text-on-paper) !important;
  border-radius: 999px;
  box-shadow: 0 4px 0 var(--ink);
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.nav-cta:hover {
  background: var(--ember); color: var(--text-on-paper) !important;
  transform: translateY(-2px);
  box-shadow: 0 6px 0 var(--ink);
}

/* Codex sub-nav (codex hub + codex pages) */
.codex-subnav {
  background:
    linear-gradient(180deg, var(--bg-deep), rgba(15, 10, 26, 0.7)),
    radial-gradient(900px 80px at 50% 0%, var(--gold-haze), transparent 70%);
  border-bottom: 1px solid rgba(242, 184, 77, 0.25);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.4);
}
.codex-subnav .container {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  padding-top: 12px; padding-bottom: 12px;
}
.codex-subnav a {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 16px; border-radius: 999px;
  font-family: var(--sans); font-weight: 600; font-size: 0.84rem;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-mid); border: 1.5px solid transparent;
  transition: color .15s ease, background .15s ease, border-color .15s ease;
}
.codex-subnav a:hover {
  color: var(--text);
  background: rgba(242, 184, 77, 0.08);
  border-color: rgba(242, 184, 77, 0.3);
}
.codex-subnav a.is-active {
  color: var(--text-on-paper);
  background: var(--gold);
  border-color: var(--gold-deep);
  box-shadow: 0 2px 0 var(--ink);
}

@media (max-width: 760px) {
  .nav-links { gap: 12px; }
  .nav-links a:not(.nav-cta) { font-size: 0.82rem; }
}

/* ------ Buttons ------ */

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 14px 26px; border-radius: 999px;
  font-family: var(--sans); font-weight: 700; font-size: 0.95rem;
  letter-spacing: 0.12em; text-transform: uppercase;
  border: var(--stroke) solid var(--ink); cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease, color .15s ease;
}
.btn-primary {
  background: var(--ember); color: #fff;
  box-shadow: 0 5px 0 var(--ink), 0 14px 24px -10px var(--ember-glow);
  text-shadow: 0 2px 0 var(--ember-deep);
}
.btn-primary:hover {
  transform: translateY(-2px);
  background: var(--gold); color: var(--text-on-paper);
  text-shadow: none;
  box-shadow: 0 7px 0 var(--ink), 0 18px 28px -10px var(--ember-glow);
}
.btn-ghost {
  background: transparent; color: var(--text);
  border-color: var(--text-mid);
  box-shadow: 0 4px 0 var(--ink-soft);
}
.btn-ghost:hover {
  background: var(--text); color: var(--text-on-paper);
  border-color: var(--ink);
  box-shadow: 0 6px 0 var(--ink);
}

/* ------ Hero ------ */

.hero {
  position: relative;
  min-height: clamp(560px, 88vh, 880px);
  display: flex; align-items: center;
  overflow: hidden; isolation: isolate;
}
.hero-bg {
  position: absolute; inset: 0; z-index: -3;
  background-image: url("../assets/art/hero-bg.png");
  background-size: cover;
  background-position: center 30%;
  filter: saturate(115%) contrast(105%) brightness(0.7);
  transform: scale(1.06);
  will-change: transform;
}
.hero-vignette {
  position: absolute; inset: 0; z-index: -2;
  background:
    radial-gradient(ellipse at 30% 50%, rgba(255, 110, 54, 0.22) 0%, transparent 55%),
    radial-gradient(ellipse at 80% 70%, rgba(176, 122, 230, 0.18) 0%, transparent 50%),
    linear-gradient(180deg, rgba(12, 8, 32, 0.55) 0%, rgba(12, 8, 32, 0.42) 40%, rgba(12, 8, 32, 0.95) 100%);
}
.hero-scrim {
  position: absolute; left: 0; right: 0; bottom: -1px; height: 180px; z-index: -1;
  background: linear-gradient(180deg, transparent, var(--bg) 90%);
}
.hero-inner { padding: 110px 24px 130px; max-width: 1080px; }
.hero h1 { margin-top: 0.2em; }
.hero h1 .accent { color: var(--gold); text-shadow: 0 4px 0 var(--ink), 0 0 30px rgba(242, 184, 77, 0.45); }
.hero .display { text-shadow: 0 4px 0 var(--ink), 0 12px 30px rgba(0,0,0,0.5); }
.hero .lede { margin-top: 18px; }

.cta-row { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 32px; }

.store-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 16px;
  margin-top: 36px;
}
.store-row-label {
  width: 100%; font-size: 0.78rem; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--text-soft); margin-bottom: -4px;
}
.store-badge {
  display: inline-flex; transition: transform .15s ease, filter .15s ease;
  filter: drop-shadow(0 6px 14px rgba(0,0,0,0.45));
}
.store-badge:hover { transform: translateY(-2px); filter: drop-shadow(0 10px 18px rgba(0,0,0,0.55)) brightness(1.1); }
.store-badge img { height: 56px; width: auto; }

/* ------ Section base ------ */

.section { padding: clamp(72px, 10vw, 130px) 0; position: relative; }
.section-head { text-align: center; max-width: 780px; margin: 0 auto clamp(40px, 5vw, 64px); }
.section-head .section-sub { margin: 12px auto 0; }

/* ------ Pillars (was Features) ------ */

.pillars { background: var(--bg-deep); border-top: var(--stroke) solid var(--ink); border-bottom: var(--stroke) solid var(--ink); }
.pillar-grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: 22px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
.pillar-card {
  background: var(--paper);
  color: var(--text-on-paper);
  border: var(--stroke-thick) solid var(--ink);
  border-radius: var(--radius-lg);
  padding: 28px 26px;
  position: relative; overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: transform .2s ease;
}
.pillar-card::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(circle at 0% 0%, rgba(255, 110, 54, 0.10), transparent 55%);
}
.pillar-card:hover { transform: translateY(-4px); }
.pillar-icon {
  width: 64px; height: 64px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--paper-2);
  border: 3px solid var(--ink);
  margin-bottom: 16px;
  box-shadow: inset 0 -3px 0 var(--paper-line);
  overflow: hidden;
}
.pillar-icon img {
  width: 100%; height: 100%; object-fit: cover;
  border-radius: 50%;
  image-rendering: -webkit-optimize-contrast;
}
.pillar-card h3 { color: var(--text-on-paper); margin-bottom: 8px; }
.pillar-card p { color: var(--text-on-paper-soft); font-size: 0.97rem; line-height: 1.55; margin: 0; }

/* ------ Mode card (single now: Standard) ------ */

.modes { background: var(--bg); }
.mode-grid {
  display: grid; gap: 28px;
  grid-template-columns: 1fr;
  max-width: 880px; margin: 0 auto;
}
.mode-card {
  background: var(--paper);
  color: var(--text-on-paper);
  border: var(--stroke-thick) solid var(--ink);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}
.mode-art { aspect-ratio: 16 / 9; overflow: hidden; background: var(--bg-deep); }
.mode-art img { width: 100%; height: 100%; object-fit: cover; }
.mode-body { padding: 28px 30px 32px; }
.mode-body h3 { color: var(--text-on-paper); font-size: 1.7rem; margin: 6px 0 12px; }
.mode-body p { color: var(--text-on-paper-soft); }
.mode-bullets { list-style: none; margin: 18px 0 0; padding: 18px 0 0; border-top: 2px solid var(--paper-line); }
.mode-bullets li {
  display: flex; align-items: baseline; justify-content: space-between; gap: 14px;
  padding: 8px 0; font-size: 0.95rem;
}
.mode-bullets li + li { border-top: 1px dashed var(--paper-line); }
.mode-bullets span { color: var(--text-on-paper-soft); letter-spacing: 0.04em; font-family: var(--sans); }
.mode-bullets strong { color: var(--text-on-paper); font-weight: 700; }

/* ------ Tribe row (landing page) ------ */

.tribes-strip { background: var(--bg-2); border-top: var(--stroke) solid var(--ink); border-bottom: var(--stroke) solid var(--ink); }

.tribe-row {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}
.tribe-card {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 26px 14px;
  background: var(--paper);
  color: var(--text-on-paper);
  border: var(--stroke-thick) solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  transition: transform .15s ease;
  text-decoration: none;
}
.tribe-card:hover { transform: translateY(-3px); }
.tribe-card[data-tribe="Sentinel"] { background: var(--tribe-bg-Sentinel); }
.tribe-card[data-tribe="Beast"]    { background: var(--tribe-bg-Beast); }
.tribe-card[data-tribe="Dragon"]   { background: var(--tribe-bg-Dragon); }
.tribe-card[data-tribe="Mech"]     { background: var(--tribe-bg-Mech); }
.tribe-card[data-tribe="Undead"]   { background: var(--tribe-bg-Undead); }
.tribe-card[data-tribe="Neutral"]  { background: var(--tribe-bg-Neutral); }
.tribe-card img {
  width: 72px; height: 72px; object-fit: contain;
  filter: drop-shadow(0 6px 0 rgba(27, 20, 48, 0.35));
}
.tribe-card .tribe-name {
  font-family: var(--display); letter-spacing: 0.18em; font-size: 0.95rem;
  text-transform: uppercase; color: var(--text-on-paper);
}
.tribe-card .tribe-count {
  font-family: var(--sans); font-size: 0.78rem; letter-spacing: 0.18em;
  color: var(--text-on-paper-soft);
}

/* ------ Codex hub ------ */

.codex-hero {
  padding: clamp(50px, 8vw, 90px) 0 clamp(36px, 5vw, 56px);
  border-bottom: 1px solid rgba(242, 184, 77, 0.18);
  background:
    radial-gradient(ellipse 600px 200px at 50% 0%, var(--gold-haze) 0%, transparent 70%),
    radial-gradient(ellipse 800px 400px at 50% 100%, rgba(15, 10, 26, 0.4), transparent 70%),
    var(--bg-deep);
  text-align: center;
  position: relative;
}
.codex-hero h1 { margin-bottom: 14px; }

.codex-hub {
  display: grid; gap: 24px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
.codex-tile {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.4), transparent 30%),
    var(--paper);
  color: var(--text-on-paper);
  border: var(--stroke-thick) solid var(--ink);
  border-radius: var(--radius-lg);
  padding: 28px 26px;
  display: flex; flex-direction: column; gap: 12px;
  box-shadow: var(--shadow-card);
  transition: transform .15s ease, box-shadow .15s ease;
  text-decoration: none;
  position: relative; overflow: hidden;
}
.codex-tile:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 0 var(--ink), 0 18px 36px -12px rgba(0, 0, 0, 0.6);
}
.codex-tile::after {
  content: "→"; position: absolute; right: 22px; top: 22px;
  font-family: var(--sans); font-size: 1.5rem; color: var(--gold-deep);
  transition: transform .2s ease, color .15s ease;
}
.codex-tile:hover::after { transform: translateX(6px); color: var(--ember-deep); }
.codex-tile h3 { color: var(--text-on-paper); margin: 0; }
.codex-tile p { margin: 0; color: var(--text-on-paper-soft); font-size: 0.95rem; }
.codex-tile .codex-tile-stat {
  font-family: var(--sans); text-transform: uppercase; letter-spacing: 0.18em;
  font-size: 0.74rem; color: var(--gold-deep); font-weight: 700;
}

/* ------ Codex shared layout: filters + grid ------ */

.codex-page { padding: 40px 0 80px; }

.filter-bar {
  display: flex; flex-direction: column; gap: 12px;
  margin: 0 0 28px;
  padding: 16px 20px;
  background: linear-gradient(180deg, rgba(15, 10, 26, 0.85), rgba(15, 10, 26, 0.65));
  border: var(--stroke) solid var(--ink);
  border-top: 1px solid rgba(242, 184, 77, 0.35);
  border-radius: var(--radius);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 8px 24px -16px rgba(0, 0, 0, 0.6);
}
.filter-row {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
}
.filter-row + .filter-row {
  padding-top: 12px;
  border-top: 1px solid rgba(242, 184, 77, 0.10);
}
.filter-row-search { gap: 12px; }

.filter-label {
  font-family: var(--sans); text-transform: uppercase; letter-spacing: 0.18em;
  font-size: 0.72rem; color: var(--gold-deep); font-weight: 700;
  min-width: 86px;
}
.filter-chip {
  padding: 6px 14px; border-radius: 999px;
  border: 1.5px solid rgba(214, 193, 144, 0.28);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-mid);
  font-family: var(--sans); font-weight: 600; font-size: 0.78rem;
  letter-spacing: 0.08em; text-transform: uppercase;
  cursor: pointer; transition: background .15s ease, color .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.filter-chip:hover {
  color: var(--text);
  border-color: rgba(242, 184, 77, 0.6);
  background: rgba(242, 184, 77, 0.06);
}
.filter-chip.is-active {
  background: var(--gold);
  color: var(--text-on-paper);
  border-color: var(--gold-deep);
  box-shadow: 0 2px 0 var(--ink), 0 0 0 1px rgba(242, 184, 77, 0.4);
}
.filter-search {
  flex: 1 1 240px;
  padding: 10px 14px;
  border: 1.5px solid rgba(214, 193, 144, 0.28);
  background: rgba(15, 10, 26, 0.7);
  color: var(--text);
  font-family: var(--sans); font-size: 0.92rem;
  border-radius: 999px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.filter-search::placeholder { color: var(--text-soft); }
.filter-search:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(242, 184, 77, 0.15);
}

.filter-select {
  appearance: none;
  -webkit-appearance: none;
  padding: 9px 36px 9px 14px;
  border: 1.5px solid rgba(214, 193, 144, 0.28);
  background-color: rgba(15, 10, 26, 0.7);
  color: var(--text);
  font-family: var(--sans); font-size: 0.86rem; font-weight: 600;
  letter-spacing: 0.04em;
  border-radius: 999px;
  cursor: pointer;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--gold) 50%),
    linear-gradient(135deg, var(--gold) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.filter-select:hover { border-color: rgba(242, 184, 77, 0.6); }
.filter-select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(242, 184, 77, 0.15);
}
.filter-select option {
  background: var(--bg-deep);
  color: var(--text);
}

.filter-count {
  font-family: var(--sans); font-size: 0.82rem; color: var(--text-soft);
  margin-left: auto;
  white-space: nowrap;
}

.filter-chip-loading,
.filter-empty {
  font-family: var(--sans); font-size: 0.78rem; color: var(--text-soft);
  font-style: italic; padding: 4px 8px;
}

@media (max-width: 760px) {
  .filter-bar { padding: 14px; }
  .filter-label { min-width: 0; width: 100%; margin-bottom: 2px; }
  .filter-row { gap: 6px; }
  .filter-row-search { flex-wrap: wrap; }
  .filter-chip { padding: 5px 11px; font-size: 0.72rem; }
  .filter-count { margin-left: 0; }
  .filter-select { font-size: 0.78rem; padding: 7px 30px 7px 12px; }
}

.card-grid {
  display: grid; gap: 20px;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

/* Generic codex-plate card (unit, boss) */

.plate {
  background: var(--paper);
  color: var(--text-on-paper);
  border: var(--stroke-thick) solid var(--ink);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-card);
  transition: transform .15s ease, box-shadow .15s ease;
  text-decoration: none;
  position: relative;
  isolation: isolate;
}
.plate:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 0 var(--ink), 0 18px 30px -10px rgba(0,0,0,0.45);
}
/* Tier-colored inner frame ring (mirrors in-game card frame color by tier) */
.plate[data-tier="1"] { box-shadow: inset 0 0 0 3px var(--tier-1), var(--shadow-card); }
.plate[data-tier="2"] { box-shadow: inset 0 0 0 3px var(--tier-2), var(--shadow-card); }
.plate[data-tier="3"] { box-shadow: inset 0 0 0 3px var(--tier-3), var(--shadow-card); }
.plate[data-tier="4"] { box-shadow: inset 0 0 0 3px var(--tier-4), var(--shadow-card); }
.plate[data-tier="1"]:hover { box-shadow: inset 0 0 0 3px var(--tier-1), 0 10px 0 var(--ink), 0 18px 30px -10px rgba(0,0,0,0.45); }
.plate[data-tier="2"]:hover { box-shadow: inset 0 0 0 3px var(--tier-2), 0 10px 0 var(--ink), 0 18px 30px -10px rgba(0,0,0,0.45); }
.plate[data-tier="3"]:hover { box-shadow: inset 0 0 0 3px var(--tier-3), 0 10px 0 var(--ink), 0 18px 30px -10px rgba(0,0,0,0.45); }
.plate[data-tier="4"]:hover { box-shadow: inset 0 0 0 3px var(--tier-4), 0 10px 0 var(--ink), 0 18px 30px -10px rgba(0,0,0,0.45); }

/* Tribe-icon watermark stamped behind body content. Lives inside .plate-body
   so it sits beneath the unit art and stays scoped to that area; .plate-body
   already forms its own stacking context (position:relative; z-index:1), so
   z-index:-1 here keeps the watermark behind text without escaping the
   plate. */
.plate-watermark {
  position: absolute; inset: 0;
  background-repeat: no-repeat;
  background-position: center center;
  background-size: auto 45%;
  opacity: 0.10;
  pointer-events: none;
  z-index: -1;
  mix-blend-mode: multiply;
}
.plate-art {
  aspect-ratio: 1 / 1;
  background: var(--paper-2);
  border-bottom: 3px solid var(--ink);
  position: relative;
  overflow: hidden;
  z-index: 1;
}
.plate-art img {
  width: 100%; height: 100%; object-fit: cover;
  image-rendering: -webkit-optimize-contrast;
}
.plate-art .plate-tier {
  position: absolute; top: 8px; left: 8px;
  background: var(--ink);
  color: var(--gold);
  font-family: var(--sans); font-weight: 700;
  font-size: 0.72rem; letter-spacing: 0.16em; text-transform: uppercase;
  padding: 4px 10px; border-radius: 999px;
}
.plate[data-tier="1"] .plate-art .plate-tier { color: var(--tier-1); }
.plate[data-tier="2"] .plate-art .plate-tier { color: var(--tier-2); }
.plate[data-tier="3"] .plate-art .plate-tier { color: #7fb0ff; }
.plate[data-tier="4"] .plate-art .plate-tier { color: #c596ff; }
.plate-art .plate-tribe {
  position: absolute; top: 8px; right: 8px;
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--paper);
  color: var(--text-on-paper);
  border: 2px solid var(--ink);
  font-family: var(--sans); font-weight: 700;
  font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase;
  padding: 3px 9px 3px 6px; border-radius: 999px;
}
.plate-art .plate-tribe img { width: 14px; height: 14px; }
.plate-body { padding: 14px 14px 16px; position: relative; z-index: 1; }
.plate-name {
  font-family: var(--display); font-weight: 700;
  font-size: 1.05rem; line-height: 1.2;
  color: var(--text-on-paper);
  margin: 0 0 4px;
}
.plate-sub {
  font-family: var(--sans); font-size: 0.78rem; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--text-on-paper-soft);
  margin: 0 0 6px;
}
.plate-desc {
  font-family: var(--serif); font-size: 0.85rem; line-height: 1.35;
  color: var(--text-on-paper); margin: 0 0 12px;
  white-space: pre-line;
}
.plate-stats {
  display: grid; grid-template-columns: repeat(5, 1fr);
  gap: 4px; padding-top: 10px;
  border-top: 2px dashed var(--paper-line);
  font-family: var(--sans);
}
.plate-stat {
  display: flex; flex-direction: column; align-items: center;
  gap: 3px;
  font-size: 0.78rem;
}
.plate-stat-icon {
  width: 22px; height: 22px;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,0.18));
}
.plate-stat-label {
  font-size: 0.62rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--text-on-paper-soft); font-weight: 700;
}
.plate-stat-value { font-weight: 700; color: var(--text-on-paper); }

.tribe-tag-Sentinel { color: var(--gold-deep); }
.tribe-tag-Dragon   { color: var(--ember-deep); }
.tribe-tag-Beast    { color: var(--leaf-deep); }
.tribe-tag-Mech     { color: var(--rime-deep); }
.tribe-tag-Undead   { color: var(--bruise-deep); }
.tribe-tag-Neutral  { color: var(--bone-deep); }

/* Tribe-tinted plate borders/shadows */
.plate[data-tribe="Sentinel"]  { background: var(--tribe-bg-Sentinel); }
.plate[data-tribe="Beast"]     { background: var(--tribe-bg-Beast); }
.plate[data-tribe="Dragon"]    { background: var(--tribe-bg-Dragon); }
.plate[data-tribe="Mech"]      { background: var(--tribe-bg-Mech); }
.plate[data-tribe="Undead"]    { background: var(--tribe-bg-Undead); }
.plate[data-tribe="Neutral"]   { background: var(--tribe-bg-Neutral); }

/* ------ Rune card ------ */

.rune-card {
  background: var(--paper);
  color: var(--text-on-paper);
  border: var(--stroke-thick) solid var(--ink);
  border-radius: var(--radius);
  padding: 22px 18px;
  text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  box-shadow: var(--shadow-card);
  transition: transform .15s ease;
  position: relative;
}
.rune-card:hover { transform: translateY(-4px); }
.rune-card-icon {
  width: 88px; height: 88px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, var(--paper-2), var(--paper-deep));
  border: 3px solid var(--ink);
  filter: drop-shadow(0 4px 0 var(--ink));
  margin-top: 4px;
  overflow: hidden;
}
.rune-card-icon img {
  width: 100%; height: 100%; object-fit: cover;
  border-radius: 50%;
  image-rendering: -webkit-optimize-contrast;
}
.rune-card-name {
  font-family: var(--display); font-weight: 700; font-size: 1.1rem;
  margin: 0; color: var(--text-on-paper);
}
.rune-card-tiers {
  display: flex; gap: 4px; justify-content: center;
  font-family: var(--sans); font-size: 0.7rem; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--text-on-paper-soft);
}
.rune-tier-pill {
  padding: 2px 7px;
  background: var(--paper-2);
  border: 2px solid var(--ink);
  border-radius: 999px; font-weight: 700;
}
.rune-card-desc {
  font-size: 0.92rem; color: var(--text-on-paper-soft); line-height: 1.45;
  margin: 0;
}
.rune-card-tags {
  display: flex; gap: 4px; justify-content: center; flex-wrap: wrap;
  margin-top: 4px;
}
.rune-tag {
  font-family: var(--sans); font-size: 0.68rem; letter-spacing: 0.14em;
  text-transform: uppercase; font-weight: 700;
  background: var(--ink); color: var(--gold);
  padding: 3px 8px; border-radius: 999px;
}
.rune-tag.tribe-Sentinel { background: var(--gold-deep); color: #fff; }
.rune-tag.tribe-Dragon   { background: var(--ember-deep); color: #fff; }
.rune-tag.tribe-Beast    { background: var(--leaf-deep); color: #fff; }
.rune-tag.tribe-Mech     { background: var(--rime-deep); color: #fff; }
.rune-tag.tribe-Undead   { background: var(--bruise-deep); color: #fff; }
.rune-tag.kw { background: var(--ember); color: #fff; }

/* ------ Keyword card ------ */

.keyword-grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.keyword-card {
  background: var(--paper);
  color: var(--text-on-paper);
  border: var(--stroke-thick) solid var(--ink);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-card);
}
.keyword-card-name {
  font-family: var(--display); font-weight: 700; font-size: 1.1rem;
  margin: 0 0 8px; color: var(--text-on-paper);
  display: flex; align-items: center; gap: 10px;
}
.keyword-card-dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--ember); border: 2px solid var(--ink);
  flex-shrink: 0;
}
.keyword-card-dot.kw-burn { background: var(--ember); }
.keyword-card-dot.kw-freeze { background: var(--rime); }
.keyword-card-dot.kw-venom, .keyword-card-dot.kw-bloodletting, .keyword-card-dot.kw-rabid, .keyword-card-dot.kw-bloodlust { background: var(--leaf); }
.keyword-card-dot.kw-stun, .keyword-card-dot.kw-haywire, .keyword-card-dot.kw-blind { background: var(--gold); }
.keyword-card-dot.kw-shield, .keyword-card-dot.kw-everlasting, .keyword-card-dot.kw-consecrate, .keyword-card-dot.kw-relentless { background: var(--gold); }
.keyword-card-dot.kw-dread, .keyword-card-dot.kw-macabre { background: var(--bruise); }
.keyword-card-dot.kw-overclock, .keyword-card-dot.kw-supercharge, .keyword-card-dot.kw-haywire { background: var(--rime); }
.keyword-card-dot.kw-feral, .keyword-card-dot.kw-kindled { background: var(--ember); }
.keyword-card-dot.kw-fleeting, .keyword-card-dot.kw-lucid { background: var(--bruise); }
.keyword-card-dot.kw-evasion, .keyword-card-dot.kw-spread, .keyword-card-dot.kw-threat, .keyword-card-dot.kw-maim, .keyword-card-dot.kw-hatch { background: var(--bone); }
.keyword-card-text {
  font-size: 0.94rem; color: var(--text-on-paper-soft); line-height: 1.55; margin: 0;
}

/* ------ Boss card ------ */

.boss-card {
  background: var(--boss-bg);
  color: var(--text);
  border: var(--stroke-thick) solid var(--ink);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: transform .15s ease;
}
.boss-card:hover { transform: translateY(-4px); }
/* Tier-colored frame ring on boss roster cards (boss frame matches its round) */
.boss-card[data-tier="1"] { box-shadow: inset 0 0 0 3px var(--tier-1), var(--shadow-card); }
.boss-card[data-tier="2"] { box-shadow: inset 0 0 0 3px var(--tier-2), var(--shadow-card); }
.boss-card[data-tier="3"] { box-shadow: inset 0 0 0 3px var(--tier-3), var(--shadow-card); }
.boss-card[data-tier="4"] { box-shadow: inset 0 0 0 3px var(--tier-4), var(--shadow-card); }
.boss-art {
  aspect-ratio: 1 / 1;
  background: #110820;
  border-bottom: 3px solid var(--ink);
  overflow: hidden;
  position: relative;
}
.boss-art img { width: 100%; height: 100%; object-fit: cover; }
.boss-art .plate-tier {
  position: absolute; top: 8px; left: 8px;
  background: var(--ink);
  font-family: var(--sans); font-weight: 700;
  font-size: 0.72rem; letter-spacing: 0.16em; text-transform: uppercase;
  padding: 4px 10px; border-radius: 999px;
}
.boss-card[data-tier="1"] .boss-art .plate-tier { color: var(--tier-1); }
.boss-card[data-tier="2"] .boss-art .plate-tier { color: var(--tier-2); }
.boss-card[data-tier="3"] .boss-art .plate-tier { color: #7fb0ff; }
.boss-card[data-tier="4"] .boss-art .plate-tier { color: #c596ff; }
.boss-body { padding: 16px 18px 18px; }
.boss-name {
  font-family: var(--display); font-weight: 700; font-size: 1.1rem;
  margin: 0 0 4px; color: var(--gold);
}
.boss-sub {
  font-family: var(--sans); font-size: 0.78rem; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--bruise);
  margin: 0 0 10px;
}
.boss-stats {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px;
  padding-top: 10px; border-top: 1px dashed rgba(242, 184, 77, 0.25);
  font-family: var(--sans); font-size: 0.78rem;
}
.boss-stats .plate-stat-label { color: rgba(242, 184, 77, 0.65); }
.boss-stats .plate-stat-value { color: var(--text); }
.boss-minion {
  margin-top: 10px;
  font-family: var(--sans); font-size: 0.78rem; letter-spacing: 0.06em;
  color: var(--text-soft);
}
.boss-minion strong { color: var(--bruise); }

/* ------ CTA section ------ */

.cta {
  background:
    radial-gradient(ellipse at 50% 0%, rgba(255, 110, 54, 0.18) 0%, transparent 55%),
    linear-gradient(180deg, var(--bg-2), var(--bg));
  border-top: var(--stroke) solid var(--ink);
  text-align: center;
}
.cta-inner { max-width: 820px; margin: 0 auto; }
.cta .section-sub { margin: 12px auto 32px; }
.store-row-large { justify-content: center; }
.store-row-large .store-badge img { height: 64px; }
.cta-note { margin-top: 22px; font-size: 0.82rem; color: var(--text-soft); letter-spacing: 0.04em; }

/* ------ Footer ------ */

.site-footer {
  border-top: var(--stroke) solid var(--ink);
  background: var(--bg-deep);
  padding: 38px 0 50px;
}
.footer-inner { display: flex; flex-direction: column; align-items: center; gap: 18px; text-align: center; }
.footer-brand { display: flex; align-items: center; gap: 12px; }
.footer-nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 18px; }
.footer-nav a { color: var(--text-soft); font-size: 0.92rem; font-family: var(--sans); }
.footer-nav a:hover { color: var(--text); }
.footer-fineprint { color: var(--text-soft); font-size: 0.78rem; margin: 0; letter-spacing: 0.04em; }

/* ------ Reveal animation ------ */

.reveal { opacity: 0; transform: translateY(18px); transition: opacity .55s ease, transform .55s ease; }
.reveal.is-visible { opacity: 1; transform: none; }

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

/* ------ Detail page (unit) ------ */

.detail-page {
  padding: 40px 0 80px;
}
.detail-back {
  font-family: var(--sans); font-size: 0.82rem; text-transform: uppercase;
  letter-spacing: 0.18em; color: var(--text-soft);
  display: inline-block; margin-bottom: 22px;
}
.detail-back:hover { color: var(--gold); }

.detail-grid {
  display: grid; gap: 32px;
  grid-template-columns: minmax(280px, 1fr) 2fr;
  align-items: start;
  position: relative;
  isolation: isolate;
  background: var(--paper);
  border: var(--stroke-thick) solid var(--ink);
  border-radius: var(--radius-lg);
  padding: 26px;
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.detail-grid[data-tribe="Sentinel"] { background: var(--tribe-bg-Sentinel); }
.detail-grid[data-tribe="Beast"]    { background: var(--tribe-bg-Beast); }
.detail-grid[data-tribe="Dragon"]   { background: var(--tribe-bg-Dragon); }
.detail-grid[data-tribe="Mech"]     { background: var(--tribe-bg-Mech); }
.detail-grid[data-tribe="Undead"]   { background: var(--tribe-bg-Undead); }
.detail-grid[data-tribe="Neutral"]  { background: var(--tribe-bg-Neutral); }
.detail-grid[data-tier="1"] { box-shadow: inset 0 0 0 4px var(--tier-1), var(--shadow-card); }
.detail-grid[data-tier="2"] { box-shadow: inset 0 0 0 4px var(--tier-2), var(--shadow-card); }
.detail-grid[data-tier="3"] { box-shadow: inset 0 0 0 4px var(--tier-3), var(--shadow-card); }
.detail-grid[data-tier="4"] { box-shadow: inset 0 0 0 4px var(--tier-4), var(--shadow-card); }
@media (max-width: 760px) { .detail-grid { grid-template-columns: 1fr; padding: 18px; } }

.detail-watermark {
  position: absolute; inset: 0;
  background-repeat: no-repeat;
  background-position: 105% 100%;
  background-size: 60% auto;
  opacity: 0.10;
  pointer-events: none;
  z-index: 0;
  mix-blend-mode: multiply;
}

.detail-art {
  margin: 0;
  background: var(--paper);
  border: var(--stroke-thick) solid var(--ink);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  align-self: start;
  line-height: 0;
  position: relative;
  z-index: 1;
}
.detail-art img { width: 100%; height: auto; display: block; }

/* Tier-colored inner ring on the art frame, matching in-game minicard look.
   Driven off the parent .detail-grid[data-tier] so it updates live when the
   user clicks T1/T2/T3/T4 on the unit detail page. */
.detail-grid[data-tier="1"] .detail-art { box-shadow: inset 0 0 0 4px var(--tier-1), var(--shadow-card); }
.detail-grid[data-tier="2"] .detail-art { box-shadow: inset 0 0 0 4px var(--tier-2), var(--shadow-card); }
.detail-grid[data-tier="3"] .detail-art { box-shadow: inset 0 0 0 4px var(--tier-3), var(--shadow-card); }
.detail-grid[data-tier="4"] .detail-art { box-shadow: inset 0 0 0 4px var(--tier-4), var(--shadow-card); }

.detail-body {
  display: flex; flex-direction: column; gap: 18px;
  position: relative; z-index: 1;
}
.detail-name {
  font-family: var(--display);
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  margin: 0;
  color: var(--ink);
  text-shadow: 0 1px 0 rgba(255, 248, 230, 0.55);
}
.detail-meta {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.detail-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--sans); font-size: 0.74rem; letter-spacing: 0.14em;
  text-transform: uppercase; font-weight: 700;
  padding: 5px 12px; border-radius: 999px;
  background: var(--paper); color: var(--text-on-paper);
  border: 2px solid var(--ink);
}
.detail-pill img { width: 16px; height: 16px; }
.detail-pill.tier { background: var(--gold); color: var(--text-on-paper); }
.detail-pill.tribe-Sentinel { background: var(--gold); }
.detail-pill.tribe-Dragon { background: var(--ember); color: #fff; }
.detail-pill.tribe-Beast { background: var(--leaf); color: #fff; }
.detail-pill.tribe-Mech { background: var(--rime); color: #fff; }
.detail-pill.tribe-Undead { background: var(--bruise); color: #fff; }
.detail-pill.tribe-Neutral { background: var(--bone); color: var(--text-on-paper); }

.detail-stats {
  display: grid; grid-template-columns: repeat(5, 1fr);
  gap: 0;
  background: var(--paper);
  border: var(--stroke-thick) solid var(--ink);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  color: var(--text-on-paper);
}
@media (max-width: 580px) { .detail-stats { grid-template-columns: repeat(2, 1fr); } }
.detail-stat {
  padding: 14px 10px; text-align: center;
  border-right: 2px solid var(--paper-line);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.detail-stat:last-child { border-right: none; }
.detail-stat-icon {
  width: 30px; height: 30px;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,0.18));
}
.detail-stat-label {
  font-family: var(--sans); font-size: 0.7rem; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--text-on-paper-soft); font-weight: 700;
}
.detail-stat-value { font-family: var(--display); font-size: 1.7rem; font-weight: 700; }
.stat-delta {
  display: block;
  margin-top: 4px;
  min-height: 1em;
  line-height: 1;
  font-family: var(--sans); font-size: 0.7rem; letter-spacing: 0.06em;
  font-weight: 700;
}
.stat-delta-up    { color: var(--leaf-deep); }
.stat-delta-down  { color: var(--ember-deep); }
.stat-delta-empty { visibility: hidden; }

/* Tier extrapolator (unit detail) */
.tier-extrapolator {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  background: var(--paper);
  border: var(--stroke-thick) solid var(--ink);
  border-radius: var(--radius);
  padding: 10px 14px;
  box-shadow: var(--shadow-card);
}
.tier-extrapolator-label {
  font-family: var(--sans); font-size: 0.74rem; letter-spacing: 0.16em;
  text-transform: uppercase; font-weight: 700;
  color: var(--text-on-paper-soft);
  margin-right: 4px;
}
.tier-step {
  font-family: var(--sans); font-weight: 700;
  font-size: 0.84rem; letter-spacing: 0.06em;
  padding: 6px 12px;
  border-radius: 999px;
  border: 2px solid var(--ink);
  background: var(--paper-2);
  color: var(--text-on-paper);
  cursor: pointer;
  transition: background .12s ease, color .12s ease, transform .12s ease;
}
.tier-step:hover { transform: translateY(-1px); background: var(--gold); }
.tier-step.is-active {
  background: var(--ember); color: #fff;
  box-shadow: 0 3px 0 var(--ink);
}
.tier-step.is-base::after {
  content: "★";
  margin-left: 4px;
  color: var(--gold-deep);
  font-size: 0.7rem;
}
.tier-step.is-base.is-active::after { color: var(--gold); }
.tier-extrapolator-note {
  font-family: var(--sans); font-size: 0.74rem; color: var(--text-on-paper-soft);
  margin-left: auto; font-style: italic;
}

/* Boss detail */
.boss-detail-art {
  background: var(--boss-bg);
}
.boss-detail-art img { filter: drop-shadow(0 6px 18px rgba(0,0,0,0.4)); }
.boss-ability-list {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column; gap: 12px;
}
.boss-ability-list li { color: var(--text-on-paper-soft); }
.boss-ability-list strong { color: var(--text-on-paper); font-family: var(--sans); letter-spacing: 0.06em; }
.boss-minion-card {
  display: grid; grid-template-columns: 120px 1fr; gap: 16px; align-items: start;
}
.boss-minion-card img {
  width: 120px; height: 120px; object-fit: cover;
  border: 3px solid var(--ink); border-radius: var(--radius-sm);
  background: var(--paper-2);
}
.boss-minion-card[data-tier="1"] img { box-shadow: inset 0 0 0 3px var(--tier-1); }
.boss-minion-card[data-tier="2"] img { box-shadow: inset 0 0 0 3px var(--tier-2); }
.boss-minion-card[data-tier="3"] img { box-shadow: inset 0 0 0 3px var(--tier-3); }
.boss-minion-card[data-tier="4"] img { box-shadow: inset 0 0 0 3px var(--tier-4); }
.boss-minion-ability {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 2px dashed var(--paper-line);
}
.boss-minion-ability h5 {
  font-family: var(--sans); font-size: 0.78rem; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--text-on-paper);
  margin: 0 0 4px;
}
.boss-minion-ability p {
  font-family: var(--serif); font-size: 0.9rem; line-height: 1.4;
  color: var(--text-on-paper-soft); margin: 0; white-space: pre-line;
}

/* Make boss cards in the roster behave as full-tile links */
.boss-card-link { text-decoration: none; display: flex; flex-direction: column; }
.boss-card-link h3, .boss-card-link p, .boss-card-link strong { text-decoration: none; }

.detail-section {
  background: var(--paper);
  color: var(--text-on-paper);
  border: var(--stroke-thick) solid var(--ink);
  border-radius: var(--radius);
  padding: 18px 22px;
  box-shadow: var(--shadow-card);
}
.detail-section h3 {
  font-family: var(--display); font-size: 1.2rem; color: var(--text-on-paper);
  margin: 0 0 6px;
}
.detail-section p { color: var(--text-on-paper-soft); margin: 0; white-space: pre-line; }

.ability-hatch {
  margin-top: 8px !important;
  padding-top: 8px;
  border-top: 1px dashed var(--paper-line);
  font-family: var(--sans); font-size: 0.85rem; letter-spacing: 0.04em;
  color: var(--text-on-paper) !important;
}
.ability-hatch strong {
  font-family: var(--sans); letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--bruise); margin-right: 6px;
}

.hatch-target-list {
  display: flex; flex-direction: column; gap: 14px;
}
.hatch-target-card {
  text-decoration: none; color: inherit;
  padding: 12px; border: var(--stroke) solid var(--ink); border-radius: var(--radius-sm);
  background: var(--paper-2);
  transition: transform 120ms ease, box-shadow 120ms ease;
}
.hatch-target-card:hover { transform: translateY(-2px); }
.hatch-target-card h4 {
  font-family: var(--display); color: var(--text-on-paper);
}
.hatch-target-meta {
  display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px;
}
.hatch-target-missing {
  font-family: var(--sans); font-size: 0.85rem; color: var(--text-on-paper-soft);
}

/* ------ Inline 'Loading...' ------ */
.loading {
  text-align: center; padding: 80px 0;
  color: var(--text-soft); font-family: var(--sans); letter-spacing: 0.18em;
  text-transform: uppercase;
}

/* ============================================================
   Landing redesign — tribe spotlights, board demo, ftu, bosses,
   loop strip, hover tooltip layer.
   ============================================================ */

/* --- Tribe spotlights --- */
.section-tribes {
  background: var(--bg-deep);
  border-top: var(--stroke) solid var(--ink);
  border-bottom: var(--stroke) solid var(--ink);
}
.tribe-spotlights {
  display: grid; gap: 22px;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}
.spotlight {
  background: var(--paper);
  color: var(--text-on-paper);
  border: var(--stroke-thick) solid var(--ink);
  border-radius: var(--radius-lg);
  padding: 22px 22px 18px;
  display: flex; flex-direction: column; gap: 14px;
  box-shadow: var(--shadow-card);
  position: relative; overflow: hidden;
  transition: transform .18s ease;
}
.spotlight:hover { transform: translateY(-4px); }
.spotlight[data-tribe="Sentinel"] { background: var(--tribe-bg-Sentinel); }
.spotlight[data-tribe="Beast"]    { background: var(--tribe-bg-Beast); }
.spotlight[data-tribe="Dragon"]   { background: var(--tribe-bg-Dragon); }
.spotlight[data-tribe="Mech"]     { background: var(--tribe-bg-Mech); }
.spotlight[data-tribe="Undead"]   { background: var(--tribe-bg-Undead); }
.spotlight-head { display: flex; align-items: center; gap: 14px; }
.spotlight-icon {
  width: 64px; height: 64px; border-radius: 50%;
  background: rgba(27, 20, 48, 0.12);
  border: 3px solid var(--ink);
  display: grid; place-items: center;
  flex-shrink: 0;
  box-shadow: inset 0 -3px 0 var(--paper-line);
}
.spotlight-icon img { width: 46px; height: 46px; filter: drop-shadow(0 2px 0 rgba(0,0,0,0.25)); }
.spotlight-title h3 {
  font-family: var(--display); font-size: 1.6rem;
  margin: 0; color: var(--text-on-paper); letter-spacing: 0.04em;
}
.spotlight-count {
  font-family: var(--sans); font-size: 0.74rem; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--text-on-paper-soft);
  margin: 2px 0 0;
}
.spotlight-blurb {
  margin: 0; font-size: 0.97rem; color: var(--text-on-paper-soft); line-height: 1.5;
}
.spotlight-keywords { display: flex; flex-wrap: wrap; gap: 6px; }
.kw-chip {
  font-family: var(--sans); font-size: 0.7rem; letter-spacing: 0.14em;
  text-transform: uppercase; font-weight: 700;
  padding: 4px 9px; border-radius: 999px;
  background: rgba(27, 20, 48, 0.85); color: var(--gold);
  border: 2px solid var(--ink);
  cursor: help;
  transition: background .15s ease, color .15s ease, transform .12s ease;
}
.kw-chip:hover, .kw-chip:focus-visible {
  background: var(--gold); color: var(--text-on-paper);
  outline: none;
  transform: translateY(-1px);
}
.spotlight-units { display: flex; gap: 8px; }
.spotlight-unit {
  flex: 1 1 0; min-width: 0;
  background: rgba(255, 255, 255, 0.55);
  border: 2px solid var(--ink); border-radius: var(--radius-sm);
  padding: 8px 6px 6px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  text-decoration: none; color: var(--text-on-paper);
  transition: transform .12s ease, background .12s ease;
}
.spotlight-unit:hover { transform: translateY(-2px); background: rgba(255, 255, 255, 0.75); }
.spotlight-unit-art {
  width: 100%; aspect-ratio: 1 / 1;
  background: rgba(27, 20, 48, 0.08);
  border-radius: var(--radius-sm); overflow: hidden;
  display: grid; place-items: center;
}
.spotlight-unit-art img { width: 100%; height: 100%; object-fit: cover; }
.spotlight-unit-name {
  font-family: var(--sans); font-size: 0.72rem; letter-spacing: 0.04em;
  font-weight: 700; text-align: center; line-height: 1.15;
}
.spotlight-link {
  align-self: flex-start;
  font-family: var(--sans); font-size: 0.78rem; letter-spacing: 0.16em;
  text-transform: uppercase; font-weight: 700;
  color: var(--text-on-paper);
  border-bottom: 2px solid var(--ink);
  padding: 2px 0;
}

/* --- Runes section + board demo --- */
.section-runes {
  background:
    radial-gradient(ellipse at 50% 0%, rgba(242, 184, 77, 0.10) 0%, transparent 55%),
    var(--bg-2);
  border-bottom: var(--stroke) solid var(--ink);
}
.board-instructions {
  text-align: center; max-width: 60ch; margin: 0 auto 24px;
  color: var(--text-soft); font-size: 0.95rem;
}
.board-demo {
  margin: 0 auto;
  max-width: 880px;
  background: var(--paper);
  border: var(--stroke-thick) solid var(--ink);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-card);
  color: var(--text-on-paper);
}
.section-sub-emphasis {
  margin-top: 14px;
  font-size: 1rem;
  color: var(--text);
  background: rgba(242, 184, 77, 0.08);
  border-left: 3px solid var(--gold-deep);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  text-align: left;
  max-width: 64ch; margin-left: auto; margin-right: auto;
}
.section-sub-emphasis strong { color: var(--gold); }
.board-carousel {
  display: flex; flex-direction: column; gap: 18px;
}
.board-carousel-head {
  display: flex; align-items: flex-start; gap: 16px;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--paper-line);
}
.board-carousel-meta { flex: 1 1 auto; min-width: 0; }
.board-carousel-eyebrow {
  font-family: var(--sans); text-transform: uppercase;
  letter-spacing: 0.18em; font-size: 0.72rem;
  color: var(--gold-deep); margin: 0 0 4px;
}
.board-carousel-title {
  font-family: var(--display); font-size: 1.55rem; line-height: 1.1;
  margin: 0 0 6px; color: var(--text-on-paper); letter-spacing: 0.02em;
}
.board-carousel-blurb {
  margin: 0; font-size: 0.95rem; line-height: 1.5;
  color: var(--text-on-paper-soft);
}
.board-carousel-controls {
  display: flex; gap: 8px; flex-shrink: 0;
}
.board-carousel-btn {
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 3px solid var(--ink);
  background: var(--paper-2);
  color: var(--text-on-paper);
  font-family: var(--sans); font-weight: 700; font-size: 1.05rem;
  line-height: 1; cursor: pointer;
  box-shadow: 0 3px 0 var(--ink);
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}
.board-carousel-btn:hover {
  background: var(--gold);
  transform: translateY(-1px);
  box-shadow: 0 4px 0 var(--ink);
}
.board-carousel-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--ink);
}
.board-carousel-footer {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 14px;
}
.board-carousel-dots {
  display: flex; gap: 8px; align-items: center;
  flex-shrink: 0;
}
.board-carousel-dot {
  width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid var(--ink);
  background: var(--paper-deep);
  padding: 0; cursor: pointer;
  transition: background .15s ease, transform .12s ease;
}
.board-carousel-dot:hover { transform: scale(1.15); }
.board-carousel-dot.is-active {
  background: var(--gold);
  box-shadow: 0 0 0 3px rgba(242, 184, 77, 0.25);
}
/* Single grid with explicit gutter tracks separating the play grid from the
   two rune boards — mirrors GameConstants.RUNE_BOARD_GAP_PX. The bottom-right
   quadrant doesn't exist in-game; we render no cells there. */
.boardgrid {
  display: grid;
  grid-template-columns: repeat(8, 1fr) 18px repeat(2, 1fr);
  grid-template-rows: repeat(4, 1fr) 18px repeat(2, 1fr);
  gap: 4px;
  aspect-ratio: 10 / 6;
  position: relative;
}
.cell {
  border-radius: var(--radius-sm);
  background: rgba(60, 38, 18, 0.10);
  border: 2px solid rgba(27, 20, 48, 0.18);
  transition: background .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.cell.is-projecting {
  background: rgba(242, 184, 77, 0.48);
  box-shadow: inset 0 0 0 2px var(--gold-deep);
  border-color: var(--gold-deep);
}
.board-token {
  position: relative;
  border: 3px solid var(--ink);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 4px 0 var(--ink);
  cursor: pointer;
  text-decoration: none;
  transition: transform .15s ease, box-shadow .15s ease;
  z-index: 2;
}
.board-token:hover { transform: translateY(-2px); box-shadow: 0 6px 0 var(--ink); z-index: 3; }
.board-token.is-active,
.board-token.is-affected {
  outline: 3px solid var(--ember);
  outline-offset: 2px;
  z-index: 4;
}
.board-unit {
  display: block;
  background: var(--paper);
  color: var(--text-on-paper);
}
.board-unit-art {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.board-unit-runes {
  position: absolute; top: 4px; right: 4px;
  display: flex; flex-direction: column; gap: 3px;
  z-index: 2;
}
.unit-rune-badge {
  display: block;
  width: 22px; height: 22px;
  border: 2px solid var(--ink); border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, var(--paper-2), var(--paper-deep));
  overflow: hidden;
  box-shadow: 0 2px 0 var(--ink), 0 0 0 2px rgba(242, 184, 77, 0.55);
}
.unit-rune-badge img {
  width: 100%; height: 100%; object-fit: cover; border-radius: 50%;
}
.board-unit-name {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 3px 6px;
  font-family: var(--sans); font-size: 0.62rem; letter-spacing: 0.06em;
  text-transform: uppercase; font-weight: 700;
  background: linear-gradient(180deg, transparent, rgba(27, 20, 48, 0.92));
  color: var(--gold);
  text-align: center;
  z-index: 1;
}
.tribe-bg-Sentinel { background: var(--tribe-bg-Sentinel); }
.tribe-bg-Beast    { background: var(--tribe-bg-Beast); }
.tribe-bg-Dragon   { background: var(--tribe-bg-Dragon); }
.tribe-bg-Mech     { background: var(--tribe-bg-Mech); }
.tribe-bg-Undead   { background: var(--tribe-bg-Undead); }
.tribe-bg-Neutral  { background: var(--tribe-bg-Neutral); }

.board-rune {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: linear-gradient(180deg, #fff7df, #efd396);
  color: var(--text-on-paper);
  padding: 6px;
  gap: 4px;
}
.board-rune-icon {
  width: 60%; aspect-ratio: 1 / 1;
  border-radius: 50%;
  border: 3px solid var(--ink);
  background: radial-gradient(circle at 30% 30%, var(--paper-2), var(--paper-deep));
  overflow: hidden;
  display: grid; place-items: center;
}
.board-rune-icon img {
  width: 100%; height: 100%; object-fit: cover; border-radius: 50%;
}
.board-rune-name {
  font-family: var(--sans); font-size: 0.62rem; letter-spacing: 0.08em;
  text-transform: uppercase; font-weight: 700; text-align: center;
  line-height: 1.05;
}

.board-hover-hint {
  margin: 0;
  font-family: var(--sans); font-size: 0.82rem;
  color: var(--text-on-paper-soft);
  flex: 1 1 auto; min-width: 0;
  line-height: 1.4;
}

.rune-explainer {
  margin-top: 36px;
  display: flex; flex-direction: column; align-items: center; gap: 24px;
}
.rune-explainer-list {
  list-style: none; padding: 0; margin: 0;
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  width: 100%;
}
.rune-explainer-list li {
  background: rgba(245, 231, 200, 0.08);
  border: 2px solid rgba(245, 231, 200, 0.25);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.rune-explainer-list h4 {
  margin: 0 0 6px; color: var(--gold);
  font-family: var(--sans); text-transform: uppercase;
  letter-spacing: 0.16em; font-size: 0.82rem;
}
.rune-explainer-list p {
  margin: 0; color: var(--text-mid); font-size: 0.92rem; line-height: 1.5;
}

/* --- Featured units grid --- */
.section-units { background: var(--bg); }
.ftu-grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}
.ftu-card {
  background: var(--paper);
  color: var(--text-on-paper);
  border: var(--stroke-thick) solid var(--ink);
  border-radius: var(--radius);
  padding: 12px;
  text-decoration: none;
  display: flex; flex-direction: column; gap: 8px;
  box-shadow: var(--shadow-card);
  transition: transform .15s ease, box-shadow .15s ease;
  position: relative; cursor: pointer;
}
.ftu-card:hover { transform: translateY(-4px); box-shadow: 0 10px 0 var(--ink), 0 18px 30px -10px rgba(0,0,0,0.45); }
.ftu-card[data-tribe="Sentinel"] { background: var(--tribe-bg-Sentinel); }
.ftu-card[data-tribe="Beast"]    { background: var(--tribe-bg-Beast); }
.ftu-card[data-tribe="Dragon"]   { background: var(--tribe-bg-Dragon); }
.ftu-card[data-tribe="Mech"]     { background: var(--tribe-bg-Mech); }
.ftu-card[data-tribe="Undead"]   { background: var(--tribe-bg-Undead); }
.ftu-art {
  aspect-ratio: 1 / 1;
  background: rgba(27, 20, 48, 0.08);
  border: 2px solid var(--ink);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.ftu-art img { width: 100%; height: 100%; object-fit: cover; }
.ftu-meta {
  display: flex; gap: 6px; align-items: center;
  font-family: var(--sans); font-size: 0.66rem; letter-spacing: 0.14em;
  text-transform: uppercase; font-weight: 700;
}
.ftu-tribe {
  padding: 3px 8px; border-radius: 999px;
  background: var(--ink); color: var(--gold);
}
.ftu-tier { color: var(--text-on-paper-soft); }
.ftu-name { margin: 0; font-family: var(--display); font-size: 1.05rem; line-height: 1.15; color: var(--text-on-paper); }
.ftu-ability { margin: 0; font-family: var(--sans); font-size: 0.78rem; letter-spacing: 0.06em; color: var(--text-on-paper-soft); }
.section-foot { text-align: center; margin-top: 28px; }

/* --- Boss roster --- */
.section-bosses {
  background: linear-gradient(180deg, var(--bg-deep), var(--bg-2));
  border-top: var(--stroke) solid var(--ink);
}
.boss-tile-grid {
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}
.boss-tile {
  display: flex; flex-direction: column;
  background: var(--boss-bg);
  color: var(--text);
  border: var(--stroke-thick) solid var(--ink);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  box-shadow: var(--shadow-card);
  transition: transform .15s ease;
}
.boss-tile:hover { transform: translateY(-4px); }
.boss-tile-art {
  aspect-ratio: 1 / 1;
  background: #110820;
  border-bottom: 3px solid var(--ink);
  overflow: hidden;
}
.boss-tile-art img { width: 100%; height: 100%; object-fit: cover; }
.boss-tile-body { padding: 14px 16px 16px; }
.boss-tile-body h4 {
  font-family: var(--display); font-size: 1.2rem;
  color: var(--gold); margin: 0 0 8px;
}
.boss-tile-stats {
  list-style: none; margin: 0 0 8px; padding: 0;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px;
  font-family: var(--sans); font-size: 0.74rem;
}
.boss-tile-stats li { display: flex; flex-direction: column; align-items: center; }
.boss-tile-stats span {
  font-size: 0.62rem; letter-spacing: 0.12em; text-transform: uppercase;
  color: rgba(242, 184, 77, 0.65); font-weight: 700;
}
.boss-tile-stats strong { color: var(--text); font-weight: 700; }
.boss-tile-minion {
  margin: 0; font-family: var(--sans); font-size: 0.78rem;
  color: var(--text-soft);
}
.boss-tile-minion strong { color: var(--bruise); }

/* --- Loop strip --- */
.section-loop {
  background: var(--bg);
  border-top: var(--stroke) solid var(--ink);
}
.loop-row {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}
.loop-row li {
  background: var(--paper);
  color: var(--text-on-paper);
  border: var(--stroke-thick) solid var(--ink);
  border-radius: var(--radius);
  padding: 18px 20px;
  position: relative;
  box-shadow: var(--shadow-card);
}
.loop-num {
  position: absolute; top: -18px; left: 14px;
  width: 36px; height: 36px;
  background: var(--ember); color: #fff;
  border: 3px solid var(--ink);
  border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--display); font-weight: 700; font-size: 1rem;
}
.loop-row h4 { margin: 8px 0 6px; font-family: var(--display); font-size: 1.05rem; color: var(--text-on-paper); }
.loop-row p { margin: 0; font-size: 0.9rem; color: var(--text-on-paper-soft); line-height: 1.5; }

@media (max-width: 760px) {
  .board-demo { padding: 12px; }
  .board-rune-name, .board-unit-name { font-size: 0.55rem; }
  .board-carousel-head { flex-direction: column; gap: 10px; align-items: stretch; }
  .board-carousel-controls { justify-content: flex-end; }
  .board-carousel-title { font-size: 1.3rem; }
  .board-carousel-blurb { font-size: 0.88rem; }
  .board-carousel-footer { flex-direction: column; align-items: flex-start; }
  .board-carousel-dots { align-self: center; }
}
