:root {
  --bg: #07080c;
  --bg-2: #0d0f16;
  --panel: rgba(255, 255, 255, 0.035);
  --panel-solid: #11131b;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #eef0f6;
  --muted: #8b90a3;
  --faint: #5b6073;
  --accent: #5865f2;          /* Discord blurple */
  --accent-2: #8b5cf6;
  --accent-glow: rgba(88, 101, 242, 0.35);
  --danger: #f2555a;
  --ok: #3ddc97;
  --radius: 14px;
  --radius-lg: 22px;
  --font: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --display: 'Sora', 'Inter', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 1.5;
}
button, input { font: inherit; color: inherit; }
a { color: inherit; }

/* Ambient background */
.ambient {
  position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden;
}
.ambient::before, .ambient::after {
  content: ''; position: absolute; border-radius: 50%; filter: blur(110px); opacity: .55;
}
.ambient::before {
  width: 640px; height: 640px; left: -160px; top: -220px;
  background: radial-gradient(circle, var(--accent) 0%, transparent 65%);
  animation: drift 22s ease-in-out infinite alternate;
}
.ambient::after {
  width: 560px; height: 560px; right: -180px; bottom: -200px;
  background: radial-gradient(circle, var(--accent-2) 0%, transparent 65%);
  animation: drift 26s ease-in-out infinite alternate-reverse;
}
.grid-overlay {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
}
@keyframes drift { to { transform: translate(80px, 60px) scale(1.1); } }

/* Logo */
.logo { display: inline-flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 700; font-size: 19px; letter-spacing: -.02em; text-decoration: none; }
.logo-mark {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 6px 24px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,.25);
}
.logo-mark svg { width: 18px; height: 18px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  height: 44px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--border-strong);
  background: rgba(255,255,255,.04); cursor: pointer; font-weight: 600; font-size: 14px;
  transition: transform .15s ease, background .2s ease, border-color .2s ease, box-shadow .2s ease;
  text-decoration: none; white-space: nowrap;
}
.btn:hover { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.22); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--text); color: #0a0b10; border-color: transparent; }
.btn-primary:hover { background: #fff; }
.btn-discord {
  width: 100%; height: 54px; font-size: 15.5px; border: none; color: #fff;
  background: linear-gradient(180deg, #6773f6, var(--accent));
  box-shadow: 0 10px 34px -6px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,.22);
}
.btn-discord:hover { background: linear-gradient(180deg, #7480f7, #5d69f3); box-shadow: 0 14px 40px -6px rgba(88,101,242,.55), inset 0 1px 0 rgba(255,255,255,.25); }
.btn-discord svg { width: 24px; height: 24px; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: rgba(255,255,255,.06); border-color: transparent; }
.btn-icon { width: 36px; height: 36px; padding: 0; border-radius: 10px; border-color: transparent; background: transparent; color: var(--muted); }
.btn-icon:hover { color: var(--text); background: rgba(255,255,255,.07); border-color: transparent; }
.btn-icon.danger:hover { color: var(--danger); background: rgba(242,85,90,.1); }
.btn-icon svg { width: 18px; height: 18px; }

/* Inputs */
.field { display: grid; gap: 7px; }
.field label { font-size: 13px; color: var(--muted); font-weight: 500; }
.input {
  height: 46px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--border-strong);
  background: rgba(0,0,0,.25); outline: none; transition: border-color .2s, box-shadow .2s, background .2s;
}
.input::placeholder { color: var(--faint); }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(88,101,242,.18); background: rgba(0,0,0,.35); }

/* ---------- Login page ---------- */
.auth-wrap {
  position: relative; z-index: 1; min-height: 100vh; display: grid;
  grid-template-columns: 1.1fr 1fr;
}
.auth-hero {
  padding: 48px 56px; display: flex; flex-direction: column; justify-content: space-between;
  border-right: 1px solid var(--border);
}
.auth-hero h1 {
  font-family: var(--display); font-size: clamp(38px, 4.6vw, 64px); line-height: 1.02;
  letter-spacing: -.045em; margin: 0 0 20px; font-weight: 700;
}
.auth-hero h1 .grad {
  background: linear-gradient(100deg, #fff 0%, #aab2ff 45%, var(--accent-2) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.auth-hero p.lead { color: var(--muted); font-size: 17px; max-width: 460px; margin: 0; }
.feature-row { display: flex; gap: 28px; flex-wrap: wrap; color: var(--muted); font-size: 13.5px; }
.feature-row span { display: inline-flex; align-items: center; gap: 8px; }
.feature-row svg { width: 16px; height: 16px; color: var(--accent); }

.wave { display: flex; align-items: center; gap: 4px; height: 64px; margin: 40px 0 0; }
.wave i {
  display: block; width: 4px; border-radius: 4px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  animation: bounce 1.4s ease-in-out infinite; opacity: .8;
}
@keyframes bounce { 0%,100% { transform: scaleY(.35); } 50% { transform: scaleY(1); } }

.auth-panel { display: grid; place-items: center; padding: 40px 24px; }
.auth-card {
  width: 100%; max-width: 410px; padding: 34px; border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(255,255,255,.055), rgba(255,255,255,.02));
  border: 1px solid var(--border); backdrop-filter: blur(18px);
  box-shadow: 0 30px 80px -20px rgba(0,0,0,.6);
}
.auth-card h2 { font-family: var(--display); font-size: 24px; margin: 0 0 6px; letter-spacing: -.02em; }
.auth-card .sub { color: var(--muted); margin: 0 0 26px; font-size: 14px; }
.discord-note { color: var(--faint); font-size: 12.5px; text-align: center; margin: 10px 0 0; }
.divider { display: flex; align-items: center; gap: 14px; color: var(--faint); font-size: 12px; text-transform: uppercase; letter-spacing: .1em; margin: 24px 0; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

.email-toggle { width: 100%; }
.email-section { display: none; }
.email-section.open { display: block; animation: fadeUp .3s ease; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.tabs { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; border-radius: 12px; background: rgba(0,0,0,.3); border: 1px solid var(--border); margin-bottom: 18px; }
.tab { height: 36px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); cursor: pointer; font-weight: 600; font-size: 13.5px; transition: background .2s, color .2s; }
.tab.active { background: rgba(255,255,255,.09); color: var(--text); }
form.auth-form { display: grid; gap: 14px; }
form.auth-form .btn-primary { margin-top: 6px; height: 46px; }
.form-error { color: var(--danger); font-size: 13px; min-height: 18px; margin: 0; }

/* ---------- App ---------- */
.app { position: relative; z-index: 1; min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between;
  padding: 14px 32px; border-bottom: 1px solid var(--border);
  background: rgba(7,8,12,.7); backdrop-filter: blur(16px);
}
.user-chip { display: flex; align-items: center; gap: 12px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; object-fit: cover; border: 1px solid var(--border-strong);
  display: grid; place-items: center; font-weight: 700; font-size: 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.user-meta { line-height: 1.2; }
.user-meta strong { display: block; font-size: 14px; }
.user-meta small { color: var(--muted); font-size: 12px; display: inline-flex; align-items: center; gap: 5px; }
.user-meta small svg { width: 12px; height: 12px; }

.container { max-width: 1120px; margin: 0 auto; padding: 36px 32px 80px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 26px; flex-wrap: wrap; }
.page-head h1 { font-family: var(--display); font-size: 32px; letter-spacing: -.035em; margin: 0; }
.page-head p { margin: 4px 0 0; color: var(--muted); }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 22px; }
.stat {
  padding: 18px 20px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--border);
}
.stat .label { color: var(--muted); font-size: 12.5px; text-transform: uppercase; letter-spacing: .08em; }
.stat .value { font-family: var(--display); font-size: 26px; font-weight: 600; letter-spacing: -.02em; margin-top: 4px; }
.meter { height: 6px; border-radius: 6px; background: rgba(255,255,255,.07); margin-top: 12px; overflow: hidden; }
.meter > div { height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .5s ease; }

.dropzone {
  display: block; position: relative; border-radius: var(--radius-lg); padding: 42px 24px; text-align: center; cursor: pointer;
  border: 1.5px dashed var(--border-strong); background: var(--panel);
  transition: border-color .2s, background .2s, transform .2s;
  margin-bottom: 22px;
}
.dropzone:hover { border-color: rgba(255,255,255,.28); background: rgba(255,255,255,.05); }
.dropzone.drag { border-color: var(--accent); background: rgba(88,101,242,.09); transform: scale(1.005); }
.dz-icon {
  width: 56px; height: 56px; border-radius: 16px; margin: 0 auto 14px; display: grid; place-items: center;
  background: linear-gradient(135deg, rgba(88,101,242,.25), rgba(139,92,246,.2)); border: 1px solid rgba(88,101,242,.4);
}
.dz-icon svg { width: 26px; height: 26px; color: #c3c8ff; }
.dropzone h3 { margin: 0; font-size: 17px; font-weight: 600; }
.dropzone p { margin: 6px 0 0; color: var(--muted); font-size: 13.5px; }
.dropzone u { color: #aab2ff; text-decoration: none; font-weight: 600; }
.dropzone input { display: none; }

.queue { display: grid; gap: 8px; margin-bottom: 22px; }
.queue:empty { display: none; }
.q-item { display: grid; grid-template-columns: 1fr auto; gap: 6px 14px; align-items: center; padding: 12px 16px; border-radius: 12px; background: var(--panel); border: 1px solid var(--border); font-size: 13.5px; }
.q-item .q-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-item .q-pct { color: var(--muted); font-variant-numeric: tabular-nums; }
.q-item .meter { grid-column: 1 / -1; margin-top: 0; height: 4px; }
.q-item.done .meter > div { background: var(--ok); }
.q-item.error .meter > div { background: var(--danger); }
.q-item.error .q-pct { color: var(--danger); }

.panel { border-radius: var(--radius-lg); background: var(--panel); border: 1px solid var(--border); overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.panel-head h2 { font-size: 15px; margin: 0; font-weight: 600; }
.search { position: relative; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--faint); }
.search .input { height: 38px; padding-left: 36px; width: 260px; font-size: 14px; }

.file-list { list-style: none; margin: 0; padding: 6px; }
.file-row {
  display: grid; grid-template-columns: 44px 1fr 100px 120px 156px; align-items: center; gap: 14px;
  padding: 10px 12px; border-radius: 12px; transition: background .15s;
}
.file-row:hover { background: rgba(255,255,255,.04); }
.f-icon { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.f-icon svg { width: 19px; height: 19px; }
.f-icon.audio { background: rgba(88,101,242,.16); color: #a6adff; }
.f-icon.video { background: rgba(236,72,153,.14); color: #f9a8d4; }
.f-icon.image { background: rgba(61,220,151,.13); color: #86efc1; }
.f-icon.archive { background: rgba(245,158,11,.14); color: #fcd34d; }
.f-icon.doc { background: rgba(56,189,248,.13); color: #7dd3fc; }
.f-icon.other { background: rgba(255,255,255,.07); color: var(--muted); }
.f-name { min-width: 0; }
.f-name strong { display: block; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.f-name small { color: var(--faint); font-size: 12px; }
.f-size, .f-date { color: var(--muted); font-size: 13.5px; font-variant-numeric: tabular-nums; }
.f-actions { display: flex; gap: 2px; justify-content: flex-end; }
.file-row audio { grid-column: 2 / -1; width: 100%; height: 36px; margin-top: 4px; }
.file-row .thumb { grid-column: 2 / -1; max-width: 100%; max-height: 320px; border-radius: 10px; margin-top: 4px; }

.empty { padding: 56px 20px; text-align: center; color: var(--muted); }
.empty svg { width: 40px; height: 40px; color: var(--faint); margin-bottom: 10px; }
.empty strong { display: block; color: var(--text); font-size: 15px; margin-bottom: 4px; }

.toast-stack { position: fixed; bottom: 22px; right: 22px; z-index: 50; display: grid; gap: 10px; }
.toast {
  padding: 12px 16px; border-radius: 12px; background: var(--panel-solid); border: 1px solid var(--border-strong);
  box-shadow: 0 20px 50px -10px rgba(0,0,0,.6); font-size: 14px; max-width: 340px; animation: fadeUp .25s ease;
}
.toast.error { border-color: rgba(242,85,90,.5); }
.toast.ok { border-color: rgba(61,220,151,.45); }

.spinner { width: 18px; height: 18px; border: 2px solid rgba(255,255,255,.25); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Responsive */
@media (max-width: 920px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-hero { border-right: 0; border-bottom: 1px solid var(--border); padding: 32px 24px; }
  .auth-hero .wave, .feature-row { display: none; }
  .auth-hero h1 { font-size: 38px; margin-top: 28px; }
}
@media (max-width: 760px) {
  .topbar { padding: 12px 16px; }
  .container { padding: 24px 16px 60px; }
  .stats { grid-template-columns: 1fr; }
  .search .input { width: 100%; }
  .search { flex: 1; }
  .file-row { grid-template-columns: 40px 1fr auto; gap: 10px; }
  .f-size, .f-date { display: none; }
  .user-meta { display: none; }
}
