/* ══════════════════ FableCut — Premiere-style dark theme ══════════════════ */
:root {
  --bg: #0e0e10;
  --panel: #1b1b1f;
  --panel-2: #232329;
  --border: #2d2d34;
  --text: #d7d7dc;
  --dim: #8b8b93;
  --accent: #7b6cff;
  --accent-2: #4f8cff;
  --danger: #e5484d;
  --clip-video: linear-gradient(180deg, #3d5afe22, #3d5afe11), #2b3b8f;
  --track-h-video: 58px;
  --track-h-audio: 42px;
  --side-panel-w: 320px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
}

html,
body {
  height: 100%;
  overflow: hidden;
}

body {
  background: var(--bg);
  color: var(--text);
  font: 13px/1.45 "Segoe UI", system-ui, -apple-system, sans-serif;
}

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  gap: 6px;
  padding: 6px;
}

.topbar {
  flex: 0 0 46px;
}

.upper {
  flex: 1 1 0;
  min-height: 140px;
  min-width: 0;
}

.timeline-panel {
  flex: 0 0 var(--timeline-h, 400px);
  min-height: 180px;
  overflow: hidden;
}

.v-split {
  flex: 0 0 6px;
  cursor: ns-resize;
  position: relative;
  z-index: 5;
  border-radius: 3px;
}

.v-split::after {
  content: "";
  position: absolute;
  left: 18%;
  right: 18%;
  top: 2px;
  height: 2px;
  border-radius: 1px;
  background: var(--border);
  transition: background .15s;
}

.v-split:hover::after,
.v-split.dragging::after {
  background: var(--accent);
}

body.resizing-panels {
  cursor: ns-resize !important;
}

body.resizing-panels * {
  cursor: ns-resize !important;
  user-select: none !important;
}

.hidden {
  display: none !important;
}

.dim {
  color: var(--dim);
  display: inline-flex;
}

.flex-spacer {
  flex: 1;
}

/* Visually hidden but still activatable (file picker via <label for>) */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── Top bar ── */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.logo {
  display: flex;
  align-items: center;
  font-size: 15px;
  letter-spacing: .3px;
  color: #fff;
}

.logo b {
  color: var(--accent);
}

.logo-mark {
  display: inline-flex;
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  margin-right: 6px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  font-size: 10px;
  align-items: center;
  justify-content: center;
}

.topbar-center {
  flex: 1;
  text-align: center;
  color: var(--dim);
}

.topbar-right {
  display: flex;
  gap: 8px;
  align-items: center;
}

.layout-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-right: 4px;
}

.btn-group {
  display: inline-flex;
  gap: 0px;
}

.btn-group .btn:first-child {
  border-radius: 5px 0 0 5px;
}

.btn-group .btn:not(:first-child):not(:last-child) {
  border-radius: 0;
  margin: 0;
}

.btn-group .btn:last-child {
  border-radius: 0 5px 5px 0;
}

.btn-group .btn.on {
  border-color: var(--accent);
  z-index: 1;
}

body.track-size-s .clip .clip-label {
  font-size: 10px;
  padding: 1px 6px;
}

body.track-size-s .clip .fade {
  display: none;
}

body.track-size-s .clip.c-audio .clip-body::after {
  height: 12px;
}

body.track-size-s .clip {
  border-width: 1px;
  border-radius: 2px;
  box-shadow: none;
}

body.track-size-s .clip .handle.l {
  border-left-width: 1px;
}

body.track-size-s .clip .handle.r {
  border-right-width: 1px;
}

body.track-size-s .clip.selected {
  outline-width: 1px;
  box-shadow: 0 0 0 1px #7b6cff55;
}

/* ── Title-style picker (inspector) ── */
.style-picker-btn {
  flex: 1;
  min-width: 0;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
}

.style-menu {
  position: fixed;
  z-index: 100;
  min-width: 190px;
  max-height: 330px;
  overflow-y: auto;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px;
  box-shadow: 0 12px 32px #000c;
}

.style-opt {
  padding: 7px 10px;
  border-radius: 5px;
  font-size: 15px;
  line-height: 1.25;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}

.style-opt:hover {
  background: #7b6cff26;
}

.style-opt.on {
  color: #cfc8ff;
  background: #7b6cff14;
}

/* ── Buttons ── */
.btn {
  display: inline-block;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 12px;
  font: inherit;
  cursor: pointer;
  white-space: nowrap;
}

.btn:hover {
  background: #2c2c34;
  border-color: #3c3c46;
}

.btn:active {
  transform: translateY(1px);
}

.btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: none;
  color: #fff;
  font-weight: 600;
}

.btn.primary:hover {
  filter: brightness(1.12);
}

.btn.ghost {
  background: transparent;
}

.btn.tiny {
  padding: 3px 9px;
  font-size: 12px;
  border-radius: 5px;
}

.btn .ico {
  display: inline-block;
  vertical-align: -2px;
  margin-right: 2px;
}

.btn.tiny.accent {
  border-color: var(--accent);
  color: #cfc8ff;
}

.btn.icon {
  width: 34px;
  padding: 6px 0;
  text-align: center;
}

.btn.icon.big {
  width: 44px;
  font-size: 15px;
}

.btn.toggle.on {
  border-color: var(--accent);
  color: #cfc8ff;
  background: #7b6cff1a;
}

/* ── Panels ── */
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .4px;
  color: var(--dim);
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}

.panel-head-actions {
  display: flex;
  gap: 6px;
  text-transform: none;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
}

.upper {
  display: grid;
  grid-template-columns: var(--side-panel-w) minmax(0, 1fr) var(--side-panel-w);
  gap: 6px;
  min-height: 0;
}

.panel.bin,
.panel.inspector {
  min-width: 0;
  overflow: hidden;
}

.panel.bin {
  z-index: 1;
}

/* keep overflowing head buttons above the monitor */

/* ── Media bin ── */
.bin-tabs {
  display: flex;
  gap: 2px;
  padding: 6px 8px 0;
  border-bottom: 1px solid var(--border);
}

.bin-tabs button {
  flex: 1;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--dim);
  font: 600 11px/1.2 "Segoe UI", sans-serif;
  padding: 5px 2px 7px;
  cursor: pointer;
  letter-spacing: .2px;
  white-space: nowrap;
}

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

.bin-tabs button.on {
  color: #cfc8ff;
  border-bottom-color: var(--accent);
}

.bin-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.lib-item .lib-play,
.lib-item .lib-add {
  flex: none;
  width: 26px;
  padding: 3px 0;
  text-align: center;
}

.bin-thumb.svg {
  background-color: #2a2a33;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

.bin-empty {
  margin: auto;
  text-align: center;
  color: var(--dim);
  padding: 20px 10px;
}

.bin-empty-icon {
  font-size: 34px;
  margin-bottom: 10px;
  opacity: .8;
}

.bin-empty .hint {
  margin-top: 8px;
  font-size: 11px;
  opacity: .7;
}

.bin-item {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 6px;
  border-radius: 6px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  cursor: grab;
}

.bin-item:hover {
  border-color: #454552;
}

.bin-item:active {
  cursor: grabbing;
}

.bin-thumb {
  width: 58px;
  height: 34px;
  border-radius: 4px;
  flex: none;
  background: #000 center/cover no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.bin-meta {
  min-width: 0;
  flex: 1;
}

.bin-name {
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #e8e8ee;
}

.bin-sub {
  font-size: 11px;
  color: var(--dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bin-del {
  flex: none;
  align-self: flex-start;
  color: var(--dim);
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  padding: 2px 4px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .12s;
}

.bin-item:hover .bin-del {
  opacity: 1;
  pointer-events: auto;
}

.bin-del:hover {
  color: var(--danger);
}

/* ── Monitor ── */
.monitor-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  min-height: 0;
  margin: 8px;
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}

#preview {
  max-width: 100%;
  max-height: 100%;
  display: block;
  background: #000;
}

.head-select {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 5px;
  padding: 2px 6px;
  font: 12px "Segoe UI", sans-serif;
  max-width: 170px;
}

/* ── Safe-area guides (positioned over the canvas by JS) ── */
#safeOverlay {
  position: absolute;
  pointer-events: none;
  z-index: 5;
}

#safeOverlay .sa-action {
  position: absolute;
  inset: 5%;
  border: 1px dashed #ffffff59;
}

#safeOverlay .sa-title {
  position: absolute;
  inset: 10%;
  border: 1px dashed #ffffff30;
}

#safeOverlay .sa-ui-bottom,
#safeOverlay .sa-ui-right {
  display: none;
}

#safeOverlay.vertical .sa-ui-bottom {
  display: block;
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 34%;
  background: repeating-linear-gradient(45deg, #ff4d6a14 0 8px, transparent 8px 16px);
  border-top: 1px dashed #ff4d6a80;
}

#safeOverlay.vertical .sa-ui-right {
  display: block;
  position: absolute;
  top: 30%;
  right: 0;
  bottom: 0;
  width: 13%;
  background: repeating-linear-gradient(45deg, #ff4d6a14 0 8px, transparent 8px 16px);
  border-left: 1px dashed #ff4d6a80;
}

.transport {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 14px 10px;
  gap: 12px;
}

.transport-btns {
  display: flex;
  align-items: center;
  gap: 4px;
}

.transport-btns .btn.icon {
  width: 26px;
  height: 26px;
  padding: 0;
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.transport-btns .btn.icon.big {
  width: 40px;
  height: 34px;
  font-size: 16px;
}

#btnPlay.on {
  background: #7b6cff;
  border-color: #9a8fff;
  color: #fff;
  font-size: 19.2px; /* 16px × 1.2 — pause glyph reads smaller than ▶ */
  /* ⏸ sits low in the em-box; padding shifts the flex content up to optical center */
  padding-bottom: 3px;
}

#btnPlay.on:hover {
  background: #8d80ff;
  border-color: #b0a6ff;
}

.timecode {
  font: 600 14px/1 "Consolas", monospace;
  color: #b9b3ff;
  min-width: 86px;
  height: 14px;
  line-height: 14px;
  align-self: center;
}

.timecode.dim {
  color: var(--dim);
  text-align: right;
}

/* ── Inspector ── */
.inspector-body {
  flex: 1;
  min-width: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 10px;
}

.inspector-empty {
  margin: auto;
  text-align: center;
  color: var(--dim);
  padding-top: 40px;
}

.insp-multi {
  margin-bottom: 12px;
  padding: 7px 9px;
  border-radius: 6px;
  font-size: 11px;
  color: #cfd0ff;
  background: #7b6cff1c;
  border: 1px solid #7b6cff44;
}

.insp-section {
  margin-bottom: 14px;
}

.insp-section h3 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--dim);
  border-bottom: 1px solid var(--border);
  padding-bottom: 4px;
  margin-bottom: 8px;
}

.insp-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  min-width: 0;
}

.insp-row label {
  flex: 0 0 72px;
  font-size: 12px;
  color: var(--dim);
}

.insp-row label.insp-reset {
  cursor: help;
}

.insp-row label.insp-reset:hover {
  color: #cfc8ff;
}

.insp-ctrls {
  display: flex;
  flex: 1;
  min-width: 0;
  gap: 6px;
  align-items: center;
}

.insp-ctrls select,
.insp-ctrls input[type=number] {
  flex: 1;
  min-width: 0;
}

.insp-ctrls .insp-dur {
  flex: none;
  width: 52px;
}

.insp-ctrls input[type=color],
.insp-ctrls .btn {
  flex: none;
}

.insp-row input[type=range] {
  flex: 1;
}

.insp-row .val {
  width: 42px;
  flex: none;
  text-align: right;
  font-size: 11px;
  color: var(--text);
  font-family: Consolas, monospace;
}

.insp-row input[type=number],
.insp-row input[type=text],
.insp-row select {
  flex: 1;
  min-width: 0;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 4px;
  padding: 4px 6px;
  font: inherit;
}

.insp-row input[type=color] {
  width: 40px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: none;
}

.insp-row textarea {
  flex: 1;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 4px;
  padding: 4px 6px;
  font: inherit;
  resize: vertical;
  min-height: 48px;
}

input[type=range] {
  accent-color: var(--accent);
  height: 18px;
}

.kf-ctl {
  display: flex;
  gap: 2px;
  flex: none;
}

.kf-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--dim);
  border-radius: 4px;
  font-size: 10px;
  padding: 2px 5px;
  cursor: pointer;
  line-height: 1;
}

.kf-btn:hover {
  color: #fff;
  border-color: #4a4a56;
}

.kf-btn.has {
  color: #ffd166;
  border-color: #ffd16666;
}

/* ── Timeline ── */
.timeline-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
}

.tiny-label {
  font-size: 11px;
}

#zoomSlider {
  width: 130px;
}

.timeline {
  flex: 1;
  display: flex;
  min-height: 0;
}

.track-headers {
  width: 58px;
  flex: none;
  border-right: 1px solid var(--border);
  padding-top: 26px;
  background: var(--panel);
  z-index: 2;
  overflow: hidden;
}

.track-head {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 6px;
  border-bottom: 1px solid #232328;
  font-size: 11px;
  font-weight: 700;
  color: var(--dim);
  letter-spacing: .5px;
}

.track-head.disabled {
  opacity: .55;
}

.track-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  margin: 0;
  padding: 2px;
  border: 0;
  background: transparent;
  cursor: pointer;
  border-radius: 4px;
  color: inherit;
}

.track-toggle:hover {
  background: #ffffff12;
}

.track-toggle .track-ico {
  display: block;
  width: 15px;
  height: 15px;
  pointer-events: none;
}

.track-toggle .track-ico-off {
  display: none;
}

.track-toggle[aria-pressed="false"] {
  color: var(--dim) !important;
}

.track-toggle[aria-pressed="false"] .track-ico-off {
  display: block;
}

.track.disabled {
  opacity: .4;
}

.timeline-scroll {
  flex: 1;
  overflow-x: auto;
  overflow-y: auto;
  position: relative;
}

.ruler {
  position: sticky;
  top: 0;
  left: 0;
  display: block;
  height: 26px;
  z-index: 3;
  cursor: ew-resize;
  background: var(--panel-2);
}

.tracks-content {
  position: relative;
}
.work-dim {
  position: absolute;
  top: 0;
  bottom: 0;
  background: #00000066;
  pointer-events: none;
  z-index: 1;
}
.work-dim-l {
  left: 0;
  border-right: 1px solid #5eead4aa;
}
.work-dim-r {
  border-left: 1px solid #fb923caa;
}
.work-dim.hidden {
  display: none;
}

.track {
  position: relative;
  border-bottom: 1px solid #232328;
  background: repeating-linear-gradient(90deg, transparent 0 59px, #ffffff05 59px 60px);
}

.track.drop-hint {
  background-color: #7b6cff14;
}

/* ── Clips ── */
.clip {
  position: absolute;
  top: 3px;
  bottom: 3px;
  border-radius: 5px;
  overflow: visible;
  border: 1px solid #0007;
  cursor: grab;
  min-width: 8px;
  box-shadow: 0 1px 3px #0006;
}

/* rounded clip content — trans wedges sit outside this so corners stay sharp */
.clip-body {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  overflow: hidden;
}

.clip:active {
  cursor: grabbing;
}

.clip.selected {
  outline: 2px solid #b9baff;
  outline-offset: -1px;
  box-shadow: 0 0 0 3px #7b6cff55;
}

.clip.selected.primary {
  outline-color: #fff;
}

/* rubber-band selection box drawn while dragging on empty timeline area */
.marquee {
  position: absolute;
  z-index: 5;
  pointer-events: none;
  border: 1px solid #7b6cffcc;
  background: #7b6cff22;
  border-radius: 2px;
}

.clip .clip-label {
  position: absolute;
  inset: 0;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  text-shadow: 0 1px 2px #000c;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  z-index: 3;
}

/* transition wedges — width from transition duration × pps (see transitionMarksHtml) */
.clip .trans-mark {
  position: absolute;
  top: 0;
  bottom: 0;
  height: auto;
  pointer-events: none;
  z-index: 2;
  overflow: hidden;
}
.clip .trans-mark svg {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.clip .trans-mark.in {
  left: 0;
  border-top-left-radius: inherit;
  border-bottom-left-radius: inherit;
}
.clip .trans-mark.out {
  right: 0;
  border-top-right-radius: inherit;
  border-bottom-right-radius: inherit;
}
.clip .trans-mark polygon {
  fill: #ffffff55;
  stroke: #ffffffcc;
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
  pointer-events: auto;
  cursor: pointer;
}
.clip .trans-mark.focused polygon {
  fill: #7b6cff88;
  stroke: #cfc8ff;
  stroke-width: 1.5;
}
/* duration handle — invisible drag strip at the wedge edge */
.clip .trans-dur-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 10px;
  cursor: ew-resize;
  pointer-events: auto;
  z-index: 3;
}
.clip .trans-mark.in .trans-dur-handle {
  right: 0;
}
.clip .trans-mark.out .trans-dur-handle {
  left: 0;
}

.insp-row.trans-active {
  background: #7b6cff18;
  border-radius: 6px;
  margin: 0 -6px;
  padding: 2px 6px;
}

.clip .fade {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #ffffff1f, transparent 40%);
  pointer-events: none;
  z-index: 0;
}

.clip .handle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 8px;
  cursor: ew-resize;
  z-index: 4;
}

.clip .handle.l {
  left: 0;
  border-left: 3px solid #ffffff55;
}

.clip .handle.r {
  right: 0;
  border-right: 3px solid #ffffff55;
}

.clip.c-video .clip-body {
  background: linear-gradient(180deg, #4c66ff33, #4c66ff11), #273575;
}

.clip.c-video .thumbs {
  position: absolute;
  inset: 0;
  background-repeat: repeat-x;
  background-size: auto 100%;
  opacity: .5;
  pointer-events: none;
}

.clip.c-image .clip-body {
  background: linear-gradient(180deg, #2dbd8533, #2dbd8511), #1d5b45;
}

.clip.c-audio .clip-body {
  background: linear-gradient(180deg, #7ec24933, #7ec24911), #33531f;
}

.clip.c-audio .clip-body::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 22px;
  transform: translateY(-50%);
  background: repeating-linear-gradient(90deg, #a5e07588 0 2px, transparent 2px 5px);
  clip-path: polygon(0 50%, 5% 20%, 10% 70%, 15% 35%, 20% 80%, 25% 25%, 30% 60%, 35% 15%, 40% 75%, 45% 40%, 50% 85%, 55% 30%, 60% 65%, 65% 20%, 70% 78%, 75% 42%, 80% 68%, 85% 25%, 90% 72%, 95% 38%, 100% 50%, 100% 100%, 0 100%);
  opacity: .55;
  pointer-events: none;
}

.clip.c-audio.has-wave .clip-body::after {
  display: none;
}

/* real waveform replaces the CSS placeholder */
.clip .wave {
  position: absolute;
  inset: 3px 0;
  width: 100%;
  height: calc(100% - 6px);
  pointer-events: none;
}

.clip.c-text .clip-body {
  background: linear-gradient(180deg, #ff7ac833, #ff7ac811), #6b2a53;
}

.clip.c-svg .clip-body {
  background: linear-gradient(180deg, #ffd16633, #ffd16611), #6b5420;
}

.clip.c-adjust .clip-body {
  background: repeating-linear-gradient(135deg, #38bdf822 0 10px, transparent 10px 20px), #155e75;
}

/* ── Playhead ── */
.playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: #ff4d6a;
  z-index: 4;
  pointer-events: none;
}

.playhead-cap {
  position: absolute;
  top: 0;
  left: -6px;
  width: 13px;
  height: 14px;
  background: #ff4d6a;
  clip-path: polygon(0 0, 100% 0, 100% 55%, 50% 100%, 0 55%);
}

/* ── Overlays / dialogs ── */
.overlay {
  position: fixed;
  inset: 0;
  background: #000a;
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.dialog {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px 28px;
  width: 420px;
  box-shadow: 0 20px 60px #000a;
}

.dialog h2 {
  font-size: 16px;
  margin-bottom: 6px;
  color: #fff;
}

.dialog p {
  margin-bottom: 16px;
}

.progress {
  height: 8px;
  border-radius: 4px;
  background: var(--panel-2);
  overflow: hidden;
  margin-bottom: 18px;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width .2s;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.engine-opt {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  background: var(--panel-2);
}

.engine-opt:hover {
  border-color: #454552;
}

.engine-opt:has(input:checked) {
  border-color: var(--accent);
  background: #7b6cff12;
}

.engine-opt:has(input:disabled) {
  opacity: .5;
  cursor: not-allowed;
}

.engine-opt input {
  margin-top: 3px;
  accent-color: var(--accent);
}

.engine-opt .dim {
  font-size: 12px;
}

.export-track-warn {
  margin: 0 0 12px;
  padding: 9px 12px;
  border: 1px solid #8a6a28;
  border-radius: 8px;
  background: #3a2e12;
  color: #f0c14a;
  font-size: 12px;
  line-height: 1.4;
}

.export-track-warn.hidden {
  display: none;
}

.dialog.help {
  width: min(820px, 94vw);
  max-height: min(90vh, 640px);
  overflow: auto;
}

.dialog.help .keys-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 28px;
  margin-bottom: 12px;
  align-items: start;
}

.dialog.help .keys {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 0;
}

.dialog.help .keys td {
  padding: 5px 6px;
  border-bottom: 1px solid #26262c;
  font-size: 12px;
  vertical-align: top;
}

.dialog.help .keys td:first-child {
  width: 40%;
  color: var(--dim);
  white-space: nowrap;
}

@media (max-width: 700px) {
  .dialog.help .keys-cols {
    grid-template-columns: 1fr;
  }
}

kbd {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 1px 6px;
  font: 11px Consolas, monospace;
  color: #fff;
}

/* ── Scrollbars ── */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-thumb {
  background: #35353e;
  border-radius: 5px;
  border: 2px solid var(--panel);
}

::-webkit-scrollbar-track {
  background: transparent;
}

/* ── Toast ── */
#toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 20px);
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9px 16px;
  border-radius: 8px;
  font-size: 12px;
  box-shadow: 0 8px 30px #000a;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s;
  z-index: 80;
  max-width: 60vw;
}

#toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ── Inspector checkboxes ── */
.insp-row input[type=checkbox] {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
  flex: none;
}

/* ── Drop highlight ── */
body.file-drag::after {
  content: "Drop files to import";
  position: fixed;
  inset: 10px;
  border: 2px dashed var(--accent);
  border-radius: 14px;
  background: #7b6cff14;
  color: #cfc8ff;
  font-size: 18px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99;
  pointer-events: none;
}