/* =========================================================================
   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 set padding: 16px and its (0,2,0) beat the house's
   (0,1,0) clamp, so the studio's three panels were the only cards on the
   site at 16px. The padding belongs to terminal.css - see 6b, THE SURFACE
   REGISTER, and test_house_look.py::NoPageSheetRestylesASharedPrimitive. */

/* ---------- deck ---------- */
.deck h3 { 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: var(--tm-h-panel); 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;
  background: var(--scrim-modal); border: 1px solid var(--tm-hair); /* house look owns this - see terminal.css 6b THE SURFACE REGISTER */
  -webkit-backdrop-filter: blur(12px) saturate(120%);
  backdrop-filter: blur(12px) saturate(120%);
}
.stage-growth .gr-label {
  font:600 var(--tm-h-micro)/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: var(--r-xs);
  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 takes the GATE voice - terminal.css section 11 */
.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(--tm-h-panel); }
/* .btn-sm is the house look's one compact step - terminal.css section 7 */

.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: var(--r-xs); }
.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;
}

/* ---------- the tappable palette (2026-08-14) ----------
   One strip, aimed at the ACTIVE channel row; the species' own default wears
   the natural ring. Pressing a row anywhere aims the strip. */
.channel { cursor: pointer; }
.channel.cp-on { border-color: var(--edge); background: var(--surface-3); }
.channel-palette { margin-top: 8px; }
.channel-palette .cp-for {
  display: block; margin: 0 0 7px;
  font: 600 var(--tm-h-micro, 11px)/1 var(--font-mono);
  letter-spacing: .15em; text-transform: uppercase; color: var(--fg-mute);
}
.cp-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(26px, 1fr));
  gap: 6px;
}
.cp-swatch {
  position: relative; aspect-ratio: 1; min-height: 24px; padding: 0;
  cursor: pointer; border: 1px solid var(--border-2);
  border-radius: var(--r-xs); background: var(--cp);
}
.cp-swatch:hover { border-color: var(--edge); }
.cp-swatch.on { outline: 2px solid var(--edge); outline-offset: 1px; }
.cp-swatch.cp-natural::after {
  content: ""; position: absolute; inset: 3px;
  border: 1px solid var(--surface-3); border-radius: var(--r-xs);
}

.studio-panel-label {
  font:600 var(--tm-h-micro)/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 var(--tm-h-panel)/1.3 var(--font-ui);
}
.save-note { flex-basis: 100%; font-size: 12.5px; margin: 0; }

/* SKIN CODES. Same row grammar as the save row above it, with its own rule
   rather than a shared class: the code field is MONOSPACE on purpose - a
   player reading a code back to a friend, or checking a paste landed whole,
   needs the characters to line up and 2/Z/5/S to be told apart. The box wraps
   to its own line under about 420px rather than squeezing the two buttons to
   nothing. */
.code-row {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  margin-top: 10px;
}
#code-input {
  flex: 1 1 190px; min-width: 0; padding: 9px 11px;
  background: var(--surface-3); border: 1px solid var(--border);
  border-radius: var(--r-s); color: var(--fg);
  font: 500 12.5px/1.3 var(--font-mono); letter-spacing: .02em;
}
/* The paste's OWN name box (2026-08-14). Narrower than the code box and it
   gives way first: on a phone the code is what must stay readable, and a name
   is one short word. */
#code-name {
  flex: 0 1 150px; min-width: 0; padding: 9px 11px;
  background: var(--surface-3); border: 1px solid var(--border);
  border-radius: var(--r-s); color: var(--fg);
  font: 500 12.5px/1.3 var(--font-sans, inherit);
}
#code-note { flex-basis: 100%; font-size: 12.5px; margin: 0; }

/* The layout a bought or pasted skin is WORN with. Sits between the row's name
   and its Apply, and never grows: the name is what the player is reading. */
.skin-pattern {
  flex: 0 0 auto; max-width: 44%; padding: 7px 8px;
  background: var(--surface-3); border: 1px solid var(--border);
  border-radius: var(--r-s); color: var(--fg);
  font: 500 12px/1.2 var(--font-sans, inherit);
}

/* TRY IT FIRST - a ghost button beside Create, because it buys nothing. */
.gc-try { white-space: nowrap; }

.designs { border-top: 1px solid var(--border); padding-top: 12px; }
/* THE LIBRARY ROW MAY WRAP (2026-08-15, Frontier's screenshot: "PPLY"/"XPOR").
   Five children in a 316px rail cannot share one line: without a wrap the
   buttons were the only shrinkable items and the deficit clipped their text
   off the left edge. Rules, each one half of the cure:
   - the row wraps, so a button keeps its full label on a second line;
   - a button NEVER shrinks (flex:0 0 auto + nowrap) - a control that loses
     letters is worse than one that moves;
   - the name pill claims a whole line when the rail is tight (min-width
     makes the wrap happen at the pill, not mid-button);
   - the pattern select stays capped so it can never squeeze the actions;
   - the terminal theme's chevron ::before is off INSIDE rows - at this size
     it spent ~14px per button saying nothing. */
.design-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 5px; }
.design-row .btn, .design-row .design-del {
  flex: 0 0 auto; white-space: nowrap;
}
.design-row .btn::before { content: none; }
.design-row .skin-pattern { max-width: 9em; }
.design-load {
  flex: 1 1 auto; min-width: 9em; 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 { overflow-wrap: anywhere; }
.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(--tm-hair);
  /* house look owns this - see terminal.css 6b THE SURFACE REGISTER */
}
.glitch-tile h3 { font-size: var(--tm-h-sec); 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;
  /* a hairline ring over arbitrary band colours - drawn from the owner's own
     ground rather than a colour literal, so it follows the palette */
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--bg) 35%, transparent);
}
.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; } }

/* ---------- glitch custom: THE COMPOSER (2026-08-14, typed numbers) ----------
   Owner order: "for glitch custom it should offer numbers". The pane is the
   fleet's proven IsleSkinWeb builder shape: one lab row (pattern chips, the
   texture number, magnitude chips, randomize/reset) over seven slot rows of
   four number fields. Nothing here previews the animal — the strip on the
   receipt is a colour reading, and only the game's shader draws the glitch.
   `.gc-chip` and `.gc-num` are dressed by terminal.css 6b (THE SURFACE
   REGISTER); this sheet only lays them out. */
.gc-lab {
  display: flex; flex-wrap: wrap; gap: 12px 18px; align-items: flex-end;
  margin-top: 10px;
}
.gc-lab-field { display: grid; gap: 5px; }
.gc-lab-acts { display: flex; gap: 6px; }
.gc-lab-label { color: var(--fg-mute); font-size: var(--tm-h-micro); }
.gc-chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.gc-chip {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 34px; padding: 6px 8px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--tm-hair);
  color: var(--fg-dim); font-size: 11px;
}
.gc-chip:hover { color: var(--fg); border-color: var(--edge); }
.gc-chip.is-on { border-color: var(--accent); color: var(--accent-hi); }
.gc-slots { display: grid; gap: 8px; margin-top: 14px; }
.gc-slot-row {
  display: grid; grid-template-columns: 110px minmax(0, 1fr);
  align-items: center; gap: 10px;
}
.gc-slot-name { color: var(--fg-mute); font-size: var(--tm-h-micro); }
.gc-chan-row { display: flex; flex-wrap: wrap; gap: 6px; }
/* A channel is a compact typed number. Same input grammar as #design-name —
   a hairline over the surface — sized to the ~7-character magnitudes the
   randomize chips write; the register owns radius/typeface. */
.gc-num {
  width: 9ch; padding: 7px 8px;
  background: var(--surface); border: 1px solid var(--tm-hair);
  color: var(--fg); font-size: 12px;
}
.gc-num:focus { border-color: var(--accent); outline: none; }
/* The column header over the four channel boxes. Each cell is exactly one
   input wide so R/G/B/A sit over their own column, and it is quiet enough to
   read as a header rather than a fifth control. */
.gc-chan-k {
  width: 9ch; text-align: center;
  color: var(--fg-mute); font: 600 10.5px/1 var(--font-mono);
  letter-spacing: var(--tm-track, .08em); text-transform: uppercase;
}
.gc-chan-head { margin-bottom: 2px; }
/* The mirror pre-check's mark: the offending box, in the danger ink the
   server's own refusal sentence names. */
.gc-num.is-bad { border-color: var(--bad); }
.gc-save-row { margin-top: 14px; }
.gc-price-note { flex-basis: 100%; }
@media (max-width: 1080px) {
  .gc-slot-row { grid-template-columns: 1fr; gap: 4px; }
}

/* ---------- 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; }
}
