/* ---------- Studio layout ---------- */
.gallery {
  flex: 1;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: clamp(1.25rem, 4vw, 3.5rem) clamp(1rem, 5vw, 4rem);
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(1.5rem, 4vw, 3.5rem);
  align-items: start;
}

@media (min-width: 900px) {
  .gallery { grid-template-columns: minmax(0, 1.5fr) minmax(280px, 1fr); }
  .artwork { position: sticky; top: 2rem; }
}

/* ---------- Artwork ---------- */
.artwork {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  min-width: 0;
}

.frame-wrap {
  width: 100%;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.frame {
  width: 100%;
  background: var(--ink);
  padding: clamp(6px, 1.2vw, 12px);
  box-shadow: 0 18px 40px -20px rgba(0, 0, 0, 0.35);
}

.mat {
  position: relative;
  background: #ffffff;
  padding: clamp(12px, 4vw, 40px);
}

canvas#canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  touch-action: pan-y; /* vertical scroll still works; horizontal swipes change brushes */
}

.hud {
  position: absolute;
  top: clamp(20px, calc(4vw + 8px), 48px);
  left: clamp(20px, calc(4vw + 8px), 48px);
  background: rgba(31, 31, 31, 0.85);
  color: var(--wall);
  font-size: 0.75rem;
  padding: 0.35rem 0.65rem;
  border-radius: 4px;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}

.hud.show { opacity: 1; transform: none; }

.swipe-hint {
  display: none;
  position: absolute;
  left: 50%;
  bottom: clamp(20px, calc(4vw + 12px), 52px);
  transform: translateX(-50%);
  background: rgba(31, 31, 31, 0.85);
  color: var(--wall);
  font-size: 0.75rem;
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  white-space: nowrap;
  pointer-events: none;
}

.track-progress {
  width: 100%;
  height: 2px;
  background: var(--line);
}

.track-fill {
  height: 100%;
  width: 0;
  background: var(--accent);
}

.now-playing {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--muted);
  text-align: center;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--line);
  flex-shrink: 0;
}

.dot.live {
  background: var(--accent);
  animation: pulse 1.6s ease-in-out infinite;
}

@keyframes pulse { 50% { opacity: 0.35; } }

/* ---------- Side panel ---------- */
.side {
  display: flex;
  flex-direction: column;
  gap: clamp(1.25rem, 3vw, 2rem);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
}

/* ---------- Tools ---------- */
.tools {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  border-top: 1px solid var(--line);
  padding-top: clamp(1rem, 3vw, 1.5rem);
}

.tool {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.picker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.palette-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
}

/* keep palette names on one line */
.palette-picker .pick { white-space: nowrap; min-width: 0; gap: 3px; }
.palette-picker .swatch { width: 8px; height: 8px; }
.palette-picker .pick-name { overflow: hidden; text-overflow: ellipsis; }

.hint {
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.6;
}

/* ---------- Canvas size label (blank canvas only) ---------- */
.size-chip {
  position: absolute;
  top: clamp(20px, calc(4vw + 8px), 48px);
  right: clamp(20px, calc(4vw + 8px), 48px);
  z-index: 2;
}

.size-chip-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: #ffffff;
  border: 1px solid var(--ink);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 0.75rem;
  padding: 0.4rem 0.65rem;
  min-height: 36px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.size-chip-btn:hover,
.size-chip-btn:focus-visible {
  background: var(--ink);
  color: var(--wall);
  outline: none;
}

.size-chip-caret { color: var(--accent); font-size: 0.7rem; }

.size-chip-btn:hover .size-chip-caret,
.size-chip-btn:focus-visible .size-chip-caret { color: inherit; }

.size-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 180px;
  background: #ffffff;
  border: 1px solid var(--line);
  box-shadow: 0 12px 28px -16px rgba(0, 0, 0, 0.35);
  padding: 0.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.size-menu .pick {
  width: 100%;
  justify-content: flex-start;
  min-height: 38px;
}