:root {
  --bg: #f6f7fb;
  --bg-grad: radial-gradient(1200px 600px at 10% -10%, #e4e8ff 0%, transparent 60%),
             radial-gradient(900px 500px at 110% 10%, #dff5ef 0%, transparent 55%);
  --surface: #ffffff;
  --surface-2: #f1f3f9;
  --border: #e3e6ef;
  --text: #0b1020;
  --muted: #5b6478;
  --accent: #4f46e5;
  --accent-2: #6366f1;
  --accent-soft: #eef0ff;
  --success: #059669;
  --danger: #dc2626;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 12px 32px -12px rgba(16, 24, 40, .14);
  --radius: 18px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0d17;
    --bg-grad: radial-gradient(1200px 600px at 10% -10%, #1c1f4a 0%, transparent 60%),
               radial-gradient(900px 500px at 110% 10%, #0f2e2a 0%, transparent 55%);
    --surface: #121626;
    --surface-2: #1a1f33;
    --border: #262c44;
    --text: #eef1fb;
    --muted: #9aa3bd;
    --accent: #818cf8;
    --accent-2: #a5b4fc;
    --accent-soft: #1e2250;
    --success: #34d399;
    --danger: #f87171;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 12px 32px -12px rgba(0,0,0,.6);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-grad), var(--bg);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
button { font: inherit; cursor: pointer; }

/* ---------- Header / footer ---------- */
.nav {
  max-width: 1080px; width: 100%; margin: 0 auto;
  padding: 22px 20px; display: flex; align-items: center; justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; color: var(--text); }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), #06b6d4); color: #fff;
}
.nav-links { display: flex; gap: 22px; font-size: 14px; color: var(--muted); }
.nav-links a { color: var(--muted); }
.nav-links a:hover { color: var(--text); }
footer { margin-top: auto; padding: 28px 20px; text-align: center; color: var(--muted); font-size: 13px; }

main { max-width: 1080px; width: 100%; margin: 0 auto; padding: 8px 20px 40px; }

/* ---------- Hero ---------- */
.hero { text-align: center; padding: 24px 0 32px; }
.pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); font-size: 13px; font-weight: 600;
}
.hero h1 { font-size: clamp(32px, 5vw, 52px); line-height: 1.08; letter-spacing: -0.03em; margin: 18px 0 14px; }
.hero h1 span { background: linear-gradient(90deg, var(--accent), #06b6d4); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { color: var(--muted); font-size: 17px; max-width: 560px; margin: 0 auto; line-height: 1.6; }

/* ---------- Card ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 28px;
}
.uploader { max-width: 640px; margin: 0 auto; }

.dropzone {
  display: block;
  border: 2px dashed var(--border); border-radius: 14px; padding: 40px 20px; text-align: center;
  background: var(--surface-2); transition: border-color .15s, background .15s; cursor: pointer;
}
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: var(--accent-soft); }
.dropzone .icon {
  width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 16px; display: grid; place-items: center;
  background: var(--surface); color: var(--accent); border: 1px solid var(--border);
}
.dropzone strong { display: block; font-size: 16px; margin-bottom: 4px; }
.dropzone small { color: var(--muted); }
.dropzone input { display: none; }

.file-chip {
  display: none; align-items: center; gap: 12px; padding: 14px; border: 1px solid var(--border);
  border-radius: 12px; background: var(--surface-2);
}
.file-chip.show { display: flex; }
.file-chip .ficon {
  width: 42px; height: 42px; flex: none; border-radius: 10px; background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; font-size: 11px; font-weight: 700; text-transform: uppercase;
}
.file-chip .meta { min-width: 0; flex: 1; }
.file-chip .name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-chip .size { color: var(--muted); font-size: 13px; }
.icon-btn {
  border: 0; background: transparent; color: var(--muted); width: 34px; height: 34px; border-radius: 8px;
  display: grid; place-items: center;
}
.icon-btn:hover { background: var(--surface); color: var(--danger); }

.field { margin-top: 24px; }
.field-label { display: flex; justify-content: space-between; font-weight: 600; font-size: 14px; margin-bottom: 10px; }
.field-label span { color: var(--muted); font-weight: 500; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  padding: 9px 14px; border-radius: 10px; font-size: 14px; font-weight: 500; transition: all .12s;
}
.chip:hover { border-color: var(--accent); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 12px; padding: 14px 20px; font-weight: 600; font-size: 15px;
  transition: transform .06s, opacity .15s, background .15s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; width: 100%; margin-top: 26px; }
.btn-primary:hover:not(:disabled) { background: var(--accent-2); }
.btn-ghost { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--accent); }
.btn-danger { background: transparent; color: var(--danger); border: 1px solid var(--border); }
.btn-danger:hover { border-color: var(--danger); }

.progress { margin-top: 18px; display: none; }
.progress.show { display: block; }
.bar { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar > div { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), #06b6d4); transition: width .15s; }
.progress-text { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-top: 8px; }

.error { color: var(--danger); font-size: 14px; margin-top: 14px; min-height: 1em; }

/* ---------- Result ---------- */
.result { display: none; }
.result.show { display: block; }
.result-head { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.check { width: 40px; height: 40px; border-radius: 50%; background: color-mix(in srgb, var(--success) 15%, transparent); color: var(--success); display: grid; place-items: center; flex: none; }
.result-head h2 { margin: 0; font-size: 20px; }
.result-head p { margin: 2px 0 0; color: var(--muted); font-size: 14px; }

.share-grid { display: grid; grid-template-columns: 200px 1fr; gap: 24px; align-items: start; }
.qr { background: #fff; border-radius: 14px; padding: 12px; border: 1px solid var(--border); }
.qr svg { display: block; width: 100%; height: auto; }

.link-box { display: flex; gap: 8px; }
.link-box input {
  flex: 1; min-width: 0; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font: 500 14px ui-monospace, 'SFMono-Regular', Consolas, monospace;
}
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 14px; }
.stat { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
.stat small { display: block; color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.stat b { font-size: 16px; font-variant-numeric: tabular-nums; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.row-actions .btn { padding: 10px 14px; font-size: 14px; }

/* ---------- Features ---------- */
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 56px; }
.feature { padding: 22px; }
.feature .ficon { width: 40px; height: 40px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; margin-bottom: 14px; }
.feature h3 { margin: 0 0 6px; font-size: 16px; }
.feature p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.55; }

/* ---------- Download page ---------- */
.dl { max-width: 520px; margin: 24px auto 0; text-align: center; }
.dl .big-icon {
  width: 76px; height: 76px; margin: 4px auto 18px; border-radius: 22px; background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; font-weight: 800; font-size: 14px; text-transform: uppercase;
}
.dl h1 { font-size: 22px; margin: 0 0 6px; word-break: break-word; }
.dl .sub { color: var(--muted); margin: 0 0 22px; }
.dl .stats { text-align: left; margin-bottom: 6px; }
.dl .btn-primary { margin-top: 18px; }
.state-icon { width: 64px; height: 64px; margin: 8px auto 16px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.skeleton { height: 14px; background: var(--surface-2); border-radius: 6px; margin: 10px auto; animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .5; } }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px); opacity: 0;
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 14px; font-weight: 500;
  transition: all .2s; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 720px) {
  .features { grid-template-columns: 1fr; }
  .share-grid { grid-template-columns: 1fr; }
  .qr { max-width: 220px; margin: 0 auto; }
  .card { padding: 20px; }
  .nav-links { display: none; }
}
