/* ============================================================
   不断光 · 移动端公共样式 V1.0
   三套主题：
   - zen   经典禅意（沿用 swsl 深棕风格）
   - elder 长者清爽大字（浅色 · 大字号 · 高对比）
   - youth 青春自定义（现代浅色 · 手势 · 倍速）
   ============================================================ */

/* ---------- 主题令牌（默认 = 经典禅意） ---------- */
:root {
    --font-root: 16px;
    --user-scale: 1;            /* 字号放大倍数（JS 写入 html.style.fontSize） */

    --bg-page: #1A1A1A;
    --bg-page-2: #0F0F0F;
    --bg-card: #2A2A2A;
    --bg-card-2: #333333;
    --bg-elev: #3A3A3A;
    --bg-head: #23201C;        /* 分类标题栏：比卡片略深的暖棕黑 */
    --bg-head-2: #2E2822;
    --t1: #F5F5DC;
    --t2: #D2B48C;
    --muted: #A9A9A9;
    --line: #404040;
    --divider: #333333;

    --primary: #8B4513;
    --primary-2: #A0522D;
    --secondary: #D2691E;
    --accent: #FF8C00;
    --primary-contrast: #F5F5DC;

    --ok: #4CAF50;
    --warn: #FFA726;
    --err: #F44336;

    --radius: 12px;
    --radius-lg: 16px;
    --shadow: 0 8px 32px rgba(0,0,0,.35);
    --shadow-soft: 0 4px 16px rgba(0,0,0,.25);
    --btn-h: 48px;
    --tap: 44px;                /* 最小触控尺寸 */
    --pattern-opacity: .03;     /* 莲花底纹透明度 */
}

html[data-theme="elder"] {
    --font-root: 17px;
    --bg-page: #FAF6EC;
    --bg-page-2: #F3ECDD;
    --bg-card: #FFFFFF;
    --bg-card-2: #FFFCF6;
    --bg-elev: #F3ECDC;
    --bg-head: #EFE5CF;         /* 分类标题栏：比白卡片略深的米色 */
    --bg-head-2: #FAF2E0;
    --t1: #2B2620;
    --t2: #5E5142;
    --muted: #8C7F6B;
    --line: #E4D9C3;
    --divider: #EDE4D2;

    --primary: #8B4513;
    --primary-2: #A0522D;
    --secondary: #B8651B;
    --accent: #B8651B;
    --primary-contrast: #FFFFFF;

    --ok: #2E7D32;
    --warn: #B26A00;
    --err: #C62828;

    --radius: 16px;
    --radius-lg: 20px;
    --shadow: 0 6px 22px rgba(90,70,40,.12);
    --shadow-soft: 0 3px 12px rgba(90,70,40,.08);
    --btn-h: 54px;
    --tap: 52px;
    --pattern-opacity: 0;      /* 清爽版关闭底纹 */
}

html[data-theme="youth"] {
    --font-root: 16px;
    --bg-page: #EEF2FF;
    --bg-page-2: #E5EAFF;
    --bg-card: #FFFFFF;
    --bg-card-2: #FAFBFF;
    --bg-elev: #F1F4FF;
    --bg-head: #E7ECFD;         /* 分类标题栏：比白卡片略深的淡蓝紫 */
    --bg-head-2: #F3F5FF;
    --t1: #1F2540;
    --t2: #4B5475;
    --muted: #8A91A8;
    --line: #E2E7FA;
    --divider: #ECF0FE;

    --primary: #4F6BED;
    --primary-2: #7C5CFC;
    --secondary: #06B6D4;
    --accent: #06B6D4;
    --primary-contrast: #FFFFFF;

    --ok: #16A34A;
    --warn: #D97706;
    --err: #DC2626;

    --radius: 18px;
    --radius-lg: 22px;
    --shadow: 0 10px 30px rgba(79,107,237,.14);
    --shadow-soft: 0 4px 14px rgba(79,107,237,.10);
    --btn-h: 46px;
    --pattern-opacity: 0;
}

/* ---------- 基础 ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    font-family: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", sans-serif;
    background: var(--bg-page);
    color: var(--t1);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    transition: background .3s ease, color .3s ease;
}
a { color: inherit; }
button { font-family: inherit; }

/* 莲花底纹（仅禅意版可见） */
body::before {
    content: '';
    position: fixed; inset: 0;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><path fill="%238B4513" d="M50,20 C60,15 70,15 80,20 C85,30 85,40 80,50 C70,55 60,55 50,50 C40,55 30,55 20,50 C15,40 15,30 20,20 C30,15 40,15 50,20 Z"/></svg>');
    background-size: 200px;
    opacity: var(--pattern-opacity);
    pointer-events: none;
    z-index: 0;
}

/* ============================================================
   通用组件
   ============================================================ */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    width: 100%;
    min-height: var(--btn-h);
    padding: 10px 20px;
    border: none; border-radius: 999px;
    font-size: 1rem; font-weight: 700;
    cursor: pointer; text-decoration: none;
    transition: transform .15s ease, box-shadow .2s ease, background .2s ease;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: var(--primary-contrast); }
.btn-primary:hover { box-shadow: 0 6px 20px rgba(139,69,19,.35); }
html[data-theme="youth"] .btn-primary:hover { box-shadow: 0 6px 20px rgba(79,107,237,.35); }
.btn-secondary { background: var(--bg-elev); color: var(--t1); border: 1px solid var(--line); }
.btn-ghost { background: transparent; color: var(--t2); border: 1px dashed var(--line); }

.field { margin-bottom: 12px; }
.field label { display: block; margin-bottom: 6px; color: var(--t2); font-size: .85rem; font-weight: 600; }
.field input {
    width: 100%;
    min-height: var(--tap);
    padding: 9px 12px;
    background: var(--bg-card-2);
    border: 1.5px solid var(--line);
    border-radius: var(--radius);
    color: var(--t1);
    font-size: .82rem;
    font-family: inherit;
    transition: border-color .2s, box-shadow .2s;
}
.field input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(139,69,19,.15); }
.field input::placeholder { color: var(--muted); }
.field .err-msg { display: none; color: var(--err); font-size: .82rem; margin-top: 4px; }
.field .field-hint { color: var(--muted); font-size: .72rem; line-height: 1.45; margin-top: 4px; }
.field.invalid .field-hint { display: none; }
.field.invalid input { border-color: var(--err); }
.field.invalid .err-msg { display: block; }

/* 邮箱：账号输入框 + 后缀下拉 */
.email-split { display: flex; gap: 8px; }
.email-split input { flex: 1 1 auto; min-width: 0; }
.email-split select {
    flex: 0 0 auto;
    max-width: 46%;
    min-height: var(--tap);
    padding: 9px 30px 9px 12px;
    background-color: var(--bg-card-2);
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='currentColor' d='M8 11L3 5h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 9px center;
    background-size: 13px;
    border: 1.5px solid var(--line);
    border-radius: var(--radius);
    color: var(--t1);
    font-family: inherit;
    font-size: .82rem;
    line-height: 1.2;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
}
.email-split select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(139,69,19,.15); }
.field.invalid .email-split select { border-color: var(--err); }

/* 大复选框 */
.check-row { display: flex; align-items: flex-start; gap: 8px; font-size: .78rem; line-height: 1.5; color: var(--t2); cursor: pointer; user-select: none; }
.check-row input { position: absolute; opacity: 0; pointer-events: none; }
.check-box {
    flex: none;
    width: 24px; height: 24px; margin-top: 2px;
    border: 2px solid var(--line); border-radius: 6px;
    background: var(--bg-card-2);
    display: flex; align-items: center; justify-content: center;
    transition: all .2s;
    color: transparent; font-size: 14px;
}
.check-row input:checked + .check-box { background: var(--primary); border-color: var(--primary); color: var(--primary-contrast); }
.check-row a { color: var(--primary); font-weight: 700; text-decoration: none; }
html[data-theme="elder"] .check-box { width: 24px; height: 24px; font-size: 14px; }

/* 轻提示 */
.toast {
    position: fixed; left: 50%; bottom: 34px;
    transform: translateX(-50%) translateY(20px);
    max-width: 88%;
    padding: 12px 20px;
    background: var(--bg-elev); color: var(--t1);
    border: 1px solid var(--line);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    font-size: .95rem; text-align: center;
    opacity: 0; pointer-events: none;
    transition: opacity .25s, transform .25s;
    z-index: 9999;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.ok { border-left-color: var(--ok); }
.toast.err { border-left-color: var(--err); }
.toast.warn { border-left-color: var(--warn); }

/* ============================================================
   跳转/风格选择页（index.html）
   ============================================================ */
.entry-container {
    min-height: 100vh; min-height: 100dvh;
    background: linear-gradient(135deg, var(--bg-page), var(--bg-page-2));
    display: flex; align-items: center; justify-content: center;
    position: relative; overflow: hidden;
    padding: 20px 16px;
}
.lotus-animation {
    position: absolute; inset: 0; opacity: .1;
    background-image:
        radial-gradient(circle at 20% 30%, var(--primary) 1px, transparent 1px),
        radial-gradient(circle at 80% 70%, var(--secondary) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: bdgFloat 20s infinite linear;
}
@keyframes bdgFloat {
    0% { transform: translate(0,0) rotate(0); }
    100% { transform: translate(-50px,-50px) rotate(360deg); }
}
.entry-card {
    background: linear-gradient(135deg, var(--bg-card), var(--bg-card-2));
    border-radius: var(--radius-lg);
    padding: 32px 26px;
    max-width: 520px; width: 100%;
    text-align: center;
    box-shadow: var(--shadow);
    border: 1px solid var(--line);
    position: relative; z-index: 10;
    animation: bdgCardIn .7s ease-out;
}
@keyframes bdgCardIn {
    from { opacity: 0; transform: translateY(26px) scale(.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.lotus-icon { font-size: 52px; color: var(--primary); margin-bottom: 10px; animation: bdgPulse 4s infinite ease-in-out; }
@keyframes bdgPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.1); } }
.app-title { font-size: 1.7rem; font-weight: 800; margin-bottom: 4px; }
.app-subtitle { color: var(--t2); font-size: .95rem; margin-bottom: 10px; }
.version-badge {
    display: inline-block;
    background: var(--primary); color: var(--primary-contrast);
    padding: 3px 12px; border-radius: 999px;
    font-size: .78rem; font-weight: 700;
    margin-bottom: 22px;
}
.entry-section-label {
    text-align: left; color: var(--muted); font-size: .85rem;
    margin: 18px 0 10px;
}

/* 风格选择卡 */
.theme-options { display: flex; flex-direction: column; gap: 12px; }
.theme-btn {
    width: 100%;
    display: flex; align-items: center; gap: 14px;
    padding: 14px 16px;
    background: var(--bg-card-2);
    border: 2px solid transparent;
    border-radius: var(--radius);
    color: var(--t1);
    cursor: pointer; text-align: left;
    transition: all .2s;
}
.theme-btn:hover { background: var(--bg-elev); transform: translateY(-2px); }
.theme-btn.active { border-color: var(--primary); background: var(--bg-elev); box-shadow: var(--shadow-soft); }
.theme-swatch {
    flex: none; width: 46px; height: 46px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; color: #fff;
}
.swatch-zen   { background: linear-gradient(135deg, #8B4513, #D2691E); }
.swatch-elder { background: linear-gradient(135deg, #FFFFFF, #F3ECDC); color: #8B4513; border: 1px solid #E4D9C3; }
.swatch-youth { background: linear-gradient(135deg, #4F6BED, #06B6D4); }
.theme-info { flex: 1; min-width: 0; }
.theme-name { font-size: 1.05rem; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.theme-desc { font-size: .82rem; color: var(--muted); margin-top: 2px; }
.rec-tag {
    font-size: .68rem; font-weight: 700; color: var(--primary-contrast);
    background: var(--accent); border-radius: 999px; padding: 1px 8px;
}
html[data-theme=""] .rec-tag, .rec-tag { color: #fff; }

.remember-row { justify-content: center; margin: 18px 0 6px; }
.auto-redirect {
    display: flex; align-items: center; justify-content: center; flex-wrap: wrap;
    gap: 10px; margin-top: 18px; padding: 12px;
    background: var(--bg-card-2); border-radius: var(--radius);
    font-size: .92rem; color: var(--t2);
}
.countdown { font-size: 1.15rem; font-weight: 800; color: var(--accent); min-width: 24px; }
.auto-redirect button {
    min-height: 34px; padding: 4px 14px; width: auto;
    border-radius: 999px; border: 1px solid var(--line);
    background: var(--bg-elev); color: var(--t2); cursor: pointer; font-size: .85rem;
}
.entry-footer {
    margin-top: 20px; padding-top: 16px;
    border-top: 1px solid var(--divider);
    display: flex; justify-content: center; gap: 18px; flex-wrap: wrap;
}
.entry-footer a { color: var(--t2); text-decoration: none; font-size: .88rem; display: inline-flex; gap: 6px; align-items: center; }
.entry-footer a:hover { color: var(--t1); }

/* ============================================================
   移动端长页（mobile.html）
   ============================================================ */
.topbar {
    position: sticky; top: 0; z-index: 100;
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    color: var(--primary-contrast);
    padding: 12px 14px;
    padding-top: calc(12px + env(safe-area-inset-top));
    display: flex; align-items: center; gap: 10px;
    box-shadow: 0 3px 14px rgba(0,0,0,.18);
}
.brand { display: flex; align-items: center; gap: 9px; flex: 1; min-width: 0; }
.brand i { flex: none; font-size: 1.4rem; }
.brand > div { flex: 1; min-width: 0; font-weight: 800; font-size: 1.2rem; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand small {
    display: block;
    font-size: .72rem; font-weight: 400; opacity: .88; line-height: 1.35;
    margin-top: 2px;
}
.icon-btn {
    flex: none;
    width: var(--tap); height: var(--tap);
    border-radius: 50%; border: none;
    background: rgba(255,255,255,.16);
    color: var(--primary-contrast);
    font-size: 1.05rem; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background .2s, transform .15s;
}
.icon-btn:hover { background: rgba(255,255,255,.28); }
.icon-btn:active { transform: scale(.92); }
/* 顶栏“添加到桌面”按钮：使用站点 LOGO */
.icon-btn img { width: 62%; height: 62%; object-fit: contain; border-radius: 6px; display: block; }
/* 账号胶囊隐藏：未登录时页面顶部即登录卡，已登录时有欢迎条；
   设置入口保留在右侧调色板按钮。隐藏后保证站名与副标题任何状态下完整一行 */
.user-chip { display: none; }

/* 手机窄屏：图标按钮略收 */
@media (max-width: 480px) {
    .topbar { gap: 8px; padding: 10px 12px; }
    .icon-btn { width: 40px; height: 40px; font-size: .98rem; }
}

.page { position: relative; z-index: 1; max-width: 720px; margin: 0 auto; padding: 12px 12px 40px; }

/* 登录卡片 */
.auth-card {
    background: linear-gradient(135deg, var(--bg-card), var(--bg-card-2));
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    padding: 20px 18px;
    margin-bottom: 18px;
}
.auth-head { text-align: center; margin-bottom: 14px; }
.auth-head .lotus-icon { font-size: 36px; margin-bottom: 6px; animation: none; }
.auth-head h2 { font-size: 1.25rem; }
.auth-head p { font-size: .85rem; color: var(--muted); margin-top: 4px; }
.auth-tabs { display: flex; background: var(--bg-elev); border-radius: 999px; padding: 4px; margin-bottom: 16px; }
.auth-tabs button {
    flex: 1; min-height: 40px; border: none; border-radius: 999px;
    background: transparent; color: var(--t2);
    font-size: .95rem; font-weight: 700; cursor: pointer;
}
.auth-tabs button.active { background: var(--primary); color: var(--primary-contrast); }
.auth-error {
    display: none;
    margin-bottom: 14px;
    padding: 10px 14px;
    background: rgba(244,67,54,.10);
    border: 1px solid var(--err);
    border-radius: var(--radius);
    color: var(--err);
    font-size: .88rem;
    line-height: 1.5;
}
.guest-line { text-align: center; margin-top: 12px; }
.guest-line button {
    border: none; background: none; cursor: pointer;
    color: var(--t2); font-size: .74rem; text-decoration: underline;
    text-underline-offset: 3px; font-family: inherit;
    white-space: nowrap;
}
.guest-line button:hover { color: var(--primary); }

/* 已登录欢迎条 */
.welcome-bar {
    display: flex; align-items: center; gap: 10px;
    background: var(--bg-card); border: 1px solid var(--line);
    border-left: 4px solid var(--ok);
    border-radius: var(--radius);
    padding: 12px 14px; margin-bottom: 18px;
    box-shadow: var(--shadow-soft);
}
.welcome-bar { align-items: center; padding: 10px 14px; gap: 10px; }
.welcome-bar i { flex: none; color: var(--ok); font-size: 1.15rem; }
.welcome-bar .wb-text { flex: 1; min-width: 0; font-size: .9rem; }
.welcome-bar .wb-text b {
    display: block; font-size: .92rem; font-weight: 700;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.welcome-bar .wb-sub {
    display: block; margin-top: 2px; font-size: .74rem; line-height: 1.4;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.welcome-bar button {
    flex: none; border: 1px solid var(--line); background: var(--bg-elev);
    color: var(--t2); border-radius: 999px; padding: 6px 14px;
    font-size: .82rem; cursor: pointer;
}

/* 分类区块 */
.cat-section { margin-bottom: 10px; }
.cat-head {
    width: 100%;
    display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px;
    padding: 13px 16px;
    background: linear-gradient(135deg, var(--bg-head), var(--bg-head-2));
    border: 1px solid var(--line);
    border-radius: var(--radius);
    color: var(--t1);
    cursor: pointer;
    box-shadow: var(--shadow-soft);
    font-family: inherit;
    text-align: left;
}
.cat-head:active { transform: scale(.99); }
.cat-icon {
    flex: none; width: 44px; height: 44px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    color: var(--primary-contrast); font-size: 1.15rem;
}
.cat-title { flex: 1; min-width: 0; font-size: 1.12rem; font-weight: 800; }
.cat-name { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* 描述独立占第二行，与标题文字左对齐，完整换行不省略；数据中的 \n 按换行显示 */
.cat-desc {
    flex: 0 0 100%;
    padding-left: 56px; /* 图标 44 + gap 12 */
    font-size: .74rem; font-weight: 400; color: var(--muted);
    line-height: 1.5;
    white-space: pre-line;
}
/* 窄屏：图标略缩，描述缩进同步 */
@media (max-width: 480px) {
    .cat-head { padding: 12px 14px; gap: 8px 10px; }
    .cat-icon { width: 40px; height: 40px; }
    .cat-desc { padding-left: 50px; }
}
.cat-count {
    flex: none; font-size: .9rem; color: var(--t2);
    background: var(--bg-elev); border-radius: 999px; padding: 3px 10px;
}
.chevron { color: var(--muted); transition: transform .3s; font-size: .95rem; }
.cat-section.collapsed .chevron { transform: rotate(-90deg); }
.cat-body {
    overflow: hidden;
    max-height: 2000px;
    transition: max-height .35s ease, margin .35s ease;
    margin-top: 10px;
}
.cat-section.collapsed .cat-body { max-height: 0; margin-top: 0; }

/* 课程菜单：课程类单列大卡；应用中心两列 */
.menu-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
.menu-grid.two-col { grid-template-columns: 1fr 1fr; gap: 12px; }
.menu-card {
    display: flex; flex-direction: column; gap: 8px;
    min-width: 0;            /* grid item：防止一行长文本撑破 1fr 轨道 */
    min-height: 80px;
    padding: 11px 14px;
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    text-decoration: none; color: var(--t1);
    box-shadow: var(--shadow-soft);
    transition: transform .15s, box-shadow .2s, border-color .2s;
    position: relative;
}
.menu-card:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow); }
.menu-card:active { transform: scale(.98); }

/* 第一行：图标在左、名称在右，固定一行（超长省略号兜底，不逐卡缩字） */
.m-main { display: flex; align-items: center; gap: 9px; min-width: 0; }
.menu-card .m-icon {
    flex: none;
    width: 38px; height: 38px; border-radius: 10px;
    background: var(--bg-elev); color: var(--primary);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.02rem;
}
.menu-name {
    flex: 1; min-width: 0;
    font-size: 1.02rem; font-weight: 700; line-height: 1.3;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.menu-meta { margin-top: auto; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: .75rem; color: var(--muted); }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.st-done { color: var(--ok); }
.st-done .dot { background: var(--ok); }
.st-updating { color: var(--warn); }
.st-updating .dot { background: var(--warn); }
.tag-pill {
    background: var(--bg-elev); color: var(--t2);
    border-radius: 999px; padding: 1px 8px; font-size: .68rem;
}
.url-note { position: absolute; top: 10px; right: 10px; font-size: .65rem; color: var(--warn); }

/* 青春版：卡片小一点、信息密一点 */
html[data-theme="youth"] .menu-card { min-height: 72px; }
html[data-theme="youth"] .menu-grid.two-col .menu-card { min-height: 86px; }
html[data-theme="youth"] .cat-icon { background: linear-gradient(135deg, var(--primary), var(--secondary)); }
html[data-theme="youth"] .menu-card .m-icon { color: var(--primary); }

/* 长者版（基准 17px）：卡片紧凑、名称统一 1rem，全部卡片同一字号 */
html[data-theme="elder"] .menu-card { min-height: 84px; }
html[data-theme="elder"] .menu-grid.two-col .menu-card { min-height: 96px; }
html[data-theme="elder"] .menu-card .m-icon { width: 38px; height: 38px; border-radius: 10px; font-size: 1.05rem; }
html[data-theme="elder"] .menu-name { font-size: 1rem; }
html[data-theme="elder"] .menu-meta { font-size: .8rem; }

/* 应用中心两列卡：标题缩小一档保证完整，图标同步收窄 */
.menu-grid.two-col .menu-name { font-size: .96rem; }
.menu-grid.two-col .m-icon { width: 32px; height: 32px; border-radius: 9px; font-size: .92rem; }
.menu-grid.two-col .m-main { gap: 7px; }
.menu-grid.two-col .menu-meta { font-size: .68rem; line-height: 1.4;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.page-footer {
    margin-top: 26px; padding-top: 18px;
    border-top: 1px solid var(--divider);
    display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.page-footer a, .page-footer button {
    background: none; border: none; cursor: pointer;
    color: var(--t2); font-size: .85rem; text-decoration: none; font-family: inherit;
}
.page-footer a:hover, .page-footer button:hover { color: var(--t1); }

/* ---------- 底部设置抽屉 ---------- */
.sheet-mask {
    position: fixed; inset: 0; background: rgba(0,0,0,.45);
    opacity: 0; pointer-events: none; transition: opacity .25s;
    z-index: 500;
}
.sheet-mask.open { opacity: 1; pointer-events: auto; }
.sheet {
    position: fixed; left: 0; right: 0; bottom: 0;
    background: var(--bg-card);
    border-radius: 22px 22px 0 0;
    padding: 10px 18px calc(22px + env(safe-area-inset-bottom));
    max-height: 86vh; overflow-y: auto;
    transform: translateY(100%); transition: transform .28s ease;
    z-index: 501;
    box-shadow: var(--shadow);
}
.sheet.open { transform: translateY(0); }
.sheet-handle { width: 42px; height: 4px; border-radius: 2px; background: var(--line); margin: 4px auto 14px; }
.sheet-title { font-size: 1.1rem; font-weight: 800; text-align: center; margin-bottom: 16px; }
.sheet-group { margin-bottom: 20px; }
.sheet-group > .sg-label { font-size: .85rem; color: var(--muted); margin-bottom: 8px; }
.sheet-theme-list { display: flex; flex-direction: column; gap: 10px; }
.sheet-theme-item {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 14px; border-radius: var(--radius);
    background: var(--bg-card-2); border: 2px solid transparent;
    cursor: pointer;
}
.sheet-theme-item.active { border-color: var(--primary); }
.stepper { display: flex; align-items: center; gap: 14px; justify-content: center; }
.stepper button {
    width: 48px; height: 44px; border-radius: 12px;
    border: 1px solid var(--line); background: var(--bg-elev);
    color: var(--t1); font-size: 1.1rem; cursor: pointer; font-weight: 700;
}
.stepper .scale-val { min-width: 64px; text-align: center; font-weight: 700; }
.seg { display: flex; background: var(--bg-elev); border-radius: 999px; padding: 4px; }
.seg button {
    flex: 1; min-height: 38px; border: none; background: none;
    border-radius: 999px; color: var(--t2); cursor: pointer; font-size: .88rem; font-weight: 600;
}
.seg button.active { background: var(--primary); color: var(--primary-contrast); }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 2px; }
.switch-row .s-label { font-size: .95rem; }
.switch-row .s-label small { display: block; color: var(--muted); font-size: .76rem; }
.switch { position: relative; display: inline-block; width: 56px; height: 30px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
    position: absolute; inset: 0; cursor: pointer;
    background: var(--bg-elev); border: 1px solid var(--line);
    border-radius: 999px; transition: .25s;
}
.slider::before {
    content: ''; position: absolute; width: 22px; height: 22px;
    left: 3px; bottom: 3px; background: var(--muted);
    border-radius: 50%; transition: .25s;
}
.switch input:checked + .slider { background: var(--primary); border-color: var(--primary); }
.switch input:checked + .slider::before { transform: translateX(26px); background: #fff; }
.sheet-tip { font-size: .78rem; color: var(--muted); text-align: center; margin-top: 6px; line-height: 1.5; }

/* 青春版开启手势：保留单指上下滚动，双指捏合交给 JS 缩放（禁用浏览器原生缩放避免冲突） */
html.gesture-on, html.gesture-on body { touch-action: pan-y; }

/* 桌面端访问跳转页时（理论上自动去幻灯片，这里仅兜底排版） */
@media (min-width: 900px) {
    .page { max-width: 760px; }
}
