:root {
  --cell-size: 32px;
}

.app {
  max-width: 600px;
}

#grid {
  display: grid;
  gap: 2px;
  padding: 8px;
  background: var(--board-bg);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  user-select: none;
  touch-action: manipulation;
}

.flood-cell {
  width: var(--cell-size);
  height: var(--cell-size);
  border-radius: 3px;
  transition: background-color 0.12s ease;
  cursor: default;
}

/* Color bar */
.color-bar {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.color-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
  box-shadow: var(--shadow-sm);
  outline: none;
  flex-shrink: 0;
}

.color-btn:hover {
  transform: scale(1.12);
  box-shadow: var(--shadow-md);
}

.color-btn.active {
  border-color: var(--text-strong);
  box-shadow: 0 0 0 3px rgba(0,0,0,0.18), var(--shadow-md);
  transform: scale(1.08);
}

body.dark .color-btn.active {
  border-color: #fff;
  box-shadow: 0 0 0 3px rgba(255,255,255,0.25), var(--shadow-md);
}

/* Overlay */
.overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 100;
  animation: fadein 0.3s ease;
}
.overlay[hidden] { display: none; }

.overlay-text {
  font-size: clamp(32px, 8vmin, 52px);
  font-weight: 800;
  color: var(--text-strong);
  text-align: center;
  line-height: 1.25;
}

@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }

/* Responsive sizing */
@media (max-width: 480px) {
  :root { --cell-size: 26px; }
  .color-btn { width: 38px; height: 38px; }
}
@media (max-width: 360px) {
  :root { --cell-size: 20px; }
  .color-btn { width: 32px; height: 32px; }
}
