:root {
  /* ---- Palette: military hardware / KTANE prop ---- */
  --bg-void: #0a0b0d;
  --casing: #23262b;
  --casing-hi: #2c3037;
  --bezel: #15171b;
  --bezel-deep: #0e1013;
  --panel: #262a30;
  --panel-raised: #31363d;
  --metal: #575b62;
  --metal-light: #b8bcc0;
  --metal-mid: #7d8288;
  --metal-dark: #4a4e54;
  --label-cream: #e8e4d4;
  --timer-red: #ff2b2b;
  --glass: #0a0c0e;
  --accent-red: #ff3b30;
  --accent-red-dim: #7a2018;
  --accent-green: #3dfc6e;
  --accent-amber: #ffb020;
  --accent-cyan: #38d7f0;
  --hazard-yellow: #f5c518;
  --text-main: #eef0f2;
  --text-dim: #9aa1ab;
  --border: #3b4046;

  --font-display: "Black Ops One", "Arial Black", sans-serif;
  --font-mono: "Share Tech Mono", ui-monospace, "Courier New", monospace;
  --font-seg: "DSEG7 Classic", var(--font-mono);
  --font: var(--font-mono);

  /* ---- Material recipes ---- */
  --shadow-raised:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    inset 0 -2px 3px rgba(0, 0, 0, 0.45),
    0 4px 10px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(0, 0, 0, 0.6);
  --shadow-recess:
    inset 0 2px 8px rgba(0, 0, 0, 0.65),
    inset 0 -1px 0 rgba(255, 255, 255, 0.05),
    0 1px 0 rgba(255, 255, 255, 0.05);
  --key-travel: 0 4px 0 #101216, 0 6px 12px rgba(0, 0, 0, 0.55);
  --key-travel-down: 0 1px 0 #101216, 0 2px 4px rgba(0, 0, 0, 0.5);

  --grad-key: linear-gradient(180deg, #3a3f46, #282c31);
  --grad-plate: linear-gradient(180deg, var(--casing-hi), var(--casing));
  --grad-metal:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.05) 0 1px, transparent 1px 3px),
    linear-gradient(180deg, #93979d, #5d6167 45%, #75797f);
  --grad-carbon:
    linear-gradient(45deg, rgba(255, 255, 255, 0.02) 25%, transparent 25%, transparent 75%, rgba(255, 255, 255, 0.02) 75%),
    linear-gradient(-45deg, rgba(255, 255, 255, 0.02) 25%, transparent 25%, transparent 75%, rgba(255, 255, 255, 0.02) 75%),
    linear-gradient(180deg, #1c1f24, #16181d);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg-void);
  font-family: var(--font);
  color: var(--text-main);
}

#app {
  max-width: 460px;
  margin: 0 auto;
  min-height: 100vh;
  background:
    radial-gradient(140% 90% at 50% 0%, rgba(255, 255, 255, 0.045), transparent 60%),
    repeating-linear-gradient(100deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 4px),
    linear-gradient(180deg, #24272c, #17191d);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: hidden;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-image: linear-gradient(180deg, #9ea3a9, #4c5056 30%, #7c8188 70%, #3d4147) 1;
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.9);
}

/* subtle vignette + scanline sheen over everything, painted once */
#app::after {
  content: "";
  position: fixed;
  inset: 0;
  max-width: 460px;
  margin: 0 auto;
  pointer-events: none;
  z-index: 40;
  background:
    radial-gradient(120% 100% at 50% 50%, transparent 55%, rgba(0, 0, 0, 0.32) 100%);
}

.app-frame-bolts {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  max-width: 460px;
  margin: 0 auto;
  pointer-events: none;
  z-index: 30;
  display: none;
}

body.on-menu .app-frame-bolts {
  display: block;
}

.mute-btn {
  position: fixed;
  top: 10px;
  right: 14px;
  z-index: 50;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: rgba(20, 22, 26, 0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid #0b0d10;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 2px 6px rgba(0, 0, 0, 0.5);
  font-size: 1rem;
  line-height: 1;
  opacity: 0.75;
  transition: opacity 0.15s ease, transform 0.06s ease;
}
.mute-btn:hover { opacity: 1; }
.mute-btn:active { transform: scale(0.92); }
.mute-btn.muted { opacity: 0.5; }

.frame-bolt.fb-tl { top: 8px; left: 8px; --slot: 20deg; }
.frame-bolt.fb-tr { top: 8px; right: 8px; --slot: 105deg; }
.frame-bolt.fb-bl { bottom: 8px; left: 8px; --slot: 155deg; }
.frame-bolt.fb-br { bottom: 8px; right: 8px; --slot: 60deg; }
.frame-bolt.fb-top { top: 8px; left: 50%; transform: translateX(-50%); --slot: 80deg; }
.frame-bolt.fb-bottom { bottom: 8px; left: 50%; transform: translateX(-50%); --slot: 30deg; }
.frame-bolt.fb-left { top: 50%; left: 8px; transform: translateY(-50%); --slot: 130deg; }
.frame-bolt.fb-right { top: 50%; right: 8px; transform: translateY(-50%); --slot: 10deg; }

/* ---------- Hardware primitives ---------- */

/* Machined screw: conic rim + domed head + rotated slot */
.bolt {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, #c9ccd0, #85898f 55%, transparent 72%),
    conic-gradient(#9aa0a8, #d5d8db, #787d84, #e2e5e8, #8a8f96, #9aa0a8);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.7),
    inset 0 -1px 2px rgba(0, 0, 0, 0.5);
  position: absolute;
}
.bolt::before {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: 50%;
  background: linear-gradient(var(--slot, 45deg), transparent 42%, rgba(16, 18, 21, 0.9) 46% 54%, transparent 58%);
}
.bolt.tl { top: 8px; left: 8px; --slot: 25deg; }
.bolt.tr { top: 8px; right: 8px; --slot: 100deg; }
.bolt.bl { bottom: 8px; left: 8px; --slot: 150deg; }
.bolt.br { bottom: 8px; right: 8px; --slot: 65deg; }

/* LED: lit dome + pulsing bloom on a compositor-only layer */
@keyframes ledPulse {
  0%, 100% { opacity: 0.9; }
  50% { opacity: 0.15; }
}

.led {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
  position: relative;
  flex-shrink: 0;
  background: #24272b;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.8), 0 1px 0 rgba(255, 255, 255, 0.06);
}
.led::after {
  content: "";
  position: absolute;
  inset: -7px;
  border-radius: 50%;
  background: radial-gradient(circle, currentColor 0%, transparent 65%);
  opacity: 0.85;
  animation: ledPulse 1.1s infinite;
}
.led-red {
  background: radial-gradient(circle at 40% 32%, #ff9c94, var(--accent-red) 55%, #6e120c);
  color: var(--accent-red);
}
.led-amber {
  background: radial-gradient(circle at 40% 32%, #ffd98f, var(--accent-amber) 55%, #7a4c00);
  color: var(--accent-amber);
}
.led-amber::after { animation-delay: 0.3s; }
.led-green {
  background: radial-gradient(circle at 40% 32%, #b1ffc9, var(--accent-green) 55%, #0c6e2c);
  color: var(--accent-green);
}
.led-green::after { animation-delay: 0.6s; }

.led.steady::after {
  animation: none;
  opacity: 0.7;
}

.led-cluster {
  display: flex;
  gap: 6px;
  align-items: center;
}

.hazard-stripe {
  height: 8px;
  width: 100%;
  background: repeating-linear-gradient(
    45deg,
    var(--hazard-yellow),
    var(--hazard-yellow) 11px,
    #14171b 11px,
    #14171b 22px
  );
  border-radius: 2px;
  flex-shrink: 0;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.25),
    inset 0 -2px 3px rgba(0, 0, 0, 0.5),
    0 1px 3px rgba(0, 0, 0, 0.6);
}

/* Cable strip with rubber grommets */
.deco-wire-strip {
  display: flex;
  gap: 12px;
  padding: 13px 18px;
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.03) 0 1px, transparent 1px 3px),
    linear-gradient(180deg, #2e3238, #22252a);
  border-radius: 10px;
  border: 1px solid #0c0e11;
  box-shadow: var(--shadow-recess);
}
.deco-wire {
  flex: 1;
  height: 9px;
  border-radius: 5px;
  position: relative;
  box-shadow:
    inset 0 2px 2px rgba(255, 255, 255, 0.35),
    inset 0 -3px 3px rgba(0, 0, 0, 0.45),
    0 2px 3px rgba(0, 0, 0, 0.5);
}
.deco-wire::before,
.deco-wire::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #4a4e54, #1a1c20 70%);
  border: 2px solid #0c0e11;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.8);
  transform: translateY(-50%);
}
.deco-wire::before { left: -8px; }
.deco-wire::after { right: -8px; }
.deco-wire.red { background-color: var(--accent-red); }
.deco-wire.blue { background-color: #3b82f6; }
.deco-wire.yellow { background-color: #f2d505; }
.deco-wire.green { background-color: var(--accent-green); }

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

/* ---------- Menu Screen ---------- */

.menu-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 30px 24px;
  gap: 30px;
}

/* 3D detonator hero */
.bomb-hero-stage {
  perspective: 800px;
  width: 200px;
  height: 200px;
  touch-action: none;
}

.bomb-hero {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transform: rotateX(var(--ty, 0deg)) rotateY(var(--tx, 0deg));
  transition: transform 0.16s ease-out;
  will-change: transform;
}

@keyframes heroSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.hero-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, transparent 58%, rgba(0, 0, 0, 0.35) 62%, transparent 66%),
    conic-gradient(#8b9096, #c4c8cc, #6f747a, #d5d8db, #7d8288, #b0b4b9, #8b9096);
  box-shadow:
    0 14px 30px rgba(0, 0, 0, 0.65),
    inset 0 2px 3px rgba(255, 255, 255, 0.35),
    inset 0 -4px 8px rgba(0, 0, 0, 0.5);
}
.hero-ring .hero-dashes {
  position: absolute;
  inset: 7px;
  border-radius: 50%;
  border: 2px dashed rgba(56, 215, 240, 0.4);
  animation: heroSpin 16s linear infinite;
}

.hero-core {
  position: absolute;
  inset: 20px;
  border-radius: 50%;
  transform: translateZ(24px);
  transform-style: preserve-3d;
  background:
    radial-gradient(circle at 38% 30%, #3b4048, #1d2025 60%, #101216 90%);
  box-shadow:
    inset 0 2px 4px rgba(255, 255, 255, 0.12),
    inset 0 -8px 16px rgba(0, 0, 0, 0.7),
    0 10px 20px rgba(0, 0, 0, 0.55);
}

.hero-glass {
  position: absolute;
  inset: 26px;
  border-radius: 50%;
  transform: translateZ(16px);
  background:
    radial-gradient(circle at 50% 30%, rgba(255, 60, 48, 0.12), transparent 60%),
    radial-gradient(circle at 38% 28%, #171a1f, #08090c 80%);
  border: 1px solid #000;
  box-shadow:
    inset 0 2px 6px rgba(0, 0, 0, 0.9),
    inset 0 -1px 0 rgba(255, 255, 255, 0.05),
    0 0 24px rgba(255, 43, 43, 0.14);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 9px;
}

.hero-led {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  position: relative;
  background: radial-gradient(circle at 40% 32%, #ff9c94, var(--accent-red) 55%, #6e120c);
}
.hero-led::after {
  content: "";
  position: absolute;
  inset: -12px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 59, 48, 0.9) 0%, transparent 65%);
  animation: ledPulse 1.3s infinite;
}

.hero-readout {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 4px;
  color: var(--timer-red);
  text-shadow: 0 0 8px currentColor;
  animation: ledPulse 2.6s infinite;
}

.hero-bolt-ring .bolt:nth-child(1) { top: 6px; left: 50%; margin-left: -5px; --slot: 15deg; }
.hero-bolt-ring .bolt:nth-child(2) { bottom: 6px; left: 50%; margin-left: -5px; --slot: 75deg; }
.hero-bolt-ring .bolt:nth-child(3) { left: 6px; top: 50%; margin-top: -5px; --slot: 130deg; }
.hero-bolt-ring .bolt:nth-child(4) { right: 6px; top: 50%; margin-top: -5px; --slot: 45deg; }

.menu-title {
  font-family: var(--font-display);
  font-size: 2.6rem;
  font-weight: 400;
  letter-spacing: 3px;
  text-align: center;
  color: var(--text-main);
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.7), 0 6px 14px rgba(0, 0, 0, 0.5);
}

.menu-title span {
  color: var(--timer-red);
  text-shadow: 0 0 18px rgba(255, 43, 43, 0.55), 0 2px 0 rgba(0, 0, 0, 0.7);
}

.menu-subtitle {
  color: var(--text-dim);
  text-align: center;
  margin-top: -16px;
  font-size: 0.8rem;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.difficulty-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 15px;
  perspective: 900px;
}

.difficulty-btn {
  width: 100%;
  padding: 16px 20px 16px 22px;
  border-radius: 10px;
  background: var(--grad-plate);
  border: 1px solid #0b0d10;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-start;
  position: relative;
  box-shadow: var(--shadow-raised);
  transition: transform 0.09s ease, box-shadow 0.09s ease;
  --edge: var(--accent-amber);
  overflow: hidden;
}
.difficulty-btn::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 4px;
  border-radius: 0 3px 3px 0;
  background: var(--edge);
  box-shadow: 0 0 10px var(--edge), 0 0 22px var(--edge);
  opacity: 0.85;
}
.difficulty-btn:nth-child(odd) { transform: rotate(0.35deg); }
.difficulty-btn:nth-child(even) { transform: rotate(-0.3deg); }

.difficulty-btn:active {
  transform: translateY(3px) scale(0.99);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    inset 0 -1px 2px rgba(0, 0, 0, 0.4),
    0 1px 3px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(0, 0, 0, 0.6);
}

.difficulty-btn .diff-name {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 400;
  letter-spacing: 2px;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 10px;
}

.difficulty-btn .diff-meta {
  font-size: 0.72rem;
  letter-spacing: 1px;
  color: var(--text-dim);
  text-transform: uppercase;
}

.difficulty-btn .diff-led { width: 8px; height: 8px; }

.difficulty-btn.easy { --edge: var(--accent-green); }
.difficulty-btn.easy .diff-name { color: var(--accent-green); }

.difficulty-btn.medium { --edge: var(--accent-amber); }
.difficulty-btn.medium .diff-name { color: var(--accent-amber); }

.difficulty-btn.hard { --edge: var(--accent-red); }
.difficulty-btn.hard .diff-name { color: var(--accent-red); }

.difficulty-btn.impossible {
  --edge: #a855f7;
  background:
    linear-gradient(135deg, rgba(168, 85, 247, 0.1), transparent 55%),
    var(--grad-plate);
}
.difficulty-btn.impossible .diff-name {
  color: #c084fc;
  animation: pulse 1.4s infinite;
}

.difficulty-btn.disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* ---------- Game Screen ---------- */

.game-screen {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(20, 22, 26, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid #0b0d10;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.05), 0 6px 16px rgba(0, 0, 0, 0.45);
  position: sticky;
  top: 0;
  z-index: 5;
}

.back-btn {
  color: var(--text-dim);
  font-size: 0.8rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 8px 10px;
  border-radius: 8px;
}
.back-btn:active { background: var(--panel-raised); }

.timer-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* 7-segment display on smoked glass */
.timer {
  font-family: var(--font-seg);
  font-size: 1.55rem;
  color: var(--timer-red);
  position: relative;
  padding: 7px 12px 5px;
  background: linear-gradient(180deg, #0b0d10, #050609);
  border-radius: 7px;
  border: 1px solid #000;
  box-shadow:
    var(--shadow-recess),
    0 1px 0 rgba(255, 255, 255, 0.07);
  transition: color 0.3s ease;
  contain: content;
}
.timer .timer-ghost {
  position: absolute;
  left: 12px;
  top: 7px;
  color: var(--timer-red);
  opacity: 0.07;
  pointer-events: none;
}
.timer .timer-digits {
  position: relative;
  text-shadow: 0 0 9px currentColor;
}

.timer.warn { color: var(--accent-amber); }
.timer.danger { color: var(--timer-red); }
.timer.danger .timer-digits {
  animation: pulse 0.6s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.progress-label {
  font-size: 0.7rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-dim);
}

.bomb-body {
  flex: 1;
  padding: 22px 16px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
}

/* carbon-fiber faceplate */
.bomb-casing {
  width: 100%;
  background: var(--grad-carbon);
  background-size: 6px 6px, 6px 6px, 100% 100%;
  border: 1px solid #0a0c0e;
  border-radius: 18px;
  padding: 18px;
  box-shadow:
    inset 0 0 40px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 10px 30px rgba(0, 0, 0, 0.5),
    0 0 0 4px #2b2f35,
    0 0 0 5px #0b0d10;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.compartment-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 13px;
}

/* KTANE-style module tray: raised module in dark bezel, status LED top-right */
.compartment {
  aspect-ratio: 1;
  border-radius: 12px;
  background: var(--grad-plate);
  border: 1px solid #0b0d10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  position: relative;
  box-shadow:
    var(--shadow-raised),
    0 0 0 3px var(--bezel-deep);
  transition: transform 0.09s ease, box-shadow 0.2s ease;
}

.compartment:active {
  transform: translateY(2px) scale(0.98);
}

.compartment .comp-icon {
  font-size: 2.6rem;
  color: var(--accent-amber);
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.6));
}

.compartment .comp-icon svg {
  width: 44px;
  height: 44px;
  display: block;
}

.compartment .bolt { width: 8px; height: 8px; }
.compartment .bolt.tl { top: 6px; left: 6px; }
.compartment .bolt.tr { top: 6px; right: 6px; }
.compartment .bolt.bl { bottom: 6px; left: 6px; }
.compartment .bolt.br { bottom: 6px; right: 6px; }

.compartment.solved .comp-icon {
  color: var(--accent-green);
}

.compartment.solved {
  border-color: rgba(61, 252, 110, 0.35);
  box-shadow:
    var(--shadow-raised),
    0 0 0 3px var(--bezel-deep),
    0 0 16px rgba(61, 252, 110, 0.18);
}

.solved-badge {
  position: absolute;
  bottom: 6px;
  right: 8px;
  color: var(--accent-green);
  font-size: 0.85rem;
  text-shadow: 0 0 8px currentColor;
}

.tile-led {
  position: absolute;
  top: 9px;
  right: 20px;
  width: 7px;
  height: 7px;
}

/* ---------- Quit confirm dialog ---------- */

.confirm-overlay {
  position: fixed;
  inset: 0;
  max-width: 460px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(4, 6, 9, 0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 45;
  animation: popIn 0.16s ease;
}

.confirm-panel {
  width: 100%;
  max-width: 320px;
  padding: 24px 20px;
  text-align: center;
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(255, 255, 255, 0.05), transparent 55%),
    linear-gradient(180deg, #272b31, #1d2025);
  border: 1px solid #0a0c0e;
  border-radius: 16px;
  box-shadow:
    0 30px 60px rgba(0, 0, 0, 0.7),
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 0 0 4px #2b2f35,
    0 0 0 5px #0b0d10;
}

@keyframes popIn {
  from { transform: scale(0.94); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.confirm-title {
  font-family: var(--font-display);
  letter-spacing: 2px;
  color: var(--accent-red);
  font-size: 1.1rem;
  margin-bottom: 8px;
  text-shadow: 0 0 16px rgba(255, 59, 48, 0.4);
}

.confirm-text {
  color: var(--text-dim);
  font-size: 0.85rem;
  line-height: 1.45;
  margin-bottom: 20px;
}

.confirm-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}
.confirm-actions .submit-btn {
  margin-top: 0;
}

.submit-btn.danger {
  background: linear-gradient(180deg, #ff6a5f, #e6402f);
  color: #2a0805;
  border: 1px solid #7a1a12;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.4),
    0 4px 0 #7a1a12,
    0 6px 12px rgba(0, 0, 0, 0.5);
}
.submit-btn.danger:active {
  transform: translateY(3px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    0 1px 0 #7a1a12,
    0 2px 4px rgba(0, 0, 0, 0.5);
}

/* ---------- Start countdown ---------- */

.countdown-overlay {
  position: fixed;
  inset: 0;
  max-width: 460px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(6, 8, 11, 0.72);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 25;
  pointer-events: none;
}

.countdown-num {
  font-family: var(--font-display);
  font-size: 6rem;
  color: var(--accent-amber);
  text-shadow: 0 0 30px rgba(255, 176, 32, 0.6), 0 3px 0 rgba(0, 0, 0, 0.6);
  animation: countPop 0.75s ease-out;
}
.countdown-num.go {
  color: var(--accent-green);
  font-size: 3.4rem;
  letter-spacing: 5px;
  text-shadow: 0 0 30px rgba(61, 252, 110, 0.6), 0 3px 0 rgba(0, 0, 0, 0.6);
}

@keyframes countPop {
  0% { transform: scale(2.2); opacity: 0; }
  28% { transform: scale(1); opacity: 1; }
  100% { transform: scale(0.7); opacity: 0; }
}

/* ---------- Puzzle Overlay: defusal module ---------- */

.puzzle-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 6, 9, 0.55);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 20;
  perspective: 900px;
}

.puzzle-sheet {
  width: 100%;
  max-width: 420px;
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(255, 255, 255, 0.05), transparent 55%),
    linear-gradient(180deg, #272b31, #1d2025);
  border: 1px solid #0a0c0e;
  border-radius: 16px;
  padding: 26px 20px 32px;
  max-height: 85vh;
  overflow-y: auto;
  animation: moduleIn 0.26s cubic-bezier(0.2, 0.9, 0.3, 1.15);
  position: relative;
  box-shadow:
    0 30px 60px rgba(0, 0, 0, 0.7),
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    inset 0 -3px 8px rgba(0, 0, 0, 0.4),
    0 0 0 4px #2b2f35,
    0 0 0 5px #0b0d10;
}

@keyframes moduleIn {
  from {
    transform: rotateX(10deg) translateZ(-60px) scale(0.94);
    opacity: 0;
  }
  to {
    transform: rotateX(0deg) translateZ(0) scale(1);
    opacity: 1;
  }
}

.puzzle-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

/* engraved label plate */
.puzzle-title {
  font-family: var(--font-mono);
  font-size: 0.92rem;
  font-weight: 400;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #2e2c24;
  background: linear-gradient(180deg, #f2eee0, #ddd8c6);
  padding: 6px 14px;
  border-radius: 4px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.8),
    inset 0 -2px 3px rgba(0, 0, 0, 0.25),
    0 2px 4px rgba(0, 0, 0, 0.5);
}

.puzzle-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.puzzle-led { width: 10px; height: 10px; }

.puzzle-close {
  font-size: 1.3rem;
  color: var(--text-dim);
  padding: 4px 10px;
  border-radius: 6px;
}
.puzzle-close:active { background: var(--panel-raised); }

.puzzle-instructions {
  color: var(--text-dim);
  font-size: 0.82rem;
  margin-bottom: 18px;
  line-height: 1.45;
}

.puzzle-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.puzzle-feedback {
  min-height: 20px;
  font-size: 0.8rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--accent-red);
}

.puzzle-feedback.good {
  color: var(--accent-green);
}

/* ---------- Shared puzzle controls: machined keys ---------- */

.keypad-grid {
  display: grid;
  grid-template-columns: repeat(3, 64px);
  gap: 12px;
  justify-content: center;
}

.keypad-grid button {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--grad-key);
  border: 1px solid #101216;
  font-size: 1.25rem;
  font-family: var(--font-mono);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    var(--key-travel);
  transition: transform 0.06s ease, box-shadow 0.06s ease;
}
.keypad-grid button:active {
  transform: translateY(3px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    var(--key-travel-down);
}

.code-display {
  font-family: var(--font-mono);
  font-size: 2rem;
  letter-spacing: 9px;
  color: var(--accent-amber);
  text-shadow: 0 0 10px rgba(255, 176, 32, 0.55);
  min-height: 52px;
  padding: 6px 16px 2px;
  background: linear-gradient(180deg, #0b0d10, #050609);
  border-radius: 7px;
  border: 1px solid #000;
  box-shadow: var(--shadow-recess);
}

.wire-rack {
  width: 100%;
}

.wire-cut-svg {
  width: 100%;
  height: auto;
  display: block;
}

.wire-cut-svg .wire-hit {
  cursor: crosshair;
  pointer-events: stroke;
}

@keyframes wireSpark {
  from {
    transform: scale(0.4);
    opacity: 1;
  }
  to {
    transform: scale(2.4);
    opacity: 0;
  }
}

.wire-spark {
  transform-box: fill-box;
  transform-origin: center;
  animation: wireSpark 0.34s ease-out forwards;
}

@media (prefers-reduced-motion: reduce) {
  .wire-spark {
    animation-duration: 0.01s;
  }
}

.simon-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  width: 100%;
}

.simon-btn {
  height: 84px;
  border-radius: 14px;
  opacity: 0.5;
  transition: opacity 0.12s ease, transform 0.08s ease;
  border: 1px solid rgba(0, 0, 0, 0.6);
  position: relative;
  overflow: hidden;
  box-shadow:
    inset 0 2px 3px rgba(255, 255, 255, 0.3),
    inset 0 -6px 10px rgba(0, 0, 0, 0.4),
    0 4px 8px rgba(0, 0, 0, 0.5);
}
.simon-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.22), transparent 45%);
  pointer-events: none;
}

.simon-btn.lit {
  opacity: 1;
  box-shadow:
    inset 0 2px 3px rgba(255, 255, 255, 0.4),
    0 0 26px currentColor,
    0 4px 8px rgba(0, 0, 0, 0.5);
}

.simon-btn:active {
  transform: translateY(2px) scale(0.98);
}

.switch-row {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
}

.switch-track {
  width: 46px;
  height: 78px;
  border-radius: 24px;
  background: linear-gradient(180deg, #17191d, #23262b);
  border: 1px solid #0b0d10;
  position: relative;
  padding: 4px;
  box-shadow: var(--shadow-recess);
}

.switch-thumb {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 30%, #9aa0a8, #5d6167 65%, #3d4147);
  position: absolute;
  left: 3px;
  bottom: 3px;
  transition: bottom 0.15s ease, background 0.15s ease;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.4),
    0 3px 6px rgba(0, 0, 0, 0.6);
}

.switch-track.on .switch-thumb {
  bottom: 37px;
  background: radial-gradient(circle at 38% 30%, #b1ffc9, var(--accent-green) 65%, #0c6e2c);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.4),
    0 0 14px rgba(61, 252, 110, 0.5),
    0 3px 6px rgba(0, 0, 0, 0.6);
}

/* bit switches (binary decoder) */
.bit-row {
  display: flex;
  gap: 13px;
  justify-content: center;
}

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

.bit-value {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-dim);
  transition: color 0.15s ease, text-shadow 0.15s ease;
}

.bit-value.lit {
  color: var(--accent-amber);
  text-shadow: 0 0 8px rgba(255, 176, 32, 0.6);
}

.bit-sum.bit-sum-match {
  color: var(--accent-green);
  text-shadow: 0 0 10px rgba(61, 252, 110, 0.55);
}

.switch-target-row {
  display: flex;
  gap: 14px;
  justify-content: center;
  margin-bottom: 4px;
}

.switch-target-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: #17191d;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.7);
}
.switch-target-dot.on {
  background: radial-gradient(circle at 40% 32%, #ffd98f, var(--accent-amber) 60%);
  border-color: var(--accent-amber);
  box-shadow: 0 0 10px rgba(255, 176, 32, 0.5);
}

.dial-lock {
  display: flex;
  gap: 18px;
  justify-content: center;
}

.dial-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.dial-arrow {
  width: 46px;
  height: 40px;
  background: var(--grad-key);
  border: 1px solid #101216;
  border-radius: 10px;
  font-size: 1.1rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), var(--key-travel);
  transition: transform 0.06s ease, box-shadow 0.06s ease;
}
.dial-arrow:active {
  transform: translateY(3px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), var(--key-travel-down);
}

.dial-value {
  width: 46px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 1.6rem;
  color: var(--accent-amber);
  text-shadow: 0 0 10px rgba(255, 176, 32, 0.5);
  padding: 2px 0;
  background: linear-gradient(180deg, #0b0d10, #050609);
  border-radius: 6px;
  border: 1px solid #000;
  box-shadow: var(--shadow-recess);
}

.dial-target {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.85rem;
  margin-bottom: 4px;
}

.wire-pair-board {
  display: flex;
  justify-content: space-between;
  width: 100%;
  gap: 40px;
  position: relative;
}

.wire-pair-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.wire-pair-col {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.wire-node {
  width: 44px;
  height: 34px;
  border-radius: 8px;
  border: 3px solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 800;
  color: rgba(0, 0, 0, 0.6);
  cursor: grab;
  touch-action: none;
  position: relative;
  box-shadow:
    inset 0 2px 2px rgba(255, 255, 255, 0.3),
    inset 0 -4px 5px rgba(0, 0, 0, 0.4),
    0 3px 5px rgba(0, 0, 0, 0.5);
}

.wire-node.selected {
  border-color: #fff;
}

.wire-node.dragging {
  cursor: grabbing;
  border-color: #fff;
  opacity: 0.85;
}

.wire-node.matched {
  opacity: 0.4;
  cursor: default;
}

.wire-node.wire-unlit {
  filter: brightness(0.4) saturate(0.6);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5);
}

.wire-node.wire-lit {
  filter: none;
  box-shadow:
    inset 0 2px 2px rgba(255, 255, 255, 0.3),
    0 0 10px var(--wire-glow, currentColor),
    0 0 20px var(--wire-glow, currentColor);
  transition: filter 0.25s ease, box-shadow 0.25s ease;
}

.submit-btn {
  margin-top: 6px;
  padding: 13px 30px;
  border-radius: 10px;
  background: linear-gradient(180deg, #4ffc84, #2ec95a);
  color: #06280f;
  font-family: var(--font-mono);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  font-size: 0.9rem;
  border: 1px solid #0a3d1a;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.45),
    0 4px 0 #14672e,
    0 6px 12px rgba(0, 0, 0, 0.5);
  transition: transform 0.06s ease, box-shadow 0.06s ease;
}
.submit-btn:active {
  transform: translateY(3px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    0 1px 0 #14672e,
    0 2px 4px rgba(0, 0, 0, 0.5);
}

.submit-btn.secondary {
  background: var(--grad-key);
  color: var(--text-main);
  border: 1px solid #101216;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    var(--key-travel);
}
.submit-btn.secondary:active {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    var(--key-travel-down);
}

.tap-grid {
  display: grid;
  grid-template-columns: repeat(3, 64px);
  gap: 11px;
  justify-content: center;
}

.tap-grid.tap-grid-2col {
  grid-template-columns: repeat(2, 64px);
}

.tap-grid.tap-grid-4col {
  grid-template-columns: repeat(4, 60px);
  gap: 8px;
}
.tap-grid.tap-grid-4col button {
  width: 60px;
}

.tap-grid button {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  background: var(--grad-key);
  border: 1px solid #101216;
  font-size: 1.3rem;
  font-family: var(--font-mono);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), var(--key-travel);
  transition: transform 0.06s ease, box-shadow 0.06s ease;
}
.tap-grid button:active {
  transform: translateY(3px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), var(--key-travel-down);
}
.tap-grid button.done {
  background: linear-gradient(180deg, rgba(61, 252, 110, 0.22), rgba(61, 252, 110, 0.1));
  border-color: rgba(61, 252, 110, 0.5);
  color: var(--accent-green);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 0 12px rgba(61, 252, 110, 0.25),
    var(--key-travel-down);
  transform: translateY(3px);
}

/* backlit inspection panel: dark glass tiles, glowing glyphs, scanner sweep */
.odd-grid {
  display: grid;
  grid-template-columns: repeat(3, 64px);
  gap: 10px;
  justify-content: center;
  position: relative;
  padding: 14px;
  background: linear-gradient(180deg, #131519, #0c0e11);
  border: 1px solid #0b0d10;
  border-radius: 14px;
  box-shadow:
    var(--shadow-recess),
    0 0 0 3px #2b2f35,
    0 0 0 4px #0b0d10;
  overflow: hidden;
}

.odd-grid::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 38%, rgba(56, 215, 240, 0.13) 50%, transparent 62%);
  transform: translateX(-100%);
  animation: oddSweep 3.2s ease-in-out infinite;
  pointer-events: none;
}

@keyframes oddSweep {
  0% { transform: translateX(-100%); }
  55%, 100% { transform: translateX(100%); }
}

@keyframes oddBreath {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.78; }
}

.odd-grid button {
  width: 64px;
  height: 64px;
  border-radius: 10px;
  background: radial-gradient(circle at 50% 35%, #23272d, #101317 80%);
  border: 1px solid #0b0d10;
  font-size: 1.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-amber);
  text-shadow: 0 0 9px currentColor, 0 0 24px rgba(255, 176, 32, 0.35);
  box-shadow:
    inset 0 2px 5px rgba(0, 0, 0, 0.7),
    inset 0 -1px 0 rgba(255, 255, 255, 0.05),
    0 1px 0 rgba(255, 255, 255, 0.05);
  animation: oddBreath 2.6s ease-in-out infinite;
  transition: transform 0.06s ease;
  position: relative;
}
.odd-grid button:nth-child(2n) { animation-delay: 0.5s; }
.odd-grid button:nth-child(3n) { animation-delay: 1.1s; }
.odd-grid button:nth-child(5n) { animation-delay: 1.7s; }

.odd-grid button:active {
  transform: scale(0.93);
}

/* wrong pick: red flicker + shake */
@keyframes oddMissShake {
  0%, 100% { transform: translateX(0); opacity: 1; }
  15% { transform: translateX(-5px); opacity: 0.5; }
  30% { transform: translateX(5px); opacity: 1; }
  45% { transform: translateX(-4px); opacity: 0.4; }
  60% { transform: translateX(4px); opacity: 1; }
  80% { transform: translateX(-2px); opacity: 0.7; }
}
.odd-grid button.odd-miss {
  color: var(--accent-red);
  animation: oddMissShake 0.45s ease;
}

/* correct pick: green flare + expanding ring, rest of panel powers down */
@keyframes oddHitPop {
  0% { transform: scale(1); }
  40% { transform: scale(1.18); }
  100% { transform: scale(1.06); }
}
@keyframes oddHitRing {
  from { transform: scale(0.6); opacity: 1; }
  to { transform: scale(1.7); opacity: 0; }
}
.odd-grid button.odd-hit {
  color: var(--accent-green);
  text-shadow: 0 0 12px currentColor, 0 0 34px rgba(61, 252, 110, 0.6);
  border-color: rgba(61, 252, 110, 0.6);
  animation: oddHitPop 0.5s ease forwards;
  z-index: 1;
}
.odd-grid button.odd-hit::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 12px;
  border: 2px solid var(--accent-green);
  animation: oddHitRing 0.6s ease-out forwards;
  pointer-events: none;
}

.odd-grid.odd-solved button:not(.odd-hit) {
  animation: none;
  opacity: 0.15;
  text-shadow: none;
  transition: opacity 0.6s ease 0.12s, text-shadow 0.6s ease 0.12s;
}
.odd-grid.odd-solved::after {
  animation: none;
  opacity: 0;
}

/* ---------- Backlit glass panel kit (shared by symbol puzzles) ---------- */

.glass-panel {
  position: relative;
  padding: 14px;
  background: linear-gradient(180deg, #131519, #0c0e11);
  border: 1px solid #0b0d10;
  border-radius: 14px;
  box-shadow:
    var(--shadow-recess),
    0 0 0 3px #2b2f35,
    0 0 0 4px #0b0d10;
  overflow: hidden;
}

.glass-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 38%, rgba(56, 215, 240, 0.13) 50%, transparent 62%);
  transform: translateX(-100%);
  animation: oddSweep 3.2s ease-in-out infinite;
  pointer-events: none;
}

.glass-tile {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: radial-gradient(circle at 50% 35%, #23272d, #101317 80%);
  border: 1px solid #0b0d10;
  color: var(--accent-amber);
  text-shadow: 0 0 9px currentColor, 0 0 24px rgba(255, 176, 32, 0.35);
  box-shadow:
    inset 0 2px 5px rgba(0, 0, 0, 0.7),
    inset 0 -1px 0 rgba(255, 255, 255, 0.05),
    0 1px 0 rgba(255, 255, 255, 0.05);
  animation: oddBreath 2.6s ease-in-out infinite;
}
.glass-tile:nth-child(2n) { animation-delay: 0.5s; }
.glass-tile:nth-child(3n) { animation-delay: 1.1s; }
.glass-tile:nth-child(5n) { animation-delay: 1.7s; }

.glass-tile.gt-off {
  color: rgba(154, 161, 171, 0.45);
  text-shadow: none;
}
.glass-tile.gt-green {
  color: var(--accent-green);
  text-shadow: 0 0 12px currentColor, 0 0 30px rgba(61, 252, 110, 0.55);
}
.glass-tile.gt-cyan {
  color: var(--accent-cyan);
  text-shadow: 0 0 10px currentColor, 0 0 26px rgba(56, 215, 240, 0.5);
}
.glass-tile.gt-red {
  color: var(--accent-red);
  text-shadow: 0 0 10px currentColor, 0 0 26px rgba(255, 59, 48, 0.5);
}
.glass-tile.gt-miss {
  color: var(--accent-red);
  animation: oddMissShake 0.45s ease;
}
.glass-tile.gt-hit {
  animation: oddHitPop 0.5s ease forwards;
  z-index: 1;
}
.glass-tile.gt-hit::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 12px;
  border: 2px solid currentColor;
  animation: oddHitRing 0.6s ease-out forwards;
  pointer-events: none;
}

.glass-panel.panel-solved .glass-tile:not(.gt-keep) {
  animation: none;
  opacity: 0.15;
  text-shadow: none;
  transition: opacity 0.6s ease 0.12s, text-shadow 0.6s ease 0.12s;
}
.glass-panel.panel-solved::after {
  animation: none;
  opacity: 0;
}

.gauge-value {
  font-family: var(--font-mono);
  font-size: 2.2rem;
  color: var(--accent-amber);
  text-shadow: 0 0 12px rgba(255, 176, 32, 0.5);
  padding: 4px 18px 0;
  background: linear-gradient(180deg, #0b0d10, #050609);
  border-radius: 7px;
  border: 1px solid #000;
  box-shadow: var(--shadow-recess);
}

.gauge-slider {
  width: 100%;
  accent-color: var(--accent-green);
  height: 36px;
}

.multiselect-grid {
  display: grid;
  grid-template-columns: repeat(3, 64px);
  gap: 11px;
  justify-content: center;
}

.select-tile {
  width: 64px;
  height: 64px;
  border-radius: 12px;
  border: 3px solid rgba(0, 0, 0, 0.4);
  box-shadow:
    inset 0 2px 2px rgba(255, 255, 255, 0.25),
    inset 0 -4px 6px rgba(0, 0, 0, 0.35),
    0 3px 6px rgba(0, 0, 0, 0.5);
}

.select-tile.selected {
  border-color: #fff;
  box-shadow:
    inset 0 2px 2px rgba(255, 255, 255, 0.25),
    0 0 14px rgba(255, 255, 255, 0.35),
    0 3px 6px rgba(0, 0, 0, 0.5);
}

.rotate-row {
  display: flex;
  gap: 40px;
  justify-content: center;
  align-items: center;
}

.rotate-arrow {
  font-size: 3rem;
  transition: transform 0.15s ease;
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.6));
}

.target-arrow {
  opacity: 0.5;
}

/* ---------- More Puzzle Styles ---------- */

.memory-grid {
  display: grid;
  grid-template-columns: repeat(3, 64px);
  gap: 10px;
  justify-content: center;
}

.memory-card {
  width: 64px;
  height: 64px;
  font-size: 1.5rem;
  cursor: pointer;
  transition: transform 0.06s ease;
}
.memory-card:active {
  transform: scale(0.93);
}

.morse-tap-btn {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 38% 30%, #ff9c94, var(--accent-red) 60%, #99201a);
  border: 3px solid #4d0f0a;
  font-family: var(--font-mono);
  font-size: 1.1rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
  box-shadow:
    inset 0 3px 4px rgba(255, 255, 255, 0.35),
    inset 0 -8px 14px rgba(0, 0, 0, 0.4),
    0 6px 0 #5c130d,
    0 10px 20px rgba(0, 0, 0, 0.6);
  transition: transform 0.05s ease, box-shadow 0.05s ease;
}
.morse-tap-btn:active {
  transform: translateY(5px);
  box-shadow:
    inset 0 3px 4px rgba(255, 255, 255, 0.25),
    inset 0 -4px 8px rgba(0, 0, 0, 0.4),
    0 1px 0 #5c130d,
    0 3px 6px rgba(0, 0, 0, 0.6);
}

.maze-grid {
  display: grid;
  grid-template-columns: repeat(3, 64px);
  gap: 6px;
  justify-content: center;
}

.maze-cell {
  width: 64px;
  height: 64px;
  font-size: 1.4rem;
}
.maze-cell.goal { border-color: rgba(61, 252, 110, 0.35); }
.maze-cell.blocked { border-color: rgba(255, 59, 48, 0.35); }

.maze-controls {
  display: flex;
  gap: 12px;
}

.color-mix-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.color-mix-swatch {
  width: 54px;
  height: 54px;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.5);
  box-shadow:
    inset 0 2px 2px rgba(255, 255, 255, 0.3),
    inset 0 -4px 6px rgba(0, 0, 0, 0.35),
    0 3px 6px rgba(0, 0, 0, 0.5);
}

.color-mix-swatch.question {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #1a1d22, #14161a);
  font-size: 1.4rem;
  color: var(--text-dim);
  box-shadow: var(--shadow-recess);
}

.color-mix-options {
  display: flex;
  gap: 14px;
}

.color-mix-swatch.option {
  cursor: pointer;
  transition: transform 0.06s ease;
}
.color-mix-swatch.option:active { transform: translateY(2px) scale(0.96); }

.cipher-legend {
  font-size: 0.95rem;
  color: var(--text-dim);
  letter-spacing: 1px;
}

.lights-grid {
  display: grid;
  grid-template-columns: repeat(3, 64px);
  gap: 6px;
  justify-content: center;
}

.light-cell {
  width: 64px;
  height: 64px;
  border-radius: 10px;
  background: linear-gradient(180deg, #1a1d22, #14161a);
  border: 1px solid #0b0d10;
  box-shadow: var(--shadow-recess);
  transition: box-shadow 0.15s ease, background 0.15s ease;
}

.light-cell.on {
  background: radial-gradient(circle at 45% 35%, #ffd98f, var(--accent-amber) 70%);
  border-color: var(--accent-amber);
  box-shadow:
    inset 0 2px 3px rgba(255, 255, 255, 0.4),
    0 0 18px rgba(255, 176, 32, 0.55);
}

.number-select-tile {
  width: 64px;
  height: 64px;
  border-radius: 12px;
  background: var(--grad-key);
  border: 2px solid #101216;
  font-family: var(--font-mono);
  font-size: 1.3rem;
  color: var(--text-main);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), var(--key-travel);
  transition: transform 0.06s ease, box-shadow 0.06s ease;
}
.number-select-tile:active {
  transform: translateY(3px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), var(--key-travel-down);
}

.number-select-tile.selected {
  border-color: var(--accent-green);
  color: var(--accent-green);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 0 12px rgba(61, 252, 110, 0.3),
    var(--key-travel-down);
  transform: translateY(3px);
}

.count-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  width: 100%;
}

.count-grid.count-grid-3col {
  grid-template-columns: repeat(3, 1fr);
}

.count-cell {
  aspect-ratio: 1;
  font-size: 1.25rem;
}

.timing-track {
  width: 100%;
  height: 40px;
  background: linear-gradient(180deg, #14161a, #1c1f24);
  border-radius: 20px;
  position: relative;
  border: 1px solid #0b0d10;
  box-shadow: var(--shadow-recess);
}

.timing-zone {
  position: absolute;
  top: 0;
  bottom: 0;
  background: rgba(61, 252, 110, 0.25);
  border-left: 2px solid var(--accent-green);
  border-right: 2px solid var(--accent-green);
  box-shadow: 0 0 12px rgba(61, 252, 110, 0.2);
}

.timing-marker {
  position: absolute;
  top: 3px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 32%, #ff9c94, var(--accent-red) 60%, #6e120c);
  box-shadow: 0 0 12px rgba(255, 59, 48, 0.6), 0 2px 4px rgba(0, 0, 0, 0.6);
  transform: translateX(-50%);
  left: 0;
}

.dpad {
  display: grid;
  grid-template-columns: repeat(3, 56px);
  grid-template-rows: repeat(3, 56px);
  gap: 6px;
  justify-content: center;
}

.dpad-btn {
  background: var(--grad-key);
  border: 1px solid #101216;
  border-radius: 10px;
  font-size: 1.4rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), var(--key-travel);
  transition: transform 0.06s ease, box-shadow 0.06s ease;
}
.dpad-btn:active {
  transform: translateY(3px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), var(--key-travel-down);
}

.dpad-up { grid-column: 2; grid-row: 1; }
.dpad-left { grid-column: 1; grid-row: 2; }
.dpad-right { grid-column: 3; grid-row: 2; }
.dpad-down { grid-column: 2; grid-row: 3; }

.wire-trace-svg {
  width: 100%;
  max-width: 260px;
  height: auto;
}

.pyramid {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.pyramid-row {
  display: flex;
  justify-content: center;
  gap: 8px;
}
.pyramid-cell {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: linear-gradient(180deg, #1a1d22, #14161a);
  border: 1px solid #0b0d10;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 1rem;
  color: var(--text-main);
  box-shadow: var(--shadow-recess);
}
.pyramid-cell.blank {
  border-color: var(--accent-amber);
  color: var(--accent-amber);
  box-shadow: var(--shadow-recess), 0 0 8px rgba(255, 176, 32, 0.2);
}

.clock-svg {
  width: 172px;
  height: 172px;
  display: block;
  margin: 0 auto;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.55));
}
.clock-svg .clock-num {
  font-family: var(--font-mono);
  fill: var(--accent-amber);
}
.clock-svg .clock-hand-h {
  stroke: var(--accent-amber);
  filter: drop-shadow(0 0 3px rgba(255, 176, 32, 0.6));
}
.clock-svg .clock-hand-m {
  stroke: var(--accent-cyan);
  filter: drop-shadow(0 0 3px rgba(56, 215, 240, 0.6));
}

.whack-grid {
  display: grid;
  grid-template-columns: repeat(3, 64px);
  gap: 6px;
  justify-content: center;
}
.whack-cell {
  width: 64px;
  height: 64px;
  border-radius: 10px;
  background: linear-gradient(180deg, #1a1d22, #14161a);
  border: 1px solid #0b0d10;
  font-size: 1.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-recess);
}
.whack-cell.active {
  background: linear-gradient(180deg, rgba(255, 176, 32, 0.3), rgba(255, 176, 32, 0.15));
  border-color: var(--accent-amber);
  box-shadow: var(--shadow-recess), 0 0 14px rgba(255, 176, 32, 0.3);
}

.whack-target {
  width: 42px;
  height: 42px;
  color: var(--accent-amber);
  filter: drop-shadow(0 0 6px rgba(255, 176, 32, 0.7));
  animation: whackPop 0.12s ease-out;
}

@keyframes whackPop {
  from { transform: scale(0.4); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .whack-target { animation: none; }
}

.majority-cell {
  aspect-ratio: 1;
  font-size: 1.25rem;
  cursor: pointer;
  transition: transform 0.06s ease;
}
.majority-cell:active {
  transform: scale(0.93);
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}
.quiz-option {
  padding: 14px;
  border-radius: 10px;
  background: var(--grad-key);
  border: 1px solid #101216;
  font-size: 0.95rem;
  color: var(--text-main);
  text-align: center;
  letter-spacing: 1px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), var(--key-travel);
  transition: transform 0.06s ease, box-shadow 0.06s ease;
}
.quiz-option:active {
  transform: translateY(3px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), var(--key-travel-down);
}

.recall-cell {
  width: 64px;
  height: 64px;
  border-radius: 10px;
  background: linear-gradient(180deg, #1a1d22, #14161a);
  border: 1px solid #0b0d10;
  box-shadow: var(--shadow-recess);
  transition: box-shadow 0.12s ease, background 0.12s ease;
}
.recall-cell.highlight {
  background: radial-gradient(circle at 45% 35%, rgba(255, 217, 143, 0.5), rgba(255, 176, 32, 0.35));
  border-color: var(--accent-amber);
  box-shadow: var(--shadow-recess), 0 0 14px rgba(255, 176, 32, 0.35);
}
.recall-cell.selected {
  border-color: var(--accent-green);
  background: linear-gradient(180deg, rgba(61, 252, 110, 0.22), rgba(61, 252, 110, 0.1));
  box-shadow: var(--shadow-recess), 0 0 12px rgba(61, 252, 110, 0.25);
}

.path-cell {
  width: 64px;
  height: 64px;
  border-radius: 10px;
  background: linear-gradient(180deg, #1a1d22, #14161a);
  border: 1px solid #0b0d10;
  box-shadow: var(--shadow-recess);
}
.path-cell.lit {
  background: radial-gradient(circle at 45% 35%, rgba(255, 217, 143, 0.55), rgba(255, 176, 32, 0.4));
  border-color: var(--accent-amber);
  box-shadow: var(--shadow-recess), 0 0 14px rgba(255, 176, 32, 0.35);
}
.path-cell.done { border-color: var(--accent-green); box-shadow: var(--shadow-recess), 0 0 10px rgba(61, 252, 110, 0.25); }

.dual-slider-row {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
}

.latin-grid {
  display: grid;
  grid-template-columns: repeat(3, 64px);
  gap: 6px;
  justify-content: center;
}
.latin-cell {
  width: 64px;
  height: 64px;
  font-size: 1.5rem;
}
.latin-cell.blank {
  border-color: rgba(56, 215, 240, 0.35);
  animation-duration: 1.4s;
}

.tf-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}
.tf-tile {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.3),
    inset 0 -2px 3px rgba(0, 0, 0, 0.35),
    0 2px 3px rgba(0, 0, 0, 0.5);
}
.tf-buttons {
  display: flex;
  gap: 14px;
}

/* wait-for-green signal button: full dome restyle per state */
.signal-timer {
  min-width: 140px;
  text-align: center;
  font-size: 1.4rem;
  letter-spacing: 2px;
}

.signal-btn {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  font-family: var(--font-mono);
  font-size: 1.05rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  border: 3px solid;
  transition: transform 0.05s ease;
}

.signal-btn.wait {
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
  background: radial-gradient(circle at 38% 30%, #ff9c94, var(--accent-red) 60%, #99201a);
  border-color: #4d0f0a;
  box-shadow:
    inset 0 3px 4px rgba(255, 255, 255, 0.35),
    inset 0 -8px 14px rgba(0, 0, 0, 0.4),
    0 6px 0 #5c130d,
    0 10px 20px rgba(0, 0, 0, 0.6),
    0 0 24px rgba(255, 59, 48, 0.3);
}
.signal-btn.wait:active {
  transform: translateY(5px);
  box-shadow:
    inset 0 3px 4px rgba(255, 255, 255, 0.25),
    inset 0 -4px 8px rgba(0, 0, 0, 0.4),
    0 1px 0 #5c130d,
    0 3px 6px rgba(0, 0, 0, 0.6);
}

.signal-btn.go {
  color: #06280f;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.25);
  background: radial-gradient(circle at 38% 30%, #b1ffc9, var(--accent-green) 60%, #128a3a);
  border-color: #0a4d20;
  box-shadow:
    inset 0 3px 4px rgba(255, 255, 255, 0.45),
    inset 0 -8px 14px rgba(0, 0, 0, 0.3),
    0 6px 0 #14672e,
    0 10px 20px rgba(0, 0, 0, 0.6),
    0 0 34px rgba(61, 252, 110, 0.5);
}
.signal-btn.go:active {
  transform: translateY(5px);
  box-shadow:
    inset 0 3px 4px rgba(255, 255, 255, 0.35),
    inset 0 -4px 8px rgba(0, 0, 0, 0.3),
    0 1px 0 #14672e,
    0 3px 6px rgba(0, 0, 0, 0.6),
    0 0 34px rgba(61, 252, 110, 0.5);
}

.signal-box {
  width: 160px;
  height: 80px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  letter-spacing: 2px;
  text-transform: uppercase;
  font-size: 1.05rem;
  color: #0b0d10;
  margin: 0 auto;
  box-shadow:
    inset 0 2px 3px rgba(255, 255, 255, 0.35),
    inset 0 -6px 10px rgba(0, 0, 0, 0.3),
    0 4px 10px rgba(0, 0, 0, 0.5);
}

/* ---------- Scale / Lever balance puzzles ---------- */

.balance-svg,
.lever-svg {
  width: 240px;
  height: auto;
  display: block;
  margin: 0 auto;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.5));
}

.sb-load {
  font-family: var(--font-mono);
  font-size: 15px;
  fill: var(--accent-amber);
}
.sb-you { fill: var(--accent-cyan); }

.balance-svg.sb-balanced .sb-load,
.balance-svg.sb-balanced .sb-you {
  fill: var(--accent-green);
}

.lever-arm {
  transform-box: view-box;
  transform-origin: 130px 118px;
  transform: rotate(0deg);
  transition: transform 0.4s cubic-bezier(0.34, 1.3, 0.5, 1);
}
.lever-tick {
  font-family: var(--font-mono);
  font-size: 9px;
  fill: var(--text-dim);
}
.lever-wlabel {
  font-family: var(--font-mono);
  font-size: 13px;
  fill: var(--text-main);
}
.lever-cw { fill: var(--accent-amber); }
.lever-hit { cursor: pointer; }
.lever-svg.lever-balanced .lever-cw,
.lever-svg.lever-balanced .lever-wlabel {
  fill: var(--accent-green);
}

.chip-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
.chip-btn {
  min-width: 48px;
  padding: 11px 14px;
  border-radius: 10px;
  background: var(--grad-key);
  border: 1px solid #101216;
  font-family: var(--font-mono);
  font-size: 1rem;
  color: var(--text-main);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), var(--key-travel);
  transition: transform 0.06s ease, box-shadow 0.06s ease;
}
.chip-btn:active {
  transform: translateY(3px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), var(--key-travel-down);
}
.chip-reset { color: var(--text-dim); }

/* ---------- Pipe Connect ---------- */

.pipe-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.pipe-port {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 32%, #4a4e54, #1a1c20 70%);
  border: 2px solid #0b0d10;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.8);
  flex-shrink: 0;
  transition: background 0.25s ease, box-shadow 0.25s ease;
}
.pipe-stage.pipe-solved .pipe-port {
  background: radial-gradient(circle at 40% 32%, #b1ffc9, var(--accent-green) 60%);
  box-shadow: 0 0 12px rgba(61, 252, 110, 0.6);
}

.pipe-grid {
  display: grid;
  grid-template-columns: repeat(3, 60px);
  grid-template-rows: repeat(3, 60px);
  gap: 4px;
  padding: 10px;
  background: linear-gradient(180deg, #131519, #0c0e11);
  border: 1px solid #0b0d10;
  border-radius: 12px;
  box-shadow: var(--shadow-recess), 0 0 0 3px #2b2f35, 0 0 0 4px #0b0d10;
}
.pipe-tile {
  width: 60px;
  height: 60px;
  padding: 0;
  border: 1px solid #0b0d10;
  border-radius: 8px;
  background: radial-gradient(circle at 50% 35%, #23272d, #101317 80%);
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.6);
  cursor: pointer;
  transition: box-shadow 0.2s ease;
}
.pipe-tile svg { display: block; width: 100%; height: 100%; }
.pipe-rot {
  transform-box: view-box;
  transform-origin: 30px 30px;
  transition: transform 0.18s ease;
}
.pipe-conduit {
  transition: stroke 0.2s ease;
}
.pipe-tile.flow {
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.6), 0 0 14px rgba(61, 252, 110, 0.35);
}

/* ---------- Debug Screen ---------- */

.debug-screen {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.debug-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: rgba(20, 22, 26, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid #0b0d10;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.05);
  position: sticky;
  top: 0;
  z-index: 5;
}

.debug-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 18px;
}

.debug-card {
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(255, 255, 255, 0.04), transparent 55%),
    linear-gradient(180deg, #272b31, #1d2025);
  border: 1px solid #0a0c0e;
  border-radius: 14px;
  padding: 16px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    0 6px 16px rgba(0, 0, 0, 0.45),
    0 0 0 3px #2b2f35,
    0 0 0 4px #0b0d10;
}

.debug-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.debug-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  letter-spacing: 1px;
  text-transform: uppercase;
  font-size: 0.9rem;
}

.debug-card-icon {
  display: inline-flex;
  color: var(--accent-amber);
}
.debug-card-icon svg {
  width: 18px;
  height: 18px;
}

.debug-status {
  font-size: 0.7rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #17191d;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.5);
}

.debug-status.good {
  color: var(--accent-green);
  border-color: rgba(61, 252, 110, 0.5);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.5), 0 0 10px rgba(61, 252, 110, 0.2);
}

.debug-link {
  margin-top: 24px;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.75rem;
  letter-spacing: 1px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---------- End Screens ---------- */

.end-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 32px;
  text-align: center;
}

.end-emblem {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.end-emblem svg {
  width: 54px;
  height: 54px;
}

.end-emblem.success {
  background:
    radial-gradient(circle at 40% 32%, rgba(61, 252, 110, 0.25), transparent 65%),
    radial-gradient(circle at 38% 30%, #2a2e34, #17191d 75%);
  border: 3px solid var(--accent-green);
  box-shadow:
    0 0 30px rgba(61, 252, 110, 0.35),
    inset 0 2px 4px rgba(255, 255, 255, 0.1),
    inset 0 -6px 12px rgba(0, 0, 0, 0.5);
  color: var(--accent-green);
}

.end-emblem.fail {
  background:
    radial-gradient(circle at 40% 32%, rgba(255, 59, 48, 0.3), transparent 65%),
    radial-gradient(circle at 38% 30%, #2a2e34, #17191d 75%);
  border: 3px solid var(--accent-red);
  box-shadow:
    0 0 30px rgba(255, 59, 48, 0.4),
    inset 0 2px 4px rgba(255, 255, 255, 0.1),
    inset 0 -6px 12px rgba(0, 0, 0, 0.5);
  color: var(--accent-red);
}

@keyframes shockwave {
  from {
    transform: scale(0.4);
    opacity: 0.9;
  }
  to {
    transform: scale(2.6);
    opacity: 0;
  }
}
.end-emblem.fail::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 3px solid var(--accent-red);
  animation: shockwave 1.4s ease-out infinite;
}

@keyframes endShake {
  0%, 100% { transform: translate(0, 0); }
  20% { transform: translate(-4px, 2px); }
  40% { transform: translate(4px, -2px); }
  60% { transform: translate(-3px, -2px); }
  80% { transform: translate(3px, 2px); }
}

.end-title {
  font-family: var(--font-display);
  font-size: 2.4rem;
  font-weight: 400;
  letter-spacing: 6px;
}

.end-title.success {
  color: var(--accent-green);
  text-shadow: 0 0 24px rgba(61, 252, 110, 0.5), 0 2px 0 rgba(0, 0, 0, 0.7);
}
.end-title.fail {
  color: var(--accent-red);
  text-shadow: 0 0 24px rgba(255, 59, 48, 0.6), 0 2px 0 rgba(0, 0, 0, 0.7);
}

.end-detail {
  color: var(--text-dim);
  font-size: 0.9rem;
  letter-spacing: 0.5px;
}

/* end-screen washes: pre-painted overlay, animate opacity only (compositor-safe) */
@keyframes overlayPulse {
  0%, 100% { opacity: 0; }
  50% { opacity: 1; }
}

.end-screen { position: relative; }
.end-screen > * { position: relative; z-index: 1; }
.end-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0;
}

.end-screen.fail-flash {
  animation: endShake 0.5s ease-in-out 2;
}
.end-screen.fail-flash::before {
  background: rgba(255, 59, 48, 0.14);
  animation: overlayPulse 0.7s ease-in-out infinite;
}

.end-screen.success-glow::before {
  background: radial-gradient(120% 100% at 50% 50%, transparent 45%, rgba(61, 252, 110, 0.13) 100%);
  animation: overlayPulse 2s ease-in-out infinite;
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .led::after,
  .hero-led::after,
  .hero-readout,
  .hero-ring .hero-dashes,
  .end-emblem.fail::after,
  .end-screen.fail-flash,
  .end-screen.fail-flash::before,
  .end-screen.success-glow::before,
  .odd-grid::after,
  .odd-grid button,
  .glass-panel::after,
  .glass-tile,
  .lever-arm,
  .pipe-rot,
  .countdown-num,
  .timer.danger .timer-digits,
  .difficulty-btn.impossible .diff-name {
    animation: none;
  }
  .bomb-hero {
    transition: none;
  }
}
