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

:root {
  --bg:          #0d0d1a;
  --surface:     #13131f;
  --surface2:    #1a1a2e;
  --border:      rgba(255,255,255,.07);
  --border-hov:  rgba(108,99,255,.45);
  --accent:      #6c63ff;
  --accent2:     #a855f7;
  --grad:        linear-gradient(135deg, var(--accent), var(--accent2));
  --grad-mp3:    linear-gradient(135deg, #10b981, #059669);
  --text:        #e2e8f0;
  --muted:       #64748b;
  --dim:         #94a3b8;
  --success:     #10b981;
  --error:       #ef4444;
  --radius:      14px;
}

html { scroll-behavior: smooth; }

body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  background-image:
    radial-gradient(900px 480px at 15% -10%, rgba(108,99,255,.14), transparent 60%),
    radial-gradient(700px 420px at 90% 0%, rgba(168,85,247,.10), transparent 60%);
  background-attachment: fixed;
}

.shell { max-width: 720px; margin: 0 auto; padding: 40px 18px 80px; }

/* ── Nav ─────────────────────────────── */
.nav { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 26px; }
.nav-link {
  color: var(--dim); text-decoration: none; font-size: .88rem; font-weight: 600;
  padding: 6px 12px; border-radius: 8px; border: 1px solid transparent;
  transition: all .15s ease;
}
.nav-link:hover { color: var(--text); background: var(--surface2); }
.nav-link.active { color: #a5b4fc; border-color: rgba(108,99,255,.35); background: rgba(108,99,255,.1); }

/* ── Hero ─────────────────────────────── */
.hero { text-align: center; margin-bottom: 28px; }
.hero.article { text-align: left; margin-bottom: 10px; }
.hero.article .logo { margin: 0 0 16px; }
.hero.article h1 { font-size: 1.6rem; }
.homelink { display: block; text-decoration: none; color: inherit; }
.hero .logo {
  width: 56px; height: 56px; margin: 0 auto 16px; border-radius: 16px;
  background: var(--grad);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 30px rgba(108,99,255,.35);
}
.hero h1 { font-size: 1.9rem; font-weight: 800; letter-spacing: -.02em; }
.hero h1 span {
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.hero p { color: var(--dim); margin-top: 8px; font-size: .98rem; line-height: 1.6; }

/* ── Cards ────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-top: 18px;
}

/* ── Mode pills ───────────────────────── */
.pills { display: flex; gap: 10px; margin-bottom: 18px; }
.pill {
  flex: 1; text-align: center; padding: 10px 12px;
  border-radius: 10px; cursor: pointer; user-select: none;
  font-weight: 700; font-size: .95rem;
  color: var(--dim); text-decoration: none;
  background: var(--surface2);
  border: 1px solid var(--border);
  transition: all .15s ease;
}
.pill.active.mp4 { color: #a5b4fc; border-color: rgba(108,99,255,.5); background: rgba(108,99,255,.12); }
.pill.active.mp3 { color: #6ee7b7; border-color: rgba(16,185,129,.5); background: rgba(16,185,129,.12); }

/* ── URL form ─────────────────────────── */
.urlrow { display: flex; gap: 10px; }
.urlrow input {
  flex: 1; min-width: 0;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  color: var(--text); font-size: .95rem;
  outline: none; transition: border-color .15s ease;
}
.urlrow input:focus { border-color: var(--border-hov); }
.urlrow input::placeholder { color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px; border: none; border-radius: 10px;
  font-weight: 700; font-size: .95rem; cursor: pointer;
  color: #fff; background: var(--grad);
  transition: filter .15s ease, transform .05s ease;
  text-decoration: none;
}
.btn:hover:not(:disabled) { filter: brightness(1.12); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.green { background: var(--grad-mp3); }

/* ── Status / meta line ───────────────── */
.meta {
  display: flex; justify-content: space-between; align-items: center;
  color: var(--muted); font-size: .85rem; margin-top: 14px;
  flex-wrap: wrap; gap: 8px;
}
.meta b { color: var(--dim); }
.help-link { color: var(--muted); text-decoration: none; }
.help-link:hover { color: var(--dim); text-decoration: underline; }

/* ── Video info ───────────────────────── */
.info { display: none; margin-top: 4px; }
.info.show { display: block; }
.vinfo { display: flex; gap: 14px; }
.vinfo img {
  width: 200px; aspect-ratio: 16/9; object-fit: cover;
  border-radius: 10px; border: 1px solid var(--border);
  flex-shrink: 0;
}
.vinfo .txt { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.vinfo .vtitle { font-weight: 700; font-size: 1.02rem; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.vinfo .vdur { color: var(--muted); font-size: .88rem; }

/* ── Format table ──────────────────────── */
.formats { margin-top: 18px; }
.formats.hidden { display: none; }
.ftable { width: 100%; border-collapse: collapse; }
.ftable td { padding: 11px 10px; border-top: 1px solid var(--border); font-size: .92rem; }
.ftable tr.frow { cursor: pointer; transition: background .12s ease; }
.ftable tr.frow:hover td { background: rgba(108,99,255,.07); }
.ftable tr.frow.sel td { background: rgba(108,99,255,.13); }
.ftable tr.frow.sel .res-label { color: #a5b4fc; }
.ftable tr.frow.disabled { opacity: .42; cursor: not-allowed; }
.ftable tr.frow.disabled:hover td { background: none !important; }
input[type=radio] { accent-color: var(--accent); width: 15px; height: 15px; cursor: pointer; }
.res-label { font-weight: 700; }
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 5px;
  font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  color: #fbbf24; background: rgba(245,158,11,.18);
}
.size-cell { color: var(--dim); font-size: .85rem; }

/* ── Action row ───────────────────────── */
.actionrow { margin-top: 18px; display: flex; gap: 10px; }
.actionrow .btn { flex: 1; }

/* ── Progress ─────────────────────────── */
.progress { display: none; }
.progress.show { display: block; }
.ptop { display: flex; justify-content: space-between; font-size: .9rem; margin-bottom: 10px; gap: 10px; }
.plabel { color: var(--dim); font-weight: 600; }
.ppct { font-weight: 800; white-space: nowrap; }
.barwrap {
  height: 10px; border-radius: 999px;
  background: var(--surface2); overflow: hidden;
}
.bar {
  height: 100%; width: 0%;
  background: var(--grad); border-radius: 999px;
  transition: width .25s ease;
}
.bar.indet {
  width: 34%;
  animation: slide 1.1s ease-in-out infinite;
}
@keyframes slide {
  0%   { margin-left: -34%; }
  100% { margin-left: 100%; }
}

/* ── Done ─────────────────────────────── */
.done { display: none; text-align: center; }
.done.show { display: block; }
.done .tick {
  width: 54px; height: 54px; margin: 4px auto 14px; border-radius: 50%;
  background: rgba(16,185,129,.14); border: 1px solid rgba(16,185,129,.4);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem; color: var(--success);
}
.done .fname { font-weight: 700; word-break: break-all; }
.done .fsize { color: var(--muted); font-size: .88rem; margin-top: 4px; }
.done a.btn { margin-top: 18px; background: var(--grad-mp3); }
.done .hint { color: var(--muted); font-size: .8rem; margin-top: 12px; }
.done .hint a { color: var(--dim); }

/* ── Error banner ──────────────────────── */
.errbox {
  display: none;
  margin-top: 18px;
  background: rgba(239,68,68,.09);
  border: 1px solid rgba(239,68,68,.35);
  color: #fca5a5;
  padding: 12px 14px; border-radius: 10px; font-size: .9rem;
  word-break: break-word;
}
.errbox.show { display: block; }

/* ── Article content ───────────────────── */
.content { margin-top: 26px; }
.content h2 { font-size: 1.22rem; font-weight: 700; margin: 28px 0 10px; letter-spacing: -.01em; line-height: 1.35; }
.content h3 { font-size: 1.05rem; font-weight: 700; margin: 20px 0 8px; }
.content p { color: var(--dim); line-height: 1.65; margin-bottom: 12px; font-size: .95rem; }
.content a { color: #a5b4fc; text-decoration: underline; }
.content a:hover { color: #c7d2fe; }
.content ol, .content ul { color: var(--dim); line-height: 1.65; margin: 0 0 14px 22px; font-size: .95rem; }
.content li { margin-bottom: 6px; }
.content strong { color: var(--text); font-weight: 600; }
.content table { width: 100%; border-collapse: collapse; margin: 14px 0 18px; font-size: .9rem; }
.content th, .content td { padding: 10px 12px; border: 1px solid var(--border); text-align: left; color: var(--dim); vertical-align: top; line-height: 1.5; }
.content th { color: var(--text); background: var(--surface2); font-weight: 700; }

/* ── Footer ────────────────────────────── */
.foot {
  text-align: center; color: var(--muted); font-size: .8rem;
  margin-top: 34px; line-height: 1.7;
}
.footnav { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-bottom: 14px; }
.footnav a { color: var(--dim); text-decoration: none; }
.footnav a:hover { color: var(--text); }
.foot b { color: var(--dim); }
.foot .disclaimer { margin-top: 4px; }

.spinner {
  display: inline-block; width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,.25); border-top-color: #fff;
  border-radius: 50%; animation: spin .8s linear infinite;
  vertical-align: -2px; margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 560px) {
  .shell { padding: 26px 14px 60px; }
  .hero h1 { font-size: 1.5rem; }
  .urlrow { flex-direction: column; }
  .vinfo { flex-direction: column; }
  .vinfo img { width: 100%; }
}
