/* =========================================================================
   studio.css — Skin Studio: deck | living stage | channels.
   Loaded only by studio.html. No raw colour literals: theme tokens only.

   TWO COLLISIONS RESOLVED (both were silent in the donor):
     1. `.tabs [role=tab]` here vs `.tabs button` in site.css. Both matched the
        same buttons on this page; the winner was decided by link order, not by
        intent. The studio lane is `.studio-tabs [role=tab]` now.
     2. `.card { padding: 16px }` was declared here with NO page scope, so this
        sheet silently reshaped the shared card component. It is
        `.card.studio-card` now — an opt-in, applied in the fragment.
   `.panel-label` also meant something different in map.css; this one is
   `.studio-panel-label`.
   ========================================================================= */

/* ---------- tabs ---------- */
.studio-tabs {
  display: inline-flex; gap: 4px; padding: 4px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-s);
}
.studio-tabs [role="tab"] {
  padding: 8px 15px; border: 0; border-radius: var(--r-xs);
  background: transparent; color: var(--fg-dim);
  font: 600 13.5px/1 var(--font-ui); cursor: pointer;
}
.studio-tabs [role="tab"][aria-selected="true"] {
  background: var(--surface-3); color: var(--fg);
}

/* ---------- layout ---------- */
.studio {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr) 316px;
  gap: 14px;
  align-items: start;
}
.card.studio-card { padding: 16px; }

/* ---------- deck ---------- */
.deck h3 { font-size: var(--fs-3); margin-bottom: 10px; }
.deck-search input {
  width: 100%; padding: 8px 11px;
  background: var(--surface-3); border: 1px solid var(--border);
  border-radius: var(--r-s); color: var(--fg);
  font: 500 13.5px/1.3 var(--font-ui);
}
.deck-list {
  margin-top: 10px; max-height: 520px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 4px;
  scrollbar-width: thin;
}
.deck-row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 9px 11px; border: 1px solid transparent; border-radius: var(--r-s);
  background: transparent; color: var(--fg-dim); cursor: pointer;
  text-align: left;
}
.deck-row b { font: 600 13.5px/1.2 var(--font-ui); color: var(--fg-dim); }
.deck-row span {
  font: 600 10px/1 var(--font-mono); letter-spacing: .13em; text-transform: uppercase;
  color: var(--fg-mute);
}
.deck-row:hover { background: var(--surface-2); }
.deck-row.on { background: var(--surface-3); border-color: var(--border-2); }
.deck-row.on b { color: var(--fg); }
.deck-empty { padding: 8px 4px; }

/* ---------- stage ---------- */
.stage { display: flex; flex-direction: column; gap: 12px; }
.stage-head { display: flex; align-items: center; gap: 10px; }
.stage-head h3 { font-size: 17.5px; margin-right: auto; }
.stage-anim { display: inline-flex; gap: 5px; flex-wrap: wrap; justify-content: flex-end; }
/* the display rule above would beat the hidden attribute's UA rule */
.stage-anim[hidden] { display: none; }

.chip {
  padding: 6px 11px; border-radius: var(--r-xs);
  border: 1px solid var(--border); background: var(--surface);
  color: var(--fg-dim); font: 600 12px/1 var(--font-ui); cursor: pointer;
}
.chip:hover:not(:disabled) { color: var(--fg); border-color: var(--edge); }
.chip.on { background: var(--surface-3); color: var(--fg); border-color: var(--border-2); }
.chip:disabled { opacity: .45; cursor: not-allowed; }

.stage-wrap {
  position: relative; height: 480px;
  border-radius: var(--r-s); overflow: hidden;
  background: var(--stage-floor);
  border: 1px solid var(--border);
}
#stage-canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
.stage-note {
  /* 56px, not 12: the growth pill owns the bottom-centre seat now */
  position: absolute; left: 0; right: 0; bottom: 56px;
  text-align: center; margin: 0;
  font: 500 12.5px/1.4 var(--font-ui); color: var(--fg-dim);
}
.stage-note.is-error { color: var(--warn); }

/* ---------- growth preview ----------
   The Arkadia studio's slider, 1:1 in structure and seating (a glass pill,
   bottom-centre over the stage, label | range | "NN% · STAGE" readout) with
   every colour a THEME token - nothing of the donor's palette survives. */
.stage-growth {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: 12px;
  z-index: 2; max-width: calc(100% - 20px);
  display: inline-flex; align-items: center; gap: 10px;
  padding: 8px 13px; border-radius: 999px;
  background: var(--scrim-modal); border: 1px solid var(--border);
  -webkit-backdrop-filter: blur(12px) saturate(120%);
  backdrop-filter: blur(12px) saturate(120%);
}
.stage-growth .gr-label {
  font: 600 10px/1 var(--font-mono); letter-spacing: .14em;
  text-transform: uppercase; color: var(--fg-mute);
}
.stage-growth .gr-readout {
  font: 500 11px/1 var(--font-mono); letter-spacing: .08em;
  color: var(--fg-dim); min-width: 92px; white-space: nowrap;
}
.stage-growth #growth-pct {
  color: var(--fg); font-variant-numeric: tabular-nums;
  display: inline-block; min-width: 34px; text-align: right;
}
.stage-growth input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 150px; height: 3px; border-radius: 3px;
  background: var(--border-2); outline: none; cursor: pointer;
}
.stage-growth input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--surface-3); cursor: pointer;
}
.stage-growth input[type="range"]::-moz-range-thumb {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--surface-3); cursor: pointer;
}
@media (max-width: 560px) {
  .stage-growth { gap: 8px; padding: 6px 10px; }
  .stage-growth .gr-label { display: none; }
  .stage-growth input[type="range"] { width: 34vw; }
  .stage-growth .gr-readout { min-width: 84px; font-size: 10px; }
}

.stage-gate {
  position: absolute; inset: 0; z-index: 3;
  display: grid; place-content: center; justify-items: center;
  gap: 10px; text-align: center; padding: 24px;
  background: var(--scrim-modal);
  -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px);
}
/* the display:grid above would beat the hidden attribute's UA rule */
.stage-gate[hidden] { display: none; }
.stage-gate h3 { font-size: 19px; }
.stage-gate p { max-width: 40ch; color: var(--fg-dim); font-size: 14px; }

.stage-foot {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.stage-foot-k {
  font: 600 10.5px/1 var(--font-mono); letter-spacing: .15em; text-transform: uppercase;
  color: var(--fg-mute);
}
.chips { display: inline-flex; gap: 5px; }

/* The pattern-size note. One line under the stage foot saying what those three
   buttons change - a player reading "size" beside a pattern letter can just as
   easily think it means the animal. Sized to sit UNDER the row without becoming
   a second heading. */
.studio-size-note {
  margin: 6px 0 0; max-width: 52ch;
  font-size: 12px; line-height: 1.45; color: var(--fg-mute);
}

/* ---------- channels ---------- */
.channels { display: flex; flex-direction: column; gap: 14px; }
.channels .stage-head h3 { font-size: var(--fs-3); }
.btn-sm { padding: 7px 11px; font-size: 12.5px; }

.channel-list { display: flex; flex-direction: column; gap: 7px; }
.channel {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 7px 9px; border: 1px solid var(--border); border-radius: var(--r-s);
  background: var(--surface-2);
}
.channel label { font: 600 13px/1 var(--font-ui); color: var(--fg-dim); }
.channel-io { display: flex; align-items: center; gap: 7px; }
.channel input[type="color"] {
  width: 34px; height: 26px; padding: 0; border: 1px solid var(--border-2);
  border-radius: var(--r-xs); background: var(--surface-3); cursor: pointer;
}
.channel input[type="color"]::-webkit-color-swatch-wrapper { padding: 2px; }
.channel input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 3px; }
.channel .hex {
  width: 78px; padding: 5px 7px;
  background: var(--surface-3); border: 1px solid var(--border);
  border-radius: var(--r-xs); color: var(--fg-dim);
  font: 500 12px/1 var(--font-mono); text-transform: lowercase;
}

.studio-panel-label {
  font: 600 10.5px/1 var(--font-mono); letter-spacing: .15em; text-transform: uppercase;
  color: var(--fg-mute); margin: 0 0 8px;
}
.presets { display: flex; flex-wrap: wrap; gap: 6px; }
.preset {
  padding: 7px 11px; border-radius: var(--r-xs);
  border: 1px solid var(--border); background: var(--surface-2);
  color: var(--fg-dim); font: 600 12.5px/1 var(--font-ui); cursor: pointer;
}
.preset:hover { color: var(--fg); border-color: var(--edge); }

.save-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
#design-name {
  flex: 1 1 130px; padding: 9px 11px;
  background: var(--surface-3); border: 1px solid var(--border);
  border-radius: var(--r-s); color: var(--fg);
  font: 500 13.5px/1.3 var(--font-ui);
}
.save-note { flex-basis: 100%; font-size: 12.5px; margin: 0; }

.designs { border-top: 1px solid var(--border); padding-top: 12px; }
.design-row { display: flex; align-items: center; gap: 6px; margin-bottom: 5px; }
.design-load {
  flex: 1; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--r-s);
  background: var(--surface-2); color: var(--fg-dim); cursor: pointer; text-align: left;
}
.design-load b { font: 600 13px/1.2 var(--font-ui); color: var(--fg-dim); }
.design-load span {
  font: 600 10px/1 var(--font-mono); letter-spacing: .12em; text-transform: uppercase;
  color: var(--fg-mute);
}
.design-load:hover { border-color: var(--edge); }
.design-load:hover b { color: var(--fg); }
/* THE ROW THE EDITOR IS OPEN ON. The save button says "Update", and this says
   WHICH design it will update - without it the two controls that decide where
   a save lands sit at opposite ends of the panel with nothing joining them. */
.design-row.editing .design-load {
  border-color: var(--accent, var(--edge));
  background: var(--surface-3, var(--surface-2));
}
.design-row.editing .design-load b { color: var(--fg); }
.design-del {
  width: 30px; height: 34px; flex: none;
  border: 1px solid var(--border); border-radius: var(--r-s);
  background: transparent; color: var(--fg-mute);
  font: 500 var(--fs-3)/1 var(--font-ui); cursor: pointer;
}
.design-del:hover { color: var(--bad); border-color: var(--bad-dim); }
.designs-empty { font-size: 12.5px; }

/* ---------- glitch tiles ---------- */
.glitch-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
}
.glitch-tile {
  position: relative; overflow: hidden;
  padding: 18px 16px 15px;
  background: var(--surface); border: 1px solid var(--border-2);
  border-radius: var(--r); box-shadow: var(--shadow);
}
.glitch-tile h3 { font-size: 17px; margin-bottom: 4px; }
.glitch-tile p { color: var(--fg); font: 600 14px/1 var(--font-ui); margin: 0 0 10px; }
/* ★★★ THE COLOUR PROXIMITY PLATE - what a glitch tile shows now that NO glitch
   skin ships a render (2026-08-11 owner order, fleet-wide). Seven bands, engine
   order, each the server's documented fold of that slot. There is no <img> on
   this tile any more and nothing here requests one.

   It sits on the tile's own accent wash rather than the old white --art-plate:
   the white plate existed because the retired renders were dinos matted on
   white, and a colour reading has no matte. A row that arrives with no bands at
   all still gets the plate and the wash, which is exactly the tile this page
   drew before there was ever any art. */
.glitch-prox {
  display: flex; width: 100%; aspect-ratio: 3 / 2; overflow: hidden;
  margin: 0 0 10px; border-radius: var(--r-xs);
  background:
    linear-gradient(180deg,
      color-mix(in srgb, var(--glitch-accent, var(--accent)) 26%, transparent),
      var(--surface-3));
}
.glitch-prox i {
  flex: 1 1 0; min-width: 0; display: block;
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / .35);
}
.glitch-cmd { font-size: 12px; color: var(--fg-mute); }
.glitch-cmd code {
  font-family: var(--font-mono); font-size: 11px; color: var(--accent-hi);
  background: var(--surface-3); padding: 2px 5px; border-radius: var(--r-xs);
}
/* ---------- the till, and the skins this account owns ----------
   The buy control sits in the tile's own flow, under the price, so a tile with
   a control and a tile without one are the same height and the grid does not
   step. `.is-armed` is the CONFIRM state: it must not look like the resting
   Buy, because the next press spends points. */
.glitch-buy { display: flex; gap: 8px; }
.glitch-buy .btn { flex: 1; justify-content: center; }
.glitch-buy .btn.is-armed {
  border-color: var(--accent); color: var(--accent-hi);
  background: var(--surface-3);
}
/* A tile whose skin is already owned reads as SETTLED - no price, no pull. */
.glitch-tile.is-owned { border-color: var(--edge); }
/* The receipt / refusal line. Empty by default: it takes no room until the
   server has actually said something. */
.glitch-note { font-size: 12px; margin: 8px 0 0; }
.glitch-note:empty { display: none; }
/* A BOUGHT skin in the library. Same row shape as a saved design so the two
   read as one library, with the name block inert - a purchase's colours are
   never loaded into the editor, so its name is not a button. */
.skin-row .skin-name { cursor: default; }
.skin-row .skin-name:hover { border-color: var(--border); }
.skin-row .skin-name span { color: var(--accent-hi); }

.glitch-shimmer {
  position: absolute; inset: 0 0 auto; height: 3px;
  background: var(--grad-shimmer);
  background-size: 240% 100%;
  animation: glitch-slide 3.2s linear infinite;
}
@keyframes glitch-slide {
  from { background-position: 0% 0; } to { background-position: 240% 0; }
}
@media (prefers-reduced-motion: reduce) { .glitch-shimmer { animation: none; } }

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .studio { grid-template-columns: 208px minmax(0, 1fr); }
  .channels { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  .studio { grid-template-columns: 1fr; }
  .deck-list { max-height: 250px; }
  .stage-wrap { height: 380px; }
  .stage-foot-var { margin-left: 0; }
}
