:root {
  color-scheme: dark;
  --bg: #09090b;
  --panel: #111114;
  --panel2: #18181b;
  --line: #27272a;
  --line2: #3f3f46;
  --text: #fafafa;
  --muted: #a1a1aa;
  --dim: #71717a;
  --accent: #38bdf8;
  --accent-dark: #0ea5e9;
  --accent-dim: rgba(56, 189, 248, 0.14);
  --accent-border: rgba(56, 189, 248, 0.45);
  --ok: #10b981;
  --warn: #f59e0b;
  --err: #f43f5e;
  --sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 13.5px/1.45 var(--sans);
  accent-color: var(--accent);
  -webkit-font-smoothing: antialiased;
}

body {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.mono {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

.ico {
  flex: none;
  display: block;
}

[hidden] {
  display: none !important;
}

.srVideo {
  position: fixed;
  left: -16px;
  top: -16px;
  width: 2px;
  height: 2px;
  opacity: 0.001;
  pointer-events: none;
}

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

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible,
[role="slider"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Tool Sub-Header Strip (unified 52px bar) */
.toolBar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 52px;
  min-height: 52px;
  padding: 0 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  flex-wrap: nowrap;
}

.toolBarLeft,
.toolBarCenter,
.toolBarRight {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex-wrap: nowrap;
  max-width: 100%;
}

.toolBarCenter {
  overflow-x: auto;
  scrollbar-width: none;
}
.toolBarCenter::-webkit-scrollbar {
  display: none;
}

.rfToolTitle {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
}

.accentDot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
  flex: none;
}

.toolName[data-tool-name] {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--text);
  white-space: nowrap;
}

.rfToolTag {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 99px;
  padding: 3px 9px;
  white-space: nowrap;
}

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

.stChip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 11px;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: var(--panel);
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

.stChip.ok {
  color: #7dd3fc;
  border-color: rgba(56, 189, 248, 0.35);
  background: rgba(56, 189, 248, 0.08);
}

.stChip.ok::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.quickPresetBtn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  height: 28px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  border-radius: 99px;
  padding: 0 10px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.quickPresetBtn:hover {
  border-color: var(--line2);
  color: var(--text);
}

.quickPresetBtn.on {
  border-color: var(--accent-border);
  background: var(--accent-dim);
  color: #bae6fd;
}

.presetGroup {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 38px;
  padding: 0 4px 0 10px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--panel);
  color: var(--muted);
}

.presetGroup select {
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
  max-width: 180px;
  height: 30px;
  padding: 0 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.presetGroup select option,
.presetGroup select optgroup {
  background: var(--panel2);
  color: var(--text);
}

.iconBtn {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  padding: 0;
}

.iconBtn:hover:not(:disabled) {
  background: var(--panel2);
  color: var(--text);
}

.iconBtn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.devLangSwitch {
  display: inline-flex;
  gap: 2px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 2px;
}

.langBtn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  padding: 5px 8px;
  border-radius: 7px;
}

.langBtn.on {
  background: var(--text);
  color: var(--bg);
}

/* Hide dev lang switcher when Aurer production bar injects its own .aurerLang */
body:has(> .aurerBar .aurerLang) .devLangSwitch {
  display: none;
}

/* Notices & Inline Prompts */
.stNote {
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0 14px;
}

.stNote:has(> :not([hidden]):not(:empty)) {
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.warnBanner {
  padding: 9px 12px;
  border-radius: 9px;
  background: rgba(244, 63, 94, 0.12);
  border: 1px solid rgba(244, 63, 94, 0.45);
  color: #fda4af;
  font-size: 12.5px;
  font-weight: 600;
}

.presetAsk {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--accent-border);
  border-radius: 9px;
  background: var(--panel2);
  font-size: 12.5px;
}

.presetAsk[hidden] {
  display: none;
}

.presetAsk input {
  flex: 1;
  min-width: 160px;
  max-width: 280px;
}

.presetHint:empty {
  display: none;
}

/* Main Studio Split */
main.studio {
  flex: 1 1 0;
  min-height: 0;
  display: grid;
  grid-template-columns: 400px minmax(0, 1fr);
  background: var(--bg);
}

@media (max-width: 1100px) and (min-width: 901px) {
  main.studio {
    grid-template-columns: 360px minmax(0, 1fr);
  }
}

/* Left Sidebar */
.side {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--line);
  background: var(--bg);
}

.stepTabs {
  flex: none;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  padding: 8px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}

.stepTab {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 9px 2px 8px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 14px;
  text-align: center;
  min-width: 0;
}

.stepTab span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.stepTab:hover {
  color: var(--text);
  background: var(--panel);
}

.stepTab[aria-selected="true"] {
  color: #ffffff;
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.5);
  box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.15);
}

.stepTab[aria-selected="true"] .ico {
  color: var(--accent);
}

.panes {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--line2) transparent;
}

.paneInner {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 14px 22px;
}

/* Cards & Controls */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cardHead {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  border-radius: 8px;
}

.cardHead > div,
.cardHead > h2 {
  flex: 1;
  min-width: 0;
}

.cardHead:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.cardHead h2 {
  margin: 0;
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text);
  line-height: 1.25;
}

.cardHead p {
  margin: 2px 0 0;
  font-size: 11.5px;
  color: var(--dim);
  line-height: 1.3;
}

.cardChev {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  color: var(--dim);
  flex: none;
  transition: transform 0.18s ease, color 0.15s;
}

.cardChev svg {
  width: 15px;
  height: 15px;
  display: block;
}

.cardHead:hover .cardChev {
  color: var(--text);
}

.card.is-collapsed {
  padding-bottom: 14px;
  gap: 0;
}

.card.is-collapsed .cardChev {
  transform: rotate(-90deg);
}

.card.is-collapsed > :not(.cardHead) {
  display: none !important;
}

@media (prefers-reduced-motion: reduce) {
  .cardChev {
    transition: none;
  }
}

.cIco {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--accent-dim);
  color: var(--accent);
  flex: none;
}

.badgeMono {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--accent);
}

.linkBtn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 4px;
}
.linkBtn:hover {
  text-decoration: underline;
}

/* Dropzone */
.drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 18px 12px;
  border: 1.5px dashed var(--line2);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.015);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
}

.drop input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.dropIco {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--accent-dim);
  color: var(--accent);
}

.dropIco.large {
  width: 48px;
  height: 48px;
}

.drop .big {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  word-break: break-word;
}

.drop .small {
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--dim);
}

.drop:hover,
.drop.over {
  border-color: var(--accent);
  background: rgba(56, 189, 248, 0.07);
}

.drop.filled {
  border-style: solid;
  border-color: var(--accent-border);
  background: rgba(56, 189, 248, 0.05);
  padding: 12px;
}

.specsGrid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

.specsGrid[hidden] {
  display: none;
}

.specBox {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 9px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.specK {
  font-size: 10px;
  color: var(--dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.specV {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Inputs & Segmented Pill / Card Groups */
.grid2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.fieldStack {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.fieldStack > span {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.inputCtrl {
  width: 100%;
  height: 38px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  font-size: 13px;
  color: var(--text);
}

.inputCtrl:focus {
  outline: none;
  border-color: var(--accent);
}

.inputCtrl:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.segPills {
  display: grid;
  gap: 3px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 3px;
}

.segCards {
  display: grid;
  gap: 6px;
}

.cols2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.segBtn {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  border-radius: 7px;
  padding: 7px 6px;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  min-width: 0;
}

.segBtn:hover:not(:disabled):not(.on) {
  color: var(--text);
  background: var(--panel2);
}

.segBtn.on {
  background: var(--text);
  color: var(--bg);
}

.segCards .segBtn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  text-align: left;
  padding: 9px 10px;
  background: var(--bg);
  border-color: var(--line);
  border-radius: 10px;
}

.segCards .segBtn .sT {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}

.segCards .segBtn .sS {
  font-size: 10.5px;
  color: var(--dim);
}

.segCards .segBtn.on {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--text);
}

.segCards .segBtn.on .sS {
  color: #bae6fd;
}

.segBtn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* Range Sliders */
.rangeRow {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.rangeTop {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
}

.rangeTop .mono {
  color: var(--text);
  font-weight: 600;
}

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

input[type="range"]::-webkit-slider-runnable-track {
  height: 5px;
  border-radius: 99px;
  background: var(--line2);
}

input[type="range"]::-moz-range-track {
  height: 5px;
  border-radius: 99px;
  background: var(--line2);
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 15px;
  height: 15px;
  margin-top: -5px;
  border-radius: 50%;
  background: var(--text);
  border: 3px solid var(--accent);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.22);
}

input[type="range"]::-moz-range-thumb {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--text);
  border: 3px solid var(--accent);
}

input[type="range"]:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Switches */
.switchRow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0;
  cursor: pointer;
}

.switchInline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
}

.rowBetween {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.switchCtrl {
  -webkit-appearance: none;
  appearance: none;
  flex: none;
  width: 38px;
  height: 22px;
  margin: 0;
  border-radius: 99px;
  background: var(--line2);
  position: relative;
  cursor: pointer;
  transition: background-color 0.15s;
}

.switchCtrl::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--text);
  transition: transform 0.15s;
}

.switchCtrl:checked {
  background: var(--accent-dark);
}

.switchCtrl:checked::after {
  transform: translateX(16px);
}

.switchCtrl:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Estimate Card */
.estCard {
  border-color: var(--accent-border);
  background: linear-gradient(155deg, rgba(56, 189, 248, 0.08), var(--panel));
}

.savingsBadge {
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--accent-dim);
  border: 1px solid var(--accent-border);
  color: #bae6fd;
  font-size: 11px;
  font-weight: 700;
}

.estRow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.estRow > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.estRight {
  text-align: right;
}

.estArrow {
  color: var(--dim);
  font-size: 16px;
}

.estValMuted {
  font-size: 15px;
  color: var(--muted);
}

.estValAccent {
  font-size: 18px;
  color: var(--accent);
}

.hint {
  margin: 0;
  font-size: 11.5px;
  color: var(--dim);
}

.warnText {
  color: #fbbf24;
}

/* Buttons */
.btn {
  appearance: none;
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 700;
  background: var(--accent-dark);
  color: #031520;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  text-decoration: none;
}

.btn:hover:not(:disabled) {
  filter: brightness(1.08);
}

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

.btn.ghost {
  background: var(--panel2);
  color: var(--text);
  border: 1px solid var(--line);
}

.btn.ghost:hover:not(:disabled) {
  border-color: var(--line2);
  background: #202026;
}

.btn.small {
  padding: 7px 11px;
  font-size: 12px;
  border-radius: 8px;
}

.btn.danger {
  background: #be123c;
  color: #fff;
}

.btn.okBtn {
  background: var(--ok);
  color: #032216;
  width: 100%;
}

/* Right Preview Stage */
.stage {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background:
    radial-gradient(circle at 50% 42%, rgba(56, 189, 248, 0.08), transparent 62%),
    linear-gradient(rgba(255, 255, 255, 0.022) 1px, transparent 1px) 0 0 / 28px 28px,
    linear-gradient(90deg, rgba(255, 255, 255, 0.022) 1px, transparent 1px) 0 0 / 28px 28px,
    var(--bg);
}

.stageTop {
  flex: none;
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  padding: 12px 18px 0;
}

.chip {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 9px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: rgba(17, 17, 20, 0.88);
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
}

.canvasWrap {
  flex: 1 1 0;
  min-height: 0;
  position: relative;
  margin: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#previewCanvas {
  max-width: 100%;
  max-height: 100%;
  border-radius: 10px;
  background: #000000;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.08);
  cursor: grab;
  touch-action: none;
  user-select: none;
}

#previewCanvas.dragging {
  cursor: grabbing;
}

#previewCanvas[hidden] {
  display: none;
}

.emptyStage {
  max-width: 420px;
  padding: 28px 22px;
  border-radius: 16px;
  border: 1px dashed var(--line2);
  background: rgba(17, 17, 20, 0.85);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.emptyStage[hidden] {
  display: none;
}

.emptyStage h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
}

.emptyStage p {
  margin: 0;
  font-size: 12.5px;
  color: var(--muted);
}

/* Timeline & Transport */
.transportBox {
  flex: none;
  border-top: 1px solid var(--line);
  background: rgba(9, 9, 11, 0.94);
  padding: 12px 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.trimTrack {
  position: relative;
  height: 22px;
  margin: 0 5px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 7px;
  user-select: none;
  touch-action: none;
  cursor: pointer;
}

.trimTicks {
  position: absolute;
  inset: 5px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2px;
  pointer-events: none;
  opacity: 0.3;
}

.trimTick {
  flex: 1;
  background: var(--muted);
  border-radius: 2px;
}

.trimDim {
  position: absolute;
  top: 0;
  bottom: 0;
  background: rgba(9, 9, 11, 0.72);
  pointer-events: none;
}

.trimDim.left {
  left: 0;
  width: 0%;
  border-radius: 8px 0 0 8px;
}

.trimDim.right {
  right: 0;
  width: 0%;
  border-radius: 0 8px 8px 0;
}

.trimWindow {
  position: absolute;
  top: -1px;
  bottom: -1px;
  left: 0%;
  width: 100%;
  background: rgba(56, 189, 248, 0.14);
  border-top: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent-dark);
  pointer-events: none;
}

.trimHandle {
  position: absolute;
  top: -3px;
  bottom: -3px;
  width: 14px;
  margin-left: -7px;
  border-radius: 5px;
  cursor: ew-resize;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.7);
}

.trimHandle.in {
  left: 0%;
  background: var(--accent);
  color: #041b29;
}

.trimHandle.out {
  left: 100%;
  background: var(--accent-dark);
  color: #031520;
}

.trimHandle::after {
  content: "";
  width: 2px;
  height: 14px;
  background: currentColor;
  border-radius: 2px;
}

.playhead {
  position: absolute;
  top: -4px;
  bottom: -4px;
  left: 0%;
  width: 2px;
  margin-left: -1px;
  background: #ffffff;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.8);
  pointer-events: none;
  z-index: 5;
}

.transport {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.transport .btn {
  height: 42px;
  padding: 0 15px;
}

.playBtn {
  background: var(--text);
  color: var(--bg);
  min-width: 112px;
}

.time {
  height: 42px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
}

.status {
  flex: 1;
  min-width: 120px;
  font-size: 12.5px;
  color: var(--muted);
}

.status.err {
  color: #fda4af;
}

.exportBtn {
  background: linear-gradient(180deg, var(--accent), var(--accent-dark));
  color: #031926;
  box-shadow: 0 6px 20px rgba(56, 189, 248, 0.3);
}

.exportBtn:disabled {
  box-shadow: none;
}

.transport [hidden] {
  display: none;
}

/* Native Modal Dialog */
dialog.expDialog {
  margin: auto;
  padding: 18px 20px 20px;
  width: min(540px, calc(100vw - 32px));
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line2);
  border-radius: 16px;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.72);
}

dialog.expDialog[open] {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

dialog.expDialog:modal {
  overscroll-behavior: contain;
}

dialog.expDialog::backdrop {
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(6px);
  overflow: hidden;
  overscroll-behavior: contain;
}

.expHead {
  display: flex;
  align-items: center;
  gap: 10px;
}

.expHead h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
}

.expClose {
  margin-left: auto;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--panel2);
  color: var(--muted);
}

.expClose:hover:not(:disabled) {
  color: var(--text);
  border-color: var(--line2);
}

.expClose:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.progressWrap {
  height: 10px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 99px;
  overflow: hidden;
}

.progressBar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-dark), var(--accent));
}

dialog.expDialog.busy .progressBar {
  @media (prefers-reduced-motion: no-preference) {
    background-size: 200% 100%;
    background-image: linear-gradient(90deg, var(--accent-dark), #7dd3fc, var(--accent-dark));
    animation: expShine 1.4s linear infinite;
  }
}

@keyframes expShine {
  to { background-position: -200% 0; }
}

.expMetaRow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.expStatusText {
  font-size: 13px;
  color: var(--muted);
}

.expStatusText.err {
  color: #fda4af;
}

.expPct {
  font-weight: 700;
  font-size: 13px;
}

.expEtaRow {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--dim);
}

.expResult {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.expResult[hidden] {
  display: none;
}

.expResult video {
  width: 100%;
  max-height: 40vh;
  border-radius: 9px;
  background: #000000;
}

.expSummary {
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--bg);
  border: 1px solid var(--line);
  font-size: 12px;
  color: var(--text);
}

/* Global Drag Overlay & Toast */
.dragOverlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(9, 9, 11, 0.88);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  pointer-events: none;
}

.dragOverlay.on {
  display: flex;
}

.dragBox {
  width: 100%;
  max-width: 440px;
  border: 2px dashed var(--accent);
  border-radius: 18px;
  background: var(--panel);
  padding: 32px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.dragTitle {
  font-size: 16px;
  font-weight: 800;
}

.dragSub {
  font-size: 12px;
  color: var(--muted);
}

.toast {
  position: fixed;
  bottom: 72px;
  right: 18px;
  z-index: 95;
  background: var(--panel2);
  border: 1px solid var(--accent-border);
  color: var(--text);
  padding: 9px 14px;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 600;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.65);
}

/* Responsive Breakpoints */
@media (max-width: 1560px) {
  .trustChips .stChip:not(.ok) {
    display: none;
  }
}

@media (max-width: 1360px) {
  .trustChips {
    display: none;
  }
}

@media (max-width: 1120px) {
  .toolBarCenter {
    display: none;
  }
}

@media (max-width: 900px) {
  body {
    height: auto;
    min-height: 100dvh;
    overflow: visible;
  }
  main.studio {
    flex: none;
    height: auto;
    display: flex;
    flex-direction: column;
  }
  .stage {
    order: -1;
    border-bottom: 1px solid var(--line);
  }
  .canvasWrap {
    flex: none;
    height: min(56vh, 62vw);
    min-height: 220px;
    margin: 10px 12px;
  }
  .stageTop {
    padding: 10px 12px 0;
  }
  .transportBox {
    padding: 10px 12px 12px;
  }
  .trimTrack {
    height: 34px;
  }
  .transport .status {
    flex-basis: 100%;
    order: 6;
  }
  .side {
    border-right: 0;
  }
  .stepTabs {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bg);
  }
  .stepTab {
    min-height: 44px;
  }
  .cardHead {
    min-height: 44px;
  }
  .panes {
    overflow: visible;
  }
  .toolBar {
    height: auto;
    flex-wrap: wrap;
    padding: 8px 12px;
    row-gap: 8px;
  }
  .toolBarCenter {
    display: flex;
    flex-basis: 100%;
  }
  .toolBarRight {
    flex-basis: 100%;
  }
  .presetGroup {
    flex: 1;
    min-width: 0;
    max-width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .presetGroup::-webkit-scrollbar {
    display: none;
  }
  .presetGroup select {
    flex: 1;
    min-width: 80px;
    max-width: none;
  }
}

@media (max-width: 560px) {
  .rfToolTag {
    display: none;
  }
  .stepTab {
    font-size: 10.5px;
    padding: 7px 2px;
    min-height: 44px;
  }
  .transport .btn {
    height: 40px;
    padding: 0 12px;
  }
  .time {
    height: 40px;
    padding: 0 9px;
  }
  .pngBtn span {
    display: none;
  }
  .playBtn {
    min-width: 0;
  }
  .exportBtn {
    flex: 1;
  }
  .cols3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ---------- Preview player controls: listening volume + full screen ---------- */
.pvControls {
  position: absolute;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(10, 10, 14, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.2s ease;
}
.pvControls[hidden] { display: none; }
@media (hover: none) { .pvControls { opacity: 0.85; } }
.canvasWrap:hover .pvControls,
.pvControls:focus-within,
.stage.isFs .pvControls { opacity: 1; }
.pvBtn {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #fff;
  cursor: pointer;
}
.pvBtn:hover { background: rgba(255, 255, 255, 0.12); }
.pvBtn:focus-visible { outline: 2px solid var(--accent, #38bdf8); outline-offset: 1px; }
.pvBtn.isMuted { color: #fca5a5; }
.pvVol { width: 84px; margin: 0 4px; accent-color: #38bdf8; }
.stage.isFs {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  max-width: none;
  background: var(--bg, #09090b);
}
.stage.isFs.pseudoFs {
  position: fixed;
  inset: 0;
  z-index: 1000;
}
@media (max-width: 560px) {
  .pvVol { display: none; }
  .pvControls { opacity: 0.85; }
}
