/* Theme tokens used throughout the layout. */
@font-face {
  font-family: "GooeySlime";
  src: url("./GooeySlime-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --page-bg: #ffffff;
  --ink: #111111;
  --ink-soft: rgba(17, 17, 17, 0.55);
  --font-base: "GooeySlime", "Trebuchet MS", sans-serif;
  --maze-line: rgba(17, 17, 17, 0.08);
  --maze-line-strong: rgba(17, 17, 17, 0.14);
  --maze-fill: rgba(17, 17, 17, 0.035);
  --mood-shadow: rgba(0, 0, 0, 0.16);
  --mood-vignette: rgba(0, 0, 0, 0.35);
  --mood-haze: rgba(0, 0, 0, 0.08);
  --neon-cyan: #111111;
  --neon-pink: #333333;
  --neon-green: #222222;
  --panel: rgba(255, 255, 255, 0.92);
  --panel-border: rgba(0, 0, 0, 0.08);
  --shadow: rgba(0, 0, 0, 0.12);
  --frame-bg: rgba(255, 255, 255, 0.96);
  --frame-border: rgba(0, 0, 0, 0.12);
  --hint-bg: linear-gradient(120deg, rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.08));
  --hint-border: rgba(0, 0, 0, 0.12);
  --hint-shadow: rgba(0, 0, 0, 0.12);
  --fullscreen-bg: rgba(255, 255, 255, 0.92);
  --fullscreen-border: rgba(0, 0, 0, 0.14);
  --fullscreen-shadow: rgba(0, 0, 0, 0.12);
  --fullscreen-hover-bg: rgba(255, 255, 255, 0.98);
  --control-border: rgba(0, 0, 0, 0.2);
  --control-shadow: rgba(0, 0, 0, 0.14);
  --control-shadow-hover: rgba(0, 0, 0, 0.16);
  --control-bg: linear-gradient(130deg, rgba(255, 255, 255, 0.98), rgba(0, 0, 0, 0.04));
  --control-active-bg: linear-gradient(130deg, rgba(0, 0, 0, 0.1), rgba(255, 255, 255, 0.1));
  --focus-ring: rgba(0, 0, 0, 0.4);
  --menu-backdrop: #ffffff;
  --menu-panel: rgba(255, 255, 255, 0.94);
  --menu-border: rgba(0, 0, 0, 0.12);
  --menu-section: rgba(255, 255, 255, 0.9);
  --menu-accent: #f0a23b;
  --menu-accent-ink: #111111;
  --menu-muted: rgba(17, 17, 17, 0.55);
  --editor-panel: rgba(255, 255, 255, 0.92);
  --editor-border: rgba(0, 0, 0, 0.12);
  --editor-accent: #0f6570;
  --editor-danger: #8b2e2e;
}

/* Consistent sizing model for easier layout math. */
* {
  box-sizing: border-box;
}

/* Center the experience and set the default type stack. */
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-base);
  background: var(--page-bg);
  color: var(--ink);
  position: relative;
}

.menu-body {
  background: var(--menu-backdrop), var(--page-bg);
}

body::before {
  content: none;
}

body::after {
  content: none;
}

/* Overall page grid for header + game frame. */
.page {
  width: min(96vw, 1680px);
  padding: 32px 16px 40px;
  display: grid;
  gap: 18px;
  position: relative;
  z-index: 1;
}

/* Title row with the name and control legend. */
.title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  animation: rise 0.8s ease both;
  text-align: center;
}

.title-main {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

.title h1 {
  margin: 0 0 6px;
  font-family: var(--font-base);
  font-size: clamp(28px, 4vw, 42px);
  letter-spacing: 1.8px;
  text-transform: uppercase;
}

.title p {
  margin: 0;
  color: var(--ink-soft);
}

/* Game frame that clips the canvas and overlays. */
.frame {
  position: relative;
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  aspect-ratio: 16 / 9;
  border-radius: 22px;
  overflow: hidden;
  box-shadow: 0 26px 60px rgba(0, 0, 0, 0.12);
  border: 1px solid var(--frame-border);
  background: var(--frame-bg);
  animation: rise 0.8s ease 0.2s both;
}

/* Canvas stretches to fill the frame while JS controls resolution. */
canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* Frame buttons (theme + fullscreen). */
.frame-actions {
  position: absolute;
  top: 18px;
  right: 20px;
  display: flex;
  gap: 10px;
  z-index: 5;
}

.frame-actions button,
.frame-actions .frame-link {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--fullscreen-border);
  background: var(--fullscreen-bg);
  color: var(--ink);
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  box-shadow: 0 10px 26px var(--fullscreen-shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.frame-actions button:hover,
.frame-actions .frame-link:hover {
  background: var(--fullscreen-hover-bg);
  box-shadow: 0 14px 28px var(--fullscreen-shadow);
}

.frame-actions button:active,
.frame-actions .frame-link:active {
  transform: translateY(1px);
}

.frame-actions button:focus-visible,
.frame-actions .frame-link:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

/* Control buttons below the game canvas. */
.controls {
  display: grid;
  gap: 18px;
  animation: rise 0.8s ease 0.25s both;
}

.control-group {
  background: var(--panel);
  padding: 16px 18px;
  border-radius: 16px;
  border: 1px solid var(--panel-border);
  box-shadow: 0 18px 38px var(--shadow);
}

.control-group h2 {
  margin: 0 0 12px;
  font-size: 0.95rem;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.control-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.control-button {
  position: relative;
  border: 1px solid var(--control-border);
  border-radius: 999px;
  padding: 8px 12px;
  background: var(--control-bg);
  color: var(--ink);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  cursor: pointer;
  box-shadow: 0 10px 18px var(--control-shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  user-select: none;
  touch-action: manipulation;
}

.control-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 28px var(--control-shadow-hover);
}

.control-button:active {
  transform: translateY(1px);
}

.control-button[aria-pressed="true"] {
  background: var(--control-active-bg);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2), 0 6px 14px rgba(0, 0, 0, 0.12);
}

.control-button.is-flash {
  animation: controlFlash 0.35s ease;
}

.control-button:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page-bg: radial-gradient(circle at 22% 10%, #1a1c22 0%, #0f1115 55%, #0a0c10 100%);
  --ink: #f3f3f3;
  --ink-soft: rgba(243, 243, 243, 0.6);
  --maze-line: rgba(243, 243, 243, 0.08);
  --maze-line-strong: rgba(243, 243, 243, 0.14);
  --maze-fill: rgba(243, 243, 243, 0.04);
  --mood-shadow: rgba(0, 0, 0, 0.38);
  --mood-vignette: rgba(0, 0, 0, 0.6);
  --mood-haze: rgba(0, 0, 0, 0.18);
  --neon-cyan: #f3f3f3;
  --neon-pink: #cfd2d6;
  --neon-green: #e5e7eb;
  --panel: rgba(20, 22, 26, 0.92);
  --panel-border: rgba(255, 255, 255, 0.08);
  --shadow: rgba(0, 0, 0, 0.5);
  --frame-bg: rgba(18, 20, 24, 0.96);
  --frame-border: rgba(255, 255, 255, 0.08);
  --hint-bg: linear-gradient(120deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.04));
  --hint-border: rgba(255, 255, 255, 0.12);
  --hint-shadow: rgba(0, 0, 0, 0.55);
  --fullscreen-bg: rgba(20, 22, 26, 0.9);
  --fullscreen-border: rgba(255, 255, 255, 0.12);
  --fullscreen-shadow: rgba(0, 0, 0, 0.6);
  --fullscreen-hover-bg: rgba(28, 30, 36, 0.95);
  --control-border: rgba(255, 255, 255, 0.18);
  --control-shadow: rgba(0, 0, 0, 0.5);
  --control-shadow-hover: rgba(0, 0, 0, 0.6);
  --control-bg: linear-gradient(130deg, rgba(255, 255, 255, 0.08), rgba(0, 0, 0, 0.35));
  --control-active-bg: linear-gradient(130deg, rgba(255, 255, 255, 0.16), rgba(0, 0, 0, 0.45));
  --focus-ring: rgba(255, 255, 255, 0.45);
  --toggle-bg: rgba(20, 22, 26, 0.92);
  --toggle-border: rgba(255, 255, 255, 0.14);
  --toggle-shadow: rgba(0, 0, 0, 0.6);
  --menu-backdrop: radial-gradient(circle at top, rgba(30, 33, 40, 0.9), rgba(8, 10, 14, 0.82));
  --menu-panel: rgba(18, 20, 24, 0.96);
  --menu-border: rgba(255, 255, 255, 0.12);
  --menu-section: rgba(24, 26, 32, 0.92);
  --menu-accent: #f0b357;
  --menu-accent-ink: #0f1115;
  --menu-muted: rgba(243, 243, 243, 0.6);
  --editor-panel: rgba(18, 20, 24, 0.94);
  --editor-border: rgba(255, 255, 255, 0.12);
  --editor-accent: #63b0a9;
  --editor-danger: #c96a6a;
}

:root[data-theme="light"] {
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --page-bg: radial-gradient(circle at 22% 10%, #1a1c22 0%, #0f1115 55%, #0a0c10 100%);
    --ink: #f3f3f3;
    --ink-soft: rgba(243, 243, 243, 0.6);
    --maze-line: rgba(243, 243, 243, 0.08);
    --maze-line-strong: rgba(243, 243, 243, 0.14);
    --maze-fill: rgba(243, 243, 243, 0.04);
    --mood-shadow: rgba(0, 0, 0, 0.38);
    --mood-vignette: rgba(0, 0, 0, 0.6);
    --mood-haze: rgba(0, 0, 0, 0.18);
    --neon-cyan: #f3f3f3;
    --neon-pink: #cfd2d6;
    --neon-green: #e5e7eb;
    --panel: rgba(20, 22, 26, 0.92);
    --panel-border: rgba(255, 255, 255, 0.08);
    --shadow: rgba(0, 0, 0, 0.5);
    --frame-bg: rgba(18, 20, 24, 0.96);
    --frame-border: rgba(255, 255, 255, 0.08);
    --hint-bg: linear-gradient(120deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.04));
    --hint-border: rgba(255, 255, 255, 0.12);
    --hint-shadow: rgba(0, 0, 0, 0.55);
    --fullscreen-bg: rgba(20, 22, 26, 0.9);
    --fullscreen-border: rgba(255, 255, 255, 0.12);
    --fullscreen-shadow: rgba(0, 0, 0, 0.6);
    --control-border: rgba(255, 255, 255, 0.18);
    --control-shadow: rgba(0, 0, 0, 0.5);
    --control-shadow-hover: rgba(0, 0, 0, 0.6);
    --control-bg: linear-gradient(130deg, rgba(255, 255, 255, 0.08), rgba(0, 0, 0, 0.35));
    --control-active-bg: linear-gradient(130deg, rgba(255, 255, 255, 0.16), rgba(0, 0, 0, 0.45));
    --focus-ring: rgba(255, 255, 255, 0.45);
    --menu-backdrop: radial-gradient(circle at top, rgba(30, 33, 40, 0.9), rgba(8, 10, 14, 0.82));
    --menu-panel: rgba(18, 20, 24, 0.96);
    --menu-border: rgba(255, 255, 255, 0.12);
    --menu-section: rgba(24, 26, 32, 0.92);
    --menu-accent: #f0b357;
    --menu-accent-ink: #0f1115;
    --menu-muted: rgba(243, 243, 243, 0.6);
    --editor-panel: rgba(18, 20, 24, 0.94);
    --editor-border: rgba(255, 255, 255, 0.12);
    --editor-accent: #63b0a9;
    --editor-danger: #c96a6a;
  }
}

.menu-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--menu-backdrop);
  backdrop-filter: blur(10px);
  z-index: 6;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.menu-overlay[data-visible="true"] {
  opacity: 1;
  pointer-events: auto;
}

.menu-card {
  width: min(92vw, 640px);
  background: var(--frame-bg);
  border: 1px solid var(--frame-border);
  border-radius: 24px;
  padding: 24px;
  display: grid;
  gap: 18px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.25);
  animation: rise 0.4s ease both;
}

.menu-card--story {
  width: min(92vw, 860px);
  max-height: 84vh;
}

.story-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 10px;
  max-height: min(55vh, 520px);
  overflow: auto;
  padding-right: 6px;
}

.story-grid .story-level {
  font-size: 0.75rem;
  padding: 8px 10px;
}

.story-grid .story-level[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.menu-page {
  align-content: start;
  position: relative;
}

.menu-page .title {
  flex-direction: column;
}

.menu-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
}

.menu-shell {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(320px, 720px);
  gap: 28px;
  align-items: stretch;
  width: min(96vw, 1200px);
  margin: 0 auto;
}

.menu-shell--single {
  grid-template-columns: 1fr;
  justify-items: center;
}

.menu-card--page {
  width: 100%;
  max-width: 720px;
}

.maze-custom-shell {
  position: relative;
  width: min(92vw, 980px);
  aspect-ratio: 1 / 1;
  border-radius: 24px;
  border: 1px solid var(--frame-border);
  overflow: hidden;
  background: var(--frame-bg);
  box-shadow: 0 28px 60px rgba(0, 0, 0, 0.18);
}

.maze-custom-shell canvas {
  width: 100%;
  height: 100%;
  display: block;
  background: #ffffff;
}

.maze-custom-overlay {
  position: absolute;
  top: 18px;
  left: 18px;
  width: min(360px, 92%);
  background: var(--menu-panel);
  border: 1px solid var(--menu-border);
  border-radius: 20px;
  padding: 16px;
  display: grid;
  gap: 12px;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.25);
}

.menu-header--split {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.maze-builder-subtitle {
  margin: 0;
  color: var(--menu-muted);
  font-size: 0.85rem;
}

.maze-custom-overlay.is-minimized {
  width: min(220px, 70%);
}

.maze-custom-overlay.is-minimized .maze-builder-subtitle,
.maze-custom-overlay.is-minimized .menu-section {
  display: none;
}

.menu-graphic {
  position: relative;
  border-radius: 24px;
  border: 1px solid var(--frame-border);
  background: linear-gradient(140deg, var(--frame-bg), rgba(0, 0, 0, 0.04));
  box-shadow: 0 28px 60px rgba(0, 0, 0, 0.18);
  min-height: 360px;
  overflow: hidden;
  display: grid;
  place-items: center;
  isolation: isolate;
  color: var(--ink-soft);
}

.menu-graphic::before {
  content: "";
  position: absolute;
  inset: -20% 30% auto -10%;
  height: 55%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.75), rgba(255, 255, 255, 0));
  opacity: 0.9;
}

.menu-graphic::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(var(--panel-border) 1px, transparent 1px),
    linear-gradient(90deg, var(--panel-border) 1px, transparent 1px);
  background-size: 36px 36px;
  opacity: 0.2;
}

.menu-graphic-core {
  width: clamp(160px, 26vw, 240px);
  aspect-ratio: 1;
  border-radius: 46% 54% 58% 42% / 55% 45% 55% 45%;
  background: radial-gradient(circle at 30% 28%, rgba(255, 255, 255, 0.95), rgba(0, 0, 0, 0.05) 60%);
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.18);
  position: relative;
  z-index: 2;
  animation: menuFloat 6s ease-in-out infinite;
}

.menu-graphic-core::after {
  content: "";
  position: absolute;
  inset: 14%;
  border-radius: 50%;
  background: radial-gradient(circle at 45% 40%, rgba(255, 255, 255, 0.7), rgba(0, 0, 0, 0) 68%);
  opacity: 0.75;
}

.menu-graphic-ring {
  position: absolute;
  width: min(80%, 360px);
  height: min(80%, 360px);
  border-radius: 50%;
  border: 1px dashed var(--panel-border);
  z-index: 1;
}

.menu-graphic-ring--inner {
  width: min(48%, 210px);
  height: min(48%, 210px);
  border-style: solid;
  opacity: 0.55;
}

.menu-graphic-flow {
  position: absolute;
  width: 60%;
  height: 8px;
  background: linear-gradient(90deg, transparent, currentColor, transparent);
  border-radius: 999px;
  transform: translateY(120%) rotate(-6deg);
  opacity: 0.35;
  z-index: 1;
}

.menu-note {
  margin: 0;
  color: var(--menu-muted);
  font-size: 0.85rem;
  text-align: center;
}

.menu-header h2 {
  margin: 0 0 6px;
  font-family: var(--font-base);
  letter-spacing: 1px;
}

.menu-header p {
  margin: 0;
  color: var(--menu-muted);
}

.menu-section {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 16px;
  display: grid;
  gap: 12px;
  box-shadow: 0 14px 26px rgba(0, 0, 0, 0.12);
}

.menu-section h3 {
  margin: 0;
  font-size: 0.95rem;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.menu-field {
  display: grid;
  gap: 6px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.menu-field input,
.menu-field select {
  border-radius: 12px;
  border: 1px solid var(--panel-border);
  padding: 8px 10px;
  font-family: inherit;
  font-size: 0.9rem;
  background: rgba(255, 255, 255, 0.8);
  color: var(--ink);
}

.menu-field input[type="range"] {
  padding: 0;
  height: 28px;
  accent-color: var(--menu-accent);
}

:root[data-theme="dark"] .menu-field input,
:root[data-theme="dark"] .menu-field select {
  background: rgba(10, 12, 16, 0.8);
  color: var(--ink);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .menu-field input,
  :root:not([data-theme]) .menu-field select {
    background: rgba(10, 12, 16, 0.8);
    color: var(--ink);
  }
}

.menu-inline {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  align-items: end;
}

.menu-button,
.menu-primary,
.menu-close {
  position: relative;
  border: 1px solid var(--control-border);
  border-radius: 999px;
  padding: 8px 12px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  cursor: pointer;
  background: var(--control-bg);
  color: var(--ink);
  box-shadow: 0 10px 18px var(--control-shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  user-select: none;
  touch-action: manipulation;
}

.menu-primary {
  background: var(--control-active-bg);
}

.menu-button:hover,
.menu-primary:hover,
.menu-close:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 28px var(--control-shadow-hover);
}

.menu-button:active,
.menu-primary:active,
.menu-close:active {
  transform: translateY(1px);
}

.menu-button:focus-visible,
.menu-primary:focus-visible,
.menu-close:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.menu-empty {
  margin: 0;
  color: var(--menu-muted);
  font-size: 0.85rem;
}

.editor-panel {
  position: absolute;
  top: 18px;
  left: 18px;
  width: min(340px, 92%);
  max-height: calc(100% - 36px);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--editor-panel);
  border: 1px solid var(--editor-border);
  border-radius: 20px;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.25);
  overflow: auto;
  z-index: 4;
  opacity: 0;
  transform: translateX(-12px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.editor-panel[data-visible="true"] {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

.maze-panel {
  display: none;
  gap: 12px;
}

.maze-panel[data-visible="true"] {
  display: grid;
}

.maze-header h2 {
  margin: 0;
  font-size: 1.1rem;
  font-family: var(--font-base);
  letter-spacing: 0.8px;
}

.maze-header p {
  margin: 4px 0 0;
  color: var(--menu-muted);
  font-size: 0.85rem;
}

.maze-section {
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--panel-border);
  padding-top: 10px;
}

.maze-panel progress {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.65);
  accent-color: var(--menu-accent);
}

.maze-status {
  font-size: 0.82rem;
  color: var(--menu-muted);
}

.editor-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.editor-header h2 {
  margin: 0;
  font-size: 1.1rem;
  font-family: var(--font-base);
  letter-spacing: 0.8px;
}

.editor-header p {
  margin: 4px 0 0;
  color: var(--menu-muted);
  font-size: 0.85rem;
}

.editor-exit {
  border-radius: 999px;
  border: 1px solid var(--editor-border);
  padding: 8px 14px;
  font-family: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  background: transparent;
}

.editor-section {
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--editor-border);
  padding-top: 10px;
}

.editor-section-title {
  margin: 0;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--menu-muted);
}

.editor-field {
  display: grid;
  gap: 6px;
  font-size: 0.78rem;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.editor-field input,
.editor-field select {
  border-radius: 12px;
  border: 1px solid var(--editor-border);
  padding: 8px 10px;
  font-family: inherit;
  font-size: 0.9rem;
  background: rgba(255, 255, 255, 0.8);
  color: var(--ink);
}

.editor-field input[type="range"] {
  padding: 0;
  height: 26px;
  width: 100%;
  background: transparent;
  accent-color: var(--editor-accent);
}

:root[data-theme="dark"] .editor-field input,
:root[data-theme="dark"] .editor-field select {
  background: rgba(10, 12, 16, 0.8);
  color: var(--ink);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .editor-field input,
  :root:not([data-theme]) .editor-field select {
    background: rgba(10, 12, 16, 0.8);
    color: var(--ink);
  }
}

.editor-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.editor-actions {
  display: grid;
  gap: 8px;
}

.editor-primary,
.editor-secondary,
.editor-danger {
  border-radius: 999px;
  padding: 10px 14px;
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  cursor: pointer;
}

.editor-primary {
  background: linear-gradient(120deg, var(--editor-accent), #86c9c2);
  color: #0f1115;
}

.editor-secondary {
  background: transparent;
  border-color: var(--editor-border);
}

.editor-danger {
  background: transparent;
  border-color: var(--editor-danger);
  color: var(--editor-danger);
}

.editor-hints {
  font-size: 0.8rem;
  color: var(--menu-muted);
  border-top: 1px solid var(--editor-border);
  padding-top: 10px;
}

@media (max-width: 760px) {
  .menu-card {
    padding: 18px;
  }

  .editor-panel {
    left: 10px;
    right: 10px;
    width: auto;
  }

  .maze-custom-shell {
    width: min(94vw, 720px);
    aspect-ratio: 4 / 5;
  }

  .maze-custom-overlay {
    left: 12px;
    right: 12px;
    width: auto;
  }
}

@media (max-width: 980px) {
  .menu-shell {
    grid-template-columns: 1fr;
  }

  .menu-graphic {
    min-height: 220px;
  }
}

/* Gentle entrance animation for page elements. */
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes hazeDrift {
  0% {
    background-position: 0 0, 0 0, 0 0, 0 0, 0 0, center, 0 0, 0 0;
  }
  100% {
    background-position: 0 0, 0 0, 0 0, 0 0, 0 0, center, 30px -20px, -24px 18px;
  }
}

@keyframes controlFlash {
  0% {
    box-shadow: 0 0 0 0 rgba(0, 0, 0, 0.3);
  }
  100% {
    box-shadow: 0 0 0 14px rgba(0, 0, 0, 0);
  }
}

@keyframes menuFloat {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-6px);
  }
}

/* Stack the header on smaller screens. */
@media (max-width: 860px) {
  .title {
    flex-direction: column;
    align-items: flex-start;
  }

  .legend {
    width: 100%;
  }
}
