@font-face {
  font-family: Tiny5;
  src: url("../../font/Tiny5-Regular.ttf") format("truetype");
  font-display: swap;
  font-style: normal;
  font-weight: 400;
}

:root {
  color-scheme: dark;
  --bg: #100e1c;
  --header-h: 0px;
  --hud-h: 112px;
  --touch-h: 0px;
  --touch-side: 160px;
  --gap: 0px;
  --stick: 96px;
  --knob: 44px;
  --dpad: 96px;
  --pill-w: 48px;
  --pill-h: 32px;
  --pause-w: 36px;
  --use-w: 52px;
  --atk-w: 72px;
  --btn-h: 72px;
  --touch-gap: 10px;
  --touch-pad: 12px;
  --stone-btn: url("../../gui/vendor/touch/btn-normal.png");
  --stone-btn-hover: url("../../gui/vendor/touch/btn-hover.png");
  --stone-btn-pressed: url("../../gui/vendor/touch/btn-pressed.png");
  --stone-btn-big: url("../../gui/vendor/touch/btn-big-normal.png");
  --stone-btn-big-hover: url("../../gui/vendor/touch/btn-big-hover.png");
  --stone-btn-big-pressed: url("../../gui/vendor/touch/btn-big-pressed.png");
  --stone-tab: url("../../gui/vendor/touch/tab-off.png");
  --stone-tab-on: url("../../gui/vendor/touch/tab-on.png");
  --stone-slot: url("../../gui/vendor/touch/slot-normal.png");
  --stone-slot-on: url("../../gui/vendor/touch/slot-selected.png");
  --stone-plate: url("../../gui/vendor/touch/plate.png");
  --help-h: 0px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
}

/* v14: page chrome (seed toolbar, feel toggles, controls footer) lives in the
   in-game Settings panel. The page is a full-bleed game canvas. */
header, .help { display: none !important; }
body[data-orientation="portrait"] { --gap: 0px; }
#game { box-shadow: none; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  background: var(--bg);
  color: #e8e4f0;
  font: 13px/1.3 ui-sans-serif, system-ui, sans-serif;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: manipulation;
}
body {
  position: fixed;
  inset: 0;
}
#app {
  height: 100%;
  width: 100%;
  display: flex;
  flex-direction: column;
  padding: var(--safe-t) var(--safe-r) var(--safe-b) var(--safe-l);
  overflow: hidden;
  overscroll-behavior: none;
}
header {
  flex: 0 0 auto;
  min-height: var(--header-h);
  max-height: 40vh;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: center;
  padding: 4px 8px;
  background: #1a1730;
  border-bottom: 1px solid #3a3560;
  overflow: hidden;
}
.brand { font-weight: 700; letter-spacing: 0.02em; white-space: nowrap; }
#version { color: #ffe050; }
.credit { color: #c8c0a0; font-weight: 500; margin-left: 8px; font-size: 12px; letter-spacing: 0.01em; }
.toolbar { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; flex: 1 1 auto; }
label { display: flex; align-items: center; gap: 4px; }
input[type="number"] {
  width: 4.5rem; background: #0d0b18; color: inherit; border: 1px solid #4a4570;
  padding: 4px 6px; border-radius: 4px; font-size: 16px;
}
button {
  background: #3a2f7a; color: #fff; border: 0; border-radius: 4px;
  padding: 6px 10px; cursor: pointer; font: inherit;
  touch-action: manipulation;
}
button:hover { background: #5244a8; }
button.on { background: #6b4ad4; }
.orient { display: inline-flex; border: 1px solid #4a4570; border-radius: 4px; overflow: hidden; }
.orient button { border-radius: 0; padding: 6px 8px; background: #241e48; }
.orient button.on { background: #6b4ad4; }
#status { color: #a8e0b0; font-variant-numeric: tabular-nums; }

#stage-wrap {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  position: relative;
  display: grid;
  gap: var(--gap);
  padding: var(--gap);
}
#stage {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
body[data-orientation="portrait"] #stage {
  align-items: flex-end;
}
#game, #hud {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: var(--bg);
  box-shadow: 0 0 0 1px #2a2648;
  /* exact backing-store size is set in JS; never CSS-scale the bitmap */
  flex: 0 0 auto;
  touch-action: none;
}
#hud { image-rendering: pixelated; max-width: 100%; }
body[data-orientation="portrait"] #hud {
  justify-self: stretch;
  align-self: stretch;
  max-width: 100%;
  width: 100%;
}

/* Portrait: taller camera, HUD + touch stacked under the canvas */
body[data-orientation="portrait"] #stage-wrap {
  grid-template-columns: 1fr;
  grid-template-rows: 1fr var(--hud-h);
  grid-template-areas:
    "stage"
    "hud";
}
body[data-orientation="portrait"] #stage { grid-area: stage; }
body[data-orientation="portrait"] #hud { grid-area: hud; justify-self: stretch; align-self: stretch; }
body[data-orientation="portrait"][data-touch="on"] #touch {
  grid-area: stage;
  display: block;
  position: relative;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 3;
  padding: 0;
}

/* Landscape: wide camera, HUD drawn on the canvas. Touch clusters overlay
   the corners so side columns do not letterbox the stage. */
body[data-orientation="landscape"] #stage-wrap {
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
  grid-template-areas: "stage";
}
body[data-orientation="landscape"] #stage { grid-area: stage; }
body[data-orientation="landscape"] #hud { display: none; }
body[data-orientation="landscape"][data-touch="on"] #touch {
  display: block;
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  padding: 0;
}
body[data-orientation="landscape"][data-touch="on"] #touch-left,
body[data-orientation="landscape"][data-touch="on"] #touch-actions {
  pointer-events: auto;
  position: absolute;
}

body[data-touch="off"] #touch { display: none !important; }
body[data-touch="off"][data-orientation="portrait"] #stage-wrap {
  grid-template-rows: 1fr var(--hud-h);
  grid-template-areas: "stage" "hud";
}
body[data-touch="off"][data-orientation="landscape"] #stage-wrap {
  grid-template-columns: 1fr;
  grid-template-areas: "stage";
}

#touch {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 calc(12px + var(--safe-r)) calc(8px + var(--safe-b)) calc(12px + var(--safe-l));
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}
#dpad {
  position: relative;
  width: var(--dpad);
  height: var(--dpad);
  touch-action: none;
  image-rendering: pixelated;
}
#dpad .arm {
  position: absolute;
  background: transparent;
  border-style: solid;
  border-width: 4px;
  border-image: var(--stone-slot) 4 fill;
  border-image-width: 4px;
  border-radius: 0;
  pointer-events: none;
  image-rendering: pixelated;
}
#dpad .arm.vert { width: 30px; height: var(--dpad); left: 29px; top: 0; }
#dpad .arm.horiz { width: var(--dpad); height: 30px; left: 0; top: 29px; }
#dpad .knob {
  position: absolute; width: 28px; height: 28px; left: 30px; top: 30px;
  border-radius: 0; border: 0;
  background: var(--stone-plate) center / 100% 100% no-repeat;
  image-rendering: pixelated;
  pointer-events: none;
  box-shadow: 0 0 0 1px #1a1428;
}
#dpad.active .arm, #dpad .arm.pressed {
  border-image-source: var(--stone-slot-on);
  filter: brightness(1.15);
}
#dpad.active .knob { filter: brightness(1.25); }
#touch-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
#touch-left #dpad { order: 2; }
#touch-left #touch-heroes { order: 1; }
#touch-heroes {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: center;
}
#touch-heroes button {
  font-family: Tiny5, monospace;
  font-size: 10px;
  letter-spacing: 0.02em;
  color: #d8d0b0;
  text-shadow: 1px 1px 0 #1a1428;
  padding: 0;
  width: var(--pill-w);
  min-width: var(--pill-w);
  height: var(--pill-h);
  min-height: var(--pill-h);
  background: transparent;
  border-radius: 0;
  border-style: solid;
  border-width: 4px;
  border-image: var(--stone-tab) 4 fill;
  border-image-width: 4px;
  image-rendering: pixelated;
  overflow: visible;
  white-space: nowrap;
}
#touch-heroes button.on {
  background: transparent;
  color: #ffe050;
  border-image-source: var(--stone-tab-on);
}
#touch-heroes button:active, #touch-heroes button.active {
  border-image-source: var(--stone-tab-on);
  transform: translateY(1px);
}
#touch-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
#use, #atk, #pause {
  font-family: Tiny5, monospace;
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.06em;
  color: #f4ead0;
  text-shadow: 1px 1px 0 #1a1428;
  background: transparent;
  border-radius: 0;
  border-style: solid;
  border-width: 6px;
  border-image: var(--stone-btn) 6 fill;
  border-image-width: 6px;
  box-shadow: none;
  image-rendering: pixelated;
  touch-action: none;
}
#use { width: var(--use-w); height: var(--btn-h); min-width: var(--use-w); min-height: var(--btn-h); }
#atk {
  width: var(--atk-w); height: var(--btn-h); min-width: var(--atk-w); min-height: var(--btn-h);
  border-image-source: var(--stone-btn-big);
  color: #ffe8c8;
}
#use:hover, #pause:hover { border-image-source: var(--stone-btn-hover); background: transparent; }
#atk:hover { border-image-source: var(--stone-btn-big-hover); background: transparent; }
#use.active, #use:active, #pause.active, #pause:active {
  border-image-source: var(--stone-btn-pressed);
  background: transparent;
  transform: translateY(1px);
}
#atk.active, #atk:active {
  border-image-source: var(--stone-btn-big-pressed);
  background: transparent;
  transform: translateY(1px);
  filter: brightness(1.08);
}

.help {
  flex: 0 0 auto;
  text-align: center;
  color: #9a96b0;
  margin: 0;
  padding: 4px 12px calc(6px + var(--safe-b));
  max-height: var(--help-h);
  overflow: hidden;
}
body[data-touch="on"] .help { display: none; }
body[data-touch="off"] .help { display: block; }

/* Compact header options on narrow portrait phones */
@media (max-width: 500px), (max-height: 500px) {
  header { font-size: 12px; }
  .opt { display: none; }
  input[type="number"] { font-size: 16px; } /* iOS zoom guard */
}

#stage-wrap { position: relative; }
#died {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(16, 14, 28, 0.35);
  z-index: 5;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
#died[hidden] { display: none !important; }
.died-card {
  pointer-events: none;
  text-align: center;
  background: rgba(16, 14, 28, 0.85);
  border: 2px solid #c8c0a0;
  padding: 16px 22px;
  color: #e8e4f0;
}
.died-title { margin: 0 0 8px; color: #ffe050; font-weight: 700; font-size: 20px; letter-spacing: 0.04em; }
.died-summary { margin: 0 0 8px; color: #e8e4f0; font-size: 14px; }
.died-hint { margin: 0; color: #d8d0b0; font-size: 14px; }

.died-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 10px; }
.died-actions button { min-height: 44px; min-width: 120px; padding: 10px 14px; }
.died-best { margin: 6px 0 0; color: #c8c0a0; font-size: 13px; }

#seed-menu {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(16, 14, 28, 0.55);
  padding: 16px;
  pointer-events: auto;
}
#seed-menu[hidden] { display: none !important; }
.seed-menu-card {
  min-width: min(320px, 92vw);
  max-width: 420px;
  background: #1a1730;
  border: 1px solid #5a5080;
  border-radius: 8px;
  padding: 16px 16px 12px;
  color: #e8e4f0;
  box-shadow: 0 8px 24px rgba(0,0,0,0.45);
}
.seed-menu-title { margin: 0 0 8px; color: #ffe050; font-weight: 700; font-size: 16px; }
.seed-menu-seed { margin: 0 0 4px; font-variant-numeric: tabular-nums; font-size: 18px; }
.seed-menu-field {
  display: flex; flex-direction: column; gap: 6px;
  margin: 0 0 12px; font-size: 13px; color: #c8c0a0;
}
.seed-menu-field input {
  width: 100%; min-height: 44px; font-size: 20px;
  background: #0d0b18; color: #ffe050; border: 1px solid #6b4ad4;
  border-radius: 6px; padding: 8px 10px; font-variant-numeric: tabular-nums;
}
.seed-menu-best { margin: 0 0 12px; color: #c8c0a0; font-size: 13px; }
.seed-menu-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.seed-menu-actions button,
.seed-menu-close {
  min-height: 44px;
  min-width: 112px;
  padding: 10px 14px;
}
.seed-menu-hint { margin: 10px 0 8px; color: #a8a0b8; font-size: 12px; }
.seed-menu-close { width: 100%; margin-top: 4px; background: #241e48; }
.seed-menu-close:hover { background: #3a2f7a; }
button.copied { background: #2f6b44; }

#pause {
  width: var(--pause-w); min-width: var(--pause-w); height: var(--btn-h); min-height: var(--btn-h);
  color: #ffe050;
  touch-action: manipulation;
}
body[data-screen="title"] #touch-left,
body[data-screen="title"] #use,
body[data-screen="title"] #atk { visibility: hidden; pointer-events: none; }
body[data-screen="title"] #pause { visibility: hidden; pointer-events: none; }
body[data-screen="paused"] #dpad,
body[data-screen="paused"] #use,
body[data-screen="paused"] #atk,
body[data-screen="win"] #dpad,
body[data-screen="win"] #use,
body[data-screen="win"] #atk,
body[data-screen="death"] #dpad,
body[data-screen="death"] #use,
body[data-screen="death"] #atk { pointer-events: none; }
body[data-screen="title"] #hud { visibility: hidden; }
body[data-screen="death"] #hud,
body[data-screen="win"] #hud { display: none !important; }
/* Collapse the reserved portrait HUD row so death/victory do not leave an empty framed box. */
body[data-orientation="portrait"][data-screen="death"] #stage-wrap,
body[data-orientation="portrait"][data-screen="win"] #stage-wrap {
  grid-template-rows: 1fr;
  grid-template-areas: "stage";
}
body[data-touch="off"][data-orientation="portrait"][data-screen="death"] #stage-wrap,
body[data-touch="off"][data-orientation="portrait"][data-screen="win"] #stage-wrap {
  grid-template-rows: 1fr;
  grid-template-areas: "stage";
}

body[data-contrast="high"] .toolbar,
body[data-contrast="high"] .help {
  background: #000;
  color: #fff;
}
body[data-contrast="high"] .brand,
body[data-contrast="high"] .credit,
body[data-contrast="high"] #version {
  color: #ffff00;
}
body[data-text-scale="2"] .help { font-size: 18px; }


.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.touch-cluster { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.cluster-grip {
  width: 44px; min-width: 44px; min-height: 32px; height: 32px;
  padding: 0; border-radius: 8px; letter-spacing: 0.12em;
  background: rgba(36, 30, 72, 0.85); color: #c8c0a0; font-size: 14px;
  cursor: grab; touch-action: none;
}
.cluster-grip:active { cursor: grabbing; background: #3a2f7a; }
#touch-left, #touch-actions { z-index: 3; }
#use, #atk { min-width: 32px; min-height: 32px; }

/* v27: portrait + touch keeps a reserved band under the vitals so the
   d-pad, USE, ATK, PAUSE and class pills never cover the tray. */
body[data-orientation="portrait"][data-touch="on"] #stage-wrap {
  grid-template-rows: 1fr var(--hud-h);
  grid-template-areas:
    "stage"
    "hud"
    "touch";
}
body[data-orientation="portrait"][data-touch="on"] #touch {
  display: flex;
  position: relative;
  top: auto;
  left: auto;
  right: auto;
  bottom: auto;
  pointer-events: auto;
  padding: var(--touch-pad) var(--touch-pad);
  z-index: 2;
  overflow: hidden;
  align-items: center;
  justify-content: space-between;
  gap: var(--touch-gap);
}
body[data-orientation="portrait"][data-touch="on"] #touch-left,
body[data-orientation="portrait"][data-touch="on"] #touch-actions {
  pointer-events: auto;
  position: relative;
  left: auto;
  top: auto;
  bottom: auto;
  right: auto;
}
body[data-orientation="portrait"][data-touch="on"] #touch-left {
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: var(--touch-gap);
}
body[data-orientation="portrait"][data-touch="on"] #touch-left #dpad { order: 0; }
body[data-orientation="portrait"][data-touch="on"] #touch-left #touch-heroes { order: 1; }
body[data-orientation="portrait"][data-touch="on"] #touch-heroes {
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 4px;
  justify-content: center;
}
/* Action cluster is a short row beside the stick, no extra chrome padding. */
body[data-orientation="portrait"][data-touch="on"] #touch-actions {
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: var(--touch-gap);
  background: transparent;
  border-radius: 0;
  padding: 0;
}
/* Drag handles are hidden in the reserved band so the d-pad + pills fit. */
body[data-orientation="portrait"][data-touch="on"] .cluster-grip {
  display: none;
}

/* v21: hide thumb clusters on death, victory, and the floor map. */
body[data-screen="death"] #touch,
body[data-screen="win"] #touch,
body[data-screen="map"] #touch {
  display: none !important;
  visibility: hidden;
  pointer-events: none;
}
body[data-orientation="portrait"][data-touch="on"][data-screen="death"] #stage-wrap,
body[data-orientation="portrait"][data-touch="on"][data-screen="win"] #stage-wrap {
  grid-template-rows: 1fr;
  grid-template-areas: "stage";
}

/* v22: collapse the reserved portrait HUD/touch band on the floor map so
   the stage fills the viewport the same way death/victory already do. */
body[data-orientation="portrait"][data-screen="map"] #stage-wrap,
body[data-orientation="portrait"][data-touch="on"][data-screen="map"] #stage-wrap,
body[data-touch="off"][data-orientation="portrait"][data-screen="map"] #stage-wrap {
  --hud-h: 0px;
  grid-template-rows: 1fr;
  grid-template-areas: "stage";
  padding-bottom: 0;
  gap: 0;
  min-height: 100%;
  height: 100%;
}
body[data-screen="map"] #hud {
  display: none !important;
  height: 0 !important;
  min-height: 0 !important;
  overflow: hidden;
}
body[data-orientation="portrait"][data-screen="map"] #stage {
  justify-self: stretch;
  align-self: stretch;
  width: 100%;
  height: 100%;
  max-height: 100%;
  min-height: 100%;
}
body[data-orientation="portrait"][data-screen="map"] #game {
  /* Fill the stage; backing-store size is still set in JS (no CSS bitmap scale). */
  margin: 0 auto;
}


/* v29: standard mobile overlay — virtual stick, round USE/ATK, pause icon.
   Controls sit on the playfield, never in a reserved band, never over the tray. */
#touch { pointer-events: none; }
#touch #pause,
#touch #touch-left,
#touch #touch-actions,
#touch #dpad,
#touch #use,
#touch #atk { pointer-events: auto; }

#touch-left.touch-stick-zone,
body[data-touch="on"] #touch-left {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 45%;
  display: block;
  background: transparent;
  padding: 0;
  margin: 0;
}
#dpad,
body[data-touch="on"] #dpad {
  position: absolute;
  left: var(--touch-pad);
  bottom: var(--touch-pad);
  width: var(--stick);
  height: var(--stick);
  border-radius: 50%;
  background: rgba(16, 14, 28, 0.30);
  border: 2px solid rgba(244, 234, 208, 0.38);
  box-shadow: none;
  image-rendering: auto;
}
#dpad .arm { display: none !important; }
#dpad .stick-base {
  display: block;
  position: absolute;
  inset: 0;
  border-radius: 50%;
  pointer-events: none;
}
#dpad .knob {
  position: absolute;
  width: var(--knob);
  height: var(--knob);
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: rgba(244, 234, 208, 0.58);
  border: 2px solid rgba(255, 224, 80, 0.75);
  box-shadow: 0 1px 4px rgba(0,0,0,0.35);
  pointer-events: none;
}
#dpad.active,
#dpad.pressed {
  background: rgba(16, 14, 28, 0.42);
  border-color: rgba(255, 224, 80, 0.7);
}
#dpad.active .knob,
#dpad.pressed .knob {
  background: rgba(255, 224, 80, 0.85);
  border-color: #fff4a8;
}

#touch-actions.touch-actions,
body[data-touch="on"] #touch-actions {
  position: absolute;
  right: var(--touch-pad);
  bottom: var(--touch-pad);
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  gap: var(--touch-gap);
  background: transparent;
  padding: 0;
  margin: 0;
  border: 0;
}
#use, #atk {
  font-family: Tiny5, monospace;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: #f4ead0;
  text-shadow: 1px 1px 0 rgba(16,14,28,0.85);
  border-radius: 50%;
  border: 2px solid rgba(244, 234, 208, 0.42);
  background: rgba(16, 14, 28, 0.34);
  box-shadow: none;
  image-rendering: auto;
  padding: 0;
}
#use {
  width: var(--use-w);
  height: var(--use-w);
  min-width: var(--use-w);
  min-height: var(--use-w);
  margin-bottom: 10px;
}
#atk {
  width: var(--atk-w);
  height: var(--atk-w);
  min-width: var(--atk-w);
  min-height: var(--atk-w);
  color: #ffe8c8;
  border-color: rgba(255, 224, 80, 0.45);
}
#use:hover, #atk:hover { background: rgba(16, 14, 28, 0.46); }
#use:active, #use.active {
  background: rgba(255, 224, 80, 0.32);
  transform: translateY(1px);
  border-color: #ffe050;
}
#atk:active, #atk.active {
  background: rgba(255, 224, 80, 0.42);
  transform: translateY(1px);
  border-color: #fff4a8;
  filter: none;
}

#pause.touch-pause,
body[data-touch="on"] #pause {
  position: absolute;
  top: var(--touch-pad);
  left: var(--touch-pad);
  width: var(--pause-w);
  height: var(--pause-w);
  min-width: var(--pause-w);
  min-height: var(--pause-w);
  padding: 0;
  border-radius: 8px;
  border: 2px solid rgba(244, 234, 208, 0.4);
  background: rgba(16, 14, 28, 0.34);
  color: transparent;
  box-shadow: none;
  z-index: 4;
}
#pause.touch-pause .pause-bars,
body[data-touch="on"] #pause .pause-bars {
  display: block;
  width: 12px;
  height: 14px;
  margin: 9px auto 0;
  border-left: 4px solid #ffe050;
  border-right: 4px solid #ffe050;
  box-sizing: border-box;
}
#pause.touch-pause:active,
#pause.touch-pause.active,
body[data-touch="on"] #pause:active {
  background: rgba(255, 224, 80, 0.32);
  transform: translateY(1px);
}

/* Hero class pills live in Pause, not on the playfield. */
#touch-heroes, .cluster-grip { display: none !important; }

/* Cancel leftover v28 reserved-band rules. */
body[data-orientation="portrait"][data-touch="on"] #touch-left,
body[data-orientation="portrait"][data-touch="on"] #touch-actions {
  position: absolute;
  background: transparent;
}


/* v29 override: leftover v27/v28 reserved-band rules must not create a
   third grid row or a flex band under the canvas. Overlay the stage only. */
body[data-orientation="portrait"][data-touch="on"] #stage-wrap {
  grid-template-columns: 1fr;
  grid-template-rows: 1fr var(--hud-h);
  grid-template-areas:
    "stage"
    "hud";
}
body[data-orientation="portrait"][data-touch="on"] #stage {
  grid-area: stage;
  align-items: flex-end;
  padding: 0;
}
body[data-orientation="portrait"][data-touch="on"] #hud {
  grid-area: hud;
}
body[data-orientation="portrait"][data-touch="on"] #touch {
  grid-area: stage;
  display: block;
  position: relative;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  margin: 0;
  overflow: visible;
  pointer-events: none;
  z-index: 3;
  background: transparent;
}
body[data-orientation="portrait"][data-touch="on"] #touch-left,
body[data-orientation="portrait"][data-touch="on"] #touch-actions,
body[data-orientation="portrait"][data-touch="on"] #dpad,
body[data-orientation="portrait"][data-touch="on"] #pause {
  position: absolute;
  pointer-events: auto;
}
