/* =============================================
   WIRE HEIST — STYLE (Graphics Upgraded)
   Theme: Vintage spy-heist poster — VHS/CRT feel
   ============================================= */

:root {
  --ink:   #1E1A16;
  --paper: #EDE3CF;
  --amber: #E2A33B;
  --rust:  #B6452C;
  --teal:  #3E7068;

  --amber-glow: #E2A33B88;
  --rust-glow:  #B6452C66;
  --teal-glow:  #3E706866;
  --ink-deep:   #0F0D0B;
  --paper-dim:  #B8AE96;

  --cell-size: 48px;
  --border-thick: 4px;

  --scanline-opacity: 0.03;
}

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

html, body {
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  background: var(--ink);
  color: var(--paper);
  font-family: 'Archivo', sans-serif;
  position: fixed;
  inset: 0;
}

/* =============================================
   GLOBAL SCANLINE OVERLAY
   ============================================= */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, var(--scanline-opacity)) 2px,
    rgba(0, 0, 0, var(--scanline-opacity)) 4px
  );
  mix-blend-mode: multiply;
}

/* =============================================
   NOISE TEXTURE
   ============================================= */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9998;
  opacity: 0.015;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='256' height='256' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
  background-size: 256px 256px;
}

/* =============================================
   OVERLAYS
   ============================================= */
.overlay {
  position: fixed;
  inset: 0;
  background: var(--ink);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  flex-direction: column;
}

.overlay.active {
  display: flex;
}

.overlay-content {
  text-align: center;
  max-width: 640px;
  padding: 40px;
  position: relative;
}

/* Decorative corner brackets */
.overlay-content::before,
.overlay-content::after {
  content: '';
  position: absolute;
  width: 40px;
  height: 40px;
  border-color: var(--amber);
  border-style: solid;
  opacity: 0.3;
}

.overlay-content::before {
  top: 0;
  left: 0;
  border-width: 2px 0 0 2px;
}

.overlay-content::after {
  bottom: 0;
  right: 0;
  border-width: 0 2px 2px 0;
}

.stamp-title {
  font-family: 'Big Shoulders Display', cursive;
  font-weight: 900;
  font-size: 72px;
  letter-spacing: 6px;
  color: var(--amber);
  text-transform: uppercase;
  margin-bottom: 8px;
  line-height: 1;
  text-shadow:
    0 0 20px rgba(226, 163, 59, 0.3),
    0 0 60px rgba(226, 163, 59, 0.1);
  position: relative;
}

.stamp-title::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 60%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--amber), transparent);
  opacity: 0.4;
}

.caught-title {
  color: var(--rust);
  text-shadow:
    0 0 20px rgba(182, 69, 44, 0.4),
    0 0 60px rgba(182, 69, 44, 0.15);
}

.caught-title::after {
  background: linear-gradient(90deg, transparent, var(--rust), transparent);
}

.subtitle {
  font-family: 'Special Elite', cursive;
  font-size: 18px;
  color: var(--paper);
  opacity: 0.7;
  letter-spacing: 4px;
  margin-bottom: 32px;
  position: relative;
}

.intro-text {
  font-family: 'Archivo', sans-serif;
  font-size: 16px;
  line-height: 1.7;
  color: var(--paper);
  opacity: 0.85;
  margin-bottom: 36px;
  padding: 20px 20px 20px 28px;
  border: 2px solid var(--amber);
  position: relative;
  background: rgba(226, 163, 59, 0.03);
}

.intro-text::before {
  content: '"';
  font-family: 'Big Shoulders Display', cursive;
  font-size: 60px;
  color: var(--amber);
  position: absolute;
  top: -8px;
  left: 12px;
  line-height: 1;
  opacity: 0.5;
}

.intro-text::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 40px;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(226, 163, 59, 0.05));
  pointer-events: none;
}

.win-text {
  font-family: 'Archivo', sans-serif;
  font-size: 18px;
  line-height: 1.7;
  color: var(--paper);
  margin-bottom: 36px;
  padding: 24px;
  border: 2px solid var(--teal);
  position: relative;
  background: rgba(62, 112, 104, 0.04);
}

.win-text::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--teal), transparent);
  opacity: 0.5;
}

.controls-info {
  display: flex;
  gap: 40px;
  justify-content: center;
  margin-bottom: 40px;
}

.control-col {
  text-align: center;
  padding: 16px 24px;
  border: 2px solid var(--paper);
  opacity: 0.85;
  position: relative;
  transition: all 0.2s;
}

.control-col::before {
  content: '';
  position: absolute;
  top: -2px;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--amber);
  transform: scaleX(0);
  transition: transform 0.3s;
}

.control-col:hover::before {
  transform: scaleX(1);
}

.control-label {
  font-family: 'Big Shoulders Display', cursive;
  font-weight: 700;
  font-size: 16px;
  color: var(--amber);
  letter-spacing: 2px;
  margin-bottom: 8px;
}

.control-keys {
  font-family: 'Special Elite', cursive;
  font-size: 28px;
  color: var(--paper);
  margin-bottom: 4px;
  text-shadow: 0 0 8px rgba(237, 227, 207, 0.15);
}

.control-desc {
  font-family: 'Archivo', sans-serif;
  font-size: 12px;
  color: var(--paper);
  opacity: 0.6;
}

.click-prompt {
  font-family: 'Special Elite', cursive;
  font-size: 18px;
  color: var(--amber);
  letter-spacing: 3px;
  animation: blink-prompt 1.5s ease-in-out infinite;
  cursor: pointer;
  position: relative;
  display: inline-block;
  padding: 8px 20px;
}

.click-prompt::before,
.click-prompt::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 30px;
  height: 1px;
  background: var(--amber);
  opacity: 0.3;
}

.click-prompt::before { right: 100%; margin-right: 8px; }
.click-prompt::after { left: 100%; margin-left: 8px; }

@keyframes blink-prompt {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* =============================================
   START SCREEN ANIMATIONS
   ============================================= */
.start-content {
  max-width: 700px;
  position: relative;
  z-index: 2;
}

/* Animated grid background */
.start-bg-anim {
  position: absolute;
  inset: 0;
  overflow: hidden;
  z-index: 0;
}

.start-grid-lines {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    90deg,
    transparent,
    transparent 80px,
    rgba(226, 163, 59, 0.03) 80px,
    rgba(226, 163, 59, 0.03) 81px
  );
  animation: gridScroll 20s linear infinite;
}

.start-grid-lines.h {
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 80px,
    rgba(226, 163, 59, 0.02) 80px,
    rgba(226, 163, 59, 0.02) 81px
  );
  animation: gridScrollH 25s linear infinite;
}

@keyframes gridScroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(80px); }
}

@keyframes gridScrollH {
  0%   { transform: translateY(0); }
  100% { transform: translateY(80px); }
}

/* Top decoration */
.start-top-deco {
  margin-bottom: 12px;
  opacity: 0;
  animation: fadeSlideUp 0.8s ease-out 0.2s forwards;
}

/* Classification badge */
.start-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  margin-bottom: 8px;
  opacity: 0;
  animation: fadeSlideUp 0.8s ease-out 0.4s forwards;
}

.badge-line {
  width: 40px;
  height: 1px;
  background: var(--rust);
  opacity: 0.4;
}

.badge-text {
  font-family: 'Special Elite', cursive;
  font-size: 11px;
  color: var(--rust);
  letter-spacing: 4px;
  opacity: 0.7;
}

/* Title wrapper */
.start-title-wrap {
  margin-bottom: 16px;
  opacity: 0;
  animation: fadeSlideUp 0.8s ease-out 0.5s forwards;
}

.start-title-sub {
  font-family: 'Special Elite', cursive;
  font-size: 14px;
  color: var(--paper);
  letter-spacing: 12px;
  opacity: 0.3;
  margin-bottom: -8px;
}

.start-title {
  font-size: 96px;
  line-height: 0.85;
  letter-spacing: 8px;
  margin-bottom: 8px;
  background: linear-gradient(180deg, var(--amber), #D4922A, var(--amber));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 30px rgba(226, 163, 59, 0.2));
  position: relative;
}

.start-title::after {
  display: none;
}

.start-title-line {
  width: 120px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--amber), transparent);
  margin: 8px auto;
  opacity: 0.4;
}

.start-title-tagline {
  font-family: 'Special Elite', cursive;
  font-size: 16px;
  color: var(--paper);
  letter-spacing: 8px;
  opacity: 0.5;
}

/* Drone decoration */
.start-drone-deco {
  margin: 12px auto;
  opacity: 0;
  animation: fadeSlideUp 0.8s ease-out 0.7s forwards;
}

.start-drone-svg {
  display: block;
  margin: 0 auto;
}

/* Story text */
.start-story {
  opacity: 0;
  animation: fadeSlideUp 0.8s ease-out 0.8s forwards;
  font-size: 14px;
  line-height: 1.8;
  max-width: 520px;
  margin: 0 auto 24px;
}

/* Controls */
.start-story + .controls-info {
  opacity: 0;
  animation: fadeSlideUp 0.8s ease-out 0.9s forwards;
}

/* CTA Button */
.start-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 24px 0 16px;
  opacity: 0;
  animation: fadeSlideUp 0.8s ease-out 1s forwards;
}

.cta-bracket {
  font-family: 'Big Shoulders Display', cursive;
  font-size: 32px;
  color: var(--amber);
  opacity: 0.3;
  font-weight: 700;
}

.start-cta .click-prompt {
  font-size: 20px;
  letter-spacing: 4px;
}

/* Footer */
.start-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  opacity: 0;
  animation: fadeSlideUp 0.8s ease-out 1.1s forwards;
  font-family: 'Special Elite', cursive;
  font-size: 10px;
  letter-spacing: 3px;
  color: var(--paper);
  opacity: 0.15;
}

.footer-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--amber);
  opacity: 0.3;
}

/* Title glitch effect */
#overlay-start .start-title {
  animation: fadeSlideUp 0.8s ease-out 0.5s forwards, titleGlitch 6s ease-in-out infinite 2s;
}

@keyframes fadeSlideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes titleGlitch {
  0%, 92%, 100% { transform: translateX(0); }
  93% { transform: translateX(-2px); filter: hue-rotate(10deg); }
  94% { transform: translateX(2px); }
  95% { transform: translateX(-1px); filter: hue-rotate(0deg); }
}

/* =============================================
   STAMP TRANSITION
   ============================================= */
.stamp-overlay {
  background: rgba(30, 26, 22, 0.95);
  pointer-events: none;
}

.stamp-text {
  font-family: 'Special Elite', cursive;
  font-size: 64px;
  color: var(--rust);
  letter-spacing: 6px;
  border: 6px solid var(--rust);
  padding: 16px 40px;
  transform: scale(3);
  opacity: 0;
  text-transform: uppercase;
  position: relative;
  box-shadow:
    inset 0 0 30px rgba(182, 69, 44, 0.2),
    0 0 20px rgba(182, 69, 44, 0.1);
}

.stamp-text::before {
  content: '';
  position: absolute;
  inset: 4px;
  border: 1px solid rgba(182, 69, 44, 0.3);
  pointer-events: none;
}

.stamp-overlay.active .stamp-text {
  animation: stamp-in 0.25s ease-out forwards,
             stamp-out 0.2s ease-in 0.5s forwards;
}

@keyframes stamp-in {
  0%   { transform: scale(3) rotate(-8deg); opacity: 0; }
  100% { transform: scale(1) rotate(-3deg); opacity: 1; }
}

@keyframes stamp-out {
  0%   { transform: scale(1) rotate(-3deg); opacity: 1; }
  100% { transform: scale(0.8) rotate(-3deg); opacity: 0; }
}

/* =============================================
   GAME CONTAINER
   ============================================= */
#game-container {
  display: none;
  width: 100%;
  height: 100%;
  height: 100dvh;
  flex-direction: column;
  background: var(--ink);
  position: relative;
  overflow: hidden;
}

#game-container.active {
  display: flex;
}

/* CRT vignette effect */
#game-container::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  background: radial-gradient(
    ellipse at center,
    transparent 55%,
    rgba(15, 13, 11, 0.3) 75%,
    rgba(15, 13, 11, 0.6) 100%
  );
  mix-blend-mode: multiply;
}

/* =============================================
   HUD
   ============================================= */
#hud-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 24px;
  padding-top: calc(8px + env(safe-area-inset-top, 0px));
  background: linear-gradient(180deg, var(--ink-deep), var(--ink));
  border-bottom: var(--border-thick) solid var(--paper);
  min-height: 44px;
  position: relative;
  z-index: 50;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  flex-shrink: 0;
}

/* Top HUD animated glow line */
#hud-top::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent 0%, var(--amber-glow) 30%, var(--amber) 50%, var(--amber-glow) 70%, transparent 100%);
  background-size: 200% 100%;
  animation: hudGlowSlide 4s ease-in-out infinite;
  opacity: 0.5;
}

@keyframes hudGlowSlide {
  0%, 100% { background-position: 200% 0; }
  50%      { background-position: -200% 0; }
}

.hud-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hud-separator {
  width: 1px;
  height: 20px;
  background: linear-gradient(180deg, transparent, var(--paper-dim), transparent);
  opacity: 0.2;
  flex-shrink: 0;
}

.hud-label {
  font-family: 'Special Elite', cursive;
  font-size: 12px;
  color: var(--paper);
  opacity: 0.5;
  letter-spacing: 2px;
}

.hud-value {
  font-family: 'Big Shoulders Display', cursive;
  font-weight: 700;
  font-size: 18px;
  color: var(--amber);
  letter-spacing: 1px;
  text-shadow: 0 0 10px rgba(226, 163, 59, 0.2);
}

.hud-timer {
  color: var(--rust);
  font-size: 24px;
  text-shadow: 0 0 15px rgba(182, 69, 44, 0.3);
  animation: timer-pulse 1s ease-in-out infinite;
}

.hud-timer-bar {
  width: 80px;
  height: 4px;
  background: rgba(237, 227, 207, 0.1);
  overflow: hidden;
  border-radius: 2px;
  flex-shrink: 0;
}

.hud-timer-fill {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, var(--rust), var(--amber));
  transition: width 0.1s linear;
  border-radius: 2px;
}

@keyframes timer-pulse {
  0%, 100% { text-shadow: 0 0 15px rgba(182, 69, 44, 0.3); }
  50% { text-shadow: 0 0 25px rgba(182, 69, 44, 0.6); }
}

#hud-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 24px;
  background: linear-gradient(0deg, var(--ink-deep), var(--ink));
  border-top: 2px solid rgba(237, 227, 207, 0.15);
  font-family: 'Special Elite', cursive;
  font-size: 12px;
  color: var(--paper);
  opacity: 0.5;
  letter-spacing: 1px;
  position: relative;
  z-index: 50;
  flex-shrink: 0;
}

/* Bottom HUD glow line */
#hud-bottom::before {
  content: '';
  position: absolute;
  top: -4px;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--teal-glow), transparent);
  opacity: 0.3;
}

/* =============================================
   PANELS — DRONE ONLY (FULL SCREEN)
   ============================================= */
#panels {
  display: flex;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

.panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px;
  position: relative;
  justify-content: center;
}

/* Panel ambient glow */
.panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 80%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--paper), transparent);
  opacity: 0.06;
}

.panel-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Big Shoulders Display', cursive;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 2px;
  color: var(--paper);
  opacity: 0.6;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.panel-icon {
  flex-shrink: 0;
}

/* =============================================
   GAMES GRID
   ============================================= */
.game-grid {
  display: grid;
  gap: 0;
  border: 3px solid var(--paper);
  background: var(--ink);
  position: relative;
  box-shadow:
    0 0 0 1px rgba(237, 227, 207, 0.05),
    inset 0 0 60px rgba(0, 0, 0, 0.4),
    0 0 40px rgba(0, 0, 0, 0.3),
    0 4px 20px rgba(0, 0, 0, 0.4);
}

/* Grid corner accents */
.game-grid::before,
.game-grid::after {
  content: '';
  position: absolute;
  width: 12px;
  height: 12px;
  z-index: 5;
  pointer-events: none;
}

.game-grid::before {
  top: -1px;
  left: -1px;
  border-top: 3px solid var(--amber);
  border-left: 3px solid var(--amber);
}

.game-grid::after {
  bottom: -1px;
  right: -1px;
  border-bottom: 3px solid var(--teal);
  border-right: 3px solid var(--teal);
}

.cell {
  width: var(--cell-size);
  height: var(--cell-size);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(237, 227, 207, 0.08);
}

/* Cell types */
.cell-wall {
  background: var(--paper);
  opacity: 0.14;
  position: relative;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.25), inset 0 -1px 2px rgba(255, 255, 255, 0.03);
}

/* Wall brick texture */
.cell-wall::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(90deg, transparent, transparent 8px, rgba(0,0,0,0.12) 8px, rgba(0,0,0,0.12) 9px),
    repeating-linear-gradient(0deg, transparent, transparent 5px, rgba(0,0,0,0.1) 5px, rgba(0,0,0,0.1) 6px);
  opacity: 0.8;
}

.cell-wall::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, rgba(255,255,255,0.06), transparent);
  z-index: 1;
}

/* ── FLOOR ── */
.cell-floor {
  background: transparent;
  position: relative;
}

.cell-floor::after {
  content: '';
  position: absolute;
  inset: 0;
  border: 1px solid rgba(237, 227, 207, 0.025);
}

.cell-floor::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(226, 163, 59, 0.01), transparent 70%);
  pointer-events: none;
}

.cell-door {
  background: var(--amber);
  opacity: 0.25;
  border: 2px solid var(--amber);
  position: relative;
  animation: door-idle 3s ease-in-out infinite;
  box-shadow: inset 0 0 12px rgba(226, 163, 59, 0.15);
}

@keyframes door-idle {
  0%, 100% { opacity: 0.25; box-shadow: inset 0 0 12px rgba(226, 163, 59, 0.15); }
  50% { opacity: 0.38; box-shadow: inset 0 0 20px rgba(226, 163, 59, 0.25); }
}

.cell-door::after {
  content: '';
  position: absolute;
  inset: 3px;
  border: 1px dashed rgba(226, 163, 59, 0.4);
  pointer-events: none;
}

.cell-door::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 70% 50%, rgba(226, 163, 59, 0.2), transparent 60%);
  animation: lockGlow 2s ease-in-out infinite;
  pointer-events: none;
}

@keyframes lockGlow {
  0%, 100% { opacity: 0.3; }
  50%      { opacity: 0.9; }
}

.cell-door-open {
  background: var(--amber);
  opacity: 0.5;
  border: 2px solid var(--amber);
  position: relative;
  animation: doorOpenPulse 0.5s ease-out;
  box-shadow: 0 0 15px var(--amber-glow);
}

@keyframes doorOpenPulse {
  0%   { transform: scale(1.15); box-shadow: 0 0 30px var(--amber-glow); }
  100% { transform: scale(1); box-shadow: 0 0 15px var(--amber-glow); }
}

.cell-door-open::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(226, 163, 59, 0.25), transparent 60%);
  pointer-events: none;
}

.cell-exit {
  background: var(--teal);
  opacity: 0.35;
  border: 2px dashed var(--teal);
  position: relative;
}

.cell-exit-active {
  background: var(--teal);
  opacity: 0.6;
  border: 2px solid var(--teal);
  animation: exit-pulse 1s ease-in-out infinite;
  position: relative;
  box-shadow: 0 0 12px var(--teal-glow);
}

.cell-exit-active::before {
  content: '';
  position: absolute;
  inset: -6px;
  border: 1px solid var(--teal);
  border-radius: 50%;
  opacity: 0;
  animation: exit-ring 2s ease-in-out infinite;
  pointer-events: none;
}

@keyframes exit-ring {
  0%, 100% { opacity: 0; transform: scale(0.8); }
  50% { opacity: 0.5; transform: scale(1.2); }
}

.cell-exit-active::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(62, 112, 104, 0.35), transparent 70%);
  animation: exitInnerGlow 1.5s ease-in-out infinite;
  pointer-events: none;
}

@keyframes exitInnerGlow {
  0%, 100% { opacity: 0.4; }
  50%      { opacity: 1; }
}

.cell-exit-locked {
  background: rgba(237, 227, 207, 0.06);
  border: 2px dashed rgba(237, 227, 207, 0.15);
  position: relative;
}

.cell-exit-locked::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(237, 227, 207, 0.2);
  border-radius: 2px;
}

.cell-exit-unlocking {
  background: var(--teal);
  opacity: 0.6;
  border: 2px solid var(--teal);
  animation: exit-unlock 0.5s ease-out;
}

@keyframes exit-unlock {
  0%   { transform: scale(0.5); opacity: 0; }
  50%  { transform: scale(1.2); }
  100% { transform: scale(1); opacity: 0.6; }
}

@keyframes exit-pulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 0.9; }
}

.cell-bolt {
  background: var(--amber);
  opacity: 0.3;
  position: relative;
  box-shadow: 0 0 15px var(--amber-glow);
}

.cell-bolt::before {
  content: '';
  position: absolute;
  inset: -12px;
  background: radial-gradient(circle, var(--amber-glow), transparent 70%);
  animation: bolt-aura 2s ease-in-out infinite;
  pointer-events: none;
}

@keyframes bolt-aura {
  0%, 100% { opacity: 0.3; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.15); }
}

.cell-bolt::after {
  content: '';
  position: absolute;
  top: 3px;
  right: 3px;
  width: 4px;
  height: 4px;
  background: #fff;
  border-radius: 50%;
  animation: boltSparkle 1.5s ease-in-out infinite;
  pointer-events: none;
  box-shadow: 0 0 4px #fff;
}

@keyframes boltSparkle {
  0%, 100% { opacity: 0; transform: scale(0); }
  50%      { opacity: 0.9; transform: scale(1.2); }
}

/* Fog of war — redacted style */
.cell-redacted {
  background: var(--ink-deep);
  position: relative;
}

.cell-redacted::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(
      -45deg,
      transparent,
      transparent 3px,
      rgba(237, 227, 207, 0.04) 3px,
      rgba(237, 227, 207, 0.04) 4px
    );
}

/* Redacted "CLASSIFIED" text overlay */
.cell-redacted::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 10px,
    rgba(182, 69, 44, 0.03) 10px,
    rgba(182, 69, 44, 0.03) 11px
  );
  pointer-events: none;
}

/* Drone */
.drone-marker {
  width: 28px;
  height: 28px;
  position: relative;
  z-index: 10;
  filter: drop-shadow(0 0 6px rgba(226, 163, 59, 0.5));
  animation: drone-hover 2s ease-in-out infinite;
}

@keyframes drone-hover {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}

/* Glitch Bot */
.bot-marker {
  width: 30px;
  height: 30px;
  position: relative;
  z-index: 10;
  filter: drop-shadow(0 0 4px rgba(182, 69, 44, 0.4));
}

/* Bot vision area */
.cell-bot-vision {
  background: rgba(182, 69, 44, 0.15);
  border: 1px solid rgba(182, 69, 44, 0.25);
  position: relative;
}

.cell-bot-vision::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 4px,
      rgba(182, 69, 44, 0.08) 4px,
      rgba(182, 69, 44, 0.08) 5px
    );
}

/* Danger pulse in bot vision */
.cell-bot-vision::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle at center,
    rgba(182, 69, 44, 0.08),
    transparent 70%
  );
  animation: danger-pulse 1.5s ease-in-out infinite;
  pointer-events: none;
}

@keyframes danger-pulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.8; }
}

/* Bolt marker on ground view */
.bolt-marker-ground {
  width: 24px;
  height: 24px;
  position: relative;
  z-index: 5;
}

/* =============================================
   SWITCH PANEL (FLOATING OVER DRONE)
   ============================================= */
#switch-panel {
  position: fixed;
  bottom: 8px;
  left: 8px;
  z-index: 90;
  max-width: 220px;
  border: 2px solid var(--paper);
  padding: 6px 10px;
  background: rgba(15, 13, 11, 0.88);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4), inset 0 0 20px rgba(0, 0, 0, 0.2);
}

/* Panel scanline */
#switch-panel::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 3px,
    rgba(62, 112, 104, 0.02) 3px,
    rgba(62, 112, 104, 0.02) 4px
  );
  pointer-events: none;
}

.switch-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Big Shoulders Display', cursive;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 2px;
  color: var(--teal);
  margin-bottom: 6px;
  text-transform: uppercase;
}

#switch-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.switch-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  font-family: 'Special Elite', cursive;
  font-size: 14px;
  color: var(--paper);
  border: 1px solid rgba(237, 227, 207, 0.15);
  background: transparent;
  transition: all 0.15s;
  position: relative;
}

.switch-item.selected {
  border-color: var(--amber);
  background: rgba(226, 163, 59, 0.12);
  box-shadow: inset 0 0 15px rgba(226, 163, 59, 0.05);
}

.switch-item.selected .switch-indicator {
  background: var(--amber);
  box-shadow: 0 0 8px var(--amber-glow);
}

.switch-indicator {
  width: 10px;
  height: 10px;
  border: 2px solid var(--paper);
  flex-shrink: 0;
  transition: all 0.15s;
}

.switch-item.cooldown .switch-indicator {
  background: var(--rust);
  animation: cooldown-blink 0.5s ease-in-out infinite;
  box-shadow: 0 0 6px var(--rust-glow);
}

@keyframes cooldown-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.switch-item.cooldown {
  opacity: 0.5;
}

.switch-item.active-switch .switch-indicator {
  background: var(--teal);
  border-color: var(--teal);
  box-shadow: 0 0 8px var(--teal-glow);
}

/* =============================================
   PUZZLE (FLOATING OVER DRONE)
   ============================================= */
#puzzle-panel {
  position: fixed;
  top: 65px;
  left: 91%;
  transform: translateX(-50%);
  z-index: 90;
  max-width: 280px;
  width: auto;
  border: 2px solid var(--amber);
  padding: 8px 14px;
  background: rgba(15, 13, 11, 0.92);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4), 0 0 20px rgba(226, 163, 59, 0.08), inset 0 0 20px rgba(0, 0, 0, 0.2);
}

/* Puzzle scanline */
#puzzle-panel::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 3px,
    rgba(226, 163, 59, 0.02) 3px,
    rgba(226, 163, 59, 0.02) 4px
  );
  pointer-events: none;
}

.puzzle-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Big Shoulders Display', cursive;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 2px;
  color: var(--amber);
  margin-bottom: 8px;
  text-transform: uppercase;
}

.puzzle-code-display {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-bottom: 6px;
}

.puzzle-digit {
  width: 36px;
  height: 40px;
  border: 2px solid rgba(237, 227, 207, 0.3);
  background: rgba(237, 227, 207, 0.04);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Special Elite', cursive;
  font-size: 20px;
  color: var(--paper);
  transition: all 0.2s;
  position: relative;
}

.puzzle-digit::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--amber);
  transform: scaleX(0);
  transition: transform 0.3s;
}

.puzzle-digit.filled {
  border-color: var(--amber);
  background: rgba(226, 163, 59, 0.2);
  color: var(--amber);
  text-shadow: 0 0 8px rgba(226, 163, 59, 0.3);
}

.puzzle-digit.filled::after {
  transform: scaleX(1);
}

.puzzle-digit.correct {
  border-color: var(--teal);
  background: rgba(62, 112, 104, 0.25);
  color: var(--teal);
  text-shadow: 0 0 8px rgba(62, 112, 104, 0.3);
}

.puzzle-digit.correct::after {
  background: var(--teal);
  transform: scaleX(1);
}

.puzzle-digit.wrong {
  border-color: var(--rust);
  background: rgba(182, 69, 44, 0.15);
  color: var(--rust);
  animation: shake 0.3s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-3px); }
  75% { transform: translateX(3px); }
}

.puzzle-hint {
  font-family: 'Archivo', sans-serif;
  font-size: 11px;
  color: var(--paper);
  opacity: 0.5;
  text-align: center;
  letter-spacing: 0.5px;
  margin-top: 4px;
}

.puzzle-step-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 8px;
}

.puzzle-step-label {
  font-family: 'Special Elite', cursive;
  font-size: 12px;
  color: var(--paper);
  opacity: 0.5;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.puzzle-next-num {
  font-family: 'Big Shoulders Display', cursive;
  font-weight: 900;
  font-size: 28px;
  color: var(--amber);
  line-height: 1;
  text-shadow: 0 0 12px rgba(226, 163, 59, 0.4);
  animation: nextNumPulse 1.5s ease-in-out infinite;
  min-width: 30px;
  text-align: center;
}

@keyframes nextNumPulse {
  0%, 100% { text-shadow: 0 0 12px rgba(226, 163, 59, 0.4); transform: scale(1); }
  50%      { text-shadow: 0 0 24px rgba(226, 163, 59, 0.7); transform: scale(1.1); }
}

.puzzle-progress-outer {
  width: 100%;
  height: 4px;
  background: rgba(237, 227, 207, 0.1);
  border-radius: 2px;
  overflow: hidden;
  margin: 6px 0 4px 0;
}

.puzzle-progress-inner {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--amber), var(--teal));
  border-radius: 2px;
  transition: width 0.4s ease-out;
}

.puzzle-digit-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0;
}

.puzzle-arrow {
  font-size: 14px;
  color: var(--paper);
  opacity: 0.2;
  margin: 0 2px;
}

/* Target tile highlight on grid */
.cell-puzzle-next {
  position: relative;
}

.cell-puzzle-next::after {
  content: '';
  position: absolute;
  inset: -3px;
  border: 2px solid var(--amber);
  border-radius: 2px;
  animation: puzzleTargetPulse 1.5s ease-in-out infinite;
  pointer-events: none;
  z-index: 12;
}

@keyframes puzzleTargetPulse {
  0%, 100% { opacity: 0.4; inset: -3px; }
  50%      { opacity: 1; inset: -5px; }
}

/* =============================================
   IN-GAME PUZZLE HINT ARROWS
   ============================================= */
.puzzle-hint-arrow {
  font-size: 20px;
  color: var(--amber);
  text-shadow: 0 0 10px rgba(226, 163, 59, 0.5);
  animation: hintArrowBounce 1s ease-in-out infinite;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 0 4px rgba(226, 163, 59, 0.3));
}

.puzzle-hint-arrow.right { transform: translate(-30%, -50%); }
.puzzle-hint-arrow.left  { transform: translate(-70%, -50%); }
.puzzle-hint-arrow.down  { transform: translate(-50%, -30%); }
.puzzle-hint-arrow.up    { transform: translate(-50%, -70%); }

@keyframes hintArrowBounce {
  0%, 100% { opacity: 0.6; }
  50%      { opacity: 1; }
}

.puzzle-hint-dist {
  transform: translateX(-50%);
  animation: hintDistFade 2s ease-in-out infinite;
}

@keyframes hintDistFade {
  0%, 100% { opacity: 0.4; }
  50%      { opacity: 0.8; }
}

.puzzle-digit.next {
  border-color: var(--amber);
  background: rgba(226, 163, 59, 0.1);
  animation: digitNextGlow 1.5s ease-in-out infinite;
}

@keyframes digitNextGlow {
  0%, 100% { box-shadow: 0 0 0 rgba(226, 163, 59, 0); }
  50%      { box-shadow: 0 0 10px rgba(226, 163, 59, 0.3); }
}

.puzzle-arrow.active {
  color: var(--teal);
  opacity: 0.6;
}

/* Keypad tile on grid */
.cell-keypad {
  border: 2px solid var(--amber);
  background: rgba(226, 163, 59, 0.12);
  position: relative;
}

/* Keypad glow */
.cell-keypad::before {
  content: '';
  position: absolute;
  inset: -2px;
  border: 1px solid rgba(226, 163, 59, 0.3);
  pointer-events: none;
  animation: keypad-pulse 2s ease-in-out infinite;
}

@keyframes keypad-pulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.7; }
}

.cell-keypad .keypad-num {
  font-family: 'Big Shoulders Display', cursive;
  font-weight: 900;
  font-size: 18px;
  color: var(--amber);
  line-height: 1;
  text-shadow: 0 0 6px rgba(226, 163, 59, 0.3);
}

.cell-keypad.activated {
  border-color: var(--teal);
  background: rgba(62, 112, 104, 0.2);
}

.cell-keypad.activated .keypad-num {
  color: var(--teal);
  text-shadow: 0 0 8px rgba(62, 112, 104, 0.4);
}

.cell-keypad.activated::before {
  border-color: rgba(62, 112, 104, 0.4);
  animation: none;
}

.cell-keypad.wrong-flash {
  border-color: var(--rust);
  background: rgba(182, 69, 44, 0.2);
  animation: shake 0.3s ease-in-out;
}

/* =============================================
   PROJECTILE
   ============================================= */
.cell-projectile {
  z-index: 20;
}

.cell-projectile::before {
  content: '';
  position: absolute;
  width: 10px;
  height: 10px;
  background: var(--amber);
  border-radius: 50%;
  box-shadow:
    0 0 8px var(--amber),
    0 0 20px var(--amber),
    0 0 40px rgba(226, 163, 59, 0.4),
    0 0 60px rgba(226, 163, 59, 0.2);
  animation: projectile-glow 0.15s ease-in-out;
  z-index: 20;
}

.cell-projectile::after {
  content: '';
  position: absolute;
  width: 6px;
  height: 6px;
  background: var(--amber);
  border-radius: 50%;
  opacity: 0.5;
  box-shadow: 0 0 6px var(--amber);
  z-index: 19;
}

@keyframes projectile-glow {
  0%   { transform: scale(2); opacity: 1; filter: brightness(2); }
  100% { transform: scale(1);   opacity: 0.9; filter: brightness(1); }
}

/* Bot stun flash */
.cell-bot-stun {
  animation: bot-stun-flash 0.3s ease-in-out 3;
}

@keyframes bot-stun-flash {
  0%, 100% { background: transparent; }
  50%      { background: rgba(226, 163, 59, 0.3); }
}

/* Bot dead */
.cell-bot-dead {
  opacity: 0.4;
  position: relative;
}

/* Bot dead smoke effect */
.cell-bot-dead::after {
  content: '';
  position: absolute;
  inset: -4px;
  background: radial-gradient(circle, rgba(182, 69, 44, 0.1), transparent 70%);
  animation: dead-fade 2s ease-out forwards;
  pointer-events: none;
}

@keyframes dead-fade {
  0% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.5); }
}

/* Shoot cooldown HUD */
#hud-shoot-cool .hud-value {
  color: var(--teal);
}

#hud-shoot-cool .hud-value.cooling {
  color: var(--rust);
  animation: cooldown-blink 0.5s ease-in-out infinite;
}

/* =============================================
   QUIZ OVERLAY
   ============================================= */
.quiz-box {
  max-width: 520px;
  border: 3px solid var(--amber);
  padding: 28px 32px;
  position: relative;
  background: rgba(30, 26, 22, 0.95);
  box-shadow:
    0 0 0 1px rgba(226, 163, 59, 0.2),
    inset 0 0 40px rgba(0, 0, 0, 0.3);
}

/* Quiz corner decorations */
.quiz-box::before {
  content: 'CLASSIFIED';
  position: absolute;
  top: -10px;
  right: 16px;
  font-family: 'Special Elite', cursive;
  font-size: 10px;
  color: var(--rust);
  letter-spacing: 3px;
  background: var(--ink);
  padding: 0 8px;
  opacity: 0.6;
}

.quiz-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  justify-content: center;
}

.quiz-label {
  font-family: 'Special Elite', cursive;
  font-size: 16px;
  color: var(--amber);
  letter-spacing: 3px;
  text-transform: uppercase;
}

.quiz-question {
  font-family: 'Archivo', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--paper);
  line-height: 1.5;
  margin-bottom: 24px;
  text-align: center;
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  border: 1px solid rgba(237, 227, 207, 0.1);
  background: rgba(237, 227, 207, 0.02);
}

.quiz-choices {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.quiz-choice {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid rgba(237, 227, 207, 0.25);
  background: rgba(237, 227, 207, 0.04);
  color: var(--paper);
  font-family: 'Archivo', sans-serif;
  font-size: 15px;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  position: relative;
  overflow: hidden;
}

/* Choice hover sweep */
.quiz-choice::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(226, 163, 59, 0.08), transparent);
  transition: left 0.3s;
}

.quiz-choice:hover::before {
  left: 100%;
}

.quiz-choice:hover {
  border-color: var(--amber);
  background: rgba(226, 163, 59, 0.08);
  box-shadow: inset 0 0 10px rgba(226, 163, 59, 0.05);
}

.quiz-choice.correct {
  border-color: var(--teal);
  background: rgba(62, 112, 104, 0.2);
  color: var(--teal);
  pointer-events: none;
  box-shadow: 0 0 10px rgba(62, 112, 104, 0.1);
}

.quiz-choice.wrong {
  border-color: var(--rust);
  background: rgba(182, 69, 44, 0.15);
  color: var(--rust);
  pointer-events: none;
}

.quiz-choice.disabled {
  pointer-events: none;
  opacity: 0.4;
}

.quiz-feedback {
  font-family: 'Special Elite', cursive;
  font-size: 15px;
  text-align: center;
  min-height: 24px;
  margin-bottom: 8px;
  letter-spacing: 1px;
}

.quiz-feedback.correct-fb {
  color: var(--teal);
  text-shadow: 0 0 8px rgba(62, 112, 104, 0.3);
}

.quiz-feedback.wrong-fb {
  color: var(--rust);
  text-shadow: 0 0 8px rgba(182, 69, 44, 0.3);
}

.quiz-timer-bar {
  width: 100%;
  height: 4px;
  background: rgba(237, 227, 207, 0.1);
  overflow: hidden;
  position: relative;
}

.quiz-timer-fill {
  width: 100%;
  height: 100%;
  background: var(--amber);
  transition: width 0.1s linear;
  position: relative;
}

/* Timer glow */
.quiz-timer-fill::after {
  content: '';
  position: absolute;
  right: 0;
  top: -2px;
  width: 20px;
  height: 8px;
  background: radial-gradient(ellipse, var(--amber), transparent);
  opacity: 0.6;
}

.quiz-timer-fill.urgent {
  background: var(--rust);
}

.quiz-timer-fill.urgent::after {
  background: radial-gradient(ellipse, var(--rust), transparent);
  animation: urgent-flash 0.5s ease-in-out infinite;
}

@keyframes urgent-flash {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

/* =============================================
   TOUCH CONTROLS (hidden on desktop)
   ============================================= */
#touch-controls {
  display: none;
}

/* =============================================
   MOBILE RESPONSIVE
   ============================================= */
@media (max-width: 900px) {
  :root {
    --cell-size: 24px;
  }

  #panels {
    position: relative;
    min-height: 0;
    overflow: hidden;
    padding-bottom: 0;
  }

  #panel-drone {
    flex: 1;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4px;
    padding-bottom: 80px;
    min-height: 0;
    overflow: hidden;
    position: relative;
  }

  #panel-drone .panel-header {
    position: absolute;
    top: 4px;
    left: 8px;
    z-index: 50;
    font-size: 10px;
    margin-bottom: 0;
    background: rgba(15, 13, 11, 0.7);
    padding: 2px 8px;
    border-radius: 2px;
  }

  #panel-drone .game-grid {
    border-width: 2px;
  }

  /* ===== FLOATING SWITCH PANEL ===== */
  #switch-panel {
    position: fixed;
    bottom: 140px;
    left: 8px;
    z-index: 90;
    max-width: 170px;
    padding: 4px 8px;
    background: rgba(15, 13, 11, 0.92);
    border: 1px solid rgba(237, 227, 207, 0.2);
  }

  .switch-header {
    font-size: 9px;
    margin-bottom: 2px;
  }

  .switch-item {
    padding: 3px 6px;
    font-size: 11px;
  }

  .switch-indicator {
    width: 8px;
    height: 8px;
  }

  /* ===== FLOATING PUZZLE PANEL ===== */
  #puzzle-panel {
    position: fixed;
    top: 35px;
    bottom: auto;
    left: 50%;
    transform: translateX(-50%);
    max-width: 200px;
    width: auto;
    padding: 1px 8px;
    background: rgba(15, 13, 11, 0.92);
    border: 2px solid var(--amber);
  }

  .puzzle-header {
    font-size: 10px;
    margin-bottom: 4px;
  }

  .puzzle-step-label {
    font-size: 10px;
  }

  .puzzle-next-num {
    font-size: 22px;
  }

  .puzzle-digit {
    width: 28px;
    height: 32px;
    font-size: 16px;
  }

  .puzzle-hint {
    font-size: 10px;
  }

  /* ===== HUD ===== */
  #hud-top {
    padding: 3px 8px;
    min-height: 28px;
    flex-wrap: wrap;
    gap: 2px;
    font-size: 10px;
  }

  .hud-value {
    font-size: 12px;
  }

  .hud-timer {
    font-size: 14px;
  }

  .hud-label {
    font-size: 8px;
    letter-spacing: 1px;
  }

  .hud-separator {
    height: 14px;
    margin: 0 2px;
  }

  .hud-timer-bar {
    width: 50px;
    height: 3px;
  }

  #hud-bottom {
    padding: 3px 8px;
    font-size: 9px;
    letter-spacing: 0.5px;
  }

  /* ===== CELLS ===== */
  .cell {
    width: var(--cell-size);
    height: var(--cell-size);
  }

  .drone-marker {
    width: 28px;
    height: 28px;
  }

  .bot-marker {
    width: 30px;
    height: 30px;
  }

  /* ===== OVERLAYS ===== */
  .stamp-title {
    font-size: 36px;
    letter-spacing: 3px;
  }

  .start-title {
    font-size: 56px;
    letter-spacing: 4px;
  }

  .start-title-sub {
    font-size: 11px;
    letter-spacing: 8px;
  }

  .start-title-tagline {
    font-size: 12px;
    letter-spacing: 5px;
  }

  .start-story {
    font-size: 12px;
    padding: 10px;
    margin-bottom: 16px;
  }

  .start-cta .click-prompt {
    font-size: 16px;
    letter-spacing: 3px;
  }

  .cta-bracket {
    font-size: 24px;
  }

  .start-drone-deco {
    display: none;
  }

  .start-top-deco svg {
    width: 200px;
  }

  .subtitle {
    font-size: 12px;
  }

  .intro-text {
    font-size: 12px;
    padding: 10px;
    margin-bottom: 16px;
    line-height: 1.5;
  }

  .win-text {
    font-size: 13px;
    padding: 12px;
  }

  .controls-info {
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
  }

  .mobile-only-controls {
    display: block !important;
  }

  .control-col {
    padding: 8px 12px;
  }

  .control-keys {
    font-size: 20px;
  }

  .control-desc {
    font-size: 11px;
  }

  .overlay-content {
    padding: 16px;
  }

  .stamp-text {
    font-size: 32px;
    padding: 8px 20px;
  }

  .click-prompt {
    font-size: 13px;
    letter-spacing: 2px;
  }

  .quiz-box {
    padding: 16px;
    max-width: 90vw;
  }

  .quiz-question {
    font-size: 14px;
    min-height: 40px;
  }

  .quiz-choice {
    font-size: 12px;
    padding: 8px 10px;
  }

  .quiz-label {
    font-size: 12px;
  }

  /* ===== TOUCH CONTROLS ===== */
  #touch-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    background: rgba(15, 13, 11, 0.88);
    border-top: 2px solid rgba(237, 227, 207, 0.15);
    width: 100%;
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 60;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
  }

  .touch-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
  }

  .touch-label {
    font-family: 'Special Elite', cursive;
    font-size: 9px;
    color: var(--paper);
    opacity: 0.4;
    letter-spacing: 2px;
  }

  /* D-Pad */
  .dpad {
    display: grid;
    grid-template-areas:
      ".    up   ."
      "left center right"
      ".    down .";
    grid-template-columns: repeat(3, 52px);
    grid-template-rows: repeat(3, 44px);
    gap: 4px;
  }

  .dpad-btn {
    width: 52px;
    height: 44px;
    border: 2px solid rgba(237, 227, 207, 0.3);
    background: rgba(237, 227, 207, 0.06);
    color: var(--paper);
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
    transition: all 0.1s;
  }

  .dpad-btn:active {
    background: rgba(226, 163, 59, 0.25);
    border-color: var(--amber);
    box-shadow: 0 0 10px rgba(226, 163, 59, 0.2);
  }

  .dpad-up    { grid-area: up; }
  .dpad-down  { grid-area: down; }
  .dpad-left  { grid-area: left; }
  .dpad-right { grid-area: right; }
  .dpad-center {
    grid-area: center;
    border-color: var(--amber);
    background: rgba(226, 163, 59, 0.1);
  }
  .dpad-center:active {
    background: rgba(226, 163, 59, 0.4);
  }

  /* TOUCH HINT */
  .touch-hint {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    opacity: 0.5;
    padding: 0 6px;
  }

  .touch-hint-icon {
    font-size: 22px;
    line-height: 1;
  }

  .touch-hint-text {
    font-family: 'Special Elite', cursive;
    font-size: 7px;
    color: var(--paper);
    letter-spacing: 0.5px;
    text-align: center;
    line-height: 1.2;
    white-space: nowrap;
  }

}

/* Very small screens */
@media (max-width: 480px) {
  :root {
    --cell-size: 22px;
  }

  #touch-controls {
    padding: 8px 10px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  }

  .dpad {
    grid-template-columns: repeat(3, 48px);
    grid-template-rows: repeat(3, 40px);
    gap: 3px;
  }

  .dpad-btn {
    width: 48px;
    height: 40px;
    font-size: 16px;
  }

  .touch-hint-text {
    font-size: 6px;
  }

  .stamp-title {
    font-size: 30px;
  }

  .quiz-question {
    font-size: 13px;
    min-height: 40px;
  }

  .quiz-choice {
    font-size: 12px;
    padding: 8px 10px;
  }
}

/* Extra small screens (320px and below) */
@media (max-width: 320px) {
  :root {
    --cell-size: 20px;
  }

  #touch-controls {
    padding: 6px 8px;
    padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px));
  }

  .dpad {
    grid-template-columns: repeat(3, 44px);
    grid-template-rows: repeat(3, 36px);
    gap: 3px;
  }

  .dpad-btn {
    width: 44px;
    height: 36px;
    font-size: 15px;
  }

  .touch-hint-text {
    font-size: 5px;
  }
}

/* =============================================
   SCROLLBAR
   ============================================= */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: var(--ink);
}

::-webkit-scrollbar-thumb {
  background: var(--paper);
  opacity: 0.3;
}

/* =============================================
   WIN SCREEN ANIMATION
   ============================================= */
#overlay-win .overlay-content {
  animation: winReveal 1s ease-out;
}

@keyframes winReveal {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* =============================================
   CAUGHT SCREEN SHAKE
   ============================================= */
#overlay-caught.active {
  animation: screenShake 0.3s ease-out;
}

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

/* =============================================
   VHS TRACKING LINES
   ============================================= */
.vhs-tracking {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9997;
  overflow: hidden;
}

.vhs-line {
  position: absolute;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(237, 227, 207, 0.04) 10%,
    rgba(237, 227, 207, 0.08) 50%,
    rgba(237, 227, 207, 0.04) 90%,
    transparent 100%
  );
  animation: vhsScan linear infinite;
  opacity: 0;
}

.vhs-line:nth-child(1) { animation-duration: 8s; animation-delay: 0s; }
.vhs-line:nth-child(2) { animation-duration: 12s; animation-delay: 3s; height: 2px; }
.vhs-line:nth-child(3) { animation-duration: 6s; animation-delay: 5s; height: 4px; }

@keyframes vhsScan {
  0%   { top: -5%; opacity: 0; }
  5%   { opacity: 0.6; }
  10%  { opacity: 0; }
  15%  { opacity: 0.3; }
  20%  { top: 100%; opacity: 0; }
  100% { top: 100%; opacity: 0; }
}

/* =============================================
   FILM GRAIN (ANIMATED)
   ============================================= */
.film-grain {
  position: fixed;
  inset: -50%;
  width: 200%;
  height: 200%;
  pointer-events: none;
  z-index: 9996;
  opacity: 0.025;
  animation: grainShift 0.5s steps(4) infinite;
}

@keyframes grainShift {
  0%   { transform: translate(0, 0); }
  25%  { transform: translate(-2%, -3%); }
  50%  { transform: translate(1%, 2%); }
  75%  { transform: translate(-1%, 1%); }
  100% { transform: translate(2%, -1%); }
}

/* =============================================
   FLOATING PARTICLES
   ============================================= */
.particle-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 95;
  overflow: hidden;
}

.particle {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  animation: particleFloat linear infinite;
}

.particle-dust {
  background: rgba(237, 227, 207, 0.15);
  box-shadow: 0 0 3px rgba(237, 227, 207, 0.1);
}

.particle-amber {
  background: rgba(226, 163, 59, 0.25);
  box-shadow: 0 0 4px rgba(226, 163, 59, 0.2);
}

.particle-teal {
  background: rgba(62, 112, 104, 0.2);
  box-shadow: 0 0 3px rgba(62, 112, 104, 0.15);
}

@keyframes particleFloat {
  0%   { transform: translateY(100vh) translateX(0) scale(1); opacity: 0; }
  10%  { opacity: 1; }
  90%  { opacity: 1; }
  100% { transform: translateY(-10vh) translateX(var(--drift)) scale(0.5); opacity: 0; }
}

/* =============================================
   CRT CURVE EFFECT
   ============================================= */
.crt-curve {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 101;
  border-radius: 12px;
  box-shadow:
    inset 0 0 80px rgba(0, 0, 0, 0.35),
    inset 0 0 200px rgba(0, 0, 0, 0.15);
}

/* Horizontal scan bar that moves */
.crt-scanbar {
  position: fixed;
  left: 0;
  width: 100%;
  height: 60px;
  pointer-events: none;
  z-index: 102;
  background: linear-gradient(180deg,
    transparent 0%,
    rgba(237, 227, 207, 0.008) 40%,
    rgba(237, 227, 207, 0.015) 50%,
    rgba(237, 227, 207, 0.008) 60%,
    transparent 100%
  );
  animation: scanbarMove 6s ease-in-out infinite;
}

@keyframes scanbarMove {
  0%   { top: -80px; }
  100% { top: calc(100vh + 80px); }
}

/* =============================================
   AMBIENT LIGHT SHAFTS
   ============================================= */
.light-shafts {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 93;
  overflow: hidden;
}

.light-shaft {
  position: absolute;
  width: 200px;
  height: 150%;
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(226, 163, 59, 0.015) 30%,
    rgba(226, 163, 59, 0.03) 50%,
    rgba(226, 163, 59, 0.015) 70%,
    transparent 100%
  );
  transform: rotate(-15deg);
  animation: shaftDrift 15s ease-in-out infinite;
}

.light-shaft:nth-child(1) { left: 10%; animation-delay: 0s; animation-duration: 18s; }
.light-shaft:nth-child(2) { left: 40%; animation-delay: 4s; animation-duration: 22s; width: 150px; opacity: 0.6; }
.light-shaft:nth-child(3) { left: 70%; animation-delay: 8s; animation-duration: 16s; width: 180px; opacity: 0.5; }

@keyframes shaftDrift {
  0%, 100% { transform: rotate(-15deg) translateX(0); opacity: 0.4; }
  50%      { transform: rotate(-12deg) translateX(30px); opacity: 0.7; }
}

/* =============================================
   FOG LAYER
   ============================================= */
.fog-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 94;
  overflow: hidden;
}

.fog-patch {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(237, 227, 207, 0.02), transparent 70%);
  animation: fogDrift linear infinite;
}

.fog-patch:nth-child(1) { width: 400px; height: 200px; left: -200px; top: 20%; animation-duration: 30s; }
.fog-patch:nth-child(2) { width: 300px; height: 150px; left: -150px; top: 60%; animation-duration: 25s; animation-delay: 8s; }
.fog-patch:nth-child(3) { width: 350px; height: 180px; left: -175px; top: 40%; animation-duration: 35s; animation-delay: 15s; opacity: 0.5; }

@keyframes fogDrift {
  0%   { transform: translateX(-100px); opacity: 0; }
  10%  { opacity: 0.6; }
  90%  { opacity: 0.6; }
  100% { transform: translateX(calc(100vw + 100px)); opacity: 0; }
}

/* =============================================
   GLITCH EFFECT (for game events)
   ============================================= */
.glitch-flash {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 200;
  opacity: 0;
}

.glitch-flash.active {
  animation: glitchFlash 0.3s ease-out;
}

.glitch-flash.red {
  background: linear-gradient(
    0deg,
    rgba(182, 69, 44, 0.3) 0%,
    transparent 30%,
    transparent 70%,
    rgba(182, 69, 44, 0.3) 100%
  );
}

.glitch-flash.amber {
  background: radial-gradient(
    circle at center,
    rgba(226, 163, 59, 0.15),
    transparent 60%
  );
}

.glitch-flash.teal {
  background: radial-gradient(
    circle at center,
    rgba(62, 112, 104, 0.15),
    transparent 60%
  );
}

@keyframes glitchFlash {
  0%   { opacity: 1; }
  30%  { opacity: 0.5; }
  100% { opacity: 0; }
}

/* =============================================
   SCREEN FLASH (for catches/shots)
   ============================================= */
.screen-flash {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 201;
  opacity: 0;
}

.screen-flash.active {
  animation: screenFlash 0.4s ease-out;
}

.screen-flash.danger {
  background: rgba(182, 69, 44, 0.4);
  box-shadow: inset 0 0 100px rgba(182, 69, 44, 0.3);
}

.screen-flash.success {
  background: rgba(62, 112, 104, 0.3);
  box-shadow: inset 0 0 100px rgba(62, 112, 104, 0.2);
}

@keyframes screenFlash {
  0%   { opacity: 1; }
  20%  { opacity: 0.7; }
  100% { opacity: 0; }
}

/* =============================================
   ALARM FLASH BORDER
   ============================================= */
.alarm-border {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 103;
  border: 4px solid transparent;
  opacity: 0;
  transition: opacity 0.3s;
}

.alarm-border.active {
  animation: alarmPulse 1s ease-in-out infinite;
}

@keyframes alarmPulse {
  0%, 100% { border-color: rgba(182, 69, 44, 0); }
  50%      { border-color: rgba(182, 69, 44, 0.5); box-shadow: inset 0 0 30px rgba(182, 69, 44, 0.1); }
}

/* =============================================
   LEVEL TRANSITION VHS GLITCH
   ============================================= */
.level-transition {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 300;
  opacity: 0;
}

.level-transition.active {
  animation: levelGlitch 0.8s ease-out;
}

.level-transition .glitch-bar {
  position: absolute;
  left: 0;
  width: 100%;
  background: rgba(237, 227, 207, 0.08);
  animation: glitchBarScan 0.8s ease-out;
}

@keyframes levelGlitch {
  0%   { opacity: 1; }
  50%  { opacity: 0.8; }
  100% { opacity: 0; }
}

@keyframes glitchBarScan {
  0%   { transform: scaleX(0); }
  20%  { transform: scaleX(1); }
  100% { transform: scaleX(0); }
}

/* =============================================
   DRONE HOVER SHADOW
   ============================================= */
.drone-shadow {
  position: absolute;
  width: 18px;
  height: 6px;
  background: radial-gradient(ellipse, rgba(0, 0, 0, 0.25), transparent 70%);
  border-radius: 50%;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  animation: droneShadow 2s ease-in-out infinite;
  z-index: 9;
}

@keyframes droneShadow {
  0%, 100% { transform: translateX(-50%) scale(1); opacity: 0.3; }
  50%      { transform: translateX(-50%) scale(0.85); opacity: 0.2; }
}

/* =============================================
   BOT SCAN LINE
   ============================================= */
.bot-scan {
  position: absolute;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(182, 69, 44, 0.4), transparent);
  top: 0;
  left: 0;
  animation: botScan 1.5s linear infinite;
  pointer-events: none;
  z-index: 11;
}

@keyframes botScan {
  0%   { top: 0; opacity: 0; }
  10%  { opacity: 1; }
  90%  { opacity: 1; }
  100% { top: 100%; opacity: 0; }
}

/* =============================================
   PUZZLE ACTIVATION RIPPLE
   ============================================= */
.puzzle-ripple {
  position: absolute;
  inset: 0;
  border-radius: 0;
  border: 2px solid var(--teal);
  animation: puzzleRipple 0.6s ease-out forwards;
  pointer-events: none;
  z-index: 15;
}

@keyframes puzzleRipple {
  0%   { transform: scale(0.5); opacity: 1; }
  100% { transform: scale(2); opacity: 0; }
}

/* =============================================
   PROJECTILE TRAIL PARTICLES
   ============================================= */
.projectile-particle {
  position: absolute;
  width: 3px;
  height: 3px;
  background: var(--amber);
  border-radius: 50%;
  pointer-events: none;
  animation: projParticle 0.4s ease-out forwards;
  z-index: 19;
}

@keyframes projParticle {
  0%   { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(0) translate(var(--px), var(--py)); }
}

/* =============================================
   SWITCH ACTIVATION EFFECT
   ============================================= */
.switch-activate-fx {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(226, 163, 59, 0.2), transparent);
  animation: switchFx 0.3s ease-out forwards;
  pointer-events: none;
}

@keyframes switchFx {
  0%   { opacity: 1; transform: translateX(-100%); }
  100% { opacity: 0; transform: translateX(100%); }
}

/* =============================================
   EXIT BEACON
   ============================================= */
.exit-beacon {
  position: absolute;
  inset: -12px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(62, 112, 104, 0.15), transparent 70%);
  animation: exitBeacon 2s ease-in-out infinite;
  pointer-events: none;
}

@keyframes exitBeacon {
  0%, 100% { transform: scale(0.8); opacity: 0.3; }
  50%      { transform: scale(1.2); opacity: 0.7; }
}

/* =============================================
   COLLECTED BOLT EFFECT
   ============================================= */
.bolt-collect-fx {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(226, 163, 59, 0.4), transparent 70%);
  animation: boltCollect 0.5s ease-out forwards;
  pointer-events: none;
  z-index: 15;
}

@keyframes boltCollect {
  0%   { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(3); }
}

/* =============================================
   NEW TILE TYPES
   ============================================= */
.cell-server {
  background: rgba(62, 112, 104, 0.08);
  border: 1px solid rgba(62, 112, 104, 0.15);
  position: relative;
}

.cell-server::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 5px,
    rgba(62, 112, 104, 0.04) 5px,
    rgba(62, 112, 104, 0.04) 6px
  );
  pointer-events: none;
}

.cell-crate {
  background: rgba(184, 174, 150, 0.06);
  border: 1px solid rgba(184, 174, 150, 0.12);
  position: relative;
}

.cell-crate::after {
  content: '';
  position: absolute;
  inset: 2px;
  border: 1px dashed rgba(184, 174, 150, 0.1);
  pointer-events: none;
}

.cell-terminal {
  background: rgba(62, 112, 104, 0.06);
  position: relative;
}

.cell-terminal::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 50%;
  transform: translateX(-50%);
  width: 8px;
  height: 8px;
  background: rgba(226, 163, 59, 0.15);
  border-radius: 50%;
  animation: terminal-blink 3s ease-in-out infinite;
  pointer-events: none;
}

@keyframes terminal-blink {
  0%, 90%, 100% { opacity: 0.3; }
  95% { opacity: 1; }
}

/* =============================================
   PER-LEVEL THEME BACKGROUNDS
   ============================================= */
.game-grid.theme-lobby {
  background:
    radial-gradient(circle at 20% 30%, rgba(226, 163, 59, 0.03) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(226, 163, 59, 0.02) 0%, transparent 50%),
    var(--ink);
}

.game-grid.theme-server {
  background:
    radial-gradient(circle at 30% 50%, rgba(62, 112, 104, 0.04) 0%, transparent 50%),
    radial-gradient(circle at 70% 50%, rgba(62, 112, 104, 0.03) 0%, transparent 50%),
    var(--ink);
}

.game-grid.theme-core {
  background:
    radial-gradient(circle at 50% 50%, rgba(182, 69, 44, 0.04) 0%, transparent 40%),
    radial-gradient(circle at 20% 20%, rgba(226, 163, 59, 0.03) 0%, transparent 40%),
    radial-gradient(circle at 80% 80%, rgba(62, 112, 104, 0.03) 0%, transparent 40%),
    var(--ink);
}

/* =============================================
   ENHANCED DRONE VIEW — CIRCULAR VISION
   ============================================= */
#panel-drone .game-grid {
  position: relative;
}

#panel-drone .game-grid::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 40;
  background: radial-gradient(
    circle at 50% 50%,
    transparent 35%,
    rgba(15, 13, 11, 0.3) 55%,
    rgba(15, 13, 11, 0.7) 75%,
    rgba(15, 13, 11, 0.9) 100%
  );
  opacity: 0;
  transition: opacity 0.3s;
}

/* Grid scan line */
#panel-drone .game-grid::after {
  content: '';
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(226, 163, 59, 0.08) 20%,
    rgba(226, 163, 59, 0.15) 50%,
    rgba(226, 163, 59, 0.08) 80%,
    transparent 100%
  );
  pointer-events: none;
  z-index: 41;
  animation: gridScanLine 4s ease-in-out infinite;
}

@keyframes gridScanLine {
  0%   { top: 0; opacity: 0; }
  10%  { opacity: 1; }
  90%  { opacity: 1; }
  100% { top: 100%; opacity: 0; }
}

/* =============================================
   AMBIENT GLOW SPOTS
   ============================================= */
#panel-drone {
  position: relative;
}

#panel-drone::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(226, 163, 59, 0.04), transparent 70%);
  pointer-events: none;
  z-index: 0;
  animation: ambientPulse 6s ease-in-out infinite;
}

@keyframes ambientPulse {
  0%, 100% { opacity: 0.5; transform: translate(-50%, -50%) scale(1); }
  50%      { opacity: 1; transform: translate(-50%, -50%) scale(1.2); }
}

/* =============================================
   ENHANCED DRONE SVG
   ============================================= */
.drone-marker {
  filter: drop-shadow(0 0 8px rgba(226, 163, 59, 0.6)) drop-shadow(0 0 16px rgba(226, 163, 59, 0.3));
}

/* =============================================
   CAMERA SHAKE
   ============================================= */
.game-grid.shake {
  animation: gridShake 0.3s ease-out;
}

@keyframes gridShake {
  0%, 100% { transform: translate(0, 0); }
  15% { transform: translate(-2px, 1px); }
  30% { transform: translate(2px, -1px); }
  45% { transform: translate(-1px, 2px); }
  60% { transform: translate(1px, -2px); }
  75% { transform: translate(-1px, 1px); }
}

/* =============================================
   DRONE TRAIL EFFECT
   ============================================= */
.drone-trail {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(226, 163, 59, 0.15), transparent 60%);
  animation: trailFade 0.5s ease-out forwards;
  pointer-events: none;
  z-index: 8;
}

@keyframes trailFade {
  0%   { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(0.3); }
}

/* =============================================
   ENHANCED SWITCH INDICATOR
   ============================================= */
.switch-item.selected::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 3px;
  height: 100%;
  background: var(--amber);
  animation: switchSelectGlow 1s ease-in-out infinite;
}

@keyframes switchSelectGlow {
  0%, 100% { opacity: 0.6; }
  50%      { opacity: 1; box-shadow: 0 0 8px var(--amber-glow); }
}

/* =============================================
   ENHANCED HUD ITEMS
   ============================================= */
.hud-item {
  position: relative;
}

.hud-item::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--amber), transparent);
  opacity: 0;
  transition: opacity 0.2s;
}

.hud-item:hover::after {
  opacity: 0.3;
}

/* =============================================
   PUZZLE PANEL ENHANCED
   ============================================= */
#puzzle-panel {
  border-image: linear-gradient(135deg, var(--amber), var(--rust), var(--amber)) 1;
}

.puzzle-digit {
  position: relative;
  overflow: hidden;
}

.puzzle-digit::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: conic-gradient(
    from 0deg,
    transparent 0deg,
    rgba(226, 163, 59, 0.05) 60deg,
    transparent 120deg
  );
  animation: digitRotate 4s linear infinite;
  pointer-events: none;
}

@keyframes digitRotate {
  0%   { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* =============================================
   SWITCH PANEL ENHANCED
   ============================================= */
#switch-panel {
  border-image: linear-gradient(135deg, var(--paper), var(--teal), var(--paper)) 1;
}

/* =============================================
   QUIZ BOX ENHANCED
   ============================================= */
.quiz-box {
  border-image: linear-gradient(135deg, var(--amber), var(--rust), var(--amber)) 1;
}

.quiz-choice {
  position: relative;
}

.quiz-choice::after {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 3px;
  height: 100%;
  background: var(--paper);
  opacity: 0;
  transition: all 0.15s;
}

.quiz-choice:hover::after {
  opacity: 0.3;
  background: var(--amber);
}

.quiz-choice.correct::after {
  opacity: 1;
  background: var(--teal);
}

.quiz-choice.wrong::after {
  opacity: 1;
  background: var(--rust);
}

/* =============================================
   ENHANCED INTRO TEXT
   ============================================= */
.intro-text {
  position: relative;
  background:
    linear-gradient(135deg, rgba(226, 163, 59, 0.03), transparent 50%),
    linear-gradient(315deg, rgba(226, 163, 59, 0.02), transparent 50%);
  border-image: linear-gradient(135deg, var(--amber), rgba(226, 163, 59, 0.3), var(--amber)) 1;
}

.win-text {
  border-image: linear-gradient(135deg, var(--teal), rgba(62, 112, 104, 0.3), var(--teal)) 1;
}

/* =============================================
   CONTROL COL ENHANCED
   ============================================= */
.control-col {
  border-image: linear-gradient(135deg, var(--paper), rgba(237, 227, 207, 0.3), var(--paper)) 1;
  background: linear-gradient(135deg, rgba(237, 227, 207, 0.02), transparent);
}

.control-col:hover {
  background: linear-gradient(135deg, rgba(226, 163, 59, 0.05), transparent);
  border-color: var(--amber);
}

/* =============================================
   GRID ENHANCED CORNERS
   ============================================= */
.game-grid {
  border: 3px solid var(--paper);
  box-shadow:
    0 0 0 1px rgba(237, 227, 207, 0.05),
    inset 0 0 40px rgba(0, 0, 0, 0.3),
    0 0 30px rgba(0, 0, 0, 0.2);
}

/* =============================================
   STAMP TEXT ENHANCED
   ============================================= */
.stamp-text {
  border: 6px solid var(--rust);
}

/* =============================================
   PRINT STYLE
   ============================================= */
@media print {
  body::after, body::before, #game-container::after { display: none; }
  .vhs-tracking, .film-grain, .particle-container, .crt-curve,
  .crt-scanbar, .light-shafts, .fog-layer, .alarm-border,
  .glitch-flash, .screen-flash, .level-transition { display: none; }
}
