:root {
  --ui-bg: rgba(10, 10, 16, 0.78);
  --ui-border: rgba(255, 255, 255, 0.18);
  --ui-glow: rgba(120, 200, 255, 0.22);
  --text: #e8f2ff;
  --muted: rgba(232, 242, 255, 0.75);
  --accent: #7df0ff;
  --accent2: #ffcc66;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  background: #05060a;
  overflow: hidden;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  letter-spacing: 0.02em;
}

/* ----- Game container: centred canvas (portrait on mobile, widescreen on desktop) ----- */
#game-container {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #05060a;
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: #0a0a0f;
}

#game-canvas {
  touch-action: none; /* Prevent pull-to-refresh/overscroll from stealing touches during gameplay */
}

#game-container.in-menu #game-canvas {
  touch-action: pinch-zoom; /* Allow pinch-to-zoom in menus for mobile readability */
}

#game-container.in-menu {
  pointer-events: none;
}

#game-container.in-menu #game-canvas {
  pointer-events: auto;
}

#game-container.in-menu .fullscreen-btn {
  pointer-events: auto;
}

#game-container.in-menu .canvas-back-btn {
  pointer-events: auto;
}

#game-container.in-menu .overlay:not(.hidden) {
  pointer-events: auto;
}

/* ----- Canvas back button (HTML overlay, top-left, canvas menu scenes only) ----- */
.canvas-back-btn {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 9990;
  width: 56px;
  height: 56px;
  min-width: 56px;
  min-height: 56px;
  padding: 0;
  border: 2px solid rgba(255,255,255,0.25);
  border-radius: 12px;
  background: rgba(20, 22, 28, 0.92);
  color: #d0d8e0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  pointer-events: auto !important;
  transition: background 0.2s, color 0.2s;
}
.canvas-back-btn.hidden {
  display: none !important;
}
.canvas-back-btn:hover {
  background: rgba(45, 50, 60, 0.95);
  color: #e0e8f0;
}
.canvas-back-btn:active {
  transform: scale(0.93);
  background: rgba(60, 70, 85, 0.95);
}

/* ----- Fullscreen button ----- */
.fullscreen-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 9990;
  width: 56px;
  height: 56px;
  min-width: 56px;
  min-height: 56px;
  padding: 0;
  border: 2px solid rgba(255,255,255,0.25);
  border-radius: 12px;
  background: rgba(20, 22, 28, 0.92);
  color: #d0d8e0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  pointer-events: auto !important;
  transition: background 0.2s, color 0.2s;
}
.fullscreen-btn:hover {
  background: rgba(45, 50, 60, 0.95);
  color: #e0e8f0;
}
.fullscreen-btn:active {
  transform: scale(0.93);
  background: rgba(60, 70, 85, 0.95);
}
/* Expand icon (four corners) */
.fullscreen-btn::before {
  content: '';
  width: 20px;
  height: 20px;
  border: 2.5px solid currentColor;
  border-radius: 3px;
  box-sizing: border-box;
}
.fullscreen-btn.is-fullscreen::before {
  border-style: double;
  width: 16px;
  height: 16px;
}

#game-container:fullscreen,
#game-container:-webkit-full-screen {
  width: 100%;
  height: 100%;
  background: #05060a;
}

/* ----- Loading (above menu and game so it stays visible until hidden) ----- */
#loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(10, 10, 15, 0.75);
  color: #8f8;
  font-size: 24px;
  gap: 8px;
  transition: opacity 0.3s ease;
}

#loading-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

/* ----- Touch controller (NES-style, mobile) ----- */
#touch-controller-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: min(4vw, 24px) min(5vw, 32px) min(8vw, 48px);
  /* Above the 3D field (5) and HUD/overlay canvas (10) so the controls stay on
     top of play-call etc. — the player can always see they're in control.
     Still below the nav buttons (9990) and quit modal (10020). */
  z-index: 9985;
}
#touch-controller-overlay:not(.hidden) {
  pointer-events: auto;
  touch-action: none; /* Prevent browser scroll/zoom from stealing touches on mobile */
  -webkit-user-select: none;
  user-select: none;
}
#touch-controller-overlay.hidden {
  display: none;
}

/* Analog stick: slide thumb without lifting */
.touch-stick {
  position: relative;
  width: min(28vw, 160px);
  height: min(28vw, 160px);
  border-radius: 50%;
  background: rgba(35, 35, 45, 0.85);
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.5), 0 2px 8px rgba(0,0,0,0.3);
  pointer-events: auto;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}
.touch-stick-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 36%;
  height: 36%;
  margin-left: -18%;
  margin-top: -18%;
  border-radius: 50%;
  background: rgba(90, 95, 110, 0.95);
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
  pointer-events: none;
  transition: transform 0.05s ease-out;
}

.touch-dpad {
  display: none; /* Replaced by analog stick for slide-without-lifting */
  position: relative;
  width: min(28vw, 160px);
  height: min(28vw, 160px);
}
.dpad-btn {
  position: absolute;
  width: 32%;
  height: 32%;
  border: none;
  border-radius: 6px;
  background: rgba(45, 45, 50, 0.72);
  box-shadow: inset 0 2px 4px rgba(255,255,255,0.12), 0 2px 6px rgba(0,0,0,0.4);
  pointer-events: auto;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}
.dpad-btn:active {
  background: rgba(65, 65, 72, 0.85);
  transform: scale(0.96);
}
.dpad-up    { top: 0;   left: 34%; }
.dpad-down  { bottom: 0; left: 34%; }
.dpad-left  { left: 0;   top: 34%; }
.dpad-right { right: 0;  top: 34%; }
/* Diagonal: almost invisible, same hit area feel */
.dpad-diag {
  width: 28%;
  height: 28%;
  background: rgba(50, 50, 55, 0.18);
  border-radius: 4px;
}
.dpad-diag:active {
  background: rgba(60, 60, 68, 0.35);
}
.dpad-up-left    { top: 8%;   left: 8%; }
.dpad-up-right   { top: 8%;   right: 8%; }
.dpad-down-left  { bottom: 8%; left: 8%; }
.dpad-down-right { bottom: 8%; right: 8%; }
.dpad-center {
  position: absolute;
  left: 34%;
  top: 34%;
  width: 32%;
  height: 32%;
  background: rgba(35, 35, 40, 0.8);
  border-radius: 4px;
  pointer-events: none;
}

.touch-buttons {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: min(4vw, 20px);
  pointer-events: none;
}
.touch-btn {
  width: min(18vw, 72px);
  height: min(18vw, 72px);
  border-radius: 50%;
  border: none;
  font-size: min(4.5vw, 22px);
  font-weight: bold;
  color: rgba(255,255,255,0.95);
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
  box-shadow: inset 0 2px 4px rgba(255,255,255,0.2), 0 3px 8px rgba(0,0,0,0.35);
  pointer-events: auto;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}
.touch-btn-a {
  background: rgba(60, 120, 200, 0.72);
}
.touch-btn-a:active {
  background: rgba(80, 140, 220, 0.85);
  transform: scale(0.95);
}
.touch-btn-b {
  background: rgba(180, 60, 60, 0.72);
}
.touch-btn-b:active {
  background: rgba(200, 80, 80, 0.85);
  transform: scale(0.95);
}

#loading-progress {
  font-size: 18px;
  color: #6c6;
}

/* ----- CRT scanlines + vignette (when menu visible) ----- */
body.crt::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(to bottom, rgba(0,0,0,0.20), rgba(0,0,0,0.05) 35%, rgba(0,0,0,0.22)),
    repeating-linear-gradient(
      to bottom,
      rgba(0,0,0,0.18) 0px,
      rgba(0,0,0,0.18) 1px,
      rgba(0,0,0,0.00) 3px,
      rgba(0,0,0,0.00) 4px
    );
  mix-blend-mode: multiply;
  opacity: 0.9;
}

/* Mode select: lighter scanlines so matrix text stays readable on dark canvas */
body.crt.mode-select-scene::before {
  background:
    linear-gradient(to bottom, rgba(0,0,0,0.10), rgba(0,0,0,0.02) 35%, rgba(0,0,0,0.12)),
    repeating-linear-gradient(
      to bottom,
      rgba(0,0,0,0.07) 0px,
      rgba(0,0,0,0.07) 1px,
      rgba(0,0,0,0.00) 4px,
      rgba(0,0,0,0.00) 5px
    );
  opacity: 0.48;
}

body.crt.mode-select-scene::after {
  opacity: 0.35;
}

body.crt::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(255,255,255,0.10) 0%, rgba(0,0,0,0.65) 70%, rgba(0,0,0,0.85) 100%);
  opacity: 0.6;
}

/* ----- Retro menu panel ----- */
#menu-panel {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  pointer-events: none;
  z-index: 15;
}

#menu-panel .panel {
  pointer-events: auto;
}

#menu-panel.hidden {
  display: none;
}

.ui .panel {
  width: min(720px, 92vw);
  border: 1px solid var(--ui-border);
  background: var(--ui-bg);
  box-shadow:
    0 0 0 2px rgba(0,0,0,0.35) inset,
    0 18px 55px rgba(0,0,0,0.65),
    0 0 40px var(--ui-glow);
  border-radius: 18px;
  overflow: hidden;
  backdrop-filter: blur(6px);
}

/* Mobile: compact panel + top bar (Back / Edition) — desktop hides the bar */
.menu-mobile-bar {
  display: none;
}

@media (max-width: 900px) {
  #menu-panel {
    padding: max(6px, env(safe-area-inset-top, 6px)) max(6px, env(safe-area-inset-right, 6px))
      max(10px, env(safe-area-inset-bottom, 10px)) max(6px, env(safe-area-inset-left, 6px));
    align-items: center;
    justify-content: center;
  }
  .menu-mobile-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.22);
  }
  .menu-back-step-btn,
  .menu-mobile-bar .menu-back-mode-btn {
    flex: 1;
    min-height: 48px;
    padding: 12px 14px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: rgba(35, 40, 52, 0.95);
    color: var(--text);
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }
  .menu-back-step-btn {
    background: rgba(60, 90, 120, 0.55);
    border-color: rgba(125, 240, 255, 0.35);
  }
  .menu-mobile-bar .menu-back-mode-btn {
    flex: 0 0 auto;
    min-width: 120px;
  }
  .header .meta {
    display: none;
  }
  .ui .panel {
    width: min(100%, 480px);
    max-width: calc(100vw - 16px);
    max-height: min(78dvh, 620px);
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }
  .header {
    padding: 10px 14px 10px;
    flex-shrink: 0;
  }
  .content {
    grid-template-columns: 1fr;
    flex: 1;
    min-height: 0;
    overflow: hidden;
  }
  .menu {
    border-right: none;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    max-height: min(30vh, 220px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex-shrink: 0;
  }
  .right {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 10px 12px 14px;
    flex: 1;
    min-height: 0;
    font-size: clamp(12px, 3.1vw, 14px);
  }
  .title {
    font-size: clamp(15px, 4vw, 19px);
  }
  .subtitle {
    font-size: clamp(10px, 2.8vw, 12px);
    display: none;
  }
  .item {
    min-height: 40px;
    padding: 8px;
    margin: 2px 0;
    font-size: clamp(13px, 3.2vw, 15px);
  }
}

.header {
  padding: 18px 20px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.title {
  font-size: 18px;
  color: var(--text);
  text-transform: uppercase;
}

.subtitle {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
  line-height: 1.3;
}

.meta {
  text-align: right;
  font-size: 12px;
  color: var(--muted);
  user-select: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.meta-hint {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  opacity: 0.85;
}

.menu-back-mode-btn {
  margin-top: 8px;
  min-height: 44px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  cursor: pointer;
  touch-action: manipulation;
}

.menu-back-mode-btn:hover,
.menu-back-mode-btn:focus-visible {
  background: rgba(255, 255, 255, 0.14);
  outline: none;
}

.menu-back-mode-btn:active {
  background: rgba(100, 180, 255, 0.2);
}

.content {
  display: grid;
  grid-template-columns: 1fr 0.9fr;
  gap: 0;
}

.menu {
  padding: 14px 10px 16px 14px;
  border-right: 1px solid rgba(255,255,255,0.08);
}

.menu ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  margin: 4px 0;
  min-height: 52px;
  box-sizing: border-box;
  border-radius: 12px;
  color: var(--text);
  user-select: none;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(125, 240, 255, 0.15);
}

.cursor {
  width: 18px;
  text-align: center;
  color: var(--accent);
  filter: drop-shadow(0 0 6px rgba(125,240,255,0.35));
}

.item.active {
  background: linear-gradient(90deg, rgba(125,240,255,0.18), rgba(255,204,102,0.10));
  outline: 1px solid rgba(125,240,255,0.28);
  box-shadow: 0 0 0 2px rgba(0,0,0,0.25) inset;
}

.right {
  padding: 14px 14px 16px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.badge {
  display: inline-block;
  padding: 6px 10px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 999px;
  margin-bottom: 10px;
  color: var(--text);
  background: rgba(255,255,255,0.05);
}

.controls {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}

.row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  background: rgba(0,0,0,0.16);
}

input[type="range"] {
  width: 52%;
}

.hint {
  margin-top: 10px;
  color: rgba(232,242,255,0.55);
}

/* Field picker (when "Choose Field" selected) */
.field-picker {
  margin-top: 10px;
}

.menu-option-row {
  margin-top: 8px;
}
.menu-option-row label {
  display: flex;
  align-items: center;
  gap: 8px;
}
.menu-option-row input[type="range"] {
  width: 100px;
  vertical-align: middle;
}
.menu-option-row select {
  margin-left: 4px;
}

.field-picker.hidden {
  display: none !important;
}

.field-label {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

.field-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.field-option {
  padding: 6px 10px;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  background: rgba(0,0,0,0.2);
  color: var(--text);
  font-size: 11px;
  cursor: default;
}

.field-option.selected,
.ball-option.selected {
  border-color: var(--accent);
  background: rgba(125,240,255,0.12);
}

.ball-option {
  padding: 6px 10px;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  background: rgba(0,0,0,0.2);
  color: var(--text);
  font-size: 11px;
  cursor: default;
}

/* Jersey colour picker */
.jersey-row {
  display: flex;
  gap: 16px;
  align-items: center;
  margin: 8px 0;
}

.jersey-row label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text);
}

.jersey-row input[type="color"] {
  width: 32px;
  height: 24px;
  border: 1px solid var(--ui-border);
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  padding: 0;
}

.jersey-preview {
  position: relative;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  border: 1px solid var(--ui-border);
  margin-top: 6px;
  background: linear-gradient(135deg, #cc0000 0%, #cc0000 50%, #ffffff 50%, #ffffff 100%);
}

.jersey-preview canvas.jersey-preview-mascot {
  position: absolute;
  left: 0;
  top: 0;
  width: 48px;
  height: 48px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  pointer-events: none;
}

/* Overlays (Control options / Credits) */
.overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0,0,0,0.7);
  padding: 24px;
  pointer-events: auto;
  /* Above touch controller (10) and fullscreen btn (9990) so modals stay tappable on mobile */
  z-index: 10020;
}

.overlay.hidden {
  display: none !important;
}

.overlay-panel {
  width: min(400px, 90vw);
  max-height: min(92vh, 900px);
  overflow-y: auto;
  border: 1px solid var(--ui-border);
  background: var(--ui-bg);
  border-radius: 18px;
  padding: 24px;
  box-shadow: 0 18px 55px rgba(0,0,0,0.65);
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 900px) {
  .overlay {
    padding: max(12px, env(safe-area-inset-top, 12px)) max(12px, env(safe-area-inset-right, 12px))
      max(12px, env(safe-area-inset-bottom, 12px)) max(12px, env(safe-area-inset-left, 12px));
    align-items: stretch;
  }
  .overlay-panel {
    width: 100%;
    max-width: none;
    min-height: min(88vh, 640px);
    padding: clamp(18px, 4vw, 28px);
    font-size: clamp(15px, 3.8vw, 18px);
  }
  .overlay-panel .title {
    font-size: clamp(1.1rem, 4.2vw, 1.35rem);
  }
  .btn-primary,
  .btn-secondary {
    min-height: 48px;
    min-width: 120px;
    padding: 14px 22px;
    font-size: clamp(15px, 3.8vw, 18px);
    touch-action: manipulation;
  }
  .matchup-actions {
    gap: 16px;
  }
}

.overlay-panel .title {
  margin-bottom: 12px;
}

.overlay-panel p {
  color: var(--text);
}

.options-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.option-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
}
.option-toggle input { cursor: pointer; }

.overlay-list {
  list-style: none;
  padding: 0;
  margin: 0 0 12px 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.8;
}

.overlay-panel .hint {
  margin-top: 8px;
  font-size: 11px;
}

.overlay-back-btn {
  display: block;
  width: 100%;
  margin-top: 16px;
  padding: 12px 20px;
  font-size: 16px;
  font-family: inherit;
  color: var(--text);
  background: rgba(80, 100, 140, 0.5);
  border: 1px solid var(--ui-border);
  border-radius: 10px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.overlay-back-btn:hover, .overlay-back-btn:active {
  background: rgba(100, 130, 180, 0.6);
}

.matchup-panel {
  width: min(520px, 94vw);
  max-height: min(90vh, 720px);
  overflow-y: auto;
}

.matchup-pickers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
  margin-bottom: 12px;
  text-align: left;
}

.matchup-picker-block .field-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 6px;
}

.matchup-picker-block .field-list {
  max-height: 140px;
  overflow-y: auto;
}

@media (max-width: 520px) {
  .matchup-pickers {
    grid-template-columns: 1fr;
  }
}

.matchup-summary {
  margin: 12px 0 20px;
  padding: 12px 14px;
  background: rgba(0,0,0,0.25);
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.85;
}

.matchup-line {
  color: var(--text);
}

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

.btn-primary,
.btn-secondary {
  padding: 10px 20px;
  border-radius: 10px;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  border: 1px solid var(--ui-border);
}

.btn-primary {
  background: linear-gradient(180deg, rgba(125,240,255,0.25), rgba(125,240,255,0.12));
  color: var(--text);
}

.btn-primary:hover {
  background: linear-gradient(180deg, rgba(125,240,255,0.35), rgba(125,240,255,0.18));
}

.btn-secondary {
  background: rgba(255,255,255,0.06);
  color: var(--muted);
}

.btn-secondary:hover {
  background: rgba(255,255,255,0.1);
  color: var(--text);
}

/* Cutscene demo (demo menu → Cutscene demo): color pickers above canvas bottom */
.cutscene-demo-overlay {
  position: fixed;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  z-index: 50;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid rgba(120, 140, 160, 0.45);
  background: rgba(12, 14, 20, 0.94);
  font-family: system-ui, -apple-system, Segoe UI, sans-serif;
  font-size: 13px;
  color: #d8dee8;
  pointer-events: auto;
  max-width: min(960px, 96vw);
}

.cutscene-demo-overlay.hidden {
  display: none !important;
}

.cutscene-demo-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.cutscene-demo-label input[type="color"] {
  width: 36px;
  height: 28px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  cursor: pointer;
  vertical-align: middle;
}

.cutscene-demo-hint {
  opacity: 0.85;
  font-size: 12px;
  color: #9aa8b8;
}

.cutscene-demo-back-btn {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 10px 16px;
  font-size: 15px;
  font-weight: 600;
  color: #e8ecf0;
  background: rgba(80, 100, 130, 0.55);
  border: 1px solid rgba(180, 200, 220, 0.45);
  border-radius: 8px;
  cursor: pointer;
  touch-action: manipulation;
}

.cutscene-demo-back-btn:active {
  background: rgba(100, 120, 160, 0.75);
}

@media (max-width: 720px) {
  .content {
    grid-template-columns: 1fr;
  }
  .menu {
    border-right: none;
    border-bottom: 1px solid rgba(255,255,255,0.08);
  }
  input[type="range"] {
    width: 60%;
  }
}

.landscape-hint {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  background: rgba(255, 200, 60, 0.92);
  color: #1a1200;
  font-size: 13px;
  font-weight: bold;
  text-align: center;
  padding: 8px 12px;
  pointer-events: none;
  letter-spacing: 0.03em;
}
.landscape-hint.hidden { display: none; }
