/* ==========================================================================
   app.css —— 布局与组件。色值一律经由 tokens.css 的变量，此处不出现任何 hex。
   ========================================================================== */

*,*::before,*::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg-2);
  color: var(--text);
  font: var(--fw-4) var(--fs-body)/var(--lh-body) var(--font-ui);
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
  /* F8：表格数字 + 斜杠零（0 与 O 可辨，地址场景关键） */
  font-feature-settings: "tnum" 1, "zero" 1;
  line-break: strict; /* F9：CJK 行尾不断标点 */
}

button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; padding: 0; text-align: left; }
ul, ol { margin: 0; padding: 0; list-style: none; }
h1,h2,h3,h4 { margin: 0; font-weight: var(--fw-6); }
p { margin: 0; }
code { font-family: var(--font-num); font-size: .92em; }
svg.ic { width: var(--ic-md); height: var(--ic-md); flex: 0 0 auto; fill: none;
         stroke: currentColor; stroke-width: var(--ic-base); stroke-linecap: round; stroke-linejoin: round; }

/* ---------------- 舞台 ---------------- */
.stage {
  min-height: 100%;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: var(--sp-6);
  padding: var(--sp-6) var(--sp-5) var(--sp-7);
}

/* ---------------- 左侧索引栏 ---------------- */
.rail {
  width: 208px; flex: 0 0 208px;
  position: sticky; top: var(--sp-6);
  display: flex; flex-direction: column; gap: var(--sp-5);
}
.rail-brand { display: flex; align-items: center; gap: var(--sp-3); }
.rail-logo {
  width: 38px; height: 38px; flex: 0 0 38px; border-radius: var(--r-sm);
  background: var(--head-grad); color: var(--text-on-brand);
  display: grid; place-items: center;
  font-size: var(--fs-15); font-weight: var(--fw-7); letter-spacing: .02em;
  box-shadow: var(--sh-1);
}
.rail-title { font-size: var(--fs-14); font-weight: var(--fw-6); }
.rail-sub { font-size: var(--fs-11); color: var(--text-3); }
.rail-group { display: flex; flex-direction: column; gap: 2px; }
.rail-group-title {
  font-size: var(--fs-11); font-weight: var(--fw-6); color: var(--text-3);
  letter-spacing: .06em; text-transform: uppercase; margin-bottom: var(--sp-1);
}
.rail-item {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: 7px 10px; border-radius: var(--r-sm);
  font-size: var(--fs-12); color: var(--text-2);
  transition: background var(--dur-1) var(--ease), color var(--dur-1) var(--ease);
}
.rail-item .ic { width: 17px; height: 17px; }
.rail-item:hover { background: var(--surface-2); color: var(--text); }
.rail-item.on { background: var(--brand-weak); color: var(--brand); font-weight: var(--fw-5); }
.rail-toggle { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); font-size: var(--fs-12); color: var(--text-2); }
.rail-foot { font-size: var(--fs-11); color: var(--text-3); line-height: 1.7; }

/* 分段控件 */
.seg {
  display: inline-flex; padding: 2px; gap: 2px;
  background: var(--track); border-radius: var(--r-pill);
}
.seg button {
  padding: 3px 9px; border-radius: var(--r-pill);
  font-size: var(--fs-11); color: var(--text-2);
  transition: background var(--dur-1) var(--ease), color var(--dur-1) var(--ease);
}
.seg button.on { background: var(--brand); color: var(--text-on-brand); font-weight: var(--fw-5); }

/* ---------------- 手机框 ---------------- */
.device { flex: 0 0 auto; }
.device-frame {
  position: relative;
  width: 390px; height: 844px;
  border-radius: 44px;
  background: var(--bg);
  border: 1px solid var(--hairline-2);
  box-shadow: var(--sh-3), 0 0 0 10px var(--surface), 0 0 0 11px var(--hairline-2);
  overflow: hidden;
  display: flex; flex-direction: column;
}

/* 状态栏 */
.statusbar {
  height: var(--statusbar-h); flex: 0 0 var(--statusbar-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 var(--sp-5) 0 var(--sp-6);
  font-size: var(--fs-12); font-weight: var(--fw-6);
  color: var(--text); position: relative; z-index: 4;
}
.statusbar.on-brand { color: var(--text-on-brand); background: var(--brand); }
.sb-notch { width: 74px; height: 20px; border-radius: var(--r-pill); background: var(--tp-black); }
[data-theme="light"] .sb-notch { background: var(--tp-black); }
.sb-icons { display: flex; align-items: center; gap: 5px; }
.sb-svg { height: 11px; fill: currentColor; }

/* 应用滚动区
   scroll-behavior 刻意不用 smooth：换页时会写 scrollTop = 0，
   一旦这里是 smooth，那次赋值就变成一段几百毫秒的滚动动画，
   和新内容的进场抢同一段时间轴 —— 页面会先在新内容里往上滑一段。
   要平滑由转场层负责（js/motion.js），不要交给浏览器的隐式动画。 */
.app {
  flex: 1 1 auto; overflow-y: auto; overflow-x: hidden;
  position: relative;
  overscroll-behavior: contain;
}
.app::-webkit-scrollbar { width: 0; }

/* ---------------- 底部 Tab ---------------- */
.tabbar {
  flex: 0 0 var(--tabbar-h); height: var(--tabbar-h);
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--bg);
  border-top: 1px solid var(--hairline);
  padding-bottom: var(--safe-b);
  position: relative; z-index: 5;
}
.tabbar.hidden { display: none; }
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; font-size: var(--fs-11); color: var(--text-3);
  transition: color var(--dur-1) var(--ease);
}
.tab .ic { width: 22px; height: 22px; }
.tab.on { color: var(--brand); font-weight: var(--fw-5); }
.tab:active { transform: scale(.94); }

/* ---------------- 头部（品牌蓝） ---------------- */
.head {
  background: var(--head-grad);
  color: var(--text-on-brand);
  padding: 0 var(--sp-4) var(--sp-4);
  border-radius: 0 0 var(--r-xl) var(--r-xl);
  position: relative;
  overflow: hidden;
}
.head::after {
  content: ""; position: absolute; right: -70px; top: -90px;
  width: 240px; height: 240px; border-radius: 50%;
  background: var(--track); opacity: .5; pointer-events: none;
}
.head-row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); padding-top: var(--sp-2); position: relative; z-index: 1; }
.head-wallet {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px 5px 6px; border-radius: var(--r-pill);
  background: var(--track);
  font-size: var(--fs-12); font-weight: var(--fw-5); color: var(--text-on-brand);
}
.head-wallet .avatar {
  width: 20px; height: 20px; border-radius: 50%; flex: 0 0 20px;
  background: var(--tp-black); opacity: .85;
  display: grid; place-items: center; font-size: 9px; font-weight: var(--fw-7); color: var(--text-on-brand);
}
.head-wallet .ic { width: 15px; height: 15px; }
.head-acts { display: flex; gap: var(--sp-2); }
.icon-btn {
  width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--track); color: var(--text-on-brand);
  transition: background var(--dur-1) var(--ease), transform var(--dur-1) var(--ease);
}
.icon-btn:hover { background: var(--hairline-2); }
.icon-btn:active { transform: scale(.9); }
.icon-btn .ic { width: 18px; height: 18px; }

.balance-wrap { margin-top: var(--sp-5); position: relative; z-index: 1; }
.balance-label { display: flex; align-items: center; gap: 6px; font-size: var(--fs-12); opacity: .78; }
.balance-label .ic { width: 15px; height: 15px; }
.balance { display: flex; align-items: baseline; gap: var(--sp-2); margin-top: 2px; }
.balance-num { font-size: var(--fs-34); font-weight: var(--fw-7); letter-spacing: var(--ls-tight); line-height: 1.1; }
.balance-cur { font-size: var(--fs-14); font-weight: var(--fw-5); opacity: .8;
  padding: 2px 8px; border-radius: var(--r-pill); background: var(--track); }

.head-brand { display: inline-flex; align-items: center; gap: var(--sp-2); }
.blink { animation: blink var(--dur-3) var(--ease); }
@keyframes blink { 0% { opacity: .25; transform: translateY(-2px);} 100% { opacity: 1; transform: none; } }
@keyframes growX { from { transform: scaleX(.4); opacity: .4; } to { transform: scaleX(1); opacity: 1; } }

/* 四宫格快捷操作（蓝块之外：白卡 / 深色卡，两主题通用） */
.quick {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-2);
  margin-top: var(--sp-3); padding: 0 var(--sp-4); position: relative; z-index: 1;
}
.quick-btn {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: var(--sp-3) 4px; border-radius: var(--r-md);
  background: var(--surface); border: 1px solid var(--hairline); box-shadow: var(--sh-1);
  color: var(--text);
  font-size: var(--fs-11); font-weight: var(--fw-5);
  transition: background var(--dur-1) var(--ease), transform var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease);
}
.quick-btn:hover { border-color: var(--brand-line); }
.quick-btn:active { transform: scale(.95); }
.quick-btn .ic { width: 21px; height: 21px; stroke-width: 2; color: var(--brand); }

/* ---------------- 页面通用 ---------------- */
.page { padding-bottom: var(--sp-6); }
.page-head {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4) var(--sp-3);
  position: sticky; top: 0; z-index: 3;
  background: var(--bg);
  border-bottom: 1px solid var(--hairline);
}
.page-head.plain { border-bottom: 0; }
.page-title { font-size: var(--fs-17); font-weight: var(--fw-6); flex: 1 1 auto; }
.page-head .icon-btn { background: var(--surface-2); color: var(--text); }
.page-head .icon-btn:hover { background: var(--surface-3); }
.page-head .head-act { font-size: var(--fs-12); color: var(--brand); font-weight: var(--fw-5); }

.section { padding: var(--sp-3) var(--sp-4); }
.section + .section { padding-top: 0; }
.section-title {
  display: flex; align-items: center; justify-content: space-between;
  font-size: var(--fs-12); color: var(--text-3); font-weight: var(--fw-5);
  padding: var(--sp-3) var(--sp-4) var(--sp-2);
}
.section-title .link { color: var(--brand); font-weight: var(--fw-5); }

/* 卡片 / 列表 */
.card {
  background: var(--surface); border-radius: var(--r-lg);
  border: 1px solid var(--hairline); overflow: hidden;
}
.list { display: flex; flex-direction: column; }
.row {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4); min-height: 56px;
  transition: background var(--dur-1) var(--ease);
}
.row + .row { box-shadow: inset 0 1px 0 var(--hairline); }
.row.tap { cursor: pointer; }
.row.tap:hover { background: var(--surface-2); }
.row.tap:active { background: var(--surface-3); }
.row-main { flex: 1 1 auto; min-width: 0; }
.row-title { font-size: var(--fs-14); font-weight: var(--fw-5); display: flex; align-items: center; gap: 6px; }
.row-sub { font-size: var(--fs-12); color: var(--text-3); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-end { text-align: right; flex: 0 0 auto; }
.row-val { font-size: var(--fs-14); font-weight: var(--fw-5); }
.row-val2 { font-size: var(--fs-12); color: var(--text-3); margin-top: 2px; }
.row .ic.chev { width: 17px; height: 17px; color: var(--text-3); }

/* token 徽标 */
.tk {
  width: 38px; height: 38px; flex: 0 0 38px; border-radius: 50%;
  display: grid; place-items: center; position: relative;
  font-size: var(--fs-12); font-weight: var(--fw-7); color: var(--text-on-brand);
  letter-spacing: var(--ls-tight);
}
.tk .chain-dot {
  position: absolute; right: -2px; bottom: -2px;
  width: 15px; height: 15px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 8px; font-weight: var(--fw-7); color: var(--text-on-brand);
  border: 2px solid var(--surface);
}
.tk.sm { width: 30px; height: 30px; flex-basis: 30px; font-size: var(--fs-11); }
.tk.lg { width: 46px; height: 46px; flex-basis: 46px; font-size: var(--fs-15); }
.tk.sq { border-radius: var(--r-sm); }
/* 远端 logo 层：覆盖字形，加载失败会被 onerror 移除，自动露出底层字形 */
.tk .tk-img {
  position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1;
  border-radius: inherit; object-fit: cover; background: var(--surface-2);
}
.tk .chain-dot { z-index: 2; }
/* data-logo="fallback" 标记「该币走了内置字形」，不做视觉区分，供自检与调试读取 */

/* 语义涨跌色 */
.up { color: var(--up); }
.down { color: var(--down); }
.pill-up, .pill-down {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 62px; padding: 4px 8px; border-radius: var(--r-xs);
  font-size: var(--fs-12); font-weight: var(--fw-6); color: var(--text-on-brand);
}
.pill-up { background: var(--up); }
.pill-down { background: var(--down); }
.pill-arw { display: inline-flex; width: 12px; height: 12px; margin-right: 2px; vertical-align: -1px; }
.pill-arw svg { width: 12px; height: 12px; flex: none; }

.tag {
  display: inline-flex; align-items: center; gap: 4px;
  flex: 0 0 auto; white-space: nowrap;
  padding: 2px 7px; border-radius: var(--r-xs);
  font-size: var(--fs-11); font-weight: var(--fw-5);
  background: var(--surface-3); color: var(--text-2);
}
.tag.brand { background: var(--brand-weak); color: var(--brand); }
.tag.danger { background: var(--red); color: var(--text-on-brand); }
.tag.warn { background: var(--amber); color: var(--tp-black); }
.tag.ok { background: var(--green); color: var(--text-on-brand); }

/* chips */
.chips { display: flex; gap: var(--sp-2); overflow-x: auto; padding: var(--sp-3) var(--sp-4); }
.chips::-webkit-scrollbar { height: 0; }
.chip {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 12px; border-radius: var(--r-pill);
  background: var(--surface); border: 1px solid var(--hairline);
  font-size: var(--fs-12); font-weight: var(--fw-5); color: var(--text-2);
  transition: all var(--dur-1) var(--ease);
}
.chip .dt { width: 8px; height: 8px; border-radius: 50%; }
.chip.on { background: var(--brand-weak); border-color: var(--brand-line); color: var(--brand); }

/* 分段 tab（页内） */
.tabs { display: flex; gap: var(--sp-5); padding: 0 var(--sp-4); border-bottom: 1px solid var(--hairline); }
.tabs .tb {
  padding: var(--sp-3) 0; font-size: var(--fs-14); color: var(--text-3);
  position: relative; font-weight: var(--fw-5);
}
.tabs .tb { transition: color var(--dur-2) var(--ease); }
.tabs .tb.on { color: var(--text); }
.tabs .tb.on::after {
  content: ""; position: absolute; left: 0; right:0; bottom: -1px;
  height: 2px; border-radius: 2px; background: var(--brand);
  transform-origin: center; animation: growX var(--dur-2) var(--ease) both;
}

/* 输入 */
.field { padding: var(--sp-3) var(--sp-4); }
.field-label { font-size: var(--fs-12); color: var(--text-3); margin-bottom: 6px; }
.input, .textarea, .select {
  width: 100%; padding: 12px var(--sp-3);
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: var(--r-md); color: var(--text); font-size: var(--fs-14);
  outline: none; transition: border-color var(--dur-1) var(--ease), background var(--dur-1) var(--ease);
}
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input:focus, .textarea:focus { border-color: var(--brand); background: var(--brand-weak); }
.textarea { min-height: 84px; resize: vertical; line-height: 1.6;
  font-family: var(--font-num); font-size: var(--fs-12); }
.input-row { display: flex; align-items: center; gap: var(--sp-2); }
.input-row .input { flex: 1 1 auto; }
.help { font-size: var(--fs-11); color: var(--text-3); margin-top: 6px; line-height: 1.6; }
.help.warn { color: var(--amber); }

/* 输入框错误态：红边 + 抖动（F9 校验失败反馈） */
.input.err, .textarea.err { border-color: var(--down); background: var(--down-weak); animation: shake 420ms var(--ease-inout); }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

.switch {
  width: 44px; height: 26px; flex: 0 0 44px; border-radius: var(--r-pill);
  background: var(--track); position: relative;
  transition: background var(--dur-2) var(--ease);
}
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 20px; height: 20px; border-radius: 50%; background: var(--tp-offwhite);
  transition: transform var(--dur-3) var(--ease-spring), width var(--dur-1) var(--ease);
  box-shadow: var(--sh-1);
}
.switch:active::after { width: 24px; } /* 按压回弹：先被「拉宽」再弹回 */
.switch.on { background: var(--brand); }
.switch.on::after { transform: translateX(18px); }

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 13px var(--sp-4); border-radius: var(--r-md);
  font-size: var(--fs-15); font-weight: var(--fw-6);
  transition: transform var(--dur-1) var(--ease), background var(--dur-1) var(--ease), opacity var(--dur-1) var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: var(--text-on-brand); }
.btn-primary:hover { background: var(--brand-press); }
.btn-ghost { background: var(--surface-2); color: var(--text); }
.btn-ghost:hover { background: var(--surface-3); }
.btn-danger { background: var(--red); color: var(--text-on-brand); }
.btn-line { border: 1px solid var(--hairline-2); color: var(--text); }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 14px; font-size: var(--fs-12); border-radius: var(--r-sm); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn-row { display: flex; gap: var(--sp-3); padding: var(--sp-4); }

/* 底部固定操作条 */
.dock {
  position: sticky; bottom: 0; z-index: 3;
  padding: var(--sp-3) var(--sp-4) var(--sp-4);
  background: var(--bg);
  border-top: 1px solid var(--hairline);
}

/* 空态 */
.empty { padding: var(--sp-7) var(--sp-4); text-align: center; color: var(--text-3); font-size: var(--fs-12); }
.empty .ic { width: 34px; height: 34px; margin-bottom: var(--sp-2); opacity: .5; }

/* ---------------- 金额输入 ---------------- */
.amount-box { padding: var(--sp-4); }
.amount-big {
  width: 100%; background: none; border: 0; outline: none;
  font-size: var(--fs-26); font-weight: var(--fw-7); color: var(--text);
  padding: 0; letter-spacing: -.01em;
}
.amount-meta { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; font-size: var(--fs-12); color: var(--text-3); }
.max-btn { color: var(--brand); font-weight: var(--fw-6); font-size: var(--fs-12); }
.token-pick {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: var(--r-pill); background: var(--surface-2);
  font-weight: var(--fw-6); font-size: var(--fs-12);
}

/* ---------------- 确认页字段表 ---------------- */
.kv { padding: 0 var(--sp-4); }
.kv-item { display: flex; gap: var(--sp-4); padding: var(--sp-3) 0; box-shadow: inset 0 -1px 0 var(--hairline); }
.kv-item:last-child { box-shadow: none; }
.kv-k { flex: 0 0 96px; font-size: var(--fs-12); color: var(--text-3); }
.kv-v { flex: 1 1 auto; font-size: var(--fs-12); word-break: break-all; }
.kv-v.mono { font-family: var(--font-num); }

/* 风险提示条 */
.alert {
  display: flex; gap: var(--sp-3); padding: var(--sp-3);
  border-radius: var(--r-md); font-size: var(--fs-12); line-height: 1.6;
  background: var(--surface-2); color: var(--text-2);
}
.alert .ic { width: 17px; height: 17px; margin-top: 1px; }
.alert.danger { background: var(--red); color: var(--text-on-brand); }
.alert.warn { background: var(--amber); color: var(--tp-black); }
.alert.info { background: var(--brand-weak); color: var(--text); }

/* ---------------- 遮罩 / 底部弹层 / 对话框 ---------------- */
.overlay-root { position: absolute; inset: 0; z-index: 40; pointer-events: none; }
.overlay-root.open { pointer-events: auto; }
.scrim {
  position: absolute; inset: 0; background: var(--scrim);
  opacity: 0; transition: opacity var(--dur-2) var(--ease);
}
.overlay-root.open .scrim { opacity: 1; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0;
  background: var(--sheet); border-radius: var(--r-xl) var(--r-xl) 0 0;
  max-height: 84%; display: flex; flex-direction: column;
  transform: translateY(102%); transition: transform var(--dur-3) var(--ease);
  box-shadow: var(--sh-3);
}
.overlay-root.open .sheet { transform: none; }
.sheet-grab { width: 40px; height: 4px; border-radius: 2px; background: var(--hairline-2); margin: var(--sp-3) auto var(--sp-1); flex: 0 0 auto; }
.sheet-head { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-2) var(--sp-4) var(--sp-3); flex: 0 0 auto; }
.sheet-title { font-size: var(--fs-15); font-weight: var(--fw-6); flex: 1 1 auto; }
.sheet-body { overflow-y: auto; padding-bottom: var(--sp-5); }

.modal {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%,-46%) scale(.92);
  width: 296px; background: var(--sheet); border-radius: var(--r-lg);
  padding: var(--sp-5); text-align: center; opacity: 0;
  transition: opacity var(--dur-2) var(--ease), transform 340ms var(--ease-spring);
  box-shadow: var(--sh-3);
}
.overlay-root.open .modal { opacity: 1; transform: translate(-50%,-50%) scale(1); }
.modal-title { font-size: var(--fs-15); font-weight: var(--fw-6); }
.modal-text { font-size: var(--fs-12); color: var(--text-2); margin-top: var(--sp-2); line-height: 1.6; }
.modal-acts { display: flex; gap: var(--sp-3); margin-top: var(--sp-5); }
.modal-acts .btn { flex: 1 1 0; }

/* toast */
.toast-root {
  position: absolute; left: 0; right: 0; bottom: 96px; z-index: 60;
  display: flex; flex-direction: column; align-items: center; gap: var(--sp-2);
  pointer-events: none;
}
.toast {
  position: relative; overflow: hidden;
  max-width: 84%; padding: 10px var(--sp-4); border-radius: var(--r-pill);
  background: var(--surface-3); color: var(--text);
  font-size: var(--fs-12); box-shadow: var(--sh-2);
  opacity: 0; transform: translateY(8px);
  transition: opacity var(--dur-2) var(--ease), transform var(--dur-2) var(--ease);
}
[data-theme="light"] .toast { background: var(--tp-black); color: var(--tp-offwhite); }
.toast.in { opacity: 1; transform: none; }
/* 自动消失进度条 */
.toast .bar {
  position: absolute; left: 0; bottom: 0; height: 2px; width: 100%;
  background: var(--brand); transform-origin: left center;
  animation: toastBar var(--toast-ms, 1700ms) linear forwards;
}
@keyframes toastBar { from { transform: scaleX(1); } to { transform: scaleX(0); } }

/* 下拉刷新指示器 */
.ptr {
  position: absolute; left: 0; right: 0; top: 0; height: 0; overflow: hidden;
  display: flex; align-items: flex-start; justify-content: center;
  color: var(--brand); z-index: 6; pointer-events: none;
}
.ptr-ic { margin-top: 10px; transition: transform var(--dur-2) var(--ease); }
.ptr.ready .ptr-ic { transform: rotate(180deg); }
.ptr.spin .ptr-ic { animation: ptrSpin 700ms linear infinite; }
@keyframes ptrSpin { to { transform: rotate(360deg); } }

/* ---------------- 行情 ---------------- */
.mk-row { align-items: center; }
.mk-name { font-size: var(--fs-14); font-weight: var(--fw-6); }
.mk-sym { font-size: var(--fs-11); color: var(--text-3); }
.mk-price { font-size: var(--fs-14); font-weight: var(--fw-6); }
.mk-spark { flex: 0 0 60px; height: 26px; }

.leader-tabs { display: flex; gap: var(--sp-4); padding: var(--sp-3) var(--sp-4) 0; }
.leader-tabs .lt { font-size: var(--fs-12); color: var(--text-3); font-weight: var(--fw-6); padding-bottom: 6px; position: relative; }
.leader-tabs .lt.on { color: var(--brand); }
.leader-tabs .lt.on::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--brand); border-radius: 2px; }

/* 币种详情 */
.coin-head { padding: var(--sp-4); }
.coin-price { font-size: var(--fs-34); font-weight: var(--fw-7); letter-spacing: var(--ls-tight); }
.coin-meta { display: flex; align-items: center; gap: var(--sp-3); margin-top: 6px; font-size: var(--fs-12); color: var(--text-3); }
.periods { display: flex; gap: var(--sp-4); padding: var(--sp-3) var(--sp-4) var(--sp-2); }
.periods .pd { font-size: var(--fs-12); color: var(--text-3); font-weight: var(--fw-6); padding: 3px 0; border-bottom: 2px solid transparent; }
.periods .pd.on { color: var(--brand); border-bottom-color: var(--brand); }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); }
.stat { background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--r-md); padding: var(--sp-3); }
.stat-k { font-size: var(--fs-11); color: var(--text-3); }
.stat-v { font-size: var(--fs-15); font-weight: var(--fw-6); margin-top: 3px; }

/* ---------------- 发现 ---------------- */
.dapp-cats { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); }
.dapp-cat { display: flex; flex-direction: column; align-items: center; gap: 7px; font-size: var(--fs-11); color: var(--text-2); }
.dapp-cat .cc {
  width: 46px; height: 46px; border-radius: var(--r-md);
  display: grid; place-items: center; background: var(--surface-2); color: var(--brand);
}
.dapp-cat .cc .ic { width: 22px; height: 22px; }
.dapp-cat:active .cc { transform: scale(.94); }
.dapp-list { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); }
.dapp-card {
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: var(--r-md); padding: var(--sp-3);
  display: flex; flex-direction: column; gap: 6px;
  transition: transform var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease);
}
.dapp-card:hover { border-color: var(--brand-line); }
.dapp-card:active { transform: scale(.98); }
.dapp-card .dtop { display: flex; align-items: center; gap: var(--sp-2); }
.dapp-name { font-size: var(--fs-12); font-weight: var(--fw-6); flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dapp-desc { font-size: var(--fs-11); color: var(--text-3); line-height: 1.5; height: 2.9em; overflow: hidden; }
.dapp-foot { display: flex; align-items: center; justify-content: space-between; font-size: var(--fs-11); color: var(--text-3); }
.star { color: var(--text-3); }
.star.on { color: var(--amber); }
.star .ic { width: 15px; height: 15px; fill: currentColor; stroke: currentColor; }

/* 内置浏览器 */
.browser-bar {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3); border-bottom: 1px solid var(--hairline); background: var(--bg);
}
.urlbar {
  flex: 1 1 auto; display: flex; align-items: center; gap: 6px;
  background: var(--surface-2); border-radius: var(--r-pill);
  padding: 8px var(--sp-3); font-size: var(--fs-12); color: var(--text-2);
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.urlbar .ic { width: 14px; height: 14px; }
.progress { height: 2px; background: var(--brand); width: 0; transition: width var(--dur-3) var(--ease); }
.browser-body { padding: var(--sp-5) var(--sp-4); }
.browser-mock {
  border: 1px dashed var(--hairline-2); border-radius: var(--r-md);
  padding: var(--sp-5); text-align: center; color: var(--text-3); font-size: var(--fs-12);
}
/* 真实网页框：高度固定成手机内容区比例，站点拒绝被嵌入时框内会空白（不是样式问题） */
.webview-wrap {
  border: 1px solid var(--hairline); border-radius: var(--r-md); overflow: hidden;
  background: var(--surface); margin: 0 var(--sp-4);
}
.webview-frame { display: block; width: 100%; height: 420px; border: 0; background: var(--surface-2); }
.webview-blocked { position: relative; }
.webview-blocked::after {
  content: "该站点拒绝被嵌入显示（空白多半是对方策略，不是加载失败）—— 请用下方「在新标签页打开」";
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center;
  padding: var(--sp-5); font-size: var(--fs-12); color: var(--text-3);
  background: var(--surface);
}

/* 连接授权弹窗（注入式 Provider） */
.connect-card { text-align: left; }
.connect-origin { display: flex; align-items: center; gap: var(--sp-3); padding-bottom: var(--sp-3); border-bottom: 1px solid var(--hairline); }
.connect-origin .oo { width: 40px; height: 40px; border-radius: var(--r-sm); background: var(--brand-weak); color: var(--brand); display: grid; place-items: center; font-weight: var(--fw-7); }

/* ---------------- 授权管理 ---------------- */
.ap-item { }
.ap-risk { width: 4px; align-self: stretch; border-radius: 2px; flex: 0 0 4px; }
.ap-risk.high { background: var(--red); }
.ap-risk.mid { background: var(--amber); }
.ap-risk.low { background: var(--green); }
.allowance-unlimited { color: var(--red); font-weight: var(--fw-6); }
.addr-chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--font-num);
  font-size: var(--fs-11); color: var(--text-3);
}

/* ---------------- 网络 / 设置 ---------------- */
.net-dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 10px; }
.warn-inline { font-size: var(--fs-11); color: var(--amber); margin-top: 4px; line-height: 1.6; }

/* ---------------- 钱包管理 ---------------- */
.wtype-icon { width: 40px; height: 40px; flex: 0 0 40px; border-radius: var(--r-md); display: grid; place-items: center; background: var(--brand-weak); color: var(--brand); }
.wtype-icon.gray { background: var(--surface-3); color: var(--text-2); }
.wtype-icon.gold { background: var(--amber); color: var(--tp-black); }

/* ---------------- 助记词 ---------------- */
.mn-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-2); padding: var(--sp-3) var(--sp-4); }
.mn-word {
  display: flex; align-items: center; gap: 5px;
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: var(--r-sm); padding: 8px;
  font-size: var(--fs-12); font-family: var(--font-num);
}
.mn-word i { font-style: normal; color: var(--text-3); font-size: var(--fs-11); min-width: 14px; }
.mn-blur { filter: blur(5px); user-select: none; }
.blur-note { text-align: center; font-size: var(--fs-12); color: var(--text-3); padding: 0 var(--sp-4) var(--sp-3); }

/* ---------------- 二维码 ---------------- */
.qr-wrap { display: grid; place-items: center; padding: var(--sp-4); }
.qr-box { background: var(--tp-offwhite); padding: var(--sp-3); border-radius: var(--r-md); }
.qr-box svg { display: block; }
.qr-badge { margin-top: var(--sp-2); font-size: var(--fs-11); color: var(--text-3); text-align: center; }

/* ---------------- 扫一扫（相机取景框） ----------------
   真取流时的取景框：视频铺满，四角是品牌色直角，中间一条扫描线来回走。
   环境没有相机或原生解码器时这段根本不渲染，改走「粘贴解析」分支。 */
.scan-stage {
  position: relative; width: 100%; aspect-ratio: 1 / 1; max-height: 260px;
  background: var(--tp-black); border-radius: var(--r-md); overflow: hidden;
}
.scan-stage video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-frame {
  position: absolute; inset: 14%; border-radius: var(--r-sm);
  box-shadow: 0 0 0 100vmax rgba(1, 1, 9, .38);
}
.scan-frame::before, .scan-frame::after {
  content: ""; position: absolute; width: 22px; height: 22px; border: 2px solid var(--brand);
}
.scan-frame::before { top: -2px; left: -2px; border-right: 0; border-bottom: 0; border-top-left-radius: var(--r-sm); }
.scan-frame::after { bottom: -2px; right: -2px; border-left: 0; border-top: 0; border-bottom-right-radius: var(--r-sm); }
.scan-stage::after {
  content: ""; position: absolute; left: 14%; right: 14%; height: 2px;
  background: linear-gradient(90deg, transparent, var(--brand), transparent);
  animation: scanSweep 2.1s var(--ease-inout) infinite;
}
@keyframes scanSweep { 0% { top: 16%; } 50% { top: 82%; } 100% { top: 16%; } }

/* ---------------- 右侧说明 ---------------- */
.notes { width: 268px; flex: 0 0 268px; display: flex; flex-direction: column; gap: var(--sp-4); position: sticky; top: var(--sp-6); }
.notes-card { background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--r-md); padding: var(--sp-4); }
.notes-card h3 { font-size: var(--fs-12); margin-bottom: var(--sp-2); }
.notes-card li { font-size: var(--fs-12); color: var(--text-2); line-height: 1.7; padding-left: var(--sp-4); position: relative; }
.notes-card li::before { content: ""; position: absolute; left: 5px; top: .62em; width: 4px; height: 4px; border-radius: 50%; background: var(--brand); }
.notes-card code { color: var(--brand); }
.notes-card ol { counter-reset: n; }
.notes-card ol li { counter-increment: n; }
.notes-card ol li::before { content: counter(n) "."; background: none; width: auto; height: auto; left: 0; top: 0; color: var(--brand); font-weight: var(--fw-6); border-radius: 0; }

/* ---------------- 观察钱包：灰色资产界面 ---------------- */
.watch-mode .tk,
.watch-mode .row-val,
.watch-mode .balance-num { filter: grayscale(1); opacity: .72; }
.watch-mode .row-val2 { filter: grayscale(1); }

/* ==========================================================================
   动效层（币安动效规范：进入 280-400ms expo.out；press 120ms；非对称计时）
   页面进场 → 列表级联 → 行情闪动 → 图表绘制 → 微交互，逐层叠加。
   ========================================================================== */

/* 页面进场：每次 paint() 生成新节点，动画自动重放 */
.page, .page-head, .coin-head, .head {
  animation: pageIn var(--dur-4) var(--ease-expo) both;
}
@keyframes pageIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

/* 列表级联：--i 由 fx.stagger() 写入，26ms 步进 */
.card .row, .list .row, .dapp-card, .mn-word, .chip {
  animation: rowIn var(--dur-4) var(--ease-expo) both;
  animation-delay: calc(var(--i, 0) * 26ms);
}
@keyframes rowIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

/* 行情闪动：价格变动方向瞬时底色脉冲（实时跳动由 fx.live() 驱动） */
.fl-up   { animation: flUp   900ms var(--ease-out, var(--ease)); }
.fl-down { animation: flDown 900ms var(--ease-out, var(--ease)); }
@keyframes flUp {
  0%   { background: var(--up-weak); }
  100% { background: transparent; }
}
@keyframes flDown {
  0%   { background: var(--down-weak); }
  100% { background: transparent; }
}

/* 数字跳动：价格更新瞬间的缩放脉冲 */
.tick { animation: tickPop 360ms var(--ease-expo); }
@keyframes tickPop {
  0% { transform: scale(1); }
  35% { transform: scale(1.06); }
  100% { transform: scale(1); }
}

/* 图表绘制：走势线描边生长，面积渐入，K 线逐根升起 */
.mk-spark path {
  stroke-dasharray: 240;
  stroke-dashoffset: 240;
  animation: drawLine 900ms var(--ease) forwards;
}
@keyframes drawLine { to { stroke-dashoffset: 0; } }

.chart-area .area-fill { animation: fadeIn var(--dur-4) var(--ease) both; }
.chart-area .area-line {
  stroke-dasharray: 1200;
  stroke-dashoffset: 1200;
  animation: drawLine 1100ms var(--ease) forwards;
}
.chart-area .area-dot { animation: dotPop 400ms 900ms var(--ease-expo) both; }
@keyframes dotPop { from { opacity: 0; transform: scale(0); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.chart-kline rect, .chart-kline line.wick {
  transform-box: fill-box;
  transform-origin: center bottom;
  animation: candleUp 500ms var(--ease-expo) both;
  animation-delay: calc(var(--i, 0) * 14ms);
}
@keyframes candleUp {
  from { opacity: 0; transform: scaleY(.2); }
  to   { opacity: 1; transform: none; }
}

/* 底部 Tab 切换：激活图标弹跳 */
.tab.on .ic { animation: tabPop 260ms var(--ease-expo); }
@keyframes tabPop {
  0% { transform: scale(.8); }
  60% { transform: scale(1.12); }
  100% { transform: scale(1); }
}

/* 实时脉冲点（行情页「实时」徽标） */
.live-dot {
  width: 7px; height: 7px; border-radius: 50%; flex: 0 0 7px;
  background: var(--green); position: relative;
}
.live-dot::after {
  content: ""; position: absolute; inset: -3px;
  border-radius: 50%; border: 1.5px solid var(--green);
  animation: livePing 1600ms var(--ease) infinite;
}
@keyframes livePing {
  0% { transform: scale(.6); opacity: .9; }
  80%, 100% { transform: scale(1.7); opacity: 0; }
}
.live-tag {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: var(--fs-11); color: var(--text-3); font-weight: var(--fw-5);
}

/* 余额滚动完成后的一次呼吸高光 */
.balance-num.breathe { animation: breathe 700ms var(--ease); }
@keyframes breathe {
  0% { text-shadow: 0 0 0 rgba(255,255,255,0); }
  40% { text-shadow: 0 0 18px var(--glow); }
  100% { text-shadow: 0 0 0 rgba(255,255,255,0); }
}

/* 骨架屏微光（切换网络 / 筛选时的占位 shimmer 供后续使用） */
.shimmer {
  background: linear-gradient(100deg, var(--surface) 40%, var(--surface-2) 50%, var(--surface) 60%);
  background-size: 200% 100%;
  animation: shimmer 1.2s linear infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* =========================== v3.0 新增动效段 =========================== */

/* 按压波纹：fx.ripple() 在按下点生成 .ripple 扩散 */
.ripple-host { position: relative; overflow: hidden; }
.ripple {
  position: absolute; border-radius: 50%; pointer-events: none;
  background: currentColor; opacity: .14;
  transform: scale(0);
  animation: rippleOut 520ms var(--ease-out, var(--ease)) forwards;
}
@keyframes rippleOut {
  to { transform: scale(1); opacity: 0; }
}

/* 校验失败抖动：fx.shake() */
.shake { animation: shakeX 420ms var(--ease-inout); }
@keyframes shakeX {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-7px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(3px); }
}

/* 公告跑马灯（资产页头部下方，TP 特征组件） */
.notice {
  display: flex; align-items: center; gap: var(--sp-2);
  margin: var(--sp-3) var(--sp-4) 0;
  padding: 7px var(--sp-3); border-radius: var(--r-pill);
  background: var(--brand-weak);
  font-size: var(--fs-12); color: var(--brand); font-weight: var(--fw-5);
  overflow: hidden;
}
.notice .ic { width: 14px; height: 14px; flex: 0 0 14px; }
.notice-track { flex: 1 1 auto; overflow: hidden; white-space: nowrap; mask-image: linear-gradient(90deg, transparent, rgba(0,0,0,.95) 6%, rgba(0,0,0,.95) 94%, transparent); }
.notice-move { display: inline-block; padding-right: 48px; animation: marquee 18s linear infinite; }
@keyframes marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* 成功对勾弹出（复制 / 签名成功后的强调反馈） */
.ok-pop {
  display: inline-grid; place-items: center;
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--green); color: var(--text-on-brand);
  animation: okPop 480ms var(--ease-spring) both;
}
.ok-pop .ic { width: 22px; height: 22px; stroke-width: 2.4; }
.ok-pop .ic path {
  stroke-dasharray: 30; stroke-dashoffset: 30;
  animation: drawLine 420ms 160ms var(--ease) forwards;
}
@keyframes okPop {
  0% { opacity: 0; transform: scale(.4); }
  100% { opacity: 1; transform: scale(1); }
}

/* 头部状态数字闪光划过（总资产数字上的一道高光扫过） */
.head::before {
  content: ""; position: absolute; left: -60%; top: 0; bottom: 0; width: 45%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.14), transparent);
  transform: skewX(-18deg);
  animation: sheen 4.8s var(--ease-inout) infinite;
  pointer-events: none;
}
@keyframes sheen {
  0%, 55% { left: -60%; }
  85%, 100% { left: 130%; }
}

/* 状态徽标（后台风格脉冲，钱包内用于实时标识） */
.pulse-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: var(--fs-11); font-weight: var(--fw-5);
  padding: 3px 9px; border-radius: var(--r-pill);
  background: var(--up-weak); color: var(--up-txt);
}
.pulse-badge .dt { width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: pulseDt 1.4s var(--ease) infinite; }
@keyframes pulseDt {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .45; transform: scale(.72); }
}

/* ---------------- 响应式 ---------------- */
@media (max-width: 1180px) { .notes { display: none; } }
@media (max-width: 900px) {
  .rail { display: none; }
  .stage { padding: 0; gap: 0; }
  .device { flex: 1 1 auto; width: 100%; }
  .device-frame {
    width: 100%; height: 100vh; max-width: none;
    border-radius: 0; border: 0; box-shadow: none;
  }
  .sb-notch { display: none; }
}

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