:root {
  --bg: #090d16;
  --bg-card: #111827;
  --bg-input: #0b111e;
  --border: #1f2937;
  --border-highlight: #374151;
  --text: #f8fafc;
  --text-muted: #94a3b8;
  --emerald: #10b981;
  --emerald-dark: #059669;
  --blue: #3b82f6;
  --orange: #f97316;
  --radius: 14px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

code {
  font-family: "JetBrains Mono", Consolas, monospace;
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 6px;
  border-radius: 5px;
  font-size: 0.88em;
  color: #6ee7b7;
}

.bg-glow {
  position: fixed;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  filter: blur(130px);
  opacity: 0.14;
  pointer-events: none;
  z-index: 0;
}
.bg-glow-1 { top: -120px; left: -80px; background: var(--emerald); }
.bg-glow-2 { bottom: -140px; right: -80px; background: var(--blue); }

.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px;
  position: relative;
  z-index: 1;
}

.topbar {
  border-bottom: 1px solid var(--border);
  background: rgba(9, 13, 22, 0.9);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 30;
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  gap: 14px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--emerald), var(--blue));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.35);
}
.brand-logo svg { width: 22px; height: 22px; }

.brand-title {
  font-weight: 700;
  font-size: 1.14rem;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.badge-cf {
  font-size: 0.72rem;
  background: rgba(16, 185, 129, 0.18);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.4);
  padding: 2px 8px;
  border-radius: 999px;
}

.brand-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  border: 1px solid rgba(16, 185, 129, 0.35);
  background: rgba(16, 185, 129, 0.1);
  color: #a7f3d0;
}
.status-pill .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--emerald);
  box-shadow: 0 0 8px var(--emerald);
}

.main-grid {
  padding-top: 24px;
  padding-bottom: 48px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
}

.card-hero {
  background: linear-gradient(180deg, rgba(17, 24, 39, 0.96), rgba(13, 19, 33, 0.98));
  border-color: #26354d;
}

.hero-header h1 {
  font-size: 1.45rem;
  margin-bottom: 6px;
}

.hero-desc {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin-bottom: 18px;
}

.url-bar-wrapper {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.url-input-group {
  flex: 1;
  min-width: 280px;
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 2px solid #2e4369;
  border-radius: 12px;
  padding: 4px 10px;
}
.url-input-group:focus-within {
  border-color: var(--emerald);
}

.url-icon {
  font-size: 1.1rem;
  margin-right: 8px;
}

.url-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 1rem;
  padding: 10px 4px;
  outline: none;
}

.btn-inline {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--border-highlight);
  color: var(--text-muted);
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.82rem;
  margin-left: 6px;
  white-space: nowrap;
}
.btn-inline:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.14);
}

.select-format-main {
  background: var(--bg-input);
  border: 2px solid #2e4369;
  color: var(--text);
  padding: 0 14px;
  border-radius: 12px;
  font-size: 0.92rem;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  min-height: 48px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--emerald), var(--emerald-dark));
  color: #fff;
  border: none;
  padding: 12px 24px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 0.98rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.32);
  transition: transform 0.15s, filter 0.15s;
}
.btn-primary:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}
.btn-primary:disabled {
  opacity: 0.65;
  cursor: wait;
}

.sample-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 18px;
  font-size: 0.84rem;
}
.sample-label { color: var(--text-muted); }

.chip-link {
  background: rgba(59, 130, 246, 0.14);
  border: 1px solid rgba(59, 130, 246, 0.35);
  color: #93c5fd;
  padding: 4px 12px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.82rem;
}
.chip-link:hover { background: rgba(59, 130, 246, 0.24); }

.preview-card {
  display: grid;
  grid-template-columns: 270px 1fr;
  gap: 20px;
  background: rgba(9, 13, 22, 0.72);
  border: 1px solid #26354d;
  border-radius: 12px;
  padding: 18px;
  align-items: start;
}

.preview-thumb-wrap {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: #000;
}
.preview-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.platform-tag {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(239, 68, 68, 0.92);
  color: #fff;
  font-size: 0.74rem;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 6px;
}

.preview-kicker {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #34d399;
  font-weight: 700;
  margin-bottom: 4px;
}
.preview-title {
  font-size: 1.05rem;
  margin-bottom: 6px;
  line-height: 1.4;
}
.preview-submeta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 0.83rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.filename-bar {
  background: #0d1322;
  border: 1px solid rgba(16, 185, 129, 0.35);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 14px;
}
.filename-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #6ee7b7;
  margin-bottom: 6px;
}
.filename-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.filename-input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid #2e4369;
  color: #f8fafc;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.88rem;
  outline: none;
}
.filename-input:focus {
  border-color: var(--emerald);
}

.quick-dl-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.btn-quick-fmt {
  background: linear-gradient(135deg, #1e293b, #0f172a);
  border: 1px solid #334155;
  color: #f8fafc;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-quick-fmt:hover {
  border-color: var(--emerald);
  background: rgba(16, 185, 129, 0.16);
  color: #6ee7b7;
}
.btn-quick-audio:hover {
  border-color: var(--orange);
  background: rgba(249, 115, 22, 0.16);
  color: #fdba74;
}

.progress-panel {
  background: #0d1322;
  border: 1px solid #25334d;
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 14px;
}
.progress-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 0.86rem;
}
.progress-status-text {
  color: #e2e8f0;
}
.progress-percent {
  font-weight: 700;
  color: #34d399;
  font-family: monospace;
  white-space: nowrap;
}
.progress-bar-bg {
  width: 100%;
  height: 10px;
  background: #1e293b;
  border-radius: 999px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--emerald), var(--blue));
  border-radius: 999px;
  transition: width 0.3s ease;
}

.final-dl-action {
  margin-top: 12px;
}
.btn-final-save {
  display: block;
  text-align: center;
  background: linear-gradient(135deg, var(--emerald), var(--emerald-dark));
  color: #fff;
  text-decoration: none;
  padding: 11px 16px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.92rem;
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.35);
}
.btn-final-save:hover {
  filter: brightness(1.08);
}

.hidden { display: none !important; }

.worker-streams-box {
  background: #0d1322;
  border: 1px solid #25334d;
  border-radius: 10px;
  padding: 12px;
}

.engine-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.engine-badge {
  font-size: 0.8rem;
  font-weight: 600;
  color: #93c5fd;
  background: rgba(59, 130, 246, 0.14);
  border: 1px solid rgba(59, 130, 246, 0.35);
  padding: 3px 10px;
  border-radius: 8px;
}

.stream-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.stream-status {
  font-size: 0.83rem;
  color: var(--text-muted);
}

.btn-stream-dl {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  text-decoration: none;
  padding: 7px 13px;
  border-radius: 8px;
  font-size: 0.83rem;
  font-weight: 600;
  border: 1px solid rgba(147, 197, 253, 0.3);
}
.btn-stream-dl:hover { filter: brightness(1.12); }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.card-header h2 { font-size: 1.05rem; }

.tag-doc {
  font-size: 0.76rem;
  background: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.35);
  padding: 3px 10px;
  border-radius: 999px;
}

.local-fix-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}
.control-item label {
  display: block;
  font-size: 0.84rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: #cbd5e1;
}
.select-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-highlight);
  color: var(--text);
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 0.88rem;
}

.terminal-box {
  background: #060911;
  border: 1px solid #1e293b;
  border-radius: 10px;
  overflow: hidden;
}
.terminal-bar {
  background: #0f172a;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #1e293b;
  flex-wrap: wrap;
  gap: 8px;
}
.terminal-title {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-family: monospace;
}
.terminal-btns { display: flex; gap: 8px; }
.btn-copy-code {
  background: rgba(59, 130, 246, 0.2);
  border: 1px solid rgba(59, 130, 246, 0.45);
  color: #93c5fd;
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 0.78rem;
  cursor: pointer;
  font-weight: 600;
}
.btn-bat-fix {
  background: rgba(16, 185, 129, 0.2);
  border-color: rgba(16, 185, 129, 0.45);
  color: #6ee7b7;
}
.terminal-code {
  padding: 14px;
  color: #4ade80;
  font-family: "JetBrains Mono", Consolas, monospace;
  font-size: 0.84rem;
  white-space: pre-wrap;
  word-break: break-all;
}

.btn-link-sm {
  background: none;
  border: none;
  color: #93c5fd;
  cursor: pointer;
  font-size: 0.8rem;
}

.footer {
  border-top: 1px solid var(--border);
  padding: 18px 0;
  font-size: 0.82rem;
  color: var(--text-muted);
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}
.footer a { color: #6ee7b7; text-decoration: none; }

@media (max-width: 960px) {
  .preview-card { grid-template-columns: 1fr; }
  .quick-dl-grid { grid-template-columns: repeat(2, 1fr); }
  .local-fix-controls { grid-template-columns: 1fr; }
}
