.paint {
  max-width: 1200px;
  margin: 0.5rem auto 2rem;
  padding: 0 1rem;
  position: relative;
  z-index: 1;
}

.paint-header {
  text-align: center;
  padding: 0.5rem 0 1rem;
}

.paint-header h1 {
  margin: 0;
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  background: linear-gradient(90deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  padding-bottom: 0.1em;
}

.paint-sub {
  margin: 0.25rem 0 0;
  font-weight: 600;
  color: var(--text);
}

.paint-app {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 1rem;
}

.toolbar {
  background: var(--card);
  border: 3px solid var(--card-border);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.tool-group { display: flex; flex-direction: column; gap: 0.5rem; }
.tool-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-soft);
  font-weight: 800;
}

/* Color palette */
.palette {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.4rem;
}

.swatch {
  aspect-ratio: 1;
  border-radius: 50%;
  border: 3px solid white;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s ease;
  padding: 0;
}

.swatch:hover { transform: scale(1.1); }
.swatch.active {
  border-color: var(--text);
  transform: scale(1.15);
  box-shadow: 0 0 0 2px var(--primary), 0 4px 10px rgba(0, 0, 0, 0.3);
}

/* Brush sizes */
.brush-sizes {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.4rem;
}

.brush-btn {
  background: white;
  border: 2px solid #ddd;
  border-radius: 12px;
  cursor: pointer;
  padding: 0.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s ease;
}
.brush-btn.active { border-color: var(--primary); background: #f5efff; }

.dot {
  display: block;
  border-radius: 50%;
  background: var(--text);
}
.dot.s  { width: 6px;  height: 6px; }
.dot.m  { width: 12px; height: 12px; }
.dot.l  { width: 20px; height: 20px; }
.dot.xl { width: 32px; height: 32px; }

/* Tool buttons */
.tool-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 0.4rem; }

.tool-btn {
  font: inherit;
  font-weight: 700;
  padding: 0.5rem;
  border-radius: 12px;
  border: 2px solid #ddd;
  background: white;
  cursor: pointer;
  font-size: 0.9rem;
  color: #1f1b2e;
}
.tool-btn.active { border-color: var(--primary); background: #f5efff; }

/* Template select */
#template {
  font: inherit;
  font-weight: 700;
  padding: 0.5rem 0.7rem;
  border-radius: 12px;
  border: 2px solid var(--primary);
  background: white;
  color: #1f1b2e;
  cursor: pointer;
}

/* Action buttons */
.actions { gap: 0.5rem; }

.btn-action {
  font: inherit;
  font-weight: 800;
  padding: 0.7rem;
  border-radius: 14px;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  color: white;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  box-shadow: var(--shadow);
  transition: transform 0.15s ease;
}
.btn-action:hover { transform: translateY(-2px); }
.btn-action.primary { background: linear-gradient(90deg, var(--primary), var(--accent)); }
.btn-action.danger  { background: linear-gradient(90deg, #ff8a8a, #ff5c5c); }

/* Canvas */
.canvas-wrap {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0.75rem;
  overflow: hidden;
  border: 3px solid var(--card-border);
}

#canvas {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 12px;
  cursor: crosshair;
  touch-action: none;
  background: white;
}

@media (max-width: 720px) {
  .paint-app { grid-template-columns: 1fr; }
  .toolbar { order: 2; }
  .canvas-wrap { order: 1; }
}
