:root {
  color-scheme: dark;
  --bg: #07090f;
  --bg-soft: #0b0f17;
  --panel: rgba(17, 22, 33, 0.86);
  --panel-strong: rgba(19, 25, 37, 0.96);
  --border: rgba(255, 255, 255, 0.08);
  --text: #f4f7fb;
  --muted: rgba(232, 236, 243, 0.68);
  --accent: #88d6ff;
  --accent-2: #9b8cff;
  --accent-3: #3be7b0;
  --danger: #ff7b9c;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.24);
  --radius-xl: 20px;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 10px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top, rgba(136, 214, 255, 0.08), transparent 32%),
    radial-gradient(circle at 85% 15%, rgba(155, 140, 255, 0.07), transparent 24%),
    linear-gradient(180deg, #05070b 0%, #0b1018 100%);
  color: var(--text);
  font-family: "Plus Jakarta Sans", system-ui, sans-serif;
}

body {
  overflow-x: hidden;
}

canvas#particles {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  opacity: 0.65;
}

.shell {
  position: relative;
  z-index: 1;
  width: min(1120px, calc(100% - 24px));
  margin: 0 auto;
  padding: 24px 0 48px;
}

.card,
.glass {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.hero {
  display: grid;
  grid-template-columns: 1.2fr 0.95fr;
  gap: 20px;
  padding: 20px;
  overflow: hidden;
  position: relative;
}

.hero::before {
  content: "";
  position: absolute;
  inset: -18% auto auto -8%;
  width: 320px;
  height: 320px;
  background: radial-gradient(circle, rgba(136, 214, 255, 0.11), transparent 60%);
  filter: blur(18px);
  animation: drift 18s ease-in-out infinite alternate;
}

.hero__copy,
.hero__panel {
  position: relative;
  z-index: 1;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  margin-top: 16px;
  font-size: clamp(2.2rem, 5vw, 4.2rem);
  line-height: 1.02;
  letter-spacing: -0.04em;
}

.hero p {
  margin-top: 18px;
  max-width: 52ch;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.65;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 20px;
}

.stats div,
.history-item,
.empty-state,
.progress-wrap,
.stream-panel,
.result-main,
.dropzone,
.input-stack,
.folder-panel,
.folder-item {
  border-radius: var(--radius-lg);
}

.stats div {
  padding: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.stats strong,
.stats span {
  display: block;
}

.stats strong {
  font-size: 0.95rem;
}

.stats span,
.dropzone__hint,
.stream-caption,
.pill,
.section-head.compact button,
.meta-grid span,
.result-state {
  color: var(--muted);
  font-size: 0.9rem;
}

.hero__panel {
  padding: 16px;
}

.input-stack {
  display: grid;
  gap: 12px;
}

.advanced-panel {
  padding: 12px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(255, 255, 255, 0.025);
}

.advanced-panel summary {
  cursor: pointer;
  font-weight: 800;
  margin-bottom: 10px;
}

.advanced-panel label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
}

.advanced-panel input {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  border-radius: 12px;
  padding: 11px 12px;
  font: inherit;
  outline: none;
}

.advanced-panel input::placeholder {
  color: rgba(233, 239, 255, 0.38);
}

.advanced-panel p {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.55;
}

.input-stack label,
.section-head h2,
.section-head h3 {
  font-weight: 800;
  letter-spacing: -0.02em;
}

.dropzone {
  position: relative;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(255, 255, 255, 0.03);
  transition: border-color 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

.dropzone.dragover {
  transform: translateY(-1px);
  border-color: rgba(136, 214, 255, 0.42);
  background: rgba(136, 214, 255, 0.05);
}

textarea {
  width: 100%;
  resize: vertical;
  min-height: 116px;
  border: 0;
  outline: none;
  color: var(--text);
  background: transparent;
  font: inherit;
  font-size: 1rem;
  line-height: 1.6;
  padding: 0;
}

textarea::placeholder {
  color: rgba(233, 239, 255, 0.38);
}

.dropzone__hint {
  margin-top: 8px;
}

.actions,
.button-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

button,
.anchor-button,
.link-button {
  border: 0;
  cursor: pointer;
  font: inherit;
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

button:hover,
.anchor-button:hover,
.link-button:hover {
  transform: translateY(-1px);
}

button:active,
.anchor-button:active,
.link-button:active {
  transform: translateY(0);
}

.primary,
.secondary,
.anchor-button,
.link-button {
  border-radius: 999px;
  padding: 11px 16px;
  font-weight: 800;
}

.primary,
.anchor-button {
  color: #08101c;
  background: linear-gradient(135deg, #9be5ff, #a89cff 55%, #4ae1bb);
  box-shadow: 0 10px 24px rgba(136, 214, 255, 0.12);
}

.secondary,
.link-button {
  color: var(--text);
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.progress-wrap {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(255, 255, 255, 0.025);
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.9rem;
}

.progress-bar {
  height: 8px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 999px;
}

#progressFill {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--accent-3));
  box-shadow: none;
  transition: width 0.18s ease;
}

.content-grid {
  margin-top: 20px;
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 16px;
}

.sidebar,
.result-card {
  padding: 18px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.pill {
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.history-list {
  display: grid;
  gap: 12px;
}

.history-item {
  padding: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.history-item__top {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
}

.history-item__title {
  font-weight: 700;
  margin-bottom: 6px;
  word-break: break-word;
}

.history-item__meta {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

.history-item button {
  margin-top: 10px;
  width: 100%;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 360px;
  text-align: center;
  padding: 28px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed rgba(255, 255, 255, 0.1);
}

.empty-state__icon {
  width: 60px;
  height: 60px;
  display: grid;
  place-items: center;
  font-size: 1.5rem;
  border-radius: 18px;
  margin-bottom: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.result-area {
  display: grid;
  gap: 14px;
}

.result-main {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 14px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.thumbnail-wrap {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(255, 255, 255, 0.03);
}

.thumbnail-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity 0.35s ease;
}

.thumbnail-wrap img.visible {
  opacity: 1;
}

.thumbnail-overlay {
  position: absolute;
  left: 12px;
  bottom: 12px;
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 800;
  background: rgba(6, 8, 14, 0.64);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.result-meta h3 {
  font-size: clamp(1.3rem, 2vw, 1.8rem);
  word-break: break-word;
  margin-bottom: 14px;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.meta-grid div {
  padding: 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.meta-grid span {
  display: block;
  margin-bottom: 6px;
}

.meta-grid strong {
  font-size: 1rem;
}

.stream-panel {
  padding: 14px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.folder-panel {
  display: grid;
  gap: 14px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.folder-list {
  display: grid;
  gap: 10px;
}

.folder-item {
  display: grid;
  gap: 12px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.folder-item__top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: start;
}

.folder-item__title {
  font-weight: 800;
  word-break: break-word;
}

.folder-item__meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.88rem;
}

.folder-item .button-row {
  gap: 8px;
}

.folder-item .button-row a,
.folder-item .button-row button {
  padding: 10px 12px;
}

video {
  width: 100%;
  border-radius: 20px;
  background: #000;
  aspect-ratio: 16 / 9;
}

.stream-caption {
  margin-top: 10px;
}

.hidden {
  display: none !important;
}

.toast-host {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 5;
  display: grid;
  gap: 10px;
}

.toast {
  min-width: 260px;
  max-width: 340px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(10, 14, 22, 0.92);
  box-shadow: var(--shadow);
  animation: pop 0.25s ease;
}

.toast strong {
  display: block;
  margin-bottom: 4px;
}

.toast.success strong {
  color: var(--accent-3);
}

.toast.error strong {
  color: var(--danger);
}

.toast.info strong {
  color: var(--accent);
}

@keyframes pop {
  from {
    transform: translateY(10px) scale(0.98);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

@keyframes drift {
  from {
    transform: translate3d(0, 0, 0);
  }
  to {
    transform: translate3d(40px, 24px, 0);
  }
}

@media (max-width: 980px) {
  .hero,
  .content-grid,
  .result-main {
    grid-template-columns: 1fr;
  }

  .stats {
    grid-template-columns: 1fr;
  }

  .sidebar {
    order: 2;
  }

  .result-card {
    order: 1;
  }

  .empty-state {
    min-height: 260px;
  }
}

@media (max-width: 680px) {
  .shell {
    width: min(100% - 14px, 1120px);
    padding-top: 10px;
  }

  .hero,
  .sidebar,
  .result-card {
    padding: 14px;
  }

  h1 {
    font-size: clamp(1.9rem, 9vw, 3rem);
  }

  .actions,
  .button-row {
    display: grid;
  }

  .actions button,
  .button-row button,
  .button-row a {
    width: 100%;
    justify-content: center;
  }

  .meta-grid {
    grid-template-columns: 1fr;
  }

  .result-main {
    padding: 12px;
  }

  .thumbnail-wrap {
    aspect-ratio: 16 / 10;
  }

  .toast {
    min-width: calc(100vw - 28px);
  }
}