:root {
  color-scheme: light dark;
  --bg: #f4f3ef;
  --surface: #ffffff;
  --surface-2: #efeee9;
  --fg: #19191a;
  --muted: #74736c;
  --faint: #a9a8a1;
  --line: rgba(20, 20, 20, 0.08);
  --accent: #2b5cff;
  --accent-2: #6d8bff;
  --accent-fg: #ffffff;
  --ok: #138a4f;
  --ok-soft: #e3f3ea;
  --warn: #a35a00;
  --warn-soft: #fbefdc;
  --bad: #c2382d;
  --bad-soft: #fbe8e5;
  --r: 22px;
  --shadow: 0 1px 1px rgba(0, 0, 0, 0.03), 0 10px 30px rgba(20, 20, 30, 0.07);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0f10;
    --surface: #1a1a1c;
    --surface-2: #242427;
    --fg: #f1f0ec;
    --muted: #9c9b95;
    --faint: #66655f;
    --line: rgba(255, 255, 255, 0.07);
    --accent: #7393ff;
    --accent-2: #a3b6ff;
    --accent-fg: #0b0f1f;
    --ok: #5fd394;
    --ok-soft: rgba(95, 211, 148, 0.13);
    --warn: #f1b46a;
    --warn-soft: rgba(241, 180, 106, 0.13);
    --bad: #ff8b80;
    --bad-soft: rgba(255, 139, 128, 0.13);
    --shadow: 0 0 0 1px rgba(255, 255, 255, 0.04);
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  padding: env(safe-area-inset-top) max(16px, env(safe-area-inset-right)) calc(40px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}
main, .top { max-width: 520px; margin: 0 auto; }
a { color: var(--accent); text-decoration: none; }

/* header */
.top { display: flex; align-items: center; justify-content: space-between; padding: 18px 2px 6px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; letter-spacing: -0.01em; }
.mark { width: 32px; height: 32px; border-radius: 10px; background: var(--fg); display: grid; place-items: center; }
.mark svg { width: 20px; height: 20px; fill: none; stroke: var(--bg); stroke-width: 1.9; stroke-linejoin: round; stroke-linecap: round; }
.mark .tick { stroke-dasharray: 12; stroke-dashoffset: 12; animation: draw 0.7s 0.3s var(--ease) forwards; }
.pill { font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: var(--warn-soft); color: var(--warn); }

/* sections */
.section { margin-top: 26px; }
.section > h2 { font-size: 13px; font-weight: 600; color: var(--muted); margin: 0 6px 10px; letter-spacing: 0.02em; }
.card { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); padding: 20px; }
.stack { display: flex; flex-direction: column; gap: 12px; }

/* entrance */
.enter { animation: rise 0.55s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(0.985); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 45%, transparent); } 100% { box-shadow: 0 0 0 10px transparent; } }
@keyframes shimmer { from { background-position: -200% 0; } to { background-position: 200% 0; } }
@keyframes flow { from { transform: translateX(-30%); } to { transform: translateX(130%); } }
@keyframes breathe { 0%, 100% { transform: scale(1); opacity: 0.55; } 50% { transform: scale(1.06); opacity: 0.9; } }
@keyframes spin { to { transform: rotate(360deg); } }

/* hero: Safe */
.safe-card { display: flex; align-items: center; gap: 14px; }
.safe-icon { width: 46px; height: 46px; border-radius: 15px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); display: grid; place-items: center; flex: none; }
.safe-icon svg { width: 24px; height: 24px; stroke: #fff; fill: none; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.safe-card .k { color: var(--muted); font-size: 13px; }
.safe-card .v { font: 600 17px/1.3 ui-monospace, "SF Mono", Menlo, monospace; }
.chains { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.chip { font-size: 12px; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }

/* request */
.req .eyebrow { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--muted); }
.req .eyebrow .tag { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--accent); }
.req .eyebrow .tag::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: pulse 1.6s infinite; }
.timer { font-variant-numeric: tabular-nums; }
.timer.soon { color: var(--warn); }
.req h3 { font-size: 15px; font-weight: 600; color: var(--muted); margin: 14px 0 2px; }
.amount { font-size: 44px; font-weight: 700; letter-spacing: -0.035em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.amount small { font-size: 18px; font-weight: 600; color: var(--muted); margin-left: 6px; letter-spacing: 0; }
.route { position: relative; display: grid; grid-template-columns: 1fr 44px 1fr; align-items: center; margin: 18px 0 4px; }
.node { background: var(--surface-2); border-radius: 14px; padding: 10px 12px; min-width: 0; }
.node .n { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.node .w { color: var(--muted); font-size: 12px; }
.wire { position: relative; height: 2px; margin: 0 6px; background: var(--line); overflow: hidden; border-radius: 2px; }
.wire::after { content: ""; position: absolute; inset: 0; width: 45%; background: linear-gradient(90deg, transparent, var(--accent), transparent); animation: flow 1.6s ease-in-out infinite; }
.checks { list-style: none; padding: 0; margin: 18px 0 0; display: flex; flex-direction: column; gap: 9px; }
.checks li { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; animation: rise 0.45s var(--ease) both; }
.checks li svg { flex: none; width: 20px; height: 20px; margin-top: 1px; }
.checks li svg circle { fill: var(--ok-soft); }
.checks li svg path { fill: none; stroke: var(--ok); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 12; stroke-dashoffset: 12; animation: draw 0.4s var(--ease) forwards; animation-delay: inherit; }
details.more { margin-top: 14px; font-size: 14px; color: var(--muted); }
details.more summary { cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 4px; }
details.more summary::-webkit-details-marker { display: none; }
details.more summary::after { content: "›"; transition: transform 0.2s; }
details.more[open] summary::after { transform: rotate(90deg); }
.steps { list-style: none; margin: 10px 0 0; padding: 0; }
.steps li { padding: 8px 0; border-top: 1px solid var(--line); color: var(--fg); font-size: 14px; }
dl.raw { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 10px 0 0; font-size: 13px; }
dl.raw dt { color: var(--muted); }
dl.raw dd { margin: 0; font-family: ui-monospace, "SF Mono", Menlo, monospace; word-break: break-all; }
.actions { display: grid; grid-template-columns: auto 1fr; gap: 10px; margin-top: 20px; }
button { font: inherit; border: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; transition: transform 0.12s var(--ease), opacity 0.2s, background 0.2s; }
button:active { transform: scale(0.97); }
button:disabled { opacity: 0.5; cursor: default; transform: none; }
.btn { font-size: 17px; font-weight: 600; border-radius: 16px; padding: 16px 18px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn.primary { background: var(--accent); color: var(--accent-fg); box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 30%, transparent); }
.btn.ghost { background: var(--surface-2); color: var(--fg); }
.btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.btn .spin { width: 18px; height: 18px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin 0.8s linear infinite; }
.msg { margin-top: 14px; font-size: 14px; border-radius: 12px; padding: 12px 14px; animation: rise 0.35s var(--ease) both; }
.msg.bad { background: var(--bad-soft); color: var(--bad); }
.msg.info { background: var(--surface-2); color: var(--muted); }
.refused { border: 1px solid var(--bad-soft); }
.refused h3 { color: var(--bad); }

/* success burst */
.done-burst { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 18px 0 6px; animation: fade 0.3s both; }
.done-burst svg { width: 76px; height: 76px; }
.done-burst circle { fill: none; stroke: var(--ok); stroke-width: 3; stroke-dasharray: 220; stroke-dashoffset: 220; animation: draw 0.6s var(--ease) forwards; }
.done-burst path { fill: none; stroke: var(--ok); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 50; stroke-dashoffset: 50; animation: draw 0.4s 0.45s var(--ease) forwards; }
.done-burst .t { font-weight: 700; font-size: 19px; margin-top: 10px; }
.done-burst .s { color: var(--muted); font-size: 14px; }
.collapse { transition: opacity 0.4s var(--ease), transform 0.4s var(--ease); }
.collapse.out { opacity: 0; transform: scale(0.97); }

/* empty */
.empty { display: flex; align-items: center; gap: 14px; }
.empty .halo { width: 44px; height: 44px; border-radius: 50%; background: var(--ok-soft); display: grid; place-items: center; flex: none; animation: breathe 3.2s ease-in-out infinite; }
.empty .halo svg { width: 22px; height: 22px; fill: none; stroke: var(--ok); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.empty .t { font-weight: 600; }
.empty .s { color: var(--muted); font-size: 14px; }

/* activity timeline */
.act .head { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.act .title { font-weight: 600; font-size: 15px; line-height: 1.35; }
.badge { flex: none; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.badge.live { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.tl { list-style: none; margin: 14px 0 0; padding: 0; position: relative; }
.tl li { position: relative; padding: 0 0 14px 30px; font-size: 14px; }
.tl li:last-child { padding-bottom: 0; }
.tl li::before { content: ""; position: absolute; left: 8px; top: 18px; bottom: -2px; width: 2px; background: var(--line); }
.tl li:last-child::before { display: none; }
.tl li.done::before { background: var(--ok); opacity: 0.5; }
.tl .dot { position: absolute; left: 0; top: 1px; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 2px solid var(--faint); }
.tl .done .dot { background: var(--ok); border-color: var(--ok); }
.tl .done .dot svg { width: 10px; height: 10px; fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.tl .active .dot { border-color: var(--accent); background: var(--accent); animation: pulse 1.4s infinite; }
.tl .failed .dot { border-color: var(--bad); background: var(--bad); }
.tl .label { color: var(--fg); }
.tl .todo .label { color: var(--faint); }
.tl .note { color: var(--accent); font-size: 13px; }
.tl .note.shimmer { background: linear-gradient(90deg, var(--accent) 30%, var(--accent-2) 50%, var(--accent) 70%); background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: shimmer 2.2s linear infinite; }
.tl .tx { font-size: 13px; margin-left: 6px; white-space: nowrap; }
.act.finished { padding: 14px 18px; }
.act.finished .tl { display: none; }

/* passkey */
.pk { display: flex; align-items: center; gap: 14px; }
.pk .ic { width: 42px; height: 42px; border-radius: 14px; background: var(--ok-soft); display: grid; place-items: center; flex: none; }
.pk .ic.none { background: var(--warn-soft); }
.pk .ic svg { width: 22px; height: 22px; fill: none; stroke: var(--ok); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.pk .ic.none svg { stroke: var(--warn); }
.pk .t { font-weight: 600; font-size: 15px; }
.pk .s { color: var(--muted); font-size: 13px; }
.fp { font-family: ui-monospace, "SF Mono", Menlo, monospace; }

/* skeleton */
.skel { height: 120px; border-radius: var(--r); background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 50%, var(--surface) 75%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }

/* pairing */
.pair { margin-top: 18px; }
.pair h1 { font-size: 28px; letter-spacing: -0.025em; line-height: 1.15; margin: 8px 4px 8px; }
.pair .lead { color: var(--muted); margin: 0 4px 22px; }
.stepper { list-style: none; padding: 0; margin: 0 0 22px; display: flex; flex-direction: column; gap: 4px; }
.stepper li { display: flex; gap: 14px; align-items: center; padding: 12px 14px; border-radius: 16px; transition: background 0.3s var(--ease); }
.stepper li.now { background: var(--surface); box-shadow: var(--shadow); }
.stepper .num { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 14px; background: var(--surface-2); color: var(--muted); flex: none; transition: background 0.3s, color 0.3s; }
.stepper .now .num { background: var(--accent); color: var(--accent-fg); animation: pulse 1.6s infinite; }
.stepper .ok .num { background: var(--ok); color: #fff; }
.stepper .ok .num svg { width: 14px; height: 14px; fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.stepper .t { font-weight: 600; }
.stepper .s { color: var(--muted); font-size: 13px; }
.stepper .todo .t { color: var(--faint); }
.big { width: 100%; }
.hint { margin-top: 14px; font-size: 14px; color: var(--muted); text-align: center; }
.warnbox { background: var(--warn-soft); color: var(--warn); border-radius: 14px; padding: 12px 14px; font-size: 14px; margin-bottom: 16px; }

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