@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=VT323:wght@400&display=swap');

    :root {
      --bg: #0d0d1a;
      --panel: #14142a;
      --border: #2a2a5a;
      --accent: #ff4444;
      --accent2: #ffcc00;
      --accent3: #44ff88;
      --text: #e8e8ff;
      --dim: #888aaa;
      --pixel: 2px solid #2a2a5a;
    }

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

    body {
      background: var(--bg);
      color: var(--text);
      font-family: 'Press Start 2P', monospace;
      height: 100dvh;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      overflow: hidden;
      position: relative;
    }

    /* ─── SCANLINE OVERLAY ─── */
    body::before {
      content: '';
      position: fixed; inset: 0;
      background: repeating-linear-gradient(
        0deg, transparent, transparent 2px,
        rgba(0,0,0,0.08) 2px, rgba(0,0,0,0.08) 4px
      );
      pointer-events: none;
      z-index: 9999;
    }

    /* ─── MENU ─── */
    #menu {
      width: min(560px, 96vw);
      background: var(--panel);
      border: var(--pixel);
      border-color: var(--border);
      padding: 20px;
      display: flex;
      flex-direction: column;
      gap: 12px;
      box-shadow: 0 0 40px rgba(255,68,68,0.15), inset 0 0 20px rgba(0,0,0,0.4);
      max-height: 96dvh;
      overflow-y: auto;
    }

    /* dos columnas del menú */
    .menu-cols {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 12px;
    }
    .menu-col {
      display: flex;
      flex-direction: column;
      gap: 10px;
    }
    .col-title {
      font-size: 7px;
      color: var(--accent2);
      letter-spacing: 2px;
      border-bottom: 1px solid var(--border);
      padding-bottom: 4px;
      margin-bottom: 2px;
    }

    #menu h1 {
      text-align: center;
      font-size: clamp(18px,5vw,28px);
      color: var(--accent);
      text-shadow: 0 0 10px var(--accent), 0 0 30px rgba(255,68,68,0.4);
      letter-spacing: 4px;
      margin-bottom: 4px;
    }

    #menu h1 span { color: var(--accent2); }

    .subtitle {
      text-align: center;
      font-family: 'VT323', monospace;
      font-size: 18px;
      color: var(--dim);
      margin-top: -8px;
    }

    .divider {
      height: 2px;
      background: linear-gradient(90deg, transparent, var(--border), transparent);
    }

    .row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
    }

    .row label {
      font-size: 8px;
      color: var(--dim);
      flex: 1;
      line-height: 1.6;
    }

    .row .ctrl {
      display: flex;
      align-items: center;
      gap: 6px;
    }

    .val-display {
      font-family: 'VT323', monospace;
      font-size: 22px;
      color: var(--accent2);
      min-width: 36px;
      text-align: center;
    }

    button.pxbtn {
      background: var(--bg);
      border: 2px solid var(--border);
      color: var(--text);
      font-family: 'Press Start 2P', monospace;
      font-size: 10px;
      padding: 5px 10px;
      cursor: pointer;
      transition: all .1s;
    }
    button.pxbtn:hover, button.pxbtn:active {
      background: var(--border);
      border-color: var(--accent2);
      color: var(--accent2);
      transform: scale(1.05);
    }

    /* Mode selector */
    .mode-btns {
      display: flex;
      gap: 6px;
      flex-wrap: wrap;
    }
    .mode-btn {
      background: var(--bg);
      border: 2px solid var(--border);
      color: var(--dim);
      font-family: 'Press Start 2P', monospace;
      font-size: 7px;
      padding: 8px 10px;
      cursor: pointer;
      flex: 1;
      text-align: center;
      transition: all .15s;
      line-height: 1.6;
    }
    .mode-btn.active {
      border-color: var(--accent2);
      color: var(--accent2);
      background: rgba(255,204,0,0.08);
      box-shadow: 0 0 8px rgba(255,204,0,0.3);
    }

    #startBtn {
      margin-top: 4px;
      background: var(--accent);
      border: 2px solid #ff6666;
      color: white;
      font-family: 'Press Start 2P', monospace;
      font-size: 13px;
      padding: 14px;
      cursor: pointer;
      letter-spacing: 3px;
      text-shadow: 0 1px 4px rgba(0,0,0,0.5);
      box-shadow: 0 4px 0 #aa2222, 0 0 20px rgba(255,68,68,0.4);
      transition: all .1s;
    }
    #startBtn:hover { filter: brightness(1.2); }
    #startBtn:active {
      transform: translateY(3px);
      box-shadow: 0 1px 0 #aa2222;
    }

    /* ─── GAME ─── */
    #gameWrap {
      display: none;
      flex-direction: column;
      align-items: center;
      width: 100%;
      height: 100dvh;
    }

    #hud {
      display: flex;
      align-items: center;
      justify-content: space-between;
      width: 100%;
      max-width: 700px;
      padding: 8px 12px;
      font-size: 8px;
      color: var(--dim);
      flex-shrink: 0;
    }

    #hud .alive { color: var(--accent3); }
    #hud .timer-hud { color: var(--accent2); }

    #canvas {
      display: block;
      border: 2px solid var(--border);
      background: #0a0a18;
      image-rendering: pixelated;
      cursor: none;
      flex-shrink: 0;
    }

    /* ─── OVERLAY (win/lose/pause) ─── */
    #overlay {
      display: none;
      position: fixed; inset: 0;
      background: rgba(0,0,0,0.8);
      z-index: 100;
      align-items: center;
      justify-content: center;
    }
    #overlayBox {
      background: var(--panel);
      border: var(--pixel);
      border-color: var(--accent);
      padding: 30px 24px;
      text-align: center;
      max-width: 360px;
      width: 90vw;
      display: flex;
      flex-direction: column;
      gap: 16px;
      box-shadow: 0 0 40px rgba(255,68,68,0.3);
    }
    #overlayTitle {
      font-size: 20px;
      color: var(--accent);
      text-shadow: 0 0 12px var(--accent);
    }
    #overlayMsg {
      font-family: 'VT323', monospace;
      font-size: 22px;
      color: var(--text);
      line-height: 1.5;
    }
    .overlay-btns {
      display: flex;
      gap: 10px;
      justify-content: center;
    }

    #bombTimerBar {
      width: 100%;
      max-width: 700px;
      height: 6px;
      background: var(--border);
      flex-shrink: 0;
    }
    #bombTimerFill {
      height: 100%;
      background: var(--accent2);
      transition: background .2s;
      width: 100%;
    }
/* ─── Speed buttons ─── */
.speed-btn.active {
  border-color: var(--accent2);
  color: var(--accent2);
  background: rgba(255,204,0,0.12);
}

/* ─── Toggle switch ─── */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  gap: 8px;
}
.toggle-label {
  font-size: 7px;
  color: var(--dim);
}
.toggle-row input[type="checkbox"] {
  display: none;
}
.toggle-track {
  width: 32px;
  height: 16px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 0;
  position: relative;
  display: inline-block;
  flex-shrink: 0;
  transition: background .15s;
}
.toggle-row input:checked + .toggle-track {
  background: var(--accent2);
  border-color: var(--accent2);
}
.toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 10px;
  height: 10px;
  background: var(--bg);
  transition: left .15s;
}
.toggle-row input:checked + .toggle-track .toggle-thumb {
  left: 18px;
}
