:root {
  --game-bg: radial-gradient(circle at 50% 25%, #1e1b4b 0%, #0f172a 55%, #020617 100%);
  --game-accent: #f59e0b;
}

.sparks-field {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  overflow: hidden;
  touch-action: none;
  background: var(--game-bg);
}

.sparks-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: pointer;
  touch-action: none;
}

.sparks-canvas:focus-visible {
  outline: 4px solid #f59e0b;
  outline-offset: -4px;
}

/* Interactive moon */
.moon-btn {
  position: absolute;
  top: max(14px, calc(10px + env(safe-area-inset-top, 0px)));
  right: max(16px, calc(10px + env(safe-area-inset-right, 0px)));
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1.5px solid rgba(254, 240, 138, 0.35);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  padding: 0;
  box-shadow: 0 0 16px rgba(254, 240, 138, 0.18);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

.moon-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 0 22px rgba(254, 240, 138, 0.35);
}

.moon-btn:active {
  transform: scale(0.92);
}

.moon-btn:focus-visible {
  outline: 3px solid #f59e0b;
  outline-offset: 3px;
}

.moon-icon {
  font-size: 28px;
  line-height: 1;
}

.moon-btn.wobble {
  animation: moon-hop 0.5s ease-out;
}

@keyframes moon-hop {
  0% { transform: scale(1); }
  40% { transform: scale(1.25) rotate(-12deg); }
  75% { transform: scale(0.95) rotate(6deg); }
  100% { transform: scale(1); }
}

/* Modes bar */
.modes-bar {
  position: absolute;
  bottom: max(14px, calc(10px + env(safe-area-inset-bottom, 0px)));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: clamp(6px, 2vw, 12px);
  padding: 6px clamp(10px, 2vw, 16px);
  background: rgba(15, 23, 42, 0.88);
  border: 1.5px solid rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(8px);
  border-radius: 36px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  z-index: 10;
  max-width: 92vw;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.modes-bar::-webkit-scrollbar {
  display: none;
}

.mode-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 6px 14px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.08);
  border: 1.5px solid transparent;
  color: #f8fafc;
  font-size: clamp(13px, 3.2vw, 15px);
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  transition: all 0.15s ease-out;
}

.mode-btn:hover {
  background: rgba(255, 255, 255, 0.16);
}

.mode-btn:active {
  transform: scale(0.96);
}

.mode-btn:focus-visible {
  outline: 3px solid #f59e0b;
  outline-offset: 2px;
}

.mode-btn.active {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.45);
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.45);
  transform: scale(1.05);
}

.mode-btn.active:active {
  transform: scale(1.01);
}

.mode-icon {
  font-size: 18px;
  line-height: 1;
}

@media (prefers-reduced-motion: reduce) {
  .moon-btn.wobble {
    animation: none;
  }
}
