:root {
  color-scheme: dark;
  --bg: #0b0b0e;
  --card: #16161c;
  --line: rgba(255, 255, 255, 0.08);
  --text: #f4f4f5;
  --muted: #a1a1aa;
  --dim: #71717a;
  --accent: #f59e0b;
  --accent-ink: #1a1200;
  --ok: #22c55e;
  --bad: #ef4444;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 -apple-system, "Segoe UI", Roboto, "Helvetica Neue", system-ui, sans-serif;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
           max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  overscroll-behavior: none;
}

header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 4px 20px;
}
header .logo { width: 28px; height: 28px; }
header h1 { font-size: 18px; margin: 0; font-weight: 600; letter-spacing: 0.01em; }
header .spacer { flex: 1; }
header button { font-size: 13px; padding: 8px 12px; min-height: 36px; background: transparent; color: var(--dim); border: 0; }

main { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 16px; max-width: 520px; width: 100%; margin: 0 auto; }

.screen { display: none; flex-direction: column; gap: 16px; }
.screen.active { display: flex; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
}

h2 { margin: 0 0 4px; font-size: 22px; font-weight: 600; }
p { margin: 0; color: var(--muted); }
.muted { color: var(--dim); font-size: 14px; }
.error { color: var(--bad); font-size: 14px; min-height: 1.4em; }

button, .btn {
  appearance: none;
  border: 0;
  border-radius: 14px;
  min-height: 56px;
  padding: 0 20px;
  font: inherit;
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  background: #26262e;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  transition: transform 80ms ease, background 120ms ease;
}
button:active { transform: scale(0.985); }
button:disabled { opacity: 0.5; cursor: default; transform: none; }
button.primary { background: var(--accent); color: var(--accent-ink); }
button.ghost { background: transparent; border: 1px solid var(--line); }
button svg { width: 22px; height: 22px; flex: none; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }

input[type="password"], input[type="text"] {
  width: 100%;
  min-height: 56px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #0f0f13;
  color: var(--text);
  font: inherit;
  font-size: 17px;
  padding: 0 16px;
  outline: none;
}
input:focus { border-color: var(--accent); }

.file-name { font-weight: 600; word-break: break-all; }

.progress { height: 10px; border-radius: 999px; background: #26262e; overflow: hidden; }
.progress > div { height: 100%; width: 0%; background: var(--accent); transition: width 160ms linear; }
.stat { display: flex; justify-content: space-between; font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }

.link-box {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  word-break: break-all;
  background: #0f0f13;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  color: var(--text);
  user-select: all;
}

.countdown { font-size: 32px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
.countdown.warn { color: var(--bad); }

.ok { color: var(--ok); }

header .pill {
  font-size: 13px;
  padding: 0 12px;
  min-height: 36px;
  width: auto;
  border-radius: 999px;
  background: #26262e;
  color: var(--muted);
  font-weight: 500;
}
header .pill b { color: var(--text); margin-left: 4px; }

.recent-list { display: flex; flex-direction: column; gap: 10px; }
.recent-item { display: flex; flex-direction: column; gap: 6px; padding: 16px; }
.recent-top { display: flex; justify-content: space-between; align-items: center; }
.recent-cd { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--muted); }
.recent-cd.warn { color: var(--bad); }
.recent-actions { margin-top: 6px; }
.recent-actions button { min-height: 44px; font-size: 15px; border-radius: 12px; }
.badge {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent);
}
.badge.received { background: rgba(34, 197, 94, 0.15); color: var(--ok); }

.toast {
  position: fixed;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(20px);
  background: #26262e;
  color: var(--text);
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
