:root {
  color-scheme: dark;
  --bg: #080c18;
  --surface: #101727;
  --surface-2: #151e30;
  --surface-3: #1b263b;
  --line: rgba(173, 190, 220, 0.14);
  --line-strong: rgba(173, 190, 220, 0.26);
  --text: #f4f7fb;
  --muted: #97a6bd;
  --dim: #66738a;
  --accent: #73e6c2;
  --accent-2: #5bb7ff;
  --accent-ink: #061611;
  --danger: #ff7f91;
  --x: #ff7d8e;
  --y: #75dc9b;
  --z: #68a9ff;
  --radius: 16px;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
  background:
    radial-gradient(circle at 18% -10%, rgba(91, 183, 255, 0.12), transparent 30rem),
    radial-gradient(circle at 88% 0%, rgba(115, 230, 194, 0.08), transparent 28rem),
    var(--bg);
  color: var(--text);
}

body {
  min-width: 320px;
}

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

button,
label[for] {
  -webkit-tap-highlight-color: transparent;
}

button {
  border: 0;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
label[for]:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  min-height: 70px;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(8, 12, 24, 0.84);
  backdrop-filter: blur(18px);
}

.brand,
.topbar-actions,
.document-meta,
.mode-switch button,
.quick-export,
.panel-heading,
.stage-toolbar,
.channel-heading,
.inspector-heading,
.timeline-toolbar,
.duration-input,
.time-labels,
.canvas-legend {
  display: flex;
  align-items: center;
}

.brand {
  gap: 12px;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  letter-spacing: -0.015em;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.72rem;
}

.brand-mark {
  position: relative;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(115, 230, 194, 0.45);
  border-radius: 10px;
  background: linear-gradient(145deg, rgba(115, 230, 194, 0.18), rgba(91, 183, 255, 0.07));
}

.brand-mark span {
  position: absolute;
  left: 15px;
  width: 3px;
  border-radius: 3px;
  background: var(--accent);
}

.brand-mark span:nth-child(1) {
  top: 6px;
  height: 7px;
}

.brand-mark span:nth-child(2) {
  top: 14px;
  left: 9px;
  width: 15px;
  height: 3px;
}

.brand-mark span:nth-child(3) {
  top: 18px;
  height: 10px;
}

.topbar-actions {
  gap: 9px;
}

.button {
  display: inline-flex;
  min-height: 40px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 0.84rem;
  font-weight: 720;
  text-decoration: none;
  transition: 150ms ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.button.primary {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 8px 28px rgba(115, 230, 194, 0.14);
}

.button.primary:hover:not(:disabled) {
  background: #8af0d0;
}

.button.secondary {
  border-color: var(--line-strong);
  background: var(--surface-2);
}

.button.secondary:hover:not(:disabled),
.button.ghost:hover:not(:disabled) {
  border-color: rgba(115, 230, 194, 0.38);
  background: var(--surface-3);
}

.button.ghost {
  border-color: var(--line);
  background: transparent;
}

.button.large {
  min-height: 50px;
  padding: 0 21px;
  border-radius: 12px;
}

.button.compact {
  min-height: 34px;
  padding: 0 12px;
}

.button.full {
  width: 100%;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

.welcome {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 84px 0 60px;
}

.welcome-copy {
  width: min(780px, 100%);
  margin: 0 auto 54px;
  text-align: center;
}

.eyebrow {
  color: var(--accent);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.17em;
}

.welcome h1 {
  max-width: 740px;
  margin: 14px auto 20px;
  font-size: clamp(2.55rem, 6vw, 5rem);
  font-weight: 760;
  letter-spacing: -0.058em;
  line-height: 0.98;
}

.welcome-copy > p {
  max-width: 690px;
  margin: 0 auto;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.17rem);
  line-height: 1.7;
}

.welcome-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 32px;
}

.drop-zone {
  display: flex;
  min-height: 255px;
  cursor: pointer;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  border: 1px dashed rgba(115, 230, 194, 0.37);
  border-radius: 24px;
  background:
    linear-gradient(135deg, rgba(115, 230, 194, 0.055), transparent 42%),
    var(--surface);
  box-shadow: var(--shadow);
  transition: 180ms ease;
}

.drop-zone:hover,
.drop-zone.active {
  border-color: var(--accent);
  background-color: var(--surface-2);
  transform: translateY(-2px);
}

.drop-zone strong {
  margin-top: 24px;
  font-size: 1.05rem;
}

.drop-zone > span {
  margin-top: 7px;
  color: var(--muted);
  font-size: 0.82rem;
}

.drop-illustration {
  display: flex;
  align-items: center;
  gap: 18px;
}

.source-file-cards {
  display: flex;
  align-items: center;
}

.source-file-cards .file-card + .file-card {
  margin-left: -18px;
}

.file-card {
  display: grid;
  width: 82px;
  height: 96px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  color: var(--accent-2);
  background: var(--surface-3);
  font-size: 0.75rem;
  font-weight: 850;
  letter-spacing: 0.12em;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.24);
}

.file-card.anim {
  color: var(--accent);
  transform: rotate(3deg);
}

.file-card.xml {
  transform: rotate(-3deg);
}

.file-card.bvh {
  color: #d7a7ff;
  transform: translateY(5px) rotate(3deg);
}

.transfer-arrow {
  color: var(--dim);
  font-size: 1.5rem;
}

.preflight {
  display: grid;
  align-items: start;
  margin-top: 34px;
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(16, 23, 39, 0.74);
  grid-template-columns: 0.8fr 1.6fr;
  gap: 40px;
}

.file-help {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(16, 23, 39, 0.72);
}

.file-help summary {
  display: grid;
  min-height: 68px;
  cursor: pointer;
  align-items: center;
  padding: 10px 18px;
  grid-template-columns: 34px 1fr auto;
  gap: 11px;
  list-style: none;
}

.file-help summary::-webkit-details-marker {
  display: none;
}

.help-icon {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid rgba(91, 183, 255, 0.35);
  border-radius: 9px;
  color: var(--accent-2);
  background: rgba(91, 183, 255, 0.08);
  font-size: 0.78rem;
  font-weight: 850;
}

.file-help summary strong,
.file-help summary small {
  display: block;
}

.file-help summary strong {
  font-size: 0.82rem;
}

.file-help summary small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.68rem;
}

.summary-chevron {
  color: var(--muted);
  transition: transform 150ms ease;
}

.file-help[open] .summary-chevron {
  transform: rotate(180deg);
}

.path-grid {
  display: grid;
  padding: 4px 18px 14px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.path-card {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
}

.os-name {
  display: block;
  margin-bottom: 7px;
  color: var(--accent);
  font-size: 0.63rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.path-card code {
  display: block;
  overflow-x: auto;
  color: #c8d4e6;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.68rem;
  line-height: 1.55;
  scrollbar-width: thin;
  white-space: nowrap;
}

.file-help > p {
  margin: 0;
  padding: 0 18px 16px 63px;
  color: var(--muted);
  font-size: 0.69rem;
  line-height: 1.5;
}

.preflight h2 {
  margin: 8px 0 0;
  font-size: 1.55rem;
  letter-spacing: -0.03em;
}

.preflight ol {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.preflight li {
  display: flex;
  gap: 12px;
}

.preflight li > span {
  display: grid;
  flex: 0 0 28px;
  height: 28px;
  place-items: center;
  border: 1px solid rgba(115, 230, 194, 0.35);
  border-radius: 50%;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 800;
}

.preflight strong {
  font-size: 0.85rem;
}

.preflight p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.5;
}

.editor-page {
  padding: 18px;
}

.document-bar {
  display: grid;
  min-height: 72px;
  align-items: center;
  margin-bottom: 14px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(16, 23, 39, 0.84);
  grid-template-columns: minmax(220px, 1fr) auto minmax(330px, 1fr);
  gap: 16px;
}

.document-meta {
  min-width: 0;
  gap: 10px;
}

.document-meta > div {
  min-width: 0;
}

.document-meta strong,
.document-meta small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.document-tools,
.history-controls {
  display: flex;
  align-items: center;
}

.document-tools {
  gap: 8px;
}

.history-controls {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--bg);
}

.history-controls button {
  display: grid;
  width: 34px;
  height: 38px;
  cursor: pointer;
  place-items: center;
  border-right: 1px solid var(--line);
  color: var(--muted);
  background: transparent;
  font-size: 1.05rem;
}

.history-controls button:last-child {
  border-right: 0;
}

.history-controls button:hover:not(:disabled) {
  color: var(--text);
  background: var(--surface-3);
}

.history-controls button:disabled {
  cursor: default;
  color: var(--dim);
  opacity: 0.45;
}

.document-meta strong {
  font-size: 0.86rem;
}

.document-meta small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.7rem;
}

.status-dot {
  flex: 0 0 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 5px rgba(115, 230, 194, 0.08);
}

.mode-switch {
  display: flex;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
}

.mode-switch button {
  min-width: 126px;
  cursor: pointer;
  justify-content: center;
  gap: 9px;
  padding: 7px 12px;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
}

.mode-switch button.active {
  color: var(--text);
  background: var(--surface-3);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.18);
}

.mode-switch strong,
.mode-switch small {
  display: block;
  text-align: left;
}

.mode-switch strong {
  font-size: 0.76rem;
}

.mode-switch small {
  margin-top: 1px;
  font-size: 0.58rem;
}

.mode-icon {
  color: var(--accent);
  font-size: 0.72rem;
}

.mode-icon.keyframes {
  color: var(--accent-2);
  font-size: 0.55rem;
  word-spacing: 3px;
}

.quick-export {
  justify-content: flex-end;
  gap: 12px;
}

.quick-export > label:not(.compact-check) {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 0.7rem;
}

.position-policy select {
  min-width: 112px;
}

select,
.duration-input input {
  min-height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface-3);
}

select {
  padding: 0 26px 0 9px;
}

.compact-check {
  display: flex;
  cursor: pointer;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.7rem;
}

.compact-check input {
  accent-color: var(--accent);
}

.workspace {
  display: grid;
  min-height: calc(100vh - 177px);
  grid-template-columns: 248px minmax(390px, 1fr) 310px;
  gap: 14px;
}

.panel,
.stage-card,
.timeline-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(16, 23, 39, 0.9);
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.16);
}

.panel {
  min-height: 0;
  overflow: hidden;
}

.panel-heading,
.stage-toolbar,
.timeline-toolbar {
  justify-content: space-between;
}

.panel-heading {
  padding: 20px 18px 14px;
}

.panel h2,
.stage-toolbar h2 {
  margin: 4px 0 0;
  font-size: 1rem;
  letter-spacing: -0.02em;
}

.count-badge {
  display: grid;
  min-width: 27px;
  height: 27px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--surface-2);
  font-size: 0.68rem;
}

.search-box {
  display: flex;
  align-items: center;
  margin: 0 13px 10px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--dim);
  background: var(--bg);
}

.search-box input {
  width: 100%;
  min-height: 38px;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 0.78rem;
}

.search-box input::placeholder {
  color: var(--dim);
}

.filter-row {
  display: grid;
  margin: 0 13px 10px;
  padding: 3px;
  border-radius: 8px;
  background: var(--bg);
  grid-template-columns: 1fr 1fr;
}

.filter-row button,
.segmented button {
  cursor: pointer;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-size: 0.68rem;
  font-weight: 700;
}

.filter-row button {
  min-height: 30px;
}

.filter-row button.active,
.segmented button.active {
  color: var(--text);
  background: var(--surface-3);
}

.joint-list {
  height: calc(100vh - 345px);
  min-height: 340px;
  overflow-y: auto;
  padding: 0 8px 14px;
  scrollbar-color: var(--line-strong) transparent;
  scrollbar-width: thin;
}

.joint-row {
  display: grid;
  width: 100%;
  min-height: 38px;
  cursor: pointer;
  align-items: center;
  padding: 0 9px;
  border-radius: 8px;
  background: transparent;
  grid-template-columns: 8px 1fr auto;
  gap: 9px;
  text-align: left;
}

.joint-row:hover {
  background: rgba(255, 255, 255, 0.035);
}

.joint-row.selected {
  background: rgba(115, 230, 194, 0.1);
}

.joint-row.inactive {
  color: var(--muted);
}

.joint-led {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(115, 230, 194, 0.5);
}

.joint-row.inactive .joint-led {
  border: 1px solid var(--dim);
  background: transparent;
  box-shadow: none;
}

.joint-name {
  overflow: hidden;
  font-size: 0.73rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.channel-pips {
  display: flex;
  gap: 3px;
}

.channel-pips span {
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--dim);
  font-size: 0.54rem;
  font-weight: 800;
}

.channel-pips span.enabled {
  border-color: rgba(115, 230, 194, 0.25);
  color: var(--accent);
  background: rgba(115, 230, 194, 0.07);
}

.empty-list {
  padding: 26px 15px;
  color: var(--dim);
  font-size: 0.72rem;
  text-align: center;
}

.stage-column {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 14px;
}

.stage-card {
  display: flex;
  min-height: 620px;
  flex: 1 1 auto;
  flex-direction: column;
  overflow: hidden;
}

.stage-toolbar {
  min-height: 68px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--line);
}

.stage-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tool-toggle {
  min-height: 37px;
  cursor: pointer;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--bg);
  font-size: 0.68rem;
  font-weight: 700;
}

.tool-toggle:hover,
.tool-toggle.active {
  border-color: var(--line-strong);
  color: var(--text);
}

.tool-toggle.active {
  box-shadow: inset 0 -2px var(--accent);
}

.rig-visibility {
  position: relative;
}

.rig-visibility > summary {
  display: flex;
  min-height: 37px;
  cursor: pointer;
  align-items: center;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--bg);
  gap: 6px;
  font-size: 0.68rem;
  font-weight: 700;
  list-style: none;
}

.rig-visibility > summary::-webkit-details-marker {
  display: none;
}

.rig-visibility > summary:hover,
.rig-visibility[open] > summary {
  border-color: var(--line-strong);
  color: var(--text);
}

.rig-visibility > summary i {
  display: grid;
  min-width: 17px;
  height: 17px;
  place-items: center;
  border-radius: 9px;
  color: var(--accent-ink);
  background: var(--accent);
  font-size: 0.56rem;
  font-style: normal;
}

.rig-visibility-menu {
  position: absolute;
  z-index: 15;
  top: calc(100% + 8px);
  right: 0;
  width: 250px;
  padding: 10px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: #121b2d;
  box-shadow: var(--shadow);
}

.visibility-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  margin-bottom: 8px;
  padding: 2px 3px 9px;
  border-bottom: 1px solid var(--line);
  gap: 10px;
}

.visibility-heading strong,
.visibility-heading small {
  display: block;
}

.visibility-heading strong {
  font-size: 0.75rem;
}

.visibility-heading small {
  margin-top: 3px;
  color: var(--dim);
  font-size: 0.58rem;
  white-space: nowrap;
}

.visibility-heading button {
  cursor: pointer;
  padding: 3px;
  color: var(--accent);
  background: transparent;
  font-size: 0.62rem;
  font-weight: 700;
  white-space: nowrap;
}

.rig-visibility-menu > label {
  display: flex;
  min-height: 31px;
  cursor: pointer;
  align-items: center;
  padding: 0 6px;
  border-radius: 7px;
  color: var(--muted);
  gap: 8px;
  font-size: 0.7rem;
}

.rig-visibility-menu > label:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.035);
}

.rig-visibility-menu input {
  accent-color: var(--accent);
}

.segmented {
  display: flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
}

.segmented button {
  min-height: 29px;
  padding: 0 11px;
}

.skeleton-canvas {
  position: relative;
  display: grid;
  flex: 1;
  min-height: 550px;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(circle at center, rgba(91, 183, 255, 0.045), transparent 42%),
    linear-gradient(rgba(255, 255, 255, 0.012) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.012) 1px, transparent 1px);
  background-size: auto, 28px 28px, 28px 28px;
}

.skeleton-canvas svg {
  width: min(100%, 580px);
  max-height: 630px;
  overflow: visible;
  touch-action: none;
  user-select: none;
}

.orbit-hit-area {
  cursor: default;
  fill: transparent;
}

svg.orbit .orbit-hit-area {
  cursor: grab;
}

svg.orbit .orbit-hit-area:active {
  cursor: grabbing;
}

.skeleton-grid line {
  stroke: rgba(173, 190, 220, 0.07);
  stroke-dasharray: 4 7;
  stroke-width: 1;
}

.bone-lines line {
  stroke: rgba(151, 166, 189, 0.28);
  stroke-linecap: round;
  stroke-width: 1.35;
  transition: stroke 150ms ease;
}

.bone-lines line.active {
  stroke: rgba(115, 230, 194, 0.82);
  stroke-width: 2;
}

.bone-node {
  cursor: pointer;
}

.bone-node circle {
  fill: #657187;
  stroke: rgba(8, 12, 24, 0.9);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
  transition: 120ms ease;
}

.bone-node:hover circle {
  fill: var(--text);
  r: 5px;
}

.bone-node.active circle {
  fill: var(--accent);
  filter: drop-shadow(0 0 5px rgba(115, 230, 194, 0.65));
}

.bone-node.selected circle {
  fill: var(--accent-2);
  stroke: white;
  stroke-width: 1.5;
  filter: drop-shadow(0 0 8px rgba(91, 183, 255, 0.72));
}

.rotation-gizmo {
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.42));
}

.gizmo-center {
  fill: var(--text);
  stroke: var(--accent-2);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

.gizmo-axis {
  cursor: ew-resize;
}

.gizmo-hit {
  fill: none;
  pointer-events: stroke;
  stroke: transparent;
  stroke-width: 14;
}

.gizmo-ring {
  fill: none;
  pointer-events: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 2.2;
  vector-effect: non-scaling-stroke;
}

.gizmo-axis:hover .gizmo-ring {
  stroke-width: 4;
}

.gizmo-axis text {
  pointer-events: none;
  fill: currentColor;
  font-size: 10px;
  font-weight: 900;
  paint-order: stroke;
  stroke: var(--bg);
  stroke-width: 3px;
  text-anchor: middle;
}

.gizmo-x {
  color: var(--x);
}

.gizmo-y {
  color: var(--y);
}

.gizmo-z {
  color: var(--z);
}

.canvas-legend {
  position: absolute;
  right: 16px;
  bottom: 14px;
  gap: 13px;
  color: var(--dim);
  font-size: 0.62rem;
}

.canvas-legend .orbit-help {
  color: var(--muted);
}

.canvas-legend span {
  display: flex;
  align-items: center;
  gap: 5px;
}

.canvas-legend i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #657187;
}

.canvas-legend i.active {
  background: var(--accent);
}

.inspector {
  padding: 18px;
  overflow-y: auto;
}

.inspector-heading {
  justify-content: space-between;
  min-height: 54px;
  margin-bottom: 18px;
}

.inspector-heading h2 {
  overflow: hidden;
  max-width: 225px;
  margin: 4px 0 2px;
  font-size: 1.18rem;
  letter-spacing: -0.025em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inspector-heading small {
  color: var(--muted);
  font-size: 0.67rem;
}

.joint-priority {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
  gap: 12px;
}

.joint-priority strong,
.joint-priority small {
  display: block;
}

.joint-priority strong {
  font-size: 0.76rem;
}

.joint-priority small {
  margin-top: 3px;
  color: var(--dim);
  font-size: 0.58rem;
  line-height: 1.4;
}

.icon-button {
  display: grid;
  width: 30px;
  height: 30px;
  cursor: pointer;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--surface-2);
  font-size: 1rem;
}

.icon-button:hover {
  color: var(--text);
}

.icon-button.danger:hover {
  border-color: rgba(255, 127, 145, 0.4);
  color: var(--danger);
}

.channel-card {
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
}

.channel-card.disabled {
  opacity: 0.62;
}

.channel-heading {
  justify-content: space-between;
  gap: 12px;
}

.channel-heading h3 {
  margin: 0;
  font-size: 0.8rem;
}

.channel-heading p {
  margin: 3px 0 0;
  color: var(--dim);
  font-size: 0.6rem;
  line-height: 1.4;
}

.switch {
  position: relative;
  flex: 0 0 34px;
  height: 20px;
  cursor: pointer;
}

.switch input {
  position: absolute;
  opacity: 0;
}

.switch span {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--surface-3);
  transition: 140ms ease;
}

.switch span::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--muted);
  content: "";
  transition: 140ms ease;
}

.switch input:checked + span {
  background: rgba(115, 230, 194, 0.22);
}

.switch input:checked + span::after {
  background: var(--accent);
  transform: translateX(14px);
}

.vector-grid {
  display: grid;
  margin-top: 13px;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}

.axis {
  position: relative;
  display: grid;
  align-items: center;
  grid-template-columns: 17px 1fr 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
}

.axis > span {
  font-size: 0.62rem;
  font-weight: 900;
  text-align: center;
}

.axis-x > span {
  color: var(--x);
}

.axis-y > span {
  color: var(--y);
}

.axis-z > span {
  color: var(--z);
}

.axis input {
  width: 100%;
  min-width: 0;
  height: 34px;
  padding: 0 2px;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
  font-size: 0.67rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
  -moz-appearance: textfield;
}

.axis input::-webkit-inner-spin-button,
.axis input::-webkit-outer-spin-button {
  margin: 0;
  -webkit-appearance: none;
}

.axis small {
  color: var(--dim);
  font-size: 0.58rem;
}

.inactive-callout,
.empty-inspector {
  padding: 18px;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  text-align: center;
}

.inactive-callout strong {
  font-size: 0.82rem;
}

.inactive-callout p,
.empty-inspector p {
  margin: 5px 0 14px;
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.5;
}

.empty-inspector {
  margin-top: 30px;
}

.empty-inspector > span {
  color: var(--accent);
  font-size: 2rem;
}

.empty-inspector h2 {
  margin: 10px 0 0;
}

.timeline-card {
  overflow: hidden;
}

.timeline-toolbar {
  min-height: 54px;
  padding: 9px 13px;
  border-bottom: 1px solid var(--line);
}

.timeline-toolbar > div:first-child strong {
  display: block;
  margin-top: 3px;
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}

.duration-input {
  gap: 6px;
  color: var(--muted);
  font-size: 0.65rem;
}

.duration-input input {
  width: 70px;
  padding: 0 7px;
  font-size: 0.7rem;
}

.duration-input small {
  color: var(--dim);
}

.scrubber {
  padding: 10px 16px 6px 132px;
  border-bottom: 1px solid var(--line);
}

.scrubber input {
  width: 100%;
  height: 4px;
  accent-color: var(--accent-2);
}

.time-labels {
  justify-content: space-between;
  color: var(--dim);
  font-size: 0.56rem;
}

.track-list {
  max-height: 250px;
  overflow-y: auto;
  padding: 6px 10px;
}

.track-row {
  display: grid;
  min-height: 28px;
  align-items: center;
  grid-template-columns: 112px 1fr;
  gap: 10px;
}

.track-name {
  overflow: hidden;
  cursor: pointer;
  color: var(--muted);
  background: transparent;
  font-size: 0.64rem;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.track-name:hover {
  color: var(--text);
}

.track-lane {
  position: relative;
  height: 19px;
  border-bottom: 1px solid rgba(173, 190, 220, 0.08);
  background-image: linear-gradient(90deg, rgba(173, 190, 220, 0.06) 1px, transparent 1px);
  background-size: 10% 100%;
}

.key-dot {
  position: absolute;
  top: 6px;
  width: 8px;
  height: 8px;
  cursor: pointer;
  border: 1px solid var(--bg);
  background: var(--accent-2);
  transform: translateX(-50%) rotate(45deg);
}

.key-dot.position {
  background: var(--accent);
}

.key-dot.selected {
  box-shadow: 0 0 0 2px var(--text);
}

.timeline-hint {
  margin: 0;
  padding: 8px 14px 10px;
  border-top: 1px solid var(--line);
  color: var(--dim);
  font-size: 0.58rem;
  text-align: center;
}

.toast {
  position: fixed;
  z-index: 50;
  right: 22px;
  bottom: 22px;
  display: flex;
  max-width: min(430px, calc(100vw - 44px));
  min-height: 50px;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 9px 10px 9px 15px;
  border: 1px solid rgba(115, 230, 194, 0.32);
  border-radius: 12px;
  background: #17243a;
  box-shadow: var(--shadow);
  font-size: 0.76rem;
}

.toast.error {
  border-color: rgba(255, 127, 145, 0.44);
}

.drop-overlay {
  position: fixed;
  z-index: 100;
  display: grid;
  pointer-events: none;
  opacity: 0;
  inset: 0;
  place-items: center;
  background: rgba(5, 8, 16, 0.82);
  backdrop-filter: blur(8px);
  transition: opacity 120ms ease;
}

.app-shell.dragging .drop-overlay {
  opacity: 1;
}

.drop-overlay-card {
  display: flex;
  width: min(430px, calc(100vw - 40px));
  min-height: 220px;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  border: 2px dashed var(--accent);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.drop-overlay-card .drop-icon {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  margin-bottom: 16px;
  border-radius: 50%;
  color: var(--accent-ink);
  background: var(--accent);
  font-size: 1.6rem;
}

.drop-overlay-card strong {
  font-size: 1.35rem;
}

.drop-overlay-card span:last-child {
  margin-top: 7px;
  color: var(--muted);
  font-size: 0.75rem;
}

@media (max-width: 1100px) {
  .document-bar {
    grid-template-columns: 1fr auto;
  }

  .quick-export {
    display: none;
  }

  .workspace {
    grid-template-columns: 220px minmax(370px, 1fr);
  }

  .inspector {
    grid-column: 1 / -1;
    min-height: auto;
  }
}

@media (max-width: 760px) {
  .topbar {
    padding: 0 14px;
  }

  .brand small,
  .topbar-actions .secondary {
    display: none;
  }

  .welcome {
    width: min(100% - 24px, 1180px);
    padding-top: 54px;
  }

  .welcome h1 {
    font-size: clamp(2.4rem, 13vw, 4rem);
  }

  .preflight {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .preflight ol {
    grid-template-columns: 1fr;
  }

  .path-grid {
    grid-template-columns: 1fr;
  }

  .file-help > p {
    padding-left: 18px;
  }

  .editor-page {
    padding: 10px;
  }

  .document-bar {
    grid-template-columns: 1fr;
  }

  .mode-switch {
    width: 100%;
  }

  .document-tools {
    width: 100%;
  }

  .document-tools .mode-switch {
    flex: 1;
  }

  .mode-switch button {
    flex: 1;
    min-width: 0;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .joint-list {
    height: 260px;
    min-height: 260px;
  }

  .stage-card {
    min-height: 540px;
  }

  .skeleton-canvas {
    min-height: 460px;
  }

  .timeline-toolbar {
    flex-wrap: wrap;
    gap: 8px;
  }

  .scrubber {
    padding-left: 20px;
  }

  .track-row {
    grid-template-columns: 84px 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
