/* ============================================================
   PokéPeg — left rail + cinematic stage + binder rail + stream
   Pokémon TCG palette: Pikachu yellow page + Pokéball red accents,
   dark ink text, with canonical TCG energy colors for the 14 flags.
   ============================================================ */

   :root {
    /* surfaces — yellow ladder */
    --ink:        #ffcb05;       /* page background, Pokémon yellow */
    --ink-2:      #f4bb00;       /* one step deeper */
    --ink-3:      #e6ad00;       /* deepest "page" tone */
    --panel:      #fff09a;       /* light cream panel */
    --panel-2:    #ffe566;
    --panel-3:    #ffd83d;
    --line:       rgba(26, 16, 4, 0.18);
    --line-2:     rgba(26, 16, 4, 0.32);
    --line-3:     rgba(26, 16, 4, 0.55);

    /* type — dark on yellow */
    --text:       #1a1004;       /* near-black coffee */
    --text-2:     #2e2110;
    --muted:      #6b5430;
    --muted-2:    #8c7848;

    /* dark "terminal" surfaces for code-block elements */
    --term:       #1a1004;
    --term-2:     #2a1c08;
    --term-3:     #3a2b14;

    /* brand — Pokémon */
    --red:        #d40c0c;       /* slightly deeper so it reads on yellow */
    --red-2:      #ff2a2a;
    --red-soft:   rgba(212, 12, 12, 0.20);
    /* on a yellow page, "gold accent" reads as red — remap */
    --gold:       #d40c0c;
    --gold-2:     #ff2a2a;
    --gold-soft:  rgba(212, 12, 12, 0.18);
    --blue:       #1a3aaa;       /* deeper blue for contrast */
    --blue-2:     #3b6dee;
    --blue-soft:  rgba(26, 58, 170, 0.16);
  
    /* TCG energy types */
    --e-fire:      #f08030;
    --e-water:     #6890f0;
    --e-grass:     #78c850;
    --e-lightning: #f8d030;
    --e-psychic:   #f85888;
    --e-fighting:  #c03028;
    --e-dark:      #4a3a2e;
    --e-metal:     #b8b8d0;
    --e-fairy:     #ee99ac;
    --e-dragon:    #7038f8;
    --e-normal:    #a8a878;
  
    /* radii */
    --r-sm: 8px;
    --r-md: 14px;
    --r-lg: 22px;
    --r-xl: 28px;
  
    /* fonts */
    --font-sans:    "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
    --font-display: "Space Grotesk", "Inter", system-ui, sans-serif;
    --font-mono:    "JetBrains Mono", ui-monospace, Menlo, monospace;
  
    /* layout */
    --rail-w: 240px;
  }
  
  *, *::before, *::after { box-sizing: border-box; }
  html, body { margin: 0; padding: 0; }
  html { color-scheme: light; }
  body {
    background: var(--ink);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    min-height: 100vh;
    overflow-x: hidden;
  }
  img { display: block; max-width: 100%; }
  a { color: inherit; text-decoration: none; }
  button { font: inherit; color: inherit; cursor: pointer; }
  code, pre { font-family: var(--font-mono); }
  
  /* ---------------- ambient ---------------- */
  .bg-grain {
    position: fixed; inset: 0; z-index: 0;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 200'><filter id='n'><feTurbulence baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='0.5'/></svg>");
    opacity: 0.06;
    mix-blend-mode: multiply;
    pointer-events: none;
  }
  .bg-vignette {
    position: fixed; inset: 0; z-index: 0;
    background:
      radial-gradient(ellipse at 50% -10%, rgba(255,255,255,0.45) 0%, transparent 55%),
      radial-gradient(ellipse at 50% 110%, var(--ink-3) 0%, transparent 55%);
    pointer-events: none;
  }
  /* Pokéball watermark — top-right, very faint */
  body::after {
    content: "";
    position: fixed;
    top: -240px; right: -240px;
    width: 720px; height: 720px;
    border-radius: 50%;
    background:
      radial-gradient(circle, var(--red) 0 50%, transparent 51%),
      linear-gradient(180deg, transparent 49.5%, var(--term) 49.5%, var(--term) 50.5%, transparent 50.5%),
      radial-gradient(circle, transparent 18%, rgba(0,0,0,0.5) 18.5%, rgba(0,0,0,0.5) 22%, transparent 22.5%),
      transparent;
    opacity: 0.07;
    filter: blur(0.5px);
    pointer-events: none;
    z-index: 0;
  }
  
  /* ---------------- LAYOUT: rail + content ---------------- */
  
  .rail {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--rail-w);
    z-index: 30;
    display: flex; flex-direction: column;
    padding: 28px 22px 22px;
    background: linear-gradient(180deg, var(--term) 0%, var(--term-2) 100%);
    border-right: 3px solid var(--text);
    color: #fff5d6;
    box-shadow: 4px 0 0 0 var(--red);
  }
  .rail-brand {
    display: inline-flex; align-items: center; gap: 12px;
    color: #fff5d6;
    margin-bottom: 36px;
  }
  .rail-mark {
    display: inline-grid; place-items: center;
    width: 32px; height: 32px; border-radius: 50%;
    box-shadow: 0 0 0 1px rgba(255,255,255,0.12), 0 4px 14px -4px rgba(238,21,21,0.6);
  }
  .rail-name {
    font-family: var(--font-display);
    font-size: 18px; font-weight: 700;
    letter-spacing: -0.01em;
  }
  .rail-name i {
    font-style: normal;
    background: linear-gradient(120deg, var(--ink) 0%, var(--red-2) 100%);
    -webkit-background-clip: text; background-clip: text; color: transparent;
  }
  
  .rail-nav {
    display: flex; flex-direction: column; gap: 2px;
    margin-top: 4px;
  }
  .rail-link {
    position: relative;
    display: grid;
    grid-template-columns: 30px 1fr;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    color: rgba(255, 245, 214, 0.78);
    transition: background-color .15s ease, color .15s ease;
    font-size: 14px;
  }
  .rail-link::before {
    content: attr(data-glyph);
    font-family: var(--font-mono); font-size: 10px;
    letter-spacing: .08em;
    color: rgba(255, 245, 214, 0.6);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 6px;
    padding: 2px 0;
    text-align: center;
  }
  .rail-link:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--ink);
  }
  .rail-link:hover::before { color: var(--ink); border-color: rgba(255,203,5,.5); }
  .rail-link.is-active {
    background: linear-gradient(90deg, rgba(255,203,5,.16), transparent 80%);
    color: var(--ink);
  }
  .rail-link.is-active::before { color: var(--ink); border-color: var(--ink); }
  .rail-link.is-active::after {
    content: "";
    position: absolute; left: -22px; top: 12px; bottom: 12px;
    width: 3px; border-radius: 0 3px 3px 0;
    background: linear-gradient(180deg, var(--ink), var(--red));
  }
  
  .rail-foot { margin-top: auto; display: grid; gap: 12px; }
  .rail-foot-note {
    margin: 0;
    font-family: var(--font-mono); font-size: 10px;
    color: rgba(255, 245, 214, 0.45); letter-spacing: .04em;
    line-height: 1.6;
  }
  
  .contract-pill {
    position: relative; overflow: hidden;
    display: inline-flex; align-items: center; gap: 8px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 10px;
    font-size: 11px; color: rgba(255, 245, 214, 0.85);
    transition: border-color .15s ease;
  }
  .contract-pill:hover { border-color: var(--ink); }
  .contract-pill-dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--ink); box-shadow: 0 0 10px var(--ink);
  }
  .contract-pill-label {
    font-family: var(--font-mono); font-size: 9px;
    letter-spacing: .14em; text-transform: uppercase;
    color: rgba(255, 245, 214, 0.55);
  }
  .contract-pill-addr { font-family: var(--font-mono); font-size: 11px; color: #fff5d6; }
  .pill-flash {
    position: absolute; right: 10px; top: 50%;
    transform: translateY(-50%);
    font-family: var(--font-mono); font-size: 10px;
    color: var(--ink); opacity: 0; transition: opacity .2s ease;
    pointer-events: none;
  }
  .pill-flash.show { opacity: 1; }
  
  .content {
    margin-left: var(--rail-w);
    position: relative;
    z-index: 1;
  }
  
  /* ---------------- ticker strip ---------------- */
  .ticker {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; gap: 24px;
    padding: 12px 32px;
    background: var(--term);
    color: #fff5d6;
    border-bottom: 3px solid var(--ink);
    font-size: 12px;
  }
  .ticker-cell { display: inline-flex; align-items: center; gap: 8px; }
  .ticker-cell--row { gap: 6px; }
  .ticker-cell--push { margin-left: auto; }
  .ticker-key {
    font-family: var(--font-mono); font-size: 10px;
    letter-spacing: .14em; text-transform: uppercase;
    color: rgba(255, 245, 214, 0.55);
  }
  .ticker-val {
    font-family: var(--font-mono); font-size: 12px;
    color: #fff5d6;
  }
  .ticker-val em { font-style: normal; color: rgba(255, 245, 214, 0.55); font-size: 10px; }
  .status-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--ink); box-shadow: 0 0 10px var(--ink);
    animation: pulse 1.6s ease-in-out infinite;
  }
  @keyframes pulse {
    0%, 100% { opacity: .55; transform: scale(1); }
    50%      { opacity: 1;   transform: scale(1.4); }
  }
  .ticker-text {
    font-family: var(--font-mono); font-size: 11px;
    letter-spacing: .12em; text-transform: uppercase;
    color: rgba(255, 245, 214, 0.85);
  }
  
  .badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px;
    background: var(--panel);
    border: 1px solid var(--line-2);
    border-radius: 999px;
    font-size: 11px; color: var(--text-2);
    font-family: var(--font-mono); letter-spacing: .04em;
  }
  .badge--ok   { background: rgba(120, 200, 80, 0.14); border-color: rgba(120, 200, 80, 0.32); color: #a4e07a; }
  .badge--soon { background: var(--red-soft); border-color: rgba(238, 21, 21, 0.32); color: #ff8b8b; }
  .badge--big  { padding: 8px 14px; font-size: 12px; }
  
  /* ---------------- shared headings ---------------- */
  .micro {
    display: inline-flex; align-items: center; gap: 8px;
    margin: 0 0 8px;
    font-family: var(--font-mono); font-size: 10px;
    letter-spacing: .18em; text-transform: uppercase;
    color: var(--muted);
  }
  .micro .dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--red); box-shadow: 0 0 10px var(--red);
    animation: pulse 1.6s ease-in-out infinite;
  }
  .hh {
    font-family: var(--font-display);
    font-size: clamp(26px, 3vw, 38px);
    font-weight: 700; letter-spacing: -0.02em;
    line-height: 1.1;
    margin: 0;
  }
  
  /* ---------------- STAGE ---------------- */
  .stage {
    position: relative;
    padding: 80px 64px 64px;
    text-align: center;
    overflow: hidden;
    border-bottom: 1px solid var(--line);
  }
  .stage-bg {
    position: absolute; inset: 0;
    background:
      radial-gradient(ellipse 700px 360px at 50% 0%, rgba(255, 255, 255, 0.45), transparent 60%),
      radial-gradient(ellipse 700px 360px at 50% 100%, rgba(212, 12, 12, 0.10), transparent 60%);
    pointer-events: none;
  }
  .stage-spotlight {
    position: absolute; left: 50%; top: 30%;
    width: 520px; height: 520px;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(255, 255, 255, 0.55) 0%, transparent 70%);
    filter: blur(50px);
    pointer-events: none;
  }
  .stage-eyebrow {
    position: relative; z-index: 1;
    justify-content: center;
  }
  .stage-title {
    position: relative; z-index: 1;
    font-family: var(--font-display);
    font-size: clamp(40px, 6vw, 76px);
    font-weight: 700; letter-spacing: -0.03em;
    line-height: 1.02;
    margin: 8px auto 18px;
  }
  .stage-title span { display: block; }
  .stage-title-grad {
    background: linear-gradient(120deg, var(--red) 0%, var(--red-2) 50%, var(--blue) 100%);
    -webkit-background-clip: text; background-clip: text; color: transparent;
  }
  .stage-lead {
    position: relative; z-index: 1;
    max-width: 60ch;
    margin: 0 auto 36px;
    color: var(--text-2);
    font-size: 16px;
  }
  .stage-card-wrap {
    position: relative; z-index: 1;
    display: grid;
    grid-template-columns: minmax(0, 360px) minmax(0, 320px);
    gap: 40px;
    justify-content: center;
    align-items: start;
    margin: 0 auto 32px;
    text-align: left;
  }
  .stage-card { position: relative; }
  .stage-meta {
    background: var(--panel);
    border: 2px solid var(--text);
    border-radius: var(--r-lg);
    padding: 22px 22px 20px;
    box-shadow: 6px 6px 0 0 var(--red);
  }
  .stage-meta-name {
    font-family: var(--font-display);
    font-size: 22px; font-weight: 700;
    margin: 0 0 14px;
    color: var(--red);
  }
  .stage-meta-traits {
    list-style: none; padding: 0; margin: 0;
    display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px;
  }
  .trait-row {
    display: flex; justify-content: space-between; align-items: baseline;
    gap: 12px; padding-bottom: 8px;
    border-bottom: 1px dashed var(--line);
    min-width: 0;
  }
  .trait-key {
    font-family: var(--font-mono); font-size: 10px;
    letter-spacing: .08em; text-transform: uppercase;
    color: var(--muted);
    flex-shrink: 0;
  }
  .trait-val {
    font-size: 13px; color: var(--text);
    font-weight: 500; text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
  }

  /* ---- featured market-price block ---- */
  .stage-price {
    position: relative;
    display: flex; flex-direction: column; align-items: flex-start;
    gap: 4px;
    margin: 4px 0 18px;
    padding: 14px 18px 16px;
    border-radius: 14px;
    background:
      linear-gradient(180deg, rgba(255,203,5,.14), rgba(255,203,5,.04) 60%, transparent),
      var(--panel, #0d1322);
    border: 1px solid rgba(255,203,5,.42);
    box-shadow:
      0 0 0 1px rgba(255,255,255,.04) inset,
      0 12px 28px -16px rgba(255,203,5,.55);
    overflow: hidden;
  }
  .stage-price::before {
    content: ""; position: absolute; inset: 0;
    background: radial-gradient(120% 120% at 100% 0%, rgba(238,21,21,.18), transparent 55%);
    pointer-events: none;
  }
  .stage-price-label {
    font-family: var(--font-mono); font-size: 10px;
    letter-spacing: .14em; text-transform: uppercase;
    color: var(--muted);
    position: relative;
  }
  .stage-price-value {
    font-family: var(--font-mono);
    font-size: clamp(36px, 4.4vw, 52px);
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.01em;
    color: #ee1515;                              /* Pokémon red */
    text-shadow: 0 1px 0 rgba(0,0,0,.35), 0 0 22px rgba(238,21,21,.35);
    white-space: nowrap;                         /* never split a price */
    font-variant-numeric: tabular-nums;
    position: relative;
  }
  .stage-price-source {
    font-family: var(--font-mono); font-size: 10px;
    letter-spacing: .08em; text-transform: uppercase;
    color: rgba(255,255,255,.55);
    position: relative;
  }
  
  .stage-actions {
    position: relative; z-index: 1;
    display: inline-flex; gap: 12px; flex-wrap: wrap;
    justify-content: center;
  }
  .btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 12px 18px; border-radius: 12px;
    font-weight: 600; font-size: 14px;
    border: 1px solid transparent;
    transition: transform .15s ease, background-color .15s ease, border-color .15s ease, box-shadow .15s ease;
  }
  .btn:hover { transform: translateY(-1px); }
  .btn-glyph { font-size: 14px; }
  .btn--primary {
    background: linear-gradient(140deg, var(--red) 0%, #b40e0e 100%);
    color: #fff; border: 1px solid rgba(255,255,255,.10);
    box-shadow: 0 14px 30px -10px rgba(238, 21, 21, 0.65);
  }
  .btn--primary:hover {
    background: linear-gradient(140deg, var(--red-2) 0%, var(--red) 100%);
    box-shadow: 0 18px 36px -10px rgba(255, 77, 77, 0.7);
  }
  .btn--ghost {
    background: var(--panel);
    color: var(--text);
    border-color: var(--text);
    border-width: 2px;
  }
  .btn--ghost:hover { color: var(--red); border-color: var(--red); }
  
  .peg-loading {
    text-align: center; color: var(--muted); padding: 80px 0;
    font-family: var(--font-mono); letter-spacing: .12em; text-transform: uppercase;
    font-size: 12px;
  }
  
  /* ---------------- PEG (card) — scan-first ---------------- */
  
  .peg {
    position: relative;
    display: grid; gap: 0;
    border-radius: var(--r-lg);
    overflow: hidden;
    background: var(--panel-3);
    border: 2px solid var(--text);
    cursor: pointer;
    transition: transform .18s ease, box-shadow .18s ease;
    box-shadow: 4px 4px 0 0 var(--text);
  }
  .peg:hover {
    transform: translateY(-3px) translateX(-1px);
    box-shadow: 6px 6px 0 0 var(--red);
  }
  
  .peg-frame {
    position: relative;
    aspect-ratio: 5 / 7;
    background: #000;
    overflow: hidden;
  }
  .peg-art {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
  }
  .peg-art--missing {
    background: linear-gradient(135deg, var(--ink-2), var(--panel-2));
  }
  
  /* rarity aura — a thin colored inner ring */
  .peg-aura {
    position: absolute; inset: 0;
    pointer-events: none;
    box-shadow:
      inset 0 0 0 2px var(--rarity-color, rgba(255,255,255,0.10)),
      inset 0 0 0 4px rgba(0,0,0,0.22);
  }
  .peg--common   { --rarity-color: rgba(255,255,255,0.16); }
  .peg--uncommon { --rarity-color: rgba(120,200,80,0.55); }
  .peg--rare     { --rarity-color: rgba(106,163,255,0.70); }
  .peg--ultra    { --rarity-color: rgba(238,21,21,0.85); }
  .peg--mythic   { --rarity-color: rgba(255,203,5,0.90); }
  
  /* hero-only holographic sweep */
  .peg-holo {
    position: absolute; inset: 0;
    background: conic-gradient(
      from 0deg,
      transparent 0deg,
      rgba(255, 255, 255, 0.12) 35deg,
      rgba(255, 203, 5, 0.20) 70deg,
      rgba(238, 21, 21, 0.18) 110deg,
      transparent 160deg,
      rgba(47, 109, 255, 0.20) 230deg,
      transparent 290deg
    );
    mix-blend-mode: screen;
    opacity: 0.55;
    pointer-events: none;
  }
  
  /* corner overlays */
  .peg-rarity {
    position: absolute; top: 10px; left: 10px; z-index: 3;
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 9px;
    border-radius: 999px;
    background: rgba(7, 11, 20, 0.85);
    backdrop-filter: blur(6px);
    border: 1px solid var(--rarity-color, rgba(255,255,255,0.18));
    color: #fff5d6;
    font-family: var(--font-mono); font-size: 10px;
    letter-spacing: .12em; text-transform: uppercase;
  }
  .peg-rarity-stars { color: #ffcb05; letter-spacing: 0; }
  .peg-rarity-label { color: #d6d2c0; font-size: 9px; }
  
  .peg-bit {
    position: absolute; top: 10px; right: 10px; z-index: 3;
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 9px;
    border-radius: 999px;
    background: rgba(7, 11, 20, 0.85);
    backdrop-filter: blur(6px);
    border: 1px solid rgba(255, 255, 255, 0.16);
    color: #fff5d6;
    font-family: var(--font-mono); font-size: 10px;
  }
  .peg-bit-dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: #ffcb05; box-shadow: 0 0 8px #ffcb05;
  }
  
  /* foot strip */
  .peg-foot {
    display: grid; gap: 6px;
    padding: 10px 12px 12px;
    background: var(--panel);
    border-top: 2px solid var(--text);
  }
  .peg-foot-head { display: grid; gap: 2px; }
  .peg-name {
    font-family: var(--font-display);
    font-size: 14px; font-weight: 700;
    margin: 0; line-height: 1.2;
    color: var(--text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .peg-set {
    font-family: var(--font-mono); font-size: 10px;
    color: var(--muted); margin: 0; letter-spacing: .04em;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  
  .peg-orbs {
    display: flex; align-items: center; gap: 4px;
    margin-top: 4px;
  }
  .peg-tail {
    margin-left: auto;
    font-size: 10px; color: var(--muted);
    font-family: var(--font-mono);
  }
  
  .orb {
    width: 11px; height: 11px;
    border-radius: 50%;
    border: 1px solid rgba(0,0,0,0.45);
    box-shadow: 0 1px 0 rgba(255,255,255,0.18) inset, 0 4px 8px -4px rgba(0,0,0,0.7);
    background: var(--e-normal);
  }
  .orb--fire      { background: radial-gradient(circle at 35% 30%, #ffba78, var(--e-fire)); }
  .orb--water     { background: radial-gradient(circle at 35% 30%, #b6c9ff, var(--e-water)); }
  .orb--grass     { background: radial-gradient(circle at 35% 30%, #b6e89a, var(--e-grass)); }
  .orb--lightning { background: radial-gradient(circle at 35% 30%, #fff09a, var(--e-lightning)); }
  .orb--psychic   { background: radial-gradient(circle at 35% 30%, #ffb3ce, var(--e-psychic)); }
  .orb--fighting  { background: radial-gradient(circle at 35% 30%, #f0827b, var(--e-fighting)); }
  .orb--dark      { background: radial-gradient(circle at 35% 30%, #8a7a6e, var(--e-dark)); }
  .orb--metal     { background: radial-gradient(circle at 35% 30%, #e6e6f4, var(--e-metal)); }
  .orb--fairy     { background: radial-gradient(circle at 35% 30%, #ffd0dc, var(--e-fairy)); }
  
  /* hero peg — extra payload */
  .peg--hero {
    border-color: var(--text);
    box-shadow:
      8px 8px 0 0 var(--red),
      0 24px 60px -20px rgba(0, 0, 0, 0.4);
  }
  .peg--hero:hover { box-shadow: 10px 10px 0 0 var(--red), 0 28px 70px -20px rgba(0, 0, 0, 0.5); }
  .peg--hero .peg-frame { aspect-ratio: 5 / 7; }
  .peg--hero .peg-name { font-size: 16px; }
  .peg-line {
    display: flex; align-items: baseline; gap: 8px;
    font-family: var(--font-mono); font-size: 11px;
    border-top: 1px dashed var(--line);
    padding-top: 6px; margin-top: 2px;
    color: var(--text-2);
  }
  .peg-line-key {
    color: var(--muted);
    font-size: 9px; letter-spacing: .14em; text-transform: uppercase;
    min-width: 36px;
  }
  .peg-line-val {
    color: var(--text);
    font-size: 11px; white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis;
  }
  .peg-energies {
    display: flex; flex-wrap: wrap; gap: 4px;
    margin-top: 6px;
  }
  
  /* ---------------- ENERGY CHIPS ---------------- */
  .chip {
    display: inline-flex; align-items: center;
    padding: 3px 9px;
    border-radius: 999px;
    font-family: var(--font-mono); font-size: 10px;
    letter-spacing: .04em;
    color: #fff;
    border: 1px solid transparent;
    white-space: nowrap;
    text-transform: lowercase;
  }
  .chip::before {
    content: "";
    width: 6px; height: 6px; border-radius: 50%;
    background: rgba(255,255,255,0.85);
    margin-right: 6px;
    box-shadow: 0 0 6px rgba(255,255,255,0.6);
  }
  .chip--off {
    background: transparent !important;
    color: rgba(255,255,255,0.36) !important;
    border-color: rgba(255,255,255,0.10) !important;
  }
  .chip--off::before { background: rgba(255,255,255,0.18); box-shadow: none; }
  
  .chip--fire      { background: var(--e-fire);      border-color: rgba(255,255,255,0.22); }
  .chip--water     { background: var(--e-water);     border-color: rgba(255,255,255,0.22); }
  .chip--grass     { background: var(--e-grass);     border-color: rgba(255,255,255,0.22); color: #0e2310; }
  .chip--lightning { background: var(--e-lightning); border-color: rgba(0,0,0,0.18);       color: #2a1f00; }
  .chip--lightning::before { background: rgba(0,0,0,0.4); box-shadow: 0 0 6px rgba(0,0,0,0.3); }
  .chip--psychic   { background: var(--e-psychic);   border-color: rgba(255,255,255,0.22); }
  .chip--fighting  { background: var(--e-fighting);  border-color: rgba(255,255,255,0.22); }
  .chip--dark      { background: var(--e-dark);      border-color: rgba(255,255,255,0.22); }
  .chip--metal     { background: var(--e-metal);     border-color: rgba(0,0,0,0.18);       color: #1c1c2a; }
  .chip--metal::before { background: rgba(0,0,0,0.45); box-shadow: 0 0 6px rgba(0,0,0,0.3); }
  .chip--fairy     { background: var(--e-fairy);     border-color: rgba(255,255,255,0.22); color: #2a1622; }
  .chip--dragon    { background: var(--e-dragon);    border-color: rgba(255,255,255,0.22); }
  .chip--normal    { background: var(--e-normal);    border-color: rgba(255,255,255,0.22); color: #1f1f10; }
  
  /* ---------------- BINDER (horizontal rail) ---------------- */
  .binder { padding: 64px 0 56px; border-bottom: 1px solid var(--line); }
  .binder-head {
    display: flex; align-items: flex-end; justify-content: space-between;
    gap: 24px; flex-wrap: wrap;
    padding: 0 64px 24px;
  }
  .binder-meta { text-align: right; }
  .binder-hint {
    margin: 0 0 8px;
    font-family: var(--font-mono); font-size: 10px;
    color: var(--muted); letter-spacing: .14em; text-transform: uppercase;
  }
  .binder-counters {
    list-style: none; padding: 0; margin: 0;
    display: inline-flex; gap: 18px;
  }
  .binder-counters li {
    display: grid; gap: 2px;
    text-align: right;
  }
  .binder-counters b {
    font-family: var(--font-display);
    font-size: 18px; color: var(--red);
  }
  .binder-counters span {
    font-family: var(--font-mono); font-size: 10px;
    color: var(--muted); letter-spacing: .04em;
  }
  
  .binder-rail {
    display: flex; gap: 16px;
    padding: 6px 64px 24px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scrollbar-width: thin;
    scrollbar-color: var(--panel-3) transparent;
  }
  .binder-rail::-webkit-scrollbar { height: 8px; }
  .binder-rail::-webkit-scrollbar-thumb { background: var(--panel-2); border-radius: 8px; }
  .binder-rail::-webkit-scrollbar-track { background: transparent; }
  .binder-rail .peg {
    flex: 0 0 240px;
    scroll-snap-align: start;
  }
  .rail-loading {
    color: var(--muted); padding: 32px 0; margin: 0 64px;
    font-family: var(--font-mono); letter-spacing: .14em; text-transform: uppercase;
    font-size: 11px;
  }
  
  /* ---------------- STREAM ---------------- */
  .stream {
    padding: 64px 64px 56px;
    border-bottom: 1px solid var(--line);
  }
  .stream-head {
    display: flex; align-items: flex-end; justify-content: space-between;
    gap: 24px; flex-wrap: wrap;
    margin-bottom: 24px;
  }
  .stream-search {
    position: relative;
    display: inline-flex; align-items: center;
    background: var(--panel);
    border: 1px solid var(--line-2);
    border-radius: 999px;
    padding: 6px 12px 6px 32px;
    width: 320px;
  }
  .stream-search-icon { position: absolute; left: 12px; color: var(--muted); display: inline-flex; }
  .stream-search input {
    flex: 1;
    background: transparent; border: 0; outline: 0;
    color: var(--text);
    font-family: var(--font-mono); font-size: 12px;
  }
  .stream-search input::placeholder { color: var(--muted); }
  .stream-search-clear {
    background: transparent; border: 0;
    color: var(--muted); font-size: 16px;
    padding: 0 4px;
  }
  
  .stream-table-head, .stream-row {
    display: grid;
    grid-template-columns: 220px 220px minmax(0, 1fr) 120px 160px 80px;
    gap: 18px;
    align-items: center;
    padding: 10px 16px;
  }
  .stream-table-head {
    font-family: var(--font-mono); font-size: 10px;
    letter-spacing: .14em; text-transform: uppercase;
    color: #fff5d6;
    background: var(--term);
    border: 2px solid var(--text);
    border-radius: 10px 10px 0 0;
    border-bottom: 0;
  }
  .ta-right { text-align: right; }
  
  .stream-list {
    list-style: none; padding: 0; margin: 0;
    background: var(--panel);
    border: 2px solid var(--text);
    border-top: 0;
    border-radius: 0 0 10px 10px;
    max-height: 640px; overflow-y: auto;
    box-shadow: 6px 6px 0 0 var(--text);
  }
  
  .stream-row {
    border-bottom: 1px dashed var(--line);
    transition: background-color .2s ease, transform .25s ease;
    font-size: 13px;
  }
  .stream-row:last-child { border-bottom: 0; }
  .stream-row:hover { background: var(--panel-2); }
  .stream-row--new {
    background: var(--red-soft);
    transform: translateX(-6px);
  }
  .stream-row .feed-addr {
    font-family: var(--font-mono); font-size: 12px;
    color: var(--text);
    border-bottom: 1px dashed var(--line-2);
  }
  .stream-row .feed-addr:hover { color: var(--red); border-bottom-color: var(--red); }
  .stream-row .feed-pulled {
    font-family: var(--font-mono); font-size: 12px;
    color: var(--text-2);
    display: flex; align-items: center; gap: 6px;
  }
  .stream-row .feed-pulled .feed-count {
    color: var(--red); font-weight: 700;
  }
  .stream-row .feed-thumbs {
    display: flex; align-items: center;
    min-width: 0;
  }
  .stream-row .feed-block {
    font-family: var(--font-mono); font-size: 11px;
    color: var(--muted);
  }
  .stream-row .feed-block code { color: var(--text); }
  .stream-row .feed-tx {
    font-family: var(--font-mono); font-size: 11px;
    color: var(--muted);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .stream-row .feed-tx:hover { color: var(--red); }
  .stream-row .feed-time {
    font-family: var(--font-mono); font-size: 11px;
    color: var(--muted);
    text-align: right;
    white-space: nowrap;
  }
  .stream-empty {
    padding: 32px 24px; color: var(--muted);
    font-size: 13px; text-align: center;
  }
  
  .thumb {
    position: relative;
    width: 36px; height: 50px;
    border-radius: 5px;
    overflow: hidden;
    margin-right: -10px;
    background: #000;
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 4px 10px -4px rgba(0, 0, 0, 0.7);
    flex: 0 0 auto;
  }
  .thumb-art {
    width: 100%; height: 100%;
    object-fit: cover;
  }
  .thumb-art--missing { background: linear-gradient(135deg, var(--ink-2), var(--panel-2)); }
  .thumb--mythic { border-color: #ffcb05; box-shadow: 0 0 0 1px #ffe066 inset, 0 4px 10px -4px rgba(255, 203, 5, 0.4); }
  .thumb--ultra  { border-color: var(--red);  box-shadow: 0 0 0 1px var(--red-2)  inset, 0 4px 10px -4px var(--red-soft); }
  .thumb--rare   { border-color: var(--blue); box-shadow: 0 0 0 1px var(--blue-2) inset, 0 4px 10px -4px var(--blue-soft); }
  
  /* ---------------- ANATOMY ---------------- */
  .anatomy-host {
    padding: 64px 64px 56px;
    border-bottom: 1px solid var(--line);
  }
  .anatomy-head { max-width: 720px; margin-bottom: 28px; }
  .anatomy-lead { color: var(--text-2); font-size: 16px; margin: 12px 0 0; }
  .anatomy-lead em { font-style: normal; color: var(--red); font-weight: 700; }
  
  .anatomy-card {
    background: var(--panel);
    border: 2px solid var(--text);
    border-radius: var(--r-xl);
    padding: 32px;
    display: grid; gap: 24px;
    box-shadow: 8px 8px 0 0 var(--text);
  }
  
  .anatomy-addr {
    display: flex; align-items: baseline; flex-wrap: wrap;
    font-family: var(--font-mono);
    font-size: clamp(16px, 2.2vw, 24px);
    word-break: break-all;
    padding: 22px 22px 16px;
    background: var(--term);
    color: #fff5d6;
    border: 2px solid var(--text);
    border-radius: var(--r-md);
  }
  .anatomy-addr-lead { color: #d6cfb6; }
  .anatomy-addr-tail {
    color: var(--ink);
    font-weight: 700;
    background: linear-gradient(120deg, rgba(255,203,5,0.18), rgba(255,42,42,0.18));
    padding: 0 6px;
    border-radius: 6px;
    border: 1px solid var(--ink);
    margin-left: 4px;
  }
  .anatomy-legend {
    display: flex; align-items: center; gap: 12px;
    flex-wrap: wrap;
    margin-top: -10px;
    font-family: var(--font-mono); font-size: 10px;
    letter-spacing: .04em;
  }
  .anatomy-legend-dim   { color: var(--muted); }
  .anatomy-legend-arrow { color: var(--muted); }
  .anatomy-legend-hot   { color: var(--red); font-weight: 700; }
  
  .anatomy-rows {
    display: grid; gap: 4px;
    background: var(--ink);
    border: 2px solid var(--text);
    border-radius: var(--r-md);
    padding: 8px;
  }
  .anatomy-row {
    display: grid;
    grid-template-columns: 60px auto minmax(0, 1fr) 14px;
    align-items: center;
    gap: 14px;
    padding: 10px 14px;
    border-radius: 8px;
    opacity: 0.45;
    transition: background-color .15s ease;
  }
  .anatomy-row.is-on { opacity: 1; background: var(--panel); }
  .anatomy-row-bit {
    font-family: var(--font-mono); font-size: 10px;
    color: var(--text-2); letter-spacing: .04em;
    text-transform: uppercase;
  }
  .anatomy-row-blurb {
    font-size: 12px; color: var(--text);
    line-height: 1.45;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .anatomy-row:not(.is-on) .anatomy-row-blurb { color: var(--muted-2); }
  .anatomy-row-led {
    width: 10px; height: 10px;
    border-radius: 50%;
    background: rgba(26, 16, 4, 0.18);
    border: 1px solid rgba(26, 16, 4, 0.32);
  }
  .anatomy-row-led.is-on {
    background: var(--red);
    border-color: var(--red);
    box-shadow: 0 0 10px var(--red);
  }
  
  .anatomy-pool {
    background: var(--ink);
    border: 2px solid var(--text);
    border-radius: var(--r-md);
    padding: 18px 22px;
  }
  .anatomy-pool-title {
    margin: 0 0 12px;
    font-family: var(--font-mono); font-size: 11px;
    font-weight: 700;
    color: var(--red);
    text-transform: uppercase; letter-spacing: .14em;
  }
  .anatomy-pool dl {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 6px 18px;
    margin: 0;
  }
  .anatomy-pool dt {
    font-family: var(--font-mono); font-size: 11px;
    color: var(--muted); letter-spacing: .04em;
  }
  .anatomy-pool dd {
    margin: 0;
    font-family: var(--font-mono); font-size: 12px;
    color: var(--text);
  }
  
  /* ---------------- TYPE CHART ---------------- */
  .chart {
    padding: 64px 64px 80px;
    border-bottom: 1px solid var(--line);
  }
  .chart-head {
    display: flex; align-items: flex-end; justify-content: space-between;
    gap: 24px; flex-wrap: wrap;
    margin-bottom: 24px;
  }
  .chart-note {
    margin: 0;
    font-family: var(--font-mono); font-size: 11px;
    color: var(--muted); letter-spacing: .04em;
    max-width: 36ch; text-align: right;
  }
  .chart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
  }
  .chart-tile {
    position: relative;
    background: var(--panel);
    border: 2px solid var(--text);
    border-radius: var(--r-md);
    padding: 16px 18px 18px 22px;
    display: grid; gap: 8px;
    overflow: hidden;
    transition: transform .15s ease, box-shadow .15s ease;
    box-shadow: 3px 3px 0 0 var(--text);
  }
  .chart-tile:hover { transform: translateY(-2px) translateX(-1px); box-shadow: 5px 5px 0 0 var(--red); }
  .chart-tile::before {
    content: "";
    position: absolute; left: 0; top: 0; bottom: 0;
    width: 4px;
    background: var(--e-normal);
  }
  .chart-tile[data-energy="fire"]::before      { background: var(--e-fire); }
  .chart-tile[data-energy="water"]::before     { background: var(--e-water); }
  .chart-tile[data-energy="grass"]::before     { background: var(--e-grass); }
  .chart-tile[data-energy="lightning"]::before { background: var(--e-lightning); }
  .chart-tile[data-energy="psychic"]::before   { background: var(--e-psychic); }
  .chart-tile[data-energy="fighting"]::before  { background: var(--e-fighting); }
  .chart-tile[data-energy="dark"]::before      { background: var(--e-dark); }
  .chart-tile[data-energy="metal"]::before     { background: var(--e-metal); }
  .chart-tile[data-energy="fairy"]::before     { background: var(--e-fairy); }
  .chart-tile-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 8px;
  }
  .chart-tile-bit {
    font-family: var(--font-mono); font-size: 10px;
    color: var(--red); letter-spacing: .08em;
    background: rgba(212, 12, 12, 0.10);
    padding: 2px 8px; border-radius: 999px;
    border: 1px solid var(--red);
    font-weight: 700;
  }
  .chart-tile-desc {
    font-size: 12px; color: var(--text-2);
    margin: 0; line-height: 1.45;
  }
  .chart-tile-meta {
    font-family: var(--font-mono); font-size: 10px;
    color: var(--muted); letter-spacing: .08em;
    margin: 0; text-transform: uppercase;
  }
  
  /* ---------------- FOOTER ---------------- */
  .footer {
    padding: 32px 64px 48px;
    position: relative;
  }
  .footer-ribbon {
    height: 4px;
    background: linear-gradient(90deg,
      var(--e-fire) 0%, var(--e-water) 14%, var(--e-grass) 28%,
      var(--e-lightning) 42%, var(--e-psychic) 56%, var(--e-fighting) 70%,
      var(--e-dark) 84%, var(--red) 100%);
    border-radius: 2px;
    margin-bottom: 24px;
    opacity: 0.9;
  }
  .footer-line {
    display: flex; align-items: center; justify-content: space-between;
    gap: 20px; flex-wrap: wrap;
    color: var(--muted);
    font-size: 12px;
    font-family: var(--font-mono); letter-spacing: .04em;
  }
  .footer-mark { color: var(--text); font-weight: 700; }
  .footer-mark i {
    font-style: normal;
    color: var(--red);
  }
  
  /* ---------------- responsive ---------------- */
  @media (max-width: 1100px) {
    .stage-card-wrap { grid-template-columns: minmax(0, 360px); }
    .stream-table-head, .stream-row {
      grid-template-columns: 160px 1fr 110px 60px;
    }
    .stream-table-head > :nth-child(3),
    .stream-row > .feed-thumbs,
    .stream-table-head > :nth-child(5),
    .stream-row > .feed-tx { display: none; }
  }
  @media (max-width: 900px) {
    :root { --rail-w: 0px; }
    .rail {
      position: static;
      width: auto; height: auto;
      flex-direction: row; align-items: center;
      border-right: 0; border-bottom: 1px solid var(--line);
      padding: 14px 18px;
      gap: 18px;
    }
    .rail-brand { margin: 0; }
    .rail-nav { flex-direction: row; flex-wrap: wrap; gap: 6px; margin: 0; }
    .rail-link { padding: 6px 10px; }
    .rail-link::before { display: none; }
    .rail-link.is-active::after { display: none; }
    .rail-foot { display: none; }
    .content { margin-left: 0; }
  
    .ticker { padding: 10px 18px; gap: 14px; flex-wrap: wrap; }
    .stage { padding: 48px 22px; }
    .binder-head, .binder-rail, .stream, .anatomy-host, .chart, .footer { padding-left: 22px; padding-right: 22px; }
  }
  @media (max-width: 640px) {
    .stage-title { font-size: clamp(32px, 9vw, 48px); }
    .stage-meta { display: none; }
    .stage-card-wrap { grid-template-columns: minmax(0, 320px); }
    .binder-rail .peg { flex: 0 0 200px; }
    .stream-table-head, .stream-row {
      grid-template-columns: 130px 1fr 60px;
    }
    .stream-table-head > :nth-child(4),
    .stream-row > .feed-block { display: none; }
  }