/* ===========================================================================
   VlyzerBox — styles
   Theming is driven by the data-theme attribute on <html> (set before paint
   by an inline script, toggled at runtime). Light is the default.
   =========================================================================== */

:root,
:root[data-theme='light'] {
  --bg: #f4f6fb;
  --bg-soft: #ffffff;
  --card: #ffffff;
  --ink: #0f172a;
  --ink-soft: #475569;
  --ink-faint: #94a3b8;
  --line: #e2e8f0;
  --line-soft: #eef2f7;
  --accent: #0ea5e9;
  --accent-2: #2dd4bf;
  --accent-ink: #0c7ca8;
  --danger: #e11d48;
  --danger-bg: #fff1f3;
  --ok: #10b981;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 18px 40px -22px rgba(15, 23, 42, .22);
  --orb-1: .5;
  --orb-2: .35;
}

:root[data-theme='dark'] {
  --bg: #070b16;
  --bg-soft: #0c1426;
  --card: #0e1729;
  --ink: #e9eef7;
  --ink-soft: #9fb0c9;
  --ink-faint: #64769180;
  --ink-faint: #66789680;
  --line: #1d2840;
  --line-soft: #16203492;
  --accent: #38bdf8;
  --accent-2: #2dd4bf;
  --accent-ink: #7dd3fc;
  --danger: #fb7185;
  --danger-bg: #2a1119;
  --ok: #34d399;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 24px 50px -28px rgba(0, 0, 0, .8);
  --orb-1: .22;
  --orb-2: .18;
}

:root {
  --radius: 18px;
  --radius-sm: 12px;
}

* { box-sizing: border-box; }
/* The [hidden] attribute must always win over class-level display rules. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background .25s ease, color .25s ease;
}

/* Ambient background orbs */
.bg-orbs { position: fixed; inset: 0; overflow: hidden; z-index: -1; pointer-events: none; }
.bg-orbs span {
  position: absolute;
  width: 46vw; height: 46vw;
  max-width: 620px; max-height: 620px;
  border-radius: 50%;
  filter: blur(90px);
}
.bg-orbs span:nth-child(1) {
  top: -16%; right: -8%;
  background: radial-gradient(circle, var(--accent-2), transparent 68%);
  opacity: var(--orb-1);
}
.bg-orbs span:nth-child(2) {
  bottom: -22%; left: -10%;
  background: radial-gradient(circle, var(--accent), transparent 68%);
  opacity: var(--orb-2);
}

/* Header */
.site-header {
  max-width: 860px;
  margin: 0 auto;
  padding: 24px 22px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand-mark { display: block; border-radius: 9px; }
.brand-name {
  font-family: "Space Grotesk", "Inter", sans-serif;
  font-weight: 600;
  font-size: 1.12rem;
  letter-spacing: -.01em;
}
.brand-name strong { color: var(--accent); font-weight: 700; }

.header-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  display: grid; place-items: center;
  width: 38px; height: 38px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--ink-soft);
  cursor: pointer;
  transition: .16s;
}
.icon-btn:hover { color: var(--accent); border-color: var(--accent); }
.icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* theme toggle: show the icon for the action you'll switch TO */
.icon-sun { display: none; }
:root[data-theme='dark'] .icon-sun { display: block; }
:root[data-theme='dark'] .icon-moon { display: none; }

.project-link {
  font-size: .85rem;
  font-weight: 600;
  color: var(--ink-soft);
  text-decoration: none;
  border: 1px solid var(--line);
  padding: 8px 14px;
  border-radius: 999px;
  transition: .16s;
  white-space: nowrap;
}
.project-link:hover { color: var(--accent); border-color: var(--accent); }

/* Layout */
.wrap { max-width: 720px; margin: 0 auto; padding: 0 22px 64px; }

/* Hero */
.hero { text-align: center; padding: 64px 0 38px; }
.hero-title {
  font-family: "Space Grotesk", "Inter", sans-serif;
  font-weight: 700;
  font-size: clamp(3rem, 12vw, 5.5rem);
  line-height: .98;
  letter-spacing: -.03em;
  margin: 0 0 18px;
}
.hero-title span { color: var(--accent); }
.hero-sub {
  color: var(--ink-soft);
  max-width: 46ch;
  margin: 0 auto;
  font-size: 1.04rem;
}
.hero-sub strong { color: var(--ink); font-weight: 600; }

/* Dropzone */
.dropzone {
  position: relative;
  background: var(--card);
  border: 1.5px dashed var(--line);
  border-radius: var(--radius);
  padding: 46px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color .18s, background .18s, transform .18s;
  box-shadow: var(--shadow);
  outline: none;
}
.dropzone:hover, .dropzone:focus-visible { border-color: var(--accent); transform: translateY(-2px); }
.dropzone.drag { border-color: var(--accent); border-style: solid; background: color-mix(in srgb, var(--accent) 7%, var(--card)); }
.dropzone.busy { cursor: not-allowed; border-style: solid; }
.dropzone.busy .dz-inner { opacity: .32; filter: grayscale(.4); pointer-events: none; }

.dz-icon {
  width: 64px; height: 64px;
  margin: 0 auto 16px;
  display: grid; place-items: center;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  box-shadow: 0 10px 26px -10px var(--accent);
}
.dz-title { font-size: 1.14rem; font-weight: 600; margin: 0 0 4px; }
.dz-sub { color: var(--ink-soft); margin: 0 0 16px; }
.dz-link { color: var(--accent); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.dz-hint {
  display: inline-block;
  font-size: .8rem;
  color: var(--ink-faint);
  background: var(--bg);
  border: 1px solid var(--line);
  padding: 5px 12px;
  border-radius: 999px;
  margin: 0;
}
.dz-busy {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center; gap: 12px;
  font-weight: 600; color: var(--ink-soft);
  padding: 0 20px; text-align: center;
}
.spinner {
  width: 20px; height: 20px;
  border: 2.5px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex: none;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Alert */
.alert {
  margin-top: 18px;
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  font-size: .92rem;
  font-weight: 500;
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid color-mix(in srgb, var(--danger) 28%, transparent);
  display: flex; gap: 9px; align-items: flex-start;
}
.alert::before { content: "⚠"; }

/* Upload list */
.list { margin-top: 26px; display: flex; flex-direction: column; gap: 14px; }
.item {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  animation: rise .35s ease both;
}
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.item-top { display: flex; align-items: center; gap: 13px; }
.thumb {
  width: 46px; height: 46px; flex: none;
  border-radius: 11px;
  background: var(--bg);
  border: 1px solid var(--line);
  display: grid; place-items: center;
  overflow: hidden;
  color: var(--ink-faint);
  font-size: .62rem; font-weight: 700; letter-spacing: .03em;
  text-transform: uppercase;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.item-meta { flex: 1; min-width: 0; }
.item-name { margin: 0; font-weight: 600; font-size: .96rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-size { margin: 2px 0 0; font-size: .82rem; color: var(--ink-faint); }
.item-status { flex: none; width: 26px; height: 26px; display: grid; place-items: center; }
.item-status svg { width: 22px; height: 22px; }

/* Progress */
.progress { margin-top: 13px; height: 8px; border-radius: 999px; background: var(--line-soft); overflow: hidden; }
.bar {
  height: 100%; width: 0; border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  transition: width .25s cubic-bezier(.4, 0, .2, 1);
}
.bar.shimmer { background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.progress-meta {
  display: flex; justify-content: space-between;
  font-size: .8rem; color: var(--ink-faint);
  margin-top: 7px; font-variant-numeric: tabular-nums;
}
.item.done .progress, .item.done .progress-meta,
.item.error .progress, .item.error .progress-meta { display: none; }

/* Result — one link + one action button */
.item-result { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.link-row { display: flex; align-items: center; gap: 8px; }
.link-input {
  flex: 1; min-width: 0;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: .82rem;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--ink);
}
.link-input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.copy-btn {
  flex: none;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--ink);
  font-weight: 600; font-size: .82rem;
  padding: 10px 16px;
  border-radius: 10px;
  cursor: pointer;
  transition: .15s;
}
.copy-btn:hover { border-color: var(--accent); color: var(--accent); }
.copy-btn.copied { background: var(--ok); border-color: var(--ok); color: #fff; }

.result-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%;
  padding: 11px 16px;
  border-radius: 10px;
  font-weight: 600; font-size: .9rem;
  text-decoration: none;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  color: #fff;
  border: none;
  transition: filter .15s, transform .15s;
}
.result-btn:hover { filter: brightness(1.05); transform: translateY(-1px); }
.result-btn.secondary {
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--line);
}
.result-btn.secondary:hover { border-color: var(--accent); color: var(--accent); }

.item-error { margin: 12px 0 0; color: var(--danger); font-weight: 500; font-size: .9rem; }
.item.done { border-color: color-mix(in srgb, var(--ok) 40%, var(--line)); }
.item.error { border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); }

/* Footer */
.site-footer {
  text-align: center;
  color: var(--ink-faint);
  font-size: .82rem;
  padding: 8px 22px 40px;
  display: flex; gap: 9px; justify-content: center; flex-wrap: wrap;
}
.site-footer .dot { opacity: .5; }

/* Settings modal */
.overlay {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(8, 12, 22, .55);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: fade .18s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: 100%; max-width: 420px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  animation: rise .22s ease both;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.modal-head h2 { margin: 0; font-size: 1.15rem; font-family: "Space Grotesk", "Inter", sans-serif; }
.setting-block { padding: 16px 0; border-top: 1px solid var(--line-soft); }
.setting-block:first-of-type { border-top: none; }
.setting-label { margin: 0 0 2px; font-weight: 600; font-size: .95rem; }
.setting-desc { margin: 0 0 12px; font-size: .82rem; color: var(--ink-faint); }

.seg-group {
  display: flex; gap: 6px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 5px;
}
.seg {
  flex: 1;
  padding: 9px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-soft);
  font-weight: 600; font-size: .86rem;
  cursor: pointer;
  transition: .15s;
}
.seg:hover { color: var(--ink); }
.seg.active {
  background: var(--card);
  color: var(--accent);
  box-shadow: 0 1px 3px rgba(15, 23, 42, .12);
}

/* Responsive */
@media (max-width: 560px) {
  .project-link { display: none; }
  .dropzone { padding: 38px 18px; }
  .link-row { flex-wrap: wrap; }
  .link-input { flex-basis: 100%; }
  .copy-btn { flex: 1; }
}
