/* ============================================================
   喂了吗 · 主题系统 + 视觉增强 (theme.css v2)
   ------------------------------------------------------------
   设计原则：
   1. 不修改 app.css 的布局/尺寸/class 名 —— 只做颜色与动效覆盖
   2. 颜色全部走 CSS 变量，4 套主题通过 <html data-theme="..."> 切换
   3. 动效通过 <html data-motion="off"> 一键关闭
   4. 删除本文件界面回到"基础可用"，不影响功能
   ============================================================ */

/* ============================================================
   一、主题变量（4 套色板）
   ============================================================ */
:root,
html[data-theme="indigo"] {
    /* 品牌主色 */
    --brand: #6366f1;
    --brand-2: #4f46e5;
    --brand-deep: #4338ca;
    --brand-grad: linear-gradient(135deg, #6366f1, #4f46e5);
    --brand-soft: #eef2ff;      /* 主色浅底（选中态） */
    --brand-softer: #e0e7ff;
    --brand-glow: rgba(99, 102, 241, 0.32);
    --welcome-2: #f0f9ff;       /* 欢迎卡渐变的另一端（淡紫 → 淡蓝，旧版就是这个） */

    /* 主题色（theme-color meta 用） */
    --theme-color: #6366f1;

    /* 中性色 */
    --bg-page: #f5f7fb;
    --text-strong: #111827;
    --text-body: #374151;
    --text-muted: #6b7280;
    --text-faint: #9ca3af;
    --border: #e5e7eb;
    --border-soft: #eef0f5;

    /* 语义色 */
    --success: #22c55e;
    --success-2: #16a34a;
    --warning: #f59e0b;
    --danger: #dc2626;
}

/* 深色（夜色）：Apple 系统蓝 #0A84FF + 中性深灰，2026-11-06 依用户选的效果图配色加入 */
html[data-theme="dark"] {
    --brand: #0a84ff;
    --brand-2: #409cff;
    --brand-deep: #0060df;
    --brand-grad: linear-gradient(135deg, #0a84ff, #409cff);
    --brand-soft: rgba(10, 132, 255, .15);
    --brand-softer: rgba(10, 132, 255, .26);
    --brand-glow: rgba(10, 132, 255, .24);
    --welcome-2: #1c2530;
    --theme-color: #16181d;
    --bg-page: #16181d;
    --text-strong: #f5f5f7;
    --text-body: #c7c9ce;
    --text-muted: #92959c;
    --text-faint: #6e7076;
    --border: rgba(255, 255, 255, .12);
    --border-soft: rgba(255, 255, 255, .07);
    --success: #30d158;
    --success-2: #248a3d;
    --warning: #ffd60a;
    --danger: #ff453a;

    /* 三层表面令牌：布局底 / 容器面 / 输入面 / 控件面。
       基础层里有若干写死 #fff 的表面，靠这四个令牌统一收口，不再逐页打补丁。 */
    --wm-surface: #202228;        /* 卡片、设置项、侧栏、弹窗内容 */
    --wm-surface-hover: #25272e;  /* 悬停态 */
    --wm-surface-2: #262930;      /* 输入框、未选中标签 */
    --wm-surface-3: #2a2c33;      /* 默认按钮、抬升控件 */
}

/* 粉色（粉 + 白） */
html[data-theme="pink"] {
    --brand: #ec4899;
    --brand-2: #db2777;
    --brand-deep: #be185d;
    --brand-grad: linear-gradient(135deg, #ec4899, #db2777);
    --brand-soft: #fdf2f8;
    --brand-softer: #fce7f3;
    --brand-glow: rgba(236, 72, 153, 0.32);
    --welcome-2: #fdf4ff;       /* 粉 → 淡紫粉 */
    --theme-color: #ec4899;
}

/* 绿色（自然系，贴合龟主题） */
html[data-theme="green"] {
    --brand: #10b981;
    --brand-2: #059669;
    --brand-deep: #047857;
    --brand-grad: linear-gradient(135deg, #10b981, #059669);
    --brand-soft: #ecfdf5;
    --brand-softer: #d1fae5;
    --brand-glow: rgba(16, 185, 129, 0.32);
    --welcome-2: #ecfeff;       /* 绿 → 淡青 */
    --theme-color: #10b981;
}

/* 黄色（黄 + 黑，高对比硬朗） */
html[data-theme="yellow"] {
    --brand: #f59e0b;
    --brand-2: #d97706;
    --brand-deep: #b45309;
    --brand-grad: linear-gradient(135deg, #f59e0b, #d97706);
    --brand-soft: #fffbeb;
    --brand-softer: #fef3c7;
    --brand-glow: rgba(245, 158, 11, 0.32);
    --welcome-2: #fff7ed;       /* 黄 → 淡橙，避免配淡蓝发灰 */
    --theme-color: #f59e0b;
    /* 黄黑主题：文字压黑，页面底更暖 */
    --text-strong: #1a1a1a;
    --text-body: #262626;
}

/* ============================================================
   二、全局：高级灰底 + 主题色光晕
   ============================================================ */
body {
    background:
        radial-gradient(1200px 600px at 10% -10%, var(--brand-soft) 0%, transparent 55%),
        radial-gradient(1000px 500px at 100% 0%, var(--brand-soft) 0%, transparent 50%),
        var(--bg-page);
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    color: var(--text-body);
    transition: background 0.4s ease;
}

/* ============================================================
   三、顶部导航：分段控件（Segmented，大厂规范）
   ============================================================ */
.top-nav {
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid var(--brand-soft);
    box-shadow: 0 4px 20px rgba(17, 24, 39, 0.05);
    /* PWA / 独立窗口：顶栏自己盖住状态栏区域，颜色与页面连成一体，
       不再让浏览器用一块品牌色把顶部和正文割开 */
    padding-top: calc(12px + env(safe-area-inset-top, 0px));
}
/* 4 个按钮紧贴成一个整体分段控件：外层浅灰内衬，选中项是主色浅底 + 主色字 */
.nav-btn {
    background: transparent;
    color: #6b7280;
    transition: background 0.2s ease, color 0.2s ease;
}
.nav-btn:hover { background: rgba(17, 24, 39, 0.05); color: #374151; }
.nav-btn.active {
    background: var(--brand-soft);
    color: var(--brand);
    box-shadow: inset 0 0 0 1px var(--brand-softer);
}

/* ============================================================
   四、卡片：细腻阴影 + 悬停浮起
   ============================================================ */
.card {
    border: 1px solid rgba(17, 24, 39, 0.04);
    box-shadow: 0 1px 2px rgba(17, 24, 39, 0.03), 0 8px 24px rgba(17, 24, 39, 0.05);
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}
.card:hover {
    box-shadow: 0 2px 4px rgba(17, 24, 39, 0.04), 0 14px 38px rgba(17, 24, 39, 0.08);
}
.card-title {
    position: relative;
    padding-left: 12px;
    color: var(--text-strong);
}
.card-title::before {
    content: "";
    position: absolute;
    left: 0; top: 50%;
    transform: translateY(-50%);
    width: 4px; height: 16px;
    border-radius: 2px;
    background: var(--brand-grad);
}
.section-head { color: var(--text-body); border-top-color: var(--border-soft); }
.section-head::before { background: var(--brand-softer); }

/* ============================================================
   五、欢迎卡：渐变 + 光晕
   ============================================================ */
.welcome-card {
    /* 沿用旧版配色：淡紫 → 淡蓝的柔和过渡，两端都是淡色。
       曾经中间写成 #ffffff 58%，浅底上会明显发白、把卡片切成两半，已改回。 */
    background: linear-gradient(135deg, var(--brand-soft) 0%, var(--welcome-2, #f0f9ff) 100%);
    box-shadow: 0 10px 30px var(--brand-glow), inset 0 1px 0 rgba(255, 255, 255, .9);
    position: relative;
    overflow: hidden;
    /* 压住探头龟的下半身：龟在卡片后面，只有上半截露在卡片上沿 */
    z-index: 1;
}
.welcome-card::after {
    content: "";
    position: absolute;
    right: -40px; top: -60px;
    width: 200px; height: 200px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--brand-glow), transparent 70%);
    pointer-events: none;
}
.welcome-text h2 { color: var(--text-strong); letter-spacing: -0.2px; }
.welcome-text p { color: var(--brand); }
.wc-eyebrow { color: var(--text-muted); }

/* ============================================================
   六、统计卡：数字里程表 + 按压反馈
   ============================================================ */
.stat-card {
    border: 1px solid rgba(17, 24, 39, 0.04);
    box-shadow: 0 1px 2px rgba(17, 24, 39, 0.03), 0 6px 18px rgba(17, 24, 39, 0.05);
    transition: all 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}
.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px var(--brand-glow);
    border-color: var(--brand-softer);
}
/* 触屏按压反馈（珍珠玻璃：按下 scale，松开回弹） */
.stat-card:active { transform: scale(0.955); transition-duration: 0.14s; }
.stat-num {
    background: var(--brand-grad);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
    font-variant-numeric: tabular-nums;
}

/* ============================================================
   七、按钮：按压分通道
   ============================================================ */
.btn, .btn-small { transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1); }
.btn-primary { background: var(--brand-grad); box-shadow: 0 4px 14px var(--brand-glow); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 22px var(--brand-glow); }
.btn-primary:active { transform: translateY(0) scale(0.97); }
.btn-default { color: var(--text-body); }
.btn-default:hover { background: var(--brand-soft); transform: translateY(-1px); }
.btn-danger:hover { background: #fecaca; }
.btn-small.primary { background: var(--brand-soft); color: var(--brand-deep); }
.btn-small.primary:hover { background: var(--brand-softer); }
.btn-small.danger:hover { background: #fecaca; }
/* 幽灵按钮（次要/查看类操作，弱化不抢主操作）：透明底 + 细边框 + 灰字 */
.btn-small.ghost {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid rgba(17, 24, 39, 0.1);
    padding: 5px 10px;
}
.btn-small.ghost:hover { background: rgba(17, 24, 39, 0.04); color: var(--text-strong); border-color: rgba(17, 24, 39, 0.18); }
.btn-small.ghost:active { transform: scale(0.96); }
/* 危险操作弱化（退出登录）：浅红描边 + 红字，不填充色块 */
.btn-small.danger-outline {
    background: transparent;
    color: #dc2626;
    border: 1px solid rgba(220, 38, 38, 0.28);
    padding: 5px 10px;
}
.btn-small.danger-outline:hover { background: #fee2e2; border-color: rgba(220, 38, 38, 0.45); }
.btn-small.danger-outline:active { transform: scale(0.96); }

/* ============================================================
   七B、账本「当前用户」卡片：用户行 + 四等分操作条（大厂规范）
   ============================================================ */
.user-head {
    display: flex; align-items: center; gap: 10px;
    font-size: 14px; color: var(--text-body);
}
.user-avatar {
    display: inline-flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; border-radius: 12px; font-size: 18px;
    background: var(--brand-soft); flex-shrink: 0;
    border: none; padding: 0; overflow: visible; cursor: pointer;
    position: relative; transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.user-avatar:active { transform: scale(0.92); }
.user-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 12px; }
/* 右下角小相机角标：提示这里可以换头像 */
.user-avatar::after {
    content: '📷'; position: absolute; right: -4px; bottom: -4px;
    width: 17px; height: 17px; border-radius: 50%;
    background: #fff; color: #4b5563; font-size: 9px; line-height: 17px; text-align: center;
    box-shadow: 0 1px 4px rgba(17, 24, 39, 0.28);
    pointer-events: none;
}
.user-name { display: inline-block; line-height: 1.4; min-width: 0; }
.user-name b { color: var(--text-strong); font-weight: 600; }
.user-avatar-tip { display: block; font-style: normal; font-size: 11px; color: var(--text-muted, #9ca3af); line-height: 1.35; }
/* 操作条图标：SVG 齿轮，尺寸跟随文字（视觉与"设置"二字等大） */
.ua-ico { width: 1.06em; height: 1.06em; margin-right: 4px; flex-shrink: 0; vertical-align: -0.14em; }
.user-actions {
    display: grid; grid-template-columns: repeat(4, 1fr);
    margin-top: 12px;
    border-top: 1px solid var(--line-soft, rgba(17, 24, 39, 0.06));
}
.user-action {
    padding: 10px 0; border: none; background: transparent; text-align: center;
    font-size: 13px; font-weight: 400; color: var(--brand);
    cursor: pointer; transition: background 0.2s ease, color 0.2s ease;
    position: relative; min-height: 40px;
    display: inline-flex; align-items: center; justify-content: center;
}
/* 首项左对齐、末项右对齐：文字与上方用户信息（头像/用户名）及卡片左右内边距对齐，
   中间两项居中，避免四段文字像浮在格子里 */
.user-action:first-child { justify-content: flex-start; }
.user-action:last-child { justify-content: flex-end; }
.user-action + .user-action::before {
    content: ''; position: absolute; left: 0; top: 25%; height: 50%;
    width: 1px; background: var(--line-soft, rgba(17, 24, 39, 0.08));
}
.user-action:hover { background: var(--brand-softer, rgba(99, 102, 241, 0.06)); }
.user-action:active { transform: scale(0.96); }
.user-action.danger { color: #dc2626; }
.user-action.danger:hover { background: #fef2f2; }

/* ============================================================
   七C、文字密集页面排版节奏（档案 / 繁育 / 医疗）
   ------------------------------------------------------------
   问题：信息行 12px + 4px 行距挤在一起，长配对串被塞进右半边反复折行。
   规范：正文 14px、说明 13px、行高 1.5~1.6，间距走 4px 网格，
        长文本一律独占一行，不与标题抢宽度。
   ============================================================ */
.card-title { line-height: 1.4; }
.record-item { padding: 14px 16px; margin-bottom: 12px; }
.record-item:hover { background: var(--brand-soft); }
.record-item-head { align-items: baseline; margin-bottom: 6px; }
.record-item-title { font-size: 14px; font-weight: 600; line-height: 1.5; color: var(--text-strong); }
.record-item-date {
    font-size: 12px; line-height: 1.5; color: var(--text-muted);
    font-variant-numeric: tabular-nums; flex-shrink: 0;
}
/* 配对关系独占一行：公 × 母，长名字不再挤在标题右侧折成两行 */
.record-pair {
    font-size: 13px; line-height: 1.6; color: var(--text-body);
    margin-bottom: 6px; word-break: break-word;
}
.record-item-info {
    font-size: 13px; line-height: 1.6; color: var(--text-body);
    gap: 6px 16px;
}
.record-item-info > div { line-height: 1.6; }
.record-item-actions { margin-top: 10px; }
/* 档案详情：字段标签与值同一基线，行距放宽 */
.character-info-grid { font-size: 13px; gap: 8px 20px; line-height: 1.6; }
.character-info-item label { color: var(--text-muted); font-weight: 400; }
.character-info-item span { font-weight: 600; color: var(--text-strong); }
/* 档案树：一行一只龟，行高统一，长名字省略而不是挤压箭头 */
.tree-label { line-height: 1.5; font-size: 13px; }
.section-head { font-size: 13px; line-height: 1.5; }
/* 手机端：长文本单列，避免半栏 6 个字的宽度反复折行 */
@media (max-width: 560px) {
    .record-item-info { grid-template-columns: 1fr; gap: 4px; }
    .record-item { padding: 12px 14px; }
}

/* ============================================================
   八、表单：聚焦反馈
   ============================================================ */
.form-input, .form-select, .search-input, .filter-select {
    transition: all 0.22s ease;
    color: var(--text-body);
}
.form-input:focus, .form-select:focus,
.search-input:focus, .filter-select:focus {
    border-color: var(--brand);
    background: #fff;
    box-shadow: 0 0 0 4px var(--brand-glow);
}
.form-label { color: var(--text-body); }

/* ============================================================
   九、待办项 & 记录项
   ============================================================ */
.task-item, .record-item {
    background: #fff;
    border: 1px solid var(--border-soft);
    transition: all 0.24s cubic-bezier(0.4, 0, 0.2, 1);
}
.task-item:hover, .record-item:hover {
    background: #fff;
    border-color: var(--brand-softer);
    box-shadow: 0 6px 18px var(--brand-glow);
    transform: translateY(-2px);
}
.task-item:has(.check-btn.finished) .task-name {
    text-decoration: line-through;
    color: var(--text-faint);
}
.check-btn { transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1); }
.check-btn:hover { border-color: var(--brand); transform: scale(1.12); }
.check-btn.finished {
    background: linear-gradient(135deg, var(--success), var(--success-2));
    border-color: var(--success-2);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.35);
    /* 打卡完成：弹簧回弹（珍珠玻璃「结」语态） */
    animation: checkPop 0.46s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes checkPop {
    0% { transform: scale(0.6); }
    60% { transform: scale(1.25); }
    100% { transform: scale(1); }
}

/* ============================================================
   十、侧栏 & 档案树
   ============================================================ */
.archive-sidebar {
    border: 1px solid rgba(17, 24, 39, 0.04);
    box-shadow: 0 1px 2px rgba(17, 24, 39, 0.03), 0 8px 24px rgba(17, 24, 39, 0.05);
}
.tree-label { transition: all 0.2s ease; color: var(--text-body); }
.tree-label:hover { background: var(--brand-soft); }
.tree-label.active {
    background: linear-gradient(90deg, var(--brand-soft), #fff);
    box-shadow: inset 0 0 0 1px var(--brand-softer);
    border-left-color: var(--brand);
    color: var(--brand-deep);
}

/* ============================================================
   十一、图片容器
   ============================================================ */
.character-main-img, .gallery-item {
    background: linear-gradient(135deg, #f3f4f6, #eef0f6);
    border: 1px solid rgba(17, 24, 39, 0.05);
    transition: all 0.26s ease;
}
.gallery-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 22px var(--brand-glow);
}
.img-upload-add { transition: all 0.24s ease; }
.img-upload-add:hover { color: var(--brand); border-color: var(--brand); background: var(--brand-soft); }

/* ============================================================
   十二、弹窗
   ============================================================ */
.modal-mask {
    background: rgba(17, 24, 39, 0.38);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.modal-mask.show .modal-box {
    animation: modalPop 0.28s cubic-bezier(0.34, 1.4, 0.64, 1);
}
@keyframes modalPop {
    from { opacity: 0; transform: translateY(14px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-box {
    border: 1px solid rgba(17, 24, 39, 0.05);
    box-shadow: 0 24px 60px rgba(17, 24, 39, 0.22);
}
.modal-title { color: var(--text-strong); }

/* ============================================================
   十三、Toast
   ============================================================ */
.toast {
    background: rgba(17, 24, 39, 0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 10px 30px rgba(17, 24, 39, 0.28);
}

/* ============================================================
   十四、底部导航：悬浮岛
   ============================================================ */
.bottom-nav { background: rgba(255, 255, 255, 0.9); backdrop-filter: blur(14px); }
.bottom-nav-item { transition: all 0.24s cubic-bezier(0.4, 0, 0.2, 1); color: var(--text-muted); }
.bottom-nav-item:hover { transform: translateY(-3px); color: var(--brand); }
.bottom-nav-item.active { color: var(--brand-2); font-weight: 600; }
.bottom-nav-item.active .icon { transform: scale(1.15); }
.bottom-nav-item .icon { transition: transform 0.24s ease; }
.bottom-nav-item:active { transform: scale(0.92); }

/* ============================================================
   十五、图表条：渐变 + 生长动画
   ============================================================ */
.chart-bar {
    background: linear-gradient(180deg, var(--brand-softer), var(--brand));
    box-shadow: 0 2px 8px var(--brand-glow);
    transition: height 0.5s ease;
    /* 生长动画：加载时从 0 长到目标高度（珍珠玻璃「放」语态） */
    animation: barGrow 0.6s cubic-bezier(0.34, 1.2, 0.64, 1);
    transform-origin: bottom;
}
@keyframes barGrow {
    from { transform: scaleY(0); }
    to   { transform: scaleY(1); }
}
.chart-bar:hover { filter: brightness(1.08); }

/* ============================================================
   十六、库存预警：语义色分级
   ============================================================ */
.stock-warning {
    background: #fef3c7;
    border-left: 4px solid var(--warning);
    box-shadow: 0 2px 10px rgba(245, 158, 11, 0.12);
    border-radius: 8px;
    color: var(--text-body);
}
.stock-warning.danger {
    background: #fee2e2;
    border-left-color: var(--danger);
}

/* ============================================================
   十七、滚动条
   ============================================================ */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--brand-softer); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--brand); }

/* ============================================================
   十八、设置页（新增）
   ============================================================ */
.setting-group { margin-bottom: 20px; }
.setting-group-title {
    font-size: 13px; font-weight: 600; color: var(--text-muted);
    margin-bottom: 10px; padding-left: 12px; position: relative;
}
.setting-group-title::before {
    content: ""; position: absolute; left: 0; top: 50%;
    transform: translateY(-50%);
    width: 3px; height: 13px; border-radius: 2px; background: var(--brand-grad);
}
.setting-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px; background: #fff; border-radius: 12px;
    border: 1px solid var(--border-soft);
    margin-bottom: 8px; gap: 12px;
}
.setting-item:active { transform: scale(0.99); }
.setting-item-label { font-size: 14px; color: var(--text-body); display: flex; align-items: center; gap: 8px; }
.setting-item-label .si-ico { font-size: 18px; }
.setting-item-desc { font-size: 12px; color: var(--text-faint); margin-top: 3px; }

/* 设置页头像缩略图：与首页头卡同一套「白环托形」逻辑，只是尺寸小一号 */
/* 主题色块选择器 */
.theme-swatches { display: flex; gap: 12px; }
.theme-swatch {
    width: 40px; height: 40px; border-radius: 50%;
    cursor: pointer; border: 3px solid transparent;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative; flex-shrink: 0;
}
.theme-swatch:active { transform: scale(0.88); }
.theme-swatch.active {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-soft);
    transform: scale(1.08);
}
.theme-swatch.indigo { background: linear-gradient(135deg, #6366f1, #4f46e5); }
.theme-swatch.pink   { background: linear-gradient(135deg, #ec4899, #db2777); }
.theme-swatch.green  { background: linear-gradient(135deg, #10b981, #059669); }
.theme-swatch.yellow { background: linear-gradient(135deg, #f59e0b, #d97706); }
.theme-swatch.dark   { background: linear-gradient(135deg, #202228 30%, #0a84ff 100%); }
.theme-swatch .check {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 18px; opacity: 0; transition: opacity 0.15s;
}
.theme-swatch.active .check { opacity: 1; }

/* 动效开关（iOS 风格 toggle） */
.switch {
    width: 48px; height: 28px; border-radius: 999px;
    background: #e5e7eb; position: relative; cursor: pointer;
    transition: background 0.25s; flex-shrink: 0;
}
.switch::after {
    content: ""; position: absolute; top: 3px; left: 3px;
    width: 22px; height: 22px; border-radius: 50%;
    background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    transition: transform 0.25s cubic-bezier(0.34, 1.4, 0.64, 1);
}
.switch.on { background: var(--brand); }
.switch.on::after { transform: translateX(20px); }

/* 捐赠二维码 */
.donate-grid { display: flex; gap: 16px; justify-content: center; }
.donate-card {
    flex: 1; max-width: 160px; text-align: center;
    background: #fff; border: 1px solid var(--border-soft);
    border-radius: 14px; padding: 14px 12px;
}
.donate-card img {
    width: 100%; aspect-ratio: 1; border-radius: 10px;
    object-fit: contain; background: #fafafa; margin-bottom: 8px;
}
.donate-card .donate-name { font-size: 13px; font-weight: 600; color: var(--text-body); }
.donate-card .donate-tip { font-size: 11px; color: var(--text-faint); margin-top: 3px; }

/* 捐赠按钮（打赏入口） */
.donate-btn {
    width: 100%; padding: 14px; border: none; border-radius: 14px;
    background: var(--brand-grad); color: #fff; font-size: 15px; font-weight: 600;
    cursor: pointer; box-shadow: 0 6px 18px var(--brand-glow);
    transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}
.donate-btn:hover { transform: translateY(-2px); box-shadow: 0 10px 26px var(--brand-glow); }
.donate-btn:active { transform: translateY(0) scale(0.97); }

/* 关于卡 */
.about-card { text-align: center; padding: 24px 16px; }
.about-logo { font-size: 52px; margin-bottom: 10px; filter: drop-shadow(0 6px 14px var(--brand-glow)); }
.about-name { font-size: 20px; font-weight: 700; color: var(--text-strong); margin-bottom: 4px; }
.about-version { font-size: 12px; color: var(--text-faint); margin-bottom: 14px; }
.about-desc { font-size: 13px; color: var(--text-muted); line-height: 1.7; }

/* ============================================================
   十九、动效开关：data-motion="off" 时全局关闭动效
   ============================================================ */
html[data-motion="off"] *,
html[data-motion="off"] *::before,
html[data-motion="off"] *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
}

/* ============================================================
   二十、无障碍：跟随系统减弱动效偏好
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ============================================================
   二十一、手机端：首页四项统计卡 → 单卡内四格网格
   桌面端 4 列各自独立卡；手机端合并成一张大卡、内部分四格，
   降低高度、提高信息密度（大厂规范：小屏弱化零值、紧凑排布）
   ============================================================ */
@media (max-width: 768px) {
    .stat-row {
        grid-template-columns: repeat(4, 1fr);
        gap: 0;
        background: #fff;
        border-radius: 12px;
        padding: 12px 4px;
        margin-bottom: 16px;
        border: 1px solid rgba(17, 24, 39, 0.04);
        box-shadow: 0 1px 2px rgba(17, 24, 39, 0.03), 0 6px 18px rgba(17, 24, 39, 0.05);
    }
    .stat-card {
        background: transparent;
        border: none;
        box-shadow: none;
        padding: 4px 2px;
        border-right: 1px solid rgba(17, 24, 39, 0.06);
        border-radius: 0;
    }
    .stat-card:last-child { border-right: none; }
    .stat-card:hover { transform: none; box-shadow: none; border-color: transparent; }
    .stat-card:active { transform: scale(0.92); }
    .stat-num { font-size: 20px; margin-bottom: 2px; }
    .stat-label { font-size: 11px; line-height: 1.2; }
}

/* ============================================================
   二十二、宇宙漂浮视图 + 孵化中心（珍珠玻璃：星空 + 星球漂浮 + 卫星环绕）
   ============================================================ */
/* iOS 上长按/双指按住图片会弹「存储图像 / 拷贝」菜单并回弹预览；缩略图当图标用必须禁掉 */
.cosmos-sphere img,
.lin-avatar img,
.hatch-mom img,
.user-avatar img,
.character-main-img img,
.gallery-item img,
.med-img img {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    user-select: none;
    -webkit-user-drag: none;
}
/* 星球/账号头像只是图标，永远不点它本身，事件直接给父级 */
.cosmos-sphere img,
.lin-avatar img,
.user-avatar img { pointer-events: none; }
.cosmos-mask {
    position: fixed; inset: 0; z-index: 300; display: none;
    flex-direction: column;
    background:
        radial-gradient(1200px 700px at 20% -10%, rgba(99,102,241,0.25), transparent 55%),
        radial-gradient(900px 600px at 100% 20%, rgba(236,72,153,0.18), transparent 50%),
        linear-gradient(180deg, #0b1026 0%, #151a3a 55%, #0b1026 100%);
    overflow: hidden;
}
/* 星星背景 */
.cosmos-mask::before {
    content: ''; position: absolute; inset: 0; pointer-events: none;
    background-image:
        radial-gradient(1.5px 1.5px at 12% 24%, rgba(255,255,255,0.9), transparent 40%),
        radial-gradient(1px 1px at 38% 68%, rgba(255,255,255,0.7), transparent 40%),
        radial-gradient(2px 2px at 62% 18%, rgba(255,255,255,0.8), transparent 40%),
        radial-gradient(1px 1px at 80% 52%, rgba(255,255,255,0.6), transparent 40%),
        radial-gradient(1.5px 1.5px at 28% 88%, rgba(255,255,255,0.7), transparent 40%),
        radial-gradient(1px 1px at 72% 78%, rgba(255,255,255,0.6), transparent 40%),
        radial-gradient(1px 1px at 90% 8%, rgba(255,255,255,0.7), transparent 40%),
        radial-gradient(1.5px 1.5px at 6% 60%, rgba(255,255,255,0.5), transparent 40%);
    animation: twinkle 4s ease-in-out infinite alternate;
}
@keyframes twinkle { from { opacity: 0.55; } to { opacity: 1; } }
.cosmos-header {
    position: relative; z-index: 8; display: flex; align-items: center; gap: 12px;
    /* 顶部留出 iOS 刘海/状态栏安全区，否则右上角 ✕ 落在系统状态栏里点不到 */
    padding: calc(16px + env(safe-area-inset-top, 0px)) 18px 16px;
    flex-shrink: 0;
}
.cosmos-title { font-size: 20px; font-weight: 700; color: #fff; letter-spacing: 0.5px; }
.cosmos-sub { font-size: 12px; color: rgba(255,255,255,0.65); flex: 1; }
.cosmos-close {
    width: 34px; height: 34px; border-radius: 50%; border: 1px solid rgba(255,255,255,0.25);
    background: rgba(255,255,255,0.08); color: #fff; font-size: 16px; cursor: pointer;
    display: flex; align-items: center; justify-content: center; transition: all 0.2s;
}
.cosmos-close:hover { background: rgba(255,255,255,0.2); transform: rotate(90deg); }
.cosmos-stage { position: relative; flex: 1; z-index: 1; overflow: hidden; touch-action: pan-y; }
/* 星空层：随左右滑动整体横移，营造"地球仪转动"的错觉（星球本身仍平铺不旋转） */
.cosmos-stars {
    position: absolute; inset: -12% -70%;
    background-image:
        radial-gradient(1.6px 1.6px at 24px 36px, rgba(255,255,255,0.95), transparent 60%),
        radial-gradient(1.2px 1.2px at 96px 120px, rgba(255,255,255,0.8), transparent 60%),
        radial-gradient(1px 1px at 168px 64px, rgba(255,255,255,0.65), transparent 60%),
        radial-gradient(2px 2px at 210px 170px, rgba(255,255,255,0.85), transparent 60%),
        radial-gradient(1.2px 1.2px at 60px 200px, rgba(255,255,255,0.7), transparent 60%),
        radial-gradient(1px 1px at 150px 220px, rgba(255,255,255,0.5), transparent 60%);
    background-size: 240px 240px, 240px 240px, 240px 240px, 300px 300px, 240px 240px, 300px 300px;
    opacity: 0.75; pointer-events: none;
    will-change: transform;
    animation: stars-drift 54s linear infinite;
}
@keyframes stars-drift { from { transform: translate3d(0, 0, 0); } to { transform: translate3d(-240px, 0, 0); } }
/* 分页轨道：每页一层，位移 = 自己的序号 - 当前页（翻页整排平移，无 3D 变形） */
.cosmos-track { position: absolute; inset: 0; }
.cosmos-page {
    position: absolute; inset: 0;
    transform: translate3d(calc(var(--i, 0) * 100% + var(--cosmos-drag, 0px)), 0, 0);
    transition: transform 0.42s cubic-bezier(0.22, 0.61, 0.36, 1);
    will-change: transform;
}
/* 分页指示器 */
.cosmos-pager {
    position: absolute; left: 0; right: 0; bottom: 10px; z-index: 3;
    display: flex; align-items: center; justify-content: center; gap: 8px;
}
.cosmos-pager i {
    width: 7px; height: 7px; border-radius: 999px; background: rgba(255,255,255,0.28);
    cursor: pointer; transition: all 0.25s ease; display: block;
}
.cosmos-pager i.on { width: 18px; background: #fff; }
.cosmos-pager-num {
    margin-left: 4px; font-size: 11px; font-variant-numeric: tabular-nums;
    color: rgba(255,255,255,0.6); letter-spacing: 0.4px;
}
.cosmos-loading {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    color: rgba(255,255,255,0.7); font-size: 14px; letter-spacing: 1px;
}
.cosmos-legend {
    position: relative; z-index: 2; display: flex; gap: 6px 14px; justify-content: center; align-items: center;
    padding: 10px 16px calc(14px + env(safe-area-inset-bottom, 0px));
    font-size: 11.5px; color: rgba(255,255,255,0.7); flex-shrink: 0; flex-wrap: wrap;
}
.legend-hint { color: rgba(255, 255, 255, 0.42); font-size: 10.5px; flex: 1 0 100%; text-align: center; }
.legend-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-right: 4px; vertical-align: middle; }
.legend-dot.male { background: #6366f1; }
.legend-dot.female { background: #ec4899; }
.legend-dot.egg { background: #fbbf24; width: 8px; height: 8px; }

/* 星球（一只龟）：可直接按住拖动摆放 */
.cosmos-planet {
    position: absolute; transform: translate(-50%, -50%);
    display: flex; flex-direction: column; align-items: center; z-index: 2;
    touch-action: none; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent;
    cursor: grab;
}
.cosmos-planet.holding { z-index: 5; cursor: grabbing; }
.cosmos-planet.lp-on .cosmos-sphere {
    box-shadow: 0 0 0 3px rgba(255,255,255,0.55), 0 0 32px var(--pc, #6366f1), 0 0 80px rgba(99,102,241,0.55);
}
.cosmos-sphere {
    width: calc(64px * var(--ps, 1)); height: calc(64px * var(--ps, 1)); border-radius: 50%;
    background: radial-gradient(circle at 32% 28%, rgba(255,255,255,0.35), transparent 45%), var(--pc, #6366f1);
    box-shadow: 0 0 24px var(--pc, #6366f1), 0 0 60px rgba(99,102,241,0.35);
    display: flex; align-items: center; justify-content: center; overflow: hidden;
    border: 2px solid rgba(255,255,255,0.35);
    transition: box-shadow 0.25s ease;
}
.cosmos-sphere img { width: 100%; height: 100%; object-fit: cover; }
.cosmos-num { color: #fff; font-size: 13px; font-weight: 700; text-align: center; line-height: 1.15; padding: 2px; text-shadow: 0 1px 3px rgba(0,0,0,0.4); }
.cosmos-label {
    margin-top: 6px; font-size: calc(10.5px * var(--ps, 1)); color: rgba(255,255,255,0.9); text-align: center;
    max-width: calc(88px * var(--ps, 1)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    text-shadow: 0 1px 3px rgba(0,0,0,0.6);
    padding: 1px 7px; border-radius: 999px;
    background: rgba(8, 12, 30, 0.45);
}
/* 带蛋卫星的母龟：标签下移，避开最外圈轨道，不被蛋/∞ 压住 */
.cosmos-planet.has-eggs .cosmos-label { margin-top: 44px; }
/* 星球漂移 */
@keyframes planet-drift {
    from { transform: translate(-50%, -50%) translate(0, 0); }
    25% { transform: translate(-50%, -50%) translate(14px, -10px); }
    50% { transform: translate(-50%, -50%) translate(-6px, -18px); }
    75% { transform: translate(-50%, -50%) translate(-16px, -4px); }
    to { transform: translate(-50%, -50%) translate(0, 0); }
}
/* 蛋卫星轨道 */
.cosmos-egg {
    position: absolute; top: 50%; left: 50%; width: 14px; height: 14px; margin: -7px;
    border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fde68a, #fbbf24 70%);
    box-shadow: 0 0 10px rgba(251,191,36,0.7);
}
@keyframes egg-orbit {
    from { transform: rotate(0deg) translateX(var(--orbit-r, 40px)) rotate(0deg); }
    to { transform: rotate(360deg) translateX(var(--orbit-r, 40px)) rotate(-360deg); }
}
/* 蛋超过 6 个时的「∞」占位符号 */
.cosmos-more {
    position: absolute; top: 50%; left: 50%; width: 20px; height: 20px; margin: -10px;
    font-size: 18px; font-weight: 700; line-height: 20px; text-align: center;
    color: var(--pc, #fbbf24); /* 颜色跟随母龟色系 */
    text-shadow: 0 0 12px currentColor, 0 0 26px currentColor;
    pointer-events: none;
}

/* ============================================================
   关系图谱（长按星球弹出：配对 → 窝 → 蛋 → 转录后代）
   ============================================================ */
/* 图谱吸附层：跟着按压点定位，左侧球往右弹 / 右侧球往左弹 */
.cosmos-pop {
    position: absolute; z-index: 6; display: none; pointer-events: none;
}
.cosmos-pop.show { display: block; }
/* 指回被按住星球的箭头 */
.cosmos-pop::before {
    content: ''; position: absolute; top: var(--arrow-y, 50%); width: 12px; height: 12px;
    margin-top: -6px; z-index: 7;
    background: #151c3c;
    border: 1px solid rgba(255, 255, 255, 0.16);
    transform: rotate(45deg); border-radius: 2px;
}
.cosmos-pop.to-right::before { left: -6px; border-right-color: transparent; border-top-color: transparent; }
.cosmos-pop.to-left::before { right: -6px; border-left-color: transparent; border-bottom-color: transparent; }
/* 面板被手指挪过位置后，箭头已不指向原球，收起来 */
.cosmos-pop.moved::before { display: none; }
.lineage-panel {
    width: 254px; max-width: 74vw; max-height: 68vh;
    display: flex; flex-direction: column; overflow: hidden;
    background:
        radial-gradient(420px 220px at 12% -8%, rgba(99, 102, 241, 0.3), transparent 62%),
        linear-gradient(180deg, rgba(23, 30, 60, 0.97) 0%, rgba(11, 16, 38, 0.97) 100%);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 16px;
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.52), inset 0 1px 0 rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.cosmos-pop.to-right .lineage-panel { transform-origin: left center; animation: lineage-pop-r 0.26s cubic-bezier(0.18, 0.9, 0.32, 1.18) both; }
.cosmos-pop.to-left .lineage-panel { transform-origin: right center; animation: lineage-pop-l 0.26s cubic-bezier(0.18, 0.9, 0.32, 1.18) both; }
@keyframes lineage-pop-r { from { opacity: 0; transform: translateX(-12px) scale(0.72, 0.9); } to { opacity: 1; transform: none; } }
@keyframes lineage-pop-l { from { opacity: 0; transform: translateX(12px) scale(0.72, 0.9); } to { opacity: 1; transform: none; } }
.lineage-head {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 12px; border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.lineage-title {
    flex: 1; min-width: 0; font-size: 13px; font-weight: 600; color: #fff;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.lineage-hint { font-size: 10px; color: rgba(255, 255, 255, 0.42); flex-shrink: 0; letter-spacing: 0.2px; }
/* 内容可手动滚动（手指不离开时上下拖＝翻看剩余关系） */
.lineage-body {
    padding: 10px 12px 12px; overflow-y: auto; -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain; scrollbar-width: none;
}
.lineage-body::-webkit-scrollbar { width: 0; height: 0; }
/* 树：根节点 + 分组 + 分支竖轨 */
.lin-root { position: relative; }
.lin-node {
    display: flex; align-items: center; gap: 8px;
    padding: 7px 9px; margin-bottom: 6px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    animation: lin-pop 0.46s cubic-bezier(0.18, 0.9, 0.32, 1.25) both;
    animation-delay: var(--d, 0s);
}
@keyframes lin-pop {
    0% { opacity: 0; transform: scale(0.55) translateY(6px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}
.lin-root > .lin-node {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.22);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12), 0 0 26px rgba(99, 102, 241, 0.25);
}
.lin-avatar {
    width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    background: radial-gradient(circle at 32% 28%, rgba(255,255,255,0.3), transparent 55%), var(--pc, #6366f1);
    border: 1.5px solid rgba(255, 255, 255, 0.35);
    overflow: hidden; box-shadow: 0 0 12px var(--pc, #6366f1);
}
.lin-avatar img { width: 100%; height: 100%; object-fit: cover; }
.lin-avatar b { font-size: 10px; color: #fff; font-weight: 600; letter-spacing: 0.2px; }
.lin-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.lin-title { font-size: 12px; font-weight: 600; color: #fff; line-height: 1.35; }
.lin-sub { font-size: 10.5px; color: rgba(255, 255, 255, 0.62); line-height: 1.45; }
.lin-branches { padding-left: 8px; }
.lin-group { margin-top: 8px; position: relative; padding-left: 8px; border-left: 2px solid rgba(255, 255, 255, 0.1); }
.lin-group-title {
    font-size: 11px; font-weight: 600; color: rgba(255, 255, 255, 0.72);
    letter-spacing: 0.3px; margin: 0 0 6px; padding-left: 2px;
}
.lin-branch { position: relative; padding-left: 10px; }
.lin-branch::before {
    content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 2px;
    background: linear-gradient(180deg, rgba(236, 72, 153, 0.55), rgba(99, 102, 241, 0.18));
    border-radius: 2px;
}
.lin-branch > .lin-node { position: relative; }
.lin-branch > .lin-node::before {
    content: ''; position: absolute; left: -10px; top: 50%; width: 10px; height: 2px;
    background: rgba(236, 72, 153, 0.45);
}
.lin-clutch { padding-left: 10px; margin-left: 2px; border-left: 2px dashed rgba(255, 255, 255, 0.14); }
.lin-clutch-icon { font-size: 15px; width: 20px; text-align: center; flex-shrink: 0; }
.lin-eggs { display: flex; flex-wrap: wrap; gap: 4px; padding: 2px 0 6px 4px; }
.lin-egg {
    display: inline-flex; align-items: center; gap: 3px;
    padding: 3px 6px 3px 5px; border-radius: 999px;
    font-size: 10px; line-height: 1.4; color: rgba(255, 255, 255, 0.85);
    background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.12);
}
.lin-egg i { font-style: normal; font-size: 11px; }
.lin-egg em { font-style: normal; font-size: 9px; color: rgba(255, 255, 255, 0.5); }
.lin-egg.warm { border-color: rgba(251, 191, 36, 0.45); background: rgba(251, 191, 36, 0.12); }
.lin-egg.warm em { color: rgba(253, 230, 138, 0.85); }
.lin-egg.done { border-color: rgba(34, 197, 94, 0.45); background: rgba(34, 197, 94, 0.12); }
.lin-egg.done em { color: rgba(134, 239, 172, 0.85); }
.lin-egg.fail { opacity: 0.6; }
.lin-kids { display: flex; flex-direction: column; }
.lin-kid .lin-node { border-left: 2px solid rgba(34, 197, 94, 0.35); }
.lin-empty {
    padding: 14px 4px; font-size: 12px; color: rgba(255, 255, 255, 0.55); line-height: 1.6;
}
.lin-empty span { color: rgba(255, 255, 255, 0.4); }
/* 往年窝次折叠提示 */
.lin-past {
    margin-top: 8px; padding: 6px 2px; font-size: 10.5px; line-height: 1.5;
    color: rgba(255, 255, 255, 0.38); text-align: center;
    border-top: 1px dashed rgba(255, 255, 255, 0.1);
}

/* 孵化中心卡片 */
.hatch-mask { background: linear-gradient(180deg, #0b1026 0%, #1a1240 55%, #0b1026 100%); }
#hatchStage { padding: 8px 16px 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.hatch-card {
    display: flex; gap: 14px; align-items: center;
    background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.12);
    border-radius: 14px; padding: 14px;
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    animation: hatch-in 0.5s cubic-bezier(0.4,0,0.2,1) both;
}
@keyframes hatch-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
.hatch-card.urgent { border-color: rgba(251,191,36,0.5); box-shadow: 0 0 18px rgba(251,191,36,0.2); }
.hatch-mom {
    width: 52px; height: 52px; border-radius: 50%; flex-shrink: 0;
    background: radial-gradient(circle at 32% 28%, rgba(255,255,255,0.35), transparent 45%), #ec4899;
    display: flex; align-items: center; justify-content: center; overflow: hidden;
    border: 2px solid rgba(255,255,255,0.3); box-shadow: 0 0 16px rgba(236,72,153,0.4);
}
.hatch-mom img { width: 100%; height: 100%; object-fit: cover; }
.hatch-mom .cosmos-num { font-size: 11px; }
.hatch-info { flex: 1; min-width: 0; }
.hatch-no { color: #fff; font-size: 15px; font-weight: 600; }
.hatch-urgent-tag { font-style: normal; font-size: 11px; color: #fbbf24; margin-left: 6px; }
.hatch-pair { color: rgba(255,255,255,0.6); font-size: 12px; margin-top: 2px; }
.hatch-meta { color: rgba(255,255,255,0.55); font-size: 11px; margin-top: 6px; }
.hatch-progress { height: 6px; border-radius: 3px; background: rgba(255,255,255,0.12); margin-top: 8px; overflow: hidden; }
.hatch-progress-bar {
    height: 100%; border-radius: 3px;
    background: linear-gradient(90deg, #6366f1, #a78bfa);
    transition: width 0.8s cubic-bezier(0.4,0,0.2,1);
}
.hatch-card.urgent .hatch-progress-bar { background: linear-gradient(90deg, #f59e0b, #fbbf24); }

/* ============================================================
   二十三、剩余页面细节统一（医疗标签页等，与顶部导航分段控件同风格）
   ============================================================ */
/* 医疗病历标签页：选中态改成「主色浅底 + 主色字」，与顶部导航分段控件一致，去掉实心填充 */
.med-tab {
    border-color: rgba(17, 24, 39, 0.08);
    background: transparent;
    color: var(--text-muted, #6b7280);
    border-radius: 7px;
    transition: all 0.2s ease;
}
.med-tab:hover { background: rgba(17, 24, 39, 0.04); color: var(--text-strong, #111827); }
.med-tab.active {
    background: var(--brand-soft);
    border-color: var(--brand-softer);
    color: var(--brand);
    font-weight: 600;
    box-shadow: inset 0 0 0 1px var(--brand-softer);
}

/* 繁育中心蛋篮/蛋芯片：圆角与字重统一 */
.egg-chip {
    border-radius: 7px;
    font-weight: 500;
}
.egg-chip.on { background: var(--brand-soft); color: var(--brand); border-color: var(--brand-softer); }

/* 回收站类型标签：语义色（信息中性灰，不抢内容） */
.recycle-type {
    color: var(--text-faint, #9ca3af);
    font-size: 11px;
}

/* 统计页卡片 & 图表：统一圆角与主色渐变 */
.stats-card {
    border: 1px solid rgba(17, 24, 39, 0.04);
    border-radius: 12px;
}
.chart-bar {
    background: var(--brand-grad);
    border-radius: 4px 4px 0 0;
}



/* ============================================================
   深色主题 · 表面覆盖层
   ------------------------------------------------------------
   基础层 app.css 里有若干写死的浅色表面，变量改不到，
   这里按 class 逐个换成「窗口底 #202228 / 输入底 #262930」。
   ============================================================ */
html[data-theme="dark"] body {
    background:
        radial-gradient(1000px 520px at 8% -10%, rgba(10,132,255,.11) 0%, transparent 58%),
        radial-gradient(900px 460px at 100% 0%, rgba(64,156,255,.07) 0%, transparent 52%),
        var(--bg-page);
}
html[data-theme="dark"] .top-nav {
    background: rgba(30,32,38,.86); border-bottom-color: rgba(255,255,255,.09);
    box-shadow: 0 4px 20px rgba(0,0,0,.35);
}
html[data-theme="dark"] .bottom-nav { background: rgba(30,32,38,.90); border-color: rgba(255,255,255,.09); }
html[data-theme="dark"] .nav-btn { color: var(--text-muted); }
html[data-theme="dark"] .nav-btn:hover { background: rgba(255,255,255,.07); color: var(--text-strong); }
html[data-theme="dark"] .card,
html[data-theme="dark"] .stat-card,
html[data-theme="dark"] .task-item,
html[data-theme="dark"] .record-item,
html[data-theme="dark"] .stats-card,
html[data-theme="dark"] .modal-box,
html[data-theme="dark"] .auth-card,
html[data-theme="dark"] .plan-preview,
html[data-theme="dark"] .check-btn,
html[data-theme="dark"] .search-input,
html[data-theme="dark"] .filter-select,
html[data-theme="dark"] .form-input,
html[data-theme="dark"] .form-select,
html[data-theme="dark"] .user-avatar,
html[data-theme="dark"] .plan-preview .plan-icon {
    background: var(--wm-surface); color: var(--text-body);
    border-color: rgba(255,255,255,.10);
    box-shadow: 0 1px 2px rgba(0,0,0,.28), 0 8px 24px rgba(0,0,0,.20);
}
html[data-theme="dark"] .card:hover,
html[data-theme="dark"] .stat-card:hover,
html[data-theme="dark"] .task-item:hover,
html[data-theme="dark"] .record-item:hover {
    background: var(--wm-surface-hover); border-color: rgba(10,132,255,.42);
    box-shadow: 0 6px 18px rgba(0,0,0,.32);
}
html[data-theme="dark"] .form-input:focus,
html[data-theme="dark"] .form-select:focus,
html[data-theme="dark"] .search-input:focus,
html[data-theme="dark"] .filter-select:focus { background: var(--wm-surface-2); }
html[data-theme="dark"] .btn-default { background: var(--wm-surface-3); color: var(--text-body); }
html[data-theme="dark"] .btn-danger:hover,
html[data-theme="dark"] .btn-small.danger:hover { background: rgba(255,69,58,.18); }
html[data-theme="dark"] .btn-small.danger-outline:hover { background: rgba(255,69,58,.14); border-color: rgba(255,69,58,.5); }
html[data-theme="dark"] .btn-small.ghost:hover { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.22); }
html[data-theme="dark"] .tree-label.active { background: linear-gradient(90deg, var(--brand-soft), #202228); }
html[data-theme="dark"] .img-upload-add { background: linear-gradient(135deg, #2a2c33, #23262d); }
html[data-theme="dark"] .egg-progress { background: rgba(255,255,255,.15); }
html[data-theme="dark"] .welcome-card::after { opacity: .28; }
html[data-theme="dark"] .auth-mask { background: linear-gradient(160deg, #16181d 0%, #1c2530 100%); }
html[data-theme="dark"] .auth-title,
html[data-theme="dark"] .card-title,
html[data-theme="dark"] .modal-title,
html[data-theme="dark"] .plan-name,
html[data-theme="dark"] .record-item-title,
html[data-theme="dark"] .character-info-item span,
html[data-theme="dark"] .stats-card h4 { color: var(--text-strong); }
html[data-theme="dark"] .stat-label,
html[data-theme="dark"] .task-desc,
html[data-theme="dark"] .record-item-date,
html[data-theme="dark"] .record-item-info,
html[data-theme="dark"] .form-label,
html[data-theme="dark"] .character-info-item label,
html[data-theme="dark"] .recycle-type { color: var(--text-muted); }
html[data-theme="dark"] .switch { background: #3a3d44; }
html[data-theme="dark"] .switch::after { background: #f5f5f7; }


/* 深色主题 · 补充：基础层里其余写死的浅灰/浅色语义底 */
html[data-theme="dark"] .egg-row,
html[data-theme="dark"] .egg-chip,
html[data-theme="dark"] .egg-basket,
html[data-theme="dark"] .template-card,
html[data-theme="dark"] .icon-pick,
html[data-theme="dark"] .gallery-item,
html[data-theme="dark"] .character-main-img,
html[data-theme="dark"] .recycle-item,
html[data-theme="dark"] .section-count,
html[data-theme="dark"] .med-tab,
html[data-theme="dark"] .pager-btn {
    background: var(--wm-surface); border-color: rgba(255,255,255,.10); color: var(--text-body);
}
html[data-theme="dark"] .egg-chip.on,
html[data-theme="dark"] .egg-chip.in-basket { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); }
html[data-theme="dark"] .egg-chip.done { background: #191b20; }
html[data-theme="dark"] .btn-danger,
html[data-theme="dark"] .btn-small.danger { background: rgba(255,69,58,.16); color: #ff7b72; }
html[data-theme="dark"] .stock-warning { background: rgba(255,214,10,.10); border-left-color: var(--warning); }
html[data-theme="dark"] .stock-warning.danger { background: rgba(255,69,58,.10); border-left-color: var(--danger); }
html[data-theme="dark"] .tree-label:hover,
html[data-theme="dark"] .back-btn:hover,
html[data-theme="dark"] .pager-btn:not(:disabled):hover { background: rgba(255,255,255,.07); color: var(--text-strong); }


/* 深色主题 · 补充二：手机端统计行、新手引导、头像位 */
html[data-theme="dark"] .stat-row {
    background: var(--wm-surface); border-color: rgba(255,255,255,.08);
    box-shadow: 0 1px 2px rgba(0,0,0,.28), 0 6px 18px rgba(0,0,0,.22);
}
html[data-theme="dark"] .wc-avatar,
html[data-theme="dark"] .welcome-card .wc-avatar {
    background: #2a2c33 !important; background-image: none !important;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.12) !important;
}
html[data-theme="dark"] .onboard-card { background: var(--wm-surface-hover); box-shadow: 0 16px 50px rgba(0,0,0,.5); }
html[data-theme="dark"] .onboard-card h3 { color: var(--text-strong); }
html[data-theme="dark"] .onboard-card p { color: var(--text-body); }
html[data-theme="dark"] .ob-step { color: var(--brand); }
html[data-theme="dark"] .ob-btn { background: var(--wm-surface-3); border-color: rgba(255,255,255,.12); color: var(--text-body); }
html[data-theme="dark"] .ob-btn:hover { background: #32353d; }
html[data-theme="dark"] .ob-btn.primary { background: var(--brand, #0a84ff); border-color: var(--brand, #0a84ff); color: #fff; }
html[data-theme="dark"] .ob-btn.primary:hover { background: var(--brand-2, #409cff); }
html[data-theme="dark"] .ob-btn.ghost { background: transparent; color: var(--text-muted); }
html[data-theme="dark"] .onboard-hole { box-shadow: 0 0 0 9999px rgba(0,0,0,.68), 0 0 0 3px rgba(10,132,255,.9) inset; }


/* ============================================================
   深色主题 · 表面层收口（三层表面模型 / 颜色一律走令牌）
   ------------------------------------------------------------
   基础层 app.css / theme.css 里还有一批写死的 #fff、#f9fafb、
   #f0f0f0，CSS 变量改不到。这里按「容器面 / 输入面 / 控件面」
   一次性收口，避免继续按页面零散打补丁。
   有意的白保持不动：开关圆点、主题色块对勾、打赏码图片白底
   （二维码必须白底才能保证扫码识别）。
   ============================================================ */
html[data-theme="dark"] .setting-item,
html[data-theme="dark"] .setting-item.about-card,
html[data-theme="dark"] .archive-sidebar,
html[data-theme="dark"] .donate-card {
    background: var(--wm-surface);
    border-color: rgba(255,255,255,.10);
    color: var(--text-body);
    box-shadow: 0 1px 2px rgba(0,0,0,.28), 0 6px 18px rgba(0,0,0,.18);
}
html[data-theme="dark"] .setting-item-label,
html[data-theme="dark"] .about-name,
html[data-theme="dark"] .donate-card .donate-name { color: var(--text-strong); }
html[data-theme="dark"] .setting-item-desc,
html[data-theme="dark"] .about-desc,
html[data-theme="dark"] .about-version,
html[data-theme="dark"] .donate-card .donate-tip { color: var(--text-muted); }
html[data-theme="dark"] .btn-small.default {
    background: var(--wm-surface-3);
    color: var(--text-body);
    border-color: rgba(255,255,255,.12);
}
html[data-theme="dark"] .btn-small.default:hover {
    background: var(--wm-surface-hover); color: var(--text-strong);
}
html[data-theme="dark"] .auth-tabs { border-color: rgba(255,255,255,.12); }
html[data-theme="dark"] .auth-tabs span {
    background: var(--wm-surface-2); color: var(--text-muted);
}
html[data-theme="dark"] .auth-tabs span.active { background: var(--brand); color: #fff; }
html[data-theme="dark"] .auth-logo {
    background: linear-gradient(145deg, var(--brand-soft), var(--wm-surface));
}
html[data-theme="dark"] .tree-label { color: var(--text-body); }
