/* ============================================================
   反诈卫士 · 沪语适老版 全局样式（视觉系统 v3 — Neumorphism 新拟物派）
   设计语言：柔和可触的"软陶表面" —— 浅灰 #e0e5ec 单色底，
   双光源（左上亮 #ffffff / 右下暗 #b8bcc2）双重阴影塑造凸起与凹陷；
   交互遵循 Hover Shadowing（悬停阴影缩小）与 Extrude to Intrude
   （按下一瞬间外凸转内凹），全程禁用 translate 位移、渐变与粗边框，
   所有过渡统一 duration-300 ease-in-out。
   适老化约束不变：模式类必须挂在 <html> 上（--font-root 供
   html{font-size} 同层读取）；颜色/字号/圆角/阴影全部走 tokens，
   高对比与大字模式只覆写变量；语义色（danger/warn/ok）与
   .phone 模拟手机屏、.code-box 代码块保留产品语义，不参与换肤。
   ============================================================ */

:root {
  --font-root: 14pt;

  /* 新拟物基色（浅绿主题） */
  --c-bg: #e6f4ee;          /* 主表面 */
  --c-card: #e6f4ee;        /* 元素表面：与背景保持同一色系 */
  --c-surface: #f4fbf8;     /* 抬升表面（顶栏/底栏/对话气泡） */
  --c-text: #242424;
  --c-sub: #4b5a5a;
  --c-primary: #3fc38a;     /* 强调色 / CTA */
  --c-primary-deep: #2f9e6d;
  --c-primary-light: #d9f1e6;
  --c-danger: #d9534f;
  --c-danger-light: #f8e4e2;
  --c-warn: #b7791f;
  --c-warn-light: #f6ecd8;
  --c-ok: #2e8b57;
  --c-ok-light: #e3f1e8;
  --c-line: #cdd6d0;        /* 仅用于 1px 发丝分隔线 */
  --c-border: transparent;  /* 组件描边：常态透明（阴影塑形），高对比模式覆写为可见色 */
  --c-on-primary: #0e2c20;  /* 强调色上的深墨字（保证老人可读对比度） */

  /* 双光源（固定光源：左上亮、右下暗） */
  --sh-dark: #b8c2b9;
  --sh-light: #ffffff;
  --sh-xs: 2px 2px 4px var(--sh-dark), -2px -2px 4px var(--sh-light);
  --sh-sm: 3px 3px 6px var(--sh-dark), -3px -3px 6px var(--sh-light);
  --sh-md: 4px 4px 8px var(--sh-dark), -4px -4px 8px var(--sh-light);
  --sh-lg: 8px 8px 16px var(--sh-dark), -8px -8px 16px var(--sh-light);
  --sh-in-sm: inset 2px 2px 4px var(--sh-dark), inset -2px -2px 4px var(--sh-light);
  --sh-in: inset 4px 4px 8px var(--sh-dark), inset -4px -4px 8px var(--sh-light);
  --sh-in-deep: inset 6px 6px 12px var(--sh-dark), inset -6px -6px 12px var(--sh-light);
  --shadow-card: var(--sh-md);
  --shadow-lift: var(--sh-lg);

  --radius: 16px;
  --radius-sm: 12px;
  --btn-h: 48px;
  --page-max: 560px;
  --pad-x: 16px;
  --gap: 16px;
  --ease: .3s ease-in-out;
}

/* 适老化大字模式：老人自动开启，整体字号放大。
 * 注意必须挂在 html 上（见文件头注释）。 */
html.elder-mode { --font-root: 20pt; --btn-h: 58px; --radius: 18px; }

/* 高对比度模式：黑底黄字（无障碍覆写，仅改变量 + 显式描边） */
html.high-contrast {
  --c-bg: #000000;
  --c-card: #1a1a00;
  --c-surface: #1a1a00;
  --c-text: #ffe600;
  --c-sub: #ffe600;
  --c-primary: #00d0ff;
  --c-primary-deep: #57e2ff;
  --c-primary-light: #002233;
  --c-danger: #ff5f4d;
  --c-danger-light: #330000;
  --c-warn: #ffb300;
  --c-warn-light: #332200;
  --c-ok: #5cff5c;
  --c-ok-light: #003300;
  --c-line: #ffe600;
  --c-border: #ffe600;
  --c-on-primary: #000000;
  --sh-dark: #000000;
  --sh-light: #ffe600;
  --sh-xs: none;
  --sh-sm: none;
  --sh-md: none;
  --sh-lg: none;
  --sh-in-sm: none;
  --sh-in: none;
  --sh-in-deep: none;
  --shadow-card: none;
  --shadow-lift: none;
}

/* ---------- 基础 ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: var(--font-root); }
body {
  font-family: -apple-system, "Segoe UI", "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  background: var(--c-bg);
  color: var(--c-text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  padding-bottom: calc(68px + env(safe-area-inset-bottom));
}
a { color: var(--c-primary); text-decoration: none; }
button { font-family: inherit; font-size: inherit; color: inherit; }
::selection { background: var(--c-primary-light); }
:focus-visible { outline: 2px solid var(--c-primary); outline-offset: 2px; }

/* ---------- 顶栏（抬升表面 + 品牌细线 + 软投影分隔） ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--c-surface);
  box-shadow: 0 5px 12px -8px var(--sh-dark);
}
.topbar::before { content: ""; display: block; height: 3px; background: var(--c-primary); }
.topbar-inner {
  max-width: var(--page-max); margin: 0 auto;
  padding: 10px var(--pad-x);
  display: flex; align-items: center; gap: 14px;
}
.topbar-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.logo-mark {
  background: var(--c-primary); color: var(--c-on-primary);
  border-radius: 10px; padding: 0.08em 0.34em;
  font-weight: 800; font-size: 0.95em; letter-spacing: 0;
  box-shadow: var(--sh-sm);
}
.topbar-title .logo { font-size: 1.16rem; font-weight: 800; letter-spacing: .02em; white-space: nowrap; }
.topbar-title .sub {
  font-size: 0.86rem; color: var(--c-sub);
  padding-left: 8px; margin-left: 2px; border-left: 1px solid var(--c-line);
  white-space: nowrap;
}
.topbar-tools { display: flex; gap: 8px; margin-left: auto; flex-shrink: 0; }
.tool-btn {
  border: 1px solid var(--c-border); background: var(--c-surface); color: var(--c-text);
  border-radius: 999px; padding: 4px 13px; font-size: 0.84rem; cursor: pointer;
  box-shadow: var(--sh-sm);
  transition: box-shadow var(--ease), background var(--ease), color var(--ease);
}
.tool-btn:hover { box-shadow: var(--sh-xs); }
.tool-btn.active {
  background: var(--c-primary);
  color: var(--c-on-primary); font-weight: 700;
}

/* ---------- 主容器 ---------- */
.app {
  max-width: var(--page-max); margin: 0 auto;
  padding: 22px var(--pad-x) 48px;
}
.app > * { animation: fadeUp .34s ease-out both; }
.app > *:nth-child(2) { animation-delay: .05s; }
.app > *:nth-child(3) { animation-delay: .1s; }
.app > *:nth-child(4) { animation-delay: .15s; }

.view-title {
  font-size: clamp(1.32rem, 2vw + 0.8rem, 1.55rem);
  font-weight: 800; letter-spacing: .01em;
  margin-bottom: 6px; line-height: 1.3;
}
.view-desc { color: var(--c-sub); font-size: 1rem; margin-bottom: 20px; max-width: 44em; }

/* 凸起卡片：与背景同色 + 双光源外阴影 */
.card {
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  box-shadow: var(--sh-md);
  padding: 18px;
  margin-bottom: var(--gap);
}
.section-title {
  font-size: 1.02rem; font-weight: 800; margin-bottom: 12px;
  display: flex; align-items: center; gap: 8px; letter-spacing: .01em;
}
.section-title::before { content: ""; width: 4px; height: 1em; background: var(--c-primary); border-radius: 2px; flex-shrink: 0; }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.sec-head .section-title { margin-bottom: 0; }
.sec-note { font-size: 0.86rem; color: var(--c-sub); }

/* ---------- 按钮 / 输入 ----------
 * 按钮：默认外凸 → hover 阴影缩小（手指靠近遮光） → active 转内凹（严禁 translate） */
.btn {
  display: block; width: 100%; min-height: var(--btn-h);
  border: 1px solid var(--c-border); border-radius: var(--radius);
  background: var(--c-primary); color: var(--c-on-primary);
  font-size: 1.02rem; font-weight: 700; cursor: pointer; line-height: 1.4;
  padding: 12px 18px; text-align: center;
  box-shadow: var(--sh-md);
  transition: box-shadow var(--ease), background var(--ease), color var(--ease);
}
.btn:hover:not(:disabled) { background: var(--c-primary-deep); box-shadow: var(--sh-sm); }
.btn:active:not(:disabled) { box-shadow: var(--sh-in); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: var(--sh-sm); }
.btn-lg { min-height: calc(var(--btn-h) + 6px); font-size: 1.1rem; }
.btn-note { font-size: 0.78rem; font-weight: 400; opacity: 0.85; margin-left: 8px; }
.btn-sec { background: var(--c-card); color: var(--c-primary); }
.btn-sec:hover:not(:disabled) { background: var(--c-primary-light); }
.btn-danger { background: var(--c-danger); }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; }

/* 输入框：深凹陷；focus 凹陷变浅（通道打开而非加压） */
.field-input {
  width: 100%; min-height: var(--btn-h);
  border: 1px solid var(--c-border); border-radius: var(--radius);
  background: var(--c-card); color: var(--c-text);
  padding: 10px 14px; font-size: 1rem; font-family: inherit;
  box-shadow: var(--sh-in-deep);
  transition: box-shadow var(--ease);
}
.field-input:focus { outline: none; box-shadow: var(--sh-in-sm); }
.login-row { display: flex; gap: 10px; }
.login-row .field-input { flex: 1; }

/* ---------- 标签 / chips ---------- */
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--c-border); background: var(--c-card); color: var(--c-text);
  border-radius: 999px; padding: 7px 15px; font-size: 0.9rem; cursor: pointer;
  box-shadow: var(--sh-sm);
  transition: box-shadow var(--ease), background var(--ease), color var(--ease);
}
.chip:hover { box-shadow: var(--sh-xs); }
.chip.selected { background: var(--c-primary); color: var(--c-on-primary); font-weight: 700; }
.chip-danger.selected { background: var(--c-danger); color: #fff; }

.trap-row { display: flex; flex-wrap: wrap; gap: 8px; }
.trap-tag {
  background: var(--c-danger-light); color: var(--c-danger);
  border: 1px solid var(--c-border);
  border-radius: 999px; padding: 5px 12px; font-size: 0.85rem; font-weight: 600;
}

/* ============ 首页：杂志式文字 hero（头版头条式底线分隔） ============ */
.hero {
  padding: 16px 0 28px; margin-bottom: 26px;
  border-bottom: 1px solid var(--c-line);
}
.hero-copy { max-width: 40em; }
.kicker {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--c-primary); font-weight: 700; font-size: 0.8rem;
  letter-spacing: .18em; margin-bottom: 10px;
}
.kicker::before { content: ""; width: 22px; height: 2px; background: var(--c-primary); border-radius: 2px; }
.hero-title {
  font-size: clamp(2.1rem, 7vw, 3rem);
  font-weight: 800; letter-spacing: .02em; line-height: 1.18;
  margin-bottom: 12px;
}
.hero-lede { color: var(--c-sub); font-size: 1.07rem; margin-bottom: 20px; max-width: 30em; }
.hero-note { font-size: 0.86rem; color: var(--c-sub); margin-top: 12px; }

/* 首页分区 */
.home-section { margin-bottom: 30px; }

/* 身份选择：单选行列表（选中 = 内凹按压态） */
.ident-grid { display: grid; gap: 10px; }
.ident-card {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border: 1px solid var(--c-border); border-radius: var(--radius-sm);
  background: var(--c-card); padding: 14px 16px; cursor: pointer;
  box-shadow: var(--sh-md);
  transition: box-shadow var(--ease), background var(--ease);
}
.ident-card:hover { box-shadow: var(--sh-sm); }
.ident-card .ic-name { font-weight: 700; font-size: 1.02rem; }
.ident-card .ic-tag { font-size: 0.86rem; color: var(--c-sub); margin-top: 2px; }
.ident-card.selected { box-shadow: var(--sh-in); background: var(--c-primary-light); }
.ident-card.selected .ic-name { color: var(--c-primary); }
.ident-card.selected::after {
  content: "\2713"; color: var(--c-primary);
  font-weight: 800; font-size: 1.1rem; flex-shrink: 0;
}

/* 功能入口便当盒：凸起小卡，hover 仅缩小阴影（不浮起） */
.bento { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.bento-card {
  display: flex; flex-direction: column; gap: 4px; min-height: 120px;
  background: var(--c-card);
  border: 1px solid var(--c-border); border-radius: var(--radius);
  box-shadow: var(--sh-md);
  padding: 18px; cursor: pointer; position: relative; overflow: hidden;
  transition: box-shadow var(--ease);
}
.bento-card:hover { box-shadow: var(--sh-sm); }
.badge-ent {
  display: inline-block; width: max-content;
  font-size: 0.72rem; font-weight: 700; letter-spacing: .06em;
  color: var(--c-primary); background: var(--c-primary-light);
  border-radius: 999px; padding: 2px 10px; margin-bottom: 6px;
}
.bento-card .b-name { font-weight: 800; font-size: 1.05rem; letter-spacing: .01em; }
.bento-card .b-desc { font-size: 0.93rem; color: var(--c-sub); line-height: 1.55; }
.bento-card .b-more {
  margin-top: auto; padding-top: 12px;
  font-size: 0.84rem; font-weight: 700; color: var(--c-primary);
}
.bento-main { grid-column: span 2; min-height: 150px; }
.bento-main .b-name { font-size: 1.3rem; }

/* ============ 防骗体检 ============ */
.progress-wrap {
  background: var(--c-bg); border: 1px solid var(--c-border);
  border-radius: 999px; height: 12px; overflow: hidden; margin-bottom: 6px;
  box-shadow: var(--sh-in);
}
.progress-bar { height: 100%; background: var(--c-primary); border-radius: 999px; transition: width var(--ease); }
.progress-num { font-size: 0.93rem; color: var(--c-sub); text-align: right; margin-bottom: 12px; }

.option-item {
  display: flex; align-items: center; gap: 12px;
  border: 1px solid var(--c-border); border-radius: var(--radius-sm);
  padding: 13px 15px; margin-bottom: 10px; cursor: pointer; background: var(--c-card);
  box-shadow: var(--sh-sm);
  transition: box-shadow var(--ease), background var(--ease);
}
.option-item:hover { box-shadow: var(--sh-xs); }
.option-item.selected { box-shadow: var(--sh-in); background: var(--c-primary-light); }
.option-item .opt-radio {
  width: 24px; height: 24px; border-radius: 50%;
  border: 1px solid var(--c-border); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.86rem; font-weight: 700; color: var(--c-sub);
  box-shadow: var(--sh-in-sm);
  transition: box-shadow var(--ease), background var(--ease), color var(--ease);
}
.option-item.selected .opt-radio { background: var(--c-primary); color: var(--c-on-primary); box-shadow: var(--sh-xs); }
.option-item .opt-text { flex: 1; font-size: 0.98rem; }

.speak-btn {
  display: inline-flex; align-items: center; gap: 4px; flex-shrink: 0;
  border: 1px solid var(--c-primary); color: var(--c-primary); background: transparent;
  border-radius: 999px; padding: 3px 11px; font-size: 0.78rem; cursor: pointer;
  transition: box-shadow var(--ease), background var(--ease), color var(--ease);
}
.speak-btn:hover { background: var(--c-primary); color: var(--c-on-primary); box-shadow: var(--sh-xs); }

/* ============ 报告 ============ */
.score-wrap { text-align: center; padding: 6px 0 14px; }
.score-num { font-size: clamp(3rem, 8vw, 3.6rem); font-weight: 800; color: var(--c-primary); line-height: 1.05; letter-spacing: .01em; }
.score-unit { font-size: 1rem; color: var(--c-sub); }
.risk-badge {
  display: inline-block; margin-top: 10px; border-radius: 999px; padding: 6px 18px;
  font-weight: 700; font-size: 0.98rem;
  box-shadow: var(--sh-xs);
}
.risk-1 { background: var(--c-ok-light); color: var(--c-ok); }
.risk-2 { background: var(--c-warn-light); color: var(--c-warn); }
.risk-3 { background: var(--c-warn-light); color: var(--c-warn); }
.risk-4 { background: var(--c-danger-light); color: var(--c-danger); }
.risk-5 { background: var(--c-danger); color: #fff; }

.level-bar { display: flex; gap: 6px; margin: 14px 0 8px; }
.level-item {
  flex: 1; text-align: center; border-radius: var(--radius-sm); padding: 10px 2px;
  background: var(--c-card); border: 1px solid var(--c-border); font-size: 0.86rem; color: var(--c-sub);
  box-shadow: var(--sh-sm);
}
.level-item .lv-num { font-size: 1.08rem; font-weight: 800; display: block; }
.level-item.current { color: var(--c-danger); font-weight: 700; background: var(--c-danger-light); box-shadow: var(--sh-in); }
.level-item.current .lv-num { color: var(--c-danger); }
.level-desc { font-size: 0.93rem; color: var(--c-sub); margin-bottom: 4px; }

.weak-item { border-left: 4px solid var(--c-danger); background: var(--c-danger-light); border-radius: var(--radius-sm); padding: 11px 14px; margin-bottom: 10px; }
.weak-item .w-head { display: flex; justify-content: space-between; font-weight: 700; color: var(--c-danger); }
.weak-item .w-desc { font-size: 0.88rem; margin-top: 4px; }

.policy-card { border: 1px solid var(--c-border); border-radius: var(--radius-sm); padding: 13px 15px; margin-bottom: 10px; background: var(--c-card); box-shadow: var(--sh-sm); }
.policy-card .p-title { font-weight: 700; color: var(--c-primary); }
.policy-card .p-sub { font-size: 0.86rem; color: var(--c-sub); margin: 2px 0 4px; }
.policy-card .p-body { font-size: 0.88rem; }

/* ============ 演练器（.phone 深色模拟手机屏：产品语义，保留原貌） ============ */
.phone {
  background: #10151d; border-radius: 24px; padding: 18px 14px 22px;
  color: #e6edf3; max-width: 330px; margin: 0 auto 14px;
  border: 1px solid #1f242d;
  box-shadow: 0 10px 30px -6px rgba(0, 0, 0, 0.4);
}
.phone .p-status { font-size: 0.75rem; color: #8b949e; text-align: center; margin-bottom: 10px; }
.phone .p-detect { text-align: center; font-size: 0.72rem; color: #f8b133; min-height: 1.2em; margin-bottom: 6px; }
.phone .p-avatar {
  width: 64px; height: 64px; border-radius: 50%; margin: 0 auto 8px;
  background: var(--c-danger); color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem; font-weight: 800;
}
.phone .p-from { text-align: center; font-size: 1.1rem; font-weight: 700; }
.phone .p-type { text-align: center; font-size: 0.8rem; color: #8b949e; margin-bottom: 12px; }
.phone .p-text { background: #161c26; border-radius: 10px; padding: 12px; font-size: 0.9rem; min-height: 3.2em; }
.phone .p-btn-row { display: flex; gap: 14px; margin-top: 16px; justify-content: center; }
.phone .p-btn {
  width: 58px; height: 58px; border-radius: 50%; border: none; color: #fff;
  font-size: 0.8rem; cursor: pointer;
  transition: transform .1s;
}
.phone .p-btn:active { transform: scale(.93); }
.phone .p-btn.green { background: #238636; }
.phone .p-btn.red { background: #da3633; }

.timeline { border-left: 2px solid var(--c-line); padding-left: 16px; margin-top: 4px; }
.tl-item { position: relative; margin-bottom: 14px; animation: fadeUp .4s ease-out; }
.tl-item::before {
  content: ""; position: absolute; left: -22px; top: 7px;
  width: 10px; height: 10px; border-radius: 50%; background: var(--c-primary);
}
.tl-item .tl-time { font-size: 0.86rem; color: var(--c-sub); }
.tl-item .tl-name { font-weight: 700; }
.tl-item .tl-desc { font-size: 0.93rem; color: var(--c-sub); }
.tl-item.tl-danger::before { background: var(--c-danger); }
.tl-item.tl-danger .tl-name { color: var(--c-danger); }
.tl-item.tl-ok::before { background: var(--c-ok); }
.tl-item.tl-ok .tl-name { color: var(--c-ok); }

/* ============ 科普页 ============ */
.tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.tabs .tab-btn {
  flex: 1; border: 1px solid var(--c-border); background: var(--c-card); color: var(--c-text);
  border-radius: var(--radius-sm); padding: 10px 0; font-size: 0.9rem; cursor: pointer;
  box-shadow: var(--sh-sm);
  transition: box-shadow var(--ease), background var(--ease), color var(--ease);
}
.tabs .tab-btn:hover { box-shadow: var(--sh-xs); }
.tabs .tab-btn.active { background: var(--c-primary); color: var(--c-on-primary); font-weight: 700; }
.info-list { counter-reset: it; }
.info-item {
  position: relative; padding: 13px 4px 13px 44px;
  border-bottom: 1px dashed var(--c-line);
}
.info-item:last-child { border-bottom: none; }
.info-item::before {
  counter-increment: it; content: counter(it, decimal-leading-zero);
  position: absolute; left: 2px; top: 15px;
  font-size: 0.82rem; font-weight: 800; color: var(--c-primary); opacity: .5;
}
.info-item .i-title { font-weight: 700; color: var(--c-primary); margin-bottom: 4px; font-size: 0.98rem; }
.info-item .i-body { font-size: 0.9rem; }

/* ---------- 科普卡片语音播报（老人身份） ---------- */
.info-playable { cursor: pointer; }
.info-item.info-playable { border-radius: var(--radius-sm); transition: background var(--ease); }
.info-item.info-playable:hover { background: var(--c-primary-light); }
.i-play {
  float: right; font-size: 0.72rem; font-weight: 700; color: var(--c-primary);
  border: 1px solid var(--c-primary); border-radius: 999px; padding: 2px 10px; margin-left: 8px;
}
.policy-card.info-playable { position: relative; cursor: pointer; transition: background var(--ease); }
.policy-card.info-playable:hover { background: var(--c-primary-light); }
.policy-card.info-playable .p-title { padding-right: 74px; }
.policy-card .i-play { position: absolute; top: 12px; right: 12px; }

/* ============ 统计看板（管理员） ============ */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: var(--gap); }
.stat-card {
  background: var(--c-card); border: 1px solid var(--c-border);
  border-radius: var(--radius); box-shadow: var(--sh-md);
  padding: 16px 14px; text-align: center;
}
.stat-card .s-num { font-size: clamp(1.7rem, 4vw, 2.1rem); font-weight: 800; color: var(--c-primary); line-height: 1.15; letter-spacing: .01em; }
.stat-card .s-label { font-size: 0.86rem; color: var(--c-sub); margin-top: 4px; }
.stat-card .s-note { font-size: 0.86rem; color: var(--c-sub); opacity: .8; margin-top: 2px; }
.charts-grid { display: grid; gap: var(--gap); }
.charts-grid .card { margin-bottom: 0; }

.bar-row { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; font-size: 0.93rem; }
.bar-row:last-child { margin-bottom: 0; }
.bar-row .b-label { width: 5.6em; flex-shrink: 0; }
.bar-row .b-track {
  flex: 1; background: var(--c-bg); border: 1px solid var(--c-border);
  border-radius: 999px; height: 12px; overflow: hidden;
  box-shadow: var(--sh-in);
}
.bar-row .b-fill { height: 100%; border-radius: 999px; }
.bar-row .b-num { width: 2.6em; text-align: right; color: var(--c-sub); font-variant-numeric: tabular-nums; }

/* ============ 嵌入页（.code-box 代码块：产品语义，保留深色） ============ */
.code-box {
  background: #10151d; color: #7ee787; border-radius: var(--radius-sm); padding: 14px;
  font-family: Consolas, "SF Mono", monospace; font-size: 0.8rem;
  overflow-x: auto; white-space: pre; line-height: 1.6;
}
.note-list { padding-left: 1.2em; font-size: 0.93rem; color: var(--c-sub); }
.note-list li { margin-bottom: 6px; }

/* ============ 智能语音对话 ============ */
.chat-status {
  padding: 11px 14px; background: var(--c-primary-light); color: var(--c-primary);
  border-radius: var(--radius-sm); font-size: 0.9rem; line-height: 1.6; font-weight: 600;
  box-shadow: var(--sh-xs);
}
.talk-btn {
  width: 150px; height: 150px; border-radius: 50%;
  border: 1px solid var(--c-border); background: var(--c-primary);
  color: var(--c-on-primary); font-size: 1.05rem; font-weight: 700; cursor: pointer;
  box-shadow: var(--sh-lg);
  transition: box-shadow var(--ease), background var(--ease);
}
.talk-btn:hover:not(:disabled) { box-shadow: var(--sh-md); }
.talk-btn:active:not(:disabled) { box-shadow: var(--sh-in); }
.talk-btn:disabled { opacity: 0.55; cursor: not-allowed; box-shadow: var(--sh-md); }
.chat-asr {
  min-height: 1.6em; margin-top: 10px; padding: 9px 14px;
  background: var(--c-card); border-radius: var(--radius-sm);
  font-size: 0.93rem; line-height: 1.6; color: var(--c-sub);
  box-shadow: var(--sh-in-deep);
}
/* 对话记录：纵向自上而下排列，配合 chat.js 的 appendChild 尾部追加 ——
 * 新消息永远出现在旧消息的下方（严禁 column-reverse，会颠倒时间顺序） */
.chat-log {
  display: flex; flex-direction: column; justify-content: flex-start; align-items: stretch;
  gap: 10px; max-height: 440px; overflow-y: auto; padding: 2px;
}
.chat-empty { color: var(--c-sub); font-size: 1rem; text-align: center; padding: 14px 0; }
.chat-msg { max-width: 86%; padding: 10px 14px; border-radius: 14px; font-size: 0.98rem; line-height: 1.65; word-break: break-word; animation: fadeUp .25s ease-out; }
.chat-msg .m-role { display: block; font-size: 0.86rem; font-weight: 700; opacity: 0.75; margin-bottom: 2px; }
.chat-msg.user { align-self: flex-end; background: var(--c-primary); color: var(--c-on-primary); border-bottom-right-radius: 4px; box-shadow: var(--sh-sm); }
.chat-msg.agent { align-self: flex-start; background: var(--c-surface); color: var(--c-text); border-bottom-left-radius: 4px; box-shadow: var(--sh-sm); }
.chat-msg.agent .m-role { color: var(--c-primary); }

/* ============ 底部导航（全端：页面五个入口固定在最底部） ============ */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: flex; background: var(--c-surface);
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -5px 12px -8px var(--sh-dark);
  max-width: var(--page-max); margin: 0 auto;
}
.tabbar .tab {
  flex: 1; text-align: center; padding: 11px 0 9px; color: var(--c-sub);
  font-size: 1.1rem; transition: color var(--ease);
}
.tabbar .tab:hover { color: var(--c-text); }
.tabbar .tab.active { color: var(--c-primary); font-weight: 800; }

/* ============ 提示（toast：系统级浮层，保留深色以保证可读性） ============ */
.toast {
  position: fixed; left: 50%; bottom: calc(80px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: rgba(17, 25, 39, 0.94); color: #fff;
  border-radius: 999px; padding: 11px 22px; font-size: 0.9rem; z-index: 999;
  animation: fadeUp .25s ease-out; max-width: 86vw; text-align: center;
}

@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ============ 高对比度模式：阴影全部扁平化，改用显式描边保证结构可见 ============ */
html.high-contrast .card,
html.high-contrast .bento-card,
html.high-contrast .stat-card,
html.high-contrast .ident-card,
html.high-contrast .option-item,
html.high-contrast .chip,
html.high-contrast .tabs .tab-btn,
html.high-contrast .tool-btn,
html.high-contrast .btn,
html.high-contrast .field-input,
html.high-contrast .chat-msg,
html.high-contrast .progress-wrap,
html.high-contrast .b-track,
html.high-contrast .chat-asr,
html.high-contrast .policy-card,
html.high-contrast .level-item,
html.high-contrast .trap-tag,
html.high-contrast .opt-radio { border-color: var(--c-border); }
html.high-contrast .topbar { border-bottom: 1px solid var(--c-border); }
html.high-contrast .tabbar { border-top: 1px solid var(--c-border); }

/* ============ 桌面端（≥760px）：限宽升级 + 阴影随屏幕放大（md: 前缀等效） ============ */
@media (min-width: 760px) {
  :root {
    --page-max: 1120px; --pad-x: 32px;
    --sh-xs: 3px 3px 6px var(--sh-dark), -3px -3px 6px var(--sh-light);
    --sh-sm: 4px 4px 8px var(--sh-dark), -4px -4px 8px var(--sh-light);
    --sh-md: 8px 8px 16px var(--sh-dark), -8px -8px 16px var(--sh-light);
    --sh-lg: 12px 12px 24px var(--sh-dark), -12px -12px 24px var(--sh-light);
  }
  .app { padding-top: 34px; }
  .view-title { font-size: 1.6rem; }

  /* 文字杂志式 hero：加大留白与字号 */
  .hero { padding: 52px 0 38px; }
  .hero-title { font-size: clamp(2.5rem, 4.2vw, 3.4rem); }
  .hero-copy .btn-lg { max-width: 22em; }

  /* 便当盒：主卡 4×2 放大，次要入口小卡环绕 */
  .bento { grid-template-columns: repeat(6, 1fr); grid-auto-rows: 100px; gap: 14px; }
  .bento-main { grid-column: span 4; grid-row: span 2; min-height: 0; }
  .bento-main .b-name { font-size: 1.45rem; }
  .bento-main .b-desc { font-size: 1rem; max-width: 24em; }
  .bento-card:nth-child(2) { grid-column: span 2; }
  .bento-card:nth-child(3) { grid-column: span 2; }
  .bento-card:nth-child(4) { grid-column: span 3; }
  .bento-card:nth-child(5) { grid-column: span 3; }

  /* 统计看板：4 KPI + 双栏图表 */
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
  .charts-grid { grid-template-columns: 1fr 1fr; }
  .charts-grid .card.span-2 { grid-column: span 2; }
}

/* 中屏顶栏压缩：隐藏副标题，给功能按钮留空间 */
@media (max-width: 899px) {
  .topbar-title .sub { display: none; }
}

/* 动效降级 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}