:root {
  --bg: #0e0f13;
  --panel: #171920;
  --panel2: #1f222b;
  --line: #2a2e39;
  --text: #e9eaf0;
  --muted: #9097a7;
  --accent: #7c5cff;
  --accent2: #9b83ff;
  --ok: #38c793;
  --err: #ff6b6b;
  --radius: 14px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 32px 20px 60px; }
.center { text-align: center; padding-top: 18vh; }
h1 { font-size: 26px; margin: 0 0 4px; word-break: break-word; }
.muted { color: var(--muted); }
footer { margin-top: 48px; font-size: 13px; text-align: center; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel2); color: var(--text); font: inherit; font-weight: 600;
  text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent2); }
.btn:disabled { opacity: .5; cursor: default; }

input, select {
  font: inherit; color: var(--text); background: var(--panel2);
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---------- share page ---------- */
.space-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 18px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.card .preview { background: #000; aspect-ratio: 16 / 9; display: flex; align-items: center; justify-content: center; }
.card.audio .preview { aspect-ratio: auto; padding: 28px 14px; background: var(--panel2); }
.card video, .card img { width: 100%; height: 100%; object-fit: contain; display: block; }
.card audio { width: 100%; }
.card .preview a { display: block; width: 100%; height: 100%; }
.noprev { font-weight: 800; font-size: 28px; color: var(--muted); letter-spacing: 2px; }
.card .meta { padding: 12px 14px 4px; flex: 1; }
.card .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .size { color: var(--muted); font-size: 13px; }
.card > .btn { margin: 10px 14px 14px; }
.empty { padding: 40px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); }
#dlstatus { margin: -10px 0 18px; }

/* ---------- upload page ---------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.login { max-width: 380px; margin: 14vh auto 0; }
.login form { display: flex; gap: 8px; margin-top: 14px; }
.login input { flex: 1; min-width: 0; }
.error { color: var(--err); min-height: 1.5em; margin: 8px 0 0; }
.drop {
  border: 2px dashed var(--line); border-radius: var(--radius); padding: 46px 20px; text-align: center;
  cursor: pointer; transition: border-color .15s, background .15s;
}
.drop.over, .drop:hover { border-color: var(--accent); background: rgba(124, 92, 255, .06); }
.drop strong { font-size: 18px; display: block; margin-bottom: 4px; }
.opts { display: flex; gap: 10px; flex-wrap: wrap; margin: 16px 0; align-items: center; }
.opts input { flex: 1; min-width: 200px; }
.files { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 8px; }
.file { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.file .row { display: flex; justify-content: space-between; gap: 12px; }
.file .fname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.file .stat { color: var(--muted); font-size: 13px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.file .x { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 18px; line-height: 1; padding: 0 2px; }
.bar { height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.bar > div { height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.file.done .bar > div { background: var(--ok); }
.file.failed .bar > div { background: var(--err); }
.file.failed .stat { color: var(--err); }
.result { margin-top: 18px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.result input { flex: 1; min-width: 240px; font-family: ui-monospace, Consolas, monospace; font-size: 14px; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.linkbtn { background: none; border: 0; color: var(--muted); cursor: pointer; font: inherit; text-decoration: underline; }
