/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2c5f2d;
    --primary-light: #4a8c4e;
    --primary-dark: #1a3f1b;
    /* 派生色 — 由 brand.js 动态计算并覆盖（品牌切换时自动更新） */
    --primary-focus-shadow: rgba(44, 95, 45, 0.10);
    --primary-bg-light: #f0f7f0;
    --secondary-color: #8b4513;
    --accent-color: #d4a574;
    /* [v1.15] Apple 风格视觉语言：近黑白灰克制配色 + 单一品牌强调色，取代此前偏暖的米色系统 */
    --bg-color: #f5f5f7;
    --card-bg: #ffffff;
    --text-primary: #1d1d1f;
    --text-secondary: #6e6e73;
    --border-color: #d2d2d7;
    --success-color: #52c41a;
    --warning-color: #faad14;
    --error-color: #dc2626;
    /* Apple 极少用重阴影，靠发丝边+极轻投影表达层次 */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.10);
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 20px;
    /* Apple 标志性缓动曲线，替代通用 ease，用于按钮/卡片过渡 */
    --ease-apple: cubic-bezier(0.28, 0.11, 0.32, 1);
    /* [v1.15] 表单填充底色 token（替代此前散落的硬编码 #fafafa/white，深色模式才不会露白） */
    --fill-subtle: #f5f5f7;
    --fill-input: #f5f5f7;
    --fill-input-focus: #ffffff;
}

/* [v1.13] 深色/护眼模式 — 覆盖 token 而非逐条规则改写，全站基于 CSS 变量故大部分组件自动适配 */
:root[data-theme="dark"] {
    --primary-color: #4a8c4e;
    --primary-light: #6bb06f;
    --primary-dark: #2c5f2d;
    --primary-focus-shadow: rgba(74, 140, 78, 0.18);
    --primary-bg-light: #1e2b1f;
    --bg-color: #16181a;
    --card-bg: #202323;
    --text-primary: #e8e6e0;
    --text-secondary: #a3a39c;
    --border-color: #3a3d3a;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
    /* [v1.15] 深色模式下的填充底色（比卡片略深，聚焦时略亮，营造凹陷输入感） */
    --fill-subtle: #1a1c1d;
    --fill-input: #17191a;
    --fill-input-focus: #26292a;
}
:root[data-theme="dark"] body {
    background: radial-gradient(ellipse 900px 500px at 50% -5%, rgba(74, 140, 78, 0.08), transparent 60%), var(--bg-color);
}

/* [v1.15] 浅色毛玻璃导航栏配深色图标，深色模式下另行反转 */
.theme-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.045);
    color: var(--text-primary);
    cursor: pointer;
    transition: background var(--ease-apple) 0.15s;
}
.theme-toggle-btn:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}
.theme-toggle-btn:hover { background: rgba(0, 0, 0, 0.08); }
:root[data-theme="dark"] .theme-toggle-btn { background: rgba(255, 255, 255, 0.1); color: var(--text-primary); }
:root[data-theme="dark"] .theme-toggle-btn:hover { background: rgba(255, 255, 255, 0.18); }
.theme-toggle-btn .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle-btn .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle-btn .icon-moon { display: block; }

body {
    font-family: 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    /* [v1.15] Apple 标志性的抗锯齿字体渲染，让文字更清透（尤其大字号标题） */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    /* [v1.13] 层次感底色：径向柔光 + 极浅纸纹，替代纯色平铺 */
    background:
        radial-gradient(ellipse 900px 500px at 50% -5%, rgba(44, 95, 45, 0.05), transparent 60%),
        var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    /* [v1.8.5] dvh 优先：动态视口适配 iOS Safari/Android Chrome URL 栏伸缩 */
    min-height: 100vh;
    min-height: 100dvh;
    /* [v1.10.27] mobile-polish.js 提供 --app-h（visualViewport 真实可视高度） */
    min-height: var(--app-h, 100dvh);
    display: flex;
    flex-direction: column;
    /* 防 iOS Safari 整页橡皮筋外露白色背景 */
    overscroll-behavior-y: contain;
}

/* [v1.10.27] 软键盘弹起时（Android），底部 padding 等于键盘高度，防按钮被遮 */
.kb-open .form-section,
.kb-open .input-section,
.kb-open .main-content {
    padding-bottom: calc(var(--kb-h, 0px) + 1rem);
}
/* 键盘弹起时隐藏底部 sticky 元素（按钮通常会自动 scrollIntoView 到可见区） */
.kb-open .nav-bottom,
.kb-open .footer { display: none; }

/* [v1.15] Apple 风格滚动淡入：区块首次进入视口时轻微上浮显现，尊重 prefers-reduced-motion（下方全局规则会清零 transition-duration） */
.reveal-on-scroll {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s var(--ease-apple), transform 0.6s var(--ease-apple);
}
.reveal-on-scroll.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* [v1.10.27] 尊重用户的减弱动画偏好 + .reduced-motion class（由 JS 注入） */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
html.reduced-motion *, html.reduced-motion *::before, html.reduced-motion *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
}

/* 导航栏 — [v1.15] Apple 风格毛玻璃悬浮条，替代此前实心渐变色块 */
.navbar {
    background: rgba(255, 255, 255, 0.78);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    color: var(--text-primary);
    padding: 1.1rem 0;
    /* [v1.8.5] 顶部安全区：iPhone 全面屏刘海/灵动岛不再压住 logo */
    padding-top: max(1.1rem, calc(0.6rem + env(safe-area-inset-top, 0px)));
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06);
    position: sticky;
    top: 0;
    z-index: 100;
}
:root[data-theme="dark"] .navbar {
    background: rgba(22, 24, 26, 0.72);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.08);
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo {
    display: inline-flex;
    align-items: center;
    color: var(--primary-color);
}

.navbar h1 {
    font-family: 'Songti SC', 'STSong', 'SimSun', 'Noto Serif SC', 'Hiragino Mincho ProN', serif;
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--text-primary);
}

.nav-info {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

/* [v1.15] Apple 风格：浅底深字，去掉此前深色导航栏上的白字描边处理 */
.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.4rem 0.8rem;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font-size: 0.85rem;
    transition: background var(--ease-apple) 0.2s, color var(--ease-apple) 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    /* 44px 最小触控目标：align-self:stretch 让链接撑满 navbar 全高 */
    align-self: stretch;
}

.nav-link:hover {
    background: rgba(0, 0, 0, 0.045);
    color: var(--primary-color);
}
:root[data-theme="dark"] .nav-link:hover {
    background: rgba(255, 255, 255, 0.08);
}

.github-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.15);
    /* [v1.10.38] -webkit- 前缀 */
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.github-link:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.github-link svg {
    width: 20px;
    height: 20px;
}

/* [v1.15] 浅色毛玻璃导航栏改为深色系半透明底，维持可读对比度 */
.status-badge {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.status-badge.healthy {
    background: rgba(82, 196, 26, 0.14);
    color: #2f7d0f;
}

.status-badge.warn {
    background: rgba(250, 173, 20, 0.18);
    color: #92620a;
}

.status-badge.error {
    background: rgba(245, 34, 45, 0.14);
    color: #b0202a;
}
:root[data-theme="dark"] .status-badge { background: rgba(255, 255, 255, 0.1); color: var(--text-secondary); }

/* 表单校验错误提示 */
.field-error {
    color: var(--error-color);
    font-size: 0.82rem;
    margin-top: 0.25rem;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* 容器 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* 主内容区 */
.main-content {
    flex: 1;
    padding: 3rem 0;
}

/* AI 体质评估入口横幅 — [v1.15] Apple 风格：单一实色替代三段渐变，色彩本身不再靠渐变堆叠层次 */
.ai-diagnosis-banner {
    display: block;
    /* [v1.10.52] 使用 CSS 变量 — 品牌主色自动适配（真爱金/书院棕/默认绿） */
    background: var(--primary-color);
    border-radius: var(--radius-lg);
    padding: 1.75rem 2.25rem;
    margin-bottom: 1.5rem;
    text-decoration: none;
    color: #fff;
    /* Apple 极轻投影，不再靠多层堆叠制造"厚度" */
    box-shadow: var(--shadow-md);
    transition: transform var(--ease-apple) 0.3s, box-shadow var(--ease-apple) 0.3s;
    position: relative;
    overflow: hidden;
}

.ai-diagnosis-banner::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 300px;
    height: 300px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 50%;
}

.ai-diagnosis-banner:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.ai-diagnosis-banner:focus-visible {
    outline: 3px solid rgba(255, 255, 255, 0.9);
    outline-offset: 3px;
}

.banner-content {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    position: relative;
    z-index: 1;
}

.banner-icon {
    flex-shrink: 0;
    width: 64px;
    height: 64px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    color: #fff;
}

.banner-text {
    flex: 1;
}

.banner-text h2 {
    font-family: 'Songti SC', 'STSong', 'SimSun', 'Noto Serif SC', 'Hiragino Mincho ProN', serif;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.3rem;
    color: #fff;
}

.banner-text p {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.5;
}

.banner-arrow {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    opacity: 0.7;
    color: #fff;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.ai-diagnosis-banner:hover .banner-arrow {
    opacity: 1;
    transform: translateX(5px);
}

@media (max-width: 768px) {
    .ai-diagnosis-banner {
        padding: 1.25rem;
    }
    .banner-icon {
        font-size: 2rem;
        width: 48px;
        height: 48px;
        border-radius: 12px;
    }
    .banner-text h2 {
        font-size: 1.2rem;
    }
    .banner-text p {
        font-size: 0.85rem;
    }
    .banner-arrow {
        font-size: 1.5rem;
    }
}

/* [v1.12] 体质自测入口横幅 — 次级样式，避免与 AI 诊断主横幅争夺视觉焦点 */
.constitution-entry-wrap {
    margin-bottom: 2.5rem;
}

.constitution-banner {
    display: block;
    width: 100%;
    text-align: left;
    background: var(--card-bg);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.75rem;
    cursor: pointer;
    /* [v1.13] 静止态也带一点柔光，避免与升级后的主横幅相比显得单薄 */
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset, 0 2px 10px rgba(0, 0, 0, 0.04);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    font-family: inherit;
}

.constitution-banner:hover {
    transform: translateY(-2px);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset, var(--shadow-md);
    border-color: var(--accent-color);
}

.constitution-banner:focus-visible {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}

.constitution-banner .banner-content {
    gap: 1.25rem;
}

.constitution-banner .banner-icon {
    width: 52px;
    height: 52px;
    /* [v1.13] 金色调而非主色，与主横幅拉开层级，强化"次级但精致"的定位 */
    background: linear-gradient(135deg, rgba(212, 165, 116, 0.16), rgba(212, 165, 116, 0.06));
    color: var(--secondary-color);
    backdrop-filter: none;
}

.constitution-banner .banner-text h2 {
    font-size: 1.15rem;
    color: var(--text-primary);
}

.constitution-banner .banner-text p {
    color: var(--text-secondary);
    font-size: 0.88rem;
}

.constitution-banner .banner-arrow {
    color: var(--primary-color);
}

.constitution-result-summary {
    margin-top: 0.6rem;
    padding: 0.75rem 1.1rem;
    background: var(--primary-bg-light);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    color: var(--text-primary);
    line-height: 1.6;
}

/* [v1.12] 今日节气提示条 */
.seasonal-tip {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
    padding: 0.7rem 1.1rem;
    margin-bottom: 2.5rem;
    background: #fff8ee;
    border: 1px solid rgba(212, 165, 116, 0.35);
    border-left: 3px solid var(--accent-color);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    color: var(--text-primary);
    line-height: 1.6;
}

.seasonal-tip .seasonal-tip-term {
    font-weight: 600;
    color: var(--secondary-color);
    flex-shrink: 0;
}

/* [v1.15] 深色模式：奶油底会露白块，改为深色暖调半透明底 */
:root[data-theme="dark"] .seasonal-tip {
    background: rgba(212, 165, 116, 0.10);
    border-color: rgba(212, 165, 116, 0.28);
}
:root[data-theme="dark"] .seasonal-tip .seasonal-tip-term {
    color: var(--accent-color);
}

/* 章节样式 */
section {
    margin-bottom: 3rem;
}

.section-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

/* [v1.15] Apple 风格标题：更大字号 + 收紧字距（负 tracking）+ 近黑而非品牌色（色彩留给按钮/强调点） */
.section-header h2 {
    font-family: 'Songti SC', 'STSong', 'SimSun', 'Noto Serif SC', 'Hiragino Mincho ProN', serif;
    font-size: 2.25rem;
    font-weight: 600;
    letter-spacing: -0.015em;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    position: relative;
}

/* [v1.13] 金色点缀线 — 呼应中医底蕴的高级感标记，非纯功能性色块 */
.section-header h2::after {
    content: '';
    display: block;
    width: 44px;
    height: 3px;
    margin: 0.6rem auto 0;
    background: linear-gradient(90deg, transparent, var(--accent-color), transparent);
    border-radius: 2px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
    letter-spacing: 0.02em;
}

/* [v1.13] 语音输入按钮（主述框） */
.voice-input-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    min-height: 44px;
    padding: 0.35rem 0.8rem;
    margin-bottom: 0.5rem;
    border: 1.5px solid var(--border-color);
    border-radius: 999px;
    /* [v1.16] 用 token 替代硬编码 #fff，深色模式不再露白 */
    background: var(--fill-input);
    color: var(--text-secondary);
    font-size: 0.82rem;
    cursor: pointer;
    transition: background var(--ease-apple) 0.15s, border-color var(--ease-apple) 0.15s, color var(--ease-apple) 0.15s;
}

.voice-input-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.voice-input-btn[aria-pressed="true"] {
    background: var(--error-color);
    border-color: var(--error-color);
    color: #fff;
    animation: voice-pulse 1.4s ease-in-out infinite;
}

@keyframes voice-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.35); }
    50% { box-shadow: 0 0 0 6px rgba(220, 38, 38, 0); }
}

/* [v1.14] 五行情志调理入口 */
.wuxing-entry-wrap {
    margin-bottom: 2.5rem;
}

.wuxing-heading {
    font-family: 'Songti SC', 'STSong', 'SimSun', 'Noto Serif SC', 'Hiragino Mincho ProN', serif;
    font-size: 1.15rem;
    color: var(--primary-color);
    margin-bottom: 0.3rem;
}

.wuxing-subtitle {
    color: var(--text-secondary);
    font-size: 0.88rem;
    margin-bottom: 0.9rem;
}

/* [v1.13] 隐私信任标识 — 顾客交出面部照片/症状等敏感信息前的信任提示 */
.privacy-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.75rem;
    padding: 0.3rem 0.75rem;
    background: var(--primary-bg-light);
    color: var(--primary-color);
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 500;
}
/* [v1.13] 深色模式下 --primary-color 对小号文字在浅底色药丸上对比度不足(实测约3.5:1)，单独提亮到 6.7:1 */
:root[data-theme="dark"] .privacy-badge {
    color: #7fc384;
}

/* 表单样式 */
/* [v1.15] Apple 风格卡片：发丝边 + 极轻投影，去掉此前的多层堆叠阴影 */
.patient-form {
    background: var(--card-bg);
    padding: 2.75rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.form-group {
    margin-bottom: 2rem;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    font-size: 1rem;
}

.label-icon {
    font-size: 1.3rem;
}

/* [v1.15] Apple 风格输入框：细边(1px)+柔和填充底，聚焦时底色提亮+2.5px 品牌色焦点环，去掉 transition:all 性能反模式 */
.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.9rem 1.2rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    /* [v1.8.5] 显式 16px：低于 16px iOS Safari 会自动放大整页让人眩晕 */
    font-size: 16px;
    line-height: 1.5;
    font-family: inherit;
    color: var(--text-primary);
    transition: border-color var(--ease-apple) 0.2s, background var(--ease-apple) 0.2s, box-shadow var(--ease-apple) 0.2s;
    background: var(--fill-input);
    /* iOS select / textarea 默认外观去除，统一风格 */
    -webkit-appearance: none;
    appearance: none;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    background: var(--fill-input-focus);
    box-shadow: 0 0 0 2.5px var(--primary-focus-shadow);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

/* [v1.16] Apple 表单输入框深度升级：品牌色光标 / 悬停预热 / 标签聚焦高亮 / 自定义 select 箭头 */
.form-group input,
.form-group textarea {
    caret-color: var(--primary-color);
}

/* 悬停预热：聚焦前边框先暗一档，让用户感知到"这里可以输入" */
.form-group input:not(:focus):hover,
.form-group textarea:not(:focus):hover,
.form-group select:not(:focus):hover {
    border-color: var(--text-secondary);
}

/* 标签聚焦高亮：输入框激活时 label 同步变品牌色，产生"父子呼应"感 */
.form-group:focus-within > label {
    color: var(--primary-color);
    transition: color var(--ease-apple) 0.2s;
}

/* 自定义 select 下拉箭头：用 SVG data-URI 替换浏览器默认外观 */
.form-group select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236e6e73' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.95rem center;
    background-size: 14px 14px;
    padding-right: 2.75rem;
    cursor: pointer;
}
.form-group select:focus {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232c5f2d' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
}
:root[data-theme="dark"] .form-group select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a3a39c' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
}
:root[data-theme="dark"] .form-group select:focus {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234a8c4e' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
}

/* [v1.10.9] iOS Safari 防自动放大: 输入框字号 < 16px 时聚焦会触发页面放大,
   导致后续布局割裂。强制移动设备上 input/textarea/select 至少 16px */
@media (hover: none) and (pointer: coarse) {
    input, textarea, select {
        font-size: 16px !important;
    }
    /* 触摸反馈: 按钮点下时立刻有视觉变化 (移动端原生 click 有 300ms 延迟感) */
    button, .btn, [role="button"] {
        -webkit-tap-highlight-color: var(--primary-focus-shadow);
        touch-action: manipulation;
    }
    button:active, .btn:active {
        transform: scale(0.98);
        transition: transform 0.05s;
    }
}

.form-hint {
    display: block;
    margin-top: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.char-count {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-top: 0.35rem;
    transition: color 0.2s;
}

.char-count.warn {
    color: #b45309;
    font-weight: 500;
}

.char-count.over {
    color: var(--error-color);
    font-weight: 600;
}

/* [v1.11] 四诊快捷标签 — 点选代替手打，降低填写门槛 */
.quick-tags {
    margin-bottom: 0.75rem;
}

.tag-group {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.6rem;
}

.tag-group:last-child {
    margin-bottom: 0;
}

.tag-group-label {
    flex: 0 0 auto;
    font-size: 0.82rem;
    color: var(--text-secondary);
    min-width: 4.2em;
}

.tag-chip {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0.5rem 0.9rem;
    border: 1.5px solid var(--border-color);
    border-radius: 999px;
    /* [v1.16] token 替代 #fff */
    background: var(--fill-input);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.05s;
}

.tag-chip:hover {
    border-color: var(--primary-light);
}

.tag-chip:active {
    transform: scale(0.97);
}

.tag-chip:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.tag-chip.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
    font-weight: 500;
}

/* [v1.11] 更多信息折叠区 — 渐进式披露，减少首屏文字量 */
/* [v1.15] 背景改用 token（原硬编码 #fafafa 在深色模式会露出刺眼白块） */
.more-info {
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--fill-subtle);
}

.more-info summary {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.9rem 1.2rem;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-primary);
    list-style: none;
    min-height: 44px;
}

.more-info summary::-webkit-details-marker {
    display: none;
}

.more-info summary .chevron {
    margin-left: auto;
    transition: transform 0.2s;
}

.more-info[open] summary .chevron {
    transform: rotate(180deg);
}

.more-info-body {
    padding: 0 1.2rem 1.2rem;
}

.more-info .form-group:last-child {
    margin-bottom: 0.5rem;
}

/* 按钮样式 */
.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2.5rem;
}

/* [v1.15] Apple 风格按钮：药丸形、实色填充，去掉渐变与位移动效，靠透明度/阴影表达状态 */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.9rem 2rem;
    border: none;
    border-radius: 999px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: opacity var(--ease-apple) 0.2s, box-shadow var(--ease-apple) 0.2s, transform var(--ease-apple) 0.15s;
    font-family: inherit;
}

/* .btn-icon: see shared definition below (SVG-based, replaces emoji font-size) */

.btn-primary {
    background: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    opacity: 0.88;
}

.btn-primary:active {
    transform: scale(0.97);
    opacity: 1;
}

.btn-secondary {
    background: var(--card-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(0, 0, 0, 0.03);
    border-color: var(--text-secondary);
}
:root[data-theme="dark"] .btn-secondary:hover { background: rgba(255, 255, 255, 0.06); }

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* 进度显示 */
.progress-section {
    background: var(--card-bg);
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.progress-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.progress-item {
    display: flex;
    gap: 1.5rem;
    padding: 1.5rem;
    background: var(--fill-subtle);
    border-radius: var(--radius-md);
    border-left: 4px solid var(--border-color);
    transition: all 0.3s ease;
}

.progress-item.active {
    border-left-color: var(--primary-color);
    background: var(--primary-bg-light);
}

.progress-item.completed {
    border-left-color: var(--success-color);
    background: var(--primary-bg-light);
}

/* Agent 出错：红色边框 + 淡红背景（用 rgba 适配深色模式） */
.progress-item.error {
    border-left-color: var(--error-color);
    background: rgba(220, 38, 38, 0.06);
}
.progress-item.error .progress-fill {
    background: var(--error-color);
    width: 100% !important;
    opacity: 0.4;
}

.progress-icon {
    min-width: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.progress-content {
    flex: 1;
}

.progress-content h3 {
    font-size: 1.1rem;
    margin-bottom: 0.3rem;
    color: var(--text-primary);
}

.progress-content p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.8rem;
}

.progress-bar {
    height: 6px;
    background: #e0e0e0;
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
    width: 0%;
    transition: width 0.5s ease;
    border-radius: 3px;
}

/* 结果展示 */
.result-section {
    background: var(--card-bg);
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.header-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    justify-content: flex-end;
    margin-top: 1rem;
}
.header-actions-group {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
}
.hdr-divider {
    display: inline-block;
    width: 1px;
    height: 28px;
    background: var(--border-color);
    align-self: center;
    margin: 0 4px;
    flex-shrink: 0;
}
@media (max-width: 600px) {
    .header-actions { justify-content: center; }
    .header-actions .hdr-divider { display: none; }
    .header-actions-group { flex-wrap: wrap; justify-content: center; }
}
/* btn-icon base (shared by all pages) */
.btn-icon {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    vertical-align: middle;
}
.btn-icon svg {
    width: 15px;
    height: 15px;
    display: block;
    flex-shrink: 0;
}
/* label SVG icons */
.label-icon {
    display: inline-flex;
    align-items: center;
    vertical-align: -0.1em;
    margin-right: 2px;
}
.label-icon svg {
    width: 14px;
    height: 14px;
}
/* progress icons */
.progress-icon svg {
    display: block;
    color: var(--primary-color);
}

.result-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--border-color);
    overflow-x: auto;
}

.tab-btn {
    padding: 0.8rem 1.5rem;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.tab-btn:hover {
    color: var(--primary-color);
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-content {
    min-height: 400px;
}

.tab-pane {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-pane.active {
    display: block;
}

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

/* 报告容器 */
.report-container {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    font-family: 'Songti SC', 'STSong', 'SimSun', 'Noto Serif SC', 'Hiragino Mincho ProN', serif;
    line-height: 1.8;
}

.report-container h1,
.report-container h2,
.report-container h3 {
    color: var(--primary-color);
    margin: 1.5rem 0 1rem;
}

.report-container h1 {
    font-size: 1.8rem;
    text-align: center;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 1rem;
}

.report-container h2 {
    font-size: 1.4rem;
}

.report-container h3 {
    font-size: 1.1rem;
}

.report-container p {
    margin: 0.8rem 0;
}

.report-container ul,
.report-container ol {
    margin-left: 2rem;
    margin-bottom: 1rem;
}

.report-container table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

.report-container th,
.report-container td {
    border: 1px solid var(--border-color);
    padding: 0.8rem;
    text-align: left;
}

.report-container th {
    background: var(--primary-bg-light);
    font-weight: 600;
    color: var(--primary-color);
}

.report-container tr:nth-child(even) td {
    background: rgba(44, 95, 45, 0.03);
}

.report-container code {
    background: #f0f4f0;
    padding: 0.15em 0.4em;
    border-radius: 3px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9em;
}

.report-container hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 1.5rem 0;
}

/* 历史弹窗内的 Markdown 表格样式（复用 report-container 方案） */
.modal-box table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.9rem;
}
.modal-box th, .modal-box td {
    border: 1px solid var(--border-color);
    padding: 0.5rem 0.75rem;
    text-align: left;
}
.modal-box th {
    background: var(--primary-bg-light);
    font-weight: 600;
    color: var(--primary-color);
}
.modal-box tr:nth-child(even) td { background: rgba(44, 95, 45, 0.03); }
.modal-box code {
    background: #f0f4f0;
    padding: 0.15em 0.4em;
    border-radius: 3px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9em;
}
.modal-box hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 1rem 0;
}
.modal-box ul, .modal-box ol {
    margin-left: 1.5rem;
    margin-bottom: 0.75rem;
}
.modal-box h2 { font-size: 1.2rem; color: var(--primary-color); margin: 1.25rem 0 0.5rem; }
.modal-box h3 { font-size: 1rem;   color: var(--primary-color); margin: 1rem 0 0.4rem; }

/* 数据卡片 */
.data-card {
    background: var(--fill-subtle);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    border-left: 4px solid var(--primary-color);
}

.data-card h4 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.data-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.data-item {
    background: var(--card-bg);
    padding: 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.data-item strong {
    display: block;
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 0.3rem;
}

.data-item span {
    color: var(--text-primary);
    font-size: 1rem;
}

/* 页脚 */
.footer {
    background: var(--primary-dark);
    color: rgba(255, 255, 255, 0.8);
    text-align: center;
    padding: 2rem 0;
    margin-top: auto;
}

/* 加载动画 */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading {
    display: inline-block;
    animation: spin 1s linear infinite;
}

/* 响应式设计 - 平板 / 中等屏 */
@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }

    .navbar {
        padding: 0.8rem 0;          /* 高度收紧 */
    }
    .navbar .container {
        flex-wrap: wrap;            /* 必要时换行,避免压挤 */
        gap: 0.5rem;
    }
    .navbar h1 {
        font-size: 1.15rem;
        line-height: 1.2;
        white-space: nowrap;        /* 不让标题被压成竖排 */
    }
    /* .logo size auto-scales via SVG viewBox */

    .nav-info {
        gap: 0.4rem;
        flex-wrap: nowrap;
    }
    .nav-link {
        font-size: 0.78rem;
        padding: 0.35rem 0.6rem;
        white-space: nowrap;
        /* [v1.10.38] 44px：Apple HIG / Google MD 最小可触摸高度 */
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }

    .github-link span {
        display: none;
    }
    .github-link {
        padding: 0.5rem;
        min-width: 36px;
        min-height: 36px;
        justify-content: center;
    }

    .status-badge {
        font-size: 0.75rem;
        padding: 0.35rem 0.6rem;
        white-space: nowrap;
        max-width: 130px;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .section-header h2 { font-size: 1.5rem; }
    .patient-form     { padding: 1.5rem; }
    .form-actions     { flex-direction: column; }
    .btn              { width: 100%; justify-content: center; min-height: 44px; }
    .header-actions   { flex-wrap: wrap; }
    .result-tabs      { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .data-grid        { grid-template-columns: 1fr; }
}

/* 超小屏(iPhone SE / 单手握持) */
@media (max-width: 420px) {
    .navbar h1 {
        font-size: 1rem;
    }
    /* .logo: SVG fixed-size, no override needed */
    .nav-brand {
        gap: 0.5rem;
    }
    /* 极窄时主动隐藏 "X 连接失败" 长文字 */
    .status-badge {
        max-width: 100px;
    }
}

/* 打印样式 */
@media print {
    .navbar,
    .footer,
    .header-actions,
    .result-tabs,
    .input-section,
    .modal-actions,
    .modal-close {
        display: none !important;
    }

    .report-container {
        border: none;
        box-shadow: none;
    }

    /* 主页报告区域打印优化 */
    .result-section {
        box-shadow: none;
        border: 1px solid #ccc;
    }

    /* 若页面只有报告 tab 处于激活状态，只印激活内容 */
    .tab-pane:not(.active) {
        display: none !important;
    }

    body {
        font-size: 13px;
        color: #111;
    }

    h2, h3 {
        page-break-after: avoid;
    }

    pre, blockquote, table {
        page-break-inside: avoid;
    }
}

/* ============================================================
 * P26 全端响应式增强
 * 断点矩阵：
 *   ≥ 1400px  大桌面 (2xl)
 *   1200-1399 桌面   (xl)
 *   769-1199  平板/笔记本 (lg)
 *   481-768   手机横屏/平板竖屏 (md) ← 原有
 *   361-480   普通手机 (sm)
 *   321-360   小屏手机 iPhone SE/小米  (xs)
 *   ≤ 320     超窄 WebView / 折叠屏外屏 (xxs)
 *   landscape 手机横屏单独处理
 * ============================================================ */

/* ── 全局基础 ───────────────────────────────────────────────── */
html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%; /* 防 iOS 旋转时自动放大字体 */
    text-size-adjust: 100%;
}

/* 触摸设备去掉点击高亮蓝框 */
a, button, input, textarea, select,
.tab-btn, .nav-link, .status-badge, .action-btn {
    -webkit-tap-highlight-color: transparent;
}

/* 防双击缩放 */
button, .btn, .tab-btn, .action-btn {
    touch-action: manipulation;
}

/* 媒体元素不溢出 */
img, video, canvas, iframe {
    max-width: 100%;
    height: auto;
}

/* 容器全宽 */
.container {
    width: 100%;
}

/* 长文本换行（防止报告/档案/链接撑破布局） */
.report-container,
.modal-box,
.data-item,
.progress-content {
    overflow-wrap: break-word;
    word-break: break-word;
}

/* 表格横向滚动（防止长表格溢出屏幕） */
.report-container table,
.modal-box table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
}
/* 恢复 table 内部元素正常宽度 */
.report-container thead,
.report-container tbody,
.report-container tr,
.modal-box thead,
.modal-box tbody,
.modal-box tr {
    width: 100%;
}

/* 底部安全区（iPhone X/14/15 home indicator）*/
.footer {
    padding-bottom: max(2rem, calc(1.25rem + env(safe-area-inset-bottom, 0px)));
}

/* ── 大桌面（≥ 1400px）─────────────────────────────────────── */
@media (min-width: 1400px) {
    .container { max-width: 1320px; }
    .navbar h1 { font-size: 2rem; }
    .patient-form,
    .progress-section,
    .result-section { padding: 3rem; }
}

/* ── 平板 / 笔记本（769px ~ 1199px）────────────────────────── */
@media (min-width: 769px) and (max-width: 1199px) {
    .container { padding: 0 1.5rem; }
    .navbar h1  { font-size: 1.4rem; }
    .patient-form,
    .progress-section,
    .result-section { padding: 2rem; }
    .data-grid { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
}

/* ── 桌面宽屏：进度条双列显示 ──────────────────────────────── */
@media (min-width: 960px) {
    .progress-container {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 1.25rem;
    }
    /* 最后一个奇数项跨两列（report agent） */
    .progress-item:last-child:nth-child(odd) {
        grid-column: 1 / -1;
    }
}

/* ── 手机端增补（补丁叠加在原有 768px 之上）─────────────────── */
@media (max-width: 768px) {
    .main-content {
        padding: 1.25rem 0;
        /* [v1.8.5] 移动端贴底安全区，避免 iOS home indicator 压住 footer 按钮 */
        padding-bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));
    }
    section { margin-bottom: 1.5rem; }

    .progress-section,
    .result-section { padding: 1.25rem 1rem; }

    /* 结果操作按钮：自动换行，不强制 100% */
    .header-actions .btn {
        width: auto;
        font-size: 0.85rem;
        padding: 0.55rem 0.9rem;
        min-height: 44px;
    }

    /* [v1.8.5] 所有交互按钮在触屏上保证 44×44 苹果可触可达标准 */
    .btn, button.btn, .action-btn, .nav-link, .tab-btn {
        min-height: 44px;
        min-width: 44px;
    }

    /* 进度项：手机横排轻度压缩 */
    .progress-item { padding: 0.9rem 1rem; gap: 0.9rem; }
    .progress-icon { min-width: 48px; }

    .report-container { padding: 1.25rem 1rem; }
    .report-container h1 { font-size: 1.4rem; }
    .report-container h2 { font-size: 1.15rem; }

    /* 页脚文字 */
    .footer { font-size: 0.82rem; line-height: 1.8; }
}

/* ── 普通手机（≤ 480px）────────────────────────────────────── */
@media (max-width: 480px) {
    .container { padding: 0 0.85rem; }

    /* 导航 */
    .navbar { padding: 0.7rem 0; }
    .navbar h1 {
        font-size: 1.05rem;
        max-width: 160px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    /* .logo: SVG fixed-size */

    /* 进度项：图标竖排 */
    .progress-item {
        flex-direction: column;
        gap: 0.6rem;
        align-items: flex-start;
    }
    .progress-icon {
        min-width: unset;
        width: 100%;
        height: auto;
        justify-content: flex-start;
    }

    /* 表单 */
    .patient-form { padding: 1.25rem 1rem; }
    .form-group   { margin-bottom: 1.5rem; }

    /* Tab 按钮缩小 */
    .tab-btn {
        padding: 0.6rem 0.9rem;
        font-size: 0.83rem;
    }

    /* 横幅：隐藏箭头，内容允许换行 */
    .banner-content { flex-wrap: wrap; gap: 0.75rem; }
    .banner-arrow   { display: none; }
    .banner-text h2 { font-size: 1.1rem; }
    .banner-text p  { font-size: 0.82rem; }

    /* 表单操作按钮 */
    .form-actions { gap: 0.65rem; }
    .btn { min-height: 48px; }  /* 触摸目标更大 */

    /* [v1.10.38] 结果区操作按钮：横向滚动，避免 6 个按钮换行成多行 */
    .header-actions {
        flex-wrap: nowrap;          /* 不换行 */
        overflow-x: auto;           /* 横向滚动 */
        -webkit-overflow-scrolling: touch;
        padding-bottom: 4px;        /* 防滚动条遮住文字 */
        gap: 0.5rem;
        /* 隐藏滚动条（视觉更干净） */
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    .header-actions::-webkit-scrollbar { display: none; }
    .header-actions .btn {
        flex-shrink: 0;             /* 按钮不被压缩 */
        font-size: 0.82rem;
        padding: 0.5rem 0.8rem;
        white-space: nowrap;
    }
}

/* ── 小屏手机（≤ 360px）— iPhone SE / 红米 Note mini ──────── */
@media (max-width: 360px) {
    .container { padding: 0 0.65rem; }

    .navbar { padding: 0.55rem 0; }
    .navbar h1 { font-size: 0.95rem; max-width: 120px; }
    /* .logo: SVG fixed-size */
    .nav-brand { gap: 0.4rem; }

    .status-badge {
        font-size: 0.68rem;
        padding: 0.25rem 0.45rem;
        max-width: 90px;
    }
    .nav-info { gap: 0.3rem; }
    .nav-link {
        font-size: 0.72rem;
        padding: 0.3rem 0.45rem;
    }

    .patient-form   { padding: 1rem 0.75rem; }
    .form-group     { margin-bottom: 1.25rem; }
    /* 字号必须 ≥ 16px，防 iOS 自动缩放输入框 */
    .form-group input,
    .form-group textarea { padding: 0.75rem 0.9rem; font-size: 1rem; }

    .section-header h2   { font-size: 1.15rem; }
    .progress-section    { padding: 0.9rem 0.65rem; }
    .progress-content h3 { font-size: 0.9rem; }
    .progress-content p  { font-size: 0.8rem; }
}

/* ── 超窄设备（≤ 320px）折叠屏外屏 / 老款 Android ─────────── */
@media (max-width: 320px) {
    .container { padding: 0 0.5rem; }
    .patient-form,
    .progress-section,
    .result-section { border-radius: var(--radius-sm); padding: 0.85rem 0.6rem; }
    .btn { font-size: 0.88rem; padding: 0.65rem 0.8rem; }
    /* 最后一个 nav-link 隐藏（仅保留首页/档案之一） */
    .nav-info .nav-link:last-of-type { display: none; }
}

/* ── 手机横屏（高度 ≤ 500px + landscape）────────────────────── */
@media (max-height: 500px) and (orientation: landscape) {
    .navbar { padding: 0.4rem 0; }
    /* .logo: SVG fixed-size */
    .navbar h1 { font-size: 1rem; }

    .main-content { padding: 0.85rem 0; }
    section { margin-bottom: 0.85rem; }
    .patient-form,
    .progress-section,
    .result-section { padding: 1rem; }

    .section-header { margin-bottom: 0.85rem; }
    .section-header h2 { font-size: 1.25rem; }

    .progress-item { padding: 0.65rem 0.9rem; }
    .progress-icon { min-width: 42px; }
    .progress-content h3 { font-size: 0.9rem; margin-bottom: 0.1rem; }
    .progress-content p  { font-size: 0.78rem; margin-bottom: 0.4rem; }

    /* 表单字段上下间距压缩 */
    .form-group { margin-bottom: 1rem; }
}

/* ── 触摸屏设备：抑制 hover 残留 ───────────────────────────── */
@media (hover: none) and (pointer: coarse) {
    /* hover 特效在触摸设备上禁用，改用 :active 表达反馈 */
    .btn:hover,
    .nav-link:hover,
    .github-link:hover,
    .tab-btn:hover,
    .action-btn:hover {
        transform: none !important;
        box-shadow: inherit !important;
        background-color: inherit;
        color: inherit;
    }
    /* :active 代替 hover 给触摸反馈 */
    .btn:active      { opacity: 0.78; transform: scale(0.97) !important; transition: none; }
    .tab-btn:active  { opacity: 0.7; }
    .nav-link:active { opacity: 0.7; }
    .action-btn:hover { background: var(--primary-color); color: white; } /* 保留点击态 */
    .action-btn-danger:hover { background: #f5222d; color: white; }
}

/* ── 打印增强（补充之前遗漏项）──────────────────────────────── */
@media print {
    .report-container thead,
    .modal-box thead {
        display: table-header-group; /* 打印时表格标题每页重复 */
    }
    .report-container tr,
    .modal-box tr {
        page-break-inside: avoid;
    }
    .report-container {
        max-width: 100%;
        font-size: 11pt;
        line-height: 1.7;
    }
    /* 打印时展示所有 tab 内容（而不只是激活的那个） */
    .tab-pane { display: block !important; page-break-before: always; }
    .tab-pane:first-child { page-break-before: auto; }
}

/* 美化 JSON 显示 */
.json-display {
    background: #2d2d2d;
    color: #f8f8f2;
    padding: 1.5rem;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
}

.json-key {
    color: #66d9ef;
}

.json-string {
    color: #e6db74;
}

.json-number {
    color: #ae81ff;
}

.json-boolean {
    color: #fd971f;
}

/* 警告和提示框 */
.alert {
    padding: 1rem 1.5rem;
    border-radius: var(--radius-sm);
    margin: 1rem 0;
    border-left: 4px solid;
}

.alert-success {
    background: #f6ffed;
    border-color: var(--success-color);
    color: #135200;
}

.alert-warning {
    background: #fffbe6;
    border-color: var(--warning-color);
    color: #614700;
}

.alert-error {
    background: #fff2f0;
    border-color: var(--error-color);
    color: #5c0011;
}

.alert-info {
    background: #e6f7ff;
    border-color: #1890ff;
    color: #003a8c;
}

/* ============================================================
 * P27 电脑端两栏 + 安卓端动态视口优化
 * 版本：v1.5.0
 * ============================================================ */

/* ── 安卓字体渲染 + 全局平滑 ────────────────────────────────── */
body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* ── 动态视口高度（解决安卓 Chrome 地址栏跳动）───────────────── */
/* dvh = dynamic viewport height，浏览器地址栏出现/消失时自动适配 */
@supports (min-height: 100dvh) {
    .main-content {
        min-height: calc(100dvh - 64px); /* 64px ≈ navbar 高度 */
    }
}

/* ── 禁止弹性过度滚动（安卓/iOS app 质感）────────────────────── */
html {
    overscroll-behavior: none;
}

/* ── 安卓安全区适配（带刘海/打孔屏）────────────────────────── */
.navbar {
    padding-top: max(0.85rem, env(safe-area-inset-top, 0px));
    padding-left:  max(0px, env(safe-area-inset-left, 0px));
    padding-right: max(0px, env(safe-area-inset-right, 0px));
}
.footer {
    padding-left:  max(1rem, env(safe-area-inset-left, 0px));
    padding-right: max(1rem, env(safe-area-inset-right, 0px));
}

/* ── 安卓触摸目标最小 48×48px（Material Design 规范）────────── */
@media (hover: none) and (pointer: coarse) {
    .btn,
    .tab-btn,
    .action-btn,
    .nav-link {
        min-height: 48px;
        min-width: 48px;
    }
    /* 输入框/文本域：字号≥16px 防安卓 Chrome 自动缩放 */
    .form-group input,
    .form-group textarea,
    .form-group select {
        font-size: 16px !important;
    }
    /* 滚动容器启用原生动量滚动 */
    .result-content,
    .report-container,
    .modal-box {
        -webkit-overflow-scrolling: touch;
    }
}

/* ── 安卓平板竖屏（600px ~ 900px）── */
@media (min-width: 600px) and (max-width: 900px) {
    .container { padding: 0 1.75rem; }

    /* 进度区两列，比手机舒展 */
    .progress-container {
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
    }

    /* 表单适度放大 */
    .patient-form { padding: 2rem 1.75rem; }

    /* 结果区标签排成一行 */
    .result-tabs {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        gap: 0.4rem;
        padding-bottom: 0.25rem;
    }
    .tab-btn {
        flex-shrink: 0;
        white-space: nowrap;
    }

    /* 操作按钮行 */
    .header-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    .header-actions .btn { flex: 0 0 auto; }
}

/* ── 安卓平板横屏（901px ~ 1199px）── */
@media (min-width: 901px) and (max-width: 1199px) {
    .container { padding: 0 2rem; }
    .patient-form { padding: 2.25rem 2rem; }

    /* 进度区保持两列 */
    .progress-container {
        grid-template-columns: 1fr 1fr;
        gap: 1.25rem;
    }

    /* 数据网格三列 */
    .data-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ── 电脑端（≥ 1200px）客户表单两栏布局 ────────────────────── */
@media (min-width: 1200px) {
    /* 输入区整体加宽 */
    .input-section {
        max-width: 1100px;
        margin-left: auto;
        margin-right: auto;
    }

    /* 表单使用 CSS Grid 两栏 */
    #patientForm {
        display: grid;
        grid-template-columns: 1fr 1fr;
        column-gap: 2.5rem;
        align-items: start;
    }

    /* 第一栏：基本信息行 */
    #patientForm > .form-row:first-child {
        grid-column: 1;
        grid-row: 1;
    }

    /* 第一栏：现代病名 */
    #patientForm > div.form-group:nth-of-type(1) {
        grid-column: 1;
        grid-row: 2;
    }

    /* 第一栏：主述 */
    #patientForm > div.form-group:nth-of-type(2) {
        grid-column: 1;
        grid-row: 3;
    }

    /* 第二栏：四诊信息（跨 1~4 行，与左侧等高）*/
    #patientForm > div.form-group:nth-of-type(3) {
        grid-column: 2;
        grid-row: 1 / span 4;
    }
    #patientForm > div.form-group:nth-of-type(3) textarea {
        min-height: 320px;
        resize: vertical;
    }

    /* 第一栏底部：特殊情况 */
    #patientForm > div.form-group:nth-of-type(4) {
        grid-column: 1;
        grid-row: 4;
    }

    /* 操作按钮行：跨两列，左对齐 */
    #patientForm > .form-actions {
        grid-column: 1 / -1;
        grid-row: 5;
        justify-content: flex-start;
        gap: 1rem;
    }
    #patientForm > .form-actions .btn-primary {
        min-width: 200px;
    }

    /* 结果区数据网格 */
    .data-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    /* 报告区最大宽度 */
    .report-container {
        max-width: 960px;
        margin-left: auto;
        margin-right: auto;
    }
}

/* ── 大屏桌面（≥ 1400px）进一步优化 ──────────────────────────── */
@media (min-width: 1400px) {
    .input-section {
        max-width: 1240px;
    }
    #patientForm {
        column-gap: 3rem;
    }
    #patientForm > div.form-group:nth-of-type(3) textarea {
        min-height: 380px;
    }
}

/* ============================================================
 * [v1.10.38] 全设备移动端补丁
 * 修复范围：
 *   - iPhone 横屏两侧内容被 Home 条/刘海遮挡
 *   - WeChat X5 / 旧版 Android Chrome 无 aspect-ratio 支持（见 ai-diagnosis.css）
 *   - OPPO Pad / 华为 MatePad 竖屏（800px）进一步优化
 *   - iOS Safari 平滑滚动动量（-webkit-overflow-scrolling）
 * ============================================================ */

/* ── iPhone 横屏：主内容区两侧安全区（刘海/圆角 notch）────────── */
@media (orientation: landscape) and (max-height: 500px) {
    /* 横屏手机：container 加左右安全区，防刘海/圆角遮内容 */
    .main-content .container,
    .navbar .container,
    .footer .container {
        padding-left:  max(1rem, env(safe-area-inset-left, 0px));
        padding-right: max(1rem, env(safe-area-inset-right, 0px));
    }
}

/* ── iPad / OPPO Pad 横屏（≥ 1024px 平板横屏）──────────────────── */
@media (min-width: 1024px) and (max-width: 1199px) {
    .patient-form { padding: 2rem; }
    .section-header h2 { font-size: 1.7rem; }
    /* 进度区保持 2 列 */
    .progress-container {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }
}

/* ── OPPO Pad 竖屏（750px ~ 900px）─────────────────────────────── */
@media (min-width: 750px) and (max-width: 900px) {
    /* 导航：标题不超出 */
    .navbar h1 { font-size: 1.25rem; }
    /* 表单区域：内边距舒适 */
    .patient-form { padding: 2rem 1.75rem; }
    /* 进度图标保持水平布局 */
    .progress-item { flex-direction: row; }
    .progress-icon { min-width: 52px; }
}

/* ── 所有可滚动容器：iOS 动量滚动 ───────────────────────────────── */
/* 注：iOS 13+ 默认已开启，这里对老 Safari / 微信 WebView 兜底 */
.result-tabs,
.report-container,
.modal-box,
.result-content,
.tab-content {
    -webkit-overflow-scrolling: touch;
}

/* ── 微信 X5：backdrop-filter 不支持时给导航栏/status-badge 加不透明背景 */
/* [v1.15] 导航栏改浅色毛玻璃后，不支持 blur 的浏览器改用浅灰实色兜底（配深字），而非旧版深色兜底（曾配白字） */
@supports not (backdrop-filter: blur(1px)) {
    .navbar {
        background: #fafafa;
    }
    :root[data-theme="dark"] .navbar {
        background: #1c1e1f;
    }
    .status-badge {
        background: rgba(0, 0, 0, 0.06);
    }
    .github-link {
        background: rgba(0, 0, 0, 0.25);
    }
}

/* ── 通用：select 元素在 iOS Safari 去掉内置圆角（防样式不统一）── */
select {
    -webkit-appearance: none;
    appearance: none;
    border-radius: var(--radius-sm, 8px);
}

/* ── 通用：a[href] 和 button 禁止 callout（iOS 长按菜单不显示） */
a[href], button {
    -webkit-touch-callout: none;
}

/* ── 平板/桌面端 hover 残留修复（触屏鼠标混合设备）── */
@media (hover: none) {
    .ai-diagnosis-banner:hover {
        transform: none;
        /* [v1.10.52] 使用品牌色变量 */
        box-shadow: 0 4px 20px var(--primary-focus-shadow);
    }
}

/* ============================================================
 * [v1.10.41] 全设备 iOS / Android 深度优化
 * ============================================================ */

/* ── 1. iOS/Android 自动填充背景覆盖（消灭黄色 autofill 背景）── */
/* [v1.16] 颜色与 --fill-input token 对齐（浅色 #f5f5f7 / 深色 #17191a） */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
select:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 1000px #f5f5f7 inset !important;
    -webkit-text-fill-color: #1d1d1f !important;
    caret-color: #1d1d1f;
    transition: background-color 5000s ease-in-out 0s;
}
/* 深色模式 autofill：背景用 --fill-input dark (#17191a)，文字用 --text-primary dark (#e8e6e0) */
:root[data-theme="dark"] input:-webkit-autofill,
:root[data-theme="dark"] input:-webkit-autofill:hover,
:root[data-theme="dark"] input:-webkit-autofill:focus,
:root[data-theme="dark"] textarea:-webkit-autofill,
:root[data-theme="dark"] select:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 1000px #17191a inset !important;
    -webkit-text-fill-color: #e8e6e0 !important;
    caret-color: #e8e6e0;
    transition: background-color 5000s ease-in-out 0s;
}

/* ── 2. 结果 Tab 行全尺寸动量滚动 + 隐藏滚动条 ───────────────── */
.result-tabs {
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.result-tabs::-webkit-scrollbar { display: none; }

/* ── 3. JSON 代码块可横向滚动（iOS 动量）─────────────────────── */
.json-display {
    -webkit-overflow-scrolling: touch;
}

/* ── 4. 主 CTA 横幅触摸态：立刻有视觉缩放反馈 ───────────────── */
@media (hover: none) and (pointer: coarse) {
    .ai-diagnosis-banner:active {
        transform: scale(0.988);
        /* [v1.10.52] 使用品牌色变量 */
        box-shadow: 0 2px 10px var(--primary-focus-shadow);
        transition: transform 0.08s, box-shadow 0.08s;
    }
    /* 卡片区域也需要触摸反馈 */
    .patient-form:active,
    .progress-section:active { /* 不给 :active，防止内容点击触发 */ }
}

/* ── 5. 通用可交互元素：cursor: pointer（PC 端鼠标悬停明确可点）*/
.ai-diagnosis-banner,
.tab-btn,
.action-btn,
.nav-link {
    cursor: pointer;
}

/* ── 6. 更流畅的滚动容器（补充 modal-box + data-item）────────── */
.modal-box,
.data-item {
    -webkit-overflow-scrolling: touch;
}

/* ════════════════════════════════════════════════════════
 * [v1.11.0] UI/UX PRO MAX — 通用基础增强
 * 骨架屏 · 焦点环 · 进度条加粗 · 通用动画工具类
 * ════════════════════════════════════════════════════════ */

/* ── 进度条：8px 更有存在感（从 6px 升级）── */
.progress-bar {
    height: 8px;
    border-radius: 4px;
}

/* ── 骨架屏通用组件 ── */
@keyframes skeleton-shimmer {
    0%   { background-position: -400px 0; }
    100% { background-position:  400px 0; }
}

.skeleton {
    background: linear-gradient(
        90deg,
        rgba(0, 0, 0, 0.06) 25%,
        rgba(0, 0, 0, 0.11) 50%,
        rgba(0, 0, 0, 0.06) 75%
    );
    background-size: 400px 100%;
    animation: skeleton-shimmer 1.5s ease infinite;
    border-radius: var(--radius-sm);
    color: transparent !important;
    pointer-events: none;
    user-select: none;
}

.skeleton-line {
    display: block;
    height: 1em;
    margin-bottom: 0.5em;
    border-radius: 4px;
    width: 100%;
}

.skeleton-line:last-child { width: 65%; }

/* ── 通用 fadeInUp 工具类（可配合 IntersectionObserver 使用）── */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: translateY(0); }
}

.animate-in {
    animation: fadeInUp 0.42s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.animate-in-delay-1 { animation-delay: 0.08s; }
.animate-in-delay-2 { animation-delay: 0.16s; }
.animate-in-delay-3 { animation-delay: 0.24s; }

/* ── 通用脉冲动画（加载指示器 / 待机状态）── */
@keyframes pulse-soft {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.50; }
}

.pulse {
    animation: pulse-soft 1.8s ease-in-out infinite;
}

/* ── WCAG 2.4.11 焦点环基础样式（品牌 CSS 覆盖颜色）── */
:focus-visible {
    outline:        3px solid var(--primary-color);
    outline-offset: 2px;
    border-radius:  var(--radius-sm, 4px);
}

/* 鼠标点击不显示焦点环（仅键盘导航时显示）*/
:focus:not(:focus-visible) {
    outline: none;
}

/* ── 平滑过渡：progress-item 状态切换 ── */
.progress-item {
    transition: background 0.28s ease, border-color 0.28s ease, box-shadow 0.28s ease;
}

/* ── 报告区 h1 下划线加粗 ── */
.report-container h1 {
    border-bottom-width: 2px;
    padding-bottom: 1rem;
}

/* ── 数据卡片 hover 反馈（PC 端）── */
@media (hover: hover) {
    .data-item:hover {
        border-color: var(--primary-color);
        box-shadow:   0 2px 12px var(--primary-focus-shadow);
        transition:   border-color 0.2s, box-shadow 0.2s;
    }
}

/* ════════════════════════════════════════════════════════
 * [v1.19] P8 Forms & Feedback — Toast 通知系统
 * ════════════════════════════════════════════════════════ */

/* ── 桌面端：右上角滑入 ── */
@keyframes toast-slide-in {
    from { opacity: 0; transform: translateX(110%); }
    to   { opacity: 1; transform: translateX(0); }
}
@keyframes toast-slide-out {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(110%); }
}
/* ── fadeOut 动画（之前在 script.js inline style 中，迁到 CSS）── */
@keyframes fadeOut {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(20px); }
}

.toast-container {
    position: fixed;
    top: max(80px, calc(72px + env(safe-area-inset-top, 0px)));
    right: max(16px, env(safe-area-inset-right, 0px));
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    pointer-events: none;
    max-width: min(340px, calc(100vw - 32px));
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.85rem 1rem 0.85rem 1rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    font-size: 0.875rem;
    color: var(--text-primary);
    pointer-events: auto;
    animation: toast-slide-in 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) both;
    line-height: 1.55;
    max-width: 100%;
}

.toast.leaving {
    animation: toast-slide-out 0.24s cubic-bezier(0.55, 0, 1, 0.45) forwards;
}

.toast-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    margin-top: 1px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toast-icon svg { display: block; }

.toast-success .toast-icon { color: #22c55e; }
.toast-error   .toast-icon { color: var(--error-color); }
.toast-warning .toast-icon { color: #f59e0b; }
.toast-info    .toast-icon { color: var(--primary-color); }

/* 左边框强调色 */
.toast-success { border-left: 3px solid #22c55e; }
.toast-error   { border-left: 3px solid var(--error-color); }
.toast-warning { border-left: 3px solid #f59e0b; }
.toast-info    { border-left: 3px solid var(--primary-color); }

.toast-body { flex: 1; min-width: 0; word-break: break-word; }

.toast-close {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    border: none;
    background: none;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.55;
    transition: opacity 0.15s;
    align-self: flex-start;
    margin-top: 1px;
}
.toast-close:hover { opacity: 1; }
.toast-close:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 1px;
    opacity: 1;
}

/* ── 移动端：底部居中弹出（拇指区域更易操作）── */
@media (max-width: 520px) {
    .toast-container {
        top: auto;
        bottom: max(24px, calc(20px + env(safe-area-inset-bottom, 0px)));
        right: 12px;
        left: 12px;
        max-width: 100%;
    }
    @keyframes toast-slide-in {
        from { opacity: 0; transform: translateY(32px); }
        to   { opacity: 1; transform: translateY(0); }
    }
    @keyframes toast-slide-out {
        from { opacity: 1; transform: translateY(0); }
        to   { opacity: 0; transform: translateY(20px); }
    }
}

/* ── P8 表单字段错误状态
     border-color 走 UA Shadow DOM 不可靠；outline 在非 focus 时可用（已实测）；
     box-shadow 在真实浏览器中也可用，两者叠加确保跨平台可见 ── */
.field-input-error {
    outline: 2px solid var(--error-color) !important;
    outline-offset: -1px !important;
    box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.12) !important;
}

/* ── P8 预填充横幅（替代 showPrefillBanner 的 inline style）── */
.prefill-banner {
    padding: 0.75rem 1rem;
    background: var(--primary-bg-light);
    border-left: 3.5px solid var(--primary-color);
    color: var(--primary-color);
    margin-bottom: 1.25rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    line-height: 1.55;
}
:root[data-theme="dark"] .prefill-banner {
    color: var(--primary-light);
}

/* ── P7 结果区出现动画 ── */
@keyframes result-reveal {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}
.result-section.visible {
    animation: result-reveal 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* ── reduced-motion 对 toast/result-reveal 的豁免 ── */
@media (prefers-reduced-motion: reduce) {
    .toast { animation: none !important; }
    .toast.leaving { animation: none !important; opacity: 0; }
    .result-section.visible { animation: none !important; }
}

/* ═══════════════════════════════════════════════════════════════
   v1.20 · 2026 深度打磨
   Fluid Type / Brand Shimmer / Skeleton / Streaming / Transitions
   ═══════════════════════════════════════════════════════════════ */

/* ── 流体字号 token（无断点平滑缩放 375→1440） ── */
:root {
    --text-xs:   clamp(0.68rem, 1.4vw,  0.75rem);
    --text-sm:   clamp(0.78rem, 1.8vw,  0.875rem);
    --text-base: clamp(0.875rem,2.0vw,  1rem);
    --text-lg:   clamp(1rem,    2.4vw,  1.125rem);
    --text-xl:   clamp(1.1rem,  2.8vw,  1.375rem);
    --text-2xl:  clamp(1.25rem, 3.5vw,  1.75rem);
    --text-3xl:  clamp(1.5rem,  4.5vw,  2.25rem);
}
/* 应用流体字号到关键元素 */
.nav-brand h1          { font-size: var(--text-xl); }
.section-header h2     { font-size: var(--text-2xl); }
.section-header .subtitle { font-size: var(--text-sm); }
.progress-content h3   { font-size: var(--text-base); }
.progress-content p    { font-size: var(--text-sm); }
.form-hint             { font-size: var(--text-xs); }
.tab-btn               { font-size: var(--text-sm); }

/* ── 导航品牌标题：金绿流光渐变 ── */
.nav-brand h1 {
    background: linear-gradient(
        110deg,
        var(--primary-color)  0%,
        #c9a84c              38%,
        #f0e0a0              50%,
        #c9a84c              62%,
        var(--primary-color) 100%
    );
    background-size: 260% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: brand-shimmer 7s linear infinite;
    letter-spacing: -0.01em;
}
@keyframes brand-shimmer {
    from { background-position: 0%   center; }
    to   { background-position: 260% center; }
}

/* ── 顶部阅读进度条（CSS scroll-driven，Chrome 115+；旧版静止） ── */
.scroll-progress {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(
        to right, var(--primary-color), #c9a84c 50%, var(--primary-color)
    );
    transform-origin: left center;
    transform: scaleX(0);
    z-index: 10001;
    pointer-events: none;
}
@supports (animation-timeline: scroll()) {
    .scroll-progress {
        animation: scroll-grow linear both;
        animation-timeline: scroll(root);
    }
    @keyframes scroll-grow {
        from { transform: scaleX(0); }
        to   { transform: scaleX(1); }
    }
}

/* ── 进度条项：入场交错动画（class animating 由 JS 触发） ── */
@keyframes progress-item-enter {
    from { opacity: 0; transform: translateX(-14px); }
    to   { opacity: 1; transform: translateX(0); }
}
#progressSection.animating .progress-item {
    opacity: 0;
    animation: progress-item-enter 0.42s cubic-bezier(0.22, 1, 0.36, 1) both;
}
#progressSection.animating .progress-item:nth-child(1) { animation-delay: 0.04s; }
#progressSection.animating .progress-item:nth-child(2) { animation-delay: 0.11s; }
#progressSection.animating .progress-item:nth-child(3) { animation-delay: 0.18s; }
#progressSection.animating .progress-item:nth-child(4) { animation-delay: 0.25s; }
#progressSection.animating .progress-item:nth-child(5) { animation-delay: 0.32s; }
#progressSection.animating .progress-item:nth-child(6) { animation-delay: 0.39s; }
#progressSection.animating .progress-item:nth-child(7) { animation-delay: 0.46s; }

/* ── pending 状态：进度条骨架 shimmer ── */
.progress-item.pending .progress-fill {
    width: 100% !important;
    background: linear-gradient(
        90deg,
        rgba(44, 95, 45, 0.08)  25%,
        rgba(201, 168, 76, 0.18) 50%,
        rgba(44, 95, 45, 0.08)  75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.7s ease-in-out infinite;
    border-radius: inherit;
}
.progress-item.pending .progress-icon {
    opacity: 0.35;
}

/* ── active 状态：环形脉冲 + 图标旋转 ── */
.progress-item.active {
    animation: active-glow 2.5s ease-in-out infinite;
}
@keyframes active-glow {
    0%, 100% { box-shadow: 0 0 0 0   rgba(44, 95, 45, 0.00); }
    50%       { box-shadow: 0 0 0 6px rgba(44, 95, 45, 0.14), 0 6px 28px rgba(44, 95, 45, 0.12); }
}
.progress-item.active .progress-icon svg {
    animation: spin-icon 2.2s linear infinite;
    transform-origin: center;
    display: block;
}
@keyframes spin-icon {
    to { transform: rotate(360deg); }
}

/* ── 进度填充过渡平滑 ── */
.progress-fill {
    transition: width 0.65s cubic-bezier(0.22, 1, 0.36, 1),
                background 0.4s ease;
}

/* ── SSE 流式打字光标 ── */
.streaming-cursor::after {
    content: '|';
    animation: cursor-blink 0.62s step-end infinite;
    color: var(--primary-color);
    font-weight: 300;
    margin-left: 1px;
    opacity: 1;
}
@keyframes cursor-blink {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0; }
}

/* ── 结果标签页切换淡入上移 ── */
@keyframes tab-enter {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}
.tab-pane.active {
    animation: tab-enter 0.32s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* ── 按钮按压微反馈（scale spring） ── */
.btn {
    transition: transform 0.1s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.15s ease,
                background 0.2s ease,
                color 0.2s ease;
}
.btn:active { transform: scale(0.95); }
.tab-btn { transition: color 0.18s ease, background 0.18s ease, transform 0.1s ease; }
.tab-btn:active { transform: scale(0.96); }
.tag-chip { transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease; }
.tag-chip:active { transform: scale(0.93); }

/* ── View Transition 全局淡入淡出 ── */
@keyframes vt-enter {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes vt-exit {
    from { opacity: 1; transform: translateY(0); }
    to   { opacity: 0; transform: translateY(-8px); }
}
::view-transition-new(root) {
    animation: vt-enter 0.35s cubic-bezier(0.22, 1, 0.36, 1) both;
}
::view-transition-old(root) {
    animation: vt-exit 0.22s cubic-bezier(0.55, 0, 1, 0.45) both;
}

/* ── bodymap 穴位外晕脉冲（bodymap.js 已给外层圆添加 class outer-glow） ── */
@keyframes acupoint-pulse {
    0%, 100% { opacity: 0.55; }
    50%       { opacity: 0.12; }
}
#bodymapRoot svg .outer-glow {
    animation: acupoint-pulse 2.8s ease-in-out infinite;
    transform-origin: center;
}
/* 每个穴位错开启动时间（用 nth-of-type 无法精确定位，JS 注入 style 更可靠，CSS 做备选） */
#bodymapRoot svg .outer-glow:nth-child(3n+1) { animation-delay: 0s; }
#bodymapRoot svg .outer-glow:nth-child(3n+2) { animation-delay: 0.9s; }
#bodymapRoot svg .outer-glow:nth-child(3n)   { animation-delay: 1.8s; }

/* ── v1.20 prefers-reduced-motion 统一豁免 ── */
@media (prefers-reduced-motion: reduce) {
    .nav-brand h1                        { animation: none; }
    #progressSection.animating .progress-item { animation: none !important; opacity: 1 !important; }
    .progress-item.pending .progress-fill     { animation: none; }
    .progress-item.active                     { animation: none; }
    .progress-item.active .progress-icon svg  { animation: none; }
    .streaming-cursor::after                  { animation: none; }
    .tab-pane.active                          { animation: none; }
    .btn:active, .tab-btn:active, .tag-chip:active { transform: none; }
    #bodymapRoot svg .outer-glow              { animation: none; }
}



/* [v1.21] 首屏重构：次级养生工具分隔标题 + 工具区留白 */
.wellness-tools-divider {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 32px 4px 18px;
    color: var(--text-secondary);
}
.wellness-tools-divider::before,
.wellness-tools-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border-color), transparent);
}
.wellness-tools-divider span {
    font-size: 13px;
    letter-spacing: 3px;
    white-space: nowrap;
    color: var(--text-secondary);
    font-weight: 500;
}
.wellness-tools-zone { display: flex; flex-direction: column; gap: 14px; }
.wellness-tools-zone .constitution-banner { padding: 14px 16px; }


/* [v1.22] 导航栏移动端：nav-info 横向可滚动，防 5 链接溢出挤压（保留文字标签） */
@media (max-width: 768px) {
    .nav-info {
        overflow-x: auto;
        max-width: 100%;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }
    .nav-info::-webkit-scrollbar { display: none; }
}


/* [v1.23] 移动端底部导航栏（顶尖标配，自注入自动高亮） */
.bottom-nav { display: none; }
@media (max-width: 768px) {
    .bottom-nav {
        display: flex;
        position: fixed;
        left: 0; right: 0; bottom: 0;
        z-index: 200;
        background: rgba(255, 255, 255, 0.88);
        backdrop-filter: saturate(180%) blur(20px);
        -webkit-backdrop-filter: saturate(180%) blur(20px);
        border-top: 0.5px solid var(--border-color);
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }
    .bnav-item {
        flex: 1;
        display: flex; flex-direction: column;
        align-items: center; justify-content: center; gap: 3px;
        padding: 7px 0 5px; min-height: 50px;
        text-decoration: none;
        color: var(--text-secondary);
        font-size: 11px; font-weight: 500;
        transition: color 0.15s var(--ease-apple);
        -webkit-tap-highlight-color: transparent;
    }
    .bnav-item.active { color: var(--primary-color); }
    .bnav-item:active { transform: scale(0.94); }
    body { padding-bottom: calc(58px + env(safe-area-inset-bottom, 0px)); }
    .kb-open .bottom-nav { display: none; }
}
:root[data-theme="dark"] .bottom-nav { background: rgba(22, 24, 26, 0.85); }

/* [v1.23] hero 深度层：底部微渐变叠加更有卡片体量（content 保持在上层） */
.ai-diagnosis-banner .banner-content { position: relative; z-index: 1; }
.ai-diagnosis-banner::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    border-radius: inherit;
    background: linear-gradient(165deg, rgba(255,255,255,0.10), transparent 42%, rgba(0,0,0,0.12));
    pointer-events: none;
}


/* ================================================================
   [v1.24] 高级化 Premium：深墨玉渐变 + 香槟金点缀
   （追加覆盖 · 精确选择器 · 后定义胜出，无需 !important）
   ================================================================ */

/* 1. 令牌覆盖 —— 全站主色 / 背景自动跟随（浅色模式） */
:root {
    --primary-color:  #245446;                 /* 深墨玉 */
    --primary-light:  #2e6b57;
    --primary-dark:   #16352a;
    --primary-focus-shadow: rgba(36, 84, 70, 0.12);
    --primary-bg-light: #eef3f0;
    --accent-gold:    #c8a86a;                 /* 香槟金 */
    --bg-color:       #f6f5f2;                 /* 暖纸色 */
}
/* 深色模式：主色转墨玉亮变体（深底保持可读），背景更沉、金更暖 */
:root[data-theme="dark"] {
    --primary-color:  #3f9077;
    --primary-light:  #57ad93;
    --primary-dark:   #245446;
    --accent-gold:    #d4b87a;
    --bg-color:       #111311;
}

/* 2. Hero 深墨玉渐变 + 更从容留白 + 极细金边 */
.ai-diagnosis-banner {
    background: linear-gradient(150deg, #2a6153 0%, #1f4539 48%, #16352a 100%);
    padding: 2.25rem 2.5rem;
    color: #f4f1ea;
    box-shadow: 0 10px 30px -12px rgba(22, 53, 42, 0.45);
    border: 1px solid rgba(200, 168, 106, 0.14);
}

/* 3. Hero 图标：香槟金磨砂（仅主 hero，不影响次级体质卡） */
.ai-diagnosis-banner .banner-icon {
    background: linear-gradient(135deg, rgba(200, 168, 106, 0.24), rgba(200, 168, 106, 0.10));
    border: 1px solid rgba(200, 168, 106, 0.40);
    color: #e7cf9e;
}

/* 4. Hero 箭头：香槟金 + hover 微移 */
.ai-diagnosis-banner .banner-arrow { color: #c8a86a; }
.ai-diagnosis-banner:hover .banner-arrow {
    transform: translateX(3px);
    transition: transform 0.3s var(--ease-apple);
}

/* 5. Hero 文字：暖白层次 */
.ai-diagnosis-banner .banner-text h2 { color: #f7f4ec; letter-spacing: 0.3px; }
.ai-diagnosis-banner .banner-text p  { color: rgba(244, 241, 234, 0.82); }

/* 6. 主按钮：深墨玉渐变 + 金光晕 */
.btn-primary {
    background: linear-gradient(135deg, #2a6153, #16352a);
    box-shadow: 0 4px 14px rgba(30, 74, 58, 0.30), 0 1px 3px rgba(0, 0, 0, 0.14);
}
.btn-primary:hover {
    opacity: 1;
    box-shadow: 0 7px 22px rgba(30, 74, 58, 0.40), 0 2px 6px rgba(0, 0, 0, 0.16);
    transform: translateY(-1px);
}

/* 7. 间距优化：次级体质卡 + 底部导航 active 色跟随主色 */
.constitution-banner { padding: 16px 18px; }
.bnav-item.active { color: var(--primary-color); }

/* 8. 移动端 Hero 留白回收 */
@media (max-width: 768px) {
    .ai-diagnosis-banner { padding: 1.5rem 1.35rem; }
}


/* [v1.24-a11y] prefers-reduced-motion: v1.24 hover anim off */
@media (prefers-reduced-motion: reduce) {
    .ai-diagnosis-banner:hover .banner-arrow {
        transform: none;
        transition: none;
    }
    .btn-primary:hover {
        transform: none;
    }
}


/* [v1.24-form-focus] 恢复表单键盘焦点指示器 */
/* 根因: line~681 .form-group input:focus{outline:none} 特异性(0,2,1)压过全局:focus-visible */
/* 修法: 同特异性追加到文件末尾，层叠顺序获胜；仅影响键盘导航，不改鼠标体验 */
.form-group input:focus-visible,
.form-group textarea:focus-visible,
.form-group select:focus-visible {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}


/* ===================================================================
   [v1.25-hig] Apple HIG 高级感表单重设计
   原则: 卡片分组 · 无边框输入 · 44pt触控 · 层次标签 · 醒目CTA
   =================================================================== */

/* 1. Section 标题升级 */
.input-section .section-header h2 {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.4px;
    line-height: 1.2;
}
.input-section .section-header .subtitle {
    font-size: 13px;
    opacity: 0.65;
    margin-top: 3px;
    line-height: 1.4;
}
.privacy-badge {
    display: inline-flex !important;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 500;
    color: var(--primary-color);
    background: rgba(44,95,45,0.07) !important;
    border-radius: 20px !important;
    padding: 4px 10px !important;
    margin-top: 10px;
    border: 1px solid rgba(44,95,45,0.15) !important;
    width: fit-content;
}

/* 2. 表单 - 纵向卡片堆叠 */
.patient-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* 3. 基本信息横排 - 整体卡片 */
.patient-form .form-row {
    background: var(--card-bg, #fff) !important;
    border-radius: 16px !important;
    box-shadow: 0 1px 10px rgba(0,0,0,0.07), 0 0 0 0.5px rgba(0,0,0,0.06) !important;
    overflow: hidden;
    gap: 0 !important;
    padding: 0 !important;
    flex-wrap: nowrap !important;
    margin: 0 !important;
}
.patient-form .form-row .form-group {
    background: transparent !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    padding: 14px 14px 12px !important;
    border-right: 0.5px solid rgba(0,0,0,0.08) !important;
    border-bottom: none !important;
    margin: 0 !important;
}
.patient-form .form-row .form-group:last-child {
    border-right: none !important;
}

/* 4. 独立 form-group - 卡片 */
.patient-form > .form-group {
    background: var(--card-bg, #fff) !important;
    border-radius: 16px !important;
    padding: 16px !important;
    box-shadow: 0 1px 10px rgba(0,0,0,0.07), 0 0 0 0.5px rgba(0,0,0,0.06) !important;
    margin: 0 !important;
    border: none !important;
}

/* 5. 标签 - 小号大写强调色 */
.patient-form label {
    font-size: 11px !important;
    font-weight: 600 !important;
    letter-spacing: 0.45px !important;
    text-transform: uppercase !important;
    color: var(--primary-color) !important;
    opacity: 1 !important;
    margin-bottom: 7px !important;
    display: flex !important;
    align-items: center;
    gap: 4px;
    line-height: 1;
}
.patient-form .label-icon {
    opacity: 0.65;
    display: flex;
    align-items: center;
}

/* 6. 文本/数字输入 - 无边框透明 */
.patient-form input[type="text"],
.patient-form input[type="number"],
.patient-form input[inputmode="numeric"] {
    border: none !important;
    background: transparent !important;
    padding: 2px 0 !important;
    font-size: 16px !important;
    min-height: 30px !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    color: var(--text-primary);
    font-weight: 400;
    -webkit-appearance: none;
}
.patient-form select {
    border: none !important;
    background: transparent !important;
    padding: 2px 0 !important;
    font-size: 15px !important;
    min-height: 30px !important;
    box-shadow: none !important;
    border-radius: 6px !important;
    color: var(--text-primary);
    font-weight: 500;
    width: 100%;
}

/* 7. Textarea - 浅底圆角 */
.patient-form textarea {
    border: none !important;
    background: rgba(0,0,0,0.025) !important;
    border-radius: 10px !important;
    padding: 10px 12px !important;
    font-size: 15px !important;
    line-height: 1.55 !important;
    resize: vertical;
    min-height: 80px;
    margin-top: 8px;
    box-shadow: none !important;
    color: var(--text-primary);
    width: 100%;
    box-sizing: border-box;
    transition: background 0.18s;
    font-family: inherit;
}
.patient-form textarea:focus {
    background: rgba(0,0,0,0.04) !important;
    outline: none !important;
    box-shadow: none !important;
}
.patient-form input:focus {
    outline: none !important;
    box-shadow: none !important;
}

/* 8. Form hint & char count */
.patient-form .form-hint {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 5px;
    opacity: 0.75;
    line-height: 1.4;
}
.patient-form .char-count {
    font-size: 11px;
    color: var(--text-secondary);
    opacity: 0.5;
    font-feature-settings: "tnum";
    white-space: nowrap;
}

/* 9. 快捷标签区 - 浅底容器 + pill chips */
.quick-tags {
    background: rgba(0,0,0,0.025) !important;
    border-radius: 12px !important;
    padding: 12px !important;
    margin: 10px 0 4px !important;
}
.tag-group {
    margin-bottom: 9px !important;
}
.tag-group:last-child {
    margin-bottom: 0 !important;
}
.tag-group-label {
    font-size: 10px !important;
    font-weight: 700 !important;
    letter-spacing: 0.6px !important;
    text-transform: uppercase !important;
    color: var(--primary-color) !important;
    margin-bottom: 7px !important;
    display: block !important;
    opacity: 0.7;
}
.tag-chip {
    display: inline-flex !important;
    align-items: center;
    padding: 5px 13px !important;
    border-radius: 100px !important;
    border: 1.5px solid rgba(0,0,0,0.1) !important;
    background: #fff !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    color: var(--text-primary) !important;
    cursor: pointer !important;
    margin: 0 4px 5px 0 !important;
    min-height: 30px !important;
    line-height: 1 !important;
    transition: all 0.15s ease !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05) !important;
}
.tag-chip[aria-pressed="true"] {
    background: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    color: #fff !important;
    box-shadow: 0 2px 8px rgba(44,95,45,0.28) !important;
}

/* 10. 语音输入按钮 - pill outlined */
.voice-input-btn {
    display: inline-flex !important;
    align-items: center;
    gap: 6px;
    padding: 6px 14px !important;
    border-radius: 100px !important;
    border: 1.5px solid rgba(44,95,45,0.22) !important;
    background: rgba(44,95,45,0.05) !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    color: var(--primary-color) !important;
    cursor: pointer !important;
    min-height: 32px !important;
    margin-bottom: 8px;
    transition: all 0.15s;
    box-shadow: none !important;
}
.voice-input-btn.recording {
    background: rgba(220,38,38,0.08) !important;
    border-color: rgba(220,38,38,0.3) !important;
    color: #dc2626 !important;
}

/* 11. 更多信息折叠 - 卡片 */
.more-info {
    background: var(--card-bg, #fff) !important;
    border-radius: 16px !important;
    overflow: hidden;
    box-shadow: 0 1px 10px rgba(0,0,0,0.07), 0 0 0 0.5px rgba(0,0,0,0.06) !important;
    border: none !important;
}
.more-info > summary {
    padding: 15px 16px !important;
    font-size: 15px;
    font-weight: 500;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
    list-style: none;
}
.more-info > summary::-webkit-details-marker { display: none; }
.more-info-body {
    padding: 4px 16px 16px !important;
    border-top: 0.5px solid rgba(0,0,0,0.07);
}
.more-info-body .form-group {
    box-shadow: none !important;
    background: transparent !important;
    padding: 8px 0 !important;
    border: none !important;
}

/* 12. 操作区 - 纵向全宽 */
.form-actions {
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
    padding: 0 !important;
    margin-top: 4px !important;
}

/* 主提交按钮 - Apple 主操作风格 */
.form-actions .btn-primary,
.form-actions #submitBtn,
#patientForm .btn-primary {
    width: 100% !important;
    min-height: 54px !important;
    height: auto !important;
    border-radius: 14px !important;
    font-size: 17px !important;
    font-weight: 600 !important;
    letter-spacing: -0.2px !important;
    padding: 0 24px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    background: linear-gradient(155deg, #2e6e31 0%, #1a4a1d 100%) !important;
    color: #fff !important;
    border: none !important;
    box-shadow: 0 6px 20px rgba(30,90,35,0.38), 0 2px 6px rgba(0,0,0,0.12) !important;
    transition: transform 0.12s ease, box-shadow 0.12s ease !important;
    cursor: pointer;
}
.form-actions .btn-primary:hover,
.form-actions #submitBtn:hover,
#patientForm .btn-primary:hover {
    transform: translateY(-1px) !important;
    box-shadow: 0 8px 26px rgba(30,90,35,0.42), 0 3px 8px rgba(0,0,0,0.14) !important;
}
.form-actions .btn-primary:active,
.form-actions #submitBtn:active,
#patientForm .btn-primary:active {
    transform: scale(0.98) !important;
    box-shadow: 0 3px 10px rgba(30,90,35,0.28) !important;
}

/* 重置按钮 - 轻量描边 */
.form-actions .btn-secondary,
.form-actions button[type="reset"],
#patientForm .btn-secondary {
    width: 100% !important;
    min-height: 46px !important;
    border-radius: 12px !important;
    font-size: 15px !important;
    font-weight: 500 !important;
    color: var(--text-secondary, #666) !important;
    background: transparent !important;
    border: 1.5px solid rgba(0,0,0,0.1) !important;
    box-shadow: none !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    cursor: pointer;
    transition: background 0.15s !important;
}
.form-actions .btn-secondary:hover,
.form-actions button[type="reset"]:hover {
    background: rgba(0,0,0,0.03) !important;
}

/* 13. 暗色模式适配 */
[data-theme="dark"] .patient-form .form-row,
[data-theme="dark"] .patient-form > .form-group,
[data-theme="dark"] .more-info {
    box-shadow: 0 1px 10px rgba(0,0,0,0.4), 0 0 0 0.5px rgba(255,255,255,0.07) !important;
}
[data-theme="dark"] .patient-form .form-row .form-group {
    border-right-color: rgba(255,255,255,0.07) !important;
}
[data-theme="dark"] .patient-form textarea {
    background: rgba(255,255,255,0.04) !important;
    color: var(--text-primary);
}
[data-theme="dark"] .patient-form textarea:focus {
    background: rgba(255,255,255,0.07) !important;
}
[data-theme="dark"] .quick-tags {
    background: rgba(255,255,255,0.03) !important;
}
[data-theme="dark"] .tag-chip {
    background: rgba(255,255,255,0.06) !important;
    border-color: rgba(255,255,255,0.12) !important;
    color: var(--text-primary) !important;
}
[data-theme="dark"] .more-info-body {
    border-top-color: rgba(255,255,255,0.07) !important;
}
[data-theme="dark"] .privacy-badge {
    background: rgba(44,95,45,0.18) !important;
    border-color: rgba(44,95,45,0.32) !important;
}
[data-theme="dark"] .form-actions .btn-secondary,
[data-theme="dark"] .form-actions button[type="reset"] {
    border-color: rgba(255,255,255,0.12) !important;
    color: var(--text-secondary) !important;
}


/* ===================================================================
   [v1.26-desktop] Desktop two-column layout
   860px+: left=form, right=wellness-tools, hero/progress=full-width
   =================================================================== */

@media (min-width: 860px) {

/* 1. Main container: two-column grid */
.main-content {
    padding: 0 24px 32px !important;
}
.main-content .container {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    grid-template-areas:
        "banner  banner"
        "form    tools"
        "prog    prog" !important;
    column-gap: 20px !important;
    row-gap: 0 !important;
    align-items: start !important;
    max-width: 1160px !important;
    margin: 0 auto !important;
}

/* 2. Grid area assignments */
.ai-diagnosis-banner {
    grid-area: banner !important;
    margin-top: 16px !important;
    border-radius: 16px !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden;
}
.input-section {
    grid-area: form !important;
    padding-top: 20px !important;
}
.wellness-tools-divider {
    display: none !important;
}
.wellness-tools-zone {
    grid-area: tools !important;
    padding-top: 20px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
}
.progress-section {
    grid-area: prog !important;
}

/* 3. Hero banner: desktop layout */
.ai-diagnosis-banner .banner-content {
    display: flex !important;
    align-items: center !important;
    gap: 16px !important;
    padding: 22px 28px 20px !important;
}
.ai-diagnosis-banner .banner-text h2 {
    font-size: 22px !important;
    font-weight: 700 !important;
    letter-spacing: -0.5px !important;
    line-height: 1.15 !important;
    margin-bottom: 6px !important;
}
.ai-diagnosis-banner .banner-text p {
    font-size: 12px !important;
    line-height: 1.6 !important;
    opacity: 0.65 !important;
}
.ai-diagnosis-banner .banner-icon {
    width: 52px !important;
    height: 52px !important;
    border-radius: 14px !important;
    flex-shrink: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}
.ai-diagnosis-banner .banner-arrow {
    margin-left: auto;
    flex-shrink: 0;
}

/* 4. Hero stats bar (HTML injected by patch_desktop_v126_html.py) */
.hero-stats-bar {
    display: flex !important;
    border-top: 0.5px solid rgba(255,255,255,0.08) !important;
}
.hero-stat {
    flex: 1 !important;
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    padding: 11px 20px !important;
    border-right: 0.5px solid rgba(255,255,255,0.07) !important;
}
.hero-stat:last-child {
    border-right: none !important;
}
.hero-stat-icon {
    width: 28px !important;
    height: 28px !important;
    border-radius: 8px !important;
    background: rgba(255,255,255,0.07) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0;
}
.hero-stat-val {
    font-size: 15px !important;
    font-weight: 700 !important;
    color: #fff !important;
    letter-spacing: -0.3px !important;
    line-height: 1.2 !important;
}
.hero-stat-lbl {
    font-size: 10px !important;
    color: rgba(255,255,255,0.45) !important;
    margin-top: 1px !important;
}

/* 5. Left col: form area */
.input-section .section-header {
    margin-bottom: 14px !important;
}
.input-section .section-header h2 {
    font-size: 15px !important;
    font-weight: 600 !important;
    letter-spacing: -0.2px !important;
}
.patient-form {
    gap: 10px !important;
}

/* 6. Right col: wellness tools */
.wellness-tools-zone .wuxing-heading {
    font-size: 14px !important;
    font-weight: 600 !important;
    letter-spacing: -0.2px !important;
}
.constitution-banner {
    border-radius: 14px !important;
}
.seasonal-tip {
    border-radius: 14px !important;
}
/* Quick links: 4-col -> 3-col in sidebar */
.wellness-tools-zone div[style*="grid-template-columns:repeat(4,1fr)"],
.wellness-tools-zone div[style*="grid-template-columns: repeat(4, 1fr)"] {
    grid-template-columns: repeat(3, 1fr) !important;
}

/* 7. Navbar desktop */
.navbar .container {
    max-width: 1160px !important;
    margin: 0 auto !important;
    padding: 0 24px !important;
}
.nav-link {
    font-size: 12px !important;
    padding: 5px 10px !important;
    border-radius: 8px !important;
    transition: background 0.15s !important;
}
.status-badge {
    font-size: 11px !important;
    padding: 4px 12px !important;
    border-radius: 100px !important;
}

} /* end @media 860px */

/* Max-width center on very wide screens */
@media (min-width: 1280px) {
.main-content {
    padding-left: max(24px, calc(50% - 560px)) !important;
    padding-right: max(24px, calc(50% - 560px)) !important;
}
}


/* ===================================================================
   [v1.27-wqwq] 望闻问切四诊Tab + 本店服务 + 全球健康前沿
   =================================================================== */

/* --- 望闻问切 Tab 导航 --- */
.sizu-tabs {
    display: flex;
    gap: 6px;
    margin: 8px 0 10px;
    flex-wrap: wrap;
}
.sizu-tab {
    padding: 6px 15px;
    border-radius: 100px;
    border: 1.5px solid rgba(44,95,45,0.18);
    background: transparent;
    font-size: 12px;
    font-weight: 600;
    color: var(--primary-color, #2c5f2d);
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
    min-height: 32px;
    line-height: 1;
}
.sizu-tab:hover { background: rgba(44,95,45,0.05); }
.sizu-tab.active {
    background: var(--primary-color, #2c5f2d) !important;
    color: #fff !important;
    border-color: var(--primary-color, #2c5f2d) !important;
}
.sizu-panel { display: none; }
.sizu-panel.active { display: block; }
:root[data-theme="dark"] .sizu-tab {
    border-color: rgba(74,140,78,0.28);
    color: var(--primary-color);
}
:root[data-theme="dark"] .sizu-tab:hover { background: rgba(74,140,78,0.1); }

/* --- 本店服务推荐侧边卡片 --- */
.store-services-sidebar {
    background: var(--card-bg);
    border-radius: 14px;
    box-shadow: 0 1px 8px rgba(0,0,0,0.06), 0 0 0 0.5px rgba(0,0,0,0.05);
    overflow: hidden;
    margin-bottom: 10px;
}
:root[data-theme="dark"] .store-services-sidebar {
    box-shadow: 0 1px 10px rgba(0,0,0,0.4), 0 0 0 0.5px rgba(255,255,255,0.06);
}
.store-svc-hd {
    padding: 11px 14px 9px;
    border-bottom: 0.5px solid rgba(0,0,0,0.06);
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-primary);
}
:root[data-theme="dark"] .store-svc-hd { border-bottom-color: rgba(255,255,255,0.07); }
.store-svc-hd-icon {
    width: 22px;
    height: 22px;
    border-radius: 7px;
    background: rgba(44,95,45,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
}
.store-category-block { padding: 8px 14px; border-bottom: 0.5px solid rgba(0,0,0,0.04); }
.store-category-block:last-child { border-bottom: none; }
:root[data-theme="dark"] .store-category-block { border-bottom-color: rgba(255,255,255,0.05); }
.store-cat-lbl {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.45px;
    text-transform: uppercase;
    color: var(--primary-color);
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 5px;
}
.store-cat-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.6;
    flex-shrink: 0;
}
.store-service-row {
    display: flex;
    align-items: center;
    padding: 4px 0;
    font-size: 12px;
    color: var(--text-primary);
}
.store-service-row + .store-service-row { border-top: 0.5px solid rgba(0,0,0,0.04); }
:root[data-theme="dark"] .store-service-row + .store-service-row { border-top-color: rgba(255,255,255,0.05); }
.store-svc-name { flex: 1; }
.store-svc-dur { font-size: 10.5px; color: var(--text-secondary); margin: 0 8px; }
.store-svc-price { font-size: 11.5px; color: #c48940; font-weight: 600; font-feature-settings: "tnum"; }

/* --- 全球健康前沿 --- */
.global-wellness-section { margin-top: 4px; }
.global-wellness-hd {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.3px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.global-wellness-hd::after {
    content: '';
    flex: 1;
    height: 0.5px;
    background: rgba(0,0,0,0.08);
}
:root[data-theme="dark"] .global-wellness-hd::after { background: rgba(255,255,255,0.08); }
.gwcard {
    background: var(--card-bg);
    border-radius: 11px;
    box-shadow: 0 1px 5px rgba(0,0,0,0.05), 0 0 0 0.5px rgba(0,0,0,0.04);
    padding: 9px 11px;
    display: flex;
    gap: 9px;
    align-items: flex-start;
    margin-bottom: 7px;
    transition: transform 0.15s;
}
.gwcard:hover { transform: translateY(-1px); }
.gwcard:last-child { margin-bottom: 0; }
:root[data-theme="dark"] .gwcard {
    box-shadow: 0 1px 8px rgba(0,0,0,0.35), 0 0 0 0.5px rgba(255,255,255,0.06);
}
.gwcard-icon {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 15px;
}
.gwcard-body { flex: 1; min-width: 0; }
.gwcard-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}
.gwcard-new {
    font-size: 9px;
    font-weight: 700;
    color: #fff;
    background: #dc2626;
    padding: 1px 6px;
    border-radius: 100px;
    letter-spacing: 0.2px;
}
.gwcard-desc {
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.45;
}

/* ===== [v1.30] 3-step wizard ===== */
.wz-bar{display:flex;align-items:center;justify-content:center;gap:0;margin:0 0 18px;padding-top:14px;}
.wz-step{display:flex;flex-direction:column;align-items:center;gap:4px;cursor:default;user-select:none;}
.wz-dot{width:28px;height:28px;border-radius:50%;background:var(--border-color,#e2e8f0);color:var(--text-secondary,#94a3b8);font-size:13px;font-weight:700;display:flex;align-items:center;justify-content:center;transition:background .25s,color .25s,box-shadow .25s;}
.wz-step.wz-active .wz-dot{background:var(--primary-color,#0f4c5c);color:#fff;box-shadow:0 0 0 4px rgba(15,76,92,.13);}
.wz-step.wz-done .wz-dot{background:#16a34a;color:#fff;}
.wz-step .wz-label{font-size:11px;color:var(--text-secondary,#94a3b8);transition:color .25s;white-space:nowrap;}
.wz-step.wz-active .wz-label{color:var(--primary-color,#0f4c5c);font-weight:600;}
.wz-step.wz-done .wz-label{color:#16a34a;}
.wz-line{flex:1;height:2px;background:var(--border-color,#e2e8f0);max-width:48px;min-width:20px;margin:0 6px 14px;transition:background .25s;}
.wz-wrap{display:none;}
.wz-wrap.wz-active{display:block;}
.wz-nav{display:flex;gap:10px;margin-top:16px;}
.wz-btn-next{flex:1;padding:11px 16px;border:none;border-radius:9px;font-size:14px;font-weight:600;cursor:pointer;background:var(--primary-color,#0f4c5c);color:#fff;display:flex;align-items:center;justify-content:center;gap:6px;transition:opacity .18s;}
.wz-btn-next:hover{opacity:.85;}
.wz-btn-prev{padding:11px 14px;border:1.5px solid var(--border-color,#e2e8f0);border-radius:9px;font-size:14px;font-weight:600;cursor:pointer;background:var(--card-bg,#fff);color:var(--text-secondary,#64748b);transition:background .18s;}
.wz-btn-prev:hover{background:var(--primary-bg-light,#f0f9f0);}
.wz-summary{background:var(--primary-bg-light,#f0f9f0);border:1.5px solid rgba(15,76,92,.12);border-radius:12px;padding:14px 16px;margin-bottom:14px;}
.wz-summary-title{font-size:12px;font-weight:700;color:var(--primary-color,#0f4c5c);margin-bottom:8px;text-transform:uppercase;letter-spacing:.04em;}
.wz-summary-row{display:flex;gap:8px;padding:5px 0;border-bottom:1px solid rgba(15,76,92,.07);}
.wz-summary-row:last-child{border-bottom:none;}
.wz-sk{font-weight:600;color:var(--text-primary,#1e293b);flex-shrink:0;width:48px;font-size:13px;}
.wz-sv{color:var(--text-secondary,#64748b);font-size:13px;word-break:break-all;overflow:hidden;max-height:2.8em;text-overflow:ellipsis;}
/* hide reset button inside wizard step 3 */
#wz-3 .btn-secondary{display:none;}
/* ===== end v1.30 ===== */

/* ===== [v1.34] iOS 手机端深度优化 ===== */
/* 1. 防横屏/系统字体自动放大 */
html{-webkit-text-size-adjust:100%;text-size-adjust:100%;}

/* 2. select 自定义下拉箭头（-webkit-appearance:none 后补回视觉指示器） */
.form-group select{
  background-image:url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='12'%20height='12'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='%2394a3b8'%20stroke-width='2.5'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpolyline%20points='6%209%2012%2015%2018%209'/%3E%3C/svg%3E");
  background-repeat:no-repeat;
  background-position:right 1rem center;
  background-size:12px;
  padding-right:2.6rem;
}

/* 3. 全站可点击元素：去点击高亮 + 消除 300ms 双击延迟 */
button,a,[role="button"],.tag-chip,.sizu-tab,.btn,.nav-link,
.wz-btn-next,.wz-btn-prev,.action-btn,.rec-btn,.constitution-banner{
  -webkit-tap-highlight-color:transparent;
  touch-action:manipulation;
}

/* 4. UI chrome 禁长按弹菜单/误选（正文/输入区不受影响，仍可复制） */
.navbar,.bottom-nav,.wz-bar,.sizu-tabs,.tag-chip,.rec-avatar,
.wz-btn-next,.wz-btn-prev,.action-btn,.rec-btn,.btn,.nav-link{
  -webkit-touch-callout:none;
  -webkit-user-select:none;
  user-select:none;
}

/* 5. 触摸设备专属（手机/平板）：44pt 触摸目标 + 按压回弹反馈 */
@media (hover:none) and (pointer:coarse){
  .wz-btn-next,.wz-btn-prev{min-height:48px;}
  .rec-btn,.action-btn,.sizu-tab{min-height:44px;}
  .wz-btn-next:active,.wz-btn-prev:active,.btn:active,
  .rec-btn:active,.action-btn:active,.tag-chip:active,
  .constitution-banner:active{transform:scale(.97);}
}
@media (prefers-reduced-motion:reduce){
  .wz-btn-next:active,.wz-btn-prev:active,.btn:active,
  .rec-btn:active,.action-btn:active,.tag-chip:active,
  .constitution-banner:active{transform:none;}
}
/* ===== end v1.34 ===== */
/* v1.34-iosdeep marker */

/* ===== [v1.35-wzanim] wizard 切步淡入 ===== */
.wz-wrap.wz-active{animation:wzFadeIn .3s cubic-bezier(.16,1,.3,1);}
@keyframes wzFadeIn{from{opacity:0;transform:translateY(10px);}to{opacity:1;transform:translateY(0);}}
@media (prefers-reduced-motion:reduce){.wz-wrap.wz-active{animation:none;}}
/* ===== end v1.35-wzanim ===== */
