/* Studio: editor, Fox-ify, Fusion, brand kit, 3D and collection. */

.studio {
  min-height: calc(100vh - var(--header-h));
  padding-bottom: 64px;
}
.studio-bar {
  position: sticky;
  top: var(--header-h);
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.studio-bar-inner {
  display: flex;
  align-items: center;
  gap: 18px;
  height: 58px;
  max-width: 1440px;
}
.studio-title {
  font-size: 18px;
  letter-spacing: -0.02em;
}
.studio-mascot {
  flex: none;
  width: 66px;
  margin-left: auto;
  color: var(--text-3);
}
@media (max-width: 1100px) {
  .studio-mascot {
    display: none;
  }
}
.studio-tabs button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
}
.studio-tabs svg {
  width: 16px;
  height: 16px;
}
.badge {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-text);
  font: 600 11px var(--mono);
}
.tool {
  padding-top: 24px;
}
.tool .wrap {
  max-width: 1440px;
}
.side-title {
  font-size: 14px;
  letter-spacing: -0.01em;
  margin-bottom: 12px;
}
.field.inline {
  grid-auto-flow: column;
  align-items: center;
  gap: 8px;
}
.field.inline .input {
  width: auto;
  height: 34px;
}
.field.check {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.small-note {
  margin: 0;
  font-size: 12.5px;
}
.row2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chips .chip svg {
  width: 14px;
  height: 14px;
}
.chip .x {
  margin-left: 2px;
  opacity: 0.6;
}
.wrap-seg {
  flex-wrap: wrap;
}
.lint {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
  font-size: 13px;
}
.lint li {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--panel-2);
  color: var(--text-2);
}
.lint li.ok {
  color: var(--good);
}
.lint li.bad {
  color: var(--bad);
  cursor: pointer;
}
.lint li b {
  font: 600 11.5px var(--mono);
}
.empty {
  padding: 40px 0;
  text-align: center;
}

/* Editor */

.editor {
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr) 340px;
  gap: 16px;
  align-items: start;
}
.ed-tools {
  position: sticky;
  top: calc(var(--header-h) + 74px);
  display: grid;
  gap: 4px;
  padding: 6px;
}
.ed-tools button {
  display: grid;
  place-items: center;
  width: 46px;
  height: 42px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  position: relative;
}
.ed-tools button:hover {
  background: var(--line);
  color: var(--text);
}
.ed-tools button[aria-pressed='true'] {
  background: var(--accent-soft);
  color: var(--accent-text);
}
.ed-tools button svg {
  width: 20px;
  height: 20px;
}
.ed-tools button kbd {
  position: absolute;
  right: 3px;
  bottom: 2px;
  min-width: 0;
  padding: 0 3px;
  border: 0;
  font-size: 9px;
  line-height: 12px;
  background: transparent;
  color: var(--text-3);
}
.ed-stage {
  padding: 12px;
}
.ed-stage-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 2px 4px 12px;
}
.ed-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.ed-canvas {
  display: block;
  width: 100%;
  max-width: 640px;
  aspect-ratio: 1;
  margin: 0 auto;
  border-radius: 14px;
  background: var(--icon-bg);
  touch-action: none;
  user-select: none;
  color: var(--text);
  cursor: crosshair;
}
.ed-canvas.select {
  cursor: default;
}
.ed-canvas .grid1 {
  stroke: var(--line-2);
  stroke-width: 0.03;
}
.ed-canvas .grid2 {
  stroke: var(--line);
  stroke-width: 0.02;
}
.ed-canvas .pad {
  fill: none;
  stroke: var(--accent);
  stroke-opacity: 0.45;
  stroke-width: 0.04;
  stroke-dasharray: 0.25 0.2;
}
.ed-canvas .center {
  stroke: var(--accent);
  stroke-opacity: 0.18;
  stroke-width: 0.03;
}
.ed-canvas .shape.selected {
  stroke: var(--accent);
}
.ed-canvas .shape:not(.selected):hover {
  stroke: color-mix(in srgb, currentColor 70%, var(--accent));
}
.ed-canvas .handle {
  fill: var(--panel);
  stroke: var(--accent);
  stroke-width: 0.08;
  cursor: grab;
}
.ed-canvas .handle.ctrl {
  fill: var(--accent);
}
.ed-canvas .ctrl-line {
  stroke: var(--accent);
  stroke-width: 0.04;
  stroke-opacity: 0.6;
}
.ed-canvas .ghost {
  stroke: var(--accent);
  stroke-opacity: 0.8;
}
.ed-canvas .cursor-dot {
  fill: var(--accent);
}
.ed-hint {
  margin: 10px 4px 0;
  font-size: 13px;
  min-height: 1.5em;
}
.ed-side {
  display: grid;
  gap: 16px;
}
.ed-meta {
  display: grid;
  gap: 14px;
}
.ed-preview {
  display: grid;
  gap: 12px;
}
.ed-preview .sizes {
  display: flex;
  align-items: end;
  justify-content: space-around;
  gap: 10px;
  padding: 16px;
  border-radius: 12px;
}
.ed-preview .sizes.dark {
  background: #0d0d11;
  color: #f5f5f6;
}
.ed-preview .sizes.light {
  background: #f7f6f3;
  color: #121014;
}
.ed-preview .variants {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.ed-preview .variants div {
  display: grid;
  place-items: center;
  gap: 6px;
  padding: 12px 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font: 500 11px var(--mono);
  color: var(--text-3);
}
.ed-preview .context {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.ed-preview .fake-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  font-size: 14px;
}
.ed-preview .fake-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 14px;
  color: var(--text-2);
}

/* Fox-ify */

.tool-fox {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 16px;
  align-items: start;
}
.fox-input {
  display: grid;
  gap: 14px;
}
.drop {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 120px;
  padding: 18px;
  border: 1.5px dashed var(--line-3);
  border-radius: 14px;
  color: var(--text-2);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.drop:hover,
.drop.over {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.fox-opts {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}
.fox-out {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  min-width: 0;
}
.fox-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.fox-compare figure {
  margin: 0;
  display: grid;
  gap: 8px;
}
.fox-compare figcaption {
  font: 600 11px var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
}
.fox-box {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 14px;
  background:
    linear-gradient(var(--line) 1px, transparent 1px) center / calc(100% / 24) calc(100% / 24),
    linear-gradient(90deg, var(--line) 1px, transparent 1px) center / calc(100% / 24) calc(100% / 24),
    var(--icon-bg);
  color: var(--text);
  overflow: hidden;
}
.fox-box img,
.fox-box svg {
  width: 78%;
  height: 78%;
}
.fox-box .fenn-art {
  width: 72%;
  height: auto;
  margin: 0;
}
.fu-stage > .empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.fu-stage > .empty .fenn-art {
  width: 46%;
  max-width: 240px;
}
.fox-sizes {
  display: flex;
  align-items: end;
  gap: 18px;
  color: var(--text);
}

/* Fusion */

.tool-fusion {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr) 360px;
  gap: 16px;
  align-items: start;
}
.fu-controls {
  display: grid;
  gap: 16px;
}
.fu-stage-card {
  display: grid;
  gap: 16px;
}
.fu-stage {
  position: relative;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  aspect-ratio: 1;
  border-radius: 18px;
  background:
    linear-gradient(var(--line) 1px, transparent 1px) center / calc(100% / 24) calc(100% / 24),
    linear-gradient(90deg, var(--line) 1px, transparent 1px) center / calc(100% / 24) calc(100% / 24),
    var(--icon-bg);
  color: var(--text);
  touch-action: none;
  outline-offset: 4px;
}
.fu-stage svg.out {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.fu-stage .box {
  position: absolute;
  border: 1px dashed var(--line-3);
  border-radius: 6px;
  cursor: grab;
}
.fu-stage .box.sel {
  border: 1.5px solid var(--accent);
}
.fu-stage .box span {
  position: absolute;
  top: -20px;
  left: 0;
  font: 500 10.5px var(--mono);
  color: var(--text-3);
  white-space: nowrap;
}
.fu-sizes {
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 24px;
  color: var(--text);
}
.fu-out {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  min-width: 0;
}
.fu-out .code pre {
  max-height: 260px;
  font-size: 12px;
}

/* Brand kit */

.tool-brand {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.br-controls {
  display: grid;
  gap: 16px;
}
.br-exports {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.br-preview {
  display: grid;
  gap: 18px;
}
.br-marks {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: end;
}
.br-marks figure {
  margin: 0;
  display: grid;
  justify-items: center;
  gap: 6px;
  font: 500 11px var(--mono);
  color: var(--text-3);
}
.br-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: 8px;
}
.br-grid div {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--icon-bg);
}

/* 3D */

.tool-three {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.th-controls {
  display: grid;
  gap: 16px;
}
.th-controls .small-note {
  margin-top: -8px;
}
.th-unknown {
  color: var(--accent-text);
}
.th-controls .field[hidden] {
  display: none;
}
.th-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.th-chips .chip {
  height: 30px;
}
.th-ball {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex: none;
  background: radial-gradient(circle at 35% 30%, #ffd4b0, var(--accent) 45%, #6b2a00 100%);
}
.th-ball[data-ball='clay'] {
  background: radial-gradient(circle at 38% 34%, #f3c3a0, #d9895a 55%, #8a4a2a 100%);
}
.th-ball[data-ball='plastic'] {
  background: radial-gradient(circle at 34% 28%, #fff 0 8%, #ffb06b 16%, var(--accent) 48%, #7a2c00 100%);
}
.th-ball[data-ball='metal'] {
  background: linear-gradient(160deg, #f4f5f7, #9aa0aa 40%, #e3e6ea 55%, #5d626b 100%);
}
.th-ball[data-ball='glass'] {
  background: radial-gradient(circle at 34% 28%, #fff 0 10%, rgba(255, 190, 140, 0.55) 24%, rgba(255, 122, 26, 0.25) 60%, rgba(255, 122, 26, 0.65) 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}
.th-ball[data-ball='neon'] {
  background: radial-gradient(circle, #fff 0 22%, #ff9a4d 40%, var(--accent) 60%, transparent 72%);
  box-shadow: 0 0 8px var(--accent);
}
.th-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.th-swatches button {
  width: 36px;
  height: 36px;
  padding: 3px;
  border: 1px solid var(--line-2);
  border-radius: 11px;
  background: var(--panel);
  cursor: pointer;
}
.th-swatches button[aria-pressed='true'] {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.th-swatches i {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 8px;
}
.th-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.th-main {
  display: grid;
  gap: 16px;
  min-width: 0;
}
.th-stage {
  position: relative;
  aspect-ratio: 4 / 3;
  max-height: calc(100vh - var(--header-h) - 120px);
  min-height: 300px;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: #0b0a10;
}
.th-stage.is-transparent {
  background: repeating-conic-gradient(#1b1b22 0 25%, #24242c 0 50%) 0 0 / 22px 22px;
}
:root[data-theme='light'] .th-stage.is-transparent {
  background: repeating-conic-gradient(#e7e5df 0 25%, #f6f5f2 0 50%) 0 0 / 22px 22px;
}
.th-stage .h3d-bg,
.th-stage .h3d-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  border-radius: inherit;
}
.th-stage .h3d-canvas {
  cursor: grab;
}
.th-stage .h3d-canvas:active {
  cursor: grabbing;
}
.th-stage .h3d-canvas:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.th-status {
  position: relative;
  z-index: 1;
}
.th-hint {
  position: absolute;
  left: 16px;
  bottom: 12px;
  z-index: 1;
  margin: 0;
  font: 500 11.5px var(--mono);
  color: rgba(255, 255, 255, 0.5);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
}
.th-stage.ready .th-hint {
  opacity: 1;
}
.th-stage.is-light .th-hint,
:root[data-theme='light'] .th-stage.is-transparent .th-hint {
  color: rgba(20, 16, 10, 0.55);
}
.th-out {
  display: grid;
  grid-template-columns: minmax(220px, 300px) minmax(0, 1fr);
  gap: 20px 28px;
  align-items: start;
}
.th-export {
  display: grid;
  gap: 12px;
}
.th-export .side-title,
.th-embed .side-title {
  margin: 0;
}
.th-embed {
  display: grid;
  gap: 10px;
  min-width: 0;
}
.th-embed pre {
  max-height: 180px;
  white-space: pre-wrap;
  word-break: break-all;
}
.th-note {
  grid-column: 1 / -1;
}
.th-note .mono {
  font-family: var(--mono);
}

/* Collection */

.col-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin-bottom: 20px;
}
.col-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}
.col-card {
  display: grid;
  gap: 10px;
  padding: 14px;
}
.col-card .tile svg {
  width: 56%;
  height: 56%;
}
.col-card b {
  font: 600 12.5px var(--mono);
  word-break: break-all;
}
.col-card .acts {
  display: flex;
  gap: 4px;
}
.col-card .acts .icon-btn {
  min-width: 32px;
  height: 32px;
}

@media (max-width: 1200px) {
  .editor {
    grid-template-columns: 60px minmax(0, 1fr);
  }
  .ed-side {
    grid-column: 1 / -1;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  }
  .tool-fusion {
    grid-template-columns: 300px minmax(0, 1fr);
  }
  .fu-out {
    grid-column: 1 / -1;
  }
}
@media (max-width: 860px) {
  .studio-bar-inner {
    height: auto;
    padding-top: 10px;
    padding-bottom: 8px;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }
  .studio-title {
    display: none;
  }
  .studio-tabs button span {
    font-size: 13px;
  }
  .editor {
    grid-template-columns: minmax(0, 1fr);
  }
  .ed-tools {
    position: static;
    grid-auto-flow: column;
    overflow-x: auto;
  }
  .tool-fox,
  .tool-fusion,
  .tool-brand,
  .tool-three {
    grid-template-columns: minmax(0, 1fr);
  }
  .th-out {
    grid-template-columns: 1fr;
  }
  .fox-compare {
    grid-template-columns: 1fr 1fr;
  }
}

/* Motion */

.tool-motion {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr) 360px;
  gap: 16px;
  align-items: start;
}
.mo-controls,
.mo-keyframe,
.mo-stage-card {
  display: grid;
  gap: 14px;
}
.mo-keyframe {
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.mo-keyframe[hidden] {
  display: none;
}
.mo-stage {
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 10;
  border-radius: 16px;
  background:
    linear-gradient(var(--line) 1px, transparent 1px) center / 24px 24px,
    linear-gradient(90deg, var(--line) 1px, transparent 1px) center / 24px 24px,
    var(--icon-bg);
  color: var(--text);
}
.mo-stage svg {
  width: min(240px, 60%);
  height: auto;
}
.mo-transport {
  display: flex;
  align-items: center;
  gap: 12px;
}
.mo-transport input {
  flex: 1;
  min-width: 0;
}
.mo-transport output {
  min-width: 64px;
  text-align: right;
  font: 500 12px var(--mono);
  color: var(--text-2);
}
.mo-timeline {
  display: grid;
  gap: 6px;
  outline-offset: 4px;
}
.mo-row {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}
.mo-name {
  font: 500 12px var(--mono);
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mo-lane {
  position: relative;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  cursor: copy;
}
.mo-lane::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--gf-head, 0%);
  width: 2px;
  background: var(--accent);
  opacity: 0.6;
  pointer-events: none;
}
.mo-key {
  position: absolute;
  top: 50%;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border: 2px solid var(--text-2);
  border-radius: 3px;
  background: var(--panel);
  transform: rotate(45deg);
  cursor: grab;
  touch-action: none;
}
.mo-key.on {
  border-color: var(--accent);
  background: var(--accent);
}
.mo-controls,
.mo-stage-card,
.mo-out {
  min-width: 0;
}
.mo-out {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
}
.mo-out pre {
  max-height: 340px;
  overflow: auto;
}
@media (max-width: 1100px) {
  .tool-motion {
    grid-template-columns: minmax(0, 1fr);
  }
}
