:root {
  --bg: #080a10;
  --panel: rgba(17, 21, 32, .78);
  --panel-2: rgba(26, 31, 46, .9);
  --line: rgba(255, 255, 255, .09);
  --line-strong: rgba(255, 255, 255, .16);
  --text: #f2f4fa;
  --muted: #8e97ad;
  --accent: #7c8cff;
  --accent-2: #55e6c1;
  --danger: #ff6b81;
  --warn: #ffc857;
  --radius: 18px;
  --shadow: 0 24px 70px rgba(0, 0, 0, .38);
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
code { color: #c8d0ff; }

.aurora {
  position: fixed;
  inset: -20% -10% auto -10%;
  height: 70vh;
  background:
    radial-gradient(50% 50% at 20% 20%, rgba(124, 140, 255, .22), transparent 70%),
    radial-gradient(40% 60% at 80% 10%, rgba(85, 230, 193, .13), transparent 70%),
    radial-gradient(30% 40% at 55% 50%, rgba(255, 107, 129, .09), transparent 70%);
  filter: blur(30px);
  pointer-events: none;
  z-index: 0;
}

.topbar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1180px;
  margin: 0 auto;
  padding: 26px 28px 10px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 13px;
  font-weight: 800;
  font-size: 19px;
  color: #0a0c14;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  box-shadow: 0 0 28px rgba(124, 140, 255, .34);
}
.brand strong { display: block; letter-spacing: -.02em; font-size: 17px; }
.brand small { display: block; color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }

.pill {
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 11px;
  letter-spacing: .04em;
  text-transform: uppercase;
  background: rgba(255, 255, 255, .03);
}

.shell {
  position: relative;
  z-index: 1;
  max-width: 1180px;
  margin: 0 auto;
  padding: 32px 28px 80px;
}

.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 40px;
  padding: 34px 4px 42px;
}
.eyebrow {
  margin: 0 0 10px;
  color: var(--accent-2);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
}
h1 {
  margin: 0 0 16px;
  font-size: clamp(38px, 6vw, 72px);
  line-height: .98;
  letter-spacing: -.045em;
  font-weight: 700;
}
h1 em {
  font-style: normal;
  background: linear-gradient(100deg, #fff 10%, var(--accent-2) 55%, var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.lede { max-width: 570px; margin: 0; color: var(--muted); font-size: 15.5px; line-height: 1.65; }
.hero-stats { display: flex; gap: 10px; flex-shrink: 0; }
.hero-stats div {
  min-width: 92px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, .025);
}
.hero-stats span { display: block; font-size: 26px; font-weight: 700; letter-spacing: -.03em; }
.hero-stats small { color: var(--muted); font-size: 11px; }

.grid {
  display: grid;
  grid-template-columns: minmax(340px, .85fr) minmax(420px, 1.15fr);
  gap: 18px;
}
.panel {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: var(--radius);
  padding: 22px;
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.panel h2 { margin: 0; font-size: 20px; letter-spacing: -.02em; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.hidden { display: none !important; }

.key-panel { margin-bottom: 18px; border-color: rgba(255, 200, 87, .25); background: rgba(36, 30, 16, .55); }
.key-panel h2 { font-size: 18px; margin-bottom: 6px; }
.key-panel .row { display: flex; gap: 10px; flex-wrap: wrap; }
.key-panel input { flex: 1; min-width: 240px; }

input, select {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(7, 9, 15, .66);
  color: var(--text);
  border-radius: 11px;
  padding: 11px 13px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus {
  border-color: rgba(124, 140, 255, .65);
  box-shadow: 0 0 0 3px rgba(124, 140, 255, .12);
}
input[type="range"] { padding: 0; accent-color: var(--accent); }

.primary, .ghost, .danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 11px;
  padding: 11px 16px;
  border: 1px solid transparent;
  font-weight: 600;
  transition: transform .12s, opacity .15s, background .15s;
}
.primary {
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  color: #090b12;
  box-shadow: 0 10px 26px rgba(124, 140, 255, .25);
}
.primary:hover { transform: translateY(-1px); }
.ghost {
  background: rgba(255, 255, 255, .04);
  border-color: var(--line);
  color: var(--text);
}
.ghost:hover { background: rgba(255, 255, 255, .08); }
.danger { color: var(--danger); }
.small.ghost { padding: 7px 11px; font-size: 12px; }
.wide { width: 100%; }
.link { border: 0; background: none; color: var(--accent-2); padding: 0; font-weight: 600; }

.dropzone {
  border: 1px dashed var(--line-strong);
  border-radius: 15px;
  padding: 38px 20px;
  text-align: center;
  background: rgba(255, 255, 255, .018);
  transition: border-color .15s, background .15s;
}
.dropzone.dragging { border-color: var(--accent-2); background: rgba(85, 230, 193, .06); }
.dropzone p { margin: 8px 0 0; }
.drop-icon {
  width: 46px;
  height: 46px;
  margin: 0 auto 12px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: rgba(124, 140, 255, .14);
  color: var(--accent);
  font-size: 24px;
  font-weight: 700;
}
.flow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
  margin-top: 18px;
  color: var(--muted);
  font-size: 10.5px;
  letter-spacing: .02em;
}
.flow b { color: rgba(255, 255, 255, .2); }

.progress-card {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(7, 9, 15, .5);
}
.progress-head { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; margin-bottom: 8px; }
.bar { height: 5px; border-radius: 99px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, var(--accent-2), var(--accent)); transition: width .18s; }

.video-list { display: flex; flex-direction: column; gap: 10px; max-height: 520px; overflow: auto; padding-right: 4px; }
.empty { color: var(--muted); text-align: center; padding: 46px 12px; font-size: 13px; }
.video {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  background: rgba(255, 255, 255, .018);
}
.video-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.video-title { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.video-meta { color: var(--muted); font-size: 11px; margin-top: 4px; display: flex; gap: 8px; flex-wrap: wrap; }
.video-actions { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 12px; }
.video-actions button, .video-actions a { padding: 7px 10px; font-size: 11.5px; border-radius: 9px; }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 999px; font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; }
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge.ready { color: var(--accent-2); background: rgba(85, 230, 193, .1); }
.badge.encoding, .badge.queued, .badge.uploading { color: var(--warn); background: rgba(255, 200, 87, .1); }
.badge.failed { color: var(--danger); background: rgba(255, 107, 129, .1); }
.badge.deleted, .badge.aborted { color: var(--muted); background: rgba(255, 255, 255, .06); }

.mini-bar { height: 3px; margin-top: 11px; border-radius: 99px; background: rgba(255, 255, 255, .07); overflow: hidden; }
.mini-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent-2), var(--accent)); }
.video-error { margin-top: 9px; color: var(--danger); font-size: 11.5px; line-height: 1.45; word-break: break-word; }
.video-note { margin-top: 9px; color: var(--muted); font-size: 11px; }

.architecture { margin-top: 18px; }
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.steps > div { padding: 15px; border: 1px solid var(--line); border-radius: 13px; background: rgba(255, 255, 255, .018); }
.steps b { color: var(--accent); font-size: 12px; }
.steps h3 { font-size: 13px; margin: 9px 0 6px; }
.steps p { margin: 0; color: var(--muted); font-size: 11.5px; line-height: 1.55; }

.drawer {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(4, 6, 11, .72);
  backdrop-filter: blur(8px);
}
.drawer-card {
  width: min(680px, 100%);
  max-height: 92vh;
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: 22px;
  background: #0e121c;
  box-shadow: 0 30px 100px rgba(0, 0, 0, .6);
  padding: 24px;
}
.drawer-head { display: flex; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.drawer-head h2 { margin: 0 0 4px; font-size: 23px; }
.form { display: flex; flex-direction: column; gap: 14px; }
.form label { display: flex; flex-direction: column; gap: 7px; color: var(--muted); font-size: 11.5px; font-weight: 600; letter-spacing: .02em; }
.form label output { color: var(--text); float: right; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid label { min-width: 0; }

.result { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 18px; display: flex; flex-direction: column; gap: 13px; }
.result-head { display: flex; align-items: center; gap: 9px; font-size: 13px; }
.ok-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent-2); box-shadow: 0 0 12px var(--accent-2); }
.copy-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: end; color: var(--muted); font-size: 11.5px; font-weight: 600; }
.copy-row input { grid-column: 1 / -1; font-size: 11.5px; }
.copy-row .copy { position: relative; top: -42px; margin-bottom: -28px; justify-self: end; }
.player-wrap { border-radius: 14px; overflow: hidden; border: 1px solid var(--line); background: #000; aspect-ratio: 16 / 9; }
.player-wrap video { width: 100%; height: 100%; display: block; }
.result-actions { display: flex; gap: 9px; flex-wrap: wrap; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 80;
  transform: translate(-50%, 20px);
  opacity: 0;
  pointer-events: none;
  background: #1a2030;
  border: 1px solid var(--line-strong);
  color: var(--text);
  border-radius: 12px;
  padding: 11px 16px;
  font-size: 12.5px;
  transition: opacity .18s, transform .18s;
  box-shadow: var(--shadow);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.error-text { color: var(--danger); font-size: 12px; min-height: 16px; margin: 8px 0 0; }

@media (max-width: 900px) {
  .grid, .steps { grid-template-columns: 1fr; }
  .hero { flex-direction: column; align-items: flex-start; }
  .hero-stats { width: 100%; }
  .hero-stats div { flex: 1; }
}
@media (max-width: 560px) {
  .topbar, .shell { padding-left: 16px; padding-right: 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .flow { display: none; }
}
