:root {
  --bg: #080a0e;
  --panel: #0d1015;
  --panel-2: #11151c;
  --line: rgba(255, 255, 255, 0.075);
  --line-strong: rgba(255, 255, 255, 0.13);
  --text: #eef1f7;
  --muted: #8a93a6;
  --muted-2: #626b7d;
  --accent: #8b7bff;
  --accent-soft: rgba(139, 123, 255, 0.16);
  --accent-2: #59e1d0;
  --danger: #ff6b81;
  --radius: 14px;
  --sidebar-w: 320px;
  --editor-w: 326px;
  --font: "Inter", "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

::selection {
  background: rgba(139, 123, 255, 0.35);
}

.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mono {
  font-family: var(--mono);
  font-variant-ligatures: none;
}

.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  height: 100dvh;
  width: 100%;
}

.app.editing {
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--editor-w);
}

/* ---------------------------------------------------------------- sidebar */

.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background:
    radial-gradient(120% 60% at 0% 0%, rgba(139, 123, 255, 0.07), transparent 60%),
    var(--panel);
  border-right: 1px solid var(--line);
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 16px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 12px;
  color: #cfc9ff;
  background: linear-gradient(145deg, rgba(139, 123, 255, 0.35), rgba(89, 225, 208, 0.14));
  border: 1px solid rgba(139, 123, 255, 0.35);
  box-shadow: 0 8px 24px -12px rgba(139, 123, 255, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.brand-mark svg {
  width: 22px;
  height: 22px;
}

.brand-text {
  min-width: 0;
}

.brand-text h1 {
  margin: 0;
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -0.015em;
}

.brand-text p {
  margin: 3px 0 0;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.01em;
}

.sidebar-close {
  display: none !important;
  margin-left: auto;
}

.search-wrap {
  position: relative;
  margin: 0 16px;
}

.search-wrap input {
  width: 100%;
  height: 40px;
  padding: 0 40px 0 38px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
  outline: none;
  transition: border-color 0.18s, background 0.18s, box-shadow 0.18s;
  appearance: none;
}

.search-wrap input::placeholder {
  color: var(--muted-2);
}

.search-wrap input::-webkit-search-cancel-button {
  display: none;
}

.search-wrap input:focus {
  border-color: rgba(139, 123, 255, 0.5);
  background: rgba(139, 123, 255, 0.06);
  box-shadow: 0 0 0 3px rgba(139, 123, 255, 0.1);
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 17px;
  height: 17px;
  color: var(--muted-2);
  pointer-events: none;
}

.search-wrap kbd {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  min-width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted-2);
  background: rgba(255, 255, 255, 0.03);
  pointer-events: none;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 14px 16px 12px;
}

.chip {
  height: 27px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 550;
  letter-spacing: 0.01em;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.16s ease;
}

.chip:hover {
  color: var(--text);
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.03);
}

.chip.active {
  color: #d9d4ff;
  border-color: rgba(139, 123, 255, 0.45);
  background: var(--accent-soft);
}

.chip .n {
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--muted-2);
}

.chip.active .n {
  color: rgba(217, 212, 255, 0.65);
}

.list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 20px 8px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted-2);
}

.list-count {
  font-family: var(--mono);
  letter-spacing: 0;
}

.model-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 10px 14px;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.13) transparent;
}

.model-list::-webkit-scrollbar {
  width: 8px;
}

.model-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 99px;
  border: 2px solid var(--panel);
}

.model-list::-webkit-scrollbar-track {
  background: transparent;
}

.model-card {
  position: relative;
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 8px;
  margin-bottom: 2px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  text-align: left;
  color: inherit;
  transition: background 0.16s ease, border-color 0.16s ease;
}

.model-card:hover {
  background: rgba(255, 255, 255, 0.035);
}

.model-card.active {
  background: linear-gradient(100deg, rgba(139, 123, 255, 0.13), rgba(139, 123, 255, 0.035));
  border-color: rgba(139, 123, 255, 0.26);
}

.model-card.active::before {
  content: "";
  position: absolute;
  left: -1px;
  top: 14px;
  bottom: 14px;
  width: 2px;
  border-radius: 2px;
  background: linear-gradient(var(--accent), var(--accent-2));
  box-shadow: 0 0 12px rgba(139, 123, 255, 0.75);
}

.thumb {
  position: relative;
  width: 56px;
  height: 56px;
  flex: none;
  border-radius: 9px;
  overflow: hidden;
  background:
    radial-gradient(80% 80% at 50% 25%, rgba(139, 123, 255, 0.18), transparent 70%),
    linear-gradient(160deg, #1a1f29, #0f1218);
  border: 1px solid rgba(255, 255, 255, 0.055);
  display: grid;
  place-items: center;
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.35s ease;
}

.thumb img.loaded {
  opacity: 1;
}

.model-card:hover .thumb img {
  transform: scale(1.06);
}

.thumb-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(207, 201, 255, 0.55);
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.03em;
}

.thumb img.loaded + .thumb-fallback {
  opacity: 0;
}

.card-body {
  min-width: 0;
}

.card-name {
  display: block;
  font-size: 12.8px;
  font-weight: 580;
  letter-spacing: -0.005em;
  color: #e6e9f1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.model-card.active .card-name {
  color: #fff;
}

.card-file {
  display: block;
  margin-top: 2px;
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--muted-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 5px;
  font-size: 9.5px;
  color: var(--muted-2);
  white-space: nowrap;
}

.card-meta .sep {
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.7;
}

.card-meta .anim {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--accent-2);
}

.card-meta .anim::before {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 6px currentColor;
}

.sidebar-foot {
  padding: 12px 16px 16px;
  border-top: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.12);
}

.drop-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10.5px;
  color: var(--muted-2);
}

.drop-hint svg {
  width: 14px;
  height: 14px;
  flex: none;
  color: var(--accent);
}

.drop-hint b {
  color: var(--muted);
  font-weight: 600;
}

.repo-link {
  display: inline-block;
  margin-top: 8px;
  font-size: 10.5px;
  color: var(--muted-2);
  text-decoration: none;
}

.repo-link:hover {
  color: var(--text);
}

/* ----------------------------------------------------------------- stage */

.stage {
  position: relative;
  min-width: 0;
  height: 100%;
  overflow: hidden;
  background: #0a0c11;
  isolation: isolate;
}

.backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(58% 55% at 50% 38%, #1c2230 0%, #11151d 42%, #0a0c11 100%),
    linear-gradient(180deg, rgba(139, 123, 255, 0.05), transparent 40%);
  pointer-events: none;
}

.backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.045) 0.6px, transparent 0.6px);
  background-size: 26px 26px;
  opacity: 0.25;
  mask-image: radial-gradient(70% 70% at 50% 42%, #000 0%, transparent 78%);
}

#canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  outline: none;
  touch-action: none;
}

.stage::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 140px 20px rgba(0, 0, 0, 0.55);
  z-index: 1;
}

/* ---------------------------------------------------------------- topbar */

.topbar {
  position: absolute;
  inset: 0 0 auto 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 22px 40px;
  background: linear-gradient(180deg, rgba(8, 10, 14, 0.82) 0%, rgba(8, 10, 14, 0.42) 55%, transparent 100%);
  pointer-events: none;
}

.topbar > * {
  pointer-events: auto;
}

.menu-btn {
  display: none !important;
}

.model-heading {
  min-width: 0;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  font-weight: 620;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin-bottom: 5px;
}

.eyebrow #modelCategory {
  color: #b9b2ff;
}

.eyebrow .dot {
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: var(--muted-2);
}

.eyebrow .mono {
  font-size: 9.5px;
  letter-spacing: 0;
  text-transform: none;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-heading h2 {
  margin: 0;
  font-size: clamp(19px, 2.1vw, 27px);
  font-weight: 620;
  letter-spacing: -0.025em;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-spacer {
  flex: 1;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(14, 17, 23, 0.72);
  backdrop-filter: blur(18px) saturate(130%);
  -webkit-backdrop-filter: blur(18px) saturate(130%);
  box-shadow: 0 18px 40px -24px rgba(0, 0, 0, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.toolbar-divider {
  width: 1px;
  height: 20px;
  margin: 0 4px;
  background: var(--line);
}

.icon-btn {
  position: relative;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: none;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: #98a1b2;
  transition: all 0.15s ease;
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

.icon-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.07);
}

.icon-btn:active {
  transform: scale(0.94);
}

.icon-btn[aria-pressed="true"] {
  color: #d3ceff;
  background: rgba(139, 123, 255, 0.18);
  border-color: rgba(139, 123, 255, 0.28);
  box-shadow: inset 0 0 12px rgba(139, 123, 255, 0.1);
}

.icon-btn::after {
  content: attr(data-tip);
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(-3px);
  padding: 5px 8px;
  border-radius: 6px;
  border: 1px solid var(--line-strong);
  background: #161a21;
  color: #cfd5e0;
  font-size: 10px;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.14s, transform 0.14s;
  z-index: 30;
}

.icon-btn:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ----------------------------------------------------------------- glass */

.glass {
  background: linear-gradient(160deg, rgba(20, 24, 32, 0.82), rgba(13, 16, 22, 0.76));
  border: 1px solid var(--line);
  backdrop-filter: blur(20px) saturate(130%);
  -webkit-backdrop-filter: blur(20px) saturate(130%);
  box-shadow: 0 24px 50px -30px rgba(0, 0, 0, 0.95), inset 0 1px 0 rgba(255, 255, 255, 0.045);
}

/* ----------------------------------------------------------------- stats */

.stats {
  position: absolute;
  left: 22px;
  bottom: 22px;
  z-index: 4;
  width: 292px;
  border-radius: 15px;
  padding: 13px 15px 14px;
  animation: rise 0.35s cubic-bezier(0.2, 0.8, 0.3, 1);
}

.stats-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 9.5px;
  font-weight: 650;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted-2);
  padding-bottom: 10px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.live-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 8px var(--accent-2);
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 18px;
  margin: 0;
}

.stats-grid dt {
  font-size: 9.5px;
  color: var(--muted-2);
  letter-spacing: 0.02em;
}

.stats-grid dd {
  margin: 2px 0 0;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  color: #dfe4ee;
  font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------- animation */

.anim-panel {
  position: absolute;
  right: 22px;
  bottom: 22px;
  z-index: 4;
  width: 372px;
  max-width: calc(100% - 44px);
  border-radius: 15px;
  padding: 12px 14px 13px;
  animation: rise 0.35s cubic-bezier(0.2, 0.8, 0.3, 1);
}

.anim-top {
  display: flex;
  align-items: center;
  gap: 11px;
}

.play-btn {
  width: 38px;
  height: 38px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 10px;
  border: 1px solid rgba(139, 123, 255, 0.35);
  background: linear-gradient(160deg, rgba(139, 123, 255, 0.26), rgba(139, 123, 255, 0.1));
  color: #e2ddff;
  transition: all 0.15s;
}

.play-btn:hover {
  background: rgba(139, 123, 255, 0.35);
  border-color: rgba(139, 123, 255, 0.55);
}

.play-btn:active {
  transform: scale(0.94);
}

.play-btn svg {
  width: 17px;
  height: 17px;
}

.play-btn .icon-pause {
  display: none;
}

.play-btn.playing .icon-pause {
  display: block;
}

.play-btn.playing .icon-play {
  display: none;
}

.anim-meta {
  flex: 1;
  min-width: 0;
}

.anim-label {
  display: block;
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin-bottom: 3px;
}

.anim-select-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.anim-select-wrap select {
  width: 100%;
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0 18px 0 0;
  font-size: 12px;
  font-weight: 600;
  color: #e6e9f1;
  outline: none;
  cursor: pointer;
  text-overflow: ellipsis;
}

.anim-select-wrap select option {
  background: #141820;
  color: #e6e9f1;
}

.anim-select-wrap .chev {
  position: absolute;
  right: 0;
  width: 13px;
  height: 13px;
  color: var(--muted);
  pointer-events: none;
}

.speed {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: none;
  padding-left: 12px;
  border-left: 1px solid var(--line);
}

.speed span {
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-2);
}

.speed select {
  appearance: none;
  border: 0;
  background: transparent;
  color: #cfd5e0;
  font-family: var(--mono);
  font-size: 11px;
  padding: 0 12px 0 0;
  outline: none;
  cursor: pointer;
}

.speed select option {
  background: #141820;
}

.anim-track {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 9px;
}

.anim-track span {
  font-size: 9.5px;
  color: var(--muted-2);
  font-variant-numeric: tabular-nums;
  flex: none;
  width: 32px;
}

.anim-track span:last-child {
  text-align: right;
}

input[type="range"] {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 16px;
  background: transparent;
  cursor: pointer;
  margin: 0;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 3px;
  border-radius: 99px;
  background: linear-gradient(
    to right,
    var(--accent) 0%,
    var(--accent) var(--fill, 0%),
    rgba(255, 255, 255, 0.1) var(--fill, 0%),
    rgba(255, 255, 255, 0.1) 100%
  );
}

input[type="range"]::-moz-range-track {
  height: 3px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.1);
}

input[type="range"]::-moz-range-progress {
  height: 3px;
  border-radius: 99px;
  background: var(--accent);
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 11px;
  height: 11px;
  margin-top: -4px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--accent);
  box-shadow: 0 0 0 3px rgba(139, 123, 255, 0.18);
  transition: box-shadow 0.15s;
}

input[type="range"]:hover::-webkit-slider-thumb {
  box-shadow: 0 0 0 5px rgba(139, 123, 255, 0.22);
}

input[type="range"]::-moz-range-thumb {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--accent);
}

/* ------------------------------------------------------------------ hint */

.hint {
  position: absolute;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: rgba(12, 15, 20, 0.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-size: 10.5px;
  color: var(--muted-2);
  white-space: nowrap;
  transition: opacity 0.5s ease, transform 0.5s ease;
  pointer-events: none;
}

.hint svg {
  width: 13px;
  height: 13px;
}

.hint b {
  color: var(--muted);
  font-weight: 600;
}

.hint.hide {
  opacity: 0;
  transform: translateX(-50%) translateY(6px);
}

/* ---------------------------------------------------------------- loader */

.loader {
  position: absolute;
  inset: 0;
  z-index: 15;
  display: grid;
  place-items: center;
  background: rgba(8, 10, 14, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s;
}

.loader.show {
  opacity: 1;
  visibility: visible;
}

.loader-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: min(320px, 82vw);
  padding: 26px 26px 22px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(16, 19, 26, 0.9);
  box-shadow: 0 30px 80px -30px #000;
  animation: rise 0.3s ease;
}

.ring {
  position: relative;
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 12px;
  color: #dedaff;
}

.ring::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.08);
}

.ring::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: var(--accent);
  border-right-color: var(--accent-2);
  animation: spin 0.9s linear infinite;
  mask: linear-gradient(#000, #000);
}

.loader-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  text-align: center;
}

.loader-text strong {
  font-size: 13px;
  font-weight: 620;
}

.loader-text span {
  font-size: 10px;
  color: var(--muted-2);
  max-width: 250px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.load-bar {
  width: 100%;
  height: 3px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.load-bar i {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.2s ease;
}

/* --------------------------------------------------------------- dropzone */

.dropzone {
  position: absolute;
  inset: 14px;
  z-index: 18;
  display: grid;
  place-items: center;
  border: 1.5px dashed rgba(139, 123, 255, 0.6);
  border-radius: 20px;
  background: rgba(9, 11, 16, 0.78);
  backdrop-filter: blur(10px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.18s ease, visibility 0.18s;
  pointer-events: none;
}

.dropzone.active {
  opacity: 1;
  visibility: visible;
}

.dropzone-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 30px 40px;
  text-align: center;
}

.dropzone-card svg {
  width: 34px;
  height: 34px;
  color: var(--accent);
  margin-bottom: 8px;
}

.dropzone-card strong {
  font-size: 16px;
  font-weight: 620;
}

.dropzone-card span {
  font-size: 11.5px;
  color: var(--muted);
}

/* ------------------------------------------------------------------ toast */

.toast {
  position: absolute;
  left: 50%;
  bottom: 64px;
  transform: translate(-50%, 10px);
  z-index: 25;
  max-width: min(440px, calc(100% - 40px));
  padding: 9px 14px;
  border-radius: 9px;
  border: 1px solid rgba(255, 107, 129, 0.3);
  background: rgba(38, 17, 23, 0.94);
  color: #ffb3be;
  font-size: 11.5px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s ease;
  text-align: center;
}

.toast.show {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

.scrim {
  display: none;
}

/* ------------------------------------------------------------- animations */

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.scrim {
  z-index: 19;
}

/* --------------------------------------------------------------- responsive */

@media (max-width: 1180px) {
  :root {
    --sidebar-w: 276px;
    --editor-w: 300px;
  }

  .stats {
    width: 244px;
  }

  .anim-panel {
    width: 316px;
  }
}

@media (max-width: 1040px) {
  .app.editing {
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  }

  .editor-panel {
    position: fixed;
    inset: 0 0 0 auto;
    width: min(340px, 90vw);
    z-index: 22;
    transform: translateX(104%);
    transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.3, 1);
    box-shadow: -40px 0 80px -40px #000;
  }

  .app.editing .editor-panel {
    transform: none;
  }

  .ed-close {
    display: grid !important;
  }
}

@media (max-width: 1020px) {
  .eyebrow .mono {
    max-width: 160px;
  }
}

@media (max-width: 920px) {
  .app,
  .app.editing {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(330px, 88vw);
    transform: translateX(-102%);
    transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.3, 1);
    box-shadow: 40px 0 80px -40px #000;
  }

  .app.nav-open .sidebar {
    transform: none;
  }

  .sidebar-close {
    display: grid !important;
  }

  .scrim {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(4, 6, 9, 0.6);
    backdrop-filter: blur(2px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s, visibility 0.25s;
  }

  .app.nav-open .scrim {
    opacity: 1;
    visibility: visible;
  }

  .menu-btn {
    display: grid !important;
    margin-left: -4px;
  }

  .topbar {
    padding: 14px 14px 30px;
    gap: 10px;
  }

  .stats {
    left: 14px;
    bottom: 14px;
  }

  .anim-panel {
    right: 14px;
    bottom: 14px;
  }

  .hint {
    display: none;
  }

  .toolbar {
    padding: 4px;
  }

  .icon-btn {
    width: 34px;
    height: 34px;
  }

  .icon-btn::after {
    display: none;
  }
}

@media (max-width: 720px) {
  .stats {
    display: none;
  }

  .anim-panel {
    left: 14px;
    right: 14px;
    width: auto;
    max-width: none;
    bottom: 14px;
  }

  .eyebrow .mono,
  .eyebrow .dot {
    display: none;
  }

  .model-heading h2 {
    font-size: 17px;
  }

  .toolbar .icon-btn#btnWire,
  .toolbar .icon-btn#btnGrid {
    display: none;
  }

  .toolbar-divider {
    display: none;
  }
}

@media (max-width: 480px) {
  .eyebrow {
    font-size: 9px;
  }

  .toolbar .icon-btn#btnDownload {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* Focus ring */
:focus-visible {
  outline: 2px solid rgba(139, 123, 255, 0.7);
  outline-offset: 2px;
}

/* ------------------------------------------------------------------ misc */

.empty-list {
  padding: 26px 18px;
  text-align: center;
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--muted-2);
}

.icon-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

/* --------------------------------------------------------------- gizmo bar */

.gizmo-bar {
  position: absolute;
  top: 76px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 4px 6px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(14, 17, 24, 0.88);
  box-shadow: 0 18px 40px -24px rgba(0, 0, 0, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  max-width: calc(100% - 28px);
  overflow-x: auto;
  scrollbar-width: none;
}

.gizmo-bar[hidden] {
  display: none;
}

.g-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 29px;
  padding: 0 9px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 560;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.g-btn svg {
  width: 15px;
  height: 15px;
}

.g-btn:hover:not(:disabled) {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.g-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.g-btn.active,
.g-btn[aria-pressed="true"] {
  color: #ddd8ff;
  background: rgba(139, 123, 255, 0.2);
  border-color: rgba(139, 123, 255, 0.34);
}

.g-btn.g-text {
  font-family: var(--mono);
  font-size: 10.5px;
  padding: 0 8px;
}

.g-sep {
  width: 1px;
  height: 18px;
  margin: 0 2px;
  background: var(--line);
  flex: none;
}

.sel-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  margin-left: 4px;
  padding: 0 6px 0 9px;
  border-radius: 7px;
  border: 1px solid rgba(89, 225, 208, 0.3);
  background: rgba(89, 225, 208, 0.12);
  color: #b2f5ec;
  font-size: 11px;
  font-weight: 550;
  max-width: 165px;
}

.sel-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sel-chip button {
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: inherit;
  font-size: 14px;
  line-height: 1;
  padding: 0;
}

.sel-chip button:hover {
  background: rgba(255, 255, 255, 0.14);
}

/* ----------------------------------------------------------- editor panel */

.editor-panel {
  display: none;
  flex-direction: column;
  min-height: 0;
  background:
    radial-gradient(120% 50% at 100% 0%, rgba(89, 225, 208, 0.05), transparent 60%),
    var(--panel);
  border-left: 1px solid var(--line);
  z-index: 20;
}

.app.editing .editor-panel {
  display: flex;
}

.ed-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--line);
}

.ed-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.ed-title h3 {
  margin: 0;
  font-size: 14.5px;
  font-weight: 650;
  letter-spacing: -0.015em;
}

.ed-badge {
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(89, 225, 208, 0.14);
  border: 1px solid rgba(89, 225, 208, 0.35);
  color: var(--accent-2);
  font-size: 9.5px;
  font-weight: 620;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.ed-head-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ed-close {
  display: none !important;
}

.ed-mini-btn {
  height: 27px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 11px;
  font-weight: 580;
  transition: all 0.15s ease;
}

.ed-mini-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
}

.ed-mini-btn.primary {
  color: #fff;
  border-color: rgba(139, 123, 255, 0.5);
  background: rgba(139, 123, 255, 0.28);
}

.ed-mini-btn.primary:hover {
  background: rgba(139, 123, 255, 0.42);
}

.ed-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 3px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.14);
}

.ed-tab {
  height: 30px;
  padding: 0 4px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.ed-tab:hover {
  color: var(--text);
}

.ed-tab.active {
  color: #e4e0ff;
  background: var(--accent-soft);
  border-color: rgba(139, 123, 255, 0.35);
}

.ed-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 14px 20px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.13) transparent;
}

.ed-sec {
  padding-bottom: 14px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.ed-sec:last-child {
  border-bottom: 0;
  margin-bottom: 0;
  padding-bottom: 0;
}

.ed-sec-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 9px;
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted-2);
}

.ed-hint,
.ed-target,
.ed-note {
  font-size: 10px;
  letter-spacing: 0;
  text-transform: none;
  color: var(--muted);
  max-width: 145px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ed-note {
  color: var(--accent-2);
}

/* Outliner */

.outliner-list {
  max-height: 175px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.22);
  padding: 4px;
  scrollbar-width: thin;
}

.out-row {
  display: flex;
  align-items: center;
  gap: 4px;
  border-radius: 7px;
  padding-right: 4px;
}

.out-row:hover {
  background: rgba(255, 255, 255, 0.04);
}

.out-row.active {
  background: rgba(139, 123, 255, 0.18);
}

.out-row.hidden-part .out-name {
  opacity: 0.45;
  text-decoration: line-through;
}

.out-select {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  height: 28px;
  padding: 0 7px;
  border: 0;
  background: transparent;
  text-align: left;
  font-size: 11.5px;
}

.out-dot {
  width: 6px;
  height: 6px;
  border-radius: 2px;
  background: var(--muted-2);
  flex: none;
}

.out-dot.root {
  background: var(--accent-2);
  border-radius: 50%;
}

.out-row.active .out-dot {
  background: var(--accent);
}

.out-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.out-tris {
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--muted-2);
}

.out-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.out-btn {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted-2);
  padding: 0;
}

.out-btn svg {
  width: 13px;
  height: 13px;
}

.out-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
}

.out-btn.danger:hover {
  color: var(--danger);
}

/* Kitbash & chips */

.kitbash-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 8px;
}

.ed-chip {
  height: 27px;
  padding: 0 9px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.035);
  color: #cfd5e2;
  font-size: 11px;
  font-weight: 550;
  transition: all 0.14s ease;
}

.ed-chip:hover {
  color: #fff;
  border-color: var(--line-strong);
  background: rgba(139, 123, 255, 0.16);
}

/* Vector3 inputs */

.vec-group {
  margin-bottom: 9px;
}

.vec-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.vec-label {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
}

.vec-label-row .vec-label {
  margin-bottom: 0;
}

.lock-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 20px;
  padding: 0 7px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted-2);
  font-size: 10px;
}

.lock-btn svg {
  width: 11px;
  height: 11px;
}

.lock-btn[aria-pressed="true"] {
  color: #d6d0ff;
  border-color: rgba(139, 123, 255, 0.4);
  background: var(--accent-soft);
}

.vec3-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
}

.num-field {
  display: flex;
  align-items: center;
  height: 29px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  overflow: hidden;
}

.num-field:focus-within {
  border-color: rgba(139, 123, 255, 0.5);
}

.num-field .ax {
  width: 18px;
  height: 100%;
  display: grid;
  place-items: center;
  font-style: normal;
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.03);
}

.num-field .ax.x { color: #ff7b8a; }
.num-field .ax.y { color: #67e89d; }
.num-field .ax.z { color: #78b6ff; }

.num-field input {
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 0 5px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text);
  outline: none;
}

.num-field input::-webkit-inner-spin-button {
  opacity: 0.4;
}

.ed-btn-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 8px;
}

/* Material & Controls */

.mat-slot-row {
  display: flex;
  gap: 6px;
}

.ed-select {
  width: 100%;
  height: 31px;
  padding: 0 8px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 11.5px;
  outline: none;
}

.ed-select.compact {
  width: auto;
  min-width: 132px;
  height: 28px;
  font-size: 11px;
}

.ed-select option {
  background: #141820;
  color: var(--text);
}

.preset-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
}

.preset-pill {
  height: 27px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 560;
}

.preset-pill:hover {
  color: #fff;
  border-color: rgba(139, 123, 255, 0.45);
  background: rgba(139, 123, 255, 0.16);
}

.prop-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 9px;
  font-size: 11.5px;
  color: var(--muted);
}

.color-combo {
  display: flex;
  align-items: center;
  gap: 6px;
}

input[type="color"] {
  width: 30px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: transparent;
  cursor: pointer;
}

input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 2px;
}

input[type="color"]::-webkit-color-swatch {
  border: 0;
  border-radius: 4px;
}

.hex-inp {
  width: 72px;
  height: 26px;
  padding: 0 7px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  font-size: 11px;
  outline: none;
}

.slider-row {
  margin-bottom: 9px;
}

.slider-head {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 2px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: #cfd5e2;
  margin-bottom: 7px;
  cursor: pointer;
}

.check-row[hidden] {
  display: none;
}

.check-row input[type="checkbox"] {
  accent-color: var(--accent);
  width: 14px;
  height: 14px;
  margin: 0;
}

.check-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin: 6px 0 8px;
}

.ed-btn {
  width: 100%;
  height: 32px;
  border-radius: 9px;
  border: 1px solid rgba(139, 123, 255, 0.42);
  background: rgba(139, 123, 255, 0.2);
  color: #ece9ff;
  font-size: 11.5px;
  font-weight: 600;
  transition: all 0.15s ease;
}

.ed-btn:hover:not(:disabled) {
  background: rgba(139, 123, 255, 0.32);
}

.ed-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.ed-btn.primary {
  background: linear-gradient(145deg, rgba(139, 123, 255, 0.48), rgba(89, 225, 208, 0.22));
  border-color: rgba(139, 123, 255, 0.6);
  color: #fff;
}

.ed-btn.subtle {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
}

.ed-btn.subtle:hover:not(:disabled) {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
}

/* Before/After Compare Card */

.compare-card {
  padding: 10px 11px;
  margin-bottom: 14px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.24);
}

.compare-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 9.5px;
  font-weight: 650;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin-bottom: 8px;
}

.savings-badge {
  padding: 2px 6px;
  border-radius: 5px;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0;
  text-transform: none;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
}

.savings-badge.positive {
  background: rgba(89, 225, 208, 0.14);
  border: 1px solid rgba(89, 225, 208, 0.3);
  color: var(--accent-2);
}

.compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 10px;
  margin: 0;
}

.compare-grid dt {
  font-size: 9.5px;
  color: var(--muted-2);
}

.compare-grid dd {
  margin: 2px 0 0;
  font-size: 11px;
  color: #e4e8f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Rig & Animate Panel */

.rig-overlay-row {
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid var(--line);
}

.bone-list {
  max-height: 155px;
}

.bone-row {
  display: flex;
  align-items: center;
}

.bone-indent {
  flex: none;
  display: inline-block;
  height: 1px;
}

.out-dot.bone {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-2);
}

.empty-list.compact {
  padding: 14px 10px;
  font-size: 11px;
}

.kf-clip-row {
  margin-bottom: 9px;
}

.kf-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 9px;
}

.kf-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 6px 0 8px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: #d6dce8;
  font-family: var(--mono);
  font-size: 10px;
}

.kf-chip:hover {
  border-color: rgba(139, 123, 255, 0.45);
  background: rgba(139, 123, 255, 0.16);
}

.kf-chip-jump {
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.kf-chip-del {
  display: grid;
  place-items: center;
  width: 15px;
  height: 15px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted-2);
  font-size: 12px;
  line-height: 1;
  padding: 0;
  cursor: pointer;
}

.kf-chip-del:hover {
  color: var(--danger);
  background: rgba(255, 107, 129, 0.16);
}

/* Offscreen mode used to render the sidebar thumbnails */
body.thumb-mode .sidebar,
body.thumb-mode .topbar,
body.thumb-mode .gizmo-bar,
body.thumb-mode .editor-panel,
body.thumb-mode .stats,
body.thumb-mode .anim-panel,
body.thumb-mode .hint,
body.thumb-mode .loader,
body.thumb-mode .dropzone,
body.thumb-mode .toast,
body.thumb-mode .stage::after {
  display: none !important;
}

body.thumb-mode {
  background: radial-gradient(60% 60% at 50% 42%, #1d2331 0%, #12161e 52%, #0b0e14 100%);
}

body.thumb-mode .app,
body.thumb-mode .app.editing {
  grid-template-columns: minmax(0, 1fr);
}

body.thumb-mode .stage,
body.thumb-mode .backdrop {
  background: transparent;
}

body.thumb-mode .backdrop::after {
  display: none;
}
