/* ============================================================
   思明堂互联网医院（演示） · H5 基础样式
   - 主题色板（2026-11-21 蓝白 Clean Medical UI 改版，用户钦定令牌）：
     主色/主按钮/导航选中 #287BF5（深按态 #1E63D0）/ 强调橙 #FF8C1F；
     页面底色 #F5F9FF（区块间隔 #EAF4FF）；卡片 #FFFFFF；
     标题字 #1A2B45 / 正文 #475569 / 辅助 #64748B、#94A3B8；
     辅助图标色：青绿 #34C3A6 / 紫 #8B7BF5 / 天蓝 #38BDF8。
   - 运行时 /api/site 返回的 theme 不再覆盖主色系（UI.applyTheme
     已改为蓝白令牌锁定模式，见 js/ui.js 变更记录）
   - 兼容目标：iOS Safari（WKWebView）与微信内置浏览器（X5/XWeb）
     不使用 gap 布局关键路径、不用 aspect-ratio/clamp，375px 优先
   ============================================================ */
:root {
  --primary: #287BF5;
  --primary-dark: #1E63D0;
  --primary-weak: #E8F1FF;
  --secondary: #1E63D0;
  --secondary-deep: #1546A0;
  --accent: #FF8C1F;
  --accent-weak: #FFF4E8;
  --aux-teal: #34C3A6;
  --aux-purple: #8B7BF5;
  --aux-sky: #38BDF8;
  --success: #2BA245;
  --success-weak: #E8F6EC;
  --danger: #E02020;
  --danger-weak: #FDECEC;
  --text: #1A2B45;
  --sub-text: #475569;
  --light-text: #64748B;
  --faint-text: #94A3B8;
  --bg: #F5F9FF;
  --bg-soft: #EAF4FF;
  --card: #FFFFFF;
  --line: #E6EEF8;
  /* 圆角三档（2026-11-21 第三阶段归一审计）：小件 12 / 卡片 16 / 大块 20 */
  --radius-s: 12px;
  --radius: 16px;
  --radius-l: 20px;
  --shadow: 0 6px 18px rgba(40, 123, 245, 0.08);
  /* iPhone 刘海屏底部安全区（不支持 env 的浏览器回退为 0） */
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ---------- Reset ---------- */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg-soft);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, p, ul, ol, figure { margin: 0; padding: 0; }
ul, ol { list-style: none; }
a { color: inherit; text-decoration: none; -webkit-touch-callout: none; }
button, input, select, textarea {
  font: inherit;
  color: inherit;
  border: 0;
  outline: none;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
}
button { cursor: pointer; }
img, svg { display: block; max-width: 100%; }

/* ---------- 应用壳层：375px 设计、桌面居中展示 ---------- */
.app-shell {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  position: relative;
  box-shadow: 0 0 24px rgba(30, 99, 208, 0.10);
}
.page-view { min-height: 100vh; }
/* 底部导航 / 底部 CTA 存在时预留空间（避免内容被遮挡） */
.page-view.has-tabbar { padding-bottom: calc(62px + var(--safe-bottom)); }
.page-view.has-cta { padding-bottom: calc(88px + var(--safe-bottom)); }
.page-inner { animation: pageIn 0.22s ease both; }
@keyframes pageIn { from { opacity: 0; } to { opacity: 1; } }

/* 尊重系统的减少动态效果偏好，避免页面切换和骨架闪动造成不适。 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------- 顶部导航栏（2026-11-21 蓝白改版：白底蓝字 + 发丝分隔线） ---------- */
.appbar {
  position: sticky;
  top: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  height: 44px;
  /* 刘海屏/全屏场景（env>0）：高度 = 内容 44px + 顶部安全区，避免 border-box 下内容盒被压扁 */
  height: calc(44px + env(safe-area-inset-top, 0px));
  padding: 0 12px;
  padding-top: env(safe-area-inset-top, 0px);
  background: #FFFFFF;
  border-bottom: 1px solid var(--line);
  color: var(--text);
}
.appbar-back {
  width: 30px;
  height: 30px;
  margin-left: -6px;
  margin-right: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--text);
  border-radius: 50%;
  flex: 0 0 auto;
}
.appbar-back:active { background: rgba(40, 123, 245, 0.10); color: var(--primary); }
.appbar-title {
  flex: 1;
  font-size: 16px;
  font-weight: 600;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.appbar-side { flex: 0 0 auto; font-size: 12px; color: var(--faint-text); }

/* ---------- 「演示项目」标识与提示条 ---------- */
.demo-pill {
  display: inline-block;
  padding: 2px 8px;
  font-size: 10px;
  line-height: 1.6;
  font-weight: 700;
  color: #FFFFFF;
  background: var(--accent);
  border-radius: 999px;
  white-space: nowrap;
}
.notice-bar {
  display: flex;
  align-items: center;
  margin: 12px 12px 0;
  padding: 8px 12px;
  font-size: 12px;
  color: #35548F;
  background: #EDF5FF;
  border: 1px solid #C9DFFF;
  border-radius: 12px;
}
.notice-bar .notice-ico { margin-right: 6px; font-size: 14px; flex: 0 0 auto; }
.notice-bar .notice-txt { flex: 1; }
.notice-bar:active { background: #E2EEFF; }
/* 弱化版提示条（首页内容来源说明：浅灰细边，不抢首屏视觉） */
.notice-bar-quiet {
  color: var(--light-text);
  background: #F1F6FE;
  border: 1px solid #DFEAF8;
  font-size: 11px;
}
.notice-bar-quiet:active { background: #E6F0FF; }

/* ---------- 灯箱查看器（证书/院内环境图片点击放大） ----------
   定位用 left/top/right/bottom 长手（评审修复：inset 简写需 Chromium 87+/Safari 14.1+，
   旧微信 X5 不支持会使灯箱错位，与本项目「不用新简写」兼容约定一致） */
.lightbox {
  position: fixed;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(4, 16, 26, 0.94);
  touch-action: none;
}
.lightbox-img {
  max-width: 96%;
  max-height: 82%;
  transition: transform 0.12s ease-out;
  will-change: transform;
  background: transparent;
}
.lightbox-cap {
  position: absolute;
  bottom: 26px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 13px;
  color: #DDE7EC;
  padding: 0 18px;
  line-height: 1.5;
}
.lightbox-close {
  position: absolute;
  top: calc(10px + env(safe-area-inset-top, 0px));
  right: 14px;
  width: 34px;
  height: 34px;
  line-height: 32px;
  text-align: center;
  font-size: 18px;
  color: #FFFFFF;
  background: rgba(255, 255, 255, 0.16);
  border-radius: 50%;
}

/* ---------- 通用卡片 / 区块 ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.section { margin: 16px 12px 0; }
.section-head {
  display: flex;
  align-items: baseline;
  margin-bottom: 10px;
}
.section-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}
.section-more { margin-left: auto; font-size: 12px; font-weight: 600; color: var(--primary); }
.section-more:active { color: var(--primary-dark); }

/* ---------- 渐变色块 + emoji 图片占位（任务硬约束：不留死链） ---------- */
.ph {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ph-emoji { font-size: 34px; line-height: 1; }
.ph-label {
  position: absolute;
  left: 10px;
  bottom: 8px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.92);
}
.ph-avatar { border-radius: 50%; }
/* 命中内置真实图片（js/ui.js REAL_IMG）时 <img> 铺满占位容器（渐变为加载底色） */
.ph-real img {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ---------- 圆角标签 / 筛选 chip ---------- */
.tag {
  display: inline-block;
  padding: 1px 8px;
  font-size: 11px;
  color: var(--primary);
  background: var(--primary-weak);
  border-radius: 4px;
  white-space: nowrap;
}
.tag-grey { color: var(--sub-text); background: #F1F5FB; }
.tag-green { color: var(--success); background: var(--success-weak); }
.chips-row {
  display: flex;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.chips-row::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  padding: 6px 14px;
  margin-right: 8px;
  font-size: 13px;
  color: var(--sub-text);
  background: #F1F5FB;
  border: 1px solid transparent;
  border-radius: 999px;
  white-space: nowrap;
}
.chip.active {
  color: var(--primary);
  font-weight: 600;
  background: var(--primary-weak);
  border-color: var(--primary);
}
.chip:active { opacity: 0.85; }

/* ---------- 按钮（胶囊形；主按钮实心 #287BF5，深按态 #1E63D0） ---------- */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  padding: 0 18px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 999px;
  transition: opacity 0.15s;
}
.btn:disabled { opacity: 0.55; }
.btn-primary { color: #FFFFFF; background: var(--primary); box-shadow: 0 6px 14px rgba(40, 123, 245, 0.22); }
.btn-primary:active { background: var(--primary-dark); }
.btn-ghost { color: var(--primary); background: #FFFFFF; border: 1px solid var(--primary); }
.btn-block { width: 100%; }
.btn-loading { position: relative; color: rgba(255, 255, 255, 0.85) !important; }

/* ---------- 表单 ---------- */
.field { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.field:last-child { border-bottom: 0; }
.field-label { font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.field-req { color: var(--danger); margin-left: 2px; }
.field-opt { font-size: 11px; color: var(--light-text); font-weight: 400; margin-left: 6px; }
.field-input {
  display: block;
  width: 100%;
  height: 40px;
  padding: 0 12px;
  font-size: 16px; /* ≥16px 避免 iOS Safari 聚焦自动放大 */
  color: var(--text);
  background: #F7F8FA;
  border: 1px solid transparent;
  border-radius: var(--radius-s);
}
.field-input::placeholder { color: var(--faint-text); }
.field-input:focus { background: #FFFFFF; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(40, 123, 245, 0.12); }
.field-input.is-error { border-color: var(--danger); background: var(--danger-weak); }
textarea.field-input {
  height: auto;
  min-height: 76px;
  padding: 10px 12px;
  line-height: 1.5;
  resize: none;
}
select.field-input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2394A3B8' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 30px;
}
select.field-input:disabled { color: var(--faint-text); }
.field-msg { display: none; margin-top: 6px; font-size: 12px; color: var(--danger); }
.field-msg.show { display: block; }
.field-counter { margin-top: 4px; font-size: 11px; color: var(--light-text); text-align: right; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  z-index: 1000;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  max-width: 78%;
  padding: 10px 16px;
  font-size: 14px;
  line-height: 1.5;
  color: #FFFFFF;
  background: rgba(17, 17, 17, 0.82);
  border-radius: 10px;
  text-align: center;
  word-break: break-all;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s;
}
.toast.show { opacity: 1; visibility: visible; }

/* ---------- 底部弹层（免责声明等） ---------- */
.sheet-overlay {
  position: fixed;
  z-index: 1001;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.22s;
}
.sheet-overlay.open { opacity: 1; visibility: visible; }
.sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-width: 480px;
  margin: 0 auto;
  max-height: 72vh;
  display: flex;
  flex-direction: column;
  background: var(--card);
  border-radius: 16px 16px 0 0;
  padding-bottom: var(--safe-bottom);
  transform: translateY(100%);
  transition: transform 0.25s ease;
}
.sheet-overlay.open .sheet { transform: translateY(0); }
.sheet-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--line);
}
.sheet-title { flex: 1; font-size: 16px; font-weight: 700; }
.sheet-close {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--light-text);
  border-radius: 50%;
  background: #F2F3F5;
}
.sheet-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 14px 16px 20px;
  font-size: 14px;
  color: var(--sub-text);
  line-height: 1.7;
}
.sheet-body p { margin-bottom: 10px; }
.sheet-body p:last-child { margin-bottom: 0; }

/* ---------- 底部导航栏（2026-11-21 蓝白改版：白底 + 顶部发丝线 + 手绘 SVG 线性图标） ---------- */
.tabbar {
  position: fixed;
  z-index: 100;
  left: 0;
  right: 0;
  bottom: 0;
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  background: #FFFFFF;
  border-top: 1px solid var(--line);
  padding: 6px 0 calc(6px + var(--safe-bottom));
}
.tab-item {
  flex: 1;
  display: block;
  text-align: center;
  color: var(--faint-text);
}
.tab-ico { display: flex; align-items: center; justify-content: center; height: 24px; line-height: 1.25; }
.tab-ico svg { width: 24px; height: 24px; }
.tab-label { display: block; font-size: 10px; line-height: 1.3; margin-top: 1px; }
.tab-item.active { color: var(--primary); font-weight: 600; }
.tab-item:active { opacity: 0.75; }

/* ---------- 骨架屏 ---------- */
.sk {
  position: relative;
  overflow: hidden;
  background: #E7EEF7;
  border-radius: 8px;
}
.sk::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(100deg, rgba(255,255,255,0) 30%, rgba(255,255,255,0.75) 50%, rgba(255,255,255,0) 70%);
  animation: skShine 1.2s infinite;
}
@keyframes skShine { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

/* ---------- 空态 / 错误态 ---------- */
.empty-state {
  padding: 52px 24px;
  text-align: center;
  color: var(--light-text);
}
.empty-ico { font-size: 44px; line-height: 1; margin-bottom: 12px; }
.empty-msg { font-size: 14px; margin-bottom: 6px; }
.empty-sub { font-size: 12px; margin-bottom: 18px; }
.empty-actions { display: flex; justify-content: center; }
.empty-actions .btn { height: 38px; font-size: 14px; padding: 0 22px; margin: 0 6px; }

/* ---------- 页脚（全站固定：演示声明 + 免责声明入口，架构 §9.1；2026-11-21 蓝系微调） ---------- */
.footer {
  margin-top: 20px;
  padding: 18px 16px 22px;
  background: #EFF5FF;
  color: var(--light-text);
  font-size: 11px;
  line-height: 1.8;
  text-align: center;
}
.footer-hotline { font-size: 12px; color: var(--sub-text); margin-bottom: 8px; }
.footer-hotline a { color: var(--primary); font-weight: 600; }
.footer-links { margin-bottom: 8px; }
.footer-links a { margin: 0 8px; color: var(--sub-text); }
.footer-links a:active { color: var(--primary); }
.footer-note { text-align: justify; text-align-last: center; }
.footer-offline { margin-top: 6px; color: #B98900; }
.footer-divider { margin: 8px auto; width: 40%; height: 1px; background: var(--line); }

/* ---------- 工具类 ---------- */
.clamp-1 {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.hscroll {
  display: flex;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.hscroll::-webkit-scrollbar { display: none; }
