/* ============================================================
   验证器 — 样式表
   设计规范沿用「流量消耗器 (Flow Panel)」：
   纯黑白灰 · 纯色背景（无渐变/无 backdrop-filter）· 胶囊按钮 · 11 级灰阶
   ============================================================ */

/* 等宽字体：JetBrains Mono（SIL OFL 1.1，可免费商用）
   自带可变字重轴，单个 31KB 文件覆盖 100–800，零为点状（非斜线）
   授权全文见 vendor/fonts/OFL.txt */
@font-face {
  font-family: 'JetBrains Mono';
  src: url('../vendor/fonts/jetbrains-mono-var.woff2') format('woff2');
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;

  /* 灰阶 */
  --ink-000: #ffffff;
  --ink-050: #f7f7f8;
  --ink-100: #ededef;
  --ink-200: #e0e0e3;
  --ink-300: #c9c9ce;
  --ink-400: #9a9aa2;
  --ink-500: #6e6e76;
  --ink-600: #4a4a52;
  --ink-700: #2e2e34;
  --ink-800: #1c1c20;
  --ink-900: #0d0d0f;
  --ink-950: #060607;

  /* 面与边 */
  --glass-bg: #ffffff;
  --glass-bg-strong: #ffffff;
  --glass-bg-faint: rgba(0, 0, 0, 0.016);
  --panel-bg: #ffffff;
  --glass-border: rgba(0, 0, 0, 0.06);
  --glass-edge: rgba(255, 255, 255, 0.95);
  --glass-shadow:
    0 1px 2px rgba(16, 18, 28, 0.04),
    0 5px 14px -4px rgba(16, 18, 28, 0.07),
    0 18px 40px -18px rgba(16, 18, 28, 0.12);
  --glass-inner: inset 0 1px 0 rgba(255, 255, 255, 1);

  --page-bg: #f2f3f4;
  --field-bg: rgba(0, 0, 0, 0.028);
  --field-bg-hover: rgba(0, 0, 0, 0.05);
  --field-border: rgba(0, 0, 0, 0.075);
  --text-1: var(--ink-900);
  --text-2: var(--ink-500);
  --text-3: var(--ink-400);
  --hairline: rgba(0, 0, 0, 0.07);

  --accent: var(--ink-900);
  --accent-text: var(--ink-000);
  --danger: #e05a4f;
  --danger-soft: rgba(224, 90, 79, 0.12);
  --ok: #2fbf5f;
  --warn: #e0a020;

  --r-lg: 26px;
  --r-md: 18px;
  --r-sm: 12px;

  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  --ease-soft: cubic-bezier(0.4, 0, 0.2, 1);

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
          "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei UI", system-ui, sans-serif;
  /* 优先用随包分发的 JetBrains Mono；后面几个是加载失败时的系统兜底 */
  --mono: 'JetBrains Mono', ui-monospace, "SF Mono", "Cascadia Mono", Menlo,
          "DejaVu Sans Mono", Consolas, monospace;
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --glass-bg: #1c1d21;
  --glass-bg-strong: #202127;
  --glass-bg-faint: rgba(255, 255, 255, 0.035);
  --panel-bg: #1c1d21;
  --glass-border: rgba(255, 255, 255, 0.085);
  --glass-edge: rgba(255, 255, 255, 0.14);
  --glass-shadow:
    0 1px 2px rgba(0, 0, 0, 0.35),
    0 6px 18px -6px rgba(0, 0, 0, 0.5),
    0 22px 50px -22px rgba(0, 0, 0, 0.6);
  --glass-inner: inset 0 1px 0 rgba(255, 255, 255, 0.07);

  --page-bg: #0b0b0d;
  --field-bg: rgba(255, 255, 255, 0.055);
  --field-bg-hover: rgba(255, 255, 255, 0.09);
  --field-border: rgba(255, 255, 255, 0.1);
  --text-1: #f2f2f4;
  --text-2: #9c9ca4;
  --text-3: #6c6c74;
  --hairline: rgba(255, 255, 255, 0.075);

  --accent: #f4f4f6;
  --accent-text: #101012;
  --danger: #ff6b60;
  --danger-soft: rgba(255, 107, 96, 0.14);
  --ok: #3ad46a;
  --warn: #f0b13a;
}

/* ---------------------------------------------------------------- 基础 */

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

/* 全局兜底：带 display 的类会盖掉 hidden 属性，这里强制以 hidden 为准 */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--page-bg);
  color: var(--text-1);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, input, select, textarea { font: inherit; color: inherit; }

:focus-visible {
  outline: 2px solid var(--ink-400);
  outline-offset: 2px;
  border-radius: 4px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

/* 自定义滚动条 */
* { scrollbar-width: thin; scrollbar-color: var(--ink-300) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--ink-300);
  border: 3px solid transparent;
  border-radius: 999px;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background-color: var(--ink-400); background-clip: content-box; }
:root[data-theme="dark"] ::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.16); background-clip: content-box; }
:root[data-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.26); background-clip: content-box; }

/* ---------------------------------------------------------------- 外壳 */

.app {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.container {
  position: relative;
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 clamp(16px, 3vw, 32px);
}

/* 主内容区：所有板块之间的垂直间距统一由这里的 gap 决定，
   各板块自身不再用不对称的上下内边距（那会让居中失效） */
#main.container {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding-top: 18px;
}

/* 工具栏与账户网格也必须是同一套 flex 间距。
   放在普通 block 容器里时 gap 完全不会生效（会塌成 0px，表现为"上面有间距下面没有"） */
#vault-view {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.app-header {
  position: sticky;
  /* 粘住的位置与外边距必须用同一个值：否则页面顶部时 sticky 位移会把顶栏推下去，
     与下方内容重叠（实测视觉间距会塌到 2px） */
  top: clamp(8px, 2vw, 16px);
  margin-top: clamp(8px, 2vw, 16px);
  z-index: 30;
  padding: 0 clamp(16px, 3vw, 32px);
}

.header-inner {
  max-width: 1080px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 62px;
  padding: 13px 16px;
  border-radius: var(--r-lg);
  background: var(--glass-bg-strong);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow), var(--glass-inner);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
  min-width: 0;
  user-select: none;
}

.brand-mark {
  width: 38px; height: 38px;
  border-radius: 11px;
  background: var(--accent);
  color: var(--accent-text);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}
.brand-mark svg { width: 20px; height: 20px; }

/* 品牌名是顶栏里唯一的文字，靠 .brand 的 align-items: center 垂直居中 */
.brand-title { font-size: 17px; font-weight: 650; letter-spacing: -0.02em; }
/* 桌面用全名，窄屏用短名：顶栏在 360-390px 已经被四个圆钮占满，
   全名放上去会把操作区挤到第二行 */
.bt-short { display: none; }

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex: 0 0 auto;
}

/* 搜索 */
.search-wrap {
  position: relative;
  flex: 0 1 240px;
  min-width: 0;
}
.search-wrap > svg {
  position: absolute; left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  pointer-events: none;
}
/* 这两个只在窄屏出现（见响应式那一节） */
.search-open, .search-cancel { display: none; }
.search-input {
  width: 100%;
  height: 34px;
  padding: 0 30px 0 34px;
  border-radius: 999px;
  border: 1px solid var(--field-border);
  background: var(--field-bg);
  color: var(--text-1);
  font-size: 13px;
  outline: none;
  transition: background 0.2s var(--ease-soft), border-color 0.2s;
}
.search-input::placeholder { color: var(--text-3); }
.search-input:focus { border-color: var(--ink-400); background: var(--field-bg-hover); }
.search-clear {
  position: absolute; right: 5px; top: 50%;
  transform: translateY(-50%);
  width: 24px; height: 24px;
  border: 0; background: transparent; color: var(--text-3);
  border-radius: 50%; cursor: pointer;
  display: none; place-items: center;
}
.search-clear.is-visible { display: grid; }
.search-clear:hover { background: var(--field-bg-hover); color: var(--text-1); }

/* ---------------------------------------------------------------- 按钮 */

.icon-btn,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 999px;
  border: 1px solid var(--field-border);
  background: var(--field-bg);
  color: var(--text-2);
  cursor: pointer;
  white-space: nowrap;
  flex: 0 0 auto;
  transition: background 0.2s var(--ease-soft), color 0.2s, transform 0.16s var(--ease),
              border-color 0.2s, box-shadow 0.24s;
}
.btn { height: 34px; padding: 0 13px; font-size: 12.5px; font-weight: 500; }
.btn:hover { background: var(--field-bg-hover); color: var(--text-1); }
.btn:active { transform: scale(0.96); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn svg { flex: 0 0 auto; }

/* 图标包裹层：若图标被 span 包裹（如主题的日/月切换），span 会按文本基线排版导致图标上浮 2px。
   用专门的类做 flex 容器让它精确居中——不要用 `.btn > span`，那会压过移动端隐藏文字标签的规则。 */
.icon-slot { display: inline-flex; align-items: center; justify-content: center; }

/* 正方形图标按钮：34×34 正圆 */
.btn--icon { width: 34px; padding: 0; border-radius: 50%; }

/* 主按钮 */
.btn--primary {
  background: var(--accent);
  border-color: transparent;
  color: var(--accent-text);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.14), 0 6px 16px -6px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
.btn--primary:hover {
  background: var(--accent);
  color: var(--accent-text);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.16), 0 10px 22px -6px rgba(0, 0, 0, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}
:root[data-theme="dark"] .btn--primary { box-shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 6px 16px -6px rgba(0, 0, 0, 0.6); }

/* 危险按钮 */
.btn--danger { color: var(--danger); }
.btn--danger:hover { background: var(--danger-soft); color: var(--danger); border-color: transparent; }

/* 透明按钮 */
.btn--ghost { background: transparent; border-color: transparent; }
.btn--ghost:hover { background: var(--field-bg-hover); border-color: transparent; }

/* 文字按钮 */
.link-btn {
  border: none;
  background: none;
  padding: 0;
  font-size: 12.5px;
  color: var(--text-3);
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: var(--ink-300);
  text-underline-offset: 3px;
  transition: color 0.2s;
}
.link-btn:hover { color: var(--text-1); }

/* 小号按钮（卡片内） */
.btn--sm { height: 32px; padding: 0 12px; font-size: 12.5px; }
.btn--sm.btn--icon { width: 32px; padding: 0; }
.btn--sm svg { width: 14px; height: 14px; }
.btn--icon svg { width: 17px; height: 17px; }
.btn--sm.btn--icon svg { width: 15px; height: 15px; }

/* 通栏大按钮 */
.btn--block {
  width: 100%;
  height: 46px;
  border-radius: var(--r-sm);
  font-size: 14.5px;
  font-weight: 620;
  letter-spacing: 0.08em;
}

/* 忙态 */
.btn.is-busy { color: transparent !important; position: relative; }
.btn.is-busy::after {
  content: "";
  position: absolute;
  top: 50%; left: 50%;
  width: 15px; height: 15px;
  margin: -8px 0 0 -8px;
  border-radius: 50%;
  border: 2px solid var(--text-2);
  border-top-color: transparent;
  animation: spin 0.72s linear infinite;
}
.btn--primary.is-busy::after { border-color: var(--accent-text); border-top-color: transparent; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- 工具条 */

.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  min-height: 34px;
}

.stat-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--text-3);
}
.stat-line strong { color: var(--text-1); font-weight: 600; }
.dot-sep { color: var(--ink-300); }

.toolbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
/* 工具栏里的下拉取内容宽度，不与网格同宽 */
.toolbar .picker { width: auto; min-width: 132px; }

/* ---------------------------------------------------------------- 账户网格 */

.accounts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
  gap: 18px;
  padding-bottom: 26px;
}

.card {
  position: relative;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-lg);
  padding: clamp(16px, 2.2vw, 22px);
  /* 底部少留 12px：操作行自身有 12px 内边距，加一起才与上边距对称 */
  padding-bottom: calc(clamp(16px, 2.2vw, 22px) - 12px);
  box-shadow: var(--glass-shadow), var(--glass-inner);
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
  transition: transform 0.3s var(--ease), box-shadow 0.3s;
}
.card:hover { transform: translateY(-2px); }

.card-head { display: flex; align-items: center; gap: 11px; }

.avatar {
  width: 38px; height: 38px;
  border-radius: 11px;
  display: grid; place-items: center;
  font-size: 15px; font-weight: 600;
  background: var(--field-bg);
  border: 1px solid var(--hairline);
  color: var(--text-2);
  flex: 0 0 auto;
}

.card-title { min-width: 0; flex: 1; }
.card-name {
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-issuer {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--text-3);
  min-width: 0;
}
.card-issuer > [data-role="issuer"] {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tag-algo {
  flex: 0 0 auto;
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid var(--hairline);
  background: var(--field-bg);
  color: var(--text-3);
  font-size: 10.5px;
  font-family: var(--mono);
}

/* 验证码 */
.code-row { display: flex; align-items: center; gap: 12px; }

.code-btn {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: baseline;
  padding: 6px 8px;
  margin-left: -8px;
  border: 0;
  background: transparent;
  border-radius: var(--r-sm);
  cursor: pointer;
  text-align: left;
  transition: background 0.18s var(--ease-soft);
}
.code-btn:hover { background: var(--field-bg); }

.code-value {
  flex: 0 0 auto;
  font-family: var(--mono);
  font-size: clamp(25px, 2.6vw, 29px);
  font-weight: 620;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--text-1);
  /* JetBrains Mono 的上下延伸比 Consolas 大，1.15 会装不下字形（溢出 2-3px） */
  line-height: 1.32;
  white-space: nowrap;
}
.code-value[data-digits="8"] { font-size: clamp(23px, 2.2vw, 26px); }
.code-value[data-digits="10"] { font-size: clamp(20px, 2vw, 23px); }
.code-value.is-expiring { color: var(--danger); }
.code-value.is-placeholder { color: var(--text-3); font-size: 20px; letter-spacing: 0.01em; }

/* 悬停出现的复制提示（绝对定位，不占布局宽度） */
.code-hint {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  color: var(--text-3);
  opacity: 0;
  transition: opacity 0.12s ease;
  pointer-events: none;
}
.code-btn:hover .code-hint, .code-btn:focus-visible .code-hint { opacity: 1; }

/* 倒计时圆环 */
.ring { position: relative; width: 42px; height: 42px; flex: 0 0 auto; }
.ring svg { transform: rotate(-90deg); display: block; }
.ring-track { stroke: var(--hairline); }
.ring-bar { stroke: var(--text-2); transition: stroke-dashoffset 0.25s linear, stroke 0.2s; }
.ring.is-expiring .ring-bar { stroke: var(--danger); }
.ring-label {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-size: 12.5px; font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-2);
}
.ring.is-expiring .ring-label { color: var(--danger); }

/* 底部长条 */
.progress {
  height: 3px;
  border-radius: 999px;
  background: var(--hairline);
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  width: 100%;
  background: var(--text-2);
  border-radius: 999px;
  transition: width 0.25s linear, background-color 0.2s;
}
.progress-bar.is-expiring { background: var(--danger); }

.card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  /* 上下对称：不对称的内边距会让 align-items:center 的居中失效，按钮整体下坠。
     不要再加 margin-top —— 那会让卡片内的纵向间距出现 12/12/14 这种不一致 */
  padding: 12px 0;
  border-top: 1px solid var(--hairline);
}
.card-actions .spacer { margin-left: auto; }

/* ---------------------------------------------------------------- 空状态 */

.empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 62px 20px 66px;
  border: 1px dashed var(--ink-300);
  border-radius: var(--r-lg);
  background: var(--glass-bg);
}
.empty-icon {
  width: 52px; height: 52px;
  margin: 0 auto 16px;
  border-radius: 15px;
  background: var(--field-bg);
  border: 1px solid var(--hairline);
  display: grid; place-items: center;
  color: var(--text-2);
}
.empty h2 { margin: 0 0 6px; font-size: 16px; font-weight: 620; letter-spacing: -0.01em; }
.empty p { margin: 0 0 20px; color: var(--text-3); font-size: 13px; }
.empty-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ---------------------------------------------------------------- 弹窗 */

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal.is-open { display: flex; }

.modal-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.42); }
:root[data-theme="dark"] .modal-backdrop { background: rgba(0, 0, 0, 0.6); }

.modal-panel {
  position: relative;
  width: 100%;
  max-width: 500px;
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  background: var(--panel-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-lg);
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.28), 0 2px 8px rgba(0, 0, 0, 0.06);
  overflow: hidden;
  animation: pop 0.28s var(--ease);
}
.modal-panel--wide { max-width: 600px; }

@keyframes pop {
  from { opacity: 0; transform: translateY(10px) scale(0.985); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  flex: 0 0 auto;
}
.modal-head h2 { margin: 0; font-size: 15px; font-weight: 620; letter-spacing: -0.01em; }
.modal-head .btn { margin-left: auto; }

.modal-body { padding: 2px 20px 4px; overflow-y: auto; flex: 1 1 auto; }

.modal-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  background: var(--panel-bg);
  flex: 0 0 auto;
}
.modal-foot .spacer { margin-left: auto; }

/* ---------------------------------------------------------------- 表单 */

.field { margin-bottom: 18px; }
.field:last-child { margin-bottom: 0; }

.field-label {
  display: block;
  font-size: 13.5px;
  font-weight: 540;
  color: var(--text-2);
  margin-bottom: 8px;
}
.field-label .req { color: var(--danger); margin-left: 2px; }
.field-hint { font-size: 12px; color: var(--text-3); margin-top: 7px; line-height: 1.5; }

.input, .select, .textarea {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border-radius: var(--r-sm);
  border: 1px solid var(--field-border);
  background: var(--field-bg);
  color: var(--text-1);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
}
.textarea {
  height: auto;
  min-height: 84px;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.55;
  resize: vertical;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--ink-400);
  background: var(--field-bg-hover);
}
.input[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--danger); }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input--mono { font-family: var(--mono); font-size: 13.5px; }

.select {
  appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239a9aa2' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
}

/* ---------------------------------------------------------------- *
 * 自定义下拉（对齐流量消耗器 .picker）
 * 组件增强后会隐藏原生 select，值仍写回原生 select，
 * 所以业务代码读取 select.value 的方式完全不变
 * ---------------------------------------------------------------- */

.picker { position: relative; width: 100%; }

/* 被接管的原生 select：保留在 DOM 里参与表单语义，但不参与显示 */
.picker select { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

.picker-trigger {
  width: 100%;
  height: 46px;
  padding: 0 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-radius: var(--r-sm);
  border: 1px solid var(--field-border);
  background: var(--field-bg);
  color: var(--text-1);
  font-family: inherit;
  font-size: 14px;
  font-weight: 520;
  text-align: left;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
.picker-trigger:hover { background: var(--field-bg-hover); }
.picker-trigger:focus-visible { border-color: var(--ink-400); box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.06); }
:root[data-theme="dark"] .picker-trigger:focus-visible { box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08); }
.picker-trigger[aria-expanded="true"] { background: var(--field-bg-hover); border-color: var(--ink-300); }
:root[data-theme="dark"] .picker-trigger[aria-expanded="true"] { border-color: var(--ink-600); }

.picker-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.picker-trigger .chev {
  width: 16px; height: 16px;
  flex-shrink: 0;
  color: var(--text-3);
  transition: transform 0.32s var(--ease);
}
.picker-trigger[aria-expanded="true"] .chev { transform: rotate(180deg); }

/* 紧凑变体：工具栏里与 34px 胶囊同高 */
.picker--sm .picker-trigger {
  height: 34px;
  padding: 0 12px 0 14px;
  border-radius: 999px;
  font-size: 12.5px;
}

/* 弹出层：打开时挂到 body 下并由 JS 贴合触发器定位。
   z-index 需高于弹窗（100），否则在弹窗内的下拉会被遮住 */
.picker-panel {
  position: fixed;
  z-index: 150;
  max-height: 330px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 7px;
  border-radius: var(--r-md);
  border: 1px solid var(--glass-border);
  background: var(--panel-bg);
  box-shadow:
    0 1px 1px rgba(0, 0, 0, 0.03),
    0 10px 24px -6px rgba(16, 18, 28, 0.18),
    0 28px 60px -18px rgba(16, 18, 28, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  transform-origin: top center;
  animation: picker-in 0.24s var(--ease);
}
:root[data-theme="dark"] .picker-panel {
  box-shadow:
    0 1px 1px rgba(0, 0, 0, 0.5),
    0 10px 24px -6px rgba(0, 0, 0, 0.6),
    0 28px 60px -18px rgba(0, 0, 0, 0.75),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
.picker-panel[hidden] { display: none; }

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

.picker-option {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border: none;
  border-radius: 10px;
  background: none;
  color: var(--text-1);
  font-family: inherit;
  font-size: 13.5px;
  text-align: left;
  cursor: pointer;
  transition: background 0.16s var(--ease-soft);
}
.picker-option:hover,
.picker-option.active { background: rgba(0, 0, 0, 0.055); }
:root[data-theme="dark"] .picker-option:hover,
:root[data-theme="dark"] .picker-option.active { background: rgba(255, 255, 255, 0.075); }
.picker-option-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-option[aria-selected="true"] { font-weight: 600; }

.picker-check {
  width: 16px; height: 16px;
  flex-shrink: 0;
  color: var(--text-1);
  opacity: 0;
  transition: opacity 0.16s;
}
.picker-option[aria-selected="true"] .picker-check { opacity: 1; }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field-row--3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }

.input-group { display: flex; gap: 8px; align-items: stretch; }
.input-group .input { flex: 1; }
/* 与 46px 输入框同高时做成正圆，既对齐输入框又保持图标按钮的圆形语言 */
.input-group .btn {
  height: auto;
  aspect-ratio: 1 / 1;
  width: 46px;
  padding: 0;
  border-radius: 50%;
}
.input-group .btn svg { width: 18px; height: 18px; }

.mini-input {
  width: 96px;
  height: 34px;
  padding: 0 11px;
  border-radius: 9px;
  border: 1px solid var(--field-border);
  background: var(--field-bg);
  color: var(--text-1);
  font-family: var(--mono);
  font-size: 13px;
  text-align: right;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
}
.mini-input:focus { border-color: var(--ink-400); background: var(--field-bg-hover); }

.error-text {
  display: none;
  margin-top: 7px;
  font-size: 12.5px;
  color: var(--danger);
  line-height: 1.5;
}
.error-text.is-visible { display: block; }

/* 分段控件 */
.segmented {
  display: inline-flex;
  padding: 3px;
  gap: 3px;
  background: var(--field-bg);
  border: 1px solid var(--field-border);
  border-radius: 999px;
  width: 100%;
}
.segmented button {
  flex: 1;
  height: 30px;
  border: 0;
  background: transparent;
  color: var(--text-2);
  border-radius: 999px;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
  padding: 0 4px;
  transition: background 0.2s var(--ease-soft), color 0.2s;
}
.segmented button:hover { color: var(--text-1); }
.segmented button[aria-pressed="true"] {
  background: var(--accent);
  color: var(--accent-text);
}

/* 标签页 */
.tabs {
  display: flex;
  gap: 4px;
  padding: 3px;
  background: var(--field-bg);
  border: 1px solid var(--field-border);
  border-radius: 999px;
  margin-bottom: 18px;
}
.tabs button {
  flex: 1;
  height: 32px;
  border: 0; background: transparent;
  color: var(--text-2);
  border-radius: 999px;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  transition: background 0.2s var(--ease-soft), color 0.2s;
}
.tabs button:hover { color: var(--text-1); }
.tabs button[aria-selected="true"] { background: var(--accent); color: var(--accent-text); }
.tab-panel { display: none; }
.tab-panel.is-active { display: block; }

/* 拖放区 */
.dropzone {
  border: 1.5px dashed var(--ink-300);
  border-radius: var(--r-md);
  background: var(--field-bg);
  padding: 26px 18px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.dropzone:hover, .dropzone.is-over { border-color: var(--ink-500); background: var(--field-bg-hover); }
.dropzone svg { color: var(--text-3); margin-bottom: 10px; }
.dropzone p { margin: 0 0 4px; font-size: 13.5px; font-weight: 500; }
.dropzone span { font-size: 12px; color: var(--text-3); }

.camera-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #000;
  border-radius: var(--r-md);
  overflow: hidden;
}
.camera-stage video { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---------------------------------------------------------------- 二维码 */

.qr-box {
  background: #ffffff;
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  padding: 16px;
  width: 100%;
  max-width: 236px;
  margin: 0 auto;
}
.qr-box svg { width: 100%; height: auto; display: block; }
.qr-fallback { margin: 0; font-size: 12.5px; color: var(--ink-500); text-align: center; }

/* ---------------------------------------------------------------- 设置项 */

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 52px;
  padding: 8px 0;
  border-bottom: 1px solid var(--hairline);
}
.setting-row:last-child { border-bottom: 0; }
.setting-row .setting-text { flex: 1; min-width: 0; }
.setting-row .setting-name { font-size: 14px; font-weight: 520; }
.setting-row .setting-desc { font-size: 12px; color: var(--text-3); margin-top: 3px; line-height: 1.5; }
.setting-row .setting-control { flex: 0 0 auto; }
.setting-control--seg { width: 216px; }
.setting-control--num { width: 130px; }
.setting-control--actions { display: flex; gap: 8px; }

#storage-line {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* 开关 */
.switch {
  position: relative;
  width: 48px; height: 29px;
  border-radius: 999px;
  background: var(--ink-200);
  border: 1px solid var(--hairline);
  cursor: pointer;
  padding: 0;
  flex: 0 0 auto;
  transition: background 0.3s var(--ease);
}
/* 视觉尺寸保持 48×29（规范值），但把命中区域向外扩 9px：
   内边距盒是 46×27，46+18=64、27+18=45，达到 Apple HIG 的 44pt 最小触摸目标 */
.switch::before {
  content: "";
  position: absolute;
  inset: -9px -9px;
  border-radius: inherit;
}
:root[data-theme="dark"] .switch { background: var(--ink-700); }
.switch::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 23px; height: 23px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.28), 0 3px 8px rgba(0, 0, 0, 0.12);
  transition: transform 0.3s var(--ease);
}
.switch[aria-checked="true"] { background: var(--accent); }
.switch[aria-checked="true"]::after { transform: translateX(19px); }
/* 深色模式下的「开」态要单独写：
   `:root[data-theme="dark"] .switch` 的特异度 (0,3,0) 高于 `.switch[aria-checked="true"]` (0,2,0)，
   不补这条的话，深色下开着的开关会显示成关态的背景色（圆钮跑到右边、轨道却是暗的）。
   另外轨道变成近白色后，白色圆钮会看不见，必须换成 accent-text。 */
:root[data-theme="dark"] .switch[aria-checked="true"] { background: var(--accent); }
:root[data-theme="dark"] .switch[aria-checked="true"]::after { background: var(--accent-text); }

/* 登录弹窗里的「在本设备保持登录」行
   高度与 .field 的节奏对齐：上间距 14，行内容垂直居中 */
.remember-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 14px;
  min-height: 34px;
}
.remember-row .remember-text { flex: 1; min-width: 0; }
.remember-row .remember-name {
  font-size: 13.5px;
  font-weight: 520;
  line-height: 1.4;
}
.remember-row .remember-desc {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 2px;
  line-height: 1.45;
}
.remember-row .remember-control { flex: 0 0 auto; display: flex; align-items: center; }

.section-title {
  font-size: 12px;
  font-weight: 620;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
  margin: 24px 0 2px;
}
.section-title:first-child { margin-top: 0; }

.note-box {
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  background: var(--field-bg);
  padding: 13px 15px;
  font-size: 12.5px;
  color: var(--text-2);
  line-height: 1.6;
}
.note-box strong { color: var(--text-1); font-weight: 600; }

/* 自检结果表 */
.selftest-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 15px;
  border-radius: var(--r-md);
  border: 1px solid var(--hairline);
  background: var(--field-bg);
  margin-bottom: 12px;
}
.selftest-summary .badge { font-family: var(--mono); font-size: 13px; font-weight: 600; }
.selftest-summary.is-pass .badge { color: var(--ok); }
.selftest-summary.is-fail .badge { color: var(--danger); }

.table-wrap {
  max-height: 320px;
  overflow: auto;
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
}
table.vectors { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.vectors th, table.vectors td {
  padding: 8px 11px;
  text-align: left;
  border-bottom: 1px solid var(--hairline);
  white-space: nowrap;
}
table.vectors th {
  position: sticky; top: 0;
  background: var(--ink-050);
  font-weight: 600;
  color: var(--text-2);
  z-index: 1;
}
:root[data-theme="dark"] table.vectors th { background: #26272c; }
table.vectors td.mono { font-family: var(--mono); }
table.vectors tr:last-child td { border-bottom: 0; }
.flag-pass { color: var(--ok); font-weight: 600; }
.flag-fail { color: var(--danger); font-weight: 600; }

/* ---------------------------------------------------------------- 账户（云同步） */

/* 账号胶囊：只做状态展示，同步/退出是旁边独立的 34px 圆形按钮 */
.account-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 13px;
  border-radius: 999px;
  border: 1px solid var(--field-border);
  background: var(--field-bg);
  max-width: 190px;
  flex: 0 0 auto;
}
.account-pill .dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--ink-400);
  flex-shrink: 0;
  transition: background 0.3s, box-shadow 0.3s;
}
.account-pill .dot.ok { background: var(--ok); box-shadow: 0 0 0 3px rgba(47, 191, 95, 0.16); }
.account-pill .dot.warn { background: var(--warn); box-shadow: 0 0 0 3px rgba(224, 160, 32, 0.16); }
.account-pill .dot.bad { background: var(--danger); box-shadow: 0 0 0 3px rgba(224, 90, 79, 0.16); }
.account-pill .name {
  font-size: 12.5px;
  font-weight: 520;
  color: var(--text-1);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sync-note {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.55;
  margin-top: 8px;
}
.sync-note svg { flex: 0 0 auto; margin-top: 2px; }
.sync-note.is-error { color: var(--danger); }

.pick-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 4px 0 2px;
}
.pick-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 15px;
  border-radius: var(--r-md);
  border: 1px solid var(--field-border);
  background: var(--field-bg);
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: border-color 0.2s, background 0.2s;
}
.pick-item:hover { border-color: var(--ink-400); background: var(--field-bg-hover); }
.pick-item .pick-title { font-size: 13.5px; font-weight: 600; color: var(--text-1); }
.pick-item .pick-desc { font-size: 12px; color: var(--text-3); margin-top: 3px; line-height: 1.5; }
.pick-item svg { flex: 0 0 auto; margin-top: 2px; color: var(--text-2); }

/* ---------------------------------------------------------------- 锁定页 */

.lock { display: none; place-items: center; padding: 70px 20px; }
.lock.is-open { display: grid; }
.lock-card {
  width: 100%;
  max-width: 380px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-lg);
  padding: 28px;
  text-align: center;
  box-shadow: var(--glass-shadow), var(--glass-inner);
}
.lock-card .lock-icon {
  width: 46px; height: 46px;
  margin: 0 auto 14px;
  border-radius: 14px;
  background: var(--field-bg);
  border: 1px solid var(--hairline);
  display: grid; place-items: center;
  color: var(--text-2);
}
.lock-card h2 { margin: 0 0 6px; font-size: 16px; font-weight: 620; }
.lock-card p { margin: 0 0 18px; color: var(--text-3); font-size: 13px; }

/* ---------------------------------------------------------------- Toast */

.toasts {
  position: fixed;
  left: 50%;
  bottom: 30px;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
  width: max-content;
  max-width: calc(100vw - 40px);
}
.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 20px;
  border-radius: 999px;
  background: rgba(20, 20, 22, 0.92);
  color: #fff;
  font-size: 13px;
  text-align: center;
  animation: toast-in 0.34s var(--ease);
}
:root[data-theme="dark"] .toast { background: rgba(240, 240, 242, 0.94); color: #101012; }
.toast svg { flex: 0 0 auto; }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------------------------------------------------------------- 说明内容（弹窗内） */

.doc {
  padding: 0 0 4px;
  color: var(--text-2);
  font-size: 13.5px;
  line-height: 1.75;
}
.doc h2 {
  margin: 0 0 10px;
  font-size: 19px;
  font-weight: 650;
  letter-spacing: -0.02em;
  color: var(--text-1);
  line-height: 1.3;
}
.doc h3 {
  margin: 26px 0 10px;
  font-size: 15.5px;
  font-weight: 620;
  letter-spacing: -0.01em;
  color: var(--text-1);
}
.doc h3:first-of-type { margin-top: 20px; }
.doc p { margin: 0 0 12px; }
.doc strong { color: var(--text-1); font-weight: 600; }
.doc code {
  font-family: var(--mono);
  font-size: 0.92em;
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--field-bg);
  border: 1px solid var(--hairline);
  color: var(--text-1);
}
.doc-lead { font-size: 14px; color: var(--text-2); }

.doc-list, .doc-steps, .doc-faq { margin: 0 0 12px; padding: 0; }
.doc-list li {
  position: relative;
  padding-left: 20px;
  margin-bottom: 9px;
  list-style: none;
}
.doc-list li::before {
  content: "";
  position: absolute;
  left: 4px; top: 0.62em;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--ink-300);
}
.doc-steps { counter-reset: step; }
.doc-steps li {
  position: relative;
  counter-increment: step;
  padding-left: 30px;
  margin-bottom: 9px;
  list-style: none;
}
.doc-steps li::before {
  content: counter(step);
  position: absolute;
  left: 0; top: 0.15em;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--field-bg);
  border: 1px solid var(--hairline);
  color: var(--text-2);
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 600;
  display: grid;
  place-items: center;
}
.doc-faq dt {
  margin-top: 16px;
  font-weight: 620;
  color: var(--text-1);
}
.doc-faq dt:first-child { margin-top: 0; }
.doc-faq dd { margin: 5px 0 0; }

/* ---------------------------------------------------------------- 页脚 */

.app-footer {
  margin-top: auto;
  padding: 18px clamp(16px, 3vw, 32px) 22px;
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.6;
  border-top: 1px solid var(--hairline);
}
.app-footer .foot-grid {
  max-width: 1080px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 32px;
}
/* 第一行：站名 + 说明入口在左，状态信息在右 */
.foot-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 1 auto;
  min-width: 0;
}
.foot-title {
  margin: 0;
  font-size: 15px;
  font-weight: 620;
  letter-spacing: -0.01em;
  color: var(--text-1);
}
/* 简介独占一整行（flex-basis 100%），这样电脑上一行就能放下 */
.foot-desc {
  flex: 1 0 100%;
  margin: 0;
  font-size: 12.5px;
  color: var(--text-3);
  line-height: 1.6;
  order: 3;
}
.foot-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-end;
  text-align: right;
  margin-left: auto;
  order: 2;
  font-size: 12px;
  color: var(--text-3);
}
.app-footer strong { color: var(--text-2); font-weight: 500; }

/* 说明弹窗比普通弹窗宽一些，长文阅读更舒服 */
.modal-panel--doc { max-width: 680px; }
.modal-panel--doc .modal-body { padding: 4px 24px 8px; }

/* ---------------------------------------------------------------- 响应式 */

@media (max-width: 720px) {
  .header-inner { flex-wrap: wrap; min-height: 0; gap: 12px; padding: 12px 14px; }

  /* ================= 触摸目标：Apple HIG 最小 44×44 =================
     视觉尺寸一律沿用全局规范（34/32 的圆钮、40 高的搜索框），
     只把「命中区域」用绝对定位伪元素向外扩，外观完全不变。
     扩多少 = ceil((44 − 内边距盒) / 2)：
       34 高（内边距盒 32）→ 6px；32 高（30）→ 7px；36 高（34）→ 5px
     横向默认不扩（文字按钮本身够宽）；正方形小圆钮在下面单独补，
     并且必须同步加大间距，否则相邻命中区会互相遮挡（audit-mobile 会查）。 */
  .btn, .picker-trigger, .code-btn, .segmented button, .tabs button, .account-pill { position: relative; }
  .btn::before, .picker-trigger::before, .code-btn::before,
  .segmented button::before, .tabs button::before {
    content: "";
    position: absolute;
    left: 0; right: 0;
    top: -6px; bottom: -6px;
    border-radius: inherit;
  }
  .btn--sm::before, .btn--primary::before { top: -7px; bottom: -7px; }
  .tabs button::before { top: -5px; bottom: -5px; }
  .code-btn::before { top: -2px; bottom: -2px; }
  /* 弹窗头部的关闭圆钮：左侧是标题（不可点），横向可以放心扩 */
  .modal-head .btn::before { left: -6px; right: -6px; }
  .header-actions { margin-left: auto; }
  .brand-title { font-size: 16px; }

  /* ---- 搜索：收起成一个圆钮，点开才展开成整行（Apple 搜索栏的交互） ---- */
  .search-wrap {
    flex: 0 0 auto;
    order: 0;
    width: 34px; height: 34px;
    margin-left: auto;          /* 靠近右侧按钮组 */
  }
  /* 收起时放大镜居中；展开时回到输入框左侧（见下） */
  .search-wrap > svg { left: 50%; transform: translate(-50%, -50%); }
  /* 收起态长得和其他圆钮一样，用户才认得出这是个按钮 */
  .search-wrap:not(.is-open) {
    border: 1px solid var(--field-border);
    background: var(--field-bg);
    border-radius: 50%;
    color: var(--text-2);
  }
  .search-wrap:not(.is-open) > svg { color: currentColor; }
  .search-wrap:not(.is-open):active { background: var(--field-bg-hover); }
  .search-wrap .search-input,
  .search-wrap .search-clear { display: none; }
  /* 整块可点（透明覆盖层），触摸目标扩到 44×44 */
  .search-open {
    display: block;
    position: absolute;
    inset: -6px;              /* 内边距盒 32 + 6×2 = 44 */
    padding: 0;
    border: 0;
    background: transparent;
    border-radius: 999px;
    cursor: pointer;
  }
  .search-open:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

  /* 展开态：占满一整行，输入框 + 取消 */
  .search-wrap.is-open {
    order: 3;
    flex: 1 1 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    width: auto; height: auto;
    margin-left: 0;
  }
  .search-wrap.is-open > svg { left: 12px; transform: translateY(-50%); }
  .search-wrap.is-open .search-input {
    display: block;
    width: auto;
    flex: 1 1 auto;
    height: 44px;               /* 触屏上给足高度（Apple 最小 44pt），好点也好读 */
  }
  .search-wrap.is-open .search-open { display: none; }
  .search-wrap.is-open .search-cancel {
    display: block;
    flex: 0 0 auto;
    height: 44px;
    padding: 0 6px 0 10px;
    border: 0;
    background: transparent;
    color: var(--text-1);
    font: inherit;
    font-size: 15px;
    cursor: pointer;
    border-radius: var(--r-sm);
  }
  .search-wrap.is-open .search-cancel:active { background: var(--field-bg-hover); }

  /* ---- 窄屏收起主题切换：设置 → 外观 里可以改，顶栏省一个位置 ---- */
  #theme-toggle { display: none; }
  /* 窄屏换成短名，给右侧四个圆钮留出空间 */
  .bt-full { display: none; }
  .bt-short { display: inline; }

  /* 登录态的顶栏最容易爆：品牌 + 胶囊 + 五个按钮 > 可用宽度，会把顶栏撑成三行。
     同步与退出在「设置 → 账号与云同步」里都有，这里把胶囊收成一个 34px 圆形状态点按钮，
     与其他顶栏按钮同尺寸、同形态，点它打开设置——这样任何宽度下都不会再挤爆。 */
  .account-pill {
    width: 34px; height: 34px;
    max-width: 34px; min-width: 34px;
    padding: 0;
    gap: 0;
    justify-content: center;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s var(--ease-soft);
  }
  .account-pill:hover { background: var(--field-bg-hover); }
  .account-pill .name { display: none; }
  #btn-chip-sync, #btn-chip-logout { display: none; }

  /* 顶栏按钮：视觉仍是 34 圆钮（保持全局规范），但把命中区域扩到 44×44
     —— Apple HIG 的最小触摸目标是 44pt，34px 直接点容易点空。
     间距同时设成 12px：34 + 12 ≈ 44，相邻命中区刚好首尾相接、不会互相遮挡。 */
  .header-actions { gap: 12px; }
  .header-actions > .btn, .account-pill { position: relative; }
  .header-actions > .btn::before, .account-pill::before {
    content: "";
    position: absolute;
    inset: -6px;
    border-radius: inherit;
  }
  #btn-signin { width: 34px; padding: 0; }

  /* 工具栏必须保持单行：统计文字的尾部说明在窄屏收起（页脚已有同样信息），
     否则「文字 + 下拉」需要 365px 而可用宽度只有 358px，会挤成两行且下拉右对齐 */
  .toolbar { flex-wrap: nowrap; }
  .stat-note { display: none; }
  .stat-line { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .toolbar-right { flex: 0 0 auto; }

  .accounts { grid-template-columns: 1fr; gap: 14px; }

  /* 卡片操作按钮（复制/二维码/编辑/删除）是手机上点得最勤的，
     视觉仍是 32 小圆钮，命中区域扩到 44：32 + 14 = 46，间距同步设为 16（≥ 7×2） */
  .card-actions { gap: 16px; }
  .card-actions .btn { position: relative; }
  .card-actions .btn::before {
    content: "";
    position: absolute;
    inset: -7px;
    border-radius: inherit;
  }

  /* 工具条里的排序下拉：横向本来就宽（130px），只补高度 */
  .toolbar .picker-trigger::before { top: -6px; bottom: -6px; }

  /* 移动端：输入框字号必须 ≥16px，否则 iOS Safari 聚焦时会自动放大整个页面 */
  .input, .select, .textarea { font-size: 16px; }
  .input--mono { font-size: 16px; }
  .search-input { font-size: 16px; }
  .mini-input { font-size: 16px; }
  /* 输入框没法用伪元素扩命中区，只能在触屏上把高度补到 44 */
  .mini-input { height: 44px; }

  /* 小控件补足触摸高度 */
  .segmented button { height: 34px; }
  .tabs button { height: 36px; }
  .tag-algo { font-size: 12px; padding: 2px 7px; }

  .btn-label { display: none; }
  .btn--icon-label { width: 34px; padding: 0; }

  .modal { padding: 0; align-items: flex-end; }
  .modal-panel {
    max-width: 100%;
    max-height: 92vh;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    border-bottom: 0;
  }
  .field-row, .field-row--3 { grid-template-columns: 1fr; gap: 14px; }
  .toasts { bottom: 16px; }

  /* 页脚在窄屏改成规规矩矩的三行：
     ① 站名 + 说明按钮（两端对齐）② 登录状态 ③ 简介通栏
     之前「站名 / 图标按钮 / 状态」挤在同一行，又密又难点 */
  .app-footer { padding: 16px 16px calc(22px + env(safe-area-inset-bottom, 0px)); }
  .app-footer .foot-grid {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .foot-head { justify-content: space-between; width: 100%; gap: 10px; }
  .foot-meta { align-items: flex-start; text-align: left; margin-left: 0; }
  .foot-desc { font-size: 12px; }
  /* 说明按钮在窄屏保留文字（它独占行尾，空间够）；
     视觉保持小按钮的 32 高，命中区扩到 44（32 + 7×2） */
  #btn-doc { position: relative; }
  #btn-doc .btn-label { display: inline; }
  #btn-doc::before {
    content: "";
    position: absolute;
    inset: -7px;
    border-radius: inherit;
  }
}

/* 刘海屏 / 灵动岛：装到主屏（standalone）时给顶栏留出安全区 */
@media (max-width: 720px) {
  .app-header { padding-top: env(safe-area-inset-top, 0px); }
}

@media (min-width: 721px) {
  .btn--icon-label .btn-label { display: inline; }
}

/* 极窄屏（320–359px）：
   注意算的是「内容盒」宽度：320 视口 - 两侧容器内边距 24 = 296 可用。
   品牌只剩图标 34 + 间距 12 + 搜索 34 + 间距 12 + 操作区（4×34 + 3×12 = 172）= 264 ≤ 296 ✓
   搜索框已经收成圆钮、主题按钮已隐藏，所以现在放得下，不需要再压间距 */
@media (max-width: 359px) {
  .header-inner { padding: 12px; gap: 12px; }
  /* 只留图标：品牌名在 320px 下会把操作区挤到下一行 */
  .brand-title { display: none; }
  /* ⚠️ 不要为了省空间把间距压到 12px 以下 —— 44px 的命中区会互相遮挡，导致点错按钮 */
}

@media (max-width: 560px) {
  .setting-row { flex-direction: column; align-items: stretch; gap: 10px; }
  .setting-control--seg,
  .setting-control--num { width: 100%; }
  .setting-control--actions { justify-content: flex-start; }
  #storage-line { display: none; }
}

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

@media print {
  .app-header, .toolbar-right, .card-actions, .app-footer, .toasts { display: none !important; }
  .card { break-inside: avoid; box-shadow: none; border-color: #ccc; }
}
