:root {
  color-scheme: light;
  --paper: #f8f7fb;
  --ink: #292535;
  --muted: #625a6d;
  --accent: #7960ad;
  --line: #ddd7e6;
  --surface: #fff;
  --soft: #efebf6;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC", sans-serif;
  color: var(--ink);
  background: var(--paper);
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; padding: 0 24px; line-height: 1.6; -webkit-font-smoothing: antialiased; }
.masthead, main { width: min(100%, 976px); margin-inline: auto; }
.masthead { display: flex; align-items: center; justify-content: space-between; min-height: 76px; border-bottom: 1px solid var(--line); }
.brand { font-size: 20px; font-weight: 730; letter-spacing: -.055em; }
main { padding-bottom: max(56px, env(safe-area-inset-bottom)); }
h1, h2, p { margin: 0; }
.intro { display: grid; grid-template-columns: minmax(0, 3fr) minmax(200px, 2fr); align-items: center; gap: 36px; padding: clamp(36px, 8vw, 88px) 0; }
h1 { font-size: clamp(40px, 6.3vw, 70px); line-height: 1.12; letter-spacing: -.055em; text-wrap: balance; }
.lead { margin-top: 18px; font-size: clamp(18px, 2.1vw, 23px); line-height: 1.5; }
.guide, .panel > p, .invite p { color: var(--muted); }
.guide { margin-top: 8px; font-size: 15px; }
#start { margin-top: 23px; }
button, input, textarea { font: inherit; color: inherit; }
button { border: 1px solid var(--line); border-radius: 12px; padding: 9px 16px; min-height: 44px; background: var(--surface); font-size: 14px; font-weight: 590; line-height: 1.4; cursor: pointer; }
button.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
button.quiet { background: transparent; color: var(--muted); min-height: 40px; }
button:enabled:hover { border-color: var(--accent); color: var(--accent); }
button.primary:enabled:hover { background: #493a61; color: #fff; }
button:disabled { opacity: .58; cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.status { color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.status:not(:empty) { margin-top: 14px; }
.device-art { position: relative; width: min(100%, 330px); aspect-ratio: 1.64; justify-self: end; isolation: isolate; }
.computer, .phone { position: absolute; border: 2px solid #746581; background: #f5f1f8; box-shadow: 0 10px 20px -14px #655174; }
.computer { left: 4%; top: 12%; width: 74%; height: 68%; border-radius: 14px; padding: 7px; transform: rotate(-5deg); }
.computer::after { position: absolute; content: ""; bottom: -10px; left: -6%; width: 112%; height: 7px; border-radius: 2px 2px 8px 8px; background: #746581; }
.computer-screen, .phone-screen { height: 100%; display: grid; align-content: center; gap: 8px; border-radius: 8px; padding: 0 16%; background: #e7e0f0; }
.device-art i { display: block; }
.computer-screen i, .phone-screen i { height: 5px; width: 76%; border-radius: 8px; background: #c1afcf; }
.computer-screen i:nth-child(2), .phone-screen i:nth-child(2) { width: 92%; }
.computer-screen i:last-child, .phone-screen i:last-child { width: 52%; }
.phone { left: 67%; top: 36%; width: 23%; height: 65%; border-radius: 13px; padding: 5px; transform: rotate(6deg); }
.phone-screen { background: #dbd1e7; gap: 5px; }
.phone-screen i { height: 3px; background: #a893bb; }
.connection { position: absolute; top: 63%; left: 60%; display: flex; align-items: center; gap: 4px; padding: 7px; border-radius: 30px; background: #fff; box-shadow: 0 2px 8px #4a3d5626; }
.connection i { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
body:has(:is(#invite,#verify,#workspace):not([hidden])) .device-art { display: none; }
body:has(:is(#invite,#verify,#workspace):not([hidden])) .intro { display: block; padding-block: 30px; }
body:has(:is(#invite,#verify,#workspace):not([hidden])) h1 { font-size: clamp(34px, 4vw, 48px); }
body:has(#workspace:not([hidden])) :is(.guide,.lead) { display: none; }
.panel { min-width: 0; padding: clamp(18px, 3.2vw, 32px); border: 1px solid var(--line); border-radius: 22px; background: var(--surface); }
h2 { font-size: clamp(21px, 2.5vw, 28px); line-height: 1.3; letter-spacing: -.035em; }
h2 + p { margin-top: 8px; }
.invite { display: grid; grid-template-columns: minmax(132px, 205px) minmax(0,1fr); gap: clamp(18px, 4.5vw, 44px); align-items: center; }
.qr-frame { width: 100%; max-width: 205px; min-width: 0; justify-self: center; }
#qr { display: block; width: 100%; height: auto; aspect-ratio: 1; image-rendering: pixelated; background: white; }
label { display: block; margin: 18px 0 6px; font-size: 14px; font-weight: 600; }
.link-row, .actions { display: flex; gap: 8px; }
.link-row { flex-wrap: wrap; }
.link-row input { flex: 1 1 150px; width: 0; }
input[type=text], textarea { border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; min-width: 0; color: var(--ink); background: var(--paper); font-size: 16px; }
textarea { display: block; width: 100%; min-height: 120px; resize: vertical; }
#code { margin: 18px 0; font: 650 clamp(36px, 6vw, 58px)/1.2 ui-monospace, monospace; letter-spacing: .13em; color: var(--ink); }
.workspace { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.actions { margin-top: 12px; flex-wrap: wrap; }
.retention, #empty { font-size: 14px; }
#empty { margin-top: 22px; padding: 18px 12px; border-radius: 10px; background: var(--paper); text-align: center; }
#inbox article { border-top: 1px solid var(--line); padding: 16px 0 2px; margin-top: 16px; min-width: 0; overflow-wrap: anywhere; }
#inbox strong { font-size: 15px; }
#inbox pre { margin: 8px 0 0; padding: 10px 12px; border-radius: 8px; background: var(--paper); max-height: 12rem; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; }
@media (max-width: 640px) {
  body { padding-inline: max(16px, env(safe-area-inset-left)) max(16px, env(safe-area-inset-right)); }
  .masthead { min-height: 64px; }
  .intro { grid-template-columns: minmax(0,1fr); gap: 0; padding-block: 32px; }
  .device-art { justify-self: center; width: min(63%, 205px); margin-top: 25px; }
  .workspace, .invite { grid-template-columns: minmax(0,1fr); }
  .panel { border-radius: 16px; }
}

:root { --flow-receive: #356b69; --flow-success: #37735a; }
.transfer-motion { --flow-color: var(--accent); margin-top: 18px; border: 1px solid var(--line); border-radius: 14px; padding: 13px 14px 10px; background: var(--paper); }
.transfer-motion[data-direction='receive'] { --flow-color: var(--flow-receive); }
.transfer-route { display: flex; gap: 8px; align-items: flex-start; color: var(--flow-color); }
.transfer-motion[data-direction='receive'] .transfer-route { flex-direction: row-reverse; }
.route-device { display: grid; justify-items: center; gap: 3px; min-width: 29px; }
.route-device > i { display: block; position: relative; width: 22px; height: 16px; border: 1.6px solid currentColor; border-radius: 4px; background: var(--surface); }
.route-device > i::after { content: ''; position: absolute; left: 6px; right: 6px; bottom: -4px; height: 1.5px; border-radius: 1px; background: currentColor; }
.route-device small { margin-top: 3px; font-size: 11px; font-weight: 550; color: var(--muted); }
.route-track { display: flex; align-items: center; position: relative; flex: 1; height: 2px; margin-top: 8px; border-radius: 2px; background: var(--line); }
.transfer-motion[data-direction='receive'] .route-track { transform: scaleX(-1); }
.traveller { display: none; position: absolute; width: 12px; height: 5px; margin-left: -6px; border-radius: 4px; background: currentColor; }
.transfer-motion[data-phase='active'] .traveller { display: block; animation: transfer-travel 1.2s ease-in-out infinite; }
.transfer-motion[data-phase='waiting'] .destination > i { animation: transfer-wait 1.2s ease-in-out infinite alternate; }
.transfer-motion[data-phase='complete'] { --flow-color: var(--flow-success); }
.transfer-motion[data-phase='complete'] .route-track { background: var(--flow-success); }
.transfer-motion[data-phase='complete'] .destination > i { display: grid; place-items: center; border-color: var(--flow-success); background: var(--flow-success); border-radius: 50%; width: 19px; height: 19px; margin-top: -2px; margin-bottom: -1px; animation: transfer-arrive .35s ease-out both; }
.transfer-motion[data-phase='complete'] .destination > i::after { position: static; width: 8px; height: 5px; border-left: 2px solid white; border-bottom: 2px solid white; background: transparent; border-radius: 0; transform: translateY(-1px) rotate(-45deg); }
.transfer-motion progress { display: block; width: 100%; height: 3px; margin-top: 9px; accent-color: var(--flow-color); appearance: none; border: 0; border-radius: 2px; background: var(--line); overflow: hidden; }
.transfer-motion progress::-webkit-progress-bar { background: var(--line); }
.transfer-motion progress::-webkit-progress-value { background: var(--flow-color); transition: width .15s linear; }
.transfer-motion progress::-moz-progress-bar { background: var(--flow-color); }
.transfer-caption { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.transfer-caption > span { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
#inbox article { animation: transfer-entry .32s ease-out both; }
@keyframes transfer-travel { 0% { left: 0; opacity: 0; } 12%, 82% { opacity: 1; } 100% { left: 100%; opacity: 0; } }
@keyframes transfer-wait { from { opacity: .55; } to { opacity: 1; } }
@keyframes transfer-arrive { from { opacity: .4; transform: scale(.8); } to { opacity: 1; transform: scale(1); } }
@keyframes transfer-entry { from { opacity: .2; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) {
  .transfer-motion *, #inbox article { animation: none !important; transition: none !important; }
  .transfer-motion progress::-webkit-progress-value { transition: none; }
  .transfer-motion[data-phase='active'] .traveller { left: 50%; }
}
@media (prefers-color-scheme: dark) {
  :root { color-scheme: dark; --paper: #19171e; --ink: #efecf5; --muted: #b9b2c5; --accent: #c1a4f0; --line: #433e4c; --surface: #25222c; --soft: #302a3a; --flow-success: #70b097; --flow-receive: #79bab7; }
  button.primary { color: #241b34; background: var(--accent); border-color: var(--accent); }
  button.primary:enabled:hover { color: #20172b; background: #d1b9f6; }
  .transfer-motion[data-phase='complete'] .destination > i::after { border-color: #15241f; }
}
