/* ── Studio layout ─────────────────────── */
.studio-layout {
  display: grid;
  grid-template-columns: 252px 1fr;
  min-height: calc(100dvh - var(--nav-h));
  align-items: start;
}
.studio-sidebar {
  position: sticky; top: var(--nav-h);
  height: calc(100dvh - var(--nav-h));
  overflow-y: auto; overflow-x: hidden;
  border-right: 1px solid var(--border);
  padding: 1.1rem 1rem 2rem;
  background: var(--ivory);
  scrollbar-width: thin;
  scrollbar-color: var(--border-mid) transparent;
}
.sidebar-header { margin-bottom: 1rem; padding-bottom: 0.875rem; border-bottom: 1px solid var(--border); }
.sidebar-title { font-family: var(--font-display); font-size: 1.1rem; font-weight: 500; color: var(--rose-deep); margin-bottom: 0.15rem; }
.sidebar-sub   { font-size: 0.75rem; color: var(--muted-light); }

/* ── Controls ───────────────────────────── */
.ctrl-section { margin-bottom: 1.1rem; }
.ctrl-section-label {
  font-size: 0.68rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--gold); margin-bottom: 0.5rem;
}
.ctrl-row { display: flex; align-items: center; gap: 8px; margin-bottom: 0.45rem; }
.ctrl-label { font-size: 0.79rem; color: var(--muted); min-width: 104px; flex-shrink: 0; }
.ctrl-row input[type=range] { flex: 1; min-width: 0; accent-color: var(--rose); }
.ctrl-val { font-size: 0.79rem; font-weight: 500; min-width: 30px; text-align: right; color: var(--charcoal); }

/* ── Symmetry ───────────────────────────── */
.sym-row { display: flex; flex-wrap: wrap; gap: 4px; }
.sym-btn {
  padding: 3px 8px; font-size: 0.74rem;
  border-radius: 4px; border: 1px solid var(--border-mid);
  background: transparent; cursor: pointer;
  color: var(--muted); font-family: var(--font-body);
  transition: all 0.15s; min-height: 28px;
}
.sym-btn:hover { background: var(--parchment); color: var(--charcoal); }
.sym-btn.active { background: var(--rose); color: #fff; border-color: var(--rose); }

/* ── Colors ─────────────────────────────── */
.color-group-label { font-size: 0.77rem; color: var(--muted); margin-bottom: 0.35rem; font-weight: 500; }
.color-strip { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 0.45rem; min-height: 24px; }
.swatch {
  width: 22px; height: 22px; border-radius: 4px;
  border: 1.5px solid var(--border-mid); cursor: pointer;
  flex-shrink: 0; position: relative; transition: transform 0.15s;
}
.swatch:hover { transform: scale(1.15); }
.swatch::after {
  content: '×'; position: absolute; top: -6px; right: -6px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--rose-deep); color: white;
  font-size: 11px; line-height: 14px; text-align: center;
  display: none; font-weight: 700;
}
.swatch:hover::after { display: block; }
.hex-row { display: flex; gap: 4px; align-items: center; }
.hex-row input[type=color] {
  width: 28px; height: 26px; padding: 1px 2px;
  border-radius: 4px; border: 1px solid var(--border-mid);
  cursor: pointer; background: transparent; flex-shrink: 0;
}
.hex-row input[type=text] {
  flex: 1; min-width: 0; padding: 4px 6px;
  font-size: 0.77rem; border: 1px solid var(--border-mid);
  border-radius: 4px; font-family: var(--font-body);
  background: white; min-height: 28px;
}
.hex-row input[type=text]:focus { outline: none; border-color: var(--gold); }

/* ── Sidebar actions ─────────────────────── */
.sidebar-actions { display: flex; flex-direction: column; gap: 0.45rem; margin-top: 1.25rem; padding-top: 1.1rem; border-top: 1px solid var(--border); }
.sidebar-actions .btn { justify-content: center; font-size: 0.84rem; }

/* ── Canvas area ─────────────────────────── */
.studio-canvas-area { padding: 1.25rem; display: flex; flex-direction: column; gap: 0.875rem; }
#canvas-wrap { overflow-x: auto; cursor: crosshair; border-radius: 6px; }
#loom { display: block; image-rendering: pixelated; }

/* ── Accessible pattern description ──────── */
#pattern-desc { font-size: 0.8rem; color: var(--muted); max-width: 600px; line-height: 1.5; margin-top: 0.25rem; }

/* ── Tooltip ─────────────────────────────── */
#tooltip {
  position: fixed; background: var(--charcoal); color: var(--ivory);
  padding: 7px 11px; border-radius: 6px; font-size: 0.79rem;
  pointer-events: none; display: none; z-index: 300;
  white-space: nowrap; line-height: 1.5;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}

/* ── Progress ────────────────────────────── */
.progress-strip { max-width: 640px; }
.progress-bar-outer { height: 5px; background: var(--parchment); border-radius: 3px; overflow: hidden; margin-bottom: 0.35rem; }
.progress-bar-inner { height: 100%; background: var(--sage); border-radius: 3px; width: 0%; transition: width 0.25s; }
.progress-meta { display: flex; justify-content: space-between; align-items: center; font-size: 0.8rem; color: var(--muted); }
.reset-link { background: none; border: none; cursor: pointer; color: var(--muted); font-size: 0.8rem; font-family: var(--font-body); text-decoration: underline; padding: 0; min-height: 36px; }
.reset-link:hover { color: var(--charcoal); }

/* ── Mobile ──────────────────────────────── */
@media (max-width: 760px) {
  .studio-layout { grid-template-columns: 1fr; }
  .studio-sidebar { position: static; height: auto; border-right: none; border-bottom: 1px solid var(--border); }
}
