/* ============================================================================
   SHELF WILDS — landing + live demo
   Aesthetic: a naturalist FIELD GUIDE printed on warm paper, at night, lit by a
   barcode scanner. Deep warm ink, thermal-receipt cream accents, type-keyed
   signal colors, a slow scan-light, fine grain. Display = Fraunces (characterful
   serif), body = Hanken Grotesk, the diegetic/barcode voice = JetBrains Mono.
   ========================================================================== */

:root {
  /* --- surfaces (warm near-black → raised) --- */
  --ink:    #17120d;
  --ink-2:  #1f1813;
  --ink-3:  #271e17;
  --ink-4:  #312419;
  --paper:  #f1e7cf;      /* thermal cream accent surface */
  --paper-ink: #2a2013;

  /* --- text --- */
  --bone:    #f4ecd7;
  --bone-dim:#b6a888;
  --bone-faint:#8a7d63;

  /* --- lines & signal --- */
  --line:   #3b2e20;
  --line-2: #4c3b28;
  --ember:  #ff8b3c;      /* primary accent (scanner amber) */
  --ember-deep: #d9621f;
  --moss:   #74d2a3;      /* secondary */
  --rune:   #e3b452;      /* gold */

  /* --- per-type signal colors (used by app.js reveal/badges) --- */
  --t-Ember: #ff7a4d; --t-Tide: #4d9bff; --t-Bloom: #5fd07a;
  --t-Volt: #cfe24a; --t-Hex: #b06bff; --t-Iron: #8aa6bd;

  --maxw: 1120px;
  --radius: 16px;
  --shadow: 0 22px 50px -24px rgba(0,0,0,.8);
  --ui: "Hanken Grotesk", system-ui, sans-serif;
  --display: "Fraunces", Georgia, serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--ui);
  color: var(--bone);
  background:
    radial-gradient(1100px 620px at 84% -8%, #38260f 0%, transparent 58%),
    radial-gradient(900px 540px at -5% 18%, #241a2c 0%, transparent 52%),
    radial-gradient(1000px 800px at 50% 120%, #1c2418 0%, transparent 55%),
    var(--ink);
  min-height: 100vh;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* fine film grain over everything (atmosphere, not noise) */
.grain {
  position: fixed; inset: 0; z-index: 1; pointer-events: none; opacity: .5;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
}

::selection { background: var(--ember); color: #1a1206; }

a { color: var(--ember); text-decoration: none; }
.mono { font-family: var(--mono); font-size: .82em; letter-spacing: .02em; }
em { font-style: italic; }

/* shared buttons -------------------------------------------------------- */
.btn {
  cursor: pointer; font-family: var(--ui); font-weight: 800; font-size: 15px;
  border-radius: 999px; padding: 13px 24px; border: 1px solid transparent;
  transition: transform .08s ease, filter .15s ease, background .15s ease, color .15s ease;
  letter-spacing: .01em; display: inline-flex; align-items: center; gap: 8px;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: linear-gradient(180deg, var(--ember), var(--ember-deep));
  color: #1c1004; box-shadow: 0 10px 26px -12px var(--ember-deep);
}
.btn-primary:hover { filter: brightness(1.07) saturate(1.05); }
.btn-ghost { background: transparent; border-color: var(--line-2); color: var(--bone); }
.btn-ghost:hover { border-color: var(--ember); color: var(--ember); }
.btn.small { padding: 8px 15px; font-size: 13px; }

/* ============================================================================
   NAV
   ========================================================================== */
.nav {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px clamp(18px, 4vw, 44px);
  background: color-mix(in oklab, var(--ink) 78%, transparent);
  backdrop-filter: blur(12px) saturate(1.2);
  border-bottom: 1px solid var(--line);
}
.nav-brand { display: flex; align-items: center; gap: 11px; color: var(--bone); }
.nav-glyph { font-family: var(--mono); color: var(--ember); letter-spacing: -2px; font-size: 18px; }
.nav-name { font-family: var(--display); font-weight: 900; font-size: 20px; letter-spacing: .2px; }
.nav-links { display: flex; align-items: center; gap: clamp(8px, 2vw, 26px); }
.nav-links a { color: var(--bone-dim); font-weight: 700; font-size: 14px; }
.nav-links a:hover { color: var(--bone); }
.nav-links a:not(.nav-cta) { display: none; }
.nav-cta {
  color: var(--ember) !important; border: 1px solid var(--line-2);
  padding: 9px 16px; border-radius: 999px;
}
.nav-cta:hover { border-color: var(--ember); }
@media (min-width: 760px) { .nav-links a:not(.nav-cta) { display: inline; } }

/* ============================================================================
   HERO
   ========================================================================== */
.hero {
  position: relative; overflow: hidden;
  padding: clamp(48px, 9vw, 110px) clamp(18px, 4vw, 44px) clamp(40px, 7vw, 84px);
  border-bottom: 1px solid var(--line);
}
/* faint barcode stripes bleeding in from the right edge */
.hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .05;
  background: repeating-linear-gradient(90deg, var(--bone) 0 2px, transparent 2px 9px);
  -webkit-mask-image: linear-gradient(90deg, transparent 55%, #000 100%);
  mask-image: linear-gradient(90deg, transparent 55%, #000 100%);
}
/* slow scan light sweeping down the hero */
.hero-scanline {
  position: absolute; left: 0; right: 0; top: 0; height: 140px; pointer-events: none; z-index: 2;
  background: linear-gradient(180deg, transparent, color-mix(in oklab, var(--ember) 22%, transparent), transparent);
  animation: scan 7s linear infinite; opacity: .5;
}
@keyframes scan { 0% { transform: translateY(-160px); } 100% { transform: translateY(92vh); } }

.hero-inner {
  position: relative; z-index: 3; max-width: var(--maxw); margin: 0 auto;
  display: grid; grid-template-columns: 1.15fr .85fr; gap: clamp(28px, 5vw, 64px); align-items: center;
}
@media (max-width: 880px) { .hero-inner { grid-template-columns: 1fr; } }

.eyebrow {
  font-family: var(--mono); text-transform: uppercase; letter-spacing: .26em;
  font-size: 11px; color: var(--ember); margin: 0 0 22px;
}
.hero-title {
  font-family: var(--display); font-weight: 900; font-optical-sizing: auto;
  font-size: clamp(44px, 8vw, 92px); line-height: .96; letter-spacing: -.015em;
  margin: 0 0 24px; color: var(--bone);
}
.hero-title em { color: var(--ember); font-style: italic; font-weight: 500; }
.hero-sub {
  font-size: clamp(16px, 1.7vw, 19px); color: var(--bone-dim); max-width: 54ch;
  margin: 0 0 30px;
}
.hero-sub b { color: var(--bone); font-weight: 700; }
.hero-sub i { color: var(--rune); font-style: italic; }
.hero-cta { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 20px; }
.hero-foot { font-size: 13px; color: var(--bone-faint); margin: 0; }
.hero-foot .mono { color: var(--ember); }

/* specimen wall — die-cut sticker creatures on a thermal-paper card */
.hero-specimens { justify-self: end; width: 100%; max-width: 420px; }
.specimen-frame {
  background:
    repeating-linear-gradient(0deg, rgba(0,0,0,.03) 0 1px, transparent 1px 4px),
    var(--paper);
  border-radius: 20px; padding: 18px 18px 12px; box-shadow: var(--shadow);
  transform: rotate(-1.4deg);
  border: 1px solid #d8c9a6;
}
.specimen-wall { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.specimen {
  aspect-ratio: 1; background: #fffaf0; border-radius: 14px;
  display: flex; align-items: center; justify-content: center; padding: 8px;
  border: 1px solid #e4d6b6;
  box-shadow: 0 4px 0 #d8c9a6, inset 0 0 0 2px #fff;
  transition: transform .25s cubic-bezier(.2,.8,.3,1.2);
}
.specimen:nth-child(2n) { transform: rotate(2deg); }
.specimen:nth-child(3n) { transform: rotate(-2.5deg); }
.specimen:hover { transform: scale(1.08) rotate(0); }
.specimen .creature-svg { width: 100%; height: 100%; }
.specimen-cap { text-align: center; color: var(--paper-ink); opacity: .55; margin: 12px 0 4px; letter-spacing: .12em; text-transform: uppercase; }

/* staggered load reveal */
.reveal-up { opacity: 0; transform: translateY(18px); animation: rise .8s cubic-bezier(.2,.75,.25,1) forwards; }
.reveal-up[data-delay="0"] { animation-delay: .05s; }
.reveal-up[data-delay="1"] { animation-delay: .16s; }
.reveal-up[data-delay="2"] { animation-delay: .30s; }
.reveal-up[data-delay="3"] { animation-delay: .46s; }
.reveal-up[data-delay="4"] { animation-delay: .60s; }
@keyframes rise { to { opacity: 1; transform: none; } }

/* ============================================================================
   BANDS (shared section frame)
   ========================================================================== */
.band {
  max-width: var(--maxw); margin: 0 auto;
  padding: clamp(56px, 9vw, 104px) clamp(18px, 4vw, 44px);
}
.kicker {
  font-family: var(--mono); text-transform: uppercase; letter-spacing: .22em;
  font-size: 11px; color: var(--ember); margin: 0 0 14px;
}
.band-title {
  font-family: var(--display); font-weight: 900; font-optical-sizing: auto;
  font-size: clamp(30px, 4.6vw, 52px); line-height: 1.04; letter-spacing: -.01em;
  margin: 0 0 8px; color: var(--bone);
}
.band-title em { color: var(--ember); font-style: italic; font-weight: 500; }

/* --- the one idea: genotype vs phenotype --- */
.split {
  display: grid; grid-template-columns: 1fr auto 1fr; gap: clamp(14px, 3vw, 30px);
  align-items: stretch; margin-top: 36px;
}
@media (max-width: 820px) { .split { grid-template-columns: 1fr; } }
.split-card {
  background: linear-gradient(180deg, var(--ink-3), var(--ink-2));
  border: 1px solid var(--line); border-radius: var(--radius); padding: 26px;
  display: grid; gap: 12px; align-content: start;
}
.split-card.genotype { border-top: 3px solid var(--bone-dim); }
.split-card.phenotype { border-top: 3px solid var(--ember); }
.split-tag {
  font-family: var(--mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: .14em;
  color: var(--bone-faint);
}
.split-card h3 { font-family: var(--display); font-weight: 900; font-size: 24px; margin: 0; }
.split-card p { margin: 0; color: var(--bone-dim); font-size: 15px; }
.split-card i { color: var(--rune); }
.split-note { font-family: var(--mono); font-size: 11.5px !important; color: var(--bone-faint) !important; border-top: 1px dashed var(--line-2); padding-top: 10px; }
.split-divider { display: grid; place-items: center; }
.split-divider span {
  font-family: var(--display); font-style: italic; font-size: 20px; color: var(--ember);
  border: 1px solid var(--line-2); border-radius: 999px; width: 46px; height: 46px;
  display: grid; place-items: center; background: var(--ink);
}
@media (max-width: 820px) { .split-divider span { transform: rotate(90deg); } }

/* --- how it works: steps --- */
.steps {
  list-style: none; margin: 40px 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px;
}
@media (max-width: 880px) { .steps { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .steps { grid-template-columns: 1fr; } }
.step {
  background: var(--ink-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; display: grid; gap: 9px; align-content: start; position: relative; overflow: hidden;
}
.step::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: linear-gradient(180deg, var(--ember), transparent);
}
.step-no { font-family: var(--mono); font-size: 13px; color: var(--ember); letter-spacing: .1em; }
.step h3 { font-family: var(--display); font-weight: 700; font-size: 19px; margin: 0; }
.step p { margin: 0; font-size: 14px; color: var(--bone-dim); }

/* --- promises --- */
.promise-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 40px;
}
@media (max-width: 820px) { .promise-grid { grid-template-columns: 1fr; } }
.promise {
  background: radial-gradient(120% 120% at 0% 0%, color-mix(in oklab, var(--ember) 7%, var(--ink-3)), var(--ink-2));
  border: 1px solid var(--line); border-radius: var(--radius); padding: 28px;
  display: grid; gap: 10px; align-content: start;
}
.promise-rune {
  font-family: var(--display); font-size: 38px; color: var(--ember); line-height: 1;
  text-shadow: 0 0 24px color-mix(in oklab, var(--ember) 50%, transparent);
}
.promise h3 { font-family: var(--display); font-weight: 900; font-size: 22px; margin: 0; }
.promise p { margin: 0; color: var(--bone-dim); font-size: 15px; }
.promise i { color: var(--rune); }

/* ============================================================================
   LIVE DEMO SHELL
   ========================================================================== */
.demo { border-top: 1px solid var(--line); }
.demo-lede { color: var(--bone-dim); max-width: 64ch; margin: 6px 0 0; font-size: 15px; }
.app-shell {
  margin-top: 32px; background: linear-gradient(180deg, var(--ink-2), var(--ink));
  border: 1px solid var(--line); border-radius: 22px; padding: clamp(16px, 3vw, 28px);
  box-shadow: var(--shadow);
}

/* tabs / views */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 24px; }
.tab {
  background: transparent; border: 1px solid var(--line); color: var(--bone-dim);
  padding: 9px 17px; font-size: 14px; font-weight: 700; border-radius: 999px; cursor: pointer;
  font-family: var(--ui); transition: border-color .15s, color .15s, background .15s;
}
.tab:hover { border-color: var(--ember); color: var(--bone); }
.tab.is-active { background: var(--ink-4); color: var(--bone); border-color: var(--ember); box-shadow: 0 0 0 3px color-mix(in oklab, var(--ember) 14%, transparent); }
.view { display: none; }
.view.is-active { display: grid; gap: 28px; }
.view-head h2 { font-family: var(--display); font-weight: 900; margin: 0 0 6px; font-size: 24px; }
.view-head .lede { margin: 0; color: var(--bone-dim); font-size: 13.5px; line-height: 1.6; max-width: 72ch; }
.view-head code, .view-head b { color: var(--ember); }
.view-head code { font-family: var(--mono); font-size: .9em; }

.field-label { display: block; font-size: 12px; color: var(--bone-dim); margin-bottom: 6px; font-weight: 600; }
select {
  background: var(--ink-3); border: 1px solid var(--line); color: var(--bone);
  border-radius: 10px; padding: 10px 12px; font-size: 14px; min-width: 160px; font-family: var(--ui);
}
select:focus { outline: none; border-color: var(--ember); }
.warning { color: #ff9a8c; font-size: 13px; margin: 0; min-height: 1.2em; }

/* --- decoder --- */
.decoder { display: grid; gap: 20px; }
#scan-form label { display: block; font-size: 13px; color: var(--bone-dim); margin-bottom: 8px; font-weight: 600; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
#code {
  flex: 1; min-width: 220px; padding: 14px 16px; font-size: 16px;
  background: var(--ink-3); border: 1px solid var(--line-2); border-radius: 12px;
  color: var(--bone); font-family: var(--mono); letter-spacing: 1.5px;
}
#code:focus { outline: none; border-color: var(--ember); box-shadow: 0 0 0 3px color-mix(in oklab, var(--ember) 16%, transparent); }
.hint { margin: 0; font-size: 12px; color: var(--bone-faint); }

/* --- stage / reveal --- */
.stage {
  background:
    repeating-linear-gradient(0deg, rgba(255,255,255,.012) 0 1px, transparent 1px 3px),
    linear-gradient(180deg, var(--ink-3), var(--ink-2));
  border: 1px solid var(--line); border-radius: 20px; padding: 24px;
  min-height: 340px; display: flex; align-items: center; justify-content: center;
}
.stage.empty .placeholder { color: var(--bone-faint); font-family: var(--display); font-style: italic; font-size: 18px; }

.card { width: 100%; display: grid; grid-template-columns: 268px 1fr; gap: 26px; }
@media (max-width: 620px) { .card { grid-template-columns: 1fr; } }

.portrait {
  position: relative; aspect-ratio: 1; padding: 12px; overflow: hidden;
  border-radius: 18px; border: 1px solid var(--line-2);
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(circle at 50% 38%, rgba(255,255,255,.06), transparent 60%),
    repeating-conic-gradient(from 0deg, rgba(227,180,82,.05) 0deg 12deg, transparent 12deg 24deg),
    var(--ink-3);
}
.creature-svg { width: 100%; height: 100%; }
.portrait .sprite-wrap { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }

/* choreographed reveal (Pillar 7) — beats light in sequence (driven by app.js) */
.card.reveal .beat { opacity: 0; transform: translateY(8px); transition: opacity .45s ease, transform .45s ease; }
.card.lit-type  .beat-type  { opacity: 1; transform: none; }
.card.lit-id    .beat-id    { opacity: 1; transform: none; }
.card.lit-stats .beat-stats { opacity: 1; transform: none; }
.card.reveal-done .beat-done { opacity: 1; transform: none; }
.card.reveal:not(.reveal-done) { cursor: pointer; }

.card.reveal .sprite-wrap .creature-svg {
  filter: brightness(0) saturate(0);
  transform: scale(.9); opacity: .9;
  transition: filter .85s cubic-bezier(.2,.8,.3,1), transform .85s cubic-bezier(.2,.9,.3,1.2), opacity .6s;
}
.card.lit-type    .sprite-wrap .creature-svg { transform: scale(.96); }
.card.lit-palette .sprite-wrap .creature-svg { filter: none; transform: none; opacity: 1; }

.reveal-glow {
  position: absolute; inset: 0; border-radius: 18px; pointer-events: none; opacity: 0;
  transition: opacity .5s ease;
  background: radial-gradient(circle at 50% 42%,
    color-mix(in oklab, var(--reveal-type, var(--ember)) 55%, transparent), transparent 62%);
}
.card.lit-type .reveal-glow { opacity: .85; animation: glowPulse 1.8s ease-in-out infinite; }
.card.reveal-done .reveal-glow { opacity: .3; animation: none; }
@keyframes glowPulse { 0%,100% { opacity:.5 } 50% { opacity:.95 } }

.reveal-caption {
  position: absolute; left: 0; right: 0; bottom: 10px; text-align: center;
  font-size: 13px; letter-spacing: .3px; transition: opacity .45s ease; pointer-events: none;
}
.reveal-caption .rc-text {
  background: rgba(10,8,5,.62); color: var(--bone); padding: 4px 11px; border-radius: 20px;
  font-family: var(--display); font-style: italic; text-shadow: 0 1px 6px rgba(0,0,0,.7);
}
.reveal-caption .rc-text:empty { background: transparent; }
.card.reveal-done .reveal-caption { opacity: 0; }

.card.reveal .stat .fill { transform: scaleX(0); transform-origin: left; transition: transform .6s cubic-bezier(.2,.8,.2,1); }
.card.lit-stats .stat .fill { transform: scaleX(1); }

.shiny-badge {
  position: absolute; top: 10px; right: 10px; font-size: 12px; font-weight: 800;
  background: linear-gradient(90deg,#fff,#b9f2ff,#ffd1f5,#fff); color: #222;
  padding: 4px 9px; border-radius: 20px; letter-spacing: 1px;
}

.details { display: grid; gap: 14px; align-content: start; }
.name-row { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.name-row h3 { font-family: var(--display); font-weight: 900; margin: 0; font-size: 34px; letter-spacing: -.01em; }
.rarity-tag { font-family: var(--mono); font-size: 11px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; padding: 4px 10px; border-radius: 8px; }
.r-common { background: #3a3327; color: #d8cbb0; }
.r-uncommon { background: #25433a; color: #9af0d6; }
.r-rare { background: #25364f; color: #a9c8ff; }
.r-epic { background: #543f12; color: #ffd86b; }
.r-legendary { background: linear-gradient(90deg,#1f4a4a,#4a3417); color: #ffe9b0; }

.badges { display: flex; gap: 8px; flex-wrap: wrap; }
.badge { font-size: 12px; padding: 5px 11px; border-radius: 20px; font-weight: 700; border: 1px solid var(--line-2); }
.type-badge { color: #1a1206; border: none; }
.archetype-badge, .region-badge { color: var(--bone-dim); background: var(--ink-3); }

.stats { display: grid; gap: 8px; }
.stat { display: grid; grid-template-columns: 42px 1fr 34px; align-items: center; gap: 10px; font-size: 13px; }
.stat span:first-child { font-weight: 700; color: var(--bone-dim); }
.stat .bar { height: 9px; background: var(--ink-4); border-radius: 5px; overflow: hidden; }
.stat .fill { height: 100%; border-radius: 5px; background: linear-gradient(90deg, var(--moss), var(--ember)); }
.stat .val { text-align: right; color: var(--bone-dim); font-family: var(--mono); font-variant-numeric: tabular-nums; }
.budget-note { font-size: 11.5px; color: var(--bone-faint); line-height: 1.5; }
.budget-note b { color: var(--bone-dim); }

.provenance {
  font-family: var(--mono); font-size: 11px; color: var(--bone-faint);
  background: var(--ink); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
  word-break: break-all; line-height: 1.6;
}
.provenance b { color: var(--ember); }
.provenance summary { cursor: pointer; color: var(--ember); font-family: var(--ui); font-size: 12px; letter-spacing: .3px; list-style: none; font-weight: 700; }
.provenance summary::-webkit-details-marker { display: none; }
.provenance summary::before { content: "▸ "; }
.provenance[open] summary::before { content: "▾ "; }
.prov-body { margin-top: 8px; }

/* --- discovery gates --- */
.unidentified-title { font-family: var(--display); font-style: italic; margin: 0; font-size: 30px; color: var(--bone-dim); letter-spacing: 1px; }
.gate-panel { display: grid; gap: 12px; background: var(--ink); border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.gate-blurb { margin: 0; font-size: 13.5px; color: var(--bone); line-height: 1.55; }
.gate-blurb b { color: var(--ember); }
.resolve-btn { justify-self: start; }
.card.gated .reveal-caption .rc-text { color: var(--moss); }

.dex-cell.unresolved .creature-svg { filter: brightness(0); opacity: .5; }
.dex-cell.unresolved { border-style: dashed; }
.dex-cell.unresolved .dex-name { font-style: italic; color: var(--moss); }

/* --- collection --- */
.collection-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.collection-head h2 { font-family: var(--display); font-weight: 900; margin: 0; font-size: 20px; }
#dex-count { color: var(--bone-faint); font-weight: 400; font-family: var(--mono); font-size: 13px; }
.dex-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 12px; }
.dex-cell {
  background: var(--ink-3); border: 1px solid var(--line); border-radius: 14px; padding: 8px;
  cursor: pointer; transition: border-color .15s ease, transform .08s ease;
  display: grid; gap: 4px; justify-items: center;
}
.dex-cell:hover { border-color: var(--ember); transform: translateY(-2px); }
.dex-cell .creature-svg { width: 64px; height: 64px; }
.dex-cell .dex-name { font-size: 11px; color: var(--bone-dim); text-align: center; }

/* ===================== MANY FORMS ===================== */
.forms-layout { display: grid; grid-template-columns: 300px 1fr; gap: 22px; align-items: start; }
@media (max-width: 760px) { .forms-layout { grid-template-columns: 1fr; } }
.forms-picker { display: grid; gap: 14px; }
.forms-creature { background: var(--ink-3); border: 1px solid var(--line); border-radius: 16px; padding: 16px; display: grid; gap: 12px; }
.portrait.small { aspect-ratio: 1; max-width: 160px; margin: 0 auto; }
.forms-creature-meta { display: grid; gap: 10px; }
.shape-title { font-size: 11px; color: var(--bone-dim); margin-bottom: 4px; font-weight: 600; }
.base-shape { background: var(--ink); border: 1px solid var(--line); border-radius: 10px; padding: 10px; }

.forms-branches { display: grid; gap: 12px; align-content: start; }
.branch-head { font-size: 13px; color: var(--bone-dim); font-weight: 700; }
.branch {
  background: var(--ink-3); border: 1px solid var(--line); border-radius: 14px; padding: 14px;
  cursor: pointer; transition: border-color .15s ease, transform .08s ease, box-shadow .15s ease; display: grid; gap: 8px;
}
.branch:hover { border-color: var(--ember); transform: translateY(-1px); }
.branch.is-selected { border-color: var(--ember); box-shadow: 0 0 0 3px color-mix(in oklab, var(--ember) 16%, transparent); }
.branch-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.branch-name { font-family: var(--display); font-size: 18px; font-weight: 900; }
.branch-role { font-family: var(--mono); font-size: 10.5px; color: var(--moss); text-transform: uppercase; letter-spacing: 1px; }
.branch-blurb { margin: 0; font-size: 12.5px; color: var(--bone-dim); line-height: 1.5; }
.branch-foot { display: flex; justify-content: space-between; gap: 10px; font-size: 11px; color: var(--bone-faint); flex-wrap: wrap; }
.ability-swap { color: var(--ember); }
.ability-keep { color: var(--bone-faint); }

/* ===================== BATTLE ===================== */
.battle-controls { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; }
.field { display: grid; }
#battle-seed { width: 90px; padding: 10px 12px; background: var(--ink-3); border: 1px solid var(--line); border-radius: 10px; color: var(--bone); font-family: var(--mono); }

.battle-arena { display: grid; grid-template-columns: 1fr 1.4fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 860px) { .battle-arena { grid-template-columns: 1fr; } }
.squad-panel { background: var(--ink-3); border: 1px solid var(--line); border-radius: 16px; padding: 14px; display: grid; gap: 8px; }
.sq-head { display: flex; align-items: baseline; justify-content: space-between; }
.sq-head h3 { font-family: var(--display); font-weight: 900; margin: 0; font-size: 16px; }
.sq-side { font-size: 11px; color: var(--bone-faint); font-family: var(--mono); }
.sq-banner { font-size: 12px; color: var(--ember); font-weight: 700; }
.sq-row-label { font-size: 10px; color: var(--bone-faint); text-transform: uppercase; letter-spacing: 1px; margin-top: 4px; }
.sq-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.sq-member { display: flex; gap: 8px; align-items: center; background: var(--ink); border: 1px solid var(--line); border-radius: 10px; padding: 6px 8px; }
.sq-sprite .creature-svg { width: 34px; height: 34px; }
.sq-info { display: grid; gap: 3px; font-size: 12px; }
.sq-tags { display: flex; gap: 5px; align-items: center; flex-wrap: wrap; }
.sq-tags .badge { font-size: 10px; padding: 2px 7px; }
.row-tag, .form-tag { font-size: 10px; color: var(--bone-dim); border: 1px solid var(--line); border-radius: 8px; padding: 1px 6px; font-family: var(--mono); }
.form-tag { color: var(--ember); }
.sq-empty { color: var(--bone-faint); font-size: 12px; }

.battle-log-wrap { display: grid; gap: 10px; }
.battle-verdict { min-height: 1.4em; font-family: var(--display); font-weight: 900; font-size: 17px; color: var(--bone-dim); text-align: center; }
.battle-verdict.done.win-a { color: #ff9a8c; }
.battle-verdict.done.win-b { color: #9af0d6; }
.battle-verdict.done.win-draw { color: var(--rune); }
.battle-log {
  list-style: none; margin: 0; padding: 12px; background: var(--ink); border: 1px solid var(--line);
  border-radius: 14px; max-height: 460px; overflow-y: auto;
  font-family: var(--mono); font-size: 12px; line-height: 1.55; display: grid; gap: 2px;
}
.battle-log li { white-space: pre-wrap; animation: logIn .25s ease; }
@keyframes logIn { from { opacity: 0; transform: translateX(-6px); } to { opacity: 1; transform: none; } }
.log-round { color: var(--ember); font-weight: 700; margin-top: 6px; }
.log-ability { color: var(--rune); }
.log-ko { color: #ff8c8c; font-weight: 700; }
.log-super { color: #ffd86b; }
.log-hit { color: var(--bone); opacity: 0.9; }
.log-verdict { color: var(--moss); font-weight: 800; margin-top: 6px; }

/* ===================== TERRITORY ===================== */
.standings { display: grid; gap: 8px; max-width: 520px; }
.standing { display: grid; grid-template-columns: 80px 1fr 56px; align-items: center; gap: 10px; font-size: 13px; }
.standing-name { font-weight: 800; }
.standing-bar { height: 10px; background: var(--ink-4); border-radius: 5px; overflow: hidden; }
.standing-fill { display: block; height: 100%; border-radius: 5px; }
.standing-val { text-align: right; color: var(--bone-dim); font-family: var(--mono); font-variant-numeric: tabular-nums; }

.map-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; }
.district { background: var(--ink-3); border: 1px solid var(--line); border-radius: 16px; padding: 16px; }
.district h3 { font-family: var(--display); font-weight: 900; margin: 0 0 12px; font-size: 16px; }
.nodes { display: grid; gap: 10px; }
.node { background: var(--ink); border: 1px solid var(--line); border-left-width: 4px; border-radius: 10px; padding: 10px 12px; display: grid; gap: 3px; }
.node-id { font-size: 13px; font-weight: 700; }
.node-owner { font-size: 12px; font-weight: 700; }
.node-holder, .node-def { font-size: 11px; color: var(--bone-faint); }

.readout { background: var(--ink); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; display: grid; gap: 6px; max-width: 560px; }
.readout-row { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--bone-dim); }
.readout-row b { color: var(--bone); }
.readout-row b.ok { color: #9af0d6; }
.readout-row b.bad { color: #ff9a9a; }

/* ============================================================================
   WAITLIST
   ========================================================================== */
.waitlist { display: grid; place-items: center; }
.waitlist-card {
  width: 100%; max-width: 720px; text-align: center;
  background:
    repeating-linear-gradient(0deg, rgba(0,0,0,.025) 0 1px, transparent 1px 5px),
    var(--paper);
  color: var(--paper-ink); border-radius: 24px; padding: clamp(32px, 6vw, 56px);
  box-shadow: var(--shadow); border: 1px solid #d8c9a6;
}
.waitlist-card .kicker { color: var(--ember-deep); }
.waitlist-card .band-title { color: var(--paper-ink); }
.waitlist-card .band-title { font-size: clamp(28px, 4vw, 44px); }
.waitlist-sub { color: #5e503a; margin: 6px auto 22px; max-width: 46ch; font-size: 15px; }
.waitlist-form { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
#waitlist-email {
  flex: 1; min-width: 240px; max-width: 360px; padding: 14px 18px; font-size: 16px;
  background: #fffaf0; border: 1px solid #d3c19a; border-radius: 999px; color: var(--paper-ink);
  font-family: var(--ui);
}
#waitlist-email:focus { outline: none; border-color: var(--ember-deep); box-shadow: 0 0 0 3px color-mix(in oklab, var(--ember) 22%, transparent); }
.waitlist-msg { min-height: 1.3em; margin: 16px 0 0; font-weight: 700; font-size: 14px; color: var(--ember-deep); }
.waitlist-msg.ok { color: #1f7a52; }

/* ============================================================================
   FOOTER
   ========================================================================== */
.site-foot {
  border-top: 1px solid var(--line); padding: 32px clamp(18px, 4vw, 44px);
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  color: var(--bone-faint);
}
.site-foot .mono { font-size: 11.5px; }
.foot-tag { font-family: var(--display); font-style: italic; color: var(--bone-dim); font-size: 15px; }

/* ============================================================================
   REDUCED MOTION
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero-scanline, .specimen { animation: none; transition: none; }
  .reveal-up { opacity: 1; transform: none; animation: none; }
  .card.reveal .beat,
  .card.reveal .sprite-wrap .creature-svg,
  .card.reveal .stat .fill { transition: none; }
  .reveal-glow { animation: none; }
}
