  @font-face { font-family: 'RoyaleCouture'; src: url('fonts/custom/royale-couture-sans.otf') format('opentype'); }
  @font-face { font-family: 'Handwriting';   src: url('fonts/custom/My handwriting.ttf') format('truetype'); }

  *, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

  :root {
    --bg:         #0a0814;
    --bg-2:       #15102a;
    --panel:      #1c1538;
    --panel-2:    #261c4d;
    --ink:        #ECE6FF;
    --muted:      rgba(236,230,255,0.55);
    --dim:        rgba(236,230,255,0.32);
    --line:       rgba(185,173,249,0.18);
    --cyan:       #74D7FE;
    --violet:     #8A6FE8;
    --lavender:   #B9ADF9;
    --pink:       #DE97E7;
    --pink-hot:   #FF6FAE;
    --gold:       #FFD66B;
    --acid:       #6BFFAE;
    --warn:       #FF6F6F;
    --r3:         #6BB6FF;   /* 3-star: blue */
    --r4:         #C58CFF;   /* 4-star: purple */
    --r5:         #FFC558;   /* 5-star: gold  */

    /* wine/cream palette — pulled forward from the banner-card so the
       rest of the page reads as the same world rather than a generic
       dark-purple gacha shell. */
    --wine-deep:   #5a1838;
    --wine:        #7a2350;
    --wine-accent: #a8366d;
    --wine-glow:   rgba(168,54,109,0.32);
    --cream:       #f4ebe4;
    --cream-2:     #e6dad2;
    --cream-dim:   #ab9790;
    --line-warm:   rgba(244,235,228,0.14);
    --line-wine:   rgba(168,54,109,0.34);
    --surface:     linear-gradient(180deg, rgba(34,18,34,0.62) 0%, rgba(20,10,22,0.48) 100%);
  }

  html, body {
    width: 100%; min-height: 100%;
    background:
      radial-gradient(900px 600px at 82% -10%, rgba(168,54,109,0.20) 0%, transparent 55%),
      radial-gradient(1100px 800px at 18% 115%, rgba(90,24,56,0.22) 0%, transparent 60%),
      #0a0712;
    color: var(--ink);
    font-family: 'JetBrains Mono', 'IBM Plex Mono', ui-monospace, monospace;
    font-size: 13px;
    overflow-x: hidden;
  }

  a { color: inherit; }

  /* ─── top bar ─── */
  .topbar {
    position: sticky; top: 0; z-index: 30;
    display: flex; align-items: center; gap: 14px;
    padding: 11px 20px;
    background:
      linear-gradient(180deg, rgba(8,6,16,0.94) 0%, rgba(12,7,18,0.78) 100%);
    border-bottom: 1px solid var(--line-warm);
    box-shadow:
      0 1px 0 rgba(168,54,109,0.22),
      0 14px 32px -16px rgba(168,54,109,0.18);
    backdrop-filter: blur(10px);
  }
  .pity {
    display: flex; flex-direction: column; gap: 2px;
    padding: 6px 12px;
    border: 1px solid var(--line-warm); border-radius: 8px;
    background: linear-gradient(180deg, rgba(34,18,32,0.65), rgba(20,10,20,0.45));
  }
  .pity-row {
    font-family: 'Space Grotesk', system-ui, sans-serif;
    font-size: 10px; letter-spacing: 0.14em;
    color: var(--cream-dim);
    text-transform: uppercase;
  }
  .pity-row b {
    color: var(--cream); font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
    letter-spacing: 0.04em;
  }
  .pity-row.r5 b { color: var(--r5); }
  .pity-row.r4 b { color: var(--r4); }
  .pity-row .guar {
    display: none;
    margin-left: 6px;
    padding: 0 5px;
    border-radius: 3px;
    font-size: 8px; letter-spacing: 0.18em;
    background: var(--wine-accent); color: var(--cream);
    vertical-align: 1px;
  }

  .reset-btn {
    margin-left: 6px;
    padding: 7px 12px;
    font: inherit;
    font-family: 'Space Grotesk', system-ui, sans-serif;
    font-size: 10px; font-weight: 600; letter-spacing: 0.18em;
    color: var(--cream);
    background: rgba(90,24,56,0.32);
    border: 1px solid rgba(168,54,109,0.55);
    border-radius: 6px;
    cursor: pointer;
    text-transform: uppercase;
    transition: background .15s, border-color .15s, transform .12s;
  }
  .reset-btn:hover {
    background: rgba(122,35,80,0.5);
    border-color: var(--wine-accent);
    transform: translateY(-1px);
  }

  .title-block { flex: 1; display: flex; flex-direction: column; align-items: center; }
  .title {
    font-family: 'RoyaleCouture', serif;
    font-size: 28px; letter-spacing: 0.04em;
    color: var(--cream);
    text-shadow: 0 0 18px rgba(168,54,109,0.5);
    position: relative;
  }
  .title::before, .title::after {
    content: '';
    position: absolute; top: 50%;
    width: 28px; height: 1px;
    background: linear-gradient(90deg, transparent, var(--wine-accent));
    opacity: 0.55;
  }
  .title::before { right: calc(100% + 14px); transform: scaleX(-1); }
  .title::after  { left:  calc(100% + 14px); }
  .title em { color: var(--wine-accent); font-style: italic; }
  .title small {
    display: inline-block; margin-left: 8px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 9px; color: var(--cream-dim); letter-spacing: 0.24em; vertical-align: middle;
    text-shadow: none;
  }

  .currencies { display: flex; gap: 10px; }
  .currency {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 12px;
    border: 1px solid rgba(244,235,228,0.18);
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(34,18,32,0.68), rgba(20,10,22,0.55));
    color: var(--cream);
    font-size: 12px; font-weight: 600;
    transition: border-color .15s;
  }
  .currency:hover { border-color: rgba(168,54,109,0.6); }
  .currency .ico { width: 14px; height: 14px; }
  .currency.crystals {
    position: relative;
    padding-left: 36px;
    overflow: visible;
  }
  .currency.crystals .ico {
    position: absolute;
    left: -2px; top: 50%;
    transform: translateY(-50%);
    width: 34px; height: 34px;
    background: url('icons/gacha/wish-currency.svg') center/contain no-repeat;
    filter:
      drop-shadow(0 0 8px rgba(168,54,109,0.85))
      drop-shadow(0 0 14px rgba(122,35,80,0.55))
      drop-shadow(0 2px 4px rgba(0,0,0,0.45));
    pointer-events: none;
  }
  .currency b { color: var(--ink); font-variant-numeric: tabular-nums; }
  .currency .add {
    width: 16px; height: 16px; display: inline-flex; align-items: center; justify-content: center;
    border-radius: 50%;
    background: var(--cream);
    color: #2a1018;
    border: 1px solid rgba(90,24,56,0.45);
    font-size: 11px; font-weight: 700;
    cursor: pointer;
    transition: background .15s, border-color .15s, transform .12s;
  }
  .currency .add:hover {
    background: #fff;
    border-color: var(--wine-accent);
    transform: translateY(-1px);
  }

  /* ─── layout ─── */
  .stage {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    padding: 18px;
    max-width: 1480px; margin: 0 auto;
  }
  @media (max-width: 1080px) { .stage { grid-template-columns: 1fr; } }

  /* narrow viewports: cream card takes the full banner width, fox crops
     to a backdrop accent on the right edge so the buttons always have
     room to breathe inside the card. */
  @media (max-width: 720px) {
    .banner { min-height: 0; }
    .banner-card {
      position: relative;
      left: auto; top: auto; bottom: auto;
      width: auto;
      margin: 14px;
      padding: 18px 16px 16px;
    }
    .banner-crew { left: 60%; opacity: 0.35; }
    .featured-tag {
      position: relative;
      left: auto; right: auto; bottom: auto;
      text-align: center;
      margin: 4px 14px 0;
    }
    .featured-tag .up { position: relative; top: auto; right: auto; display: inline-block; margin-right: 6px; }
    .featured-tag .stars { display: inline-block; font-size: 12px; margin-right: 6px; }
    .featured-tag .name { display: inline-block; font-size: 18px; }
    .wish-bar {
      position: relative;
      left: auto; right: auto; bottom: auto;
      justify-content: center;
      margin: 8px 14px 14px;
    }
  }

  /* ─── banner (gacha card) ─── HSR Warp layout: cream text card on
     the left, dark cloudscape with featured character on the right. */
  .banner {
    position: relative;
    border: 1px solid var(--line); border-radius: 14px;
    background:
      linear-gradient(180deg, rgba(20,8,30,0.35) 0%, rgba(20,8,30,0.55) 100%),
      radial-gradient(700px 500px at 80% 30%, rgba(138,111,232,0.35), transparent 60%),
      url('icons/gacha/gachabackground.webp') center/cover no-repeat;
    color: #ffe7f1;
    overflow: hidden;
    min-height: 720px;
  }

  /* cream text card on the left — palette: #f4ebe4 light / #ab9790 dark.
     Hairline edge + soft drop, no heavy frame. */
  .banner-card {
    position: absolute;
    left: 14px; top: 14px; bottom: 14px;
    width: 46%;
    background: linear-gradient(180deg, #f4ebe4 0%, #e6dad2 100%);
    border: 1px solid rgba(171,151,144,0.55);
    border-radius: 14px;
    padding: 26px 24px 20px;
    display: flex; flex-direction: column; gap: 12px;
    box-shadow:
      0 1px 0 rgba(255,255,255,0.55) inset,
      0 6px 18px rgba(0,0,0,0.18),
      0 1px 2px rgba(0,0,0,0.08);
    z-index: 3;
    color: #2a1018;
  }

  /* Decorative L-brackets at each corner of the cream card. Tinted with
     the deep-wine accent so the card reads as a scrapbook page taped
     into the cloudscape. */
  .banner-card .bc {
    position: absolute;
    width: 22px; height: 22px;
    border-color: #5a1838;
    border-style: solid;
    border-width: 0;
    pointer-events: none;
  }
  .banner-card .bc-tl { top: -1px; left: -1px;
    border-top-width: 3px; border-left-width: 3px;
    border-top-left-radius: 14px;
  }
  .banner-card .bc-tr { top: -1px; right: -1px;
    border-top-width: 3px; border-right-width: 3px;
    border-top-right-radius: 14px;
  }
  .banner-card .bc-bl { bottom: -1px; left: -1px;
    border-bottom-width: 3px; border-left-width: 3px;
    border-bottom-left-radius: 14px;
  }
  .banner-card .bc-br { bottom: -1px; right: -1px;
    border-bottom-width: 3px; border-right-width: 3px;
    border-bottom-right-radius: 14px;
  }

  /* purples retuned to the wine/burgundy palette of the cloudscape:
       deep wine #5a1838 · primary #7a2350 · accent #a8366d */
  .banner-card .banner-tag {
    align-self: flex-start;
    padding: 5px 14px;
    background: #5a1838; color: #fff;
    font-family: 'Space Grotesk', system-ui, sans-serif;
    font-size: 10px; font-weight: 600;
    letter-spacing: 0.18em; text-transform: uppercase;
    border-radius: 999px;
    box-shadow: 0 1px 2px rgba(31,12,20,0.2);
  }
  .banner-card .banner-title {
    font-family: 'Space Grotesk', system-ui, -apple-system, sans-serif;
    font-weight: 700;
    font-size: 38px; line-height: 1.0;
    letter-spacing: -0.01em;
    color: #1f0c14;
    margin-top: 4px;
  }
  .banner-card .banner-title em {
    color: #1f0c14;
    font-style: italic;
    font-weight: 700;
  }
  .banner-card .banner-sub {
    font-family: 'Space Grotesk', system-ui, sans-serif;
    font-weight: 700;
    font-size: 15px;
    letter-spacing: 0.02em;
    color: #1f0c14;
    margin-top: 2px;
  }
  /* Rule: soft neutral card — diamond accent + mono body text. */
  .banner-card .banner-rule {
    padding: 10px 14px 10px 32px;
    background: rgba(171,151,144,0.22);
    border: 1px solid rgba(171,151,144,0.45);
    color: #2a1018;
    font-family: 'JetBrains Mono', 'IBM Plex Mono', ui-monospace, monospace;
    font-size: 11px; line-height: 1.5;
    border-radius: 8px;
    position: relative;
    margin-top: 2px;
  }
  .banner-card .banner-rule .star {
    position: absolute; left: 14px; top: 10px;
    color: #7a2350; font-size: 11px;
  }
  .banner-card .banner-rule b { color: #1f0c14; font-weight: 700; }
  .banner-featured-label {
    font-family: 'Space Grotesk', system-ui, sans-serif;
    font-size: 10px; letter-spacing: 0.22em; text-transform: uppercase;
    font-weight: 500;
    color: #ab9790;
    margin-top: 6px;
  }
  /* mini-strip: rounded squares, hairline burgundy border, even row. */
  .banner-card .banner-mini-strip {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }
  .banner-card .banner-mini-strip img {
    width: 100%; min-width: 0;
    aspect-ratio: 4/5;
    object-fit: cover; object-position: center top;
    border-radius: 14px;
    border: 1px solid rgba(90,24,56,0.35);
    box-shadow: 0 4px 12px rgba(31,12,20,0.26);
    transition: transform .15s, box-shadow .15s;
  }
  .banner-card .banner-mini-strip img:hover {
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 6px 14px rgba(31,12,20,0.3);
  }
  .banner-card .banner-blurb {
    font-family: 'JetBrains Mono', 'IBM Plex Mono', ui-monospace, monospace;
    font-size: 9.5px;
    color: rgba(42,16,24,0.78);
    line-height: 1.5;
  }
  .banner-card .banner-blurb b { color: #7a2350; font-weight: 700; }
  .banner-card .banner-period {
    margin-top: auto;
    display: flex; flex-direction: column; gap: 2px;
    font-family: 'Space Grotesk', system-ui, sans-serif;
  }
  .banner-card .banner-period .period-label {
    font-size: 10px; color: #ab9790;
    letter-spacing: 0.18em; text-transform: uppercase;
    font-weight: 500;
  }
  .banner-card .banner-period .period-dates {
    font-family: 'JetBrains Mono', 'IBM Plex Mono', ui-monospace, monospace;
    font-size: 14px; color: #2a1018;
    letter-spacing: 0.02em;
    font-weight: 600;
  }

  /* right side: featured fox, no card — just the cloudscape */
  .banner-crew {
    position: absolute;
    left: calc(42% + 28px); right: 0; top: 0; bottom: 0;
    z-index: 1; pointer-events: none;
  }
  .banner-hero {
    position: absolute;
    /* `object-fit: cover` (not contain) — the source image has ~20% of
       transparent padding at the top and the character then runs all
       the way to the bottom edge. In a narrow right column, contain
       was scaling the image down to fit the width and leaving a fat
       strip of dark cloudscape *below* her where EXPERT TROLL + the
       wish bar then sat, instead of overlapping her body. Cover scales
       to fill the box height — the character now reaches the banner
       bottom — and crops some hair off the left (anchored right). */
    left: 0; right: 0; top: 0; bottom: 0;
    width: 100%; height: 100%;
    object-fit: cover; object-position: right bottom;
    filter: drop-shadow(0 14px 32px rgba(0,0,0,0.55));
  }

  /* Featured-tag — no box, just floating text on the cloudscape with a
     dark drop-shadow for legibility. The name is sized large enough to
     intersect the featured-hero illustration. */
  .featured-tag {
    position: absolute; bottom: 78px; right: 24px;
    left: calc(42% + 28px);
    z-index: 4;
    text-align: right;
    background: none;
    padding: 0;
    box-shadow: none;
    color: #fff5fb;
    pointer-events: none;
  }
  .featured-tag .stars {
    color: var(--gold); font-size: 14px; letter-spacing: 0.18em;
    text-shadow: 0 2px 10px rgba(0,0,0,0.6), 0 0 18px rgba(255,209,107,0.6);
  }
  .featured-tag .name {
    font-family: 'Space Grotesk', system-ui, -apple-system, sans-serif;
    font-weight: 700;
    font-size: clamp(32px, 4vw, 52px);
    line-height: 1;
    margin-top: 4px;
    letter-spacing: 0;
    white-space: nowrap;
    text-shadow:
      0 4px 18px rgba(0,0,0,0.85),
      0 2px 6px rgba(0,0,0,0.7),
      0 0 26px rgba(255,177,241,0.4);
  }
  .featured-tag .up {
    position: absolute; top: -10px; right: -2px;
    background: var(--warn); color: #fff;
    font-size: 10px; font-weight: 700; padding: 2px 7px;
    border-radius: 4px; letter-spacing: 0.12em;
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
  }

  /* ─── wish buttons ─── HSR/Genshin Warp style: cream-translucent
     outlined pill with the gold currency overflowing the left edge
     and a thin wine separator between cost and label. Lives under
     the EXPERT TROLL featured-tag in the right half of the banner.

     `left` must clear the cream card's right edge (`14px + 46%`) plus
     room for the gem icon that protrudes ~8px past the wish-btn's
     left edge. `46% + 34px` gives ~20px of buffer past the card. */
  .wish-bar {
    position: absolute; bottom: 22px; right: 24px;
    left: calc(46% + 34px);
    z-index: 4;
    display: flex; gap: 10px;
    justify-content: flex-end;
    flex-wrap: nowrap;
    pointer-events: auto;
  }
  .wish-btn {
    position: relative;
    display: flex; align-items: center; justify-content: center;
    height: 38px;
    flex: 1 1 0;
    min-width: 0;
    max-width: 100%;
    padding: 0 14px 0 42px;
    background: linear-gradient(180deg, rgba(255,250,246,0.92) 0%, rgba(238,228,219,0.88) 100%);
    color: #2a1018;
    border: 1.5px solid rgba(90,24,56,0.55);
    border-radius: 999px;
    box-shadow:
      inset 0 1px 0 rgba(255,255,255,0.7),
      0 3px 10px rgba(31,12,20,0.22);
    font-family: 'Space Grotesk', system-ui, sans-serif;
    cursor: pointer;
    overflow: visible;
    transition: transform .12s, border-color .12s, box-shadow .12s;
  }
  .wish-btn::before {
    content: '';
    position: absolute;
    left: -8px; top: 50%;
    transform: translateY(-50%);
    width: 54px; height: 54px;
    background: url('icons/gacha/wish-currency.svg') center/contain no-repeat;
    filter:
      drop-shadow(0 0 10px rgba(168,54,109,0.95))
      drop-shadow(0 0 16px rgba(122,35,80,0.6))
      drop-shadow(0 2px 4px rgba(31,12,20,0.45));
    pointer-events: none;
  }
  .wish-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    border-color: #7a2350;
    box-shadow:
      inset 0 1px 0 rgba(255,255,255,0.8),
      0 5px 14px rgba(122,35,80,0.3);
  }
  .wish-btn:active:not(:disabled) {
    transform: translateY(0);
    box-shadow:
      inset 0 2px 5px rgba(168,54,109,0.18),
      0 2px 6px rgba(42,16,24,0.2);
  }
  .wish-btn:disabled { opacity: 0.5; cursor: not-allowed; }
  .wish-btn .lbl {
    font-size: 13px; letter-spacing: 0.02em;
    font-weight: 600;
    color: #2a1018;
    white-space: nowrap;
    overflow: visible;
    flex: 1 1 auto;
    min-width: 0;
    text-align: center;
  }

  /* ─── collection ─── */
  .collection {
    position: relative;
    margin-top: 22px;
    border: 1px solid var(--line-warm); border-radius: 12px;
    background:
      linear-gradient(180deg, rgba(34,18,32,0.55) 0%, rgba(20,10,22,0.4) 100%);
    box-shadow: inset 0 1px 0 rgba(244,235,228,0.05);
    padding: 14px;
  }
  .collection::before {
    content: '';
    position: absolute;
    top: -1px; left: -1px;
    width: 16px; height: 16px;
    border-top: 2px solid var(--wine-accent);
    border-left: 2px solid var(--wine-accent);
    border-top-left-radius: 12px;
    pointer-events: none;
  }
  .collection-head {
    display: flex; align-items: baseline; justify-content: space-between;
    gap: 10px; flex-wrap: wrap;
    margin-bottom: 12px;
    padding-left: 10px;
    position: relative;
  }
  .collection-head::before {
    content: '';
    position: absolute;
    left: 0; top: 4px;
    width: 3px; height: 11px;
    background: var(--wine-accent);
    border-radius: 1px;
  }
  .collection-head h3 {
    font-family: 'Space Grotesk', system-ui, sans-serif;
    font-size: 9px; letter-spacing: 0.26em;
    color: var(--cream-dim);
    text-transform: uppercase; font-weight: 700;
  }
  .collection-head h3 span { color: var(--cream); }
  .collection-head .cc-sep { color: var(--wine-accent); margin: 0 4px; opacity: 0.7; }
  .cc-rates {
    font-family: 'JetBrains Mono', monospace;
    font-size: 9px; letter-spacing: 0.12em; color: var(--cream-dim);
  }
  .collection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: 9px;
  }
  .cc-empty {
    grid-column: 1 / -1;
    padding: 18px 0;
    text-align: center;
    font-style: italic;
    color: var(--cream-dim); font-size: 11px;
  }
  .cc-card {
    position: relative;
    border-radius: 8px;
    border: 1px solid var(--cc-color, rgba(244,235,228,0.18));
    background: linear-gradient(180deg, rgba(244,235,228,0.04), rgba(0,0,0,0.45));
    padding: 6px;
    display: flex; flex-direction: column;
    box-shadow: 0 1px 2px rgba(0,0,0,0.5), inset 0 0 0 1px rgba(244,235,228,0.04);
    overflow: hidden;
    cursor: pointer;
    transition: transform .18s, box-shadow .18s, border-color .18s;
  }
  .cc-card:focus-visible { outline: 2px solid var(--cc-color); outline-offset: 2px; }
  .pull-card, .pull-tenview .mini-card { cursor: pointer; }
  .cc-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0,0,0,0.55), 0 0 14px var(--cc-color);
  }
  .cc-card.r5 { background: linear-gradient(180deg, rgba(255,197,88,0.12), rgba(0,0,0,0.5)); }
  .cc-card.r4 { background: linear-gradient(180deg, rgba(197,140,255,0.12), rgba(0,0,0,0.5)); }
  .cc-card.cc-locked {
    opacity: 0.45;
    filter: grayscale(0.7);
    border-color: rgba(244,235,228,0.12);
  }
  .cc-card.cc-locked .cc-port { filter: brightness(0.35) blur(0.5px); }
  .cc-card.cc-locked .cc-name { color: var(--muted); }
  .cc-port {
    width: 100%; aspect-ratio: 2 / 3;
    border-radius: 5px;
    background-size: cover; background-position: center top;
    background-color: rgba(0,0,0,0.4);
    border: 1px solid rgba(255,255,255,0.08);
    margin-bottom: 5px;
  }
  .cc-port.cc-proc {
    background:
      radial-gradient(circle at 50% 50%, var(--proc-color), transparent 70%),
      repeating-linear-gradient(45deg, rgba(255,255,255,0.04) 0 4px, transparent 4px 8px);
  }
  .cc-stars { font-size: 9px; color: var(--cc-color); text-shadow: 0 0 6px currentColor; letter-spacing: 0.08em; }
  .cc-name {
    font-family: 'RoyaleCouture', serif;
    font-size: 11px; line-height: 1.05;
    color: var(--ink);
    margin-top: 1px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .cc-opt {
    font-size: 8px; letter-spacing: 0.1em;
    color: var(--muted); text-transform: uppercase;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .cc-count {
    position: absolute; top: 4px; right: 4px;
    background: rgba(0,0,0,0.7); color: var(--cc-color);
    font-size: 9px; font-weight: 700;
    padding: 1px 5px; border-radius: 999px;
    border: 1px solid var(--cc-color);
  }

  /* ─── world map / sim ─── */
  .sim {
    display: flex; flex-direction: column; gap: 12px;
  }
  .sim-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 4px;
    font-family: 'Space Grotesk', system-ui, sans-serif;
    font-size: 10px; letter-spacing: 0.22em;
    color: var(--cream-dim); text-transform: uppercase;
    font-weight: 600;
  }
  .sim-head > span:first-child {
    display: inline-flex; align-items: center;
    color: var(--cream);
  }
  .sim-head #turn { color: var(--wine-accent); margin-left: 4px; }
  .sim-head #status { color: var(--cream-dim); font-style: italic; }
  .sim-head .pulse {
    display: inline-block; width: 7px; height: 7px;
    background: var(--acid); border-radius: 50%;
    box-shadow: 0 0 8px var(--acid);
    animation: pulse 1.4s ease-in-out infinite;
    margin-right: 8px;
  }
  @keyframes pulse { 0%,100%{opacity:1;} 50%{opacity:.3;} }

  .map-wrap {
    position: relative;
    border: 1px solid var(--line-warm); border-radius: 12px;
    background:
      radial-gradient(700px 300px at 50% 0%, rgba(168,54,109,0.08), transparent 60%),
      linear-gradient(180deg, #110818, #0a0612);
    box-shadow:
      inset 0 0 0 1px rgba(0,0,0,0.4),
      inset 0 0 80px rgba(90,24,56,0.18);
    overflow: hidden;
    aspect-ratio: 16/10;
  }
  .map-wrap::before, .map-wrap::after {
    content: '';
    position: absolute;
    width: 18px; height: 18px;
    border-color: var(--wine-accent);
    border-style: solid; border-width: 0;
    pointer-events: none;
    z-index: 2;
  }
  .map-wrap::before {
    top: 6px; left: 6px;
    border-top-width: 2px; border-left-width: 2px;
    border-top-left-radius: 8px;
  }
  .map-wrap::after {
    bottom: 6px; right: 6px;
    border-bottom-width: 2px; border-right-width: 2px;
    border-bottom-right-radius: 8px;
  }
  svg.map { width: 100%; height: 100%; display: block; }
  .map-region {
    transition: fill .3s, stroke .2s, filter .3s;
    cursor: default;
    stroke: rgba(185,173,249,0.4);
    stroke-width: 0.8;
  }
  .map-region.hover { stroke: var(--ink); stroke-width: 1.4; filter: brightness(1.2); }
  .map-label {
    fill: rgba(236,230,255,0.7);
    font-family: 'JetBrains Mono', monospace;
    font-size: 7px; letter-spacing: 0.16em; text-transform: uppercase;
    pointer-events: none;
    text-anchor: middle;
  }
  .map-pop {
    fill: rgba(236,230,255,0.45);
    font-family: 'JetBrains Mono', monospace;
    font-size: 5.5px;
    pointer-events: none;
    text-anchor: middle;
  }

  /* AI deploy markers */
  .ai-marker { pointer-events: none; }
  .ai-marker .core { transform-origin: center; animation: marker-pulse 2.4s ease-in-out infinite; }
  @keyframes marker-pulse { 0%,100%{ r: 2.4; } 50%{ r: 3.4; } }

  /* population dots — one circle ≈ 50M humans, scattered inside each country
     polygon. State: free (pale blue) / controlled (AI hue) / dead (oxblood) */
  .person {
    fill: rgba(220, 232, 255, 0.78);
    pointer-events: none;
    transition: fill 700ms ease, opacity 700ms ease;
    animation: person-idle 4.2s ease-in-out infinite;
    animation-delay: var(--idle-delay, 0s);
  }
  .person.controlled {
    filter: drop-shadow(0 0 2.6px currentColor);
    opacity: 1;
    animation: none;
  }
  .person.dead {
    opacity: 0.42;
    animation: none;
  }
  .person.flash { animation: person-flash 700ms ease-out; }
  .person.migrating {
    transition: cx 1.0s ease-in-out, cy 1.0s ease-in-out, fill 700ms ease;
    filter: drop-shadow(0 0 2.6px var(--cyan));
  }
  @keyframes person-idle {
    0%, 100% { opacity: 0.82; }
    50%      { opacity: 0.46; }
  }
  @keyframes person-flash {
    0%   { r: 1.3; }
    32%  { r: 3.0; }
    100% { r: 1.3; }
  }

  /* cross-border migration spore — fires when an AI seeds a new country */
  .spore { pointer-events: none; }

  /* ─── stats / leaderboard ─── shared "scrapbook page" treatment:
     warm dark surface, hairline cream border, a wine L-bracket in
     the top-left corner that echoes the banner-card. */
  .stats {
    display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  }
  .stats-card,
  .leaderboard,
  .events-panel {
    position: relative;
    border: 1px solid var(--line-warm); border-radius: 10px;
    background:
      linear-gradient(180deg, rgba(34,18,32,0.62) 0%, rgba(20,10,22,0.48) 100%);
    box-shadow:
      inset 0 1px 0 rgba(244,235,228,0.05),
      0 1px 0 rgba(0,0,0,0.4);
    padding: 14px 14px 12px;
  }
  .stats-card::before,
  .leaderboard::before,
  .events-panel::before {
    content: '';
    position: absolute;
    top: -1px; left: -1px;
    width: 16px; height: 16px;
    border-top: 2px solid var(--wine-accent);
    border-left: 2px solid var(--wine-accent);
    border-top-left-radius: 10px;
    pointer-events: none;
  }
  .stats-card h3,
  .leaderboard h3,
  .events-panel h3 {
    font-family: 'Space Grotesk', system-ui, sans-serif;
    font-size: 9px; letter-spacing: 0.26em;
    color: var(--cream-dim);
    text-transform: uppercase;
    font-weight: 700;
    margin-bottom: 10px;
    padding-left: 10px;
    display: flex; align-items: center; gap: 6px;
    position: relative;
  }
  .stats-card h3::before,
  .leaderboard h3::before,
  .events-panel h3::before {
    content: '';
    position: absolute;
    left: 0; top: 50%; transform: translateY(-50%);
    width: 3px; height: 11px;
    background: var(--wine-accent);
    border-radius: 1px;
  }
  .humans-bar {
    height: 6px; border-radius: 999px; overflow: hidden;
    background: rgba(244,235,228,0.06);
    position: relative;
    border: 1px solid rgba(244,235,228,0.06);
  }
  .humans-bar .fill {
    height: 100%;
    background: linear-gradient(90deg, var(--acid), var(--cyan));
    transition: width .5s ease;
  }
  .stats-row {
    display: flex; justify-content: space-between; align-items: baseline;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px; padding: 5px 0;
    border-bottom: 1px solid var(--line-warm);
    color: var(--cream-dim);
  }
  .stats-row:last-child { border-bottom: none; }
  .stats-row > span:first-child {
    font-family: 'Space Grotesk', system-ui, sans-serif;
    font-size: 10px; letter-spacing: 0.08em;
    color: var(--cream-dim);
  }
  .stats-row .v {
    font-variant-numeric: tabular-nums;
    color: var(--cream);
    font-weight: 600;
  }
  .stats-row.warn .v { color: var(--warn); }

  .leaderboard {
    grid-column: 1 / -1;
  }
  .lb-row {
    position: relative;
    display: grid; grid-template-columns: 26px 1fr auto auto auto;
    align-items: center; gap: 10px;
    padding: 7px 8px;
    border-top: 1px solid var(--line-warm);
    font-size: 11px;
    border-radius: 4px;
    overflow: hidden;
  }
  .lb-row::before {
    content: '';
    position: absolute;
    inset: 0 auto 0 0;
    width: var(--reach, 0%);
    background: linear-gradient(90deg,
      color-mix(in srgb, var(--ai-color, var(--wine-accent)) 22%, transparent) 0%,
      transparent 100%);
    pointer-events: none;
    transition: width .5s ease;
  }
  .lb-row > * { position: relative; z-index: 1; }
  .lb-row:first-of-type { border-top: none; }
  .lb-kills {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px; color: var(--warn);
    font-variant-numeric: tabular-nums;
    border: 1px solid rgba(255,111,111,0.35);
    background: rgba(255,111,111,0.1);
    padding: 1px 6px; border-radius: 4px;
    white-space: nowrap;
  }
  .lb-kills.lb-pacifist {
    color: var(--acid);
    border-color: rgba(107,255,174,0.3);
    background: rgba(107,255,174,0.1);
    font-style: italic;
  }
  .lb-rank {
    font-family: 'Space Grotesk', system-ui, sans-serif;
    font-weight: 700; font-size: 11px;
    color: var(--cream-dim); font-variant-numeric: tabular-nums;
  }
  .lb-name { display: flex; align-items: center; gap: 7px; min-width: 0; }
  .lb-dot {
    width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto;
    box-shadow: 0 0 8px currentColor;
  }
  .lb-name .nm {
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    color: var(--cream); font-weight: 500;
  }
  .lb-stars { color: var(--gold); font-size: 9px; letter-spacing: 0.05em; }
  .lb-pct {
    font-family: 'JetBrains Mono', monospace;
    font-variant-numeric: tabular-nums;
    color: var(--cream); font-weight: 700;
  }
  .lb-empty { color: var(--cream-dim); font-style: italic; padding: 14px 0; text-align: center; }

  .ticker {
    position: relative;
    margin-top: 4px;
    border: 1px solid var(--line-warm); border-radius: 10px;
    background:
      linear-gradient(180deg, rgba(28,16,28,0.55) 0%, rgba(18,10,20,0.42) 100%);
    box-shadow: inset 0 1px 0 rgba(244,235,228,0.04);
    padding: 10px 12px;
    height: 110px;
    overflow-y: auto;
    font-size: 11px; line-height: 1.55;
  }
  .ticker::-webkit-scrollbar { width: 6px; }
  .ticker::-webkit-scrollbar-thumb { background: rgba(168,54,109,0.4); border-radius: 6px; }
  .ticker::-webkit-scrollbar-track { background: transparent; }
  .tk-line {
    display: flex; gap: 10px; padding: 2px 0;
    border-left: 2px solid transparent;
    padding-left: 6px;
    margin-left: -6px;
  }
  .tk-line:hover { border-left-color: var(--wine-accent); background: rgba(168,54,109,0.06); }
  .tk-time {
    color: var(--wine-accent);
    flex: 0 0 40px; font-variant-numeric: tabular-nums;
    font-weight: 600; opacity: 0.85;
  }
  .tk-msg { color: var(--cream); }
  .tk-msg b { font-weight: 700; color: var(--cream); }
  .tk-msg.spawn b { color: var(--acid); }
  .tk-msg.attack b { color: var(--warn); }
  .tk-msg.takeover b { color: var(--gold); }
  .tk-msg.migrate b { color: var(--cyan); }
  .tk-msg.win { color: var(--gold); font-weight: 600; }
  .tk-msg.lose { color: var(--warn); font-weight: 600; }

  /* ─── pull animation overlay ─── */
  .pull-overlay {
    position: fixed; inset: 0; z-index: 100;
    background:
      linear-gradient(180deg, rgba(2,1,8,0.55), rgba(2,1,8,0.85)),
      url('icons/gacha/gachabackground.webp') center/cover no-repeat,
      rgba(2,1,8,0.88);
    display: none;
    align-items: center; justify-content: center;
    backdrop-filter: blur(6px);
  }
  .pull-overlay.active { display: flex; animation: overlay-fade .35s ease-out; }
  @keyframes overlay-fade { from { opacity: 0; } to { opacity: 1; } }

  .pull-stage {
    position: relative;
    width: min(620px, 90vw);
    height: min(460px, 70vh);
    display: flex; align-items: center; justify-content: center;
  }
  .pull-burst {
    position: absolute; inset: 0;
    background: radial-gradient(circle at center, rgba(255,255,255,0.0), transparent 50%);
  }
  .pull-burst.go {
    animation: burst 1.4s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  }
  @keyframes burst {
    0%   { background: radial-gradient(circle at center, rgba(255,255,255,0.0), transparent 30%); }
    40%  { background: radial-gradient(circle at center, rgba(255,255,255,0.95), rgba(255,209,107,0.4) 30%, transparent 60%); }
    100% { background: radial-gradient(circle at center, rgba(255,255,255,0.0), transparent 50%); }
  }
  .pull-card {
    position: relative;
    width: 260px; height: 420px;
    border-radius: 14px;
    border: 2px solid currentColor;
    background:
      linear-gradient(180deg, rgba(255,255,255,0.06), rgba(0,0,0,0.4)),
      var(--card-bg, #1c1538);
    color: var(--card-color, var(--lavender));
    box-shadow: 0 0 40px currentColor, inset 0 0 30px rgba(255,255,255,0.08);
    display: flex; flex-direction: column;
    padding: 18px;
    transform: scale(0.6); opacity: 0;
    transition: transform .4s cubic-bezier(0.22, 1, 0.36, 1), opacity .3s;
  }
  .pull-card.show { transform: scale(1); opacity: 1; }
  .pull-card .portrait {
    width: 100%;
    aspect-ratio: 2 / 3;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 10px;
    background: rgba(0,0,0,0.4);
    box-shadow: inset 0 0 18px rgba(0,0,0,0.5), 0 0 14px var(--card-color);
    border: 1px solid rgba(255,255,255,0.12);
  }
  .pull-card .portrait img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
  }
  .pull-card .stars {
    text-align: center;
    font-size: 18px; letter-spacing: 0.1em;
    color: var(--card-color);
    text-shadow: 0 0 14px currentColor;
    margin-bottom: 10px;
  }
  .pull-card .name {
    font-family: 'RoyaleCouture', serif;
    font-size: 22px; line-height: 1.05;
    color: var(--ink);
    margin-bottom: 8px;
    text-shadow: 0 0 12px var(--card-color);
  }
  .pull-card .opt {
    font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase;
    color: rgba(236,230,255,0.7);
    margin-bottom: 12px;
  }
  .pull-card .opt b { color: var(--card-color); display: block; font-size: 13px; letter-spacing: 0.04em; text-transform: none; margin-top: 2px; }
  .pull-card .meth {
    font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase;
    color: rgba(236,230,255,0.7);
  }
  .pull-card .meth b { color: var(--ink); display: block; font-size: 12px; letter-spacing: 0.02em; text-transform: none; margin-top: 2px; font-family: 'Handwriting', cursive; font-weight: 400; }
  .pull-card .deploy {
    margin-top: auto;
    font-size: 9px; letter-spacing: 0.2em; text-transform: uppercase;
    color: rgba(236,230,255,0.5);
    border-top: 1px solid rgba(236,230,255,0.15);
    padding-top: 8px;
  }
  .pull-skip {
    position: absolute; bottom: -50px; left: 50%; transform: translateX(-50%);
    padding: 8px 18px;
    background: rgba(255,255,255,0.08);
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--ink); font: inherit;
    font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase;
    cursor: pointer;
  }
  .pull-skip:hover { background: rgba(255,255,255,0.16); }

  .pull-tenview {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    width: min(820px, 95vw);
  }
  .pull-tenview .mini-card {
    border-radius: 8px;
    border: 1.5px solid currentColor;
    color: var(--card-color, var(--lavender));
    background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(0,0,0,0.4)), var(--card-bg, #1c1538);
    padding: 8px;
    display: flex; flex-direction: column;
    box-shadow: 0 0 16px currentColor;
    transform: translateY(20px); opacity: 0;
    transition: transform .4s cubic-bezier(0.22, 1, 0.36, 1), opacity .4s;
  }
  .pull-tenview .mini-card.show { transform: translateY(0); opacity: 1; }
  .pull-tenview .mini-card .portrait {
    width: 100%; aspect-ratio: 2 / 3;
    border-radius: 5px; overflow: hidden;
    background: rgba(0,0,0,0.4);
    border: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 5px;
    box-shadow: inset 0 0 8px rgba(0,0,0,0.5), 0 0 8px var(--card-color);
  }
  .pull-tenview .mini-card .portrait img { width: 100%; height: 100%; object-fit: cover; display: block; }
  .pull-tenview .mini-card .stars { font-size: 11px; color: var(--card-color); text-shadow: 0 0 8px currentColor; }
  .pull-tenview .mini-card .name {
    font-family: 'RoyaleCouture', serif;
    color: var(--ink);
    font-size: 13px; line-height: 1.05; margin-top: 4px;
  }
  .pull-tenview .mini-card .opt {
    margin-top: auto; font-size: 9px; color: rgba(236,230,255,0.6);
    line-height: 1.3;
  }
  .pull-tenview .mini-card .opt b { color: var(--card-color); display: block; }

  /* ─── outcome — fullscreen black with narrative typewriter ─── */
  .outcome-overlay {
    position: fixed; inset: 0; z-index: 80;
    background: #000;
    display: none;
    align-items: center; justify-content: center;
    padding: 48px 24px;
  }
  .outcome-overlay.active { display: flex; }
  .outcome {
    width: min(680px, 100%);
    color: #ECE6FF;
    text-align: center;
    font-family: 'Space Grotesk', system-ui, sans-serif;
  }
  .outcome .sub,
  .outcome h2,
  .outcome p,
  .outcome .again {
    opacity: 0;
    transform: translateY(8px);
    animation: outcome-fade-in 1.2s ease forwards;
  }
  .outcome .sub   { animation-delay: 0.4s; }
  .outcome h2    { animation-delay: 1.2s; }
  .outcome p:nth-of-type(1) { animation-delay: 2.6s; }
  .outcome p:nth-of-type(2) { animation-delay: 4.4s; }
  .outcome .again { animation-delay: 5.6s; }

  @keyframes outcome-fade-in {
    to { opacity: 1; transform: translateY(0); }
  }

  .outcome .sub {
    font-weight: 700;
    font-size: 11px; letter-spacing: 0.42em;
    color: rgba(236,230,255,0.4);
    text-transform: uppercase;
    margin-bottom: 32px;
  }
  .outcome h2 {
    font-family: 'RoyaleCouture', serif;
    font-size: clamp(40px, 6vw, 64px);
    line-height: 1.0;
    letter-spacing: 0.02em;
    margin-bottom: 36px;
    color: #fff;
  }
  .outcome p {
    font-size: 17px;
    line-height: 1.7;
    color: rgba(236,230,255,0.86);
    margin: 0 auto 24px;
    max-width: 56ch;
  }
  .outcome p em {
    font-style: italic;
    font-weight: 500;
    color: #fff;
  }
  .outcome p.meta {
    font-size: 11px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(236,230,255,0.35);
    margin-top: 24px;
    margin-bottom: 44px;
  }
  .outcome p.meta b { color: rgba(236,230,255,0.7); font-weight: 600; }
  .outcome .again {
    display: inline-block;
    padding: 12px 28px;
    background: transparent;
    color: rgba(236,230,255,0.8);
    border: 1px solid rgba(236,230,255,0.4);
    border-radius: 0;
    font-family: 'Space Grotesk', system-ui, sans-serif;
    font-size: 11px; font-weight: 600; letter-spacing: 0.32em;
    text-transform: uppercase;
    cursor: pointer;
    transition: color .2s, border-color .2s, background .2s;
  }
  .outcome .again:hover {
    color: #000; background: #fff; border-color: #fff;
  }

  /* ─── character detail (roster card → click) ─── */
  .char-detail-overlay {
    position: fixed; inset: 0; z-index: 90;
    background: rgba(2,1,8,0.86);
    display: none; align-items: center; justify-content: center;
    backdrop-filter: blur(8px);
    padding: 24px;
  }
  .char-detail-overlay.active { display: flex; }
  .char-detail {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 220px) minmax(0, 1fr);
    gap: 22px;
    width: min(640px, 95vw);
    max-height: 92vh;
    overflow: auto;
    border: 1px solid var(--cd-color, var(--line-warm));
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(34,18,32,0.94) 0%, rgba(20,10,22,0.94) 100%);
    box-shadow:
      0 1px 0 rgba(244,235,228,0.06) inset,
      0 30px 80px -20px rgba(168,54,109,0.45),
      0 0 0 1px var(--cd-color, rgba(168,54,109,0.18)),
      0 0 24px var(--cd-color, transparent);
    padding: 22px;
  }
  @media (max-width: 560px) {
    .char-detail { grid-template-columns: 1fr; }
  }
  .char-detail .cd-close {
    position: absolute; top: 10px; right: 12px;
    width: 30px; height: 30px;
    border: 1px solid var(--line-warm); border-radius: 50%;
    background: rgba(20,10,22,0.7); color: var(--cream);
    font-family: 'Space Grotesk', system-ui, sans-serif;
    font-size: 16px; line-height: 1;
    cursor: pointer;
    transition: border-color .12s, color .12s;
  }
  .char-detail .cd-close:hover { border-color: var(--cd-color); color: var(--cd-color); }
  .char-detail .cd-port {
    width: 100%; aspect-ratio: 2 / 3;
    border-radius: 8px;
    background-size: cover; background-position: center top;
    background-color: rgba(0,0,0,0.4);
    border: 1px solid var(--cd-color, rgba(255,255,255,0.1));
    box-shadow: 0 0 18px var(--cd-color, transparent), inset 0 0 18px rgba(0,0,0,0.45);
  }
  .char-detail .cd-port.cd-proc {
    background:
      radial-gradient(circle at 50% 45%, var(--proc-color), transparent 70%),
      repeating-linear-gradient(45deg, rgba(255,255,255,0.04) 0 4px, transparent 4px 8px);
  }
  .char-detail .cd-port.cd-locked {
    filter: brightness(0.35) blur(0.5px);
  }
  .char-detail .cd-info { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
  .char-detail .cd-stars {
    font-size: 15px; letter-spacing: 0.18em;
    color: var(--cd-color); text-shadow: 0 0 10px currentColor;
  }
  .char-detail .cd-name {
    font-family: 'RoyaleCouture', serif;
    font-size: 30px; line-height: 1.05; color: var(--cream);
    text-shadow: 0 0 16px var(--cd-color, transparent);
    word-wrap: break-word;
  }
  .char-detail .cd-tag {
    display: inline-block; align-self: flex-start;
    padding: 5px 12px;
    font-family: 'Space Grotesk', system-ui, sans-serif;
    font-size: 12px; font-weight: 700; letter-spacing: 0.18em;
    text-transform: uppercase;
    border: 1px solid var(--cd-color); color: var(--cd-color);
    border-radius: 999px;
    background: rgba(20,10,22,0.5);
  }
  .char-detail .cd-row {
    display: grid;
    grid-template-columns: 96px 1fr;
    gap: 14px;
    padding: 10px 0;
    border-top: 1px solid var(--line-warm);
  }
  .char-detail .cd-row:first-of-type { border-top: none; padding-top: 4px; }
  .char-detail .cd-row .k {
    font-family: 'Space Grotesk', system-ui, sans-serif;
    color: var(--cream-dim);
    font-size: 12px; font-weight: 600;
    letter-spacing: 0.16em; text-transform: uppercase;
    align-self: center;
  }
  .char-detail .cd-row .v {
    font-family: 'Space Grotesk', system-ui, sans-serif;
    color: var(--cream);
    font-size: 15px; line-height: 1.4;
  }
  .char-detail .cd-status {
    margin-top: 8px;
    padding: 10px 12px;
    border: 1px dashed var(--cd-color);
    border-radius: 6px;
    font-family: 'Space Grotesk', system-ui, sans-serif;
    font-size: 12px; font-weight: 600;
    letter-spacing: 0.18em; text-transform: uppercase;
    color: var(--cream-dim); text-align: center;
  }
  .char-detail .cd-status.owned { color: var(--cd-color); }

  /* sparkle particles */
  .spark {
    position: absolute; width: 4px; height: 4px;
    background: currentColor; border-radius: 50%;
    pointer-events: none;
    box-shadow: 0 0 6px currentColor;
  }

  /* ─── HUMANS ALIVE — hero counter above map ─── */
  .humans-hero {
    position: relative;
    border: 1px solid var(--line-warm); border-radius: 12px;
    background:
      radial-gradient(800px 240px at 50% 50%, rgba(107,255,174,0.05), transparent 70%),
      linear-gradient(180deg, #14081a, #0a0612);
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.4);
    padding: 16px 22px;
    display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 18px;
    overflow: hidden;
  }
  .humans-hero::before {
    content: ''; position: absolute; left: 0; top: 0; bottom: 0;
    width: var(--alive-pct, 100%);
    background: linear-gradient(90deg, rgba(107,255,174,0.10) 0%, rgba(168,54,109,0.06) 100%);
    transition: width .6s ease;
    pointer-events: none;
  }
  .humans-hero > * { position: relative; z-index: 1; }
  .hh-meta {
    font-family: 'Space Grotesk', system-ui, sans-serif;
    font-size: 9px; letter-spacing: 0.26em; text-transform: uppercase;
    color: var(--cream-dim);
    line-height: 1.85;
    font-weight: 600;
  }
  .hh-meta b {
    color: var(--cream); font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    letter-spacing: 0.04em;
  }
  .hh-meta.right { text-align: right; }
  .hh-num {
    font-family: 'JetBrains Mono', monospace;
    font-variant-numeric: tabular-nums;
    font-size: 40px; font-weight: 700;
    color: #6BFFAE;
    text-shadow: 0 0 22px rgba(107,255,174,0.45);
    letter-spacing: 0.02em;
    line-height: 1;
    text-align: center;
  }
  .hh-num small {
    display: block;
    font-family: 'Space Grotesk', system-ui, sans-serif;
    font-size: 9px; font-weight: 600; letter-spacing: 0.32em;
    color: var(--cream-dim); margin-top: 6px;
    text-shadow: none;
  }
  .hh-num.crit  { color: var(--warn); text-shadow: 0 0 22px rgba(255,111,111,0.5); }
  .hh-num.dying {
    color: var(--gold); text-shadow: 0 0 22px rgba(255,209,107,0.5);
    animation: heartbeat 1.6s ease-in-out infinite;
  }
  @keyframes heartbeat { 0%,100%{transform:scale(1);} 12%{transform:scale(1.03);} 24%{transform:scale(1);} 36%{transform:scale(1.02);} }

  /* ─── alignment chips ─── */
  .align-chip {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 999px;
    font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase;
    border: 1px solid currentColor;
    margin-left: 4px;
    vertical-align: middle;
  }
  .align-aligned    { color: var(--acid); }
  .align-unaligned  { color: var(--warn); }
  .align-mesa       { color: var(--gold); }
  .align-deceptive  { color: var(--pink-hot); }

  /* ─── banner-ended overlay (fills the .banner) ─── */
  .banner-ended-overlay {
    position: absolute; inset: 0;
    background: rgba(20,12,30,0.78);
    backdrop-filter: blur(3px);
    display: none; flex-direction: column; align-items: center; justify-content: center;
    color: #ffe7f1;
    z-index: 5; gap: 14px;
    text-align: center;
    padding: 28px;
  }
  .banner-ended-overlay.show { display: flex; }
  .banner-ended-overlay h3 {
    font-family: 'Space Grotesk', system-ui, sans-serif;
    font-weight: 700;
    font-size: 32px; letter-spacing: 0.02em;
    color: #fff5fb;
    text-shadow:
      0 0 18px rgba(168,54,109,0.7),
      0 0 28px rgba(122,35,80,0.45);
  }
  .banner-ended-overlay p {
    font-family: 'JetBrains Mono', 'IBM Plex Mono', ui-monospace, monospace;
    font-size: 12px; line-height: 1.55; max-width: 360px;
    color: rgba(255,231,241,0.72);
  }
  .banner-ended-overlay button {
    padding: 10px 22px;
    background: linear-gradient(180deg, #f4ebe4 0%, #e6dad2 100%);
    color: #2a1018;
    border: 1px solid rgba(90,24,56,0.55);
    border-radius: 999px;
    box-shadow:
      inset 0 1px 0 rgba(255,255,255,0.6),
      0 4px 12px rgba(31,12,20,0.35);
    font-family: 'Space Grotesk', system-ui, sans-serif;
    font-size: 13px; font-weight: 600; letter-spacing: 0.06em;
    text-transform: uppercase;
    cursor: pointer;
    transition: transform .12s, border-color .12s, box-shadow .12s;
  }
  .banner-ended-overlay button:hover {
    transform: translateY(-1px);
    border-color: #7a2350;
    box-shadow:
      inset 0 1px 0 rgba(255,255,255,0.7),
      0 6px 16px rgba(122,35,80,0.4);
  }

  /* ─── events panel + toast ─── (panel chrome shared with stats-card
     above; only the row/tag styles live here.) */
  .ev-list {
    display: flex; flex-direction: column; gap: 4px;
    max-height: 110px; overflow-y: auto;
    padding-right: 2px;
  }
  .ev-list::-webkit-scrollbar { width: 6px; }
  .ev-list::-webkit-scrollbar-thumb { background: rgba(168,54,109,0.4); border-radius: 6px; }
  .ev {
    display: flex; gap: 9px; align-items: baseline;
    padding: 5px 8px; border-radius: 4px;
    background: rgba(244,235,228,0.025);
    border-left: 2px solid var(--wine-accent);
    font-size: 11px; line-height: 1.35;
    color: var(--cream);
  }
  .ev .tag {
    flex: 0 0 auto;
    padding: 2px 7px; border-radius: 3px;
    font-family: 'Space Grotesk', system-ui, sans-serif;
    font-size: 8px; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase;
    background: var(--wine); color: var(--cream);
  }
  .ev.gov    .tag { background: var(--cyan);     color: #08111c; }
  .ev.gov          { border-left-color: var(--cyan); }
  .ev.crisis .tag { background: var(--warn);     color: #fff; }
  .ev.crisis       { border-left-color: var(--warn); }
  .ev.boon   .tag { background: var(--acid);     color: #08111c; }
  .ev.boon         { border-left-color: var(--acid); }
  .ev.leak   .tag { background: var(--pink-hot); color: #fff; }
  .ev.leak         { border-left-color: var(--pink-hot); }
  .ev.empty {
    color: var(--cream-dim); font-style: italic;
    padding: 10px 0; text-align: center;
    background: none; border-left: 0;
  }

  .event-toast {
    position: fixed; top: 64px; right: 18px; z-index: 50;
    width: min(320px, 80vw);
    border: 1px solid var(--line-warm); border-radius: 10px;
    background: linear-gradient(180deg, rgba(34,18,32,0.95) 0%, rgba(20,10,22,0.92) 100%);
    box-shadow:
      0 1px 0 rgba(244,235,228,0.05) inset,
      0 18px 40px -10px rgba(0,0,0,0.6),
      0 0 0 1px rgba(168,54,109,0.18);
    padding: 12px 14px;
    transform: translateX(120%);
    transition: transform .35s cubic-bezier(0.22, 1, 0.36, 1);
  }
  .event-toast.show { transform: translateX(0); }
  .event-toast .tag {
    display: inline-block;
    padding: 2px 8px; border-radius: 3px;
    font-family: 'Space Grotesk', system-ui, sans-serif;
    font-size: 9px; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase;
    background: var(--wine); color: var(--cream);
  }
  .event-toast.gov    .tag { background: var(--cyan);     color: #08111c; }
  .event-toast.crisis .tag { background: var(--warn);    color: #fff; }
  .event-toast.boon   .tag { background: var(--acid);     color: #08111c; }
  .event-toast.leak   .tag { background: var(--pink-hot); color: #fff; }
  .event-toast .ttl {
    font-family: 'RoyaleCouture', serif;
    font-size: 18px; line-height: 1.1;
    color: var(--ink);
    margin: 6px 0 4px;
  }
  .event-toast .ds {
    font-size: 11px; line-height: 1.45;
    color: var(--muted);
  }

  /* ─── phones (≤560px) ─── kept at the bottom of the file so these
     overrides actually win on equal specificity against the desktop
     rules above. */
  @media (max-width: 560px) {
    .topbar {
      flex-wrap: wrap;
      gap: 8px;
      padding: 8px 12px;
    }
    .topbar .pity { padding: 4px 8px; }
    .pity-row { font-size: 9px; letter-spacing: 0.1em; }
    .reset-btn { padding: 5px 8px; font-size: 9px; letter-spacing: 0.12em; }
    .title-block { order: -1; flex: 1 0 100%; }
    .title { font-size: 20px; }
    .title::before, .title::after { width: 18px; }
    .title small { font-size: 8px; letter-spacing: 0.18em; }
    .currencies { flex: 1 1 100%; gap: 8px; justify-content: space-between; }
    .currency { padding: 5px 10px; font-size: 11px; }
    .currency.crystals { padding-left: 32px; }
    .currency.crystals .ico { width: 28px; height: 28px; }

    .stage { padding: 10px; gap: 12px; }

    .banner-card {
      padding: 18px 14px 14px;
      gap: 9px;
    }
    .banner-card .banner-title { font-size: 28px; line-height: 1; }
    .banner-card .banner-sub { font-size: 13px; }
    .banner-card .banner-rule { font-size: 10px; padding: 8px 12px 8px 28px; }
    .banner-card .banner-rule .star { left: 12px; top: 9px; }
    .banner-featured-label { font-size: 9px; letter-spacing: 0.18em; }
    .banner-card .banner-mini-strip { gap: 6px; }
    .banner-card .banner-mini-strip img { border-radius: 10px; }
    .banner-card .banner-blurb { font-size: 9px; line-height: 1.5; }
    .banner-card .banner-period .period-label { font-size: 9px; }
    .banner-card .banner-period .period-dates { font-size: 12px; }

    .wish-bar { gap: 10px; }
    .wish-btn {
      height: 40px;
      padding: 0 12px 0 38px;
    }
    .wish-btn::before {
      width: 48px; height: 48px;
      left: -6px;
    }
    .wish-btn .lbl { font-size: 12px; }

    /* sim panel — stack the stats grid into a single column and shrink
       the giant population number so it fits on a phone screen. */
    .stats { grid-template-columns: 1fr; gap: 10px; }
    .stats-card, .leaderboard, .events-panel { padding: 12px 12px 10px; }
    .humans-hero .hh-num { font-size: clamp(28px, 11vw, 42px); }
    .humans-hero .hh-meta { font-size: 9px; }
    .sim-head { font-size: 9px; letter-spacing: 0.18em; }

    /* 10-pull reveal grid — 5 columns squashed each card to ~58px on a
       phone, switch to 2 columns so portraits are readable. */
    .pull-tenview { grid-template-columns: repeat(2, 1fr); width: min(420px, 92vw); }
  }
