:root {
  color-scheme: dark;
  --bg: #050506;
  --panel: rgba(18, 20, 22, 0.94);
  --panel-strong: rgba(29, 32, 35, 0.98);
  --stroke: rgba(255, 255, 255, 0.13);
  --text: #f7f8f5;
  --muted: #a8aea8;
  --accent: #30e1a1;
  --warn: #ffbf47;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
  -webkit-user-select: none;
  user-select: none;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

.app {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 332px;
  min-height: 100vh;
}

.stage {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  background: #000;
}

.topbar {
  position: absolute;
  z-index: 6;
  top: 18px;
  left: 18px;
  right: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}

.brand,
.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
}

.brand {
  min-height: 42px;
  padding: 7px 12px 7px 8px;
  border: 1px solid var(--stroke);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.52);
  backdrop-filter: blur(18px);
  font-weight: 740;
}

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: inline-block;
  background:
    linear-gradient(135deg, rgba(48, 225, 161, 0.95), rgba(101, 155, 255, 0.88)),
    #111;
  box-shadow: 0 0 22px rgba(48, 225, 161, 0.34);
}

.icon-button {
  width: 42px;
  height: 42px;
  border: 1px solid var(--stroke);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.52);
  color: var(--text);
  backdrop-filter: blur(18px);
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: 21px;
  line-height: 1;
}

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

.drop-zone {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  cursor: pointer;
  background: #000;
}

.drop-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.drop-zone span {
  min-width: 132px;
  text-align: center;
  padding: 12px 16px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.07);
  font-weight: 740;
}

.drop-zone.dragging span {
  border-color: rgba(48, 225, 161, 0.78);
  box-shadow: 0 0 34px rgba(48, 225, 161, 0.22);
}

.preview-shell {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: #000;
  overflow: hidden;
}

.source-video,
.video-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.source-video {
  z-index: 2;
  opacity: 0;
  pointer-events: none;
}

.video-canvas {
  z-index: 3;
}

.preview-shell.show-original .source-video {
  opacity: 1;
}

.preview-shell.show-original .video-canvas {
  opacity: 0;
}

.compare-button {
  position: absolute;
  z-index: 5;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  border: 1px solid var(--stroke);
  border-radius: 999px;
  color: var(--text);
  background: rgba(0, 0, 0, 0.52);
  backdrop-filter: blur(18px);
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 720;
}

.busy {
  position: absolute;
  z-index: 7;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 150px;
  justify-content: center;
  padding: 12px 14px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(18px);
}

.spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.22);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}

.controls {
  min-width: 0;
  border-left: 1px solid var(--stroke);
  background: var(--panel);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 17px;
}

.control-row {
  display: grid;
  gap: 7px;
}

.control-row label,
.sliders span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
  text-transform: uppercase;
}

select {
  width: 100%;
  border: 1px solid var(--stroke);
  border-radius: 8px;
  background: var(--panel-strong);
  color: var(--text);
  padding: 10px;
}

.meter {
  display: grid;
  gap: 7px;
  padding: 12px;
  border: 1px solid var(--stroke);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.transport {
  display: grid;
  gap: 8px;
}

.time-row,
.export-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.sliders {
  display: grid;
  gap: 15px;
}

.sliders label {
  display: grid;
  gap: 7px;
}

.sliders span {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

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

progress {
  width: 124px;
  height: 8px;
  border: 0;
  border-radius: 99px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.12);
}

progress::-webkit-progress-bar {
  background: rgba(255, 255, 255, 0.12);
}

progress::-webkit-progress-value {
  background: var(--accent);
}

progress::-moz-progress-bar {
  background: var(--accent);
}

.hidden {
  display: none !important;
}

body.dragging-files .stage::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 5;
  border: 2px solid rgba(48, 225, 161, 0.78);
  pointer-events: none;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 900px) {
  .app {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(420px, 58vh) auto;
  }

  .stage {
    min-height: 420px;
  }

  .controls {
    border-left: 0;
    border-top: 1px solid var(--stroke);
  }
}

@media (max-width: 520px) {
  .topbar {
    top: 12px;
    left: 12px;
    right: 12px;
  }

  .brand {
    max-width: 164px;
  }

  .icon-button {
    width: 38px;
    height: 38px;
  }

  .controls {
    padding: 16px;
  }
}
