:root {
  --game-bg: #ffffff;
}

.splash-field {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  overflow: hidden;
  touch-action: none;
  background: #ffffff;
}

.canvas-area {
  position: absolute;
  inset: 0;
  cursor: crosshair;
  background: radial-gradient(circle at 50% 50%, #ffffff 0%, #f8fafc 100%);
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

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

/* Palette bar */
.palette-bar {
  position: absolute;
  bottom: max(16px, env(safe-area-inset-bottom, 16px));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: clamp(6px, 1.8vw, 12px);
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 36px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.04);
  z-index: 10;
  max-width: 92vw;
  overflow-x: auto;
  overflow-y: hidden;
  touch-action: pan-x;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

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

.palette-btn {
  width: clamp(40px, 8.5vw, 48px);
  height: clamp(40px, 8.5vw, 48px);
  border-radius: 50%;
  border: 3px solid #ffffff;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.14);
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1), border-color 0.15s ease, box-shadow 0.15s ease;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

.palette-btn:hover {
  transform: scale(1.12);
}

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

.palette-btn.active {
  transform: scale(1.22);
  border-color: #0f172a;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.28);
}

.palette-btn-rainbow {
  background: linear-gradient(135deg, #f43f5e, #fbbf24, #10b981, #3b82f6);
  position: relative;
}

.palette-btn-rainbow::after {
  content: '🌈';
  font-family: var(--font-emoji);
  font-variant-emoji: emoji;
  font-size: 16px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* Controls */
.splash-controls {
  position: absolute;
  top: max(12px, env(safe-area-inset-top, 12px));
  right: max(12px, env(safe-area-inset-right, 12px));
  z-index: 11;
}

.clear-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #38bdf8 0%, #0284c7 100%);
  color: #ffffff;
  border: none;
  border-radius: 30px;
  padding: 8px 18px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  min-height: 44px;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

.clear-btn:hover:not(:disabled) {
  transform: scale(1.05);
  box-shadow: 0 6px 18px rgba(2, 132, 199, 0.45);
}

.clear-btn:active:not(:disabled) {
  transform: scale(0.95);
}

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

.clear-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-icon {
  font-size: 22px;
  line-height: 1;
  font-family: var(--font-emoji);
  font-variant-emoji: emoji;
}

/* Paint blot */
.paint-blot {
  position: absolute;
  border-radius: 42% 58% 64% 36% / 44% 48% 52% 56%;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 -4px 8px rgba(0, 0, 0, 0.1), 0 4px 12px rgba(0, 0, 0, 0.08);
  animation: blot-appear 0.22s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  will-change: transform;
}

.paint-stamp {
  font-family: var(--font-emoji);
  font-variant-emoji: emoji;
  font-size: var(--stamp-size, 24px);
  line-height: 1;
  pointer-events: none;
  user-select: none;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
  transform: rotate(var(--counter-rot, 0deg));
}

@keyframes blot-appear {
  0% { transform: rotate(var(--rot, 0deg)) scale(0.2); }
  100% { transform: rotate(var(--rot, 0deg)) scale(1); }
}

/* Droplet splatters */
.paint-drop {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  animation: drop-spread 0.35s ease-out forwards;
}

@keyframes drop-spread {
  0% { transform: translate(0, 0) scale(0.4); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(1); opacity: 0.95; }
}

/* Water wave */
.water-wave {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(56, 189, 248, 0.88) 0%, rgba(2, 132, 199, 0.94) 100%);
  z-index: 20;
  pointer-events: none;
  animation: wave-wash 0.65s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes wave-wash {
  0% { transform: translateY(-100%); }
  50% { transform: translateY(0); }
  100% { transform: translateY(100%); }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .paint-blot {
    animation: none;
    transform: rotate(var(--rot, 0deg)) scale(1);
  }
  .paint-drop {
    animation: none;
    transform: translate(var(--dx), var(--dy)) scale(1);
    opacity: 0.95;
  }
  .water-wave {
    animation: wave-fade 0.4s ease forwards;
  }
  @keyframes wave-fade {
    0% { opacity: 0.9; }
    100% { opacity: 0; }
  }
}
