/* ============================================================
   授权中心 · 样式表
   结构：设计变量 → 基础 → 公共组件 → 管理台 → 弹窗提示 → 公开页
   所有 class 名与 app.js 保持一一对应，只做视觉层升级
   ============================================================ */

:root {
  /* 表面层 */
  --bg: #f6f7f9;
  --bg-grad: radial-gradient(1100px 520px at 50% -160px, #e2ebff 0%, rgba(246, 247, 249, 0) 72%);
  --card: #ffffff;
  --surface-2: #f6f8fa;
  --surface-3: #eef1f5;

  /* 描边 */
  --border: #e7eaef;
  --border-strong: #d3d8e0;

  /* 文字 */
  --text: #171a1f;
  --text-2: #40474f;
  --muted: #697382;

  /* 主色 */
  --primary: #2f6feb;
  --primary-hover: #2559c9;
  --primary-soft: #ecf2ff;
  --primary-ring: rgba(47, 111, 235, .16);

  /* 语义色 */
  --danger: #d1242f;
  --danger-soft: #fdeced;
  --ok: #18803a;
  --ok-soft: #e8f6ec;
  --warn: #9a6700;
  --warn-soft: #fff7e3;

  /* 形状与阴影 */
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 2px 6px rgba(16, 24, 40, .04);
  --shadow-md: 0 4px 16px rgba(16, 24, 40, .07), 0 1px 3px rgba(16, 24, 40, .05);
  --shadow-lg: 0 18px 48px rgba(16, 24, 40, .16);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  background-image: var(--bg-grad);
  background-repeat: no-repeat;
  color: var(--text);
  font: 14px/1.6 var(--font);
  font-feature-settings: "tnum" 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--primary); text-decoration: none; transition: opacity .15s; }
a:hover { opacity: .8; }

::selection { background: var(--primary-ring); }

/* 统一的键盘焦点样式，鼠标点击不触发 */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* 细滚动条 */
* { scrollbar-width: thin; scrollbar-color: #c9cfd8 transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb {
  background: #cfd5de; border-radius: 10px; border: 3px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: #b6bdc8; background-clip: content-box; }

/* ---------- 公共 ---------- */
/* 公开页容器：垂直居中，桌面上不会挤在顶部；
   用 min-height 而非 height，内容变长时会自然撑开、不会裁掉顶部 */
.wrap {
  max-width: 560px; margin: 0 auto;
  min-height: 100dvh;
  display: flex; flex-direction: column; justify-content: center;
  padding: 40px 20px 56px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-pad { padding: 24px; }

.brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 650; font-size: 15.5px; letter-spacing: -.2px;
}
.brand-dot {
  width: 24px; height: 24px; border-radius: 7px; flex: 0 0 24px;
  background: linear-gradient(135deg, #4a86f7, #6f4ef2);
  box-shadow: 0 2px 6px rgba(47, 111, 235, .32), inset 0 1px 0 rgba(255, 255, 255, .35);
  position: relative;
}
/* 用一条对勾强化识别度，纯 CSS 不占请求 */
.brand-dot::after {
  content: ""; position: absolute; left: 7px; top: 7.5px;
  width: 8px; height: 4.5px; border-left: 2px solid #fff; border-bottom: 2px solid #fff;
  transform: rotate(-45deg); border-radius: 1px;
}

h1 {
  font-size: 20px; margin: 0 0 6px; font-weight: 650;
  letter-spacing: -.3px; line-height: 1.35;
}
h2 {
  font-size: 15px; margin: 0 0 14px; font-weight: 640; letter-spacing: -.1px;
  display: flex; align-items: center; gap: 8px;
}
/* 卡片内的分区标题加一条左侧色条，让「站点 / 运行环境 / 公钥」这类段落一眼分开 */
.card-pad > h2::before, .card > h2::before {
  content: ""; width: 3px; height: 13px; border-radius: 2px;
  background: var(--primary); opacity: .85; flex: 0 0 3px;
}
.sub { color: var(--muted); font-size: 13px; margin: 0; line-height: 1.65; }
.sub code {
  font-family: var(--mono); font-size: .92em; background: var(--surface-3);
  padding: 1px 5px; border-radius: 4px;
}

/* ---------- 表单 ---------- */
label.field { display: block; margin-bottom: 16px; }
label.field > span {
  display: block; font-size: 12.5px; color: var(--text-2);
  margin-bottom: 6px; font-weight: 550;
}

input[type=text], input[type=password], input[type=number], input[type=datetime-local],
select, textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font: inherit;
  color: var(--text);
  background: #fff;
  outline: none;
  transition: border-color .16s, box-shadow .16s, background .16s;
}
input[type=text]:hover, input[type=password]:hover, input[type=number]:hover,
input[type=datetime-local]:hover, select:hover, textarea:hover {
  border-color: #bfc6d1;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}
input[readonly] { background: var(--surface-2); color: var(--muted); cursor: default; }
textarea { resize: vertical; min-height: 150px; font-family: var(--font); line-height: 1.65; }
input::placeholder, textarea::placeholder { color: #a5adb9; }

/* 下拉箭头换成更轻的样式 */
select {
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5' stroke='%23697382' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 15px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: #fff; color: var(--text);
  font: inherit; font-weight: 540;
  cursor: pointer; white-space: nowrap; user-select: none;
  transition: background .15s, border-color .15s, box-shadow .15s, transform .08s;
}
.btn:hover { background: var(--surface-2); border-color: #c3cad4; }
.btn:active { transform: translateY(.5px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.btn-primary {
  background: var(--primary); border-color: var(--primary); color: #fff;
  box-shadow: 0 1px 2px rgba(47, 111, 235, .28), inset 0 1px 0 rgba(255, 255, 255, .14);
}
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }

.btn-danger { color: var(--danger); border-color: #f2c8c8; background: #fff; }
.btn-danger:hover { background: var(--danger-soft); border-color: #eab3b3; }

.btn-sm { padding: 4px 10px; font-size: 12.5px; border-radius: 7px; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--surface-3); border-color: transparent; }

.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 16px; }

/* ---------- 表格 ---------- */
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
th {
  text-align: left; font-weight: 600; color: var(--muted); font-size: 11.5px;
  letter-spacing: .04em; text-transform: none;
  padding: 10px 12px; white-space: nowrap;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 1;
}
td {
  padding: 10px 12px; border-bottom: 1px solid #f0f2f6;
  vertical-align: middle; color: var(--text-2);
  font-variant-numeric: tabular-nums;
  /* 关键：表格单元格默认不换行。
     否则空间不够时中文会被压缩成竖排（「V6 菱致改装工具」一字一行），
     宁可让表格变宽、外层横向滚动，也不要竖排。 */
  white-space: nowrap;
}
/* 需要换行的长文本（备注、错误信息）单独放行 */
td.wrap, td .wrap { white-space: normal; }
/* 表格窄屏时允许横向滚动，并给出可见的滚动条 */
.table-scroll { overflow-x: auto; }
tbody tr { transition: background .12s; }
tbody tr:hover td { background: #f9fafc; }
tbody tr:last-child td { border-bottom: 0; }
td:first-child, th:first-child { padding-left: 14px; }
td:last-child, th:last-child { padding-right: 14px; text-align: right; }
/* 数字列右对齐，金额、次数、时长这类一眼能纵向比较 */
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

.mono { font-family: var(--mono); font-size: 12.5px; letter-spacing: -.1px; }
.key-cell {
  font-family: var(--mono); font-size: 12.5px; letter-spacing: .1px;
  color: var(--text); white-space: nowrap;
}

/* ---------- 标签 ---------- */
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 8px; border-radius: 20px;
  font-size: 11.5px; font-weight: 570; line-height: 18px; white-space: nowrap;
  border: 1px solid transparent;
  margin-right: 4px; vertical-align: middle;
}
.tag::before {
  content: ""; width: 5px; height: 5px; border-radius: 50%;
  background: currentColor; opacity: .75; flex: 0 0 5px;
}
.tag-ok { background: var(--ok-soft); color: var(--ok); border-color: rgba(24, 128, 58, .14); }
.tag-warn { background: var(--warn-soft); color: var(--warn); border-color: rgba(154, 103, 0, .14); }
.tag-danger { background: var(--danger-soft); color: var(--danger); border-color: rgba(209, 36, 47, .14); }
.tag-mute { background: var(--surface-3); color: var(--muted); border-color: rgba(105, 115, 130, .1); }
.tag-info { background: var(--primary-soft); color: var(--primary); border-color: rgba(47, 111, 235, .14); }
/* 纯文字标签不显示圆点 */
.tag.plain::before { display: none; }

/* ---------- 布局：管理台 ---------- */
.shell { display: flex; min-height: 100vh; }

.side {
  width: 216px; flex: 0 0 216px;
  background: #fff;
  border-right: 1px solid var(--border);
  padding: 18px 12px 16px;
  display: flex; flex-direction: column; gap: 2px;
  position: sticky; top: 0; height: 100vh;
}
.side-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 2px 6px 20px;
}
.side-head .brand { padding: 0; }
.side-close {
  display: none; padding: 5px 7px; color: var(--muted);
  border-radius: 7px;
}
.side-close:hover { color: var(--text); background: var(--surface-3); }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px; border-radius: 9px;
  color: var(--text-2); cursor: pointer;
  font-size: 13.5px; font-weight: 500; user-select: none;
  transition: background .14s, color .14s;
  position: relative;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active {
  background: var(--primary-soft); color: var(--primary-hover); font-weight: 600;
}
.nav-item.active::before {
  content: ""; position: absolute; left: -12px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 18px; border-radius: 0 3px 3px 0; background: var(--primary);
}
.nav-item .ico {
  width: 17px; height: 17px;
  display: flex; align-items: center; justify-content: center;
  opacity: .58; flex: 0 0 17px;
  transition: opacity .14s;
}
.nav-item:hover .ico { opacity: .8; }
.nav-item.active .ico { opacity: 1; }

.side-foot {
  margin-top: auto; padding: 12px 10px 4px;
  border-top: 1px solid var(--border);
  font-size: 12px; color: var(--muted);
  display: flex; flex-direction: column; gap: 4px;
}

.main { flex: 1; min-width: 0; padding: 28px 32px 72px; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 22px; gap: 12px; flex-wrap: wrap;
}
.topbar h1 { margin: 0; font-size: 19px; }

/* 统计卡 */
.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(152px, 1fr));
  gap: 12px; margin-bottom: 22px;
}
.stat {
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius); padding: 15px 16px;
  transition: box-shadow .18s, transform .18s, border-color .18s;
}
.stat:hover { box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.stat .k {
  font-size: 12px; color: var(--muted); margin-bottom: 6px;
  font-weight: 500; letter-spacing: .01em;
}
.stat .v {
  font-size: 23px; font-weight: 660; letter-spacing: -.5px;
  font-variant-numeric: tabular-nums; line-height: 1.2;
}
.stat .v small { font-size: 12px; font-weight: 500; color: var(--muted); margin-left: 4px; letter-spacing: 0; }

.toolbar {
  display: flex; gap: 8px; align-items: center;
  margin-bottom: 14px; flex-wrap: wrap;
}
.toolbar .spacer { flex: 1; }
.toolbar select, .toolbar input {
  width: auto; min-width: 140px; padding: 7px 11px; font-size: 13px;
}
.toolbar select { padding-right: 30px; }

.table-card {
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow);
}
.table-scroll { overflow-x: auto; }
/* 只有真正溢出时才显示（由 JS 打标记），避免误导 */
.table-card.has-scroll::after {
  content: "← 左右滑动查看全部列 →";
  display: block; text-align: center;
  font-size: 11.5px; color: var(--muted);
  padding: 7px 10px;
  border-top: 1px solid var(--border);
  background: #fcfcfd;
}

.pager {
  display: flex; align-items: center; justify-content: flex-end; gap: 8px;
  padding: 11px 16px; border-top: 1px solid var(--border);
  font-size: 12.5px; color: var(--muted); background: #fcfcfd;
}

.empty {
  padding: 52px 20px; text-align: center; color: var(--muted); font-size: 13px;
}

/* ---------- 弹窗 ---------- */
.mask {
  position: fixed; inset: 0; background: rgba(20, 26, 36, .42);
  backdrop-filter: blur(2px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 60px 16px; z-index: 50; overflow-y: auto;
  animation: fade .16s ease-out;
}
.modal {
  background: #fff; border-radius: 14px; width: 100%; max-width: 580px;
  box-shadow: var(--shadow-lg); overflow: hidden;
  animation: pop .18s cubic-bezier(.2, .8, .3, 1);
}
.modal-head {
  padding: 17px 22px; border-bottom: 1px solid var(--border);
  font-weight: 640; font-size: 15px;
}
.modal-body { padding: 22px; max-height: 68vh; overflow-y: auto; }
.modal-foot {
  padding: 14px 22px; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 8px; background: #fcfcfd;
}

@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
@keyframes pop {
  from { opacity: 0; transform: translateY(8px) scale(.985) }
  to { opacity: 1; transform: none }
}

/* ---------- 提示 ---------- */
.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(6px);
  background: #1c2026; color: #fff;
  padding: 10px 18px; border-radius: 10px;
  font-size: 13px; font-weight: 500;
  z-index: 100; box-shadow: 0 8px 28px rgba(0, 0, 0, .26);
  opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none;
  max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-2px); }
.toast.err { background: var(--danger); }

.alert {
  padding: 11px 14px; border-radius: 9px; font-size: 13px; line-height: 1.6;
  margin-bottom: 14px; border: 1px solid transparent;
}
.alert-info { background: var(--primary-soft); color: #1c4fbf; border-color: rgba(47, 111, 235, .14); }
.alert-warn { background: var(--warn-soft); color: var(--warn); border-color: rgba(154, 103, 0, .16); }
.alert-err { background: var(--danger-soft); color: var(--danger); border-color: rgba(209, 36, 47, .14); }

/* ---------- 公开页 ---------- */
.wrap .brand { justify-content: center; margin-bottom: 26px; font-size: 16px; }

.tabs {
  display: flex; gap: 4px; margin-bottom: 18px;
  background: var(--surface-3); padding: 4px; border-radius: 10px;
}
.tab {
  flex: 1; text-align: center;
  padding: 8px 14px; border-radius: 7px; cursor: pointer;
  font-size: 13.5px; font-weight: 540; color: var(--muted);
  user-select: none; transition: background .16s, color .16s, box-shadow .16s;
}
.tab:hover { color: var(--text-2); }
.tab.active {
  background: #fff; color: var(--text); font-weight: 620;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .07), 0 1px 1px rgba(16, 24, 40, .04);
}

.wrap .card { border-radius: 14px; }
.wrap .card-pad { padding: 26px 24px; }
.wrap h1 { font-size: 19px; margin-bottom: 6px; }
.wrap label.field { margin-bottom: 14px; }
.wrap label.field > span { font-size: 13px; }
.wrap input[type=text] { padding: 11px 13px; font-size: 14px; }
.wrap .btn { width: 100%; padding: 11px 15px; font-size: 14px; font-weight: 560; }
.wrap .btn-sm { width: auto; padding: 5px 12px; font-size: 12.5px; }

.result { margin-top: 18px; }
.result > .card { box-shadow: none; background: var(--surface-2); border-color: var(--border); }

.kv {
  display: flex; padding: 10px 0; border-bottom: 1px dashed #e6eaef;
  font-size: 13.5px; align-items: baseline;
}
.kv:last-child { border-bottom: 0; }
.kv .k { width: 92px; flex: 0 0 92px; color: var(--muted); font-size: 13px; }
.kv .v { flex: 1; min-width: 0; word-break: break-word; font-weight: 520; }

.dev-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 11px 0; border-bottom: 1px dashed #e6eaef; font-size: 13px;
}
.dev-item:last-child { border-bottom: 0; }
/* 设备名过长时省略，避免撑破小屏布局 */
.dev-item > div { min-width: 0; }
.dev-item > div > div:first-child {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.key-big {
  font-family: var(--mono);
  font-size: 16px; letter-spacing: .8px; font-weight: 600;
  padding: 16px 14px; background: #fff;
  border: 1px dashed var(--border-strong); border-radius: 10px;
  text-align: center; word-break: break-all; color: var(--text);
}

.copy-list {
  max-height: 320px; overflow-y: auto;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 9px; padding: 12px 14px;
}
.copy-list div {
  font-family: var(--mono); font-size: 12.5px; padding: 3px 0; letter-spacing: .1px;
}

/* ---------- 限流档位选择 ---------- */
.rate-opts { display: flex; flex-direction: column; gap: 8px; }

.rate-opt {
  display: flex; align-items: flex-start;
  padding: 13px 15px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  cursor: pointer; user-select: none;
  transition: border-color .15s, background .15s, box-shadow .15s;
  background: #fff;
}
.rate-opt:hover { border-color: #b9c1cd; background: #fcfdff; }
.rate-opt.active {
  border-color: var(--primary); background: var(--primary-soft);
  box-shadow: 0 0 0 3px var(--primary-ring);
}
/* 原生 radio 仍保留在 DOM 里（表单提交、键盘可达），只是视觉隐藏 */
.rate-opt input {
  position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none;
}
.rate-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.rate-name {
  display: flex; align-items: center; gap: 6px;
  font-weight: 620; font-size: 13.5px; color: var(--text);
}
.rate-desc { font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.rate-nums {
  font-family: var(--mono); font-size: 11.5px; color: var(--text-2);
  background: rgba(255, 255, 255, .72);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 8px;
  margin-top: 2px;
  align-self: flex-start;
  letter-spacing: -.1px;
}

/* ---------- 响应式 ----------
   三档：桌面（≥1200）常驻侧栏 / 笔记本与平板横屏（960–1199）侧栏收窄 /
   平板竖屏与手机（<960）侧栏变抽屉，由左上角按钮唤出 */

/* 汉堡按钮与遮罩默认不出现，桌面端不需要 */
.btn-menu {
  display: none;
  padding: 7px 9px; margin-left: -4px;
  border-radius: 8px;
}
.topbar-left { display: flex; align-items: center; gap: 8px; min-width: 0; }
.topbar-left h1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-mask { display: none; }
body.no-scroll { overflow: hidden; }

/* ---- 笔记本：收紧侧栏，给内容让位 ---- */
@media (max-width: 1359px) {
  .side { width: 196px; flex: 0 0 196px; padding: 16px 10px; }
  .side-head { padding: 2px 4px 18px; }
  .side-head .brand { font-size: 14.5px; }
  .nav-item { padding: 8px 9px; font-size: 13px; }
  .main { padding: 24px 22px 64px; }
}

/* ---- 平板竖屏 / 手机：侧栏改抽屉 ---- */
@media (max-width: 960px) {
  .side {
    position: fixed; left: 0; top: 0; bottom: 0;
    width: 256px; flex: 0 0 256px; height: 100dvh;
    padding: 16px 12px;
    transform: translateX(-100%);
    transition: transform .24s cubic-bezier(.3, .8, .3, 1);
    z-index: 60; border-right: 0;
  }
  .side.open {
    transform: none;
    box-shadow: 0 0 60px rgba(16, 24, 40, .22);
  }

  .side-mask {
    display: block; position: fixed; inset: 0; z-index: 55;
    background: rgba(16, 24, 40, .42);
    opacity: 0; visibility: hidden;
    transition: opacity .2s, visibility .2s;
  }
  .side-mask.show { opacity: 1; visibility: visible; }

  .btn-menu { display: inline-flex; }
  .side-close { display: inline-flex; }
  .main { padding: 16px 16px 72px; }
  .topbar { margin-bottom: 16px; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .table-scroll { -webkit-overflow-scrolling: touch; }
}

/* ---- 手机 ---- */
@media (max-width: 640px) {
  .topbar { flex-direction: column; align-items: stretch; gap: 12px; }
  .topbar .row { justify-content: flex-start; flex-wrap: wrap; }
  .toolbar { gap: 6px; }
  .toolbar select, .toolbar input { min-width: 0; flex: 1 1 132px; font-size: 16px; } /* 16px 避免 iOS 聚焦时自动放大 */
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .stat { padding: 12px 13px; }
  .stat .v { font-size: 20px; }
  .modal { max-width: none; }
  .mask { padding: 20px 10px; }
  .modal-body { max-height: 74vh; padding: 18px; }
  .modal-head, .modal-foot { padding-left: 18px; padding-right: 18px; }
  .rate-opt { padding: 12px 13px; }
  .rate-nums { font-size: 11px; }
}

/* ---- 公开页：手机优先，桌面收窄成一列更好读 ---- */
@media (max-width: 720px) {
  .wrap { padding: 32px 16px 56px; }
  .wrap .card-pad { padding: 22px 18px; }
  .wrap .card { border-radius: 12px; }
  .wrap h1 { font-size: 18px; }
  .kv .k { width: 78px; flex: 0 0 78px; font-size: 12.5px; }
  .key-big { font-size: 14px; letter-spacing: .4px; padding: 14px 10px; }
}

@media (max-width: 380px) {
  .wrap { padding: 24px 12px 48px; }
  .wrap .card-pad { padding: 18px 14px; }
  .tabs { gap: 3px; padding: 3px; }
  .tab { padding: 7px 8px; font-size: 13px; }
}

/* 减少动效偏好 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}
