:root {
  --arcade-panel: rgba(15, 18, 43, 0.96);
  --arcade-panel-soft: rgba(255, 255, 255, 0.08);
  --arcade-line: rgba(255, 255, 255, 0.14);
  --arcade-text: #f7f8ff;
  --arcade-muted: #b9bfd6;
  --arcade-accent: #8b7cff;
  --arcade-accent-2: #61e7ff;
}

.game-sound-toggle {
  position: fixed;
  z-index: 100;
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0 !important;
  border: 1px solid rgba(255, 255, 255, 0.22) !important;
  border-radius: 50% !important;
  background: rgba(10, 12, 31, 0.72) !important;
  color: white !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22) !important;
  backdrop-filter: blur(12px);
  font-size: 18px !important;
  line-height: 1 !important;
}

.game-status-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 6px 12px;
  border: 1px solid var(--arcade-line);
  border-radius: 999px;
  background: rgba(10, 12, 31, 0.66);
  color: #eff2ff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  backdrop-filter: blur(10px);
}

.quality-pulse {
  animation: qualityPulse 0.38s ease;
}

@keyframes qualityPulse {
  50% { transform: scale(1.16); filter: brightness(1.18); }
}

html.game-flappy-bird #gameCanvas,
html.game-infinite-stairs #gameCanvas {
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 24px 70px rgba(20, 15, 70, 0.38), inset 0 0 0 1px rgba(255, 255, 255, 0.12) !important;
}

html.game-flappy-bird #startScreen,
html.game-flappy-bird #gameOverScreen,
html.game-infinite-stairs #startScreen,
html.game-infinite-stairs #gameOverScreen {
  width: min(82vw, 350px);
  min-width: 0 !important;
  padding: clamp(24px, 6vw, 38px) !important;
  border: 1px solid rgba(255, 255, 255, 0.62);
  box-shadow: 0 28px 90px rgba(22, 17, 70, 0.36) !important;
}

html.game-flappy-bird #startScreen h1,
html.game-flappy-bird #gameOverScreen h1,
html.game-infinite-stairs #startScreen h1,
html.game-infinite-stairs #gameOverScreen h1 {
  overflow-wrap: normal;
  word-break: keep-all;
  line-height: 1.18;
}

html.game-flappy-bird .game-status-chip,
html.game-infinite-stairs .game-status-chip {
  position: absolute;
  z-index: 12;
  top: max(18px, calc(env(safe-area-inset-top) + 8px));
  left: max(16px, env(safe-area-inset-left));
}

.flappy-medal {
  margin: 12px 0 2px;
  color: #675ad7;
  font-size: 14px;
  font-weight: 800;
}

html.game-minesweeper body,
html.game-rps body,
html.game-cham-cham-cham body {
  background:
    radial-gradient(circle at 12% 12%, rgba(97, 231, 255, 0.18), transparent 32%),
    radial-gradient(circle at 88% 88%, rgba(169, 102, 255, 0.2), transparent 35%),
    linear-gradient(145deg, #090b1c, #19153c 58%, #101f36) !important;
}

html.game-minesweeper #gameContainer,
html.game-rps .game-container,
html.game-cham-cham-cham .game-container {
  border: 1px solid var(--arcade-line) !important;
  background: linear-gradient(155deg, rgba(22, 25, 54, 0.98), rgba(12, 15, 35, 0.98)) !important;
  color: var(--arcade-text) !important;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.46) !important;
}

html.game-minesweeper h1,
html.game-rps h1,
html.game-cham-cham-cham h1 {
  color: var(--arcade-text) !important;
  text-shadow: 0 0 24px rgba(139, 124, 255, 0.35);
}

html.game-minesweeper #gameStats,
html.game-rps .score-board,
html.game-cham-cham-cham .score-board {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: var(--arcade-panel-soft) !important;
}

html.game-minesweeper .stat-label,
html.game-rps .score-label,
html.game-cham-cham-cham .score-label {
  color: var(--arcade-muted) !important;
}

html.game-minesweeper .stat-value,
html.game-rps .score-value,
html.game-cham-cham-cham .score-value {
  color: #8feeff !important;
}

html.game-minesweeper #gameBoard {
  border: 1px solid rgba(255, 255, 255, 0.18) !important;
  border-radius: 12px;
  background: #0a0d20 !important;
  box-shadow: 0 20px 55px rgba(0, 0, 0, 0.36), inset 0 0 30px rgba(97, 231, 255, 0.05);
  overflow: hidden;
}

html.game-minesweeper .cell {
  min-height: 0 !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  background: linear-gradient(145deg, #353d68, #202747) !important;
  color: white;
  box-shadow: inset 1px 1px rgba(255, 255, 255, 0.12), inset -1px -1px rgba(0, 0, 0, 0.25) !important;
}

html.game-minesweeper .cell.revealed {
  background: #11162e !important;
  box-shadow: none !important;
}

html.game-minesweeper .difficulty-btn,
html.game-minesweeper #restartButton,
html.game-minesweeper .back-btn {
  background: rgba(255, 255, 255, 0.1) !important;
  color: var(--arcade-text) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
}

html.game-minesweeper .difficulty-btn.active,
html.game-minesweeper #restartButton {
  background: linear-gradient(135deg, #6b64ff, #9c4dff) !important;
}

html.game-minesweeper .difficulty-mobile-only {
  display: none !important;
}

.mine-mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 12px auto 14px;
  padding: 5px;
  max-width: 280px;
  border: 1px solid var(--arcade-line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
}

.mine-mode-switch button {
  min-height: 42px;
  padding: 8px 12px !important;
  border: 0 !important;
  border-radius: 10px !important;
  background: transparent !important;
  color: var(--arcade-muted) !important;
  font-size: 14px !important;
}

.mine-mode-switch button.active {
  background: linear-gradient(135deg, #61e7ff, #8b7cff) !important;
  color: #090b1c !important;
  box-shadow: 0 8px 22px rgba(97, 231, 255, 0.2);
}

.mine-best-time {
  margin: -4px 0 10px;
  color: var(--arcade-muted);
  font-size: 12px;
  text-align: center;
}

html.game-rps .best-streak-header,
html.game-cham-cham-cham .best-streak-header {
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  background: linear-gradient(135deg, rgba(97, 231, 255, 0.14), rgba(139, 124, 255, 0.22)) !important;
}

html.game-rps .best-streak-label,
html.game-cham-cham-cham .best-streak-label {
  color: var(--arcade-muted) !important;
}

html.game-rps .best-streak-value,
html.game-cham-cham-cham .best-streak-value {
  color: white !important;
}

html.game-rps .choice-btn,
html.game-cham-cham-cham .choice-btn {
  border-color: rgba(255, 255, 255, 0.2) !important;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.05)) !important;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.18) !important;
}

html.game-rps .choice-btn.selected,
html.game-cham-cham-cham .choice-btn.selected {
  border-color: #75ecff !important;
  box-shadow: 0 0 0 4px rgba(97, 231, 255, 0.13), 0 0 28px rgba(97, 231, 255, 0.28) !important;
}

html.game-rps .choice-btn:disabled,
html.game-cham-cham-cham .choice-btn:disabled {
  cursor: wait;
  opacity: 0.58;
}

html.game-rps .result,
html.game-cham-cham-cham .result {
  color: var(--arcade-text);
}

html.game-rps .reset-btn,
html.game-rps .back-btn,
html.game-cham-cham-cham .reset-btn,
html.game-cham-cham-cham .back-btn {
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  background: rgba(255, 255, 255, 0.08) !important;
  color: var(--arcade-text) !important;
}

@media (max-width: 480px) {
  html.game-rps .game-container,
  html.game-cham-cham-cham .game-container {
    padding: 16px !important;
  }

  html.game-minesweeper #gameContainer {
    padding: 18px 12px !important;
  }

  html.game-flappy-bird #startScreen h1,
  html.game-infinite-stairs #startScreen h1 {
    font-size: clamp(25px, 7vw, 31px) !important;
  }
}

@media (max-width: 768px) {
  html.game-minesweeper .difficulty-btn {
    display: none !important;
  }

  html.game-minesweeper .difficulty-btn[data-difficulty="easy"],
  html.game-minesweeper .difficulty-mobile-only {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .quality-pulse { animation: none; }
}
