/* FastDownload — shared design system */
:root {
  color-scheme: dark;
  --bg: #070b16;
  --bg-2: #0b1224;
  --surface: rgba(255, 255, 255, .045);
  --surface-2: rgba(255, 255, 255, .08);
  --surface-solid: #0f1729;
  --line: rgba(255, 255, 255, .09);
  --line-strong: rgba(255, 255, 255, .18);
  --text: #e9edf8;
  --text-2: #a7b1cc;
  --text-3: #76829f;
  --accent: #22d3ee;
  --accent-text: #67e8f9;
  --ok: #34d399;
  --warn: #fbbf24;
  --bad: #fb7185;
  --shadow: 0 24px 60px -24px rgba(0, 0, 0, .7);
  --glow-1: rgba(34, 211, 238, .20);
  --glow-2: rgba(139, 92, 246, .22);
  --glow-3: rgba(244, 114, 182, .12);
  --head-grad: linear-gradient(90deg, #67e8f9, #a5b4fc 55%, #d8b4fe);
  --btn-grad: linear-gradient(135deg, #0891b2 0%, #4f46e5 55%, #7c3aed 100%);
  --btn-glow: 0 10px 30px -10px rgba(99, 102, 241, .75);
  --r: 20px;
  --bot-1: #089ac3; --bot-2: #b68103; --bot-3: #9572e7; --bot-4: #01a760; --bot-5: #707ff1;
  --bot-6: #d96604; --bot-7: #388cf0; --bot-8: #e15a4e; --bot-x: #8a96b4;
  --k-video: #a78bfa; --k-audio: #f472b6; --k-image: #34d399; --k-archive: #fbbf24; --k-doc: #60a5fa; --k-file: #a7b1cc;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Sinhala", "Iskoola Pota", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #f3f5fb; --bg-2: #e9edf8;
    --surface: rgba(255, 255, 255, .72); --surface-2: rgba(255, 255, 255, .95); --surface-solid: #ffffff;
    --line: rgba(20, 30, 70, .10); --line-strong: rgba(20, 30, 70, .22);
    --text: #121a33; --text-2: #4a5677; --text-3: #6d7898;
    --accent: #0891b2; --accent-text: #0e7490;
    --ok: #059669; --warn: #b45309; --bad: #e11d48;
    --shadow: 0 24px 50px -28px rgba(30, 41, 90, .35);
    --glow-1: rgba(34, 211, 238, .30); --glow-2: rgba(139, 92, 246, .22); --glow-3: rgba(244, 114, 182, .18);
    --head-grad: linear-gradient(90deg, #0e7490, #4f46e5 55%, #7c3aed);
    --bot-1: #0081a3; --bot-2: #986b00; --bot-3: #7e5acc; --bot-4: #028b4f; --bot-5: #5a66d6;
    --bot-6: #b65400; --bot-7: #1a73d5; --bot-8: #c44037; --bot-x: #6d7898;
    --k-video: #7c3aed; --k-audio: #db2777; --k-image: #059669; --k-archive: #b45309; --k-doc: #2563eb; --k-file: #4a5677;
  }
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f5fb; --bg-2: #e9edf8;
  --surface: rgba(255, 255, 255, .72); --surface-2: rgba(255, 255, 255, .95); --surface-solid: #ffffff;
  --line: rgba(20, 30, 70, .10); --line-strong: rgba(20, 30, 70, .22);
  --text: #121a33; --text-2: #4a5677; --text-3: #6d7898;
  --accent: #0891b2; --accent-text: #0e7490;
  --ok: #059669; --warn: #b45309; --bad: #e11d48;
  --shadow: 0 24px 50px -28px rgba(30, 41, 90, .35);
  --glow-1: rgba(34, 211, 238, .30); --glow-2: rgba(139, 92, 246, .22); --glow-3: rgba(244, 114, 182, .18);
  --head-grad: linear-gradient(90deg, #0e7490, #4f46e5 55%, #7c3aed);
  --bot-1: #0081a3; --bot-2: #986b00; --bot-3: #7e5acc; --bot-4: #028b4f; --bot-5: #5a66d6;
  --bot-6: #b65400; --bot-7: #1a73d5; --bot-8: #c44037; --bot-x: #6d7898;
  --k-video: #7c3aed; --k-audio: #db2777; --k-image: #059669; --k-archive: #b45309; --k-doc: #2563eb; --k-file: #4a5677;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--text);
  font: 15px/1.55 var(--font); -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
h1, h2, h3, p { margin: 0; }
button, input { font: inherit; color: inherit; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
svg.ic { width: 1.15em; height: 1.15em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }

/* background */
.aurora { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none;
  background: radial-gradient(1200px 700px at 50% -10%, var(--bg-2), var(--bg)); }
.aurora i { position: absolute; border-radius: 50%; filter: blur(90px); opacity: .9; animation: drift 26s ease-in-out infinite alternate; }
.aurora i:nth-child(1) { width: 520px; height: 520px; left: -120px; top: -140px; background: var(--glow-1); }
.aurora i:nth-child(2) { width: 560px; height: 560px; right: -160px; top: 80px; background: var(--glow-2); animation-duration: 32s; animation-delay: -8s; }
.aurora i:nth-child(3) { width: 420px; height: 420px; left: 30%; bottom: -200px; background: var(--glow-3); animation-duration: 38s; animation-delay: -14s; }
@keyframes drift { to { transform: translate3d(60px, 40px, 0) scale(1.12); } }
@media (prefers-reduced-motion: reduce) { .aurora i { animation: none; } * { scroll-behavior: auto !important; } }

/* layout */
.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.nav { position: sticky; top: 0; z-index: 20; backdrop-filter: blur(16px) saturate(140%); -webkit-backdrop-filter: blur(16px) saturate(140%);
  background: color-mix(in srgb, var(--bg) 62%, transparent); border-bottom: 1px solid var(--line); }
.nav .wrap { display: flex; align-items: center; gap: 12px; height: 62px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -.01em; font-size: 17px; color: var(--text); }
.brand:hover { text-decoration: none; }
.logo { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; color: #fff; background: var(--btn-grad); box-shadow: var(--btn-glow); }
.logo svg { width: 18px; height: 18px; }
.spacer { flex: 1; }
.nav-links { display: flex; align-items: center; gap: 6px; }

/* surfaces */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }
.card.pad { padding: 22px; }
.card h2 { font-size: 16px; font-weight: 650; letter-spacing: -.01em; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 18px; border-radius: 12px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); font-weight: 600; cursor: pointer;
  transition: transform .15s ease, background .15s ease, border-color .15s ease, box-shadow .15s ease; white-space: nowrap; text-decoration: none; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:active { transform: translateY(1px) scale(.99); }
.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; }
.btn.primary { border-color: transparent; background: var(--btn-grad); color: #fff; box-shadow: var(--btn-glow); }
.btn.primary:hover { filter: brightness(1.1); box-shadow: 0 14px 34px -10px rgba(99, 102, 241, .9); }
.btn.big { height: 52px; padding: 0 28px; font-size: 16px; border-radius: 14px; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface); color: var(--text); }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.btn.danger:hover { background: color-mix(in srgb, var(--bad) 14%, transparent); }
.btn.sm { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn.icon { width: 38px; padding: 0; }
.btn.sm.icon { width: 34px; }
.spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .35); border-top-color: #fff; animation: rot .7s linear infinite; }
@keyframes rot { to { transform: rotate(360deg); } }

/* inputs */
.field { display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 8px 0 16px; border-radius: 14px; border: 1px solid var(--line-strong);
  background: color-mix(in srgb, var(--surface-solid) 70%, transparent); transition: border-color .15s, box-shadow .15s; }
.field:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent); }
.field input { flex: 1; min-width: 0; height: 100%; background: none; border: 0; outline: 0; font-size: 15px; }
.field input::placeholder { color: var(--text-3); }
.field > svg { color: var(--text-3); }
label.lbl { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.field.compact { height: 44px; border-radius: 12px; }

/* chips / pills */
.chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 11px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--text-2); }
.chip.nowrap, .btn { white-space: nowrap; }
.chip.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, transparent); background: color-mix(in srgb, var(--ok) 10%, transparent); }
.chip.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 35%, transparent); background: color-mix(in srgb, var(--warn) 10%, transparent); }
.chip.bad { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, transparent); background: color-mix(in srgb, var(--bad) 10%, transparent); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); flex: none; }
.dot.ok { background: var(--ok); box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 60%, transparent); animation: pulse 2s infinite; }
.dot.warn { background: var(--warn); }
.dot.bad { background: var(--bad); }
@keyframes pulse { 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

/* toggle switch */
.switch { position: relative; width: 42px; height: 24px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; cursor: pointer; margin: 0; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line-strong); transition: .2s; }
.switch span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--text-2); transition: .2s; }
.switch input:checked + span { background: var(--ok); border-color: transparent; }
.switch input:checked + span::after { transform: translateX(18px); background: #fff; }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* toasts */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 100; display: flex; flex-direction: column; gap: 10px; max-width: calc(100vw - 32px); }
.toast { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border-radius: 14px; background: var(--surface-solid); border: 1px solid var(--line-strong);
  box-shadow: var(--shadow); font-size: 14px; max-width: 380px; animation: pop .25s ease; }
.toast.ok svg { color: var(--ok); } .toast.bad svg { color: var(--bad); }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.97); } }

/* skeleton */
.skel { border-radius: 10px; background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 50%, var(--surface) 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* modal */
.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 20px; background: rgba(3, 6, 14, .72); backdrop-filter: blur(6px); animation: fade .2s; }
.modal[hidden] { display: none; }
@keyframes fade { from { opacity: 0; } }
.modal .sheet { width: min(960px, 100%); max-height: 100%; background: var(--surface-solid); border: 1px solid var(--line-strong); border-radius: 18px; overflow: hidden; box-shadow: var(--shadow); }
.modal .sheet header { display: flex; align-items: center; gap: 10px; padding: 12px 14px 12px 18px; border-bottom: 1px solid var(--line); font-weight: 600; }
.modal .sheet header span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal video, .modal audio, .modal img { display: block; width: 100%; max-height: 74vh; background: #000; object-fit: contain; }
.modal audio { background: transparent; padding: 24px; }

.hidden { display: none !important; }
@media (max-width: 560px) {
  .wrap { padding: 0 16px; }
  .nav .wrap { gap: 8px; }
  .nav .btn.sm:not(.icon) { padding: 0 11px; }
  .hide-sm { display: none !important; }
  .nav .wrap { height: 58px; }
}
