/* Extracted from functions/play.js. Keep route HTML thin; put play-page styling here. */
:root {
  --mazebench-topbar-height: 64px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  background-color: var(--bg, #070811);
  background-image:
    radial-gradient(ellipse 110% 60% at 50% -6%, rgba(var(--violet-rgb), 0.16), rgba(7, 8, 17, 0) 66%),
    linear-gradient(rgba(var(--cyan-rgb), 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(var(--cyan-rgb), 0.045) 1px, transparent 1px);
  background-size: 100% 100%, 46px 46px, 46px 46px;
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--font-body);
  margin: 0;
  min-height: 100dvh;
}
body.play-mode {
  background-image: none;
}

button,
input,
select,
textarea {
  font: inherit;
}
html.play-mode,
body.play-mode {
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
}
html.play-mode *,
body.play-mode * {
  caret-color: transparent !important;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none !important;
  -webkit-user-drag: none !important;
  -webkit-user-select: none !important;
  -moz-user-select: none !important;
  -ms-user-select: none !important;
  user-select: none !important;
}
#game-root,
#game-root .play-shell,
#game-root .play-stage,
#game-root .maze-frame,
#game-root .maze-canvas,
.mazebench-controls,
.mazebench-controls *,
.mazebench-controls button {
  caret-color: transparent !important;
  -webkit-tap-highlight-color: transparent !important;
  -webkit-touch-callout: none !important;
  -webkit-user-drag: none !important;
  -webkit-user-select: none !important;
  -moz-user-select: none !important;
  -ms-user-select: none !important;
  touch-action: none !important;
  user-select: none !important;
}
.topbar {
  height: var(--mazebench-topbar-height);
}
.account-actions {
  min-width: 96px;
}
.custom-world-meta {
  left: 50%;
  max-width: min(52vw, 520px);
  overflow: hidden;
  pointer-events: none;
  position: absolute;
  text-align: center;
  text-overflow: ellipsis;
  transform: translateX(-50%);
  white-space: nowrap;
}
.custom-world-meta strong { font-weight: 700; }
.custom-world-meta span { color: var(--muted); font-size: 12px; }
.leaderboard-link,
a.save-button {
  align-items: center;
  background: rgba(124, 143, 255, 0.05);
  border: 1px solid rgba(124, 143, 255, 0.32);
  border-radius: var(--radius);
  box-shadow: none;
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  font-weight: 600;
  justify-content: center;
  min-height: 36px;
  padding: 7px 14px;
  text-decoration: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}
.leaderboard-link:hover,
.leaderboard-link:focus-visible,
a.save-button:hover,
a.save-button:focus-visible {
  background: rgba(124, 143, 255, 0.12);
  border-color: rgba(124, 143, 255, 0.85);
  box-shadow: 0 0 16px rgba(124, 143, 255, 0.3);
  color: #ffffff;
  outline: none;
  transform: none;
}
.account-button { min-width: 96px; }
.play-picker {
  display: grid;
  gap: 18px;
  margin: 0 auto;
  max-width: 860px;
  padding: 36px 18px 56px;
  width: 100%;
}
.picker-head {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
}
.picker-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.save-list {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}
.save-row {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  display: grid;
  gap: 12px;
  grid-template-columns: auto 1fr auto;
  padding: 12px 14px;
}
.save-thumb {
  align-items: center;
  aspect-ratio: 1;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  height: 54px;
  justify-content: center;
  overflow: hidden;
  width: 54px;
}
.save-thumb img {
  display: block;
  height: 100%;
  image-rendering: pixelated;
  object-fit: cover;
  width: 100%;
}
.save-thumb.is-empty::before {
  background: #111;
  content: "";
  display: block;
  height: 8px;
  width: 8px;
}
.save-meta {
  display: grid;
  gap: 4px;
  min-width: 0;
}
	      .save-row-actions {
	        display: flex;
	        flex-wrap: wrap;
	        gap: 8px;
	        justify-content: flex-end;
	      }
	      .submit-progress {
	        display: grid;
	        gap: 6px;
	        grid-column: 1 / -1;
	      }
	      .submit-progress-label {
	        color: var(--muted);
	        font-family: var(--font-mono);
	        font-size: 12px;
	      }
	      .submit-progress-track {
	        border: 1px solid var(--line-strong);
	        border-radius: 999px;
	        height: 12px;
	        overflow: hidden;
	        position: relative;
	      }
	      .submit-progress-track span {
	        animation: submitProgressSlide 920ms ease-in-out infinite;
	        background: var(--yellow);
	        display: block;
	        height: 100%;
	        width: 38%;
	      }
	      @keyframes submitProgressSlide {
	        0% { transform: translateX(-105%); }
	        100% { transform: translateX(270%); }
	      }
	      .status {
	        min-height: 20px;
	      }
#game-root {
  --mazebench-stage-bottom: 0px;
  --mazebench-stage-left: 0px;
  --mazebench-stage-right: 0px;
  --mazebench-stage-top: var(--mazebench-topbar-height);
  min-height: calc(100dvh - var(--mazebench-topbar-height));
  overflow: hidden;
}
#game-root .play-shell {
  display: block;
  height: calc(100dvh - var(--mazebench-topbar-height));
  overflow: hidden;
  padding: 0;
  position: fixed;
  left: 0;
  right: 0;
  top: var(--mazebench-topbar-height);
  width: 100vw;
}
#game-root .play-header,
#game-root .mazebench-runtime-toggles {
  display: none;
}
#game-root .play-stage {
  align-items: center;
  display: grid;
  height: 100%;
  justify-content: center;
  left: 0;
  margin: 0;
  overflow: hidden;
  padding: 0;
  place-items: center;
  position: absolute;
  top: 0;
  width: 100vw;
}
#game-root .maze-frame {
  aspect-ratio: 1;
  background: transparent !important;
  border: 1px solid rgba(var(--cyan-rgb), 0.55) !important;
  border-radius: 14px !important;
  box-shadow: 0 0 34px rgba(var(--cyan-rgb), 0.28) !important;
  box-sizing: border-box;
  height: min(calc(100dvh - var(--mazebench-topbar-height) - 28px), calc(100vw - 28px));
  margin: 0 auto;
  max-height: 100%;
  max-width: 100%;
  overflow: hidden;
  padding: 0 !important;
  position: relative;
  width: min(calc(100dvh - var(--mazebench-topbar-height) - 28px), calc(100vw - 28px));
}
#game-root .maze-frame.is-loading {
  border-color: transparent !important;
  box-shadow: none !important;
}
#game-root .maze-canvas {
  border: 0 !important;
  border-radius: 0 !important;
  box-sizing: border-box;
  display: block;
  max-height: 100%;
  max-width: 100%;
  transition: opacity 180ms ease;
}
#game-root .maze-frame.is-loading .maze-canvas,
#game-root .maze-frame.is-ready .maze-canvas {
  opacity: 0;
}
#game-root .maze-frame.is-ready .maze-canvas {
  animation: mazeCanvasAppear 180ms ease 360ms forwards;
}
#game-root .maze-load-art {
  align-items: center;
  background: var(--bg);
  display: flex;
  inset: 0;
  justify-content: center;
  pointer-events: none;
  position: absolute;
  z-index: 2;
}
#game-root .maze-load-square {
  background: var(--ink);
  box-sizing: border-box;
  height: var(--loader-square-size, 100%);
  width: var(--loader-square-size, 100%);
  transform: scale(0);
  transform-origin: center;
}
#game-root .maze-load-progress {
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  bottom: 18px;
  height: 8px;
  left: 50%;
  overflow: hidden;
  position: absolute;
  transform: translateX(-50%);
  width: min(180px, 52%);
}
#game-root .maze-load-progress span {
  animation: mazeLoadProgress 840ms cubic-bezier(0.65, 0, 0.35, 1) infinite;
  background: var(--yellow);
  display: block;
  height: 100%;
  width: 42%;
}
#game-root .maze-frame:not(.is-loading):not(.is-ready) .maze-load-art {
  display: none;
}
#game-root .maze-frame.is-ready .maze-load-square {
  animation: mazeBlackSquareGrow 360ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
#game-root .maze-frame.is-ready .maze-load-art {
  animation: mazeViewportFade 180ms ease 360ms forwards;
}
#game-root .maze-frame.is-ready .maze-load-progress {
  display: none;
}
@keyframes mazeLoadProgress {
  from {
    transform: translateX(-110%);
  }
  to {
    transform: translateX(250%);
  }
}
@keyframes mazeBlackSquareGrow {
  from {
    transform: scale(0);
  }
  to {
    transform: scale(1);
  }
}
@keyframes mazeViewportFade {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}
@keyframes mazeCanvasAppear {
  to {
    opacity: 1;
  }
}
.mazebench-controls {
  bottom: 0;
  display: block;
  left: 0;
  pointer-events: none;
  position: fixed;
  right: 0;
  top: var(--mazebench-topbar-height);
  z-index: 30;
}
#game-root.is-loading .mazebench-controls {
  display: none !important;
}
.top-play-controls {
  align-items: flex-start;
  display: flex;
  gap: 8px;
  justify-content: space-between;
  left: 16px;
  pointer-events: none;
  position: absolute;
  right: 16px;
  top: 16px;
}
.top-play-right {
  display: grid;
  gap: 8px;
  justify-items: center;
}
.top-play-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.keyboard-hint {
  align-items: center;
  background: rgba(10, 14, 32, 0.82);
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  display: inline-flex;
  font-family: var(--font-mono);
  font-size: 12px;
  min-height: 34px;
  padding: 7px 10px;
  white-space: nowrap;
}
.save-status,
.save-status:hover,
.save-status:focus-visible,
.save-status:active {
  align-items: center;
  background: rgba(10, 14, 32, 0.82);
  border: 0;
  border-radius: 9px;
  box-shadow: none;
  color: var(--ink);
  cursor: default;
  display: inline-flex;
  font: inherit;
  font-size: 12px;
  font-style: italic;
  justify-content: center;
  min-height: 22px;
  padding: 0 6px;
  transform: none;
  white-space: nowrap;
}
.save-status.can-retry {
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.camera-pad {
  bottom: 16px;
  display: grid;
  position: absolute;
}
.control-pad {
  bottom: 16px;
  display: grid;
  grid-template-columns: repeat(3, 52px);
  grid-template-rows: repeat(3, 52px);
  justify-content: center;
  left: var(--mazebench-control-pad-left, 16px);
  position: absolute;
}
.camera-pad {
  left: var(--mazebench-camera-pad-left, auto);
  right: var(--mazebench-camera-pad-right, 16px);
}
.dpad-center {
  background: rgba(10, 14, 32, 0.82);
  border: 1px solid rgba(var(--cyan-rgb), 0.4);
  border-radius: 0;
  box-shadow: none;
  grid-column: 2;
  grid-row: 2;
  min-height: 52px;
  padding: 0;
  transform: none;
}
.control-cluster {
  display: flex;
  gap: 8px;
  justify-content: center;
}
.mazebench-controls .control-button,
.mazebench-controls .dpad-center,
.keyboard-hint {
  pointer-events: auto;
}
.control-button {
  align-items: center;
  background: rgba(10, 14, 32, 0.82);
  border: 1px solid rgba(var(--cyan-rgb), 0.4);
  border-radius: 10px;
  box-shadow: 0 0 14px rgba(var(--cyan-rgb), 0.1);
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-weight: 700;
  height: 44px;
  justify-content: center;
  min-height: 0;
  min-width: 52px;
  padding: 0 12px;
  text-decoration: none;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  white-space: nowrap;
}
.dpad-button,
.dpad-button:hover,
.dpad-button:focus-visible,
.dpad-button:active {
  background: rgba(10, 14, 32, 0.82);
  border-radius: 0;
  box-shadow: none;
  color: transparent;
  font-size: 0;
  height: 52px;
  min-height: 0;
  min-width: 52px;
  padding: 0;
  position: relative;
  transform: none;
}
.dpad-button {
  border: 1px solid rgba(var(--cyan-rgb), 0.4);
}
.dpad-button::before {
  content: "";
  display: block;
  height: 0;
  width: 0;
}
.dpad-button:is([data-move="up"], [data-camera="up"]) {
  border-bottom: 0;
  grid-column: 2;
  grid-row: 1;
}
.dpad-button:is([data-move="up"], [data-camera="up"])::before {
  border-bottom: 18px solid #e7eaff;
  border-left: 11px solid transparent;
  border-right: 11px solid transparent;
}
.dpad-button:is([data-move="left"], [data-camera="left"]) {
  border-right: 0;
  grid-column: 1;
  grid-row: 2;
}
.dpad-button:is([data-move="left"], [data-camera="left"])::before {
  border-bottom: 11px solid transparent;
  border-right: 18px solid #e7eaff;
  border-top: 11px solid transparent;
}
.dpad-button:is([data-move="right"], [data-camera="right"]) {
  border-left: 0;
  grid-column: 3;
  grid-row: 2;
}
.dpad-button:is([data-move="right"], [data-camera="right"])::before {
  border-bottom: 11px solid transparent;
  border-left: 18px solid #e7eaff;
  border-top: 11px solid transparent;
}
.dpad-button:is([data-move="down"], [data-camera="down"]) {
  border-top: 0;
  grid-column: 2;
  grid-row: 3;
}
.dpad-button:is([data-move="down"], [data-camera="down"])::before {
  border-left: 11px solid transparent;
  border-right: 11px solid transparent;
  border-top: 18px solid #e7eaff;
}
.secondary-controls {
  display: grid;
  gap: 8px;
  justify-items: end;
}
.file-controls {
  display: flex;
  gap: 8px;
}
.control-button:active {
  background: rgba(var(--cyan-rgb), 0.18);
  border-color: rgba(var(--cyan-rgb), 0.9);
  box-shadow: inset 0 0 14px rgba(var(--cyan-rgb), 0.2);
  color: #ffffff;
  outline: none;
}
.world-map-overlay {
  align-items: center;
  background: rgba(5, 6, 15, 0);
  backdrop-filter: blur(0);
  -webkit-backdrop-filter: blur(0);
  display: grid;
  inset: 0;
  justify-items: center;
  opacity: 0;
  padding: 18px;
  pointer-events: none;
  position: fixed;
  transition:
    opacity 180ms ease,
    background-color 180ms ease,
    backdrop-filter 180ms ease,
    -webkit-backdrop-filter 180ms ease;
  z-index: 45;
}
.world-map-overlay.is-open {
  background: rgba(5, 6, 15, 0.9);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 1;
  pointer-events: auto;
}
.world-map-overlay.is-closing {
  pointer-events: none;
}
	      .world-run-prompt {
	        align-items: center;
	        background: rgba(46, 42, 32, 0.45);
	        display: grid;
	        inset: 0;
	        justify-items: center;
	        padding: 18px;
	        pointer-events: auto;
	        position: fixed;
	        z-index: 70;
	      }
	      .world-run-prompt-card {
	        background: var(--paper);
	        border: 1px solid var(--line-strong);
	        border-radius: var(--radius-lg);
	        box-shadow: var(--shadow-lg);
	        display: grid;
	        gap: 14px;
	        max-width: min(92vw, 420px);
	        padding: 20px;
	      }
	      .world-run-prompt-card h2 {
	        font-family: var(--font-display);
	        font-size: 17px;
	        font-weight: 700;
	        letter-spacing: 0.02em;
	        text-transform: uppercase;
	      }
	      .world-run-prompt-actions {
	        display: flex;
	        flex-wrap: wrap;
	        gap: 8px;
	      }
.world-map-panel {
  display: grid;
  gap: 12px;
  justify-items: center;
  max-height: calc(100dvh - var(--mazebench-topbar-height) - 36px);
  max-width: min(92vw, 820px);
  overflow: auto;
  overscroll-behavior: contain;
  touch-action: pan-x pan-y;
  width: max-content;
}
.world-map-bar {
  align-items: center;
  background: rgba(10, 13, 30, 0.92);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  display: flex;
  gap: 8px;
  justify-content: space-between;
  margin: 0 14px;
  padding: 8px 8px 8px 14px;
}
.world-map-stage {
  justify-self: center;
  padding: 14px;
  position: relative;
  width: max-content;
}
.world-map-backdrop {
  display: block;
  filter: drop-shadow(0 0 16px rgba(var(--cyan-rgb), 0.3));
  left: 14px;
  overflow: visible;
  pointer-events: none;
  position: absolute;
  top: 14px;
  z-index: 0;
}
.world-map-backdrop path {
  fill: rgba(11, 14, 32, 0.92);
  stroke: rgba(var(--cyan-rgb), 0.85);
  stroke-linejoin: round;
  stroke-width: 2;
}
.controls-overlay {
  z-index: 75;
}
/* ---- Home hero over the 3D world ---- */
#game-root.is-overview .mazebench-controls {
  display: none !important;
}
#game-root.is-fullbleed .maze-frame {
  aspect-ratio: auto;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  height: calc(100dvh - var(--mazebench-topbar-height));
  max-height: none;
  max-width: none;
  width: 100vw;
}
#game-root.is-fullbleed .maze-canvas {
  height: 100% !important;
  max-height: none;
  max-width: none;
  transition: none;
  width: 100% !important;
}
#game-root.is-fullbleed .maze-load-progress {
  display: none;
}
/* Loading screen — a fully black screen with a small white loading bar,
   shown only while the world downloads/builds, then faded out. */
.home-splash {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  transition: opacity 0.45s ease;
}
.home-splash.is-hidden {
  opacity: 0;
  pointer-events: none;
}
.home-splash-bar {
  width: clamp(140px, 30vw, 240px);
  height: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  overflow: hidden;
}
.home-splash-bar-fill {
  width: 38%;
  height: 100%;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
  animation: mbLoadBar 1s ease-in-out infinite;
}
@keyframes mbLoadBar {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(285%); }
}
@media (prefers-reduced-motion: reduce) {
  .home-splash { transition: none; }
  .home-splash-bar-fill { animation-duration: 1.6s; }
}
.home-hero {
  inset: var(--mazebench-topbar-height) 0 0 0;
  pointer-events: none;
  position: fixed;
  transition: opacity 0.6s ease;
  z-index: 40;
}
.home-hero.is-leaving {
  opacity: 0;
}
/* Once the overlay is fading out for play, its full-stage click catcher
   must not swallow gameplay clicks. */
.home-hero.is-leaving .home-boot-hit {
  pointer-events: none;
}
/* ============================================================
   Vector-boot scene copied verbatim from
   maze-bench-logo-vector-boot-no-flash.html (sun + maze + wordmark +
   CRT), minus the grid landscape and the tagline, layered over the live
   3D world. Scoped under .mb-crt; base state hidden so nothing flashes
   before .home-hero.is-run replays the construction.
   ============================================================ */
.mb-crt {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
  border-radius: 26px;
}
.mb-crt .jitter { position: absolute; inset: 0; z-index: 1; }
.mb-crt svg.scene { width: 100%; height: 100%; display: block; }
/* CRT overlays */
.mb-crt .scan {
  position: absolute; inset: 0; z-index: 5; pointer-events: none;
  background-image:
    repeating-linear-gradient(to bottom, rgba(0,0,0,.32) 0 1px, rgba(0,0,0,0) 1px 3px),
    repeating-linear-gradient(to right, rgba(0,0,0,.15) 0 1px, rgba(0,0,0,0) 1px 3px);
}
.mb-crt .vig {
  position: absolute; inset: 0; z-index: 6; pointer-events: none; border-radius: 26px;
  background: radial-gradient(ellipse at center, rgba(0,0,0,0) 52%, rgba(0,0,0,.42) 88%, rgba(0,0,0,.6) 100%);
  box-shadow: inset 0 0 130px rgba(0,0,0,.68), inset 0 0 30px rgba(0,0,0,.55);
}
/* ---- Narrow / mobile: bigger boot logo. Desktop is untouched. ---- */
@media (max-width: 640px) {
  .mb-crt svg.scene { transform: scale(1.5); transform-origin: center; }
}
/* Sun */
.mb-crt .halo { opacity: 0; }
/* Dark disc behind the sun's bands (same treatment as the wordmark
   frame) so the world edges don't show through the gaps. */
.mb-crt .sun-bg { fill: #05060a; fill-opacity: 0; }
.mb-crt .sun-outline {
  fill: none; stroke: #ffb32e; stroke-width: 2; stroke-dasharray: 1; stroke-dashoffset: 1;
  filter: drop-shadow(0 0 6px rgba(255,179,46,.6));
}
.mb-crt .bands { filter: drop-shadow(0 0 14px rgba(255,92,57,.5)); }
.mb-crt .band { transform-box: fill-box; transform-origin: left center; transform: scaleX(0); }
/* Maze */
.mb-crt .mazeG { filter: drop-shadow(0 0 1.5px rgba(190,252,255,.9)) drop-shadow(0 0 9px rgba(52,231,240,.55)); }
.mb-crt .wall { fill: none; stroke: #34e7f0; stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; }
.mb-crt .beams { filter: drop-shadow(0 0 7px rgba(170,250,255,.95)); }
.mb-crt .beam { fill: none; stroke: #eaffff; stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: .02 .98; opacity: 0; }
/* Push-block + target */
.mb-crt .blockp { fill: #ffd15c; transform-box: fill-box; transform-origin: center; transform: scale(0); filter: drop-shadow(0 0 8px rgba(255,209,92,.8)); }
.mb-crt .targetp { fill: none; stroke: #ff49d9; stroke-width: 3; stroke-linejoin: round; transform-box: fill-box; transform-origin: center; transform: scale(0); filter: drop-shadow(0 0 8px rgba(255,73,217,.8)); }
/* Wordmark lockup (tagline dropped) */
.mb-crt .frame { fill: #05060a; fill-opacity: 0; stroke: #ffb32e; stroke-width: 3; stroke-dasharray: 1; stroke-dashoffset: 1; filter: drop-shadow(0 0 8px rgba(255,179,46,.45)); }
.mb-crt .word { filter: drop-shadow(0 0 2px rgba(255,209,92,.85)) drop-shadow(0 0 16px rgba(255,141,35,.45)); }
.mb-crt .w {
  font-family: 'Arial Rounded MT Bold','Helvetica Rounded','Trebuchet MS',Verdana,system-ui,sans-serif;
  font-weight: 900; font-size: 66px; letter-spacing: 6px; text-anchor: middle;
  paint-order: stroke; stroke-width: 3; stroke-linejoin: round; opacity: 0;
}
.mb-crt .wm { fill: #ffd15c; stroke: #ffd15c; }
.mb-crt .wr { fill: #ff2fb0; stroke: #ff2fb0; mix-blend-mode: screen; }
.mb-crt .wb { fill: #34e7f0; stroke: #34e7f0; mix-blend-mode: screen; }
.mb-crt .bar { fill: #ff49d9; transform-box: fill-box; transform-origin: left center; transform: scaleX(0); filter: drop-shadow(0 0 9px rgba(255,73,217,.75)); }
/* Full-stage click catcher: "press anything" via pointer. */
.home-boot-hit,
.home-boot-hit:hover,
.home-boot-hit:focus,
.home-boot-hit:focus-visible {
  position: absolute;
  inset: 0;
  z-index: 3;
  appearance: none;
  /* Override the global button styling so this full-stage catcher never
     flashes a blue hover/focus overlay over the world. */
  background: transparent;
  border: 0;
  box-shadow: none;
  outline: none;
  margin: 0;
  padding: 0;
  cursor: pointer;
  pointer-events: auto;
}
.home-boot-hit:disabled {
  cursor: default;
  pointer-events: none;
}
.home-boot-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
/* ---- Boot construction timeline (adapted from the file's body.run;
       grid-landscape + tagline dropped, rebased so the sun paints in
       immediately with the edge reveal and the wordmark "sign" follows
       once the sun is up), gated on is-run ---- */
.home-hero.is-run .sun-rise { animation: mbRise 1.3s cubic-bezier(.16,.84,.3,1) 0s both; }
.home-hero.is-run .sun-bg { animation: mbSunbg .5s linear .1s both; }
.home-hero.is-run .halo { animation: mbHaloin .8s ease .35s both, mbHalobreathe 6s ease-in-out 2.8s infinite; }
.home-hero.is-run .sun-outline { animation: mbTrace .85s ease-in-out .1s both; }
.home-hero.is-run .band { animation: mbGrowx .45s cubic-bezier(.25,0,.2,1) var(--dl) both; }
.home-hero.is-run .bands { animation: mbBandsbreathe 5s ease-in-out 2.9s infinite; }
.home-hero.is-run .wall { animation: mbTrace var(--td) linear var(--dl) both; }
.home-hero.is-run .beam { animation: mbTrace var(--td) linear var(--dl) both, mbBeamlife var(--td) linear var(--dl) both; }
.home-hero.is-run .mazeG { animation: mbMazebreathe 4.6s ease-in-out 3s infinite; }
.home-hero.is-run .blockp { animation: mbPop .32s ease-out 1.5s both; }
.home-hero.is-run .targetp { animation: mbPop .32s ease-out 1.6s both; }
.home-hero.is-run .frame { animation: mbTrace .55s ease-in-out 1.65s both, mbFramefill .35s linear 1.9s both; }
.home-hero.is-run .wr { animation: mbChromL .45s linear 2.0s both, mbWrtick 5s step-end 3.4s infinite; }
.home-hero.is-run .wb { animation: mbChromR .45s linear 2.0s both, mbWbtick 5s step-end 3.4s infinite; }
.home-hero.is-run .wm { animation: mbWordsnap .45s linear 2.0s both; }
.home-hero.is-run .bar { animation: mbGrowx .3s cubic-bezier(.2,0,.2,1) 2.45s both; }
.home-hero.is-run .mb-crt { animation: mbHum 3.4s linear 2.9s infinite; }
.home-hero.is-run .jitter { animation: mbTick 5s step-end 3.4s infinite; }
.home-hero.is-run .scan { animation: mbCrawl 7s linear 0s infinite; }
@keyframes mbTrace { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes mbBeamlife { 0% { opacity: 0; } 4% { opacity: 1; } 88% { opacity: 1; } 100% { opacity: 0; } }
@keyframes mbGrowx { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes mbRise { from { transform: translateY(175px); } to { transform: translateY(0); } }
@keyframes mbHaloin { from { opacity: 0; } to { opacity: .4; } }
@keyframes mbPop { 0% { transform: scale(0); } 70% { transform: scale(1.28); } 100% { transform: scale(1); } }
@keyframes mbFramefill { from { fill-opacity: 0; } to { fill-opacity: .82; } }
@keyframes mbSunbg { from { fill-opacity: 0; } to { fill-opacity: .82; } }
@keyframes mbWordsnap {
  0% { opacity: 0; transform: translate(-18px, 6px); animation-timing-function: step-end; }
  18% { opacity: 1; transform: translate(12px, -5px); animation-timing-function: step-end; }
  36% { opacity: .65; transform: translate(-8px, 3px); animation-timing-function: step-end; }
  55% { opacity: 1; transform: translate(4px, -2px); animation-timing-function: step-end; }
  75% { opacity: 1; transform: translate(-2px, 1px); animation-timing-function: step-end; }
  100% { opacity: 1; transform: translate(0, 0); }
}
@keyframes mbChromL {
  0% { opacity: 0; transform: translate(-30px, 6px); animation-timing-function: step-end; }
  15% { opacity: .85; transform: translate(-22px, -5px); animation-timing-function: step-end; }
  40% { opacity: .6; transform: translate(-13px, 3px); animation-timing-function: step-end; }
  70% { opacity: .85; transform: translate(-7px, -1px); animation-timing-function: step-end; }
  100% { opacity: .75; transform: translate(-2.5px, 0); }
}
@keyframes mbChromR {
  0% { opacity: 0; transform: translate(30px, -6px); animation-timing-function: step-end; }
  15% { opacity: .85; transform: translate(22px, 5px); animation-timing-function: step-end; }
  40% { opacity: .6; transform: translate(13px, -3px); animation-timing-function: step-end; }
  70% { opacity: .85; transform: translate(7px, 1px); animation-timing-function: step-end; }
  100% { opacity: .75; transform: translate(2.5px, 0); }
}
@keyframes mbHum {
  0%, 100% { opacity: 1; }
  11% { opacity: .988; } 13% { opacity: 1; }
  37% { opacity: .978; } 39% { opacity: 1; }
  71% { opacity: .99; } 73% { opacity: 1; }
}
@keyframes mbHalobreathe { 0%, 100% { opacity: .4; } 50% { opacity: .56; } }
@keyframes mbBandsbreathe { 0%, 100% { opacity: 1; } 50% { opacity: .88; } }
@keyframes mbMazebreathe { 0%, 100% { opacity: 1; } 55% { opacity: .86; } }
@keyframes mbTick {
  0%, 95.8% { transform: translate(0, 0); }
  96% { transform: translate(4px, -1px); }
  96.6% { transform: translate(-3px, 1px); }
  97.2% { transform: translate(1.5px, 0); }
  97.8%, 100% { transform: translate(0, 0); }
}
@keyframes mbWrtick {
  0%, 95.8% { transform: translate(-2.5px, 0); }
  96% { transform: translate(-9px, 1px); }
  97% { transform: translate(-5px, 0); }
  97.8%, 100% { transform: translate(-2.5px, 0); }
}
@keyframes mbWbtick {
  0%, 95.8% { transform: translate(2.5px, 0); }
  96% { transform: translate(9px, -1px); }
  97% { transform: translate(5px, 0); }
  97.8%, 100% { transform: translate(2.5px, 0); }
}
@keyframes mbCrawl { from { background-position: 0 0, 0 0; } to { background-position: 0 6px, 0 0; } }
@media (prefers-reduced-motion: reduce) {
  .home-hero.is-run .sun-rise, .home-hero.is-run .halo, .home-hero.is-run .sun-bg,
  .home-hero.is-run .sun-outline,
  .home-hero.is-run .band, .home-hero.is-run .bands, .home-hero.is-run .wall,
  .home-hero.is-run .beam, .home-hero.is-run .mazeG, .home-hero.is-run .blockp,
  .home-hero.is-run .targetp, .home-hero.is-run .frame, .home-hero.is-run .wr,
  .home-hero.is-run .wb, .home-hero.is-run .wm, .home-hero.is-run .bar,
  .home-hero.is-run .mb-crt, .home-hero.is-run .jitter, .home-hero.is-run .scan { animation: none; }
  .mb-crt .halo { opacity: .4; }
  .mb-crt .sun-outline, .mb-crt .wall, .mb-crt .frame { stroke-dashoffset: 0; }
  .mb-crt .frame, .mb-crt .sun-bg { fill-opacity: .82; }
  .mb-crt .band, .mb-crt .bar { transform: scaleX(1); }
  .mb-crt .blockp, .mb-crt .targetp { transform: scale(1); }
  .mb-crt .w { opacity: 1; }
  .mb-crt .wr { transform: translate(-2.5px, 0); }
  .mb-crt .wb { transform: translate(2.5px, 0); }
}
/* Bottom prompt carries its own scrim so it reads over bright edges. */
.home-boot-footer {
  position: absolute;
  bottom: clamp(26px, 7vh, 74px);
  left: 0;
  right: 0;
  pointer-events: none;
  text-align: center;
  z-index: 4;
}
.home-boot-status,
.home-boot-continue {
  font-family: var(--font-mono);
  letter-spacing: 0.22em;
  margin: 0;
  text-transform: uppercase;
  white-space: nowrap;
}
.home-boot-status {
  color: var(--muted);
  font-size: 12px;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.9);
}
.home-boot-continue {
  backdrop-filter: blur(2px);
  background: rgba(3, 6, 12, 0.62);
  border: 1px solid rgba(var(--cyan-rgb), 0.35);
  border-radius: 999px;
  box-shadow: 0 0 22px rgba(0, 0, 0, 0.55), 0 0 18px rgba(var(--cyan-rgb), 0.18);
  color: #eaffff;
  display: none;
  opacity: 0;
  font-size: clamp(13px, 1.5vw, 15px);
  padding: 10px 22px;
  text-shadow: 0 0 10px rgba(var(--cyan-rgb), 0.7);
}
.home-hero.is-ready .home-boot-status {
  display: none;
}
/* Fade in, then a gentle breathing pulse. */
.home-hero.is-ready .home-boot-continue {
  display: inline-block;
  animation: mbContinueIn 0.7s ease-out both, bootpulse 2.6s ease-in-out 0.7s infinite;
}
/* While the boot logo is still assembling, keep "Press anything to
   continue" hidden until the whole sequence finishes (.is-booted). */
.home-hero.is-run:not(.is-booted) .home-boot-continue {
  display: none;
}
@keyframes mbContinueIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes bootpulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.72; }
}
@media (prefers-reduced-motion: reduce) {
  .home-hero.is-ready .home-boot-continue { animation: none; opacity: 1; }
}
/* ---- Home save-file popup ---- */
.home-file-panel {
  width: min(94vw, 480px);
}
.home-file-list {
  display: grid;
  gap: 6px;
}
.home-file-row,
.home-file-row:hover,
.home-file-row:focus-visible {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: flex-start;
  min-height: 0;
  padding: 8px 10px;
  text-align: left;
  white-space: normal;
}
.home-file-row .save-thumb {
  flex: none;
}
.home-file-meta {
  display: grid;
  gap: 3px;
  min-width: 0;
}
.home-file-meta strong {
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.home-file-meta span {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11.5px;
}
.controls-panel {
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: grid;
  gap: 18px;
  max-height: calc(100dvh - var(--mazebench-topbar-height) - 36px);
  overflow: auto;
  overscroll-behavior: contain;
  padding: 22px 24px;
  touch-action: pan-x pan-y;
  width: min(92vw, 920px);
}
.controls-panel-bar {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: space-between;
}
.controls-section {
  display: grid;
  gap: 10px;
  min-width: 0;
}
.controls-section h3 {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.controls-binding-list,
.controls-option-list {
  display: grid;
  gap: 8px;
}
.controls-binding-row,
.controls-option-row {
  align-items: center;
  background: rgba(10, 14, 32, 0.34);
  border: 1px solid rgba(var(--cyan-rgb), 0.13);
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr) auto;
  min-height: 40px;
  padding: 5px 6px 5px 10px;
}
.controls-binding-row span,
.controls-option-row span {
  font-size: 13px;
  line-height: 1.25;
  min-width: 0;
}
.key-button,
.option-button {
  height: 32px;
  font-family: var(--font-mono);
  font-size: 12px;
  min-width: 74px;
  padding: 0 10px;
}
.key-button.is-listening {
  border-color: rgba(var(--amber-rgb), 0.9);
  box-shadow: 0 0 12px rgba(var(--amber-rgb), 0.35);
  color: var(--amber);
}
.controls-note {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}
.controls-footer {
  display: flex;
  justify-content: flex-end;
}
@media (min-width: 760px) {
  .controls-panel {
    align-items: start;
    grid-template-columns: minmax(0, 1.55fr) minmax(260px, 0.95fr);
  }
  .controls-panel-bar,
  .controls-footer {
    grid-column: 1 / -1;
  }
  .controls-section:first-of-type {
    grid-column: 1;
    grid-row: 2 / span 3;
  }
  .controls-section:nth-of-type(2),
  .controls-section:nth-of-type(3) {
    grid-column: 2;
  }
  .controls-binding-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 759px) {
  .controls-panel {
    padding: 18px;
    width: min(94vw, 620px);
  }
}
@media (max-width: 560px) {
  .controls-binding-row,
  .controls-option-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .key-button,
  .option-button {
    min-width: 72px;
  }
}
.world-map-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.world-map-grid {
  background: transparent; /* styles.css paints the editor grid black */
  border: 0;
  display: grid;
  gap: 0;
  grid-auto-rows: var(--world-map-tile-size, 82px);
  grid-template-columns: repeat(var(--world-map-columns, 1), var(--world-map-tile-size, 82px));
  padding: 0;
  position: relative;
  z-index: 1;
}
.world-map-cell,
.world-map-cell:hover,
.world-map-cell:focus-visible,
.world-map-cell:active {
  align-items: center;
  background: var(--bg-2);
  border: 0;
  border-radius: 0;
  box-shadow: none;
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-size: 0;
  height: var(--world-map-tile-size, 82px);
  justify-content: center;
  min-height: 0;
  overflow: hidden;
  padding: 0;
  position: relative;
  transform: none;
  touch-action: manipulation;
  width: var(--world-map-tile-size, 82px);
}
.world-map-cell.is-current {
  outline: 2px solid var(--cyan);
  outline-offset: -2px;
  z-index: 1;
}
.world-map-thumb {
  display: block;
  height: 100%;
  image-rendering: pixelated;
  object-fit: cover;
  width: 100%;
}
.world-map-cell-label {
  align-items: center;
  background: rgba(5, 6, 15, 0.78);
  bottom: 0;
  color: var(--ink);
  display: flex;
  font-family: var(--font-mono);
  font-size: 10px;
  justify-content: center;
  left: 0;
  min-height: 17px;
  position: absolute;
  right: 0;
}
.world-map-cell:not(:disabled):hover::after,
.world-map-cell:not(:disabled):focus-visible::after {
  border: 2px solid var(--cyan);
  box-shadow: inset 0 0 12px rgba(var(--cyan-rgb), 0.4);
  content: "";
  inset: 0;
  pointer-events: none;
  position: absolute;
}
.dpad-button:active::before,
.dpad-button.is-active::before {
  filter: invert(1);
}
.dpad-button:active,
.dpad-button.is-active {
  background: rgba(var(--cyan-rgb), 0.9);
}
@media (hover: hover) and (pointer: fine) {
  .control-button:hover,
  .control-button:focus-visible {
    background: rgba(var(--cyan-rgb), 0.12);
    border-color: rgba(var(--cyan-rgb), 0.9);
    box-shadow: 0 0 16px rgba(var(--cyan-rgb), 0.3);
    color: #ffffff;
    outline: none;
  }
  .dpad-button:hover,
  .dpad-button:focus-visible {
    background: rgba(var(--cyan-rgb), 0.16);
    border-color: rgba(var(--cyan-rgb), 0.9);
  }
}
@media (max-width: 760px) {
  /* Keep Play available during a run without crowding the room title. */
  body.play-mode .topbar-nav .nav-dropdown,
  body.play-mode .topbar-nav .nav-link:not(.play-nav-link) {
    display: none;
  }
}
@media (max-width: 560px) {
  .topbar { padding: 0 10px; }
  .save-row {
    grid-template-columns: auto 1fr;
  }
  .save-row .save-button {
    grid-column: 2;
    justify-self: start;
  }
  .save-row-actions {
    grid-column: 2;
    justify-content: flex-start;
  }
}
@media (hover: none) and (pointer: coarse) {
  #game-root .play-shell {
    align-content: stretch;
    padding: 0;
  }
  #game-root .play-stage {
    bottom: var(--mazebench-stage-bottom);
    height: auto;
    left: var(--mazebench-stage-left);
    min-height: 0;
    padding: 0;
    position: fixed;
    right: var(--mazebench-stage-right);
    top: var(--mazebench-stage-top);
    width: auto;
  }
  .mazebench-controls {
    bottom: 0;
    display: block;
    left: 0;
    pointer-events: none;
    position: fixed;
    right: 0;
    top: var(--mazebench-topbar-height);
    z-index: 30;
  }
  .top-play-controls {
    display: flex;
    gap: 8px;
    justify-content: space-between;
    left: 12px;
    position: absolute;
    right: 12px;
    top: 12px;
  }
  .keyboard-hint {
    display: none;
  }
  .save-status {
    background: rgba(10, 14, 32, 0.82);
    border: 1px solid var(--line-strong);
    border-radius: 9px;
    min-height: 34px;
    padding: 7px 10px;
  }
  .top-play-actions,
  .camera-controls,
  .top-play-right {
    display: flex;
    gap: 8px;
  }
  .top-play-actions .control-button {
    min-width: 96px;
  }
  .control-pad {
    bottom: max(12px, env(safe-area-inset-bottom));
    left: 12px;
    position: absolute;
  }
  .camera-pad {
    bottom: max(12px, env(safe-area-inset-bottom));
    display: grid;
    left: auto;
    pointer-events: auto;
    position: absolute;
    right: 12px;
  }
  .mazebench-controls .control-button,
  .mazebench-controls .dpad-center {
    pointer-events: auto;
  }
  #game-root {
    overflow: hidden;
    touch-action: none;
  }
}
@media (hover: none) and (pointer: coarse) and (orientation: landscape) {
  .control-pad {
    bottom: auto;
    top: var(--mazebench-dpad-top, calc(var(--mazebench-topbar-height) + 92px));
  }
  .camera-pad {
    bottom: auto;
    top: var(--mazebench-dpad-top, calc(var(--mazebench-topbar-height) + 92px));
  }
}
@media (max-width: 380px) {
  .control-pad {
    grid-template-columns: repeat(3, 46px);
    grid-template-rows: repeat(3, 46px);
  }
  .dpad-button,
  .dpad-center {
    height: 46px;
    min-height: 46px;
    min-width: 46px;
  }
  .control-button {
    min-width: 46px;
    padding-left: 9px;
    padding-right: 9px;
  }
}
