:root {
  --accent: #ff3b5c;
  --accent-2: #33e6ff;
  --bot: #ff8a3d;
  --ink: #0b0d13;
  --panel: rgba(10, 13, 20, 0.72);
  --panel-line: rgba(255, 255, 255, 0.14);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #efede8;
  color: #eef1f8;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}

#game-shell {
  position: fixed;
  inset: 0;
  overflow: hidden;
  transition: filter 120ms linear;
}

#game-shell.bw-flash {
  filter: grayscale(1) contrast(1.2);
}

#game {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
}

/* ---------- screen effects ---------- */

#screen-flash {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 40;
  opacity: 0;
  background: radial-gradient(circle at center, rgba(255, 235, 210, 0.55), rgba(255, 70, 60, 0.28) 55%, transparent 78%);
  transition: opacity 60ms linear;
}

#screen-flash.kill {
  background: radial-gradient(circle at center, rgba(255, 255, 255, 0.75), rgba(255, 138, 61, 0.35) 55%, transparent 80%);
}

#impact-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 39;
  overflow: hidden;
}

.impact-ring {
  position: absolute;
  width: 26px;
  height: 26px;
  margin: -13px 0 0 -13px;
  border-radius: 50%;
  border: 2px solid rgba(255, 200, 120, 0.95);
  box-shadow: 0 0 18px rgba(255, 150, 60, 0.85);
  transform: scale(0.4);
  opacity: 1;
  animation: impact-pop 380ms ease-out forwards;
}

.impact-ring.big {
  width: 40px;
  height: 40px;
  margin: -20px 0 0 -20px;
  border-width: 3px;
}

@keyframes impact-pop {
  0% { transform: scale(0.3); opacity: 1; }
  60% { opacity: 0.9; }
  100% { transform: scale(2.6); opacity: 0; }
}

.impact-spark {
  position: absolute;
  width: 5px;
  height: 5px;
  margin: -2.5px 0 0 -2.5px;
  border-radius: 50%;
  background: #ffcf8a;
  box-shadow: 0 0 6px rgba(255, 180, 90, 0.9);
  animation: spark-fly 360ms ease-out forwards;
}

@keyframes spark-fly {
  0% { transform: translate(0, 0); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)); opacity: 0; }
}

/* ---------- anime impact frame (drawn procedurally on a canvas) ---------- */

#impact-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 55;
  pointer-events: none;
  opacity: 0;
  transform-origin: center;
}
#impact-canvas.on { opacity: 1; }
#impact-canvas.out { opacity: 0; transition: opacity 140ms linear; }

/* ---------- sniper scope ---------- */

.scope-overlay {
  position: fixed;
  inset: 0;
  z-index: 38;
  pointer-events: none;
  background: radial-gradient(circle at center, transparent 0, transparent 34vh, #000 34.6vh);
}

.scope-overlay.hidden { display: none; }

.scope-cross {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 2px;
  height: 2px;
}

.scope-cross i {
  position: absolute;
  background: rgba(0, 0, 0, 0.75);
}

.scope-cross i:nth-child(1) { width: 1px; height: 68vh; left: 0; top: -34vh; }
.scope-cross i:nth-child(2) { width: 68vh; height: 1px; top: 0; left: -34vh; }

/* ---------- 2D weapon sprite (replaces a 3D viewmodel) ---------- */

.weapon-sprite {
  position: fixed;
  right: 0;
  bottom: 0;
  width: min(22vw, 300px);
  z-index: 21;
  pointer-events: none;
  image-rendering: pixelated;
  filter: drop-shadow(-6px 8px 10px rgba(0, 0, 0, 0.35));
  transform-origin: 80% 70%;
  will-change: transform;
}

.weapon-sprite.hide { display: none; }

.muzzle-flash-sprite {
  position: fixed;
  z-index: 23;
  width: 220px;
  pointer-events: none;
  image-rendering: auto;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.4) rotate(-28deg);
  mix-blend-mode: screen;
}

.muzzle-flash-sprite.fire {
  animation: muzzle-pop 130ms ease-out;
}

@keyframes muzzle-pop {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.3) rotate(-28deg); }
  25% { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(-28deg); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.3) rotate(-28deg); }
}

/* ---------- HUD ---------- */

.hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 20;
}

.brand-lockup {
  position: absolute;
  top: 18px;
  left: 20px;
  line-height: 1.05;
  animation: hud-in 500ms ease-out both;
}

.eyebrow {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.28em;
  color: var(--accent-2);
  opacity: 0.9;
}

.brand-lockup h1 {
  margin: 2px 0 0;
  font-size: 26px;
  letter-spacing: 0.06em;
}

.subtitle {
  margin: 2px 0 0;
  font-size: 12px;
  color: rgba(238, 241, 248, 0.65);
}

@keyframes hud-in {
  0% { opacity: 0; transform: translateY(-8px); }
  100% { opacity: 1; transform: translateY(0); }
}

.readout {
  position: absolute;
  top: 18px;
  right: 20px;
  display: flex;
  gap: 14px;
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: 12px;
  padding: 10px 16px;
  backdrop-filter: blur(6px);
  animation: hud-in 500ms ease-out 80ms both;
}

.readout > div {
  text-align: center;
  min-width: 44px;
}

.readout-label {
  display: block;
  font-size: 9px;
  letter-spacing: 0.16em;
  color: rgba(238, 241, 248, 0.55);
}

.readout strong {
  font-size: 18px;
  font-variant-numeric: tabular-nums;
  display: inline-block;
}

.readout strong.pulse {
  animation: stat-pulse 380ms ease-out;
}

@keyframes stat-pulse {
  0% { transform: scale(1.35); color: var(--accent-2); }
  100% { transform: scale(1); color: inherit; }
}

.readout small {
  font-size: 9px;
  margin-left: 2px;
  color: rgba(238, 241, 248, 0.5);
}

.reticle {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  pointer-events: none;
}

.reticle i {
  position: absolute;
  inset: 0;
  border: 1.5px solid rgba(255, 255, 255, 0.85);
  border-radius: 50%;
  opacity: 0.55;
}

.reticle b {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 3px;
  height: 3px;
  margin: -1.5px 0 0 -1.5px;
  background: #fff;
  border-radius: 50%;
}

.assist-circle {
  position: fixed;
  top: 0;
  left: 0;
  width: 34px;
  height: 34px;
  margin: -17px 0 0 -17px;
  border-radius: 50%;
  border: 2px solid rgba(255, 200, 90, 0.85);
  pointer-events: none;
  opacity: 0;
  z-index: 22;
  transition: left 150ms ease-out, top 150ms ease-out, opacity 150ms linear, border-color 150ms linear, transform 150ms linear;
}

.assist-circle.show { opacity: 0.85; }

.assist-circle.locked {
  border-color: rgba(120, 255, 160, 0.95);
  transform: scale(0.72);
  box-shadow: 0 0 14px rgba(120, 255, 160, 0.6);
}

.hit-marker {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 30px;
  height: 30px;
  margin: -15px 0 0 -15px;
  pointer-events: none;
  opacity: 0;
}

.hit-marker i {
  position: absolute;
  width: 12px;
  height: 2px;
  background: var(--bot);
  top: 50%;
  left: 50%;
  border-radius: 2px;
}

.hit-marker i:nth-child(1) { transform: translate(-13px, -1px) rotate(45deg); }
.hit-marker i:nth-child(2) { transform: translate(3px, -1px) rotate(-45deg); }
.hit-marker i:nth-child(3) { transform: translate(-13px, -1px) rotate(-45deg); }
.hit-marker i:nth-child(4) { transform: translate(3px, -1px) rotate(45deg); }

.hit-marker.show { animation: hit-flash 260ms ease-out; }

@keyframes hit-flash {
  0% { opacity: 1; transform: scale(0.7); }
  40% { opacity: 1; transform: scale(1.15); }
  100% { opacity: 0; transform: scale(1.3); }
}

.kill-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, 18px);
  font-size: 13px;
  letter-spacing: 0.22em;
  color: var(--bot);
  text-shadow: 0 0 12px rgba(255, 138, 61, 0.8);
  opacity: 0;
  white-space: nowrap;
}

.kill-text.show { animation: kill-pop 620ms ease-out; }

@keyframes kill-pop {
  0% { opacity: 0; transform: translate(-50%, 10px) scale(0.9); }
  20% { opacity: 1; transform: translate(-50%, 26px) scale(1.05); }
  75% { opacity: 1; transform: translate(-50%, 30px) scale(1); }
  100% { opacity: 0; transform: translate(-50%, 38px) scale(1); }
}

.grapple-reticle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.6);
  font-size: 20px;
  color: var(--accent-2);
  opacity: 0;
  pointer-events: none;
  text-shadow: 0 0 10px rgba(51, 230, 255, 0.9);
}

.grapple-reticle.active {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  transition: transform 120ms ease-out;
}

.weapon-hud {
  position: absolute;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: 14px;
  padding: 8px 14px 8px 8px;
  backdrop-filter: blur(6px);
  animation: hud-in 500ms ease-out 120ms both;
}

.weapon-ring {
  width: 40px;
  height: 40px;
}

.weapon-ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ring-track {
  fill: none;
  stroke: rgba(255, 255, 255, 0.15);
  stroke-width: 4;
}

.ring-fill {
  fill: none;
  stroke: var(--accent-2);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 119.4;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 60ms linear, stroke 120ms linear;
}

.weapon-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.weapon-copy strong {
  font-size: 13px;
  letter-spacing: 0.08em;
}

.weapon-copy span {
  font-size: 11px;
  color: var(--accent-2);
  letter-spacing: 0.1em;
}

.weapon-copy span.reloading { color: var(--accent); }
.weapon-copy span.zooming { color: #ffd27a; }

.weapon-slots {
  display: flex;
  gap: 6px;
  margin-left: 4px;
  pointer-events: auto;
  position: relative;
  z-index: 26;
}

.weapon-slots .slot {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  border: 1px solid var(--panel-line);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(238, 241, 248, 0.7);
  font-size: 12px;
  cursor: pointer;
}

.weapon-slots .slot.active {
  border-color: var(--accent-2);
  color: #fff;
  background: rgba(51, 230, 255, 0.18);
}

.help-card {
  position: absolute;
  bottom: 24px;
  left: 20px;
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 12px;
  line-height: 1.7;
  backdrop-filter: blur(6px);
  animation: hud-in 500ms ease-out 160ms both;
}

.help-card kbd {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 11px;
  margin-right: 2px;
}

.focus-prompt {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(6, 8, 13, 0.55);
  pointer-events: auto;
  cursor: pointer;
  text-align: center;
}

.focus-prompt.hidden { display: none; }

.focus-mark {
  font-size: 30px;
  color: var(--accent-2);
}

.focus-prompt p {
  margin: 0;
  font-size: 13px;
  color: rgba(238, 241, 248, 0.85);
}

.toast {
  position: absolute;
  bottom: 84px;
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  font-size: 12px;
  letter-spacing: 0.14em;
  color: var(--accent-2);
  opacity: 0;
  transition: opacity 220ms ease, transform 220ms ease;
  white-space: nowrap;
}

.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.hidden { display: none !important; }

/* ---------- touch controls (JS-gated: body.is-touch only) ---------- */

.touch-controls {
  position: fixed;
  inset: 0;
  z-index: 25;
  pointer-events: none;
  display: none;
}

body.is-touch .touch-controls { display: block; }

.move-zone {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 46vw;
  max-width: 320px;
  height: 46vw;
  max-height: 320px;
  pointer-events: auto;
}

.stick-base {
  position: absolute;
  left: 26px;
  bottom: 26px;
  width: 128px;
  height: 128px;
  border-radius: 50%;
  border: 1px solid var(--panel-line);
  background: var(--panel);
}

.stick {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 56px;
  height: 56px;
  margin: -28px 0 0 -28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.35);
}

.look-zone {
  position: absolute;
  right: 0;
  top: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: auto;
}

.touch-actions {
  position: absolute;
  right: 18px;
  bottom: 18px;
  width: 250px;
  height: 260px;
  pointer-events: none;
}

.touch-actions .action {
  position: absolute;
  pointer-events: auto;
  border-radius: 50%;
  border: 1px solid var(--panel-line);
  background: var(--panel);
  color: #eef1f8;
  font-size: 11px;
  letter-spacing: 0.08em;
  font-weight: 600;
}

.touch-actions .fire {
  width: 80px;
  height: 80px;
  right: 0;
  bottom: 86px;
  background: rgba(255, 59, 92, 0.28);
  border-color: rgba(255, 59, 92, 0.55);
  font-size: 13px;
}

.touch-actions .jump {
  width: 62px;
  height: 62px;
  right: 88px;
  bottom: 0;
}

.touch-actions .grapple {
  width: 58px;
  height: 58px;
  right: 4px;
  top: 0;
  background: rgba(51, 230, 255, 0.16);
  border-color: rgba(51, 230, 255, 0.4);
}

.touch-actions .slide {
  width: 58px;
  height: 58px;
  right: 106px;
  bottom: 98px;
}

.touch-actions .switch {
  width: 48px;
  height: 48px;
  right: 96px;
  top: 64px;
  font-size: 10px;
}

body.is-touch .help-card { display: none; }

/* ---------- menu screens (main / settings / pause) ---------- */

.menu-screen {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 30%, rgba(20, 26, 40, 0.55), rgba(6, 8, 13, 0.86));
  backdrop-filter: blur(2px);
}

#menu-screen {
  background-image: linear-gradient(rgba(6, 8, 13, 0.6), rgba(6, 8, 13, 0.8)), url("menu-background.jpg");
  background-size: cover;
  background-position: center;
}

.menu-screen.hidden { display: none; }

.menu-card {
  width: min(92vw, 420px);
  text-align: center;
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: 18px;
  padding: 30px 26px 26px;
  backdrop-filter: blur(10px);
  animation: menu-in 380ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes menu-in {
  0% { opacity: 0; transform: translateY(14px) scale(0.97); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

.menu-card h1 {
  margin: 4px 0 10px;
  font-size: 34px;
  letter-spacing: 0.08em;
}

.menu-tag {
  margin: 0 0 20px;
  font-size: 13px;
  line-height: 1.5;
  color: rgba(238, 241, 248, 0.75);
}

.play-button {
  appearance: none;
  border: none;
  border-radius: 12px;
  padding: 14px 0;
  width: 100%;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: #0b0d13;
  background: linear-gradient(135deg, var(--accent-2), #8dfcff);
  box-shadow: 0 10px 30px rgba(51, 230, 255, 0.35);
  cursor: pointer;
  animation: play-pulse 2.6s ease-in-out infinite;
}

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

@keyframes play-pulse {
  0%, 100% { box-shadow: 0 10px 30px rgba(51, 230, 255, 0.35); }
  50% { box-shadow: 0 10px 40px rgba(51, 230, 255, 0.6); }
}

.ghost-button {
  appearance: none;
  border: 1px solid var(--panel-line);
  border-radius: 12px;
  padding: 12px 0;
  width: 100%;
  margin-top: 10px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: #eef1f8;
  background: rgba(255, 255, 255, 0.05);
  cursor: pointer;
}

.ghost-button:hover { background: rgba(255, 255, 255, 0.1); }
.ghost-button:active { transform: translateY(1px); }

.menu-legend {
  display: none;
  margin-top: 18px;
  font-size: 12px;
  line-height: 1.8;
  color: rgba(238, 241, 248, 0.7);
}

.menu-legend kbd {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 11px;
}

body:not(.is-touch) #menu-legend-desktop { display: block; }
body.is-touch #menu-legend-touch { display: block; }

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  font-size: 13px;
  color: rgba(238, 241, 248, 0.85);
  text-align: left;
}

.setting-row.column {
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}

.setting-row input[type="checkbox"] {
  width: 20px;
  height: 20px;
}

.setting-row input[type="range"] { width: 100%; }

.setting-row b { color: var(--accent-2); }

@media (max-width: 480px) {
  .brand-lockup h1 { font-size: 20px; }
  .readout { gap: 10px; padding: 8px 12px; }
  .menu-card h1 { font-size: 28px; }
}

/* =====================================================================
   INK THEME: monochrome ink-sketch paper look with one crimson accent
   ===================================================================== */
:root {
  --accent: #d7263d;
  --accent-2: #0b0b0d;
  --bot: #d7263d;
  --ink: #0b0b0d;
  --paper: #f2f0ea;
  --panel: rgba(242, 240, 234, 0.93);
  --panel-line: #0b0b0d;
  --display: Impact, "Haettenschweiler", "Arial Narrow Bold", "Arial Black", system-ui, sans-serif;
  color-scheme: light;
}
html, body { background: #efede8; color: var(--ink); }
input[type="checkbox"], input[type="range"] { accent-color: #d7263d; }

/* world is drawn in light tones: HUD becomes paper tags with hard ink shadows */
.brand-lockup { color: var(--ink); text-shadow: 1px 1px 0 var(--paper), -1px -1px 0 var(--paper), 1px -1px 0 var(--paper), -1px 1px 0 var(--paper); }
.brand-lockup h1 { font-family: var(--display); letter-spacing: 0.08em; font-weight: 400; transform: skew(-6deg); }
.eyebrow { color: var(--accent); font-weight: 700; opacity: 1; }
.subtitle { color: rgba(11, 11, 13, 0.7); }
.readout, .weapon-hud, .help-card {
  background: var(--panel); color: var(--ink); backdrop-filter: none;
  border: 2px solid var(--ink); border-radius: 3px; box-shadow: 4px 4px 0 var(--ink);
}
.readout-label, .readout small { color: rgba(11, 11, 13, 0.6); }
.readout strong { font-family: var(--display); font-weight: 400; letter-spacing: 0.04em; font-size: 22px; }
@keyframes stat-pulse { 0% { transform: scale(1.35); color: var(--accent); } 100% { transform: scale(1); color: inherit; } }
.reticle i { border-color: var(--ink); box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.85), inset 0 0 0 1px rgba(255, 255, 255, 0.85); opacity: 0.8; }
.reticle b { background: var(--ink); box-shadow: 0 0 0 1.5px #fff; }
.assist-circle { border: 2.5px solid var(--accent); box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.75); }
.assist-circle.locked { border-color: var(--accent); background: rgba(215, 38, 61, 0.14); box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--ink); }
.hit-marker i { background: var(--accent); box-shadow: 0 0 0 1px #fff; height: 3px; }
.kill-text { color: var(--accent); font-family: var(--display); font-size: 18px; text-shadow: 2px 2px 0 #fff, -1px -1px 0 #fff, 0 0 0 var(--ink); }
.grapple-reticle { color: var(--ink); text-shadow: 0 0 0 #fff, 1px 1px 0 #fff, -1px -1px 0 #fff; }
.weapon-copy strong { font-family: var(--display); font-weight: 400; letter-spacing: 0.08em; }
.weapon-copy span { color: rgba(11, 11, 13, 0.62); }
.weapon-copy span.reloading { color: var(--accent); }
.weapon-copy span.zooming { color: var(--ink); }
.ring-track { stroke: rgba(11, 11, 13, 0.16); }
.ring-fill { stroke: var(--accent); }
.weapon-slots .slot { background: var(--paper); color: var(--ink); border: 2px solid var(--ink); border-radius: 2px; }
.weapon-slots .slot.active { background: var(--ink); color: var(--paper); }
.help-card kbd, .menu-legend kbd { background: var(--ink); color: var(--paper); border-radius: 2px; }
.focus-prompt p { background: var(--paper); color: var(--ink); border: 2px solid var(--ink); box-shadow: 4px 4px 0 var(--ink); border-radius: 3px; padding: 10px 16px; }
.focus-mark { color: var(--accent); }
.toast { background: var(--ink); color: var(--paper); border: 2px solid var(--paper); border-radius: 2px; font-family: var(--display); letter-spacing: 0.1em; }
#screen-flash { background: radial-gradient(circle at center, rgba(255, 255, 255, 0.5), rgba(215, 38, 61, 0.16) 60%, transparent 80%); }
#screen-flash.kill { background: radial-gradient(circle at center, rgba(255, 255, 255, 0.8), rgba(11, 11, 13, 0.25) 62%, transparent 82%); }
.impact-ring { border-color: var(--ink); box-shadow: 0 0 0 2px #fff; }
.impact-spark { background: var(--accent); box-shadow: 0 0 0 1px #fff; }
.scope-overlay { background: radial-gradient(circle at center, transparent 0, transparent 34vh, #0b0b0d 34.6vh); }
.scope-cross i { background: rgba(11, 11, 13, 0.85); }

/* touch controls: inked buttons */
.touch-actions .action { background: rgba(11, 11, 13, 0.84); color: var(--paper); border: 2px solid var(--paper); box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.35); font-family: var(--display); letter-spacing: 0.06em; font-weight: 400; }
.touch-actions .fire { background: rgba(215, 38, 61, 0.92); }
.touch-actions .action.active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 rgba(0, 0, 0, 0.35); }
.stick-base { background: rgba(11, 11, 13, 0.18); border: 2px solid var(--ink); }
.stick { background: var(--ink); border: 2px solid var(--paper); }

/* the main menu is its own scene; the game canvas and HUD are not shown behind it */
#game-shell.menu-open #game,
#game-shell.menu-open .hud,
#game-shell.menu-open .weapon-sprite,
#game-shell.menu-open .muzzle-flash-sprite,
#game-shell.menu-open .touch-controls { visibility: hidden; }

.menu-screen { background: rgba(239, 237, 232, 0.8); backdrop-filter: blur(3px); color: var(--ink); overflow: hidden; }
#menu-screen { background: #efede8; background-image: none; backdrop-filter: none; }
.settings-screen.over-scene { background: transparent; backdrop-filter: none; }
.menu-bg { position: absolute; inset: -5%; background: url("menu-background.jpg") center / cover no-repeat; will-change: transform; filter: contrast(1.06); }
.menu-bg::after { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse 46% 52% at 50% 48%, rgba(244, 242, 236, 0.93) 0, rgba(244, 242, 236, 0.74) 52%, transparent 100%); }
.menu-fx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.menu-content { position: relative; width: min(92vw, 560px); text-align: center; animation: none; padding: 10px; }
.menu-screen.card-away .menu-content, .menu-screen.card-away .menu-stamp { display: none; }
.menu-eyebrow { margin: 0 0 6px; font-size: 12px; font-weight: 700; letter-spacing: 0.32em; color: var(--accent); animation: ink-in 500ms 60ms both; }
.menu-title { margin: 0; font-family: var(--display); font-weight: 400; font-size: clamp(70px, 14vw, 156px); line-height: 0.84; letter-spacing: 0.015em; text-transform: uppercase; color: var(--ink); transform: skew(-7deg) rotate(-2deg); }
.menu-title span { display: block; animation: ink-in 720ms cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.menu-title span:nth-child(2) { color: var(--paper); -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; animation-delay: 140ms; margin-left: 0.5em; }
.menu-brush { display: block; width: min(72%, 380px); height: 16px; margin: 8px auto 0; fill: var(--accent); transform: rotate(-2deg); transform-origin: left center; animation: brush-in 640ms 420ms cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.menu-tag { margin: 14px 0 22px; font-size: 14px; line-height: 1.5; color: rgba(11, 11, 13, 0.82); font-weight: 600; animation: ink-in 600ms 520ms both; }
.menu-buttons { display: flex; flex-direction: column; gap: 14px; width: min(78%, 330px); margin: 0 auto; animation: ink-in 600ms 600ms both; }
@keyframes ink-in { 0% { opacity: 0; clip-path: inset(0 100% 0 0); transform: translateX(-26px); } 100% { opacity: 1; clip-path: inset(0 0 0 0); transform: none; } }
@keyframes brush-in { 0% { transform: rotate(-2deg) scaleX(0); } 100% { transform: rotate(-2deg) scaleX(1); } }

.play-button, .ghost-button {
  font-family: var(--display); font-weight: 400; letter-spacing: 0.16em; border-radius: 2px; margin: 0;
  border: 3px solid var(--ink); transition: transform 90ms ease-out, box-shadow 90ms ease-out, background 90ms linear, color 90ms linear;
}
.play-button { font-size: 26px; padding: 12px 0; color: var(--paper); background: var(--ink); box-shadow: 6px 6px 0 var(--accent); animation: none; transform: rotate(-1deg); }
.play-button:hover { transform: translate(-2px, -2px) rotate(-1deg); box-shadow: 9px 9px 0 var(--accent); }
.play-button:active { transform: translate(4px, 4px) rotate(-1deg); box-shadow: 2px 2px 0 var(--accent); }
.ghost-button { font-size: 17px; padding: 9px 0; color: var(--ink); background: rgba(244, 242, 236, 0.8); box-shadow: 4px 4px 0 var(--ink); transform: rotate(0.6deg); }
.ghost-button:hover { background: var(--ink); color: var(--paper); }
.ghost-button:active { transform: translate(3px, 3px) rotate(0.6deg); box-shadow: 1px 1px 0 var(--ink); }
.menu-legend { color: rgba(11, 11, 13, 0.82); margin-top: 24px; font-size: 12px; font-weight: 600; animation: ink-in 600ms 760ms both; }
.menu-legend kbd { padding: 2px 7px; margin: 0 2px; }
.menu-stamp { position: absolute; right: 4vw; bottom: 5vh; font-family: var(--display); font-size: 20px; line-height: 1.05; letter-spacing: 0.16em; color: var(--accent); border: 3px solid var(--accent); padding: 8px 14px; transform: rotate(-9deg); opacity: 0.9; animation: stamp-in 420ms 900ms cubic-bezier(0.2, 1.6, 0.4, 1) both; mix-blend-mode: multiply; }
@keyframes stamp-in { 0% { opacity: 0; transform: rotate(-9deg) scale(2.4); } 100% { opacity: 0.9; transform: rotate(-9deg) scale(1); } }

/* pause + settings cards: paper with hard ink shadow */
.menu-card { background: var(--paper); color: var(--ink); border: 3px solid var(--ink); border-radius: 3px; box-shadow: 9px 9px 0 var(--ink); backdrop-filter: none; }
.menu-card h1 { font-family: var(--display); font-weight: 400; font-size: 44px; letter-spacing: 0.06em; transform: skew(-6deg); }
.menu-card .eyebrow { color: var(--accent); }
.menu-card .play-button, .menu-card .ghost-button { width: 100%; margin-top: 14px; }
.setting-row { color: var(--ink); font-weight: 600; }
.setting-row b { color: var(--accent); }
@media (max-width: 480px) {
  .menu-stamp { display: none; }
  .menu-card h1 { font-size: 34px; }
  .menu-title { font-size: clamp(64px, 22vw, 110px); }
}
@media (max-height: 520px) {
  .menu-title { font-size: clamp(48px, 16vh, 90px); }
  .menu-tag { margin: 8px 0 12px; }
  .menu-legend { margin-top: 12px; }
  .menu-stamp { display: none; }
}

@media (max-height: 520px) {
  .menu-eyebrow, .menu-tag { display: none; }
  .menu-title { font-size: clamp(44px, 17vh, 80px); }
  .menu-buttons { gap: 10px; margin-top: 12px; }
  .play-button { font-size: 22px; padding: 8px 0; }
  .ghost-button { font-size: 15px; padding: 6px 0; }
  .menu-legend { margin-top: 10px; font-size: 11px; }
  .menu-legend p { margin: 2px 0; }
}

/* ---------- touch button layout: no overlaps on short landscape phones ---------- */
.touch-actions { width: 250px; height: 250px; }
.touch-actions .fire    { width: 78px; height: 78px; right: 0;    bottom: 78px; }
.touch-actions .grapple { width: 66px; height: 66px; right: 4px;  top: 0; font-size: 9.5px; letter-spacing: 0.02em; }
.touch-actions .switch  { width: 46px; height: 46px; right: 82px; top: 8px; }
.touch-actions .slide   { width: 58px; height: 58px; right: 98px; bottom: 92px; font-size: 10px; }
.touch-actions .jump    { width: 62px; height: 62px; right: 88px; bottom: 0; }


/* ---------- Cloudflare Pages 1v1 lobby ---------- */
.online-panel {
  width: min(88%, 390px); margin: 18px auto 0; padding: 14px 16px 12px;
  text-align: left; color: var(--ink); background: rgba(247,245,238,.88);
  border: 1px solid rgba(11,13,19,.7); box-shadow: 5px 5px 0 var(--accent); transform: rotate(.35deg);
}
.online-panel-title { display:flex; justify-content:space-between; align-items:baseline; gap:8px; margin-bottom:10px; font-weight:900; letter-spacing:.13em; font-size:12px; }
.online-panel-title small { color:rgba(11,13,19,.58); font-size:9px; letter-spacing:.08em; }
.room-field { display:flex; min-width:0; flex-direction:column; gap:4px; flex:1; }
.room-field span { font-size:9px; font-weight:900; letter-spacing:.15em; color:rgba(11,13,19,.65); }
.room-field input { width:100%; min-width:0; min-height:36px; border:1px solid rgba(11,13,19,.42); border-radius:3px; padding:7px 9px; background:#fffefa; color:#0b0d13; font:700 14px ui-monospace,SFMono-Regular,Consolas,monospace; outline:none; }
.room-field input:focus { border-color:var(--accent); box-shadow:0 0 0 2px rgba(255,59,92,.18); }
.room-primary,.room-secondary { border:1px solid var(--ink); border-radius:2px; font-weight:900; letter-spacing:.1em; cursor:pointer; min-height:38px; }
.room-primary { width:100%; margin:8px 0 10px; background:var(--ink); color:#fff; box-shadow:3px 3px 0 var(--accent); }
.room-primary:hover { transform:translateY(-1px); }
.room-join-row { display:flex; align-items:flex-end; gap:8px; }
.room-secondary { min-width:82px; background:var(--accent); color:#fff; padding:0 14px; box-shadow:3px 3px 0 var(--ink); }
.room-primary:disabled,.room-secondary:disabled { opacity:.55; cursor:wait; }
.room-feedback { min-height:28px; margin:10px 0 0; color:rgba(11,13,19,.75); font-size:11px; line-height:1.4; overflow-wrap:anywhere; }
.room-feedback.error { color:#b20c2b; font-weight:700; }
.online-status { position:fixed; z-index:31; top:18px; left:50%; transform:translateX(-50%); display:flex; align-items:center; justify-content:center; gap:8px; max-width:min(94vw,680px); padding:8px 10px 8px 14px; background:rgba(8,12,20,.88); border:1px solid rgba(51,230,255,.45); box-shadow:0 4px 26px rgba(0,0,0,.24); color:#e8fbff; font:800 10px ui-monospace,SFMono-Regular,Consolas,monospace; letter-spacing:.075em; white-space:nowrap; }
.online-status.hidden { display:none; }
.online-status span { max-width:calc(94vw - 170px); overflow:hidden; text-overflow:ellipsis; }
.online-status button { color:#071017; background:#33e6ff; border:0; border-radius:2px; padding:7px 9px; font-weight:900; font-size:9px; letter-spacing:.08em; cursor:pointer; }
.online-status button:last-child { color:#fff; background:#b20c2b; }
#game-shell.online-match .readout > div:last-child { min-width:62px; }
@media (max-height: 760px) {
  body:has(.rooms-screen:not(.hidden)) { overflow:hidden; }
  .menu-screen:not(.hidden) { overflow-y:auto; align-items:flex-start; }
  .menu-content { margin:20px auto; }
  .menu-title { font-size:clamp(54px,10vh,100px); }
  .menu-tag { margin:8px 0; }
  .menu-buttons { gap:8px; }
  .rooms-card { margin: 18px auto; }
  .menu-legend { margin-top:10px; }
}
@media (max-width:480px) {
  .rooms-card { width:min(94%,460px); }
  .online-status { top:6px; gap:5px; padding:6px; }
  .online-status button { padding:6px; }
  .room-feedback { font-size:10px; }
}


/* Dedicated rooms page: create/join are no longer squeezed into the main menu. */
#rooms-screen { isolation: isolate; }
#rooms-screen::after { content:""; position:absolute; inset:0; background:rgba(242,240,234,.68); pointer-events:none; }
#rooms-screen .menu-bg { z-index:-1; }
#rooms-screen .rooms-card { position:relative; z-index:1; width:min(92vw,470px); text-align:left; padding:clamp(22px,4vw,34px); }
#rooms-screen .rooms-card .eyebrow { margin-bottom:4px; }
#rooms-screen .rooms-card h1 { margin:0 0 8px; font-size:clamp(40px,7vw,56px); }
.rooms-description { margin:0 0 20px; max-width:42ch; color:rgba(11,11,13,.72); font-size:13px; line-height:1.6; font-weight:600; }
.rooms-name-field { margin-bottom:14px; }
#rooms-screen .room-field span { display:block; }
#rooms-screen .room-field input { min-height:44px; font-size:15px; }
#rooms-screen .room-primary { display:flex; align-items:center; justify-content:space-between; min-height:50px; padding:0 16px; font-family:var(--display); font-size:20px; letter-spacing:.12em; border:2px solid var(--ink); box-shadow:4px 4px 0 var(--accent); }
#rooms-screen .room-primary span { font-size:25px; }
.rooms-or { display:flex; align-items:center; gap:10px; margin:18px 0 14px; color:rgba(11,11,13,.58); font-size:9px; font-weight:900; letter-spacing:.14em; white-space:nowrap; }
.rooms-or span { height:1px; flex:1; background:rgba(11,11,13,.24); }
#rooms-screen .room-join-row { align-items:flex-end; gap:10px; }
#rooms-screen .room-secondary { min-height:44px; min-width:94px; font-family:var(--display); font-size:18px; letter-spacing:.1em; border:2px solid var(--ink); }
#rooms-screen .room-feedback { min-height:32px; margin-top:14px; font-size:12px; }
#rooms-screen .rooms-back-button { width:100%; margin-top:6px; box-shadow:3px 3px 0 var(--ink); transform:none; font-size:16px; }
#rooms-screen .rooms-back-button:hover { background:var(--ink); color:var(--paper); }
.online-status { z-index: 80; }
@media (max-height: 650px) {
  #rooms-screen:not(.hidden) { overflow-y:auto; align-items:flex-start; }
  #rooms-screen .rooms-card { margin:16px auto 24px; }
  .rooms-description { margin-bottom:12px; }
}
