:root {
  --bg: #0b0f14;
  --bg-soft: #111722;
  --panel: rgba(18, 24, 32, 0.9);
  --panel-strong: rgba(15, 19, 27, 0.96);
  --panel-muted: rgba(8, 12, 18, 0.44);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(118, 169, 255, 0.24);
  --text: #ecf3ff;
  --muted: #9caec8;
  --accent: #79a8ff;
  --accent-strong: #a3c3ff;
  --accent-2: #e3a7ff;
  --danger: #ff6b87;
  --success: #7ed7a7;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.38);
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;
  color-scheme: dark;
  font-family: "Avenir Next", "Segoe UI Variable", "SF Pro Display", "Segoe UI", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(121, 168, 255, 0.16), transparent 36%),
    radial-gradient(circle at right bottom, rgba(227, 167, 255, 0.13), transparent 32%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.015), rgba(255, 255, 255, 0)),
    var(--bg);
  color: var(--text);
}

body {
  padding: 24px;
}

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

button,
.file-label,
.player-shell,
input[type="range"],
input[type="checkbox"] {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
.file-label:focus-visible,
.player-shell:focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: 3px;
}

.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;
}

.noscript {
  margin: 0 auto 18px;
  max-width: 1280px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: rgba(255, 107, 135, 0.12);
  border: 1px solid rgba(255, 107, 135, 0.3);
}

.app {
  max-width: 1320px;
  margin: 0 auto;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 20px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-strong);
  letter-spacing: 0.12em;
  font-size: 0.78rem;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
}

h1 {
  font-size: clamp(1.5rem, 3vw, 2.45rem);
  line-height: 1.08;
}

.subtitle,
.muted,
.hint,
.footer-note,
.preset-summary,
.tips,
.timeline-meta,
.message {
  color: var(--muted);
}

.subtitle {
  margin: 10px 0 0;
  max-width: 70ch;
  line-height: 1.5;
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.72fr) minmax(320px, 0.98fr);
  gap: 22px;
  align-items: start;
}

.surface,
.sidebar {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.surface {
  padding: 20px;
}

.sidebar {
  padding: 18px;
  position: sticky;
  top: 20px;
}

.stack {
  display: grid;
  gap: 16px;
}

.section {
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-lg);
  padding: 14px 14px 16px;
  background: var(--panel-muted);
}

.section-head,
.section-head-large,
.row,
.field-top,
.preset-head,
.toggle-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.section-head,
.section-head-large,
.field-top,
.preset-head {
  align-items: baseline;
}

.section-head {
  margin-bottom: 12px;
}

.section-head-large {
  margin-bottom: 16px;
  align-items: flex-start;
}

.section h2 {
  font-size: 1rem;
}

.row {
  align-items: center;
  flex-wrap: wrap;
}

.row-tight {
  gap: 10px;
}

.control-grid,
.eq-grid {
  display: grid;
  gap: 12px;
}

.top-gap {
  margin-top: 12px;
}

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

.field-top span:last-child,
.timeline-meta,
.message,
.preset-summary,
.badge,
code {
  font-variant-numeric: tabular-nums;
}

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

button,
.file-label {
  min-height: 46px;
  padding: 12px 15px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.015));
  color: var(--text);
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease, opacity 120ms ease;
}

button:hover:not(:disabled),
.file-label:hover {
  transform: translateY(-1px);
  border-color: var(--border-strong);
  background: linear-gradient(180deg, rgba(121, 168, 255, 0.14), rgba(255, 255, 255, 0.03));
}

button:active:not(:disabled),
.file-label:active {
  transform: translateY(0);
}

button.primary {
  background: linear-gradient(180deg, rgba(121, 168, 255, 0.25), rgba(121, 168, 255, 0.09));
  border-color: rgba(121, 168, 255, 0.42);
}

button[data-active="true"],
button[aria-pressed="true"] {
  background: linear-gradient(180deg, rgba(121, 168, 255, 0.22), rgba(121, 168, 255, 0.08));
  border-color: rgba(121, 168, 255, 0.45);
}

button.ghost {
  background: rgba(255, 255, 255, 0.03);
}

button:disabled,
input:disabled,
.file-label[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
}

input[type="file"] {
  display: none;
}

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

.badge,
.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--text);
  white-space: nowrap;
}

.badge {
  justify-content: center;
}

.surface-player {
  display: grid;
  gap: 16px;
}

.player-shell {
  position: relative;
  min-height: 320px;
  aspect-ratio: 16 / 9;
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0)),
    #02060b;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.player-shell.dragover {
  transform: scale(1.004);
  border-color: rgba(121, 168, 255, 0.56);
  box-shadow: 0 0 0 1px rgba(121, 168, 255, 0.32), 0 28px 84px rgba(0, 0, 0, 0.45);
}

#screen {
  width: 100%;
  height: 100%;
  display: block;
  background: #000;
}

#video {
  display: none;
}

.overlay,
.drop-hint {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.overlay {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  padding: 16px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.28));
}

.pill {
  pointer-events: auto;
  max-width: min(100%, 420px);
  backdrop-filter: blur(16px);
}

.pill strong {
  font-weight: 700;
}

.pill span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.drop-hint {
  display: grid;
  place-items: center;
  background: rgba(4, 10, 18, 0.6);
  color: var(--text);
  font-size: clamp(1rem, 2vw, 1.2rem);
  letter-spacing: 0.03em;
  opacity: 0;
  transition: opacity 120ms ease;
}

.player-shell.dragover .drop-hint {
  opacity: 1;
}

.message-row {
  display: grid;
  gap: 6px;
}

.message {
  margin: 0;
  min-height: 1.35em;
  line-height: 1.4;
}

.message-error {
  color: var(--danger);
}

.timeline-wrap {
  display: grid;
  gap: 6px;
}

.timeline-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.92rem;
}

.toggle-row {
  align-items: center;
  padding-top: 2px;
}

.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch-ui {
  width: 50px;
  height: 29px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.08);
  position: relative;
  transition: background 120ms ease, border-color 120ms ease;
}

.switch-ui::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 21px;
  height: 21px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
  transition: transform 120ms ease;
}

.switch input:checked + .switch-ui {
  background: rgba(121, 168, 255, 0.34);
  border-color: rgba(121, 168, 255, 0.46);
}

.switch input:checked + .switch-ui::after {
  transform: translateX(21px);
}

.segmented {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  padding: 4px;
  gap: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.segmented-btn {
  min-height: 38px;
  padding: 8px 14px;
  border-radius: 999px;
  background: transparent;
}

.segmented-btn[aria-pressed="true"] {
  background: linear-gradient(180deg, rgba(121, 168, 255, 0.22), rgba(121, 168, 255, 0.08));
  border-color: rgba(121, 168, 255, 0.45);
}

.preset-grid {
  display: grid;
  gap: 12px;
}

.preset-card {
  padding: 12px;
  border-radius: 16px;
  background: var(--panel-strong);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.preset-card.is-active {
  border-color: rgba(121, 168, 255, 0.46);
  box-shadow: inset 0 0 0 1px rgba(121, 168, 255, 0.18);
}

.preset-summary {
  margin: 10px 0 0;
  line-height: 1.45;
}

.preset-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

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

.stat {
  border-radius: 16px;
  padding: 12px;
  background: var(--panel-strong);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.stat strong {
  display: block;
  margin-bottom: 4px;
  font-size: 1.02rem;
}

.stat span {
  color: var(--muted);
  font-size: 0.9rem;
}

.tips {
  margin: 0;
  padding-left: 18px;
  line-height: 1.55;
}

.tips li + li {
  margin-top: 6px;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 7px;
  border-radius: 8px;
  font-size: 0.9em;
}

@media (max-width: 1120px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }
}

@media (max-width: 780px) {
  body {
    padding: 16px;
  }

  .hero {
    flex-direction: column;
  }

  .hero-badges {
    justify-content: flex-start;
  }

  .surface,
  .sidebar {
    border-radius: 20px;
    padding: 16px;
  }

  .overlay {
    flex-direction: column;
    align-items: stretch;
  }

  .pill {
    max-width: 100%;
  }

  .stat-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 580px) {
  .transport,
  .preset-actions,
  .row {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .transport button:first-child,
  .row > :first-child:last-child {
    grid-column: 1 / -1;
  }

  .player-shell {
    min-height: 220px;
  }

  .segmented {
    width: 100%;
  }

  .segmented-btn {
    flex: 1 1 0;
  }
}
