:root {
  --bg: #0e1424;
  --panel: #16203b;
  --text: #f5f7ff;
  --muted: #a8b5db;
  --accent: #ff6fa9;
  --accent-2: #7be0ff;
  --good: #91f2b3;
  --warn: #ffd36d;
  --danger: #ff8e8e;
  --shadow: 0 16px 48px rgba(0, 0, 0, 0.32);
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
body { min-height: 100dvh; }
button, input, select { font: inherit; }
.app-shell, .screen-host { min-height: 100dvh; }
.screen { width: 100%; min-height: 100dvh; }
.screen--centered {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(20px, env(safe-area-inset-top)) 20px max(20px, env(safe-area-inset-bottom));
}
.screen--puzzle {
  padding: max(8px, env(safe-area-inset-top)) 8px max(8px, env(safe-area-inset-bottom));
}
.panel {
  background: linear-gradient(180deg, rgba(26,36,68,0.97), rgba(17,24,45,0.99));
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: var(--shadow);
}
.card { border-radius: 24px; padding: 22px; }
.login-card { width: min(100%, 430px); }
.eyebrow {
  text-transform: none;
  font-size: 0.74rem;
  letter-spacing: 0.14em;
  color: var(--accent-2);
  margin-bottom: 10px;
}
h1, h2, h3, p { margin: 0; }
h1 { font-size: 1.85rem; margin-bottom: 8px; }
.muted { color: var(--muted); line-height: 1.45; }
.player-line {
  margin-top: 14px;
  display: inline-flex;
  gap: 8px;
  align-items: center;
  padding: 9px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  font-weight: 700;
}
.player-line--button {
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--text);
  cursor: pointer;
}
.stack-form { margin-top: 18px; display: grid; gap: 12px; }
.code-input {
  width: 100%;
  height: 60px;
  border-radius: 18px;
  border: 2px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.05);
  color: var(--text);
  text-align: center;
  font-size: 1.45rem;
  text-transform: none;
  letter-spacing: 0.16em;
  font-weight: 800;
}
.code-input:focus {
  outline: none;
  border-color: var(--accent-2);
  box-shadow: 0 0 0 4px rgba(123,224,255,0.18);
}
.primary-button, .player-button, .small-button, .keypad-cell, .toggle-pill, .route-pill, .pattern-cell, .bit-cell {
  border: none;
  border-radius: 18px;
  padding: 14px 18px;
  font-weight: 800;
  cursor: pointer;
}
.primary-button { background: linear-gradient(135deg, var(--accent), #ff9b6d); color: #1e0f17; }
.player-button, .small-button, .keypad-cell, .toggle-pill, .route-pill, .pattern-cell, .bit-cell {
  background: rgba(255,255,255,0.08);
  color: var(--text);
}
.player-button.is-selected { outline: 2px solid var(--accent-2); }
.status-text { min-height: 1.2em; color: var(--warn); }
.status-text.error { color: var(--danger); }
.status-text.good { color: var(--good); }
.player-chooser { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hidden { display: none !important; }

.puzzle-card {
  min-height: calc(100dvh - max(16px, env(safe-area-inset-top) + env(safe-area-inset-bottom)));
  height: calc(100dvh - max(16px, env(safe-area-inset-top) + env(safe-area-inset-bottom)));
  border: none;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 0;
  overflow: hidden;
}
.puzzle-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px 8px;
}
.puzzle-name {
  min-width: 0;
  font-weight: 900;
  font-size: 1.05rem;
  line-height: 1.1;
  letter-spacing: 0.02em;
}
.small-button--top {
  padding: 10px 14px;
  border-radius: 14px;
  white-space: nowrap;
  flex-shrink: 0;
}
.game-body {
  min-height: 0;
  display: grid;
  align-content: stretch;
  gap: 0;
  overflow: hidden;
  padding: 8px;
}
.single-box {
  min-height: 0;
  height: 100%;
  display: grid;
  gap: 10px;
  align-content: stretch;
  position: relative;
  border-radius: 22px;
  overflow: hidden;
}
.canvas-fill {
  min-height: 0;
  min-width: 0;
  display: grid;
  overflow: hidden;
  border-radius: 20px;
}
.canvas-fill canvas {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 20px;
  background: rgba(0,0,0,0.22);
  overflow: hidden;
}
.canvas-fill--square { aspect-ratio: 1 / 1; }
.signal-display {
  display: grid;
  place-items: center;
  text-align: center;
  padding: 0 6px;
  font-size: clamp(1.5rem, 8vw, 3rem);
  line-height: 1.18;
  letter-spacing: 0.14em;
  font-weight: 900;
  text-shadow: 2px 0 0 rgba(255,111,169,0.28), -2px 0 0 rgba(123,224,255,0.28);
}
.slider-slot { display: grid; align-items: center; min-height: 64px; }
input[type="range"] {
  width: 100%;
  accent-color: var(--accent-2);
  height: 32px;
  margin: 0;
}
.control-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}
.control-row--laser {
  grid-template-columns: 1fr auto;
}
.control-row--laser .small-button,
.control-row--compact .small-button { min-width: 62px; padding-inline: 0; }
.control-row--compact { grid-template-columns: repeat(2, 1fr); gap: 10px; }
.terminal {
  min-height: 170px;
  border-radius: 18px;
  background: #09111d;
  border: 1px solid rgba(123,224,255,0.22);
  padding: 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: #9afcc1;
  display: grid;
  align-content: center;
  gap: 6px;
}
.terminal-line { opacity: 0.92; }
.meter {
  height: 14px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  overflow: hidden;
}
.meter > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  width: 0%;
}
.control-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.toggle-pill.is-on {
  background: linear-gradient(135deg, rgba(145,242,179,0.84), rgba(123,224,255,0.7));
  color: #0d1822;
}
.route-pill {
  display: grid;
  gap: 8px;
  justify-items: center;
  min-height: 90px;
}
.route-circles {
  display: flex;
  gap: 6px;
}
.route-circle {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.16);
}
.route-circle.is-filled {
  background: var(--accent-2);
  box-shadow: 0 0 0 4px rgba(123,224,255,0.18);
}
.route-label { font-size: 0.95rem; }
.glitch-grid {
  display: grid;
  gap: 6px;
  justify-content: center;
  align-content: center;
  min-height: 0;
}
.glitch-tile {
  width: min(14vw, 52px);
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 14px;
  font-weight: 900;
  font-size: clamp(1rem, 5vw, 1.5rem);
}
.vault-wrap {
  width: min(100%, 360px);
  min-width: 0;
  margin: 0 auto;
  display: grid;
  gap: 12px;
  align-content: center;
}
.vault-wrap--sequence { width: min(100%, 330px); }
.vault-sequence {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  align-content: center;
}
.vault-sequence-cell {
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  border-radius: 18px;
  font-size: clamp(1.6rem, 9vw, 2.1rem);
  font-weight: 900;
  color: var(--key);
  border: 2px solid color-mix(in srgb, var(--key) 72%, white 10%);
  background: color-mix(in srgb, var(--key) 15%, rgba(255,255,255,0.04));
}
.vault-dots {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
}
.vault-dots--spaced {
  margin-bottom: 14px;
}
.vault-dot {
  aspect-ratio: 1 / 1;
  width: min(100%, 46px);
  border-radius: 50%;
  justify-self: center;
  background: color-mix(in srgb, var(--key) 24%, rgba(255,255,255,0.08));
  border: 2px solid color-mix(in srgb, var(--key) 70%, white 10%);
}
.vault-dot.is-filled {
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--key) 30%, transparent), inset 0 0 0 1px rgba(255,255,255,0.08);
}
.symbol-keypad {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
}
.keypad-cell {
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  min-width: 0;
  padding: 0;
  font-size: clamp(1.55rem, 8vw, 2rem);
  background: color-mix(in srgb, var(--key, var(--accent-2)) 18%, rgba(255,255,255,0.05));
  border: 2px solid color-mix(in srgb, var(--key, var(--accent-2)) 72%, white 10%);
  color: var(--key, var(--accent-2));
}
.keypad-cell--plain {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.12);
  color: var(--text);
}

.pattern-layout,
.binary-layout,
.rotor-layout,
.orbit-layout,
.counter-layout {
  min-height: 0;
  display: grid;
  gap: 10px;
  align-content: center;
}
.pattern-grid,
.binary-grid {
  display: grid;
  gap: 10px;
  width: min(100%, 330px);
  margin: 0 auto;
}
.pattern-grid { grid-template-columns: repeat(3, 1fr); }
.binary-grid { grid-template-columns: repeat(4, 1fr); }
.pattern-cell,
.bit-cell {
  aspect-ratio: 1 / 1;
  padding: 0;
  display: grid;
  place-items: center;
  min-width: 0;
}
.pattern-cell[data-state="0"],
.bit-cell[data-state="0"] {
  background: rgba(255,255,255,0.06);
}
.bit-cell[data-state="1"] {
  background: rgba(123,224,255,0.18);
  border: 2px solid rgba(123,224,255,0.82);
}
.pattern-cell--duo {
  position: relative;
  background: rgba(255,255,255,0.06);
  border: 2px solid rgba(255,255,255,0.12);
  overflow: hidden;
}
.pattern-cell--duo[data-active="1"] {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.85);
}
.pattern-hint,
.pattern-own {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.pattern-hint::before {
  content: '';
  position: absolute;
  inset: 18%;
  border-radius: 20px;
  opacity: 0;
}
.pattern-cell--duo[data-hint="blue"] .pattern-hint::before {
  opacity: 1;
  background: rgba(123,224,255,0.9);
  box-shadow: 0 0 0 2px rgba(123,224,255,0.25) inset;
}
.pattern-cell--duo[data-hint="red"] .pattern-hint::before {
  opacity: 1;
  background: rgba(255,111,169,0.9);
  box-shadow: 0 0 0 2px rgba(255,111,169,0.25) inset;
}
.pattern-own::before,
.pattern-own::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0;
  height: 0;
  border-radius: 999px;
  transform: translate(-50%, -50%);
  transition: width 120ms ease, height 120ms ease, opacity 120ms ease;
  opacity: 0;
}
.pattern-cell--duo[data-active="1"] .pattern-own::before {
  width: 64%;
  height: 64%;
  border: 2px solid rgba(255,255,255,0.92);
  opacity: 1;
}
.pattern-cell--duo[data-active="1"] .pattern-own::after {
  width: 22%;
  height: 22%;
  background: rgba(255,255,255,0.92);
  opacity: 1;
}
.pattern-core {
  width: 54%;
  height: 54%;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
}
.bit-bar {
  width: 22%;
  height: 60%;
  border-radius: 999px;
  background: rgba(255,255,255,0.14);
}
.bit-cell[data-state="1"] .bit-bar {
  background: var(--accent-2);
}
.reel-window {
  width: min(100%, 360px);
  margin: 0 auto;
  border-radius: 18px;
  background: rgba(9,17,29,0.9);
  border: 1px solid rgba(123,224,255,0.22);
  overflow: hidden;
}
.reel-strip {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 2px;
  padding: 10px;
}
.reel-cell {
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: rgba(255,255,255,0.05);
  font-weight: 900;
  font-size: clamp(1rem, 5vw, 1.3rem);
}
.reel-cell.is-marked {
  background: rgba(123,224,255,0.16);
  color: var(--accent-2);
}
.reel-divider {
  height: 1px;
  background: rgba(255,255,255,0.08);
}

.vault-wrap--helper {
  width: min(100%, 320px);
}
.vault-helper {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.vault-helper-cell {
  aspect-ratio: 1 / 1;
  border: none;
  border-radius: 18px;
  background: rgba(255,255,255,0.08);
  color: var(--text);
  font-size: clamp(1.6rem, 10vw, 2.2rem);
  font-weight: 900;
}
.vault-helper-cell.is-hit {
  background: rgba(123,224,255,0.16);
  box-shadow: inset 0 0 0 2px rgba(123,224,255,0.62);
  color: var(--accent-2);
}
.vault-helper-progress {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.vault-helper-dot {
  height: 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.12);
}
.vault-helper-dot.is-filled {
  background: var(--accent-2);
}
.rotor-target {
  width: min(100%, 220px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.rotor-target--letters {
  width: min(100%, 220px);
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.rotor-target span {
  display: grid;
  place-items: center;
  min-height: 52px;
  border-radius: 14px;
  background: rgba(255,255,255,0.08);
  color: var(--accent-2);
  font-weight: 900;
  font-size: 1.2rem;
  letter-spacing: 0.08em;
}
.tile-shift-layout {
  min-height: 0;
  display: grid;
  gap: 10px;
  align-content: center;
}
.tile-shift-grid {
  width: min(100%, 340px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.tile-shift-cell {
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  min-width: 0;
  border-radius: 16px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.08);
  font-size: clamp(1.1rem, 7vw, 1.8rem);
  font-weight: 900;
}
.tile-shift-controls {
  width: min(100%, 340px);
  margin: 0 auto;
  display: grid;
  gap: 10px;
}
.tile-shift-controls.is-rows { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tile-shift-controls.is-cols { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tile-shift-button {
  min-width: 0;
  padding: 12px 0;
}

.solve-banner {
  border-radius: 20px;
  padding: 14px 16px;
  background: linear-gradient(135deg, rgba(145,242,179,0.22), rgba(123,224,255,0.16));
  border: 1px solid rgba(145,242,179,0.35);
}
.solve-banner .clue {
  text-align: center;
  font-size: 1.05rem;
  font-weight: 900;
  letter-spacing: 0.05em;
}
.sync-status {
  border-radius: 16px;
  padding: 12px 14px;
  background: rgba(255,142,142,0.12);
  border: 1px solid rgba(255,142,142,0.3);
  color: var(--danger);
  font-weight: 700;
}

.modal-shell {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(4, 8, 15, 0.7);
  backdrop-filter: blur(10px);
}
.modal-card {
  width: min(100%, 360px);
  border-radius: 24px;
  padding: 20px;
  display: grid;
  gap: 16px;
}
.modal-title {
  font-size: 1.2rem;
  font-weight: 900;
}
.modal-body {
  color: var(--muted);
  line-height: 1.45;
}
.modal-body p { margin: 0; }
.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.small-button--danger {
  background: linear-gradient(135deg, rgba(255,111,169,0.95), rgba(255,155,109,0.95));
  color: #180c14;
}

.solve-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  border-radius: inherit;
  overflow: hidden;
  padding: 0;
}
.solve-banner--overlay {
  height: 100%;
  border-radius: inherit;
  display: grid;
  place-items: center;
  padding: 24px;
  overflow: hidden;
}
.single-box.is-solved > *:not(.solve-overlay) {
  visibility: hidden;
  pointer-events: none;
}

@media (max-width: 640px) {
  .screen--puzzle {
    padding: max(6px, env(safe-area-inset-top)) 6px max(6px, env(safe-area-inset-bottom));
  }
  .puzzle-card {
    border-radius: 0;
    padding: 0;
  }
  .puzzle-name {
    font-size: 1rem;
  }
  .primary-button, .player-button, .small-button, .keypad-cell, .toggle-pill, .route-pill, .pattern-cell, .bit-cell {
    padding: 12px 14px;
  }
  .signal-display {
    font-size: clamp(1.2rem, 7vw, 2.5rem);
  }
  .glitch-tile {
    width: min(13vw, 46px);
  }
  .reel-cell {
    font-size: clamp(0.95rem, 4.5vw, 1.15rem);
  }
}

.rotor-hint {
  width: min(100%, 360px);
  margin: 0 auto;
  text-align: center;
  border-radius: 14px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.06);
  color: var(--accent-2);
  font-weight: 800;
}
.counter-wrap {
  width: min(100%, 340px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-content: center;
}
.counter-target {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.counter-button, .counter-digit.is-target {
  aspect-ratio: 1 / 1;
  border-radius: 18px;
  min-width: 0;
}
.counter-button {
  border: none;
  background: rgba(255,255,255,0.08);
  color: var(--text);
  display: grid;
  place-items: center;
  gap: 6px;
  padding: 8px;
  font-weight: 900;
}
.counter-plus {
  color: var(--accent-2);
  font-size: 1.2rem;
  line-height: 1;
}
.counter-digit {
  font-size: clamp(1.5rem, 9vw, 2.4rem);
  font-weight: 900;
}
.counter-digit.is-target {
  display: grid;
  place-items: center;
  background: rgba(255,255,255,0.08);
  color: var(--accent-2);
  border: 2px solid rgba(123,224,255,0.5);
}

/* Traitors-style gesture / input hardening */
html, body {
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}
* {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
button, [role="button"], canvas, .pattern-cell, .keypad-cell, .toggle-pill, .route-pill, .tile-shift-button, .vault-helper-cell {
  touch-action: manipulation;
}

.puzzle-card {
  position: relative;
  isolation: isolate;
  background: linear-gradient(180deg, rgba(12,18,34,0.88), rgba(11,18,34,0.96));
}
.fx-layer {
  position: absolute;
  inset: -12%;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  opacity: 0.96;
}
.fx-canvas {
  width: 100%;
  height: 100%;
  display: block;
}
.puzzle-topbar,
.game-body,
#solvedArea,
#syncStatus {
  position: relative;
  z-index: 1;
}

.single-box {
  position: relative;
  overflow: hidden;
  padding: 14px;
  border-radius: 24px;
  background:
    radial-gradient(circle at top left, rgba(123,224,255,0.12), transparent 34%),
    radial-gradient(circle at bottom right, rgba(255,111,169,0.1), transparent 36%),
    linear-gradient(180deg, rgba(16,24,45,0.92), rgba(10,16,30,0.94));
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 20px 42px rgba(0,0,0,0.26), inset 0 1px 0 rgba(255,255,255,0.04);
}
.single-box::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  border: 1px solid rgba(123,224,255,0.08);
}
.small-button,
.primary-button,
.player-button,
.keypad-cell,
.toggle-pill,
.route-pill,
.pattern-cell,
.bit-cell,
.vault-helper-cell,
.counter-button {
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease, border-color 120ms ease;
}
.small-button:active,
.primary-button:active,
.player-button:active,
.keypad-cell:active,
.toggle-pill:active,
.route-pill:active,
.pattern-cell:active,
.bit-cell:active,
.vault-helper-cell:active,
.counter-button:active {
  transform: scale(0.985);
}

/* Secret Signal */
.single-box--radio {
  padding: 16px;
}
.radio-shell {
  min-height: 100%;
  height: 100%;
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 14px;
}
.radio-scope-wrap {
  min-height: 0;
  border-radius: 22px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(4,10,20,0.96), rgba(8,15,28,0.96));
  border: 1px solid rgba(123,224,255,0.16);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.03), 0 10px 36px rgba(0,0,0,0.26);
}
.radio-scope {
  width: 100%;
  height: 100%;
  display: block;
  background: transparent !important;
}
.radio-dock {
  display: grid;
  place-items: center;
  padding-top: 2px;
}
.radio-dial-wrap {
  display: grid;
  place-items: center;
}
.radio-dial {
  --dial-angle: 0deg;
  width: min(41vw, 150px);
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  border: none;
  position: relative;
  background:
    radial-gradient(circle at 50% 38%, rgba(255,255,255,0.18), transparent 22%),
    radial-gradient(circle at 50% 50%, rgba(123,224,255,0.14), transparent 58%),
    linear-gradient(180deg, rgba(35,49,81,0.96), rgba(17,24,43,0.98));
  box-shadow:
    inset 0 2px 6px rgba(255,255,255,0.06),
    inset 0 -12px 22px rgba(0,0,0,0.32),
    0 18px 38px rgba(0,0,0,0.32);
  padding: 0;
  cursor: grab;
  touch-action: none;
}
.radio-dial:active { cursor: grabbing; }
.radio-dial-ring,
.radio-dial-knob,
.radio-dial::after {
  position: absolute;
  inset: 0;
  border-radius: 50%;
}
.radio-dial-ring {
  inset: 10%;
  border: 2px solid rgba(255,255,255,0.1);
  box-shadow: 0 0 0 8px rgba(123,224,255,0.05), inset 0 0 0 1px rgba(255,255,255,0.04);
}
.radio-dial-knob {
  inset: 24%;
  background:
    radial-gradient(circle at 40% 34%, rgba(255,255,255,0.22), transparent 16%),
    linear-gradient(180deg, rgba(40,56,92,0.95), rgba(13,20,37,1));
  box-shadow: inset 0 2px 10px rgba(255,255,255,0.06), inset 0 -8px 18px rgba(0,0,0,0.32);
}
.radio-dial::after {
  content: "";
  inset: 17%;
  width: 4px;
  height: 30%;
  left: 50%;
  top: 20%;
  transform-origin: 50% 100%;
  transform: translateX(-50%) rotate(var(--dial-angle));
  border-radius: 999px;
  background: linear-gradient(180deg, #ffffff, #7be0ff 68%, rgba(123,224,255,0.2));
  box-shadow: 0 0 18px rgba(123,224,255,0.5);
}


.single-box--laser-console {
  padding: 14px;
}
.laser-console-shell {
  min-height: min(76dvh, 640px);
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 14px;
}
.laser-stage {
  min-height: 0;
  border-radius: 24px;
  overflow: hidden;
  background:
    radial-gradient(circle at 20% 18%, rgba(123,224,255,0.16), transparent 34%),
    radial-gradient(circle at 80% 78%, rgba(255,111,169,0.14), transparent 34%),
    linear-gradient(180deg, rgba(5,10,18,0.98), rgba(8,14,26,0.98));
  border: 1px solid rgba(123,224,255,0.14);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 16px 34px rgba(0,0,0,0.28);
  transform: none;
}
.laser-stage canvas {
  width: 100%;
  height: 100%;
  display: block;
}
.laser-console-controls {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 14px;
  align-items: stretch;
}
.laser-joystick-block,
.laser-mirror-panel {
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(18,27,46,0.94), rgba(9,15,28,0.96));
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 14px 28px rgba(0,0,0,0.24);
}
.laser-joystick-block {
  display: grid;
  place-items: center;
  padding: 14px 0;
}
.laser-joystick-rail {
  position: relative;
  width: 54px;
  height: min(34vh, 220px);
  display: grid;
  place-items: center;
  touch-action: none;
}
.laser-joystick-track {
  position: absolute;
  inset: 8px 20px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(7,13,23,0.98), rgba(18,32,52,0.95));
  border: 1px solid rgba(123,224,255,0.12);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.03);
}
.laser-thumb {
  position: absolute;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background:
    radial-gradient(circle at 35% 30%, rgba(255,255,255,0.3), transparent 22%),
    linear-gradient(180deg, rgba(48,67,107,1), rgba(18,26,45,1));
  box-shadow: 0 10px 24px rgba(0,0,0,0.34), inset 0 1px 0 rgba(255,255,255,0.08), 0 0 0 6px rgba(123,224,255,0.06);
}
.laser-mirror-panel {
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-content: center;
}
.laser-mirror-button {
  min-height: 68px;
  border: none;
  border-radius: 18px;
  background:
    radial-gradient(circle at 24% 18%, rgba(255,255,255,0.16), transparent 18%),
    linear-gradient(180deg, rgba(23,35,58,0.98), rgba(12,18,31,0.98));
  color: var(--text);
  font-weight: 900;
  font-size: 1.45rem;
  letter-spacing: 0;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05), 0 10px 22px rgba(0,0,0,0.24);
}
.laser-mirror-button:active {
  transform: scale(0.985);
}


.single-box--shutters-device {
  padding: 14px;
}
.shutter-shell {
  min-height: min(76dvh, 640px);
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 14px;
}
.shutter-display {
  min-height: 0;
  border-radius: 24px;
  overflow: hidden;
  background:
    radial-gradient(circle at 20% 18%, rgba(123,224,255,0.12), transparent 34%),
    radial-gradient(circle at 80% 78%, rgba(255,111,169,0.12), transparent 34%),
    linear-gradient(180deg, rgba(5,10,18,0.98), rgba(8,14,26,0.98));
  border: 1px solid rgba(123,224,255,0.14);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 16px 34px rgba(0,0,0,0.28);
}
.shutter-display canvas {
  width: 100%;
  height: 100%;
  display: block;
}
.shutter-dock {
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(18,27,46,0.94), rgba(9,15,28,0.96));
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 14px 28px rgba(0,0,0,0.24);
  padding: 14px 16px;
}
.shutter-rail {
  position: relative;
  height: 58px;
  touch-action: none;
  --rail-value: 50%;
}
.shutter-rail-track {
  position: absolute;
  inset: 16px 0;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(7,13,23,0.98), rgba(18,32,52,0.95));
  border: 1px solid rgba(123,224,255,0.12);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.03);
}
.shutter-rail-thumb {
  position: absolute;
  top: 50%;
  left: var(--rail-value);
  transform: translate(-50%, -50%);
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, rgba(255,255,255,0.3), transparent 22%),
    linear-gradient(180deg, rgba(48,67,107,1), rgba(18,26,45,1));
  box-shadow: 0 10px 24px rgba(0,0,0,0.34), inset 0 1px 0 rgba(255,255,255,0.08), 0 0 0 6px rgba(123,224,255,0.06);
}
/* Slightly fresher puzzle widgets */
.canvas-fill canvas {
  background: linear-gradient(180deg, rgba(6,12,24,0.92), rgba(10,19,34,0.94));
  border: 1px solid rgba(255,255,255,0.06);
}
.terminal,
.reel-window,
.glitch-tile,
.tile-shift-cell,
.pattern-cell--duo,
.keypad-cell,
.vault-helper-cell,
.counter-button,
.counter-digit.is-target,
.vault-sequence-cell {
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 10px 24px rgba(0,0,0,0.16);
}

@media (max-width: 640px) {
  .single-box {
    padding: 12px;
    border-radius: 22px;
  }
  .radio-shell {
    min-height: 100%;
    height: 100%;
  }
  .radio-dial {
    width: min(45vw, 136px);
  }
}


.code-input { font-variant-numeric: tabular-nums; }
.radio-dial::after { height: 34%; top: 16%; }

.single-box--laser-console { padding: 10px; }
.laser-console-shell {
  position: relative;
  min-height: min(76dvh, 640px);
  border-radius: 24px;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 18%, rgba(123,224,255,0.12), transparent 32%),
    radial-gradient(circle at 82% 80%, rgba(255,111,169,0.1), transparent 32%),
    linear-gradient(180deg, rgba(7,11,20,0.98), rgba(11,16,28,0.98));
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 18px 36px rgba(0,0,0,0.24);
}
.laser-stage {
  min-height: 0;
  height: 100%;
  border-radius: 0;
  overflow: hidden;
  background: transparent;
  border: none;
  box-shadow: none;
}
.laser-console-overlay {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  display: grid;
  grid-template-columns: 66px 1fr;
  gap: 10px;
  align-items: end;
}
.laser-console-controls { display: none; }
.laser-joystick-block,
.laser-mirror-panel {
  backdrop-filter: blur(10px);
  background: linear-gradient(180deg, rgba(14,22,40,0.82), rgba(9,14,26,0.9));
}
.laser-joystick-block { padding: 10px 0; border-radius: 18px; }
.laser-joystick-rail { width: 40px; height: min(24vh, 156px); }
.laser-joystick-track { inset: 6px 14px; }
.laser-thumb { width: 28px; height: 28px; box-shadow: 0 8px 18px rgba(0,0,0,0.32), inset 0 1px 0 rgba(255,255,255,0.08), 0 0 0 4px rgba(123,224,255,0.06); }
.laser-mirror-panel {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 8px;
  border-radius: 18px;
}
.laser-mirror-button { min-height: 50px; border-radius: 14px; font-size: 1.2rem; }

.single-box--shutters-device { padding: 10px; }
.shutter-shell {
  min-height: min(76dvh, 640px);
  border-radius: 24px;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 18%, rgba(123,224,255,0.12), transparent 30%),
    radial-gradient(circle at 82% 80%, rgba(255,211,109,0.08), transparent 30%),
    linear-gradient(180deg, rgba(7,11,20,0.98), rgba(11,16,28,0.98));
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 18px 36px rgba(0,0,0,0.24);
}
.shutter-display {
  border-radius: 0;
  background: transparent;
  border: none;
  box-shadow: none;
}
.shutter-dock {
  margin: 0 10px 10px;
  backdrop-filter: blur(10px);
  background: linear-gradient(180deg, rgba(18,27,46,0.82), rgba(9,15,28,0.9));
}

.single-box--vault {
  display: grid;
  gap: 12px;
  align-content: start;
}
.vault-stage {
  height: 180px;
  border-radius: 22px;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 32%, rgba(255,211,109,0.12), transparent 36%),
    linear-gradient(180deg, rgba(9,14,26,0.98), rgba(15,10,22,0.98));
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 14px 30px rgba(0,0,0,0.24);
}
.vault-stage canvas { width: 100%; height: 100%; display: block; }
.vault-wrap {
  background: linear-gradient(180deg, rgba(18,27,46,0.76), rgba(9,15,28,0.84));
  border: 1px solid rgba(255,255,255,0.06);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 12px 28px rgba(0,0,0,0.18);
}


/* v1.6 targeted fixes */
.single-box--laser-console { padding: 10px; }
.laser-console-shell {
  min-height: min(76dvh, 640px);
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 10px;
  border-radius: 24px;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 18%, rgba(123,224,255,0.12), transparent 32%),
    radial-gradient(circle at 82% 80%, rgba(255,111,169,0.1), transparent 32%),
    linear-gradient(180deg, rgba(7,11,20,0.98), rgba(11,16,28,0.98));
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 18px 36px rgba(0,0,0,0.24);
}
.laser-stage {
  min-height: 0;
  height: 100%;
  overflow: hidden;
  border-radius: 0;
  background: transparent;
  border: none;
  box-shadow: none;
}
.laser-console-overlay { display: none; }
.laser-console-controls {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 10px;
  align-items: stretch;
  padding: 0 10px 10px;
}
.laser-joystick-block,
.laser-mirror-panel {
  backdrop-filter: blur(10px);
  background: linear-gradient(180deg, rgba(14,22,40,0.82), rgba(9,14,26,0.9));
  border: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 12px 22px rgba(0,0,0,0.22);
}
.laser-joystick-block { padding: 8px 0; border-radius: 16px; }
.laser-joystick-rail { width: 36px; height: min(17vh, 118px); }
.laser-joystick-track { inset: 6px 12px; }
.laser-thumb { width: 26px; height: 26px; box-shadow: 0 8px 18px rgba(0,0,0,0.32), inset 0 1px 0 rgba(255,255,255,0.08), 0 0 0 4px rgba(123,224,255,0.06); }
.laser-mirror-panel {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 8px;
  border-radius: 16px;
}
.laser-mirror-button {
  min-height: 62px;
  border-radius: 14px;
  border: none;
  font-size: 1.25rem;
  background:
    radial-gradient(circle at 24% 18%, rgba(255,255,255,0.16), transparent 18%),
    linear-gradient(180deg, rgba(23,35,58,0.98), rgba(12,18,31,0.98));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05), 0 10px 22px rgba(0,0,0,0.24);
}

.single-box--vault {
  display: grid;
  align-content: center;
  min-height: 100%;
}
.vault-stage { display: none !important; }
.vault-wrap {
  width: min(100%, 360px);
  min-width: 0;
  margin: 0 auto;
  display: grid;
  gap: 14px;
  align-content: center;
  background: none;
  border: none;
  box-shadow: none;
}
.vault-wrap--sequence { width: min(100%, 330px); }
.vault-sequence-cell {
  border: none;
  background: linear-gradient(180deg, color-mix(in srgb, var(--key) 18%, rgba(255,255,255,0.05)), color-mix(in srgb, var(--key) 10%, rgba(7,12,22,0.92)));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06), 0 12px 24px rgba(0,0,0,0.18), 0 0 0 1px rgba(255,255,255,0.04);
}
.vault-dots { gap: 12px; }
.vault-dots--spaced { margin-bottom: 18px; }
.vault-dot {
  aspect-ratio: 1 / 1;
  width: min(100%, 52px);
  border-radius: 50%;
  justify-self: center;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: clamp(1.1rem, 5vw, 1.45rem);
  font-weight: 900;
  background: linear-gradient(180deg, rgba(31,43,68,0.95), rgba(11,16,29,0.98));
  border: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 10px 20px rgba(0,0,0,0.22), 0 0 0 1px rgba(255,255,255,0.03);
}
.vault-dot-symbol { line-height: 1; transform: translateY(-1px); }
.vault-dot.is-active { box-shadow: 0 0 0 2px rgba(255,255,255,0.78), 0 0 18px rgba(255,255,255,0.18), inset 0 1px 0 rgba(255,255,255,0.1), 0 10px 20px rgba(0,0,0,0.22); }
.vault-dot.is-filled {
  background: linear-gradient(180deg, color-mix(in srgb, var(--key) 34%, rgba(38,52,82,0.94)), color-mix(in srgb, var(--key) 16%, rgba(12,18,31,0.98)));
  color: #fff;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--key) 20%, transparent), inset 0 1px 0 rgba(255,255,255,0.08), 0 12px 24px rgba(0,0,0,0.22);
}
.keypad-cell--vault,
.vault-helper-cell {
  border: none;
  background: linear-gradient(180deg, rgba(31,43,68,0.98), rgba(12,18,31,0.98));
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 12px 24px rgba(0,0,0,0.22), 0 0 0 1px rgba(255,255,255,0.03);
}
.keypad-cell--vault:active,
.vault-helper-cell:active {
  transform: translateY(1px) scale(0.985);
  box-shadow: inset 0 3px 10px rgba(255,255,255,0.05), 0 6px 12px rgba(0,0,0,0.26), 0 0 16px rgba(123,224,255,0.12);
}
.vault-helper-cell.is-hit {
  background: linear-gradient(180deg, rgba(32,76,112,0.98), rgba(17,30,56,0.98));
  color: var(--accent-2);
  box-shadow: 0 0 0 4px rgba(123,224,255,0.12), inset 0 1px 0 rgba(255,255,255,0.08), 0 12px 24px rgba(0,0,0,0.22);
}


/* v1.7 targeted fixes */
.single-box--laser-console {
  padding: 12px;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 12px;
}
.laser-stage {
  min-height: 0;
  height: 100%;
  border-radius: 22px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(5,10,18,0.98), rgba(8,14,26,0.98));
  border: 1px solid rgba(123,224,255,0.14);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 16px 34px rgba(0,0,0,0.28);
}
.laser-console-controls {
  display: grid;
  grid-template-columns: 72px repeat(4, minmax(0, 1fr));
  gap: 10px;
  align-items: stretch;
  padding: 0;
}
.laser-joystick-block,
.laser-mirror-button {
  min-height: 96px;
  border-radius: 18px;
  backdrop-filter: blur(10px);
  background: linear-gradient(180deg, rgba(14,22,40,0.82), rgba(9,14,26,0.9));
  border: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 12px 22px rgba(0,0,0,0.22);
}
.laser-joystick-block {
  padding: 8px 0;
  display: grid;
  place-items: center;
}
.laser-joystick-rail {
  width: 36px;
  height: 92px;
}
.laser-joystick-track { inset: 6px 12px; }
.laser-thumb { width: 26px; height: 26px; }
.laser-mirror-panel {
  display: contents;
}
.laser-mirror-button {
  min-width: 0;
  font-size: 1.35rem;
}
@media (max-width: 640px) {
  .laser-console-controls {
    grid-template-columns: 60px repeat(4, minmax(0, 1fr));
    gap: 8px;
  }
  .laser-joystick-block,
  .laser-mirror-button { min-height: 82px; border-radius: 16px; }
  .laser-joystick-rail { height: 78px; width: 32px; }
  .laser-thumb { width: 24px; height: 24px; }
}
.shutter-display canvas {
  overflow: hidden;
}
/* soften vault colors/buttons without extra framing */
.vault-sequence-cell {
  background: linear-gradient(180deg, color-mix(in srgb, var(--key) 22%, rgba(255,255,255,0.04)), color-mix(in srgb, var(--key) 12%, rgba(7,12,22,0.92)));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06), 0 10px 20px rgba(0,0,0,0.16);
}
.keypad-cell--vault,
.vault-helper-cell {
  background: linear-gradient(180deg, rgba(31,43,68,0.98), rgba(12,18,31,0.98));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 10px 18px rgba(0,0,0,0.2);
}
