/**
 * aihub — Luma Boards 产品壳精髓
 * 参考：主号 Chrome https://app.lumalabs.ai/boards 实拍
 * + auth 页 dark-theme/light-theme 变量（Radix gray 阶）
 */

@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");

/* ========== Luma tokens (from app dark/light) ========== */
html[data-theme="dark"],
html:not([data-theme]) {
  color-scheme: dark;
  --page: #000000;
  --bg: #111111;
  --panel: #191919;
  --panel-2: #222222;
  --panel-3: #2a2a2a;
  --text: #eeeeee;
  --text-2: #b4b4b4;
  --text-3: #7b7b7b;
  --line: #ffffff12;
  --line-2: #ffffff1b;
  --line-3: #ffffff2c;
  --hover: #ffffff09;
  --hover-2: #ffffff12;
  --btn: #ffffff;
  --btn-text: #000000;
  --btn-hover: #f6f6f6;
  --ghost-border: #ffffff2c;
  --glow: rgba(80, 120, 255, 0.22);
  --ok: #34d399;
  --ok-bg: rgba(52, 211, 153, 0.14);
  --warn: #fbbf24;
  --warn-bg: rgba(251, 191, 36, 0.14);
  --bad: #f87171;
  --bad-bg: rgba(248, 113, 113, 0.14);
  --dot: radial-gradient(#ffffff0a 1px, transparent 1px);
  --theme-color: #111111;
}

html[data-theme="light"] {
  color-scheme: light;
  --page: #ffffff;
  --bg: #fcfcfc;
  --panel: #f9f9f9;
  --panel-2: #f0f0f0;
  --panel-3: #e8e8e8;
  --text: #202020;
  --text-2: #646464;
  --text-3: #838383;
  --line: #0000000f;
  --line-2: #00000017;
  --line-3: #00000026;
  --hover: #00000006;
  --hover-2: #0000000f;
  --btn: #000000;
  --btn-text: #ffffff;
  --btn-hover: #2e2e2e;
  --ghost-border: #00000026;
  --glow: rgba(80, 120, 255, 0.12);
  --ok: #0d9f6e;
  --ok-bg: rgba(13, 159, 110, 0.12);
  --warn: #b45309;
  --warn-bg: rgba(180, 83, 9, 0.1);
  --bad: #dc2626;
  --bad-bg: rgba(220, 38, 38, 0.1);
  --dot: radial-gradient(#0000000a 1px, transparent 1px);
  --theme-color: #ffffff;
}

:root {
  --font: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", "PingFang SC", sans-serif;
  /* 侧栏宽：必须在 :root，禁止只写在 dark 里导致浅色栏塌成内容宽 */
  --rail-w: 240px;
  /* 内容区高度（不含 home indicator） */
  --tabbar-h: 50px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  /* 底栏避让：只留底栏高度 + 安全区 + 少量余量（过大=滚到底一大片空） */
  --tabbar-space: calc(var(--tabbar-h) + var(--safe-b) + 12px);
  /* 动效：克制、产品级（非弹跳 demo） */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-fast: 120ms;
  --dur: 200ms;
  --dur-med: 320ms;
  --dur-slow: 480ms;
  /* APIMart 风：小圆角硬边框，别用大软圆 */
  --r: 4px;
  --r-lg: 6px;
  --r-xl: 8px;
  --shadow-card: 0 8px 28px rgba(0, 0, 0, 0.28);
  --shadow-lift: 0 14px 36px rgba(0, 0, 0, 0.32);
  --z-tab: 100;
  --z-toast: 160;
  --z-drawer: 300;
  --z-preview: 400;
}

html[data-theme="light"] {
  --shadow-card: 0 8px 24px rgba(0, 0, 0, 0.08);
  --shadow-lift: 0 14px 36px rgba(0, 0, 0, 0.12);
}

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

html {
  -webkit-text-size-adjust: 100%;
  width: 100%;
  max-width: 100%;
  /* 纵向必须能滚；只锁横向（勿用 clip 叠多层，会吞滚轮） */
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-x: none;
  /* 主题切换：底色/字色平滑过渡 */
  transition: background-color var(--dur-med) var(--ease), color var(--dur) ease;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  background: var(--page);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100dvh;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-x: none;
  /* 勿设 overscroll-behavior-y:none — 部分环境会表现为无法滚 */
  /* PWA / 刘海：内容别顶进状态栏（black-translucent） */
  padding-top: var(--safe-t);
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}

body.drawer-open,
body.xyq-preview-open {
  overflow: hidden;
}

button {
  font: inherit;
  color: inherit;
  border: 0;
  background: none;
  cursor: pointer;
  padding: 0;
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--line-3);
  outline-offset: 2px;
  border-radius: 8px;
}

/* 入场 / 微交互关键帧 */
@keyframes view-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes drawer-in {
  from {
    opacity: 0.6;
    transform: translateX(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes drawer-up {
  from {
    opacity: 0.7;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes glow-breathe {
  0%,
  100% {
    opacity: 0.55;
    transform: translateX(-50%) scale(1);
  }
  50% {
    opacity: 0.9;
    transform: translateX(-50%) scale(1.06);
  }
}

@keyframes tab-pop {
  0% {
    transform: scale(0.88);
  }
  55% {
    transform: scale(1.06);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

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

a {
  color: inherit;
  text-decoration: none;
}

img,
video {
  display: block;
  max-width: 100%;
}

.ico {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

/* ========== Shell: rail + workspace ========== */
.shell {
  display: flex;
  min-height: 100dvh;
  width: 100%;
  max-width: 100%;
  /* 中间层不要 overflow，交给 html/body 滚 */
  background: var(--page);
}

/* Left rail — 固定宽，深浅同宽 */
.rail {
  width: var(--rail-w);
  min-width: var(--rail-w);
  max-width: var(--rail-w);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  padding: 16px 12px 12px;
  background: var(--page);
  border-right: 1px solid var(--line);
  position: sticky;
  top: 0;
  height: 100dvh;
  z-index: 20;
  box-sizing: border-box;
  transition: background-color var(--dur-med) var(--ease), border-color var(--dur) ease;
}

/* 品牌：放大 mark + wordmark，去掉假用户卡 */
.rail-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 18px;
  color: var(--text);
  text-decoration: none;
  transition: opacity var(--dur-fast) ease;
}

.rail-brand:hover {
  opacity: 0.88;
}

.rail-brand .brand-mark {
  display: block;
  height: 28px;
  width: auto;
  color: inherit;
  flex-shrink: 0;
  transition: transform var(--dur) var(--ease);
}

.rail-brand:hover .brand-mark {
  transform: scale(1.02);
}

.rail-brand img {
  height: 28px;
  width: auto;
  background: transparent;
}

/* 账号页英雄区仍用圆形缩写 */
.rail-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--btn);
  color: var(--btn-text);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}

.rail-nav,
.rail-sec {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.rail-sec {
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.rail-sec-label {
  margin: 0 0 4px;
  padding: 0 10px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-3);
}

/* 主导航：仅 rail-nav 内 item 可 is-active */
.rail-nav .rail-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border-radius: var(--r);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-2);
  text-align: left;
  border: 0;
  background: transparent;
  transition: background var(--dur-fast) ease, color var(--dur-fast) ease;
}

.rail-nav .rail-item:hover {
  background: var(--hover-2);
  color: var(--text);
}

.rail-nav .rail-item.is-active {
  background: var(--panel-2);
  color: var(--text);
}

.rail-nav .rail-item .ico {
  width: 18px;
  height: 18px;
  opacity: 0.85;
}

.rail-nav .rail-item.is-active .ico {
  opacity: 1;
}

/* 页内锚点：弱样式，绝不跟主导航抢选中 */
.rail-link {
  display: block;
  width: 100%;
  padding: 6px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-3);
  font-size: 12.5px;
  font-weight: 500;
  text-align: left;
  transition: color var(--dur-fast) ease, background var(--dur-fast) ease;
}

.rail-link:hover {
  color: var(--text-2);
  background: var(--hover);
}

.rail-foot {
  margin-top: auto;
  padding: 12px 4px 4px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.theme-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  border: 1px solid var(--line);
  background: transparent;
  transition:
    background var(--dur-fast) ease,
    color var(--dur-fast) ease,
    border-color var(--dur-fast) ease,
    transform var(--dur-fast) var(--ease);
}

.theme-toggle:hover {
  background: var(--hover-2);
  color: var(--text);
  border-color: var(--line-2);
}

.theme-toggle:active {
  transform: scale(0.98);
}

.theme-ico {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  position: relative;
  flex-shrink: 0;
}

html[data-theme="dark"] .theme-ico {
  background: linear-gradient(90deg, currentColor 50%, transparent 50%);
}

html[data-theme="light"] .theme-ico {
  background: currentColor;
  box-shadow: inset -4px 0 0 0 var(--page);
}

.rail-credit {
  margin: 0;
  padding: 0 10px;
  font-size: 11px;
  color: var(--text-3);
  line-height: 1.35;
}

/* Workspace */
.workspace {
  flex: 1;
  min-width: 0; /* 防 flex 子项撑破横向 */
  max-width: 100%;
  background:
    var(--dot) 0 0 / 22px 22px,
    var(--bg);
  transition: background-color var(--dur-med) var(--ease);
}

.canvas {
  /* 高度跟内容走；别 min-height:100dvh，否则短页+底栏 padding 会滚出大空白 */
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 0;
}

.view {
  display: none;
  max-width: 100%;
}

.view.is-active {
  display: block;
}

@media (min-width: 769px) {
  .canvas,
  .view.is-active {
    min-height: 100dvh;
  }
}

/* 切页：轻上移 + 淡入（产品壳标准手感） */
.view.is-active.is-enter {
  animation: view-in var(--dur-med) var(--ease-out) both;
}

/* ========== Agent：Open WebUI；手机全屏专用壳 ========== */
.agent {
  display: flex;
  flex-direction: column;
  height: calc(100dvh - var(--safe-t));
  max-width: none;
  margin: 0;
  padding: 12px;
  box-sizing: border-box;
  min-height: 0;
}

.agent-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  flex-shrink: 0;
  padding: 0 4px;
}

.agent-back {
  display: none;
  flex-shrink: 0;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line-2);
  background: var(--panel);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--r);
}

.agent-bar-main {
  min-width: 0;
  flex: 1;
}

.agent-bar h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.agent-sub {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.45;
  max-width: 64ch;
}

.agent-bar-right {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-end;
}

.agent-ext {
  display: none;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  text-decoration: none;
  border: 1px solid var(--line-2);
  padding: 6px 10px;
  border-radius: var(--r);
  background: var(--panel);
}

.agent-ext:hover {
  color: var(--text);
}

.agent-status,
.agent-ui-badge {
  flex-shrink: 0;
  font-size: 11px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--text-3);
  border: 1px solid var(--line-2);
  background: var(--panel);
  padding: 6px 10px;
  line-height: 1.35;
  max-width: 320px;
  text-align: right;
}

.agent-status.is-ok,
.agent-ui-badge.is-ok {
  color: var(--ok);
}

.agent-status.is-bad,
.agent-ui-badge.is-bad {
  color: var(--bad);
}

.agent-frame {
  flex: 1;
  min-height: 0;
  display: flex;
  border: 1px solid var(--line-2);
  background: var(--panel);
  overflow: hidden;
}

.agent-iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: #0a0a0a;
  /* 减少双滚动手势冲突 */
  touch-action: pan-x pan-y;
}

.agent-boot {
  padding: 28px 24px;
  max-width: 560px;
  margin: auto;
  color: var(--text);
}

.agent-boot h2 {
  margin: 0 0 10px;
  font-size: 18px;
  font-weight: 600;
}

.agent-boot p {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.5;
}

.agent-boot ol {
  margin: 0 0 16px;
  padding-left: 1.2em;
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.55;
}

.agent-boot pre {
  margin: 8px 0;
  padding: 10px 12px;
  background: var(--page);
  border: 1px solid var(--line-2);
  font-size: 12px;
  overflow-x: auto;
  color: var(--text);
}

.agent-boot-meta {
  font-size: 12px !important;
  color: var(--text-3) !important;
}

.agent-boot .btn {
  margin-right: 8px;
  margin-top: 4px;
  text-decoration: none;
}

/* —— 手机：Agent 全屏，藏底栏，iframe 铺满（唯一可接受嵌套方式） —— */
@media (max-width: 768px) {
  body.agent-mobile-fs {
    overflow: hidden !important;
    /* 盖过 body padding-top 安全区，改由顶条自己吃 */
    padding-top: 0 !important;
  }

  body.agent-mobile-fs .mobile-tabbar {
    display: none !important;
  }

  body.agent-mobile-fs .shell {
    min-height: 100dvh;
  }

  body.agent-mobile-fs #view-agent.view.is-active {
    position: fixed;
    inset: 0;
    z-index: 180;
    display: block !important;
    min-height: 0 !important;
    max-width: none;
    background: var(--page);
    overflow: hidden;
  }

  body.agent-mobile-fs .agent {
    position: absolute;
    inset: 0;
    height: 100%;
    max-height: 100%;
    padding: 0;
    margin: 0;
  }

  body.agent-mobile-fs .agent-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 2;
    height: calc(44px + env(safe-area-inset-top, 0px));
    margin: 0;
    padding: env(safe-area-inset-top, 0px) 8px 0;
    box-sizing: border-box;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    background: color-mix(in srgb, var(--page) 94%, transparent);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line-2);
  }

  body.agent-mobile-fs .agent-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  body.agent-mobile-fs .agent-bar-main h1,
  body.agent-mobile-fs .agent-sub,
  body.agent-mobile-fs .agent-status,
  body.agent-mobile-fs .agent-ui-badge {
    display: none;
  }

  body.agent-mobile-fs .agent-bar-right {
    flex-direction: row;
    align-items: center;
    margin-left: auto;
  }

  body.agent-mobile-fs .agent-ext {
    display: inline-flex;
  }

  body.agent-mobile-fs .agent-frame {
    position: absolute;
    top: calc(44px + env(safe-area-inset-top, 0px));
    left: 0;
    right: 0;
    bottom: 0;
    border: 0;
    border-radius: 0;
  }

  body.agent-mobile-fs .agent-boot {
    padding: 20px 16px;
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  }

  /* 未进全屏时的兜底（boot 页） */
  .agent {
    height: calc(100dvh - var(--safe-t) - var(--tabbar-h) - var(--safe-b));
    padding: 8px;
  }
}

/* ========== Home: 仪表盘（与资产页共用 am-* 语言） ========== */
.home,
.am-home {
  padding: 28px 32px 80px;
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
  min-width: 0;
}

.home-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.home-title {
  margin: 0;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--text);
}

.board-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.am-link {
  border: 0;
  background: transparent;
  padding: 0;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  cursor: pointer;
  text-decoration: none;
}

.am-link:hover {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* 首页快照格可点进资产 */
.am-cell.is-link {
  cursor: pointer;
  border: 0;
  width: 100%;
  text-align: left;
  color: inherit;
  font: inherit;
}

.am-cell.is-link:hover {
  background: var(--panel-2);
}

/* 首页只留一条风险入口，不堆完整列表 */
.home-alert {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin: 0 0 16px;
  padding: 12px 14px;
  border: 1px solid var(--line-2);
  background: var(--panel);
  text-align: left;
  color: inherit;
  cursor: pointer;
}

.home-alert:hover {
  background: var(--panel-2);
}

.home-alert-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--warn);
}

.home-alert-dot.is-bad {
  background: var(--bad);
}

.home-alert-txt {
  min-width: 0;
  flex: 1;
}

.home-alert-txt strong {
  display: block;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.home-alert-txt em {
  display: block;
  margin-top: 2px;
  font-style: normal;
  font-size: 12px;
  color: var(--text-3);
}

.home-snap {
  margin-bottom: 12px;
}

.home-media {
  margin-top: 4px;
  margin-bottom: 12px;
}

.home-media-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0 12px;
}

.home-media-h h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 500;
}

/* 分段：对齐 APIMart 方钮 */
.seg {
  display: inline-flex;
  gap: 0;
  padding: 0;
  border-radius: var(--r);
  background: transparent;
  border: 1px solid var(--line-2);
  overflow: hidden;
}

.seg button {
  height: 30px;
  padding: 0 12px;
  border-radius: 0;
  border-right: 1px solid var(--line-2);
  font-size: 12px;
  font-weight: 500;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--text-3);
  background: transparent;
  transition: background var(--dur-fast) ease, color var(--dur-fast) ease;
}

.seg button:last-child {
  border-right: 0;
}

.seg button:hover {
  color: var(--text);
  background: var(--hover-2);
}

.seg button.is-active {
  background: var(--btn);
  color: var(--btn-text);
  box-shadow: none;
}

/* Board card grid */
.board-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 12px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.board-card {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--r-lg);
  background: var(--panel);
  border: 1px solid var(--line-2);
  overflow: hidden;
  cursor: pointer;
  padding: 0;
  text-align: left;
  min-width: 0;
  max-width: 100%;
  isolation: isolate;
  transition:
    border-color var(--dur) ease,
    transform var(--dur) var(--ease),
    background var(--dur) ease,
    box-shadow var(--dur) var(--ease);
  /* 入场：按 --i 错开，上限约 0.36s */
  animation: card-in var(--dur-slow) var(--ease-out) both;
  animation-delay: calc(min(var(--i, 0), 12) * 28ms);
}

.board-card:hover {
  border-color: var(--line-3);
  transform: translateY(-3px);
  background: var(--panel-2);
  box-shadow: var(--shadow-card);
  z-index: 1;
}

.board-card:active {
  transform: translateY(-1px) scale(0.99);
}

@media (hover: none) {
  .board-card:hover {
    transform: none;
    box-shadow: none;
  }
}

.board-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--dur-slow) var(--ease-out);
  will-change: transform;
}

.board-card:hover img {
  transform: scale(1.045);
}

.board-card-new {
  display: grid;
  place-items: center;
  color: var(--text-3);
  font-size: 32px;
  font-weight: 300;
  line-height: 1;
  background: var(--panel);
  border-style: dashed;
  border-color: var(--line-2);
  transition:
    border-color var(--dur) ease,
    color var(--dur) ease,
    background var(--dur) ease,
    transform var(--dur) var(--ease),
    box-shadow var(--dur) var(--ease);
}

.board-card-new:hover {
  border-style: solid;
  border-color: var(--line-3);
  color: var(--text-2);
  background: var(--panel-2);
}

.board-card-new small {
  display: block;
  margin-top: 8px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--text-3);
  transition: color var(--dur) ease;
}

.board-card-shade {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 28px 10px 10px;
  background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.55) 55%, rgba(0, 0, 0, 0.82) 100%);
  color: #fff;
  pointer-events: none;
  transition: opacity var(--dur) ease;
}

html[data-theme="light"] .board-card-shade {
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.55));
}

.board-card-shade b {
  display: block;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.board-card-shade span {
  display: block;
  margin-top: 2px;
  font-size: 10px;
  opacity: 0.7;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.board-card-play {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 42px;
  height: 42px;
  margin: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.48);
  border: 1px solid rgba(255, 255, 255, 0.22);
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.94);
  opacity: 0.92;
  transition:
    transform var(--dur) var(--ease),
    opacity var(--dur) ease,
    background var(--dur) ease,
    box-shadow var(--dur) ease;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.board-card:hover .board-card-play {
  transform: translate(-50%, -50%) scale(1.06);
  opacity: 1;
  background: rgba(0, 0, 0, 0.58);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

.board-card-play::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-35%, -50%);
  border-style: solid;
  border-width: 6px 0 6px 10px;
  border-color: transparent transparent transparent #fff;
}

/* Library (legacy hooks) */
.lib {
  padding: 28px 28px 64px;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  min-width: 0;
}

.lib-title {
  margin: 0 0 16px;
  font-size: 28px;
  font-weight: 500;
  letter-spacing: -0.03em;
}

/*
 * 资产页 — 抄 APIMart 控制台语言
 * 硬边框网格指标、mono 微标、分段条、方卡片，移动端 2 列压实
 */
.am {
  padding: 28px 32px 80px;
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
  min-width: 0;
}

.am-head {
  margin-bottom: 16px;
}

.am-head h1 {
  margin: 0;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.am-head p {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--text-3);
  line-height: 1.5;
}

/* 分段：APIMart 方钮 */
.am-seg {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin-bottom: 16px;
  border: 1px solid var(--line-2);
  width: fit-content;
  max-width: 100%;
}

.am-seg button {
  height: 32px;
  padding: 0 14px;
  font-size: 12px;
  font-weight: 500;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--text-3);
  background: transparent;
  border: 0;
  border-right: 1px solid var(--line-2);
  letter-spacing: 0.02em;
}

.am-seg button:last-child {
  border-right: 0;
}

.am-seg button.is-on {
  background: var(--btn);
  color: var(--btn-text);
}

.am-seg button:not(.is-on):hover {
  color: var(--text);
  background: var(--hover-2);
}

/* 指标网格：共享边框，像 APIMart 看板 */
.am-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--line-2);
  background: var(--line-2);
  gap: 1px;
  margin-bottom: 16px;
  scroll-margin-top: 12px;
}

.am-grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.am-grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.acct-rules {
  margin: 0;
  padding: 12px 14px 14px 28px;
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.55;
}

.acct-rules li {
  margin-bottom: 6px;
}

.acct-rules li:last-child {
  margin-bottom: 0;
}

.am-cell {
  background: var(--panel);
  padding: 14px 16px;
  min-height: 88px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  position: relative;
  overflow: hidden;
}

.am-cell-k {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-3);
  line-height: 1.3;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.am-cell-v {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1.05;
  color: var(--text);
}

.am-cell-s {
  font-size: 11px;
  color: var(--text-3);
  line-height: 1.35;
}

/* 面板块 */
.am-panel {
  border: 1px solid var(--line-2);
  background: var(--panel);
  margin-bottom: 12px;
  scroll-margin-top: 12px;
}

.am-panel-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.am-panel-h h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.am-panel-h span {
  font-size: 11px;
  color: var(--text-3);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
}

.am-panel-b {
  padding: 0;
}

.am-panel-note {
  margin: 0;
  padding: 10px 14px;
  font-size: 12px;
  color: var(--text-3);
  border-bottom: 1px solid var(--line);
  line-height: 1.45;
}

/* 风险行 */
.am-risk {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  color: inherit;
  background: transparent;
}

.am-risk:last-child {
  border-bottom: 0;
}

.am-risk:hover {
  background: var(--hover);
}

.am-risk-dot {
  width: 7px;
  height: 7px;
  margin-top: 5px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--warn);
}

.am-risk-dot.is-bad {
  background: var(--bad);
}

.am-risk-body {
  flex: 1;
  min-width: 0;
}

.am-risk-body strong {
  display: block;
  font-size: 13px;
  font-weight: 500;
}

.am-risk-body span {
  display: block;
  margin-top: 3px;
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.4;
}

.am-risk-st {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 500;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--warn);
}

.am-risk-st.is-bad {
  color: var(--bad);
}

/* 通道双栏 */
.am-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}

.am-col {
  padding: 12px 14px 14px;
  min-width: 0;
}

.am-col + .am-col {
  border-left: 1px solid var(--line);
}

.am-col h3 {
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-3);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.am-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.am-tags li {
  font-size: 12px;
  font-weight: 500;
  padding: 4px 8px;
  border: 1px solid var(--line-2);
  background: var(--page);
  color: var(--text-2);
}

.am-tags.is-dead li {
  color: var(--text-3);
  font-weight: 400;
  text-decoration: line-through;
  text-decoration-color: var(--line-3);
  opacity: 0.85;
}

/* 列表行 */
.am-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px 12px;
  align-items: center;
  width: 100%;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  color: inherit;
  background: transparent;
}

.am-row:last-child {
  border-bottom: 0;
}

.am-row:hover {
  background: var(--hover);
}

.am-row-main {
  min-width: 0;
}

.am-row-main strong {
  display: block;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.am-row-main span {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.am-row-id {
  font-size: 11px;
  color: var(--text-3);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: nowrap;
}

.am-row-st {
  font-size: 11px;
  font-weight: 500;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: nowrap;
  min-width: 2.5em;
  text-align: right;
}

.am-row-st.is-ok {
  color: var(--ok);
}

.am-row-st.is-warn {
  color: var(--warn);
}

.am-row-st.is-bad {
  color: var(--bad);
}

.am-foot {
  margin-top: 8px;
  padding: 14px 0 0;
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.5;
}

.am-foot button {
  color: var(--text-2);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 3px;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  font: inherit;
}

.am-foot button:hover {
  color: var(--text);
}

.am-empty {
  padding: 16px 14px;
  font-size: 13px;
  color: var(--text-3);
}

/* 兼容旧 hub 类名若残留 */
.hub {
  display: contents;
}

/* Account */
.acct {
  padding: 48px 28px 80px;
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  min-width: 0;
}

.acct-hero {
  text-align: center;
  margin-bottom: 36px;
}

.acct-hero .rail-avatar {
  width: 64px;
  height: 64px;
  font-size: 22px;
  margin: 0 auto 14px;
}

.acct-hero h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 500;
  letter-spacing: -0.03em;
}

.acct-hero p {
  margin: 6px 0 0;
  color: var(--text-3);
  font-size: 14px;
}

.acct-stats {
  display: flex;
  justify-content: center;
  gap: 28px;
  margin-top: 20px;
}

.acct-stats b {
  display: block;
  font-size: 20px;
  font-weight: 500;
}

.acct-stats span {
  font-size: 11px;
  color: var(--text-3);
}

.acct-block {
  margin-bottom: 28px;
}

.acct-block h2 {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-3);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.acct-list {
  border-top: 1px solid var(--line);
}

.acct-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 13px 8px;
  margin: 0 -4px;
  border-radius: 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  transition:
    background var(--dur-fast) ease,
    transform var(--dur-fast) var(--ease);
}

.acct-row:hover {
  background: var(--hover-2);
}

.acct-row:active {
  transform: scale(0.995);
}

.acct-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-3);
  flex-shrink: 0;
}

.acct-dot.ok {
  background: var(--ok);
  box-shadow: 0 0 0 3px var(--ok-bg);
}

.acct-dot.warn {
  background: var(--warn);
  box-shadow: 0 0 0 3px var(--warn-bg);
}

.acct-dot.bad {
  background: var(--bad);
  box-shadow: 0 0 0 3px var(--bad-bg);
}

.acct-txt {
  flex: 1;
  min-width: 0;
}

.acct-txt b {
  display: block;
  font-size: 13.5px;
  font-weight: 500;
}

.acct-txt span {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: var(--r);
  font-size: 11px;
  font-weight: 500;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: var(--hover-2);
  color: var(--text-2);
  border: 1px solid var(--line);
  flex-shrink: 0;
}

.badge.ok {
  background: var(--ok-bg);
  color: var(--ok);
  border-color: transparent;
}

.badge.warn {
  background: var(--warn-bg);
  color: var(--warn);
  border-color: transparent;
}

.badge.bad {
  background: var(--bad-bg);
  color: var(--bad);
  border-color: transparent;
}

.empty {
  padding: 48px 16px;
  text-align: center;
  color: var(--text-3);
}

/* Drawer — 必须高于底栏，打开时藏底栏 */
.drawer-root[hidden] {
  display: none !important;
}

.drawer-root {
  position: fixed;
  /* 盖住 status bar 区域 */
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: var(--z-drawer);
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px)
    env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
  box-sizing: border-box;
}

.drawer-backdrop {
  position: absolute;
  /* 铺满含安全区外的视口 */
  inset: calc(-1 * env(safe-area-inset-top, 0px))
    calc(-1 * env(safe-area-inset-right, 0px))
    calc(-1 * env(safe-area-inset-bottom, 0px))
    calc(-1 * env(safe-area-inset-left, 0px));
  background: rgba(0, 0, 0, 0.6);
  animation: fade-in var(--dur) ease both;
}

.drawer {
  position: absolute;
  top: env(safe-area-inset-top, 0px);
  right: env(safe-area-inset-right, 0px);
  bottom: env(safe-area-inset-bottom, 0px);
  height: auto;
  width: min(420px, 100%);
  max-width: 100%;
  background: var(--panel);
  border-left: 1px solid var(--line-2);
  display: flex;
  flex-direction: column;
  color: var(--text);
  animation: drawer-in var(--dur-med) var(--ease-out) both;
  box-shadow: -12px 0 40px rgba(0, 0, 0, 0.35);
  border-radius: 0;
}

.drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 16px 14px;
  border-bottom: 1px solid var(--line-2);
  flex-shrink: 0;
}

.drawer-kicker {
  margin: 0 0 4px;
  font-size: 11px;
  color: var(--text-3);
  letter-spacing: 0.04em;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  text-transform: uppercase;
}

.drawer-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--r);
  display: grid;
  place-items: center;
  border: 1px solid var(--line-2);
  color: var(--text-2);
  background: transparent;
  transition:
    background var(--dur-fast) ease,
    color var(--dur-fast) ease,
    border-color var(--dur-fast) ease;
}

.icon-btn:hover {
  background: var(--hover-2);
  color: var(--text);
  border-color: var(--line-3);
}

.icon-btn:active {
  opacity: 0.85;
}

.drawer-body {
  flex: 1;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.web-hero {
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--panel-2);
}

.web-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.web-copy,
.info-card {
  padding: 16px 14px;
}

.info-status {
  margin-bottom: 10px;
}

.info-blurb {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-2);
}

.info-more {
  margin: 12px 0 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-3);
}

.web-copy {
  padding: 16px 14px;
}

.web-copy h3 {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 600;
}

.web-copy p {
  margin: 0;
  font-size: 13px;
  color: var(--text-3);
  line-height: 1.45;
}

.web-copy h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 500;
}

.web-copy p,
.info-blurb {
  margin: 8px 0 0;
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.5;
}

.info-status {
  margin-bottom: 10px;
}

.info-more {
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--text-3);
  line-height: 1.5;
}

.drawer-foot {
  display: flex;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--line-2);
  flex-shrink: 0;
  background: var(--panel);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 40px;
  padding: 0 16px;
  border-radius: var(--r);
  font-size: 13px;
  font-weight: 500;
  transition:
    background var(--dur-fast) ease,
    color var(--dur-fast) ease,
    border-color var(--dur-fast) ease,
    opacity var(--dur-fast) ease;
}

.btn:active {
  opacity: 0.88;
}

.btn-primary {
  flex: 1;
  background: var(--btn);
  color: var(--btn-text);
}

.btn-primary:hover {
  background: var(--btn-hover);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.16);
}

.btn-secondary {
  flex: 0 0 auto;
  min-width: 88px;
  border: 1px solid var(--ghost-border);
  color: var(--text);
  background: transparent;
}

.btn-secondary:hover {
  background: var(--hover-2);
  border-color: var(--line-3);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(28px + var(--safe-b));
  transform: translateX(-50%) translateY(8px);
  background: var(--btn);
  color: var(--btn-text);
  padding: 10px 16px;
  border-radius: var(--r);
  font-size: 13px;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity var(--dur) var(--ease),
    transform var(--dur) var(--ease);
  z-index: var(--z-toast);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
}

@media (max-width: 768px) {
  .toast {
    bottom: calc(var(--tabbar-h) + var(--safe-b) + 16px);
  }

  body.drawer-open .toast,
  body.xyq-preview-open .toast {
    bottom: calc(28px + var(--safe-b));
  }
}

.toast.is-on {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  animation: toast-in var(--dur-med) var(--ease-out) both;
}

/* 默认隐藏；窄屏 media 内开启。PC 永不显示 */
.mobile-tabbar {
  display: none;
}

/* ========== Mobile shell ========== */
@media (max-width: 768px) {
  .rail {
    display: none !important;
  }

  .home,
  .am-home,
  .lib,
  .am,
  .hub,
  .lg,
  .ast,
  .acct {
    /* 底：仅避让固定底栏，勿再叠 100dvh */
    padding: 12px 12px var(--tabbar-space);
    width: 100%;
    max-width: 100%;
    min-height: 0;
  }

  .am {
    padding: 12px 12px var(--tabbar-space);
  }

  .canvas,
  .view,
  .view.is-active {
    min-height: 0 !important;
  }

  /* 点阵背景仍铺满一屏，但不撑高可滚动高度 */
  .workspace {
    min-height: calc(100dvh - var(--safe-t));
  }

  .home-title {
    font-size: 22px;
    letter-spacing: -0.03em;
  }

  .home-media .board-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .home-snap {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .create-go {
    border-radius: var(--r);
  }

  .am-head h1 {
    font-size: 22px;
  }

  .am-head p {
    font-size: 12px;
  }

  .am-seg {
    width: 100%;
  }

  .am-seg button {
    flex: 1 1 0;
    min-width: 0;
    padding: 0 8px;
    font-size: 11px;
  }

  .am-grid,
  .am-grid-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .am-grid-3 .am-cell:last-child {
    grid-column: 1 / -1;
  }

  /* 四宫格底栏：防挤字 */
  .mobile-tabbar button {
    max-width: none;
    font-size: 10px;
  }

  .mobile-tabbar .tab-lab {
    font-size: 10px;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .am-cell {
    min-height: 76px;
    padding: 12px;
  }

  .am-cell-v {
    font-size: 22px;
  }

  .am-cols {
    grid-template-columns: 1fr;
  }

  .am-col + .am-col {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .am-row {
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 12px;
    gap: 8px;
  }

  .am-row-id {
    display: none;
  }

  .am-tags li {
    font-size: 11px;
    padding: 5px 8px;
  }

  .home-head {
    margin-bottom: 14px;
  }

  .home-title {
    font-size: 22px;
  }

  .board-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  /* 底 sheet：高度留给内容，脚在安全区上；z 高于底栏 */
  .drawer-root {
    padding: 0;
  }

  .drawer-backdrop {
    inset: 0;
  }

  .drawer {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-height: min(88dvh, 100%);
    height: auto;
    border-radius: 12px 12px 0 0;
    border-left: 0;
    border-top: 1px solid var(--line-2);
    animation: drawer-up var(--dur-med) var(--ease-out) both;
    box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.35);
    /* 底 sheet 自带底部 safe-area */
    padding-bottom: var(--safe-b);
  }

  .drawer-body {
    max-height: calc(88dvh - 140px - var(--safe-b));
  }

  .drawer-foot {
    padding-bottom: 12px;
  }

  /*
   * H5 固定底栏
   */
  .mobile-tabbar {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: var(--z-tab);
    width: 100%;
    max-width: 100vw;
    height: calc(var(--tabbar-h) + var(--safe-b));
    padding: 0 4px var(--safe-b);
    margin: 0;
    box-sizing: border-box;
    align-items: stretch;
    justify-content: space-around;
    /* 实底：半透明会让卡片从底下透上来，H5 固定菜单发脏 */
    background: var(--page);
    border-top: 1px solid var(--line);
    /* 手势与选中 */
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
  }

  /* 顶部分割线略提亮，和内容区分层 */
  .mobile-tabbar::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 1px;
    background: var(--line-2);
    pointer-events: none;
  }

  .mobile-tabbar button {
    flex: 1 1 0;
    min-width: 0;
    max-width: 120px;
    height: var(--tabbar-h);
    margin: 0;
    padding: 6px 4px 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    border: 0;
    background: transparent;
    color: var(--text-3);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .mobile-tabbar button:active {
    opacity: 0.72;
  }

  .mobile-tabbar .tab-ico {
    position: relative;
    width: 26px;
    height: 26px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
  }

  .mobile-tabbar .tab-ico .ico {
    position: absolute;
    inset: 0;
    width: 26px;
    height: 26px;
    margin: auto;
    /* 覆盖全局 .ico 线框默认 */
    stroke: currentColor;
    fill: none;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .mobile-tabbar .tab-ico .ico-on {
    display: none;
    stroke: none;
    fill: currentColor;
  }

  .mobile-tabbar .tab-ico .ico-off {
    display: block;
  }

  .mobile-tabbar .tab-lab {
    font-size: 10px;
    font-weight: 500;
    line-height: 1.15;
    letter-spacing: 0.02em;
    transform: translateZ(0);
  }

  .mobile-tabbar button {
    transition: color var(--dur-fast) ease;
  }

  .mobile-tabbar button.is-active {
    color: var(--text);
  }

  .mobile-tabbar button.is-active .tab-ico {
    animation: tab-pop var(--dur-med) var(--ease-out) both;
  }

  .mobile-tabbar button.is-active .tab-ico .ico-off {
    display: none;
  }

  .mobile-tabbar button.is-active .tab-ico .ico-on {
    display: block;
  }

  .mobile-tabbar button.is-active .tab-lab {
    font-weight: 600;
  }

  body.xyq-preview-open .mobile-tabbar,
  body.drawer-open .mobile-tabbar {
    display: none !important;
  }
}
