:root {
  color-scheme: dark;
  --bg: #0a0f14;
  --bg-soft: #121a23;
  --panel: rgba(18, 26, 35, 0.88);
  --panel-border: rgba(158, 184, 211, 0.14);
  --text: #edf4fb;
  --muted: #9fb1c5;
  --accent: #66e3c4;
  --accent-strong: #1fc99f;
  --danger: #ff7a7a;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(102, 227, 196, 0.18), transparent 28%),
    radial-gradient(circle at top right, rgba(74, 144, 226, 0.2), transparent 22%),
    linear-gradient(180deg, #081018 0%, #0a0f14 100%);
}

button,
input,
textarea,
select {
  font: inherit;
}

.app-shell {
  width: min(1680px, calc(100vw - 24px));
  margin: 0 auto;
  padding: 20px 0 40px;
}

.hero {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  align-items: stretch;
  margin-bottom: 16px;
}

.eyebrow {
  margin: 0 0 12px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.78rem;
  color: var(--accent);
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  font-size: clamp(2rem, 4vw, 3.6rem);
  line-height: 1;
}

.hero-copy {
  max-width: 78ch;
  color: var(--muted);
  font-size: 0.98rem;
}

.panel {
  backdrop-filter: blur(14px);
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.panel {
  padding: 18px;
  margin-bottom: 14px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.panel-header h2 {
  margin-bottom: 0;
}

.sources {
  display: grid;
  grid-template-columns: 1.1fr 1.4fr;
  gap: 16px;
}

.upload-card,
.url-form,
.source-list,
.video-card,
.controls {
  border: 1px solid rgba(158, 184, 211, 0.14);
  background: rgba(8, 14, 22, 0.72);
  border-radius: 20px;
}

.upload-card {
  display: grid;
  gap: 6px;
  padding: 22px;
  min-height: 160px;
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.upload-card:hover {
  transform: translateY(-2px);
  border-color: rgba(102, 227, 196, 0.45);
}

.upload-card.drag-over {
  transform: translateY(-3px);
  border-color: var(--accent);
  background: rgba(102, 227, 196, 0.08);
  box-shadow: 0 0 0 2px rgba(102, 227, 196, 0.25), var(--shadow);
}

.upload-card.drag-over .upload-title {
  color: var(--accent);
}

.upload-card input {
  display: none;
}

.upload-drag-hint {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  font-size: 0.82rem;
  color: var(--muted);
  opacity: 0.7;
}

.upload-drag-hint::before {
  content: "";
  display: inline-block;
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  background: currentColor;
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M9 2a1 1 0 0 1 1 1v8.586l1.293-1.293a1 1 0 1 1 1.414 1.414l-3 3a1 1 0 0 1-1.414 0l-3-3a1 1 0 1 1 1.414-1.414L8 11.586V3a1 1 0 0 1 1-1Zm6 0a1 1 0 0 1 .993.883L16 3v5h3a2 2 0 0 1 1.995 1.85L21 10v9a2 2 0 0 1-1.85 1.995L19 21H5a2 2 0 0 1-1.995-1.85L3 19v-9a2 2 0 0 1 1.85-1.995L5 8h3V3a1 1 0 0 1 1-1h6Zm4 8h-3v9H8v-9H5v9h14v-9Z'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M9 2a1 1 0 0 1 1 1v8.586l1.293-1.293a1 1 0 1 1 1.414 1.414l-3 3a1 1 0 0 1-1.414 0l-3-3a1 1 0 1 1 1.414-1.414L8 11.586V3a1 1 0 0 1 1-1Zm6 0a1 1 0 0 1 .993.883L16 3v5h3a2 2 0 0 1 1.995 1.85L21 10v9a2 2 0 0 1-1.85 1.995L19 21H5a2 2 0 0 1-1.85 1.995L3 19v-9a2 2 0 0 1 1.85-1.995L5 8h3V3a1 1 0 0 1 1-1h6Zm4 8h-3v9H8v-9H5v9h14v-9Z'/%3E%3C/svg%3E");
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: contain;
}

.upload-title {
  font-size: 1.15rem;
  font-weight: 700;
}

.upload-copy,
.hint {
  color: var(--muted);
}

.url-form {
  padding: 22px;
}

.url-form label {
  display: inline-block;
  margin-bottom: 10px;
  font-weight: 500;
}

.url-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.url-row textarea {
  flex: 1;
  min-width: 0;
}

textarea,
select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(158, 184, 211, 0.18);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

select,
option {
  color: var(--text);
  background: #101821;
}

textarea {
  resize: vertical;
  min-height: 120px;
}

.url-row button {
  align-self: flex-start;
}

button {
  border: 0;
  border-radius: 14px;
  padding: 12px 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #04110d;
  font-weight: 700;
  cursor: pointer;
  transition: transform 180ms ease, opacity 180ms ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.ghost-button {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.ghost-button.active {
  background: rgba(102, 227, 196, 0.18);
  color: var(--accent);
}

.source-list {
  margin-top: 16px;
  padding: 14px;
  display: grid;
  gap: 10px;
}

.source-toolbar {
  margin-top: 14px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.source-list.empty {
  padding: 4px;
}

.source-list.empty .empty-state {
  padding: 24px 20px;
  border-radius: 14px;
}


.source-item {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  cursor: grab;
  transition: opacity 160ms ease, box-shadow 160ms ease;
  position: relative;
}

.source-item:active {
  cursor: grabbing;
}

.source-item.dragging {
  opacity: 0.35;
  box-shadow: none;
}

.source-item.drag-before {
  box-shadow: inset 0 2px 0 0 var(--accent);
}

.source-item.drag-after {
  box-shadow: inset 0 -2px 0 0 var(--accent);
}

.drag-grip {
  flex-shrink: 0;
  width: 16px;
  height: 20px;
  opacity: 0.3;
  cursor: grab;
  transition: opacity 140ms ease;
}

.drag-grip::before {
  content: "";
  display: block;
  width: 16px;
  height: 20px;
  background: var(--muted);
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 16' fill='black'%3E%3Ccircle cx='3' cy='3' r='1.5'/%3E%3Ccircle cx='7' cy='3' r='1.5'/%3E%3Ccircle cx='3' cy='8' r='1.5'/%3E%3Ccircle cx='7' cy='8' r='1.5'/%3E%3Ccircle cx='3' cy='13' r='1.5'/%3E%3Ccircle cx='7' cy='13' r='1.5'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 16' fill='black'%3E%3Ccircle cx='3' cy='3' r='1.5'/%3E%3Ccircle cx='7' cy='3' r='1.5'/%3E%3Ccircle cx='3' cy='8' r='1.5'/%3E%3Ccircle cx='7' cy='8' r='1.5'/%3E%3Ccircle cx='3' cy='13' r='1.5'/%3E%3Ccircle cx='7' cy='13' r='1.5'/%3E%3C/svg%3E");
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: contain;
}

.source-item:hover .drag-grip {
  opacity: 0.65;
}

.source-meta {
  min-width: 0;
}

.source-name {
  display: block;
  font-weight: 700;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-type {
  display: block;
  color: var(--muted);
  font-size: 0.92rem;
}

.remove-btn {
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(255, 122, 122, 0.12);
  color: #ffb1b1;
}

.source-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  align-items: center;
}

.compare-check {
  width: 18px;
  height: 18px;
  accent-color: var(--accent-strong);
}

.compare-check:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.toggle-btn,
.hide-preview-btn {
  padding: 8px 12px;
  border-radius: 10px;
}

.icon-btn {
  width: 38px;
  min-width: 38px;
  height: 38px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-btn::before {
  content: "";
  display: block;
  width: 18px;
  height: 18px;
  background: currentColor;
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: contain;
}

.audio-icon::before {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M14 4.5v15a1 1 0 0 1-1.68.74L7.6 16H4a1 1 0 0 1-1-1V9a1 1 0 0 1 1-1h3.6l4.72-4.24A1 1 0 0 1 14 4.5Zm3.78 2.72a1 1 0 0 1 1.41 0 7 7 0 0 1 0 9.9 1 1 0 1 1-1.41-1.42 5 5 0 0 0 0-7.06 1 1 0 0 1 0-1.42Zm-2.83 2.83a1 1 0 0 1 1.41 0 3 3 0 0 1 0 4.24 1 1 0 1 1-1.41-1.42 1 1 0 0 0 0-1.4 1 1 0 0 1 0-1.42Z'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M14 4.5v15a1 1 0 0 1-1.68.74L7.6 16H4a1 1 0 0 1-1-1V9a1 1 0 0 1 1-1h3.6l4.72-4.24A1 1 0 0 1 14 4.5Zm3.78 2.72a1 1 0 0 1 1.41 0 7 7 0 0 1 0 9.9 1 1 0 1 1-1.41-1.42 5 5 0 0 0 0-7.06 1 1 0 0 1 0-1.42Zm-2.83 2.83a1 1 0 0 1 1.41 0 3 3 0 0 1 0 4.24 1 1 0 1 1-1.41-1.42 1 1 0 0 0 0-1.4 1 1 0 0 1 0-1.42Z'/%3E%3C/svg%3E");
}

.hide-icon::before {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='m2.7 1.29 20 20a1 1 0 0 1-1.4 1.42l-3.04-3.04A11.8 11.8 0 0 1 12 21C5.83 21 1.73 15.7.46 13.58a2.94 2.94 0 0 1 0-3.16 22.78 22.78 0 0 1 5.2-5.99L1.29 2.71A1 1 0 0 1 2.7 1.3Zm7.94 7.94 3.12 3.12a2.5 2.5 0 0 0-3.12-3.12Zm8.65 6.24-2.2-2.2a5.49 5.49 0 0 0-6.36-6.36L8.58 4.76A11.4 11.4 0 0 1 12 4c6.17 0 10.27 5.3 11.54 7.42a2.94 2.94 0 0 1 0 3.16 22.43 22.43 0 0 1-4.25 4.89Z'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='m2.7 1.29 20 20a1 1 0 0 1-1.4 1.42l-3.04-3.04A11.8 11.8 0 0 1 12 21C5.83 21 1.73 15.7.46 13.58a2.94 2.94 0 0 1 0-3.16 22.78 22.78 0 0 1 5.2-5.99L1.29 2.71A1 1 0 0 1 2.7 1.3Zm7.94 7.94 3.12 3.12a2.5 2.5 0 0 0-3.12-3.12Zm8.65 6.24-2.2-2.2a5.49 5.49 0 0 0-6.36-6.36L8.58 4.76A11.4 11.4 0 0 1 12 4c6.17 0 10.27 5.3 11.54 7.42a2.94 2.94 0 0 1 0 3.16 22.43 22.43 0 0 1-4.25 4.89Z'/%3E%3C/svg%3E");
}

.show-icon::before {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M12 5c6.17 0 10.27 5.3 11.54 7.42a2.94 2.94 0 0 1 0 3.16C22.27 17.7 18.17 23 12 23S1.73 17.7.46 15.58a2.94 2.94 0 0 1 0-3.16C1.73 10.3 5.83 5 12 5Zm0 4a5 5 0 1 0 0 10 5 5 0 0 0 0-10Zm0 2a3 3 0 1 1 0 6 3 3 0 0 1 0-6Z'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M12 5c6.17 0 10.27 5.3 11.54 7.42a2.94 2.94 0 0 1 0 3.16C22.27 17.7 18.17 23 12 23S1.73 17.7.46 15.58a2.94 2.94 0 0 1 0-3.16C1.73 10.3 5.83 5 12 5Zm0 4a5 5 0 1 0 0 10 5 5 0 0 0 0-10Zm0 2a3 3 0 1 1 0 6 3 3 0 0 1 0-6Z'/%3E%3C/svg%3E");
}

.remove-icon::before {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M9 3h6l1 2h4a1 1 0 1 1 0 2h-1l-1 13a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 7H4a1 1 0 1 1 0-2h4l1-2Zm0 6a1 1 0 0 0-1 1v8a1 1 0 1 0 2 0v-8a1 1 0 0 0-1-1Zm6 0a1 1 0 0 0-1 1v8a1 1 0 1 0 2 0v-8a1 1 0 0 0-1-1Z'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M9 3h6l1 2h4a1 1 0 1 1 0 2h-1l-1 13a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 7H4a1 1 0 1 1 0-2h4l1-2Zm0 6a1 1 0 0 0-1 1v8a1 1 0 1 0 2 0v-8a1 1 0 0 0-1-1Zm6 0a1 1 0 0 0-1 1v8a1 1 0 1 0 2 0v-8a1 1 0 0 0-1-1Z'/%3E%3C/svg%3E");
}

.safe-area-icon::before {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M3 3h5v2H5v3H3V3Zm13 0h5v5h-2V5h-3V3ZM3 16h2v3h3v2H3v-5Zm16 3h-3v2h5v-5h-2v3ZM7 7h10v10H7V7Zm2 2v6h6V9H9Z'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M3 3h5v2H5v3H3V3Zm13 0h5v5h-2V5h-3V3ZM3 16h2v3h3v2H3v-5Zm16 3h-3v2h5v-5h-2v3ZM7 7h10v10H7V7Zm2 2v6h6V9H9Z'/%3E%3C/svg%3E");
}

.play-icon::before {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M7 4.5v15a1 1 0 0 0 1.5.86l12-7.5a1 1 0 0 0 0-1.72l-12-7.5A1 1 0 0 0 7 4.5Z'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M7 4.5v15a1 1 0 0 0 1.5.86l12-7.5a1 1 0 0 0 0-1.72l-12-7.5A1 1 0 0 0 7 4.5Z'/%3E%3C/svg%3E");
}

.pause-icon::before {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M8 5a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1H8Zm6 0a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2Z'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M8 5a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1H8Zm6 0a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2Z'/%3E%3C/svg%3E");
}

.restart-icon::before {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M12 4V1L8 5l4 4V6c3.31 0 6 2.69 6 6 0 1.01-.25 1.97-.7 2.8l1.46 1.46A7.93 7.93 0 0 0 20 12c0-4.42-3.58-8-8-8zm0 14c-3.31 0-6-2.69-6-6 0-1.01.25-1.97.7-2.8L5.24 7.74A7.93 7.93 0 0 0 4 12c0 4.42 3.58 8 8 8v3l4-4-4-4v3z'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M12 4V1L8 5l4 4V6c3.31 0 6 2.69 6 6 0 1.01-.25 1.97-.7 2.8l1.46 1.46A7.93 7.93 0 0 0 20 12c0-4.42-3.58-8-8-8zm0 14c-3.31 0-6-2.69-6-6 0-1.01.25-1.97.7-2.8L5.24 7.74A7.93 7.93 0 0 0 4 12c0 4.42 3.58 8 8 8v3l4-4-4-4v3z'/%3E%3C/svg%3E");
}

.screenshot-icon::before {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M9 2L7.17 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2h-3.17L15 2H9zm3 15c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5z'/%3E%3Cpath d='M12 9c-1.65 0-3 1.35-3 3s1.35 3 3 3 3-1.35 3-3-1.35-3-3-3z'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M9 2L7.17 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2h-3.17L15 2H9zm3 15c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5z'/%3E%3Cpath d='M12 9c-1.65 0-3 1.35-3 3s1.35 3 3 3 3-1.35 3-3-1.35-3-3-3z'/%3E%3C/svg%3E");
}

.speed-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
}

.speed-icon::before {
  content: "";
  display: block;
  width: 18px;
  height: 18px;
  background: currentColor;
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: contain;
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm4.29-11.71L12.5 12H9a1 1 0 0 0 0 2h3.5l4.29-4.29a1 1 0 0 0-1.5-1.42z'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm4.29-11.71L12.5 12H9a1 1 0 0 0 0 2h3.5l4.29-4.29a1 1 0 0 0-1.5-1.42z'/%3E%3C/svg%3E");
}

.controls {
  padding: 18px;
  display: grid;
  gap: 16px;
}

.view-controls {
  grid-template-columns: minmax(280px, 1.5fr) minmax(220px, 1fr);
  align-items: end;
}

.primary-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.inline-field {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}

.timeline {
  display: grid;
  gap: 10px;
}

.timeline label {
  color: var(--muted);
}

.preview-size {
  display: grid;
  gap: 10px;
}

.layout-mode {
  display: grid;
  gap: 10px;
}

.compare-controls.hidden {
  display: none;
}

.preview-size-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
}

input[type="range"] {
  width: 100%;
}

.time-meta {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 0.9rem;
}

.comparison-panel {
  width: calc(100vw - 24px);
  max-width: none;
  margin-left: calc(50% - ((100vw - 24px) / 2));
  margin-right: calc(50% - ((100vw - 24px) / 2));
  border-radius: 0;
  border-left: 0;
  border-right: 0;
}

.comparison-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  flex-wrap: nowrap;
}

.comparison-header-tools {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-width: 0;
  flex-wrap: wrap;
}

.comparison-view-controls {
  flex: 1 1 560px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-width: 0;
  flex-wrap: wrap;
}

.comparison-view-controls .preview-size {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.comparison-view-controls .preview-size-header {
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

.comparison-view-controls .preview-size input[type="range"] {
  width: min(28vw, 280px);
}

.comparison-view-controls .layout-mode {
  display: flex;
  align-items: center;
  gap: 10px;
}

.comparison-view-controls .layout-mode label {
  white-space: nowrap;
}

.comparison-view-controls .layout-mode select {
  width: 210px;
}

.comparison-panel.compare-mode .comparison-view-controls .layout-mode {
  display: none !important;
}

.comparison-header-tools .status-badge,
.comparison-header-tools .ghost-button {
  flex: 0 0 auto;
}

.comparison-actions {
  display: grid;
  gap: 8px;
  justify-items: center;
  flex: 0 0 auto;
}

.timeline-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.timeline-help {
  position: relative;
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.timeline-help:hover,
.timeline-help:focus-visible {
  transform: none;
  background: rgba(102, 227, 196, 0.18);
  color: var(--accent);
}

.timeline-help-icon {
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1;
}

.timeline-tooltip {
  position: absolute;
  right: 0;
  bottom: calc(100% + 10px);
  width: min(320px, 70vw);
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(8, 14, 22, 0.96);
  border: 1px solid rgba(158, 184, 211, 0.18);
  color: var(--text);
  font-size: 0.85rem;
  line-height: 1.4;
  text-align: left;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms ease;
  z-index: 30;
}

.timeline-help:hover .timeline-tooltip,
.timeline-help:focus-visible .timeline-tooltip {
  opacity: 1;
}

.playback-dock {
  position: sticky;
  bottom: 0;
  z-index: 20;
  backdrop-filter: blur(18px);
  background: rgba(10, 15, 20, 0.92);
}

.playback-dock-inner {
  display: grid;
  grid-template-columns: auto minmax(320px, 1fr);
  gap: 18px;
  align-items: center;
}

:root[data-layout-mode="custom"] .video-grid,
.video-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  gap: 16px;
}

.video-grid.empty {
  display: block;
}

.empty-state {
  padding: 40px 28px;
  border-radius: 20px;
  border: 1px dashed rgba(158, 184, 211, 0.18);
  color: var(--muted);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  animation: emptyFadeIn 300ms ease both;
}

@keyframes emptyFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.empty-state-icon {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: rgba(158, 184, 211, 0.07);
  border: 1px solid rgba(158, 184, 211, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
  flex-shrink: 0;
}

.empty-state-icon::before {
  content: "";
  display: block;
  width: 26px;
  height: 26px;
  background: var(--muted);
  opacity: 0.55;
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: contain;
}

/* icon variants */
.empty-state-icon--add::before {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M4 4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2H4Zm0 2h16v12H4V6Zm4.5 2a.5.5 0 0 0-.5.5v3h-3a.5.5 0 0 0 0 1h3v3a.5.5 0 0 0 1 0v-3h3a.5.5 0 0 0 0-1h-3v-3a.5.5 0 0 0-.5-.5Z'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M4 4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2H4Zm0 2h16v12H4V6Zm4.5 2a.5.5 0 0 0-.5.5v3h-3a.5.5 0 0 0 0 1h3v3a.5.5 0 0 0 1 0v-3h3a.5.5 0 0 0 0-1h-3v-3a.5.5 0 0 0-.5-.5Z'/%3E%3C/svg%3E");
}

.empty-state-icon--hidden::before {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='m2.7 1.29 20 20a1 1 0 0 1-1.4 1.42l-3.04-3.04A11.8 11.8 0 0 1 12 21C5.83 21 1.73 15.7.46 13.58a2.94 2.94 0 0 1 0-3.16 22.78 22.78 0 0 1 5.2-5.99L1.29 2.71A1 1 0 0 1 2.7 1.3Zm7.94 7.94 3.12 3.12a2.5 2.5 0 0 0-3.12-3.12Zm8.65 6.24-2.2-2.2a5.49 5.49 0 0 0-6.36-6.36L8.58 4.76A11.4 11.4 0 0 1 12 4c6.17 0 10.27 5.3 11.54 7.42a2.94 2.94 0 0 1 0 3.16 22.43 22.43 0 0 1-4.25 4.89Z'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='m2.7 1.29 20 20a1 1 0 0 1-1.4 1.42l-3.04-3.04A11.8 11.8 0 0 1 12 21C5.83 21 1.73 15.7.46 13.58a2.94 2.94 0 0 1 0-3.16 22.78 22.78 0 0 1 5.2-5.99L1.29 2.71A1 1 0 0 1 2.7 1.3Zm7.94 7.94 3.12 3.12a2.5 2.5 0 0 0-3.12-3.12Zm8.65 6.24-2.2-2.2a5.49 5.49 0 0 0-6.36-6.36L8.58 4.76A11.4 11.4 0 0 1 12 4c6.17 0 10.27 5.3 11.54 7.42a2.94 2.94 0 0 1 0 3.16 22.43 22.43 0 0 1-4.25 4.89Z'/%3E%3C/svg%3E");
}

.empty-state-icon--compare::before {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M2 4a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v16a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V4Zm11 0v16h7V4h-7ZM4 4v16h7V4H4Z'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M2 4a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v16a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V4Zm11 0v16h7V4h-7ZM4 4v16h7V4H4Z'/%3E%3C/svg%3E");
}

.empty-state-icon--warning::before {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M12 2a1 1 0 0 1 .87.5l9.5 16.5A1 1 0 0 1 21.5 21h-19a1 1 0 0 1-.87-1.5l9.5-16.5A1 1 0 0 1 12 2Zm0 2.18L3.74 19h16.52L12 4.18ZM12 16a1 1 0 1 1 0 2 1 1 0 0 1 0-2Zm0-7a1 1 0 0 1 1 1v4a1 1 0 1 1-2 0v-4a1 1 0 0 1 1-1Z'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M12 2a1 1 0 0 1 .87.5l9.5 16.5A1 1 0 0 1 21.5 21h-19a1 1 0 0 1-.87-1.5l9.5-16.5A1 1 0 0 1 12 2Zm0 2.18L3.74 19h16.52L12 4.18ZM12 16a1 1 0 1 1 0 2 1 1 0 0 1 0-2Zm0-7a1 1 0 0 1 1 1v4a1 1 0 1 1-2 0v-4a1 1 0 0 1 1-1Z'/%3E%3C/svg%3E");
}

.empty-state-title {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.empty-state-body {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0;
  max-width: 34ch;
  line-height: 1.5;
}


:root[data-layout-mode="custom"] .video-card,
.video-card {
  width: min(100%, var(--preview-width, 560px));
  flex: 0 0 min(100%, var(--preview-width, 560px));
  max-width: var(--preview-width, 560px);
  padding: 12px;
  overflow: hidden;
  transition: width 180ms ease, flex-basis 180ms ease, max-width 180ms ease;
}

.video-card.active {
  outline: 1px solid rgba(102, 227, 196, 0.58);
}

.video-card[draggable="true"] {
  cursor: default;
}

.video-card-header {
  cursor: grab;
}

.video-card.dragging {
  opacity: 0.3;
}

.video-card.drag-before {
  box-shadow: inset 3px 0 0 0 var(--accent);
}

.video-card.drag-after {
  box-shadow: inset -3px 0 0 0 var(--accent);
}


.video-stage {
  position: relative;
  aspect-ratio: var(--media-aspect-ratio, 16 / 9);
  overflow: hidden;
  background: #000;
}

.video-stage video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.compare-stage {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #000;
}

.compare-stage video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.compare-primary-wrap,
.compare-secondary-wrap {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.compare-stage[data-orientation="side-by-side"] {
  display: flex;
}

.compare-stage[data-orientation="side-by-side"] .compare-primary-wrap,
.compare-stage[data-orientation="side-by-side"] .compare-secondary-wrap {
  position: relative;
  inset: auto;
  flex: 0 0 50%;
  width: 50%;
  height: 100%;
  clip-path: none;
}

.compare-stage[data-orientation="side-by-side"] .compare-primary-wrap video,
.compare-stage[data-orientation="side-by-side"] .compare-secondary-wrap video,
.compare-stage[data-orientation="side-by-side"] .compare-primary-wrap .safe-area-overlay,
.compare-stage[data-orientation="side-by-side"] .compare-secondary-wrap .safe-area-overlay,
.compare-stage[data-orientation="side-by-side"] .compare-primary-wrap .compare-diff-overlay,
.compare-stage[data-orientation="side-by-side"] .compare-secondary-wrap .compare-diff-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.compare-stage[data-orientation="vertical"] .compare-primary-wrap {
  clip-path: inset(0 calc(100% - (var(--split-position, 50) * 1%)) 0 0);
}

.compare-stage[data-orientation="vertical"] .compare-secondary-wrap {
  clip-path: inset(0 0 0 calc(var(--split-position, 50) * 1%));
}

.compare-stage[data-orientation="horizontal"] .compare-primary-wrap {
  clip-path: inset(0 0 calc(100% - (var(--split-position, 50) * 1%)) 0);
}

.compare-stage[data-orientation="horizontal"] .compare-secondary-wrap {
  clip-path: inset(calc(var(--split-position, 50) * 1%) 0 0 0);
}

.compare-handle {
  position: absolute;
  z-index: 2;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.22);
}

.compare-stage[data-orientation="vertical"] .compare-handle {
  top: 0;
  bottom: 0;
  width: 4px;
  left: calc(var(--split-position, 50) * 1%);
  transform: translateX(-50%);
  cursor: ew-resize;
}

.compare-stage[data-orientation="horizontal"] .compare-handle {
  left: 0;
  right: 0;
  height: 4px;
  top: calc(var(--split-position, 50) * 1%);
  transform: translateY(-50%);
  cursor: ns-resize;
}

.compare-stage[data-orientation="side-by-side"] .compare-handle {
  display: none;
}

.compare-handle::after {
  content: "";
  position: absolute;
  inset: 50%;
  width: 22px;
  height: 22px;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

.compare-badge {
  color: var(--muted);
  font-size: 0.84rem;
}

.compare-audio-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.compare-meta-left .compare-audio-actions {
  justify-content: flex-start;
}

.safe-area-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  opacity: 0.9;
}

.compare-diff-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  opacity: 0.9;
  mix-blend-mode: screen;
  z-index: 1;
}

.video-card-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  padding: 8px 4px 12px;
}

.compare-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(190px, 280px) minmax(0, 1fr);
  align-items: start;
  gap: 16px;
}

.compare-meta {
  min-width: 0;
}

.compare-meta-left {
  text-align: left;
}

.compare-meta-right {
  text-align: right;
}

.compare-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
}

.compare-title-row-left {
  justify-content: flex-start;
}

.compare-title-row-right {
  justify-content: flex-end;
}

.compare-center-controls {
  display: grid;
  gap: 8px;
  align-content: start;
  justify-items: stretch;
  width: 100%;
  min-width: 0;
}

.compare-center-label {
  color: var(--muted);
  font-size: 0.84rem;
  text-align: center;
}

.compare-toggle-group {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  padding: 4px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.06);
}

.compare-toggle-btn {
  padding: 8px 12px;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
}

.compare-toggle-btn.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #04110d;
}

.compare-diff-btn {
  width: 100%;
}

.compare-diff-controls {
  width: 100%;
  display: none;
  gap: 10px;
}

.compare-diff-controls.active {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
}

.compare-diff-field {
  display: grid;
  gap: 6px;
  width: 100%;
  color: var(--muted);
  font-size: 0.84rem;
}

.compare-diff-field strong {
  color: var(--text);
  font-size: 0.82rem;
}

.compare-diff-sensitivity input[type="range"] {
  width: 100%;
}

.compare-diff-color input[type="color"] {
  width: 44px;
  height: 44px;
  padding: 3px;
  border-radius: 10px;
  border: 1px solid rgba(158, 184, 211, 0.18);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
}

.compare-diff-color {
  justify-items: center;
}

.compare-diff-color span {
  text-align: center;
}

.video-card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  flex-shrink: 0;
}

.safe-area-slot:empty {
  display: none;
}

.safe-area-btn {
  position: relative;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.safe-area-btn.active {
  background: rgba(102, 227, 196, 0.18);
  color: var(--accent);
}

.safe-area-badge {
  position: absolute;
  bottom: 3px;
  right: 3px;
  min-width: 14px;
  height: 14px;
  padding: 0 3px;
  border-radius: 999px;
  background: var(--accent);
  color: #04110d;
  font-size: 0.55rem;
  font-weight: 700;
  line-height: 14px;
  text-align: center;
  letter-spacing: 0;
  pointer-events: none;
}

.video-meta {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.video-title {
  margin: 0;
  font-size: 1rem;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compare-title-row .video-title {
  flex: 1 1 auto;
  min-width: 0;
}

.compare-title-row-right .video-title {
  text-align: right;
}

.compare-audio-actions {
  flex: 0 0 auto;
}

.video-resolution {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1;
}

.video-meta-info {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.video-meta-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  font-size: 0.65rem;
  font-weight: 700;
  font-style: normal;
  line-height: 1;
  color: var(--muted);
}

.video-meta-pill {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(158, 184, 211, 0.1);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.error-pill {
  background-color: #ff5252;
  color: #fff;
  font-weight: 500;
}

.video-meta-loading {
  color: var(--accent);
  font-size: 0.78rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(102, 227, 196, 0.08);
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px dashed rgba(102, 227, 196, 0.4);
  font-weight: 500;
}

.video-meta-loading-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  background: rgba(102, 227, 196, 0.08);
  border: 1px dashed rgba(102, 227, 196, 0.4);
}

.spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid rgba(102, 227, 196, 0.25);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
  flex-shrink: 0;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.audio-btn {
  flex-shrink: 0;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.audio-btn.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #04110d;
}

:root[data-layout-mode="fit"] .video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  align-items: start;
}

:root[data-layout-mode="fit"] .video-card {
  width: auto;
  flex: initial;
  max-width: none;
}

:root[data-layout-mode="max"] .video-grid {
  display: grid;
  grid-template-columns: 1fr;
}

:root[data-layout-mode="max"] .video-card {
  width: auto;
  flex: initial;
  max-width: none;
}

:root[data-layout-mode="cols-1"] .video-grid,
:root[data-layout-mode="cols-2"] .video-grid,
:root[data-layout-mode="cols-3"] .video-grid,
:root[data-layout-mode="cols-4"] .video-grid {
  display: grid;
}

:root[data-layout-mode="cols-1"] .video-grid {
  grid-template-columns: repeat(1, minmax(0, 1fr));
}

:root[data-layout-mode="cols-2"] .video-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

:root[data-layout-mode="cols-3"] .video-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

:root[data-layout-mode="cols-4"] .video-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

:root[data-layout-mode="cols-1"] .video-card,
:root[data-layout-mode="cols-2"] .video-card,
:root[data-layout-mode="cols-3"] .video-card,
:root[data-layout-mode="cols-4"] .video-card {
  width: auto;
  flex: initial;
  max-width: none;
}

@media (max-width: 860px) {
  .sources {
    grid-template-columns: 1fr;
  }

  .app-shell {
    width: min(100vw - 20px, 1280px);
    padding-top: 20px;
  }

  .panel {
    border-radius: 20px;
  }

  .comparison-panel {
    width: calc(100vw - 20px);
    margin-left: calc(50% - ((100vw - 20px) / 2));
    margin-right: calc(50% - ((100vw - 20px) / 2));
    padding-left: 10px;
    padding-right: 10px;
  }

  .comparison-panel-header {
    display: grid;
    grid-template-columns: 1fr;
    justify-items: stretch;
    gap: 12px;
  }

  .comparison-header-tools,
  .comparison-view-controls {
    width: 100%;
    min-width: 0;
    flex-wrap: wrap;
  }

  .comparison-header-tools {
    justify-content: center;
  }

  .comparison-view-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .comparison-view-controls .preview-size,
  .comparison-view-controls .layout-mode {
    display: grid;
    gap: 8px;
  }

  .comparison-view-controls .preview-size input[type="range"],
  .comparison-view-controls .layout-mode select {
    width: 100%;
  }

  .comparison-actions {
    width: 100%;
  }

  .timeline-tooltip {
    right: auto;
    left: 50%;
    transform: translateX(-50%);
    width: min(320px, calc(100vw - 32px));
  }

  .url-row {
    flex-direction: column;
  }

  .url-row button {
    align-self: stretch;
  }

  .view-controls,
  .playback-dock-inner {
    grid-template-columns: 1fr;
  }

  .video-grid {
    display: grid;
    grid-template-columns: 1fr;
  }

  .source-item,
  .video-card-header {
    flex-direction: column;
    align-items: stretch;
  }

  .compare-header {
    grid-template-columns: 1fr;
  }

  .compare-meta-left,
  .compare-meta-right {
    text-align: left;
  }

  .compare-title-row-left,
  .compare-title-row-right {
    justify-content: space-between;
  }

  .compare-title-row-right .video-title {
    text-align: left;
  }

  .compare-center-controls {
    order: -1;
  }

  .compare-diff-controls.active {
    grid-template-columns: 1fr;
  }

  .compare-diff-color {
    justify-items: start;
  }

  .source-actions,
  .video-card-actions {
    justify-content: stretch;
  }
}

/* ── Toast notifications ─────────────────────────────────────────── */

#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  align-items: flex-end;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 16px;
  min-width: 260px;
  max-width: min(400px, calc(100vw - 48px));
  border-radius: 16px;
  backdrop-filter: blur(18px);
  background: rgba(14, 22, 32, 0.92);
  border: 1px solid rgba(158, 184, 211, 0.16);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  pointer-events: all;
  position: relative;
  overflow: hidden;
  animation: toastIn 280ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.toast.toast-exit {
  animation: toastOut 240ms ease forwards;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(32px) scale(0.96); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0) scale(1); max-height: 120px; margin-bottom: 0; }
  to   { opacity: 0; transform: translateX(32px) scale(0.94); max-height: 0; margin-bottom: -10px; }
}

.toast-icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 800;
  line-height: 1;
}

.toast-body {
  flex: 1;
  min-width: 0;
  font-size: 0.875rem;
  line-height: 1.45;
  color: var(--text);
}

.toast-close {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 1rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  margin-top: -1px;
  transition: background 140ms ease, color 140ms ease;
}

.toast-close:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text);
  transform: none;
}

.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  border-radius: 0 0 16px 16px;
  animation: toastProgress linear forwards;
}

@keyframes toastProgress {
  from { width: 100%; }
  to   { width: 0%; }
}

.toast--error   { border-color: rgba(255, 122, 122, 0.3); }
.toast--warning { border-color: rgba(255, 193, 87, 0.3); }
.toast--success { border-color: rgba(102, 227, 196, 0.3); }
.toast--info    { border-color: rgba(100, 160, 230, 0.28); }

.toast--error   .toast-icon { background: rgba(255, 122, 122, 0.18); color: #ffb1b1; }
.toast--warning .toast-icon { background: rgba(255, 193, 87, 0.18);  color: #ffd87a; }
.toast--success .toast-icon { background: rgba(102, 227, 196, 0.18); color: var(--accent); }
.toast--info    .toast-icon { background: rgba(100, 160, 230, 0.18); color: #8ec3f5; }

.toast--error   .toast-progress { background: rgba(255, 122, 122, 0.7); }
.toast--warning .toast-progress { background: rgba(255, 193, 87, 0.7); }
.toast--success .toast-progress { background: rgba(102, 227, 196, 0.7); }
.toast--info    .toast-progress { background: rgba(100, 160, 230, 0.7); }

/* ── Confirm dialog ──────────────────────────────────────────────── */

.confirm-backdrop {
  position: fixed;
  inset: 0;
  z-index: 8900;
  background: rgba(5, 10, 18, 0.6);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: confirmBackdropIn 180ms ease both;
}

@keyframes confirmBackdropIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.confirm-dialog {
  background: rgba(14, 22, 32, 0.97);
  border: 1px solid rgba(158, 184, 211, 0.18);
  border-radius: 22px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  padding: 28px 28px 22px;
  max-width: min(400px, calc(100vw - 40px));
  width: 100%;
  animation: confirmDialogIn 220ms cubic-bezier(0.34, 1.4, 0.64, 1) both;
}

@keyframes confirmDialogIn {
  from { opacity: 0; transform: scale(0.92) translateY(10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.confirm-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: rgba(255, 122, 122, 0.12);
  border: 1px solid rgba(255, 122, 122, 0.22);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.confirm-icon::before {
  content: "";
  display: block;
  width: 22px;
  height: 22px;
  background: #ffb1b1;
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M9 3h6l1 2h4a1 1 0 1 1 0 2h-1l-1 13a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 7H4a1 1 0 1 1 0-2h4l1-2Zm0 6a1 1 0 0 0-1 1v8a1 1 0 1 0 2 0v-8a1 1 0 0 0-1-1Zm6 0a1 1 0 0 0-1 1v8a1 1 0 1 0 2 0v-8a1 1 0 0 0-1-1Z'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M9 3h6l1 2h4a1 1 0 1 1 0 2h-1l-1 13a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 7H4a1 1 0 1 1 0-2h4l1-2Zm0 6a1 1 0 0 0-1 1v8a1 1 0 1 0 2 0v-8a1 1 0 0 0-1-1Zm6 0a1 1 0 0 0-1 1v8a1 1 0 1 0 2 0v-8a1 1 0 0 0-1-1Z'/%3E%3C/svg%3E");
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: contain;
}

.confirm-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 8px;
}

.confirm-body {
  font-size: 0.875rem;
  color: var(--muted);
  margin: 0 0 22px;
  line-height: 1.5;
}

.confirm-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.confirm-cancel {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.confirm-ok {
  background: rgba(255, 122, 122, 0.18);
  color: #ffb1b1;
  border: 1px solid rgba(255, 122, 122, 0.28);
}

.confirm-ok:hover:not(:disabled) {
  background: rgba(255, 122, 122, 0.28);
}

.video-error-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(10, 15, 20, 0.92);
  backdrop-filter: blur(8px);
  text-align: center;
  z-index: 10;
  color: var(--text);
  box-sizing: border-box;
}

.video-error-icon {
  color: #ffb74d;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.video-error-title {
  margin: 0 0 8px;
  font-size: 1rem;
  font-weight: 600;
  color: #ffb74d;
}

.video-error-desc {
  margin: 0 0 12px;
  font-size: 0.85rem;
  color: var(--muted);
  max-width: 380px;
  line-height: 1.5;
}

.video-error-tip {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 8px 12px;
  max-width: 400px;
  line-height: 1.4;
}

.video-error-actions {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 380px;
}

.convert-prores-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--accent);
  color: #081018;
  border: none;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 4px 16px rgba(102, 227, 196, 0.35);
}

.convert-prores-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
  box-shadow: 0 6px 20px rgba(102, 227, 196, 0.45);
}

.convert-prores-btn:active {
  transform: translateY(0);
}

.convert-progress-wrap {
  width: 100%;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  position: relative;
  height: 28px;
  overflow: hidden;
  border: 1px solid rgba(102, 227, 196, 0.3);
}

.convert-progress-bar {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: linear-gradient(90deg, #1fc99f, #66e3c4);
  transition: width 0.2s ease;
  border-radius: 999px;
}

.convert-progress-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
  z-index: 1;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

.convert-privacy-note {
  margin: 0;
  font-size: 0.73rem;
  color: var(--muted);
  opacity: 0.85;
}

.preview-pill {
  color: var(--accent);
  background: rgba(102, 227, 196, 0.12);
  border: 1px solid rgba(102, 227, 196, 0.4);
  font-weight: 600;
}

.video-error-file-protocol {
  background: rgba(255, 179, 71, 0.08);
  border: 1px solid rgba(255, 179, 71, 0.3);
  border-radius: 8px;
  padding: 10px 12px;
  text-align: left;
  font-size: 0.77rem;
  line-height: 1.45;
  color: #fbd38d;
  width: 100%;
}

.video-error-file-protocol p {
  margin: 4px 0 0 0;
  color: #e2e8f0;
}

.video-error-file-protocol code {
  background: rgba(0, 0, 0, 0.35);
  padding: 2px 5px;
  border-radius: 4px;
  font-family: monospace;
  color: var(--accent);
  font-size: 0.76rem;
}

.file-protocol-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 700;
  color: #ffb347;
  font-size: 0.8rem;
}

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  max-width: 440px;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 0.84rem;
  font-weight: 500;
  line-height: 1.4;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.toast.toast-show {
  opacity: 1;
  transform: translateY(0);
}

.toast-info {
  background: #151d28;
  color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.toast-success {
  background: #0d261e;
  color: #66e3c4;
  border: 1px solid rgba(102, 227, 196, 0.35);
}

.toast-warning {
  background: #2b1f0e;
  color: #fbd38d;
  border: 1px solid rgba(255, 179, 71, 0.4);
}

.toast-error {
  background: #2c1216;
  color: #feb2b2;
  border: 1px solid rgba(255, 107, 129, 0.4);
}
