/* ShareDirect — one clear action at a time. Light + dark via prefers-color-scheme. */

:root {
  color-scheme: light dark;

  /* ---- color: light ---- */
  --bg:            #F7F8F5;
  --surface:       #FFFFFF;
  --surface-2:     #EEF0F3;
  --border:        #E2E5EA;
  --border-strong: #C9CFD8;
  --text:          #192B31;
  --muted:         #5B6573;
  --accent:        #255BDB;
  --accent-hover:  #1948B9;
  --accent-ink:    #FFFFFF;
  --accent-soft:   #EDF2FF;
  --ok:            #1C7A4D;
  --ok-soft:       #E3F4EA;
  --warn:          #875300;
  --warn-soft:     #FBF1DB;
  --error:         #B3261E;
  --error-soft:    #FBE9E7;
  --idle:          var(--muted);
  --info:          var(--accent);
  --focus:         var(--accent);
  --toast-bg:      #192B31;
  --toast-ink:     #F7F8F5;
  --shadow:        0 1px 2px rgba(20,25,34,.06), 0 4px 16px rgba(20,25,34,.04);
  --shadow-pop:    0 8px 24px rgba(20,25,34,.18);

  /* ---- type (system fonts: the CSP allows no third-party font hosts) ---- */
  --font: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  /* ---- spacing (4px grid) ---- */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px;
  --sp-6: 24px; --sp-8: 32px; --sp-10: 40px; --sp-12: 48px;

  /* ---- fixed region heights (the no-shift contract) ---- */
  --h-topbar: 80px;
  --h-heading: 64px;
  --h-strip: 72px;
  --h-primary: 176px;
  --h-listhead: 40px;
  --h-row: 56px;
  --h-actionbar: 64px;
  --w-stage: 760px;
  --w-state: 240px;
  --w-cta-slot: 260px;

  /* ---- radius ---- */
  --r-control: 10px; --r-card: 14px; --r-hero: 16px; --r-pill: 999px; --r-sm: 8px;

  /* ---- motion ---- */
  --t-fast: 120ms; --t-base: 160ms; --t-reveal: 240ms; --t-bar: 300ms;
  --ease: cubic-bezier(.2,.7,.2,1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0E1013; --surface: #161920; --surface-2: #1E222A;
    --border: #2A2F38; --border-strong: #3A414C;
    --text: #E8EBEF; --muted: #9AA4B1;
    --accent: #56C3E0; --accent-hover: #7AD1E8; --accent-ink: #06202A; --accent-soft: #12303A;
    --ok: #58D08F; --ok-soft: #14301F;
    --warn: #F0C060; --warn-soft: #2E2510;
    --error: #FF8A80; --error-soft: #35191A;
    --toast-bg: #E8EBEF; --toast-ink: #0E1013;
    --shadow: 0 1px 2px rgba(0,0,0,.4); --shadow-pop: 0 8px 24px rgba(0,0,0,.5);
  }
}
@media (prefers-reduced-motion: reduce) {
  :root { --t-fast: 0ms; --t-base: 0ms; --t-reveal: 0ms; --t-bar: 0ms; }
}

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 400 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
body.dialog-open { overflow: hidden; padding-right: var(--dialog-scrollbar, 0px); }
.confirm-dialog {
  width: min(440px, calc(100vw - 40px));
  max-height: calc(100dvh - 48px);
  margin: auto;
  padding: 32px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 24px 80px rgb(0 0 0 / .22);
  overflow-y: auto;
}
.confirm-dialog[open] { animation: dialog-enter 160ms var(--ease) both; }
.confirm-dialog::backdrop { background: rgb(8 16 24 / .48); backdrop-filter: blur(4px); }
.dialog-symbol {
  width: 48px; height: 48px; display: grid; place-items: center;
  margin-bottom: 24px; border-radius: 16px;
  background: var(--accent-soft); color: var(--accent);
}
.confirm-dialog .dialog-eyebrow {
  margin: 0 0 8px; color: var(--muted); font-size: 11px;
  font-weight: 650; text-transform: uppercase; letter-spacing: .12em;
}
.confirm-dialog h2 { margin: 0 0 12px; font-size: 28px; line-height: 1.15; letter-spacing: -.04em; }
.confirm-dialog #confirm-description { color: var(--muted); font-size: 14px; line-height: 1.7; }
.confirm-dialog .dialog-reassurance {
  display: flex; align-items: center; gap: 10px;
  margin: 20px 0 28px; padding: 14px; border-radius: 12px;
  background: var(--surface-2); color: var(--muted); font-size: 12px; line-height: 1.5;
}
.dialog-reassurance svg { flex: none; color: var(--ok); }
.dialog-actions { display: flex; flex-direction: column-reverse; gap: 10px; }
.dialog-actions .btn { width: 100%; justify-content: center; }
@keyframes dialog-enter { from { opacity: 0; transform: translateY(8px) scale(.985); } to { opacity: 1; transform: none; } }
@media (max-width: 480px) { .confirm-dialog { padding: 24px; border-radius: 20px; } }
h1, h2, h3, p { margin: 0; }
a { color: var(--accent); }
a:hover { color: var(--accent-hover); }
strong, b { font-weight: 600; }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.trunc { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.error-text { color: var(--error) !important; }

/* ---------------------------------------------------------------- top bar */
.topbar {
  height: var(--h-topbar);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
}
.topbar-in {
  width: 100%;
  height: 40px;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -.01em;
  border-radius: var(--r-sm);
  flex: none;
}
.brand:hover { color: var(--text); }
.brand-mark rect { fill: var(--accent); }
.brand-mark circle { fill: var(--accent-ink); }
.brand-mark path { stroke: var(--accent-ink); }
.topbar-right { flex: 1 1 auto; display: flex; align-items: center; justify-content: flex-end; gap: 12px; min-width: 0; }
.tagline { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Which header items show is decided once per page load by the route. */
.for-home, .for-send, .for-recv { display: none !important; }
body[data-view="home"] .for-home,
body[data-view="unsupported"] .for-home { display: inline-block !important; }
body[data-view="send"] .for-send,
body[data-view="recv"] .for-recv { display: inline-flex !important; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 28px;
  padding: 0 12px 0 10px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  flex: none;
}
.code-pill { padding: 0 12px; font-weight: 500; letter-spacing: .04em; }
.code-pill.is-expired { text-decoration: line-through; opacity: .7; }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border-radius: var(--r-control);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font: 600 14px/1 var(--font);
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  flex: none;
  transition: background-color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.btn:hover { background: var(--surface-2); color: var(--text); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-ink); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.lg { height: 48px; padding: 0 22px; font-size: 15px; border-radius: 12px; }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: var(--r-sm); gap: 6px; }
.btn.block { width: 100%; }
.btn.link {
  height: auto; padding: 0; border: 0; border-radius: 2px; background: none;
  color: var(--accent); font: inherit; font-weight: 600; display: inline;
}
.btn.link:hover, .link:hover { text-decoration: underline; background: none; }
button.link {
  padding: 0; border: 0; background: none; color: var(--accent); font: inherit; font-weight: 600;
  cursor: pointer; border-radius: 2px;
}
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: default; }
.btn:disabled:hover { background: var(--surface); color: var(--text); }
.btn.primary:disabled:hover { background: var(--accent); color: var(--accent-ink); }
.btn.ghost:disabled:hover { background: transparent; color: var(--muted); }
.btn-row { display: flex; gap: 10px; }

.icon {
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  border: 0;
  background: transparent;
  color: var(--muted);
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
  transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.icon:hover { background: var(--error-soft); color: var(--error); }

/* ----------------------------------------------------------------- inputs */
.input {
  height: 44px;
  width: 100%;
  min-width: 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-control);
  background: var(--surface-2);
  color: var(--text);
  padding: 0 14px;
  font-size: 14px;
}
.input.mono { font-family: var(--mono); font-weight: 500; letter-spacing: .04em; }
.input.lg { height: 48px; border-radius: 12px; padding: 0 16px; font-size: 15px; }
.input::placeholder { color: var(--muted); opacity: .8; }
.input:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 1px var(--focus); }
.input[aria-invalid="true"] { border-color: var(--error); }
.input[aria-invalid="true"]:focus { box-shadow: 0 0 0 1px var(--error); }

/* ------------------------------------------------------------------ cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  box-shadow: var(--shadow);
}

/* ------------------------------------------------- crossfade slots (swapIn) */
.swap { display: grid; }
.swap > * {
  grid-area: 1 / 1;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--t-base) var(--ease), visibility 0s linear var(--t-base);
}
.swap > [data-active] {
  opacity: 1;
  visibility: visible;
  transition: opacity var(--t-base) var(--ease), visibility 0s linear 0s;
}

/* ------------------------------------------------------------------ stage */
#app { display: block; }
.stage {
  max-width: var(--w-stage);
  margin: 0 auto;
  padding: 40px 24px 48px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.heading {
  height: var(--h-heading);
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.heading h1 {
  font-size: 24px;
  line-height: 30px;
  font-weight: 600;
  letter-spacing: -.015em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.heading .sub { font-size: 14px; line-height: 20px; color: var(--muted); }

/* ------------------------------------------------------------ status strip */
.strip {
  --tone: var(--muted);
  height: var(--h-strip);
  flex: none;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 0 20px 0 18px;
  position: relative;
  overflow: hidden;
}
.strip::before {
  content: "";
  position: absolute;
  left: 0;
  top: 14px;
  bottom: 14px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--tone);
  transition: background-color var(--t-base) var(--ease);
}
.tone-ok { --tone: var(--ok); }
.tone-info { --tone: var(--info); }
.tone-warn { --tone: var(--warn); }
.tone-error { --tone: var(--error); }
.tone-idle { --tone: var(--idle); }
.strip .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin: 0 auto;
  background: var(--tone);
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--tone) 14%, transparent);
  transition: background-color var(--t-base) var(--ease), box-shadow var(--t-base) var(--ease);
}
.strip-text { display: grid; min-width: 0; }
.strip-layer {
  grid-area: 1 / 1;
  min-width: 0;
  opacity: 1;
}
.strip-layer.is-on { opacity: 1; }
.strip .t {
  font-size: 15px;
  font-weight: 600;
  line-height: 20px;
  height: 20px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.strip.tone-error .t { color: var(--error); }
.strip .d {
  font-size: 13px;
  line-height: 18px;
  height: 18px;
  margin-top: 2px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.strip-slot { height: 40px; display: flex; align-items: center; gap: 8px; flex: none; }
.sas {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 14px 0 12px;
  border-radius: var(--r-control);
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.sas b { font: 500 18px/1 var(--mono); letter-spacing: .12em; color: var(--text); }
.sas.is-empty { opacity: .45; }

/* -------------------------------------------------------- primary region */
.stage > .primary { height: var(--h-primary); flex: none; position: relative; }
.stage > .primary > .variant {
  height: 100%;
  min-width: 0;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
  overflow: hidden;
}
.stage > .primary.drag-over::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--r-card);
  outline: 2px dashed var(--accent);
  outline-offset: -2px;
  background: color-mix(in srgb, var(--accent-soft) 40%, transparent);
  pointer-events: none;
}
.stage > .primary.drag-over:has(.dropzone[data-active])::after { display: none; }

.dropzone {
  border: 2px dashed var(--border-strong) !important;
  box-shadow: none !important;
  align-items: center;
  text-align: center;
  gap: 10px !important;
  transition: opacity var(--t-base) var(--ease), visibility 0s linear var(--t-base), border-color var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease) !important;
}
.dropzone[data-active] {
  transition: opacity var(--t-base) var(--ease), visibility 0s, border-color var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease) !important;
}
.dropzone.over { border-color: var(--accent) !important; background: var(--accent-soft); }
.dz-icon {
  width: 40px; height: 40px; border-radius: 12px;
  background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; flex: none;
}
.dz-title { font-size: 15px; font-weight: 600; line-height: 20px; }
.dz-hint { font-size: 13px; line-height: 18px; color: var(--muted); margin-top: -4px; }
.dropzone .btn-row { margin-top: 4px; }

.label { font-size: 13px; font-weight: 600; line-height: 18px; color: var(--muted); }
.input-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.copy-btn { height: 44px; min-width: 128px; }
.helper-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  height: 20px;
  font-size: 13px;
  line-height: 20px;
  color: var(--muted);
  min-width: 0;
}
.helper-row > :first-child { flex: 1 1 auto; }
.helper-right { flex: none; white-space: nowrap; }
.helper { font-size: 13px; line-height: 18px; height: 18px; color: var(--muted); }
.share.is-dim { opacity: .5; }
.share.is-dim[data-active] { opacity: .5; }
.share.is-expired #share-link { text-decoration: line-through; }

.progress-card { gap: 14px !important; }
.pc-top, .pc-big { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; min-width: 0; }
/* Numbers that change while transferring sit in fixed-width, left-aligned
   boxes, so their text never moves (no layout shift as digits change). */
.pc-big { display: grid; grid-template-columns: minmax(0, 1fr) 200px; }
.big > span:first-child { display: inline-block; min-width: 6.6ch; }
.pc-top { font-size: 13px; line-height: 18px; }
.eyebrow-sm { font-size: 13px; font-weight: 600; color: var(--muted); }
.big { font-size: 28px; line-height: 1; font-weight: 600; letter-spacing: -.02em; white-space: nowrap; }
.big .of { font-size: 15px; font-weight: 500; letter-spacing: 0; color: var(--muted); }
.rate { font-size: 15px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; text-align: left; }
.rate.muted { color: var(--muted); }
.progress-card .helper-row .btn { margin-right: -10px; }
.folder-line { display: inline-flex !important; align-items: center; gap: 8px; }
.folder-line svg { flex: none; }
.folder-line b { color: var(--text); font-weight: 500; overflow: hidden; text-overflow: ellipsis; }

.done-card {
  display: grid !important;
  grid-template-columns: 56px minmax(0, 1fr) auto;
  align-items: center;
  gap: 20px !important;
}
.done-tile {
  width: 56px; height: 56px; border-radius: 16px;
  background: var(--ok-soft); color: var(--ok);
  display: grid; place-items: center;
}
.done-text { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.done-headline { font-size: 22px; line-height: 1.2; font-weight: 600; letter-spacing: -.015em; }
.done-detail { font-size: 14px; line-height: 20px; color: var(--muted); }
.done-link { font-size: 13px; line-height: 18px; color: var(--muted); margin-top: 4px; }
.done-actions { display: flex; flex-direction: column; gap: 8px; align-items: stretch; }

.connection { padding: 24px 32px !important; gap: 18px !important; }
.nodes { display: flex; align-items: center; gap: 16px; }
.node-col { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 120px; flex: none; }
.node {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--muted);
  display: grid; place-items: center;
}
.node.me { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.node-label { font-size: 12px; line-height: 16px; color: var(--muted); }
.wire {
  flex: 1 1 auto;
  height: 2px;
  margin-bottom: 24px;
  background: repeating-linear-gradient(90deg, var(--border-strong) 0 8px, transparent 8px 16px);
  background-size: 16px 2px;
}
.connection.is-live .wire {
  background-image: repeating-linear-gradient(90deg, var(--accent) 0 8px, transparent 8px 16px);
  animation: wire 0.8s linear infinite;
}
@keyframes wire { to { background-position: 16px 0; } }
.conn-caption { text-align: center; font-size: 13px; line-height: 18px; color: var(--muted); }

.selection { gap: 20px !important; }
.kvs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.kv { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.kv > :first-child { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.kv > :last-child { font-size: 17px; line-height: 22px; font-weight: 600; }
.kv .muted-val { color: var(--muted); font-weight: 500; }

#recv-error.no-form .input-row { visibility: hidden; }

/* ----------------------------------------------------------------- bars */
.bar {
  height: 4px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  overflow: hidden;
  margin-top: 6px;
}
.bar > span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: inherit;
  transition: width var(--t-bar) linear, background-color var(--t-base) var(--ease);
}
.bar-lg { height: 8px; margin-top: 0; flex: none; }
#overall-fill { transition: background-color var(--t-base) var(--ease); }
#overall-fill.progress-animated { transition: width 50ms linear, background-color var(--t-base) var(--ease); }
@media (prefers-reduced-motion: reduce) {
  #overall-fill.progress-animated { transition: none; }
}
.bar.ok > span, .done .bar > span { background: var(--ok); }

/* -------------------------------------------------------- list + header */
.listhead {
  height: var(--h-listhead);
  flex: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 0 4px;
  font-size: 13px;
  color: var(--muted);
  min-width: 0;
}
.summary { font-variant-numeric: tabular-nums; }
.summary b { color: var(--text); font-weight: 600; }
.tools { display: flex; gap: 6px; flex: none; margin-right: -8px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; flex: none; white-space: nowrap; }
.check input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
.check:has(input:disabled) { cursor: default; }
.check:has(input:disabled) span { opacity: .45; }

.files {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
}
.files:has(> .ghost-row:only-child) {
  border-style: dashed;
  border-color: var(--border-strong);
  box-shadow: none;
  background: transparent;
}
.ghost-row .row-in {
  height: var(--h-row);
  display: flex;
  align-items: center;
  padding: 0 20px;
  color: var(--muted);
  font-size: 13px;
  opacity: .8;
}
li.file {
  display: grid;
  grid-template-rows: 1fr;
  transition: grid-template-rows var(--t-reveal) var(--ease);
}
li.file.reveal { grid-template-rows: 0fr; }
li.file > .row-in { min-height: 0; overflow: hidden; }
.files > li + li > .row-in { border-top: 1px solid var(--border); }
.file .row-in {
  display: grid;
  grid-template-rows: var(--h-row);
  align-items: center;
}
#send-list .file .row-in { grid-template-columns: minmax(0, 1fr) var(--w-state) 32px; gap: 20px; padding: 0 12px 0 20px; }
#recv-list .file .row-in { grid-template-columns: 18px minmax(0, 1fr) var(--w-state); gap: 16px; padding: 0 20px; }
#recv-list .file input[type="checkbox"] { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
.meta { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.name { font-size: 14px; font-weight: 500; line-height: 20px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.size { font-size: 12px; color: var(--muted); white-space: nowrap; flex: none; }
.file.done .name, .file.skip .name { color: var(--muted); }
.file.skip .name { font-weight: 400; }
.state { min-width: 0; }
.st {
  display: flex;
  min-width: 0;
  height: 16px;
  font-size: 12px;
  line-height: 16px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}
#send-list .st { display: block; }
.st-t { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.st-retry { flex: none; white-space: pre; }
.st-retry .link { font-size: 12px; line-height: 16px; }
.st.ok { color: var(--ok); }
.st.active { color: var(--accent); }
.st.warn { color: var(--warn); }
.st.error, .st.err { color: var(--error); }
.state:has(.st.warn) .bar > span { background: var(--warn); }
.state:has(.st.error) .bar > span { background: var(--error); }

/* -------------------------------------------------------------- action bar */
.actionbar {
  height: var(--h-actionbar);
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.foot {
  flex: 1 1 auto;
  min-width: 0;
  height: 40px;
  font-size: 13px;
  line-height: 20px;
  color: var(--muted);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.cta-slot {
  width: var(--w-cta-slot);
  flex: none;
  display: grid;
  justify-items: end;
  align-items: center;
}
.cta-slot > * { grid-area: 1 / 1; }

/* ----------------------------------------------------------------- toasts */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  z-index: 10;
  width: max-content;
  max-width: min(560px, calc(100vw - 32px));
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 12px 12px 16px;
  border-radius: 12px;
  background: var(--toast-bg);
  color: var(--toast-ink);
  font-size: 13px;
  line-height: 18px;
  box-shadow: var(--shadow-pop);
  animation: toast-in var(--t-base) var(--ease);
}
.toast b, .toast strong { color: inherit; }
.toast-btn {
  background: transparent !important;
  color: inherit !important;
  border-color: color-mix(in srgb, currentColor 35%, transparent) !important;
}
.toast-btn:hover { border-color: currentColor !important; }
.toast :focus-visible { outline-color: var(--toast-ink); }
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* ---------------------------------------------------------------- landing */
.home { max-width: 680px; margin: 0 auto; padding: 72px 24px 24px; text-align: center; }
.hero { display: flex; flex-direction: column; align-items: center; gap: 22px; }
.eyebrow { font-size: 11px; font-weight: 650; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.hero h1 { font-size: clamp(48px, 6vw, 76px); line-height: 1.04; letter-spacing: -.065em; font-weight: 650; }
.hero h1 span { color: var(--accent); }
.hero-text { font-size: 18px; line-height: 1.5; color: var(--muted); }
.home-action { margin: 36px auto 0; max-width: 380px; }
.home-action > :not([data-active]) { display: none; }
.send-hero { width: 100%; min-height: 64px; border-radius: 18px; font-size: 18px; justify-content: space-between; padding: 0 28px; box-shadow: 0 6px 14px color-mix(in srgb, var(--accent) 18%, transparent); }
.send-hero span { font-size: 27px; font-weight: 400; }
.home-caption { color: var(--muted); font-size: 13px; margin-top: 16px; }
#home-error:not(:empty) { margin-top: 12px; }
.receive-entry { max-width: 440px; margin: 34px auto 0; text-align: left; border-top: 1px solid var(--border); padding-top: 22px; }
.receive-entry summary { display: flex; justify-content: space-between; align-items: center; gap: 12px; list-style: none; min-height: 44px; cursor: pointer; color: var(--muted); font-size: 14px; border-radius: 6px; }
.receive-entry summary::-webkit-details-marker { display: none; }
.receive-entry summary > span { color: var(--text); font-weight: 600; }
.receive-entry[open] summary > span > span { display: inline-block; transform: rotate(180deg); }
.code-form { display: grid; gap: 12px; margin-top: 18px; }
.code-form label { font-size: 13px; font-weight: 600; }
.code-form .input { background: var(--surface); }
#code-error:empty { display: none; }
#code-error { font-size: 13px; }
.trust-line { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px 22px; color: var(--muted); font-size: 12px; margin-top: 42px; }
.trust-line span::before { content: '✓'; color: var(--ok); padding-right: 6px; }
.how-it-works { max-width: 440px; margin: 22px auto 0; color: var(--muted); font-size: 13px; }
.how-it-works summary { cursor: pointer; min-height: 44px; padding: 12px; border-radius: 6px; }
.how-it-works ol { text-align: left; padding-left: 24px; line-height: 1.6; }
.how-it-works li { padding: 6px 0; }
.how-it-works p { line-height: 1.6; text-align: left; margin-top: 12px; }
.site-footer { font-size: 12px; color: var(--muted); padding: 36px 0 12px; }

/* ------------------------------------------------------------ unsupported */
.info-card { padding: 24px; display: flex; flex-direction: column; gap: 20px; border-radius: var(--r-hero); }
.info-title { font-size: 14px; font-weight: 600; }
.browsers { display: flex; flex-wrap: wrap; gap: 12px; }
.bro {
  flex: 1 1 180px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
}
.bro b { display: block; font-size: 14px; line-height: 20px; }
.bro span:not(.bro-mark) { display: block; font-size: 12px; line-height: 16px; color: var(--muted); }
.bro-mark {
  width: 32px; height: 32px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 14px;
}
.qa { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; border-top: 1px solid var(--border); }
.qa > div { padding-top: 16px; }
.qa-q { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.qa-a { font-size: 13px; line-height: 1.5; color: var(--muted); }
.fatal-note { display: none; }
#unsupported.is-fatal .info-card { display: none; }
#unsupported.is-fatal .fatal-note { display: -webkit-box; font-family: var(--mono); font-size: 12px; }

/* --------------------------------------------------------- narrow (≤720px)
   Heights change once at the breakpoint, never per state. */
@media (max-width: 720px) {
  :root {
    --h-strip: 112px;
    --h-primary: 232px;
    --h-row: 72px;
    --h-actionbar: 104px;
    --w-state: 1fr;
  }
  .topbar-in { padding: 0 16px; }
  body[data-view] .tagline { display: none !important; }
  .stage { padding: 24px 16px 40px; }
  .strip {
    grid-template-columns: 24px minmax(0, 1fr);
    grid-template-rows: 40px 40px;
    align-content: center;
    row-gap: 8px;
    padding: 8px 16px 8px 14px;
  }
  .strip-slot { grid-column: 2; }
  .strip .dot { align-self: center; }
  .stage > .primary > .variant { padding: 16px; }
  .helper-right { display: none; }
  .kvs { grid-template-columns: 1fr 1fr; gap: 12px; }
  .kvs .kv:last-child { grid-column: 1 / -1; }
  .done-card { grid-template-columns: 48px minmax(0, 1fr) !important; gap: 12px 16px !important; }
  .done-actions { grid-column: 1 / -1; flex-direction: row; }
  .done-actions .btn { flex: 1 1 0; }
  .done-tile { width: 48px; height: 48px; }
  .done-headline { font-size: 18px; }
  .big { font-size: 22px; }
  #send-list .file .row-in {
    grid-template-columns: minmax(0, 1fr) 32px;
    grid-template-rows: var(--h-row);
    gap: 4px 12px;
    padding: 0 8px 0 16px;
  }
  #send-list .file .row-in > .meta { grid-column: 1; grid-row: 1; align-self: start; margin-top: 14px; }
  #send-list .file .row-in > .state { grid-column: 1; grid-row: 1; align-self: start; margin-top: 38px; }
  #send-list .file .row-in > .icon { grid-column: 2; grid-row: 1; }
  #recv-list .file .row-in { grid-template-columns: 18px minmax(0, 1fr); gap: 12px; padding: 0 16px; }
  #recv-list .file .row-in > .meta { grid-column: 2; grid-row: 1; align-self: start; margin-top: 14px; }
  #recv-list .file .row-in > .state { grid-column: 2; grid-row: 1; align-self: start; margin-top: 38px; }
  #recv-list .file .row-in > input { grid-column: 1; grid-row: 1; }
  .actionbar { flex-direction: column; align-items: stretch; justify-content: center; gap: 12px; }
  .cta-slot { width: 100%; justify-items: stretch; }
  .cta-slot .btn { width: 100%; }
  .listhead .tools .btn:last-child { display: none; }
  .qa { grid-template-columns: 1fr; }
  .home { padding: 40px 16px 0; gap: 28px; }
  .hero h1 { font-size: 30px; }
  .site-footer { margin: 0 -16px; }
}

/* --------------------------------------------------------- reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; }
  .btn:active:not(:disabled) { transform: none; }
  .dropzone, .dropzone[data-active] { transition: none !important; }
}

/* Simple sharing flow: content determines height so instructions stay readable. */
.topbar { border-bottom: 0; background: transparent; }
.topbar-in { max-width: 1120px; }
.brand { font-size: 19px; letter-spacing: -.04em; }
.brand-mark { width: 32px; height: 32px; }
.tagline { font-size: 12px; }
.btn { min-height: 44px; height: auto; padding-top: 12px; padding-bottom: 12px; }
.btn.sm { min-height: 44px; height: auto; }
.input, .input.lg { min-height: 48px; font-size: 16px; }
.btn:focus-visible, summary:focus-visible { outline-width: 3px; outline-offset: 4px; }
.stage { max-width: 740px; padding-top: 42px; gap: 24px; }
.heading { height: auto; min-height: 100px; gap: 12px; }
.heading h1 { font-size: 36px; line-height: 1.15; letter-spacing: -.045em; white-space: normal; overflow: visible; }
.heading .sub { font-size: 15px; line-height: 1.6; white-space: normal; overflow: visible; }
.stage > .primary { height: auto; min-height: 0; }
.stage > .primary > .variant { height: auto; min-height: 210px; padding: 28px; overflow: visible; border-radius: 22px; box-shadow: none; }
.stage > .primary > .variant:not([data-active]) { display: none !important; }
.stage > .primary > .variant[data-active] { transition: none; }
.stage > .primary { order: 1; }
.stage > .strip { order: 2; }
.stage > .listhead { order: 3; }
.stage > .files { order: 4; }
.stage > .actionbar { order: 5; }
.strip { height: auto; min-height: 84px; padding: 18px 20px; border-radius: 14px; box-shadow: none; background: transparent; gap: 12px; }
.strip .t, .strip .d { height: auto; white-space: normal; overflow: visible; }
.strip .d { line-height: 1.5; margin-top: 5px; }
.strip-layer:not(.is-on) { display: none; }
.strip-slot { height: auto; flex-wrap: wrap; }
.strip-slot:empty { display: none; }
.strip:has(.strip-slot:empty) { grid-template-columns: 20px minmax(0, 1fr); }
.sas { height: auto; min-height: 44px; }
.sas.is-empty { display: none; }
.dropzone { border: 1.5px dashed var(--border-strong) !important; min-height: 280px !important; background: var(--surface); gap: 16px !important; }
.dz-icon { width: 56px; height: 56px; border-radius: 16px; }
.dz-icon svg { width: 26px; height: 26px; }
.dz-title { font-size: 21px; line-height: 1.3; letter-spacing: -.02em; }
.dz-hint { font-size: 14px; }
#add-files { min-width: 160px; min-height: 48px; }
#add-folder { border-color: transparent; background: transparent; color: var(--muted); }
#share { gap: 18px; }
#share .label { font-size: 16px; color: var(--text); }
#share .input { background: var(--bg); }
#share-native { min-height: 52px; }
#share:has(#share-native:not([hidden])) #copy { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.helper-row { height: auto; flex-wrap: wrap; }
#expires { font-size: 12px; }
#send[data-phase="empty"] #send-status.tone-idle,
#send[data-phase="empty"] > .listhead,
#send[data-phase="empty"] > .files,
#send[data-phase="empty"] #new-share { display: none; }
#send[data-phase="empty"] #start-over { display: none; }
#send[data-phase="done"] #send-actions { display: none; }
#send-transfer .pc-big, #overall .pc-big { grid-template-columns: minmax(0, 1fr); gap: 12px; }
.big { font-size: 32px; }
.big > span:first-child { min-width: 0; }
.rate { font-size: 13px; color: var(--muted); }
.listhead { height: auto; min-height: 44px; flex-wrap: wrap; gap: 8px; padding: 0; }
.tools { margin: 0; }
.files { border-radius: 16px; box-shadow: none; }
.meta { flex-direction: column; align-items: flex-start; gap: 3px; }
.file .row-in { min-height: 80px; grid-template-rows: auto; padding-top: 16px !important; padding-bottom: 16px !important; }
#send-list .file .row-in { grid-template-columns: minmax(0, 1fr) 160px 44px; gap: 12px; }
.icon { width: 44px; height: 44px; }
#recv-list .file .row-in { grid-template-columns: 18px minmax(0, 1fr) 160px; }
#recv-list .file .row-in:has(.save-file:not([hidden])) { grid-template-columns: 18px minmax(0, 1fr) auto; }
#recv-list .file .row-in:has(.save-file:not([hidden])) > .state { display: none; }
.save-file { min-height: 44px; font-size: 13px; white-space: nowrap; }
.st { height: auto; min-height: 18px; line-height: 1.5; white-space: normal; }
.st-t { overflow-wrap: anywhere; }
.st-retry { min-height: 24px; }
.name { max-width: 100%; }
.actionbar { height: auto; min-height: 60px; align-items: flex-start; }
.foot { height: auto; overflow: visible; display: block; -webkit-line-clamp: unset; font-size: 13px; line-height: 1.6; }
#recv > .actionbar { flex-direction: column-reverse; align-items: stretch; padding-top: 4px; }
#recv-cta { width: 100%; }
#recv-cta > [data-active] { width: 100%; min-height: 56px; font-size: 16px; }
#recv-cta > :not([data-active]) { display: none; }
.download-actions { display: grid; gap: 12px; width: 100%; }
#folder-option { color: var(--muted); font-size: 13px; }
#folder-option summary { cursor: pointer; padding: 10px 0; }
#folder-option p { line-height: 1.6; margin: 4px 0 12px; }
#loading .heading { min-height: 0; }
#recv[data-phase="ready"] > .actionbar { order: 2; }
#recv[data-phase="waiting"] > .listhead, #recv[data-phase="waiting"] > .files { display: none; }
#selection .bar { display: none; }
#selection .kvs { grid-template-columns: 1fr 1fr; }
#selection .kv:last-child { display: none; }
#selection { min-height: 150px; }
#sel-hint { height: auto; white-space: normal; }
.done-card { grid-template-columns: 52px minmax(0, 1fr) !important; }
.done-actions { grid-column: 1 / -1; flex-direction: row; }
.done-text .trunc { white-space: normal; overflow: visible; }
.done-headline { font-size: 24px; }
#recv.portable #recv-done .done-actions { display: none; }
#recv.portable #recv-done .done-link { display: none; }
#recv.portable #recv-done { min-height: 150px; }
#recv.portable[data-phase="done"] .actionbar { order: 5; }
#recv.portable[data-phase="done"] #rd-headline { font-size: 20px; }
#recv.portable[data-phase="done"] #rd-detail { font-size: 14px; }
#recv.portable[data-phase="done"] .done-tile { background: var(--accent-soft); color: var(--accent); }
#recv-error .label { display: block; margin-bottom: 12px; }
#recv-error .input-row { align-items: start; }
.node-col { width: 80px; }
.conn-caption { line-height: 1.6; }
@media (max-width: 720px) {
  :root { --h-topbar: 68px; }
  .home { padding: 46px 24px 20px; }
  .hero { gap: 20px; }
  .hero h1 { font-size: 54px; }
  .hero .eyebrow { font-size: 9px; letter-spacing: .1em; }
  .hero-text { font-size: 16px; }
  .home-action { margin-top: 30px; }
  .send-hero { min-height: 60px; font-size: 17px; }
  .home-caption { font-size: 12px; }
  .receive-entry { margin-top: 26px; padding-top: 18px; }
  .receive-entry summary { font-size: 13px; }
  .trust-line { margin-top: 28px; gap: 8px 14px; font-size: 11px; }
  .how-it-works { margin-top: 14px; }
  .site-footer { padding-top: 26px; margin: 0; font-size: 11px; }
  .stage { padding: 28px 20px 36px; gap: 20px; }
  .heading { min-height: 0; padding-bottom: 4px; }
  .heading h1 { font-size: 30px; }
  .heading .sub { font-size: 14px; }
  .stage > .primary > .variant { padding: 22px; min-height: 180px; }
  .strip { grid-template-columns: 16px minmax(0, 1fr); grid-template-rows: auto; padding: 16px; row-gap: 12px; }
  .strip-slot { grid-column: 2; }
  .strip .dot { align-self: center; }
  .strip .t { font-size: 14px; }
  .sas { padding: 10px; }
  .sas b { font-size: 16px; }
  .helper-right { display: none; }
  .btn-row { flex-wrap: wrap; justify-content: center; }
  #share .input-row { grid-template-columns: minmax(0, 1fr); }
  #copy { width: 100%; min-height: 48px; }
  #share-link { font-size: 13px; }
  #send-list .file .row-in { grid-template-columns: minmax(0, 1fr) 44px; gap: 4px 12px; }
  #send-list .file .row-in > .meta { grid-column: 1; grid-row: 1; margin: 0; }
  #send-list .file .row-in > .state { grid-column: 1; grid-row: 2; margin: 0; }
  #send-list .file .row-in > .icon { grid-column: 2; grid-row: 1 / 3; }
  #recv-list .file .row-in { grid-template-columns: 18px minmax(0, 1fr); padding-left: 14px; padding-right: 14px; gap: 6px 12px; }
  #recv-list .file .row-in > .meta { grid-column: 2; grid-row: 1; margin: 0; }
  #recv-list .file .row-in > .state { grid-column: 2; grid-row: 2; margin: 0; }
  #recv-list .file .row-in > input { grid-column: 1; grid-row: 1 / 3; }
  #recv-list .file .row-in:has(.save-file:not([hidden])) { grid-template-columns: minmax(0, 1fr) auto; gap: 12px; }
  #recv-list .file .row-in:has(.save-file:not([hidden])) > input { display: none; }
  #recv-list .file .row-in:has(.save-file:not([hidden])) > .meta { grid-column: 1; }
  #recv-list .file .save-file { grid-column: 2; grid-row: 1; }
  .listhead .tools .btn:last-child { display: inline-flex; }
  #recv-error .input-row { grid-template-columns: 1fr; }
  .done-actions .btn { min-width: 0; white-space: normal; }
  .actionbar { min-height: 0; }
  .connection { padding: 22px !important; }
}
@media (max-width: 360px) {
  .home { padding-left: 20px; padding-right: 20px; }
  .hero h1 { font-size: 46px; }
  .receive-entry summary { flex-wrap: wrap; gap: 0 10px; }
  .code-form .input-row { grid-template-columns: 1fr; }
  .brand { font-size: 17px; }
  .code-pill { display: none !important; }
}
@media (prefers-color-scheme: dark) {
  :root { --accent: #8AABFF; --accent-hover: #A2BCFF; --accent-ink: #101B34; --accent-soft: #202D48; }
}
@media (prefers-reduced-motion: reduce) {
  .stage > .primary > .variant[data-active] { animation: none; }
}

@media (max-width: 720px) {
  body[data-view="send"] .topbar .pill, body[data-view="recv"] .topbar .pill:not(.code-pill) { display: none !important; }
  .topbar-right { flex: 0 1 auto; }
  #start-over { font-size: 12px; padding: 10px; }
  .hero h1 { font-size: 44px; }
  .hero h1 span { white-space: nowrap; }
  #send-list .file .row-in, #recv-list .file .row-in { grid-template-rows: auto auto; }
  #recv-list .file .row-in:has(.save-file:not([hidden])) { grid-template-rows: auto; }
  #expires { white-space: normal; overflow: visible; }
}
@media (max-width: 360px) { .hero h1 { font-size: 37px; } }
/* Once received, the file list itself is the final action. */
#recv.portable[data-phase="done"] > .primary,
#recv.portable[data-phase="done"] > .strip.tone-info,
#recv.portable[data-phase="done"] > .strip.tone-idle,
#recv.portable[data-phase="done"] > .strip.tone-ok { display: none; }

/* Optional live WebRTC evidence; the transfer's primary action stays prominent. */
.connection-details-host { order: 2; min-width: 0; }
.connection-details { border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.connection-details > summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; min-height: 52px; cursor: pointer; list-style: none; font-size: 13px; font-weight: 600; border-radius: 14px; }
.connection-details > summary::-webkit-details-marker { display: none; }
.connection-details > summary > span:first-child::before { content: '+'; margin-right: 10px; color: var(--muted); }
.connection-details[open] > summary > span:first-child::before { content: '−'; }
.connection-badge { color: var(--muted); font-size: 12px; font-weight: 500; text-align: right; }
.connection-details[data-connected="true"] .connection-badge { color: var(--ok); }
.connection-details-body { border-top: 1px solid var(--border); padding: 20px; font-size: 13px; line-height: 1.6; }
.connection-description { color: var(--muted); }
.connection-path { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 0; font-weight: 600; }
.connection-path > :nth-child(2) { color: var(--muted); }
.connection-details[data-connected="true"] .connection-path > :nth-child(2) { color: var(--ok); }
.connection-metrics { margin: 0; }
.connection-metrics > div { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 16px; padding: 9px 0; border-top: 1px solid var(--border); }
.connection-metrics dt { color: var(--muted); }
.connection-metrics dd { margin: 0; text-align: right; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.connection-endpoints, .connection-stamp { color: var(--muted); font-size: 12px; margin-top: 16px; }
.connection-verify { background: var(--accent-soft); padding: 16px; border-radius: 12px; margin: 20px 0; }
.connection-code { display: block; margin: 10px 0; font-size: 20px; letter-spacing: .06em; }
.connection-verify p { font-size: 12px; }
.connection-independent > summary { cursor: pointer; min-height: 44px; padding: 12px 0; }
.connection-independent p { margin: 8px 0; color: var(--muted); }
.connection-independent code { overflow-wrap: anywhere; }
@media (max-width: 400px) {
  .connection-details > summary { padding: 14px; gap: 8px; flex-wrap: wrap; }
  .connection-details-body { padding: 16px; }
  .connection-metrics > div { gap: 10px; }
}
