/**
 * Divisha's Game Universe - Game-Specific Stylesheet
 */

/* Shared Game Layout Components */
.game-container {
  width: 100%;
  max-width: 680px;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0 auto;
}

.game-header-bar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 12px;
}

.game-title-group h2 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: var(--neon-cyan);
}

.game-subtitle {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.game-stats-pills {
  display: flex;
  gap: 10px;
}

.stat-pill {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-card);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 70px;
}

.stat-label {
  font-size: 0.65rem;
  font-family: var(--font-display);
  color: var(--text-muted);
}

.stat-value {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.game-control-toolbar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 10px;
}

.difficulty-picker, .mode-toggles {
  display: flex;
  gap: 6px;
}

.diff-btn, .mode-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-card);
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.diff-btn:hover, .mode-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.diff-btn.active, .mode-btn.active {
  background: rgba(0, 240, 255, 0.15);
  border-color: var(--neon-cyan);
  color: var(--neon-cyan);
}

.game-hints-box {
  margin-top: 14px;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
}

.game-overlay {
  position: absolute;
  inset: 0;
  background: rgba(6, 7, 20, 0.88);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-lg);
  z-index: 10;
}

.game-overlay.hidden {
  display: none;
}

.overlay-content {
  text-align: center;
  padding: 24px;
  max-width: 340px;
}

.overlay-content h3 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  margin-bottom: 8px;
  color: var(--neon-cyan);
}

.overlay-content p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.overlay-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
}

/* ==========================================================================
   1. COSMIC 2048
   ========================================================================== */
.game2048-board-wrapper {
  position: relative;
  background: rgba(14, 18, 48, 0.7);
  border: 1px solid var(--border-neon);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), var(--glow-cyan);
  border-radius: var(--radius-lg);
  padding: 12px;
  touch-action: none;
}

.game2048-board {
  display: grid;
  grid-template-columns: repeat(4, 85px);
  grid-template-rows: repeat(4, 85px);
  gap: 10px;
}

.c2048-cell {
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-md);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.c2048-tile {
  width: 100%;
  height: 100%;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  animation: tile-pop 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.tile-number {
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1;
}

.tile-label {
  font-size: 0.55rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
  opacity: 0.85;
}

.tile-2 { background: #1e1b4b; color: #93c5fd; border: 1px solid #3b82f6; }
.tile-4 { background: #172554; color: #60a5fa; border: 1px solid #60a5fa; }
.tile-8 { background: #083344; color: #22d3ee; border: 1px solid #06b6d4; box-shadow: 0 0 10px rgba(6, 182, 212, 0.4); }
.tile-16 { background: #064e3b; color: #34d399; border: 1px solid #10b981; box-shadow: 0 0 10px rgba(16, 185, 129, 0.4); }
.tile-32 { background: #713f12; color: #fde047; border: 1px solid #eab308; box-shadow: 0 0 12px rgba(234, 179, 8, 0.5); }
.tile-64 { background: #7c2d12; color: #fb923c; border: 1px solid #f97316; box-shadow: 0 0 12px rgba(249, 115, 22, 0.5); }
.tile-128 { background: #831843; color: #f472b6; border: 1px solid #ec4899; box-shadow: 0 0 15px rgba(236, 72, 153, 0.6); }
.tile-256 { background: #581c87; color: #c084fc; border: 1px solid #a855f7; box-shadow: 0 0 15px rgba(168, 85, 247, 0.6); }
.tile-512 { background: #4c0519; color: #fb7185; border: 1px solid #f43f5e; box-shadow: 0 0 18px rgba(244, 63, 94, 0.7); }
.tile-1024 { background: linear-gradient(135deg, #00f0ff, #9d4edd); color: #000; font-weight: 900; box-shadow: 0 0 22px rgba(0, 240, 255, 0.8); }
.tile-2048 { background: linear-gradient(135deg, #ff007f, #ffe600); color: #000; font-weight: 900; box-shadow: 0 0 25px rgba(255, 0, 127, 0.9); }
.tile-super { background: linear-gradient(135deg, #ffffff, #00f0ff, #ff007f); color: #000; box-shadow: 0 0 30px #ffffff; }

@keyframes tile-pop {
  0% { transform: scale(0.4); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

@media (max-width: 480px) {
  .game2048-board {
    grid-template-columns: repeat(4, 68px);
    grid-template-rows: repeat(4, 68px);
    gap: 8px;
  }
  .tile-number { font-size: 1.15rem; }
  .tile-label { font-size: 0.45rem; }
}

/* ==========================================================================
   2. NEON GALAXY SNAKE
   ========================================================================== */
.snake-canvas-wrapper {
  position: relative;
  background: #0a0d20;
  border: 1px solid var(--border-neon);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), var(--glow-cyan);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

#snake-canvas {
  display: block;
  max-width: 100%;
  height: auto;
}

.powerup-status-hud {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.hud-badge {
  font-family: var(--font-display);
  font-size: 0.7rem;
  padding: 3px 8px;
  border-radius: 4px;
  background: rgba(255, 230, 0, 0.15);
  border: 1px solid #ffe600;
  color: #ffe600;
}

.hud-badge.hidden {
  display: none;
}

/* Virtual D-Pad for Mobile */
.virtual-dpad {
  display: none;
  flex-direction: column;
  align-items: center;
  margin-top: 16px;
}

.dpad-middle-row {
  display: flex;
  gap: 40px;
  margin: 6px 0;
}

.dpad-btn {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-card);
  color: var(--neon-cyan);
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
}

.dpad-btn:active {
  background: rgba(0, 240, 255, 0.25);
}

@media (max-width: 768px) {
  .virtual-dpad {
    display: flex;
  }
}

/* ==========================================================================
   3. VOID INVADERS
   ========================================================================== */
.invaders-canvas-wrapper {
  position: relative;
  background: #060814;
  border: 1px solid var(--border-neon);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), var(--glow-pink);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

#invaders-canvas {
  display: block;
  max-width: 100%;
  height: auto;
}

.ship-status-hud {
  display: flex;
  align-items: center;
  gap: 16px;
}

.shield-gauge {
  display: flex;
  align-items: center;
  gap: 6px;
}

.shield-bars {
  display: flex;
  gap: 4px;
}

.shield-pip {
  width: 14px;
  height: 10px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.shield-pip.active {
  background: var(--neon-cyan);
  border-color: var(--neon-cyan);
  box-shadow: 0 0 6px var(--neon-cyan);
}

.bomb-count-val {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--neon-pink);
}

.mobile-shooter-controls {
  display: none;
  width: 100%;
  max-width: 480px;
  justify-content: space-between;
  margin-top: 14px;
  gap: 8px;
}

.shooter-btn {
  flex: 1;
  padding: 12px 0;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-card);
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}

.shooter-btn:active {
  background: rgba(0, 240, 255, 0.2);
}

.shoot-fire {
  background: rgba(255, 0, 127, 0.15);
  border-color: var(--neon-pink);
  color: var(--neon-pink);
}

.shoot-bomb {
  background: rgba(255, 230, 0, 0.15);
  border-color: #ffe600;
  color: #ffe600;
}

@media (max-width: 768px) {
  .mobile-shooter-controls {
    display: flex;
  }
}

/* ==========================================================================
   4. QUANTUM MINESWEEPER
   ========================================================================== */
.minesweeper-board-wrapper {
  position: relative;
  background: rgba(14, 18, 48, 0.8);
  border: 1px solid var(--border-neon);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), var(--glow-purple);
  border-radius: var(--radius-lg);
  padding: 12px;
  overflow: auto;
  max-width: 100%;
}

.minesweeper-board {
  display: grid;
  gap: 4px;
}

.ms-cell {
  width: 34px;
  height: 34px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s ease;
}

.ms-cell:hover {
  background: rgba(0, 240, 255, 0.15);
  border-color: var(--neon-cyan);
}

.ms-cell.revealed {
  background: rgba(10, 13, 34, 0.9);
  border-color: rgba(255, 255, 255, 0.04);
  cursor: default;
}

.ms-cell.flagged {
  border-color: #ff007f;
  background: rgba(255, 0, 127, 0.1);
}

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

.num-1 { color: #00f0ff; }
.num-2 { color: #00ff88; }
.num-3 { color: #ff007f; }
.num-4 { color: #9d4edd; }
.num-5 { color: #ffb703; }
.num-6 { color: #06b6d4; }
.num-7 { color: #fb7185; }
.num-8 { color: #ffffff; }

/* ==========================================================================
   5. STELLAR FOUR (CONNECT 4)
   ========================================================================== */
.connect4-board-wrapper {
  position: relative;
  background: rgba(14, 18, 54, 0.85);
  border: 1px solid var(--border-neon);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), var(--glow-cyan);
  border-radius: var(--radius-lg);
  padding: 16px;
}

.c4-drop-guide {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  margin-bottom: 8px;
}

.c4-drop-btn {
  background: rgba(0, 240, 255, 0.08);
  border: 1px solid rgba(0, 240, 255, 0.2);
  color: var(--neon-cyan);
  padding: 6px 0;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s ease;
}

.c4-drop-btn:hover {
  background: rgba(0, 240, 255, 0.25);
  transform: translateY(2px);
}

.connect4-board {
  display: grid;
  grid-template-columns: repeat(7, 54px);
  grid-template-rows: repeat(6, 54px);
  gap: 8px;
  background: #090c24;
  padding: 12px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(0, 240, 255, 0.15);
}

.c4-slot {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: rgba(6, 8, 20, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
}

.c4-disc {
  width: 90%;
  height: 90%;
  border-radius: 50%;
  animation: drop-disc 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.disc-cyan {
  background: radial-gradient(circle at 35% 35%, #ffffff, var(--neon-cyan) 60%, #0088cc);
  box-shadow: 0 0 14px var(--neon-cyan);
}

.disc-pink {
  background: radial-gradient(circle at 35% 35%, #ffffff, var(--neon-pink) 60%, #99004d);
  box-shadow: 0 0 14px var(--neon-pink);
}

.winning-disc {
  animation: win-pulse 0.8s infinite alternate;
}

@keyframes drop-disc {
  0% { transform: translateY(-120px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

@keyframes win-pulse {
  0% { transform: scale(0.9); filter: brightness(1); }
  100% { transform: scale(1.1); filter: brightness(1.5); }
}

@media (max-width: 480px) {
  .connect4-board {
    grid-template-columns: repeat(7, 38px);
    grid-template-rows: repeat(6, 38px);
    gap: 5px;
    padding: 8px;
  }
}

/* ==========================================================================
   6. CONSTELLATION MEMORY
   ========================================================================== */
.memory-board-wrapper {
  position: relative;
  background: rgba(14, 18, 48, 0.8);
  border: 1px solid var(--border-neon);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), var(--glow-purple);
  border-radius: var(--radius-lg);
  padding: 16px;
}

.memory-grid {
  display: grid;
  gap: 12px;
}

.grid-easy {
  grid-template-columns: repeat(4, 80px);
  grid-template-rows: repeat(3, 80px);
}

.grid-medium {
  grid-template-columns: repeat(4, 80px);
  grid-template-rows: repeat(4, 80px);
}

.grid-hard {
  grid-template-columns: repeat(6, 70px);
  grid-template-rows: repeat(4, 70px);
}

.memory-card {
  perspective: 1000px;
  cursor: pointer;
}

.card-inner {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: var(--radius-md);
}

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

.card-front, .card-back {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.card-front {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-card);
}

.card-front:hover {
  border-color: var(--neon-cyan);
  background: rgba(0, 240, 255, 0.1);
}

.card-back-icon {
  font-size: 1.4rem;
  color: var(--neon-cyan);
  opacity: 0.6;
}

.card-back {
  background: #151838;
  border: 1px solid var(--neon-purple);
  transform: rotateY(180deg);
  box-shadow: 0 0 12px rgba(157, 78, 221, 0.4);
}

.card-symbol {
  font-size: 1.8rem;
}

.card-name {
  font-size: 0.55rem;
  font-family: var(--font-display);
  color: var(--text-secondary);
  margin-top: 2px;
}

.memory-card.matched .card-back {
  border-color: var(--neon-green);
  box-shadow: 0 0 16px rgba(0, 255, 136, 0.6);
}

@media (max-width: 520px) {
  .grid-easy, .grid-medium {
    grid-template-columns: repeat(4, 62px);
    grid-template-rows: repeat(4, 62px);
    gap: 8px;
  }
  .grid-hard {
    grid-template-columns: repeat(6, 48px);
    grid-template-rows: repeat(4, 48px);
    gap: 6px;
  }
  .card-symbol { font-size: 1.3rem; }
  .card-name { display: none; }
}

/* ==========================================================================
   7. ASTRO WORD ORBIT (WORDLE)
   ========================================================================== */
.wordle-board-wrapper {
  position: relative;
  margin-bottom: 20px;
}

.wordle-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.wordle-row {
  display: flex;
  gap: 6px;
}

.wordle-tile {
  width: 52px;
  height: 52px;
  background: rgba(255, 255, 255, 0.04);
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-primary);
  text-transform: uppercase;
  transition: all 0.2s ease;
}

.wordle-tile.pop {
  transform: scale(1.08);
  border-color: var(--neon-cyan);
}

.wordle-tile.tile-correct {
  background: #064e3b;
  border-color: var(--neon-green);
  box-shadow: 0 0 10px rgba(0, 255, 136, 0.5);
}

.wordle-tile.tile-present {
  background: #713f12;
  border-color: var(--neon-amber);
  box-shadow: 0 0 10px rgba(255, 183, 3, 0.5);
}

.wordle-tile.tile-absent {
  background: #1e2030;
  border-color: #2b2d42;
  color: var(--text-muted);
}

.wordle-keyboard {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  max-width: 500px;
}

.keyboard-row {
  display: flex;
  justify-content: center;
  gap: 5px;
}

.key-btn {
  flex: 1;
  height: 48px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--border-card);
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.key-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--neon-cyan);
}

.key-btn.wide-key {
  flex: 1.5;
  font-size: 0.75rem;
}

.key-btn.key-correct {
  background: #064e3b;
  border-color: var(--neon-green);
  color: #ffffff;
}

.key-btn.key-present {
  background: #713f12;
  border-color: var(--neon-amber);
  color: #ffffff;
}

.key-btn.key-absent {
  background: #181926;
  border-color: #1f2133;
  color: #555870;
}

@media (max-width: 480px) {
  .wordle-tile {
    width: 44px;
    height: 44px;
    font-size: 1.25rem;
  }
  .key-btn {
    height: 42px;
    font-size: 0.75rem;
  }
}
