:root {
  --ink: #17201b;
  --muted: #5d6862;
  --line: #d5ddd7;
  --panel: #ffffff;
  --paper: #f5f8f5;
  --accent: #315efb;
  --purple: #7650e8;
  --audio: #0d6b4f;
  --danger: #9b2f2f;
  --filter: #c36a16;
  font-family: system-ui, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-size: 13px;
  color-scheme: light;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-width: 320px;
  overflow: hidden;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button {
  height: 36px;
  padding: 0 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  font-weight: 600;
}
button:hover:not(:disabled) {
  background: #edf2ee;
  border-color: #b3c0b7;
}
button:disabled {
  color: #7b857f;
  cursor: default;
  background: #f0f3f0;
}
button.primary {
  height: 44px;
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
button.primary:hover:not(:disabled) {
  background: #254de2;
}
button.primary:disabled {
  background: #e0e7fc;
  color: #687899;
  border-color: #d2dcf8;
}
button.danger {
  color: var(--danger);
}
button.is-active {
  border-color: var(--accent);
  color: var(--accent);
  background: #eef3ff;
}
a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
input:not([type="checkbox"]):not([type="range"]),
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  min-height: 36px;
  background: var(--panel);
  padding: 7px 9px;
}
input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  cursor: pointer;
  margin: 4px 0;
}
input[type="checkbox"] {
  accent-color: var(--accent);
  width: 17px;
  height: 17px;
  vertical-align: middle;
}
input[type="color"] {
  padding: 3px !important;
}
textarea {
  resize: vertical;
  min-height: 74px;
}
input:disabled,
select:disabled,
textarea:disabled {
  background: #f0f3f0;
  color: #7b857f;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
[hidden] {
  display: none !important;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h2 {
  font-size: 16px;
  line-height: 1.4;
}
h3 {
  font-size: 13px;
}
small,
.muted {
  color: var(--muted);
  line-height: 1.5;
}
.help-wrap {
  display: inline-flex;
  position: relative;
  max-width: 100%;
  vertical-align: middle;
}
.help-wrap > button:first-child {
  max-width: 100%;
}
.icon-button {
  min-width: 40px;
  min-height: 40px;
  padding: 0 8px;
}
.help-wrap > .touch-help {
  display: none;
}
.full-width,
.full-width > .help-wrap,
.full-width > .help-wrap > button,
.help-wrap.full-width > button:first-child {
  width: 100%;
}
.button-row {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
.button-row.spread {
  justify-content: space-between;
}
.button-row.tight {
  gap: 3px;
}
.button-row .small {
  height: 32px;
  padding: 0 8px;
  font-size: 11px;
}
.section {
  display: grid;
  gap: 10px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}
.section:first-child {
  border-top: 0;
  padding-top: 0;
}
.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.badge {
  display: inline-flex;
  align-items: center;
  min-width: 24px;
  min-height: 22px;
  padding: 2px 7px;
  border-radius: 20px;
  font-size: 11px;
  color: var(--muted);
  background: var(--paper);
}
.field {
  display: grid;
  gap: 5px;
  min-width: 0;
  font-size: 12px;
}
.field > span:first-child {
  font-weight: 600;
}
.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.field-grid > .wide {
  grid-column: 1/-1;
}
.check-field {
  display: flex;
  gap: 8px;
  align-items: center;
  line-height: 1.5;
}
.range-field {
  display: grid;
  gap: 4px;
}
.range-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
}
.range-heading input {
  width: 68px !important;
  min-height: 30px !important;
  padding: 4px 5px !important;
  text-align: right;
}
.details {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}
.details > summary {
  cursor: pointer;
  font-weight: 600;
  list-style-position: inside;
  padding: 6px 0;
}
.details-body {
  display: grid;
  gap: 12px;
  padding-top: 10px;
}
.notice {
  padding: 11px 12px;
  border: 1px solid #dbe4f9;
  border-radius: 6px;
  background: #eef3ff;
  font-size: 12px;
  line-height: 1.5;
}
.notice.error {
  border-color: #e9c6c6;
  background: #fff3f1;
  color: var(--danger);
}
.notice.success {
  border-color: #c4e0d5;
  background: #edf8f2;
  color: var(--audio);
}
.empty-note {
  padding: 24px 8px;
  text-align: center;
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
}
.topbar {
  height: 64px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 750;
  color: var(--ink);
  white-space: nowrap;
}
.brand-name {
  font-size: inherit;
  line-height: inherit;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 7px;
  background: var(--audio);
  color: #fff;
  font-size: 14px;
}
.project-title {
  flex: 1;
  min-width: 90px;
  max-width: 300px;
}
.project-title input {
  border-color: transparent !important;
  background: transparent !important;
  font-weight: 600;
}
.save-status {
  font-size: 11px;
  color: var(--muted);
  margin-right: auto;
  white-space: nowrap;
}
.topbar-actions {
  display: flex;
  gap: 5px;
}
.workflow-stepper {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.workflow-stepper button {
  border: 0;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  padding: 0 14px;
}
.workflow-stepper button.is-active {
  color: var(--accent);
  background: #eef3ff;
}
.step-number {
  display: grid;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  font-size: 11px;
}
.step-connector {
  width: 28px;
  height: 1px;
  background: var(--line);
}
.drawer-action {
  display: none;
}
.studio-shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr) 292px;
  height: calc(100vh - var(--studio-header-height, 120px));
  min-height: 774px;
}
.media-panel {
  border-right: 1px solid var(--line);
  padding: 18px 16px;
  background: var(--panel);
  overflow-y: auto;
}
.media-intro {
  margin: 5px 0 14px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}
.import-actions {
  display: grid;
  gap: 8px;
}
.import-secondary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.import-secondary .help-wrap > button {
  width: 100%;
  padding: 0 6px;
  font-size: 12px;
}
.import-secondary > .help-wrap {
  width: 100%;
}
.media-tabs {
  display: flex;
  gap: 2px;
  margin: 20px 0 10px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 6px;
}
.media-tabs .help-wrap {
  flex: 1;
}
.media-tabs button {
  padding: 0 7px;
  font-size: 12px;
  border-color: transparent;
  width: 100%;
}
.media-assets {
  display: grid;
  gap: 10px;
}
.asset-card {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px;
  display: grid;
  gap: 7px;
  min-width: 0;
  background: #fff;
}
.asset-preview {
  width: 100%;
  height: 82px;
  object-fit: cover;
  border-radius: 4px;
  background: #e9efe9;
}
.asset-name {
  font-size: 12px;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.asset-meta {
  font-size: 10px;
  color: var(--muted);
  line-height: 1.5;
}
.asset-card button {
  font-size: 11px;
  padding: 0 8px;
}
.asset-selected {
  border: 2px solid var(--accent);
  background: #eef3ff;
}
.media-hint {
  border-top: 1px solid var(--line);
  margin-top: 20px;
  padding-top: 14px;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.6;
}
.import-progress {
  font-size: 12px;
  margin-top: 10px;
  line-height: 1.5;
}
.editor-workspace {
  min-width: 0;
  display: grid;
  grid-template-rows: 454px minmax(320px, 1fr);
  overflow: hidden;
}
.preview-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: 40px 366px 48px;
  min-width: 0;
  background: var(--panel);
}
.stage-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 16px;
  font-size: 12px;
  min-width: 0;
}
.stage-title {
  min-width: 0;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stage-facts {
  color: var(--muted);
  white-space: nowrap;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.stage-viewport {
  background: #141b18;
  display: grid;
  place-items: center;
  overflow: hidden;
  position: relative;
  padding: 12px;
}
.stage-media {
  position: relative;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: 16/9;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #000;
}
.stage-media canvas,
.stage-media video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  grid-area: 1/1;
}
.stage-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  padding: 20px;
  text-align: center;
  color: #fff;
  background: #17231d;
}
.stage-empty strong {
  max-width: 360px;
  font-size: 20px;
  font-weight: 550;
  line-height: 1.4;
}
.stage-empty > span:last-child {
  font-size: 12px;
  line-height: 1.6;
  max-width: 310px;
  color: #b5c5b9;
}
.empty-film {
  font-size: 48px;
  font-weight: 200;
  color: #91bba0;
}
.safe-area {
  position: absolute;
  inset: 10%;
  border: 1px dashed #ffffff80;
  pointer-events: none;
}
.interaction-box {
  position: absolute;
  border: 2px solid var(--accent);
  background: #315efb08;
  touch-action: none;
  cursor: move;
  transform-origin: center;
  z-index: 3;
}
.interaction-box.filter-selection {
  border-color: var(--filter);
  background: #c36a1610;
}
.selection-caption {
  position: absolute;
  bottom: 100%;
  left: -2px;
  background: var(--accent);
  color: #fff;
  padding: 3px 7px;
  font-size: 10px;
  white-space: nowrap;
  pointer-events: none;
}
.interaction-box > .resize-handle {
  position: absolute;
  width: 40px;
  height: 40px;
  max-width: none;
  transform: translate(-50%, -50%);
}
.resize-handle button:first-child {
  width: 40px;
  height: 40px;
  border: 0;
  min-height: 40px;
  padding: 0;
  background: transparent;
  position: relative;
}
.resize-handle button:first-child::after {
  content: "";
  position: absolute;
  left: 15px;
  top: 15px;
  width: 10px;
  height: 10px;
  background: white;
  border: 2px solid var(--accent);
}
.resize-handle[data-handle="nw"] {
  left: 0;
  top: 0;
}
.resize-handle[data-handle="n"] {
  left: 50%;
  top: 0;
}
.resize-handle[data-handle="ne"] {
  left: 100%;
  top: 0;
}
.resize-handle[data-handle="e"] {
  left: 100%;
  top: 50%;
}
.resize-handle[data-handle="se"] {
  left: 100%;
  top: 100%;
}
.resize-handle[data-handle="s"] {
  left: 50%;
  top: 100%;
}
.resize-handle[data-handle="sw"] {
  left: 0;
  top: 100%;
}
.resize-handle[data-handle="w"] {
  left: 0;
  top: 50%;
}
.transport {
  display: flex;
  gap: 5px;
  align-items: center;
  padding: 4px 12px;
  border-bottom: 1px solid var(--line);
  min-width: 0;
}
.transport button {
  height: 36px;
  min-width: 36px;
  padding: 0 9px;
  font-size: 12px;
}
.transport .play-button {
  min-width: 68px;
}
.transport .seek-field {
  flex: 1;
  min-width: 50px;
}
.transport .timecode {
  font-size: 10px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.transport .transport-frame {
  display: none;
}
.timeline-card {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 320px;
  background: var(--paper);
  border-top: 1px solid var(--line);
  overflow: hidden;
}
.timeline-head {
  padding: 6px 12px;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  min-width: 0;
  flex-wrap: wrap;
}
.timeline-head h2 {
  font-size: 13px;
}
.timeline-head .button-row {
  flex-wrap: wrap;
  min-width: 0;
}
.zoom-label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
}
.zoom-label input {
  width: 90px;
}
.timeline-viewport {
  overflow: auto;
  min-height: 0;
  min-width: 0;
  position: relative;
  contain: paint;
  isolation: isolate;
  overscroll-behavior: contain;
}
.timeline-content {
  position: relative;
  min-width: max(720px, 100%);
  min-height: 100%;
  padding-bottom: 14px;
}
.timeline-ruler {
  height: 28px;
  position: sticky;
  top: 0;
  z-index: 15;
  border-bottom: 1px solid var(--line);
  background: #f9fbf9;
  cursor: crosshair;
}
.ruler-label {
  position: sticky;
  left: 0;
  z-index: 10;
  width: 140px;
  height: 28px;
  display: flex;
  align-items: center;
  background: #f9fbf9;
  padding-left: 10px;
  font-size: 10px;
  color: var(--muted);
  border-right: 1px solid var(--line);
}
.ruler-mark {
  position: absolute;
  top: 6px;
  font-size: 9px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  border-left: 1px solid var(--line);
  padding-left: 5px;
  height: 22px;
}
.track-row {
  position: relative;
  height: 66px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, transparent 39px, #e1e8e133 40px);
  background-size: 40px 100%;
}
.track-row.audio-row {
  height: 88px;
}
.track-row.is-drop-target {
  background: #eef3ff;
}
.track-heading {
  position: sticky;
  left: 0;
  z-index: 10;
  width: 140px;
  height: 100%;
  display: grid;
  align-content: center;
  gap: 2px;
  padding: 4px 7px;
  background: #f5f8f5;
  border-right: 1px solid var(--line);
}
.track-name {
  font-size: 11px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
.track-heading button {
  padding: 0 4px;
  min-width: 40px;
  height: 28px;
  min-height: 28px;
  font-size: 12px;
  background: transparent;
  border-color: transparent;
}
.group-heading {
  height: 30px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  background: #edf2ed;
  position: relative;
}
.group-heading > span:first-child {
  position: sticky;
  left: 0;
  width: 140px;
  z-index: 10;
  background: #edf2ed;
  padding: 0 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 30px;
}
.group-heading > small {
  position: sticky;
  left: 140px;
  padding-left: 8px;
  background: inherit;
}
.group-heading button {
  height: 26px;
  min-height: 26px;
  border: 0;
  background: transparent;
  padding: 0 4px;
  font-size: 11px;
}
.timeline-item {
  z-index: 2;
  position: absolute;
  top: 6px;
  height: 52px;
  border: 2px solid transparent;
  border-radius: 6px;
  min-width: 8px;
  background: #dce8fd;
  color: #172b4a;
  cursor: grab;
  touch-action: none;
  user-select: none;
  overflow: hidden;
}
.timeline-item.is-selected {
  border: 2px solid var(--accent);
  background-color: #eef3ff;
  box-shadow: 0 0 0 1px white;
}
.timeline-item.item-text,
.timeline-item.item-credits {
  background: #eee7ff;
  color: #4b328d;
}
.timeline-item.item-image {
  background: #e2eafb;
  color: #355282;
}
.timeline-item.item-filter {
  background: #f8e9d5;
  color: #824514;
}
.timeline-item.item-audio {
  height: 76px;
  background: #dcefe5;
  color: var(--audio);
}
.timeline-item.is-disabled {
  opacity: 0.4;
}
.clip-poster {
  position: absolute;
  inset: 0;
  background-size: auto 100%;
  background-repeat: repeat-x;
  opacity: 0.24;
  pointer-events: none;
}
.clip-label {
  position: relative;
  display: block;
  padding: 5px 12px 0;
  font-size: 10px;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}
.clip-time {
  position: relative;
  padding: 2px 12px;
  font-size: 9px;
  pointer-events: none;
  white-space: nowrap;
}
.clip-waveform {
  position: absolute;
  bottom: 0;
  left: 2px;
  width: calc(100% - 4px);
  height: 14px;
  opacity: 0.75;
  pointer-events: none;
}
.clip-channels {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 3px;
  display: grid;
  gap: 2px;
  pointer-events: none;
}
.clip-channel {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr);
  align-items: center;
  gap: 4px;
  height: 16px;
  font-size: 9px;
  font-weight: 700;
}
.clip-channel canvas {
  max-width: 100%;
  height: 16px;
}
.segment-index-row {
  height: 24px;
  position: sticky;
  top: 28px;
  z-index: 14;
  background: #fff4e7;
  border-bottom: 1px solid #e7cfb6;
}
.segment-index-row .ruler-label {
  height: 24px;
  background: #fff4e7;
  color: #814014;
}
.segment-index {
  position: absolute;
  top: 0;
  height: 24px;
  border-left: 1px solid #c28c58;
  color: #814014;
  font-size: 10px;
}
.segment-index > span {
  position: absolute;
  padding: 4px 3px;
  overflow: hidden;
  white-space: nowrap;
  z-index: 1;
  background: #fff4e7;
}
.effect-strip {
  height: 3px;
  background: var(--filter);
  position: absolute;
  bottom: 0;
}
.trim-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 12px;
  z-index: 2;
}
.trim-handle.start {
  left: 0;
}
.trim-handle.end {
  right: 0;
}
.trim-handle button:first-child {
  width: 12px;
  height: 100%;
  min-height: 0;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: #315efb22;
  cursor: ew-resize;
}
.trim-handle button:first-child::after {
  content: "";
  display: block;
  width: 2px;
  height: 15px;
  background: #315efb88;
  margin: auto;
}
.timeline-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--accent);
  pointer-events: none;
  z-index: 7;
}
.timeline-playhead::before {
  content: "";
  position: absolute;
  left: -5px;
  top: 0;
  width: 12px;
  height: 10px;
  background: var(--accent);
  clip-path: polygon(0 0, 100% 0, 100% 50%, 50% 100%, 0 50%);
}
.ruler-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  border-left: 2px solid var(--accent);
  pointer-events: none;
}
.ruler-playhead::before {
  content: "";
  position: absolute;
  left: -6px;
  top: 0;
  width: 10px;
  height: 10px;
  background: var(--accent);
  clip-path: polygon(0 0, 100% 0, 100% 50%, 50% 100%, 0 50%);
}
.timeline-add {
  position: absolute;
  top: 17px;
  z-index: 3;
  transform: translateX(-50%);
}
.timeline-add button {
  padding: 0 5px;
  height: 28px;
  min-height: 28px;
  font-size: 10px;
  background: #fff;
  box-shadow: 0 1px 4px #17201b12;
}
.transition-button {
  position: absolute;
  top: 20px;
  z-index: 5;
  transform: translateX(-50%);
}
.transition-button button {
  width: 40px;
  height: 40px;
  min-height: 40px;
  padding: 0;
  background: #fff;
  color: var(--purple);
  border-color: #b9a7ed;
}
.segment-cut {
  position: absolute;
  top: 52px;
  bottom: 0;
  width: 1px;
  border-left: 1px dashed var(--danger);
  pointer-events: none;
  z-index: 1;
}
.segment-cut span {
  position: absolute;
  top: 0;
  left: 3px;
  font-size: 9px;
  color: var(--danger);
  white-space: nowrap;
}
.timeline-tip {
  padding: 18px 20px 18px 160px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}
.drag-readout {
  position: fixed;
  z-index: 5000;
  background: var(--ink);
  color: #fff;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 11px;
  pointer-events: none;
}
.context-panel {
  padding: 18px 16px;
  background: var(--panel);
  border-left: 1px solid var(--line);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.selection-summary {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.selection-summary h2 {
  font-size: 15px;
  overflow-wrap: anywhere;
}
.selection-summary p {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.6;
  margin-top: 5px;
}
.context-content {
  display: grid;
  gap: 16px;
}
.next-action {
  margin-top: auto;
  padding-top: 12px;
  display: grid;
  gap: 8px;
}
.context-hint {
  padding: 14px 0;
  color: var(--muted);
  line-height: 1.65;
}
.on-top-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.on-top-grid > .help-wrap {
  display: flex;
}
.on-top-grid button {
  width: 100%;
  height: auto;
  min-height: 102px;
  white-space: normal;
  padding: 10px 8px;
  display: grid;
  justify-items: start;
  align-content: start;
  gap: 8px;
  text-align: left;
  font-size: 12px;
}
.card-symbol {
  font-size: 24px;
  font-weight: 500;
  line-height: 1.2;
  color: var(--accent);
}
.on-top-grid small {
  font-size: 10px;
  font-weight: 400;
}
.effect-entry,
.credits-group,
.curve-point {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  gap: 9px;
}
.curve-editor {
  height: 100px;
  width: 100%;
  background: #f4f7ff;
  border: 1px solid var(--line);
  border-radius: 6px;
  touch-action: none;
  cursor: crosshair;
}
.curve-list {
  display: grid;
  gap: 8px;
}
.curve-point {
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.curve-point .field {
  font-size: 10px;
}
.curve-point .button-row {
  grid-column: 1/-1;
}
.audio-balance {
  display: grid;
  gap: 10px;
}
.audio-meter {
  height: 5px;
  background: #e0ece5;
  border-radius: 3px;
  overflow: hidden;
}
.audio-meter > span {
  height: 100%;
  display: block;
  background: var(--audio);
  width: 0;
}
.export-progress {
  display: grid;
  gap: 10px;
}
.export-progress progress {
  width: 100%;
  height: 8px;
  accent-color: var(--accent);
}
.export-results {
  display: grid;
  gap: 10px;
}
.export-result {
  border: 1px solid var(--line);
  padding: 10px;
  border-radius: 6px;
  display: grid;
  gap: 8px;
}
.export-facts {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.6;
}
.technical-settings {
  display: grid;
  gap: 10px;
}
.conflict-card {
  margin: 10px 0;
}
.mobile-context-title {
  display: none;
}
.waveform-large {
  width: 100%;
  height: 60px;
  background: #edf6f0;
  border-radius: 6px;
}
.audio-waveforms,
.audio-routing {
  display: grid;
  gap: 8px;
}
.audio-waveform-lane strong {
  display: block;
  margin-bottom: 3px;
  font-size: 11px;
}
.audio-waveform-lane .waveform-large {
  display: block;
  height: 40px;
}
.audio-routing .button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
dialog {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0;
  width: min(660px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  color: var(--ink);
  background: var(--panel);
  box-shadow: 0 20px 90px #17201b33;
}
dialog::backdrop {
  background: #14221977;
  backdrop-filter: blur(2px);
}
.dialog-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.dialog-head h2 {
  font-size: 18px;
}
.dialog-body {
  display: grid;
  gap: 16px;
  padding: 20px;
}
.dialog-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  position: sticky;
  bottom: 0;
  background: #fff;
  border-top: 1px solid var(--line);
  padding: 14px 20px;
}
.choice-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.choice-grid > .help-wrap {
  display: flex;
}
.choice-grid button {
  width: 100%;
  height: auto;
  min-height: 92px;
  white-space: normal;
  display: grid;
  gap: 7px;
  padding: 10px;
  text-align: left;
  align-content: start;
}
.choice-grid canvas {
  width: 100%;
  height: 65px;
  object-fit: cover;
  border-radius: 4px;
}
.choice-grid small {
  font-size: 10px;
  font-weight: 400;
}
.media-choice {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
}
.media-choice img {
  width: 72px;
  height: 42px;
  object-fit: cover;
  border-radius: 4px;
}
.choice-copy {
  flex: 1;
  min-width: 0;
}
.media-choice strong {
  font-size: 12px;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.media-choice small {
  font-size: 10px;
}
.preset-illustration {
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  background: linear-gradient(120deg, #dceede, #e4eaff);
  font-size: 26px;
}
.studio-tooltip {
  position: fixed;
  z-index: 9999;
  max-width: 280px;
  padding: 10px 12px;
  border-radius: 6px;
  background: #17201b;
  color: #fff;
  box-shadow: 0 4px 18px #0003;
  pointer-events: none;
  font-size: 12px;
  line-height: 1.5;
}
.studio-tooltip strong,
.studio-tooltip span {
  display: block;
}
.studio-tooltip strong {
  margin-bottom: 4px;
}
.undo-toast {
  position: fixed;
  z-index: 1000;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 20px;
  background: var(--ink);
  color: #fff;
  padding: 10px 14px;
  border-radius: 8px;
  box-shadow: 0 4px 20px #17201b33;
  max-width: calc(100vw - 32px);
}
.undo-toast button {
  border: 0;
  background: transparent;
  color: #bed0ff;
}
.announcer {
  position: fixed;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}
.is-exporting .timeline-viewport,
.is-exporting .media-panel,
.is-exporting .interaction-box {
  pointer-events: none;
  opacity: 0.65;
}
.is-dragging-file .stage-viewport {
  outline: 3px dashed var(--accent);
  outline-offset: -7px;
}
.intro-card {
  display: grid;
  gap: 10px;
  line-height: 1.6;
}
.shortcut-list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 18px;
  font-size: 12px;
}
.shortcut-list dt {
  font-weight: 700;
}
.shortcut-list dd {
  margin: 0;
  color: var(--muted);
}
@media (min-width: 1600px) {
  .transport .transport-frame {
    display: inline-flex;
  }
}
@media (max-height: 893px) and (min-width: 760px) {
  .studio-shell {
    min-height: 0;
  }
  .editor-workspace {
    grid-template-rows: minmax(250px, 1fr) 320px;
  }
  .preview-card {
    grid-template-rows: 40px minmax(0, 1fr) 48px;
  }
  .stage-viewport {
    min-height: 0;
  }
}
@media (min-width: 760px) and (max-width: 1099px) {
  .studio-shell {
    grid-template-columns: minmax(0, 1fr) 280px;
  }
  .media-panel {
    display: none;
    position: fixed;
    top: var(--studio-header-height, 120px);
    bottom: 0;
    left: 0;
    width: 248px;
    z-index: 30;
    box-shadow: 12px 0 40px #17201b22;
  }
  .media-panel.is-open {
    display: block;
  }
  .drawer-action {
    display: inline-flex;
  }
  .topbar {
    padding: 0 12px;
    gap: 8px;
  }
  .brand-name {
    display: none;
  }
  .workflow-stepper {
    gap: 5px;
  }
  .workflow-stepper button {
    padding: 0 8px;
  }
  .step-connector {
    width: 15px;
  }
  .context-panel {
    padding: 16px 12px;
  }
  .transport .timecode {
    display: none;
  }
}
@media (min-width: 760px) {
  .studio-shell {
    height: calc(100dvh - var(--studio-header-height, 120px));
    min-height: 0;
    grid-template-rows: minmax(200px, 1fr) minmax(280px, 0.9fr);
  }
  .media-panel {
    grid-column: 1;
    grid-row: 1 / -1;
  }
  .editor-workspace {
    grid-column: 2;
    grid-row: 1;
    grid-template-rows: minmax(0, 1fr);
    min-height: 0;
  }
  /* Cached pages from studio-3 still nest the timeline in this workspace.
     Place both cards in the shell grid so the preview cannot collapse. */
  .editor-workspace:has(> .timeline-card) {
    display: contents;
  }
  .editor-workspace:has(> .timeline-card) > .preview-card {
    grid-column: 2;
    grid-row: 1;
  }
  .preview-card {
    grid-template-rows: 40px minmax(0, 1fr) 48px;
  }
  .stage-viewport {
    min-height: 0;
  }
  .context-panel {
    grid-column: 3;
    grid-row: 1;
    min-height: 0;
  }
  .timeline-card {
    grid-column: 2 / -1;
    grid-row: 2;
    min-height: 0;
  }
}
@media (min-width: 760px) and (max-width: 1099px) {
  .editor-workspace,
  .editor-workspace:has(> .timeline-card) > .preview-card {
    grid-column: 1;
  }
  .context-panel {
    grid-column: 2;
  }
  .timeline-card {
    grid-column: 1 / -1;
  }
}
@media (min-width: 760px) and (max-height: 599px) {
  body {
    overflow-y: auto;
  }
  .studio-shell {
    /* Preserve the two minimum grid rows when the window becomes shorter.
       A fixed 600px shell enlarged the preview at the 599px breakpoint. */
    min-height: 480px;
  }
}
@media (max-width: 759px) {
  body {
    overflow: auto;
  }
  .topbar {
    padding: 8px 10px;
    gap: 5px;
    height: auto;
    min-height: 104px;
    flex-wrap: wrap;
  }
  .brand-name,
  .save-status,
  .topbar #historyButtons,
  .topbar .offline-link {
    display: none;
  }
  .project-title {
    max-width: none;
    min-width: 0;
    flex: 1 0 100%;
    order: 2;
  }
  .topbar-actions {
    margin-left: auto;
  }
  .topbar-actions > .help-wrap:nth-child(-n + 2) {
    display: none;
  }
  .workflow-stepper {
    gap: 0;
    justify-content: space-around;
  }
  .workflow-stepper button {
    font-size: 10px;
    gap: 4px;
    padding: 0 3px;
    white-space: normal;
    line-height: 1.2;
    height: 44px;
    width: 100%;
  }
  .workflow-stepper > .help-wrap {
    flex: 1;
    min-width: 0;
  }
  .step-connector {
    display: none;
  }
  .step-number {
    width: 18px;
    height: 18px;
    font-size: 9px;
  }
  .studio-shell {
    display: block;
    min-height: calc(100vh - var(--studio-header-height, 120px));
    height: auto;
  }
  .editor-workspace {
    display: grid;
    grid-template-rows: 350px;
    min-height: 350px;
  }
  .timeline-card {
    height: 420px;
  }
  .preview-card {
    grid-template-rows: 40px 262px 48px;
  }
  .stage-viewport {
    padding: 8px;
  }
  .stage-head {
    padding: 0 10px;
  }
  .stage-facts {
    font-size: 9px;
  }
  #stageFacts {
    display: none;
  }
  .stage-title {
    font-size: 11px;
  }
  .stage-empty strong {
    font-size: 17px;
  }
  .stage-empty > span:last-child {
    font-size: 10px;
  }
  .stage-empty {
    gap: 8px;
  }
  .empty-film {
    font-size: 35px;
  }
  .transport {
    padding: 4px 6px;
    gap: 3px;
  }
  .transport .timecode {
    display: none;
  }
  .transport button {
    padding: 0 6px;
    min-width: 30px;
  }
  .transport .play-button {
    min-width: 48px;
  }
  .context-panel {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 62vh;
    z-index: 35;
    border: 1px solid var(--line);
    border-radius: 14px 14px 0 0;
    box-shadow: 0 -10px 50px #17201b33;
    padding: 16px;
  }
  .context-panel.is-open {
    display: flex;
  }
  .mobile-context-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .media-panel {
    display: none;
    position: fixed;
    top: var(--studio-header-height, 160px);
    bottom: 0;
    left: 0;
    width: min(320px, 90vw);
    z-index: 30;
    box-shadow: 12px 0 40px #17201b33;
  }
  .media-panel.is-open {
    display: block;
  }
  .drawer-action {
    display: inline-flex;
  }
  .timeline-head {
    padding: 6px;
    gap: 4px;
  }
  .timeline-head h2 {
    font-size: 11px;
  }
  .zoom-label input {
    width: 50px;
  }
  .timeline-head button {
    padding: 0 6px;
    font-size: 11px;
  }
  .timeline-secondary {
    display: none;
  }
  .choice-grid {
    grid-template-columns: 1fr 1fr;
  }
  .dialog-body {
    padding: 14px;
  }
  .dialog-head {
    padding: 12px 14px;
  }
  .dialog-head h2 {
    font-size: 16px;
  }
  .studio-shell[data-step="media"] .media-panel {
    display: block;
    position: relative;
    top: auto;
    bottom: auto;
    width: 100%;
    box-shadow: none;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .studio-shell[data-step="media"] .media-assets {
    grid-template-columns: 1fr 1fr;
  }
  .studio-shell[data-step="media"] .media-hint {
    display: none;
  }
  .studio-shell[data-step="export"] .context-panel {
    display: flex;
    position: relative;
    max-height: none;
    box-shadow: none;
    border-radius: 0;
  }
  .studio-shell[data-step="export"] .editor-workspace {
    min-height: 350px;
    grid-template-rows: 350px;
  }
  .studio-shell[data-step="export"] .timeline-card {
    display: grid;
  }
}
@media (hover: none) and (pointer: coarse) {
  .track-heading .button-row {
    gap: 4px;
  }
  .track-heading button {
    height: 40px;
    min-height: 40px;
  }
  .track-toggle-control {
    padding-right: 0 !important;
  }
  .track-toggle-control > .touch-help {
    display: none !important;
  }
  .help-wrap {
    padding-right: 40px;
  }
  .help-wrap > .touch-help {
    display: block;
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    min-width: 40px;
    min-height: 40px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 15px;
  }
  .trim-handle,
  .resize-handle {
    padding-right: 0;
  }
  .trim-handle .touch-help,
  .resize-handle .help-wrap > .touch-help {
    display: none;
  }
  .import-secondary {
    grid-template-columns: 1fr;
  }
  .timeline-head {
    overflow-x: auto;
    flex-shrink: 0;
  }
}
@media (max-width: 759px) and (hover: none) and (pointer: coarse) {
  .topbar button:not(.touch-help) {
    padding: 0 6px;
  }
  .workflow-stepper {
    height: 96px;
  }
  .workflow-stepper .help-wrap,
  .transport .help-wrap {
    padding-right: 0;
    padding-bottom: 40px;
  }
  .workflow-stepper .help-wrap > .touch-help,
  .transport .help-wrap > .touch-help {
    top: auto;
    right: 50%;
    bottom: 0;
    transform: translateX(50%);
  }
  .transport .icon-button {
    min-width: 40px;
  }
  .preview-card {
    grid-template-rows: 40px 222px 88px;
  }
  .transport {
    height: 88px;
  }
  .media-panel {
    top: var(--studio-header-height, 160px);
  }
  .studio-shell {
    min-height: calc(100vh - var(--studio-header-height, 160px));
  }
}
