/* 颜色与 App 的 ui/theme/Theme.kt 相同（浅色为主，另有深色）；按钮一律无描边 */
:root {
  --bg: #ffffff; --card: #f5f7fa; --text: #101820; --sub: #6b7680; --weak: #edf2f7;
  --accent: #027aff; --accent-soft: #eaf3ff; --accent-text: #0a5bc4; --btn: #0a6be8; --btn-text: #fff;
  --line: #eef1f4; --link: #0a6be8; --ok: #12805c; --ok-soft: #e8f5ef; --warn: #9a5b00; --warn-soft: #fff6e5;
  --bad: #d92d20; --bad-soft: #fdedec; --dis: #edf2f7; --dis-text: #a3acb5; --track: #dde3ea; --pill: #fff;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #080a0e; --card: #161a20; --text: #fff; --sub: #a1aab5; --weak: #20252d;
    --accent: #2f8bff; --accent-soft: #0f2238; --accent-text: #8ec0ff; --btn: #0a6be8;
    --line: #1e232a; --link: #5aa2ff; --ok: #3dd39a; --ok-soft: #10241c; --warn: #f5b544; --warn-soft: #2a2112;
    --bad: #ff6b5e; --bad-soft: #2b1513; --dis: #1c2128; --dis-text: #5d6670; --track: #2a313a; --pill: #2a313a;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  /* 侧边栏宽度由用户拖动决定；弹窗（不支持侧边栏的浏览器）固定 360 宽 */
  min-width: 340px; min-height: 600px; background: var(--bg); color: var(--text);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}
#app { height: 100%; max-width: 520px; margin: 0 auto; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; text-align: inherit; }
a { color: var(--link); }
small { font-size: 12px; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
.grow { flex: 1; min-width: 0; }
.col { display: flex; flex-direction: column; min-width: 0; }
.col.end { align-items: flex-end; text-align: right; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }
.center { text-align: center; }
.pad { padding: 48px 0; }
.pad-x { padding: 0 20px; }
.sub { color: var(--sub); margin: 0; }
.small { font-size: 12px; }
.muted { color: var(--sub); }
.ok-text { color: var(--ok); }
.warn-text { color: var(--warn); margin: 0; }
.bad-text { color: var(--bad); }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 图标 */
.svg { display: inline-flex; flex: none; }
.svg svg { width: 100%; height: 100%; }
.ic { width: 22px; height: 22px; }
.ic.small { width: 18px; height: 18px; }
.ic.accent { color: var(--accent); }
.avatar { width: var(--s, 30px); height: var(--s, 30px); border-radius: 50%; overflow: hidden; }
.token { position: relative; width: var(--s); height: var(--s); flex: none; display: inline-block; }
.token > img:first-child { width: 100%; height: 100%; border-radius: 50%; display: block; }
.token .badge-ic { position: absolute; right: -3px; bottom: -3px; width: 42%; height: 42%; border-radius: 50%; border: 2px solid var(--bg); background: var(--bg); }

/* 页面骨架 */
.page { display: flex; flex-direction: column; min-height: 100vh; }
.page.with-nav { height: 100vh; }
.scroll { flex: 1; overflow-y: auto; padding-bottom: 16px; }
.bar { display: flex; align-items: center; gap: 8px; height: 56px; padding: 0 8px; flex: none; }
.bar h1 { flex: 1; margin: 0; font-size: 17px; text-align: center; }
.bar.title { padding: 0 8px 0 20px; }
.bar.title h1 { text-align: left; font-size: 22px; font-weight: 800; }
.bar.home { padding: 0 8px 0 12px; }
.icon-btn { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; border-radius: 12px; flex: none; }
.icon-btn:hover { background: var(--weak); }
.icon-btn.small { width: 32px; height: 32px; }
.icon-btn.small .ic { width: 18px; height: 18px; color: var(--sub); }
.icon-space { width: 44px; flex: none; }
.content { flex: 1; display: flex; flex-direction: column; gap: 14px; padding: 4px 20px 20px; }
.actions { position: sticky; bottom: 0; display: flex; flex-direction: column; gap: 10px; padding: 12px 20px 20px; background: var(--bg); }

/* 按钮与输入 */
.btn { display: block; width: 100%; height: 52px; border-radius: 14px; font-weight: 700; font-size: 16px; text-align: center; text-decoration: none; line-height: 52px; }
.btn.primary { background: var(--btn); color: var(--btn-text); }
.btn.secondary { background: var(--weak); color: var(--text); }
.btn.danger { background: var(--bad-soft); color: var(--bad); }
.btn:disabled { background: var(--dis); color: var(--dis-text); cursor: default; }
.link { color: var(--link); font-weight: 600; }
.link-muted { color: var(--sub); font-weight: 700; font-size: 17px; }
.link-text { color: var(--link); font-weight: 600; font-size: 13px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span:first-child, .field-head { color: var(--text); font-size: 14px; font-weight: 600; }
.field-head { display: flex; justify-content: space-between; }
input, textarea {
  width: 100%; padding: 14px; border: 0; border-radius: 14px; background: var(--card); color: var(--text); font: inherit; font-size: 15px;
}
input:focus, textarea:focus { outline: 2px solid var(--accent); }
textarea { resize: vertical; }
.input-with { display: flex; align-items: center; background: var(--card); border-radius: 14px; }
.input-with:focus-within { outline: 2px solid var(--accent); }
.input-with input { background: none; outline: none; }
.input-with .unit { padding: 0 14px; color: var(--sub); font-weight: 700; font-size: 16px; }
.field-btn { padding: 0 14px; color: var(--link); font-weight: 700; white-space: nowrap; flex: none; }
.error { color: var(--bad); margin: 0; font-size: 13px; }
.error:empty { display: none; }
.status { display: flex; gap: 8px; margin: 0; font-size: 13px; line-height: 20px; }
.status .ic { width: 16px; height: 16px; margin-top: 2px; }
.status.ok { color: var(--ok); }
.status.warn { color: var(--warn); }
.status.bad { color: var(--bad); }
.hint-box { margin-top: -6px; }
.tag { padding: 4px 8px; border-radius: 8px; background: var(--weak); color: var(--sub); font-size: 12px; font-weight: 600; white-space: nowrap; }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.chip { margin-left: 6px; padding: 2px 6px; border-radius: 6px; background: var(--weak); color: var(--sub); font-size: 11px; font-weight: 700; vertical-align: 1px; }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.card { background: var(--card); border-radius: 16px; padding: 14px 16px; }

/* 欢迎、解锁 */
.hero { align-items: center; justify-content: center; text-align: center; gap: 10px; }
.hero .logo { width: 72px; height: 72px; border-radius: 18px; }
.hero h1 { margin: 6px 0 0; font-size: 26px; font-weight: 800; }
.hero .sub { max-width: 300px; }
.welcome-body { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 0 24px; min-height: 480px; }
.welcome-space.top { flex: .9; }
.welcome-space.middle { flex: .7; min-height: 56px; }
.welcome-space.bottom { flex: 1; }
.welcome-wordmark { margin: 0; width: 220px; height: 59px; background: var(--text); mask: url("icons/wordmark.svg") center / contain no-repeat; -webkit-mask: url("icons/wordmark.svg") center / contain no-repeat; }
.welcome-buttons { width: 100%; max-width: 480px; display: flex; flex-direction: column; gap: 12px; }
.welcome-test { text-align: center; margin: 0; padding: 0 20px max(16px, env(safe-area-inset-bottom)); }
#tervo-update { position: fixed; z-index: 50; left: 50%; transform: translateX(-50%); bottom: calc(76px + env(safe-area-inset-bottom)); width: calc(100% - 32px); max-width: 448px; box-shadow: 0 4px 20px #0002; }
.unlock { gap: 14px; }
.unlock input, .unlock .btn { max-width: 360px; }
.row-btn { display: flex; align-items: center; gap: 12px; width: 100%; }
.row-btn strong { display: block; font-size: 16px; }
.row-btn small { color: var(--sub); }
.words { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 0; margin: 0; list-style: none; counter-reset: w; }
.words li { counter-increment: w; background: var(--card); border-radius: 10px; padding: 10px 8px; font-weight: 700; }
.words li::before { content: counter(w); color: var(--sub); font-weight: 500; font-size: 12px; margin-right: 6px; }
.words.zh li { text-align: center; font-size: 19px; }
.words.zh li::before { float: left; }

/* 钱包首页（与 App 的 WalletTab 相同） */
.account-btn { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 12px; min-width: 0; }
.account-btn:hover { background: var(--weak); }
.account-btn strong { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.total { padding: 14px 24px 0; }
.total-label { display: flex; align-items: center; color: var(--sub); font-weight: 600; }
.total-value { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; justify-content: inherit; }
.total-value .num { font-size: 42px; font-weight: 800; letter-spacing: -1px; line-height: 1.15; }
.total-value .unit { color: var(--sub); font-weight: 700; font-size: 16px; }
.circles { display: flex; padding: 22px 20px 0; }
.circle-btn { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 4px 0; border-radius: 12px; font-size: 13px; font-weight: 600; }
.circle-btn .dot { width: 52px; height: 52px; border-radius: 50%; background: var(--weak); display: flex; align-items: center; justify-content: center; }
.circle-btn .dot.primary { background: var(--btn); color: #fff; }
.circle-btn:hover .dot { filter: brightness(.96); }
.section-tabs { display: flex; gap: 20px; padding: 22px 24px 4px; align-items: baseline; }
.section-tabs strong { font-size: 17px; font-weight: 800; }
.asset { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 62px; padding: 8px 24px; }
.asset:hover { background: var(--card); }
.asset strong { font-size: 16px; }
.asset small { color: var(--sub); font-size: 13px; }
.asset .col.end small { font-size: 12px; }
.asset .muted { color: var(--sub); }
.asset.compact { min-height: 56px; padding: 6px 4px; border-radius: 10px; }
.token-wrap { position: relative; flex: none; }
.dir { position: absolute; right: -3px; bottom: -3px; width: 18px; height: 18px; border-radius: 50%; background: var(--text); color: var(--bg); border: 2px solid var(--bg); display: flex; align-items: center; justify-content: center; }
.dir .ic { width: 10px; height: 10px; }
.dir.in { background: var(--ok); color: #fff; }

/* 底部导航（钱包 / 记录 / 我的） */
.bottom-nav { display: flex; border-top: 1px solid var(--line); background: var(--bg); flex: none; }
.bottom-nav button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 10px; color: var(--sub); font-size: 12px; font-weight: 600; }
.bottom-nav button.on { color: var(--accent); }

/* 分段选择 */
.seg { display: flex; gap: 4px; padding: 4px; border-radius: 14px; background: var(--card); }
.seg button { flex: 1; height: 40px; border-radius: 10px; color: var(--sub); font-weight: 700; display: flex; align-items: center; justify-content: center; }
.seg button.on { background: var(--pill); color: var(--text); box-shadow: 0 1px 2px rgba(16, 24, 32, .06); }
.seg-label { display: inline-flex; align-items: center; gap: 6px; }

/* 收款 */
.qr { background: #fff; border-radius: 16px; padding: 14px; width: 220px; height: 220px; margin: 4px auto 0; }
.qr .svg { width: 100%; height: 100%; }
.addr-line { display: flex; align-items: center; gap: 4px; justify-content: center; text-align: center; }
.addr-line .mono { font-size: 15px; font-weight: 600; word-break: break-all; }
.guide { display: flex; flex-direction: column; gap: 10px; }
.guide-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.guide-row > .sub:first-child { width: 40px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 6px; border-radius: 999px; background: var(--pill); font-weight: 700; }
.pill.accent { background: var(--accent-soft); color: var(--accent-text); }

/* 发送、确认 */
.asset-head { display: flex; align-items: center; gap: 12px; }
.asset-head strong { font-size: 16px; }
.confirm-hero { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 6px 0 4px; text-align: center; justify-content: center; }
.confirm-hero .total-value { justify-content: center; }
.done { width: 52px; height: 52px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); display: flex; align-items: center; justify-content: center; }
.details { margin: 0; display: flex; flex-direction: column; }
.details > div { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line); }
.details > div.stack { flex-direction: column; align-items: flex-start; gap: 4px; }
.details dt { color: var(--sub); flex: none; }
.details dd { margin: 0; display: flex; align-items: center; gap: 6px; text-align: right; }
.details dd.addr { font-size: 15px; word-break: break-all; text-align: left; display: block; }
.details dd.addr b { color: var(--accent); }
.hash { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; border-radius: 16px; background: var(--card); width: 100%; }
.hash .mono { font-size: 13px; word-break: break-all; }

/* 记录、我的 */
.group-title { color: var(--sub); font-size: 13px; font-weight: 600; margin: 14px 24px 4px; }
.sheet .group-title { margin: 8px 0 4px; }
.me-account { display: flex; align-items: center; gap: 12px; margin: 4px 20px 0; width: calc(100% - 40px); }
.me-account strong { font-size: 16px; }
.card.list { margin: 0 20px; padding: 4px 0; }
.me-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 16px; }
button.me-item:hover { background: var(--weak); }
.scroll > .pad-x { margin-top: 12px; }

/* 底部弹层 */
.scrim { position: fixed; inset: 0; background: rgba(8, 10, 14, .42); display: flex; align-items: flex-end; justify-content: center; z-index: 100; animation: fade .15s; }
.sheet { width: 100%; max-width: 520px; max-height: 88vh; overflow-y: auto; background: var(--bg); border-radius: 22px 22px 0 0; padding: 8px 20px 24px; display: flex; flex-direction: column; gap: 6px; animation: up .18s ease-out; }
.sheet h2 { font-size: 20px; margin: 8px 0 6px; }
.grip { width: 36px; height: 4px; border-radius: 2px; background: var(--track); margin: 4px auto 6px; }
.account-row { display: flex; align-items: center; gap: 4px; border-radius: 14px; }
.account-row.on { background: var(--card); }
.account-pick { display: flex; align-items: center; gap: 12px; padding: 10px 8px; }
.account-pick strong { font-size: 16px; }
.account-pick small { color: var(--sub); }
.account-row.add { gap: 12px; padding: 10px 8px; color: var(--link); }
.plus { width: 40px; height: 40px; border-radius: 50%; background: var(--weak); display: flex; align-items: center; justify-content: center; }
.avatar-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin-bottom: 10px; }
.avatar-grid button { border-radius: 50%; padding: 3px; display: flex; justify-content: center; }
.avatar-grid button.on { box-shadow: 0 0 0 2px var(--accent); }
.copied { color: var(--ok) !important; }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(24px); } }
.install-sheet { position: relative; padding-bottom: max(24px, env(safe-area-inset-bottom)); gap: 12px; max-height: 90dvh; }
.install-sheet h2 { padding-right: 32px; font-size: 21px; }
.install-sheet .install-close { position: absolute; top: 20px; right: 12px; }
.install-brand { display: flex; align-items: center; gap: 12px; }
.install-brand img { border-radius: 12px; }
.install-brand strong { font-size: 18px; }
.install-brand p { margin: 2px 0 0; }
.install-hint { margin: 0; }
.install-steps { margin: 0; padding-left: 22px; display: grid; gap: 10px; }
.install-steps[hidden] { display: none; }
.install-steps li { padding-left: 4px; }
.install-copy { align-self: center; }
@media (prefers-reduced-motion: reduce) { .scrim, .sheet { animation: none; } }
.scan-video { width: 100%; height: min(40dvh,320px); object-fit: cover; border-radius: 16px; background: #111; }
.scan-sheet { display: flex; flex-direction: column; gap: 12px; }
.scan-sheet .error { overflow-wrap: anywhere; }
.receive-image { display: block; width: 100%; max-width: 400px; height: auto; margin: 0 auto; border-radius: 12px; -webkit-touch-callout: default; user-select: auto; }
.browser-help-list { padding-left: 20px; display: grid; gap: 10px; }

body{min-width:0;min-height:100dvh}.page{min-height:100dvh;padding-top:env(safe-area-inset-top)}.page.with-nav{height:100dvh}.actions,.bottom-nav{padding-bottom:max(16px,env(safe-area-inset-bottom))}input,textarea{font-size:16px}#app{min-height:100dvh}body[data-private=true] #app{visibility:hidden}
