/* =========================================================
   CYBER ARCADE PORTAL (Synthwave / Neon Tech Aesthetic)
   ========================================================= */

@import url("https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&display=swap");

/* Pinned Tab */
#game-tab {
  position: fixed;
  right: -5px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(11, 17, 32, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid #00e5ff;
  border-right: none;
  padding: 20px 10px;
  border-radius: 12px 0 0 12px;
  cursor: pointer;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 0 15px rgba(0, 229, 255, 0.2);
  animation: widgetGlow 3s ease-in-out infinite;
  overflow: hidden;
}

@keyframes widgetGlow {
  0%,
  100% {
    box-shadow: 0 0 15px rgba(0, 229, 255, 0.2);
  }
  50% {
    box-shadow: 0 0 25px rgba(0, 229, 255, 0.5);
  }
}

#game-tab:hover {
  transform: translateY(-50%) translateX(-8px);
  background: rgba(0, 229, 255, 0.1);
  box-shadow: 0 0 25px rgba(0, 229, 255, 0.6);
}

.scanline {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: rgba(0, 229, 255, 0.5);
  box-shadow: 0 0 10px #00e5ff;
  animation: scan 2s linear infinite;
  opacity: 0.5;
}

@keyframes scan {
  0% {
    transform: translateY(-100%);
  }
  100% {
    transform: translateY(200px);
  }
}

#game-tab .tab-icon {
  width: 28px;
  height: 28px;
  color: #00e5ff;
  animation: pulseNeon 2s infinite alternate;
}

#game-tab .tab-text {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  color: #fff;
  font-family: "Orbitron", sans-serif;
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
}

@keyframes pulseNeon {
  0% {
    filter: drop-shadow(0 0 2px #00e5ff);
  }
  100% {
    filter: drop-shadow(0 0 8px #00e5ff);
  }
}

/* Modal Overlay & Body Lock */
body.game-open {
  overflow: hidden;
}

/* The Expanded Dashboard Panel (Full Screen) */
#game-panel {
  position: fixed;
  inset: 0; /* Full screen */
  background: radial-gradient(circle at center, #111 0%, #050505 100%);
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease;
  display: flex;
  flex-direction: column;
  cursor: crosshair;
}

body.game-open #game-panel {
  opacity: 1;
  visibility: visible;
}

/* Overlay Scanlines */
.arcade-scanline-overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%),
    linear-gradient(
      90deg,
      rgba(255, 0, 0, 0.06),
      rgba(0, 255, 0, 0.02),
      rgba(0, 0, 255, 0.06)
    );
  background-size:
    100% 4px,
    3px 100%;
  pointer-events: none;
  z-index: 99;
}

/* Header */
.game-header {
  position: relative;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 32px;
  border-bottom: 1px solid #ff0055;
  background: rgba(255, 0, 85, 0.1);
  box-shadow: 0 4px 20px rgba(255, 0, 85, 0.2);
}

.game-header h3 {
  color: #ff0055;
  margin: 0;
  font-family: "Orbitron", sans-serif;
  text-shadow: 0 0 10px #ff0055;
}

/* Make sure the content areas inside the panel can scroll */
.game-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px;
  scrollbar-width: thin;
  scrollbar-color: var(--cyan) transparent;
}
.game-content::-webkit-scrollbar {
  width: 6px;
}
.game-content::-webkit-scrollbar-thumb {
  background: var(--cyan);
  border-radius: 4px;
}

.close-game-btn {
  background: transparent;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 8px;
  transition: all 0.2s;
}
.close-game-btn:hover {
  color: #ff0055;
  transform: scale(1.1);
}

/* Common Screen Settings */
.game-content {
  flex-grow: 1;
  position: relative;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

/* Pre-Screen (Game Selection) */
.arcade-title {
  font-family: "Orbitron", sans-serif;
  font-size: 32px;
  font-weight: 900;
  color: #fff;
  text-align: center;
  margin-bottom: 40px;
  text-shadow:
    0 0 10px #00e5ff,
    0 0 20px #00e5ff;
}

.arcade-cards-grid {
  display: flex;
  gap: 32px;
  max-width: 900px;
  width: 100%;
  justify-content: center;
  flex-wrap: wrap;
}

.arcade-card {
  background: rgba(20, 20, 30, 0.8);
  border: 2px solid #333;
  border-radius: 12px;
  padding: 32px;
  width: 320px;
  text-align: center;
  position: relative;
  overflow: hidden;
  transition:
    transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275),
    border-color 0.3s,
    box-shadow 0.3s;
  cursor: default;
}

.arcade-card-glint {
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(
    to right,
    transparent,
    rgba(255, 255, 255, 0.1),
    transparent
  );
  transform: skewX(-20deg);
}

.arcade-card:hover {
  transform: translateY(-10px);
}
.arcade-card:hover .arcade-card-glint {
  animation: glint 0.6s;
}

@keyframes glint {
  100% {
    left: 200%;
  }
}

#card-flyer:hover {
  border-color: #9062ff;
  box-shadow: 0 0 30px rgba(144, 98, 255, 0.3);
}
#card-stroop:hover {
  border-color: #00e5ff;
  box-shadow: 0 0 30px rgba(0, 229, 255, 0.3);
}

.arcade-card-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.arcade-card h3 {
  font-family: "Orbitron", sans-serif;
  font-size: 24px;
  color: #fff;
  margin-bottom: 12px;
}
#card-flyer h3 {
  text-shadow: 0 0 10px #9062ff;
}
#card-stroop h3 {
  text-shadow: 0 0 10px #00e5ff;
}

.arcade-card p {
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 24px;
  min-height: 42px;
}

.high-score-badge {
  background: rgba(0, 0, 0, 0.5);
  border-radius: 20px;
  padding: 8px 16px;
  font-family: "Orbitron", sans-serif;
  font-size: 12px;
  color: #ffd700;
  margin-bottom: 24px;
  display: inline-block;
  border: 1px solid rgba(255, 215, 0, 0.3);
}

.btn-insert-coin {
  width: 100%;
  padding: 16px;
  background: transparent;
  color: #fff;
  border: 2px solid #fff;
  border-radius: 4px;
  font-family: "Orbitron", sans-serif;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  animation: blink 2s infinite;
}

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

#btn-start-flyer {
  border-color: #9062ff;
  color: #9062ff;
}
#btn-start-flyer:hover {
  background: #9062ff;
  color: #fff;
  box-shadow: 0 0 20px #9062ff;
}

#btn-start-stroop {
  border-color: #00e5ff;
  color: #00e5ff;
}
#btn-start-stroop:hover {
  background: #00e5ff;
  color: #000;
  box-shadow: 0 0 20px #00e5ff;
}

/* Arena Screens Common */
.arena-screen {
  background: #050505;
}

.btn-back-arcade {
  position: absolute;
  top: 24px;
  left: 24px;
  background: transparent;
  border: 1px solid #333;
  color: #888;
  padding: 8px 16px;
  font-family: "Orbitron", sans-serif;
  font-size: 12px;
  cursor: pointer;
  border-radius: 4px;
  z-index: 101;
  transition: all 0.2s;
}
.btn-back-arcade:hover {
  border-color: #fff;
  color: #fff;
}

/* ---------------------------------
   GAME 1: CYBER FLYER (Canvas)
   --------------------------------- */
#flyer-canvas {
  width: 100%;
  max-width: 800px;
  height: 500px;
  background: #0a0a0a;
  border: 2px solid #9062ff;
  border-radius: 8px;
  box-shadow: 0 0 30px rgba(144, 98, 255, 0.2);
  cursor: pointer;
}

.arcade-score-hud {
  position: absolute;
  top: 24px;
  right: 24px;
  font-family: "Orbitron", sans-serif;
  font-size: 24px;
  color: #9062ff;
  text-shadow: 0 0 10px #9062ff;
  z-index: 101;
}

/* ---------------------------------
   GAME 2: STROOP CRISIS
   --------------------------------- */
#game-timer-container {
  width: 100%;
  max-width: 600px;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  margin-bottom: 24px;
  overflow: hidden;
}
#game-timer-bar {
  height: 100%;
  width: 100%;
  background: #00ff66;
  box-shadow: 0 0 15px #00ff66;
  transform-origin: left;
}
.timer-danger {
  background: #ff0055 !important;
  box-shadow: 0 0 20px #ff0055 !important;
}

.round-counter {
  font-family: "Orbitron", sans-serif;
  color: #888;
  margin-bottom: 40px;
  letter-spacing: 2px;
}

#stroop-word-container {
  height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 60px;
}

#stroop-word {
  font-family: "Orbitron", sans-serif;
  font-size: 80px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 8px;
  margin: 0;
  text-shadow: 0 0 30px currentColor;
  transition: transform 0.1s;
}

/* Glitch animation class */
.stroop-glitch {
  animation: glitch-anim 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) both infinite;
}
@keyframes glitch-anim {
  0% {
    transform: translate(0);
  }
  20% {
    transform: translate(-2px, 2px);
  }
  40% {
    transform: translate(-2px, -2px);
  }
  60% {
    transform: translate(2px, 2px);
  }
  80% {
    transform: translate(2px, -2px);
  }
  100% {
    transform: translate(0);
  }
}

.stroop-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  width: 100%;
  max-width: 600px;
}

.stroop-btn {
  background: transparent;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 24px;
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  font-family: "Orbitron", sans-serif;
  cursor: pointer;
  transition: all 0.1s;
}
.stroop-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: #fff;
  transform: scale(1.05);
}

#combo-tracker {
  position: absolute;
  top: 100px;
  font-family: "Orbitron", sans-serif;
  font-size: 32px;
  color: #ffd700;
  text-shadow: 0 0 20px #ffd700;
  animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

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

#timeout-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 0, 85, 0.3);
  color: #ff0055;
  font-family: "Orbitron", sans-serif;
  font-size: 100px;
  font-weight: 900;
  text-shadow: 0 0 40px #ff0055;
  z-index: 200;
  pointer-events: none;
  animation: flashRed 0.5s ease-out forwards;
}

@keyframes flashRed {
  0% {
    opacity: 1;
    transform: scale(1.2);
  }
  100% {
    opacity: 0;
    transform: scale(1);
  }
}

/* Generic Arcade Game Over Overlay */
.arcade-game-over {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(10, 10, 15, 0.95);
  border: 2px solid #555;
  border-radius: 12px;
  padding: 40px;
  text-align: center;
  z-index: 150;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
  width: 90%;
  max-width: 400px;
}

#flyer-game-over {
  border-color: #9062ff;
  box-shadow: 0 0 40px rgba(144, 98, 255, 0.3);
}
#stroop-game-over {
  border-color: #00e5ff;
  box-shadow: 0 0 40px rgba(0, 229, 255, 0.3);
}

.glitch-text {
  font-family: "Orbitron", sans-serif;
  font-size: 32px;
  color: #9062ff;
  text-shadow: 0 0 10px #9062ff;
  margin-bottom: 24px;
}

.eval-stat {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}
.eval-label {
  color: #888;
  font-size: 12px;
  letter-spacing: 1px;
}
.eval-value {
  color: #fff;
  font-size: 24px;
  font-weight: 700;
  font-family: "Orbitron", sans-serif;
}

.arcade-new-record {
  color: #ffd700;
  font-family: "Orbitron", sans-serif;
  font-size: 18px;
  margin-top: 16px;
  text-shadow: 0 0 10px #ffd700;
  animation: blink 1s infinite;
}

/* Screenshake class applied to arena */
.shake-hard {
  animation: shake 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}
@keyframes shake {
  10%,
  90% {
    transform: translate3d(-4px, 0, 0);
  }
  20%,
  80% {
    transform: translate3d(4px, 0, 0);
  }
  30%,
  50%,
  70% {
    transform: translate3d(-8px, 0, 0);
  }
  40%,
  60% {
    transform: translate3d(8px, 0, 0);
  }
}

/* =======================================================
   LEADERBOARDS & ALIAS MODAL
   ======================================================= */
.arcade-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
}

.arcade-modal {
  background: rgba(10, 10, 15, 0.9);
  border: 2px solid #333;
  border-radius: 12px;
  padding: 40px;
  text-align: center;
  width: 90%;
  max-width: 450px;
  box-shadow: 0 0 50px rgba(0, 255, 102, 0.1);
  animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.arcade-input {
  width: 100%;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid #555;
  color: #fff;
  font-family: "Orbitron", sans-serif;
  font-size: 20px;
  padding: 16px;
  text-align: center;
  border-radius: 6px;
  outline: none;
  text-transform: uppercase;
  transition: all 0.2s;
}
.arcade-input:focus {
  border-color: #00ff66;
  box-shadow: 0 0 15px rgba(0, 255, 102, 0.3);
}

.leaderboard-tabs {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 24px;
}

.lb-tab {
  background: transparent;
  border: 1px solid #555;
  color: #888;
  padding: 12px 24px;
  font-family: "Orbitron", sans-serif;
  font-size: 12px;
  font-weight: 700;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.lb-tab:hover {
  border-color: #fff;
  color: #fff;
}

.lb-tab.active {
  border-color: #ffd700;
  color: #ffd700;
  box-shadow: 0 0 15px rgba(255, 215, 0, 0.3);
}

.leaderboard-container {
  width: 100%;
  max-width: 700px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid #333;
  border-radius: 8px;
  overflow-y: auto;
  max-height: 400px;
  margin: 0 auto;
}

.arcade-table {
  width: 100%;
  border-collapse: collapse;
  font-family: "Orbitron", sans-serif;
  font-size: 14px;
  text-align: left;
}

.arcade-table th {
  background: rgba(255, 255, 255, 0.05);
  color: #aaa;
  padding: 16px;
  border-bottom: 2px solid #555;
  letter-spacing: 2px;
  position: sticky;
  top: 0;
}

.arcade-table td {
  padding: 16px;
  border-bottom: 1px solid #222;
  color: #fff;
}

.arcade-table tr.rank-1 td {
  color: #ffd700;
  font-weight: 700;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}
.arcade-table tr.rank-2 td {
  color: #c0c0c0;
  font-weight: 700;
  text-shadow: 0 0 10px rgba(192, 192, 192, 0.5);
}
.arcade-table tr.rank-3 td {
  color: #cd7f32;
  font-weight: 700;
  text-shadow: 0 0 10px rgba(205, 127, 50, 0.5);
}

.arcade-table tr:hover {
  background: rgba(255, 255, 255, 0.05);
}

.current-user-row {
  background: rgba(0, 255, 102, 0.1) !important;
  border-left: 4px solid #00ff66;
}

.leaderboard-congrats {
  position: absolute;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.9);
  flex-direction: column;
  animation: flashWinner 1s ease-out;
  pointer-events: none;
}
.leaderboard-congrats h1 {
  font-family: "Orbitron", sans-serif;
  font-size: 48px;
  color: #ffd700;
  text-shadow: 0 0 30px #ffd700;
  margin-bottom: 20px;
}
@keyframes flashWinner {
  0% {
    background: #fff;
  }
  100% {
    background: rgba(0, 0, 0, 0.9);
  }
}

/* ---------------------------------
   GAME 3: NEON SUDOKU — unified rules
   --------------------------------- */

/* Arena layout */
#sudoku-matrix-arena {
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 16px 20px 24px;
  overflow-y: auto;
}

/* Header row */
.sudoku-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: 450px;
  font-family: "Orbitron", sans-serif;
  font-size: 14px;
  color: #00e5ff;
  text-shadow: 0 0 8px rgba(0, 229, 255, 0.5);
}
.sudoku-timer,
.sudoku-mistakes {
  letter-spacing: 0.08em;
}

/* Difficulty pills */
.sudoku-difficulty-selector {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
  max-width: 450px;
}
.btn-diff {
  font-family: "Orbitron", sans-serif;
  font-size: 11px;
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid #333;
  background: rgba(0, 0, 0, 0.5);
  color: #888;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.05em;
}
.btn-diff:hover {
  border-color: #00e5ff;
  color: #00e5ff;
}
.btn-diff.active {
  background: rgba(0, 229, 255, 0.15);
  border-color: #00e5ff;
  color: #00e5ff;
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.3);
}

/* ── Board ── */
.sudoku-board {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  width: 100%;
  max-width: 450px;
  aspect-ratio: 1 / 1;
  border: 2px solid #00e5ff;
  box-shadow: 0 0 20px rgba(0, 229, 255, 0.25);
  border-radius: 4px;
  overflow: hidden;
  background: #00e5ff; /* gap colour = thin cyan lines */
  gap: 1px;
  margin: 0 auto;
}

/* ── Cells ── */
.sudoku-cell {
  background: #090e1a;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Orbitron", sans-serif;
  font-size: clamp(14px, 2.5vw, 22px);
  font-weight: 700;
  cursor: pointer;
  position: relative;
  transition: background 0.15s;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* 3×3 box borders — added by JS via classList */
.sudoku-cell.box-right {
  border-right: 2px solid #00e5ff;
}
.sudoku-cell.box-bottom {
  border-bottom: 2px solid #00e5ff;
}

/* States */
.sudoku-cell.fixed {
  color: #e0f7ff;
}
.sudoku-cell.user {
  color: #ffd700;
  text-shadow: 0 0 6px rgba(255, 215, 0, 0.5);
}
.sudoku-cell.selected {
  background: rgba(0, 229, 255, 0.35);
  box-shadow: inset 0 0 12px rgba(0, 229, 255, 0.6);
}
.sudoku-cell.zone {
  background: rgba(0, 229, 255, 0.07);
}
.sudoku-cell.same {
  background: rgba(0, 229, 255, 0.18);
}
.sudoku-cell.error {
  color: #ff0055 !important;
  background: rgba(255, 0, 85, 0.18) !important;
  text-shadow: 0 0 8px #ff0055;
}
.sudoku-cell.conflict {
  animation: conflictPulse 0.7s ease;
}
@keyframes conflictPulse {
  0%,
  100% {
    box-shadow: none;
  }
  50% {
    box-shadow:
      inset 0 0 0 2px #ff0055,
      0 0 12px #ff0055;
  }
}

/* Hover (only non-selected, non-fixed) */
.sudoku-cell:not(.selected):not(.fixed):hover {
  background: rgba(0, 229, 255, 0.12);
}

/* ── Loading skeleton ── */
.sudoku-board.loading {
  background: #090e1a;
  gap: 1px;
}
.sudoku-skel {
  background: #0d1422;
  animation: skelPulse 1.2s ease-in-out infinite;
}
@keyframes skelPulse {
  0%,
  100% {
    background: #0d1422;
  }
  50% {
    background: rgba(0, 229, 255, 0.08);
  }
}

/* ── Notes mini-grid ── */
.sudoku-notes-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.sudoku-notes-grid span {
  font-size: clamp(7px, 1vw, 10px);
  color: #5599aa;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 400;
  font-family: "Orbitron", sans-serif;
}

/* ── Controls row ── */
.sudoku-controls {
  display: flex;
  gap: 10px;
  width: 100%;
  max-width: 450px;
  justify-content: center;
  flex-wrap: wrap;
}
/* Both .btn-sudoku-action (HTML) and .sudoku-btn (legacy) */
.btn-sudoku-action,
.sudoku-btn {
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid #00e5ff;
  color: #00e5ff;
  padding: 9px 14px;
  border-radius: 4px;
  font-family: "Orbitron", sans-serif;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
  letter-spacing: 0.03em;
}
.btn-sudoku-action:hover,
.sudoku-btn:hover {
  background: rgba(0, 229, 255, 0.15);
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.35);
}
.btn-sudoku-action.active,
.sudoku-btn.active {
  background: #00e5ff;
  color: #000;
  box-shadow: 0 0 14px #00e5ff;
}
.btn-sudoku-action:disabled,
.sudoku-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

/* ── Numpad ── */
.sudoku-numpad {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 6px;
  width: 100%;
  max-width: 450px;
}
.btn-num,
.numpad-btn {
  background: #090e1a;
  border: 1px solid #1a2a3a;
  color: #cde;
  font-family: "Orbitron", sans-serif;
  font-size: clamp(14px, 2vw, 20px);
  padding: 10px 0;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.18s;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}
.btn-num:hover,
.numpad-btn:hover {
  border-color: #00e5ff;
  color: #00e5ff;
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.3);
}
.btn-num:disabled,
.numpad-btn:disabled {
  opacity: 0.25;
  cursor: default;
}
.btn-num.exhausted,
.numpad-btn.exhausted {
  opacity: 0.2;
}

/* Remaining-count badge */
.num-badge {
  font-size: 9px;
  color: #5599aa;
  line-height: 1;
  font-weight: 400;
  letter-spacing: 0;
}

/* ── Game Over overlay ── */
.arcade-game-over {
  position: absolute;
  inset: 0;
  z-index: 200;
  background: rgba(5, 8, 22, 0.96);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  backdrop-filter: blur(6px);
  animation: panelIn 0.4s ease both;
}

/* Mobile tweaks */
@media (max-width: 500px) {
  #sudoku-matrix-arena {
    padding: 10px 10px 16px;
    gap: 8px;
  }
  .sudoku-board {
    max-width: 100%;
  }
  .btn-sudoku-action,
  .sudoku-btn {
    font-size: 10px;
    padding: 7px 10px;
  }
  .btn-num,
  .numpad-btn {
    font-size: 14px;
    padding: 8px 0;
  }
}

/* Hide game-tab on mobile */
@media (max-width: 768px) {
  #game-tab {
    display: none !important;
  }
}

/* =========================================
   GAME 4: MINESWEEPER — BOMB GRID
   ========================================= */

#minesweeper-arena {
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 14px 16px 20px;
  overflow-y: auto;
  overflow-x: hidden;
}

/* ── Header ─────────────────────────────── */
.mine-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: 540px;
  font-family: "Orbitron", sans-serif;
  font-size: 14px;
  color: #00e5ff;
  text-shadow: 0 0 8px rgba(0, 229, 255, 0.5);
  letter-spacing: 0.05em;
}
.mine-counter,
.mine-time-display {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(0, 229, 255, 0.25);
  padding: 5px 12px;
  border-radius: 4px;
}

/* Restart button in header */
#btn-mine-restart {
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid #00e5ff;
  color: #00e5ff;
  font-family: "Orbitron", sans-serif;
  font-size: 11px;
  padding: 5px 12px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.04em;
}
#btn-mine-restart:hover {
  background: rgba(0, 229, 255, 0.15);
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.3);
}

/* ── Difficulty pills (shared .btn-diff, scoped in arena) ── */

/* ── Flag mode toggle ───────────────────── */
.mine-controls {
  display: flex;
  gap: 10px;
  align-items: center;
  width: 100%;
  max-width: 540px;
  justify-content: center;
}
#btn-mine-flag-toggle {
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid #ffd700;
  color: #ffd700;
  font-family: "Orbitron", sans-serif;
  font-size: 12px;
  padding: 7px 16px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}
#btn-mine-flag-toggle.active {
  background: #ffd700;
  color: #000;
  box-shadow: 0 0 12px rgba(255, 215, 0, 0.5);
}
#btn-mine-flag-toggle:hover {
  opacity: 0.85;
}

.mine-mode-hint {
  font-family: "Orbitron", sans-serif;
  font-size: 10px;
  color: #556;
  letter-spacing: 0.04em;
}

/* ── Board ──────────────────────────────── */
.mine-board-wrap {
  width: 100%;
  max-width: 540px;
  overflow-x: auto;
  border-radius: 4px;
}

#mine-board {
  --cell-size: 32px;
  display: grid;
  gap: 2px;
  background: rgba(0, 229, 255, 0.15);
  border: 2px solid rgba(0, 229, 255, 0.4);
  border-radius: 4px;
  padding: 3px;
  width: max-content;
  margin: 0 auto;
}

/* ── Cells ──────────────────────────────── */
.mine-cell {
  width: var(--cell-size);
  height: var(--cell-size);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Orbitron", sans-serif;
  font-size: calc(var(--cell-size) * 0.52);
  font-weight: 700;
  border-radius: 3px;
  cursor: pointer;
  user-select: none;
  transition:
    background 0.12s,
    transform 0.1s;
  background: #0d1527;
  border: 1px solid rgba(0, 229, 255, 0.18);
  -webkit-tap-highlight-color: transparent;
}

.mine-cell:hover:not(.revealed) {
  background: rgba(0, 229, 255, 0.14);
  transform: scale(0.95);
}

.mine-cell.revealed {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(0, 229, 255, 0.06);
  cursor: default;
}

.mine-cell.flagged {
  background: rgba(255, 215, 0, 0.12);
  border-color: rgba(255, 215, 0, 0.4);
}

.mine-cell.mine {
  background: rgba(255, 0, 85, 0.18);
  border-color: #ff0055;
}

.mine-cell.mine-hit {
  background: #ff0055 !important;
  box-shadow: 0 0 16px #ff0055;
}

/* Pop animation on reveal */
.mine-cell.cell-pop {
  animation: mineCellPop 0.25s ease;
}
@keyframes mineCellPop {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.18);
  }
  100% {
    transform: scale(1);
  }
}

/* Staggered mine reveal on loss */
.mine-cell.mine-reveal {
  animation: mineReveal 0.3s ease both;
}
@keyframes mineReveal {
  0% {
    opacity: 0;
    transform: scale(0.6);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* Flag pop */
.mine-cell.flag-pop {
  animation: flagPop 0.3s ease;
}
@keyframes flagPop {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.3) rotate(-10deg);
  }
  100% {
    transform: scale(1) rotate(0);
  }
}

/* ── Game Over overlay ──────────────────── */
#mine-game-over {
  position: absolute;
  inset: 0;
  z-index: 200;
  background: rgba(5, 8, 22, 0.95);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  backdrop-filter: blur(8px);
  animation: panelIn 0.35s ease both;
}

/* ── Mobile tweaks ──────────────────────── */
@media (max-width: 540px) {
  #minesweeper-arena {
    padding: 10px 8px 14px;
    gap: 8px;
  }
  .mine-header {
    font-size: 12px;
  }
  .mine-board-wrap {
    max-width: 100%;
  }
}
