/* =========================================================
   LocalShare: modern glass UI (light + dark)
   ========================================================= */
:root {
  --bg: #f4f5fb;
  --surface: rgba(255, 255, 255, .72);
  --surface-solid: #ffffff;
  --surface-2: #eceef8;
  --surface-3: #e2e5f3;
  --text: #0b1020;
  --muted: #5b6380;
  --faint: #8b92ab;
  --border: rgba(15, 23, 60, .08);
  --border-strong: rgba(15, 23, 60, .14);
  --brand: #6366f1;
  --brand-2: #8b5cf6;
  --brand-3: #06b6d4;
  --grad: linear-gradient(135deg, #6366f1 0%, #8b5cf6 52%, #06b6d4 100%);
  --grad-soft: linear-gradient(135deg, rgba(99, 102, 241, .12), rgba(139, 92, 246, .1) 50%, rgba(6, 182, 212, .12));
  --on-brand: #ffffff;
  --ok: #059669;
  --ok-soft: rgba(16, 185, 129, .14);
  --danger: #e11d48;
  --danger-soft: rgba(225, 29, 72, .1);
  --warn: #d97706;
  --shadow-sm: 0 1px 2px rgba(20, 24, 60, .06);
  --shadow: 0 1px 2px rgba(20, 24, 60, .05), 0 8px 24px -6px rgba(20, 24, 60, .12);
  --shadow-lg: 0 24px 60px -18px rgba(79, 70, 229, .45);
  --orb-1: rgba(99, 102, 241, .32);
  --orb-2: rgba(6, 182, 212, .26);
  --orb-3: rgba(236, 72, 153, .16);
  --radius: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --gutter: 16px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #070a14;
    --surface: rgba(22, 27, 48, .66);
    --surface-solid: #121729;
    --surface-2: #1a2038;
    --surface-3: #232a47;
    --text: #eef0ff;
    --muted: #a0a8c8;
    --faint: #6f789c;
    --border: rgba(255, 255, 255, .08);
    --border-strong: rgba(255, 255, 255, .14);
    --brand: #818cf8;
    --grad-soft: linear-gradient(135deg, rgba(99, 102, 241, .22), rgba(139, 92, 246, .16) 50%, rgba(6, 182, 212, .18));
    --ok: #34d399;
    --ok-soft: rgba(52, 211, 153, .14);
    --danger: #fb7185;
    --danger-soft: rgba(251, 113, 133, .12);
    --warn: #fbbf24;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 10px 30px -8px rgba(0, 0, 0, .55);
    --shadow-lg: 0 24px 60px -18px rgba(99, 102, 241, .55);
    --orb-1: rgba(99, 102, 241, .35);
    --orb-2: rgba(6, 182, 212, .22);
    --orb-3: rgba(168, 85, 247, .22);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #070a14;
  --surface: rgba(22, 27, 48, .66);
  --surface-solid: #121729;
  --surface-2: #1a2038;
  --surface-3: #232a47;
  --text: #eef0ff;
  --muted: #a0a8c8;
  --faint: #6f789c;
  --border: rgba(255, 255, 255, .08);
  --border-strong: rgba(255, 255, 255, .14);
  --brand: #818cf8;
  --grad-soft: linear-gradient(135deg, rgba(99, 102, 241, .22), rgba(139, 92, 246, .16) 50%, rgba(6, 182, 212, .18));
  --ok: #34d399;
  --ok-soft: rgba(52, 211, 153, .14);
  --danger: #fb7185;
  --danger-soft: rgba(251, 113, 133, .12);
  --warn: #fbbf24;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 10px 30px -8px rgba(0, 0, 0, .55);
  --shadow-lg: 0 24px 60px -18px rgba(99, 102, 241, .55);
  --orb-1: rgba(99, 102, 241, .35);
  --orb-2: rgba(6, 182, 212, .22);
  --orb-3: rgba(168, 85, 247, .22);
  color-scheme: dark;
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 ui-sans-serif, system-ui, -apple-system, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; line-height: 1.15; letter-spacing: -0.022em; }
p { margin: 0; }
button, input, textarea { font: inherit; color: inherit; }
b { font-weight: 650; }

:where(.btn, .icon-btn, .choice-icon, .dz-icon, .dev, .f-icon, .text-send, .empty-icon, .big-check, .tr-icon, .avatar, .act, .scan-frame) svg {
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

/* background orbs */
.bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.orb { position: absolute; border-radius: 50%; filter: blur(70px); animation: drift 22s var(--ease) infinite alternate; }
.o1 { width: 520px; height: 520px; background: var(--orb-1); top: -220px; left: -160px; }
.o2 { width: 460px; height: 460px; background: var(--orb-2); top: 20%; right: -220px; animation-delay: -7s; }
.o3 { width: 420px; height: 420px; background: var(--orb-3); bottom: -200px; left: 20%; animation-delay: -13s; }
@keyframes drift { to { transform: translate3d(40px, 30px, 0) scale(1.08); } }

.glass {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: saturate(1.6) blur(18px);
  backdrop-filter: saturate(1.6) blur(18px);
}
.muted { color: var(--muted); }
.small { font-size: 14px; }
.hint { font-size: 14px; color: var(--muted); }
.hint.center { text-align: center; }
.kicker { display: block; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--brand); }
.grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(10px + var(--safe-top)) var(--gutter) 10px;
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  -webkit-backdrop-filter: saturate(1.6) blur(16px);
  backdrop-filter: saturate(1.6) blur(16px);
  border-bottom: 1px solid var(--border);
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; }
.brand-mark { width: 34px; height: 34px; border-radius: 11px; background: var(--grad); display: grid; place-items: center; box-shadow: 0 6px 16px -6px rgba(99, 102, 241, .7); }
.brand-mark svg { width: 22px; height: 22px; }
.brand-name { font-weight: 800; font-size: 18px; letter-spacing: -0.02em; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  height: 32px; padding: 0 12px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border);
  font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap;
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.dot.ok { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.dot.warn { background: var(--warn); box-shadow: 0 0 0 3px color-mix(in srgb, var(--warn) 22%, transparent); }

main { max-width: 1120px; margin: 0 auto; padding: 20px var(--gutter) calc(40px + var(--safe-bottom)); }
.screen { animation: rise .35s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 18px;
  border: 1px solid transparent; border-radius: 14px;
  background: var(--surface-2); color: var(--text);
  font-weight: 650; font-size: 15px; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .2s, transform .1s, box-shadow .2s, border-color .2s, color .2s;
  touch-action: manipulation;
}
.btn:active { transform: scale(.97); }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn-primary { background: var(--grad); color: var(--on-brand); box-shadow: 0 8px 20px -8px rgba(99, 102, 241, .8); background-size: 140% 140%; background-position: 0 0; }
.btn-primary:hover { background-position: 100% 100%; box-shadow: 0 10px 24px -8px rgba(99, 102, 241, .9); }
.btn-soft { background: var(--surface); border-color: var(--border); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.btn-soft:hover { border-color: var(--border-strong); background: var(--surface-solid); }
.btn-ghost { background: transparent; border-color: var(--border-strong); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-link { background: none; border: none; color: var(--brand); padding: 0 8px; min-height: 38px; }
.btn-link:hover { text-decoration: underline; }
.btn-sm { min-height: 38px; padding: 0 14px; font-size: 14px; border-radius: 12px; }
.btn-lg { min-height: 54px; font-size: 16px; width: 100%; border-radius: 16px; }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); border-color: transparent; }
.btn.light, .icon-btn.light { color: #fff; border-color: rgba(255, 255, 255, .35); background: rgba(0, 0, 0, .25); }
.btn:disabled { opacity: .5; cursor: default; }

.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none;
  border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  cursor: pointer; transition: background .2s, transform .1s;
}
.icon-btn:hover { background: var(--surface-solid); }
.icon-btn:active { transform: scale(.94); }
.icon-btn svg { width: 20px; height: 20px; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 50%, transparent); outline-offset: 2px; }

/* ---------- https notice ---------- */
.notice { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; margin-bottom: 18px; border-radius: var(--radius-md); background: color-mix(in srgb, var(--warn) 14%, var(--surface-solid)); border: 1px solid color-mix(in srgb, var(--warn) 45%, transparent); font-size: 14px; }
.notice div { display: grid; gap: 4px; min-width: 0; }
.notice b:first-child { font-size: 15px; }
.notice code { font-size: 13px; padding: 1px 6px; border-radius: 6px; background: var(--surface-2); word-break: break-all; }
.notice-icon { width: 26px; height: 26px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--warn); color: #fff; font-weight: 900; }

/* ---------- home ---------- */
.hero { padding: 16px 0 28px; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-radius: 999px; margin-bottom: 18px;
  background: var(--surface); border: 1px solid var(--border);
  font-size: 13px; font-weight: 600; color: var(--muted);
}
.pulse-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); position: relative; }
.pulse-dot::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--ok); animation: ping 1.8s var(--ease) infinite; }
@keyframes ping { 75%, 100% { transform: scale(2.6); opacity: 0; } }
.hero h1 { font-size: clamp(32px, 8.4vw, 60px); font-weight: 850; letter-spacing: -0.035em; }
.lead { margin-top: 14px; color: var(--muted); font-size: clamp(16px, 2.4vw, 19px); max-width: 600px; }

.device-strip { display: flex; align-items: center; gap: 6px; margin-top: 26px; max-width: 460px; }
.dev { display: grid; justify-items: center; gap: 4px; color: var(--text); flex: none; }
.dev svg { width: 46px; height: 46px; padding: 10px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm); stroke-width: 1.7; color: var(--brand); }
.dev small { font-size: 11px; font-weight: 600; color: var(--muted); }
.wave { flex: 1; display: flex; justify-content: space-evenly; align-items: center; height: 46px; align-self: flex-start; }
.wave i { width: 6px; height: 6px; border-radius: 50%; background: var(--grad); animation: hop 1.4s var(--ease) infinite; opacity: .3; }
.wave i:nth-child(2) { animation-delay: .2s; }
.wave i:nth-child(3) { animation-delay: .4s; }
@keyframes hop { 40% { opacity: 1; transform: scale(1.5); } }

.choice-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.choice {
  position: relative; overflow: hidden;
  display: flex; align-items: center; gap: 16px; text-align: left;
  padding: 20px; min-height: 96px;
  border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--surface); box-shadow: var(--shadow); cursor: pointer;
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
  transition: transform .25s var(--ease), box-shadow .25s, border-color .25s;
}
.choice:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.choice:active { transform: scale(.985); }
.choice-start { background: var(--grad); color: #fff; border-color: transparent; box-shadow: var(--shadow-lg); }
.choice-start .choice-sub { color: rgba(255, 255, 255, .82); }
.choice-start .choice-icon { background: rgba(255, 255, 255, .2); color: #fff; }
.choice-start .choice-arrow { background: rgba(255, 255, 255, .2); color: #fff; }
.choice-rings { position: absolute; right: -60px; top: 50%; width: 220px; height: 220px; transform: translateY(-50%); pointer-events: none; }
.choice-rings i { position: absolute; inset: 0; border-radius: 50%; border: 1.5px solid rgba(255, 255, 255, .35); animation: ripple 3.6s var(--ease) infinite; opacity: 0; }
.choice-rings i:nth-child(2) { animation-delay: 1.2s; }
.choice-rings i:nth-child(3) { animation-delay: 2.4s; }
@keyframes ripple { 0% { transform: scale(.3); opacity: .9; } 100% { transform: scale(1); opacity: 0; } }
.choice-icon { position: relative; display: grid; place-items: center; width: 52px; height: 52px; flex: none; border-radius: 16px; background: var(--grad-soft); color: var(--brand); }
.choice-icon svg { width: 26px; height: 26px; }
.choice-text { position: relative; display: grid; gap: 2px; flex: 1; min-width: 0; }
.choice-title { font-size: 21px; font-weight: 800; letter-spacing: -0.02em; }
.choice-sub { font-size: 14px; color: var(--muted); }
.choice-arrow { position: relative; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--surface-2); color: var(--muted); font-weight: 700; flex: none; transition: transform .25s var(--ease); }
.choice:hover .choice-arrow { transform: translateX(3px); }

.tip { margin: 14px 4px 0; font-size: 14px; color: var(--muted); }
.tip:empty { display: none; }

.section-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); margin: 36px 4px 12px; }
.steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.steps li { display: grid; grid-template-columns: auto 1fr; column-gap: 14px; row-gap: 2px; padding: 16px; border-radius: var(--radius-md); }
.steps li b { font-size: 16px; }
.steps li span:last-child { grid-column: 2; color: var(--muted); font-size: 14px; }
.step-num { grid-row: span 2; width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; background: var(--grad); color: #fff; font-weight: 800; font-size: 15px; }

.features { display: grid; gap: 10px; margin-top: 10px; }
.feature { display: flex; gap: 14px; align-items: center; padding: 14px 16px; border-radius: var(--radius-md); border: 1px dashed var(--border-strong); }
.feature div { display: grid; }
.feature span:not(.f-icon) { font-size: 14px; color: var(--muted); }
.f-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.f-icon svg { width: 20px; height: 20px; }
.f1 { background: rgba(6, 182, 212, .14); color: #0891b2; }
.f2 { background: rgba(16, 185, 129, .14); color: var(--ok); }
.f3 { background: rgba(245, 158, 11, .16); color: #d97706; }

.settings { margin-top: 24px; padding: 0; border-radius: var(--radius-md); }
.settings summary { padding: 16px 18px; cursor: pointer; font-weight: 650; list-style: none; display: flex; justify-content: space-between; align-items: center; }
.settings summary::after { content: ""; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .2s; margin-right: 4px; }
.settings[open] summary::after { transform: rotate(225deg); }
.settings summary::-webkit-details-marker { display: none; }
.settings > :not(summary) { margin: 0 18px 18px; }
.field { display: grid; gap: 6px; font-size: 14px; font-weight: 600; color: var(--muted); }
.field input, textarea {
  width: 100%; min-height: 46px; padding: 10px 14px;
  border: 1px solid var(--border-strong); border-radius: 14px; background: var(--surface-solid); color: var(--text);
  font-size: 16px; font-weight: 500; transition: border-color .2s, box-shadow .2s;
}
.field input:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 18%, transparent); }
.help { padding-left: 18px; display: grid; gap: 8px; font-size: 14px; color: var(--muted); }
.help b { color: var(--text); }

/* ---------- host / join ---------- */
.screen-head { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.screen-head h2 { font-size: 24px; font-weight: 800; }
.qr-layout { display: grid; gap: 18px; }
.qr-col { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.qr-frame { position: relative; padding: 4px; border-radius: 28px; background: var(--grad); box-shadow: var(--shadow-lg); }
.radar { position: absolute; inset: 0; pointer-events: none; }
.radar i { position: absolute; inset: 0; border-radius: 28px; border: 2px solid var(--brand); animation: radar 2.6s var(--ease) infinite; opacity: 0; }
.radar i:nth-child(2) { animation-delay: 1.3s; }
@keyframes radar { 0% { transform: scale(1); opacity: .6; } 100% { transform: scale(1.12); opacity: 0; } }
.qr-box { position: relative; width: min(78vw, 340px); aspect-ratio: 1; display: grid; place-items: center; background: #fff; border-radius: 24px; padding: 12px; }
.qr-box svg { width: 100%; height: 100%; display: block; }
.qr-caption { color: var(--muted); font-size: 15px; max-width: 340px; }
.panel { padding: 20px; display: grid; gap: 12px; align-content: start; }
.panel h3 { font-size: 20px; font-weight: 800; }
.status { display: flex; align-items: center; gap: 10px; padding: 13px 15px; border-radius: 14px; background: var(--surface-2); font-size: 15px; font-weight: 600; }
.status.ok { background: var(--ok-soft); color: var(--ok); }
.status.err { background: var(--danger-soft); color: var(--danger); }

.spinner { width: 38px; height: 38px; border-radius: 50%; border: 3px solid rgba(99, 102, 241, .18); border-top-color: var(--brand); animation: spin .8s linear infinite; }
.spinner.sm { width: 18px; height: 18px; border-width: 2.5px; flex: none; }
.qr-box .spinner { border-color: #e4e6f5; border-top-color: #6366f1; }
@keyframes spin { to { transform: rotate(360deg); } }

.center-msg { display: grid; justify-items: center; text-align: center; gap: 14px; padding: 40px 24px; max-width: 480px; margin: 24px auto 0; }
.center-msg p { color: var(--muted); }
.big-check { width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center; background: var(--ok-soft); color: var(--ok); }
.big-check svg { width: 38px; height: 38px; stroke-width: 2.6; }

/* ---------- share: connection card ---------- */
.conn { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px 6px; padding: 18px 16px 14px; margin-bottom: 16px; }
.conn-dev { display: grid; justify-items: center; gap: 8px; min-width: 0; }
.avatar { width: 56px; height: 56px; border-radius: 18px; display: grid; place-items: center; }
.avatar svg { width: 28px; height: 28px; stroke-width: 1.8; }
.avatar.me { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.avatar.peer { background: var(--grad); color: #fff; box-shadow: 0 10px 22px -10px rgba(99, 102, 241, .9); }
.conn-name { font-weight: 700; font-size: 14px; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.beam { position: relative; width: clamp(70px, 26vw, 200px); height: 56px; align-self: start; }
.beam-line { position: absolute; left: 0; right: 0; top: 50%; height: 2px; transform: translateY(-50%); background: repeating-linear-gradient(90deg, var(--border-strong) 0 6px, transparent 6px 12px); }
.beam i { position: absolute; top: 50%; left: 0; width: 8px; height: 8px; margin-top: -4px; border-radius: 50%; background: var(--grad); opacity: 0; box-shadow: 0 0 10px rgba(99, 102, 241, .8); }
.conn.flow-out .beam i, .conn.flow-in .beam i { animation: travel 1.2s linear infinite; }
.conn.flow-in .beam i { animation-direction: reverse; }
.beam i:nth-child(3) { animation-delay: .4s !important; }
.beam i:nth-child(4) { animation-delay: .8s !important; }
@keyframes travel { 0% { left: 0; opacity: 0; } 15% { opacity: 1; } 85% { opacity: 1; } 100% { left: calc(100% - 8px); opacity: 0; } }
.conn-foot { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 12px; margin-top: 4px; border-top: 1px solid var(--border); }
.conn-route { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--muted); min-width: 0; }
.conn-route span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- share: send column ---------- */
.share-layout { display: grid; gap: 18px; }
.send-col { display: grid; gap: 12px; align-content: start; }
.dropzone {
  position: relative; isolation: isolate;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center;
  min-height: 190px; padding: 22px; cursor: pointer; border-radius: var(--radius);
  background: var(--surface); color: var(--text);
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
  transition: transform .2s var(--ease), box-shadow .2s;
}
.dropzone::before {
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; padding: 2px;
  background: var(--grad);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude; opacity: .55; transition: opacity .2s;
}
.dropzone::after { content: ""; position: absolute; inset: 0; z-index: -2; border-radius: inherit; background: var(--grad-soft); }
.dropzone:hover::before, .dropzone.drag::before { opacity: 1; }
.dropzone:hover { box-shadow: var(--shadow-lg); }
.dropzone.drag { transform: scale(1.015); }
.dropzone.disabled { opacity: .45; pointer-events: none; }
.dz-icon { width: 64px; height: 64px; border-radius: 22px; display: grid; place-items: center; background: var(--grad); color: #fff; margin-bottom: 8px; box-shadow: 0 12px 26px -10px rgba(99, 102, 241, .9); transition: transform .3s var(--ease); }
.dropzone:hover .dz-icon { transform: translateY(-3px); }
.dz-icon svg { width: 30px; height: 30px; }
.dz-title { font-weight: 800; font-size: 19px; letter-spacing: -0.01em; }
.dz-sub { font-size: 14px; color: var(--muted); }
.desktop-only { display: none; }
@media (hover: hover) and (pointer: fine) { .desktop-only { display: inline; } }

.text-send { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 16px; border-radius: 18px; }
.text-send > svg { width: 20px; height: 20px; color: var(--faint); flex: none; }
.text-send input { flex: 1; min-width: 0; min-height: 44px; border: none; background: transparent; font-size: 16px; }
.text-send input:focus { outline: none; }
.text-send .btn { width: 44px; height: 44px; padding: 0; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { display: grid; gap: 2px; padding: 12px 14px; border-radius: var(--radius-md); min-width: 0; }
.stat-label { font-size: 11px; font-weight: 700; color: var(--faint); text-transform: uppercase; letter-spacing: .07em; }
.stat-val { font-weight: 800; font-size: 17px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.speed-btn { width: 100%; }
.speed-btn svg { color: #d97706; }

/* ---------- share: activity column ---------- */
.list-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; min-height: 38px; }
.list-head h3 { font-size: 20px; font-weight: 800; }
.list-actions { display: flex; gap: 6px; align-items: center; }

.tabs { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); padding: 4px; margin-bottom: 14px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--border); }
.tab-ind { position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc((100% - 8px) / 3); border-radius: 12px; background: var(--surface-solid); box-shadow: var(--shadow-sm), 0 2px 8px -2px rgba(20, 24, 60, .15); transition: transform .3s var(--ease); }
.tabs[data-active="out"] .tab-ind { transform: translateX(100%); }
.tabs[data-active="in"] .tab-ind { transform: translateX(200%); }
.tab { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 6px; border: none; background: none; border-radius: 12px; cursor: pointer; font-size: 14px; font-weight: 650; color: var(--muted); transition: color .2s; }
.tab[aria-selected="true"] { color: var(--text); }
.count { min-width: 22px; height: 20px; padding: 0 6px; border-radius: 999px; display: inline-grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--surface-3); color: var(--muted); font-variant-numeric: tabular-nums; }
.tab[aria-selected="true"] .count { background: var(--grad); color: #fff; }

.batches { display: grid; gap: 10px; margin-bottom: 10px; }
.batches:empty { display: none; }
.batch { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: var(--radius-md); background: var(--grad-soft); border: 1px solid var(--border); }
.ring { width: 52px; height: 52px; flex: none; position: relative; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 5; }
.ring .track { stroke: var(--surface-3); }
.ring .fill { stroke-linecap: round; transition: stroke-dashoffset .4s var(--ease); }
.ring b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 12px; font-weight: 800; font-variant-numeric: tabular-nums; }
.batch-main { flex: 1; min-width: 0; display: grid; gap: 1px; }
.batch-title { font-weight: 750; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.batch-sub { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.batch.done .batch-title { color: var(--ok); }
.batch.cancelled { background: var(--danger-soft); }
.batch.cancelled .batch-title, .batch.cancelled .ring b { color: var(--danger); }

.transfers { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.tr {
  display: grid; grid-template-columns: 52px 1fr auto; gap: 14px; align-items: center;
  padding: 12px 12px 12px 12px; border-radius: var(--radius-md);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  animation: rise .3s var(--ease);
  transition: opacity .3s;
}
.tr.is-cancelled, .tr.is-error { opacity: .62; }
.tr-icon { width: 52px; height: 52px; border-radius: 15px; display: grid; place-items: center; overflow: hidden; position: relative; }
.tr-icon > svg { width: 24px; height: 24px; }
.tr-icon img { width: 100%; height: 100%; object-fit: cover; }
.k-image { background: rgba(236, 72, 153, .14); color: #db2777; }
.k-video { background: rgba(139, 92, 246, .16); color: #7c3aed; }
.k-audio { background: rgba(245, 158, 11, .16); color: #d97706; }
.k-doc { background: rgba(59, 130, 246, .14); color: #2563eb; }
.k-pdf { background: rgba(239, 68, 68, .14); color: #dc2626; }
.k-sheet { background: rgba(16, 185, 129, .14); color: #059669; }
.k-archive { background: rgba(120, 113, 108, .16); color: #78716c; }
.k-app { background: rgba(132, 204, 22, .16); color: #65a30d; }
.k-speed { background: rgba(250, 204, 21, .18); color: #ca8a04; }
.k-text { background: rgba(6, 182, 212, .14); color: #0891b2; }
.k-file { background: var(--surface-2); color: var(--muted); }
.dir-badge { position: absolute; right: 3px; bottom: 3px; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-solid); box-shadow: var(--shadow-sm); }
.dir-badge svg { width: 12px; height: 12px; stroke-width: 3; }
.dir-badge.out { color: var(--brand); }
.dir-badge.in { color: var(--ok); }
.tr-main { min-width: 0; display: grid; gap: 4px; }
.tr-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.tr-name { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1; }
.tr-text { white-space: pre-wrap; word-break: break-word; font-weight: 550; }
.badge { flex: none; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 750; letter-spacing: .02em; background: var(--surface-2); color: var(--muted); font-variant-numeric: tabular-nums; }
.badge.active { background: color-mix(in srgb, var(--brand) 16%, transparent); color: var(--brand); }
.badge.done { background: var(--ok-soft); color: var(--ok); }
.badge.cancelled, .badge.error { background: var(--danger-soft); color: var(--danger); }
.tr-meta { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar { position: relative; height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.bar > i { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--grad); border-radius: 3px; transition: width .3s linear; overflow: hidden; }
.tr.is-active .bar > i::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .55), transparent); transform: translateX(-100%); animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }
.tr-actions { display: flex; gap: 6px; }
.act { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; border: 1px solid var(--border-strong); background: var(--surface-solid); color: var(--text); cursor: pointer; transition: background .2s, transform .1s, color .2s; }
.act:active { transform: scale(.92); }
.act svg { width: 18px; height: 18px; }
.act:hover { background: var(--surface-2); }
.act.primary { background: var(--grad); color: #fff; border-color: transparent; box-shadow: 0 6px 14px -6px rgba(99, 102, 241, .9); }
.act.cancel:hover { color: var(--danger); background: var(--danger-soft); }

.empty { display: grid; justify-items: center; gap: 4px; text-align: center; padding: 40px 16px; border: 1.5px dashed var(--border-strong); border-radius: var(--radius); }
.empty p:first-of-type { font-weight: 700; }
.empty-icon { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: var(--grad-soft); color: var(--brand); margin-bottom: 8px; }
.empty-icon svg { width: 24px; height: 24px; }

/* ---------- dialogs ---------- */
dialog { border: none; padding: 0; color: var(--text); }
dialog::backdrop { background: rgba(5, 8, 20, .55); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.scanner { width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; background: #000; }
.scanner-inner { position: relative; width: 100%; height: 100%; }
.scanner video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scan-frame { position: absolute; left: 50%; top: 50%; width: min(70vw, 300px); aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 28px; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .5); border: 3px solid rgba(255, 255, 255, .95); overflow: hidden; }
.scan-line { position: absolute; left: 8%; right: 8%; height: 3px; border-radius: 3px; background: linear-gradient(90deg, transparent, #22d3ee, #a78bfa, transparent); box-shadow: 0 0 14px #22d3ee; animation: scan 2s var(--ease) infinite alternate; }
@keyframes scan { from { top: 8%; } to { top: 92%; } }
.scanner-top, .scanner-bottom { position: absolute; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px; color: #fff; }
.scanner-top { top: 0; padding-top: calc(16px + var(--safe-top)); font-weight: 750; font-size: 18px; }
.scanner-bottom { bottom: 0; flex-direction: column; padding-bottom: calc(28px + var(--safe-bottom)); text-align: center; }

.sheet { width: min(100vw - 32px, 480px); border-radius: 24px; background: var(--surface-solid); box-shadow: var(--shadow); border: 1px solid var(--border); }
.sheet[open] { animation: rise .25s var(--ease); }
.sheet form { padding: 22px; display: grid; gap: 12px; }
.sheet h3 { font-size: 20px; font-weight: 800; }
.sheet textarea { resize: vertical; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 14px; }
.sheet-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* ---------- toasts ---------- */
.toasts { position: fixed; left: 50%; bottom: calc(18px + var(--safe-bottom)); transform: translateX(-50%); z-index: 50; display: grid; gap: 8px; width: min(100vw - 32px, 420px); pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; background: color-mix(in srgb, var(--text) 92%, transparent); color: var(--bg); padding: 13px 16px; border-radius: 16px; box-shadow: var(--shadow); font-size: 15px; font-weight: 550; animation: rise .25s var(--ease); pointer-events: auto; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.toast::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; }
.toast.err { background: var(--danger); color: #fff; }
.toast.err::before { background: #fff; }

/* ---------- responsive ---------- */
@media (max-width: 380px) {
  .choice { padding: 16px; gap: 12px; }
  .choice-icon { width: 46px; height: 46px; }
  .choice-title { font-size: 19px; }
  .stat { padding: 10px; }
  .stat-val { font-size: 15px; }
  .tr { grid-template-columns: 44px 1fr auto; gap: 10px; padding: 10px; }
  .tr-icon { width: 44px; height: 44px; border-radius: 13px; }
  .act { width: 36px; height: 36px; }
  .tab { font-size: 13px; }
}

@media (min-width: 640px) {
  .choice-grid { grid-template-columns: 1fr 1fr; }
  .choice { flex-direction: column; align-items: flex-start; min-height: 200px; padding: 24px; }
  .choice-text { margin-top: auto; }
  .choice-title { font-size: 26px; }
  .choice-arrow { position: absolute; right: 22px; top: 22px; }
  .steps, .features { grid-template-columns: repeat(3, 1fr); }
  .steps li { grid-template-columns: 1fr; padding: 20px; }
  .steps li span:last-child { grid-column: 1; }
  .step-num { grid-row: auto; margin-bottom: 10px; }
  .feature { flex-direction: column; align-items: flex-start; }
}

@media (min-width: 820px) {
  main { padding-top: 36px; }
  .hero { padding: 28px 0 40px; }
  .qr-layout { grid-template-columns: auto 1fr; align-items: start; gap: 28px; }
  .qr-box { width: 340px; }
  .settings { max-width: 680px; }
}

@media (min-width: 980px) {
  .share-layout { grid-template-columns: 380px 1fr; align-items: start; gap: 24px; }
  .send-col { position: sticky; top: 84px; }
  .dropzone { min-height: 250px; }
  .conn { grid-template-columns: auto auto auto 1fr; padding: 14px 18px; gap: 14px; }
  .conn-dev { grid-auto-flow: column; align-items: center; justify-items: start; gap: 12px; }
  .avatar { width: 46px; height: 46px; border-radius: 14px; }
  .avatar svg { width: 24px; height: 24px; }
  .beam { height: 46px; width: 160px; align-self: center; }
  .conn-foot { grid-column: auto; border: none; margin: 0; padding: 0; justify-content: flex-end; gap: 16px; }
}

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