/* =========================================================================
   Isla Noctura — Skin Studio. The advanced-studio composition in the
   moonlit-night language: deck | living stage | channels.
   ========================================================================= */

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

/* ---------- deck ---------- */
.deck h3 { font-size: 16px; margin-bottom: 10px; }
.deck-search input {
  width: 100%; padding: 8px 11px;
  background: var(--surface-3); border: 1px solid var(--line);
  border-radius: var(--r-s); color: var(--moon);
  font: 500 13.5px/1.3 var(--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(--silver); cursor: pointer;
  text-align: left;
}
.deck-row b { font: 600 13.5px/1.2 var(--ui); color: var(--silver); }
.deck-row span {
  font: 600 10px/1 var(--mono); letter-spacing: .13em; text-transform: uppercase;
  color: var(--silver-mut);
}
.deck-row:hover { background: var(--surface-2); }
.deck-row.on { background: var(--surface-3); border-color: var(--line-2); }
.deck-row.on b { color: var(--moon); }
.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; }

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

.stage-wrap {
  position: relative; height: 480px;
  border-radius: var(--r-s); overflow: hidden;
  background:
    radial-gradient(75% 60% at 50% 82%, rgba(58,84,108,.3), transparent 70%),
    radial-gradient(50% 34% at 76% 6%, rgba(150,175,196,.14), transparent 65%),
    linear-gradient(180deg, var(--bg-2) 0%, var(--ink) 88%);
  border: 1px solid var(--line);
}
#stage-canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
.stage-note {
  position: absolute; left: 0; right: 0; bottom: 12px;
  text-align: center; margin: 0;
  font: 500 12.5px/1.4 var(--ui); color: var(--silver-dim);
}
.stage-note.is-error { color: var(--warn); }

.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: rgba(5, 9, 17, .78);
  -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(--silver-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(--mono); letter-spacing: .15em; text-transform: uppercase;
  color: var(--silver-mut);
}
.stage-foot-var { margin-left: auto; }
.chips { display: inline-flex; gap: 5px; }
#variation { width: 130px; accent-color: var(--accent); }
#variation-out {
  font: 600 12px/1 var(--mono); color: var(--silver-dim); min-width: 34px;
}

/* ---------- channels ---------- */
.channels { display: flex; flex-direction: column; gap: 14px; }
.channels .stage-head h3 { font-size: 16px; }
.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(--line); border-radius: var(--r-s);
  background: var(--surface-2);
}
.channel label { font: 600 13px/1 var(--ui); color: var(--silver); }
.channel-io { display: flex; align-items: center; gap: 7px; }
.channel input[type="color"] {
  width: 34px; height: 26px; padding: 0; border: 1px solid var(--line-2);
  border-radius: 5px; 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(--line);
  border-radius: 5px; color: var(--silver);
  font: 500 12px/1 var(--mono); text-transform: lowercase;
}

.panel-label {
  font: 600 10.5px/1 var(--mono); letter-spacing: .15em; text-transform: uppercase;
  color: var(--silver-mut); margin: 0 0 8px;
}
.presets { display: flex; flex-wrap: wrap; gap: 6px; }
.preset {
  padding: 7px 11px; border-radius: 5px;
  border: 1px solid var(--line); background: var(--surface-2);
  color: var(--silver); font: 600 12.5px/1 var(--ui); cursor: pointer;
}
.preset:hover { color: var(--moon); border-color: var(--stone); }

.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(--line);
  border-radius: var(--r-s); color: var(--moon);
  font: 500 13.5px/1.3 var(--ui);
}
.save-note { flex-basis: 100%; font-size: 12.5px; margin: 0; }

.designs { border-top: 1px solid var(--line); 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(--line); border-radius: var(--r-s);
  background: var(--surface-2); color: var(--silver); cursor: pointer; text-align: left;
}
.design-load b { font: 600 13px/1.2 var(--ui); color: var(--silver); }
.design-load span {
  font: 600 10px/1 var(--mono); letter-spacing: .12em; text-transform: uppercase;
  color: var(--silver-mut);
}
.design-load:hover { border-color: var(--stone); }
.design-load:hover b { color: var(--moon); }
.design-del {
  width: 30px; height: 34px; flex: none;
  border: 1px solid var(--line); border-radius: var(--r-s);
  background: transparent; color: var(--silver-mut);
  font: 500 16px/1 var(--ui); cursor: pointer;
}
.design-del:hover { color: var(--down); border-color: rgba(224,138,138,.4); }
.designs-empty { font-size: 12.5px; }

/* ---------- panel tabs (colours | glitch) ---------- */
.panel-tabs {
  display: flex; gap: 3px; padding: 4px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r-s);
}
.panel-tabs [role="tab"] {
  flex: 1; padding: 9px 10px; border: 0; border-radius: 5px;
  background: transparent; color: var(--silver-dim);
  font: 600 13px/1 var(--ui); cursor: pointer;
  transition: background .15s, color .15s, box-shadow .15s;
}
.panel-tabs [role="tab"]:hover { color: var(--moon); }
.panel-tabs [role="tab"][aria-selected="true"] {
  background: var(--surface-3); color: var(--moon);
  box-shadow: inset 0 0 0 1px var(--line-2);
}
#ptab-glitch[aria-selected="true"] {
  box-shadow: inset 0 0 0 1px rgba(168,87,214,.45);
}
.ppane { display: flex; flex-direction: column; gap: 14px; }
.ppane[hidden] { display: none; }

/* ---------- glitch pane ---------- */
.glitch-lede { margin: 0; font-size: 13px; line-height: 1.55; color: var(--silver-dim); }

.glitch-gallery {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}
.glook {
  position: relative; overflow: hidden; text-align: left;
  padding: 0; border: 1px solid var(--line); border-radius: var(--r-s);
  background: var(--surface-2); cursor: pointer;
  transition: border-color .18s, transform .18s, box-shadow .18s;
}
.glook:hover { transform: translateY(-2px); border-color: var(--line-2); box-shadow: 0 10px 24px -14px rgba(0,0,0,.85); }
.glook.on {
  border-color: var(--glook-accent, var(--accent));
  box-shadow: 0 0 0 1px var(--glook-accent, var(--accent)),
              0 12px 26px -14px var(--glook-accent, var(--accent));
}
.glook-frame {
  display: block; position: relative; aspect-ratio: 5 / 4; overflow: hidden;
  background:
    radial-gradient(70% 62% at 50% 66%, var(--glook-glow, rgba(159,182,201,.16)), transparent 72%),
    linear-gradient(180deg, var(--bg-2), var(--ink));
}
.glook-frame img {
  position: absolute; inset: 4%; width: 92%; height: 92%;
  object-fit: contain;
  filter: drop-shadow(0 8px 12px rgba(0,0,0,.6)) saturate(1.08) contrast(1.05);
  transition: transform .3s cubic-bezier(.2,.9,.25,1);
}
.glook:hover .glook-frame img { transform: scale(1.05); }
.glook-body { display: block; padding: 8px 10px 9px; }
.glook-body b {
  display: block; font: 600 12.5px/1.25 var(--ui); color: var(--silver);
}
.glook:hover .glook-body b, .glook.on .glook-body b { color: var(--moon); }
.glook-body span {
  display: flex; align-items: center; gap: 6px; margin-top: 4px;
  font: 600 9.5px/1 var(--mono); letter-spacing: .13em; text-transform: uppercase;
  color: var(--silver-mut);
}
.glook-body span i {
  width: 8px; height: 8px; border-radius: 2px; flex: none;
  background: var(--glook-accent, var(--accent));
  box-shadow: 0 0 7px var(--glook-accent, var(--accent));
}

/* bot-sold glitch items — no capture exists, so no picture is faked */
.glitch-shop { display: flex; flex-direction: column; gap: 7px; }
.gshop-row {
  position: relative; overflow: hidden;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border: 1px solid var(--line-2);
  border-radius: var(--r-s); background: var(--surface-2);
}
.gshop-row b { font: 600 13px/1.2 var(--ui); color: var(--moon); margin-right: auto; }
.gshop-row .gshop-price { font: 600 12.5px/1 var(--ui); color: var(--moon); white-space: nowrap; }
.gshop-row .gshop-cmd { font-size: 11px; color: var(--silver-mut); white-space: nowrap; }
.gshop-row .gshop-cmd code {
  font-family: var(--mono); font-size: 10.5px; color: var(--accent-hi);
  background: var(--surface-3); padding: 2px 5px; border-radius: 4px;
}
.glitch-shimmer {
  position: absolute; inset: 0 0 auto; height: 2px;
  background: linear-gradient(90deg,
    rgba(159,182,201,0), rgba(196,214,228,.85), rgba(111,215,154,.6),
    rgba(227,183,120,.6), rgba(159,182,201,0));
  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 builder ---------- */
.glitch-builder {
  display: flex; flex-direction: column; gap: 10px;
  border-top: 1px solid var(--line); padding-top: 13px;
}
.gb-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.gb-seg {
  display: inline-flex; gap: 3px; padding: 3px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 6px;
}
.gb-seg button {
  padding: 6px 11px; border: 0; border-radius: 4px;
  background: transparent; color: var(--silver-dim);
  font: 600 11px/1 var(--ui); letter-spacing: .04em; cursor: pointer;
  transition: background .15s, color .15s;
}
.gb-seg button:hover { color: var(--moon); }
.gb-seg button.on { background: var(--surface-3); color: var(--moon); box-shadow: inset 0 0 0 1px var(--line-2); }
.gb-seg-row { justify-content: space-between; }

.gb-help {
  font-size: 11.5px; line-height: 1.55; color: var(--silver-mut);
  padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-s);
  background: rgba(4,7,14,.5);
}

.gb-grid { display: flex; flex-direction: column; gap: 6px; }
.gb-slot {
  display: grid; align-items: center; gap: 5px;
  grid-template-columns: 66px repeat(4, minmax(0, 1fr));
  padding: 6px 8px; border: 1px solid var(--line);
  border-radius: var(--r-s); background: var(--surface-2);
}
.gb-slot .gb-name {
  font: 600 11px/1.2 var(--ui); color: var(--silver);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.gb-slot input[type="number"] {
  width: 100%; min-width: 0; padding: 5px 5px;
  background: var(--surface-3); border: 1px solid var(--line);
  border-radius: 4px; color: var(--silver);
  font: 500 10.5px/1 var(--mono); text-align: right;
  -moz-appearance: textfield; appearance: textfield;
}
.gb-slot input[type="number"]::-webkit-outer-spin-button,
.gb-slot input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.gb-slot input[type="number"]:focus { border-color: var(--stone); }
.gb-slot input[type="color"] {
  grid-column: 3 / -1; width: 100%; height: 26px; padding: 0;
  border: 1px solid var(--line-2); border-radius: 4px;
  background: var(--surface-3); cursor: pointer; display: none;
}
.gb-dot {
  width: 17px; height: 17px; border-radius: 50%; border: 1px solid var(--line-2);
  background: var(--surface-3); color: var(--silver-mut);
  font: 700 8px/1 var(--mono); cursor: pointer; display: none;
  align-items: center; justify-content: center; padding: 0;
}
.gb-dot.g { background: rgba(168,87,214,.2); color: #d0a3e8; border-color: rgba(168,87,214,.5); }

/* hybrid mode: dot appears; colour rows swap numbers for a picker */
.gb-grid[data-mode="hybrid"] .gb-slot { grid-template-columns: 58px 17px repeat(4, minmax(0, 1fr)); }
.gb-grid[data-mode="hybrid"] .gb-dot { display: inline-flex; }
.gb-grid[data-mode="hybrid"] .gb-slot.colour input[type="number"] { display: none; }
.gb-grid[data-mode="hybrid"] .gb-slot.colour input[type="color"] { display: block; }

.gb-mag-row { justify-content: space-between; }
.gb-chips { display: inline-flex; flex-wrap: wrap; gap: 3px; }
.gb-chips button {
  padding: 5px 8px; border: 1px solid var(--line); border-radius: 4px;
  background: var(--surface-2); color: var(--silver-mut);
  font: 600 10px/1 var(--mono); letter-spacing: .06em; cursor: pointer;
  transition: color .15s, border-color .15s;
}
.gb-chips button:hover { color: var(--moon); border-color: var(--stone); }
.gb-chips button.on { color: var(--moon); border-color: var(--stone-lit); background: var(--surface-3); }

.gb-actions { display: flex; flex-wrap: wrap; gap: 6px; }

.gb-import { display: flex; flex-direction: column; gap: 7px; }
.gb-import textarea {
  width: 100%; padding: 8px 10px; resize: vertical; min-height: 64px;
  background: var(--surface-3); border: 1px solid var(--line);
  border-radius: var(--r-s); color: var(--silver);
  font: 500 11px/1.5 var(--mono);
}
.gb-import textarea:focus { border-color: var(--stone); }
.gb-import-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.gb-import-note { font-size: 11px; color: var(--silver-mut); }
.gb-import-note.err { color: var(--down); }
.gb-import-note.ok { color: var(--live); }

/* glitch rows in the library */
.design-load .glitch-mark {
  font: 700 8.5px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase;
  color: #d0a3e8; border: 1px solid rgba(168,87,214,.5);
  padding: 3px 5px; border-radius: 4px; flex: none;
}

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