:root {
  --bg: #030407;
  --bg-soft: #090c12;
  --panel: #0a0d13;
  --panel-4: #13203a;
  --panel-5: #0d172d;
  --line: rgba(255, 255, 255, 0.1);
  --line-strong: rgba(255, 255, 255, 0.2);
  --line-stronger: rgba(255, 255, 255, 0.2);
  --overlay-05: rgba(255, 255, 255, 0.05);
  --overlay-10: rgba(255, 255, 255, 0.1);
  --overlay-black: #000000;
  --layer-fallback: rgba(255, 255, 255, 0.2);
  --text: #f5f7fb;
  --text-on-light: #09090b;
  --text-warm: #fff7ed;
  --muted: #97a0b2;
  --accent: #ff5d32;
  --accent-strong: #e51f5e;
  --accent-rgb: 255, 93, 50;
  --accent-strong-rgb: 229, 31, 94;
  --accent-soft: rgba(255, 93, 50, 0.2);
  --gold-light: #fff2c8;
  --gold-mid: #ead0a2;
  --gold-dark: #c79762;
  --gold-deep: #a56126;
  --brand-gradient: linear-gradient(135deg, #ff5d32 0%, #e51f5e 100%);
  --gold-gradient: linear-gradient(135deg, #fff2c8 0%, #ead0a2 35%, #c79762 68%, #a56126 100%);
  --surface-contrast: #263453;
  --surface-contrast-deep: #090b0f;
  --surface-track: #404a60;
  --surface-switch: #495268;
  --surface-thumb: #ffffff;
  --surface-editor: #0d1424;
  --surface-panel: #0a0b0e;
  --surface-panel-deep: #06070a;
  --surface-sidebar: #0e121c;
  --surface-sidebar-deep: #09101a;
  --surface-stage: #0c0f18;
  --surface-stage-deep: #05080e;
  --success: #22c55e;
  --success-strong: #16a34a;
  --success-soft-text: #6ee7b7;
  --teal: #14b8a6;
  --teal-light: #2dd4bf;
  --violet: #7c3aed;
  --violet-light: #8b5cf6;
  --violet-soft: #a78bfa;
  --rose-soft-text: #fda4af;
  --gold-soft-text: #fcd34d;
  --blue: #3b82f6;
  --blue-soft: rgba(96, 165, 250, 0.2);
  --blue-glow: rgba(59, 130, 246, 0.2);
  --danger: #ef4444;
  --shadow: 0 1.5rem 3rem rgba(0, 0, 0, 0.35);
  --radius-xl: 1.5rem;
  --radius-lg: 1rem;
  --radius-md: 0.75rem;
  --radius-sm: 0.75rem;
  --header-h: 4.5rem;
  --timeline-h: 22rem;
  --left-rail: 4rem;
  --right-rail: 4rem;
  --left-open: 20rem;
  --left-open-current: 20rem;
  --right-open: 20rem;
  --mono: "IBM Plex Mono", monospace;
  --sans: "Plus Jakarta Sans", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background:
    radial-gradient(circle at top right, rgba(90, 130, 255, 0.05), transparent 32%),
    radial-gradient(circle at top center, rgba(255, 93, 50, 0.1), transparent 28%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-soft) 100%);
  color: var(--text);
  font-family: var(--sans);
}

.app-shell {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

button, input, textarea, select { font: inherit; }
button { border: 0; cursor: pointer; }
body.modal-open { overflow: hidden; }

.editor {
  width: 100%;
  height: 100vh;
  padding: 0;
  display: grid;
  grid-template-rows: var(--header-h) minmax(0, 1fr) var(--timeline-h);
  gap: 0;
  overflow: hidden;
}
.editor.timeline-mini { grid-template-rows: var(--header-h) minmax(0, 1fr) 12rem; }

.surface,
.modal-card,
.toast,
.progress-panel {
  background: linear-gradient(180deg, rgba(20, 28, 46, 0.875), rgba(12, 18, 34, 0.875));
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.topbar {
  border-radius: 0;
  min-height: var(--header-h);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  padding: 0 1.5rem;
  column-gap: 1.5rem;
  row-gap: 0.75rem;
  background: var(--overlay-black);
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: none;
  z-index: 60;
}

.topbar > .brand {
  justify-self: start;
  min-width: 0;
}

.topbar > .header-tools {
  justify-self: center;
  margin-left: 0;
}

.topbar > .top-nav {
  justify-self: end;
  min-width: 0;
}

.topbar.docs-topbar > .header-tools {
  visibility: hidden;
  pointer-events: none;
}

.topbar.docs-topbar > .top-nav {
  justify-self: end;
}

.topbar.docs-topbar > .brand {
  justify-self: start;
}

.docs-header-tools {
  min-height: 2rem;
}

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

.brand-copy h1, .panel-title, .timeline-title h2, .modal-header h3 { margin: 0; font-size: 1rem; }
.brand, .header-tools, .transport, .field-actions, .modal-actions, .timeline-tools, .clip-context-tools, .preview-header, .preview-toolbar, .timeline-header, .section-line, .asset-meta, .color-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.brand-mark, .asset-thumb, .rail-button span {
  width: 2rem;
  height: 2rem;
  border-radius: 0.75rem;
  display: grid;
  place-items: center;
}

.brand-mark {
  width: auto;
  min-height: 2.5rem;
  grid-auto-flow: column;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.75rem 0.25rem 0.5rem;
  background: var(--overlay-05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: none;
}

.brand-mark img {
  width: 2rem;
  height: 2rem;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 0.25rem 0.75rem rgba(var(--accent-strong-rgb), 0.2));
}

.brand-name {
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.875);
  white-space: nowrap;
}

.brand-copy p, .panel-subtitle, .muted, .track-type, .asset-meta, .history-copy p, .toast p, .progress-panel p { margin: 0; color: var(--muted); font-size: 0.75rem; }
.project-title-input {
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0.5rem;
  background: transparent;
  color: var(--text);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.25;
  cursor: text;
  transition: all 0.25s ease;
}
.project-title-input[readonly] {
  pointer-events: auto;
}
.project-title-input:focus {
  outline: none;
  padding: 0.25rem 0.5rem;
  background: rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), 0.5);
}

.header-tools { margin-left: 0; }

.top-nav {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.25rem;
  flex-wrap: nowrap;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  min-width: 0;
}

.top-nav-link {
  position: relative;
  padding: 0.5rem 0.75rem;
  border-radius: 0.75rem;
  border: 1px solid transparent;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.25s ease;
}

.top-nav-link:hover,
.top-nav-link.active {
  background: rgba(var(--accent-rgb), 0.1);
  border-color: rgba(var(--accent-rgb), 0.35);
  color: var(--surface-thumb);
  box-shadow: inset 0 0 0 1px var(--overlay-05);
}

.user-menu {
  position: relative;
  margin-left: 0.5rem;
  flex: 0 0 auto;
}

.user-menu-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem 0.5rem 0.5rem;
  border-radius: 1rem;
  border: 1px solid var(--line);
  background: var(--overlay-05);
  color: var(--text);
}

.user-menu-trigger:hover,
.user-menu-trigger[aria-expanded="true"] {
  background: linear-gradient(135deg, rgba(var(--accent-rgb), 0.1), rgba(var(--accent-strong-rgb), 0.1));
  border-color: rgba(var(--accent-rgb), 0.35);
}

.user-menu-avatar {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--text-warm);
  background: var(--brand-gradient);
  box-shadow: 0 0.5rem 1.5rem rgba(var(--accent-rgb), 0.2);
}

.user-menu-copy {
  display: grid;
  text-align: left;
  line-height: 1; gap: 0.25rem;
}

.user-menu-copy strong {
  font-size: 0.875rem;
  font-weight: 700;
}

.user-menu-copy small {
  font-size: 0.75rem;
  color: var(--muted);
}

.user-submenu {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  z-index: 90;
  min-width: 16rem;
  padding: 0.5rem;
  border-radius: 1rem;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--surface-sidebar), var(--surface-sidebar-deep));
  box-shadow: var(--shadow);
}

.user-submenu-head {
  padding: 0.5rem 0.5rem 0.75rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 0.5rem;
}

.user-submenu-head strong,
.user-submenu-head span {
  display: block;
}

.user-submenu-head span {
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.75rem;
}

.user-submenu button,
.user-submenu a {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem;
  border-radius: 0.75rem;
  color: var(--text);
  text-decoration: none;
  background: transparent;
}

.user-submenu button:hover,
.user-submenu a:hover {
  background: rgba(255, 255, 255, 0.05);
}

.user-submenu .muted-line {
  font-size: 0.75rem;
  color: var(--muted);
}

.top-nav-link.has-status-badge::after {
  content: "";
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--brand-gradient);
  box-shadow: 0 0 0 0.25rem rgba(var(--accent-rgb), 0.2);
  animation: pulse-dot 1.15s ease-in-out infinite;
}

.docs-page {
  border-radius: 1.5rem;
  padding: 1.5rem;
  overflow: auto;
  background: linear-gradient(180deg, var(--surface-panel), var(--surface-panel-deep));
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.docs-layout {
  max-width: 72rem;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 15rem minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
}

.docs-sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.docs-nav {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.75rem;
  border-radius: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: linear-gradient(180deg, var(--panel), var(--bg-soft));
}

.docs-nav a {
  padding: 0.5rem 0.75rem;
  border-radius: 0.75rem;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
}

.docs-nav a:hover,
.docs-nav a.active {
  background: linear-gradient(135deg, rgba(var(--accent-rgb), 0.1), rgba(var(--accent-strong-rgb), 0.1));
  color: var(--text);
}

.docs-note {
  padding: 0.875rem 1rem;
  border-radius: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: linear-gradient(180deg, rgba(12, 13, 16, 0.875), rgba(8, 9, 12, 0.875));
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.5;
}

.docs-content {
  display: flex;
  flex-direction: column;
  gap: 3rem;
}

.docs-section {
  padding: 1rem 0 2.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.docs-section:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.docs-section-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.docs-section-icon {
  width: 2.5rem;
  height: 2.5rem;
  flex: 0 0 auto;
  border-radius: 0.875rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(var(--accent-rgb), 0.1), rgba(var(--accent-strong-rgb), 0.1));
  border: 1px solid rgba(197, 151, 98, 0.2);
  color: var(--accent);
}

.docs-section-icon .icon-svg {
  width: 1rem;
  height: 1rem;
}

.docs-section h3 {
  margin: 0;
  font-size: 1.5rem;
  line-height: 1.25;
}

.docs-section p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
  font-size: 1rem;
}

.docs-inline-note {
  margin-top: 1.5rem;
  padding-left: 3.25rem;
  color: var(--text);
  font-size: 0.875rem;
  line-height: 1.5;
}

.docs-inline-note strong {
  color: var(--accent);
}

.docs-pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.5rem;
  padding-left: 3.25rem;
}

.docs-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(197, 151, 98, 0.2);
  background: linear-gradient(135deg, rgba(var(--accent-rgb), 0.1), rgba(var(--accent-strong-rgb), 0.1));
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.25;
}

.docs-hero {
  padding: 1.25rem;
  border-radius: 1.25rem;
  border: 1px solid rgba(var(--accent-rgb), 0.35);
  background:
    radial-gradient(circle at top right, rgba(var(--accent-rgb), 0.2), transparent 32%),
    radial-gradient(circle at bottom left, var(--overlay-05), transparent 28%),
    linear-gradient(180deg, var(--panel), var(--bg-soft));
}

.docs-hero h2 {
  margin: 0 0 0.5rem;
  font-size: 1.5rem;
}

.docs-hero p {
  margin: 0;
  max-width: 42rem;
  color: var(--muted);
  line-height: 1.5;
}

.docs-card {
  padding: 1rem;
  border-radius: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: linear-gradient(180deg, rgba(12, 13, 16, 0.875), rgba(8, 9, 12, 0.875));
}

.docs-card h3 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
}

.docs-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.docs-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.docs-example {
  padding: 1rem;
  border-radius: 1rem;
  border: 1px dashed rgba(var(--accent-rgb), 0.35);
  background: linear-gradient(135deg, rgba(var(--accent-rgb), 0.1), rgba(255, 255, 255, 0.05));
}

.docs-example strong {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
}

.docs-example p {
  margin: 0;
  color: var(--text);
  font-size: 0.875rem;
  line-height: 1.5;
}

.ghost-button, .primary-button, .danger-button, .rail-toggle, .aspect-group button, .segmented button, .track-toolbar button, .asset-filter button, .shortcut-pill, .option-button {
  min-height: 2.5rem;
  border-radius: 0.75rem;
  padding: 0 0.75rem;
  transition: 0.25s ease;
}

.ghost-button, .rail-toggle, .aspect-group button, .segmented button, .track-toolbar button, .asset-filter button, .shortcut-pill, .option-button {
  background: var(--overlay-05);
  border: 1px solid var(--line);
  color: var(--text);
}

.primary-button {
  background: var(--brand-gradient);
  border: 1px solid rgba(var(--accent-strong-rgb), 0.35);
  color: var(--text-warm);
  font-weight: 700;
  box-shadow: 0 0.75rem 1.5rem rgba(var(--accent-strong-rgb), 0.2);
}

.primary-button:hover {
  transform: translateY(-1px);
  filter: brightness(1.1);
  box-shadow:
    0 1rem 2rem rgba(var(--accent-strong-rgb), 0.2),
    0 0 0 1px rgba(255, 255, 255, 0.1) inset;
}

.danger-button {
  background: linear-gradient(135deg, rgba(var(--accent-rgb), 0.2), rgba(var(--accent-strong-rgb), 0.1));
  color: var(--text-rose);
  border: 1px solid rgba(var(--accent-rgb), 0.2);
}

.danger-button:hover {
  transform: translateY(-1px);
  background: linear-gradient(135deg, rgba(var(--accent-rgb), 0.2), rgba(var(--accent-strong-rgb), 0.2));
  border-color: rgba(var(--accent-rgb), 0.35);
  box-shadow:
    0 1rem 1.5rem rgba(239, 68, 68, 0.2),
    0 0 0 1px rgba(255, 255, 255, 0.05) inset;
}

.ghost-button:hover, .rail-toggle:hover, .aspect-group button:hover, .segmented button:hover, .track-toolbar button:hover, .asset-filter button:hover, .shortcut-pill:hover {
  background: rgba(255, 255, 255, 0.1);
}

.rail-button:hover {
  background: var(--overlay-05);
  border-color: var(--overlay-05);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.05),
    0 0 0.75rem rgba(var(--accent-rgb), 0.1);
}

.rail-button:hover .icon-svg,
.rail-button:hover .rail-hint {
  color: rgba(255, 244, 238, 0.875);
}

.aspect-group, .segmented, .asset-filter.compact, .track-toolbar {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.aspect-group button,
.segmented button,
.save-button,
.export-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.save-button {
  min-width: 7.5rem;
  padding: 0 1rem;
  text-align: center;
  line-height: 1;
}

.export-button {
  min-width: 8.5rem;
  padding: 0 1rem;
  text-align: center;
  line-height: 1;
}

.topbar .export-button {
  background: var(--text);
  border-color: var(--line-stronger);
  color: var(--text-on-light);
  box-shadow: none;
}

.topbar .export-button:hover {
  box-shadow: none;
}

.export-button .icon-svg {
  width: 1rem;
  height: 1rem;
  transform: none;
}

.aspect-group button.active, .segmented button.active, .asset-filter button.active {
  background: linear-gradient(135deg, var(--accent-soft), rgba(var(--accent-strong-rgb), 0.2));
  border-color: rgba(var(--accent-rgb), 0.35);
  color: var(--text-warm);
}

.main-layout {
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-columns: var(--left-rail) minmax(0, 1fr);
  gap: 0;
  padding: 1.5rem 1.5rem 0;
}

.timeline-dock {
  min-height: 0;
  display: grid;
  grid-template-rows: 1rem minmax(0, 1fr);
}

.editor.sidebar-open .main-layout {
  grid-template-columns: var(--left-open-current) 0.5rem minmax(0, 1fr);
  gap: 0.5rem;
}

.editor.sidebar-closed .main-layout {
  grid-template-columns: var(--left-rail) minmax(0, 1fr);
}

.panel, .shell-panel { min-height: 0; height: 100%; border-radius: var(--radius-xl); overflow: hidden; }
.shell-panel { display: grid; grid-template-columns: 3.5rem minmax(0, 1fr); }
.shell-panel.collapsed { grid-template-columns: 3.5rem 0; }

.left-panel {
  background: transparent;
  border: 0;
  box-shadow: none;
  overflow: visible;
}

.sidebar-resizer {
  width: auto;
  cursor: col-resize;
  position: relative;
  touch-action: none;
}

.sidebar-resizer::before {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 0.125rem;
  height: 4rem;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.1);
  transition: all 0.18s ease;
}

.sidebar-resizer:hover::before,
.sidebar-resizer.dragging::before {
  width: 0.25rem;
  height: 5rem;
  background: linear-gradient(180deg, rgba(var(--accent-rgb), 0.875), rgba(var(--accent-strong-rgb), 0.75));
  box-shadow: 0 0 0.75rem rgba(var(--accent-rgb), 0.35);
}

body.sidebar-resizing {
  cursor: col-resize;
  user-select: none;
}

.timeline-resizer {
  height: 1rem;
  cursor: row-resize;
  position: relative;
  margin: 0 1.5rem 0;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
}

.timeline-resizer::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 6rem;
  height: 0.125rem;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.1);
  transition: all 0.18s ease;
  transform: translate(-50%, -50%);
}

.timeline-resizer:hover::before,
.timeline-resizer.dragging::before {
  width: 7.5rem;
  height: 0.25rem;
  background: linear-gradient(90deg, rgba(var(--accent-rgb), 0.875), rgba(var(--accent-strong-rgb), 0.75));
  box-shadow: 0 0 0.75rem rgba(var(--accent-rgb), 0.35);
}

body.timeline-resizing {
  cursor: row-resize;
  user-select: none;
}

.editor.timeline-mini .timeline-resizer {
  display: none;
}

.editor.sidebar-closed .sidebar-resizer {
  display: none;
}

.panel-rail {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.875rem 0.5rem 0.75rem;
  border-right: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
}

.rail-toggle, .rail-button {
  width: 2.5rem;
  min-height: 2.5rem;
  padding: 0;
  display: grid;
  place-items: center;
  color: var(--text);
}
.rail-toggle-minimal {
  width: 1.5rem;
  min-height: 1.5rem;
  margin: 0.25rem auto 0.5rem;
  background: transparent;
  border: 0;
  border-radius: 0;
  opacity: 0.75;
}
.rail-toggle-minimal:hover {
  background: transparent;
  opacity: 1;
}
.rail-toggle-minimal .icon-svg {
  width: 1.5rem;
  height: 1.5rem;
}
.panel-toggle-button {
  transition: all 0.25s ease;
}
.panel-toggle-button:not(.is-open) {
  color: var(--accent);
}
.panel-toggle-icon {
  transition: transform 0.25s ease;
}
.panel-toggle-button:not(.is-open) .panel-toggle-icon {
  transform: rotate(180deg);
}

.rail-button .icon-svg,
.track-toolbar .icon-svg,
.clip-context-tools .icon-svg,
.segmented .icon-svg,
.aspect-group .icon-svg {
  width: 1rem;
  height: 1rem;
}

.rail-button {
  position: relative;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 0.75rem;
  isolation: isolate;
  box-shadow: none;
}

.rail-button::before {
  content: "";
  position: absolute;
  top: -1px;
  bottom: -1px;
  right: -11px;
  width: 0.75rem;
  border-radius: 0;
  background: linear-gradient(180deg, var(--surface-sidebar), var(--surface-sidebar-deep));
  border-top: 1px solid rgba(var(--accent-rgb), 0.5);
  border-bottom: 1px solid rgba(var(--accent-rgb), 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  transform: translateX(-0.25rem);
  z-index: -1;
}

.rail-button.active {
  background:
    linear-gradient(180deg, var(--surface-sidebar), var(--surface-sidebar-deep)),
    linear-gradient(135deg, rgba(var(--accent-rgb), 0.1), rgba(var(--accent-strong-rgb), 0.05));
  border-color: rgba(var(--accent-rgb), 0.5);
  border-right-color: transparent;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  z-index: 1;
  box-shadow: 0 0 0.75rem rgba(var(--accent-rgb), 0.2);
}

.rail-button.active::before {
  opacity: 1;
  transform: translateX(0);
}

.rail-button.active .icon-svg,
.rail-button.active .rail-hint {
  color: rgb(var(--accent-rgb));
}

.rail-button.busy::after {
  content: "";
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--brand-gradient);
  box-shadow: 0 0 0 0.25rem rgba(var(--accent-rgb), 0.1);
  animation: pulse-dot 1.15s ease-in-out infinite;
}

.rail-hint {
  position: absolute;
  right: -0.35rem;
  bottom: -0.35rem;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.25rem;
  font-size: 0.75rem;
  color: #bfb596;
  font-family: var(--mono);
  font-style: normal;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: lowercase;
  line-height: 1;
  background: linear-gradient(180deg, var(--surface-panel), var(--surface-panel-deep));
  border: 1px solid #474035;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
  z-index: 2;
}

.panel-content {
  min-height: 0;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior-y: contain;
  padding: 0.875rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: linear-gradient(180deg, var(--surface-sidebar), var(--surface-sidebar-deep));
  border: 1px solid transparent;
  border-radius: 1.25rem;
  box-shadow:
    var(--shadow),
    0 0 1rem rgba(var(--accent-rgb), 0.2),
    inset 0 0 0 1px rgba(var(--accent-rgb), 0.5);
}
.sidebar-panel-section,
.panel-dynamic-content {
  min-height: 0;
  min-width: 0;
  width: 100%;
}
.shell-panel.collapsed .panel-content {
  opacity: 0;
  pointer-events: none;
}

.panel-section, .asset-row, .history-item, .drop-card, .property-empty, .timeline-empty, .modal-card, .toast, .progress-panel {
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
}

.property-empty {
  border: 0;
  background: transparent;
  box-shadow: none;
  font-style: italic;
  opacity: 0.5;
}

.panel-section {
  flex: 0 0 auto;
  min-height: fit-content;
  padding: 0.75rem;
}

.panel-content .panel-section {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.action-row { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 0.5rem; margin-bottom: 0.5rem; }
.asset-actions-panel { padding: 0.5rem; }
.asset-library-panel {
  min-height: fit-content;
  overflow: hidden;
}
.asset-actions-stack {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.option-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-style: dashed;
  border-color: rgba(255, 123, 57, 0.35);
  min-height: 3.5rem;
  padding: 0.5rem;
}

.option-button:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 123, 57, 0.5);
  box-shadow:
    inset 0 0 0 1px var(--overlay-05),
    0 0.5rem 1.5rem rgba(0, 0, 0, 0.2);
}
.upload-only { border-color: rgb(56, 189, 248); }
.icon-svg {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  flex: 0 0 auto;
  background-color: currentColor;
  -webkit-mask-image: var(--icon);
  mask-image: var(--icon);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
}
.option-button span { font-size: 0.75rem; line-height: 1.1; text-align: center; white-space: normal; }
.panel-static-actions {
  display: grid;
  gap: 0.75rem;
  padding: 0.75rem 0 0;
}

.asset-actions-stack {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.panel-dynamic-content {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.asset-quick-button {
  width: 100%;
  min-height: 4rem;
  flex-direction: column;
  justify-content: center;
  color: var(--success-soft-text);
  padding: 0.75rem;
  background: rgba(16, 185, 129, 0.1);
  border: 1px dashed rgba(52, 211, 153, 0.5);
  box-shadow: inset 0 0 0 1px rgba(16, 185, 129, 0.1);
}
.asset-quick-button span {
  font-size: 0.75rem;
  font-weight: 600;
  text-align: center;
}
.asset-quick-button .icon-svg {
  width: 1.5rem;
  height: 1.5rem;
}
.asset-quick-button.text-only {
  background: rgba(16, 185, 129, 0.05);
}
.asset-quick-button.audio-only {
  color: var(--teal-light);
  background: rgba(6, 182, 212, 0.1);
  border-color: rgba(34, 211, 238, 0.5);
  box-shadow: inset 0 0 0 1px rgba(6, 182, 212, 0.1);
}
.asset-quick-button.sfx-only {
  color: var(--pink-soft-text);
  background: rgba(236, 72, 153, 0.1);
  border-color: rgba(244, 114, 182, 0.5);
  box-shadow: inset 0 0 0 1px rgba(236, 72, 153, 0.1);
}
.asset-quick-button.create-only {
  color: var(--rose-soft-text);
  background: rgba(244, 114, 182, 0.1);
  border-color: rgba(251, 113, 133, 0.5);
  box-shadow: inset 0 0 0 1px rgba(244, 114, 182, 0.1);
}
.asset-quick-button.export-only {
  color: var(--gold-soft-text);
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(251, 191, 36, 0.5);
  box-shadow: inset 0 0 0 1px rgba(245, 158, 11, 0.1);
}
.panel-note {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.5;
}

.upcoming-note {
  font-style: normal;
  text-align: left;
  opacity: 1;
  color: rgba(255, 255, 255, 0.875);
}

.asset-quick-button:hover {
  color: var(--success-soft-text);
  background: rgba(16, 185, 129, 0.2);
  border-color: rgba(110, 231, 183, 0.875);
  box-shadow:
    inset 0 0 0 1px rgba(110, 231, 183, 0.2),
    0 0 1.5rem rgba(16, 185, 129, 0.2);
}
.section-line { justify-content: space-between; margin-bottom: 0.5rem; }
.section-line strong { font-size: 0.875rem; }
.section-inline-actions { display: inline-flex; align-items: center; gap: 0.5rem; }

.drop-card, .shortcut-pill {
  width: 100%;
  min-height: 2.5rem;
  justify-content: center;
}

.drop-card {
  display: grid;
  place-items: center;
  color: var(--muted);
}

.drop-hover { box-shadow: 0 0 0 1px rgba(222, 90, 67, 0.5); background: rgba(222, 90, 67, 0.1); }

.compact-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem; padding: 0.5rem 0;
  min-height: fit-content;
}
.compact-row { display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem; }

.asset-row { transition: all 0.25s ease; }
.asset-row:hover, .history-item:hover { background: rgba(255, 255, 255, 0.05); }
.asset-row.dragging { opacity: 0.5; transform: none; }
.asset-delete-inline {
  flex: 0 0 auto;
  margin-left: auto;
}

.asset-delete-inline:hover{border-color: rgba(var(--danger), 0.35); background: var(--danger);}

.generated-sound-main {
  flex: 1;
  min-width: 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: transparent;
  border: 0;
  color: inherit;
  text-align: left;
}
.inline-loading-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.875rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: var(--overlay-05);
  color: var(--text);
  overflow: hidden;
  pointer-events: none;
}
.inline-loading-spinner {
  width: 0.875rem;
  min-width: 0.875rem;
  height: 0.875rem;
  min-height: 0.875rem;
  border-radius: 50%;
  border: 0.125rem solid var(--line-stronger);
  border-top-color: var(--accent);
  animation: spin 0.75s linear infinite;
}
.inline-loading-pulse {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, var(--overlay-05) 25%, var(--overlay-10) 50%, var(--overlay-05) 75%, transparent 100%);
  transform: translateX(-100%);
  animation: shimmer 1.6s ease-in-out infinite;
}
.inline-loading-row > span:not(.inline-loading-pulse) {
  position: relative;
  z-index: 1;
}
.export-row { align-items: center; }
.export-row-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
  flex: 0 0 auto;
}
.export-row .ghost-button { flex: 0 0 auto; }
.export-row .icon-only { padding: 0; width: 2rem; min-width: 2rem; }
.export-library-panel { margin-top: 0.25rem; }
.create-item-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.create-item-list,
#createSectionPanel .asset-actions-stack,
#createSectionPanel .section-line {
  width: 100%;
}
#createSectionPanel .asset-actions-stack {
  gap: 0.5rem;
  margin-bottom: 1rem;
}
#createSectionPanel .asset-quick-button {
  min-height: 4rem;
  padding: 0.75rem 0.875rem;
  border-radius: 1.25rem;
  gap: 0.5rem;
}
#createSectionPanel .asset-quick-button .icon-svg {
  width: 1.5rem;
  height: 1.5rem;
}
#createSectionPanel .shape-stack-icon {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  width: 1.5rem;
  height: 1.5rem;
  color: currentColor;
  flex: 0 0 auto;
}
#createSectionPanel .shape-stack-triangle {
  width: 0;
  height: 0;
  border-left: 0.5rem solid transparent;
  border-right: 0.5rem solid transparent;
  border-bottom: 0.75rem solid currentColor;
}
#createSectionPanel .shape-stack-row {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}
#createSectionPanel .shape-stack-square {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 0.125rem;
  background: currentColor;
}
#createSectionPanel .shape-stack-circle {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: currentColor;
}
#createSectionPanel .asset-quick-button span {
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.25;
}
#createSectionPanel .section-line {
  margin-bottom: 1rem;
  padding: 0 0.5rem;
}
#createSectionPanel .section-line strong,
#createSectionPanel .section-line .muted {
  font-size: 0.875rem;
}
.create-item {
  display: grid;
  gap: 0;
  padding: 0 0.5rem 0.5rem;
  border: 0;
  border-radius: 1.25rem;
  background: transparent;
  overflow: hidden;
  box-shadow: none;
}
.create-item:not([open]) {
  padding: 0.75rem 0.875rem;
  background: rgba(31, 40, 61, 0.5);
  border: 1px solid rgba(148, 163, 184, 0.1);
}
.create-item-summary {
  list-style: none;
  display: grid;
  gap: 0.75rem;
  padding: 0;
  cursor: default;
  user-select: none;
}
.create-item-summary::-webkit-details-marker {
  display: none;
}
.create-item-summary-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.875rem;
  padding-top: 0.125rem;
}
.create-item-copy {
  min-width: 0;
  flex: 1;
}
.create-item-copy strong {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}
.create-item-summary-meta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex: 0 0 auto;
  cursor: pointer;
  align-self: center;
}
.create-item-style-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: rgba(94, 234, 212, 0.875);
  box-shadow: 0 0 0 0.125rem rgba(94, 234, 212, 0.1);
}
.create-item-chevron {
  width: 0.5rem;
  height: 0.5rem;
  border-right: 0.125rem solid rgba(245, 247, 251, 0.875);
  border-bottom: 0.125rem solid rgba(245, 247, 251, 0.875);
  transform: rotate(45deg);
  transition: transform 0.2s ease, opacity 0.2s ease;
  opacity: 0.875;
  margin-right: 0.25rem;
  margin-top: -1px;
}
.create-item[open] .create-item-chevron {
  transform: rotate(225deg);
  margin-top: 1px;
}
.create-item-summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  min-width: 0;
  padding-bottom: 0.125rem;
}
.create-item-preview-text,
.create-item-copy p {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin: 0;
  font-size: 0.875rem;
  color: rgba(159, 174, 201, 0.875);
}
.create-item-preview-text {
  flex: 1;
}
.create-item-filter {
  flex: 0 0 auto;
  margin: 0;
  font-size: 0.875rem;
  color: rgba(229, 237, 249, 0.875);
}
.create-item-filter .is-empty {
  font-style: italic;
  opacity: 0.5;
}
.create-item-filter .is-active {
  color: var(--teal-light);
}
.create-item-divider {
  height: 1px;
  background: rgba(148, 163, 184, 0.35);
  margin-top: 0.125rem;
}
.create-item:not([open]) .create-item-divider {
  opacity: 1;
}
.create-item-body {
  display: grid;
  gap: 1rem;
  padding-top: 1rem;
}
.create-editor-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.875rem;
}
.create-section-group {
  display: grid;
  gap: 0.5rem;
}
.create-section-label {
  display: flex;
  align-items: center;
  margin: 0;
  padding: 0;
  font-size: 0.75rem;
  color: rgba(145, 160, 186, 0.875);
}
.create-section-label span {
  display: inline-block;
}
.style-control-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: 1rem;
  border: 1px solid rgba(148, 163, 184, 0.1);
  background: rgba(31, 40, 61, 0.75);
  box-shadow: none;
}
.create-item-body .color-row {
  align-items: center;
  gap: 0.5rem;
  flex-wrap: nowrap;
}
.create-item-body .muted {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.75rem;
  font-weight: 500;
  color: rgba(245, 247, 251, 0.875);
}
.style-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.style-toggle-row .compact-color {
  flex: 1;
  min-width: 0;
}
.create-item-body .field textarea {
  min-height: 6.5rem;
  padding: 0.75rem;
  border-radius: 1rem;
  border: 1px solid rgba(148, 163, 184, 0.1);
  background: rgba(31, 40, 61, 0.75);
  color: var(--text);
  font-size: 0.75rem;
  line-height: 1.5;
}
.create-item-body .field label {
  gap: 0.5rem;
  margin-bottom: 0.25rem;
  font-size: 0.75rem;
  color: rgba(145, 160, 186, 0.875);
}
.create-section-group > .style-control-card > label,
.create-section-group > .field.style-control-card > label {
  display: none;
}
.create-item-body > .field.style-control-card > label {
  margin-bottom: 0;
}
.create-item-body > .field > label > span:first-child,
.style-control-card .field > label > span:first-child {
  color: rgba(145, 160, 186, 0.875);
}
.create-item-body > .field > label > span:last-child,
.style-control-card .field > label > span:last-child {
  color: rgba(229, 237, 249, 0.875);
}
.switch-field {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0;
  font-size: 0.75rem;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}
.switch-field input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.switch-ui {
  position: relative;
  width: 2rem;
  height: 1.25rem;
  border-radius: 1rem;
  background: rgba(73, 82, 104, 0.75);
  border: 0;
  transition: all 0.2s ease;
}
.switch-ui::after {
  content: "";
  position: absolute;
  top: 0.125rem;
  left: 0.125rem;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background: var(--surface-thumb);
  box-shadow: 0 1px 0.25rem rgba(0, 0, 0, 0.2);
  transition: transform 0.2s ease;
}
.switch-field input[type="checkbox"]:checked + .switch-ui {
  background: var(--accent);
}
.switch-field input[type="checkbox"]:checked + .switch-ui::after {
  transform: translateX(1rem);
}
.create-item-body input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.create-item-body .field > label {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.create-item-body .field > label span:last-child {
  font-size: 0.75rem;
  color: rgba(245, 247, 251, 0.875);
}
.create-item-body .field select {
  min-height: 3rem;
  border-radius: 1rem;
  border: 1px solid rgba(148, 163, 184, 0.1);
  background: rgba(31, 40, 61, 0.75);
  color: var(--text);
  padding: 0 0.875rem;
  font-size: 0.875rem;
}
.create-item-body .field input[type="range"] {
  margin-top: 0.25rem;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.create-item-body input[type="range"]::-webkit-slider-runnable-track {
  height: 0.5rem;
  border-radius: 1rem;
  background: linear-gradient(90deg, rgba(195, 85, 61, 0.875) 0%, rgba(195, 85, 61, 0.875) var(--scrub-progress, 0%), rgba(64, 74, 96, 0.875) var(--scrub-progress, 0%), rgba(64, 74, 96, 0.875) 100%);
  border: 0;
}
.create-item-body input[type="range"]::-webkit-slider-thumb {
  width: 0.875rem;
  height: 0.875rem;
  margin-top: -0.25rem;
  background: var(--accent);
  border: 0;
  box-shadow: none;
}
.create-item-body input[type="range"]::-moz-range-track {
  height: 0.5rem;
  border-radius: 1rem;
  background: linear-gradient(90deg, rgba(195, 85, 61, 0.875) 0%, rgba(195, 85, 61, 0.875) var(--scrub-progress, 0%), rgba(64, 74, 96, 0.875) var(--scrub-progress, 0%), rgba(64, 74, 96, 0.875) 100%);
  border: 0;
}
.create-item-body input[type="range"]::-moz-range-thumb {
  width: 0.875rem;
  height: 0.875rem;
  background: var(--accent);
  border: 0;
  box-shadow: none;
}
.create-item-body .field + .field {
  margin-top: 0;
}
.create-filter-card {
  padding: 0;
  min-height: 3rem;
}
.create-filter-card .field {
  display: flex;
  position: relative;
}
.create-filter-card .field select {
  min-height: 3rem;
  padding: 0 2rem 0 0.875rem;
  border: 0;
  border-radius: 1rem;
  background: transparent;
  box-shadow: none;
  color: var(--text);
  font-size: 0.875rem;
  line-height: 1;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: none;
}
.create-filter-card .field::after {
  content: "";
  position: absolute;
  right: 1rem;
  top: 50%;
  width: 0.5rem;
  height: 0.5rem;
  border-right: 0.125rem solid rgba(245, 247, 251, 0.875);
  border-bottom: 0.125rem solid rgba(245, 247, 251, 0.875);
  transform: translateY(-65%) rotate(45deg);
  pointer-events: none;
  opacity: 0.875;
}
.border-preview {
  position: relative;
}
.border-preview::after {
  content: "";
  position: absolute;
  left: 0.75rem;
  top: 50%;
  width: 1.5rem;
  height: 0.25rem;
  border-radius: 0.25rem;
  background: rgba(222, 90, 67, 0.875);
  transform: translateY(-50%) rotate(-28deg);
  pointer-events: none;
}
.create-item-body .compact-color input[type="color"] {
  width: 3rem;
  height: 2rem;
  padding: 0.125rem;
  border-radius: 0.5rem;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: transparent;
}
.create-item-body input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}
.create-item-body input[type="color"]::-webkit-color-swatch {
  border: 0;
  border-radius: 0.5rem;
}
.create-item-body input[type="color"]::-moz-color-swatch {
  border: 0;
  border-radius: 0.5rem;
}
.create-item-body input:not([type="range"]):not(:disabled),
.create-item-body input[type="range"]:not(:disabled),
.create-item-body select:not(:disabled),
.create-item-body textarea:not(:disabled),
.create-item-body .switch-field,
.create-item-body .switch-ui {
  cursor: pointer;
}
.create-item-body textarea:not(:disabled) {
  cursor: text;
}
.mini-row-action {
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
}
.asset-row.active,
.asset-row:focus-visible,
.asset-row:focus-within {
  background: rgba(222, 90, 67, 0.1);
  border-color: rgba(222, 90, 67, 0.35);
  box-shadow: 0 0 0 1px rgba(222, 90, 67, 0.35), 0 0 1rem rgba(222, 90, 67, 0.1);
}

.asset-row:focus-visible {
  outline: none;
}

.asset-thumb {
  flex: 0 0 auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--overlay-05);
  color: var(--text);
  cursor: zoom-in;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.asset-thumb:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  background: var(--surface-4);
  filter: brightness(1.2);
  border-color: rgba(var(--accent-rgb), 0.3);
}
.asset-thumb:active {
  transform: scale(0.95);
}

.asset-thumb.video { background: rgba(56, 189, 248, 0.1); }
.asset-thumb.image { background: rgba(222, 90, 67, 0.1); }
.asset-thumb.audio { background: rgba(45, 212, 191, 0.1); }
.asset-thumb.text { background: rgba(99, 102, 241, 0.1); }
.asset-thumb.shape { background: rgba(244, 114, 182, 0.1); }
.asset-thumb.generated { background: rgba(222, 90, 67, 0.1); }

.asset-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.icon-filters button { width: 2rem; padding: 0; }
.icon-filters .icon-svg { margin: 0 auto; }

.asset-details, .history-copy { min-width: 0; flex: 1; }
.asset-title, .history-copy strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.generated-sound-row,
.generated-sound-row .asset-title,
.generated-sound-row .asset-details,
.generated-sound-row .mini-row-action {
  color: var(--text);
}

.workspace {
  min-height: 0;
  display: grid;
  padding: 0;
}

.preview-card {
  position: relative;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  border-radius: 1.5rem;
  overflow: hidden;
  background: linear-gradient(180deg, var(--surface-stage), var(--surface-stage-deep));
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.preview-toolbar { margin-top: auto; }

.compact-head { justify-content: space-between; }
.preview-shell {
  min-height: 0;
  height: 100%;
  display: grid;
  align-items: stretch;
  padding: 0.5rem;
  border-radius: 1.25rem;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.05)),
    linear-gradient(180deg, var(--surface-panel), var(--surface-stage-deep));
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.preview-stage {
  position: relative;
  width: 100%;
  max-width: none;
  height: 100%;
  min-height: 100%;
  display: grid;
  place-items: center;
  border-radius: 1.25rem;
  padding: 1.25rem 1.25rem 0.5rem;
  background: linear-gradient(180deg, var(--surface-contrast-deep), var(--surface-stage-deep));
  border: 0;
  overflow: hidden;
}

.stage-frame-wrap {
  position: relative;
  transform-origin: center;
}

.stage-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--overlay-05) 1px, transparent 1px),
    linear-gradient(90deg, var(--overlay-05) 1px, transparent 1px);
  background-size: 3rem 3rem;
  border-radius: 1.25rem;
  opacity: 0.15;
  pointer-events: none;
  z-index: 0;
}

.stage-frame {
  position: relative;
  width: 100%;
  height: 100%;
  margin: 0 auto;
  border-radius: 1rem;
  overflow: hidden;
  background: linear-gradient(180deg, var(--surface-shell), var(--surface-contrast-deep));
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.05),
    0 1.5rem 3rem rgba(0, 0, 0, 0.5);
  transform-origin: center;
}

.stage-background {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.auth-preview-banner {
  position: absolute;
  inset: auto 1rem 1rem 1rem;
  z-index: 12;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
  border-radius: 1rem;
  border: 1px solid rgba(var(--accent-rgb), 0.2);
  background: linear-gradient(135deg, rgba(8, 12, 24, 0.875), rgba(24, 16, 30, 0.875));
  box-shadow: 0 1rem 2rem rgba(0, 0, 0, 0.2);
}

.auth-preview-banner strong,
.auth-preview-banner span {
  display: block;
}

.auth-preview-banner span {
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.75rem;
}

.stage-format-overlay {
  position: absolute;
  inset: 0;
  border-radius: 0.875rem;
  pointer-events: none;
  z-index: 8;
  box-shadow: 0 0 0 4000px rgba(0, 0, 0, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.stage-format-pill {
  position: absolute;
  top: -2rem;
  right: 0;
  padding: 0.25rem 0.5rem;
  border-radius: 1rem;
  background: rgba(6, 10, 19, 0.875);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.safe-guides::before,
.safe-guides::after {
  display: none;
}

.stage-layer {
  position: absolute;
  left: 50%;
  top: 50%;
  border-radius: 1rem;
  overflow: visible;
  transform-origin: center;
  cursor: pointer;
  transition: box-shadow 0.25s ease, outline-color 0.25s ease;
  z-index: 1;
}

.preview-stage.preview-hand-mode {
  cursor: grab;
}

.preview-stage.preview-hand-mode .stage-frame-wrap {
  cursor: grab;
}

.preview-stage.preview-hand-mode .stage-frame-wrap:active {
  cursor: grabbing;
}

.preview-stage.panning,
.preview-stage.panning .stage-frame-wrap {
  cursor: grabbing;
}

.stage-layer.selected {
  outline: 0.125rem solid rgba(255, 123, 57, 0.875);
  outline-offset: 0.125rem;
  box-shadow: 0 0 0 0.5rem rgba(255, 123, 57, 0.1);
  cursor: grab;
  z-index: 4;
}

.stage-layer.dragging {
  cursor: grabbing;
}

.stage-layer-content {
  width: 100%;
  height: 100%;
  border-radius: 1rem;
  overflow: hidden;
  display: flex;
  align-items: stretch;
}
.stage-shape {
  width: 100%;
  height: 100%;
  border-radius: 1rem;
  box-sizing: border-box;
}

.stage-layer img, .stage-layer video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
  aspect-ratio: auto;
}

.stage-text {
  width: 100%;
  height: 100%;
  min-width: 11.25rem;
  max-width: none;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: flex-start;
  font-size: clamp(1rem, 2vw, 1.5rem);
  line-height: 1.25;
  font-weight: 800;
  color: var(--surface-thumb);
  white-space: pre-wrap;
  background: transparent;
  backdrop-filter: none;
  user-select: none;
  cursor: grab;
}

.stage-text-editor {
  width: 100%;
  min-height: 100%;
  border: 1px solid rgba(255, 123, 57, 0.5);
  outline: none;
  resize: none;
  user-select: text;
  cursor: text;
}

.bbox-handles {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.bbox-handles span {
  position: absolute;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background: var(--surface-thumb);
  border: 0.125rem solid var(--accent);
  box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.2);
  z-index: 3;
  pointer-events: auto;
}

.bbox-handles span:nth-child(1) { left: calc(50% - 0.5rem); top: -0.5rem; cursor: ns-resize; }
.bbox-handles span:nth-child(2) { right: -0.5rem; top: calc(50% - 0.5rem); cursor: ew-resize; }
.bbox-handles span:nth-child(3) { left: calc(50% - 0.5rem); bottom: -0.5rem; cursor: ns-resize; }
.bbox-handles span:nth-child(4) { left: -0.5rem; top: calc(50% - 0.5rem); cursor: ew-resize; }
.bbox-handles span:nth-child(5) { left: -0.5rem; top: -0.5rem; cursor: nwse-resize; }
.bbox-handles span:nth-child(6) { right: -0.5rem; top: -0.5rem; cursor: nesw-resize; }
.bbox-handles span:nth-child(7) { left: -0.5rem; bottom: -0.5rem; cursor: nesw-resize; }
.bbox-handles span:nth-child(8) { right: -0.5rem; bottom: -0.5rem; cursor: nwse-resize; }
.bbox-rotate-handle {
  left: calc(50% - 0.5rem);
  top: -1.5rem;
  background: var(--accent);
  cursor: grab;
}
.bbox-handles::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -1rem;
  width: 1px;
  height: 1rem;
  background: rgba(255, 255, 255, 0.5);
  transform: translateX(-50%);
}

.compact-toolbar { gap: 0.5rem; }
.icon-play { width: 2.5rem; min-height: 2.5rem; padding: 0; display: grid; place-items: center; }
.compact-scrubber {
  flex: 1;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
  border-radius: 0.875rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: var(--overlay-05);
}

.preview-zoom-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  justify-content: flex-end;
  flex: 0 0 auto;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.preview-zoom-button {
  min-width: 2rem;
  min-height: 2rem;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0.75rem;
  background: var(--overlay-05);
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
}

.preview-zoom-input {
  min-width: 7.5rem;
}

.preview-aspect-group {
  flex-wrap: nowrap;
  margin-right: 0.5rem;
}

.small, .mini { min-height: 2rem; }
.mini { padding: 0 0.5rem; }
.mono { font-family: var(--mono); font-size: 0.75rem; color: var(--muted); }
input[type="range"] {
  width: 100%;
  appearance: none;
  background: transparent;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 0.5rem;
  border-radius: 1rem;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.875) 0%, rgba(255, 255, 255, 0.875) var(--scrub-progress, 0%), rgba(255,255,255,0.1) var(--scrub-progress, 0%), rgba(255,255,255,0.1) 100%);
  border: 1px solid rgba(255,255,255,0.1);
}
input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  margin-top: -0.25rem;
  background: var(--gold-gradient);
  border: 0.125rem solid var(--surface-panel);
  box-shadow: 0 0 0 0.125rem rgba(197, 151, 98, 0.2);
}
input[type="range"]::-moz-range-track {
  height: 0.5rem;
  border-radius: 1rem;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.875) 0%, rgba(255, 255, 255, 0.875) var(--scrub-progress, 0%), rgba(255,255,255,0.1) var(--scrub-progress, 0%), rgba(255,255,255,0.1) 100%);
  border: 1px solid rgba(255,255,255,0.1);
}
input[type="range"]::-moz-range-thumb {
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background: var(--gold-gradient);
  border: 0.125rem solid var(--surface-panel);
}

.field-grid { display: flex; flex-direction: column; gap: 0.5rem; }
.field-grid.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5rem; }
.field.full { grid-column: 1 / -1; }
.optional-source-row {
  margin-top: 0.5rem;
}
.optional-source-empty {
  margin-top: 0.5rem;
  padding: 0.875rem 1rem;
  text-align: left;
}

.field label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.25rem;
  font-size: 0.75rem;
  color: var(--muted);
}

.field input,
.field textarea,
.field select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border-radius: 0.75rem;
  border: 1px solid var(--line);
  background: var(--overlay-05);
  color: var(--text);
}

.field select,
.field select option {
  background: var(--surface-editor);
  color: var(--text);
}

.field textarea { min-height: 5.5rem; resize: vertical; width: 100%; max-width: 100%; }
.compact-color input[type="color"] { width: 3rem; height: 2rem; padding: 0.25rem; }
.compact-empty, .compact-empty-state { text-align: center; }

.timeline {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border-radius: var(--radius-xl);
  overflow: hidden;
  min-height: 0;
  margin: 0 1.5rem 1.5rem;
  background: var(--surface-stage-deep);
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.timeline.collapsed { grid-template-rows: auto minmax(0, 1fr); }
.timeline.collapsed .track-type,
.timeline.collapsed .ruler-mark strong,
.timeline.collapsed .clip-mini {
  display: none;
}
.timeline.collapsed #selectedClipActions {
  display: none;
}
.timeline.collapsed .label-cell,
.timeline.collapsed .track-row { height: 1.25rem; min-height: 1.25rem; }
.timeline.collapsed .ruler,
.timeline.collapsed .ruler-label { height: 1.5rem; }
.timeline.collapsed .clip { top: 0.25rem; height: 0.75rem; border-radius: 0.5rem; }
.timeline.collapsed .clip-handle { width: 0.5rem; }
.timeline.collapsed .timeline-body { grid-template-columns: 7.5rem minmax(0, 1fr); }
.timeline.collapsed .layer-name-input {
  display: none;
}

.timeline.collapsed .layer-delete-button {
  display: none;
}
.timeline.collapsed .layer-label {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.timeline.collapsed .layer-label::before {
  content: "";
  display: block;
  width: 1.5rem;
  height: 0.25rem;
  border-radius: 0.25rem;
  background: rgba(255, 255, 255, 0.35);
}
.timeline.collapsed .timeline-title {
  display: none;
}
.timeline.collapsed .timeline-center-readout,
.timeline.collapsed .timeline-zoom-label,
.timeline.collapsed .timeline-zoom-icon,
.timeline.collapsed .compact-timeline-zoom,
.timeline.collapsed .timeline-zoom-step {
  display: none;
}
.timeline-header {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  justify-content: space-between;
  flex-wrap: nowrap;
  background: rgba(255, 255, 255, 0.05);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
}

.timeline-view-group {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  flex: 1 1 auto;
  flex-wrap: nowrap;
}
.timeline-view-group h2 {
  flex: 0 0 auto;
  min-width: max-content;
  white-space: nowrap;
}

.timeline-left-tools {
  justify-self: start;
}

.timeline-add-menu {
  position: relative;
}

.timeline-add-button {
  width: 2rem;
  min-width: 2rem;
  min-height: 2rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
}

.timeline-add-button span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  line-height: 1;
  transform: translateY(-1px);
}

.timeline-add-dropdown {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  z-index: 20;
  min-width: 8.5rem;
  padding: 0.25rem;
  border-radius: 0.875rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: var(--panel);
  box-shadow: 0 1rem 2rem rgba(0, 0, 0, 0.35);
}

.timeline-add-option {
  width: 100%;
  min-height: 2rem;
  padding: 0 0.5rem;
  border-radius: 0.75rem;
  background: transparent;
  color: var(--text);
  text-align: left;
  font-size: 0.875rem;
  font-weight: 600;
}

.timeline-add-option:hover {
  background: rgba(255, 255, 255, 0.05);
}

.timeline-redo-button .icon-svg {
  transform: scaleX(-1);
}

.timeline-center-readout {
  justify-self: center;
  min-width: 0;
}

.timeline-time-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2rem;
  padding: 0 0.75rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: var(--overlay-05);
  color: var(--surface-thumb);
  font-size: 0.875rem;
  font-weight: 700;
}

.timeline-tools {
  margin-left: 1rem;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  flex: 0 0 auto;
  flex-wrap: nowrap;
  justify-self: end;
}

.clip-context-tools,
.track-toolbar {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: nowrap;
}

.clip-context-tools .ghost-button,
.clip-context-tools .danger-button,
.track-toolbar button {
  height: 2rem;
  min-height: 2rem;
  padding: 0 0.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}
.timeline-zoom-input {
  width: 8rem;
  min-width: 8rem;
}

.timeline-zoom-cluster {
  gap: 0.5rem;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.timeline-zoom-icon {
  width: 1rem;
  height: 1rem;
  color: rgba(255, 255, 255, 0.875);
}

.compact-timeline-zoom {
  width: 6rem;
  min-width: 6rem;
}

.timeline-zoom-step {
  width: 2rem;
  min-width: 2rem;
  min-height: 2rem;
  height: 2rem;
  padding: 0;
  border-radius: 0.75rem;
  border: 1px solid var(--line);
  background: var(--overlay-05);
  font-size: 1rem;
  line-height: 1;
}

.timeline-zoom-label {
  min-width: max-content;
  margin: 0;
  color: rgba(255, 255, 255, 0.75);
}
.timeline-view-button {
  width: 2rem;
  min-width: 2rem;
  min-height: 2rem;
  padding: 0;
}
.timeline-zoom-cluster [hidden] {
  display: none !important;
}

.clip-context-tools .icon-only {
  width: 2rem;
  min-width: 2rem;
  padding: 0;
}

.clip-context-tools .ghost-button span,
.clip-context-tools .danger-button span {
  line-height: 1;
}

.timeline-body {
  min-height: 0;
  display: grid;
  align-items: stretch;
  grid-template-columns: 15rem minmax(0, 1fr);
  overflow: hidden;
}

.track-labels {
  position: relative;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: var(--overlay-05);
  min-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
}

.label-cell {
  height: 4rem;
  padding: 0 0.875rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.track-label-spacer {
  height: 2.5rem;
  min-height: 2.5rem;
  padding: 0;
  border-bottom: 1px solid var(--line);
  pointer-events: none;
}

.label-cell strong { font-size: 0.75rem; line-height: 1.1; }
.track-type { display: none; }
.layer-label {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  cursor: grab;
  transition: all 0.25s ease;
}

.layer-name-group {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.layer-accent-dot {
  width: 0.5rem;
  height: 0.5rem;
  flex: 0 0 0.5rem;
  border-radius: 50%;
  background: var(--layer-color, var(--layer-fallback));
  box-shadow: 0 0 0 1px var(--overlay-10);
}

.layer-label.selected {
  background: rgba(255, 123, 57, 0.1);
  box-shadow: inset 0 0 0 1px rgba(255, 123, 57, 0.35);
}

.layer-name-input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0.25rem 0.5rem;
  border-radius: 0.5rem;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  font-size: 0.75rem;
  font-weight: 700;
}

.layer-name-input[readonly] {
  pointer-events: none;
}

.layer-name-input:focus {
  outline: none;
  border-color: rgba(255, 123, 57, 0.35);
  background: var(--overlay-05);
}

.layer-delete-button {
  flex: 0 0 1.5rem;
  width: 1.5rem;
  height: 1.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.25s ease;
}

.layer-delete-button .icon-svg {
  width: 1rem;
  height: 1rem;
}

.layer-delete-button:hover {
  background: rgba(239, 68, 68, 0.1);
  color: var(--rose-soft-text);
}

.layer-label.track-label-dragging {
  opacity: 0.5;
  transform: none;
}

.layer-label.track-drop-target {
  background: rgba(255, 123, 57, 0.1);
  box-shadow: inset 0 0 0 1px rgba(255, 123, 57, 0.5);
  transform: translateY(-0.125rem);
}

.layer-label.track-label-pressing {
  background: rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.1);
}

.ruler-label { height: 2.5rem; }
.timeline-scroll { position: relative; overflow: auto; min-width: 0; min-height: 100%; height: 100%; }
.timeline-content { position: relative; min-height: 100%; width: 100%; overflow: visible; }

.timeline-edge-handle {
  position: absolute;
  top: 0.25rem;
  z-index: 14;
  width: 0.875rem;
  height: 1.5rem;
  padding: 0;
  border-radius: 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: linear-gradient(180deg, var(--surface-track-light), var(--surface-track-dark));
  cursor: ew-resize;
  transform: translateX(-50%);
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.2);
}

.timeline-edge-handle span {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0.5rem;
  height: 0.5rem;
  transform: translate(-50%, -50%);
  border-top: 0.125rem solid rgba(230, 236, 247, 0.875);
  border-bottom: 0.125rem solid rgba(230, 236, 247, 0.875);
}

.timeline-edge-handle span::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  border-top: 0.125rem solid rgba(230, 236, 247, 0.875);
  transform: translateY(-50%);
}

.ruler {
  position: sticky;
  top: 0;
  z-index: 10;
  height: 2.5rem;
  background: var(--surface-panel-deep);
  border-bottom: 1px solid var(--line);
  overflow: visible;
}

.ruler-range-mask {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 2;
  background: rgba(5, 8, 16, 0.35);
  pointer-events: none;
}

.ruler-range-mask.left {
  left: 0;
  width: 0.75rem;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.ruler-range-mask.right {
  right: 0;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
}

.ruler-mark {
  position: absolute;
  bottom: 0;
  width: 1px;
  height: 0.75rem;
  background: rgba(255, 255, 255, 0.1);
}
.ruler-mark.micro {
  height: 0.5rem;
  background: rgba(255, 255, 255, 0.05);
}
.ruler-mark.minor {
  height: 0.875rem;
  background: rgba(255, 255, 255, 0.1);
}
.ruler-mark.major {
  top: 0;
  height: 100%;
  background: rgba(255, 255, 255, 0.2);
}
.ruler-mark.outside-range {
  background: var(--overlay-05);
}

.ruler-mark strong {
  position: absolute;
  top: 0.75rem;
  left: 0.5rem;
  font-size: 0.75rem;
  font-family: var(--mono);
  color: var(--muted);
}
.ruler-mark.outside-range strong {
  opacity: 0.35;
}

.track-row {
  position: relative;
  height: 4rem;
  border-bottom: 1px solid var(--overlay-05);
  background-image: linear-gradient(90deg, var(--overlay-05) 1px, transparent 1px);
  background-size: var(--timeline-grid, 2.5rem) 100%;
  min-width: 100%;
  overflow: visible;
}

.track-row.drop-target { background-color: rgba(255, 123, 57, 0.1); }
.track-row.track-row-pressing { background-color: var(--overlay-05); }

.clip {
  position: absolute;
  top: 0.5rem;
  height: 2.5rem;
  border-radius: 0.75rem;
  overflow: hidden;
  display: flex;
  align-items: stretch;
  background: linear-gradient(135deg, var(--clip-accent, rgba(255, 255, 255, 0.24)), rgba(255, 255, 255, 0.08));
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.2);
  transition: transform 0.25s ease, box-shadow 0.25s ease, opacity 0.25s ease;
}

.clip.active { box-shadow: 0 0 0 0.125rem rgba(255, 123, 57, 1), 0 0 0 0.25rem rgba(255, 123, 57, 0.2), 0 0.5rem 1rem rgba(0, 0, 0, 0.2); }
.clip.dragging { opacity: 0.75; transform: translateY(-1px); box-shadow: 0 1rem 1.5rem rgba(0, 0, 0, 0.35); }
.clip.video { background: linear-gradient(135deg, var(--success-strong), var(--success)); color: var(--surface-thumb); }
.clip.image { background: linear-gradient(135deg, var(--teal), var(--teal-light)); color: var(--surface-thumb); }
.clip.text { background: linear-gradient(135deg, var(--violet), var(--violet-light)); color: var(--surface-thumb); }
.clip.audio { background: linear-gradient(135deg, var(--violet), var(--violet-light)); color: var(--surface-thumb); }
.clip.generated { background: linear-gradient(135deg, var(--violet-light), var(--violet-soft)); color: var(--surface-thumb); }

.preview-tool-button.active {
  border-color: rgba(var(--accent-rgb), 0.65);
  background: linear-gradient(135deg, rgba(var(--accent-rgb), 0.18), rgba(var(--accent-strong-rgb), 0.12));
  box-shadow: 0 0 0 1px rgba(var(--accent-rgb), 0.18);
}

.preview-tool-button {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.preview-tool-button svg {
  flex: 0 0 auto;
}

.canvas-background-section {
  display: grid;
  gap: 0.75rem;
}

.background-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}

.background-preset {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr);
  align-items: center;
  gap: 0.65rem;
  min-height: 3rem;
  padding: 0.5rem 0.65rem;
  border-radius: 1rem;
  border: 1px solid rgba(148, 163, 184, 0.12);
  background: rgba(31, 40, 61, 0.66);
  color: var(--text);
  text-align: left;
}

.background-preset.transparent {
  grid-template-columns: 2.25rem minmax(0, 1fr);
}

.background-preset.active {
  border-color: rgba(var(--accent-rgb), 0.55);
  box-shadow: 0 0 0 1px rgba(var(--accent-rgb), 0.15);
}

.background-preset-swatch {
  position: relative;
  width: 2rem;
  height: 2rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
  overflow: hidden;
}

.background-preset.transparent .background-preset-swatch {
  position: relative;
  line-height: 0;
  color: rgba(237, 255, 250, 0.85);
  background:
    linear-gradient(45deg, rgba(255, 255, 255, 0.14) 25%, transparent 25%, transparent 75%, rgba(255, 255, 255, 0.14) 75%, rgba(255, 255, 255, 0.14)),
    linear-gradient(45deg, rgba(255, 255, 255, 0.07) 25%, transparent 25%, transparent 75%, rgba(255, 255, 255, 0.07) 75%, rgba(255, 255, 255, 0.07));
  background-size: 0.75rem 0.75rem;
  background-position: 0 0, 0.375rem 0.375rem;
}

.background-preset.transparent .background-preset-swatch svg {
  position: absolute;
  transform: translate(-50%, -50%);
  top: 50%;
  left: 50%;
  width: 0.95rem;
  height: 0.95rem;
  display: block;
  z-index: 1;
  pointer-events: none;
}

.background-preset.transparent .background-preset-swatch::after {
  content: "";
  position: absolute;
  inset: 0.28rem;
  border-radius: 0.55rem;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.background-preset span:last-child {
  min-width: 0;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.2;
}

.background-actions {
  margin-top: 0.25rem;
}

.clip-handle {
  width: 0.5rem;
  cursor: ew-resize;
  background: var(--line-stronger);
  z-index: 2;
}

.clip-body {
  flex: 1;
  min-width: 0;
  padding: 0 0.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  cursor: grab;
  z-index: 2;
  position: relative;
}

.clip-title {
  min-width: 0;
  font-size: 0.875rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.clip-mini { color: rgba(255, 255, 255, 0.75); }
.clip-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: rgba(255,255,255,0.875);
  flex: 0 0 auto;
}
.clip-waveform { display: flex; align-items: center; gap: 1px; height: 100%; opacity: 0.875; }
.clip-waveform span { width: 1px; border-radius: 1px; background: rgba(255, 255, 255, 0.75); }

.clip-range-mask {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 1;
  background: rgba(5, 8, 16, 0.5);
  pointer-events: none;
}

.clip-range-mask.left {
  left: 0;
  border-right: 1px solid rgba(255, 255, 255, 0.2);
}

.clip-range-mask.right {
  right: 0;
  border-left: 1px solid rgba(255, 255, 255, 0.2);
}

.playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 0.125rem;
  background: var(--accent);
  z-index: 6;
  pointer-events: none;
}

.playhead::before {
  content: "";
  position: absolute;
  top: 0.5rem;
  left: 50%;
  transform: translateX(-50%);
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 50%;
  background: var(--accent);
}

.playhead-thumb {
  position: absolute;
  top: 0.25rem;
  left: 50%;
  width: 1rem;
  height: 1rem;
  transform: translateX(-50%);
  border-radius: 50%;
  border: 0.125rem solid var(--surface-panel);
  background: var(--accent);
  box-shadow: 0 0.5rem 1rem rgba(255, 123, 57, 0.35);
  cursor: ew-resize;
  pointer-events: auto;
}

.ruler-hit-area {
  position: absolute;
  inset: 0;
  cursor: ew-resize;
  z-index: 1;
}

#promptInput {
  min-height: 7.5rem;
  line-height: 1.25;
  padding-right: 0.5rem;
  white-space: pre-wrap;
  overflow-y: auto;
}

.field-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.5rem;
}

.field-actions .primary-button,
.field-actions .ghost-button {
  width: 100%; grid-column: span 2;
  justify-content: center;
}

.history-item {
  width: 100%;
  min-width: 0;
  text-align: left;
}

.history-copy strong,
.history-copy p {
  overflow-wrap: anywhere;
}

.prompt-section {
  display: grid;
  gap: 0.5rem;
}

.prompt-section .section-line {
  align-items: center;
}

.prompt-history-list {
  max-height: 11.25rem;
  overflow: auto;
  padding-right: 0.25rem;
}

.timeline-edge-handle,
.playhead-thumb {
  touch-action: none;
}

.timeline-empty, .empty-state, .loader-box {
  display: grid;
  place-items: center;
  padding: 1.25rem;
  z-index: 9999;
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(4px);
}
.modal-card { z-index: 10000; }
.quick-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem 0.875rem;
}

.quick-link-button {
  min-height: 2rem;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  border-radius: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: rgba(229, 237, 249, 0.875);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.25rem;
}

.quick-link-button:hover,
.quick-link-button:focus-visible {
  color: var(--text);
  background: transparent;
  border: 0;
  box-shadow: none;
}

.quick-link-button .icon-svg {
  width: 0.875rem;
  height: 0.875rem;
  opacity: 0.875;
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1.25rem;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  z-index: 100000;
}

.modal-card {
  width: min(54rem, 100%);
  padding: 1.5rem;
  border-radius: 1.25rem;
  z-index: 100001;
  max-height: 95vh;
  overflow-y: auto;
  position: relative;
}

.confirm-summary {
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  border: 1px solid var(--line);
  background: var(--overlay-05);
  color: var(--text);
}
.export-modal-card {
  background: linear-gradient(180deg, var(--panel-4), var(--panel-5));
}

.export-preset-section {
  margin-bottom: 0.875rem;
}

.export-preset-head {
  margin-bottom: 0.5rem;
}

.export-preset-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}

.export-preset-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
  padding: 0.75rem 1rem;
  border-radius: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: linear-gradient(180deg, var(--overlay-05), var(--overlay-05));
  color: var(--text);
  text-align: left;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.export-preset-card strong {
  font-size: 0.875rem;
}

.export-preset-card span {
  font-size: 0.75rem;
  color: var(--muted);
}

.export-preset-card:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 123, 57, 0.5);
}

.export-preset-card.active {
  border-color: rgba(255, 123, 57, 0.75);
  background: linear-gradient(180deg, rgba(255, 123, 57, 0.2), rgba(255, 123, 57, 0.1));
  box-shadow: 0 0 0 1px rgba(255, 123, 57, 0.2) inset;
}

.modal-header { display: flex; justify-content: space-between; gap: 1rem; margin-bottom: 0.875rem; }
.modal-header p {
  margin-top: 0.5rem;
  max-width: 18.75rem;
}
.modal-close-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  width: 2rem;
  min-height: 2rem;
  height: 2rem;
  padding: 0;
  border-radius: 50%;
  font-size: 0.875rem;
  line-height: 1;
  flex: 0 0 auto;
  background: var(--accent);
  color: var(--text-warm);
  border: 0;
}
.modal-close-button:hover {
  background: rgba(222, 90, 67, 0.875);
}
.modal-actions {
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1rem;
}

.toast-stack, .progress-stack {
  position: fixed;
  left: 50%;
  top: 0.875rem;
  z-index: 110;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transform: translateX(-50%);
  align-items: center;
}

.toast, .progress-panel { width: min(18.75rem, calc(100vw - 1.25rem)); padding: 0.75rem; }
.toast,
.progress-panel {
  width: min(24rem, calc(100vw - 1.5rem));
  padding: 0.75rem 1rem;
  border-radius: 1.25rem;
  background: linear-gradient(180deg, var(--panel-4), var(--panel-5));
  border-color: var(--blue-soft);
  backdrop-filter: none;
  box-shadow:
    0 0 0 1px rgba(96, 165, 250, 0.1),
    0 0 1.5rem var(--blue-glow),
    0 1rem 2rem rgba(0, 0, 0, 0.2);
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  transform-origin: top center;
}

.toast-icon {
  width: 1.5rem;
  height: 1.5rem;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(180deg, var(--blue), var(--surface-contrast));
  color: var(--text);
  font-size: 0.875rem;
  font-style: normal;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 0 1rem rgba(59, 130, 246, 0.35);
}

.toast-copy {
  min-width: 0;
  flex: 1 1 auto;
}

.toast strong, .progress-panel strong { display: block; margin-bottom: 0.25rem; }

.toast.is-entering {
  animation: toast-enter 0.35s cubic-bezier(0.2, 0.75, 0.2, 1) both;
}

.toast.is-leaving {
  animation: toast-leave 0.25s ease both;
}

.progress-bar {
  width: 100%;
  height: 0.5rem;
  border-radius: 0.5rem;
  background: rgba(255, 255, 255, 0.05);
  overflow: hidden;
  position: relative;
}

.progress-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-strong));
  position: relative;
}

.progress-bar span::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    120deg,
    rgba(255, 255, 255, 0) 0 0.25rem,
    rgba(255, 255, 255, 0.35) 0.25rem 0.5rem,
    rgba(255, 255, 255, 0) 0.5rem 0.75rem
  );
  animation: progress-stripes 0.7s linear infinite;
  opacity: 0.875;
}

@keyframes progress-stripes {
  0% {
    transform: translateX(-0.75rem);
  }
  100% {
    transform: translateX(0.75rem);
  }
}

@keyframes toast-enter {
  0% {
    opacity: 0;
    transform: translateY(-0.75rem) scale(0.875);
    filter: blur(0.25rem);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

@keyframes toast-leave {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
  100% {
    opacity: 0;
    transform: translateY(-0.5rem) scale(0.875);
    filter: blur(0.25rem);
  }
}

.loader-ring {
  width: 2.5rem;
  height: 2.5rem;
  margin: 0 auto 0.875rem;
  border-radius: 50%;
  border: 0.25rem solid rgba(255, 123, 57, 0.1);
  border-top-color: var(--accent);
  animation: spin 1s linear infinite;
}

.hidden-input { display: none; }

.workspace-drop {
  box-shadow: inset 0 0 0 1px rgba(255, 123, 57, 0.35);
}

.workspace-active-drop {
  box-shadow: inset 0 0 0 0.125rem rgba(255, 123, 57, 0.5);
}

.workspace-drop-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(8, 12, 20, 0.75);
  color: var(--text-warm);
  font-weight: 700;
  letter-spacing: 0.02em;
  z-index: 2;
  backdrop-filter: blur(0.25rem);
}

.preview-stage {
  min-height: 100% !important;
}

.preview-card { gap: 0.75rem; }
.option-button span,
.export-button span,
.aspect-group button span {
  display: inline-flex;
  align-items: center;
  line-height: 1;
}

* {
  scrollbar-width: thin;
  scrollbar-color: rgba(148,163,184,0.35) rgba(255,255,255, 0.05);
}

*::-webkit-scrollbar {
  width: 0.75rem;
  height: 0.75rem;
}

*::-webkit-scrollbar-track {
  background: rgba(255,255,255, 0.05);
}

*::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.2);
  border-radius: 1rem;
  border: 0.125rem solid var(--surface-panel);
}

body.drag-preview-on .preview-stage {
  box-shadow: inset 0 0 0 0.125rem rgba(222, 90, 67, 0.5);
}

.flash-upload .rail-button.active,
.flash-assets .rail-button.active,
.flash-generate .rail-button.active,
.flash-create .rail-button.active,
.flash-text .rail-button.active,
.flash-ai .rail-button.active,
.flash-prompt .rail-button.active,
.flash-properties .rail-button.active,
.flash-animation .rail-button.active,
.flash-style .rail-button.active,
.flash-export .rail-button.active {
  box-shadow: 0 0 0 1px rgba(222, 90, 67, 0.5), 0 0 1rem rgba(222, 90, 67, 0.35);
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}
@keyframes pulse-dot {
  0%, 100% { transform: scale(1); opacity: 0.875; }
  50% { transform: scale(1.25); opacity: 0.75; }
}

@media (max-width: 1080px) {
  .editor { grid-template-rows: var(--header-h) minmax(0, 1fr) 15.5rem; }
  .main-layout { grid-template-columns: 4rem minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
  .editor.sidebar-open .main-layout { grid-template-columns: var(--left-open-current) 0.5rem minmax(0, 1fr); }
  .topbar { grid-template-columns: minmax(0, 1fr); min-height: auto; padding: 0.875rem; }
  .topbar > .brand,
  .topbar > .header-tools,
  .topbar > .top-nav { justify-self: stretch; }
  .topbar > .header-tools { justify-content: center; }
  .topbar > .top-nav { justify-content: center; }
  .docs-layout { grid-template-columns: 1fr; }
  .docs-sidebar { position: static; }
  .timeline-header { grid-template-columns: minmax(0, 1fr); gap: 0.5rem; }
  .timeline-left-tools,
  .timeline-center-readout,
  .timeline-tools { justify-self: stretch; }
  .timeline-center-readout { order: 2; }
  .timeline-tools { order: 3; justify-content: space-between; margin-left: 0; }
}

@media (max-width: 720px) {
  .editor { padding: 0.5rem; gap: 0.5rem; grid-template-rows: auto minmax(0, 1fr) 17.5rem; }
  .topbar { padding: 0.5rem; }
  .header-tools { width: 100%; justify-content: center; margin-left: 0; flex-wrap: wrap; }
  .top-nav { justify-content: center; flex-wrap: wrap; }
  .field-grid.two, .timeline-body { grid-template-columns: 1fr; }
  .export-preset-grid { grid-template-columns: 1fr; }
  .create-editor-grid { grid-template-columns: 1fr; }
  .timeline-body { grid-template-rows: auto minmax(0, 1fr); }
  .track-labels { display: none; }
  .sidebar-resizer, .timeline-resizer { display: none; }
  .docs-grid { grid-template-columns: 1fr; }
}

/* --- Mejoras de Assets Panel --- */
.video-thumb-container, .image-thumb-container {
  width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.video-thumb-container video, .image-thumb-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.video-badge-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.5);
  color: #fff;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  backdrop-filter: blur(2px);
  border: 1px solid rgba(255,255,255,0.2);
}
.video-badge-overlay.image {
  background: rgba(222, 90, 67, 0.4);
}
.video-badge-overlay .icon-svg {
  width: 12px;
  height: 12px;
  --icon-color: #fff;
}
.audio-icon-wrap {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.7);
}
.audio-icon-wrap .icon-svg {
  width: 20px;
  height: 20px;
  --icon-color: currentColor;
}
.asset-thumb {
  overflow: hidden !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}
.asset-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
