  #gameover button {
    color: #1a1530; border: none; border-radius: var(--radius-pill);
    padding: 15px 44px; font-size: 16px; cursor: pointer;
    font-family: inherit; letter-spacing: 0.5px; font-weight: 700;
    background: linear-gradient(135deg, #ffd36e, #ff9ec4 55%, #b89bff);
    box-shadow: 0 8px 26px rgba(184, 155, 255, 0.35);
    transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1),
                box-shadow 0.25s;
  }
  #gameover button:hover, #gameover button:focus-visible {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 12px 34px rgba(184, 155, 255, 0.5);
    outline: none;
  }

  #gameover {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: radial-gradient(ellipse at center, rgba(80, 30, 50, 0.9), rgba(14, 18, 34, 0.96));
    display: none; flex-direction: column;
    align-items: center; justify-content: center; z-index: var(--z-modal);
    /* The screen itself never scrolls — the title/score/stats AND the action
       buttons (PLAY AGAIN / rankings / title) stay fixed. ONLY the loot section
       (#gameover-earned) shrinks + scrolls internally when the loot list is too
       tall to fit (flex-shrink rules below). */
    overflow: hidden;
    padding: 12px 0;
    opacity: 0;
  }
  /* Rising photon backdrop — lives behind every card on the game-over /
     victory screen. Each .gameover-photon is absolutely-positioned at
     random x near the bottom and uses its own infinite `photon-rise`
     animation. --photon-boost (0-1) is written by a rAF loop in
     src/game-over.js, tapping the music's bass level for tempo-sync.
     The boost scales brightness + pulls speed slightly so the layer
     "breathes" with the track. */
  #gameover #gameover-photons {
    position: fixed; inset: 0; pointer-events: none;   /* pinned to viewport so it doesn't scroll with the card */
    z-index: 0; overflow: hidden;
    --photon-boost: 0;
  }
  #gameover > * { position: relative; z-index: 1; flex-shrink: 0; }   /* fixed bits never shrink */
  #gameover > #gameover-photons { z-index: 0; }
  .gameover-photon {
    position: absolute; bottom: -30px;
    border-radius: 50%;
    /* Soft halo via radial gradient — much cheaper than box-shadow because
       it uses the photon's own background, no blur overdraw. */
    background: radial-gradient(circle,
      rgba(255, 240, 200, calc(0.9 * var(--ph-bright, 0.8) + 0.5 * var(--photon-boost, 0))) 0%,
      rgba(255, 200, 120, calc(0.5 * var(--ph-bright, 0.8) + 0.3 * var(--photon-boost, 0))) 45%,
      rgba(255, 180, 90, 0) 75%);
    box-shadow: 0 0 calc(6px + 10px * var(--photon-boost, 0))
                rgba(255, 210, 140, calc(0.4 + 0.4 * var(--photon-boost, 0)));
    opacity: 0;
    animation: photon-rise linear infinite;
    /* `animation-play-state` + a CSS variable technique lets --photon-boost
       tug the rise a hair faster on the beat. Calc on duration is not
       standard, so we leave duration as a fixed inline style and let the
       boost amplify brightness only. */
  }
  /* Tier-tinted photons for win vs loss. */
  #gameover.survived .gameover-photon {
    background: radial-gradient(circle,
      rgba(200, 255, 200, calc(0.9 * var(--ph-bright, 0.8) + 0.5 * var(--photon-boost, 0))) 0%,
      rgba(120, 240, 180, calc(0.5 * var(--ph-bright, 0.8) + 0.3 * var(--photon-boost, 0))) 45%,
      rgba(90, 200, 160, 0) 75%);
    box-shadow: 0 0 calc(6px + 10px * var(--photon-boost, 0))
                rgba(140, 240, 170, calc(0.4 + 0.4 * var(--photon-boost, 0)));
  }
  #gameover.defeated .gameover-photon {
    background: radial-gradient(circle,
      rgba(255, 200, 200, calc(0.9 * var(--ph-bright, 0.8) + 0.5 * var(--photon-boost, 0))) 0%,
      rgba(255, 110, 130, calc(0.5 * var(--ph-bright, 0.8) + 0.3 * var(--photon-boost, 0))) 45%,
      rgba(200, 60, 80, 0) 75%);
    box-shadow: 0 0 calc(6px + 10px * var(--photon-boost, 0))
                rgba(255, 140, 150, calc(0.4 + 0.4 * var(--photon-boost, 0)));
  }
  @keyframes photon-rise {
    0%   { transform: translate3d(0, 0, 0) scale(0.3); opacity: 0; }
    8%   { opacity: 1; transform: translate3d(0, -10vh, 0) scale(0.6); }
    50%  { opacity: 1; transform: translate3d(0, -55vh, 0) scale(1); }
    92%  { opacity: 0.8; transform: translate3d(0, -105vh, 0) scale(1.1); }
    100% { opacity: 0; transform: translate3d(0, -115vh, 0) scale(1.1); }
  }
  @media (prefers-reduced-motion: reduce) {
    .gameover-photon { animation: none; opacity: 0; }
  }
  /* Survived (victory) — gold/green radial with a nebula shimmer. */
  #gameover.survived {
    background:
      radial-gradient(ellipse at center, rgba(255, 211, 110, 0.18), transparent 55%),
      radial-gradient(ellipse at 40% 30%, rgba(159, 232, 112, 0.20), transparent 50%),
      radial-gradient(ellipse at center, rgba(28, 38, 30, 0.92), rgba(10, 14, 22, 0.96));
  }
  /* Defeated — crimson-on-black with a subtle vignette. */
  #gameover.defeated {
    background:
      radial-gradient(ellipse at center, rgba(255, 60, 80, 0.14), transparent 50%),
      radial-gradient(ellipse at center, rgba(60, 20, 28, 0.94), rgba(10, 14, 22, 0.98));
  }
  /* One-shot container reveal — scale-pop for victory, impact-shake for loss.
     Each child block gets its own delay so the reveal cascades top-down:
     title → hero score → stat chips → earned row → CTAs → secondary links. */
  #gameover.revealing { animation: goFadeIn 280ms ease-out forwards; }
  #gameover.survived.revealing > h1,
  #gameover.survived.revealing > #gameover-hero,
  #gameover.survived.revealing > #gameover-stats,
  #gameover.survived.revealing > #gameover-earned,
  #gameover.survived.revealing > #gameover-relic-hint.visible,
  #gameover.survived.revealing > #gameover-card-preview,
  #gameover.survived.revealing > #gameover-actions,
  #gameover.survived.revealing > #gameover-secondary { animation-name: goChildPopIn; }
  #gameover.defeated.revealing > h1 { animation: goTitleSlam 620ms cubic-bezier(0.3, 0.1, 0.2, 1) both; }
  #gameover.defeated.revealing > #gameover-hero,
  #gameover.defeated.revealing > #gameover-stats,
  #gameover.defeated.revealing > #gameover-earned,
  #gameover.defeated.revealing > #gameover-relic-hint.visible,
  #gameover.defeated.revealing > #gameover-card-preview,
  #gameover.defeated.revealing > #gameover-actions,
  #gameover.defeated.revealing > #gameover-secondary { animation-name: goChildFadeUp; }
  #gameover.revealing > h1                       { animation-duration: 620ms; animation-fill-mode: both; }
  #gameover.revealing > #gameover-hero           { animation-duration: 560ms; animation-fill-mode: both; animation-delay: 180ms; }
  #gameover.revealing > #gameover-stats          { animation-duration: 520ms; animation-fill-mode: both; animation-delay: 320ms; }
  #gameover.revealing > #gameover-earned         { animation-duration: 500ms; animation-fill-mode: both; animation-delay: 440ms; }
  /* Relic hint slots between earned (440ms) and card-preview (560ms)
     without bumping the rest of the cascade — tight 60ms offset. */
  #gameover.revealing > #gameover-relic-hint.visible { animation-duration: 520ms; animation-fill-mode: both; animation-delay: 500ms; }
  #gameover.revealing > #gameover-card-preview   { animation-duration: 520ms; animation-fill-mode: both; animation-delay: 560ms; }
  #gameover.revealing > #gameover-actions        { animation-duration: 520ms; animation-fill-mode: both; animation-delay: 720ms; }
  #gameover.revealing > #gameover-secondary      { animation-duration: 480ms; animation-fill-mode: both; animation-delay: 860ms; }

  @keyframes goFadeIn   { from { opacity: 0; } to { opacity: 1; } }
  @keyframes goChildPopIn {
    0%   { opacity: 0; transform: translateY(22px) scale(0.82); }
    60%  { opacity: 1; transform: translateY(-4px) scale(1.06); }
    100% { opacity: 1; transform: translateY(0)    scale(1);    }
  }
  @keyframes goChildFadeUp {
    0%   { opacity: 0; transform: translateY(14px); }
    100% { opacity: 1; transform: translateY(0);    }
  }
  @keyframes goTitleSlam {
    0%   { opacity: 0; transform: scale(1.8); letter-spacing: 14px; filter: blur(6px); }
    55%  { opacity: 1; transform: scale(0.96); letter-spacing: 0px;  filter: blur(0);    }
    62%  { transform: translateX(-8px); }
    68%  { transform: translateX(8px);  }
    74%  { transform: translateX(-4px); }
    80%  { transform: translateX(4px);  }
    100% { transform: scale(1) translateX(0); filter: blur(0); }
  }
  /* Keep content above the confetti layer (position:absolute shards). */
  #gameover > h1,
  #gameover > #gameover-hero,
  #gameover > #gameover-stats,
  #gameover > #gameover-earned,
  #gameover > #gameover-relic-hint,
  #gameover > #gameover-card-preview,
  #gameover > #gameover-actions,
  #gameover > #gameover-secondary { position: relative; z-index: 2; }

  /* Auto-rendered share-card preview slot. Sits between the earned row and
     the action buttons — the player sees the artifact they can share before
     they see SHARE/PLAY AGAIN. Fixed aspect ratio matches the 1200×630 the
     card is rendered at so the card never distorts when the image resolves.
     Empty state collapses; filled state constrains by width. */
  #gameover-card-preview {
    width: min(420px, 80vw);
    aspect-ratio: 1200 / 630;
    margin: 0 auto 18px;
    border-radius: 14px;
    overflow: hidden;
    background: rgba(12, 16, 32, 0.55);
    border: 1px solid rgba(184, 155, 255, 0.22);
    box-shadow: 0 18px 44px rgba(10, 12, 26, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    display: none;
  }
  #gameover-card-preview.has-card,
  #gameover-card-preview.rendering { display: block; }
  #gameover-card-preview img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 320ms ease-out;
  }
  #gameover-card-preview.has-card img { opacity: 1; }
  /* Shimmer placeholder while the canvas renders. */
  #gameover-card-preview.rendering:not(.has-card) {
    background:
      linear-gradient(110deg,
        rgba(184, 155, 255, 0.06) 0%,
        rgba(184, 155, 255, 0.18) 45%,
        rgba(184, 155, 255, 0.06) 70%) 0 0 / 220% 100% no-repeat,
      rgba(12, 16, 32, 0.55);
    animation: cardPreviewShimmer 1.2s linear infinite;
  }
  @keyframes cardPreviewShimmer {
    from { background-position: 120% 0, 0 0; }
    to   { background-position: -20% 0,  0 0; }
  }
  @media (prefers-reduced-motion: reduce) {
    #gameover-card-preview.rendering:not(.has-card) { animation: none; }
    #gameover-card-preview img { transition: none; }
  }
  #gameover h1 {
    font-size: 60px; margin-bottom: 18px; font-weight: 800; letter-spacing: 1px;
    /* Center-align the text itself so wrapped translations (e.g. Indonesian
       "PERMAINAN BERAKHIR" splits to two lines on narrow viewports) stay
       centered instead of falling back to the default `start` alignment.
       Bound the box width + padding so overflow can't push past the
       viewport edge before the wrap happens. */
    text-align: center;
    max-width: calc(100% - 32px); padding: 0 16px; box-sizing: border-box;
    background: linear-gradient(120deg, #ff8a8a, #ffa866);
    -webkit-background-clip: text; background-clip: text; color: transparent;
  }
  #gameover.survived h1 {
    background: linear-gradient(120deg, #ffd36e, #9fe870 55%, #7ee2ff);
    -webkit-background-clip: text; background-clip: text; color: transparent;
    filter: drop-shadow(0 6px 28px rgba(255, 211, 110, 0.5));
  }
  #gameover.defeated h1 {
    background: linear-gradient(120deg, #ff6b6b, #ff9e7a);
    -webkit-background-clip: text; background-clip: text; color: transparent;
    filter: drop-shadow(0 4px 22px rgba(255, 60, 80, 0.45));
  }
  /* Hero — single big score right under the title. The score is the one
     saturated number on the card; every other stat is neutral-text dim. */
  #gameover-hero {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    margin: 0 0 20px;
  }
  #gameover-hero .go-score-label {
    font-size: 10.5px; letter-spacing: 2.4px; text-transform: uppercase;
    color: var(--text-dim);
  }
  #gameover-hero .go-score {
    font-size: 64px; font-weight: 800; letter-spacing: 0.5px;
    line-height: 1; font-variant-numeric: tabular-nums;
    color: var(--gold);
    filter: drop-shadow(0 6px 26px rgba(255, 211, 110, 0.32));
  }
  #gameover.defeated #gameover-hero .go-score {
    color: #ffa866;
    filter: drop-shadow(0 6px 26px rgba(255, 138, 138, 0.32));
  }
  #gameover-hero .go-badges {
    display: flex; flex-wrap: wrap; justify-content: center; gap: 8px;
    margin-top: 4px;
  }
  /* #gameover scoping beats the blanket `#gameover button { ... }` rule so
     the badges don't inherit the PLAY AGAIN gradient / padding / font-size. */
  #gameover .go-badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 5px 12px; border-radius: var(--radius-pill);
    font-family: inherit;
    font-size: 11px; font-weight: 800; letter-spacing: 1.3px;
    color: var(--text-dim);
    background: rgba(36, 22, 48, 0.44);
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: none;
    /* Button-cancel: undo the blanket #gameover button transform/hover. */
    transform: none;
  }
  #gameover .go-badge.best {
    color: var(--gold);
    border-color: rgba(255, 211, 110, 0.55);
    background: rgba(60, 44, 14, 0.55);
  }
  #gameover button.go-badge.rank {
    color: #d1aeff;
    border-color: rgba(209, 174, 255, 0.45);
    background: rgba(48, 30, 64, 0.55);
    cursor: pointer;
    transition: background 0.18s, border-color 0.18s, transform 0.18s;
  }
  #gameover button.go-badge.rank:hover,
  #gameover button.go-badge.rank:focus-visible {
    background: rgba(68, 46, 88, 0.7);
    border-color: rgba(209, 174, 255, 0.8);
    transform: translateY(-1px);
    box-shadow: none;
    outline: none;
  }
  /* Ensure [hidden] wins against any other rule (defensive — the blanket
     #gameover button styling has burned us on similar overrides before). */
  #gameover .go-badge[hidden] { display: none; }
  /* Hide the whole badges row when it has no visible children so it doesn't
     eat vertical space. Uses :has() where available, harmless otherwise. */
  #gameover-hero .go-badges:not(:has(> :not([hidden]))) { display: none; }

  /* Chip strip — three compact stats (Wave / Kills / Time) stacked as
     label-under-value. Overrides the previous text-block styling of
     #gameover-stats. */
  #gameover-stats {
    color: var(--text-dim); margin: 0 0 16px;
    text-align: center; line-height: 1.2;
  }
  .go-stat-strip {
    display: flex; justify-content: center; gap: 24px; flex-wrap: wrap;
  }
  .go-chip {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    min-width: 64px;
  }
  .go-chip .go-chip-v {
    font-size: 22px; font-weight: 700; color: var(--text);
    font-variant-numeric: tabular-nums; line-height: 1;
  }
  .go-chip .go-chip-l {
    font-size: 10px; letter-spacing: 1.8px; text-transform: uppercase;
    color: var(--text-dim);
  }

  /* Earned meta — quiet single row: LVL, combo (≥3 only), relics/prev-best. */
  #gameover-earned {
    width: min(328px, 92vw);
    margin: 0 auto 16px;
    font-size: 12px; letter-spacing: 0.5px; color: var(--text-dim);
    /* The ONLY scrollable section: shrinks (flex-shrink:1 vs 0 on its siblings)
       and scrolls internally when the loot list is too tall, so the action
       buttons below stay pinned + visible. Natural height when it fits. */
    flex-shrink: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  #gameover-earned:empty { display: none; }
  .go-loot-title {
    font-size: 11px; font-weight: 800; letter-spacing: 1.6px;
    color: rgba(255,255,255,0.5); text-transform: uppercase;
    margin-bottom: 8px;
  }
  .go-loot-list {
    display: flex; flex-direction: column; gap: 4px;
  }
  .go-loot-row {
    display: flex; align-items: center; gap: 8px;
    padding: 5px 10px;
    background: rgba(255,255,255,0.04);
    border-radius: 8px;
    font-size: 13px; font-weight: 600;
  }
  .go-loot-icon { width: 20px; display: inline-flex; justify-content: center; flex-shrink: 0; }
  .go-loot-icon svg { width: 16px; height: 16px; }
  .go-loot-label { flex: 1; color: rgba(255,255,255,0.78); }
  .go-loot-val { font-weight: 800; font-variant-numeric: tabular-nums; }
  .go-loot-empty { color: rgba(255,255,255,0.4); justify-content: center; font-style: italic; }

  /* Loot grid — thumbnail tiles, 4 per row (centered so a partial last row
     reads intentional rather than left-packed). Fixed 72px tiles + 8px gap
     fit 4 across inside the 328px #gameover-earned even on narrow phones. */
  .go-loot-grid {
    display: flex; flex-wrap: wrap; justify-content: center; gap: 8px;
  }
  .go-loot-tile {
    flex: 0 0 72px;
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 8px 4px 6px; text-align: center;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
  }
  .go-loot-tile.go-loot-item { border-color: rgba(255,204,51,0.32); background: rgba(255,204,51,0.07); }
  .go-loot-tile-ic {
    width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
    font-size: 22px; line-height: 1;
  }
  .go-loot-tile-ic svg { width: 26px; height: 26px; }
  .go-loot-thumb { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 1px 2px rgba(0,0,0,.5)); }
  .go-loot-tile-name {
    font-size: 9px; font-weight: 600; letter-spacing: .2px; line-height: 1.12;
    color: rgba(255,255,255,0.72); text-transform: uppercase;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  }
  .go-loot-tile-val { font-size: 11px; font-weight: 800; font-variant-numeric: tabular-nums; }

  /* Relic-shop discovery hint — muted ghost panel between the earned-row
     and the share-card preview. Hidden by default; src/game-over.js adds
     .visible when relicShopSeen.shouldShowGameOverHint() is true. Visual
     weight is intentionally below the SHARE / PLAY AGAIN primaries — it
     reads as a tip, not a third primary action. */
  #gameover-relic-hint {
    display: none;
    margin: 0 auto 22px;
    width: min(440px, 92vw);
    padding: 14px 16px;
    border-radius: 14px;
    background: rgba(40, 30, 14, 0.5);
    border: 1px solid rgba(255, 196, 80, 0.32);
    color: var(--text);
    text-align: left;
    align-items: center;
    gap: 12px;
  }
  #gameover-relic-hint.visible { display: flex; flex-wrap: wrap; }
  #gameover-relic-hint .relic-hint-icon {
    flex: 0 0 auto;
    font-size: 28px; line-height: 1;
    color: #7ee2ff;
    text-shadow: 0 0 12px rgba(126, 226, 255, 0.55);
  }
  #gameover-relic-hint .relic-hint-body {
    flex: 1 1 200px; min-width: 0;
    display: flex; flex-direction: column; gap: 2px;
  }
  #gameover-relic-hint .relic-hint-title {
    font-size: 13px; font-weight: 700; letter-spacing: 0.6px;
    color: #ffd680;
  }
  #gameover-relic-hint .relic-hint-msg {
    font-size: 12px; color: var(--text-dim);
    line-height: 1.4;
  }
  #gameover-relic-hint #gameover-relic-cta {
    flex: 0 0 auto;
    background: rgba(255, 196, 80, 0.14) !important;
    color: #ffd680 !important;
    border: 1.5px solid rgba(255, 196, 80, 0.55) !important;
    border-radius: var(--radius-pill) !important;
    padding: 8px 16px !important;
    font-size: 12px; font-weight: 700; letter-spacing: 0.8px;
    box-shadow: none !important;
    cursor: pointer;
    transition: background 0.16s, border-color 0.16s, transform 0.12s;
  }
  #gameover-relic-hint #gameover-relic-cta:hover,
  #gameover-relic-hint #gameover-relic-cta:focus-visible {
    background: rgba(255, 196, 80, 0.26) !important;
    border-color: rgba(255, 196, 80, 0.85) !important;
    transform: translateY(-1px);
    outline: none;
  }
  /* Mobile: stack the CTA below the title/msg block so the panel doesn't
     stretch the gameover card. */
  @media (max-width: 480px) {
    #gameover-relic-hint .relic-hint-body { flex: 1 1 100%; }
    #gameover-relic-hint #gameover-relic-cta { flex: 1 1 100%; margin-top: 4px; }
  }

  #gameover button {
    background: linear-gradient(135deg, #ff8a8a, #ffa866);
    color: #2a1010;
    box-shadow: 0 8px 26px rgba(255, 138, 138, 0.35);
  }
  #gameover button:hover, #gameover button:focus-visible {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 12px 34px rgba(255, 138, 138, 0.5);
    outline: none;
  }
  /* PLAY AGAIN is demoted to a ghost button — translucent fill, bordered in
     the survived/defeated accent colour. Keeps it obviously clickable without
     competing with SHARE for attention. */
  #gameover #restart-btn {
    background: rgba(255, 168, 102, 0.08) !important;
    color: #ffc9a8 !important;
    border: 1.5px solid rgba(255, 138, 138, 0.55) !important;
    box-shadow: none !important;
  }
  #gameover #restart-btn:hover,
  #gameover #restart-btn:focus-visible {
    background: rgba(255, 168, 102, 0.16) !important;
    border-color: rgba(255, 138, 138, 0.85) !important;
  }
  #gameover.survived #restart-btn {
    background: rgba(159, 232, 112, 0.08) !important;
    color: #c4eea8 !important;
    border: 1.5px solid rgba(159, 232, 112, 0.55) !important;
    box-shadow: none !important;
  }
  #gameover.survived #restart-btn:hover,
  #gameover.survived #restart-btn:focus-visible {
    background: rgba(159, 232, 112, 0.16) !important;
    border-color: rgba(159, 232, 112, 0.85) !important;
  }
  /* Primary CTAs — SHARE (solid) + PLAY AGAIN (ghost), equal width, side by
     side. SHARE leads visually so the social loop is the loud call. On mobile
     they stack vertically and SHARE sits on top. */
  #gameover-actions {
    display: flex; gap: 24px; flex-wrap: wrap; justify-content: center;
    width: min(440px, 92vw); margin: 0 auto 14px;
    position: relative; z-index: 2;
  }
  #gameover-actions > button {
    flex: 1 1 160px; min-width: 150px;
    display: inline-flex; align-items: center; justify-content: center;
    gap: 8px;
  }

  /* Secondary row — text-only links for View Rankings + Title Screen. Demoted
     from full buttons so they recede behind the two primary CTAs. */
  #gameover-secondary {
    display: flex; justify-content: center; gap: 18px; flex-wrap: wrap;
  }
  #gameover-secondary button {
    background: transparent !important;
    border: none !important;
    color: var(--text-dim) !important;
    font-size: 12px; font-weight: 600; letter-spacing: 0.8px;
    padding: 6px 10px !important;
    box-shadow: none !important;
    cursor: pointer;
    transition: color 0.15s ease;
  }
  #gameover-secondary button:hover,
  #gameover-secondary button:focus-visible {
    color: #d1aeff !important;
    transform: none !important;
    box-shadow: none !important;
    outline: none;
  }

  /* SHARE button on game-over. Primary CTA — solid gradient, pulsing aura,
     stronger shadow than PLAY AGAIN (which is a ghost) so the visual weight
     unambiguously favours the social loop. The .busy state dims the button
     while navigator.share is open, and .share-flash is a transient "SHARED"
     pill that fades in when the share resolves OK. */
  #share-run-btn {
    position: relative; overflow: visible;
    background: linear-gradient(135deg, #7ee2ff 0%, #b89bff 100%) !important;
    color: #0b0e17 !important;
    border: 1.5px solid rgba(255, 255, 255, 0.4) !important;
    box-shadow: 0 10px 30px rgba(126, 226, 255, 0.5), 0 0 0 0 rgba(126, 226, 255, 0);
    font-weight: 800;
    letter-spacing: 0.8px;
    transition: transform 0.15s ease, box-shadow 0.25s ease, filter 0.15s ease;
    animation: shareIdlePulse 2.4s ease-in-out infinite;
  }
  #share-run-btn:hover,
  #share-run-btn:focus-visible {
    transform: translateY(-1px);
    box-shadow: 0 12px 36px rgba(126, 226, 255, 0.65), 0 0 28px rgba(184, 155, 255, 0.7);
  }
  #share-run-btn.busy { filter: saturate(0.85) brightness(0.95); pointer-events: none; animation: none; }
  #share-run-btn .share-btn-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 20px; height: 20px; color: currentColor;
  }
  /* Busy/idle label swap — the button always reserves the idle label's space
     (so it doesn't collapse while rendering), and CSS toggles which label is
     visible based on .busy. Keeps a single button box without layout thrash. */
  #share-run-btn .share-btn-content,
  #share-run-btn .share-btn-busy {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 8px;
  }
  #share-run-btn .share-btn-busy { display: none; }
  #share-run-btn.busy .share-btn-content { display: none; }
  #share-run-btn.busy .share-btn-busy { display: inline-flex; }
  #share-run-btn .share-btn-spinner {
    width: 14px; height: 14px; border-radius: 50%;
    border: 2px solid rgba(11, 14, 23, 0.25);
    border-top-color: #0b0e17;
    animation: spin-360 0.75s linear infinite;
  }
  .share-flash {
    position: absolute; left: 50%; top: -14px;
    transform: translate(-50%, -4px);
    font-size: 11px; font-weight: 700; letter-spacing: 1.2px;
    color: #0b0e17;
    background: var(--gold);
    padding: 3px 10px; border-radius: var(--radius-pill);
    box-shadow: 0 4px 12px rgba(255, 211, 110, 0.55);
    animation: shareFlashIn 1.6s ease forwards;
    pointer-events: none;
  }
  @keyframes shareIdlePulse {
    0%, 100% { box-shadow: 0 10px 30px rgba(126, 226, 255, 0.5),  0 0 0 0 rgba(126, 226, 255, 0); }
    50%      { box-shadow: 0 10px 30px rgba(126, 226, 255, 0.62), 0 0 0 8px rgba(126, 226, 255, 0.18); }
  }
  @keyframes shareFlashIn {
    0%   { opacity: 0; transform: translate(-50%, 4px); }
    15%  { opacity: 1; transform: translate(-50%, -14px); }
    80%  { opacity: 1; transform: translate(-50%, -14px); }
    100% { opacity: 0; transform: translate(-50%, -22px); }
  }

  /* Taunt banner — rendered on the landing page when ?s=… query params are
     present (shared-run link). Floats over the top of the landing overlay
     and dismisses either via the × button or by clicking PLAY. */
  #taunt-banner {
    position: fixed; top: 16px; left: 50%;
    transform: translate(-50%, -110%);
    max-width: min(540px, 92vw);
    padding: 10px 16px 10px 20px;
    background: linear-gradient(135deg, rgba(126, 226, 255, 0.18), rgba(184, 155, 255, 0.18));
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 14px;
    box-shadow: 0 10px 30px rgba(10, 14, 30, 0.55);
    color: #e8ecff;
    font-size: 14px;
    letter-spacing: 0.2px;
    z-index: 250;
    transition: transform 0.42s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.32s ease;
    opacity: 0;
  }
  #taunt-banner.visible { transform: translate(-50%, 0); opacity: 1; }
  #taunt-banner.hiding  { transform: translate(-50%, -110%); opacity: 0; }
  #taunt-banner .taunt-inner {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  }
  #taunt-banner .taunt-who   { font-weight: 700; color: var(--gold); }
  #taunt-banner .taunt-score { color: #7ee2ff; font-variant-numeric: tabular-nums; }
  #taunt-banner .taunt-stage { color: var(--lilac); }
  #taunt-banner .taunt-cta   { color: #9fe870; font-weight: 700; margin-left: 4px; }
  #taunt-banner .taunt-dismiss {
    margin-left: auto;
    background: transparent; border: none; color: #808a9d;
    font-size: 20px; line-height: 1; width: 24px; height: 24px;
    cursor: pointer; padding: 0;
    transition: color 0.15s ease;
  }
  #taunt-banner .taunt-dismiss:hover { color: #fff; }
  @media (max-width: 520px) {
    #taunt-banner { top: 10px; font-size: 13px; padding: 9px 12px 9px 14px; }
    #taunt-banner .taunt-inner { gap: 6px; }
  }

  /* Victory confetti — spawned by _spawnVictoryConfetti. Purely decorative,
     pointer-events disabled so clicks still pass through to the buttons. */
  .gameover-confetti {
    position: absolute; top: -28px;
    width: 10px; height: 14px; border-radius: 2px;
    opacity: 0.9; pointer-events: none; z-index: 1;
    animation-name: confettiFall;
    animation-timing-function: cubic-bezier(0.3, 0.7, 0.4, 1);
    animation-fill-mode: forwards;
    will-change: transform, opacity;
  }
  @keyframes confettiFall {
    0%   { transform: translateY(-12vh) rotate(0deg);  opacity: 0; }
    12%  { opacity: 0.95; }
    100% { transform: translateY(112vh) rotate(720deg); opacity: 0; }
  }
