:root {
  --bg-primary: #050510;
  --bg-secondary: #0a0a20;
  --bg-panel: rgba(5, 10, 25, 0.95);
  --bg-overlay: rgba(2, 2, 10, 0.85);
  --cyan: #00ccff;
  --cyan-dim: rgba(0, 200, 255, 0.5);
  --cyan-glow: rgba(0, 200, 255, 0.4);
  --cyan-faint: rgba(0, 200, 255, 0.15);
  --cyan-bg: rgba(0, 200, 255, 0.06);
  --purple: #8844cc;
  --purple-accent: rgba(136, 68, 204, 0.5);
  --green: #00ff88;
  --green-dim: rgba(0, 255, 136, 0.5);
  --yellow: #ffcc00;
  --red: #ff3344;
  --red-dim: rgba(255, 80, 100, 0.7);
  --text-primary: #c0d0e0;
  --text-secondary: #a0b0c0;
  --text-dim: rgba(160, 176, 192, 0.5);
  --text-faint: rgba(160, 176, 192, 0.3);
  --metal-light: rgba(200, 210, 220, 0.6);
  --metal-dark: rgba(200, 210, 220, 0.08);
  --border-subtle: rgba(0, 200, 255, 0.1);
  --border-medium: rgba(0, 200, 255, 0.2);
  --border-strong: rgba(0, 200, 255, 0.5);
}

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

html {
  height: 100%;
  background: #050510;
}

body {
  margin: 0;
  padding: 0;
  width: 100%;
  min-height: 100%;
  background: #050510;
  color: #c0d0e0;
  font-family: "Cascadia Code", "Fira Code", "JetBrains Mono", "Consolas", "Courier New", monospace, "Segoe UI", system-ui, -apple-system, sans-serif;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#game-container {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: #050510;
  -webkit-touch-callout: none;
}

/* Menus are scrollable, so they must be allowed to pan. */
#game-container.menu-active {
  touch-action: pan-y;
}

/* Gameplay: the canvas and touch pads opt out of scrolling themselves.
   NOTE: no `touch-action: none` here — touch-action is intersected across the
   whole ancestor chain, so putting it on the container froze every scrollable
   panel inside it (how-to-play, level select, inventory). */
#game-container.game-active {
  touch-action: auto;
}

#game-screen {
  display: flex !important;
  align-items: stretch !important;
  justify-content: stretch !important;
  padding: 0 !important;
  overflow: visible !important;
  touch-action: auto;
}

canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
  touch-action: none;
}

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

.hidden {
  display: none !important;
}

body.pseudo-fullscreen #game-container {
  position: fixed;
  inset: 0;
  height: 100dvh;
  padding: 0;
}

::selection {
  background: rgba(0, 200, 255, 0.3);
  color: #ffffff;
}

.ui-toast {
  position: fixed;
  left: 50%;
  bottom: calc(28px + env(safe-area-inset-bottom));
  transform: translate(-50%, 20px);
  z-index: 400;
  max-width: min(90vw, 420px);
  padding: 12px 20px;
  border-radius: 6px;
  background: rgba(5, 10, 25, 0.96);
  border: 1px solid rgba(0, 200, 255, 0.4);
  color: #00ccff;
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
  box-shadow: 0 0 20px rgba(0, 200, 255, 0.18);
}

.ui-toast.ui-toast-show {
  opacity: 1;
  transform: translate(-50%, 0);
}

::-webkit-scrollbar {
  width: 4px;
}

::-webkit-scrollbar-track {
  background: rgba(0, 200, 255, 0.03);
}

::-webkit-scrollbar-thumb {
  background: rgba(0, 200, 255, 0.15);
  border-radius: 2px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 200, 255, 0.3);
}
