body {
  font-family: "Inter", sans-serif;
  background: #f9fafb;
  touch-action: pan-y;
}

.tool-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.03);
}

/* ── Editor layout: sidebar left, canvas right on desktop ── */
.editor-layout {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
@media (min-width: 768px) {
  .editor-layout {
    flex-direction: row;
  }
  .canvas-section {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #f3f4f6;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    padding: 20px;
  }
  .tools-section {
    width: 300px;
    flex-shrink: 0;
  }
}
.editor-layout > div {
  min-width: 0;
}

/* ── Canvas ── */
.canvas-container {
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  aspect-ratio: 1;
  background: #fff;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  border-radius: 4px;
  position: relative;
  touch-action: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
#mandala-canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
  border-radius: 4px;
}

/* ── Loading overlay ── */
#loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.7);
  display: none;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  z-index: 10;
}

/* ── Palette ── */
.palette-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 5px;
}
@media (max-width: 640px) {
  .palette-grid {
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
  }
}
.color-swatch {
  aspect-ratio: 1;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid rgba(0, 0, 0, 0.1);
  transition:
    transform 0.1s,
    border-color 0.1s;
  -webkit-tap-highlight-color: transparent;
  width: 100%;
  max-width: 34px;
}
.color-swatch:hover {
  transform: scale(1.1);
}
.color-swatch.active {
  border-color: #111;
  transform: scale(1.15);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  z-index: 10;
}

/* ── Buttons ── */
.action-btn {
  width: 100%;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid #d1d5db;
  background: #fff;
  color: #374151;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 5px;
}
.action-btn:hover {
  background: #f9fafb;
  border-color: #9ca3af;
}
.action-btn:active {
  transform: scale(0.98);
}
.primary-btn {
  background: #065f46;
  border-color: #047857;
  color: #fff;
  padding: 10px;
  font-size: 14px;
}
.primary-btn:hover {
  background: #047857;
  border-color: #064e3b;
}
.generator-btn {
  background: #065f46;
  border-color: #047857;
  color: #fff;
}
.generator-btn:hover {
  background: #047857;
  border-color: #064e3b;
}

/* ── Pattern pills ── */
.pat-pill {
  border: 1.5px solid #e5e7eb;
  border-radius: 99px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  color: #6b7280;
  background: #fff;
  cursor: pointer;
  transition: all 0.12s;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.pat-pill:hover {
  border-color: #6ee7b7;
  color: #065f46;
  background: #f0fdf4;
}
.pat-pill.active {
  border-color: #059669;
  color: #065f46;
  background: #ecfdf5;
}

/* ── Ripple ── */
@keyframes rip {
  0% {
    transform: translate(-50%, -50%) scale(0);
    opacity: 0.7;
  }
  100% {
    transform: translate(-50%, -50%) scale(4);
    opacity: 0;
  }
}
.fill-ripple {
  position: absolute;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 20;
  animation: rip 0.4s ease-out forwards;
}
