:root {
  color-scheme: dark;
  --bg: #0a160c;
  --bg-deep: #050b06;
  --panel: #112312;
  --panel-2: #132615;
  --surface: #182f1c;
  --surface-2: #172b1a;
  --overlay: #0c1a0e;
  --scrim: rgba(4, 12, 8, 0.82);
  --accent-soft: rgba(212, 162, 74, 0.18);
  --app-bg: radial-gradient(130% 120% at 50% -8%, #142a17 0%, #0a160c 50%, #050b06 100%);
  --line: #233a26;
  --line-strong: #314836;
  --text: #f0f1ea;
  --muted: #9fb4a7;
  --soft: #dfe2d8;
  --accent: #d4a24a;
  --accent-2: #ecc572;
  --danger: #ff6f61;
  --paper: #f3eee2;
  --sticky-top-offset: 0px;
  --global-timeline-height: 112px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
}

html {
  scroll-padding-top: calc(var(--sticky-top-offset) + 12px);
}

body {
  margin: 0;
  background: var(--app-bg, var(--bg));
  color: var(--text);
  overflow: hidden;
}

button,
input,
select {
  font: inherit;
}

button,
select,
input[type="number"] {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
}

button {
  cursor: pointer;
}

button:disabled,
a.is-disabled {
  cursor: not-allowed;
  opacity: 0.46;
  pointer-events: none;
}

button[hidden],
a[hidden],
[hidden] {
  display: none !important;
}

.app-shell {
  display: grid;
  grid-template-rows: 72px minmax(0, 1fr) var(--global-timeline-height);
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  min-width: 960px;
}

.topbar {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px 14px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--overlay);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1 1 220px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid #5d6868;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(212, 162, 74, 0.18), rgba(243, 177, 90, 0.12)),
    var(--panel);
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
}

.brand h1 {
  margin: 0;
  font-size: 18px;
  line-height: 1.1;
  letter-spacing: 0;
}

.brand p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  max-width: 52vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-actions {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  flex-wrap: nowrap;
  gap: 10px;
  min-width: 0;
}

.topbar-ratio-toolbar {
  flex: 0 1 330px;
  min-width: 0;
}

.topbar-ratio-toolbar .ratio-chips {
  max-width: min(24vw, 300px);
  overflow-x: auto;
  scrollbar-width: none;
}

.topbar-ratio-toolbar .ratio-chips::-webkit-scrollbar {
  display: none;
}

.module-tabs {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.module-tabs button {
  position: relative;
  min-height: 30px;
  padding: 0 18px 0 9px;
  border-color: transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
  white-space: nowrap;
}

.module-tabs button::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 7px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(118, 129, 124, 0.58);
  transform: translateY(-50%);
}

.module-tabs button.is-module-enabled::after {
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(212, 162, 74, 0.14);
}

.module-tabs button.is-active {
  border-color: rgba(212, 162, 74, 0.48);
  background: #2e2613;
  color: #dcfff7;
}

.module-tabs button.is-module-locked {
  color: rgba(151, 160, 154, 0.48);
  cursor: pointer;
}

.module-tabs button.is-module-locked::after {
  background: rgba(151, 160, 154, 0.28);
  box-shadow: none;
}

.module-tabs button.is-module-locked.is-active {
  border-color: var(--line);
  background: transparent;
}

/* Cross-page link to clipflow, styled as the 5th segment of the tab strip so
   the suite switcher reads the same here as it does on the clipflow page. */
.module-tabs .module-tab-link {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
  text-decoration: none;
  white-space: nowrap;
  transition: border-color 140ms ease, background 140ms ease;
}

.module-tabs .module-tab-link:hover {
  border-color: var(--line-strong);
  background: var(--surface-2);
}

.export-preview-toggle {
  min-height: 34px;
  padding: 0 12px;
  border-color: rgba(255, 255, 255, 0.12);
  background: var(--bg-deep);
  color: var(--muted);
  font-size: 12px;
}

.export-preview-toggle.is-active {
  border-color: rgba(243, 177, 90, 0.66);
  background: rgba(243, 177, 90, 0.12);
  color: #ffe0aa;
}

.quick-export-button {
  min-height: 34px;
  padding-inline: 16px;
}

.icon-button,
.primary-button,
.secondary-button,
.download-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border-radius: 8px;
  text-decoration: none;
  transition: border-color 140ms ease, background 140ms ease, transform 140ms ease;
}

.icon-button {
  width: 40px;
  padding: 0;
}

.icon-button svg {
  width: 19px;
  height: 19px;
  fill: currentColor;
}

.primary-button {
  padding: 0 18px;
  border-color: rgba(212, 162, 74, 0.52);
  background: #2e2613;
  color: #eafff9;
  font-weight: 750;
}

.primary-button.is-recording {
  border-color: rgba(255, 111, 97, 0.65);
  background: #3a1b1a;
  color: #ffe6e2;
}

.secondary-button,
.download-link {
  padding: 0 12px;
  background: var(--surface);
  color: var(--soft);
  font-weight: 650;
}

.secondary-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--soft);
  font-weight: 650;
  text-decoration: none;
  white-space: nowrap;
  transition: border-color 140ms ease, background 140ms ease, transform 140ms ease;
}

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

.download-link:not(.is-disabled) {
  border-color: rgba(243, 177, 90, 0.56);
  color: #ffe2b3;
}

.license-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 9px;
  border: 1px solid rgba(243, 177, 90, 0.46);
  border-radius: 999px;
  background: rgba(243, 177, 90, 0.1);
  color: #ffe2b3;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.license-pill.is-pro {
  border-color: rgba(212, 162, 74, 0.62);
  background: rgba(212, 162, 74, 0.14);
  color: #dffff7;
}

button:hover,
.download-link:hover {
  border-color: var(--line-strong);
  background: var(--surface-2);
}

button:active {
  transform: translateY(1px);
}

.workspace {
  display: grid;
  grid-template-columns: 288px minmax(420px, 1fr) 288px;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  position: relative;
}

.module-frame-panel {
  position: relative;
  z-index: 2;
  display: block;
  grid-column: 1 / -1;
  grid-row: 2;
  min-height: 0;
  background: var(--bg-deep);
}

.module-frame-panel[hidden] {
  display: none;
}

.module-frame-panel iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: var(--bg-deep);
}

body[data-active-module="brand"] .workspace,
body[data-active-module="splash"] .workspace,
body[data-active-module="audio"] .workspace {
  grid-template-columns: minmax(0, 1fr);
}

body.show-export-preview[data-active-module="brand"] .workspace,
body.show-export-preview[data-active-module="splash"] .workspace,
body.show-export-preview[data-active-module="audio"] .workspace {
  grid-template-columns: minmax(320px, 34vw) minmax(420px, 1fr);
}

body[data-active-module="brand"] .panel-left,
body[data-active-module="splash"] .panel-left,
body[data-active-module="audio"] .panel-left {
  display: none;
}

body[data-active-module="brand"] .mobile-quick-panel,
body[data-active-module="splash"] .mobile-quick-panel,
body[data-active-module="audio"] .mobile-quick-panel {
  display: none;
}

body[data-active-module="brand"] .stage-area,
body[data-active-module="splash"] .stage-area,
body[data-active-module="audio"] .stage-area {
  position: absolute;
  grid-column: 1;
  grid-row: 2;
  grid-template-rows: minmax(0, 1fr);
  left: 0;
  top: 0;
  width: 864px;
  height: calc(864px / var(--preview-ratio, 1.7777778));
  min-height: calc(864px / var(--preview-ratio, 1.7777778));
  border-right: 0;
  opacity: 0;
  pointer-events: none;
  z-index: 0;
}

body.show-export-preview[data-active-module="brand"] .stage-area,
body.show-export-preview[data-active-module="splash"] .stage-area,
body.show-export-preview[data-active-module="audio"] .stage-area {
  position: relative;
  width: auto;
  height: auto;
  min-height: 0;
  border-right: 1px solid var(--line);
  opacity: 1;
  z-index: 1;
}

body[data-active-module="brand"] .module-frame-panel,
body[data-active-module="splash"] .module-frame-panel,
body[data-active-module="audio"] .module-frame-panel {
  grid-column: 1;
  grid-row: 1 / -1;
}

body.show-export-preview[data-active-module="brand"] .module-frame-panel,
body.show-export-preview[data-active-module="splash"] .module-frame-panel,
body.show-export-preview[data-active-module="audio"] .module-frame-panel {
  grid-column: 2;
}

body[data-active-module="brand"] .panel-right,
body[data-active-module="splash"] .panel-right,
body[data-active-module="audio"] .panel-right {
  display: none;
}

body[data-active-module="brand"] .panel-right [data-module-control],
body[data-active-module="splash"] .panel-right [data-module-control],
body[data-active-module="audio"] .panel-right [data-module-control] {
  display: none;
}

body.is-embedded .topbar {
  display: none;
}

body.is-embedded .app-shell {
  grid-template-rows: minmax(0, 1fr);
  min-width: 0;
}

.panel {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scroll-padding-top: 18px;
  background: var(--panel);
}

.panel-left {
  grid-column: 1;
  grid-row: 2;
  border-right: 1px solid var(--line);
}

.panel-right {
  grid-column: 3;
  grid-row: 1 / 3;
  border-left: 1px solid var(--line);
}

/* Collapse the whole right-hand controls panel (surface mode only). */
body.is-right-collapsed .panel-right {
  display: none;
}

body.is-right-collapsed:not([data-active-module="brand"]):not([data-active-module="splash"]):not([data-active-module="audio"]) .workspace {
  grid-template-columns: 288px minmax(420px, 1fr);
}

.control-group {
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.group-header h2 {
  margin: 0;
  color: var(--soft);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.control-group.is-collapsible .group-header {
  cursor: pointer;
  margin-bottom: 0;
}

.control-group.is-collapsible:not(.is-collapsed) .group-header {
  margin-bottom: 14px;
}

.control-group.is-collapsed > :not(.group-header) {
  display: none !important;
}

.accordion-toggle {
  width: 28px;
  min-height: 28px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--soft);
  font-size: 17px;
  font-weight: 850;
  line-height: 1;
}

.group-header span,
#sourceBadge {
  color: var(--muted);
  font-size: 12px;
}

.drop-zone {
  position: relative;
  display: grid;
  grid-template-columns: 40px 1fr;
  grid-template-rows: auto auto;
  gap: 4px 12px;
  align-items: center;
  min-height: 92px;
  padding: 14px;
  border: 1px dashed #596463;
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
}

.drop-zone.is-dragging {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.drop-zone input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  z-index: 2;
  cursor: pointer;
}

.drop-symbol {
  display: grid;
  grid-row: 1 / span 2;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--accent);
  background: var(--surface-2);
}

.drop-symbol svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.drop-zone strong {
  color: var(--text);
  font-size: 14px;
}

.drop-zone small {
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.button-row.single-action {
  grid-template-columns: 1fr;
  margin-top: 10px;
}

.export-module-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 12px 0 4px;
}

.asset-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.asset-nav[hidden] {
  display: none;
}

.asset-nav .asset-nav-step {
  flex: 0 0 auto;
  min-width: 38px;
  padding: 0 10px;
  font-size: 16px;
  line-height: 1;
}

.asset-nav .asset-nav-label {
  flex: 1 1 auto;
  min-width: 0;
  text-align: center;
  font-size: 12px;
  color: var(--muted, #9aa3b2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

[data-module-control][hidden] {
  display: none;
}

.full-button {
  width: 100%;
}

#sendToClipflowButton {
  margin-top: 10px;
}

.batch-picker {
  display: grid;
  grid-template-columns: 1fr;
  gap: 5px;
  margin-top: 16px;
  padding: 12px;
  border: 1px dashed #596463;
  border-radius: 8px;
  background: var(--surface);
  color: var(--soft);
  cursor: pointer;
}

.file-picker-input {
  position: fixed;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.batch-picker-button {
  width: 100%;
  text-align: left;
  font: inherit;
}

.batch-picker + .batch-picker {
  margin-top: 10px;
}

.batch-picker span {
  font-size: 13px;
  font-weight: 750;
}

.batch-picker small,
.batch-status {
  color: var(--muted);
  font-size: 12px;
}

.batch-status {
  min-height: 16px;
  margin: 10px 0 0;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 16px;
}

.segmented button {
  min-width: 0;
  min-height: 34px;
  padding: 0 8px;
  border-color: var(--line-strong);
  border-radius: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.05;
  outline: 1px solid rgba(255, 255, 255, 0.04);
  outline-offset: -2px;
  overflow-wrap: anywhere;
}

.segmented button.is-active {
  border-color: rgba(212, 162, 74, 0.65);
  background: #2e2613;
  color: #dcfff7;
}

.material-segmented {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 16px;
  margin-bottom: 0;
}

.material-segmented button {
  min-height: 38px;
  padding: 0 6px;
  border-color: var(--line-strong);
  font-size: 11px;
}

.axis-segmented {
  grid-template-columns: repeat(2, 1fr);
  margin-top: 14px;
  margin-bottom: 0;
}

.slider-field,
.field {
  display: grid;
  grid-template-columns: 72px 1fr 42px;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 12px;
}

.field {
  grid-template-columns: 72px 1fr;
}

.slider-field[hidden],
.field[hidden] {
  display: none !important;
}

.field input,
.field select {
  width: 100%;
  min-height: 34px;
  border-radius: 8px;
  padding: 0 10px;
}

.slider-field output {
  color: var(--soft);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.keyframe-panel {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--overlay);
}

.keyframe-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.keyframe-header output {
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.keyframe-playhead {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.keyframe-slider {
  grid-template-columns: 58px 1fr 48px;
  margin-top: 10px;
}

.keyframe-actions {
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.keyframe-actions .secondary-button {
  min-width: 0;
  min-height: 32px;
  padding: 0 8px;
  font-size: 12px;
}

.keyframe-list {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.keyframe-list-empty {
  color: var(--muted);
  font-size: 11px;
}

.keyframe-list button {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 28px;
  padding: 0 8px;
  border-radius: 7px;
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.keyframe-list button.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--text);
}

.keyframe-list span:last-child {
  text-align: right;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
}

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

.export-switch {
  margin-top: 2px;
}

.stage-area {
  grid-column: 2;
  grid-row: 1 / 3;
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  --preview-ratio: 1.7777778;
  --preview-aspect: 16 / 9;
  min-width: 0;
  min-height: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0)),
    var(--app-bg, var(--bg-deep));
}

.stage-area.is-transparent-backdrop {
  background-color: var(--surface-2);
  background-image:
    linear-gradient(45deg, rgba(255, 255, 255, 0.12) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(255, 255, 255, 0.12) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(255, 255, 255, 0.12) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(255, 255, 255, 0.12) 75%);
  background-position: 0 0, 0 12px, 12px -12px, -12px 0;
  background-size: 24px 24px;
}

.canvas-frame {
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  container-type: size;
}

.stage-area.preview-aspect-16-9 {
  --preview-ratio: 1.7777778;
  --preview-aspect: 16 / 9;
}

.stage-area.preview-aspect-9-16 {
  --preview-ratio: 0.5625;
  --preview-aspect: 9 / 16;
}

.stage-area.preview-aspect-1-1 {
  --preview-ratio: 1;
  --preview-aspect: 1 / 1;
}

#stageCanvas,
#finalPreviewCanvas {
  grid-area: 1 / 1;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  display: block;
}

#stageCanvas {
  cursor: grab;
}

.stage-area.is-preview-framed #stageCanvas,
.stage-area.is-preview-framed #finalPreviewCanvas {
  width: min(100cqw, calc(100cqh * var(--preview-ratio)));
  height: min(100cqh, calc(100cqw / var(--preview-ratio)));
  aspect-ratio: var(--preview-aspect);
  background: var(--bg-deep);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.stage-area.is-transparent-backdrop.is-preview-framed #stageCanvas,
.stage-area.is-transparent-backdrop.is-preview-framed #finalPreviewCanvas {
  background: transparent;
}

#finalPreviewCanvas[hidden] {
  display: none;
}

#finalPreviewCanvas {
  pointer-events: none;
}

#stageCanvas:active {
  cursor: grabbing;
}

.stage-hud {
  position: absolute;
  top: 14px;
  left: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-width: calc(100% - 28px);
  pointer-events: none;
}

.ratio-toolbar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  pointer-events: auto;
}

.ratio-chips {
  display: flex;
  gap: 5px;
}

.ratio-remove-button,
.ratio-select-button,
.ratio-add-button {
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: var(--surface);
  color: #dbe3df;
  font-size: 12px;
  font-weight: 800;
  backdrop-filter: blur(8px);
}

.ratio-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.ratio-select-button {
  border-radius: 8px;
}

.ratio-remove-button {
  min-height: 20px;
  width: 20px;
  padding: 0;
  border-radius: 999px;
  color: #b7c1bd;
  font-size: 13px;
}

.ratio-chip.is-active .ratio-select-button {
  border-color: rgba(212, 162, 74, 0.66);
  color: #dffff8;
  background: rgba(22, 52, 47, 0.86);
}

.ratio-chip.is-active .ratio-remove-button {
  border-color: rgba(212, 162, 74, 0.36);
}

.ratio-add-button {
  width: 28px;
  padding: 0;
}

.ratio-menu {
  position: absolute;
  z-index: 40;
  top: 34px;
  left: 0;
  display: grid;
  gap: 4px;
  min-width: 132px;
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: var(--overlay);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(10px);
}

.ratio-menu.is-hidden {
  display: none;
}

.ratio-menu button {
  justify-content: flex-start;
  min-height: 30px;
  padding: 0 9px;
  border-radius: 6px;
  color: var(--soft);
  font-size: 12px;
  font-weight: 750;
  text-align: left;
}

.stage-hud span {
  min-height: 28px;
  padding: 6px 9px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: var(--scrim);
  color: #dbe3df;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  backdrop-filter: blur(8px);
}

.stage-keyframe-tooltip {
  position: absolute;
  left: 50%;
  bottom: 22px;
  z-index: 6;
  max-width: min(420px, calc(100% - 32px));
  padding: 8px 12px;
  border: 1px solid rgba(212, 162, 74, 0.42);
  border-radius: 8px;
  background: var(--scrim);
  color: #eafff8;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition: opacity 160ms ease, transform 160ms ease;
  backdrop-filter: blur(10px);
}

.stage-keyframe-tooltip.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.mobile-preview-transport {
  display: none;
}

.mobile-quick-panel {
  display: none;
  grid-column: 1;
  grid-row: 1;
  grid-template-columns: 1fr;
  gap: 12px;
  align-content: start;
  padding: 14px 18px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.mobile-source-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  align-items: stretch;
}

.mobile-import-button {
  grid-column: 1 / -1;
}

.mobile-import-button {
  position: relative;
  display: grid;
  gap: 2px;
  min-height: 48px;
  padding: 9px 12px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--text);
  cursor: pointer;
}

.mobile-import-button input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  z-index: 2;
  cursor: pointer;
}

.mobile-import-button span {
  font-size: 13px;
  font-weight: 850;
}

.mobile-import-button small {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mobile-preset-set {
  display: none;
  gap: 7px;
}

body[data-active-module="surface"] .mobile-preset-set[data-mobile-presets="surface"],
body[data-active-module="brand"] .mobile-preset-set[data-mobile-presets="brand"],
body[data-active-module="splash"] .mobile-preset-set[data-mobile-presets="splash"],
body[data-active-module="audio"] .mobile-preset-set[data-mobile-presets="audio"] {
  display: grid;
}

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

.preset-grid button {
  min-height: 42px;
  padding: 7px 8px;
  border-radius: 8px;
  background: var(--surface);
  color: var(--soft);
  font-size: 12px;
  font-weight: 800;
}

.preset-grid button.is-active {
  border-color: rgba(212, 162, 74, 0.72);
  background: #2e2613;
  color: #eafff8;
}

.mobile-preset-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.mobile-preset-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.mobile-preset-row button {
  min-height: 42px;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--soft);
  font-size: 12px;
  font-weight: 850;
}

.mobile-preset-row button.is-active {
  border-color: rgba(212, 162, 74, 0.72);
  background: #2e2613;
  color: #eafff8;
}

.timeline {
  display: grid;
  grid-template-columns: 62px 52px minmax(0, 1fr) 52px;
  align-items: center;
  gap: 10px;
  padding: 10px 18px 16px;
  border-top: 1px solid var(--line);
  background: var(--overlay);
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.global-timeline {
  position: relative;
  z-index: 20;
  min-height: var(--global-timeline-height);
}

.timeline-button {
  min-width: 0;
  min-height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  background: var(--surface);
  color: var(--soft);
  font-size: 12px;
  font-weight: 750;
}

/* Align the play button + time labels with the scrubber, which sits above the track's vertical centre */
.timeline > .timeline-button,
.timeline > span {
  margin-bottom: 24px;
}

.timeline-button.is-playing {
  border-color: rgba(212, 162, 74, 0.56);
  background: #2e2613;
  color: #dcfff7;
}

.timeline-track {
  position: relative;
  min-width: 0;
  min-height: 72px;
}

.timeline-track input {
  position: relative;
  z-index: 1;
  display: block;
  margin: 16px 0 0;
}

.timeline-keyframes {
  position: absolute;
  inset: -9px 0;
  z-index: 2;
  pointer-events: none;
}

.timeline-keyframes button {
  position: absolute;
  top: 50%;
  width: 13px;
  height: 22px;
  min-height: 0;
  padding: 0;
  border-radius: 7px;
  background: #f3b15a;
  box-shadow: 0 0 0 2px rgba(8, 10, 10, 0.8);
  transform: translate(-50%, -50%);
  pointer-events: auto;
  cursor: grab;
}

.timeline-keyframes button:active {
  cursor: grabbing;
}

.timeline-keyframes button.is-active {
  background: var(--accent);
  box-shadow: 0 0 0 2px rgba(8, 10, 10, 0.9), 0 0 0 4px rgba(212, 162, 74, 0.32);
}

.timeline-section-bars {
  position: absolute;
  left: 0;
  right: 0;
  top: 50px;
  height: 22px;
  z-index: 3;
  pointer-events: auto;
}

.timeline-section-bars[hidden] {
  display: none;
}

.timeline-section-segment {
  position: absolute;
  top: 2px;
  height: 10px;
  min-width: 4px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  color: rgba(247, 255, 249, 0.88);
  font-size: 7px;
  font-weight: 850;
  line-height: 8px;
  text-align: center;
  white-space: nowrap;
}

.timeline-section-segment.is-intro {
  background: rgba(212, 162, 74, 0.42);
}

.timeline-section-segment.is-video {
  background: rgba(255, 255, 255, 0.12);
}

.timeline-section-segment.is-ending {
  background: rgba(243, 177, 90, 0.46);
}

.timeline-section-segment.is-transition {
  background: rgba(121, 215, 255, 0.26);
}

.timeline-section-marker {
  position: absolute;
  top: -2px;
  width: 12px;
  height: 18px;
  min-height: 0;
  padding: 0;
  border: 1px solid rgba(247, 255, 249, 0.78);
  border-radius: 4px;
  background: var(--panel);
  box-shadow: 0 0 0 1px var(--scrim);
  cursor: ew-resize;
  transform: translateX(-50%);
}

.timeline-section-marker::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 4px;
  width: 2px;
  height: 10px;
  background: var(--accent);
  transform: translateX(-50%);
}

.timeline-text-cues {
  position: absolute;
  left: 0;
  right: 0;
  top: 50px;
  height: 22px;
  z-index: 3;
  pointer-events: auto;
}

.timeline-text-cues[hidden] {
  display: none;
}

.timeline-text-cues button {
  position: absolute;
  top: 1px;
  height: 14px;
  min-height: 0;
  padding: 0;
  border: 1px solid rgba(212, 162, 74, 0.6);
  border-radius: 999px;
  background: rgba(212, 162, 74, 0.42);
  box-shadow: 0 0 0 1px rgba(8, 10, 10, 0.72);
  cursor: grab;
  touch-action: none;
}

.timeline-text-cues button:active {
  cursor: grabbing;
}

.timeline-text-cues button.is-active {
  border-color: rgba(243, 177, 90, 0.86);
  background: rgba(243, 177, 90, 0.7);
}

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

.progress {
  width: 100%;
  height: 8px;
  margin-top: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.progress span {
  display: block;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 120ms linear;
}

/* Offline-render cover: hides the stretched export-resolution canvas and
   shows just a progress bar while a fast render is in progress. */
.fast-export-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--app-bg, var(--bg));
}

.fast-export-overlay[hidden] {
  display: none;
}

.fast-export-card {
  display: grid;
  gap: 12px;
  width: min(420px, 100%);
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  text-align: center;
}

.fast-export-card strong {
  color: var(--text);
  font-size: 15px;
}

.fast-export-bar {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-2);
}

.fast-export-bar span {
  display: block;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 120ms linear;
}

.fast-export-card small {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.fast-export-file {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fast-export-global {
  display: grid;
  gap: 7px;
  margin-top: 4px;
  padding-top: 13px;
  border-top: 1px solid var(--line);
}

.fast-export-global[hidden] {
  display: none;
}

.fast-export-global-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Belt-and-braces: also dim the live stage underneath during the render. */
body.is-fast-rendering .stage-area {
  visibility: hidden;
}

.paywall-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 22px;
  background: var(--scrim);
  backdrop-filter: blur(10px);
}

.paywall-modal.is-hidden {
  display: none;
}

.paywall-card {
  width: min(860px, 100%);
  max-height: min(86vh, 780px);
  overflow: auto;
  padding: 20px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 24px 72px rgba(0, 0, 0, 0.46);
}

.paywall-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.paywall-header h2 {
  margin: 0;
  color: var(--text);
  font-size: 18px;
  letter-spacing: 0;
}

.paywall-header p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.paywall-header .icon-button svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.8;
}

.pro-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px 18px;
  margin-top: 16px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--soft);
  font-size: 12px;
  line-height: 1.45;
}

.pro-grid li {
  margin-left: 16px;
}

.purchase-options {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.purchase-option {
  display: grid;
  align-content: start;
  gap: 7px;
  min-height: 118px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  text-align: left;
  cursor: pointer;
}

.purchase-option.is-current-app {
  grid-column: span 2;
  min-height: 178px;
  padding: 16px;
  border-color: rgba(77, 255, 184, 0.5);
  background: linear-gradient(180deg, rgba(77, 255, 184, 0.08), rgba(255, 255, 255, 0.035));
}

.purchase-option.is-bundle-option {
  grid-column: span 1;
  border-color: rgba(255, 208, 102, 0.32);
}

.purchase-option.is-secondary-single {
  min-height: 68px;
  padding: 10px;
  opacity: 0.72;
}

.purchase-option-eyebrow {
  color: var(--accent);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.purchase-option strong {
  color: var(--text);
  font-size: 13px;
}

.purchase-option.is-current-app strong {
  font-size: 17px;
}

.purchase-option span,
.purchase-option small {
  font-size: 11px;
  line-height: 1.35;
}

.purchase-option-features {
  display: grid;
  gap: 4px;
  margin: 2px 0 0;
  padding: 0 0 0 16px;
  color: var(--soft);
  font-size: 11px;
  line-height: 1.32;
}

.purchase-option.is-secondary-single span,
.purchase-option.is-secondary-single .purchase-option-features {
  display: none;
}

.purchase-option-status {
  color: var(--accent);
  font-weight: 750;
}

.purchase-option.is-active {
  border-color: rgba(77, 255, 184, 0.58);
  box-shadow: inset 0 0 0 1px rgba(77, 255, 184, 0.18);
}

.purchase-option.is-disabled small {
  color: var(--muted);
}

.purchase-option.is-owned {
  border-color: rgba(77, 255, 184, 0.34);
}

.purchase-option.is-owned small {
  color: var(--accent);
}

.paywall-actions {
  display: grid;
  grid-template-columns: minmax(170px, auto) minmax(0, 1fr) 104px;
  gap: 10px;
  align-items: end;
  margin-top: 16px;
}

.paywall-actions .primary-button.is-disabled {
  pointer-events: none;
  opacity: 0.5;
}

.license-entry {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.license-entry input {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: var(--surface);
  color: var(--text);
}

.license-status {
  min-height: 18px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.legal-links {
  display: flex;
  gap: 14px;
  margin-top: 10px;
}

.legal-links a {
  color: var(--muted);
  font-size: 12px;
  text-decoration: none;
}

.legal-links a:hover {
  color: var(--accent);
}

#sourceVideo {
  position: fixed;
  width: 1px;
  height: 1px;
  left: -9999px;
  top: -9999px;
  opacity: 0;
  pointer-events: none;
}

@media (max-width: 1180px) {
  .app-shell {
    min-width: 760px;
  }

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

  body[data-active-module="brand"] .workspace,
  body[data-active-module="splash"] .workspace,
  body[data-active-module="audio"] .workspace {
    grid-template-columns: minmax(0, 1fr);
  }

  body.show-export-preview[data-active-module="brand"] .workspace,
  body.show-export-preview[data-active-module="splash"] .workspace,
  body.show-export-preview[data-active-module="audio"] .workspace {
    grid-template-columns: minmax(260px, 32vw) minmax(360px, 1fr);
  }

  .slider-field {
    grid-template-columns: 64px 1fr 38px;
  }
}

@media (max-width: 860px) {
  :root {
    --sticky-top-offset: max(env(safe-area-inset-top, 0px), 10px);
  }

  body {
    overflow: auto;
    overflow-x: hidden;
    min-height: 100dvh;
  }

  .app-shell {
    min-width: 0;
    min-height: 100vh;
    min-height: 100dvh;
    height: auto;
    grid-template-rows: auto 1fr;
  }

  .topbar {
    position: sticky;
    top: var(--sticky-top-offset);
    z-index: 4;
    flex-wrap: wrap;
    width: 100%;
    max-width: 100vw;
    min-width: 0;
    padding: 12px;
  }

  .brand {
    flex: 1 1 220px;
  }

  .brand p {
    max-width: 58vw;
  }

  .top-actions {
    flex: 1 1 100%;
    min-width: 0;
    max-width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .top-actions::-webkit-scrollbar {
    display: none;
  }

  .module-tabs,
  .topbar-ratio-toolbar {
    flex: 0 0 auto;
  }

  .top-actions .primary-button,
  .top-actions .secondary-button,
  .top-actions .download-link {
    flex: 0 0 auto;
  }

  .workspace {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100vw;
    min-height: 0;
    min-width: 0;
  }

  .mobile-quick-panel {
    order: 0;
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    background: var(--panel);
  }

  .mobile-quick-panel .secondary-button {
    min-height: 48px;
    padding-inline: 14px;
  }

  .mobile-source-row {
    grid-template-columns: minmax(0, 1fr) auto auto;
  }

  .mobile-import-button {
    grid-column: auto;
  }

  .mobile-preset-row {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .stage-area {
    order: 1;
    height: min(68vh, 560px);
    min-height: 440px;
  }

  body[data-active-module="brand"] .stage-area,
  body[data-active-module="splash"] .stage-area,
  body[data-active-module="audio"] .stage-area {
    position: absolute;
    left: -9999px;
    order: 0;
    width: 864px;
    height: calc(864px / var(--preview-ratio, 1.7777778));
    min-height: calc(864px / var(--preview-ratio, 1.7777778));
    border-right: 0;
    border-bottom: 0;
    opacity: 0;
    pointer-events: none;
  }

  body.show-export-preview[data-active-module="brand"] .stage-area,
  body.show-export-preview[data-active-module="splash"] .stage-area,
  body.show-export-preview[data-active-module="audio"] .stage-area {
    position: relative;
    left: auto;
    order: 1;
    width: auto;
    height: min(52vh, 460px);
    min-height: 320px;
    border-bottom: 1px solid var(--line);
    opacity: 1;
    pointer-events: none;
  }

  body[data-active-module="brand"] .module-frame-panel,
  body[data-active-module="splash"] .module-frame-panel,
  body[data-active-module="audio"] .module-frame-panel {
    order: 1;
    min-height: 1400px;
  }

  body[data-active-module="brand"] .module-frame-panel {
    min-height: 1700px;
  }

  body[data-active-module="splash"] .module-frame-panel {
    min-height: 1800px;
  }

  body[data-active-module="audio"] .module-frame-panel {
    min-height: 2300px;
  }

  body.show-export-preview[data-active-module="brand"] .module-frame-panel,
  body.show-export-preview[data-active-module="splash"] .module-frame-panel,
  body.show-export-preview[data-active-module="audio"] .module-frame-panel {
    order: 2;
  }

  .panel-left {
    order: 2;
    border-right: 0;
    border-top: 1px solid var(--line);
  }

  .panel-right {
    order: 3;
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .panel {
    width: 100%;
    max-width: 100vw;
    min-width: 0;
    overflow: visible;
    scroll-margin-top: calc(var(--sticky-top-offset) + 88px);
  }

  .panel-left [data-global-control="source"] {
    display: none;
  }

  .control-group {
    padding: 16px;
  }

  .segmented {
    grid-template-columns: repeat(2, 1fr);
  }

  .stage-hud {
    top: 10px;
    left: 10px;
  }

  .mobile-preview-transport {
    position: absolute;
    right: 10px;
    bottom: 10px;
    left: 10px;
    z-index: 5;
    display: grid;
    grid-template-columns: 58px 58px 38px minmax(0, 1fr) 38px;
    gap: 8px;
    align-items: center;
    min-height: 44px;
    padding: 7px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    background: var(--overlay);
    backdrop-filter: blur(10px);
  }

  .stage-keyframe-tooltip {
    bottom: 66px;
  }

  .mobile-preview-transport span {
    color: var(--soft);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    text-align: center;
    white-space: nowrap;
  }

  .mobile-preview-transport input {
    width: 100%;
    min-width: 0;
  }
}

@media (max-width: 520px) {
  .brand-mark {
    width: 36px;
    height: 36px;
  }

  .brand h1 {
    font-size: 16px;
  }

  .brand p {
    max-width: 68vw;
  }

  .stage-area {
    height: 58vh;
    min-height: 360px;
  }

  body[data-active-module="brand"] .module-frame-panel,
  body[data-active-module="splash"] .module-frame-panel,
  body[data-active-module="audio"] .module-frame-panel {
    min-height: 1600px;
  }

  body[data-active-module="brand"] .module-frame-panel {
    min-height: 1820px;
  }

  body[data-active-module="splash"] .module-frame-panel {
    min-height: 1920px;
  }

  body[data-active-module="audio"] .module-frame-panel {
    min-height: 2540px;
  }

  .timeline {
    grid-template-columns: 50px 40px minmax(0, 1fr) 40px;
    gap: 8px;
    padding: 8px 10px 14px;
  }

  .mobile-preview-transport {
    grid-template-columns: 50px 50px minmax(0, 1fr);
  }

  .mobile-preview-transport span {
    display: none;
  }

  .slider-field {
    grid-template-columns: 68px 1fr 38px;
  }

  .paywall-actions,
  .pro-grid {
    grid-template-columns: 1fr;
  }
}
