/* ============================================================
   系规必背 · 主样式表
   移动端APP（375x812 设计基准）
   ============================================================ */

/* ========== 基础重置 ========== */
*, *::before, *::after {
    margin: 0; padding: 0; box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI',
                 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: var(--body-bg);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 20px;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    gap: 44px;
    flex-wrap: wrap;
    transition: background 0.4s ease;
}

/* ========== 手机外壳 ========== */
.phone-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

.phone-frame {
    width: 375px;
    height: 812px;
    background: var(--bg);
    border-radius: 40px;
    box-shadow:
        0 0 0 6px #0A0B14,
        0 0 0 8px #1A1B28,
        0 0 0 9px rgba(255, 255, 255, 0.05),
        0 30px 80px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    position: relative;
}

.demo-label {
    font-size: 12px;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    letter-spacing: 0.5px;
}

.prototype-badge {
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 1px;
    border: 1px solid rgba(255,255,255,0.06);
    padding: 4px 12px;
    border-radius: 20px;
    background: var(--card);
}

/* ========== 状态栏 ========== */
.status-bar {
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text);
}

.status-icons { display: flex; gap: 6px; align-items: center; font-size: 11px; }
.status-icons .sig { font-size: 10px; }

/* ========== Notch 刘海 ========== */
.notch-area {
    height: 30px;
    display: flex;
    justify-content: center;
    align-items: center;
}
.notch-bar {
    width: 140px; height: 28px;
    background: var(--text);
    border-radius: 18px;
}

/* ========== 应用头部 ========== */
.app-header {
    position: relative;
    padding: 8px 18px 10px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.app-header::after {
    content: '';
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.06) 0%, transparent 60%);
    pointer-events: none;
    z-index: 0;
}
.app-header .header-icon {
    width: 34px; height: 34px;
    border-radius: 10px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.06);
    display: flex; align-items: center; justify-content: center;
    font-size: 16px;
    cursor: pointer;
    position: relative; z-index: 1;
}
.app-header .header-icon:active {
    background: rgba(255,255,255,0.2);
}
.app-header .header-title {
    font-size: 17px; font-weight: 700;
    background: var(--primary-gradient);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
    position: relative; z-index: 1;
}

/* ========== 主内容区域 ========== */
.main-content {
    height: calc(812px - 44px - 30px - 52px - 72px);
    overflow-y: auto;
    padding: 0 16px 12px;
    scroll-behavior: smooth;
}
.main-content::-webkit-scrollbar { width: 0; }

/* ========== 页面容器 ========== */
.page { display: none; }
.page.active { display: block; }

/* ========== 底部导航栏 ========== */
.bottom-nav {
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-around;
    background: var(--nav-bg);
    border-top: 1px solid var(--border-light);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    position: relative;
    z-index: 10;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.3);
}
.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    cursor: pointer;
    user-select: none;
    padding: 6px 14px;
    position: relative;
}
.nav-item .nav-icon {
    font-size: 20px;
    transition: transform 0.2s ease;
}
.nav-item .nav-label {
    font-size: 10px;
    font-weight: 500;
    color: var(--text-muted);
    transition: color 0.2s ease;
}
.nav-item.active .nav-icon { transform: scale(1.1); }
.nav-item.active .nav-label {
    color: var(--primary);
    font-weight: 700;
}
.nav-item.active::before {
    content: '';
    position: absolute; top: -8px; left: 50%;
    transform: translateX(-50%);
    width: 24px; height: 3px;
    background: var(--primary-gradient);
    border-radius: 0 0 3px 3px;
}
.nav-badge {
    position: absolute;
    top: 2px; right: 4px;
    min-width: 18px; height: 18px;
    padding: 0 4px;
    border-radius: 9px;
    background: var(--danger);
    color: #fff;
    font-size: 10px; font-weight: 700;
    line-height: 18px;
    text-align: center;
    box-sizing: border-box;
}

/* ========== 通用卡片 ========== */
.card {
    background: var(--card);
    border-radius: 16px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-xs);
    margin-bottom: 10px;
}

/* ========== 按钮系统 ========== */
.btn {
    border: none;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s ease;
    user-select: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.btn:active { transform: scale(0.96); }
.btn-primary {
    background: var(--primary-gradient);
    color: #fff;
    box-shadow: var(--shadow-btn);
    font-size: 15px;
    padding: 12px 24px;
}
.btn-primary:active {
    box-shadow: var(--shadow-btn-hover);
    transform: scale(0.96);
}
.btn-secondary {
    background: var(--card-elevated);
    color: var(--text);
    border: 1px solid var(--border);
    font-size: 13px;
    padding: 10px 18px;
}
.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1.5px solid var(--primary);
    font-size: 13px;
    padding: 10px 18px;
}

/* ========== 出题按钮 ========== */
.gen-btn {
    width: 100%;
    padding: 11px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    font-family: inherit;
    background: var(--primary-gradient);
    color: #fff;
    box-shadow: var(--shadow-btn);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.gen-btn:active {
    box-shadow: var(--shadow-btn-hover);
    transform: scale(0.97);
}
.gen-btn .gen-icon { font-size: 16px; }
.gen-btn.secondary {
    background: var(--card-elevated);
    color: var(--text);
    box-shadow: var(--shadow-xs);
    border: 1px solid var(--border);
    font-weight: 600;
}

/* ========== 练习工具栏 ========== */
.practice-toolbar {
    display: flex; flex-direction: column; gap: 8px;
    margin-bottom: 10px;
}
.pt-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.pt-label {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    width: 56px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    line-height: 1;
}
.pt-content {
    flex: 1;
    display: flex;
    gap: 6px;
    min-width: 0;
}

/* 章节触发器 */
.chapter-trigger {
    flex: 1;
    position: relative;
    padding: 9px 12px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    user-select: none;
    display: flex; align-items: center; justify-content: space-between;
}
.chapter-trigger::after {
    content: '▾';
    font-size: 10px;
    transition: transform 0.25s ease;
    color: var(--text-muted);
}
.chapter-trigger.open::after {
    transform: rotate(180deg);
}

/* 章节面板 */
.chapter-panel {
    display: none;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px;
    box-shadow: var(--shadow-sm);
}
.chapter-panel.open { display: block; }
.chapter-grid-new {
    display: flex; flex-wrap: wrap; gap: 7px;
}
.ch-tag {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
    color: var(--text-secondary);
    background: var(--card-elevated);
    border: 1px solid var(--border);
    transition: all 0.2s ease;
}
.ch-tag:active { transform: scale(0.95); }
.ch-tag.active {
    background: var(--primary-light);
    color: var(--primary);
    border-color: rgba(79,70,229,0.2);
    font-weight: 700;
}
.ch-tag.hot.active {
    background: rgba(239,68,68,0.1);
    color: #EF4444;
    border-color: rgba(239,68,68,0.2);
}

/* ========== 特殊模式信息栏（错题本/收藏夹） ========== */
.practice-mode-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    margin-bottom: 10px;
    background: var(--card-elevated);
    border-radius: 12px;
    border: 1px solid var(--border);
}
.mode-bar-icon {
    font-size: 22px;
    flex-shrink: 0;
}
.mode-bar-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
}
.mode-bar-sub {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 1px;
}
.mode-bar-back {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text-muted);
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.mode-bar-back:active {
    background: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary);
}

/* ========== 自评操作（答对/答错） ========== */
.self-assess-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding: 8px 10px;
    background: var(--card-elevated);
    border-radius: 10px;
    border: 1px solid var(--border);
}
.self-assess-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
}
.self-btn {
    flex: 1;
    padding: 8px 10px;
    font-size: 12px;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    cursor: pointer;
}
.self-correct {
    background: rgba(34, 197, 94, 0.15);
    color: #22C55E;
}
.self-correct:active {
    background: rgba(34, 197, 94, 0.3);
}
.self-wrong {
    background: rgba(239, 68, 68, 0.15);
    color: #EF4444;
}
.self-wrong:active {
    background: rgba(239, 68, 68, 0.3);
}

/* ========== 错题本列表页 ========== */
.wrong-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 0 8px;
}
.wrong-page-total {
    font-size: 12px;
    color: var(--primary);
    font-weight: 600;
    background: var(--primary-light);
    padding: 4px 10px;
    border-radius: 12px;
}
.wrong-page-sub {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 12px;
}
.wrong-chapter {
    background: var(--card);
    border-radius: 12px;
    border: 1px solid var(--border);
    border-top: 3px solid #EF4444;
    padding: 12px;
    margin-bottom: 12px;
}
.wrong-chapter-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}
.wrong-chapter-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
}
.wrong-chapter-count {
    font-size: 11px;
    color: var(--text-muted);
    background: var(--card-elevated);
    padding: 2px 8px;
    border-radius: 10px;
}
.wrong-chapter-actions {
    margin-bottom: 8px;
}
.wrong-practice-btn {
    width: 100%;
    padding: 8px;
    font-size: 12px;
    border-radius: 8px;
    border: none;
    background: var(--primary-gradient, linear-gradient(135deg, #6366F1, #8B5CF6));
    color: #fff;
    font-weight: 600;
    cursor: pointer;
}
.wrong-list-items {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.wrong-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: var(--card-elevated);
    border-radius: 8px;
    border: 1px solid var(--border);
}
.wrong-item-info {
    flex: 1;
    min-width: 0;
}
.wrong-item-q {
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.wrong-item-meta {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 2px;
}
.wrong-item-actions {
    flex-shrink: 0;
}
.wrong-item-del {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: rgba(239, 68, 68, 0.12);
    color: #EF4444;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.wrong-item-del:active {
    background: rgba(239, 68, 68, 0.3);
}

/* ========== 错题本章节独立练习页 ========== */
.wrong-practice-header {
    position: relative;
    display: flex;
    align-items: center;
    padding: 4px 0 12px;
}

/* 错题练习页视觉区分：紫红边框 + 错误色顶栏 */
#page-wrong-practice {
    background: linear-gradient(180deg, rgba(239, 68, 68, 0.06) 0%, transparent 60px);
}
.wrong-practice-card.question-card {
    border-top: 3px solid #EF4444;
    box-shadow: var(--shadow-xs), 0 0 0 1px rgba(239, 68, 68, 0.1);
}
.wrong-practice-card .q-stem {
    border-left-color: #EF4444;
}
.wrong-practice-back {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
    position: relative;
    z-index: 1;
}
.wrong-practice-back:active {
    background: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary);
}
.wrong-practice-title {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 60%;
}
.wrong-practice-count {
    margin-left: auto;
    font-size: 12px;
    color: var(--primary);
    font-weight: 600;
    background: var(--primary-light);
    padding: 4px 10px;
    border-radius: 12px;
    white-space: nowrap;
    position: relative;
    z-index: 1;
}
.wrong-practice-card .question-card {
    border-top: 2px solid var(--primary);
}

/* 模式选项 */
.mode-option {
    flex: 1;
    text-align: center;
    padding: 8px 0;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    color: var(--text-secondary);
    background: var(--card-elevated);
    border: 1px solid var(--border);
    transition: all 0.2s ease;
}
.mode-option:active { transform: scale(0.95); }
.mode-option.active {
    background: var(--primary-light);
    color: var(--primary);
    border-color: rgba(79,70,229,0.25);
    box-shadow: var(--shadow-glow);
}

/* ========== 题目卡片 ========== */
.question-card {
    background: var(--card);
    border-radius: 16px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-xs);
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.q-meta {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 11px; color: var(--text-muted);
}
.q-type-badge {
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    background: var(--primary-light);
    color: var(--primary);
}
.q-chapter-tag {
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 500;
    background: var(--success);
    color: #fff;
}
.q-stem {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.6;
}
.q-blank {
    display: inline-block;
    min-width: 80px;
    border-bottom: 2px dashed var(--primary);
    padding: 0 6px;
    margin: 0 4px;
    color: var(--primary);
    font-weight: 700;
}

/* 选项 */
.options-list {
    display: flex;
    flex-direction: column;
    gap: 9px;
}
.opt-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1.5px solid var(--border);
    cursor: pointer;
    user-select: none;
    transition: all 0.15s ease;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    background: var(--card);
}
.opt-item:active { transform: scale(0.98); }
.opt-item.selected {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 700;
    box-shadow: var(--shadow-glow);
}
.opt-item.correct {
    border-color: var(--success);
    background: rgba(16,185,129,0.08);
    color: var(--success);
}
.opt-item.wrong {
    border-color: var(--danger);
    background: rgba(239,68,68,0.08);
    color: var(--danger);
}
.opt-letter {
    width: 28px; height: 28px;
    border-radius: 7px;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700;
    background: var(--card-elevated);
    color: var(--text-secondary);
    flex-shrink: 0;
}

/* 反馈区 */
.q-feedback {
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 13px;
    line-height: 1.5;
    display: none;
    font-weight: 500;
}
.q-feedback.show {
    display: block;
}
.q-feedback.correct {
    background: rgba(16,185,129,0.08);
    color: var(--success);
    border: 1px solid rgba(16,185,129,0.15);
}
.q-feedback.wrong {
    background: rgba(239,68,68,0.08);
    color: var(--danger);
    border: 1px solid rgba(239,68,68,0.15);
}

/* 操作栏 */
.q-actions {
    display: flex; gap: 8px;
    align-items: center;
}
.q-actions .gen-btn { flex: 1; }

/* ========== 统计卡片 ========== */
.stats-row {
    display: flex; gap: 8px; margin-bottom: 10px;
}
.stat-card {
    flex: 1;
    background: var(--card);
    border-radius: 14px;
    padding: 12px;
    text-align: center;
    border: 1px solid var(--border);
}
.stat-value {
    font-size: 26px; font-weight: 800;
    background: var(--primary-gradient);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.1;
}
.stat-label {
    font-size: 11px; color: var(--text-muted);
    margin-top: 2px;
}

/* ========== 进度环 ========== */
.progress-ring {
    width: 70px; height: 70px;
}
.progress-ring-track {
    stroke: rgba(79,70,229,0.1);
}
.progress-ring-fill {
    stroke: url(#progressGrad);
    stroke-linecap: round;
    transition: stroke-dashoffset 0.6s ease;
}
.stats-center {
    display: flex; align-items: center; gap: 12px; margin: 6px 0 14px 0;
}
.stats-ring-area {
    position: relative;
    display: flex; align-items: center; justify-content: center;
}
.stats-ring-percent {
    position: absolute;
    font-size: 18px; font-weight: 800;
    color: var(--text);
}

/* 连续学习 */
.stats-streak {
    display: flex; align-items: center; gap: 6px;
    padding: 8px 12px;
    background: var(--card);
    border-radius: 10px;
    border: 1px solid var(--border);
    font-size: 13px; font-weight: 600;
    color: var(--text);
    margin-bottom: 10px;
}
.stats-streak .streak-flame { font-size: 18px; }

/* 周进度 */
.week-row {
    display: flex; gap: 5px; margin-bottom: 12px;
}
.week-day {
    flex: 1;
    text-align: center;
    font-size: 10px;
    color: var(--text-muted);
    padding: 8px 0;
    border-radius: 8px;
    background: var(--card-elevated);
    border: 1px solid var(--border);
}
.week-day.done {
    background: var(--primary-light);
    color: var(--primary);
    border-color: rgba(79,70,229,0.2);
    font-weight: 600;
}
.week-day.today {
    border-color: var(--primary);
    border-width: 2px;
    font-weight: 700;
}

/* 进度条 */
.progress-strip {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px; color: var(--text-muted);
}
.progress-strip:last-child { border-bottom: none; }
.progress-bar-track {
    flex: 1;
    height: 8px;
    border-radius: 4px;
    background: var(--card-elevated);
    overflow: hidden;
}
.progress-bar-fill {
    height: 100%;
    border-radius: 4px;
    background: var(--primary-gradient);
    transition: width 0.5s ease;
}
.progress-strip .ch-label {
    width: 60px; font-size: 12px; font-weight: 600;
    color: var(--text);
}

/* ========== 激活 / 购买页 ========== */
.activate-container {
    display: flex; flex-direction: column; align-items: center;
    padding: 36px 18px; text-align: center;
    height: 100%; justify-content: center;
}
.activate-hero {
    font-size: 48px; margin-bottom: 8px;
}
.activate-title {
    font-size: 20px; font-weight: 800;
    color: var(--text);
    margin-bottom: 4px;
}
.activate-subtitle {
    font-size: 13px; color: var(--text-secondary);
    margin-bottom: 20px; line-height: 1.5;
}
.activate-input-wrapper {
    width: 100%;
    display: flex; gap: 0;
    border-radius: 12px;
    overflow: hidden;
    border: 1.5px solid var(--border);
    margin-bottom: 10px;
    background: var(--input-bg);
}
.activate-input-wrapper input {
    flex: 1;
    padding: 12px 14px;
    border: none;
    background: transparent;
    color: var(--text);
    font-size: 15px;
    font-family: inherit;
    outline: none;
}
.activate-input-wrapper input::placeholder { color: var(--text-muted); }

.buy-guide {
    display: flex; align-items: center; justify-content: center;
    gap: 6px; font-size: 12px;
    margin-top: 12px;
    padding: 8px 16px;
    border-radius: 20px;
    background: rgba(255,255,255,0.03);
}
.buy-guide .guide-label { color: var(--text-muted); }
.buy-guide .guide-link {
    color: #6366F1;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
}

/* ========== 购买页面 ========== */
.purchase-card {
    background: var(--card);
    border: 1.5px solid var(--border);
    border-radius: 16px;
    padding: 18px;
    margin-bottom: 10px;
    position: relative;
    overflow: hidden;
}
.purchase-card.recommended {
    border-color: var(--primary);
    box-shadow: var(--shadow-glow);
}
.purchase-card .recommend-badge {
    position: absolute; top: 0; right: 0;
    background: var(--primary-gradient);
    color: #fff;
    font-size: 11px; font-weight: 600;
    padding: 4px 14px;
    border-radius: 0 16px 0 12px;
}
.price-row {
    display: flex; align-items: baseline; gap: 4px;
    justify-content: center; margin: 10px 0;
}
.price-symbol { font-size: 16px; font-weight: 600; color: var(--text); }
.price-num {
    font-size: 36px; font-weight: 800;
    background: var(--primary-gradient);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
}
.price-period { font-size: 12px; color: var(--text-muted); }
.purchase-card .purchase-features {
    list-style: none;
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 2;
    margin-bottom: 10px;
}
.purchase-card .feature-icon { margin-right: 6px; color: var(--success); }

/* 许可证卡片 */
.license-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 10px;
}
.license-status {
    display: flex; align-items: center; gap: 8px;
    font-size: 13px; font-weight: 600;
}
.license-status-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--success);
}
.license-info {
    font-size: 12px; color: var(--text-secondary);
    line-height: 1.8;
}
.license-info b { color: var(--text); }
.license-devices {
    display: flex; gap: 8px; margin-top: 4px;
}
.license-device {
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 6px;
    background: var(--card-elevated);
    border: 1px solid var(--border);
    color: var(--text-secondary);
}
.license-device.current {
    color: var(--success);
    border-color: rgba(16,185,129,0.3);
    background: rgba(16,185,129,0.06);
}

/* ========== 设置页 ========== */
.setting-row {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 0; border-bottom: 1px solid var(--border);
    cursor: pointer; user-select: none;
}
.setting-row:last-child { border: none; }
.setting-row .setting-icon { font-size: 18px; }
.setting-row .setting-text { flex: 1; font-size: 13px; font-weight: 500; color: var(--text); }
.setting-row .setting-arrow { color: var(--text-muted); font-size: 16px; }
.setting-row .setting-hint {
    font-size: 11px; color: var(--text-muted); margin-right: 6px;
}

/* ========== 主题开关 ========== */
.theme-toggle {
    display: flex; align-items: center; gap: 8px;
    cursor: pointer; user-select: none;
}
.theme-toggle-track {
    width: 48px; height: 26px;
    border-radius: 13px;
    background: #374151;
    position: relative;
    transition: background 0.3s ease;
    flex-shrink: 0;
}
.theme-toggle-thumb {
    width: 20px; height: 20px;
    border-radius: 50%;
    background: #fff;
    position: absolute; top: 3px; left: 3px;
    transition: transform 0.3s ease, background 0.3s ease;
    box-shadow: 0 1px 4px rgba(0,0,0,0.25);
}
.theme-label-dark, .theme-label-light {
    font-size: 14px; transition: opacity 0.3s ease;
}
.theme-label-dark { opacity: 1; }
.theme-label-light { opacity: 0.4; }

/* ========== Toast 提示 ========== */
.toast {
    position: absolute; bottom: 100px; left: 50%;
    transform: translateX(-50%);
    background: rgba(17,18,30,0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: var(--text);
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 13px; font-weight: 600;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
    white-space: nowrap;
}
.toast.show {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(-50%) translateY(-6px);
}

/* ========== 页面指示器 ========== */
.page-indicator {
    text-align: center; font-size: 10px;
    color: var(--text-muted); padding: 6px 0;
}

/* ========== 学习仪表盘 ========== */
.dashboard-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 12px;
}
.dash-stat-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px;
    text-align: center;
}
.dash-stat-val {
    font-size: 22px; font-weight: 800;
    background: var(--primary-gradient);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
}
.dash-stat-lbl {
    font-size: 10px; color: var(--text-muted);
    margin-top: 2px;
}
.dash-mini-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 12px;
    text-align: center;
}
.dash-chapter-bar {
    display: flex; align-items: center; gap: 8px;
    padding: 5px 0; font-size: 11px;
}
.dash-chapter-bar .ch-name {
    width: 44px; font-weight: 600;
    color: var(--text); text-align: right;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dash-chapter-bar .ch-track {
    flex: 1; height: 6px;
    border-radius: 3px; background: var(--card-elevated);
    overflow: hidden;
}
.dash-chapter-bar .ch-fill {
    height: 100%; border-radius: 3px;
    background: var(--primary-gradient);
    transition: width 0.4s ease;
}
.dash-chapter-bar .ch-pct {
    width: 36px; font-size: 10px;
    color: var(--text-muted); text-align: left;
}
.dash-heatmap {
    display: flex; gap: 4px; justify-content: center;
}
.dash-heat-cell {
    width: 28px; height: 28px;
    border-radius: 4px;
    background: var(--card-elevated);
    border: 1px solid var(--border);
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    font-size: 9px; gap: 1px;
}
.dash-heat-cell.level-1 { background: rgba(79,70,229,0.2); border-color: rgba(79,70,229,0.3); }
.dash-heat-cell.level-2 { background: rgba(79,70,229,0.4); border-color: rgba(79,70,229,0.5); }
.dash-heat-cell.level-3 { background: rgba(79,70,229,0.7); border-color: rgba(79,70,229,0.8); color: #fff; }
.dash-heat-cell.today { border: 2px solid var(--primary); }
.dash-heat-cell .heat-day { color: var(--text-muted); }
.dash-heat-cell.level-3 .heat-day { color: rgba(255,255,255,0.7); }

/* ========== 搜索筛选栏 ========== */
.search-bar {
    display: flex; gap: 6px; padding: 8px 12px; align-items: center;
}
.search-input {
    flex: 1;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--input-bg);
    color: var(--text);
    font-size: 12px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}
.search-input:focus { border-color: var(--primary); }
.search-input::placeholder { color: var(--text-muted); }
.type-filter {
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--card-elevated);
    color: var(--text);
    font-size: 11px;
    font-family: inherit;
    cursor: pointer;
    outline: none;
    white-space: nowrap;
}
.result-hint {
    font-size: 10px; color: var(--text-muted);
    text-align: center; padding: 2px 0 6px;
}

/* ========== 顶部搜索框（最显眼位置） ========== */
.search-bar-top {
    padding: 0 0 6px;
    margin-bottom: 6px;
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}
.search-bar-top::before {
    content: '';
    width: 56px;
    flex-shrink: 0;
}
.search-bar-top .search-input-wrap {
    flex: 1;
    position: relative;
    min-width: 0;
}
.search-bar-top .search-input {
    padding: 10px 14px 10px 36px;
    font-size: 13px;
    border-radius: 10px;
    background: var(--input-bg);
    border: 1px solid var(--border);
    box-shadow: 0 1px 0 rgba(255,255,255,0.02) inset;
    width: 100%;
    box-sizing: border-box;
}
.search-bar-top .search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}
.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    pointer-events: none;
    opacity: 0.7;
}
.search-clear {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    line-height: 18px;
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
    background: rgba(0,0,0,0.06);
    border-radius: 50%;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s, color 0.15s;
}
.search-clear:hover {
    background: rgba(255,255,255,0.18);
    color: var(--text);
}

/* 题目池数量提示 */
.pool-count {
    flex: 1;
    font-size: 11px;
    font-weight: 600;
    color: var(--primary);
    padding: 6px 10px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    text-align: center;
    transition: color 0.2s;
}

/* ============================================================
   背诵默写模式样式
   ============================================================ */

/* 题目头部 */
.q-stem-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2px;
    min-height: 16px;
    padding: 0;
}
.q-tags {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    align-items: center;
}
.q-tag {
    display: inline-flex;
    align-items: center;
    font-size: 12px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 8px;
    line-height: 1.4;
    border: 1px solid rgba(0,0,0,0.15);
}
.q-tag.must {
    background: #FF2D2D;
    color: #000;
}
.q-tag.key {
    background: #FF5C9E;
    color: #000;
}
.q-tag.try {
    background: #FFE100;
    color: #000;
}
.q-tag.error-review {
    background: rgba(96, 165, 250, 0.12);
    color: #3B82F6;
}
.q-fav-btn {
    background: none;
    border: none;
    color: var(--gold);
    font-size: 16px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 6px;
    transition: all 0.2s;
    line-height: 1;
}
.q-fav-btn:hover {
    background: rgba(255, 215, 0, 0.1);
    transform: scale(1.1);
}

/* 题目文本 */
.q-chapter-badge {
    display: inline-block;
    background: var(--primary);
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 6px;
    margin-right: 8px;
    vertical-align: middle;
}
.question-card .q-stem {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.5;
    color: var(--text);
    padding: 8px 12px;
    background: var(--card-elevated);
    border-radius: 12px;
    margin-bottom: 6px;
    border-left: 3px solid var(--primary);
}

/* 复习信息 */
.q-review-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    margin-bottom: 8px;
    background: rgba(96, 165, 250, 0.06);
    border-radius: 8px;
    font-size: 11px;
    color: var(--text-muted);
}
.q-mark-mastered {
    font-size: 10px;
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 3px 10px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
}
.q-mark-mastered:hover {
    background: #7C3AED;
}

/* 输入区域 */
.q-input-area {
    margin-bottom: 10px;
}
.q-input-area textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--input-bg);
    color: var(--text);
    font-family: inherit;
    font-size: 13px;
    line-height: 1.5;
    resize: vertical;
    min-height: 48px;
    outline: none;
    transition: border-color 0.2s;
}
.q-input-area textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}
.q-input-area textarea::placeholder {
    color: var(--text-muted);
}

/* 操作按钮 */
.q-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}
.q-actions-2 {
    margin-top: -2px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.q-actions-2 .gen-btn {
    padding: 8px 10px;
    font-size: 12px;
    border-radius: 8px;
    min-width: 0;
    flex: none;
    width: 100%;
}
.q-actions-2 .gen-btn:last-child {
    background: var(--primary-gradient, linear-gradient(135deg, #6366F1, #8B5CF6));
    color: #fff;
    border: none;
}
/* 三列按钮：提交/显示答案/显示速记 */
.q-actions-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 6px;
}
.q-actions-3 .gen-btn {
    padding: 8px 4px;
    font-size: 12px;
    border-radius: 8px;
    white-space: nowrap;
    min-width: 0;
    flex: none;
    width: 100%;
}
.gen-btn {
    flex: 1;
    padding: 10px 16px;
    border: none;
    border-radius: 10px;
    background: var(--primary-gradient, linear-gradient(135deg, #6366F1, #8B5CF6));
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}
.gen-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-glow);
}
.gen-btn.secondary {
    background: var(--card);
    color: var(--text);
    border: 1px solid var(--border);
}
.gen-btn.secondary:hover {
    background: var(--card-elevated);
}

/* 答案展示区 */
.q-answer-panel {
    padding: 14px;
    background: var(--card-elevated);
    border-radius: 12px;
    border: 1px solid var(--border);
    margin-bottom: 10px;
    animation: fadeIn 0.3s ease;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}
.q-answer-header {
    font-size: 13px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 8px;
}
.q-answer-content {
    font-size: 13px;
    color: var(--text);
    line-height: 1.8;
    padding: 10px 12px;
    background: var(--input-bg);
    border-radius: 8px;
    margin-bottom: 8px;
    white-space: pre-wrap;
    word-break: break-word;
}
.q-answer-content mark.match {
    background: rgba(52, 211, 153, 0.3);
    color: var(--text);
    padding: 1px 2px;
    border-radius: 2px;
}
.q-mnemonic {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 10px 12px;
    background: rgba(245, 158, 11, 0.08);
    border-radius: 8px;
    border: 1px dashed rgba(245, 158, 11, 0.3);
    margin-bottom: 10px;
}
.mnemonic-label {
    font-size: 12px;
    font-weight: 700;
    color: #F59E0B;
    white-space: nowrap;
}
.mnemonic-text {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.6;
}

/* 速记面板（独立于答案面板，可单独显示） */
.q-mnemonic-panel {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 12px;
    background: rgba(245, 158, 11, 0.08);
    border-radius: 10px;
    border: 1px dashed rgba(245, 158, 11, 0.4);
    margin-bottom: 10px;
    animation: fadeIn 0.3s ease;
}
.q-mnemonic-panel .mnemonic-text {
    flex: 1;
}

/* 下一题 */
.q-next-area {
    text-align: center;
}

/* 空状态 */
.q-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}
.q-empty-icon {
    font-size: 40px;
    margin-bottom: 10px;
}
.q-empty p {
    font-size: 14px;
    margin-bottom: 16px;
}
.q-empty .gen-btn {
    width: auto;
    display: inline-block;
    padding: 10px 24px;
}

/* 加载状态 */
.q-loading {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: 14px;
}

/* 快捷操作按钮 */
.btn-row {
    display: flex;
    gap: 6px;
}
.btn-row .gen-btn {
    flex: 1;
    padding: 7px 10px;
    font-size: 11px;
    border-radius: 8px;
}

/* 仪表盘部分 */
.dash-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 14px;
}
.dash-stat-item {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    text-align: center;
}
.dash-stat-val {
    font-size: 24px;
    font-weight: 800;
    color: var(--primary);
    line-height: 1;
    margin-bottom: 4px;
}
.dash-stat-label {
    font-size: 11px;
    color: var(--text-muted);
}

/* 章节进度条 */
.ch-bar-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}
.ch-bar-label {
    font-size: 10px;
    color: var(--text-muted);
    width: 36px;
    text-align: right;
    flex-shrink: 0;
}
.ch-bar-track {
    flex: 1;
    height: 6px;
    background: var(--input-bg);
    border-radius: 3px;
    overflow: hidden;
}
.ch-bar-fill {
    height: 100%;
    background: var(--primary-gradient, linear-gradient(135deg, #6366F1, #8B5CF6));
    border-radius: 3px;
    transition: width 0.5s ease;
}
.ch-bar-num {
    font-size: 10px;
    color: var(--text-muted);
    width: 50px;
    flex-shrink: 0;
}

/* 热力图 */
.heatmap-grid {
    display: flex;
    gap: 4px;
    justify-content: center;
    margin-bottom: 10px;
}
.heat-cell {
    width: 30px;
    height: 30px;
    border-radius: 5px;
    background: var(--card);
    border: 1px solid var(--border);
}
.heat-cell.lvl1 { background: rgba(52, 211, 153, 0.2); }
.heat-cell.lvl2 { background: rgba(52, 211, 153, 0.4); }
.heat-cell.lvl3 { background: rgba(52, 211, 153, 0.7); }

/* 仪表板总结 */
.dash-summary {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.8;
}

/* ============================================================
   商业化 UI（第 1 期新增）
   试学横幅 / 锁定态空状态 / 多 SKU 购买页 / 我的题库
   ============================================================ */

/* ---- 试学横幅 ---- */
.trial-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    margin-bottom: 10px;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.14) 0%, rgba(245, 158, 11, 0.06) 100%);
    border: 1px solid rgba(245, 158, 11, 0.28);
}
.trial-info { flex: 1; min-width: 0; }
.trial-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.trial-sub {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
}
.trial-btn {
    flex-shrink: 0;
    padding: 6px 14px;
    border: none;
    border-radius: 14px;
    background: var(--primary-gradient);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: var(--shadow-btn);
}
.trial-btn:active { transform: scale(0.96); }

/* ---- 锁定态空状态 ---- */
.q-locked { text-align: center; padding: 32px 20px; }
.q-locked .q-empty-icon { font-size: 42px; margin-bottom: 12px; }
.q-locked p { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.q-locked-sub {
    font-size: 12px !important;
    font-weight: 400 !important;
    color: var(--text-secondary) !important;
    line-height: 1.7;
    margin-bottom: 14px !important;
}
.q-locked .gen-btn { margin: 4px 4px 0; }

/* ---- 多 SKU 购买页 ---- */
.sku-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    text-align: center;
}
.sku-tagline {
    font-size: 12px;
    color: var(--text-secondary);
    text-align: center;
    margin: 6px 0 12px;
    line-height: 1.6;
}
/* .purchase-card / .recommend-badge / .price-row 等沿用上方「购买页面」已有样式 */
.purchase-note {
    background: var(--card);
    border: 1px solid var(--border);
    border-left: 3px solid var(--primary);
    border-radius: 8px;
    padding: 12px 14px;
    font-size: 11.5px;
    line-height: 1.8;
    color: var(--text-secondary);
    margin-top: 4px;
}
.purchase-note b { color: var(--text); }

/* ---- 激活页提示 ---- */
.activate-tip {
    font-size: 11.5px;
    color: var(--text-muted);
    text-align: center;
    margin-top: 12px;
    line-height: 1.6;
}

/* ---- 我的题库 ---- */
.lib-empty {
    text-align: center;
    padding: 16px 10px;
}
.lib-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-top: 1px solid var(--border-light);
}
.lib-item:first-child { border-top: none; }
.lib-item-main { flex: 1; min-width: 0; }
.lib-item-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.lib-item-sub {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 3px;
}
.lib-badge {
    flex-shrink: 0;
    font-size: 11px;
    font-weight: 600;
    color: var(--success);
    background: rgba(52, 211, 153, 0.14);
    padding: 3px 10px;
    border-radius: 10px;
}
.lib-use-btn {
    flex-shrink: 0;
    font-size: 11px;
    font-weight: 600;
    color: var(--primary);
    background: var(--primary-light);
    border: 1px solid var(--border);
    padding: 4px 12px;
    border-radius: 10px;
    cursor: pointer;
}
.lib-use-btn:active { transform: scale(0.96); }

/* ===================================================================
   真机（窄屏）适配
   桌面端是「左手机 + 右仪表盘」的双屏演示；真机上要去掉演示外壳，
   让主应用铺满整屏，仪表盘用一个悬浮按钮切换。
   断点 520px：竖屏手机全命中，横屏手机与平板保留演示布局。
   =================================================================== */

/* 桌面端隐藏切换按钮 */
.mobile-view-toggle {
    display: none;
    position: fixed;
    right: 14px;
    bottom: calc(84px + env(safe-area-inset-bottom, 0px));
    z-index: 9998;
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-size: 20px;
    line-height: 1;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.mobile-view-toggle:active { transform: scale(0.94); }

@media (max-width: 520px) {
    /* 去掉演示画布的留白与并排间距 */
    body {
        display: block;
        padding: 0;
        gap: 0;
        min-height: 100dvh;
        background: var(--bg);
    }

    /* 演示标签、PROTOTYPE 徽章在真机上是多余装饰 */
    .demo-label,
    .prototype-badge {
        display: none !important;
    }

    /* 一次只显示一个视图，由 is-active 决定 */
    .phone-wrapper {
        display: none;
        width: 100%;
        gap: 0;
    }
    .phone-wrapper.is-active {
        display: block;
    }

    /* 去掉手机外壳边框，铺满视口 */
    .phone-frame {
        width: 100%;
        height: 100dvh;
        border-radius: 0;
        box-shadow: none;
        display: flex;
        flex-direction: column;
    }

    /* 真机有系统状态栏，隐藏模拟的那一条 */
    .status-bar {
        display: none;
    }

    /* 内容区改为弹性撑满，不再写死 812px 计算 */
    .main-content {
        height: auto;
        flex: 1 1 auto;
        min-height: 0;
        -webkit-overflow-scrolling: touch;
    }

    /* 底部导航避开 iPhone 手势条 */
    .bottom-nav {
        height: calc(58px + env(safe-area-inset-bottom, 0px));
        padding-bottom: env(safe-area-inset-bottom, 0px);
        flex: 0 0 auto;
    }
    .app-header {
        flex: 0 0 auto;
        padding-top: calc(8px + env(safe-area-inset-top, 0px));
    }

    /* 仪表盘那一屏本身可滚动，留出底部安全区 */
    #dashWrapper .phone-frame {
        height: 100dvh;
        padding: 16px 12px calc(24px + env(safe-area-inset-bottom, 0px));
    }

    .mobile-view-toggle {
        display: flex;
    }
}

/* 横屏手机：外壳太矮，直接让它跟着视口走 */
@media (max-height: 520px) and (max-width: 900px) {
    .phone-frame {
        height: 100dvh;
        border-radius: 0;
    }
    body { padding: 0; gap: 0; }
}

/* ==================================================================
   用户卡片 + 登录弹窗
   ================================================================== */
.user-card {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}
.user-card:active { opacity: 0.75; }
.user-avatar {
    width: 50px;
    height: 50px;
    border-radius: 25px;
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #fff;
    flex-shrink: 0;
}
.user-meta { flex: 1; min-width: 0; }
.user-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.user-sub {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.user-arrow { font-size: 16px; color: var(--text-muted); }

.modal-mask {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
    backdrop-filter: blur(2px);
}
.modal-mask[hidden] { display: none; }

.modal-card {
    width: 100%;
    max-width: 340px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 22px 20px 16px;
    box-shadow: var(--shadow-lg);
}
.modal-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 6px;
}
.modal-desc {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 14px;
}
.modal-input {
    width: 100%;
    box-sizing: border-box;
    background: var(--card-elevated);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 11px 13px;
    font-size: 15px;
    color: var(--text);
    font-family: inherit;
    margin-bottom: 10px;
    outline: none;
}
.modal-input:focus { border-color: var(--primary); }
.modal-error {
    font-size: 12px;
    color: var(--danger, #e5484d);
    margin: -2px 0 10px;
    line-height: 1.5;
}
.modal-error[hidden] { display: none; }

.modal-card .btn { width: 100%; margin-top: 8px; }
.btn-text {
    background: transparent;
    color: var(--text-muted);
    font-size: 13px;
    padding: 10px;
    box-shadow: none;
}
.btn-danger {
    background: var(--danger, #e5484d) !important;
}
