/* =====================================================================
   行健 XINGJIAN · 全站经典组件层（Legacy Components）
   ---------------------------------------------------------------------
   戳：v20260924f

   身份说明：
   本文件原名「style.css · 全站样式主文件」，2026-08-15 版本定义 108 个
   组件类，是全站登录后页面（患者端/医生端/管理端/好物/通知/家庭圈…）
   的样式根。2026-08-24 它被一次「防折行护栏」改动**整体覆盖**为 1303B，
   导致 44 个页面 301 个类名同时失去定义 —— 全站组件样式裸奔。
   本次按归档底本（_archive/2026-08-15-roadshow-bizplan/public/css/style.css）
   恢复，并做两项升级：
     1. 取值全部令牌化 var(--xj-*, fallback)，跟随 xingjian-tokens.css 唯一真源；
        颜色全面对齐现行 VI（主绿 #0e9f6e），废止旧墨绿 #2E7D5B / 纯红 #D32F2F。
     2. 适老化：底本 11 处 0.72–0.8rem（11.5–12.8px）字号全部提到 13–14px，
        满足「界面文字禁止 <13px」铁律。

   边界：本层只负责「旧类名兼容」（.card/.btn/.site-header …）。
   新页面请优先使用 xj-components.css 的 .xj-* 体系。
   文件尾部保留原「防折行护栏」（.topbar 相关），一字未改。

   所有引用均写成 var(--xj-xxx, fallback)，令牌加载失败样式不崩。
   ===================================================================== */

/* 令牌层（唯一真源）。相对本文件目录引用；加载失败时下方 fallback 仍生效。 */
@import url('xingjian-tokens.css');

/* =====================================================================
   0. 基础
   ===================================================================== */
:root {
  --max-width: 680px;
  --header-h: 56px;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  /* 功能页正文 16px：与页面既有默认一致，零布局意外。
     阅读型页面（首页/学习）请用 --xj-fs-body（17px）。 */
  font-size: 16px;
  font-family: var(--xj-font-sans, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif);
  background: var(--xj-paper, #faf8f4);
  color: var(--xj-ink, #2b3a34);
  line-height: var(--xj-lh-tight, 1.6);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

a { color: var(--xj-green-ink, #0b7a54); }

/* =====================================================================
   1. 顶部导航
   ===================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--xj-surface, #ffffff);
  border-bottom: 1px solid var(--xj-line, #eceae3);
  height: var(--header-h);
  display: flex;
  align-items: center;
  padding: 0 16px;
  box-shadow: var(--xj-shadow-1, 0 1px 3px rgba(43, 58, 52, .05));
}

.site-header .logo {
  font-size: 19px;
  font-weight: 700;
  color: var(--xj-green-ink, #0b7a54);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 6px;
}

.site-header .logo-icon {
  width: 28px;
  height: 28px;
  background: var(--xj-green, #0e9f6e);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.header-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--xj-surface-2, #f4f3ee);
  border: 1px solid var(--xj-line, #eceae3);
  border-radius: var(--xj-radius-pill, 999px);
  padding: 6px 12px;
  min-height: 34px;
  font-size: 14px;
  color: var(--xj-ink-2, #5f6f69);
  cursor: pointer;
  transition: all var(--xj-dur-fast, 180ms) var(--xj-ease, cubic-bezier(.22,.61,.36,1));
  white-space: nowrap;
  font-family: inherit;
}
.lang-switch:hover, .lang-switch:active {
  border-color: var(--xj-green, #0e9f6e);
  color: var(--xj-green-ink, #0b7a54);
}

.user-menu { position: relative; }

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--xj-green, #0e9f6e);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  overflow: hidden;
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }

.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  background: var(--xj-surface, #ffffff);
  border: 1px solid var(--xj-line, #eceae3);
  border-radius: var(--xj-radius-ctl, 8px);
  box-shadow: var(--xj-shadow-3, 0 6px 24px rgba(43, 58, 52, .10));
  min-width: 150px;
  overflow: hidden;
  display: none;
  z-index: 120;
}
.dropdown-menu.show { display: block; }
.dropdown-menu a {
  display: block;
  padding: 12px 16px;
  color: var(--xj-ink, #2b3a34);
  text-decoration: none;
  font-size: 15px;
  min-height: 44px;
  transition: background var(--xj-dur-fast, 180ms);
}
.dropdown-menu a:hover, .dropdown-menu a:active { background: var(--xj-green-mist, #e8f5ef); }

/* =====================================================================
   2. 主内容区
   ===================================================================== */
.main-content {
  flex: 1;
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 16px;
}

.wrap { width: 100%; max-width: 100%; margin: 0 auto; box-sizing: border-box; }

/* =====================================================================
   3. 卡片
   ===================================================================== */
.card {
  background: var(--xj-surface, #ffffff);
  border-radius: var(--xj-radius-card, 16px);
  box-shadow: var(--xj-shadow-2, 0 2px 10px rgba(43, 58, 52, .07));
  padding: 16px;
  margin-bottom: 12px;
  box-sizing: border-box;
}
.card:last-child { margin-bottom: 0; }

.card-title {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--xj-ink, #2b3a34);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* 卡片内通用子块（发现页/好物页在用的 card-* 组合） */
.card-body { padding: 10px 0; }
.card-img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  background: var(--xj-surface-2, #f4f3ee);
  border-radius: var(--xj-radius-ctl, 8px);
}
.card-cat, .card-city, .card-sum { font-size: 14px; color: var(--xj-ink-2, #5f6f69); }
.card-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

/* =====================================================================
   4. 表单
   ===================================================================== */
.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: 14px;
  color: var(--xj-ink-2, #5f6f69);
  margin-bottom: 6px;
  font-weight: 500;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 12px 14px;
  min-height: var(--xj-tap, 44px);
  border: 1px solid var(--xj-line-2, #d9d6cd);
  border-radius: var(--xj-radius-ctl, 8px);
  font-size: 16px;
  font-family: inherit;
  background: var(--xj-surface, #ffffff);
  color: var(--xj-ink, #2b3a34);
  transition: border-color var(--xj-dur-fast, 180ms), box-shadow var(--xj-dur-fast, 180ms);
  -webkit-appearance: none;
  box-sizing: border-box;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--xj-green, #0e9f6e);
  box-shadow: 0 0 0 3px var(--xj-green-mist, #e8f5ef);
}

.form-textarea { resize: vertical; min-height: 88px; line-height: 1.6; }

.form-input.error, .form-select.error, .form-textarea.error { border-color: var(--xj-ochre, #b4623f); }

.form-hint { font-size: 14px; color: var(--xj-ink-3, #8a9a93); margin-top: 4px; }

.form-error { font-size: 14px; color: var(--xj-ochre, #b4623f); margin-top: 4px; }

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238a9a93' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 38px;
}

/* =====================================================================
   5. 按钮
   ===================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 22px;
  min-height: var(--xj-tap, 44px);
  border: 1px solid transparent;
  border-radius: var(--xj-radius-ctl, 8px);
  font-size: 16px;
  font-family: inherit;
  font-weight: 600;
  line-height: 1.4;
  cursor: pointer;
  transition: transform var(--xj-dur-fast, 180ms) var(--xj-ease, cubic-bezier(.22,.61,.36,1)),
              background var(--xj-dur-fast, 180ms), opacity var(--xj-dur-fast, 180ms);
  text-decoration: none;
  -webkit-appearance: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
  box-sizing: border-box;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }

.btn-primary {
  background: var(--xj-green, #0e9f6e);
  border-color: var(--xj-green, #0e9f6e);
  color: #fff;
}
.btn-primary:hover, .btn-primary:active { background: var(--xj-green-strong, #0b6b43); border-color: var(--xj-green-strong, #0b6b43); }

.btn-secondary {
  background: var(--xj-surface-2, #f4f3ee);
  color: var(--xj-ink, #2b3a34);
  border-color: var(--xj-line, #eceae3);
}
.btn-secondary:hover, .btn-secondary:active { background: var(--xj-line, #eceae3); }

.btn-outline {
  background: var(--xj-surface, #ffffff);
  border-color: var(--xj-green, #0e9f6e);
  color: var(--xj-green-ink, #0b7a54);
}
.btn-outline:hover, .btn-outline:active { background: var(--xj-green-mist, #e8f5ef); }

/* 警示/删除：赭色（不用纯红，见令牌说明） */
.btn-danger {
  background: var(--xj-ochre, #b4623f);
  border-color: var(--xj-ochre, #b4623f);
  color: #fff;
}
.btn-danger:hover, .btn-danger:active { background: #9d5233; border-color: #9d5233; }

.btn-following {
  background: var(--xj-surface-2, #f4f3ee);
  color: var(--xj-ink-2, #5f6f69);
  border-color: var(--xj-line, #eceae3);
}
.btn-following:hover, .btn-following:active { background: var(--xj-line, #eceae3); }

.btn-block { width: 100%; }

/* 小号：字号 14px（适老化底线） */
.btn-sm {
  padding: 8px 14px;
  min-height: 36px;
  font-size: 14px;
  border-radius: var(--xj-radius-pill, 999px);
}

/* =====================================================================
   6. 提示条 / 标签 / 徽章
   ===================================================================== */
.ok-tip {
  background: var(--xj-green-mist, #e8f5ef);
  border-radius: var(--xj-radius-ctl, 8px);
  padding: 10px 12px;
  font-size: 14px;
  color: var(--xj-green-ink, #0b7a54);
  line-height: 1.6;
  display: none;
  margin-top: 8px;
}

.tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--xj-radius-pill, 999px);
  background: var(--xj-green-mist, #e8f5ef);
  color: var(--xj-green-ink, #0b7a54);
  font-size: 13px;
  line-height: 1.6;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--xj-surface-2, #f4f3ee);
  color: var(--xj-ink-2, #5f6f69);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.7;
}

/* =====================================================================
   7. Tab / 芯片
   ===================================================================== */
.tabs {
  display: flex;
  gap: 0;
  margin-bottom: 16px;
  background: var(--xj-surface, #ffffff);
  border-radius: var(--xj-radius-ctl, 8px);
  overflow: hidden;
  border: 1px solid var(--xj-line, #eceae3);
}

.tab {
  flex: 1;
  padding: 12px;
  min-height: var(--xj-tap, 44px);
  text-align: center;
  font-size: 15px;
  color: var(--xj-ink-2, #5f6f69);
  cursor: pointer;
  transition: all var(--xj-dur-fast, 180ms);
  border-bottom: 2px solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.tab.active {
  color: var(--xj-green-ink, #0b7a54);
  border-bottom-color: var(--xj-green, #0e9f6e);
  font-weight: 700;
  background: var(--xj-green-wash, #ecfdf5);
}

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }

.chip {
  padding: 7px 14px;
  min-height: 34px;
  border-radius: var(--xj-radius-pill, 999px);
  background: var(--xj-green-mist, #e8f5ef);
  color: var(--xj-green-ink, #0b7a54);
  font-size: 14px;
  font-weight: 600;
  border: 1px solid var(--xj-green-mist, #e8f5ef);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  transition: all var(--xj-dur-fast, 180ms);
}
.chip.active { background: var(--xj-green, #0e9f6e); border-color: var(--xj-green, #0e9f6e); color: #fff; }

.interest-pick { display: flex; flex-wrap: wrap; gap: 10px; margin: 10px 0; }
.interest-pick .chip { font-size: 15px; padding: 9px 16px; }

/* =====================================================================
   8. 内容列表
   ===================================================================== */
.content-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--xj-line, #eceae3);
  cursor: pointer;
  transition: background var(--xj-dur-fast, 180ms);
}
.content-item:last-child { border-bottom: none; }
.content-item:hover, .content-item:active { background: var(--xj-green-mist, #e8f5ef); }

.content-thumb {
  width: 100px;
  height: 64px;
  border-radius: var(--xj-radius-ctl, 8px);
  object-fit: cover;
  background: var(--xj-surface-2, #f4f3ee);
  flex-shrink: 0;
}

.content-info { flex: 1; min-width: 0; }

.content-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--xj-ink, #2b3a34);
}

.content-meta {
  font-size: 14px;
  color: var(--xj-ink-3, #8a9a93);
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.content-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
}

/* 徽章配色：全部降饱和，警示走赭不走红 */
.badge-video   { background: var(--xj-ochre-mist, #fdf6f3); color: var(--xj-ochre, #b4623f); }
.badge-article { background: var(--xj-green-mist, #e8f5ef); color: var(--xj-green-ink, #0b7a54); }
.badge-online  { background: var(--xj-green-mist, #e8f5ef); color: var(--xj-green-ink, #0b7a54); }
.badge-offline { background: var(--xj-surface-2, #f4f3ee); color: var(--xj-ink-3, #8a9a93); }
.badge-cat     { background: #e6f1fb; color: #0c447c; }
.badge-city    { background: var(--xj-green-wash, #ecfdf5); color: #27500a; }
.badge-featured, .badge-feat { background: var(--xj-amber-mist, #fff4d6); color: #854f0b; }

/* 患者列表 */
.patient-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--xj-line, #eceae3);
  cursor: pointer;
  transition: background var(--xj-dur-fast, 180ms);
}
.patient-item:last-child { border-bottom: none; }
.patient-item:hover, .patient-item:active { background: var(--xj-green-mist, #e8f5ef); }

.patient-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--xj-green, #0e9f6e);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 15px;
  flex-shrink: 0;
  overflow: hidden;
}
.patient-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* 通用列表行 / 墙 */
.list-item { padding: 12px 0; border-bottom: 1px solid var(--xj-line, #eceae3); }
.list-item:last-child { border-bottom: none; }

.wall-item { padding: 12px 0; border-bottom: 1px solid var(--xj-line, #eceae3); }
.wall-item:last-child { border-bottom: none; }
.wall-meta { font-size: 13px; color: var(--xj-ink-3, #8a9a93); margin-top: 4px; }
.wall-imgs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.wall-imgs img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; }

/* 通用行 item / row（多处页面在用的紧凑行） */
.row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--xj-line, #eceae3);
}
.row:last-child { border-bottom: none; }

.item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--xj-line, #eceae3);
}
.item:last-child { border-bottom: none; }
.item-t { font-size: 15px; font-weight: 600; color: var(--xj-ink, #2b3a34); }
.item-m { font-size: 13px; color: var(--xj-ink-3, #8a9a93); margin-top: 2px; }
.item-act { flex-shrink: 0; }

/* 入口格 */
.entry { display: block; padding: 14px; background: var(--xj-surface, #ffffff); border-radius: var(--xj-radius-card, 16px); box-shadow: var(--xj-shadow-2, 0 2px 10px rgba(43,58,52,.07)); text-decoration: none; color: inherit; }
.entry-title { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.entry-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.entry-inline { display: flex; align-items: center; gap: 10px; }

/* 区块标题 */
.section-title, .sec-title {
  font-weight: 700;
  font-size: 16px;
  margin: 18px 0 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--xj-ink, #2b3a34);
}

.stars { color: var(--xj-amber, #d9a441); letter-spacing: 2px; }

.pulse-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--xj-green-emerald, #10b981); margin-right: 6px; }

/* =====================================================================
   9. 消息
   ===================================================================== */
.message-list { display: flex; flex-direction: column; gap: 8px; padding: 12px 0; }

.message-bubble {
  max-width: 75%;
  padding: 10px 14px;
  border-radius: var(--xj-radius-card, 16px);
  font-size: 16px;
  line-height: 1.6;
  word-break: break-word;
}

.message-bubble.sent {
  align-self: flex-end;
  background: var(--xj-green, #0e9f6e);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.message-bubble.received {
  align-self: flex-start;
  background: var(--xj-surface, #ffffff);
  border: 1px solid var(--xj-line, #eceae3);
  border-bottom-left-radius: 4px;
}

.message-time { font-size: 13px; color: var(--xj-ink-3, #8a9a93); margin-top: 4px; }

.message-images { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin-top: 8px; }
.message-images img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; cursor: pointer; }

/* =====================================================================
   10. 个人主页
   ===================================================================== */
.profile-hero { display: flex; align-items: center; gap: 14px; padding: 18px 0; }

.profile-avatar {
  width: 64px; height: 64px; border-radius: 50%;
  background: var(--xj-green, #0e9f6e); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 700; flex-shrink: 0; overflow: hidden;
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }

.profile-name { font-size: 20px; font-weight: 700; color: var(--xj-ink, #2b3a34); }
.profile-sub { font-size: 14px; color: var(--xj-ink-2, #5f6f69); margin-top: 2px; }
.profile-stats { display: flex; gap: 18px; margin-top: 10px; font-size: 14px; color: var(--xj-ink-3, #8a9a93); flex-wrap: wrap; }
.profile-stats b { color: var(--xj-ink, #2b3a34); font-size: 16px; }

/* =====================================================================
   11. 商品 / 收益
   ===================================================================== */
.goods-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }

.goods-card {
  background: var(--xj-surface, #ffffff);
  border-radius: var(--xj-radius-card, 16px);
  overflow: hidden;
  box-shadow: var(--xj-shadow-2, 0 2px 10px rgba(43,58,52,.07));
  display: flex;
  flex-direction: column;
}
.goods-card img { width: 100%; height: 120px; object-fit: cover; background: var(--xj-surface-2, #f4f3ee); }
.goods-body { padding: 10px; flex: 1; display: flex; flex-direction: column; }
.goods-title { font-size: 15px; font-weight: 700; line-height: 1.35; color: var(--xj-ink, #2b3a34); }
.goods-price { color: var(--xj-ochre, #b4623f); font-weight: 700; font-size: 16px; margin-top: 4px; }
.goods-tag {
  display: inline-block; font-size: 13px;
  color: var(--xj-green-ink, #0b7a54); background: var(--xj-green-mist, #e8f5ef);
  padding: 2px 8px; border-radius: var(--xj-radius-pill, 999px);
  margin-top: 6px; align-self: flex-start;
}

.earn-card {
  background: linear-gradient(135deg, var(--xj-green, #0e9f6e), var(--xj-green-deep, #075c40));
  color: #fff; border-radius: var(--xj-radius-card, 16px); padding: 16px; text-align: center;
}
.earn-num { font-size: 29px; font-weight: 800; }

/* =====================================================================
   12. 统计卡片
   ===================================================================== */
.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }

.stat-card {
  background: var(--xj-surface, #ffffff);
  border-radius: var(--xj-radius-card, 16px);
  padding: 16px;
  text-align: center;
  box-shadow: var(--xj-shadow-2, 0 2px 10px rgba(43,58,52,.07));
}

.stat-value { font-size: 29px; font-weight: 700; color: var(--xj-green-ink, #0b7a54); }
.stat-label { font-size: 14px; color: var(--xj-ink-2, #5f6f69); margin-top: 4px; }

.stat { display: flex; flex-direction: column; align-items: center; gap: 2px; }

/* =====================================================================
   13. 空状态 / 加载
   ===================================================================== */
.empty-state { text-align: center; padding: 40px 20px; color: var(--xj-ink-3, #8a9a93); font-size: 15px; }
.empty-state-icon { font-size: 44px; margin-bottom: 12px; opacity: .55; line-height: 1; }
.empty { padding: 16px; text-align: center; color: var(--xj-ink-3, #8a9a93); font-size: 15px; }

.loading { display: flex; justify-content: center; padding: 20px; }

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--xj-line, #eceae3);
  border-top-color: var(--xj-green, #0e9f6e);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 2s; }
}

/* =====================================================================
   14. 模态框 / 底部抽屉
   ===================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 30, 26, .42);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.show { display: flex; }

.modal, .modal-card {
  background: var(--xj-surface, #ffffff);
  border-radius: var(--xj-radius-card, 16px);
  max-width: 500px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  padding: 20px;
  box-sizing: border-box;
  box-shadow: var(--xj-shadow-3, 0 6px 24px rgba(43,58,52,.10));
}

.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 12px; }
.modal-title { font-size: 18px; font-weight: 700; color: var(--xj-ink, #2b3a34); }

.modal-close {
  background: none; border: none; font-size: 24px; cursor: pointer;
  color: var(--xj-ink-3, #8a9a93); padding: 0; line-height: 1;
  width: 44px; height: 44px; display: flex; align-items: center; justify-content: center;
  border-radius: 50%; flex-shrink: 0;
}
.modal-close:hover, .modal-close:active { background: var(--xj-surface-2, #f4f3ee); }

/* 底部抽屉（sheet）：流式布局，不绝对定位钉底 */
.sheet-mask { position: fixed; inset: 0; background: rgba(20, 30, 26, .42); z-index: 300; display: none; }
.sheet-mask.show { display: block; }

.sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 310;
  background: var(--xj-paper, #faf8f4);
  border-radius: var(--xj-radius-card, 16px) var(--xj-radius-card, 16px) 0 0;
  padding: 16px 16px calc(24px + env(safe-area-inset-bottom, 0px));
  box-shadow: var(--xj-shadow-3, 0 6px 24px rgba(43,58,52,.10));
  max-height: 86vh;
  overflow-y: auto;
  box-sizing: border-box;
  display: none;
}
.sheet.show { display: block; }

.sheet-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; font-size: 18px; font-weight: 800; color: var(--xj-ink, #2b3a34); }
.sheet-bar { width: 44px; height: 4px; border-radius: 2px; background: var(--xj-line-2, #d9d6cd); margin: 0 auto 12px; }
.sheet-close { background: none; border: none; font-size: 22px; color: var(--xj-ink-3, #8a9a93); cursor: pointer; width: 44px; height: 44px; border-radius: 50%; }

/* =====================================================================
   15. 表格
   ===================================================================== */
.data-table { border-collapse: collapse; width: 100%; font-size: 15px; }
.data-table th, .data-table td { text-align: left; padding: 10px; border-bottom: 1px solid var(--xj-line, #eceae3); white-space: nowrap; }
.data-table th { color: var(--xj-ink-2, #5f6f69); font-weight: 700; background: var(--xj-surface-2, #f4f3ee); }
.data-table tbody tr:hover { background: var(--xj-green-wash, #ecfdf5); }

/* =====================================================================
   16. 视频
   ===================================================================== */
.lazy-video {
  position: relative; width: 100%; aspect-ratio: 16/9;
  background: #000; border-radius: var(--xj-radius-ctl, 8px);
  overflow: hidden; cursor: pointer;
}
.video-cover-img { width: 100%; height: 100%; object-fit: cover; opacity: .85; }
.video-cover-placeholder {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 17px;
  background: linear-gradient(135deg, var(--xj-green-deep, #075c40), var(--xj-green, #0e9f6e));
}
.video-play-btn {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 60px; height: 60px; border-radius: 50%;
  background: rgba(255,255,255,.92);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; color: var(--xj-green-ink, #0b7a54);
  transition: all var(--xj-dur-base, 300ms) var(--xj-ease, cubic-bezier(.22,.61,.36,1));
}
.lazy-video:hover .video-play-btn, .lazy-video:active .video-play-btn {
  background: #fff; transform: translate(-50%, -50%) scale(1.08);
}
.video-iframe, .video-embed { width: 100%; aspect-ratio: 16/9; border: none; border-radius: var(--xj-radius-ctl, 8px); }
.video-fallback { width: 100%; aspect-ratio: 16/9; display: flex; align-items: center; justify-content: center; background: var(--xj-surface-2, #f4f3ee); color: var(--xj-ink-3, #8a9a93); border-radius: var(--xj-radius-ctl, 8px); font-size: 15px; }

/* =====================================================================
   17. 二维码
   ===================================================================== */
.qrcode-container { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 20px; }
#qrcode canvas, #qrcode img { border-radius: var(--xj-radius-ctl, 8px); max-width: 100%; }
.qrcode-url {
  font-size: 14px; color: var(--xj-ink-3, #8a9a93);
  word-break: break-all; text-align: center;
  padding: 8px 12px; background: var(--xj-surface-2, #f4f3ee);
  border-radius: var(--xj-radius-ctl, 8px); width: 100%; box-sizing: border-box;
}

/* =====================================================================
   18. 页脚 / 免责 / Toast
   ===================================================================== */
.site-footer {
  background: var(--xj-surface, #ffffff);
  border-top: 1px solid var(--xj-line, #eceae3);
  padding: 16px;
  text-align: center;
  margin-top: auto;
}

/* 免责声明：14px（适老化底线）。健康/科普内容强制附带，不得隐藏。 */
.disclaimer {
  font-size: 14px;
  color: var(--xj-ink-3, #8a9a93);
  line-height: 1.7;
  max-width: var(--max-width);
  margin: 0 auto;
}
.disclaimer a { color: var(--xj-ink-2, #5f6f69); }

.toast {
  position: fixed; bottom: 80px; left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: rgba(20, 30, 26, .88); color: #fff;
  padding: 10px 20px; border-radius: var(--xj-radius-pill, 999px);
  font-size: 15px; z-index: 9999; opacity: 0;
  transition: all var(--xj-dur-base, 300ms) var(--xj-ease, cubic-bezier(.22,.61,.36,1));
  pointer-events: none; max-width: 90%; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* =====================================================================
   19. 角色选择卡片
   ===================================================================== */
.role-select { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }

.role-card {
  border: 2px solid var(--xj-line, #eceae3);
  border-radius: var(--xj-radius-card, 16px);
  padding: 20px 12px;
  text-align: center;
  cursor: pointer;
  transition: all var(--xj-dur-fast, 180ms);
  background: var(--xj-surface, #ffffff);
}
.role-card.active { border-color: var(--xj-green, #0e9f6e); background: var(--xj-green-wash, #ecfdf5); }

.role-card-icon { font-size: 32px; margin-bottom: 8px; line-height: 1; }
.role-card-title { font-size: 16px; font-weight: 700; margin-bottom: 4px; color: var(--xj-ink, #2b3a34); }
.role-card-desc { font-size: 14px; color: var(--xj-ink-3, #8a9a93); }

/* =====================================================================
   20. 提示文字工具类
   ===================================================================== */
.muted { color: var(--xj-ink-3, #8a9a93); }
.hint { font-size: 14px; color: var(--xj-ink-3, #8a9a93); line-height: 1.7; }
.msg { padding: 12px; text-align: center; color: var(--xj-ink-3, #8a9a93); font-size: 15px; }
.hl { color: var(--xj-green-ink, #0b7a54); font-weight: 700; }
.back {
  display: inline-flex; align-items: center; gap: 4px;
  min-height: 44px; padding: 6px 10px; font-size: 15px;
  color: var(--xj-green-ink, #0b7a54); text-decoration: none; cursor: pointer;
}
.grid { display: grid; gap: 12px; }
.consent { font-size: 14px; color: var(--xj-ink-2, #5f6f69); line-height: 1.7; }
.nudge { font-size: 14px; color: var(--xj-ochre, #b4623f); background: var(--xj-ochre-mist, #fdf6f3); padding: 10px 12px; border-radius: var(--xj-radius-ctl, 8px); }

/* =====================================================================
   21. 响应式
   ===================================================================== */
@media (max-width: 380px) {
  .role-select { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr; }
  .content-thumb { width: 80px; height: 52px; }
  .main-content { padding: 12px; }
}

@media (min-width: 768px) {
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
  .modal { max-width: 560px; }
}

/* 全局防横向溢出（严格落地规范） */
html, body { max-width: 100%; overflow-x: hidden; }
img, video, iframe { max-width: 100%; height: auto; }

/* 顶部语言切换控件：移动端始终展示，不被挤压隐藏 */
.site-header .lang-switch { flex-shrink: 0; }

/* ===== 横屏适配（手机横置，无横向滚动条） ===== */
@media (orientation: landscape) {
  .main-content { padding: 12px 16px; max-width: 100%; }
  .site-header { height: 50px; }
  .card { padding: 12px; margin-bottom: 10px; }
  .role-select { grid-template-columns: repeat(4, 1fr); }
  .role-card { padding: 12px 8px; }
  .role-card-icon { font-size: 24px; margin-bottom: 4px; }
  .stats-grid { grid-template-columns: repeat(4, 1fr); }
  .form-group { margin-bottom: 10px; }
  .form-input, .form-select, .form-textarea { padding: 9px 12px; }
  .btn { padding: 9px 20px; min-height: 40px; }
  .content-thumb { width: 72px; height: 46px; }
  .modal { max-height: 90vh; }
  .tabs .tab { padding: 9px; }
}

@media (orientation: landscape) and (max-height: 480px) {
  .role-select { grid-template-columns: repeat(4, 1fr); }
  .site-footer { padding: 8px 16px; }
  .disclaimer { font-size: 13px; }
}

/* =====================================================================
   22. 全局护栏 · 防折行（原样保留，勿动）
   ---------------------------------------------------------------------
   症状：顶部栏单行标签（如「⚠️ AI科普·非诊疗建议」）在窄屏 /
        飞书等 WebView 里被挤成两行，破坏排版。
   原则：所有 .topbar 都是"单行栏"，其内任何子元素都不允许换行；
        空间不足时以省略号收尾，而不是折行。
   作用域：仅 .topbar 内部，不波及正文 / .disclaimer 多行块。
   ===================================================================== */
.topbar { flex-wrap: nowrap; }
.topbar * { white-space: nowrap; }
.topbar-disc { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.topbar > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.single-line { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
