:root {
  --bg: #f6f6f5;
  --card: #ffffff;
  --fg: #141414;
  --muted: #74746f;
  --faint: #a3a39e;
  --border: #e7e7e4;
  --soft: #f1f1ef;
  --accent: #141414;
  --accent-fg: #ffffff;
  --ok: #1f9d55;
  --err: #d93a3a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 8px 24px rgba(0, 0, 0, .06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e0e0f;
    --card: #17171a;
    --fg: #ededec;
    --muted: #9a9a96;
    --faint: #66666a;
    --border: #2a2a2e;
    --soft: #212125;
    --accent: #ededec;
    --accent-fg: #111111;
    --ok: #3ccf7c;
    --err: #ff6b6b;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 32px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.card {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 28px;
}
.card > section > * + * { margin-top: 20px; }
.card > section > .badge + * { margin-top: 16px; }
h1 + p { margin-top: 4px; }

.foot {
  margin-top: 16px;
  font-size: 13px;
  color: var(--faint);
  display: flex;
  gap: 12px;
  align-items: center;
}
.foot a { color: inherit; text-decoration: none; }
.foot a:hover { color: var(--muted); }

h1 { font-size: 17px; font-weight: 600; margin: 0; letter-spacing: -.01em; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.num { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }

/* Icon badge */
.badge {
  width: 44px; height: 44px; border-radius: 12px;
  display: grid; place-items: center;
  background: var(--soft); color: var(--fg);
}
.badge svg { width: 22px; height: 22px; }
.badge.ok { color: var(--ok); }
.badge.err { color: var(--err); }
.center .badge { margin: 0 auto; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; height: 42px; padding: 0 16px;
  font: inherit; font-weight: 550; letter-spacing: -.005em;
  border-radius: 10px; border: 1px solid transparent; cursor: pointer;
  background: var(--accent); color: var(--accent-fg);
  transition: opacity .15s, background .15s, transform .05s;
}
.btn:hover { opacity: .88; }
.btn:active { transform: scale(.99); }
.btn:disabled { opacity: .45; cursor: default; transform: none; }
.btn.ghost { background: transparent; color: var(--fg); border-color: var(--border); }
.btn.ghost:hover { background: var(--soft); opacity: 1; }
.btn svg { width: 16px; height: 16px; }
.btn:focus-visible, .drop:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Drop zone */
.drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  min-height: 220px; padding: 24px;
  border: 1.5px dashed var(--border); border-radius: 12px;
  background: var(--soft);
  text-align: center; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.drop:hover { border-color: var(--faint); }
body.dragging .drop { border-color: var(--accent); border-style: solid; }
.drop .badge { background: var(--card); box-shadow: var(--shadow); }
.drop strong { font-weight: 600; }
.drop u { text-underline-offset: 3px; text-decoration-color: var(--faint); }

/* File row */
.file {
  display: flex; align-items: center; gap: 12px;
  padding: 12px; border-radius: 12px; background: var(--soft);
}
.file .badge { width: 40px; height: 40px; background: var(--card); flex: none; }
.file .meta { min-width: 0; flex: 1; }
.file .name { font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file .size { font-size: 13px; color: var(--muted); }

/* Progress */
.bar { height: 6px; border-radius: 99px; background: var(--soft); overflow: hidden; }
.bar > div { height: 100%; width: 0; background: var(--accent); border-radius: inherit; transition: width .2s linear; }
.stats { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-top: 8px; }

/* Link field */
.link {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 5px 5px 12px; border: 1px solid var(--border); border-radius: 10px;
}
.link input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--fg);
  font: 13px ui-monospace, "SF Mono", Menlo, monospace; text-overflow: ellipsis;
}
.link .btn { width: auto; height: 32px; padding: 0 12px; font-size: 13px; border-radius: 7px; }

.note { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: var(--muted); }
.note svg { width: 14px; height: 14px; flex: none; margin-top: 3px; }
.err-text { color: var(--err); font-size: 13px; }

.spin { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.fade { animation: fade .2s ease-out; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } }

.stack > * + * { margin-top: 10px; }
.input {
  width: 100%; height: 42px; padding: 0 12px;
  font: inherit; color: var(--fg); background: var(--card);
  border: 1px solid var(--border); border-radius: 10px; outline: 0;
  transition: border-color .15s, box-shadow .15s;
}
.input::placeholder { color: var(--faint); }
.input:focus { border-color: var(--faint); box-shadow: 0 0 0 3px var(--soft); }

.oneline { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.otp {
  height: 52px; text-align: center; font: 600 24px ui-monospace, "SF Mono", Menlo, monospace;
  letter-spacing: .4em; padding-left: .4em;
}
.otp::placeholder { color: var(--border); }
.row-links { display: flex; justify-content: space-between; gap: 12px; }
.row-links a { color: var(--muted); text-decoration: none; }
.row-links a:hover { color: var(--fg); }
.row-links a.disabled { color: var(--faint); pointer-events: none; }

/* File list */
.files { margin-top: 28px !important; }
.files-head {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--faint);
  padding-bottom: 8px;
}
.files ul { list-style: none; margin: 0; padding: 0; }
.frow {
  display: flex; align-items: center; gap: 12px; padding: 10px 0;
  border-top: 1px solid var(--border); transition: opacity .18s, transform .18s;
}
.frow.removing { opacity: 0; transform: translateX(8px); }
.frow .badge.sm { width: 36px; height: 36px; border-radius: 10px; flex: none; }
.frow .badge.sm svg { width: 18px; height: 18px; }
.frow .meta { min-width: 0; flex: 1; }
.frow .name { font-weight: 550; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.frow .name.unknown { color: var(--muted); font-weight: 500; }
.frow .size { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn {
  flex: none; height: 32px; min-width: 32px; padding: 0 8px; display: grid; place-items: center;
  border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer;
  font: inherit; font-size: 13px; font-weight: 600; transition: background .15s, color .15s;
}
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn:hover { background: var(--soft); color: var(--fg); }
.icon-btn.ok { color: var(--ok); }
.icon-btn.danger:hover { color: var(--err); }
.icon-btn.danger.armed { background: var(--err); color: #fff; }
.icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.note a { color: var(--fg); text-underline-offset: 3px; }
