/* ==========================================================================
   Make-Her Hack — "Townsville Attack" arcade mini-game (after the FAQ)
   ========================================================================== */

.arcade {
  --zig: var(--paper);
  isolation: isolate;
  overflow: hidden;
  color: var(--white);
  padding-block: clamp(4.5rem, 8vw, 6.5rem) clamp(3.5rem, 7vw, 5.5rem);
  background:
    radial-gradient(ellipse 70% 45% at 50% 0%, rgba(250, 92, 148, .22), transparent 70%),
    radial-gradient(ellipse 60% 40% at 0% 100%, rgba(82, 184, 245, .16), transparent 70%),
    radial-gradient(ellipse 60% 40% at 100% 100%, rgba(108, 211, 91, .14), transparent 70%),
    linear-gradient(#1c0f30, #0b0710);
}
.arcade::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image: radial-gradient(rgba(255, 255, 255, .13) 1.5px, transparent 2px);
  background-size: 22px 22px;
  -webkit-mask-image: linear-gradient(#000, transparent 55%);
  mask-image: linear-gradient(#000, transparent 55%);
}
.arcade__head { margin-bottom: clamp(1.75rem, 4vw, 2.75rem); }

/* The arcade sits directly above the footer, so the footer's zigzag takes its colour */
.footer { --zig: #0b0710; }
.arcade .section-title { font-size: clamp(2.3rem, 5.6vw, 4.2rem); }
.arcade .section-lede { opacity: .85; }

/* ---------- Cabinet ---------- */

.cab {
  /* Hero palette, swapped by data-hero */
  --h1: #ff5fa2;
  --h2: #ff8fc4;
  --h3: #ffd1e6;
  --hglow: rgba(255, 95, 162, .5);

  position: relative;
  width: min(100%, 1080px);
  margin-inline: auto;
  padding: 10px;
  background:
    radial-gradient(rgba(255, 255, 255, .06) 1px, transparent 1.4px) 0 0 / 9px 9px,
    linear-gradient(160deg, #2c1749, #150b25 60%);
  border: 4px solid #000;
  border-radius: 28px;
  box-shadow: 10px 10px 0 #000, 0 0 70px -12px var(--hglow);
  transition: box-shadow .5s;
  -webkit-tap-highlight-color: transparent;
}
.cab[data-hero="bubbles"] { --h1: #42c8ff; --h2: #6de5ff; --h3: #d5f7ff; --hglow: rgba(66, 200, 255, .5); }
.cab[data-hero="buttercup"] { --h1: #7be43c; --h2: #b6f35b; --h3: #e7ffc9; --hglow: rgba(123, 228, 60, .45); }

/* Fit the whole cabinet (marquee + 16:9 screen + deck, ~206px of chrome) under the nav */
@media (min-width: 901px) {
  .cab { width: min(100%, 1080px, max(640px, (100vh - 306px) * 16 / 9 + 36px)); }
}

.cab button { -webkit-user-select: none; user-select: none; }

/* ---------- Marquee ---------- */

.cab__marquee {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: .5rem;
  margin-bottom: 10px;
  padding: 6px;
  background:
    repeating-linear-gradient(-45deg, rgba(255, 255, 255, .04) 0 10px, transparent 10px 20px),
    #0d0718;
  border: 3px solid #000;
  border-radius: 18px;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .06);
}
.cab__tools { display: flex; gap: 6px; }
.cab__tools--end { justify-content: flex-end; }
.cab__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(.95rem, 2.6vw, 1.5rem);
  letter-spacing: .06em;
  line-height: 1.1;
  text-align: center;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--h3);
  text-shadow: 0 0 6px var(--h1), 0 0 18px var(--h1), 2px 2px 0 #000;
  transition: color .5s, text-shadow .5s;
}
.cab__title span { color: var(--yellow); text-shadow: 0 0 10px rgba(255, 226, 58, .8); }
.cab.is-live .cab__title { animation: arc-neon 1.1s steps(1) both; }
@keyframes arc-neon {
  0%, 18%, 32% { opacity: .15; }
  12%, 24%, 40%, 100% { opacity: 1; }
}

.cab__icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: #000;
  background: var(--white);
  border: 3px solid #000;
  border-radius: 12px;
  box-shadow: 3px 3px 0 var(--h1);
  cursor: pointer;
  transition: transform .15s var(--ease-out), box-shadow .15s var(--ease-out), opacity .2s;
}
.cab__icon:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--h1); }
.cab__icon:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--h1); }
.cab__icon:disabled { opacity: .35; cursor: default; transform: none; box-shadow: 3px 3px 0 rgba(255, 255, 255, .2); }
.cab__icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.cab__icon .i-spk { fill: currentColor; }
.cab__icon[aria-pressed="true"] .i-off,
.cab__icon[aria-pressed="false"] .i-on { display: none; }

/* ---------- Screen ---------- */

.cab__screen {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: #0d0820;
  border: 4px solid #000;
  border-radius: 18px;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .08), 0 0 0 3px rgba(255, 255, 255, .05);
  outline: none;
  container-type: size;
}
.cab__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.cab[data-state="countdown"] .cab__screen,
.cab[data-state="playing"] .cab__screen,
.cab[data-state="boss"] .cab__screen { touch-action: none; cursor: crosshair; }

.cab__scan {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    repeating-linear-gradient(rgba(0, 0, 0, .12) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse at center, transparent 60%, rgba(0, 0, 0, .45));
}

/* Sonic Scream / Power Slam screen wobble */
.cab__screen.is-warp .cab__canvas { animation: arc-warp .5s ease-out; }
@keyframes arc-warp {
  0% { transform: scale(1); filter: none; }
  20% { transform: scale(1.025, .985) skewX(-1.2deg); filter: saturate(1.6) hue-rotate(-12deg); }
  45% { transform: scale(.99, 1.015) skewX(1deg); filter: saturate(1.3) hue-rotate(10deg); }
  70% { transform: scale(1.008, .996); }
  100% { transform: none; filter: none; }
}

/* ---------- HUD ---------- */

.hud {
  position: absolute;
  inset: 0 0 auto;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  gap: 8px;
  padding: 10px;
  pointer-events: none;
  opacity: 0;
  transition: opacity .3s;
}
.cab[data-state="countdown"] .hud,
.cab[data-state="playing"] .hud,
.cab[data-state="boss"] .hud,
.cab[data-state="paused"] .hud { opacity: 1; }

.hud__box {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 4px 12px 5px;
  line-height: 1.05;
  background: rgba(13, 7, 24, .78);
  border: 2.5px solid #000;
  border-top: 3px solid var(--h1);
  border-radius: 12px;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, .6);
}
.hud__box small {
  font-size: .62rem;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--h2);
}
.hud__box b {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1rem, 2.4vw, 1.4rem);
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
}
.hud__score { justify-self: start; min-width: 6.5em; }
.hud__wave { align-items: center; }
.hud__wave b { color: var(--yellow); }
.hud__lives {
  justify-self: end;
  flex-direction: row;
  align-items: center;
  gap: 4px;
  padding: 8px 10px;
}
.hud__lives.is-hit { animation: arc-shake .4s; }

.heart {
  --f: 100%;
  position: relative;
  display: block;
  width: 22px;
  height: 20px;
  filter: drop-shadow(1.5px 0 0 #000) drop-shadow(-1.5px 0 0 #000) drop-shadow(0 1.5px 0 #000) drop-shadow(0 -1.5px 0 #000);
}
.heart::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, #ff3b6b var(--f), rgba(255, 255, 255, .2) var(--f));
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 22'%3E%3Cpath d='M12 21.5 1.9 11.6A6 6 0 0 1 12 3.3a6 6 0 0 1 10.1 8.3z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 22'%3E%3Cpath d='M12 21.5 1.9 11.6A6 6 0 0 1 12 3.3a6 6 0 0 1 10.1 8.3z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.hud__combo {
  grid-column: 2;
  justify-self: center;
  margin-top: -2px;
  padding: 3px 12px;
  font-family: var(--font-display);
  font-size: .85rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  white-space: nowrap;
  color: #000;
  background: var(--yellow);
  border: 2.5px solid #000;
  border-radius: 999px;
  box-shadow: 2px 2px 0 #000;
  rotate: -3deg;
  opacity: 0;
  scale: .6;
  transition: opacity .2s, scale .25s var(--ease-pop);
}
.hud__combo b { font-weight: 400; }
.hud__combo.is-on { opacity: 1; scale: 1; }
.hud__combo.is-bump { animation: arc-bump .25s var(--ease-pop); }
.hud__combo.is-hot { background: linear-gradient(90deg, #ffe23a, #ff8a1f, #ff3b6b, #ffe23a); background-size: 300% 100%; color: #000; animation: arc-fire 1.2s linear infinite; }
.hud__combo.is-hot.is-bump { animation: arc-bump .25s var(--ease-pop), arc-fire 1.2s linear infinite; }
@keyframes arc-bump { 50% { scale: 1.3; } }
@keyframes arc-fire { to { background-position: 300% 0; } }

.hud__boss {
  grid-column: 1 / -1;
  justify-self: center;
  width: min(70%, 420px);
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: .78rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #d9b8ff;
  text-shadow: 1.5px 1.5px 0 #000;
  opacity: 0;
  translate: 0 -8px;
  transition: opacity .4s, translate .4s var(--ease-out);
}
.cab.is-boss .hud__boss { opacity: 1; translate: none; }
.hud__bossbar {
  flex: 1;
  height: 14px;
  padding: 2px;
  background: #1a0d2a;
  border: 2.5px solid #000;
  border-radius: 999px;
  box-shadow: 2px 2px 0 #000;
}
.hud__bossbar i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #8a2be2, #d14fa8, #ff3b6b);
  transform-origin: left;
  transform: scaleX(var(--hp, 1));
  transition: transform .2s;
}
.hud__boss.is-hit .hud__bossbar i { filter: brightness(2); }

/* ---------- Banners and hints ---------- */

.cab__banner {
  position: absolute;
  left: 50%;
  top: 44%;
  z-index: 3;
  width: max-content;
  max-width: 92%;
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 5.5vw, 3.4rem);
  line-height: 1.05;
  letter-spacing: .03em;
  text-align: center;
  text-transform: uppercase;
  color: var(--white);
  -webkit-text-stroke: .09em #000;
  paint-order: stroke fill;
  text-shadow: .07em .07em 0 #000, 0 0 30px var(--h1);
  pointer-events: none;
  opacity: 0;
  translate: -50% -50%;
}
.cab__banner small {
  display: block;
  margin-top: .35em;
  font-size: .4em;
  letter-spacing: .14em;
  color: var(--h2);
}
.cab__banner[data-tone="hero"] { color: var(--h2); }
.cab__banner[data-tone="warn"] { color: #ff5a6e; text-shadow: .07em .07em 0 #000, 0 0 34px rgba(255, 40, 80, .9); }
.cab__banner[data-tone="gold"] { color: var(--yellow); }
.cab__banner.is-show { animation: arc-banner var(--dur, 1.6s) var(--ease-out) both; }
@keyframes arc-banner {
  0% { opacity: 0; scale: 2.2; rotate: -6deg; }
  12% { opacity: 1; scale: .94; rotate: -2deg; }
  20% { scale: 1.04; }
  28%, 82% { opacity: 1; scale: 1; rotate: -2deg; }
  100% { opacity: 0; scale: .9; rotate: 0deg; }
}

.cab__touchhint {
  position: absolute;
  left: 50%;
  bottom: 14px;
  z-index: 3;
  margin: 0;
  padding: .4rem .9rem;
  font-size: .85rem;
  font-weight: 600;
  white-space: nowrap;
  color: #000;
  background: var(--white);
  border: 2.5px solid #000;
  border-radius: 999px;
  box-shadow: 3px 3px 0 #000;
  pointer-events: none;
  opacity: 0;
  translate: -50% 10px;
  transition: opacity .3s, translate .3s var(--ease-out);
}
.cab__touchhint.is-show { opacity: 1; translate: -50% 0; }

/* ---------- Overlay screens ---------- */

.scr {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: clamp(.75rem, 2.5vw, 1.5rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  text-align: center;
  background:
    radial-gradient(rgba(255, 255, 255, .07) 1.2px, transparent 1.6px) 0 0 / 14px 14px,
    radial-gradient(ellipse at 50% 30%, rgba(40, 18, 70, .55), rgba(9, 5, 18, .9));
  opacity: 0;
  visibility: hidden;
  transition: opacity .3s, visibility 0s .3s;
}
.scr.is-on { opacity: 1; visibility: visible; transition: opacity .3s, visibility 0s; }
.scr--countdown { background: rgba(9, 5, 18, .25); pointer-events: none; }

.scr__kicker {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(.7rem, 1.6vw, .9rem);
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--yellow);
  text-shadow: 0 0 10px rgba(255, 226, 58, .7);
}
.scr__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 4.4vw, 2.7rem);
  line-height: 1;
  letter-spacing: .02em;
  text-transform: uppercase;
  color: var(--white);
  -webkit-text-stroke: .1em #000;
  paint-order: stroke fill;
  text-shadow: .07em .07em 0 #000, 0 0 26px var(--hglow);
}
.scr__title--sm { font-size: clamp(1.2rem, 3vw, 1.8rem); }
.scr__sub { margin: 0 0 .35rem; font-size: clamp(.82rem, 1.6vw, 1rem); opacity: .8; }
.scr__info {
  min-height: 2.6em;
  max-width: 34rem;
  margin: .15rem 0 .25rem;
  font-size: clamp(.78rem, 1.5vw, .95rem);
  line-height: 1.3;
  color: rgba(255, 255, 255, .85);
}
.scr__info b { color: var(--h2); font-weight: 600; }
.scr__btns { display: flex; flex-wrap: wrap; justify-content: center; gap: .7rem; margin-top: .4rem; }
.scr__btns--col { flex-direction: column; align-items: stretch; width: min(100%, 15rem); }

/* Arcade button (mirrors .btn from base.css, tuned for small screens) */
.abtn {
  --bg: var(--white);
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  min-height: 48px;
  padding: .7rem 1.3rem;
  font-family: var(--font-display);
  font-size: clamp(.9rem, 1.8vw, 1.08rem);
  letter-spacing: .04em;
  line-height: 1;
  text-transform: uppercase;
  color: #000;
  background: var(--bg);
  border: 3px solid #000;
  border-radius: 14px;
  box-shadow: 4px 4px 0 #000;
  cursor: pointer;
  transition: transform .15s var(--ease-out), box-shadow .15s var(--ease-out), opacity .2s, background-color .3s;
}
.abtn::after {
  content: "";
  position: absolute;
  inset: -2px auto -2px -60%;
  width: 40%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .6), transparent);
  transform: skewX(-20deg);
  transition: left .6s var(--ease-out);
}
.abtn:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 #000; }
.abtn:hover::after { left: 130%; }
.abtn:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 #000; }
.abtn--go { --bg: var(--h1); }
.abtn--ghost { --bg: transparent; color: var(--white); border-color: var(--white); box-shadow: 4px 4px 0 rgba(255, 255, 255, .25); }
.abtn:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: 4px 4px 0 #000; filter: grayscale(.6); }
.abtn--go:not(:disabled) { animation: arc-pulse 1.6s ease-in-out infinite; }
@keyframes arc-pulse {
  0%, 100% { box-shadow: 4px 4px 0 #000, 0 0 0 0 var(--hglow); }
  50% { box-shadow: 4px 4px 0 #000, 0 0 0 8px transparent; }
}

/* ---------- Character select ---------- */

.picks {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(.5rem, 1.6vw, 1.1rem);
  width: min(100%, 720px);
  margin-top: .2rem;
}
.pick {
  --c1: #ff5fa2; --c2: #ff8fc4; --c3: #ffd1e6;
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  min-width: 0;
  padding: .55rem .4rem .7rem;
  color: #000;
  background:
    radial-gradient(rgba(0, 0, 0, .12) 1.2px, transparent 1.6px) 0 0 / 10px 10px,
    radial-gradient(circle at 50% 38%, var(--c3), var(--c2) 55%, var(--c1));
  border: 3px solid #000;
  border-radius: 18px;
  box-shadow: 5px 5px 0 #000;
  cursor: pointer;
  transition: transform .25s var(--ease-pop), box-shadow .25s var(--ease-out), opacity .3s, filter .3s;
}
.pick[data-pick="bubbles"] { --c1: #42c8ff; --c2: #6de5ff; --c3: #d5f7ff; }
.pick[data-pick="buttercup"] { --c1: #7be43c; --c2: #b6f35b; --c3: #e7ffc9; }

/* Animated border, shown on hover and when picked */
.pick::before {
  content: "";
  position: absolute;
  inset: -7px;
  z-index: -1;
  border-radius: 23px;
  background: conic-gradient(from var(--ang, 0deg), var(--c1), #fff, var(--c1), var(--yellow), var(--c1));
  opacity: 0;
  transition: opacity .3s;
  animation: arc-spin 2.4s linear infinite;
}
@property --ang { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
@keyframes arc-spin { to { --ang: 360deg; } }
/* Sparkles */
.pick::after {
  content: "✦ ✧ ✦";
  position: absolute;
  inset: 4px 0 auto;
  font-size: .9rem;
  letter-spacing: 1.6em;
  color: #fff;
  text-shadow: 0 0 6px var(--c1);
  opacity: 0;
  pointer-events: none;
}
.pick:hover { transform: translateY(-6px); box-shadow: 7px 11px 0 #000; }
.pick:hover::before, .pick[aria-checked="true"]::before { opacity: 1; }
.pick:hover::after { animation: arc-sparkle 1.2s ease-out infinite; }
.pick:hover .pick__art img { filter: brightness(1.12) drop-shadow(0 0 10px #fff); }
.pick[aria-checked="true"] { transform: translateY(-4px) scale(1.05); box-shadow: 7px 9px 0 #000; }
.picks.has-pick .pick:not([aria-checked="true"]) { opacity: .55; filter: saturate(.55); transform: scale(.95); }
.picks.has-pick .pick:not([aria-checked="true"]):hover { opacity: .85; filter: none; transform: translateY(-3px) scale(.97); }
.pick.is-chosen { animation: arc-chosen .5s var(--ease-pop); }
@keyframes arc-chosen { 40% { scale: 1.12; } }
@keyframes arc-sparkle {
  0% { opacity: 0; translate: 0 14px; }
  30% { opacity: 1; }
  100% { opacity: 0; translate: 0 -10px; }
}

.pick__art {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 0;
  height: clamp(70px, 14vw, 140px);
  height: clamp(64px, 25cqh, 150px);
}
.pick__art img {
  width: auto;
  height: 100%;
  max-width: 100%;
  object-fit: contain;
  filter: drop-shadow(3px 3px 0 rgba(0, 0, 0, .35));
  transition: filter .3s;
  animation: arc-float 2.6s ease-in-out infinite;
  animation-delay: calc(var(--i) * -.8s);
}
@keyframes arc-float { 50% { translate: 0 -6px; rotate: 2deg; } }
.pick__name {
  margin-top: .25rem;
  font-family: var(--font-display);
  font-size: clamp(.9rem, 2.2vw, 1.35rem);
  line-height: 1;
  text-transform: uppercase;
  color: var(--white);
  -webkit-text-stroke: .12em #000;
  paint-order: stroke fill;
  text-shadow: .06em .06em 0 #000;
}
.pick__role {
  font-size: clamp(.6rem, 1.3vw, .75rem);
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.pick__ability {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  margin-top: .3rem;
  padding: .2rem .55rem;
  font-size: clamp(.62rem, 1.3vw, .8rem);
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--white);
  background: #000;
  border-radius: 999px;
}
.pick__ability i { font-style: normal; color: var(--c2); }

/* Intro once the cabinet scrolls into view */
.js .cab:not(.is-live) .scr--select > * { opacity: 0; }
.cab.is-live .scr--select > * { animation: arc-rise .55s var(--ease-pop) both; }
.cab.is-live .scr--select > :nth-child(2) { animation-delay: .25s; }
.cab.is-live .scr--select > :nth-child(3) { animation-delay: .35s; }
.cab.is-live .scr--select > :nth-child(n+4) { animation-delay: .45s; }
.cab.is-live .pick { animation: arc-rise .6s var(--ease-pop) both; animation-delay: calc(.5s + var(--i) * .12s); }
.cab.is-live .pick.is-chosen { animation: arc-chosen .5s var(--ease-pop); }
@keyframes arc-rise { from { opacity: 0; translate: 0 22px; scale: .9; } }

/* ---------- Loading ---------- */

.chemx {
  position: relative;
  width: 34px;
  height: 64px;
  background: linear-gradient(transparent 38%, #39ff14 38%);
  border: 3px solid #000;
  border-radius: 6px 6px 16px 16px;
  box-shadow: 0 0 24px rgba(57, 255, 20, .7), 3px 3px 0 #000;
  animation: arc-vial 1s ease-in-out infinite;
}
.chemx::before {
  content: "X";
  position: absolute;
  inset: auto 0 10px;
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: #000;
}
@keyframes arc-vial { 50% { rotate: 12deg; translate: 0 -6px; } }

/* ---------- Countdown ---------- */

.count {
  font-family: var(--font-display);
  font-size: clamp(4rem, 16vw, 9rem);
  line-height: 1;
  color: var(--h1);
  -webkit-text-stroke: .08em #000;
  paint-order: stroke fill;
  text-shadow: .06em .06em 0 #000, 0 0 40px var(--h1);
}
.count.is-go { color: var(--yellow); }
.count.is-pop { animation: arc-count .9s var(--ease-out) both; }
@keyframes arc-count {
  0% { opacity: 0; scale: 2.6; }
  25% { opacity: 1; scale: .9; }
  40% { scale: 1.05; }
  75% { opacity: 1; scale: 1; }
  100% { opacity: 0; scale: .7; }
}

/* ---------- End screens ---------- */

.scr--end {
  flex-direction: row;
  gap: clamp(1rem, 3vw, 2.5rem);
}
.end__art {
  position: relative;
  flex: 0 1 40%;
  display: grid;
  place-items: center;
}
.end__art img { width: 100%; max-height: 62%; max-height: min(320px, 60vh); object-fit: contain; filter: drop-shadow(5px 5px 0 rgba(0, 0, 0, .55)); }
.scr--victory .end__art img { animation: arc-flee 2.6s ease-in-out infinite; }
.scr--over .end__art img { animation: arc-laugh .35s ease-in-out infinite alternate; }
@keyframes arc-flee {
  0%, 100% { translate: 0 0; rotate: -3deg; }
  50% { translate: 10px -8px; rotate: 2deg; }
}
@keyframes arc-laugh {
  from { translate: 0 0; rotate: -2deg; }
  to { translate: 0 -5px; rotate: 2deg; }
}
.end__quote {
  position: absolute;
  top: 0;
  left: 0;
  max-width: 11rem;
  padding: .35rem .7rem;
  font-family: var(--font-display);
  font-size: clamp(.7rem, 1.5vw, .92rem);
  line-height: 1.1;
  text-transform: uppercase;
  color: #000;
  background: var(--white);
  border: 2.5px solid #000;
  border-radius: 14px;
  box-shadow: 3px 3px 0 #000;
  rotate: -5deg;
}
.end__quote::after {
  content: "";
  position: absolute;
  left: 70%;
  bottom: -11px;
  width: 14px;
  height: 14px;
  background: var(--white);
  border-right: 2.5px solid #000;
  border-bottom: 2.5px solid #000;
  transform: rotate(45deg) skew(10deg, 10deg);
}
.scr--over .end__quote { left: auto; right: 0; rotate: 6deg; color: #6b1fa0; }
.end__body {
  flex: 1 1 55%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .45rem;
  min-width: 0;
}
.end__hero { margin: 0; font-weight: 600; color: var(--h2); }
.end__hero b { font-family: var(--font-display); font-weight: 400; letter-spacing: .05em; text-transform: uppercase; }
.scr.is-on .end__art { animation: arc-rise .6s var(--ease-pop) both; }
.scr.is-on .end__body > * { animation: arc-rise .5s var(--ease-pop) both; }
.scr.is-on .end__body > :nth-child(2) { animation-delay: .1s; }
.scr.is-on .end__body > :nth-child(3) { animation-delay: .2s; }
.scr.is-on .end__body > :nth-child(4) { animation-delay: .4s; }
.scr.is-on .end__body > :nth-child(n+5) { animation-delay: .5s; }

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  width: min(100%, 30rem);
  margin: .2rem 0;
}
.stats div {
  padding: .4rem .3rem;
  background: rgba(255, 255, 255, .07);
  border: 2.5px solid #000;
  border-top: 3px solid var(--h1);
  border-radius: 12px;
}
.stats dt { font-size: .6rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; opacity: .75; }
.stats dd { margin: 0; font-family: var(--font-display); font-size: clamp(1rem, 2.4vw, 1.35rem); font-variant-numeric: tabular-nums; }
.stats div:first-child dd { color: var(--yellow); }

.badge {
  position: relative;
  overflow: hidden;
  margin: .15rem 0 0;
  padding: .45rem 1.1rem;
  font-family: var(--font-display);
  font-size: clamp(.82rem, 1.8vw, 1.05rem);
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #000;
  background: linear-gradient(135deg, var(--yellow), var(--h2));
  border: 3px solid #000;
  border-radius: 999px;
  box-shadow: 4px 4px 0 #000;
}
.badge::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 -40%;
  width: 30%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .8), transparent);
  transform: skewX(-20deg);
  animation: arc-shine 2.4s ease-in-out infinite 1s;
}
.scr.is-on .badge { animation: arc-stamp .6s var(--ease-pop) .4s both; }
@keyframes arc-stamp { from { opacity: 0; scale: 2.4; rotate: -12deg; } to { rotate: -2deg; } }
@keyframes arc-shine { 0% { left: -40%; } 45%, 100% { left: 130%; } }
.end__egg { min-height: 0; margin: 0; font-family: var(--font-display); font-size: .82rem; letter-spacing: .08em; text-transform: uppercase; color: var(--yellow); }
.end__egg:empty { display: none; }

/* ---------- How to play ---------- */

.scr--howto { z-index: 6; opacity: 1; visibility: visible; background: rgba(9, 5, 18, .78); }
.scr--howto[hidden] { display: none; }
.howto {
  width: min(100%, 25rem);
  padding: 1rem 1.2rem 1.2rem;
  color: #1a1020;
  text-align: left;
  background:
    radial-gradient(rgba(250, 92, 148, .18) 1.5px, transparent 2px) 0 0 / 14px 14px,
    var(--paper);
  border: 4px solid #000;
  border-radius: 20px;
  box-shadow: 7px 7px 0 #000;
  animation: arc-rise .4s var(--ease-pop);
}
.howto .scr__title { text-align: center; text-shadow: .07em .07em 0 #000; }
.howto ul { margin: .7rem 0; padding: 0; list-style: none; display: grid; gap: .4rem; }
.howto li { display: flex; align-items: center; gap: .65rem; font-size: .9rem; font-weight: 500; line-height: 1.25; }
.howto__keys { flex: 0 0 4.6rem; display: flex; gap: 3px; justify-content: center; }
.howto kbd {
  display: inline-grid;
  place-items: center;
  min-width: 1.7rem;
  padding: .1rem .35rem;
  font-family: var(--font-body);
  font-size: .78rem;
  font-weight: 700;
  color: #000;
  background: var(--white);
  border: 2px solid #000;
  border-radius: 6px;
  box-shadow: 2px 2px 0 #000;
}
.howto li > span:last-child kbd { min-width: 0; font-size: .7rem; padding: 0 .25rem; box-shadow: 1px 1px 0 #000; }
.dot {
  display: inline-grid;
  place-items: center;
  width: 1.7rem;
  height: 1.7rem;
  font-size: .8rem;
  color: #000;
  background: radial-gradient(circle at 35% 30%, #fff, var(--h2) 45%, var(--h1));
  border: 2px solid #000;
  border-radius: 50%;
}
.dot--x { background: #39ff14; border-radius: 6px 6px 12px 12px; font-family: var(--font-display); font-weight: 400; }
.dot--bot { background: #b58cff; border-radius: 6px; }
.howto__end { margin: 0 0 .8rem; text-align: center; font-family: var(--font-display); font-size: 1.1rem; text-transform: uppercase; color: var(--pink-deep); }
.howto .abtn { width: 100%; }

/* ---------- Control deck ---------- */

.cab__deck {
  display: flex;
  align-items: center;
  gap: clamp(.6rem, 2vw, 1.2rem);
  margin-top: 10px;
  padding: 10px 12px;
  background: #0d0718;
  border: 3px solid #000;
  border-radius: 18px;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .05);
}
.deck__meter { flex: 1; min-width: 0; display: grid; gap: 5px; }
.deck__label, .deck__stats {
  display: flex;
  justify-content: space-between;
  gap: .75rem;
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  white-space: nowrap;
  color: rgba(255, 255, 255, .7);
}
.deck__label span { font-family: var(--font-display); font-weight: 400; font-size: .85rem; color: var(--h2); }
.deck__label b { font-family: var(--font-display); font-weight: 400; font-size: .85rem; color: var(--white); font-variant-numeric: tabular-nums; }
.deck__stats b { font-family: var(--font-display); font-weight: 400; color: var(--white); letter-spacing: .04em; }
.chip-x {
  display: inline-grid;
  place-items: center;
  width: 1.15rem;
  height: 1.15rem;
  margin-right: .15rem;
  font-size: .62rem;
  color: #000 !important;
  background: #39ff14;
  border: 1.5px solid #000;
  border-radius: 4px;
  vertical-align: -.2em;
}
.meter {
  position: relative;
  height: 20px;
  padding: 2px;
  overflow: hidden;
  background: #1d1032;
  border: 3px solid #000;
  border-radius: 999px;
  box-shadow: 2px 2px 0 #000;
}
.meter i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--h1), var(--h2));
  transform-origin: left;
  transform: scaleX(var(--p, 0));
  transition: transform .15s;
}
/* Arcade block segments */
.meter::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(90deg, transparent 0 calc(10% - 2px), rgba(0, 0, 0, .55) calc(10% - 2px) 10%);
  pointer-events: none;
}
.meter.is-full i {
  background: linear-gradient(90deg, var(--h1), #fff, var(--h2), var(--h1));
  background-size: 300% 100%;
  animation: arc-fire 1s linear infinite;
}

.powerbtn {
  --cd: 0;
  position: relative;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 2px;
  min-width: 132px;
  min-height: 62px;
  padding: .4rem 1rem;
  font-family: var(--font-display);
  font-size: 1.15rem;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .55);
  background: #2a1a40;
  border: 3px solid #000;
  border-radius: 18px;
  box-shadow: 4px 4px 0 #000;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform .12s var(--ease-out), box-shadow .12s var(--ease-out), background-color .3s, color .3s;
}
.powerbtn:disabled { cursor: default; }
.powerbtn__key {
  font-family: var(--font-body);
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: .14em;
  opacity: .7;
}
/* Cooldown sweep */
.powerbtn::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 15px;
  background: conic-gradient(rgba(0, 0, 0, .55) calc(var(--cd) * 360deg), transparent 0);
  pointer-events: none;
}
.powerbtn.is-ready {
  color: #000;
  background: var(--h1);
  animation: arc-ready .9s ease-in-out infinite;
}
.powerbtn.is-ready:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 #000; }
.powerbtn.is-ready:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 #000; }
@keyframes arc-ready {
  0%, 100% { box-shadow: 4px 4px 0 #000, 0 0 0 0 var(--hglow); }
  50% { box-shadow: 4px 4px 0 #000, 0 0 0 10px transparent, 0 0 28px var(--h1); scale: 1.04; }
}

.cab[data-state="select"] .cab__deck,
.cab[data-state="loading"] .cab__deck { opacity: .55; }

@keyframes arc-shake {
  20% { translate: -5px 0; }
  40% { translate: 5px 0; }
  60% { translate: -3px 0; }
  80% { translate: 3px 0; }
}

/* ---------- Responsive ---------- */

@media (hover: none), (pointer: coarse) {
  .powerbtn__key { display: none; }
}

@media (max-width: 900px) {
  .cab__screen { aspect-ratio: 4 / 3; }
}

@media (max-width: 640px) {
  .arcade .container { width: min(1180px, 100% - 2rem); }
  .cab { padding: 7px; border-radius: 22px; box-shadow: 6px 6px 0 #000, 0 0 50px -12px var(--hglow); }
  .cab__marquee { grid-template-columns: auto minmax(0, 1fr) auto; margin-bottom: 7px; padding: 5px; border-radius: 15px; }
  .cab__title { font-size: clamp(.78rem, 4vw, 1rem); letter-spacing: .03em; white-space: normal; }
  /* explicit height: aspect-ratio + min-height would transfer a min-width */
  .cab__screen { aspect-ratio: auto; height: clamp(420px, (100vw - 3.4rem) * 4 / 3, 640px); border-radius: 15px; }

  .hud { gap: 5px; padding: 7px; }
  .hud__box { padding: 3px 8px 4px; border-radius: 10px; }
  .hud__score { min-width: 0; }
  .hud__box small { font-size: .55rem; }
  .hud__lives { padding: 6px 7px; gap: 2px; }
  .heart { width: 17px; height: 16px; }
  .hud__combo { font-size: .72rem; }
  .hud__boss { width: 92%; font-size: .66rem; }

  .scr--select { justify-content: flex-start; padding-top: 1rem; }
  .picks { gap: .45rem; }
  .pick { padding: .45rem .2rem .55rem; border-radius: 14px; box-shadow: 3px 3px 0 #000; }
  .pick::before { inset: -5px; border-radius: 18px; }
  .pick__art { height: 92px; }
  .pick__name { font-size: clamp(.68rem, 3.6vw, .9rem); }
  .pick__ability { padding: .15rem .4rem; letter-spacing: 0; }
  .pick__ability i { display: none; }

  .scr--end { flex-direction: column; justify-content: flex-start; gap: .4rem; padding-top: .9rem; }
  .end__art { flex: 0 0 auto; width: min(62%, 220px); }
  .end__art img { max-height: 100px; }
  .end__quote { top: -6px; left: -18%; font-size: .66rem; max-width: 8.5rem; }
  .scr--over .end__quote { right: -18%; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats div { padding: .25rem .3rem; }
  .scr__btns { gap: .5rem; }
  .scr__btns .abtn { flex: 1 1 8rem; padding-inline: .7rem; }

  .cab__deck { margin-top: 7px; padding: 8px 9px; gap: .6rem; border-radius: 15px; }
  .deck__label, .deck__stats { font-size: .62rem; letter-spacing: .08em; }
  .powerbtn { min-width: 104px; min-height: 58px; font-size: 1rem; border-radius: 16px; }
}

/* Phones held sideways: a short, wide screen that fits the viewport height */
@media (orientation: landscape) and (max-height: 520px) {
  .cab { width: min(100%, max(440px, (100svh - 150px) * 16 / 9 + 36px)); }
  .cab__screen { aspect-ratio: 16 / 9; height: auto; }
  .cab__marquee { margin-bottom: 6px; padding: 4px; }
  .cab__deck { margin-top: 6px; padding: 6px 10px; }
  .powerbtn { min-height: 48px; }
  .scr__sub, .scr__kicker { display: none; }
  .pick__art { height: clamp(48px, 22cqh, 110px); }
  .scr--end { flex-direction: row; }
  .end__art img { max-height: 40cqh; }
}

@media (max-width: 360px) {
  .pick__role { display: none; }
  .pick__ability { font-size: .56rem; }
  .cab__title span { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .pick__art img,
  .scr--victory .end__art img,
  .scr--over .end__art img { animation: none; }
  .cab__screen.is-warp .cab__canvas { animation: none; }
}
