/* ============================================================
   ConcertDefense — styles
   Torn gig poster on a concrete wall. Mobile-first.
   Themes: [data-theme="dark"] (default) / [data-theme="light"]
   ============================================================ */

/* ---------- tokens ---------- */
:root {
  --blood:      #c8261a;
  --blood-hi:   #ef4a2a;
  --blood-deep: #7d140c;
  --mustard:    #e5a92a;
  --mustard-hi: #ffce5c;
  --acid:       #a8c832;
  --acid-hi:    #d1f05c;

  --hard: 5px 5px 0 #000;
  --hard-sm: 3px 3px 0 #000;
  --r-sm: 2px;
  --r-md: 3px;
  --r-lg: 4px;

  --display: "Bebas Neue", "Oswald", Haettenschweiler, Impact, "Arial Narrow", sans-serif;
  --type:    "Special Elite", "Courier New", ui-monospace, monospace;
  --marker:  "Permanent Marker", "Segoe Print", cursive;
  --body:    "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;

  --noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='220' height='220' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E");
  --scratches: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='340' height='340'%3E%3Cg stroke='rgba(242,232,212,.10)' stroke-width='1' fill='none'%3E%3Cpath d='M0 40 L340 22M12 150 L318 172M40 260 L300 240M0 300 L340 318M90 0 L60 340M230 0 L268 340'/%3E%3C/g%3E%3C/svg%3E");
}

/* dark (default) */
:root,
:root[data-theme="dark"] {
  color-scheme: dark;
  --page:      #12100e;
  --page-2:    #0a0807;
  --text:      #f2e8d4;
  --text-dim:  #cfc2a8;
  --muted:     #97897a;
  --panel:     #1b1715;
  --panel-2:   #241f1c;
  --line:      #3b322c;
  --line-soft: #2a231f;
  --chrome:    #191512;
  --chrome-2:  #0d0b0a;
  --track:     #0d0b0a;
  --card-stock: #f5ecd8;
  --card-edge:  #e3d7bd;
  --ink:       #17120f;
  --ink-dim:   #6b5f4f;
  --tape:      rgba(226, 209, 176, .5);
  --scan-opacity: .22;
}

/* light — daylight venue, poster on sunlit concrete */
:root[data-theme="light"] {
  color-scheme: light;
  --page:      #e9ddc6;
  --page-2:    #dccdb2;
  --text:      #17120f;
  --text-dim:  #3f352b;
  --muted:     #6b5f4f;
  --panel:     #f6eede;
  --panel-2:   #efe4cf;
  --line:      #b9a68b;
  --line-soft: #cdbca2;
  --chrome:    #241d18;
  --chrome-2:  #100d0b;
  --track:     #d3c3a8;
  --card-stock: #fffaf0;
  --card-edge:  #f0e5cf;
  --ink:       #17120f;
  --ink-dim:   #584c3e;
  --tape:      rgba(120, 100, 74, .35);
  --scan-opacity: .10;
}

/* ---------- reset ---------- */
* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior-y: contain;
  /* The scroll-reveal variants start elements translated sideways. On a
     right-edge block that momentarily widens the scroll area. `clip` trims
     it without creating a scroll container, so the sticky header still
     sticks and the hard-offset shadows are untouched. */
  overflow-x: clip;
}

body {
  margin: 0;
  min-height: 100svh;
  color: var(--text);
  font-family: var(--body);
  font-size: clamp(.95rem, .92rem + .12vw, 1.02rem);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  overscroll-behavior-y: contain;
  background-color: var(--page);
  background-image:
    radial-gradient(70rem 34rem at 12% -6%, color-mix(in srgb, var(--blood) 26%, transparent), transparent 62%),
    radial-gradient(60rem 30rem at 88% 4%, color-mix(in srgb, var(--mustard) 14%, transparent), transparent 60%),
    repeating-linear-gradient(115deg, color-mix(in srgb, var(--text) 2%, transparent) 0 3px, transparent 3px 9px),
    var(--noise);
  background-blend-mode: normal, normal, normal, overlay;
  background-size: auto, auto, auto, 13.75rem 13.75rem;
  transition: background-color .3s ease, color .3s ease;
}

body::before {
  content: "";
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background-image: var(--noise), var(--scratches);
  background-size: 13.75rem 13.75rem, 21.25rem 21.25rem;
  opacity: .26;
  mix-blend-mode: overlay;
}

body::after {
  content: "";
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background: radial-gradient(130% 100% at 50% 40%, transparent 46%, rgba(0,0,0,.55) 100%);
  opacity: .9;
}
:root[data-theme="light"] body::after { opacity: .25; }

/* ---------- scrollbar ---------- */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--blood) var(--track);
}
::-webkit-scrollbar { width: .75rem; height: .75rem; }
::-webkit-scrollbar-track {
  background: var(--track);
  border-left: 1px solid var(--line-soft);
}
::-webkit-scrollbar-thumb {
  background:
    repeating-linear-gradient(135deg, var(--blood) 0 .5rem, var(--blood-deep) .5rem 1rem);
  border: 2px solid var(--track);
}
::-webkit-scrollbar-thumb:hover { background: var(--blood-hi); }
::-webkit-scrollbar-corner { background: var(--track); }

/* ---------- type ---------- */
h1, h2, h3, h4 {
  font-family: var(--display);
  font-weight: 400;
  text-transform: uppercase;
  line-height: .94;
  letter-spacing: .02em;
  margin: 0 0 .4em;
}
h1 { font-size: clamp(2.4rem, 1.6rem + 5vw, 5.4rem); }
h2 { font-size: clamp(1.75rem, 1.3rem + 2.4vw, 3rem); }
h3 { font-size: clamp(1.05rem, .98rem + .5vw, 1.25rem); letter-spacing: .1em; color: var(--mustard); }
h4 { font-size: .95rem; letter-spacing: .08em; }

p { margin: 0 0 1em; max-width: 68ch; }
a { color: var(--mustard); text-underline-offset: .18em; }
a:hover { color: var(--mustard-hi); }

.wrap {
  width: min(78rem, 100% - 1.4rem);
  margin-inline: auto;
  position: relative;
  z-index: 2;
}
.muted { color: var(--muted); }
.tiny { font-size: .78rem; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- focus ---------- */
:where(a, button, input, textarea, select, summary, [tabindex]):focus-visible {
  outline: 3px solid var(--mustard);
  outline-offset: 3px;
  border-radius: var(--r-sm);
}
.skip-link {
  position: fixed; top: .5rem; left: .5rem; z-index: 500;
  transform: translateY(-160%);
  background: var(--mustard); color: #17120f;
  padding: .55rem 1rem;
  font-family: var(--display); letter-spacing: .1em; text-transform: uppercase;
  border: 2px solid #000; box-shadow: var(--hard-sm);
  transition: transform .18s ease;
}
.skip-link:focus-visible { transform: translateY(0); }

/* ============================================================
   Header
   ============================================================ */
.site-header {
  position: sticky; top: 0; z-index: 60;
  background: linear-gradient(180deg, #191512, #0d0b0a 72%), var(--noise);
  background-size: auto, 13.75rem 13.75rem;
  border-bottom: 3px solid #000;
  box-shadow: 0 .25rem 0 color-mix(in srgb, var(--blood) 55%, transparent), 0 .75rem 1.9rem rgba(0,0,0,.7);
  color: #f2e8d4;
}
.site-header::before {
  content: "";
  position: absolute; inset: 0 0 auto 0; height: .45rem;
  background: repeating-linear-gradient(135deg, var(--mustard) 0 .875rem, #141110 .875rem 1.75rem);
  opacity: .85;
}

.header-inner {
  display: grid;
  grid-template-columns: 1fr auto auto;
  grid-template-areas:
    "brand tools toggle"
    "nav nav nav";
  align-items: center;
  gap: .5rem .6rem;
  min-height: 3.9rem;
  padding-top: .45rem;
}

.brand {
  grid-area: brand;
  display: inline-flex; align-items: center; gap: .6rem;
  color: #f2e8d4; text-decoration: none;
  background: none; border: 0; cursor: pointer; padding: 0;
  justify-self: start;
}
.brand-mark {
  display: grid; place-items: center;
  width: 2.6rem; height: 2.6rem;
  background: var(--blood);
  border: 2px solid #000;
  box-shadow: var(--hard-sm);
  transform: rotate(-4deg);
  transition: transform .18s cubic-bezier(.2,.9,.3,1.4);
}
.brand:hover .brand-mark { transform: rotate(4deg) scale(1.06); }
.brand-mark img, .brand-mark svg { width: 1.7rem; height: 1.7rem; }
.brand-text { display: flex; flex-direction: column; line-height: .82; }
.brand-text strong {
  font-family: var(--display); font-size: 1.42rem; letter-spacing: .09em;
  text-transform: uppercase;
}
.brand-text em {
  font-style: normal; font-size: .72rem; letter-spacing: .4em;
  color: var(--mustard); font-family: var(--type);
}

.header-tools { grid-area: tools; display: flex; align-items: center; gap: .35rem; justify-self: end; }

.icon-btn {
  width: 2.5rem; height: 2.5rem;
  display: grid; place-items: center;
  background: #1b1715; border: 2px solid #3b322c;
  color: #f2e8d4; font-size: 1rem; cursor: pointer;
  box-shadow: var(--hard-sm);
  transition: transform .12s ease, border-color .12s ease, background .12s ease;
}
.icon-btn:hover { border-color: var(--mustard); transform: translate(-1px,-1px); }
.icon-btn:active { transform: translate(2px,2px); box-shadow: 1px 1px 0 #000; }
.icon-btn svg { width: 1.1rem; height: 1.1rem; }
.icon-btn[aria-pressed="true"] { background: #0d0b0a; }
.icon-btn[data-muted="true"] { opacity: .55; }

/* nav toggle (mobile) */
.nav-toggle {
  grid-area: toggle;
  display: grid; place-items: center;
  width: 2.5rem; height: 2.5rem;
  background: #1b1715; border: 2px solid #3b322c;
  box-shadow: var(--hard-sm); color: #f2e8d4; cursor: pointer;
}
.nav-toggle .bars { display: grid; gap: 3px; }
.nav-toggle .bars span {
  display: block; width: 1.05rem; height: 2px; background: currentColor;
  transition: transform .18s ease, opacity .18s ease;
}
.nav-toggle[aria-expanded="true"] .bars span:nth-child(1) { transform: translateY(5px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .bars span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .bars span:nth-child(3) { transform: translateY(-5px) rotate(-45deg); }

.site-nav {
  grid-area: nav;
  display: none;
  flex-direction: column;
  gap: .1rem;
  padding: .35rem 0 .6rem;
  border-top: 1px dashed rgba(242,232,212,.14);
  margin-top: .35rem;
}
.site-nav[data-open="true"] { display: flex; }

.nav-btn {
  position: relative;
  display: block;
  background: transparent; border: 0;
  color: #cfc2a8;
  font-family: var(--display); font-size: 1.05rem; letter-spacing: .1em;
  text-transform: uppercase; text-decoration: none;
  padding: .55rem .2rem; cursor: pointer;
  transition: color .12s ease, transform .12s ease;
}
.nav-btn::after {
  content: ""; position: absolute; left: 0; bottom: .35rem; height: 3px; width: 0;
  background: var(--blood); transition: width .18s ease;
}
.nav-btn:hover, .nav-btn[aria-current="page"] { color: #f2e8d4; }
.nav-btn:hover::after, .nav-btn[aria-current="page"]::after { width: 1.6rem; }

.nav-btn--cta {
  color: #17120f; background: var(--mustard);
  border: 2px solid #000; box-shadow: var(--hard-sm);
  padding: .45rem 1rem; text-align: center;
  transform: rotate(-1.2deg);
  margin-top: .35rem;
}
.nav-btn--cta::after { display: none; }
.nav-btn--cta:hover {
  background: var(--mustard-hi); color: #17120f;
  transform: rotate(0) translate(-1px,-1px); box-shadow: var(--hard);
}

/* ============================================================
   Hero
   ============================================================ */
.hero {
  position: relative;
  padding: clamp(1.6rem, 1rem + 4vw, 4rem) 0 1.2rem;
}
.hero::before {
  content: "";
  position: absolute; left: -8%; top: 8%; width: 60%; height: 76%;
  background:
    linear-gradient(45deg, transparent 47.6%, color-mix(in srgb, var(--blood) 20%, transparent) 47.6% 52.4%, transparent 52.4%),
    linear-gradient(-45deg, transparent 47.6%, color-mix(in srgb, var(--blood) 20%, transparent) 47.6% 52.4%, transparent 52.4%);
  transform: rotate(-6deg);
  pointer-events: none; z-index: 0;
}
.hero::after {
  content: "";
  position: absolute; inset: 0; pointer-events: none; z-index: 1;
  background-image: var(--noise), var(--scratches);
  background-size: 13.75rem 13.75rem, 21.25rem 21.25rem;
  opacity: .14; mix-blend-mode: overlay;
}

.hero-inner {
  display: grid;
  gap: 1.5rem;
  align-items: center;
  position: relative;
}

.kicker {
  display: inline-block;
  font-family: var(--type); font-size: .72rem; letter-spacing: .28em;
  color: #17120f; background: var(--acid);
  padding: .22rem .6rem;
  transform: rotate(-1.6deg);
  margin: 0 0 .9rem;
  box-shadow: var(--hard-sm);
  max-width: 100%;
}
/* the tape label must never wrap into a two-line block on narrow screens */
@media (max-width: 26rem) {
  .kicker { letter-spacing: .16em; font-size: .66rem; }
}

.hero h1 {
  text-wrap: balance;
  text-shadow: 3px 3px 0 #000, 6px 6px 0 color-mix(in srgb, var(--blood) 35%, transparent);
  margin-bottom: .3em;
}
.hero h1 span {
  display: inline-block;
  color: var(--blood-hi);
  -webkit-text-stroke: 1.5px #000;
  transform: rotate(-1.1deg);
  text-shadow: 4px 4px 0 #000;
}

.lede {
  color: var(--text-dim);
  border-left: 4px solid var(--blood);
  padding-left: 1rem;
  font-size: .98rem;
}

.hero-actions {
  display: flex; flex-wrap: wrap; gap: .7rem;
  margin: 1.2rem 0 1.4rem;
}

/* mode picker — career and daily, side by side */
.mode-picker {
  display: grid;
  gap: .55rem;
  margin: 1.3rem 0 1.4rem;
  align-items: stretch;
}

.mode-block {
  display: flex;
  flex-direction: column;
  padding: .7rem .8rem .75rem;
  background: linear-gradient(180deg, rgba(255,255,255,.035), transparent 70%);
  border: 2px solid var(--line);
  border-left: 5px solid var(--mustard);
  box-shadow: var(--hard-sm);
}
.mode-block--daily {
  border-left-color: var(--acid);
  background: linear-gradient(100deg, rgba(168,200,50,.11), transparent 62%);
}

.mode-label {
  margin: 0 0 .5rem;
  font-family: var(--display);
  font-size: .9rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--mustard-hi);
  display: flex; flex-wrap: wrap; align-items: center; gap: .1rem .45rem;
}
.mode-block--daily .mode-label { color: var(--acid-hi); }
.mode-label span {
  font-family: var(--type); font-size: .6rem;
  letter-spacing: .05em; text-transform: none;
  color: var(--muted); font-weight: 400;
}
.mode-block--daily .mode-label span { color: var(--band-muted, var(--muted)); }

.mode-daily-tour {
  margin: 0 0 .55rem;
  font-family: var(--display);
  font-size: 1.05rem; letter-spacing: .05em; text-transform: uppercase;
  color: var(--text);
  line-height: 1.1;
}

.mode-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: auto; }
.mode-actions .btn { flex: 1 1 auto; }
.mode-actions .btn small {
  font-family: var(--type); font-size: .66rem;
  letter-spacing: .02em; text-transform: none; opacity: .85;
}

.mode-daily-meta {
  display: flex; flex-wrap: wrap; align-items: baseline;
  gap: .1rem .7rem;
  margin: .6rem 0 0;
  font-family: var(--type); font-size: .62rem;
  letter-spacing: .03em; color: var(--muted);
}
.mode-daily-meta b { color: var(--mustard); font-variant-numeric: tabular-nums; }
.daily-streak-inline b { font-family: var(--display); font-size: .82rem; }

@media (min-width: 34rem) {
  .mode-picker { grid-template-columns: 1fr 1fr; gap: .6rem; }
}
@media (min-width: 48rem) {
  .mode-actions .btn { flex: 1 1 auto; }
}

/* mode chip inside the HUD so the active mode is never ambiguous */
.mode-chip {
  display: inline-block;
  font-family: var(--type); font-size: .56rem;
  letter-spacing: .14em; text-transform: uppercase;
  padding: .06rem .34rem;
  border: 1px solid currentColor;
  color: var(--mustard);
  margin-right: .35rem;
  vertical-align: middle;
}
.mode-chip--daily { color: var(--acid-hi); }
.mode-chip--endless { color: var(--blood-hi); }

/* ---------- mode strip: always-on banner inside the shell ---------- */
.mode-strip {
  display: flex; flex-wrap: wrap; align-items: center; gap: .1rem .7rem;
  padding: .3rem .7rem;
  font-family: var(--display);
  font-size: .74rem; letter-spacing: .16em; text-transform: uppercase;
  color: #10120a;
  background: var(--mustard);
  border-bottom: 3px solid #000;
}
.mode-strip[hidden] { display: none; }

.mode-strip[data-mode="daily"] { background: var(--acid); }
.mode-strip[data-mode="endless"] { background: var(--blood); color: #fff3ee; }

.mode-strip-label::before {
  content: "";
  display: inline-block;
  width: .45rem; height: .45rem;
  margin-right: .4rem;
  background: currentColor;
  transform: rotate(45deg);
  vertical-align: middle;
}
.mode-strip-detail {
  font-family: var(--type);
  font-size: .62rem; letter-spacing: .06em; text-transform: none;
  opacity: .78;
}

/* a switch flashes the strip so the change cannot be missed */
.mode-strip--flash { animation: modeFlash .8s ease-out; }
@keyframes modeFlash {
  0%   { filter: brightness(2.1); }
  40%  { filter: brightness(1); }
  70%  { filter: brightness(1.55); }
  100% { filter: brightness(1); }
}

/* whole shell picks up the mode accent */
.game-shell[data-mode="career"] { --mode-accent: var(--mustard); }
.game-shell[data-mode="daily"]  { --mode-accent: var(--acid); }
.game-shell[data-mode="endless"]{ --mode-accent: var(--blood-hi); }

.game-shell .hud { border-bottom-color: #000; }
.game-shell[data-mode="daily"] .hud { box-shadow: inset 0 -2px 0 var(--acid), inset 0 -1px 0 #3b322c; }
.game-shell[data-mode="endless"] .hud { box-shadow: inset 0 -2px 0 var(--blood-hi), inset 0 -1px 0 #3b322c; }

.game-shell[data-mode="daily"] .tier-chip {
  background: var(--acid); color: #10120a;
}
.game-shell[data-mode="endless"] .tier-chip {
  background: var(--blood); color: #fff3ee;
}

.game-shell[data-mode="daily"] .canvas-wrap { box-shadow: inset 0 0 0 2px rgba(168,200,50,.35); }
.game-shell[data-mode="endless"] .canvas-wrap { box-shadow: inset 0 0 0 2px rgba(239,74,42,.4); }

.game-shell[data-mode="daily"] .dock { border-top-color: var(--acid); }
.game-shell[data-mode="endless"] .dock { border-top-color: var(--blood); }

@media (prefers-reduced-motion: reduce) {
  .mode-strip--flash { animation: none; }
}

.hero-stats {
  display: flex; flex-wrap: wrap; gap: .6rem 1.4rem;
  list-style: none; padding: 0; margin: 0;
  color: var(--muted);
  font-family: var(--type); font-size: .68rem; letter-spacing: .16em;
  text-transform: uppercase;
}
.hero-stats li { padding-left: .9rem; border-left: 2px solid var(--line); }
.hero-stats li:first-child { padding-left: 0; border-left: 0; }
.hero-stats b {
  display: block; font-family: var(--display); font-size: 1.7rem;
  color: var(--text); letter-spacing: 0; line-height: 1.1;
}

.hero-art { display: none; }
.hero-art svg, .hero-art img {
  width: 100%; height: auto; max-width: 27rem;
  filter: drop-shadow(.5rem .6rem 0 rgba(0,0,0,.5));
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  border: 2px solid #000; border-radius: var(--r-sm);
  padding: .7rem 1.25rem;
  font-family: var(--display); font-size: 1.02rem; letter-spacing: .1em;
  text-transform: uppercase; text-decoration: none;
  cursor: pointer;
  box-shadow: var(--hard);
  transition: transform .1s ease, box-shadow .1s ease, background .14s ease, color .14s ease;
  will-change: transform;
}
.btn svg { width: 1.05em; height: 1.05em; }
.btn--primary { background: var(--blood); color: #f2e8d4; transform: rotate(-.7deg); }
.btn--primary:hover {
  background: var(--blood-hi);
  transform: rotate(0) translate(-2px,-2px);
  box-shadow: 7px 7px 0 #000;
}
.btn--ghost { background: var(--panel); color: var(--text); border-color: var(--line); }
.btn--ghost:hover {
  background: var(--panel-2); border-color: var(--mustard); color: var(--text);
  transform: translate(-2px,-2px); box-shadow: 7px 7px 0 #000;
}
.btn:active { transform: translate(4px,4px) !important; box-shadow: 1px 1px 0 #000 !important; }
.btn:disabled, .btn[aria-disabled="true"] {
  opacity: .45; cursor: not-allowed;
  transform: none !important; box-shadow: var(--hard-sm) !important;
}
.btn small { font-size: .76rem; letter-spacing: .06em; opacity: .85; }

.link-btn {
  background: none; border: 0; padding: .3rem 0;
  color: var(--muted); cursor: pointer;
  font-family: var(--type); font-size: .82rem; letter-spacing: .06em;
  text-align: left; text-decoration: none;
}
.link-btn:hover { color: var(--mustard); text-decoration: underline; }

/* ============================================================
   Game shell
   ============================================================ */
.arena { padding: .75rem 0 2rem; }

.game-shell {
  position: relative;
  border: 3px solid #000;
  background: #080605;
  box-shadow: var(--hard), 0 1.6rem 3.75rem rgba(0,0,0,.75);
  overflow: hidden;
  --dock-h: 6.5rem;
  isolation: isolate;
  /* keeps the mode strip clear of the sticky header */
  scroll-margin-top: 5.5rem;
  /* dragging to aim must never select text or flash tap highlights */
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.game-shell :is(input, textarea) { -webkit-user-select: text; user-select: text; }
.game-shell:fullscreen,
.game-shell.is-theater {
  border-width: 0;
  box-shadow: none;
  display: flex; flex-direction: column; justify-content: center;
  background: #080605;
}

/* ---------- HUD ---------- */
.hud {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: "center center" "left right";
  gap: .35rem .6rem;
  align-items: center;
  padding: .45rem .6rem;
  color: #f2e8d4;
  background: linear-gradient(180deg, #211b17, #141110), var(--noise);
  background-size: auto, 13.75rem 13.75rem;
  border-bottom: 3px solid #000;
  box-shadow: inset 0 -1px 0 #3b322c;
}
.hud-left { grid-area: left; display: flex; align-items: center; gap: .7rem; min-width: 0; }
.hud-center { grid-area: center; display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.hud-right { grid-area: right; display: flex; align-items: center; gap: .6rem; justify-self: end; }

.meter { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: .4rem; min-width: 0; }
.meter-label { font-family: var(--display); font-size: .72rem; letter-spacing: .18em; color: #97897a; }
.meter-track {
  position: relative;
  height: .7rem; min-width: 3.25rem;
  background: #0a0807; border: 2px solid #000;
  box-shadow: inset 0 0 0 1px #3b322c;
  overflow: hidden;
}
.meter-track::after {
  content: ""; position: absolute; inset: 0;
  background: repeating-linear-gradient(90deg, transparent 0 .55rem, rgba(0,0,0,.5) .55rem .7rem);
  pointer-events: none;
}
.meter-fill { height: 100%; width: 100%; background: var(--acid); transition: width .22s ease, background .3s ease; }
.meter-fill.warn { background: var(--mustard); }
.meter-fill.crit { background: var(--blood); animation: crit .7s steps(2) infinite; }
@keyframes crit { 50% { opacity: .55; } }
.meter-val { display: none; font-family: var(--display); font-size: 1rem; }

.stat-row { display: flex; gap: .8rem; }
.stat { display: flex; flex-direction: column; line-height: 1.05; }
.stat span { font-family: var(--display); font-size: .6rem; letter-spacing: .2em; color: #97897a; }
.stat b {
  font-family: var(--display); font-size: 1.15rem;
  font-variant-numeric: tabular-nums; letter-spacing: .02em;
}
.stat b.is-bumping { animation: bump .28s cubic-bezier(.2,.9,.3,1.6); }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.18); color: var(--mustard-hi); } 100% { transform: scale(1); } }

/* ---------- emergency repair button ---------- */
.repair-btn {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .22rem .45rem;
  background: #14100f;
  border: 2px solid #3b322c;
  color: #cfc2a8;
  cursor: pointer;
  box-shadow: 2px 2px 0 #000;
  font-family: var(--display);
  font-size: .74rem; letter-spacing: .1em; text-transform: uppercase;
  transition: transform .1s ease, background .12s ease, border-color .12s ease, color .12s ease;
}
.repair-btn .repair-icon { font-size: .8rem; line-height: 1; }
.repair-btn .repair-label { display: none; }
.repair-btn .repair-cost { font-family: var(--type); font-size: .66rem; color: var(--mustard); }
.repair-btn.ready {
  border-color: var(--acid);
  color: var(--acid-hi);
  background: rgba(168, 200, 50, .14);
}
.repair-btn.ready .repair-cost { color: var(--acid-hi); }
.repair-btn.ready:hover { transform: translate(-1px, -1px); background: rgba(168, 200, 50, .26); }
.repair-btn:active { transform: translate(2px, 2px); box-shadow: none; }
.repair-btn:disabled { opacity: .4; cursor: not-allowed; box-shadow: none; }

@media (min-width: 34rem) {
  .repair-btn .repair-label { display: inline; }
}

/* stage heal flash */
.meter-fill.is-healing { box-shadow: 0 0 0 2px #8fe86b, 0 0 14px 2px rgba(143,232,107,.8); transition: box-shadow .18s ease; }

.tier-chip {
  display: inline-block;
  font-family: var(--display); font-size: .78rem; letter-spacing: .18em;
  padding: .1rem .5rem;
  color: #17120f; background: var(--mustard);
  border: 2px solid #000;
  transform: rotate(-1.4deg);
  white-space: nowrap;
}
.wave-chip { font-family: var(--type); font-size: .7rem; color: #cfc2a8; letter-spacing: .1em; white-space: nowrap; }

.combo-wrap {
  display: flex; flex-direction: column; align-items: flex-end; line-height: .95;
  opacity: .35; transition: opacity .2s ease, transform .2s ease;
}
.combo-wrap.active { opacity: 1; transform: rotate(-3deg) scale(1.06); }
.combo-wrap span { font-family: var(--type); font-size: .55rem; letter-spacing: .18em; color: #97897a; display: none; }
.combo-wrap b { font-family: var(--display); font-size: 1.5rem; color: var(--mustard); }

.ult-ring {
  position: relative; width: 2.6rem; height: 2.6rem;
  display: grid; place-items: center;
  border: 2px solid #000; box-shadow: var(--hard-sm);
  background: conic-gradient(var(--blood) 0deg, #1a1613 0deg);
}
.ult-ring::after { content: ""; position: absolute; inset: 3px; background: #0e0b0a; }
.ult-ring span { position: relative; z-index: 1; font-family: var(--display); font-size: .74rem; }
.ult-ring.full { animation: ultReady .8s steps(2) infinite; }
@keyframes ultReady { 50% { box-shadow: var(--hard-sm), 0 0 1.4rem color-mix(in srgb, var(--mustard) 80%, transparent); } }

/* the ultimate ring doubles as a tap button */
button.ult {
  display: block; padding: 0; border: 0; background: none; color: inherit;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}
button.ult.ready .ult-ring {
  box-shadow: var(--hard-sm), 0 0 1rem color-mix(in srgb, var(--mustard) 70%, transparent);
}
button.ult:active .ult-ring { transform: scale(.94); }

.hud-icon-btn {
  display: grid; place-items: center;
  width: 2rem; height: 2rem;
  padding: 0;
  background: #14100f; color: #cfc2a8;
  border: 2px solid #3b322c;
  font-size: .68rem; letter-spacing: .04em; line-height: 1;
  box-shadow: 2px 2px 0 #000;
  cursor: pointer;
  transition: transform .1s ease, color .12s ease, border-color .12s ease;
}
.hud-icon-btn:hover { color: var(--mustard-hi); border-color: var(--mustard); }
.hud-icon-btn:active { transform: translate(2px, 2px); box-shadow: none; }
.hud-icon-btn svg { width: .85rem; height: .85rem; }

/* Duplicated from the top bar so phones can run a single bar. Desktop keeps
   the dedicated play bar and hides these. */
.hud-only { display: none; }

/* ---------- canvas ---------- */
.canvas-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #060504;
  overflow: hidden;
}
#stage-canvas {
  display: block; width: 100%; height: 100%;
  cursor: crosshair; touch-action: none;
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}
#stage-canvas:focus-visible { box-shadow: inset 0 0 0 3px var(--mustard); }
.scan {
  position: absolute; inset: 0; pointer-events: none; z-index: 2;
  background-image: var(--noise), var(--scratches);
  background-size: 13.75rem 13.75rem, 21.25rem 21.25rem;
  opacity: var(--scan-opacity); mix-blend-mode: overlay;
}
.canvas-wrap::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 2;
  box-shadow: inset 0 0 2.9rem rgba(0,0,0,.55), inset 0 0 .75rem rgba(0,0,0,.45);
}

.toast {
  position: absolute; left: 50%; bottom: .9rem;
  transform: translate(-50%, .6rem) rotate(-1deg);
  background: #f2e8d4; color: #17120f;
  border: 2px solid #000; padding: .38rem .9rem;
  font-family: var(--display); letter-spacing: .12em; font-size: .92rem;
  box-shadow: var(--hard-sm);
  opacity: 0; pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  white-space: nowrap; z-index: 6;
  max-width: 92%; overflow: hidden; text-overflow: ellipsis;
}
.toast.show { opacity: 1; transform: translate(-50%, 0) rotate(-1deg); }

/* attract prompt */
.attract {
  position: absolute; inset: auto 0 0 0; z-index: 5;
  display: grid; gap: .1rem; justify-items: center;
  padding: .8rem 1rem 1rem;
  background: linear-gradient(0deg, rgba(6,5,4,.92), rgba(6,5,4,0));
  pointer-events: none;
}
.attract strong {
  font-family: var(--display); font-size: clamp(1rem, .76rem + 1.6vw, 1.7rem);
  letter-spacing: .12em; color: #f2e8d4;
  text-shadow: 2px 2px 0 #000;
  text-align: center; text-wrap: balance; max-width: 100%;
  animation: pulsePrompt 2.4s ease-in-out infinite;
}
.attract span {
  font-family: var(--type); font-size: .66rem; letter-spacing: .12em; color: #cfc2a8;
  text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%;
}
@keyframes pulsePrompt { 50% { opacity: .55; } }
.attract[hidden] { display: none; }

/* dock */
.dock {
  display: flex; flex-direction: column; gap: .4rem;
  padding: .5rem .6rem .6rem;
  background:
    repeating-linear-gradient(45deg, rgba(255,255,255,.014) 0 2px, transparent 2px 5px),
    linear-gradient(0deg, #191512, #0e0b0a), var(--noise);
  background-size: auto, auto, 13.75rem 13.75rem;
  border-top: 3px solid #000;
  box-shadow: inset 0 1px 0 #3b322c;
  color: #f2e8d4;
}
.dock-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; flex-wrap: wrap; }
.dock-head span { font-family: var(--display); font-size: .8rem; letter-spacing: .18em; color: var(--mustard); }
.dock-head small { font-family: var(--type); color: #97897a; font-size: .62rem; letter-spacing: .02em; text-align: right; }
.dock-tools { display: flex; align-items: center; gap: .35rem; margin-left: auto; }
button.dock-weapon {
  color: #cfc2a8; white-space: nowrap;
  background: transparent; border: 1px solid #3b322c;
  padding: .18rem .4rem;
  font-family: var(--type); font-size: .62rem; letter-spacing: .02em;
  cursor: pointer;
  transition: color .12s ease, border-color .12s ease, background .12s ease;
}
button.dock-weapon:hover { color: var(--mustard-hi); border-color: var(--mustard); background: rgba(229,169,42,.1); }
.dock-weapon b { color: var(--mustard-hi); font-weight: 400; }
.dock-weapon kbd { margin-left: .25rem; padding: 0 .25rem; font-size: .6rem; }

.sell-toggle {
  padding: .18rem .5rem;
  background: #14100f;
  border: 1px solid #3b322c;
  color: #cfc2a8;
  font-family: var(--display); font-size: .72rem; letter-spacing: .12em; text-transform: uppercase;
  cursor: pointer;
  transition: color .12s ease, border-color .12s ease, background .12s ease, transform .1s ease;
}
.sell-toggle:hover { color: var(--mustard-hi); border-color: var(--mustard); }
.sell-toggle.is-active { color: #17120f; background: var(--mustard); border-color: #000; transform: rotate(-1.5deg); }
.sell-toggle:disabled { opacity: .35; cursor: not-allowed; }

/* touch devices: generous targets, no hover-only affordances */
@media (pointer: coarse) {
  .repair-btn { min-height: 2.5rem; padding: .35rem .55rem; }
  .hud-icon-btn { width: 2.5rem; height: 2.5rem; font-size: .78rem; }
  .ult-ring { width: 3rem; height: 3rem; }
  .sell-toggle { min-height: 2.25rem; padding: .3rem .7rem; }
  button.dock-weapon { min-height: 2.25rem; padding: .3rem .5rem; }
  .gear-btn { min-height: 3.1rem; }
  .dock-items { -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
  .dock-items::-webkit-scrollbar { height: 5px; }
  .btn { min-height: 2.9rem; }
}

/* sell mode tints the playfield so the state is obvious */
.game-shell.sell-mode .canvas-wrap::after {
  box-shadow: inset 0 0 0 3px var(--blood), inset 0 0 2.9rem rgba(0,0,0,.55);
}
.game-shell.sell-mode .dock { border-top-color: var(--blood); }

/* shop info + armoury states */
.shop-item--info { border-left-color: var(--mustard); }
.shop-item--info .lvl { color: var(--blood-deep); }
.shop-item--weapon { border-left-color: var(--acid); }
.shop-item--weapon.is-equipped { background: #e8f0d6; }
.shop-item--weapon.is-equipped .lvl { color: #2e5a1f; }
.dock-items {
  display: flex; gap: .5rem;
  overflow-x: auto; padding-bottom: .3rem;
  scroll-snap-type: x proximity;
}

.gear-btn {
  position: relative; flex: 0 0 auto;
  display: grid; grid-template-columns: 2rem 1fr; grid-template-rows: auto auto;
  gap: 0 .45rem; align-items: center;
  min-width: 8.6rem; scroll-snap-align: start;
  padding: .38rem .55rem .38rem .42rem;
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,.02) 0 1px, transparent 1px 4px),
    linear-gradient(180deg, #2a2320, #17130f);
  border: 2px solid #3b322c; border-radius: var(--r-sm);
  color: #f2e8d4; cursor: pointer; text-align: left;
  box-shadow: var(--hard-sm);
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.gear-btn:hover { border-color: var(--mustard); transform: translate(-1px,-1px); box-shadow: 4px 4px 0 #000; }
.gear-btn.selected {
  border-color: var(--mustard);
  background: linear-gradient(180deg, #3a2f1c, #1d1712);
  box-shadow: 4px 4px 0 #000, inset 0 0 0 1px var(--mustard);
}
.gear-btn.selected::after {
  content: ""; position: absolute; top: -.45rem; right: -.45rem;
  width: 1rem; height: 1rem;
  background: var(--acid); border: 2px solid #000; transform: rotate(45deg);
}
.gear-btn.poor { opacity: .42; }
.gear-btn.poor:hover { transform: none; box-shadow: var(--hard-sm); border-color: #3b322c; }

.gear-icon {
  grid-row: 1 / span 2;
  width: 2rem; height: 2rem;
  display: grid; place-items: center;
  font-size: 1rem;
  background: #0d0a09; border: 2px solid #000;
  box-shadow: inset 0 0 0 1px #3b322c;
}
.gear-name {
  font-family: var(--display); font-size: .88rem; letter-spacing: .05em;
  text-transform: uppercase;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.gear-cost { font-family: var(--type); font-size: .68rem; color: var(--mustard); }
/* escaped on purpose: a stylesheet fetched without a charset guess on file://
   can be decoded as cp1252, which turns a literal bolt into mojibake */
.gear-cost::before { content: "\26A1 "; }
.gear-key {
  position: absolute; top: 1px; right: .3rem;
  font-family: var(--display); font-size: .68rem; color: #97897a;
}

/* ============================================================
   Overlays & cards
   ============================================================ */
.overlay {
  position: absolute; inset: 0; z-index: 20;
  display: none; place-items: center;
  padding: .75rem;
  background:
    radial-gradient(circle at 50% 40%, rgba(10,8,7,.72), rgba(4,3,2,.93)),
    var(--noise);
  background-size: auto, 13.75rem 13.75rem;
  backdrop-filter: blur(3px);
  overflow: auto;
}
.overlay[data-open="true"] { display: grid; }

/* Narrow screens: the shell is only 16:9 tall, so let overlays escape it
   and scroll the full viewport instead of clipping their content. */
@media (max-width: 47.99rem) {
  .overlay {
    position: fixed; inset: 0; z-index: 90;
    align-items: start;
    padding: max(.6rem, env(safe-area-inset-top)) .6rem max(1.4rem, env(safe-area-inset-bottom));
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }
  .overlay .card { margin-block: auto; max-height: none; overflow: visible; }

  /* The shell is an isolated stacking context, so a fixed overlay inside it
     still lost to later siblings. Lift the whole shell while one is open. */
  .game-shell.is-overlay-open { z-index: 95; }

  /* Nobody needs the page-level hype/share strip while a card is covering it. */
  html.has-game-overlay .engagement,
  html.has-game-overlay .share-row { visibility: hidden; }
}

/* short landscape (phones on their side, small laptop windows): the 16:9
   shell is shorter than the game-over card, so give overlays the viewport */
@media (max-height: 32rem) and (orientation: landscape) and (max-width: 60rem) {
  .overlay {
    position: fixed; inset: 0; z-index: 90;
    align-items: start;
    padding: max(.5rem, env(safe-area-inset-top)) .6rem max(1.2rem, env(safe-area-inset-bottom));
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }
  .overlay .card { margin-block: auto; max-height: none; overflow: visible; }
  .game-shell.is-overlay-open { z-index: 95; }
  html.has-game-overlay .engagement,
  html.has-game-overlay .share-row { visibility: hidden; }
}

.card {
  position: relative;
  width: min(48rem, 100%);
  max-height: 100%;
  overflow: auto;
  padding: clamp(1rem, 3.2vw, 2rem);
  text-align: center;
  color: var(--ink);
  background:
    repeating-linear-gradient(180deg, rgba(0,0,0,.022) 0 2px, transparent 2px 5px),
    linear-gradient(160deg, var(--card-stock), var(--card-edge));
  border: 3px solid #000;
  box-shadow: var(--hard), 0 1.5rem 3.75rem rgba(0,0,0,.8);
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 10px),
    94% 100%, 88% calc(100% - 9px), 82% 100%, 75% calc(100% - 10px),
    68% 100%, 61% calc(100% - 9px), 54% 100%, 46% calc(100% - 10px),
    39% 100%, 31% calc(100% - 9px), 24% 100%, 17% calc(100% - 10px),
    10% 100%, 5% calc(100% - 9px), 0 100%);
}
.card::before, .card::after {
  content: ""; position: absolute; top: -.65rem;
  width: 4.5rem; height: 1.4rem;
  background: var(--tape);
  border-left: 1px dashed rgba(0,0,0,.2);
  border-right: 1px dashed rgba(0,0,0,.2);
  box-shadow: 0 2px 5px rgba(0,0,0,.25);
}
.card::before { left: .85rem; transform: rotate(-5deg); }
.card::after { right: .85rem; transform: rotate(4deg); }
.card--narrow { width: min(28rem, 100%); }
.card h2 { color: var(--ink); text-shadow: 2px 2px 0 color-mix(in srgb, var(--blood) 22%, transparent); }
.card .kicker { margin-bottom: .6rem; }
.card-sub { color: var(--ink-dim); margin-top: -.15rem; font-size: .92rem; }
.card .muted { color: var(--ink-dim); }
.card-actions { display: flex; flex-wrap: wrap; gap: .6rem; justify-content: center; margin-top: 1.1rem; }
.card-actions--stack { flex-direction: column; align-items: stretch; }
.card .btn--ghost { background: #221b17; color: #f2e8d4; }
.card .btn--ghost:hover { background: #2e251f; }

/* tier picker */
.tier-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(7.5rem, 1fr));
  gap: .55rem; margin: 1rem 0 .4rem;
}
.tier-btn {
  position: relative;
  display: flex; flex-direction: column; gap: .15rem; align-items: center;
  padding: .65rem .5rem;
  background: #17120f; border: 2px solid #000; color: #f2e8d4;
  cursor: pointer; box-shadow: var(--hard-sm);
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.tier-btn::before {
  content: ""; position: absolute; left: 0; right: 0; top: 5px;
  border-top: 1px dashed rgba(242,232,212,.28);
}
.tier-btn:hover { transform: translate(-2px,-2px) rotate(-.8deg); box-shadow: var(--hard); border-color: var(--mustard); }
.tier-btn b { font-family: var(--display); font-size: 1rem; letter-spacing: .05em; text-transform: uppercase; }
.tier-btn small { font-family: var(--type); color: #97897a; font-size: .62rem; }
.tier-btn.locked { opacity: .4; cursor: not-allowed; }
.tier-btn.locked:hover { transform: none; box-shadow: var(--hard-sm); border-color: #000; }
.tier-num { font-family: var(--type); font-size: .56rem; letter-spacing: .24em; color: var(--blood-hi); }

/* reward ribbon */
.reward {
  display: flex; align-items: center; justify-content: center; gap: .6rem;
  margin: .2rem 0 .8rem;
  padding: .5rem .8rem;
  background: #17120f; color: #f2e8d4;
  border: 2px solid #000; box-shadow: var(--hard-sm);
  transform: rotate(-.6deg);
  font-family: var(--type); font-size: .76rem; letter-spacing: .06em;
}
.reward b { font-family: var(--display); font-size: .95rem; letter-spacing: .1em; color: var(--mustard); }
.reward[hidden] { display: none; }

/* shop */
.shop-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
  gap: .55rem; margin: 1rem 0;
}
.shop-item {
  display: flex; flex-direction: column; gap: .3rem;
  padding: .62rem; text-align: left;
  background: #f0e6d1; border: 2px solid #000; border-left: 5px solid var(--blood);
}
.shop-item h4 { margin: 0; font-size: .95rem; color: #17120f; }
.shop-item p { margin: 0; font-size: .7rem; color: var(--ink-dim); line-height: 1.35; }
.shop-item .lvl { font-family: var(--type); font-size: .62rem; letter-spacing: .08em; color: #2e5a1f; }
.shop-item .row { display: flex; gap: .35rem; margin-top: auto; padding-top: .2rem; }
.shop-item button {
  flex: 1; cursor: pointer;
  padding: .34rem .3rem;
  font-family: var(--display); font-size: .78rem; letter-spacing: .05em;
  color: #f2e8d4; background: #221b17;
  border: 2px solid #000; box-shadow: 2px 2px 0 #000;
  transition: transform .1s ease, background .12s ease;
}
.shop-item button:hover:not(:disabled) { background: var(--blood); transform: translate(-1px,-1px); box-shadow: var(--hard-sm); }
.shop-item button:disabled { opacity: .35; cursor: not-allowed; box-shadow: none; }

/* score cells */
.score-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(6.5rem, 1fr));
  gap: .45rem; margin: 1rem 0 .3rem;
}
.score-cell {
  padding: .5rem .55rem; text-align: left;
  background: #f0e6d1; border: 2px solid #000;
  box-shadow: 2px 2px 0 rgba(0,0,0,.5);
}
.score-cell span {
  display: block; font-family: var(--type);
  font-size: .56rem; letter-spacing: .16em; color: var(--ink-dim);
}
.score-cell b {
  font-family: var(--display); font-size: 1.35rem; color: #17120f;
  font-variant-numeric: tabular-nums;
}
.score-cell b.is-bumping { animation: bump .34s cubic-bezier(.2,.9,.3,1.6); }
.score-cell.best { border-left: 5px solid var(--blood); }
.score-cell.best b { color: var(--blood-deep); }

.initials-row {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .6rem;
  margin-top: .8rem; color: var(--ink-dim);
  font-family: var(--type); font-size: .76rem;
}
#initialsInput {
  width: 6rem; text-align: center; text-transform: uppercase;
  background: #17120f; color: var(--mustard);
  border: 2px solid #000;
  font-family: var(--display); font-size: 1.15rem; letter-spacing: .3em;
  padding: .3rem .1rem .3rem .35rem;
}
#initialsInput[aria-invalid="true"] { border-color: var(--blood); }

/* next-run teaser */
.teaser {
  margin: .9rem 0 .2rem;
  padding: .55rem .75rem;
  background: color-mix(in srgb, var(--blood) 12%, transparent);
  border: 2px dashed #000;
  font-family: var(--type); font-size: .74rem; color: #443a2f;
}
.teaser b { font-family: var(--display); letter-spacing: .06em; color: var(--blood-deep); }

/* ============================================================
   Engagement widgets + social
   ============================================================ */
.engagement {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  gap: .5rem;
  margin: 1rem 0 0;
}
.hype-btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .42rem .7rem;
  background: var(--panel); color: var(--text);
  border: 2px solid var(--line); box-shadow: var(--hard-sm);
  cursor: pointer;
  font-family: var(--display); font-size: .82rem; letter-spacing: .08em;
  text-transform: uppercase;
  transition: transform .12s ease, border-color .12s ease, background .12s ease;
}
.hype-btn:hover { border-color: var(--mustard); transform: translate(-1px,-1px); }
.hype-btn[aria-pressed="true"] {
  background: color-mix(in srgb, var(--blood) 22%, var(--panel));
  border-color: var(--blood);
}
.hype-btn .count { font-family: var(--type); font-size: .7rem; color: var(--muted); }
.hype-btn.pop { animation: bump .32s cubic-bezier(.2,.9,.3,1.6); }

.share-row {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  gap: .45rem; margin: .8rem 0 0;
}
.share-btn {
  display: inline-grid; place-items: center;
  width: 2.6rem; height: 2.6rem;
  background: var(--panel); color: var(--text);
  border: 2px solid var(--line); box-shadow: var(--hard-sm);
  cursor: pointer; text-decoration: none;
  transition: transform .12s ease, border-color .12s ease, color .12s ease;
}
.share-btn svg { width: 1.05rem; height: 1.05rem; fill: currentColor; }
.share-btn:hover { border-color: var(--mustard); color: var(--mustard); transform: translate(-1px,-1px); }
.share-btn--x:hover { color: #f2e8d4; border-color: #f2e8d4; }

/* ============================================================
   Content sections
   ============================================================ */
.section { padding: clamp(1.6rem, 1rem + 3vw, 3rem) 0; }
.section-head { display: grid; gap: .4rem; margin-bottom: 1.1rem; }
.section-head p { color: var(--text-dim); margin: 0; }

.features { position: relative; }
.features::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 1;
  background-image: var(--noise); background-size: 13.75rem 13.75rem;
  opacity: .12; mix-blend-mode: overlay;
}
.feature-grid { display: grid; gap: .8rem; }
.feature-grid article {
  position: relative;
  padding: 1rem .95rem;
  background:
    repeating-linear-gradient(180deg, color-mix(in srgb, var(--text) 2%, transparent) 0 2px, transparent 2px 5px),
    linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 2px solid var(--line);
  border-top: 4px solid var(--blood);
  box-shadow: var(--hard-sm);
  transition: transform .14s ease, border-color .14s ease, box-shadow .14s ease;
}
.feature-grid article:hover {
  transform: translate(-2px,-2px) rotate(-.4deg);
  box-shadow: var(--hard); border-color: var(--mustard);
}
.feature-grid article::after {
  content: attr(data-key);
  position: absolute; top: .4rem; right: .6rem;
  font-family: var(--display); font-size: 2.2rem; line-height: 1;
  color: color-mix(in srgb, var(--text) 8%, transparent);
}
.feature-grid h3 { margin-bottom: .25rem; }
.feature-grid p { margin: 0; color: var(--text-dim); font-size: .86rem; }
.feature-icon {
  display: grid; place-items: center;
  width: 2.4rem; height: 2.4rem; margin-bottom: .55rem;
  background: var(--blood); border: 2px solid #000;
  box-shadow: var(--hard-sm); transform: rotate(-3deg);
}
.feature-icon svg { width: 1.3rem; height: 1.3rem; }

/* interlinks */
.link-grid { display: grid; gap: .55rem; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); }
.link-card {
  display: block; padding: .8rem .9rem;
  background: var(--panel); border: 2px solid var(--line);
  color: var(--text); text-decoration: none;
  box-shadow: var(--hard-sm);
  transition: transform .12s ease, border-color .12s ease;
}
.link-card:hover { transform: translate(-2px,-2px); border-color: var(--mustard); color: var(--text); box-shadow: var(--hard); }
.link-card b {
  display: block; font-family: var(--display); font-size: 1rem;
  letter-spacing: .06em; text-transform: uppercase;
}
.link-card span { font-size: .78rem; color: var(--muted); }

/* prose pages */
.page-hero { padding: clamp(1.6rem, 1rem + 3vw, 3.2rem) 0 1rem; }
.page-hero .kicker { margin-bottom: .7rem; }
.page-hero p { color: var(--text-dim); }
.prose { max-width: 62ch; }
.prose h2 { margin-top: 1.8rem; }
.prose h3 { margin-top: 1.4rem; }
.prose ul, .prose ol { padding-left: 1.2rem; color: var(--text-dim); }
.prose li { margin-bottom: .4rem; }
.prose table { width: 100%; border-collapse: collapse; font-size: .9rem; margin: .8rem 0 1.2rem; }
.prose th, .prose td {
  text-align: left; padding: .45rem .5rem;
  border-bottom: 1px dashed var(--line);
}
.prose th { font-family: var(--display); letter-spacing: .1em; text-transform: uppercase; color: var(--mustard); font-weight: 400; }
kbd {
  display: inline-block;
  font-family: var(--type); font-size: .74rem;
  background: var(--panel); color: var(--text);
  border: 2px solid #000; box-shadow: 2px 2px 0 #000;
  padding: .05rem .36rem; margin-right: .12rem;
}
:root[data-theme="light"] kbd { background: #241d18; color: #f2e8d4; }

/* accordions */
details.faq {
  border: 2px solid var(--line);
  background: var(--panel);
  padding: .7rem .85rem;
  margin-bottom: .5rem;
}
details.faq summary {
  cursor: pointer; list-style: none;
  font-family: var(--display); font-size: 1rem; letter-spacing: .05em; text-transform: uppercase;
  display: flex; justify-content: space-between; gap: .6rem; align-items: center;
}
details.faq summary::-webkit-details-marker { display: none; }
details.faq summary::after {
  content: "+"; font-family: var(--display); font-size: 1.3rem; color: var(--mustard);
  transition: transform .18s ease;
}
details.faq[open] summary::after { transform: rotate(45deg); }
details.faq p { margin: .6rem 0 0; font-size: .88rem; color: var(--text-dim); }

/* media assets */
.asset-grid { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); }
.asset-card { background: var(--panel); border: 2px solid var(--line); box-shadow: var(--hard-sm); display: flex; flex-direction: column; }
/* the square icon would otherwise tower over the 1200x630 poster */
.asset-card img {
  display: block; width: 100%; height: auto;
  max-height: 17rem; object-fit: contain;
  background: #0b0908;
}
.asset-card figcaption { padding: .6rem .7rem; font-size: .78rem; color: var(--muted); margin-top: auto; }
.asset-card figcaption b { display: block; font-family: var(--display); font-size: .92rem; letter-spacing: .06em; color: var(--text); }
.asset-card figcaption a { display: inline-block; margin-right: .55rem; }

/* ============================================================
   Footer
   ============================================================ */
.site-footer {
  position: relative;
  padding: 2rem 0 1.4rem;
  color: #f2e8d4;
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,.014) 0 2px, transparent 2px 6px),
    linear-gradient(180deg, #14110f, #090706);
  border-top: 3px solid #000;
  box-shadow: inset 0 3px 0 color-mix(in srgb, var(--blood) 50%, transparent);
}
.footer-inner { display: grid; gap: 1.4rem; }
.footer-brand strong {
  font-family: var(--display); font-size: 1.2rem;
  letter-spacing: .12em; text-transform: uppercase;
}
.footer-brand p { margin: .35rem 0 0; font-size: .82rem; color: #97897a; max-width: 42ch; }
.footer-col h4 {
  font-size: .74rem; letter-spacing: .2em; color: var(--mustard);
  margin-bottom: .5rem;
}
.footer-col ul { list-style: none; padding: 0; margin: 0; display: grid; gap: .15rem; }
.footer-col a, .footer-col button {
  color: #cfc2a8; text-decoration: none;
  font-family: var(--body); font-size: .84rem; line-height: 1.7;
  letter-spacing: .005em;
  background: none; border: 0; padding: 0; cursor: pointer; text-align: left;
  transition: color .14s ease;
}
.footer-col a:hover, .footer-col button:hover {
  color: var(--mustard);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: .18em;
}
.footer-legal {
  margin: .8rem 0 0; padding-top: .9rem;
  border-top: 1px dashed #3b322c;
  font-family: var(--body); font-size: .78rem; color: #97897a;
  letter-spacing: .01em;
  display: flex; flex-wrap: wrap; gap: .3rem .9rem;
}

/* ============================================================
   Daily gig funnel — band, badge, countdown
   ============================================================ */
.btn--daily {
  background: var(--acid);
  color: #10120a;
  border-color: #000;
  transform: rotate(.7deg);
}
.btn--daily:hover {
  background: var(--acid-hi);
  color: #10120a;
  transform: rotate(0) translate(-2px, -2px);
  box-shadow: 7px 7px 0 #000;
}
.btn--daily svg { width: 1.05em; height: 1.05em; }
.btn--daily .btn-badge {
  font-family: var(--type); font-size: .68rem;
  background: #10120a; color: var(--acid-hi);
  padding: .1rem .38rem; letter-spacing: .06em;
}

.daily-band-wrap { padding: .25rem 0 0; position: relative; z-index: 3; }

.daily-band {
  position: relative;
  display: grid;
  gap: .7rem;
  padding: .9rem 1rem .95rem;
  background:
    repeating-linear-gradient(135deg, rgba(168,200,50,.055) 0 .55rem, transparent .55rem 1.1rem),
    linear-gradient(180deg, #241f1c, #12100e);
  border: 2px solid #000;
  border-left: 6px solid var(--acid);
  box-shadow: var(--hard-sm), 0 1rem 2rem rgba(0,0,0,.5);
  /* the band is a stage element: it stays dark in both themes */
  --band-text: #f2e8d4;
  --band-muted: #a89a8a;
  color: var(--band-text);
  overflow: hidden;
}
.daily-band::after {
  content: "";
  position: absolute; inset: 0; pointer-events: none;
  background-image: var(--noise);
  background-size: 13.75rem 13.75rem;
  opacity: .16; mix-blend-mode: overlay;
}

.daily-eyebrow {
  display: flex; align-items: center; gap: .45rem; flex-wrap: wrap;
  margin: 0 0 .3rem;
  font-family: var(--type); font-size: .68rem;
  letter-spacing: .16em; text-transform: uppercase; color: var(--mustard-hi);
}
.live-dot {
  width: .5rem; height: .5rem; border-radius: 50%;
  background: var(--acid);
  box-shadow: 0 0 0 0 rgba(168,200,50,.7);
  animation: dailyPing 2s ease-out infinite;
}
@keyframes dailyPing {
  0%   { box-shadow: 0 0 0 0 rgba(168,200,50,.65); }
  70%  { box-shadow: 0 0 0 .55rem rgba(168,200,50,0); }
  100% { box-shadow: 0 0 0 0 rgba(168,200,50,0); }
}

.daily-band h2 {
  margin: 0 0 .25rem;
  font-size: clamp(1.2rem, .95rem + 1.6vw, 1.85rem);
  color: var(--band-text);
}
.daily-band h2 em {
  font-style: normal; color: var(--mustard-hi);
}
.daily-note {
  margin: 0; font-size: .84rem; color: var(--band-muted);
  max-width: 52ch;
}
.daily-note b { color: var(--band-text); }

.daily-band-side {
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .8rem;
}
.daily-band-side .btn--daily { flex: 1 1 12rem; }

.daily-streak {
  display: flex; flex-direction: column; line-height: .95;
  margin: 0; padding-right: .7rem;
  border-right: 1px dashed #4a4038;
  min-width: 4.2rem;
}
.daily-streak b {
  font-family: var(--display); font-size: 1.7rem; color: var(--mustard);
}
.daily-streak span {
  font-family: var(--type); font-size: .56rem;
  letter-spacing: .14em; text-transform: uppercase; color: var(--band-muted);
}

.daily-timer {
  margin: 0; font-family: var(--type); font-size: .68rem;
  letter-spacing: .06em; color: var(--band-muted);
  white-space: nowrap;
}
.daily-timer b { color: var(--band-text); font-variant-numeric: tabular-nums; }

/* nav badge */
.nav-btn--daily { display: inline-flex; align-items: center; gap: .35rem; }
.nav-btn--cta.nav-btn--daily { gap: .3rem; }

.link-card--daily {
  border-left: 6px solid var(--acid);
  background: linear-gradient(100deg, rgba(168,200,50,.10), var(--panel) 55%);
}
.link-card--daily b { display: flex; align-items: center; gap: .4rem; color: var(--acid-hi); }
.link-card--daily:hover { border-color: var(--acid); }
.link-card--daily span { color: var(--text-dim); }
.link-card--daily [data-daily-countdown] { color: var(--text); font-family: var(--type); }

:root[data-theme="light"] .link-card--daily {
  background: linear-gradient(100deg, rgba(168,200,50,.22), var(--panel) 55%);
}
:root[data-theme="light"] .link-card--daily b { color: #4a6410; }
.streak-pill {
  display: inline-grid; place-items: center;
  min-width: 1.15rem; height: 1.15rem; padding: 0 .22rem;
  background: var(--acid); color: #10120a;
  border: 2px solid #000;
  font-family: var(--display); font-size: .7rem; line-height: 1;
}
.streak-pill[hidden] { display: none; }

@media (min-width: 48rem) {
  .daily-band {
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 1.4rem;
    padding: 1rem 1.3rem;
  }
  .daily-band-side { justify-content: flex-end; }
  .daily-band-side .btn--daily { flex: 0 0 auto; }
}

/* ============================================================
   Modals, settings, leaderboard
   ============================================================ */
.modal {
  position: fixed; inset: 0; z-index: 100;
  display: none; place-items: center; padding: .75rem;
  padding: max(.75rem, env(safe-area-inset-top)) max(.75rem, env(safe-area-inset-right))
           max(.75rem, env(safe-area-inset-bottom)) max(.75rem, env(safe-area-inset-left));
  background:
    radial-gradient(circle at 50% 30%, rgba(8,6,5,.78), rgba(3,2,2,.94)),
    var(--noise);
  background-size: auto, 13.75rem 13.75rem;
  backdrop-filter: blur(4px);
  overflow: auto;
  overscroll-behavior: contain;
}
.modal[data-open="true"] { display: grid; }

.modal-panel {
  position: relative;
  width: min(43rem, 100%);
  max-height: 88svh;
  overflow: auto;
  padding: clamp(1.1rem, 3vw, 1.9rem);
  color: var(--ink);
  background:
    repeating-linear-gradient(180deg, rgba(0,0,0,.02) 0 2px, transparent 2px 5px),
    linear-gradient(160deg, var(--card-stock), var(--card-edge));
  border: 3px solid #000;
  box-shadow: var(--hard), 0 1.6rem 4rem rgba(0,0,0,.85);
}
.modal-panel::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: .5rem;
  background: repeating-linear-gradient(135deg, var(--blood) 0 .75rem, #17120f .75rem 1.5rem);
}
.modal-panel h2 { color: var(--ink); margin-top: .3rem; }
.modal-panel p, .modal-panel label { color: var(--ink-dim); }
.modal-close {
  position: absolute; top: .3rem; right: .4rem;
  width: 2.2rem; height: 2.2rem;
  display: grid; place-items: center;
  background: var(--blood); color: #f2e8d4;
  border: 2px solid #000; box-shadow: 2px 2px 0 #000;
  font-family: var(--display); font-size: 1.3rem; line-height: 1;
  cursor: pointer;
  transition: transform .12s ease, background .12s ease;
}
.modal-close:hover { background: var(--blood-hi); transform: translate(-1px,-1px); }

.setting {
  display: grid; grid-template-columns: 1fr 7rem 3rem;
  align-items: center; gap: .7rem;
  padding: .55rem 0;
  border-bottom: 1px dashed rgba(0,0,0,.18);
}
.setting--switch { grid-template-columns: 1fr auto; }
.setting label { font-size: .9rem; color: var(--ink-dim); }
.setting output { font-family: var(--display); color: var(--blood-deep); font-size: 1rem; text-align: right; }
input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: .45rem;
  background: #17120f; border: 2px solid #000; cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 1.1rem; height: 1.1rem;
  background: var(--blood); border: 2px solid #000; cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
  width: 1rem; height: 1rem; background: var(--blood);
  border: 2px solid #000; border-radius: 0; cursor: pointer;
}
input[type="checkbox"] { width: 1.35rem; height: 1.35rem; accent-color: var(--blood); cursor: pointer; }

#shareText {
  width: 100%; padding: .7rem;
  font-family: var(--type); font-size: .82rem;
  color: #f2e8d4; background: #17120f;
  border: 2px solid #000;
  resize: vertical;
}

/* ---------- share modal ---------- */
.share-poster {
  margin: .8rem 0 1rem;
  border: 2px solid #000;
  box-shadow: var(--hard-sm);
  background: #0b0908;
  overflow: hidden;
}
.share-poster img {
  display: block;
  width: 100%; height: auto;
  aspect-ratio: 1200 / 630;
  object-fit: cover;
  background: #0b0908;
}
.share-poster img:not([src]) { display: none; }

.share-h {
  margin: 1.1rem 0 .45rem;
  font-family: var(--display);
  font-size: .8rem; letter-spacing: .18em; text-transform: uppercase;
  color: var(--blood-deep);
}

.share-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(6.6rem, 1fr));
  gap: .4rem;
}
.share-link {
  display: flex; align-items: center; gap: .4rem;
  padding: .45rem .55rem;
  background: #17120f; color: #f2e8d4;
  border: 2px solid #000; box-shadow: 2px 2px 0 #000;
  text-decoration: none; cursor: pointer;
  font-family: var(--display); font-size: .78rem;
  letter-spacing: .06em; text-transform: uppercase;
  transition: transform .1s ease, background .12s ease, box-shadow .1s ease;
}
.share-link svg { width: 1rem; height: 1rem; fill: currentColor; flex: 0 0 auto; }
.share-link:hover { background: var(--blood); transform: translate(-1px,-1px); box-shadow: 3px 3px 0 #000; color: #fff; }
.share-link:active { transform: translate(2px,2px); box-shadow: none; }
.share-link--muted { background: #221b17; }

.share-copy-row { display: flex; gap: .4rem; }
.share-copy-row input {
  flex: 1; min-width: 0;
  padding: .5rem .55rem;
  font-family: var(--type); font-size: .72rem;
  color: #f2e8d4; background: #17120f;
  border: 2px solid #000;
}
.share-copy-row .btn { flex: 0 0 auto; padding-inline: .9rem; }

/* share modal on a phone: a full-height sheet, not a centred box that
   scrolls twice and hides its buttons under the home indicator */
@media (max-width: 47.99rem) {
  .modal { place-items: stretch; padding: 0; }
  /* a full-height sheet owns the screen; stop the page behind it scrolling */
  html.has-modal, html.has-modal body { overflow: hidden; }
  .modal-panel {
    width: 100%;
    max-height: none;
    height: 100svh;
    overflow-y: auto;
    padding: 1.4rem .9rem max(1.4rem, env(safe-area-inset-bottom));
    border-width: 0;
    box-shadow: none;
  }
  .modal-close {
    position: fixed;
    top: max(.55rem, env(safe-area-inset-top));
    right: max(.55rem, env(safe-area-inset-right));
    z-index: 3;
    width: 2.75rem; height: 2.75rem;
  }
  .share-poster { margin: .6rem 0 .8rem; }
  .share-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .35rem; }
  .share-link { min-height: 2.75rem; }
  .share-copy-row { flex-wrap: nowrap; }
  .share-copy-row .btn { min-height: 2.75rem; }
  .modal-panel > .card-actions,
  .modal-panel .card-actions { flex-direction: column; }
  .modal-panel .card-actions .btn { width: 100%; }
}

/* fingers need the page-level share icons to be reachable too */
@media (pointer: coarse) {
  .share-btn { width: 2.9rem; height: 2.9rem; }
  .hype-btn { min-height: 2.6rem; }
}
@media (max-width: 30rem) {
  .share-btn { width: 2.9rem; height: 2.9rem; }
  .hype-btn { min-height: 2.6rem; }
}

/* one-tap sharing straight from the scorecard */
.quick-share {
  display: flex; flex-wrap: wrap; justify-content: center; gap: .35rem;
  margin: .9rem 0 0;
}
.quick-share:empty { display: none; }
.quick-share button,
.quick-share a {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .35rem .55rem;
  background: #221b17; color: #f2e8d4;
  border: 2px solid #000; box-shadow: 2px 2px 0 #000;
  cursor: pointer; text-decoration: none;
  font-family: var(--display); font-size: .72rem;
  letter-spacing: .05em; text-transform: uppercase;
  transition: transform .1s ease, background .12s ease;
}
.quick-share svg { width: .85rem; height: .85rem; fill: currentColor; }
.quick-share button:hover,
.quick-share a:hover { background: var(--blood); transform: translate(-1px,-1px); }

/* scorecard share strip: full-width tap targets instead of a cramped wrap */
@media (max-width: 30rem) {
  .quick-share {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .35rem;
    margin-top: .8rem;
  }
  .quick-share button,
  .quick-share a {
    justify-content: center;
    min-height: 2.75rem;
    padding: .4rem .3rem;
    font-size: .68rem;
  }
  .quick-share svg { width: .8rem; height: .8rem; }
}

.board { display: grid; gap: .3rem; margin-top: 1rem; }
.board-row {
  display: grid; grid-template-columns: 2rem 1fr auto;
  gap: .6rem; align-items: center;
  padding: .45rem .6rem;
  font-size: .86rem;
  background: rgba(0,0,0,.06);
  border: 2px solid rgba(0,0,0,.16);
  border-left: 5px solid rgba(0,0,0,.3);
}
.board-row.top {
  background: rgba(200,38,26,.12);
  border-color: #000; border-left-color: var(--blood);
  box-shadow: 2px 2px 0 rgba(0,0,0,.55);
}
.board-row .rank { font-family: var(--display); font-size: 1.05rem; color: var(--ink-dim); }
.board-row .tag { font-family: var(--display); letter-spacing: .16em; color: var(--ink); }
.board-row .sc {
  font-family: var(--display); font-size: 1.05rem;
  font-variant-numeric: tabular-nums; color: var(--blood-deep);
}
.board-row .meta { display: none; font-family: var(--type); color: var(--ink-dim); font-size: .68rem; }
.board-tabs { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .9rem; }
.board-tabs button {
  font-family: var(--display); font-size: .76rem; letter-spacing: .08em; text-transform: uppercase;
  padding: .25rem .6rem; cursor: pointer;
  background: #17120f; color: #f2e8d4; border: 2px solid #000;
}
.board-tabs button.on { background: var(--mustard); color: #17120f; }

/* ============================================================
   Crash / error boundary
   ============================================================ */
.crash {
  position: fixed; inset: 0; z-index: 400;
  display: none; place-items: center; padding: 1rem;
  background: rgba(6,4,3,.94);
}
.crash[data-open="true"] { display: grid; }
.crash-card {
  width: min(30rem, 100%);
  padding: 1.2rem;
  background: var(--panel); color: var(--text);
  border: 3px solid #000; box-shadow: var(--hard);
}
.crash-card h2 { color: var(--blood-hi); }
.crash-card code {
  display: block; margin: .6rem 0;
  padding: .5rem; background: #0b0908; color: #ffb3a6;
  font-family: var(--type); font-size: .74rem;
  border: 1px solid #3b322c; max-height: 7rem; overflow: auto;
  word-break: break-word;
}

/* ============================================================
   Breakpoints (mobile-first)
   ============================================================ */
@media (min-width: 34rem) {
  .wrap { width: min(78rem, 100% - 2rem); }
  .meter-val { display: inline; }
  .combo-wrap span { display: block; }
  .hero-stats { gap: .8rem 1.8rem; }
  .card::before, .card::after { width: 5.5rem; }
  .feature-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-inner { grid-template-columns: 1.6fr 1fr; }
  .board-row { grid-template-columns: 2.2rem 1fr auto auto; }
  .board-row .meta { display: block; }
}

@media (min-width: 48rem) {
  .header-inner {
    grid-template-columns: auto 1fr auto;
    grid-template-areas: "brand nav tools";
    min-height: 4.2rem;
  }
  .nav-toggle { display: none; }
  .site-nav {
    display: flex; flex-direction: row; align-items: center;
    justify-self: center; gap: .15rem;
    border-top: 0; margin-top: 0; padding: 0;
  }
  .nav-btn { font-size: .95rem; padding: .45rem .6rem; }
  .nav-btn::after { left: .6rem; right: .6rem; width: auto; transform: scaleX(0); transform-origin: left; }
  .nav-btn:hover::after, .nav-btn[aria-current="page"]::after { transform: scaleX(1); width: auto; }
  .nav-btn--cta { margin-top: 0; padding: .42rem .9rem; }

  .hud {
    display: flex; justify-content: space-between; gap: .8rem;
    padding: .55rem .85rem;
  }
  .hud-center { flex-direction: column; align-items: center; gap: .05rem; }
  .hud-left { gap: 1.1rem; }
  .meter { grid-template-columns: auto 7rem auto; }
  .dock { flex-direction: row; align-items: center; gap: .9rem; }
  .dock-head { flex-direction: column; align-items: flex-start; min-width: 9rem; }
  .dock-head small { text-align: left; }
  .dock-items { flex-wrap: wrap; overflow-x: visible; }
  .hero-inner { grid-template-columns: 1.15fr .85fr; }
  .hero-art { display: grid; place-items: center; }
  .feature-grid { grid-template-columns: repeat(4, 1fr); }
  .mini-layout { grid-template-columns: 1.2fr .8fr; }
}

@media (min-width: 64rem) {
  .hero { padding-top: 3.4rem; }
  .hero-stats b { font-size: 2rem; }
  .footer-inner { grid-template-columns: 2fr 1fr 1fr 1fr; }
  .hud { min-height: 4rem; }
}

@media (min-width: 80rem) {
  .hero-inner { grid-template-columns: 1.2fr .8fr; gap: 3rem; }
}

/* short viewports: keep the playfield usable without losing the mode CTAs */
@media (max-height: 34rem) and (orientation: landscape) and (max-width: 60rem) {
  .site-header { position: static; }
  .hero { padding: .6rem 0 0; }
  .hero-inner { display: none; }
  .mode-picker { margin: .4rem 0 .5rem; }
  .mode-block { padding: .5rem .6rem .55rem; }
  .mode-daily-tour, .mode-daily-meta { display: none; }
  .canvas-wrap { aspect-ratio: auto; height: 62svh; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  body::before { opacity: .16; }
  .btn--primary { transform: none; }
}

@media (forced-colors: active) {
  .btn, .icon-btn, .gear-btn, .nav-btn--cta { border-color: ButtonText; }
  .meter-fill { background: Highlight; }
}

/* ============================================================
   Game page (play.html) - full-viewport mini-app
   ============================================================ */
.play-body {
  /* dvh tracks the collapsing browser URL bar; svh is the conservative
     fallback for browsers that do not understand dvh yet. */
  height: 100svh;
  height: 100dvh;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  overscroll-behavior: none;
  background: #080605;
  -webkit-tap-highlight-color: transparent;
}

/* slim top bar replaces the site header/footer on the game page */
.play-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: max(.3rem, env(safe-area-inset-top)) max(.5rem, env(safe-area-inset-right)) .3rem max(.5rem, env(safe-area-inset-left));
  background: linear-gradient(180deg, #1d1815, #0d0a09);
  border-bottom: 3px solid #000;
  box-shadow: inset 0 -1px 0 #3b322c;
  color: #f2e8d4;
  position: relative;
  z-index: 40;
}

.brand--compact { gap: .4rem; text-decoration: none; min-width: 0; }
.brand--compact .brand-mark { width: 1.5rem; height: 1.5rem; flex: 0 0 auto; }
.brand--compact .brand-text { font-size: 1rem; min-width: 0; }
.brand--compact .brand-text strong,
.brand--compact .brand-text em { font-size: inherit; }

.play-bar-mode {
  margin: 0;
  flex: 0 1 auto;
  min-width: 0;
  font-family: var(--display);
  font-size: .78rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--mustard);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.game-shell[data-mode="daily"] ~ * .play-bar-mode,
.play-body:has(.game-shell[data-mode="daily"]) .play-bar-mode { color: var(--acid-hi); }

.play-bar-tools { margin-left: auto; display: flex; align-items: center; gap: .25rem; flex: 0 0 auto; }

/* portrait / very narrow: shed the optional bar items rather than overflow */
@media (max-width: 30rem), (max-height: 32rem) {
  .play-bar .brand-text { display: none; }
  .play-bar-link { display: none; }
}
.play-bar-link {
  font-family: var(--display);
  font-size: .72rem; letter-spacing: .12em; text-transform: uppercase;
  color: #b9ab97; text-decoration: none;
  padding: .3rem .35rem;
  border-bottom: 2px solid transparent;
}
.play-bar-link:hover { color: var(--mustard-hi); border-bottom-color: var(--mustard); }
.play-bar-exit {
  font-family: var(--display);
  font-size: .74rem; letter-spacing: .12em; text-transform: uppercase;
  color: #f2e8d4; text-decoration: none;
  padding: .3rem .55rem;
  border: 2px solid var(--blood);
  box-shadow: 2px 2px 0 #000;
  white-space: nowrap;
}
.play-bar-exit:hover { background: var(--blood); transform: translate(-1px,-1px); }
.play-bar .icon-btn { color: #cfc2a8; }

/* game shell owns all remaining height */
.play-main {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
}
.play-main > .game-shell {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border: 0;
  box-shadow: none;
  scroll-margin-top: 0;
}
.play-main .mode-strip,
.play-main .hud,
.play-main .dock { flex: 0 0 auto; }
.play-main .canvas-wrap {
  flex: 1 1 0%;
  min-height: 0;
  aspect-ratio: auto;
  display: grid;
  place-items: center;
  position: relative;
}
/* The canvas is sized in px by Engine.resize. Left in normal flow it feeds its
   own height back into the wrapper and the wrapper shrinks to the canvas,
   locking in a too-small playfield. Absolute + margin:auto keeps the wrapper
   at its grid/flex size so the canvas can grow into it. */
.play-main #stage-canvas {
  position: absolute;
  inset: 0;
  margin: auto;
  max-width: 100%;
  max-height: 100%;
}
.play-main .overlay .card { max-height: calc(100dvh - 3rem); overflow: auto; }

/* fullscreen chip over the canvas: only worth showing on touch, where the
   browser URL bar is the single biggest waste of playfield */
.fs-chip {
  position: absolute;
  right: .5rem;
  bottom: .5rem;
  z-index: 7;
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .32rem .6rem;
  background: rgba(23, 18, 15, .9);
  color: #f2e8d4;
  border: 2px solid var(--mustard);
  box-shadow: 2px 2px 0 #000;
  font-family: var(--display);
  font-size: .72rem; letter-spacing: .1em; text-transform: uppercase;
  cursor: pointer;
}
.fs-chip svg { width: .85rem; height: .85rem; }
.fs-chip[hidden] { display: none; }
.fs-chip:active { transform: translate(1px, 1px); box-shadow: none; }

/* ---------- portrait gate ---------- */
.rotate-gate {
  position: fixed;
  inset: 0;
  z-index: 320;
  display: grid;
  place-items: center;
  padding: 1.4rem max(1.1rem, env(safe-area-inset-right)) 1.4rem max(1.1rem, env(safe-area-inset-left));
  text-align: center;
  color: #f2e8d4;
  background:
    radial-gradient(circle at 50% 32%, rgba(200,38,26,.32), rgba(6,5,4,.97) 62%),
    #060504;
  overscroll-behavior: contain;
}
.rotate-gate[hidden] { display: none; }
/* while the gate is up, the page behind it must not scroll under the finger */
html.is-landscape-blocked, html.is-landscape-blocked body { overflow: hidden; }
.rotate-card { max-width: 24rem; display: grid; gap: .55rem; justify-items: center; }
.rotate-card h2 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(1.6rem, 1.2rem + 3vw, 2.4rem);
  letter-spacing: .06em;
  line-height: 1;
  color: #f2e8d4;
}
.rotate-card p { margin: 0; color: #cfc2a8; font-size: .92rem; }
.rotate-card .tiny { font-size: .74rem; color: #97897a; }
.rotate-art { display: flex; align-items: center; gap: .5rem; margin-bottom: .3rem; }
.rotate-phone {
  display: block;
  width: 2.4rem; height: 4.1rem;
  border: 3px solid #f2e8d4;
  border-radius: .45rem;
  background: linear-gradient(160deg, #2a2320, #0d0a09);
  box-shadow: 0 0 0 3px #000;
  animation: rotateWobble 2.6s ease-in-out infinite;
}
.rotate-arrow { font-size: 1.9rem; color: var(--mustard); animation: rotateSpin 2.6s ease-in-out infinite; }
@keyframes rotateWobble {
  0%, 30% { transform: rotate(0deg); }
  55%, 85% { transform: rotate(-90deg); }
  100% { transform: rotate(0deg); }
}
@keyframes rotateSpin { 0%, 30% { transform: rotate(0deg) scale(1); } 55%, 85% { transform: rotate(180deg) scale(1.15); } 100% { transform: rotate(0deg) scale(1); } }
.rotate-link {
  margin-top: .4rem;
  font-family: var(--display); font-size: .78rem; letter-spacing: .14em; text-transform: uppercase;
  color: #b9ab97;
}
@media (prefers-reduced-motion: reduce) {
  .rotate-phone, .rotate-arrow { animation: none; }
}

/* ============================================================
   Play page on phones: the playfield is the product, so every
   other row is squeezed to the smallest legible height.
   Triggered by a short viewport OR a coarse pointer, which
   covers landscape phones regardless of their pixel width.
   ============================================================ */
@media (max-height: 36rem), (pointer: coarse) and (max-height: 40rem) {

  /* ---- ONE top bar. The separate play bar is merged into the HUD:
     its logo, mode label and links are redundant (the mode chip and the
     pause overlay already carry them), and its two icon buttons are
     duplicated inside the HUD as .hud-only. ---- */
  .play-bar { display: none; }
  .hud-only { display: grid; }

  /* ---- the mode strip duplicates the HUD's mode chip ---- */
  .play-main .mode-strip { display: none; }

  /* ---- HUD: one dense row, ~34px ---- */
  .play-main .hud {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .4rem;
    padding: max(.1rem, env(safe-area-inset-top)) max(.4rem, env(safe-area-inset-right)) .1rem max(.4rem, env(safe-area-inset-left));
    min-height: 0;
    border-bottom-width: 2px;
  }
  .play-main .hud-left { gap: .45rem; flex: 1 1 auto; min-width: 0; }
  .play-main .hud-center,
  .play-main .hud-right { flex: 0 0 auto; gap: .3rem; }
  /* the integrity bar must not monopolise the row; stats need the space */
  .play-main .meter { grid-template-columns: 1fr; gap: 0; flex: 0 1 auto; width: clamp(2.75rem, 20vw, 9rem); min-width: 0; }
  .play-main .meter-label { display: none; }
  .play-main .meter-track { height: .5rem; min-width: 2.2rem; }
  .play-main .meter-val { display: none; }
  .play-main .stat-row { gap: .5rem; }
  .play-main .stat { line-height: .95; }
  .play-main .stat span { font-size: .46rem; letter-spacing: .1em; }
  .play-main .stat b { font-size: .92rem; }
  .play-main .repair-btn { padding: .08rem .28rem; font-size: .62rem; min-height: 0; gap: .18rem; }
  .play-main .repair-btn .repair-icon { font-size: .68rem; }
  .play-main .repair-btn .repair-label { display: none; }
  .play-main .repair-cost { font-size: .6rem; }

  /* the tier name is already the attract/mode copy; the wave chip carries */
  .play-main .tier-chip { display: none; }
  .play-main .wave-chip { font-size: .56rem; letter-spacing: .04em; }
  .play-main .mode-chip { font-size: .5rem; padding: .02rem .22rem; margin-right: .18rem; }

  .play-main .combo-wrap span { display: none; }
  .play-main .combo-wrap b { font-size: 1rem; }
  .play-main .ult-ring { width: 1.85rem; height: 1.85rem; }
  .play-main .ult-ring::after { inset: 2px; }
  .play-main .ult-ring span { font-size: .55rem; }
  .play-main .hud-icon-btn { width: 1.85rem; height: 1.85rem; font-size: .58rem; }

  /* ---- dock: a single scrolling row, no header ---- */
  .play-main .dock { padding: .18rem .35rem max(.22rem, env(safe-area-inset-bottom)); gap: 0; }
  .play-main .dock-head { display: none; }
  .play-main .dock-items {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 0;
    scroll-snap-type: x proximity;
  }
  .play-main .gear-btn {
    min-width: 4.9rem; min-height: 0;
    padding: .16rem .3rem;
    grid-template-columns: 1.25rem 1fr;
    gap: 0 .3rem;
  }
  .play-main .gear-icon { width: 1.25rem; height: 1.25rem; font-size: .68rem; }
  .play-main .gear-name { font-size: .66rem; letter-spacing: .02em; }
  .play-main .gear-cost { font-size: .56rem; }
  .play-main .gear-key { font-size: .52rem; top: 0; right: .2rem; }

  /* ---- canvas furniture ---- */
  .play-main .toast { bottom: .25rem; font-size: .68rem; padding: .2rem .5rem; max-width: 96%; }
  .play-main .attract { padding: .2rem .5rem .3rem; }
  .play-main .attract strong { font-size: .88rem; letter-spacing: .06em; }
  .play-main .attract span { font-size: .56rem; }
  .play-main .fs-chip { padding: .22rem .45rem; font-size: .62rem; right: .35rem; bottom: .35rem; }
}

/* Portrait phones: never render the game layout. The 16:9 field plus HUD
   plus dock cannot fit, and the previous behaviour (a letterboxed sliver
   surrounded by chrome) looked broken. */
@media (orientation: portrait) and (max-width: 64rem) {
  .play-main,
  .play-bar { visibility: hidden; }
}

/* ============================================================
   Landscape phones: the 16:9 field is limited by height, which
   leaves a wide empty band either side. Move the rig dock into
   that band as a vertical column so the playfield can use the
   full height instead.
   ============================================================ */
@media (max-height: 36rem) and (orientation: landscape) and (min-width: 34rem) {
  .play-main > .game-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 6rem;
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas:
      "hud    hud"
      "stage  dock";
  }
  .play-main .hud { grid-area: hud; }
  /* grid items only stretch when the used height is auto, and the canvas
     wrapper was resolving to its own content. Pin it to the row. */
  .play-main .canvas-wrap { grid-area: stage; height: 100%; min-height: 0; }
  .play-main .dock {
    grid-area: dock;
    flex-direction: column;
    gap: .18rem;
    padding: .22rem .2rem max(.22rem, env(safe-area-inset-bottom));
    border-top: 0;
    border-left: 2px solid #000;
    box-shadow: inset 1px 0 0 #3b322c;
    min-height: 0;
    overflow: hidden;
  }
  .play-main .dock-head {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: .22rem;
    order: 2;
    min-width: 0;
    width: 100%;
    overflow: hidden;
  }
  .play-main .dock-head > span,
  .play-main .dock-head > small { display: none; }
  .play-main .dock-tools {
    flex-direction: column;
    align-items: stretch;
    gap: .22rem;
    margin: 0;
    min-width: 0;
    width: 100%;
  }
  .play-main .gon-prefix,
  .play-main .gun-prefix,
  .play-main .dock-weapon kbd { display: none; }
  .play-main .dock-weapon,
  .play-main .sell-toggle {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: 1.6rem;
    padding: .12rem .2rem;
    font-size: .55rem;
    justify-content: center;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
  }
  .play-main .dock-weapon b {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .play-main .dock-items {
    order: 1;
    flex: 1 1 auto;
    flex-direction: column;
    flex-wrap: nowrap;
    min-height: 0;
    gap: .22rem;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 0;
    scroll-snap-type: y proximity;
  }
  .play-main .gear-btn {
    width: 100%;
    min-width: 0;
    min-height: 1.72rem;
    grid-template-columns: 1.1rem minmax(0, 1fr);
    gap: 0 .24rem;
    padding: .14rem .2rem;
    scroll-snap-align: start;
  }
  .play-main .gear-icon { width: 1.15rem; height: 1.15rem; font-size: .62rem; }
  .play-main .gear-name { font-size: .6rem; }
  .play-main .gear-cost { font-size: .54rem; }
  .play-main .gear-key { display: none; }
  .play-main .gear-btn.selected::after { width: .7rem; height: .7rem; top: -.3rem; right: -.3rem; }
}

/* ============================================================
   Landing page preview (replaces the embedded game)
   ============================================================ */
.arena--preview { padding: 1.6rem 0 2rem; }
.preview { display: grid; gap: 1.3rem; }
.preview-screen { min-width: 0; }
.preview-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  border: 3px solid #000;
  background: #060504;
  overflow: hidden;
  box-shadow: var(--hard), 0 1.3rem 3rem rgba(0,0,0,.6);
  isolation: isolate;
}
.preview-art { display: block; width: 100%; height: 100%; }
.preview-scan {
  position: absolute; inset: 0; pointer-events: none;
  background-image: var(--scratches);
  background-size: 21.25rem 21.25rem;
  opacity: .3;
  mix-blend-mode: overlay;
}
.preview-cta {
  position: absolute; inset: 0;
  display: grid; place-content: center; justify-items: center; gap: .6rem;
  text-decoration: none;
  color: #f2e8d4;
  background: radial-gradient(circle at 50% 55%, rgba(6,5,4,.62) 0 32%, rgba(6,5,4,.12) 68%);
  transition: background .2s ease;
}
.preview-cta:hover { background: radial-gradient(circle at 50% 55%, rgba(6,5,4,.72) 0 34%, rgba(6,5,4,.2) 72%); }
.preview-play {
  display: grid; place-items: center;
  width: clamp(3.2rem, 2rem + 5vw, 4.6rem);
  aspect-ratio: 1;
  color: #f2e8d4;
  background: var(--blood);
  border: 3px solid #000;
  box-shadow: var(--hard-sm);
  transition: transform .16s ease, box-shadow .16s ease;
}
.preview-play svg { width: 46%; height: 46%; margin-left: 6%; }
.preview-cta:hover .preview-play { transform: translate(-2px,-2px) rotate(-2deg); box-shadow: 6px 6px 0 #000; }
.preview-cta-text { display: grid; gap: .1rem; text-align: center; }
.preview-cta-text b {
  font-family: var(--display); font-size: clamp(1.3rem, 1rem + 2.4vw, 2rem);
  letter-spacing: .1em; text-transform: uppercase; line-height: 1;
  text-shadow: 2px 2px 0 #000;
}
.preview-cta-text small { font-family: var(--type); font-size: .68rem; color: #cfc2a8; letter-spacing: .06em; }

.preview-copy { min-width: 0; }
.preview-copy h2 {
  margin: .3rem 0 .5rem;
  font-size: clamp(1.6rem, 1.2rem + 2.4vw, 2.4rem);
}
.preview-copy p { color: var(--muted); }
.preview-points {
  list-style: none; padding: 0; margin: 1rem 0 1.2rem;
  display: grid; gap: .45rem;
  font-size: .9rem; color: var(--muted);
}
.preview-points li { padding-left: 1.1rem; position: relative; }
.preview-points li::before {
  content: ""; position: absolute; left: 0; top: .55em;
  width: .45rem; height: .45rem; background: var(--blood); transform: rotate(45deg);
}
.preview-points b { color: var(--text); font-family: var(--display); letter-spacing: .08em; }
.preview-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.preview-actions .btn { flex: 1 1 12rem; justify-content: center; }
.preview-note {
  margin: .9rem 0 0; font-family: var(--type); font-size: .74rem;
  color: var(--muted); display: flex; flex-wrap: wrap; gap: .45rem;
}
.preview-note a { color: var(--mustard); text-decoration: none; border-bottom: 1px solid currentColor; }

@media (min-width: 48rem) {
  .preview { grid-template-columns: 1.15fr .85fr; align-items: center; gap: 2rem; }
  .preview-actions .btn { flex: 0 1 auto; }
}

/* ---------- no-JS fallback for the game page ---------- */
.noscript-card {
  max-width: 34rem;
  margin: 3rem auto;
  padding: 1.5rem 1.3rem;
  color: #f2e8d4;
  background: #17120f;
  border: 3px solid #000;
  box-shadow: var(--hard), 0 1rem 2.5rem rgba(0,0,0,.7);
  text-align: left;
}
.noscript-card h1 {
  margin: 0 0 .6rem;
  font-family: var(--display);
  font-size: clamp(1.5rem, 1.2rem + 2vw, 2.1rem);
  letter-spacing: .04em;
  line-height: 1.05;
  color: #f2e8d4;
}
.noscript-card p { margin: 0 0 .7rem; color: #cfc2a8; font-size: .92rem; }
.noscript-card p:last-child { margin-bottom: 0; }
.noscript-card a { color: var(--mustard-hi); }

/* ============================================================
   Overlays on a landscape phone: the card is the whole viewport,
   so shrink the contents and pin the actions to the bottom edge
   instead of letting "Next Wave" fall below the fold.
   ============================================================ */
@media (max-height: 36rem) and (orientation: landscape) {
  .play-main .overlay,
  .overlay { padding: max(.4rem, env(safe-area-inset-top)) .5rem max(.4rem, env(safe-area-inset-bottom)); }
  .play-main .overlay .card {
    max-height: calc(100dvh - .8rem);
    padding: .65rem .8rem .5rem;
    overflow: auto;
    overscroll-behavior: contain;
  }
  .overlay .card h2 { font-size: 1.35rem; margin: .1rem 0 .3rem; }
  .overlay .card-sub { font-size: .74rem; margin: 0 0 .4rem; }
  .overlay .kicker { font-size: .6rem; padding: .1rem .45rem; margin-bottom: .35rem; letter-spacing: .16em; }
  .overlay .card-actions {
    /* Flows after the content. It used to be sticky, which pinned it over the
       last row of shop tiles and hid them. */
    margin: .5rem -.8rem -.5rem;
    padding: .45rem .8rem max(.5rem, env(safe-area-inset-bottom));
    background: var(--card-stock);
    border-top: 1px dashed rgba(0,0,0,.18);
    z-index: 2;
  }
  .overlay .card-actions .btn { min-height: 2.1rem; font-size: .74rem; padding: .35rem .7rem; }
  .overlay .card-actions--stack .btn { min-height: 1.95rem; }

  /* Shop: 4 columns and no description text, so the whole grid plus the
     action buttons fits a 390px-tall viewport without scrolling. */
  .shop-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .3rem; margin: .45rem 0; }
  .shop-item { padding: .32rem .35rem; gap: .15rem; border-left-width: 3px; }
  .shop-item h4 { font-size: .72rem; line-height: 1.1; }
  .shop-item p { display: none; }
  .shop-item .lvl { font-size: .52rem; letter-spacing: .02em; }
  .shop-item button { min-height: 1.55rem; font-size: .62rem; padding: .12rem .3rem; }

  /* tier picker + score grid */
  .tier-grid { gap: .35rem; margin: .5rem 0; }
  .score-grid { gap: .3rem; margin: .45rem 0; }

  /* Results card: seven stats wrapped onto two rows, which pushed "Run It
     Back" below the fold. One row plus a smaller tag field fits. */
  .overlay .score-grid { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .overlay .score-cell { padding: .3rem .35rem; }
  .overlay .score-cell span { font-size: .5rem; letter-spacing: .1em; }
  .overlay .score-cell b { font-size: .85rem; }
  .overlay .teaser { font-size: .68rem; margin: .3rem 0; }
  .overlay .initials-row { gap: .4rem; font-size: .74rem; }
  .overlay .initials-row input { width: 5rem; padding: .25rem .4rem; font-size: 1rem; }
  /* the four quick-share chips duplicate the "All Share Options" button */
  .overlay .quick-share { display: none; }

  /* the game-over card carries a lot; keep it scrollable but compact */
  .overlay .initials-row input { min-height: 2rem; }
}

/* Landscape phones are wider than the 47.99rem overlay breakpoint, so the
   overlay stayed absolute inside the 16:9 shell and got clipped by it.
   Promote it to the full viewport, same as the narrow-screen rule. */
@media (max-height: 36rem) and (orientation: landscape) {
  .play-main .overlay {
    position: fixed;
    inset: 0;
    z-index: 90;
    place-items: start center;
    padding: max(.4rem, env(safe-area-inset-top)) .5rem max(.4rem, env(safe-area-inset-bottom));
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }
  .game-shell.is-overlay-open { z-index: 95; }
  .play-main .overlay .card {
    max-height: none;
    overflow: visible;
    margin-inline: auto;
    width: min(46rem, 100%);
  }
}
