:root {
  --blue: #2563eb;
  --blue-2: #1d4ed8;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e6edf5;
  --card: #fff;
  --bg: #eef3f9;
  --ok: #2563eb;
  --danger: #dc2626;
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
}
button, input { font: inherit; }
button { cursor: pointer; }
.app { max-width: 480px; margin: 0 auto; padding-bottom: calc(84px + env(safe-area-inset-bottom)); }

.hero {
  background: linear-gradient(165deg, #3b82f6 0%, #1d4ed8 42%, #1e3a8a 100%);
  color: #fff;
  padding: 16px 16px 52px;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}
.hero-bar { display: flex; justify-content: flex-start; }
.live {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(15, 23, 42, .28);
  border-radius: 999px; padding: 6px 12px; font-size: 12px; font-weight: 700;
}
.live i, .dot {
  width: 7px; height: 7px; border-radius: 50%; background: #4ade80; display: inline-block;
  box-shadow: 0 0 0 4px rgba(74, 222, 128, .18);
}
.hero-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 16px; }
.hero h1 { margin: 0; font-size: 30px; letter-spacing: .5px; font-weight: 800; }
.promo {
  flex-shrink: 0;
  background: linear-gradient(90deg, #fb923c, #f97316);
  color: #fff; font-size: 12px; font-weight: 800;
  border-radius: 999px; padding: 8px 12px; line-height: 1.2;
}
.hero-sub { margin: 8px 0 0; color: rgba(255,255,255,.86); font-size: 14px; }

.metrics {
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  margin: -34px 14px 0; background: #fff; border-radius: 18px;
  box-shadow: 0 10px 28px rgba(30, 58, 138, .12);
  position: relative; z-index: 2; overflow: hidden;
}
.metrics div { text-align: center; padding: 16px 6px 14px; }
.metrics div + div { border-left: 1px solid var(--line); }
.metrics b { display: block; color: var(--blue); font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.metrics span { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }

main { padding: 14px 14px 0; }
.panel { display: none; }
.panel.active { display: block; }
.card {
  background: var(--card); border-radius: 18px; padding: 14px 14px 12px;
  margin-bottom: 12px; box-shadow: 0 8px 22px rgba(15, 23, 42, .04);
}
h2 { margin: 0 0 12px; font-size: 16px; }
h3 { margin: 0 0 12px; font-size: 18px; }

.feed-head { display: flex; justify-content: space-between; align-items: center; font-weight: 800; margin-bottom: 8px; }
.feed-head .dot { margin-right: 6px; }
.feed-viewport { height: 118px; overflow: hidden; }
.feed-track { animation: feedScroll linear infinite; }
@keyframes feedScroll { from { transform: translateY(0); } to { transform: translateY(-50%); } }
.case { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); height: 58px; box-sizing: border-box; }
.case b { display: block; font-size: 14px; }
.case-side { text-align: right; white-space: nowrap; }
.case-ok { color: var(--blue); font-weight: 800; font-size: 13px; }
.muted, .hint, .fine, .empty { color: var(--muted); font-size: 12px; line-height: 1.5; }
.empty { margin: 8px 0 4px; }

.form-head { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.ttl { color: #c2410c; font-size: 26px; font-weight: 800; line-height: 1.2; text-align: right; }
.form-card h2 { font-size: 18px; margin-top: 8px; }
.presets { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.preset, .periods button, .ghost, .saved button {
  border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 12px;
}
.preset { display: flex; align-items: center; justify-content: space-between; text-align: left; padding: 10px 12px; }
.preset-copy b { display: block; color: var(--blue); font-size: 18px; }
.preset-copy span { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; line-height: 1.35; }
.preset-mark { font-style: normal; color: #ea580c; font-size: 13px; font-weight: 800; white-space: nowrap; }
.preset.on, .periods button.on { border-color: #fdba74; background: #fff7ed; }
.preset.on b, .periods button.on { color: #c2410c; }
.field, .field-label { display: block; margin-top: 12px; font-size: 13px; font-weight: 700; }
.field span, .field-label { margin-bottom: 6px; }
input, .addr {
  width: 100%; border: 1px solid var(--line); background: #fff; color: var(--ink);
  border-radius: 12px; padding: 12px; outline: none;
}
.addr {
  margin-top: 12px; background: #0b1220; color: #e5e7eb; border: none;
  border-radius: 14px; padding: 16px 14px; font-size: 15px;
}
.addr::placeholder { color: #94a3b8; }
input:focus, .addr:focus { box-shadow: 0 0 0 3px rgba(37, 99, 235, .16); }
.hint { margin: 6px 0 0; }
.periods { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.periods button { padding: 8px 12px; font-weight: 800; }
.quote { margin-top: 12px; color: var(--blue); font-weight: 800; font-size: 14px; min-height: 1.2em; }
.quote-row { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; }
.quote .sum { font-size: 20px; }
.pay-hint { color: #c2410c; font-size: 26px; font-weight: 700; line-height: 1.2; }
.quote .sub { color: var(--muted); font-weight: 600; font-size: 12px; margin-top: 2px; }
.quote.bad, .quote.bad .sub { color: var(--danger); }
.warn {
  background: #fef2f2; color: var(--danger); border-radius: 12px; padding: 10px 12px;
  font-size: 13px; margin: 10px 0 0;
}
.submit {
  width: 100%; margin-top: 12px; border: none; border-radius: 14px;
  background: var(--blue); color: #fff; font-weight: 800; font-size: 16px; padding: 14px;
}
.submit:disabled { opacity: .45; cursor: not-allowed; }
.ghost { background: #fff; border-radius: 12px; padding: 12px 14px; font-weight: 800; }
.notice {
  background: #fff7e8; color: #c2410c; border-radius: 14px; padding: 12px 14px;
  font-size: 13px; font-weight: 700; line-height: 1.55; margin-bottom: 12px;
}
.steps { margin: 0; padding-left: 18px; color: #334155; font-size: 14px; line-height: 1.7; }
.row-title { display: flex; justify-content: space-between; align-items: center; }
.text-btn { border: none; background: transparent; color: var(--blue); font-weight: 800; padding: 0; }
.query-row, .claim { display: flex; gap: 8px; }
.query-row .ghost, .claim .ghost { width: auto; margin-top: 0; white-space: nowrap; }

.order-list { display: flex; flex-direction: column; gap: 8px; }
.order { border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
.order-top, .kv { display: flex; justify-content: space-between; gap: 8px; }
.order-top { align-items: center; margin-bottom: 6px; }
.addr, .mono, .pay-addr { font-family: ui-monospace, Consolas, monospace; word-break: break-all; }
.pill { font-size: 12px; font-weight: 800; border-radius: 999px; padding: 3px 8px; white-space: nowrap; }
.pill.wait { color: #c2410c; background: #fff7ed; }
.pill.ok { color: #1d4ed8; background: #eff6ff; }
.pill.bad { color: var(--danger); background: #fef2f2; }
.link { color: var(--blue); font-weight: 800; }
.copy {
  border: none; background: #eff6ff; color: var(--blue); border-radius: 8px;
  padding: 4px 8px; font-size: 12px; font-weight: 800; margin-left: 6px;
}
.pay-grid { display: grid; gap: 10px; margin-top: 12px; }
.pay-box { border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
.pay-box .asset { font-size: 12px; font-weight: 800; color: var(--muted); }
.pay-amt { font-size: 22px; font-weight: 800; margin: 4px 0; color: var(--blue); }
.tx { margin-top: 8px; font-size: 13px; }
.result .sum { font-size: 18px; margin-bottom: 8px; }

.nav {
  position: fixed; left: 50%; bottom: 0; transform: translateX(-50%);
  width: min(480px, 100%); display: grid; grid-template-columns: 1fr 1fr 1fr;
  background: #fff; border-top: 1px solid var(--line);
  padding: 6px 8px calc(8px + env(safe-area-inset-bottom));
}
.nav-btn {
  border: none; background: transparent; color: #94a3b8; font-weight: 700; font-size: 12px;
  padding: 6px 0 4px; display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.nav-btn .ico { width: 24px; height: 24px; }
.nav-btn svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.nav-btn svg path, .nav-btn svg circle { fill: none; }
.nav-btn.active { color: var(--blue); }
.nav-btn.active svg path:first-child { fill: currentColor; stroke: none; }

dialog { border: none; padding: 0; border-radius: 18px; width: min(420px, calc(100% - 28px)); }
dialog::backdrop { background: rgba(15, 23, 42, .46); }
.sheet { padding: 18px; }
.sheet dl { margin: 0; display: grid; gap: 8px; }
.sheet .kv b { text-align: right; }
.sheet-actions { display: grid; grid-template-columns: 1fr 1.4fr; gap: 8px; }
.sheet-actions .submit, .sheet-actions .ghost { margin-top: 14px; }
