/* bundl — styles. Every colour goes through a token so light/dark both work. */

:root {
  --bg: #f5f5f3;
  --surface: #ffffff;
  --surface-2: #f5f5f3;
  --border: #e2e2de;
  --border-strong: #c9c9c4;
  --text: #111111;
  --muted: #666666;
  --primary: #111111;
  --primary-hover: #333333;
  --on-primary: #ffffff;
  --error: #c81e1e;
  --error-bg: #fef2f2;
  --error-border: #fecaca;
  --success: #15803d;
  --success-bg: #f0fdf4;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.05);
  --badge-shadow: 0 3px 8px rgba(0,0,0,.12);
  --ring: 0 0 0 3px rgba(17,17,17,.18);
  --radius: 16px;
  --radius-sm: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e0e0f;
    --surface: #18181a;
    --surface-2: #222225;
    --border: #2c2c30;
    --border-strong: #3d3d42;
    --text: #f2f2f0;
    --muted: #a0a0a6;
    --primary: #f2f2f0;
    --primary-hover: #d6d6d3;
    --on-primary: #111111;
    --error: #f87171;
    --error-bg: #2a1414;
    --error-border: #5c2323;
    --success: #4ade80;
    --success-bg: #12261a;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
    --badge-shadow: 0 3px 8px rgba(0,0,0,.5);
    --ring: 0 0 0 3px rgba(242,242,240,.28);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 48px 16px calc(32px + env(safe-area-inset-bottom));
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
svg { fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: none; box-shadow: var(--ring); }
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- layout ---------- */
.container { width: 100%; max-width: 520px; margin: 0 auto; }
@media (min-width: 768px)  { .container { max-width: 640px; } }
@media (min-width: 1100px) { .container { max-width: 800px; } }

.site-header { text-align: center; margin-bottom: 24px; }
.logo-wrap { display: inline-flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; border-radius: 12px; padding: 2px 8px; }
.logo-icon { transform: rotate(135deg); flex-shrink: 0; }
.logo-icon rect { fill: none; stroke: currentColor; stroke-width: 4; stroke-linejoin: round; }
.logo { font-size: 40px; font-weight: 600; letter-spacing: -.5px; }
.description { font-size: 16px; color: var(--muted); margin: 6px 0 16px; min-height: 24px; }
.badges { list-style: none; display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; }
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px;
  font-size: 13px; font-weight: 500; color: var(--muted);
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px; box-shadow: var(--badge-shadow);
}
.badge svg { width: 18px; height: 18px; stroke-width: 1.8; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 32px; box-shadow: var(--shadow); }
@media (max-width: 540px) { .card { padding: 20px; } body { padding-top: 32px; } .logo { font-size: 34px; } }

.view-center { text-align: center; }
.view-title { font-size: 22px; font-weight: 600; letter-spacing: -.2px; outline: none; }
.view-subtitle { font-size: 14px; color: var(--muted); margin: 6px 0 24px; }
.notice { font-size: 14px; color: var(--muted); text-align: center; }

.site-footer { margin-top: 32px; text-align: center; font-size: 12px; color: var(--muted); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 600;
  text-decoration: none; transition: background .15s, border-color .15s, opacity .15s, transform .1s;
  border: 1px solid transparent; min-height: 44px;
}
.btn:active:not(:disabled) { transform: scale(.98); }
.btn svg { width: 18px; height: 18px; stroke-width: 2; }
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-secondary { background: transparent; color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { border-color: var(--text); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn-block { width: 100%; margin-top: 20px; padding: 14px; }
.btn-icon { padding: 0; width: 46px; flex-shrink: 0; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 8px; color: var(--muted); flex-shrink: 0; transition: color .15s, background .15s; }
.icon-btn:hover { color: var(--text); background: var(--surface-2); }
.icon-btn svg { width: 18px; height: 18px; stroke-width: 2; }
.icon-btn-sm { width: 28px; height: 28px; }
.icon-btn-sm svg { width: 15px; height: 15px; }
.link-btn { font-size: 13px; color: var(--muted); text-decoration: underline; text-underline-offset: 2px; padding: 4px; border-radius: 4px; }
.link-btn:hover { color: var(--text); }

/* ---------- upload ---------- */
.dropzone {
  width: 100%; display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 40px 24px; border: 2px dashed var(--border-strong); border-radius: 12px;
  color: var(--muted); text-align: center; transition: border-color .2s, background .2s;
}
.dropzone:hover, .dropzone.is-over { border-color: var(--text); background: var(--surface-2); }
.dropzone-icon { width: 40px; height: 40px; stroke-width: 1.5; margin-bottom: 4px; }
.dropzone-text { font-size: 14px; }
.dropzone-text strong { color: var(--text); font-weight: 600; }
.dropzone-limit { font-size: 13px; font-weight: 500; }
kbd { font: 500 12px/1 'Inter', system-ui, sans-serif; padding: 2px 6px; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 5px; color: var(--text); }
.hint-touch { display: none; }
@media (hover: none) and (pointer: coarse) { .hint-fine { display: none; } .hint-touch { display: inline; } }
.has-file .dropzone { display: none; }

.selected { margin-top: 0; padding: 12px; background: var(--surface-2); border-radius: 12px; }
.selected-row { display: flex; align-items: center; gap: 12px; }
.thumb { width: 44px; height: 44px; border-radius: 8px; background: var(--surface); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; color: var(--muted); flex-shrink: 0; overflow: hidden; }
.thumb svg { width: 22px; height: 22px; stroke-width: 1.5; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.selected-meta { flex: 1; min-width: 0; }
.selected-name { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.selected-size { font-size: 13px; color: var(--muted); }
.preview { margin-top: 12px; border-radius: 8px; overflow: hidden; background: var(--surface); display: flex; justify-content: center; }
.preview img, .preview video { display: block; max-width: 100%; max-height: 240px; object-fit: contain; }

.options { margin-top: 20px; display: grid; gap: 16px; }
.field { border: 0; min-width: 0; }
.field-label { display: block; font-size: 13px; font-weight: 500; color: var(--muted); margin-bottom: 8px; padding: 0; }
.segmented { display: flex; gap: 8px; border: 0; }
.segmented label { flex: 1; position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segmented span {
  display: block; text-align: center; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 13px; font-weight: 500; color: var(--muted); transition: all .15s;
}
.segmented label:hover span { border-color: var(--text); color: var(--text); }
.segmented input:checked + span { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.segmented input:focus-visible + span { box-shadow: var(--ring); }
.segmented-sm { margin-top: 10px; max-width: 260px; }
.segmented-sm span { padding: 8px 0; }

.check { display: inline-flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text); cursor: pointer; user-select: none; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); cursor: pointer; }

.note-preview { position: relative; margin-top: 10px; padding: 10px 40px 10px 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; }
.note-preview p { font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 7.5em; overflow: auto; }
.note-preview .icon-btn { position: absolute; top: 6px; right: 6px; }

.progress { margin-top: 20px; }
.progress-track { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; border: 1px solid var(--border); }
.progress-fill { height: 100%; width: 0; background: var(--primary); border-radius: inherit; transition: width .2s ease-out; }
.progress-row { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }

.error { margin-top: 16px; padding: 12px 14px; font-size: 13px; color: var(--error); background: var(--error-bg); border: 1px solid var(--error-border); border-radius: 8px; }
.fineprint { margin-top: 10px; font-size: 11px; color: var(--muted); text-align: center; }

/* ---------- result ---------- */
.success-icon { width: 56px; height: 56px; margin: 0 auto 16px; border-radius: 50%; background: var(--success-bg); color: var(--success); display: flex; align-items: center; justify-content: center; }
.success-icon svg { width: 28px; height: 28px; stroke-width: 2.25; }
.qr { display: inline-flex; padding: 16px; background: #fff; border: 1px solid var(--border); border-radius: 12px; margin-bottom: 20px; }
.qr img, .qr canvas { display: block; width: 180px; height: 180px; }
.link-box { text-align: left; background: var(--surface-2); border-radius: 12px; padding: 14px; }
.link-row { display: flex; gap: 8px; }
.link-input {
  flex: 1; min-width: 0; padding: 11px 12px; font-size: 14px; font-weight: 500;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px; outline: none;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; text-overflow: ellipsis;
}
.link-input:focus-visible { box-shadow: var(--ring); }
#copyBtn .i-check { display: none; }
#copyBtn.copied { background: var(--success); color: #fff; }
#copyBtn.copied .i-copy { display: none; }
#copyBtn.copied .i-check { display: block; }
.link-meta { font-size: 13px; color: var(--muted); margin-top: 10px; text-align: center; font-variant-numeric: tabular-nums; }

.share { margin: 24px 0; padding-top: 20px; border-top: 1px solid var(--border); }
.share-heading { font-size: 12px; font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 14px; }
.share-row { display: flex; justify-content: center; gap: 28px; }
.share-item { display: flex; flex-direction: column; align-items: center; gap: 6px; text-decoration: none; color: var(--muted); border-radius: 12px; padding: 2px; }
.share-btn { width: 48px; height: 48px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--surface-2); border: 1px solid var(--border); color: var(--text); transition: all .2s; }
.share-btn svg { width: 20px; height: 20px; stroke-width: 1.6; }
.share-item:hover .share-btn { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.share-label { font-size: 11px; font-weight: 500; }

/* ---------- download (recipient) ---------- */
.file-icon { width: 64px; height: 64px; margin: 4px auto 14px; border-radius: 14px; background: var(--surface-2); display: flex; align-items: center; justify-content: center; color: var(--muted); }
.file-icon svg { width: 32px; height: 32px; stroke-width: 1.5; }
.dl-name { overflow-wrap: anywhere; font-size: 20px; }
.note { text-align: left; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; margin-bottom: 4px; }
.note-heading { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 700; margin-bottom: 6px; }
.note-heading svg { width: 15px; height: 15px; stroke-width: 2.2; }
.note-body { font-size: 14px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
@media (max-width: 540px) { .note { padding: 10px 12px; } .note-body { font-size: 13px; } }
.dl-status { font-size: 13px; color: var(--success); margin-top: 10px; min-height: 0; }
.dl-status:empty { display: none; }
.gone-icon { width: 64px; height: 64px; margin: 4px auto 14px; color: var(--error); }
.gone-icon svg { width: 64px; height: 64px; stroke-width: 1.5; }
.cta { margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--border); }
.cta p { font-size: 14px; color: var(--muted); margin-bottom: 16px; }

.skeleton { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 4px 0; }
.sk { display: block; background: var(--surface-2); border-radius: 8px; animation: pulse 1.4s ease-in-out infinite; }
.sk-icon { width: 64px; height: 64px; border-radius: 14px; }
.sk-line { width: 60%; height: 18px; }
.sk-short { width: 30%; height: 14px; }
.sk-btn { width: 100%; height: 48px; margin-top: 12px; }
@keyframes pulse { 50% { opacity: .5; } }

/* ---------- drag overlay ---------- */
.drop-overlay { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; background: color-mix(in srgb, var(--bg) 80%, transparent); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); pointer-events: none; }
.drop-overlay-inner { width: 100%; height: 100%; max-width: 900px; max-height: 600px; border: 3px dashed var(--text); border-radius: 24px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; font-size: 20px; font-weight: 600; }
.drop-overlay-inner svg { width: 48px; height: 48px; }

/* ---------- modal ---------- */
.modal { margin: auto; width: min(440px, calc(100% - 32px)); border: 1px solid var(--border); border-radius: 14px; padding: 24px; background: var(--surface); color: var(--text); box-shadow: 0 12px 40px rgba(0,0,0,.25); }
.modal::backdrop { background: rgba(0,0,0,.45); }
.modal[open] { animation: pop .18s ease-out; }
.modal-title { font-size: 16px; font-weight: 600; margin-bottom: 8px; }
.modal-text { font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.modal textarea { width: 100%; min-height: 120px; resize: vertical; padding: 10px 12px; font-size: 14px; line-height: 1.5; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; outline: none; }
.modal textarea:focus-visible { box-shadow: var(--ring); border-color: var(--border-strong); }
.note-count { text-align: right; font-size: 12px; color: var(--muted); margin-top: 6px; font-variant-numeric: tabular-nums; }
.note-count.near { color: var(--error); }
.modal-actions { display: flex; gap: 10px; margin-top: 14px; }
.modal-actions .btn { flex: 1; }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.98); } }

/* ---------- toast ---------- */
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60; padding: 10px 16px; border-radius: 999px; background: var(--primary); color: var(--on-primary); font-size: 13px; font-weight: 500; box-shadow: 0 6px 20px rgba(0,0,0,.2); animation: pop .18s ease-out; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
