:root {
  --game-cream: #fff0c8;
  --game-ink: #24152f;
  --game-red: #d94d59;
  --game-orange: #ef8b42;
  --game-green: #5fb783;
  --game-blue: #63a9c4;
}

* {
  -webkit-tap-highlight-color: transparent;
}

body {
  overflow: hidden;
  touch-action: none;
  background: #15102c;
}

#stage {
  position: fixed;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  background: #15102c;
}

.game-hud {
  position: fixed;
  z-index: 15;
  top: max(0.65rem, env(safe-area-inset-top));
  left: max(0.65rem, env(safe-area-inset-left));
  right: max(0.65rem, env(safe-area-inset-right));
  display: grid;
  grid-template-columns: minmax(130px, 0.8fr) minmax(210px, 1.4fr) minmax(105px, 0.65fr) auto auto;
  gap: 0.55rem;
  align-items: start;
  pointer-events: none;
}

.hud-card {
  min-height: 62px;
  padding: 0.5rem 0.7rem 0.55rem;
  color: var(--game-cream);
  background: linear-gradient(160deg, rgba(42, 25, 55, 0.94), rgba(25, 18, 47, 0.9));
  border: 2px solid rgba(255, 240, 200, 0.28);
  border-radius: 8px 18px 8px 18px;
  box-shadow: 0 5px 0 rgba(11, 7, 25, 0.7), inset 0 1px rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(8px);
}

.hud-card strong { display: block; font-size: 0.94rem; line-height: 1.1; }
.eyebrow, .kicker { color: #efad65; font-size: 0.68rem; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase; }

.health-line {
  height: 8px;
  margin-top: 0.38rem;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 999px;
  background: rgba(0,0,0,.42);
}

.health-line i {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #e65f66, #efad65);
  transition: width 160ms linear;
}

.health-line.dragon i { background: linear-gradient(90deg, #70c68d, #d5c95d); }
.combo-pips { display: flex; gap: 4px; margin-top: .4rem; }
.combo-pips i { width: 15px; height: 7px; border-radius: 2px; background: rgba(255,255,255,.14); transform: skewX(-14deg); }
.combo-pips i.on { background: #efad65; box-shadow: inset 0 -2px rgba(81,36,23,.28); }

.hud-actions { display: flex; gap: .35rem; pointer-events: auto; }
.round-control {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 2px solid rgba(255,240,200,.28);
  border-radius: 50%;
  color: var(--game-cream);
  background: rgba(36,21,47,.9);
  font: 800 .67rem/1 "Baloo 2", sans-serif;
  box-shadow: 0 4px 0 rgba(9,6,20,.7);
  cursor: pointer;
}
.round-control:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(9,6,20,.7); }
.round-control.recording { color: #fff; background: var(--game-red); animation: recordPulse 1s ease-in-out infinite; }

.story-ribbon {
  position: fixed;
  z-index: 14;
  left: 50%;
  bottom: max(1rem, env(safe-area-inset-bottom));
  width: min(700px, calc(100% - 2rem));
  transform: translateX(-50%) rotate(-.4deg);
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: .7rem;
  padding: .55rem .85rem;
  color: var(--game-ink);
  background: var(--game-cream);
  border: 3px solid var(--game-ink);
  border-radius: 7px 18px 7px 18px;
  box-shadow: 6px 7px 0 rgba(19,11,31,.55);
  pointer-events: none;
  transition: opacity .2s, transform .25s;
}
.story-ribbon.hidden { opacity: 0; transform: translateX(-50%) translateY(20px) rotate(-.4deg); }
.story-ribbon p { margin: 0; font-weight: 700; line-height: 1.15; }
.story-speaker { padding: .28rem .45rem; color: #fff3d8; background: var(--game-red); font-size: .63rem; font-weight: 800; letter-spacing: .12em; border-radius: 4px; }

#touch { position: fixed; inset: 0; z-index: 20; display: none; pointer-events: none; }
body.touch #touch { display: block; }
#stick {
  position: absolute;
  left: max(1rem, env(safe-area-inset-left));
  bottom: max(1.1rem, env(safe-area-inset-bottom));
  width: 136px;
  height: 136px;
  border: 3.5px solid rgba(0, 229, 255, 0.65);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 229, 255, 0.12) 0%, rgba(36, 21, 47, 0.7) 80%);
  box-shadow: 0 0 20px rgba(0, 229, 255, 0.3), inset 0 0 15px rgba(0, 229, 255, 0.2);
  pointer-events: auto;
  touch-action: none;
  user-select: none;
  cursor: grab;
}
#stick:active {
  cursor: grabbing;
  border-color: rgba(0, 229, 255, 0.9);
}
#stick .knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 62px;
  height: 62px;
  margin: -31px;
  border: 3px solid #15102c;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #00f0ff 0%, #0066ff 70%, #002b80 100%);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.6), inset 0 2px 4px rgba(255, 255, 255, 0.6);
  display: grid;
  place-items: center;
  font-size: 1.4rem;
  transition: transform 0.03s ease-out;
}
.knob-crown {
  filter: drop-shadow(0 2px 3px rgba(0,0,0,0.8));
  pointer-events: none;
  transform: translateY(-1px);
}
.touch-actions {
  position: absolute;
  right: max(1rem, env(safe-area-inset-right));
  bottom: max(1.2rem, env(safe-area-inset-bottom));
  display: flex;
  align-items: flex-end;
  gap: 0.65rem;
  pointer-events: auto;
  user-select: none;
}
.touch-actions button {
  border: 3px solid var(--game-ink);
  border-radius: 50%;
  color: var(--game-ink);
  font: 800 0.85rem/1 "Baloo 2", sans-serif;
  box-shadow: 0 6px 0 rgba(12, 7, 23, 0.65);
  touch-action: none;
  cursor: pointer;
  transition: transform 0.06s ease, box-shadow 0.06s ease;
}
#fire {
  width: 96px;
  height: 96px;
  background: radial-gradient(circle at 34% 28%, #ffea88 0%, #ff8c00 45%, #d92b2b 100%);
  box-shadow: 0 6px 0 rgba(12, 7, 23, 0.65), 0 0 18px rgba(255, 140, 0, 0.5);
  color: #fff;
  text-shadow: 0 2px 3px rgba(0,0,0,0.7);
}
#windwave {
  width: 88px;
  height: 88px;
  background: radial-gradient(circle at 34% 28%, #a0f0ff 0%, #0099ff 50%, #0033aa 100%);
  color: #ffffff;
  font-size: 0.72rem;
  text-shadow: 0 2px 3px rgba(0,0,0,0.7);
  box-shadow: 0 6px 0 rgba(12, 7, 23, 0.65), 0 0 16px rgba(0, 153, 255, 0.5);
}
#spin { width: 70px; height: 70px; background: radial-gradient(circle at 35% 30%, #a2f2cc, #4cb082); }
#jump { width: 64px; height: 62px; background: radial-gradient(circle at 35% 30%, #bde4ff, #5198d0); }
.btn-punch { width: 70px; height: 70px; background: radial-gradient(circle at 35% 30%, #ff6644, #cc0000) !important; color: #fff !important; text-shadow: 0 2px 3px rgba(0,0,0,0.8); }
.btn-kick { width: 70px; height: 70px; background: radial-gradient(circle at 35% 30%, #ffaa22, #e65500) !important; color: #fff !important; text-shadow: 0 2px 3px rgba(0,0,0,0.8); }
/* The pedals only exist on a road, so they stay out of the arena entirely. */
.drive-only { display: none; }
body.driving .drive-only { display: block; }
/* Nothing in the mansion spins or kicks, so those two buttons step aside and
   leave the thumb a clear run at JUMP, SWING and FIREBALL. */
body.climbing #spin,
body.climbing #kick,
body.climbing #windwave { display: none; }
body.climbing #jump { width: 88px; height: 88px; font-size: .9rem; background: radial-gradient(circle at 35% 30%, #ffe1a8, #e08a2c); }
.btn-gas { width: 82px; height: 82px; background: radial-gradient(circle at 35% 30%, #b8f5a0, #2f9a3f) !important; color: #08240f !important; font-size: 0.95rem !important; box-shadow: 0 6px 0 rgba(12,7,23,.65), 0 0 16px rgba(74, 214, 96, 0.45) !important; }
.btn-brake { width: 74px; height: 74px; background: radial-gradient(circle at 35% 30%, #ffb3b3, #b32020) !important; color: #fff !important; font-size: 0.72rem !important; text-shadow: 0 2px 3px rgba(0,0,0,0.75); }
.touch-actions button:active { transform: translateY(4px) scale(0.96); box-shadow: 0 2px 0 rgba(12,7,23,.65); }

.overlay { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 1rem; overflow: auto; background: radial-gradient(circle at 50% 30%, rgba(67,44,83,.9), rgba(15,10,29,.97)); backdrop-filter: blur(8px); }
.overlay[hidden] { display: none; }
.sheet { width: min(760px, 100%); padding: clamp(1rem, 3vw, 1.7rem); color: var(--game-cream); background: linear-gradient(155deg, #33203f, #1b1533 75%); border: 3px solid rgba(255,240,200,.25); border-radius: 12px 32px 12px 32px; box-shadow: 12px 14px 0 rgba(8,5,18,.6), inset 0 1px rgba(255,255,255,.08); }
.start-sheet { width: min(1100px, 100%); display: grid; grid-template-columns: .9fr 1.1fr; gap: 1rem 1.4rem; }
.title-lockup h1 { margin: -.08em 0 .05em; color: #fff0c8; font: 400 clamp(3rem, 8vw, 5.4rem)/.88 "Chewy", cursive; letter-spacing: .01em; text-shadow: 0 6px 0 #8b3949, 0 10px 0 rgba(0,0,0,.35); transform: rotate(-2deg); }
.title-lockup p { max-width: 42ch; margin: .8rem 0 0; color: #d9c9c4; font-weight: 700; line-height: 1.35; }
.hero-stage { position: relative; min-height: 210px; overflow: hidden; background: radial-gradient(ellipse at 50% 85%, #887b58 0 22%, transparent 23%), linear-gradient(#7cb0b8 0 55%, #4f6e58 56%); border: 3px solid var(--game-ink); border-radius: 10px 26px 10px 26px; box-shadow: inset 0 -18px 35px rgba(18,18,32,.28); }
#preview { width: 100%; height: 100%; display: block; }
.hero-tag { position: absolute; top: .55rem; padding: .16rem .5rem; border: 2px solid var(--game-ink); border-radius: 5px; color: var(--game-ink); background: #efad65; font-size: .7rem; font-weight: 800; }
.hero-tag[hidden] { display: none; }
.hero-tag.p1 { left: .55rem; }
.hero-tag.p2 { left: 30%; transform: translateX(-50%); background: #ffc93c; }
.hero-tag.p3 { left: 60%; transform: translateX(-50%); background: #75c7b4; }
.hero-tag.p4 { right: .55rem; background: #f0b06a; }
.setup-grid { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.field { margin: 0; }
.color-field { padding: .45rem .65rem .6rem; border: 2px solid rgba(255,240,200,.18); border-radius: 10px; }
.color-field legend { padding: 0 .3rem; color: var(--muted); font-size: .72rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.swatches { display: flex; flex-wrap: wrap; gap: .4rem; }
.swatch { width: 32px; height: 32px; border: 3px solid transparent; border-radius: 8px; cursor: pointer; }
.swatch[aria-pressed="true"] { border-color: #fff0c8; transform: rotate(-5deg) scale(1.08); }
.mode-toggle { display: flex; align-items: center; gap: .65rem; padding: .5rem .65rem; border: 2px solid rgba(255,240,200,.18); border-radius: 10px; cursor: pointer; }
.mode-toggle input { width: 22px; height: 22px; accent-color: #75c7b4; }
.mode-toggle span, .mode-toggle small { display: block; }.mode-toggle small { color: var(--muted); line-height: 1.1; }
.start-button { grid-column: 1 / -1; justify-content: center; min-height: 52px; font-size: 1.05rem; }

/* The connection number: joining a room, and the email found without a login. */
.party-panel { grid-column: 1 / -1; display: grid; gap: .55rem; padding: .85rem .9rem 1rem; border: 2px solid rgba(255,240,200,.22); border-radius: 10px 26px 10px 26px; background: linear-gradient(150deg, rgba(99,169,196,.14), rgba(239,173,101,.08)); }
.party-panel h2 { margin: .05rem 0 0; font: 400 clamp(1.5rem, 4vw, 2.1rem)/1 "Chewy", cursive; color: #fff0c8; }
.party-panel p { margin: 0; line-height: 1.35; }
.party-panel .muted { font-size: .82rem; }
.party-row { display: grid; grid-template-columns: minmax(120px, 160px) 1fr; gap: .6rem .8rem; align-items: end; }
.party-code-field input { font: 800 1.5rem/1 "Baloo 2", sans-serif; letter-spacing: .3em; text-align: center; }
.party-buttons { display: flex; flex-wrap: wrap; gap: .4rem; }
.party-status { padding: .45rem .6rem; color: #ffe9c2; background: rgba(20,13,36,.55); border-left: 4px solid #efad65; border-radius: 4px; font-size: .84rem; font-weight: 700; }
.party-seats, .party-open { display: grid; gap: .35rem; margin: 0; padding: 0; list-style: none; }
.party-seats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.party-seats[hidden], .party-open[hidden] { display: none; }
.party-seats li { display: flex; align-items: center; gap: .4rem; padding: .35rem .55rem; border: 2px solid rgba(255,240,200,.16); border-radius: 8px; font-size: .82rem; font-weight: 700; }
.party-seats li.taken { background: rgba(117,199,180,.16); border-color: rgba(117,199,180,.4); }
.party-seats li.free { color: var(--muted); border-style: dashed; }
.party-seats b { color: #efad65; }
.party-seats small { color: var(--muted); font-weight: 700; }
.party-you { padding: 0 .3rem; color: var(--game-ink); background: #ffe500; border-radius: 4px; font-size: .68rem; font-style: normal; font-weight: 800; text-transform: uppercase; }
.party-open { grid-auto-flow: column; grid-auto-columns: max-content; overflow-x: auto; }
.party-email-field small { display: block; color: var(--muted); font-size: .74rem; font-weight: 700; }
.party-note { font-size: .76rem; }
.link-button { padding: 0; color: #efad65; background: none; border: 0; font: inherit; font-weight: 800; text-decoration: underline; cursor: pointer; }
.party-meter small { display: block; color: #d9c9c4; font-size: .72rem; font-weight: 700; }
.party-meter strong { font-family: "Baloo 2", sans-serif; font-size: 1.2rem; letter-spacing: .16em; }
.control-map { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, 1fr); gap: .35rem .8rem; padding-top: .2rem; border-top: 1px solid rgba(255,255,255,.1); }
.pregame-water-lab { grid-column: 1 / -1; }
.control-map p { margin: 0; color: #bfb1bd; font-size: .78rem; }
.compact-sheet { max-width: 470px; text-align: center; }.compact-sheet h1 { margin: .1rem 0; }
.center-row { justify-content: center; }
.ending-sheet { max-width: 980px; text-align: center; }
.ending-sheet h1 { font-family: "Chewy", cursive; font-size: clamp(2.3rem, 6vw, 4rem); font-weight: 400; margin: .1rem 0; }
.trophy { width: 94px; height: 94px; margin: -3.2rem auto .5rem; display: grid; place-items: center; color: #6a3b19; background: #f1c65d; border: 5px solid #6a3b19; border-radius: 42% 42% 50% 50%; font-size: 2.8rem; box-shadow: 0 9px 0 #8d5425, 0 14px 30px rgba(0,0,0,.35); transform: rotate(-4deg); }
.trophy.lost { filter: grayscale(.8); opacity: .65; }
.water-detector { margin: 1.5rem 0 .5rem; padding: clamp(.8rem, 2vw, 1.2rem); color: #d9f8f4; text-align: left; background: #071c23; border: 2px solid #4bc7b5; border-radius: 4px 28px 4px 28px; box-shadow: inset 0 0 0 5px #0d3038, 0 12px 0 rgba(2,10,15,.48); overflow: hidden; }
.water-detector[hidden] { display: none; }
.detector-heading { display: grid; grid-template-columns: 1fr auto; gap: 1rem; align-items: center; padding: .2rem .25rem 1rem; }
.detector-heading h2 { margin: .15rem 0 .25rem; color: #f5e9bd; font: 400 clamp(1.7rem, 4vw, 2.6rem)/1 "Chewy", cursive; letter-spacing: .02em; }
.detector-heading p { max-width: 68ch; margin: 0; color: #9bc2c0; font-size: .92rem; line-height: 1.35; }
.detector-dial { width: 74px; aspect-ratio: 1; display: grid; place-items: center; position: relative; border: 2px solid #4bc7b5; border-radius: 50%; background: repeating-radial-gradient(circle, transparent 0 7px, rgba(75,199,181,.13) 8px 9px); box-shadow: 0 0 24px rgba(75,199,181,.2); }
.detector-dial::before, .detector-dial::after { content: ""; position: absolute; background: rgba(75,199,181,.42); }
.detector-dial::before { width: 1px; height: 100%; }
.detector-dial::after { width: 100%; height: 1px; }
.detector-dial i { position: absolute; inset: 8px; border-radius: 50%; background: conic-gradient(from 20deg, transparent 0 75%, rgba(110,255,222,.65)); animation: detectorSweep 3.4s linear infinite; }
.detector-dial span { z-index: 1; color: #f5e9bd; font-size: .55rem; font-weight: 800; line-height: 1.05; letter-spacing: .12em; text-align: center; }
.detector-targets { display: grid; grid-template-columns: repeat(3, 1fr) auto; gap: .55rem; align-items: stretch; }
.detector-target, .scan-trigger { appearance: none; min-width: 0; color: #9bc2c0; text-align: left; background: #0d3038; border: 1px solid #2b6968; border-radius: 4px 14px 4px 14px; cursor: pointer; transition: transform .15s ease, border-color .15s ease, background .15s ease; }
.detector-target { padding: .65rem .75rem; }
.detector-target span { display: block; font-size: .62rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.detector-target strong { display: block; color: #d9f8f4; font-size: 1rem; }
.detector-target:hover, .detector-target:focus-visible { border-color: #8af4df; }
.detector-target.active { color: #071c23; background: #65dbc5; border-color: #c1fff3; transform: translateY(-2px); box-shadow: 0 4px 0 #174d50; }
.detector-target.active strong { color: #071c23; }
.scan-trigger { min-width: 142px; padding: .65rem .8rem; display: flex; align-items: center; justify-content: center; gap: .55rem; color: #1d1605; background: #f0c85e; border-color: #fff0b4; font: 800 .78rem/1 "Baloo 2", sans-serif; text-align: center; text-transform: uppercase; }
.scan-trigger i { width: 11px; height: 11px; border-radius: 50%; background: #133d3b; box-shadow: 0 0 0 4px rgba(19,61,59,.18); }
.scan-trigger:hover, .scan-trigger:focus-visible { transform: translateY(-2px); filter: brightness(1.08); }
.detector-screen { min-height: 330px; position: relative; margin-top: .65rem; overflow: hidden; background: linear-gradient(rgba(15,60,67,.94), rgba(7,28,35,.97)), repeating-linear-gradient(0deg, transparent 0 19px, rgba(101,219,197,.08) 20px); border: 1px solid #2b6968; border-radius: 3px 20px 3px 20px; }
.detector-screen::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(90deg, transparent 49.8%, rgba(101,219,197,.08) 50%, transparent 50.2%); }
.scan-beam { position: absolute; z-index: 3; inset: 0; pointer-events: none; opacity: 0; background: linear-gradient(90deg, transparent, rgba(151,255,232,.75), transparent); transform: translateX(-100%); }
.detector-screen.scanning .scan-beam { opacity: 1; animation: waterScan 1.15s ease-in-out; }
.scan-panel { position: relative; z-index: 1; padding: clamp(.8rem, 2vw, 1.15rem); }
.scan-panel[hidden] { display: none; }
.scan-summary { display: grid; grid-template-columns: auto 1fr auto; gap: .7rem; align-items: center; padding-bottom: .7rem; border-bottom: 1px dashed rgba(139,242,220,.25); }
.status-light { width: 14px; height: 14px; border-radius: 50%; }
.status-light.caution { background: #f0c85e; box-shadow: 0 0 0 5px rgba(240,200,94,.12), 0 0 18px rgba(240,200,94,.45); }
.status-light.good { background: #65dbc5; box-shadow: 0 0 0 5px rgba(101,219,197,.12), 0 0 18px rgba(101,219,197,.45); }
.scan-summary small { display: block; color: #79aaa8; font-size: .68rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.scan-summary strong { display: block; color: #f5e9bd; font-size: 1.05rem; }
.scan-summary b { padding: .25rem .45rem; color: #f0c85e; border: 1px solid currentColor; border-radius: 3px; font-size: .62rem; letter-spacing: .08em; }
#tapScan .scan-summary b { color: #65dbc5; }
.scan-explainer { margin: .75rem 0; color: #b6d4d1; font-size: .85rem; line-height: 1.45; }
.scan-explainer strong { color: #f5e9bd; }
.reading-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.reading-grid.arlington-readings, .reading-grid.grand-prairie-readings { grid-template-columns: repeat(4, 1fr); }
.reading { min-width: 0; padding: .65rem; background: rgba(4,20,26,.62); border-left: 3px solid #4bc7b5; }
.reading span, .reading small { display: block; color: #79aaa8; font-size: .67rem; line-height: 1.25; }
.reading strong { display: block; margin: .1rem 0; color: #f5e9bd; font: 400 1.45rem/1 "Chewy", cursive; }
.fix-strip { display: grid; grid-template-columns: auto 1fr; gap: .65rem; margin-top: .65rem; padding: .65rem .75rem; color: #b6d4d1; background: rgba(101,219,197,.08); border: 1px solid rgba(101,219,197,.25); font-size: .76rem; line-height: 1.4; }
.fix-strip strong { color: #65dbc5; text-transform: uppercase; letter-spacing: .06em; }
.source-row { display: flex; flex-wrap: wrap; gap: .45rem 1rem; margin-top: .65rem; }
.source-row a { color: #f0c85e; font-size: .74rem; font-weight: 800; text-underline-offset: 3px; }
.detector-note { margin: .7rem .2rem .1rem; color: #79aaa8; font-size: .69rem; line-height: 1.35; }
.detector-screen:not(.scanned) .reading, .detector-screen:not(.scanned) .fix-strip { opacity: .52; }
.detector-screen.scanned .reading { animation: readingReveal .4s both; }
.detector-screen.scanned .reading:nth-child(2) { animation-delay: .08s; }
.detector-screen.scanned .reading:nth-child(3) { animation-delay: .16s; }
.detector-screen.scanned .reading:nth-child(4) { animation-delay: .24s; }
.net-board { display: grid; grid-template-columns: .7fr 1.3fr; gap: 1rem; margin-top: 1.2rem; padding: .85rem; text-align: left; border-top: 2px dashed rgba(255,240,200,.2); }
.net-board h3 { margin: 0; }.net-board ol { margin: 0; max-height: 150px; overflow: auto; padding-left: 1.5rem; }

@keyframes recordPulse { 50% { transform: scale(.92); } }
@keyframes detectorSweep { to { transform: rotate(360deg); } }
@keyframes waterScan { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
@keyframes readingReveal { from { opacity: .35; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 760px) {
  .game-hud { grid-template-columns: 1fr 1.25fr auto auto; }
  .combo-meter { display: none; }
  .hud-actions { flex-direction: column; }
  .round-control { width: 38px; height: 38px; font-size: .58rem; }
  .start-sheet { grid-template-columns: 1fr; }
  .hero-stage { min-height: 170px; }
  .title-lockup h1 { font-size: clamp(3.2rem, 17vw, 5rem); }
  .setup-grid { grid-template-columns: 1fr; }
  .party-row { grid-template-columns: 1fr; }
  .party-seats { grid-template-columns: 1fr; }
  .control-map { grid-template-columns: 1fr; }
  .story-ribbon { bottom: calc(max(1rem, env(safe-area-inset-bottom)) + 122px); font-size: .82rem; }
  .story-ribbon p { max-height: 2.3em; overflow: hidden; }
  .detector-targets { grid-template-columns: repeat(2, 1fr); }
  .scan-trigger { grid-column: 1 / -1; min-height: 44px; }
  .reading-grid, .reading-grid.arlington-readings, .reading-grid.grand-prairie-readings { grid-template-columns: repeat(2, 1fr); }
  .net-board { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .hero-meter { display: none; }
  .game-hud { grid-template-columns: 1fr auto auto; }
  #stick { width: 112px; height: 112px; }
  #fire { width: 84px; height: 84px; }
  #spin { width: 62px; height: 62px; }
  #jump { width: 56px; height: 56px; font-size: .7rem; }
  .detector-heading { grid-template-columns: 1fr; }
  .detector-dial { display: none; }
  .detector-targets, .reading-grid, .reading-grid.arlington-readings, .reading-grid.grand-prairie-readings { grid-template-columns: 1fr; }
  .scan-trigger { grid-column: auto; }
  .scan-summary { grid-template-columns: auto 1fr; }
  .scan-summary b { grid-column: 2; width: fit-content; }
  .fix-strip { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .round-control.recording { animation: none; }
  .detector-dial i, .detector-screen.scanning .scan-beam, .detector-screen.scanned .reading { animation: none; }
}

/* ------------------------------------------------------------------ */
/* televisions, Nintendo Switch, and menus driven by a controller       */
/* ------------------------------------------------------------------ */

/* A television cuts its own edges off. Pulling the HUD in by a few percent is
   the standard fix, and it costs a player on a monitor nothing they can see.
   The Switch docked to a TV is the same screen with the same problem. */
body.tv-safe .game-hud {
  top: max(2.6vh, .6rem);
  left: max(3vw, .6rem);
  right: max(3vw, .6rem);
}
body.tv-safe .story-ribbon { bottom: max(6vh, 1.2rem); }
body.tv-safe #stick { left: max(3.6vw, 1rem); bottom: max(5vh, 1.1rem); }
body.tv-safe .touch-actions { right: max(3.6vw, 1rem); bottom: max(5vh, 1.2rem); }

/* Sitting ten feet from the screen, everything has to be a size bigger. */
body.nx .game-hud { font-size: 1.06rem; }
body.nx .hud-card strong { font-size: 1.14em; }
body.nx .story-ribbon { font-size: 1.1rem; max-width: min(760px, 88vw); }
body.nx .control-map { font-size: .96rem; }
body.nx .sheet { width: min(1180px, 94vw); }

/* Whatever the pad is pointing at has to be obvious from across the room, so
   the focus ring here is deliberately louder than a normal one. */
.overlay :focus-visible,
body.tv-safe .overlay :focus,
body.nx .overlay :focus {
  outline: 4px solid #00e5ff;
  outline-offset: 3px;
  border-radius: 8px;
  box-shadow: 0 0 0 8px rgba(0, 229, 255, .22);
}
