/* ==========================================================================
   Design System & Custom Themes
   ========================================================================== */

:root {
  /* Font Family */
  --font-primary: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  
  /* Shared Defaults */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-circle: 50%;
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  
  /* Space Theme Tokens */
  --theme-bg-gradient: radial-gradient(circle at 50% 50%, #0c0f1d 0%, #05060b 100%);
  --theme-glass-bg: rgba(13, 17, 33, 0.65);
  --theme-glass-border: rgba(255, 255, 255, 0.08);
  --theme-text-primary: #f8fafc;
  --theme-text-secondary: #94a3b8;
  --theme-accent: #3b82f6;
  --theme-accent-glow: rgba(59, 130, 246, 0.5);
  --theme-card-hover-border: rgba(59, 130, 246, 0.3);
}

body.theme-retro {
  --theme-bg-gradient: linear-gradient(180deg, #11001c 0%, #000000 100%);
  --theme-glass-bg: rgba(30, 0, 45, 0.7);
  --theme-glass-border: rgba(255, 0, 128, 0.2);
  --theme-text-primary: #39ff14; /* Matrix / Neon Green */
  --theme-text-secondary: #ff007f; /* Cyber Pink */
  --theme-accent: #ff007f;
  --theme-accent-glow: rgba(255, 0, 127, 0.5);
  --theme-card-hover-border: rgba(57, 255, 20, 0.5);
}

body.theme-cyberpunk {
  --theme-bg-gradient: linear-gradient(135deg, #14051a 0%, #040d1a 100%);
  --theme-glass-bg: rgba(10, 15, 30, 0.8);
  --theme-glass-border: #00f0ff;
  --theme-text-primary: #f0f3f6;
  --theme-text-secondary: #fcee0a; /* Cyberpunk Yellow */
  --theme-accent: #00f0ff;
  --theme-accent-glow: rgba(0, 240, 255, 0.6);
  --theme-card-hover-border: #fcee0a;
}

/* ==========================================================================
   Global Resets & Base styles
   ========================================================================== */

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

body {
  font-family: var(--font-primary);
  background: var(--theme-bg-gradient);
  color: var(--theme-text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  position: relative;
  transition: background var(--transition-slow), color var(--transition-fast);
}

/* Particle Canvas Background */
#bg-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  background: var(--theme-glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--theme-glass-border);
  z-index: 10;
  position: sticky;
  top: 0;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  user-select: none;
}

.logo-icon {
  font-size: 2rem;
  filter: drop-shadow(0 0 8px var(--theme-accent-glow));
}

.header-logo h1 {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.accent-text {
  color: var(--theme-accent);
  text-shadow: 0 0 10px var(--theme-accent-glow);
}

.header-actions {
  display: flex;
  gap: 0.75rem;
}

/* Generic Button styles */
.icon-btn, .text-btn {
  background: var(--theme-glass-bg);
  border: 1px solid var(--theme-glass-border);
  color: var(--theme-text-primary);
  font-family: var(--font-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  transition: all var(--transition-fast);
}

.icon-btn {
  padding: 0.6rem 1rem;
  border-radius: var(--radius-md);
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--theme-accent);
  box-shadow: 0 0 10px var(--theme-accent-glow);
}

.text-btn {
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
}

.text-btn:hover {
  border-color: var(--theme-accent);
  transform: translateX(-3px);
}

/* ==========================================================================
   Main Content & Section Views
   ========================================================================== */

.main-content {
  flex: 1;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
  z-index: 1;
  display: flex;
  flex-direction: column;
}

.view-section {
  display: none;
  width: 100%;
  opacity: 0;
  transform: translateY(15px);
  transition: opacity var(--transition-normal), transform var(--transition-normal);
}

.view-section.active {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

/* Welcome Banner */
.welcome-banner {
  text-align: center;
  margin-bottom: 3rem;
}

.welcome-banner h2 {
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
}

.welcome-banner p {
  color: var(--theme-text-secondary);
  font-size: 1.1rem;
}

/* Portal/Games Grid */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}

.game-card {
  background: var(--theme-glass-bg);
  border: 1px solid var(--theme-glass-border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: transform var(--transition-normal), border-color var(--transition-normal), box-shadow var(--transition-normal);
}

.game-card:hover {
  transform: translateY(-8px);
  border-color: var(--theme-card-hover-border);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 15px var(--theme-accent-glow);
}

.card-glow {
  position: absolute;
  top: -100px;
  right: -100px;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, var(--glow-color) 0%, transparent 70%);
  opacity: 0.15;
  transition: opacity var(--transition-normal);
  pointer-events: none;
}

.game-card:hover .card-glow {
  opacity: 0.35;
}

.card-icon {
  font-size: 3rem;
}

.game-card h3 {
  font-size: 1.5rem;
  font-weight: 800;
}

.game-card p {
  color: var(--theme-text-secondary);
  line-height: 1.5;
  flex-grow: 1;
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1rem;
}

.badge {
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-blue { background: rgba(59, 130, 246, 0.15); color: #3b82f6; }
.badge-red { background: rgba(239, 68, 68, 0.15); color: #ef4444; }
.badge-green { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.badge-yellow { background: rgba(234, 179, 8, 0.15); color: #eab308; }
.badge-purple { background: rgba(168, 85, 247, 0.15); color: #a855f7; }
.badge-rose { background: rgba(244, 63, 94, 0.15); color: #f43f5e; }

.play-btn {
  background: var(--theme-accent);
  border: none;
  color: #fff;
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-md);
  font-family: var(--font-primary);
  font-weight: 700;
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.play-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 0 15px var(--theme-accent);
}

/* ==========================================================================
   Game Arena Layout
   ========================================================================== */

.arena-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  background: var(--theme-glass-bg);
  padding: 1rem 1.5rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--theme-glass-border);
}

#active-game-title {
  font-size: 1.8rem;
  font-weight: 800;
}

#game-stage {
  flex-grow: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 500px;
}

/* ==========================================================================
   Modals
   ========================================================================== */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: var(--theme-glass-bg);
  border: 1px solid var(--theme-glass-border);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 550px;
  padding: 2rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
  transform: translateY(-30px);
  transition: transform var(--transition-normal);
}

.modal-overlay.active .modal-card {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--theme-glass-border);
  padding-bottom: 1rem;
}

.modal-header h3 {
  font-size: 1.4rem;
  font-weight: 800;
}

.close-modal-btn {
  background: transparent;
  border: none;
  font-size: 2rem;
  color: var(--theme-text-secondary);
  cursor: pointer;
  transition: color var(--transition-fast);
}

.close-modal-btn:hover {
  color: var(--theme-text-primary);
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Form Styles */
.setting-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.form-select {
  background: #0f172a;
  border: 1px solid var(--theme-glass-border);
  color: #fff;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-primary);
  font-size: 0.95rem;
  outline: none;
  cursor: pointer;
}

.form-select:focus {
  border-color: var(--theme-accent);
}

.btn {
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-md);
  border: none;
  font-family: var(--font-primary);
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-danger {
  background: #ef4444;
  color: #fff;
}

.btn-danger:hover {
  background: #dc2626;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.4);
}

/* Stats UI */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}

.stat-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--theme-glass-border);
  border-radius: var(--radius-md);
  padding: 1rem;
  text-align: center;
}

.stat-val {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--theme-accent);
  margin-bottom: 0.25rem;
}

.stat-lbl {
  font-size: 0.8rem;
  color: var(--theme-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ==========================================================================
   Game UI Styles
   ========================================================================== */

/* --- Simon Says --- */
.simon-board {
  display: grid;
  grid-template-columns: repeat(2, 150px);
  gap: 15px;
  position: relative;
}

.simon-pad {
  width: 150px;
  height: 150px;
  border-radius: 20px;
  cursor: pointer;
  opacity: 0.6;
  transition: all 0.1s ease-in-out;
  border: 4px solid rgba(0, 0, 0, 0.2);
}

.simon-pad:active, .simon-pad.active {
  opacity: 1;
  filter: brightness(1.3);
  transform: scale(0.96);
  box-shadow: 0 0 35px var(--pad-color);
}

.simon-green  { background: #10b981; --pad-color: #10b981; border-top-left-radius: 100px; }
.simon-red    { background: #ef4444; --pad-color: #ef4444; border-top-right-radius: 100px; }
.simon-yellow { background: #eab308; --pad-color: #eab308; border-bottom-left-radius: 100px; }
.simon-blue   { background: #3b82f6; --pad-color: #3b82f6; border-bottom-right-radius: 100px; }

.simon-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90px;
  height: 90px;
  background: #0f172a;
  border: 5px solid var(--theme-glass-border);
  border-radius: var(--radius-circle);
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: 800;
  font-size: 1.25rem;
}

/* --- Memory Match --- */
.match-board {
  display: grid;
  gap: 10px;
  perspective: 800px;
  max-width: 600px;
  width: 100%;
}

.match-card {
  width: 100%;
  aspect-ratio: 1;
  position: relative;
  transform-style: preserve-3d;
  transition: transform var(--transition-normal);
  cursor: pointer;
}

.match-card.flipped {
  transform: rotateY(180deg);
}

.match-card-front, .match-card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: var(--radius-md);
  border: 2px solid var(--theme-glass-border);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 2rem;
}

.match-card-back {
  background: var(--theme-glass-bg);
  color: var(--theme-accent);
}

.match-card-front {
  background: rgba(255, 255, 255, 0.05);
  transform: rotateY(180deg);
  border-color: var(--theme-accent);
}

/* --- Sudoku --- */
.sudoku-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  align-items: center;
  width: 100%;
  max-width: 500px;
}

.sudoku-grid {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  border: 3px solid var(--theme-text-primary);
  width: 100%;
  aspect-ratio: 1;
}

.sudoku-cell {
  border: 1px solid rgba(255, 255, 255, 0.15);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.3rem;
  font-weight: 700;
  cursor: pointer;
  position: relative;
  user-select: none;
}

/* Highlight border zones for 3x3 blocks */
.sudoku-cell:nth-child(3n) { border-right: 2px solid var(--theme-text-primary); }
.sudoku-cell:nth-child(9n) { border-right: none; }
.sudoku-grid > .sudoku-cell:nth-child(n+19):nth-child(-n+27),
.sudoku-grid > .sudoku-cell:nth-child(n+46):nth-child(-n+54) {
  border-bottom: 2px solid var(--theme-text-primary);
}

.sudoku-cell.selected { background: rgba(59, 130, 246, 0.3); }
.sudoku-cell.highlighted { background: rgba(255, 255, 255, 0.05); }
.sudoku-cell.fixed { color: var(--theme-text-secondary); font-weight: 400; }
.sudoku-cell.error { background: rgba(239, 68, 68, 0.25); color: #ef4444; }

.sudoku-notes {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  font-size: 0.55rem;
  color: var(--theme-text-secondary);
  line-height: 1;
  padding: 1px;
}

.sudoku-note-num {
  display: flex;
  justify-content: center;
  align-items: center;
}

.sudoku-pad {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 5px;
  width: 100%;
}

.sudoku-pad-btn {
  background: var(--theme-glass-bg);
  border: 1px solid var(--theme-glass-border);
  color: var(--theme-text-primary);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0;
  font-size: 1.2rem;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--font-primary);
  transition: all var(--transition-fast);
}

.sudoku-pad-btn:hover, .sudoku-pad-btn.active {
  background: var(--theme-accent);
  color: #fff;
  box-shadow: 0 0 8px var(--theme-accent-glow);
}

/* --- Battleship --- */
.battleship-layout {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  align-items: center;
  width: 100%;
}

.battleship-boards {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
}

.battleship-board-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: center;
}

.battleship-grid {
  display: grid;
  grid-template-columns: repeat(10, 35px);
  grid-template-rows: repeat(10, 35px);
  gap: 1px;
  background: var(--theme-glass-border);
  border: 2px solid var(--theme-text-primary);
}

.battleship-cell {
  background: #0f172a;
  cursor: pointer;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 0.8rem;
  transition: background 0.1s ease-in-out;
}

.battleship-cell.ship { background: #475569; }
.battleship-cell.hit::before {
  content: "💥";
}
.battleship-cell.miss::before {
  content: "💧";
}

/* --- Board Games (Chess / Checkers) --- */
.board-game-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  width: 100%;
  max-width: 520px;
}

.game-board-8x8 {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  border: 4px solid var(--theme-text-primary);
  width: 100%;
  aspect-ratio: 1;
}

.square-8x8 {
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 2.8rem;
  cursor: pointer;
  position: relative;
  user-select: none;
}

/* Checkers / Chess board colors */
.square-8x8.light { background: #f0d9b5; }
.square-8x8.dark { background: #b58863; }

.square-8x8.highlight::after {
  content: "";
  position: absolute;
  width: 25px;
  height: 25px;
  background: rgba(16, 185, 129, 0.4);
  border-radius: var(--radius-circle);
  pointer-events: none;
}

.square-8x8.selected { background: rgba(59, 130, 246, 0.5) !important; }

/* Checkers pieces styling */
.checker-piece {
  width: 75%;
  height: 75%;
  border-radius: var(--radius-circle);
  border: 3px solid #000;
  box-shadow: 0 4px 6px rgba(0,0,0,0.3);
  position: relative;
}

.checker-piece.red { background: #ef4444; border-color: #7f1d1d; }
.checker-piece.black { background: #1e293b; border-color: #0f172a; }

.checker-piece.king::after {
  content: "👑";
  font-size: 0.95rem;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

/* Promotion Modal */
.promotion-modal {
  display: flex;
  gap: 1rem;
  background: var(--theme-glass-bg);
  padding: 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--theme-glass-border);
}

.promo-piece-btn {
  font-size: 2.5rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--theme-glass-border);
  padding: 0.5rem;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.promo-piece-btn:hover {
  background: var(--theme-accent);
}

/* Status overlays */
.game-overlay-status {
  text-align: center;
  font-size: 1.2rem;
  font-weight: 700;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--theme-glass-border);
  width: 100%;
}

/* ==========================================================================
   Footer
   ========================================================================== */

.app-footer {
  text-align: center;
  padding: 1.5rem;
  background: var(--theme-glass-bg);
  border-top: 1px solid var(--theme-glass-border);
  font-size: 0.85rem;
  color: var(--theme-text-secondary);
  z-index: 10;
  margin-top: auto;
}

/* ==========================================================================
   Animations
   ========================================================================== */

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

.shake-animation {
  animation: error-shake 0.3s ease-in-out;
}

/* --- Snake --- */
.snake-canvas {
  background: #090d16;
  border: 4px solid var(--theme-text-primary);
  border-radius: var(--radius-md);
  box-shadow: 0 0 25px rgba(16, 185, 129, 0.2);
  display: block;
  max-width: 100%;
}

/* --- 2048 --- */
.g2048-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  width: 100%;
  max-width: 420px;
}

.g2048-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: 10px;
  background: #0f172a;
  border: 6px solid #1e293b;
  border-radius: var(--radius-md);
  width: 100%;
  aspect-ratio: 1;
  padding: 10px;
}

.g2048-cell {
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-sm);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.8rem;
  font-weight: 800;
  transition: all 0.1s ease-in-out;
  user-select: none;
}

/* Custom tile coloring using variable background */
.g2048-cell[data-value="2"] { background: #3b82f6; color: #fff; box-shadow: 0 0 10px rgba(59, 130, 246, 0.5); }
.g2048-cell[data-value="4"] { background: #1d4ed8; color: #fff; box-shadow: 0 0 10px rgba(29, 78, 216, 0.5); }
.g2048-cell[data-value="8"] { background: #10b981; color: #fff; box-shadow: 0 0 10px rgba(16, 185, 129, 0.5); }
.g2048-cell[data-value="16"] { background: #047857; color: #fff; box-shadow: 0 0 10px rgba(4, 120, 87, 0.5); }
.g2048-cell[data-value="32"] { background: #f59e0b; color: #fff; box-shadow: 0 0 10px rgba(245, 158, 11, 0.5); }
.g2048-cell[data-value="64"] { background: #d97706; color: #fff; box-shadow: 0 0 10px rgba(217, 119, 6, 0.5); }
.g2048-cell[data-value="128"] { background: #a855f7; color: #fff; box-shadow: 0 0 12px rgba(168, 85, 247, 0.6); }
.g2048-cell[data-value="256"] { background: #7c3aed; color: #fff; box-shadow: 0 0 12px rgba(124, 58, 237, 0.6); }
.g2048-cell[data-value="512"] { background: #ec4899; color: #fff; box-shadow: 0 0 15px rgba(236, 72, 153, 0.7); }
.g2048-cell[data-value="1024"] { background: #db2777; color: #fff; box-shadow: 0 0 15px rgba(219, 39, 119, 0.7); }
.g2048-cell[data-value="2048"] { background: #eab308; color: #000; box-shadow: 0 0 20px rgba(234, 179, 8, 0.9); }

/* --- Minesweeper --- */
.sweeper-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  width: 100%;
  max-width: 480px;
}

.sweeper-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  grid-template-rows: repeat(10, 1fr);
  gap: 2px;
  background: var(--theme-glass-border);
  border: 3px solid var(--theme-text-primary);
  width: 100%;
  aspect-ratio: 1;
}

.sweeper-cell {
  background: #1e293b;
  border-radius: 2px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.1rem;
  font-weight: 800;
  cursor: pointer;
  user-select: none;
}

.sweeper-cell.revealed {
  background: #0f172a;
  cursor: default;
}

/* Number colors for mines indicators */
.sweeper-cell[data-count="1"] { color: #3b82f6; }
.sweeper-cell[data-count="2"] { color: #10b981; }
.sweeper-cell[data-count="3"] { color: #ef4444; }
.sweeper-cell[data-count="4"] { color: #8b5cf6; }
.sweeper-cell[data-count="5"] { color: #f59e0b; }
.sweeper-cell[data-count="6"] { color: #06b6d4; }
.sweeper-cell[data-count="7"] { color: #ec4899; }
.sweeper-cell[data-count="8"] { color: #f43f5e; }

/* --- Tic-Tac-Toe --- */
.ttt-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  width: 100%;
  max-width: 380px;
}

.ttt-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 8px;
  background: var(--theme-glass-border);
  width: 100%;
  aspect-ratio: 1;
}

.ttt-cell {
  background: var(--theme-glass-bg);
  border: 1px solid var(--theme-glass-border);
  border-radius: var(--radius-md);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 4rem;
  font-weight: 800;
  cursor: pointer;
  user-select: none;
  transition: all var(--transition-fast);
}

.ttt-cell:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--theme-accent);
}

.ttt-cell.x { color: var(--theme-accent); text-shadow: 0 0 10px var(--theme-accent-glow); }
.ttt-cell.o { color: #ef4444; text-shadow: 0 0 10px rgba(239, 68, 68, 0.5); }

/* --- Color Flood --- */
.flood-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  width: 100%;
  max-width: 440px;
}

.flood-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-template-rows: repeat(12, 1fr);
  gap: 1px;
  background: var(--theme-glass-border);
  border: 4px solid var(--theme-text-primary);
  border-radius: var(--radius-md);
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
}

.flood-cell {
  width: 100%;
  height: 100%;
  transition: background-color 0.15s ease-out;
}

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

.flood-color-btn {
  aspect-ratio: 1;
  border-radius: var(--radius-circle);
  border: 3px solid #000;
  cursor: pointer;
  box-shadow: 0 4px 6px rgba(0,0,0,0.3);
  transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.flood-color-btn:hover {
  transform: scale(1.1);
  border-color: #fff;
}

/* Mobile responsive fixes */
@media(max-width: 768px) {
  .app-header {
    padding: 0.75rem 1rem;
  }
  .header-logo h1 {
    font-size: 1.25rem;
  }
  .btn-lbl {
    display: none;
  }
  .main-content {
    padding: 1rem;
  }
  .welcome-banner h2 {
    font-size: 1.8rem;
  }
  .games-grid {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }
  .game-card {
    padding: 1.5rem;
  }
  .battleship-boards {
    gap: 1rem;
  }
  .battleship-grid {
    grid-template-columns: repeat(10, 28px);
    grid-template-rows: repeat(10, 28px);
  }
  .square-8x8 {
    font-size: 1.8rem;
  }
  .checker-piece.king::after {
    font-size: 0.7rem;
  }
}
