/* osu! skin studio. Uses the shared shell tokens (shell.css) with hue 255. */
:root {
  --spring: cubic-bezier(0.34, 1.4, 0.64, 1);
  --pane-w: 300px;
  --insp-w: 384px;
  --gap: 10px;
  --pink: hsl(333 100% 66%);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg6); min-height: 100%; }
body { overflow-x: hidden; -webkit-font-smoothing: antialiased; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
svg .fill { fill: currentColor; stroke: none; }
button { font: inherit; color: inherit; }
input, select { font: inherit; color: inherit; }
code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 0.92em; background: hsl(var(--hue) 20% 50% / 0.14); padding: 1px 6px; border-radius: 5px; }
[hidden] { display: none !important; }

/* ------------------------------------------------------------ toolbar buttons */
.tb-btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 34px; padding: 0 14px; border-radius: 9px;
  border: 1px solid transparent; background: transparent; color: var(--content2);
  font-weight: 600; cursor: pointer;
  transition: background 160ms var(--ease), color 160ms var(--ease), transform 220ms var(--spring), opacity 160ms;
}
.tb-btn:hover:not(:disabled) { background: hsl(var(--hue) 20% 50% / 0.12); color: var(--content1); }
.tb-btn:active:not(:disabled) { transform: scale(0.95); }
.tb-btn:disabled { opacity: 0.35; cursor: default; }
.tb-btn.icon { width: 34px; padding: 0; justify-content: center; }
.tb-btn.primary { background: var(--highlight); color: hsl(var(--hue) 40% 10%); margin-left: 6px; }
.tb-btn.primary:hover:not(:disabled) { background: hsl(var(--hue) 100% 76%); color: hsl(var(--hue) 40% 8%); }
.studio[data-state="empty"] ~ * .tb-btn.icon,
body:has(.studio[data-state="empty"]) #undoBtn,
body:has(.studio[data-state="empty"]) #redoBtn,
body:has(.studio[data-state="empty"]) #exportBtn { display: none; }

/* ------------------------------------------------------------ generic controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  height: 42px; padding: 0 20px; border-radius: 11px;
  border: 1px solid var(--line); background: var(--bg3); color: var(--content1);
  font-weight: 600; font-size: 15px; cursor: pointer;
  transition: background 160ms var(--ease), transform 240ms var(--spring), border-color 160ms;
}
.btn:hover { background: var(--bg2); border-color: var(--dark1); }
.btn:active { transform: scale(0.96); }
.btn.primary { background: var(--highlight); border-color: transparent; color: hsl(var(--hue) 40% 10%); }
.btn.primary:hover { background: hsl(var(--hue) 100% 77%); }
.btn.busy { opacity: 0.6; pointer-events: none; }
.mini-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px;
  border-radius: 8px; border: 0; background: hsl(var(--hue) 20% 50% / 0.12); color: var(--content2);
  font-size: 12.5px; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: background 140ms var(--ease), color 140ms, transform 200ms var(--spring);
}
.mini-btn svg { width: 14px; height: 14px; }
.mini-btn:hover { background: hsl(var(--hue) 20% 50% / 0.22); color: var(--content1); }
.mini-btn:active { transform: scale(0.94); }
.mini-btn.danger:hover, .mini-btn.armed { background: hsl(355 80% 50% / 0.2); color: #ff8a92; }
.mini-btn.danger span:empty { display: none; }
.icon-btn { display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 9px; background: transparent; color: var(--content2); cursor: pointer; }
.icon-btn:hover { background: hsl(var(--hue) 20% 50% / 0.14); color: var(--content1); }
.link-btn { display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; color: var(--light3); font-size: 12.5px; font-weight: 600; padding: 4px 0; cursor: pointer; }
.link-btn:hover { color: var(--content1); }
.link-btn svg { width: 14px; height: 14px; }
.round {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%;
  border: 0; background: hsl(var(--hue) 20% 50% / 0.14); color: var(--content1); cursor: pointer;
  transition: background 140ms, transform 240ms var(--spring);
}
.round:hover:not(:disabled) { background: hsl(var(--hue) 20% 50% / 0.26); }
.round:active:not(:disabled) { transform: scale(0.9); }
.round:disabled { opacity: 0.3; cursor: default; }
.round.big { width: 44px; height: 44px; background: var(--highlight); color: hsl(var(--hue) 40% 10%); }
.round.big:hover { background: hsl(var(--hue) 100% 77%); }
.round.small { width: 30px; height: 30px; }
.round.small svg { width: 14px; height: 14px; }
.flash { animation: flash 420ms var(--ease); }
@keyframes flash { 0% { box-shadow: 0 0 0 0 hsl(var(--hue) 100% 70% / 0.7); } 100% { box-shadow: 0 0 0 10px hsl(var(--hue) 100% 70% / 0); } }

.badge { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 10px; font-size: 11px; font-weight: 700; background: hsl(var(--hue) 20% 8% / 0.75); color: var(--content1); backdrop-filter: blur(6px); letter-spacing: 0.01em; }
.badge.base { background: var(--highlight); color: hsl(var(--hue) 40% 10%); }
.badge.small { height: 17px; padding: 0 6px; font-size: 10.5px; background: hsl(var(--hue) 20% 50% / 0.16); color: var(--content2); }
.badge.small.hd { color: var(--highlight); }
.badge.small.swap { background: hsl(333 100% 66% / 0.18); color: hsl(333 100% 78%); }

.seg { display: flex; padding: 3px; gap: 3px; border-radius: 11px; background: var(--bg6); }
.seg button {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; border: 0; border-radius: 8px; background: transparent; color: var(--content2);
  font-weight: 600; cursor: pointer; transition: background 200ms var(--ease), color 160ms;
}
.seg button:hover { color: var(--content1); }
.seg button[aria-selected="true"], .seg button[aria-checked="true"] { background: var(--bg2); color: var(--content1); box-shadow: 0 1px 0 hsl(var(--hue) 30% 60% / 0.12) inset, 0 2px 8px hsl(var(--hue) 30% 2% / 0.4); }
.seg.small { padding: 2px; }
.seg.small button { height: 26px; font-size: 12px; padding: 0 10px; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.seg .count { font-size: 11px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: hsl(var(--hue) 20% 50% / 0.18); display: inline-grid; place-items: center; }
.seg .count:empty { display: none; }
.seg.wide button { height: 40px; font-size: 15px; }

/* ------------------------------------------------------------ layout */
.studio { min-height: calc(100dvh - var(--toolbar-h)); }
.studio[data-state="loading"] > * { display: none; }
.studio[data-state="empty"] > :not(.empty) { display: none; }
.studio[data-state="ready"] > .empty { display: none; }
.studio[data-state="ready"] {
  display: grid;
  grid-template-columns: var(--pane-w) minmax(0, 1fr) var(--insp-w);
  grid-template-areas: "rail center insp";
  gap: var(--gap);
  padding: var(--gap);
  height: calc(100dvh - var(--toolbar-h));
}
.panel {
  background: var(--bg5);
  border: 1px solid hsl(var(--hue) 14% 15%);
  border-radius: var(--radius-lg);
  min-height: 0;
}
.rail { grid-area: rail; display: flex; flex-direction: column; overflow: hidden; }
.rail > .seg { margin: 10px 10px 4px; flex: none; }
.rail-body { flex: 1; overflow-y: auto; padding: 6px 10px 14px; scrollbar-width: thin; scrollbar-color: var(--dark3) transparent; }
.center { grid-area: center; display: flex; flex-direction: column; gap: var(--gap); min-width: 0; min-height: 0; position: relative; }
.inspector { grid-area: insp; overflow-y: auto; overflow-x: hidden; scrollbar-width: thin; scrollbar-color: var(--dark3) transparent; }
.mobile-tabs { display: none; }

/* ------------------------------------------------------------ empty state */
.empty { display: grid; place-items: center; padding: 28px 16px 40px; min-height: calc(100dvh - var(--toolbar-h)); }
.empty-zone {
  position: relative; width: min(760px, 100%); padding: 56px 32px 40px; text-align: center;
  border-radius: 24px; outline: none;
  background:
    radial-gradient(120% 90% at 50% 0%, hsl(var(--hue) 40% 22% / 0.55), transparent 60%),
    var(--bg5);
  border: 2px dashed hsl(var(--hue) 30% 34%);
  transition: border-color 220ms var(--ease), transform 380ms var(--spring), background 220ms;
}
.empty-zone:focus-visible { border-color: var(--highlight); }
body.dragging .empty-zone { border-color: var(--highlight); transform: scale(1.015); }
.empty h1 { margin: 26px 0 8px; font-size: clamp(24px, 4.2vw, 34px); font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; }
.empty p { margin: 0; color: var(--content2); font-size: 15.5px; }
.empty-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; margin: 26px 0 0; }
.empty-hint { margin-top: 26px !important; font-size: 13px !important; color: var(--light3) !important; }
.empty-progress { margin: 24px auto 0; width: min(380px, 100%); display: grid; gap: 8px; font-size: 13px; color: var(--content2); }
.bar { height: 6px; border-radius: 3px; background: var(--bg2); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--highlight); border-radius: 3px; transition: width 300ms var(--ease); }
.empty-art { position: relative; width: 220px; height: 150px; margin: 0 auto; }
.ea-circle {
  position: absolute; left: 50%; top: 50%; width: 92px; height: 92px; margin: -46px 0 0 -46px; border-radius: 50%;
  background: radial-gradient(circle at 50% 38%, hsl(333 100% 76%), hsl(333 90% 56%));
  box-shadow: 0 0 0 6px #fff inset, 0 10px 40px hsl(333 100% 50% / 0.35);
  display: grid; place-items: center;
}
.ea-circle b { font-size: 40px; font-weight: 800; color: #fff; text-shadow: 0 2px 6px rgba(0, 0, 0, 0.35); }
.ea-approach {
  position: absolute; left: 50%; top: 50%; width: 92px; height: 92px; margin: -46px 0 0 -46px; border-radius: 50%;
  border: 3px solid hsl(333 100% 72%);
  animation: approach 1.8s cubic-bezier(0.4, 0, 1, 1) infinite;
}
@keyframes approach { 0% { transform: scale(2.3); opacity: 0; } 25% { opacity: 1; } 100% { transform: scale(1); opacity: 1; } }
.ea-osk {
  position: absolute; display: grid; place-items: end center; padding-bottom: 7px; width: 44px; height: 54px; border-radius: 8px;
  background: var(--bg2); border: 1px solid var(--line); font-style: normal; font-size: 11px; font-weight: 700; color: var(--content2);
  box-shadow: 0 8px 20px hsl(var(--hue) 30% 2% / 0.5);
  animation: bob 4s ease-in-out infinite;
}
.ea-osk::before { content: ""; position: absolute; top: 10px; left: 50%; width: 18px; height: 18px; margin-left: -9px; border-radius: 50%; border: 3px solid var(--highlight); }
.ea-osk.o1 { left: 2px; top: 26px; transform: rotate(-12deg); }
.ea-osk.o2 { right: 4px; top: 12px; transform: rotate(10deg); animation-delay: -1.3s; }
.ea-osk.o3 { right: 26px; bottom: -6px; transform: rotate(-4deg); animation-delay: -2.6s; }
.ea-osk.o3::before { border-color: var(--pink); }
@keyframes bob { 50% { translate: 0 -7px; } }

/* ------------------------------------------------------------ drop overlay */
.drop-overlay {
  position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; pointer-events: none;
  background: hsl(var(--hue) 30% 6% / 0.72); backdrop-filter: blur(4px);
  opacity: 0; transition: opacity 180ms var(--ease);
}
.drop-overlay > div {
  display: grid; justify-items: center; gap: 8px; padding: 40px 56px; border-radius: 22px;
  border: 2px dashed var(--highlight); background: hsl(var(--hue) 20% 12% / 0.9);
  transform: scale(0.94); transition: transform 360ms var(--spring);
}
.drop-overlay svg { width: 40px; height: 40px; color: var(--highlight); }
.drop-overlay b { font-size: 22px; }
.drop-overlay small { color: var(--content2); }
.drop-overlay.show { opacity: 1; }
.drop-overlay.show > div { transform: scale(1); }
body:has(.studio[data-state="empty"]) .drop-overlay { background: transparent; backdrop-filter: none; }
body:has(.studio[data-state="empty"]) .drop-overlay > div { display: none; }

/* ------------------------------------------------------------ parts rail */
.parts { display: grid; gap: 2px; }
.rail-h { margin: 14px 6px 6px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--light3); }
.part {
  position: relative; display: flex; align-items: center; gap: 11px; width: 100%; padding: 6px 8px; text-align: left;
  border: 0; border-radius: 10px; background: transparent; cursor: pointer;
  transition: background 160ms var(--ease), transform 260ms var(--spring);
}
.part:hover { background: hsl(var(--hue) 20% 50% / 0.08); }
.part:active { transform: scale(0.98); }
.part[aria-current] { background: var(--bg3); box-shadow: inset 3px 0 0 var(--highlight); }
.pt-thumb { flex: none; width: 64px; height: 40px; border-radius: 7px; overflow: hidden; background: var(--bg6); display: grid; place-items: center; color: var(--light3); }
.pt-thumb canvas { width: 100%; height: 100%; display: block; }
.icon-thumb { background: hsl(var(--hue) 30% 30% / 0.35); color: var(--highlight); }
.pt-text { min-width: 0; display: grid; gap: 1px; flex: 1; }
.pt-text b { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pt-text small { font-size: 11.5px; color: var(--light3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.part-skin { margin-top: 2px; }
.part-skin .pt-text b { font-size: 14.5px; }
.pt-dot { width: 7px; height: 7px; border-radius: 50%; flex: none; background: transparent; transition: background 200ms, transform 300ms var(--spring); transform: scale(0.4); }
.pt-dot[data-on="taken"] { background: var(--highlight); transform: scale(1); }
.pt-dot[data-on="edited"] { background: var(--pink); transform: scale(1); }

/* ------------------------------------------------------------ library */
.lib-head { padding: 6px 4px 10px; }
.lib-meta { margin: 0; font-size: 12px; color: var(--light3); line-height: 1.4; }
.lib-grid { display: grid; gap: 8px; }
.skin-card {
  border-radius: 12px; overflow: hidden; background: var(--bg3); border: 1px solid transparent;
  transition: transform 300ms var(--spring), border-color 160ms, background 160ms;
  animation: rise 420ms var(--spring) both;
}
.skin-card:hover { background: var(--bg2); transform: translateY(-2px); }
.skin-card.is-base { border-color: hsl(var(--hue) 60% 60% / 0.6); }
.skin-card { display: grid; grid-template-columns: 112px minmax(0, 1fr); }
.sc-art { position: relative; width: 112px; min-height: 63px; height: 100%; background: var(--bg6); overflow: hidden; }
.sc-art img { position: absolute; inset: 0; }
.sc-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sc-art .badge { position: absolute; top: 5px; left: 5px; height: 17px; padding: 0 6px; font-size: 10px; }
.sc-body { padding: 7px 8px 7px 10px; display: grid; gap: 4px; align-content: space-between; }
.sc-text { display: grid; gap: 2px; min-width: 0; }
.sc-text b { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sc-text small { font-size: 11.5px; color: var(--light3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sc-actions { display: flex; gap: 4px; justify-content: flex-end; }
.sc-actions .mini-btn { height: 24px; padding: 0 8px; font-size: 11.5px; }
.sc-actions .mini-btn:first-child:not(.danger) { margin-right: auto; }
.add-card {
  display: grid; justify-items: center; gap: 2px; padding: 14px 10px; border-radius: 12px; cursor: pointer;
  border: 1.5px dashed var(--line); background: transparent; color: var(--content2);
  transition: border-color 160ms, color 160ms, transform 260ms var(--spring);
}
.add-card:hover { border-color: var(--highlight); color: var(--content1); }
.add-card:active { transform: scale(0.97); }
.add-card span { font-weight: 600; }
.add-card small { color: var(--light3); font-size: 11.5px; }

/* ------------------------------------------------------------ stage */
.stage {
  position: relative; flex: none; align-self: center; aspect-ratio: 16 / 9;
  width: min(100%, calc((100dvh - var(--toolbar-h) - 3 * var(--gap) - 62px - 190px) * 16 / 9));
  border-radius: var(--radius-lg); overflow: hidden;
  background: #09080c; border: 1px solid hsl(var(--hue) 14% 15%);
}
.stage-live, .stage-still { position: absolute; inset: 0; }
.stage[data-mode="still"] .stage-live { display: none; }
.stage[data-mode="live"] .stage-still { display: none; }
.stage-live > * { width: 100%; height: 100%; }
.stage-canvas { width: 100%; height: 100%; display: block; animation: fade 260ms var(--ease); }
.stage-badge { position: absolute; right: 12px; bottom: 12px; padding: 4px 10px; border-radius: 8px; background: hsl(var(--hue) 20% 6% / 0.7); color: var(--content2); font-size: 11.5px; font-weight: 600; backdrop-filter: blur(6px); }
.stage-badge:empty { display: none; }
@keyframes fade { from { opacity: 0.4; } to { opacity: 1; } }

.transport {
  flex: none; display: flex; align-items: center; gap: 14px; padding: 8px 14px 8px 8px;
  background: var(--bg5); border: 1px solid hsl(var(--hue) 14% 15%); border-radius: var(--radius-lg);
}
.map-chip {
  display: flex; align-items: center; gap: 10px; min-width: 0; width: min(330px, 40%); padding: 5px 10px 5px 5px; text-align: left;
  border: 0; border-radius: 10px; background: var(--bg3); cursor: pointer; transition: background 160ms;
}
.map-chip:hover, .map-chip[aria-expanded="true"] { background: var(--bg2); }
.map-cover { flex: none; width: 54px; height: 38px; border-radius: 7px; overflow: hidden; background: linear-gradient(135deg, hsl(var(--hue) 30% 28%), hsl(333 40% 26%)); }
.map-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.map-text { min-width: 0; flex: 1; display: grid; }
.map-text b { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.map-text small { font-size: 11.5px; color: var(--light3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.map-chip .chev { color: var(--light3); width: 16px; height: 16px; }
.tp-controls { display: flex; align-items: center; gap: 8px; }
.studio:not([data-live="1"]) .tp-controls, .studio:not([data-live="1"]) .scrub { opacity: 0.4; }
.scrub input { flex: 1; }
.scrub { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; font-size: 12px; color: var(--content2); font-variant-numeric: tabular-nums; }
.vol { display: flex; align-items: center; gap: 8px; color: var(--content2); width: 130px; }
.vol input { flex: 1; }

/* range inputs */
input[type="range"] { -webkit-appearance: none; appearance: none; height: 22px; background: transparent; cursor: pointer; min-width: 0; --fill: 50%; }
input[type="range"]::-webkit-slider-runnable-track { height: 5px; border-radius: 3px; background: linear-gradient(90deg, var(--highlight) var(--fill), var(--bg1) var(--fill)); }
input[type="range"]::-moz-range-track { height: 5px; border-radius: 3px; background: var(--bg1); }
input[type="range"]::-moz-range-progress { height: 5px; border-radius: 3px; background: var(--highlight); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 15px; height: 15px; margin-top: -5px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5); transition: transform 200ms var(--spring); }
input[type="range"]::-moz-range-thumb { width: 15px; height: 15px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5); }
input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.25); }

/* map popover */
.map-pop {
  position: absolute; left: 0; bottom: 72px; z-index: 30; width: min(440px, 100%); max-height: min(520px, 70vh);
  display: flex; flex-direction: column; border-radius: var(--radius-lg); overflow: hidden;
  background: hsl(var(--hue) 14% 11% / 0.98); border: 1px solid var(--line);
  box-shadow: 0 24px 60px hsl(var(--hue) 40% 2% / 0.7);
  opacity: 0; transform: translateY(10px) scale(0.98); transform-origin: bottom left;
  transition: opacity 160ms var(--ease), transform 320ms var(--spring);
}
.map-pop.open { opacity: 1; transform: none; }
@media (min-width: 861px) {
  /* desktop: the map list is a shelf under the stage, always there */
  #mapPop, #mapPop[hidden] {
    display: flex !important; position: static; flex: 1; min-height: 0; width: auto; max-height: none;
    opacity: 1; transform: none; box-shadow: none; background: var(--bg5); border-color: hsl(var(--hue) 14% 15%);
  }
  .map-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); align-content: start; gap: 2px 6px; }
  .map-list h4, .map-list .note { grid-column: 1 / -1; }
  .map-chip .chev { display: none; }
}
.map-search { flex: none; display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); color: var(--light3); }
.map-search input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; font-size: 15px; color: var(--content1); }
.map-list { overflow-y: auto; padding: 6px; }
.map-list h4 { margin: 8px 8px 6px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--light3); }
.map-list .note { padding: 4px 8px 10px; }
.map-row { display: flex; align-items: center; gap: 10px; width: 100%; min-width: 0; padding: 6px; border: 0; border-radius: 9px; background: transparent; text-align: left; cursor: pointer; transition: background 140ms, transform 260ms var(--spring); }
.map-row:active { transform: scale(0.98); }
.map-row[aria-current] { box-shadow: inset 3px 0 0 var(--highlight); }
.map-row:hover { background: var(--bg3); }
.map-row[aria-current] { background: var(--bg2); }

/* ------------------------------------------------------------ inspector */
.ins-body { padding: 16px 16px 26px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
.enter { animation: rise 380ms var(--spring) both; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.ins-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.ins-head h2 { margin: 0; font-size: 21px; font-weight: 700; letter-spacing: -0.015em; }
.ins-head p { margin: 3px 0 0; color: var(--light3); font-size: 13px; }
.ins-head-art { flex: none; width: 132px; height: 82px; border-radius: 10px; overflow: hidden; background: var(--bg6); }
.ins-head-art canvas { width: 100%; height: 100%; display: block; }
.ins-sec { padding: 12px 0 6px; border-top: 1px solid hsl(var(--hue) 14% 16%); display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; min-width: 0; }
.ins-sec:first-of-type { border-top: 0; }
.ins-sec h3 { margin: 0; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--light3); }
.ins-sec h4 { margin: 4px 0 2px; font-size: 12px; color: var(--light3); font-weight: 600; }
.sec-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sec-row h3 { margin-right: auto; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.hint, .note { margin: 0; font-size: 12px; color: var(--light3); line-height: 1.45; }
.note { color: var(--content2); }

/* take-from tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.tile {
  display: grid; gap: 6px; padding: 5px 5px 7px; border-radius: 11px; text-align: left; cursor: pointer;
  border: 1.5px solid transparent; background: var(--bg3);
  transition: transform 280ms var(--spring), background 160ms, border-color 160ms;
}
.tile:hover { background: var(--bg2); transform: translateY(-2px); }
.tile:active { transform: scale(0.96); }
.tile[aria-pressed="true"] { border-color: var(--highlight); background: hsl(var(--hue) 30% 20%); }
.tile.absent { opacity: 0.55; }
.tile-art { display: grid; place-items: center; aspect-ratio: 150 / 92; border-radius: 7px; overflow: hidden; background: var(--bg6); }
.tile-art canvas { width: 100%; height: 100%; display: block; }
.tile-name { display: flex; align-items: center; gap: 4px; padding: 0 3px; font-size: 12px; font-weight: 600; min-width: 0; }
.tile-name span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-name svg { width: 13px; height: 13px; color: var(--highlight); stroke-width: 3; }
.def-mark { font-weight: 800; font-size: 18px; color: var(--light3); letter-spacing: -0.02em; }
.snd-chips { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px; align-content: center; justify-content: center; }
.snd-chips .none { font-size: 11px; color: var(--light3); }
.chip-play { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 7px 0 5px; border-radius: 11px; background: hsl(var(--hue) 20% 50% / 0.16); font-size: 10.5px; font-weight: 600; color: var(--content1); cursor: pointer; }
.chip-play:hover { background: var(--highlight); color: hsl(var(--hue) 40% 10%); }
.chip-play svg { width: 10px; height: 10px; }

/* slots */
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 6px; }
.slot {
  position: relative; display: grid; grid-template-rows: auto auto; gap: 4px; padding: 5px 5px 6px; border-radius: 10px;
  border: 1.5px solid transparent; background: var(--bg4); cursor: pointer; text-align: center;
  transition: transform 260ms var(--spring), background 140ms, border-color 140ms;
}
.slot:hover { background: var(--bg3); }
.slot:active { transform: scale(0.95); }
.slot[aria-pressed="true"] { border-color: var(--highlight); background: var(--bg3); }
.slot.drop-on, .snd-row.drop-on { border-color: var(--pink); background: hsl(333 60% 30% / 0.3); transform: scale(1.04); }
.slot.static { cursor: default; }
.slot-img {
  display: grid; place-items: center; aspect-ratio: 1; border-radius: 7px; overflow: hidden;
  background-color: #0e0c13;
  background-image: linear-gradient(45deg, #15121b 25%, transparent 25%, transparent 75%, #15121b 75%), linear-gradient(45deg, #15121b 25%, transparent 25%, transparent 75%, #15121b 75%);
  background-size: 12px 12px; background-position: 0 0, 6px 6px;
}
.slot-img img { max-width: 88%; max-height: 88%; object-fit: contain; display: block; }
.slot-img.none::after { content: "default"; font-size: 10.5px; color: var(--light3); }
.slot-name { font-size: 11px; font-weight: 600; color: var(--content2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slot-badges { position: absolute; top: 7px; right: 7px; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; pointer-events: none; }
.slot-badges .badge.small { height: 15px; font-size: 9.5px; padding: 0 5px; background: hsl(var(--hue) 20% 6% / 0.8); }
.slots.dim .slot { opacity: 0.6; }
.slots.dim .slot:hover { opacity: 1; }
.slots.gallery { grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); }
.missing { display: grid; gap: 8px; }
.swap { animation: rise 320ms var(--spring) both; }
.mini-tiles { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.mini-tile {
  flex: none; width: 84px; display: grid; gap: 4px; padding: 4px 4px 6px; border-radius: 10px; cursor: pointer;
  border: 1.5px solid transparent; background: var(--bg4); transition: transform 260ms var(--spring), border-color 140ms;
}
.mini-tile:hover { transform: translateY(-2px); background: var(--bg3); }
.mini-tile[aria-pressed="true"] { border-color: var(--highlight); }
.mt-img { display: grid; place-items: center; aspect-ratio: 1; border-radius: 7px; background: #0e0c13; overflow: hidden; }
.mt-img img { max-width: 86%; max-height: 86%; object-fit: contain; }
.mt-name { font-size: 10.5px; font-weight: 600; color: var(--content2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center; }

/* sliders */
.sliders { display: grid; gap: 4px; }
.slider { display: grid; grid-template-columns: 82px minmax(0, 1fr) 48px; align-items: center; gap: 10px; font-size: 13px; color: var(--content2); }
.slider output { text-align: right; font-variant-numeric: tabular-nums; font-size: 12px; color: var(--content1); }
.tint-row { display: grid; grid-template-columns: 30px minmax(0, 1fr) 48px; gap: 10px; align-items: center; grid-column: 2 / 4; }
input[type="color"] { -webkit-appearance: none; appearance: none; width: 30px; height: 24px; border: 0; padding: 0; border-radius: 7px; background: none; cursor: pointer; }
input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
input[type="color"]::-webkit-color-swatch { border: 2px solid hsl(var(--hue) 20% 50% / 0.3); border-radius: 7px; }
input[type="color"]::-moz-color-swatch { border: 2px solid hsl(var(--hue) 20% 50% / 0.3); border-radius: 7px; }
input[type="color"]:disabled { opacity: 0.35; }

/* settings */
.settings { display: grid; gap: 2px; }
.toggle, .numrow, .colrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 38px; padding: 4px 2px; font-size: 13.5px; cursor: pointer; }
.toggle > span, .numrow > span, .colrow > span:first-child { color: var(--content1); min-width: 0; }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.sw { position: relative; flex: none; width: 38px; height: 22px; border-radius: 11px; background: var(--bg1); transition: background 200ms var(--ease); }
.sw::after { content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--content2); transition: transform 320ms var(--spring), background 200ms; }
.toggle input:checked + .sw { background: var(--highlight); }
.toggle input:checked + .sw::after { transform: translateX(16px); background: hsl(var(--hue) 40% 10%); }
.toggle input:focus-visible + .sw { outline: 2px solid var(--highlight); outline-offset: 2px; }
.numrow input { width: 84px; height: 32px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg6); text-align: right; font-variant-numeric: tabular-nums; }
.numrow small { color: var(--light3); font-size: 11.5px; margin-left: -6px; }
.colrow { cursor: default; }
.colrow-right { display: flex; align-items: center; gap: 12px; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--content2); cursor: pointer; }
.check input { accent-color: var(--highlight); }

/* fields */
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field { min-width: 0; display: grid; gap: 5px; font-size: 12px; color: var(--light3); font-weight: 600; }
.field input, .field select {
  width: 100%; min-width: 0; height: 38px; padding: 0 12px; border-radius: 9px; border: 1px solid var(--line); background: var(--bg6); color: var(--content1); font-size: 14px; font-weight: 500;
  transition: border-color 140ms;
}
.field input:focus, .field select:focus, .numrow input:focus { outline: none; border-color: var(--highlight); }

/* colours */
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch {
  position: relative; width: 52px; height: 52px; border-radius: 50%; cursor: pointer; display: grid; place-items: center;
  background: var(--c, #888); box-shadow: 0 0 0 3px var(--bg5), 0 0 0 5px hsl(0 0% 100% / 0.12);
  transition: transform 300ms var(--spring);
  border: 0;
}
.swatch:hover { transform: scale(1.08); }
.swatch input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.sw-n { font-weight: 800; font-size: 15px; color: #fff; text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6); pointer-events: none; }
.sw-x { position: absolute; top: -4px; right: -4px; width: 20px; height: 20px; border-radius: 50%; border: 0; display: grid; place-items: center; background: var(--bg1); color: var(--content1); cursor: pointer; opacity: 0; transform: scale(0.6); transition: opacity 140ms, transform 260ms var(--spring); }
.sw-x svg { width: 11px; height: 11px; stroke-width: 3; }
.swatch:hover .sw-x, .swatch:focus-within .sw-x { opacity: 1; transform: none; }
.swatch.add { background: transparent; box-shadow: inset 0 0 0 2px var(--line); color: var(--content2); }
.swatch.add:hover { color: var(--content1); box-shadow: inset 0 0 0 2px var(--highlight); }

/* sounds */
.snd-rows { display: grid; gap: 4px; }
.snd-row { border-radius: 10px; background: var(--bg4); border: 1.5px solid transparent; transition: background 140ms, border-color 140ms, transform 260ms var(--spring); }
.snd-row.open { background: var(--bg3); }
.snd-rows.dim .snd-row { opacity: 0.7; }
.snd-main { display: flex; align-items: center; gap: 8px; padding: 5px 8px 5px 5px; }
.snd-name { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; height: 30px; border: 0; background: transparent; cursor: pointer; text-align: left; padding: 0; }
.snd-name b { font-size: 13.5px; font-weight: 600; white-space: nowrap; }
.snd-status { margin-left: auto; font-size: 11.5px; color: var(--light3); white-space: nowrap; }
.snd-status[data-kind="silent"] { color: var(--meh); }
.snd-status[data-kind="swapped"] { color: hsl(333 100% 78%); }
.snd-name .chev { width: 15px; height: 15px; color: var(--light3); }
.snd-detail { padding: 4px 12px 12px; display: grid; gap: 10px; animation: rise 300ms var(--spring) both; }
.trim { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.others { display: grid; gap: 3px; }
.other { display: flex; align-items: center; gap: 8px; padding: 3px; border-radius: 8px; }
.other.active { background: hsl(var(--hue) 30% 22% / 0.6); }
.o-name { flex: 1; min-width: 0; display: flex; gap: 8px; align-items: baseline; font-size: 12.5px; }
.o-name b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.o-name small { color: var(--meh); font-size: 11px; }

/* skin panel */
.mixlist { display: grid; gap: 4px; }
.mix-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; border: 0; background: var(--bg4); cursor: pointer; text-align: left; }
.mix-item:hover { background: var(--bg3); }
.mix-item b { font-size: 13px; font-weight: 600; white-space: nowrap; }
.mix-item span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mix-item span { margin-left: auto; font-size: 12px; color: var(--highlight); }
.mix-item svg { width: 14px; height: 14px; color: var(--light3); }

/* ------------------------------------------------------------ export sheet */
.sheet {
  width: min(520px, calc(100vw - 24px)); padding: 0; border: 1px solid var(--line); border-radius: 18px;
  background: var(--bg4); color: var(--content1); box-shadow: 0 30px 80px hsl(var(--hue) 40% 2% / 0.8);
}
.sheet[open] { animation: pop 380ms var(--spring); }
.sheet::backdrop { background: hsl(var(--hue) 30% 4% / 0.7); backdrop-filter: blur(3px); }
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(0.97); } to { opacity: 1; transform: none; } }
.sheet-body { padding: 18px 20px 20px; display: grid; gap: 14px; }
.sheet header { display: flex; align-items: center; justify-content: space-between; }
.sheet h2 { margin: 0; font-size: 22px; letter-spacing: -0.015em; }
.ex-preview { aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; background: var(--bg6); }
.ex-preview img { width: 100%; height: 100%; object-fit: cover; display: block; animation: fade 300ms var(--ease); }
.ex-how { margin: 0; font-size: 13.5px; color: var(--content2); line-height: 1.5; min-height: 2.6em; }
.ex-how b { color: var(--content1); }
.ex-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ex-meta { margin: 0; font-size: 12px; color: var(--light3); text-align: center; }

/* ------------------------------------------------------------ toast */
.toast {
  position: fixed; left: 50%; top: calc(var(--toolbar-h) + 14px); z-index: 90; max-width: min(560px, calc(100vw - 32px));
  padding: 11px 18px; border-radius: 12px; background: var(--bg1); color: var(--content1); font-size: 13.5px; font-weight: 500;
  box-shadow: 0 14px 40px hsl(var(--hue) 40% 2% / 0.6); pointer-events: none;
  opacity: 0; transform: translate(-50%, -12px) scale(0.97); transition: opacity 180ms var(--ease), transform 360ms var(--spring);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast[data-kind="bad"] { background: hsl(355 50% 26%); }

/* ------------------------------------------------------------ responsive */
@media (max-width: 1240px) {
  :root { --pane-w: 260px; --insp-w: 340px; }
  .vol { width: 96px; }
}
@media (max-width: 1040px) {
  :root { --pane-w: 236px; --insp-w: 316px; }
  .pt-thumb { width: 52px; height: 34px; }
  .vol { display: none; }
}
@media (max-width: 860px) {
  .studio[data-state="ready"] {
    display: flex; flex-direction: column; height: auto; padding: 8px 8px calc(12px + env(safe-area-inset-bottom)); gap: 8px;
  }
  .center { order: 1; }
  .stage { width: 100%; }
  .transport { flex-wrap: wrap; gap: 8px 10px; padding: 8px; }
  .map-chip { width: auto; flex: 1 1 100%; }
  .scrub { flex: 1; }
  .mobile-tabs {
    order: 2; display: flex; gap: 3px; padding: 3px; border-radius: 12px; background: var(--bg5);
    position: sticky; top: calc(var(--toolbar-h) + 6px); z-index: 20; border: 1px solid hsl(var(--hue) 14% 15%);
    box-shadow: 0 8px 24px hsl(var(--hue) 40% 2% / 0.5);
  }
  .mobile-tabs button { flex: 1; display: flex; align-items: center; justify-content: center; gap: 7px; height: 40px; border: 0; border-radius: 9px; background: transparent; color: var(--content2); font-weight: 600; cursor: pointer; transition: background 200ms var(--ease), color 160ms; }
  .mobile-tabs button svg { width: 16px; height: 16px; }
  .mobile-tabs button[aria-selected="true"] { background: var(--bg2); color: var(--content1); }
  .rail, .inspector { order: 3; overflow: visible; }
  .rail > .seg { display: none; }
  .rail-body { overflow: visible; padding-top: 10px; }
  .studio[data-mtab="edit"] .rail { display: none; }
  .studio:not([data-mtab="edit"]) .inspector { display: none; }
  .lib-grid { grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
  .map-pop { position: fixed; left: 8px; right: 8px; bottom: 8px; width: auto; max-height: 70vh; transform-origin: bottom center; }
  .empty-zone { padding: 40px 18px 30px; border-radius: 20px; }
  .tb-btn span { display: none; }
  .tb-btn:not(.icon) { width: 34px; padding: 0; justify-content: center; }
  .tb-btn.primary { width: auto; padding: 0 12px; }
  .tb-btn.primary span { display: inline; }
}
@media (max-width: 420px) {
  .lz-tab { padding: 0 10px; }
  .tb-btn.icon { width: 30px; }
  .ins-body { padding: 14px 12px 22px; }
  .ins-head-art { width: 104px; height: 64px; }
  .tiles { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
  .slider { grid-template-columns: 74px minmax(0, 1fr) 44px; gap: 8px; }
  .field-row { grid-template-columns: 1fr; }
  .ex-actions { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; }
}

/* sound "take from" rows */
.take-rows { display: grid; gap: 6px; }
.take-row {
  display: grid; gap: 8px; padding: 9px 10px; border-radius: 11px; cursor: pointer; background: var(--bg3);
  border: 1.5px solid transparent; transition: background 140ms, border-color 140ms, transform 260ms var(--spring);
}
.take-row:hover { background: var(--bg2); }
.take-row:active { transform: scale(0.985); }
.take-row[aria-pressed="true"] { border-color: var(--highlight); background: hsl(var(--hue) 30% 20%); }
.take-row.absent { opacity: 0.55; }
.take-row:focus-visible { outline: 2px solid var(--highlight); outline-offset: 2px; }
.tr-top { display: flex; align-items: center; gap: 9px; min-width: 0; }
.tr-top b { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tr-top small { margin-left: auto; font-size: 11.5px; color: var(--light3); white-space: nowrap; }
.radio { flex: none; width: 16px; height: 16px; border-radius: 50%; box-shadow: inset 0 0 0 2px var(--dark1); transition: box-shadow 240ms var(--spring); }
.take-row[aria-pressed="true"] .radio { box-shadow: inset 0 0 0 5px var(--highlight); }
.tr-chips { display: flex; flex-wrap: wrap; gap: 5px; padding-left: 25px; }
.chip-play { border: 0; }
.field.small input { height: 32px; font-size: 13px; }
