* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563EB;
    --primary-hover: #1D4ED8;
    --primary-light: #EFF6FF;
    --primary-glow: rgba(37, 99, 235, 0.12);
    --accent-color: #3B82F6;
    --secondary-color: #F1F5F9;
    --success-color: #10B981;
    --warning-color: #F59E0B;
    --danger-color: #EF4444;
    --text-primary: #0F172A;
    --text-secondary: #475569;
    --text-muted: #94A3B8;
    --border-color: #E2E8F0;
    --border-light: #F1F5F9;
    --bg-white: #FFFFFF;
    --bg-gray: #F8FAFC;
    --bg-deep: #F1F5F9;
    --sidebar-bg: #FAFBFF;
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
    --shadow-glow: 0 0 20px rgba(37, 99, 235, 0.12);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    --font-sans: system-ui, -apple-system, 'Segoe UI', Roboto, 'Noto Sans SC', 'Source Han Sans SC', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', sans-serif;
    --font-serif: 'Times New Roman', 'SimSun', 'Songti SC', 'STSong', serif;
    --font-mono: 'Cascadia Code', 'Fira Code', 'Source Code Pro', Menlo, Consolas, 'DejaVu Sans Mono', monospace;
    --heading-font: system-ui, -apple-system, 'Segoe UI', Roboto, 'Noto Sans SC', 'Source Han Sans SC', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', sans-serif;
    --h1-size: 26px;
    --h1-weight: 700;
    --h1-height: 1.35;
    --h1-spacing: 0.02em;
    --h1-color: #0F172A;
    --h1-margin-top: 0;
    --h1-margin-bottom: 16px;
    --h2-size: 20px;
    --h2-weight: 600;
    --h2-height: 1.4;
    --h2-spacing: 0.015em;
    --h2-color: #1E293B;
    --h2-margin-top: 28px;
    --h2-margin-bottom: 12px;
    --h3-size: 16px;
    --h3-weight: 600;
    --h3-height: 1.45;
    --h3-spacing: 0.01em;
    --h3-color: #334155;
    --h3-margin-top: 20px;
    --h3-margin-bottom: 8px;
    --h4-size: 14px;
    --h4-weight: 600;
    --h4-height: 1.5;
    --h4-spacing: 0.005em;
    --h4-color: #475569;
    --h4-margin-top: 16px;
    --h4-margin-bottom: 6px;
    --l1-font-weight: 600;
    --l1-font-size: 14px;
    --l1-letter-spacing: 0.04em;
    --l1-color: #1E293B;
    --l1-bg: transparent;
    --l1-border-left: none;
    --l1-text-transform: none;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-gray);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4 {
    font-family: var(--heading-font);
    line-height: var(--h1-height);
    letter-spacing: var(--h1-spacing);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1 {
    font-size: var(--h1-size);
    font-weight: var(--h1-weight);
    line-height: var(--h1-height);
    letter-spacing: var(--h1-spacing);
    color: var(--h1-color);
    margin-top: var(--h1-margin-top);
    margin-bottom: var(--h1-margin-bottom);
}

h2 {
    font-size: var(--h2-size);
    font-weight: var(--h2-weight);
    line-height: var(--h2-height);
    letter-spacing: var(--h2-spacing);
    color: var(--h2-color);
    margin-top: var(--h2-margin-top);
    margin-bottom: var(--h2-margin-bottom);
}

h3 {
    font-size: var(--h3-size);
    font-weight: var(--h3-weight);
    line-height: var(--h3-height);
    letter-spacing: var(--h3-spacing);
    color: var(--h3-color);
    margin-top: var(--h3-margin-top);
    margin-bottom: var(--h3-margin-bottom);
}

h4 {
    font-size: var(--h4-size);
    font-weight: var(--h4-weight);
    line-height: var(--h4-height);
    letter-spacing: var(--h4-spacing);
    color: var(--h4-color);
    margin-top: var(--h4-margin-top);
    margin-bottom: var(--h4-margin-bottom);
}

.app-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 320px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
}

.sidebar-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, var(--sidebar-bg) 0%, var(--primary-light) 100%);
    position: relative; /* Account Menu 绝对定位锚点 */
}

.sidebar-header.is-member {
    background: linear-gradient(135deg, var(--sidebar-bg) 0%, rgba(255, 237, 213, 0.68) 100%);
}

.sidebar-header.is-member .user-level-text {
    color: #EA580C;
    font-size: 11px;
    font-weight: 600;
}

.sidebar-header.is-member .unlock-quota-text {
    color: #EA580C;
    font-size: 13px;
    font-weight: 700;
}

.sidebar-header.is-member .user-status-info:hover .user-level-text {
    color: #D94805;
}

.sidebar-header.is-member .user-status-info:hover .unlock-quota-text {
    color: #D94805;
}

/* ===== Account Menu（头像点击展开的 popover，复用 history.back 返回链） ===== */
.account-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 12px;
    width: 220px;
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 6px;
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity var(--transition-fast), transform var(--transition-fast), visibility var(--transition-fast);
}

.account-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.account-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text-primary);
    font-size: 14px;
    transition: background var(--transition-fast), color var(--transition-fast);
    user-select: none;
}

.account-menu-item:hover {
    background: var(--primary-light);
    color: var(--primary-color);
}

.account-menu-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-menu-divider {
    height: 1px;
    background: var(--border-light);
    margin: 4px 8px;
}

.account-menu-item-danger {
    color: var(--danger-color);
}

.account-menu-item-danger:hover {
    background: rgba(239, 68, 68, 0.08);
    color: var(--danger-color);
}

/* ===== 账号资料：手机号显示 ===== */
.profile-phone-display {
    flex: 1;
    color: var(--text-secondary);
    font-size: 14px;
    padding: 8px 12px;
    background: var(--bg-gray);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
}

/* ===== 关于页面 ===== */
.about-content {
    text-align: center;
    padding: 24px 16px;
}

.about-logo {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-lg);
    margin: 0 auto 12px;
    display: block;
    object-fit: cover;
    box-shadow: var(--shadow-md);
}

.about-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 6px;
}

.about-version {
    color: var(--text-muted);
    font-size: 13px;
    margin: 0 0 16px;
}

.about-wechat {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    margin: 0 auto 16px;
    background: var(--bg-gray);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background var(--transition-fast);
    user-select: none;
}

.about-wechat:hover {
    background: var(--primary-light);
}

.about-wechat-label {
    color: var(--text-muted);
    font-size: 13px;
}

.about-wechat-value {
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
}

.about-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    font-size: 13px;
}

.about-link {
    color: var(--primary-color);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.about-link:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

.about-link-sep {
    color: var(--text-muted);
}

.about-copyright {
    color: var(--text-muted);
    font-size: 12px;
    margin: 0;
}

/* ===== Toast（轻量提示，用于微信号复制等） ===== */
/* 使用 #toast ID 选择器提升优先级，避免与下方通用 .toast 弹窗系统样式冲突 */
#toast {
    position: fixed;
    bottom: 120px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(15, 23, 42, 0.92);
    color: #fff;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-size: 14px;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease;
    pointer-events: none;
    box-shadow: var(--shadow-lg);
    white-space: nowrap;
}

#toast.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.user-panel-compact {
    flex: 1;
    min-width: 0;
}

.user-panel-compact .user-panel-guest {
    display: flex;
    gap: 8px;
}

.user-panel-compact .user-panel-logged {
    display: flex;
    align-items: center;
}

.user-panel-compact .user-info-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-panel-compact .user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
    cursor: pointer;
}

.user-panel-compact .user-meta {
    flex: 1;
    min-width: 0;
}

.user-panel-compact .user-name {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-panel-compact .user-level {
    display: inline-block;
    font-size: 10px;
    padding: 1px 8px;
    border-radius: 10px;
    margin-top: 2px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.user-quota-row {
    display: none; /* 旧 DOM 已废弃，隐藏防止残留 */
}

.quota-item {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
}

.quota-item span {
    color: var(--text-secondary);
    font-weight: 600;
}

/* ===== 新版会员权限：顶部用户状态组件（昵称右侧） ===== */
.user-status-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 1px;
    min-width: 48px;
    margin-left: 12px;
    flex-shrink: 0;
    line-height: 1.2;
    visibility: hidden; /* 默认隐藏，等 fetchUser 完成填充文本后再显示 */
    cursor: pointer;
}

.user-status-info:hover .user-level-text,
.user-status-info:hover .unlock-quota-text {
    color: var(--text-primary);
}

.user-status-info:focus-visible {
    outline: 2px solid rgba(37, 99, 235, 0.45);
    outline-offset: 2px;
}

.user-level-text {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
    white-space: nowrap;
}

.unlock-quota-text {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
    white-space: nowrap;
    position: relative;
    top: 2px;
}

.unlock-quota-text.quota-unlimited {
    color: var(--text-secondary);
    font-weight: 700;
}

.quota-unlimited {
    color: #52C41A;
    font-weight: 600;
}

.btn-upgrade-small {
    width: 28px;
    height: 28px;
    border: none;
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    border-radius: 50%;
    cursor: pointer;
    font-size: 12px;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(245, 158, 11, 0.3);
    transition: all 0.2s ease;
}

.btn-upgrade-small:hover {
    transform: scale(1.15);
    box-shadow: 0 3px 10px rgba(245, 158, 11, 0.5);
}

.btn-refresh {
    width: 34px;
    height: 34px;
    border: none;
    background: var(--bg-white);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 16px;
    color: var(--text-secondary);
    transition: all var(--transition-base);
    box-shadow: var(--shadow-xs);
}

.btn-refresh:hover {
    background: var(--primary-color);
    color: white;
    transform: rotate(180deg);
    box-shadow: var(--shadow-glow);
}

.sidebar-close-btn {
}

.btn-auth {
    flex: 1;
    padding: 7px 0;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    letter-spacing: 0.3px;
}

.btn-login {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.btn-login:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.btn-register {
    background: var(--bg-white);
    color: var(--primary-color);
    border: 1.5px solid var(--primary-color);
}

.btn-register:hover {
    background: var(--primary-light);
    transform: translateY(-1px);
}

.level-free { background: #F1F5F9; color: #64748B; }
.level-basic { background: #DBEAFE; color: #2563EB; }
.level-premium { background: #FEF3C7; color: #D97706; }
.level-vip { background: #FCE7F3; color: #DB2777; }

.settings-group-logout {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-light);
}

.setting-item-logout {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.setting-item-logout .setting-label {
    color: var(--danger-color);
}

.setting-item-logout .setting-desc {
    color: var(--text-muted);
}

.btn-logout-inline {
    padding: 6px 16px;
    border: 1px solid var(--danger-color);
    background: transparent;
    color: var(--danger-color);
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-logout-inline:hover {
    background: var(--danger-color);
    color: white;
}

.btn-setting-action {
    padding: 6px 16px;
    border: 1px solid var(--primary-color);
    background: transparent;
    color: var(--primary-color);
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.btn-setting-action:hover {
    background: var(--primary-color);
    color: white;
}

.setting-item-profile {
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
}

.setting-item-profile:hover {
    background: var(--bg-deep);
}

.setting-item-profile::after {
    content: '›';
    font-size: 16px;
    color: var(--text-muted);
    transition: transform var(--transition-fast);
}

.setting-item-profile.open::after {
    transform: rotate(90deg);
}

.profile-edit {
    padding: 12px 0 4px;
}

.profile-edit-row {
    margin-bottom: 12px;
}

.profile-edit-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.profile-edit-input {
    width: 100%;
    padding: 8px 12px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-primary);
    background: var(--bg-white);
    outline: none;
    transition: border-color var(--transition-fast);
    box-sizing: border-box;
}

.profile-edit-input:focus {
    border-color: var(--primary-color);
}

.profile-avatar-upload {
    display: flex;
    align-items: center;
    gap: 12px;
}

.profile-avatar-preview {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 2px dashed var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    overflow: hidden;
    transition: border-color var(--transition-fast);
    background: var(--bg-gray);
    flex-shrink: 0;
}

.profile-avatar-preview:hover {
    border-color: var(--primary-color);
}

#profileAvatarPlaceholder {
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.3;
}

#profileAvatarImg {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-avatar-hint {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.4;
}

.profile-edit-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 8px;
}

.profile-edit-save {
    padding: 6px 20px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.profile-edit-save:hover {
    background: var(--primary-hover);
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-smooth);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

#membershipModal {
    z-index: 10010;
}

.modal {
    background: white;
    border-radius: var(--radius-xl);
    width: 400px;
    max-width: 90vw;
    box-shadow: var(--shadow-xl);
    transform: translateY(24px) scale(0.96);
    transition: transform var(--transition-smooth);
}

.modal-overlay.active .modal {
    transform: translateY(0) scale(1);
}

.modal-wide {
    width: 800px;
    max-width: 95vw;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 22px 28px;
    border-bottom: 1px solid var(--border-light);
}

.modal-header h3 {
    font-size: 18px;
    font-weight: var(--h3-weight);
    color: var(--h3-color);
    margin-top: 0;
    margin-bottom: 0;
}

.modal-close {
    width: 34px;
    height: 34px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-sm);
    font-size: 16px;
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--secondary-color);
    color: var(--text-primary);
}

.modal-body {
    padding: 28px;
}

/* modal 滚动条统一风格：滚动容器为 .modal-overlay（与 cover-auth-modal 一致）。
   桌面端生效；移动端全局 * { scrollbar-width:none } 已隐藏。
   Firefox: scrollbar-width + scrollbar-color；WebKit: 6px thumb + var(--border-color)。 */
.modal-overlay {
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}
.modal-overlay::-webkit-scrollbar {
    width: 6px;
}
.modal-overlay::-webkit-scrollbar-track {
    background: transparent;
}
.modal-overlay::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}
.modal-overlay::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* 试题篮按钮：任意 modal 打开期间隐藏（由 app.js MutationObserver 同步 body.modal-open） */
body.modal-open .basket-entry-btn {
    display: none;
}

/* 修改密码弹窗紧凑化：复用 .profile-edit 风格，与账号资料页视觉一致。
   仅 #changePasswordModal 作用域，不影响 authModal 等其他使用 .form-group/.btn-submit 的弹窗。
   对齐 .profile-edit-row(12px) / .profile-edit-label(12px/6px) / .profile-edit-input(8px 12px/13px) / .profile-edit-save(右对齐小按钮)。 */
#changePasswordModal .form-group {
    margin-bottom: 12px;
}
#changePasswordModal .form-group label {
    font-size: 12px;
    margin-bottom: 6px;
}
#changePasswordModal .form-group input {
    padding: 8px 12px;
    font-size: 13px;
}
#changePasswordModal .btn-sms {
    padding: 8px 14px;
    font-size: 12px;
}
#changePasswordModal .form-error {
    font-size: 12px;
    margin-bottom: 4px;
    min-height: 16px;
}
#changePasswordModal .btn-submit {
    display: block;
    width: 140px;
    padding: 10px 24px;
    font-size: 13px;
    border-radius: var(--radius-sm);
    margin: 4px auto 0;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}
#changePasswordModal .btn-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(37, 99, 235, 0.35);
}

/* 移动端 modal 对齐策略（与 cover-auth-modal 一致）。
   全端统一：.modal-overlay 作为唯一滚动容器，.modal 保持自然高度不缩压。
   键盘弹出时 .modal 不收缩，由 overlay 滚动查看，保证弹窗矩形稳定。

   对齐策略（align-items）：
   - 默认 flex-start（fallback）：不支持 safe center 的极老 WebView 使用，长内容友好，短内容顶部对齐。
   - @supports safe center：现代 WebView 使用，短内容自动居中、长内容自动顶部对齐，避免短 modal 顶部大空白。 */
@media (max-width: 768px) {
    .modal-overlay {
        -webkit-overflow-scrolling: touch;
        align-items: flex-start;
        padding: 20px 0;
    }
    .modal-overlay::-webkit-scrollbar {
        display: none;
    }
    .modal {
        margin: auto;
    }
}

/* 现代环境：短内容 modal 居中、长内容 modal 顶部对齐，自动适配。
   @supports 检测 align-items: safe center，不支持的环境保留上述 flex-start fallback。 */
@supports (align-items: safe center) {
    @media (max-width: 768px) {
        .modal-overlay {
            align-items: safe center;
        }
    }
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 7px;
}

.form-group input {
    width: 100%;
    padding: 11px 16px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text-primary);
    transition: all var(--transition-base);
    outline: none;
    background: var(--bg-white);
}

.form-group input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-sms-group .sms-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.form-sms-group .sms-row input {
    flex: 1;
    min-width: 0;
}

.btn-sms {
    flex-shrink: 0;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    background: transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-sms:hover:not(:disabled) {
    background: var(--primary-light);
}

.btn-sms:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    border-color: var(--border-color);
    color: var(--text-muted);
}

/* 密码显示/隐藏切换 */
.pwd-row {
    display: flex;
    align-items: center;
    position: relative;
}

.pwd-row input {
    flex: 1;
    padding-right: 40px;
}

.btn-pwd-toggle {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: #9CA3AF;
    display: flex;
    align-items: center;
    transition: color 0.2s;
}

.btn-pwd-toggle:hover {
    color: #6B7280;
}

.btn-pwd-toggle svg {
    width: 18px;
    height: 18px;
}

.form-error {
    color: var(--danger-color);
    font-size: 13px;
    min-height: 20px;
    margin-bottom: 8px;
}

.btn-submit {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.btn-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.4);
}

.btn-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.auth-switch {
    text-align: center;
    margin-top: 18px;
    font-size: 13px;
    color: var(--text-muted);
}

.auth-switch a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

.auth-switch a:hover {
    text-decoration: underline;
}

/* Phase 4.0: 海外手机号入口 */
.auth-intl-entry {
    text-align: center;
    margin-top: 10px;
    font-size: 12px;
    color: var(--text-muted);
}

.auth-intl-entry a {
    color: var(--text-muted);
    text-decoration: none;
}

.auth-intl-entry a:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

/* Phase 4.0: 海外手机号认证弹窗 — 国家选择器 */
.form-select {
    width: 100%;
    padding: 11px 16px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text-primary);
    background: var(--bg-white);
    outline: none;
    transition: all var(--transition-base);
    font-family: inherit;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%2394A3B8' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
}

.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

/* 国家/地区选择按钮（替代原生 select） */
.form-select-btn {
    width: 100%;
    padding: 11px 16px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text-primary);
    background: var(--bg-white);
    outline: none;
    transition: all var(--transition-base);
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.form-select-btn:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-select-btn .select-arrow {
    width: 12px;
    height: 8px;
    flex-shrink: 0;
    color: var(--text-secondary);
    transition: transform 0.2s ease;
}

/* 国家/地区选择 dropdown（内联展开，absolute 定位，不锁 body，无遮罩）（浅色主题） */
.country-selector {
    position: relative;
}

.country-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 10;
    display: none;
    max-height: 220px;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    /* Firefox 滚动条（局部，仅本 dropdown） */
    scrollbar-width: thin;
    scrollbar-color: rgba(100, 116, 139, 0.4) transparent;
}

.country-selector.open .country-dropdown {
    display: block;
}

.country-selector.open .select-arrow {
    transform: rotate(180deg);
}

/* dropdown 局部滚动条（仅 .country-dropdown，不影响其他区域；浅色主题） */
.country-dropdown::-webkit-scrollbar {
    width: 6px;
}
.country-dropdown::-webkit-scrollbar-track {
    background: transparent;
}
.country-dropdown::-webkit-scrollbar-thumb {
    background: rgba(100, 116, 139, 0.4);
    border-radius: 3px;
}
.country-dropdown::-webkit-scrollbar-thumb:hover {
    background: rgba(100, 116, 139, 0.6);
}

.country-list {
    padding: 4px 0;
}

.country-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 16px;
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.15s;
}

.country-list-item:hover {
    background: var(--bg-hover);
}

.country-list-item.selected {
    color: var(--primary-color);
    background: var(--primary-glow);
    font-weight: 500;
}

.country-list-item .country-prefix {
    color: var(--text-secondary);
    font-size: 13px;
}

.country-list-item.selected .country-prefix {
    color: var(--primary-color);
}

/* Phase 4.0: 海外手机号认证弹窗 — 手机号输入（带前缀） */
.intl-phone-row {
    display: flex;
    align-items: center;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-white);
    transition: all var(--transition-base);
    overflow: hidden;
}

.intl-phone-row:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.intl-phone-prefix {
    flex-shrink: 0;
    padding: 11px 14px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--primary-light);
    border-right: 1px solid var(--border-color);
    min-width: 56px;
    text-align: center;
}

.intl-phone-row input {
    flex: 1;
    min-width: 0;
    border: none;
    padding: 11px 16px;
    font-size: 14px;
    color: var(--text-primary);
    background: transparent;
    outline: none;
    font-family: inherit;
}

.intl-phone-row input::placeholder {
    color: var(--text-muted);
}

/* Phase 4.0: 海外手机号认证弹窗 — 海外号码提示 */
.intl-auth-notice {
    margin-bottom: 16px;
    padding: 10px 14px;
    background: #FFFBE6;
    border: 1px solid #FFE58F;
    border-radius: var(--radius-sm);
    font-size: 12px;
    color: #AD8B00;
    line-height: 1.5;
}

/* 登录方式切换标签 */
.auth-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 18px;
    border-bottom: 2px solid var(--border-color);
}

.auth-tab {
    flex: 1;
    padding: 8px 0;
    border: none;
    background: none;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
}

.auth-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.auth-tab:hover:not(.active) {
    color: var(--text-secondary);
}

/* 注册协议勾选 */
.auth-agree {
    margin: 6px 0 4px;
    font-size: 13px;
    color: #666;
}
.auth-agree label {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    cursor: pointer;
    line-height: 1.5;
}
.auth-agree input[type="checkbox"] {
    margin-top: 3px;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    accent-color: #4a6cf7;
}
.auth-agree a {
    color: #4a6cf7;
    text-decoration: none;
    white-space: nowrap;
}
.auth-agree a:hover {
    text-decoration: underline;
}
.auth-captcha {
    margin: 8px 0;
}
.agree-br {
    display: none;
}
@media (max-width: 480px) {
    .agree-br {
        display: block;
    }
    /* 移动端允许滚动但隐藏滚动条 */
    html, body {
        overflow-y: auto;
        overflow-x: hidden;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    html::-webkit-scrollbar,
    body::-webkit-scrollbar {
        width: 0;
        height: 0;
        display: none;
    }
}

/* 忘记密码 */
.auth-forgot {
    text-align: right;
    margin-top: 6px;
}

.auth-forgot a {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
}

.auth-forgot a:hover {
    text-decoration: underline;
}

.membership-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.membership-card {
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 22px 18px;
    text-align: center;
    transition: all var(--transition-base);
    position: relative;
}

.membership-card.current {
    border-color: var(--primary-color);
    background: var(--primary-light);
}

.membership-card.locked:hover {
    border-color: var(--primary-color);
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.mc-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.mc-price {
    font-size: 28px;
    font-weight: 800;
    color: var(--primary-color);
    margin-bottom: 16px;
}

.mc-price span {
    font-size: 13px;
    font-weight: 400;
    color: var(--text-muted);
}

.mc-features {
    list-style: none;
    text-align: left;
    margin-bottom: 16px;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 2;
}

.mc-btn {
    width: 100%;
    padding: 9px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
}

.mc-btn-current {
    background: var(--secondary-color);
    color: var(--text-muted);
    cursor: default;
}

.mc-btn-upgrade {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.mc-btn-upgrade:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.mc-btn-downgrade {
    background: var(--secondary-color);
    color: var(--text-secondary);
    cursor: default;
}

.watermark-layer {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 999;
    display: none;
}

.filter-section {
    position: relative;
    padding: 6px 10px;
    border-bottom: 1px solid var(--border-light);
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(0, 1.5fr);
    gap: 5px;
    align-items: flex-start;
    background: var(--bg-white);
}

.filter-btn-wrap {
    position: relative;
    flex: 1;
    min-width: 0;
}

.filter-section.has-review { grid-template-columns: repeat(4, minmax(0, 1fr)) minmax(0, 1.5fr); }

.filter-btn {
    width: 100%;
    padding: 5px 3px;
    height: 32px;
    min-height: 32px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    background: #fff;
    cursor: pointer;
    transition: background .18s, color .18s, border-color .18s, box-shadow .18s;
    text-align: center;
}

.filter-btn:hover {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.filter-btn.active {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: white;
}

.filter-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--bg-white);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    z-index: 200;
    overflow: hidden;
}

.filter-dropdown.show {
    display: block;
}

.filter-btn-adv.has-filter {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.filter-btn-adv.has-find:not(.active):not(.has-filter) {
    color: var(--primary-color);
    border-color: #b6cef8;
    background: #f1f6ff;
}

.directory-find-wrap { position: static; }
.filter-section .directory-find-panel {
    width: 248px;
    max-width: calc(100% - 24px);
    left: auto;
    right: 12px;
    padding: 10px;
    border: 1px solid #e1e7ef;
    border-radius: 12px;
    box-shadow: 0 12px 36px rgba(30, 48, 76, .13);
}

.directory-find-label {
    padding: 8px 8px 6px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 500;
}

.directory-find-divider {
    margin-top: 6px;
}

.directory-find-modes {
    display: flex;
    gap: 3px;
    padding: 4px;
    border-radius: 8px;
    background: #f2f5f9;
}

.directory-find-modes .find-dropdown-item {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    flex: 1;
    min-width: 0;
    padding: 9px 2px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    font: inherit;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
}

.directory-find-filters,
.directory-find-footer {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}
.directory-find-filters .filter-adv-category,
.directory-find-footer .filter-adv-category { display: contents; }
.directory-find-filters .filter-adv-cat-header {
    padding: 10px;
    min-height: 40px;
    border: 1px solid #e7ecf3;
    background: #f8fafc;
    font-weight: 500;
}
.directory-find-filters .filter-adv-sublist,
.directory-find-footer .filter-adv-sublist { grid-column: 1 / -1; order: 1; }
.directory-find-footer {
    margin-top: 12px;
    padding-top: 8px;
    border-top: 1px solid var(--border-light);
}
.directory-find-footer .filter-adv-cat-header {
    padding: 8px;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
}
.directory-find-footer .filter-adv-clear { justify-content: flex-start; color: var(--text-muted); }

.directory-find-modes .find-dropdown-item:hover,
.directory-find-modes .find-dropdown-item.selected {
    color: var(--primary-color);
    background: #fff;
    box-shadow: 0 1px 4px rgba(30, 48, 76, .08);
}

.directory-find-panel .filter-adv-cat-header { border-radius: 6px; }
.directory-find-panel .filter-adv-sublist {
    position: static;
    min-width: 100%;
    max-width: 100%;
    border: 0;
    border-radius: 6px;
    box-shadow: none;
    max-height: 230px;
    overflow-y: auto;
    background: #f8fafc;
}

.directory-find-modes button:focus-visible,
.filter-btn:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.filter-btn-review.active {
    background: #9a3412;
    color: #fff;
    border-color: #9a3412;
}

.review-queue-panel {
    padding: 14px 12px 24px;
}

.review-queue-title {
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 700;
}

.review-queue-summary {
    margin: 5px 0 12px;
    color: var(--text-secondary);
    font-size: 12px;
}

.review-queue-reason-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin: -2px 0 12px;
}

.review-reason-summary-tag {
    padding: 3px 6px;
    border: 1px solid #fed7aa;
    border-radius: 3px;
    background: #fffaf5;
    color: #9a3412;
    font-size: 10px;
    line-height: 1.3;
}

.review-queue-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.review-queue-item {
    width: 100%;
    padding: 9px 10px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    background: var(--bg-white);
    color: var(--text-primary);
    cursor: pointer;
    text-align: left;
    transition: border-color var(--transition-base), background var(--transition-base);
}

.review-queue-item:hover,
.review-queue-item.active {
    border-color: #fb923c;
    background: #fff7ed;
}

.review-queue-item-label {
    display: block;
    overflow: hidden;
    font-size: 13px;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.review-queue-item-reasons {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 5px;
}

.review-reason-tag {
    display: inline-flex;
    padding: 2px 5px;
    border-radius: 3px;
    background: #fff1e6;
    color: #9a3412;
    font-size: 10px;
    line-height: 1.3;
}

.review-empty {
    padding: 28px 16px;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.6;
    text-align: center;
}

.review-breadcrumb-title {
    color: var(--text-primary);
    font-weight: 600;
}

.review-breadcrumb-nav {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: 12px;
}

.review-nav-btn,
.review-close-btn {
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-white);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
}

.review-nav-btn:hover:not(:disabled),
.review-close-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.review-nav-btn:disabled {
    cursor: not-allowed;
    opacity: .4;
}

.review-progress {
    min-width: 48px;
    color: var(--text-secondary);
    font-size: 12px;
    text-align: center;
}

.filter-adv-panel {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 120px;
    background: var(--bg-white);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    z-index: 200;
    overflow: visible;
}

.filter-adv-panel.show {
    display: block;
}

.filter-adv-category {
    position: relative;
}

.filter-adv-cat-header {
    width: 100%;
    border: none;
    background: transparent;
    font-family: inherit;
    text-align: left;
    padding: 9px 14px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    transition: background var(--transition-fast);
    display: flex;
    justify-content: space-between;
    align-items: center;
    white-space: nowrap;
}

.filter-adv-cat-header::after {
    content: '';
    display: inline-block;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 4px 0 4px 6px;
    border-color: transparent transparent transparent var(--text-muted);
    transition: transform var(--transition-fast);
    margin-left: 4px;
}

.filter-adv-clear::after {
    display: none;
}

.filter-adv-action {
    width: 100%;
    min-height: 36px;
    border: none;
    background: transparent;
    font-family: inherit;
    text-align: left;
}

.filter-adv-action:focus-visible,
.filter-adv-cat-header:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: -2px;
}

.filter-adv-category.open .filter-adv-cat-header::after {
    transform: rotate(90deg);
}

.filter-adv-cat-header:hover {
    background: var(--bg-deep);
}

.filter-adv-category.open .filter-adv-cat-header {
    background: var(--primary-glow);
    color: var(--primary-color);
}

.filter-adv-sublist {
    display: none;
    position: absolute;
    left: 100%;
    top: 0;
    min-width: 180px;
    max-width: 240px;
    background: var(--bg-white);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    z-index: 210;
    overflow: hidden;
}

.filter-adv-category.open .filter-adv-sublist {
    display: flex;
    flex-direction: column;
}

.filter-adv-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-gray);
    flex-shrink: 0;
}

.filter-adv-check-all {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
}

.filter-adv-check-all input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: var(--primary-color);
    cursor: pointer;
}

.filter-adv-apply {
    padding: 3px 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--bg-white);
    background: var(--primary-color);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.filter-adv-apply:hover {
    background: var(--primary-hover);
}

.filter-adv-check-list {
    max-height: 260px;
    overflow-y: auto;
    padding: 4px 0;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.filter-adv-check {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    font-size: 12px;
    color: var(--text-primary);
    cursor: pointer;
    transition: background var(--transition-fast);
    user-select: none;
    white-space: nowrap;
}

.filter-adv-check:hover {
    background: var(--bg-deep);
}

.filter-adv-check input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: var(--primary-color);
    cursor: pointer;
    flex-shrink: 0;
}

.filter-loading-dot {
    color: var(--text-muted);
    animation: filterDotPulse 1s infinite;
}

@keyframes filterDotPulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

.filter-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-gray);
    align-items: center;
}

.filter-chip-group {
    display: inline-flex;
    align-items: center;
    gap: 0;
    padding: 2px 8px;
    font-size: 11px;
    color: var(--primary-color);
    background: var(--primary-glow);
    border: 1px solid rgba(37, 99, 235, 0.2);
    border-radius: 10px;
    white-space: nowrap;
    line-height: 1.6;
}

.filter-chip-item {
    cursor: pointer;
    padding: 0 1px;
    border-radius: 3px;
    transition: all var(--transition-fast);
    position: relative;
}

.filter-chip-item:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
}

.filter-chip-item.hover-x {
    color: transparent;
}

.filter-chip-item.hover-x::after {
    content: '×';
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--danger-color);
    font-weight: 700;
    font-size: 13px;
}

.filter-chip-sep {
    color: var(--text-muted);
    margin: 0 1px;
}

.filter-chip-clear {
    font-size: 11px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 10px;
    transition: all var(--transition-fast);
}

.filter-chip-clear:hover {
    color: var(--danger-color);
    background: rgba(239, 68, 68, 0.08);
}

.filter-option {
    padding: 8px 12px;
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.filter-option:hover {
    background: var(--bg-secondary);
}

.filter-option.selected {
    background: var(--primary-glow);
    color: var(--primary-color);
    font-weight: 600;
}

.find-btn-wrap {
    position: relative;
}

.find-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
    overflow: hidden;
}

.find-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(2px);
}

.find-dropdown-item {
    padding: 9px 16px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.12s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.find-dropdown-item:hover {
    background: var(--primary-light);
    color: var(--primary-color);
}

.find-dropdown-item.selected {
    background: linear-gradient(135deg, #EFF6FF, #DBEAFE);
    color: var(--primary-color);
    font-weight: 600;
}

.find-panel {
    border-bottom: 1px solid var(--border-light);
    background: linear-gradient(135deg, #FFFBF5 0%, #FFFFFF 100%);
    animation: findPanelIn 0.2s ease;
    display: flex;
    flex-direction: column;
}

@keyframes findPanelIn {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

.find-panel-body {
    padding: 8px 14px 8px;
}

.find-search-row {
    display: flex;
    gap: 4px;
    align-items: center;
}

.find-search-input {
    flex: 1;
    min-width: 0;
    padding: 6px 10px;
    border: 1.5px solid rgba(249, 115, 22, 0.3);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-primary);
    background: var(--bg-white);
    outline: none;
    transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

.find-search-input:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.15);
}

.find-search-input::placeholder {
    color: var(--text-muted);
    font-size: 12px;
}

.find-panel-close {
    width: 24px;
    height: 24px;
    border: none;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 12px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.12s ease;
    flex-shrink: 0;
}

.find-panel-close:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #EF4444;
}

.find-match-count {
    font-size: 11px;
    color: var(--text-muted);
    min-width: 30px;
    text-align: center;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.find-match-count.has-results {
    color: var(--accent-color);
    font-weight: 600;
}

.find-nav-btn {
    width: 26px;
    height: 26px;
    border: 1px solid var(--border-color);
    background: var(--bg-white);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 10px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-base);
    flex-shrink: 0;
}

.find-nav-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.find-go-btn {
    padding: 6px 14px;
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    white-space: nowrap;
    margin-top: 6px;
    width: 100%;
}

.find-go-btn:hover {
    background: #E8620E;
}

.find-results {
    max-height: 200px;
    overflow-y: auto;
    border-top: 1px solid var(--border-light);
    padding: 4px 0;
}

.find-result-item {
    padding: 6px 14px;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background var(--transition-base);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.find-result-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.find-result-item .highlight,
.tree-item .find-highlight {
    background: #FFA500;
    color: #000000 !important;
    font-weight: 600;
    border-radius: 2px;
    padding: 0 1px;
}

.tree-item.find-match {
    background: rgba(249, 115, 22, 0.10);
    outline: 2px solid rgba(249, 115, 22, 0.5);
    outline-offset: -2px;
    border-radius: var(--radius-sm);
    transition: background 0.15s ease, outline 0.15s ease;
}

.tree-item.find-match.active {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
    outline: 2px solid rgba(249, 115, 22, 0.7);
    outline-offset: -2px;
}

.tree-item.find-match.active .label-number {
    color: rgba(255, 255, 255, 0.6);
}

.tree-item.find-match.active .tree-item-count {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.tree-item.find-match.active .tree-item-icon {
    color: rgba(255, 255, 255, 0.9);
}

.tree-item.find-match.active .find-highlight {
    background: rgba(255, 255, 255, 0.35);
    color: white !important;
    font-weight: 700;
    border-radius: 2px;
    padding: 0 1px;
}

.question-content .find-highlight {
    background: #FFA500;
    color: #000000 !important;
    font-weight: 600;
    border-radius: 2px;
    padding: 0 1px;
}

.question-card.find-match {
    border-left-color: var(--accent-color);
    box-shadow: var(--shadow-md), 0 0 0 2px rgba(249, 115, 22, 0.2);
}

.tree-item.find-match-active {
    background: rgba(249, 115, 22, 0.22);
    outline: 2px solid var(--accent-color);
    outline-offset: -2px;
    border-radius: var(--radius-sm);
}

.tree-item.find-match-active.find-clicked {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
    outline: 2px solid rgba(249, 115, 22, 0.7);
    outline-offset: -2px;
}

.tree-item.find-match-active.find-clicked .label-number {
    color: rgba(255, 255, 255, 0.6);
}

.tree-item.find-match-active.find-clicked .tree-item-count {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.tree-item.find-match-active.find-clicked .tree-item-icon {
    color: rgba(255, 255, 255, 0.9);
}

.tree-item.find-match-active.find-clicked .find-highlight {
    background: rgba(255, 255, 255, 0.35);
    color: white !important;
    font-weight: 700;
    border-radius: 2px;
    padding: 0 1px;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: translateX(0); }
}

.id-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.id-list-header {
    padding: 8px 12px;
    font-size: 12px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 4px;
    font-weight: 500;
}

.id-list-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    font-size: 13px;
}

.id-list-item:hover {
    background: var(--primary-light);
}

.id-list-item.active {
    background: var(--primary-color);
    color: #fff;
}

.id-list-item.active .id-list-tag {
    color: rgba(255,255,255,0.8);
}

.id-list-id {
    font-family: 'Consolas', 'Monaco', monospace;
    font-weight: 600;
    min-width: 56px;
}

.id-list-tag {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tree-container {
    flex: 1;
    overflow-y: auto;
    padding: 8px 10px;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.tree-container::-webkit-scrollbar {
    width: 5px;
}

.tree-container::-webkit-scrollbar-track {
    background: transparent;
}

.tree-container::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}

.tree-container::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.loading {
    text-align: center;
    padding: 50px 20px;
    color: var(--text-muted);
    font-size: 14px;
}

.loading-skeleton {
    padding: 8px 10px;
}

.skeleton-line {
    height: 14px;
    background: linear-gradient(90deg, #e8e8e8 25%, #f5f5f5 50%, #e8e8e8 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
    border-radius: 4px;
    margin-bottom: 8px;
}

.skeleton-line:nth-child(1) { width: 60%; margin-left: 10px; }
.skeleton-line:nth-child(2) { width: 75%; margin-left: 30px; }
.skeleton-line:nth-child(3) { width: 50%; margin-left: 30px; }
.skeleton-line:nth-child(4) { width: 65%; margin-left: 50px; }
.skeleton-line:nth-child(5) { width: 55%; margin-left: 50px; }
.skeleton-line:nth-child(6) { width: 70%; margin-left: 30px; }
.skeleton-line:nth-child(7) { width: 45%; margin-left: 50px; }
.skeleton-line:nth-child(8) { width: 60%; margin-left: 50px; }

@keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.preload-indicator {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 11px;
    color: var(--text-muted);
    background: var(--bg-white);
    box-shadow: var(--shadow-sm);
    transition: opacity 0.5s ease;
    z-index: 10;
    white-space: nowrap;
}

.preload-indicator.preload-done {
    color: var(--success-color);
}

.preload-spinner {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: preload-spin 0.8s linear infinite;
}

@keyframes preload-spin {
    to { transform: rotate(360deg); }
}

.preload-icon {
    font-size: 12px;
}

.preload-close {
    margin-left: 6px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    color: var(--text-muted);
    opacity: 0.6;
    transition: opacity 0.2s;
}

.preload-close:hover {
    opacity: 1;
    color: var(--danger-color);
}

.inline-loading-indicator {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.inline-loading-indicator::after {
    content: '';
    display: block;
    width: 30%;
    height: 100%;
    background: var(--primary-color);
    animation: inline-loading-bar 1s ease-in-out infinite;
}

.inline-loading-indicator.active {
    opacity: 1;
}

@keyframes inline-loading-bar {
    0% { margin-left: -30%; }
    100% { margin-left: 100%; }
}

.tree-node {
    margin-bottom: 1px;
}

.tree-item {
    display: flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 14px;
    color: var(--text-primary);
    position: relative;
    line-height: 1.5;
    letter-spacing: 0.01em;
}

.tree-item:hover {
    background: var(--primary-light);
}

.tree-item.active {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.tree-item.level-1.active,
.tree-item.level-2.active,
.tree-item.level-3.active {
    color: white;
}

.tree-item.level-1.active .label-number,
.tree-item.level-2.active .label-number,
.tree-item.level-3.active .label-number {
    color: rgba(255, 255, 255, 0.6);
}

.tree-item.level-1.active .tree-item-count,
.tree-item.level-2.active .tree-item-count,
.tree-item.level-3.active .tree-item-count {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.tree-item-icon {
    margin-right: 6px;
    font-size: 9px;
    transition: transform var(--transition-base);
    color: var(--text-muted);
    width: 14px;
    text-align: center;
    flex-shrink: 0;
    position: relative;
}

.tree-folder-icon {
    margin-right: 5px;
    font-size: 13px;
    flex-shrink: 0;
    transition: transform var(--transition-fast);
}

.tree-item.level-1 .tree-folder-icon {
    font-size: 15px;
}

.tree-item.level-2 .tree-folder-icon {
    font-size: 13px;
}

.tree-item.level-3 .tree-folder-icon {
    font-size: 12px;
}

.tree-item.active .tree-item-icon {
    color: rgba(255, 255, 255, 0.9);
}

.tree-item-icon.expanded {
    transform: rotate(90deg);
}

.tree-item-icon.leaf {
    color: var(--text-muted);
    margin-left: 2px;
    font-size: 6px;
}

.tree-item.level-1 {
    font-weight: var(--l1-font-weight);
    font-size: var(--l1-font-size);
    padding: 10px 10px;
    line-height: 1.5;
    color: var(--l1-color);
    letter-spacing: var(--l1-letter-spacing);
    background: var(--l1-bg);
    border-left: var(--l1-border-left);
    text-transform: var(--l1-text-transform);
    margin-top: 6px;
}

.tree-item.level-1:first-child {
    margin-top: 0;
}

.tree-item.level-2 {
    font-weight: 600;
    font-size: 13px;
    padding: 7px 10px;
    line-height: 1.5;
    color: #334155;
}

.tree-item.level-3 {
    font-weight: 500;
    font-size: 12.5px;
    padding: 5px 10px;
    line-height: 1.55;
    color: #475569;
}

.tree-item.level-4.clickable {
    font-size: 12px;
    padding: 4px 8px;
    font-weight: 400;
    color: var(--text-secondary);
    line-height: 1.55;
}

.tree-item.level-4 .tree-folder-icon {
    font-size: 11px;
}

.tree-item.level-4 .tree-item-count {
    font-size: 9px;
    padding: 0px 5px;
    background: #F8FAFC;
    color: #94A3B8;
}

.tree-item.level-4.clickable:hover {
    background: var(--primary-light);
    color: var(--primary-color);
}

.tree-item.level-4.clickable.active {
    background: linear-gradient(135deg, #EFF6FF, #DBEAFE);
    color: var(--primary-color);
    box-shadow: none;
}

.tree-item.level-4.clickable.active .tree-item-count {
    background: var(--primary-color);
    color: white;
}

.tree-item-label {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: baseline;
    gap: 3px;
}

.label-number {
    color: var(--text-muted);
    font-weight: 400;
    font-size: 0.9em;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

.tree-item.level-1 .label-number {
    color: #94A3B8;
    font-size: 0.88em;
}

.tree-item.level-2 .label-number {
    color: #94A3B8;
    font-size: 0.88em;
}

.tree-item.level-3 .label-number {
    color: #A1A1AA;
    font-size: 0.86em;
}

.tree-item.level-4 .label-number {
    color: #A1A1AA;
    font-size: 0.84em;
}

.tree-item.active .label-number {
    color: rgba(255, 255, 255, 0.65);
}

.label-text {
    font-weight: inherit;
}

.tree-item-count {
    font-size: 10px;
    color: var(--text-muted);
    background: var(--secondary-color);
    padding: 1px 7px;
    border-radius: 8px;
    margin-left: 6px;
    font-weight: 600;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
    line-height: 1.6;
}

.tree-item.level-1 .tree-item-count {
    font-size: 10px;
    padding: 1px 8px;
    background: #E2E8F0;
    color: #64748B;
}

.tree-item.level-2 .tree-item-count {
    font-size: 10px;
    padding: 1px 7px;
    background: #EFF6FF;
    color: #3B82F6;
}

.tree-item.level-3 .tree-item-count {
    font-size: 9px;
    padding: 1px 6px;
    background: #F1F5F9;
    color: #94A3B8;
}

.tree-item.active .tree-item-count {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.tree-item.highlighted {
    background: rgba(249, 115, 22, 0.12);
    outline: 2px solid var(--accent-color);
    outline-offset: -2px;
    border-radius: var(--radius-sm);
}

.tree-children {
    margin-left: 14px;
    border-left: 1px solid #F1F5F9;
    padding-left: 4px;
    overflow: hidden;
}

.tree-item.level-1 + .tree-children {
    margin-left: 10px;
    border-left-color: #E2E8F0;
}

.tree-item.level-2 + .tree-children {
    margin-left: 12px;
    border-left-color: #EFF6FF;
}

.tree-item.level-3 + .tree-children {
    margin-left: 10px;
    border-left-color: #F1F5F9;
}

.tree-children.expanded {
    display: block;
    animation: fadeSlideIn 0.2s ease-out;
}

.tree-children.collapsed {
    display: none;
}

@keyframes fadeSlideIn {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.question-list {
    margin-top: 4px;
}

.question-list-item {
    padding: 7px 14px;
    font-size: 13px;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
}

.question-list-item:hover {
    background: var(--primary-light);
    color: var(--primary-color);
}

.question-list-item.active {
    background: var(--primary-color);
    color: white;
}

.question-list-item .question-id {
    font-weight: 600;
    margin-right: 10px;
    min-width: 70px;
}

.question-list-item .question-area {
    color: var(--text-muted);
    font-size: 12px;
}

.question-list-item.active .question-area {
    color: rgba(255, 255, 255, 0.8);
}

.main-content {
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: fixed;
    left: 320px;
    right: 0;
    top: 0;
    padding: 24px 36px;
    overflow: hidden;
    background: var(--bg-gray);
}

.content-header {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
}

.breadcrumb {
    width: 100%;
    font-size: 13px;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 20px;
}

.bc-path {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    min-width: 0;
    overflow: hidden;
}

.bc-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.bc-item {
    color: var(--text-secondary);
    font-weight: 500;
}

.bc-sep {
    color: var(--text-muted);
    font-size: 11px;
    margin: 0 2px;
}

.bc-current {
    color: var(--primary-color);
    font-weight: 700;
}

.bc-count {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
    background: var(--secondary-color);
    padding: 3px 12px;
    border-radius: 10px;
}

.btn-add-all-to-basket {
    padding: 3px 10px;
    font-size: 12px;
    font-weight: 600;
    color: var(--success-color);
    background: var(--bg-white);
    border: 1.5px solid var(--success-color);
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s, color 0.2s, transform 0.1s;
    flex-shrink: 0;
}

.btn-add-all-to-basket:hover {
    background: var(--success-color);
    color: #fff;
    transform: translateY(-1px);
}

.btn-add-all-to-basket:active {
    transform: translateY(0);
}

.btn-add-all-to-basket:disabled {
    opacity: 0.55;
    cursor: default;
    transform: none;
}

.btn-unlock-all {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-unlock-all:hover:not(:disabled) {
    background: var(--primary-color);
}

.btn-json2-knowledge {
    padding: 3px 10px;
    font-size: 12px;
    font-weight: 600;
    color: var(--primary-color);
    background: var(--bg-white);
    border: 1.5px solid var(--primary-color);
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s, color 0.2s, transform 0.1s;
    flex-shrink: 0;
}

.btn-json2-knowledge:hover:not(:disabled),
.btn-json2-knowledge.is-open {
    background: var(--primary-color);
    color: #fff;
}

.btn-json2-knowledge:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.json2-knowledge-panel {
    display: none;
    width: 100%;
    box-sizing: border-box;
    max-height: min(34vh, 360px);
    overflow-y: auto;
    padding: 12px 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-white);
    color: var(--text-primary);
    box-shadow: 0 3px 12px rgba(15, 23, 42, 0.08);
}

.json2-knowledge-panel.is-open {
    display: block;
}

.json2-knowledge-panel.is-empty {
    display: none;
}

.json2-knowledge-content {
    line-height: 1.7;
}

/* 移动端目录容器：桌面端隐藏，移动端由媒体查询显示 */
.mobile-breadcrumb {
    display: none;
}

.question-nav {
    display: flex;
    align-items: center;
    gap: 15px;
}

.nav-btn {
    padding: 9px 18px;
    border: 1.5px solid var(--border-color);
    background: var(--bg-white);
    color: var(--text-primary);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all var(--transition-base);
}

.nav-btn:hover:not(:disabled) {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.nav-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.nav-indicator {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 600;
    min-width: 60px;
    text-align: center;
}

.welcome-message {
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    padding: 40px;
    box-sizing: border-box;
}

.welcome-message h2 {
    font-size: var(--h1-size);
    color: var(--h1-color);
    margin-bottom: 12px;
    font-weight: var(--h1-weight);
    letter-spacing: var(--h1-spacing);
    margin-top: 0;
}

.welcome-message p {
    color: var(--text-muted);
    font-size: 16px;
    font-weight: 400;
}
.welcome-mobile { display: none; }
.welcome-desktop { display: block; }

.welcome-message .btn-upgrade {
    display: inline-block;
    width: auto;
    margin-top: 20px;
    padding: 12px 36px;
    font-size: 15px;
    border-radius: var(--radius-md);
}

.apk-download-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 900;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--primary-color);
    color: #fff;
    text-decoration: none;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(22, 119, 255, 0.3);
    transition: all 0.2s ease;
}

.apk-download-btn:hover {
    background: #4096FF;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(22, 119, 255, 0.25);
}

.apk-download-btn:active {
    transform: translateY(0);
}

.apk-download-icon {
    font-size: 18px;
}

.questions-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 0 0 28px 0;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
    position: relative;
    -webkit-overflow-scrolling: touch;
}

.questions-scroll::-webkit-scrollbar {
    width: 6px;
}

.questions-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.questions-scroll::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}

.questions-scroll::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

#loadMoreTrigger {
    text-align: center;
    padding: 16px;
    color: var(--text-muted);
    font-size: 14px;
    cursor: pointer;
    transition: color 0.2s;
}

#loadMoreTrigger:hover {
    color: var(--primary-color);
}

.continuation-section-divider {
    padding: 10px 16px;
    margin: 16px 0 8px 0;
    border-top: 2px solid var(--primary-color);
    border-bottom: 1px solid var(--border-light);
}

.continuation-section-divider .divider-breadcrumb {
    font-size: 13px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}

.continuation-section-divider .divider-breadcrumb .bc-item {
    font-weight: 600;
}

.continuation-section-divider .divider-breadcrumb .bc-current {
    color: var(--primary-color);
    font-weight: 700;
}

.continuation-section-divider .divider-breadcrumb .bc-sep {
    color: var(--text-muted);
    font-size: 11px;
    margin: 0 1px;
}

.continuation-section-questions {
    margin-bottom: 8px;
}

.tree-item.continuation-highlight {
    background: rgba(37, 99, 235, 0.08);
    border-radius: 6px;
}

.question-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 24px 28px;
    margin-bottom: 2px;
    border: 1px solid var(--border-light);
    border-left: 4px solid transparent;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-base);
    animation: cardIn 0.3s ease-out;
}

.question-card:hover {
    box-shadow: var(--shadow-md);
    border-left-color: var(--primary-color);
}

@keyframes cardIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.question-card.rendering {
    opacity: 0;
    animation: none;
    transition: opacity 0.3s ease;
}

.question-card.highlight {
    border-left-color: var(--primary-color);
    box-shadow: var(--shadow-md), var(--shadow-glow);
}

.question-card.find-match {
    border-left-color: var(--accent-color);
    box-shadow: var(--shadow-md), 0 0 0 2px rgba(249, 115, 22, 0.2);
}

.question-card.highlight-flash {
    border-left-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.2), var(--shadow-md);
    transition: box-shadow 0.3s ease;
}

.question-card.search-highlight {
    border: 2px solid var(--primary-color) !important;
    box-shadow: 0 0 0 4px var(--primary-glow), var(--shadow-lg) !important;
    background: linear-gradient(135deg, #FAFBFF, #F0F0FF) !important;
    transition: border-color 0.5s ease, box-shadow 0.5s ease, background 0.5s ease !important;
}

.question-extra-info {
    margin: 10px 0 12px;
    padding: 8px 12px;
    border: 1px solid var(--border-light);
    border-left: 3px solid var(--primary-color);
    border-radius: var(--radius-sm);
    background: var(--primary-light);
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.8;
    overflow-wrap: anywhere;
}

.question-extra-info .v2-paragraph {
    margin: 0;
    text-indent: 0;
}

.question-extra-info .v2-paragraph + .v2-paragraph {
    margin-top: 4px;
}

.question-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-light);
    flex-wrap: wrap;
}

.header-tags {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
    overflow-x: auto;
    flex: 1;
    min-width: 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.header-tags::-webkit-scrollbar {
    display: none;
}

.question-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    width: 30px;
    height: 30px;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    border-radius: 50%;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
    user-select: none;
}

.question-number .qid-tooltip {
    display: none;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 6px;
    padding: 4px 10px;
    background: var(--text-primary);
    color: white;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    z-index: 100;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transition: background 0.15s ease;
}

.question-number .qid-tooltip:hover {
    background: var(--primary-color);
}

.question-number .qid-tooltip.copied {
    background: #10B981;
}

.question-number .qid-tooltip::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-bottom-color: var(--text-primary);
}

.question-number.show-id .qid-tooltip {
    display: block;
}

.card-tag {
    display: inline-block;
    padding: 2px 7px;
    background: var(--secondary-color);
    color: var(--text-secondary);
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
    font-weight: 500;
    flex-shrink: 0;
}

.btn-answer {
    padding: 4px 10px;
    border: 1.5px solid var(--primary-color);
    background: var(--bg-white);
    color: var(--primary-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    transition: all var(--transition-base);
    flex-shrink: 0;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-width: 88px;
    box-sizing: border-box;
    height: 30px;
    line-height: 1;
}

.btn-answer.active {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    border-color: var(--primary-color);
    color: white;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.btn-basket {
    padding: 4px 10px;
    border: 1.5px solid var(--success-color);
    background: var(--bg-white);
    color: var(--success-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    transition: all var(--transition-base);
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    white-space: nowrap;
    min-width: 100px;
    box-sizing: border-box;
    height: 30px;
    line-height: 1;
}

.btn-basket.added {
    background: var(--success-color);
    color: white;
    border-color: var(--success-color);
}

.btn-basket .basket-icon {
    font-size: 13px;
}

.btn-answer svg, .btn-basket svg {
    display: block;
    flex-shrink: 0;
}

.btn-basket.added .basket-icon-add { display: none; }
.btn-basket.added .basket-icon-added { display: inline; }
.btn-basket .basket-icon-added { display: none; }
.btn-basket .basket-icon-add { display: inline; }

.btn-basket.added .basket-text-add { display: none; }
.btn-basket.added .basket-text-added { display: inline; }
.btn-basket .basket-text-added { display: none; }
.btn-basket .basket-text-add { display: inline; }

/* hover 状态仅在支持鼠标 hover 的设备生效（避免移动端点击触发 :hover 导致闪烁） */
@media (hover: hover) {
    .btn-answer:hover {
        border-color: var(--primary-color);
        color: var(--primary-color);
        background: var(--primary-light);
    }

    .btn-answer.active:hover {
        background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
        border-color: var(--primary-color);
        color: white;
        box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
    }
}

.question-content {
    font-family: var(--font-serif);
    font-size: 15px;
    line-height: 2;
    color: var(--text-primary);
    word-break: break-word;
}

.question-content p {
    margin-bottom: 0.5em;
    text-indent: 2em;
}

.question-content p:first-child { text-indent: 0; }

.question-content h1 { text-indent: 0; margin-bottom: 12px; }
.question-content h2 { text-indent: 0; margin-top: 20px; margin-bottom: 10px; }
.question-content h3 { text-indent: 0; margin-top: 16px; margin-bottom: 8px; }
.question-content h4 { text-indent: 0; margin-top: 12px; margin-bottom: 6px; }

.question-content ul,
.question-content ol {
    margin: 8px 0;
    padding-left: 2em;
    text-indent: 0;
}

.question-content li { text-indent: 0; margin-bottom: 4px; }
.question-content li p { text-indent: 0; }

.question-content img {
    max-width: 100%;
    max-height: 80vh;
    height: auto;
    object-fit: contain;
    border-radius: 0;
    margin: 0;
    box-shadow: none;
    vertical-align: middle;
}

.question-content .img-block {
    display: block;
    margin: 0.5em 0;
}

.question-content .img-block img {
    display: block;
    margin: 0;
}

.question-content table {
    width: 100%;
    max-width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    font-size: 14px;
    table-layout: fixed;
    overflow-wrap: break-word;
    word-break: break-word;
}

.question-content table td,
.question-content table th {
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    text-align: left;
    overflow-wrap: break-word;
    word-break: break-word;
    hyphens: auto;
}

.question-content table th {
    background: var(--secondary-color);
    font-weight: 600;
}

.question-content .katex {
    font-size: 1em !important;
    line-height: 1.5 !important;
}

.question-content .katex .mfrac > .vlist-t2,
.question-content .katex .mfrac > .vlist-t {
    padding: 0.3em 0;
}

.question-content .katex .mfrac .frac-line {
    min-height: 0.04em;
    border-bottom-width: 0.04em;
}

/* 突出显示文本：蓝色楷体 */
.question-content .hl {
    color: #2563EB;
    font-family: 'KaiTi', 'STKaiti', '楷体', 'SimSun', serif;
}

.answer-text .hl {
    color: #2563EB;
    font-family: 'KaiTi', 'STKaiti', '楷体', 'SimSun', serif;
}

.question-content .formula {
    display: inline-block;
    vertical-align: baseline;
    line-height: 1.5;
}

.question-content .katex-display {
    margin: 0.5em 0;
}

.question-content .formula-display {
    text-align: center;
    padding: 4px 0;
    overflow-x: auto;
    line-height: 1.5;
}

.question-content .formula-display .katex {
    font-size: 1em !important;
}

.question-content .v2-table-wrap {
    width: 100%;
    overflow-x: auto;
    margin: 8px 0;
}

.v2-unsupported-node {
    color: var(--danger-color, #b91c1c);
    background: #fff1f2;
    border: 1px solid #fecdd3;
    padding: 2px 5px;
    font-family: var(--font-mono);
    font-size: 0.88em;
}

.v2-unsupported-block {
    display: block;
    margin: 6px 0;
}

.question-card-v2 img.image-load-error {
    outline: 2px solid var(--danger-color, #b91c1c);
    outline-offset: 2px;
}

.v2-explanation {
    color: #2563EB;
}

.v2-explanation .katex {
    color: inherit;
}

.question-content .v2-table {
    border-collapse: collapse;
    min-width: min(100%, 520px);
    width: max-content;
    max-width: 100%;
    font-size: 0.96em;
}

.question-content .v2-table td,
.question-content .v2-table th {
    border: 1px solid var(--border-color, #d1d5db);
    padding: 6px 10px;
    vertical-align: middle;
    text-align: left;
    font-weight: 400;
}

.question-content .v2-blank,
.answer-content .v2-blank {
    display: inline-block;
    width: calc(var(--blank-chars, 5) * 0.72em);
    min-width: 3.6em;
    height: 1em;
    margin: 0 0.12em;
    border-bottom: 1px solid currentColor;
    vertical-align: baseline;
}

.katex .katex-mathml { display: none !important; }

/* Question and formula font rules are shared in question-typography.css. */

.question-content .options { margin: 10px 0; padding-left: 0; }

.question-content .option {
    display: flex;
    align-items: flex-start;
    padding: 8px 14px;
    margin: 5px 0;
    background: var(--bg-gray);
    border-radius: var(--radius-sm);
    border: 1.5px solid transparent;
    transition: all var(--transition-base);
    cursor: pointer;
    line-height: 1.5;
    text-indent: 0;
}

.question-content .option:hover {
    border-color: var(--primary-color);
    background: var(--primary-light);
}

.question-content .option-label {
    font-weight: 700;
    margin-right: 12px;
    color: var(--primary-color);
    min-width: 24px;
    text-indent: 0;
}

.question-content .option-content {
    flex: 1;
    text-indent: 0;
}

.answer-content {
    margin-top: 12px;
    padding: 12px 18px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, #FAFBFF, #F8FAFC);
    font-family: var(--font-serif);
    font-size: 15px;
    line-height: 2;
    color: var(--text-primary);
    display: none;
}

.answer-content.visible { display: block; }

.answer-content img {
    max-width: 100%;
    max-height: 80vh;
    height: auto;
    object-fit: contain;
    border-radius: 0;
    vertical-align: middle;
}

.answer-row { display: flex; align-items: baseline; margin-bottom: 8px; }
.answer-row:last-child { margin-bottom: 0; }

.answer-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--primary-color);
    background: var(--primary-light);
    padding: 2px 10px;
    border-radius: var(--radius-sm);
    margin-right: 12px;
    flex-shrink: 0;
    line-height: 1.5;
    display: inline-flex;
    align-items: center;
    vertical-align: baseline;
}

.answer-content .katex { font-size: 1em !important; line-height: 1.5 !important; }
.answer-content .katex .mfrac > .vlist-t2,
.answer-content .katex .mfrac > .vlist-t { padding: 0.3em 0; }
.answer-content .katex .mfrac .frac-line { min-height: 0.04em; border-bottom-width: 0.04em; }
.answer-content .formula { display: inline-block; vertical-align: baseline; line-height: 1.5; }
.answer-content .katex-display { margin: 8px 0; }
.answer-content .formula-display { margin: 4px 0; text-align: center; padding: 4px 0; overflow-x: auto; line-height: 1.5; }
.answer-content .formula-display .katex { font-size: 1em !important; }

.answer-content table {
    width: 100%;
    max-width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    font-size: 14px;
    table-layout: fixed;
    overflow-wrap: break-word;
    word-break: break-word;
}

.answer-content table td,
.answer-content table th {
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    text-align: left;
    overflow-wrap: break-word;
    word-break: break-word;
    hyphens: auto;
}

.answer-content table th {
    background: var(--secondary-color);
    font-weight: 600;
}

.formula-display {
    text-align: center;
    padding: 8px 0;
    overflow-x: auto;
}

.formula-display .katex-display { margin: 0; }

.tab-stop { display: inline-block; }

.tab-segment {
    display: inline-block;
    vertical-align: top;
    box-sizing: border-box;
}

.formula {
    display: inline-block;
    vertical-align: baseline;
    line-height: 1.5;
}

.katex-error {
    color: var(--danger-color) !important;
    background: #FEF2F2;
    padding: 1px 3px;
    border-radius: 2px;
    border: 1px solid #fecaca;
}

.formula-error {
    color: #DC2626;
    background: #FEF2F2;
    padding: 3px 8px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 14px;
}

.katex-lazy {
    display: inline-block;
    min-width: 1em;
    min-height: 1em;
    vertical-align: baseline;
}

.katex-lazy[data-display="true"] {
    display: block;
    text-align: center;
    min-height: 1.5em;
}

/* Sidebar toggle button - hidden on desktop */
.sidebar-toggle {
    display: none;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 300;
    width: 44px;
    height: 44px;
    border: none;
    background: var(--primary-color);
    border-radius: var(--radius-sm);
    font-size: 22px;
    color: white;
    cursor: pointer;
    box-shadow: 0 2px 12px rgba(59,130,246,0.4);
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.sidebar-toggle:hover {
    background: var(--primary-color);
    color: white;
    transform: scale(1.05);
}

/* Sidebar overlay - hidden on desktop */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.5);
    z-index: 99;
    opacity: 0;
    transition: opacity var(--transition-smooth);
}

.sidebar-overlay.active {
    opacity: 1;
}

@media (max-width: 768px) {
    html, body {
        overflow-x: hidden;
        overflow-y: auto;
        height: 100%;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    html::-webkit-scrollbar,
    body::-webkit-scrollbar {
        width: 0;
        height: 0;
        display: none;
    }
    /* 全局隐藏所有滚动条 */
    * {
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    *::-webkit-scrollbar {
        width: 0 !important;
        height: 0 !important;
        display: none !important;
        -webkit-appearance: none;
    }
    *::-webkit-scrollbar-track,
    *::-webkit-scrollbar-thumb {
        display: none !important;
        width: 0 !important;
    }

    :root {
        --h1-size: 22px;
        --h1-height: 1.35;
        --h1-margin-bottom: 14px;
        --h2-size: 18px;
        --h2-height: 1.4;
        --h2-margin-top: 24px;
        --h2-margin-bottom: 10px;
        --h3-size: 15px;
        --h3-height: 1.45;
        --h3-margin-top: 18px;
        --h3-margin-bottom: 7px;
        --h4-size: 13px;
        --h4-height: 1.5;
        --h4-margin-top: 14px;
        --h4-margin-bottom: 5px;
    }

    .sidebar-toggle {
        display: flex;
    }

    .sidebar-overlay {
        display: block;
        pointer-events: none;
    }

    .sidebar-overlay.active {
        pointer-events: auto;
    }

    .sidebar-toggle.sidebar-hidden {
        opacity: 0;
        pointer-events: none;
    }

    .sidebar {
        width: 280px;
        transform: translateX(-100%);
        transition: transform var(--transition-smooth);
        z-index: 200;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        left: 0;
        padding: 16px;
        padding-top: 12px;
        box-sizing: border-box;
        height: 100dvh;
    }

    .app-container {
        height: 100%;
    }

    .questions-scroll {
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-y: auto;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    .questions-scroll::-webkit-scrollbar {
        width: 0 !important;
        height: 0 !important;
        display: none !important;
        -webkit-appearance: none;
    }
    .questions-scroll::-webkit-scrollbar-track,
    .questions-scroll::-webkit-scrollbar-thumb {
        display: none !important;
        width: 0 !important;
    }
    .tree-container {
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    .tree-container::-webkit-scrollbar {
        width: 0 !important;
        height: 0 !important;
        display: none !important;
        -webkit-appearance: none;
    }
    .tree-container::-webkit-scrollbar-track,
    .tree-container::-webkit-scrollbar-thumb {
        display: none !important;
        width: 0 !important;
    }
    .basket-panel-list {
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    .basket-panel-list::-webkit-scrollbar {
        width: 0 !important;
        height: 0 !important;
        display: none !important;
        -webkit-appearance: none;
    }
    .basket-panel-list::-webkit-scrollbar-track,
    .basket-panel-list::-webkit-scrollbar-thumb {
        display: none !important;
        width: 0 !important;
    }
    /* 移动端隐藏所有内部滚动条 */
    .modal-body,
    .find-results,
    .filter-adv-check-list,
    .basket-pdf-viewer,
    .math-display {
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    .modal-body::-webkit-scrollbar,
    .find-results::-webkit-scrollbar,
    .filter-adv-check-list::-webkit-scrollbar,
    .basket-pdf-viewer::-webkit-scrollbar,
    .math-display::-webkit-scrollbar {
        width: 0;
        height: 0;
        display: none;
    }

    .content-header {
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
        margin-bottom: 8px;
        padding-bottom: 8px;
        padding-left: 48px;
    }

    .breadcrumb {
        gap: 3px;
    }

    /* 桌面端面包屑隐藏，移动端目录显示 */
    .bc-path {
        display: none;
    }

    .bc-actions {
        flex-wrap: wrap;
    }
    .mobile-breadcrumb {
        display: flex;
        flex-direction: column;
        gap: 3px;
    }

    /* 每行自适应高度：JS 测量后决定一行或两行，不再固定高度 */
    .bc-line {
        line-height: 20px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* 目录项不可拆分：整体作为一个 inline-flex 单元 */
    .bc-line .bc-item {
        display: inline-flex;
        white-space: nowrap;
        align-items: center;
    }

    /* 箭头 " > "：间距由文本空格提供，覆盖桌面端 margin/font-size */
    .bc-line .bc-sep {
        margin: 0;
        font-size: inherit;
        color: var(--text-muted);
    }

    /* 操作行：整体右对齐，两元素间距 10px */
    .bc-actions {
        justify-content: flex-end;
        gap: 10px;
        margin-top: 2px;
    }

    .question-card {
        padding: 16px 20px;
    }

    .tree-container {
        padding: 6px 8px;
    }

    .tree-item.level-1 {
        font-size: 13px;
        padding: 8px 8px;
    }

    .tree-item.level-2 {
        font-size: 12.5px;
        padding: 6px 8px;
    }

    .tree-item.level-3 {
        font-size: 12px;
        padding: 5px 8px;
    }

    .tree-item.level-4.clickable {
        font-size: 11.5px;
        padding: 3px 6px;
    }

    .tree-children {
        margin-left: 10px;
        padding-left: 3px;
    }

    .tree-item.level-1 + .tree-children {
        margin-left: 8px;
    }

    .tree-item.level-2 + .tree-children {
        margin-left: 9px;
    }

    .tree-item.level-3 + .tree-children {
        margin-left: 8px;
    }

    .modal-header h3 {
        font-size: 16px;
    }

    .welcome-message h2 {
        font-size: var(--h1-size);
    }

    .welcome-mobile { display: block; }
    .welcome-desktop { display: none; }

    .filter-section {
        flex-wrap: nowrap;
    }

    .filter-btn-wrap {
        flex: 1;
        min-width: 0;
    }

    .find-btn-wrap {
        flex: 1;
        min-width: 0;
    }

    /* 移动端筛选子列表向下展开，不向右溢出屏幕 */
    .filter-adv-action {
        min-height: 44px;
    }

    .filter-adv-sublist {
        position: static;
        min-width: 100%;
        max-width: 100%;
        border: none;
        border-top: 1px solid var(--border-light);
        border-radius: 0;
        box-shadow: none;
        max-height: 200px;
        overflow-y: auto;
    }

    .filter-adv-category.open .filter-adv-sublist {
        display: flex;
    }

    .filter-adv-panel {
        right: 0;
        left: auto;
        min-width: 180px;
    }

    /* 查找下拉菜单不换行 */
    .find-dropdown {
        min-width: 100px;
        white-space: nowrap;
    }

    .find-dropdown-item {
        white-space: nowrap;
    }

    .membership-cards {
        grid-template-columns: 1fr;
    }

    .modal-body {
        padding: 20px;
    }

    .question-card-header {
        flex-wrap: wrap;
    }

    .header-tags {
        flex: 1 1 100%;
        order: 1;
    }

    .btn-answer, .btn-basket {
        order: 2;
    }

    .answer-row {
        flex-direction: column;
    }

    .answer-text {
        margin-left: 0;
    }
}

@media (max-width: 480px) {
    :root {
        --h1-size: 20px;
        --h1-height: 1.35;
        --h1-margin-bottom: 12px;
        --h2-size: 16px;
        --h2-height: 1.4;
        --h2-margin-top: 20px;
        --h2-margin-bottom: 8px;
        --h3-size: 14px;
        --h3-height: 1.45;
        --h3-margin-top: 16px;
        --h3-margin-bottom: 6px;
        --h4-size: 12.5px;
        --h4-height: 1.5;
        --h4-margin-top: 12px;
        --h4-margin-bottom: 4px;
    }

    .sidebar {
        width: 260px;
    }

    .main-content {
        padding: 12px;
        padding-top: 12px;
        box-sizing: border-box;
    }

    .tree-item.level-1 {
        font-size: 12.5px;
        padding: 7px 6px;
    }

    .tree-item.level-2 {
        font-size: 12px;
        padding: 5px 6px;
    }

    .tree-item.level-3 {
        font-size: 11.5px;
        padding: 4px 6px;
    }

    .tree-item.level-4.clickable {
        font-size: 11px;
        padding: 3px 5px;
    }

    .tree-item-count {
        font-size: 9px;
        padding: 1px 5px;
    }

    .tree-children {
        margin-left: 8px;
        padding-left: 2px;
    }

    .question-card {
        padding: 12px 14px;
    }

    .question-content {
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    .question-content::-webkit-scrollbar {
        width: 0;
        height: 0;
        display: none;
    }

    .question-content table {
        min-width: 100%;
    }

    .question-content table td,
    .question-content table th {
        padding: 2px 4px;
        font-size: 13px;
    }

    .answer-content table td,
    .answer-content table th {
        padding: 2px 4px;
        font-size: 13px;
    }

    .modal {
        max-width: 95vw;
        border-radius: var(--radius-md);
    }

    .modal-header {
        padding: 16px 20px;
    }

    .modal-body {
        padding: 16px;
    }
}

.btn-icon {
    width: 30px;
    height: 30px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-sm);
    font-size: 16px;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.btn-icon:hover {
    background: var(--primary-light);
    color: var(--primary-color);
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #CBD5E1;
    transition: background-color var(--transition-base);
    border-radius: 26px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: transform var(--transition-base);
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

input:checked + .toggle-slider {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
}

input:checked + .toggle-slider:before {
    transform: translateX(22px);
}

.settings-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.settings-group[hidden] {
    display: none;
}

#internalRecordingSettings {
    margin-top: 16px;
}

#internalRecordingSettings h4 {
    margin: 0 0 4px;
    font-size: 13px;
    color: var(--text-secondary);
}

.setting-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-light);
}

.setting-item:last-child {
    border-bottom: none;
}

.setting-info {
    flex: 1;
    margin-right: 16px;
}

.setting-label {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.setting-desc {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
    line-height: 1.5;
}

.setting-warning {
    font-size: 12px;
    color: var(--danger-color);
    font-weight: 600;
    display: none;
}

/* Member access takes precedence over historical free unlocks. The active
   selection remains blue so users can still locate the open catalog item.
   Both access paths use the same green visual state for a calmer directory. */
.tree-item.level-4.unlocked:not(.member-access):not(.active):not(:hover),
.tree-item.level-4.member-access:not(.active):not(:hover) {
    border-radius: 6px;
}

.tree-item.level-4.unlocked:not(.member-access):not(.active):not(:hover) {
    background: linear-gradient(90deg, #F0FDF4 0%, #FAFFFB 100%);
}

.tree-item.level-4.member-access:not(.active):not(:hover) {
    background: linear-gradient(90deg, #F0FDF4 0%, #FAFFFB 100%);
}

.tree-item.level-4.member-access:not(.active):not(:hover) .tree-item-label {
    color: #16A34A;
    font-weight: 600;
}

.tree-item.level-4.member-access:not(.active):not(:hover) .tree-item-icon {
    color: #22C55E;
}

.tree-item.level-4.member-access:not(.active):not(:hover) .tree-item-count {
    background: #DCFCE7;
    color: #16A34A;
    font-weight: 600;
}

.tree-item.level-4.unlocked:not(.member-access):not(.active):not(:hover) .tree-item-label {
    color: #16A34A;
    font-weight: 600;
}

.tree-item.level-4.unlocked:not(.member-access):not(.active):not(:hover) .tree-item-icon {
    color: #22C55E;
}

.tree-item.level-4.unlocked:not(.member-access):not(.active):not(:hover) .tree-item-count {
    background: #DCFCE7;
    color: #16A34A;
    font-weight: 600;
}

.tree-item.level-4 {
    position: relative;
}

.level-member {
    background: #DBEAFE;
    color: #2563EB;
}

.nav-controls {
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    gap: 8px;
    align-items: center;
}

[data-l1-style="accent-bar"] {
    --l1-font-weight: 600;
    --l1-font-size: 14px;
    --l1-letter-spacing: 0.04em;
    --l1-color: #1E293B;
    --l1-bg: transparent;
    --l1-border-left: 3px solid var(--primary-color);
    --l1-text-transform: none;
}

[data-l1-style="accent-bar"] .tree-item.level-1 {
    padding-left: 10px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

[data-l1-style="subtle-badge"] {
    --l1-font-weight: 500;
    --l1-font-size: 13px;
    --l1-letter-spacing: 0.06em;
    --l1-color: #1D4ED8;
    --l1-bg: #EFF6FF;
    --l1-border-left: none;
    --l1-text-transform: uppercase;
}

[data-l1-style="subtle-badge"] .tree-item.level-1 {
    border-radius: var(--radius-sm);
    padding: 8px 10px;
}

[data-l1-style="subtle-badge"] .tree-item.level-1 .label-number {
    color: #3B82F6;
    font-size: 0.86em;
}

[data-l1-style="subtle-badge"] .tree-item.level-1 .tree-item-count {
    background: rgba(37, 99, 235, 0.15);
    color: #1D4ED8;
}

[data-l1-style="elegant-underline"] {
    --l1-font-weight: 600;
    --l1-font-size: 14px;
    --l1-letter-spacing: 0.03em;
    --l1-color: #0F172A;
    --l1-bg: transparent;
    --l1-border-left: none;
    --l1-text-transform: none;
}

[data-l1-style="elegant-underline"] .tree-item.level-1 {
    border-bottom: 1px solid #E2E8F0;
    border-radius: 0;
    padding-bottom: 8px;
    margin-bottom: 2px;
}

[data-l1-style="elegant-underline"] .tree-item.level-1 .label-text {
    position: relative;
}

[data-l1-style="elegant-underline"] .tree-item.level-1 .label-text::after {
    content: '';
    position: absolute;
    bottom: -9px;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    border-radius: 1px;
    opacity: 0.6;
}

.quota-warning-toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: linear-gradient(135deg, #FEF3C7, #FDE68A);
    border: 1px solid #F59E0B;
    border-radius: var(--radius-md);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 8px 24px rgba(245, 158, 11, 0.25);
    z-index: 10000;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 14px;
    color: #92400E;
    white-space: nowrap;
}

.quota-warning-toast.show {
    transform: translateX(-50%) translateY(0);
}

.quota-warning-icon {
    font-size: 18px;
}

.btn-upgrade-sm {
    background: linear-gradient(135deg, #F59E0B, #EF4444);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    padding: 4px 12px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-upgrade-sm:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4);
}

.basket-entry-slot { min-width: 0; }
.filter-section.has-review .basket-entry-label { display: none; }
.filter-section.has-review .filter-btn { padding-left: 1px; padding-right: 1px; }

.basket-entry-btn {
    position: relative;
    width: 100%;
    height: 32px;
    min-height: 32px;
    padding: 5px 4px;
    border: 1px solid #d5e3f8;
    border-radius: var(--radius-sm);
    background: #edf4ff;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: background .18s, border-color .18s;
}

.basket-entry-btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.basket-entry-btn:hover {
    background: #e1edff;
    border-color: #a7c6f5;
}

.basket-entry-btn:active { background: #d4e5ff; }
.basket-entry-btn:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.basket-badge {
    position: static;
    flex-shrink: 0;
    min-width: 16px;
    height: 16px;
    border-radius: 5px;
    background: #dce9fc;
    color: var(--primary-color);
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
    line-height: 1;
}

@media (max-width: 768px) {
    .filter-section { gap: 4px; grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(0, 1.2fr); }
    .filter-btn, .basket-entry-btn { height: 36px; min-height: 36px; }
    .filter-btn { padding-left: 2px; padding-right: 2px; font-size: 12px; }
    .basket-entry-btn { min-width: 0; padding: 5px 4px; gap: 3px; font-size: 12px; }
    .basket-entry-btn svg { width: 18px; height: 18px; }
    .basket-entry-label { display: none; }
    .directory-find-modes .find-dropdown-item { min-height: 40px; }
}

/* ========== 平滑滚动浮动按钮 ========== */
.smooth-scroll-float-btn {
    position: fixed;
    right: 24px;
    bottom: 84px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #10B981, #059669);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
    z-index: 999;
    transition: all 0.2s ease;
}

.smooth-scroll-float-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.45);
}

.smooth-scroll-float-btn:active {
    transform: scale(0.95);
}

/* 平滑滚动配置面板 */
.smooth-scroll-panel {
    position: fixed;
    bottom: 140px;
    right: 20px;
    width: 260px;
    background: var(--bg-card, #fff);
    border-radius: 14px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.18);
    padding: 18px;
    z-index: 1001;
    animation: ssPanelIn 0.2s ease;
}

@keyframes ssPanelIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.smooth-scroll-panel-title {
    font-weight: 700;
    font-size: 15px;
    color: var(--text-primary, #1e293b);
    margin-bottom: 14px;
}

.smooth-scroll-field {
    margin-bottom: 12px;
}

.smooth-scroll-field label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--teaching-number-color, #64748b);
    margin-bottom: 6px;
}

.ss-input {
    width: 100%;
    padding: 8px 10px;
    border: 1.5px solid var(--border-light, #e2e8f0);
    border-radius: 8px;
    font-size: 14px;
    color: var(--text-primary, #1e293b);
    background: var(--bg-card, #fff);
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.15s ease;
}

.ss-input:focus {
    border-color: #10B981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.smooth-scroll-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.ss-cancel, .ss-start {
    flex: 1;
    padding: 9px 0;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.ss-cancel {
    background: var(--bg-gray, #f1f5f9);
    color: var(--teaching-number-color, #64748b);
}

.ss-cancel:hover {
    background: var(--border-light, #e2e8f0);
}

.ss-start {
    background: linear-gradient(135deg, #10B981, #059669);
    color: #fff;
}

.ss-start:hover {
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

/* 滚动中顶部状态栏 */
.smooth-scroll-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 36px;
    background: linear-gradient(135deg, #10B981, #059669);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    z-index: 9999;
    font-size: 13px;
    font-weight: 600;
    animation: ssBarIn 0.3s ease;
}

@keyframes ssBarIn {
    from { transform: translateY(-100%); }
    to { transform: translateY(0); }
}

.ss-bar-time {
    white-space: nowrap;
}

.ss-bar-stop {
    padding: 3px 14px;
    border: 1.5px solid rgba(255,255,255,0.7);
    border-radius: 6px;
    background: transparent;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
}

.ss-bar-stop:hover {
    background: rgba(255,255,255,0.2);
    border-color: #fff;
}

/* 手机端隐藏平滑滚动偏好项（非APK/窄屏时） */
.setting-item-mobile-only {
    display: none;
}

@media (max-width: 768px) {
    .setting-item-mobile-only {
        display: flex;
    }
    .smooth-scroll-float-btn {
        right: 16px;
        bottom: 72px;
        width: 44px;
        height: 44px;
    }
    .smooth-scroll-panel {
        right: 12px;
        left: 12px;
        width: auto;
        bottom: 120px;
    }
}

@media (max-width: 480px) {
    .smooth-scroll-float-btn {
        right: 12px;
        bottom: 68px;
        width: 40px;
        height: 40px;
    }
}

.basket-panel {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    background: var(--bg-white);
    z-index: 1001;
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: all var(--transition-smooth);
}

.basket-panel.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.basket-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
    background: var(--bg-white);
}

.basket-panel-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.basket-panel-title svg {
    color: var(--primary-color);
}

.basket-count {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    white-space: nowrap;
}

.basket-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.basket-export-split {
    display: flex;
    align-items: stretch;
    position: relative;
}

.basket-export-mode-trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 8px;
    border: none;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: #fff;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    cursor: pointer;
    transition: opacity var(--transition-fast);
    border-left: 1px solid rgba(255, 255, 255, 0.3);
    user-select: none;
}

.basket-export-mode-trigger:hover {
    opacity: 0.9;
}

.basket-export-mode-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    min-width: 140px;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    z-index: 100;
    overflow: hidden;
}

.basket-export-mode-dropdown.show {
    display: block;
}

.basket-export-mode-option {
    padding: 8px 12px;
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s;
}

.basket-export-mode-option:hover {
    background: rgba(91, 127, 255, 0.08);
}

.basket-export-mode-option.selected {
    color: var(--primary-color);
    font-weight: 600;
}

.basket-export-mode-select {
    display: none;
}

.basket-btn-export-main {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 20px;
    min-width: 70px;
    border: none;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: #fff;
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    line-height: 1.2;
}

.basket-btn-export-main:hover {
    opacity: 0.9;
}

.basket-btn-export-main:active {
    transform: translateY(1px);
}

.basket-btn-export-main:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.basket-btn-export-main.cancel-export {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.basket-btn-export-main.cancel-export + .basket-export-mode-trigger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.basket-panel-close {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border-color);
    background: var(--bg-white);
    color: var(--text-muted);
    font-size: 15px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    box-sizing: border-box;
    flex-shrink: 0;
}

.basket-panel-close:hover {
    background: var(--danger-color);
    border-color: var(--danger-color);
    color: #fff;
}

.basket-panel-body {
    flex: 1;
    display: flex;
    overflow: hidden;
}

.basket-left {
    width: 320px;
    min-width: 280px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-light);
    flex-shrink: 0;
    background: var(--bg-gray);
}

.basket-left-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
}

.basket-toolbar-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 5px 12px;
    border: 1px solid var(--border-color);
    background: var(--bg-white);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.basket-toolbar-btn:hover {
    border-color: var(--danger-color);
    color: var(--danger-color);
    background: #FEF2F2;
}

.basket-toolbar-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.basket-panel-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 12px;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.basket-panel-list::-webkit-scrollbar {
    width: 5px;
}

.basket-panel-list::-webkit-scrollbar-track {
    background: transparent;
}

.basket-panel-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}

.basket-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.basket-preview-area {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: #e8eaed;
    display: flex;
    flex-direction: column;
    touch-action: pan-y;
}

.basket-preview-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    color: var(--text-muted);
    text-align: center;
    gap: 8px;
}

.basket-preview-empty p {
    font-size: 13px;
    opacity: 0.6;
}

.basket-pdf-viewer {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-y: auto;
    overflow-x: hidden;
    background: #e8eaed;
    padding: 20px 0;
}

.basket-pdf-pages {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100%;
}

.basket-preview-page {
    width: 794px;
    padding: 76px 94px;
    box-sizing: border-box;
    background: white;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
    transform-origin: top center;
    transition: transform 0.2s ease;
}

.basket-preview-iframe {
    width: 605px;
    border: none;
    background: white;
    overflow: hidden;
}

.basket-export-progress {
    padding: 12px 20px;
    border-top: 1px solid var(--border-light);
    background: var(--bg-white);
}

.export-progress-bar {
    width: 100%;
    height: 6px;
    background: var(--secondary-color);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 6px;
}

.export-progress-fill {
    height: 100%;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    border-radius: 3px;
    transition: width 0.3s ease;
    width: 0%;
}

.export-progress-text {
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
}

/* ===== 导出完成飞行动画（仅 APK 原生环境） ===== */

/* 飞行卡片：从底部进度条飞向顶部 PDF 按钮 */
.save-fly-card {
    position: fixed;
    z-index: 100001;
    pointer-events: none;
    width: 160px;
    height: 32px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(22, 119, 255, 0.3);
    font-size: 12px;
    color: #1F2329;
    overflow: hidden;
    will-change: transform, opacity;
}

.save-fly-card .save-fly-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    background: #1677FF;
    color: #fff;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.save-fly-card .save-fly-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* PDF 按钮 pulse 动画（卡片到达时触发） */
.basket-pdf-btn.pulse {
    animation: pdfBtnPulse 500ms ease;
}

@keyframes pdfBtnPulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(22, 119, 255, 0.5);
    }
    50% {
        transform: scale(1.15);
        box-shadow: 0 0 0 8px rgba(22, 119, 255, 0.2);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(22, 119, 255, 0);
    }
}

/* PDF 按钮新文件红点（点击后自动消失） */
.basket-pdf-btn .pdf-new-dot {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 8px;
    height: 8px;
    background: #FF4D4F;
    border-radius: 50%;
    border: 1.5px solid #fff;
    box-shadow: 0 0 0 1px rgba(255, 77, 79, 0.3);
    pointer-events: none;
}

.basket-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-muted);
    text-align: center;
}

.basket-empty p {
    margin-top: 12px;
    font-size: 14px;
}

.basket-empty-hint {
    font-size: 12px !important;
    color: var(--text-muted);
    opacity: 0.7;
}

.basket-item {
    padding: 0;
    margin-bottom: 8px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-white);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast), opacity var(--transition-fast);
    display: flex;
    align-items: stretch;
    position: relative;
    overflow: visible;
}

.basket-item:hover {
    border-color: #a5b4fc;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.1);
}

/* Export is a separate entitlement, indicated only by a quiet perimeter. */
.basket-item-export-needed {
    border-color: #efb7ba;
}

.basket-item-export-needed:hover {
    border-color: #df969e;
}

.basket-item-locked {
    border-color: #fca5a5;
    background: #fff7f7;
}

.basket-item-locked:hover {
    border-color: #ef4444;
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.12);
}

.basket-item-preview-locked,
.basket-locked-hint {
    color: #b91c1c;
}

.basket-locked-hint {
    font-size: 11px;
}

.basket-access-preview {
    width: min(760px, 100%);
    box-sizing: border-box;
    margin: 12px auto;
    padding: 22px 26px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-white);
    color: var(--text-primary);
}

.basket-access-pages {
    width: 100%;
    min-width: 0;
    padding: 0 16px;
    box-sizing: border-box;
}

.basket-preview-sheet {
    width: 794px;
    max-width: 100%;
    margin: 0 auto 20px;
    background: white;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.22);
}

.basket-preview-sheet img {
    display: block;
    width: 100%;
    height: auto;
}

.basket-local-preview {
    position: relative;
    margin: 0 auto 20px;
    flex: 0 0 auto;
}

.basket-local-preview-iframe {
    display: block;
    width: 818px;
    border: 0;
    background: transparent;
    transform-origin: top left;
}

.basket-preview-locked-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 auto 16px;
    width: min(794px, 100%);
}

.basket-access-preview .question-content {
    padding: 0;
    overflow-wrap: anywhere;
}

.basket-access-preview-unlock {
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    background: #eff6ff;
    color: #1d4ed8;
    padding: 10px 16px;
    cursor: pointer;
}

@media (max-width: 600px) {
    .basket-access-pages { padding: 0 10px; }
    .basket-access-preview { padding: 16px; }
}

@media print {
    .basket-access-pages { display: none !important; }
}

.basket-access-preview-locked {
    border-color: #fca5a5;
    background: #fff7f7;
}

.basket-access-preview-title {
    margin-bottom: 14px;
    color: var(--text-secondary);
    font-size: 13px;
}

.basket-access-preview-section {
    margin-top: 16px;
}

.basket-access-preview-section h4 {
    margin: 0 0 8px;
    font-size: 14px;
    color: var(--text-primary);
}

.basket-access-preview-content {
    line-height: 1.75;
    word-break: break-word;
}

.basket-access-preview-locked-text {
    color: #b91c1c;
    font-size: 15px;
    font-weight: 600;
}

.basket-unlock-dialog-overlay {
    position: fixed;
    inset: 0;
    z-index: 10020;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(15, 23, 42, 0.36);
    backdrop-filter: blur(2px);
}

.basket-unlock-dialog {
    position: relative;
    width: min(360px, 100%);
    padding: 24px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-white);
    box-shadow: 0 18px 46px rgba(15, 23, 42, 0.18);
}

.basket-unlock-dialog h3 {
    margin: 0 40px 8px 0;
    font-size: 19px;
    line-height: 1.4;
    font-weight: 700;
    color: var(--text-primary);
    text-align: left;
}

.basket-unlock-dialog-description {
    margin: 0 0 20px;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.65;
}

.basket-unlock-dialog-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
}

.basket-unlock-dialog-close:hover {
    background: var(--bg-gray);
    color: var(--text-secondary);
}

.basket-unlock-dialog-close:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.basket-unlock-dialog-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.basket-unlock-dialog-actions button {
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-white);
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}

.basket-unlock-dialog-primary {
    border-color: var(--primary-color) !important;
    background: var(--primary-color) !important;
    color: #FFFFFF;
}

.basket-unlock-dialog-primary:hover {
    border-color: var(--primary-hover) !important;
    background: var(--primary-hover) !important;
}

.basket-unlock-dialog-membership {
    border-color: #FED7AA !important;
    background: #FFF7ED !important;
    color: #C2410C;
}

.basket-unlock-dialog-membership:hover {
    border-color: #FDBA74 !important;
    background: #FFEDD5 !important;
}

.basket-item.dragging {
    cursor: grabbing;
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.2), 0 0 0 2px rgba(91, 127, 255, 0.5);
    position: fixed;
    z-index: 9999;
    pointer-events: none;
    background: rgba(255, 255, 255, 0.95);
    opacity: 0.9;
    transform: scale(1.03);
    transition: box-shadow 0.2s ease-out, transform 0.2s ease-out, opacity 0.2s ease-out;
    user-select: none;
}

.basket-item.sorting {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.basket-item-placeholder {
    border: 2px dashed var(--primary-color);
    border-radius: var(--radius-md);
    background: #EFF6FF;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
    font-size: 13px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: placeholderPulse 2s ease-in-out infinite;
}

@keyframes placeholderPulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

.basket-insert-indicator {
    height: 4px;
    background: linear-gradient(90deg, transparent, var(--primary-color), transparent);
    border-radius: 2px;
    margin: 6px 0;
    box-shadow: 0 2px 12px rgba(91, 127, 255, 0.5);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    animation: indicatorPulse 1.5s ease-in-out infinite;
}

@keyframes indicatorPulse {
    0%, 100% {
        opacity: 0.7;
        transform: scaleX(0.9);
    }
    50% {
        opacity: 1;
        transform: scaleX(1);
    }
}

.basket-item-drag-handle {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 24px;
    min-height: 100%;
    background: var(--bg-gray);
    border-right: 1px solid var(--border-light);
    border-radius: var(--radius-md) 0 0 var(--radius-md);
    cursor: grab;
    color: var(--text-muted);
    transition: background var(--transition-fast), color var(--transition-fast);
    flex-shrink: 0;
    user-select: none;
}

.basket-item-drag-handle:hover {
    background: #e0e7ff;
    color: var(--primary-color);
}

.basket-item-drag-handle:active {
    cursor: grabbing;
}

.basket-item-body {
    flex: 1;
    min-width: 0;
    padding: 5px 6px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.basket-item-num {
    font-weight: 700;
    font-size: 12px;
    color: var(--primary-color);
    line-height: 1.2;
}

.basket-item-tags {
    display: flex;
    gap: 3px;
    flex-wrap: wrap;
    align-items: center;
}

.basket-item-bottom {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-height: 0;
}

.basket-item-preview {
    flex: 1;
    min-width: 0;
    font-size: 12px;
    line-height: 1.4;
    color: var(--text-secondary);
    max-height: 34px;
    overflow: hidden;
    position: relative;
    word-break: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.basket-item-preview img {
    display: none;
}

.basket-item-preview .katex {
    font-size: 12px;
}

.basket-item-preview .hl {
    color: #2563EB;
    font-family: 'KaiTi', 'STKaiti', '楷体', 'SimSun', serif;
}

.basket-item-tag {
    font-size: 10px;
    padding: 1px 4px;
    border-radius: 3px;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
}

.basket-item-tag.tag-year {
    background: #DBEAFE;
    color: #2563EB;
}

.basket-item-tag.tag-area {
    background: #D1FAE5;
    color: #059669;
}

.basket-item-tag.tag-stage {
    background: #FEF3C7;
    color: #D97706;
}

.basket-item-tag.tag-subject {
    background: #EFF6FF;
    color: #2563EB;
}

.basket-item-tag.tag-difficulty {
    background: #FFF7ED;
    color: #EA580C;
}

.card-tag.tag-difficulty {
    background: #FFF7ED;
    color: #EA580C;
}

.card-tag.tag-example {
    background: #EFF6FF;
    color: #2563EB;
}

.basket-item-tag.tag-example {
    background: #EFF6FF;
    color: #2563EB;
}

.basket-item-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px 2px;
    flex-shrink: 0;
    align-self: center;
}

.basket-actions-col {
    display: flex;
    flex-direction: column;
    gap: 2px;
    align-items: center;
}

.basket-item-move-up,
.basket-item-move-down,
.basket-item-remove,
.basket-item-locate {
    width: 20px;
    height: 20px;
    border: 1px solid var(--border-light);
    background: var(--bg-white);
    color: var(--text-muted);
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    padding: 0;
}

/* ===== APP 更新弹窗 ===== */

.app-update-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: app-update-fade-in 0.25s ease;
}

@keyframes app-update-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes app-update-slide-up {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes app-update-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

.app-update-dialog {
    background: #FAFBFC;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 380px;
    width: 100%;
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: app-update-slide-up 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.app-update-header {
    padding: 28px 24px 16px;
    text-align: center;
    background: #FAFBFC;
    border-bottom: 1px solid #EEF1F5;
}

.app-update-title-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.app-update-icon {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
}

.app-update-header h3 {
    font-size: 20px;
    font-weight: 700;
    color: #1F2329;
    margin: 0;
    letter-spacing: -0.3px;
}

.app-update-version {
    font-size: 13px;
    color: #86909C;
    margin: 0;
    font-weight: 500;
}

.app-update-body {
    padding: 16px 24px;
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.app-update-notes-title {
    font-size: 13px;
    font-weight: 600;
    color: #4E5969;
    margin-bottom: 8px;
}

.app-update-notes {
    font-size: 14px;
    color: #1F2329;
    line-height: 1.6;
}

.app-update-notes p {
    margin: 0 0 6px 0;
}

.app-update-notes h4,
.app-update-notes h5,
.app-update-notes h6 {
    font-size: 14px;
    font-weight: 600;
    color: #1F2329;
    margin: 10px 0 4px 0;
}

.app-update-note-item {
    color: #4E5969;
}

.app-update-notes-empty {
    color: #C9CDD4;
    font-style: italic;
}

.app-update-footer {
    padding: 16px 24px 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    border-top: 1px solid #EEF1F5;
}

.app-update-btn {
    width: 100%;
    height: 44px;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.app-update-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.app-update-btn-primary {
    background: #2B5AED;
    color: #FFFFFF;
    box-shadow: 0 2px 8px rgba(43, 90, 237, 0.25);
}

.app-update-btn-primary:hover:not(:disabled) {
    background: #2449CC;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(43, 90, 237, 0.35);
}

.app-update-btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.app-update-btn-secondary {
    background: transparent;
    color: #86909C;
}

.app-update-btn-secondary:hover:not(:disabled) {
    background: #F2F3F5;
    color: #4E5969;
}

/* ===== 迁移说明弹窗 ===== */

.app-update-migration-dialog {
    max-width: 380px;
}

.app-update-migration-desc {
    font-size: 14px;
    color: #4E5969;
    line-height: 1.6;
    margin: 0 0 12px 0;
}

.app-update-migration-subtitle {
    font-size: 13px;
    font-weight: 600;
    color: #4E5969;
    margin: 0 0 8px 0;
}

.app-update-migration-steps {
    font-size: 14px;
    color: #1F2329;
    line-height: 1.8;
    margin: 0;
    padding-left: 20px;
}

/* ===== 统一会员购买与支付状态视觉 ===== */
.modal-membership {
    position: relative;
    width: 680px;
    max-width: 94vw;
    overflow: hidden;
    border: 1px solid #E2E8F0;
    border-radius: 16px;
    background: #FFFFFF;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.18);
}

.modal-membership .modal-close {
    position: absolute;
    top: 18px;
    right: 18px;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: #94A3B8;
    font-size: 17px;
    cursor: pointer;
}

.modal-membership .modal-close:hover {
    background: #FFF7ED;
    color: #EA580C;
}

.modal-membership .modal-body {
    padding: 34px 34px 24px;
}

.membership-header {
    max-width: 560px;
    margin: 0 auto;
    text-align: center;
}

.membership-title {
    margin: 0;
    color: #EA580C;
    font-size: 23px;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: 0;
}

.membership-subtitle {
    margin: 9px 0 0;
    color: #64748B;
    font-size: 14px;
    line-height: 1.6;
}

.membership-status-summary {
    max-width: 560px;
    margin: 14px auto 0;
    color: #475569;
    font-size: 13px;
    line-height: 1.6;
    text-align: center;
}

.membership-benefits {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0;
    margin: 16px 0 20px;
    padding: 13px 0;
    border-top: 1px solid #F1F5F9;
    border-bottom: 1px solid #F1F5F9;
}

.membership-benefit {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 9px;
    padding: 0 14px;
    border-right: 1px solid #F1F5F9;
}

.membership-benefit:last-child {
    border-right: 0;
}

.membership-benefit-check {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    margin-top: 1px;
    border-radius: 50%;
    background: #FFF7ED;
    color: #EA580C;
    font-size: 12px;
    font-weight: 800;
}

.membership-benefit strong,
.membership-benefit small {
    display: block;
}

.membership-content-scope {
    margin: -8px 0 16px;
    color: #475569;
    font-size: 12px;
    line-height: 1.5;
    text-align: center;
}

.membership-content-scope span {
    margin-right: 7px;
    color: #94A3B8;
}

.membership-benefit strong {
    color: #334155;
    font-size: 13px;
    line-height: 1.4;
}

.membership-benefit small {
    margin-top: 2px;
    color: #94A3B8;
    font-size: 11px;
    line-height: 1.4;
}

.membership-plans {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.plan-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 0;
    min-height: 132px;
    padding: 20px 18px 17px;
    border: 1px solid #CBD5E1;
    border-radius: 12px;
    background: #FFFFFF;
    color: #334155;
    font: inherit;
    text-align: left;
    cursor: pointer;
    box-sizing: border-box;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
    -webkit-tap-highlight-color: transparent;
}

.plan-month {
    border-color: #CBD5E1;
    background: #F8FAFC;
}

.plan-quarter {
    border-color: #BFDBFE;
    background: #F8FBFF;
}

.plan-year {
    border-color: #FDBA74;
    background: #FFFBF7;
}

.plan-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
}

.plan-month.selected {
    border-color: #64748B;
    box-shadow: 0 0 0 2px rgba(100, 116, 139, 0.18), 0 10px 24px rgba(15, 23, 42, 0.08);
}

.plan-quarter.selected {
    border-color: #2563EB;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.16), 0 10px 24px rgba(37, 99, 235, 0.10);
}

.plan-year.selected {
    border-color: #EA580C;
    box-shadow: 0 0 0 2px rgba(234, 88, 12, 0.17), 0 12px 26px rgba(234, 88, 12, 0.12);
}

.plan-positioning {
    color: #64748B;
    font-size: 11px;
    font-weight: 650;
}

.plan-quarter .plan-positioning {
    color: #2563EB;
}

.plan-year .plan-positioning {
    color: #EA580C;
}

.plan-name {
    margin-top: 0;
    color: #334155;
    font-size: 16px;
    font-weight: 700;
}

.plan-quarter .plan-name {
    color: #1D4ED8;
}

.plan-year .plan-name {
    color: #EA580C;
}

.plan-price {
    margin-top: 15px;
    color: #334155;
    font-size: 34px;
    font-weight: 760;
    line-height: 1;
    letter-spacing: 0;
}

.plan-quarter .plan-price {
    color: #1D4ED8;
}

.plan-year .plan-price {
    color: #EA580C;
}

.plan-price .currency {
    margin-right: 2px;
    font-size: 17px;
    font-weight: 650;
}

.plan-description {
    margin-top: auto;
    padding-top: 14px;
    color: #94A3B8;
    font-size: 11px;
    line-height: 1.4;
}

.plan-year .plan-description {
    color: #EA580C;
}

.membership-footer {
    padding: 0;
}

.membership-availability-notice {
    margin: 0 0 10px;
    padding: 10px 12px;
    border: 1px solid #FED7AA;
    border-left: 3px solid #EA580C;
    border-radius: 6px;
    background: #FFF7ED;
    color: #7C2D12;
    font-size: 12px;
    line-height: 1.5;
}

.membership-availability-notice[hidden] {
    display: none;
}

.membership-availability-notice strong,
.membership-availability-notice span {
    display: block;
}

.membership-availability-notice strong {
    margin-bottom: 2px;
    color: #9A3412;
    font-size: 13px;
}

.membership-payment-method {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
    width: 236px;
    margin: 0 auto 12px;
    padding: 4px;
    border: 1px solid #E2E8F0;
    border-radius: 8px;
    background: #F8FAFC;
}

.membership-payment-method[hidden] {
    display: none;
}

.membership-payment-method-option {
    min-height: 34px;
    padding: 6px 14px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #64748B;
    font-size: 13px;
    font-weight: 650;
    cursor: pointer;
}

.membership-payment-method-option:hover {
    color: #334155;
}

.membership-payment-method-option.selected {
    background: #FFFFFF;
    color: #0F172A;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.12);
}

.membership-payment-method-option[hidden] {
    display: none;
}

.membership-payment-method.wechat-unavailable {
    grid-template-columns: minmax(0, 1fr);
    width: 118px;
}

.btn-membership-pay {
    width: 100%;
    height: 52px;
    border: 0;
    border-radius: 10px;
    background: #EA580C;
    color: #FFFFFF;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(234, 88, 12, 0.20);
    transition: background-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.btn-membership-pay:hover:not(:disabled) {
    background: #D94805;
    box-shadow: 0 10px 22px rgba(217, 72, 5, 0.24);
    transform: translateY(-1px);
}

.btn-membership-pay:active:not(:disabled) {
    background: #D94805;
    transform: translateY(0);
}

.btn-membership-pay:disabled {
    cursor: not-allowed;
    opacity: 0.72;
    box-shadow: none;
}

.btn-membership-pay.payment-unavailable:disabled {
    background: #64748B;
    opacity: 1;
}

.membership-agreement-consent {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 11px 2px 0;
    color: #64748B;
    font-size: 12px;
    line-height: 1.55;
    text-align: left;
    transition: color 0.18s ease;
}

.membership-agreement-consent.needs-attention {
    color: #9A3412;
}

.membership-agreement-consent input {
    flex: 0 0 auto;
    width: 15px;
    height: 15px;
    margin: 0;
    accent-color: #EA580C;
    cursor: pointer;
}

.membership-agreement-consent input[aria-invalid="true"] {
    outline: 1px solid #EA580C;
    outline-offset: 2px;
}

.membership-agreement-consent a {
    color: #C2410C;
    text-decoration: none;
}

.membership-agreement-consent a:hover {
    text-decoration: underline;
}

.membership-payment-note {
    margin: 10px 0 0;
    color: #94A3B8;
    font-size: 11px;
    line-height: 1.5;
    text-align: center;
}

.membership-payment-note.agreement-warning {
    color: #C2410C;
    font-weight: 600;
}

.membership-payment-overlay {
    position: fixed;
    inset: 0;
    z-index: 10020;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
    background: rgba(15, 23, 42, 0.58);
    backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-smooth), visibility var(--transition-smooth);
    box-sizing: border-box;
}

.membership-payment-overlay.active {
    opacity: 1;
    visibility: visible;
}

body.membership-payment-open .basket-entry-btn {
    display: none;
}

.membership-payment-dialog {
    position: relative;
    width: 430px;
    max-width: calc(100vw - 32px);
    padding: 36px 32px 30px;
    overflow: hidden;
    border: 1px solid #E2E8F0;
    border-radius: 16px;
    background: #FFFFFF;
    box-shadow: 0 26px 80px rgba(15, 23, 42, 0.22);
    text-align: center;
    box-sizing: border-box;
    transform: translateY(22px) scale(0.97);
    transition: transform var(--transition-smooth);
    outline: none;
}

.membership-payment-overlay.active .membership-payment-dialog {
    transform: translateY(0) scale(1);
}

.membership-payment-close {
    position: absolute;
    top: 15px;
    right: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: #94A3B8;
    font-size: 16px;
    cursor: pointer;
}

.membership-payment-close:hover {
    background: var(--primary-light);
    color: var(--primary-color);
}

.membership-payment-visual {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    margin: 0 auto 20px;
}

.membership-payment-spinner,
.membership-payment-seal,
.membership-payment-alert {
    display: none;
}

.membership-payment-overlay[data-state="creating"] .membership-payment-spinner,
.membership-payment-overlay[data-state="awaiting"] .membership-payment-spinner,
.membership-payment-overlay[data-state="confirming"] .membership-payment-spinner {
    display: block;
    width: 52px;
    height: 52px;
    border: 4px solid #DBEAFE;
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: membership-payment-spin 0.9s linear infinite;
}

.membership-payment-overlay[data-state="success"] .membership-payment-seal {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 58px;
    height: 58px;
    border: 2px solid #FDBA74;
    border-radius: 50%;
    background: #EA580C;
    color: #FFFFFF;
    font-size: 24px;
    font-weight: 850;
    box-shadow: 0 0 0 8px #FFF7ED;
    animation: membership-seal-arrive 0.42s ease-out both;
}

.membership-payment-overlay[data-state="wechat-awaiting"] .membership-payment-visual {
    display: none;
}

.membership-payment-overlay[data-state="failed"] .membership-payment-alert,
.membership-payment-overlay[data-state="timeout"] .membership-payment-alert,
.membership-payment-overlay[data-state="historical"] .membership-payment-alert,
.membership-payment-overlay[data-state="open-failed"] .membership-payment-alert {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary-color);
    font-size: 25px;
    font-weight: 750;
}

.membership-payment-overlay[data-state="failed"] .membership-payment-alert {
    background: #FEF2F2;
    color: #DC2626;
}

.membership-payment-eyebrow {
    margin-bottom: 7px;
    color: #64748B;
    font-size: 13px;
    font-weight: 600;
}

.membership-payment-overlay[data-state="success"] .membership-payment-eyebrow {
    color: #EA580C;
    font-size: 16px;
    font-weight: 750;
}

.membership-payment-overlay[data-state="success"] .membership-payment-title {
    font-size: 22px;
    font-weight: 750;
}

.membership-payment-overlay[data-state="success"] .membership-payment-message {
    min-height: 43px;
    margin-top: 8px;
    font-size: 14px;
}

.membership-payment-title {
    margin: 0;
    color: #1E293B;
    font-size: 20px;
    font-weight: 700;
    line-height: 1.35;
    letter-spacing: 0;
}

.membership-payment-message {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    max-width: 330px;
    margin: 10px auto 0;
    color: #64748B;
    font-size: 13px;
    line-height: 1.7;
}

.membership-wechat-qr {
    width: 232px;
    margin: 18px auto 0;
}

.membership-wechat-qr[hidden] {
    display: none;
}

.membership-wechat-qr-image {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 224px;
    height: 224px;
    margin: 0 auto;
    border: 1px solid #E2E8F0;
    background: #FFFFFF;
}

.membership-wechat-qr-image img {
    display: block;
    width: 208px;
    height: 208px;
}

.membership-wechat-qr p {
    margin: 9px 0 0;
    color: #475569;
    font-size: 12px;
    line-height: 1.5;
}

.membership-payment-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 22px;
    padding: 14px 16px;
    border-top: 1px solid #E2E8F0;
    border-bottom: 1px solid #E2E8F0;
    color: #475569;
    font-size: 13px;
    min-height: 54px;
    box-sizing: border-box;
}

.membership-payment-summary[hidden],
.membership-payment-order[hidden],
.membership-payment-benefits[hidden],
.membership-payment-expiry[hidden],
.membership-payment-notice[hidden],
.membership-payment-actions[hidden] {
    display: none;
}

.membership-payment-state-detail {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 128px;
}

.membership-payment-order {
    display: flex;
    align-items: baseline;
    justify-content: center;
    min-height: 20px;
    color: #64748B;
    font-size: 13px;
}

.membership-payment-summary strong {
    color: #334155;
    font-size: 14px;
    font-weight: 700;
}

.membership-payment-summary-item {
    display: flex;
    align-items: baseline;
}

.membership-payment-summary-item > span:last-child {
    color: #334155;
    font-size: 14px;
    font-weight: 650;
}

.membership-payment-benefits {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0;
    margin-top: 24px;
    padding: 3px 0;
}

.membership-payment-benefits div {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 28px;
    color: #334155;
    font-size: 14px;
    font-weight: 650;
}

.membership-payment-benefits div + div {
    border-left: 1px solid #E2E8F0;
}

.membership-payment-benefits span {
    color: #EA580C;
    font-size: 15px;
    font-weight: 800;
    line-height: 1;
}

.membership-payment-expiry {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #E2E8F0;
    color: #475569;
    font-size: 14px;
    font-weight: 650;
}

.membership-payment-notice {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    margin-top: 8px;
    padding: 8px 0;
    color: #64748B;
    font-size: 13px;
    line-height: 1.6;
    white-space: pre-line;
    box-sizing: border-box;
}

.membership-payment-notice.is-empty,
.membership-payment-actions.is-empty {
    visibility: hidden;
}

.membership-payment-actions {
    display: flex;
    gap: 10px;
    min-height: 44px;
    margin-top: 20px;
}

.membership-payment-primary,
.membership-payment-secondary {
    min-height: 44px;
    padding: 10px 18px;
    border-radius: 9px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
}

.membership-payment-primary {
    flex: 1;
    border: 1px solid var(--primary-color);
    background: var(--primary-color);
    color: #FFFFFF;
}

.membership-payment-primary:hover {
    border-color: var(--primary-hover);
    background: var(--primary-hover);
}

.membership-payment-overlay[data-state="success"] .membership-payment-primary {
    border-color: #EA580C;
    background: #EA580C;
}

.membership-payment-overlay[data-state="success"] .membership-payment-primary:hover {
    border-color: #D94805;
    background: #D94805;
}

.membership-payment-secondary {
    flex: 1;
    border: 1px solid #E2E8F0;
    background: #FFFFFF;
    color: #64748B;
}

.membership-payment-secondary:hover {
    border-color: #CBD5E1;
    background: #F8FAFC;
    color: #334155;
}

@keyframes membership-payment-spin {
    to { transform: rotate(360deg); }
}

@keyframes membership-seal-arrive {
    from { opacity: 0; transform: scale(0.82); }
    to { opacity: 1; transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
    .membership-payment-spinner,
    .membership-payment-seal {
        animation: none !important;
    }
}

@media (max-width: 600px) {
    .modal-membership {
        width: calc(100vw - 24px);
        max-width: none;
        margin: 12px 0;
    }

    .modal-membership .modal-body {
        padding: 26px 14px 16px;
    }

    .modal-membership .modal-close {
        top: 10px;
        right: 10px;
    }

    .membership-title {
        padding: 0 30px;
        font-size: 20px;
    }

    .membership-subtitle {
        padding: 0 12px;
        font-size: 12px;
    }

    .membership-status-summary {
        margin-top: 9px;
        font-size: 12px;
    }

    .membership-benefits {
        margin: 12px 0 14px;
        padding: 10px 0;
    }

    .membership-benefit {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 7px;
        padding: 0 8px;
        text-align: left;
        white-space: nowrap;
    }

    .membership-benefit-check {
        margin: 0;
    }

    .membership-benefit strong {
        color: #475569;
        font-size: 13px;
        font-weight: 600;
    }

    .membership-benefit small {
        display: none;
    }

    .membership-content-scope {
        margin: -4px 0 12px;
        font-size: 11px;
    }

    .membership-plans {
        grid-template-columns: 1fr;
        gap: 9px;
        margin-bottom: 18px;
    }

    .plan-card {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-rows: 1fr;
        align-items: center;
        min-height: 72px;
        padding: 11px 24px;
    }

    .plan-card:hover,
    .plan-card.selected {
        transform: none;
    }

    .plan-positioning {
        grid-column: 1;
        grid-row: 1;
    }

    .plan-name {
        grid-column: 1;
        grid-row: 1;
        justify-self: start;
        margin-top: 0;
        font-size: 15px;
    }

    .plan-price {
        grid-column: 2;
        grid-row: 1;
        align-self: center;
        justify-self: end;
        margin: 0;
        padding-left: 16px;
        font-size: 28px;
    }

    .plan-price .currency {
        font-size: 14px;
    }

    .plan-description {
        grid-column: 1;
        grid-row: 3;
        margin-top: 3px;
        padding: 0;
        font-size: 10px;
    }

    .btn-membership-pay {
        height: 48px;
    }

    #membershipPaymentModal {
        padding: 12px;
    }

    .membership-payment-dialog {
        width: calc(100vw - 24px);
        max-width: none;
        padding: 30px 20px 22px;
    }

    .membership-payment-visual {
        margin-bottom: 16px;
    }

    .membership-payment-title {
        font-size: 20px;
    }

    .membership-payment-message {
        font-size: 13px;
    }

    .membership-payment-primary,
    .membership-payment-secondary {
        min-width: 0;
        padding-right: 12px;
        padding-left: 12px;
        width: 100%;
    }
}

.app-update-migration-steps li {
    margin-bottom: 4px;
}

.app-update-migration-steps li:last-child {
    margin-bottom: 0;
}

.app-update-migration-notice {
    font-size: 13px;
    color: #FF4D4F;
    margin: 12px 0 0 0;
    text-align: center;
}

/* ===== 自动更新状态栏（restoreAutoUpdateFlow 使用） ===== */

.app-update-status {
    padding: 8px 24px 16px;
    font-size: 13px;
    text-align: center;
    border-top: 1px solid #EEF1F5;
}

.app-update-status-loading {
    color: #2B5AED;
}

.app-update-status-success {
    color: #52C41A;
}

.app-update-status-error {
    color: #FF4D4F;
}

/* 下载中三点跳动动画 */
.app-update-loading-dots {
    display: inline-flex;
    gap: 3px;
    margin-left: 2px;
    vertical-align: middle;
}

.app-update-loading-dots i {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #2B5AED;
    animation: app-update-dot-bounce 1.2s ease-in-out infinite;
}

.app-update-loading-dots i:nth-child(2) {
    animation-delay: 0.2s;
}

.app-update-loading-dots i:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes app-update-dot-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-4px); opacity: 1; }
}

.basket-item-move-up:hover:not(:disabled),
.basket-item-move-down:hover:not(:disabled) {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: var(--primary-light);
}

.basket-item-move-up:disabled,
.basket-item-move-down:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.basket-item-remove:hover {
    border-color: var(--danger-color);
    color: var(--danger-color);
    background: #FEF2F2;
}

.basket-item-locate {
    border-color: #e0e7ff;
    color: #3b82f6;
}

.basket-item-locate:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: var(--primary-light);
    transform: scale(1.1);
}

.btn-add-to-basket {
    width: 28px;
    height: 28px;
    border: 1.5px solid var(--border-color);
    background: var(--bg-white);
    color: var(--primary-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    flex-shrink: 0;
    line-height: 1;
    padding: 0;
}

.btn-add-to-basket:hover:not(.disabled):not(.in-basket) {
    border-color: var(--primary-color);
    background: var(--primary-light);
    transform: scale(1.1);
}

.btn-add-to-basket.in-basket {
    background: var(--success-color);
    border-color: var(--success-color);
    color: #fff;
    cursor: default;
    font-size: 13px;
}

.btn-add-to-basket.disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.btn-add-to-basket:active:not(.disabled):not(.in-basket) {
    transform: scale(0.9);
}

.basket-export-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
}

.basket-export-modal.show {
    opacity: 1;
    visibility: visible;
}

.basket-export-content {
    background: var(--bg-white);
    border-radius: var(--radius-xl);
    width: 440px;
    max-width: 90vw;
    box-shadow: var(--shadow-xl);
    position: relative;
    overflow: hidden;
    animation: modalIn 0.25s ease-out;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.basket-export-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-light);
}

.basket-export-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.basket-export-close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.basket-export-close:hover {
    background: var(--secondary-color);
    color: var(--text-primary);
}

.basket-export-body {
    padding: 20px 24px;
}

.basket-btn-export {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 20px;
    border: none;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: #fff;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.basket-btn-export:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.basket-btn-export:active {
    transform: translateY(0);
}

.basket-toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 3000;
    opacity: 0;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-lg);
    pointer-events: none;
}

.basket-toast-message {
    min-width: 0;
}

.basket-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.basket-toast-success {
    background: #ECFDF5;
    color: #065F46;
    border: 1px solid #A7F3D0;
}

.basket-toast-warning {
    background: #FFFBEB;
    color: #92400E;
    border: 1px solid #FDE68A;
}

.basket-toast-error {
    background: #FEF2F2;
    color: #991B1B;
    border: 1px solid #FECACA;
}

.basket-toast-info {
    background: #EFF6FF;
    color: var(--primary-color);
    border: 1px solid #DBEAFE;
}

.toast-icon {
    font-size: 15px;
    font-weight: 700;
}

@media (max-width: 768px) {
    .basket-toast {
        max-width: calc(100vw - 32px);
        box-sizing: border-box;
        text-align: center;
    }

    .basket-toast-message {
        white-space: pre-line;
    }


    .basket-panel-header {
        padding: 8px 12px;
        flex-wrap: wrap;
        gap: 6px;
    }

    /* 不强制 width:100% 换行；空间足够时单行，不足时 flex-wrap 自然换行 */
    .basket-header-actions {
        margin-left: auto;
        gap: 8px;
    }

    .basket-panel-body {
        flex-direction: column;
        position: relative;
    }

    /* Question list slides in from the left like sidebar */
    .basket-left {
        position: absolute;
        left: 0;
        top: 0;
        bottom: 0;
        width: 280px;
        max-height: none;
        z-index: 20;
        border-right: 1px solid var(--border-light);
        border-bottom: none;
        background: var(--bg-gray);
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: none;
    }

    .basket-left.mobile-open {
        transform: translateX(0);
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
    }

    /* Overlay behind the sliding panel */
    .basket-left-overlay {
        display: block;
        position: absolute;
        inset: 0;
        background: rgba(15, 23, 42, 0.4);
        z-index: 15;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
    }

    .basket-left-overlay.active {
        opacity: 1;
        pointer-events: auto;
    }

    /* Toggle button to open question list */
    .basket-list-toggle {
        display: flex;
        align-items: center;
        gap: 4px;
        padding: 6px 12px;
        border: 1px solid var(--border-color);
        background: var(--bg-white);
        color: var(--text-secondary);
        border-radius: var(--radius-sm);
        font-size: 12px;
        font-weight: 600;
        cursor: pointer;
        transition: all var(--transition-fast);
        -webkit-tap-highlight-color: transparent;
        white-space: nowrap;
    }

    .basket-list-toggle:hover {
        border-color: var(--primary-color);
        color: var(--primary-color);
        background: var(--primary-light);
    }

    .basket-list-toggle svg {
        width: 14px;
        height: 14px;
    }

    /* Collapse handle hidden on mobile (replaced by toggle button) */
    .basket-collapse-handle {
        display: none;
    }

    .basket-right {
        flex: 1;
        min-height: 0;
    }

    .basket-preview-page {
        /* JS handles width and scaling for mobile */
    }

    .basket-preview-iframe {
        /* JS handles iframe sizing */
    }
}

@media (min-width: 769px) {
    /* Hide mobile-only elements on desktop */
    .basket-collapse-handle {
        display: none;
    }

    .basket-list-toggle {
        display: none;
    }

    .basket-left-overlay {
        display: none;
    }
}

@media (max-width: 480px) {

    .basket-panel-header {
        padding: 8px 12px;
    }

    .basket-left {
        width: 260px;
    }

    .basket-btn-export-main {
        padding: 8px 14px;
        font-size: 12px;
    }
}

/* === 紧凑模式（短屏/横屏手机 max-height:500px） === */
/* 不按 orientation 判断，按实际可用高度判断空间是否紧张 */
@media (max-height: 500px) {
    .basket-panel-header {
        padding: 5px 10px;
        gap: 6px;
    }

    .basket-header-actions {
        gap: 6px;
    }

    .basket-panel-title {
        font-size: 14px;
        gap: 6px;
    }

    /* 题目列表按钮：紧凑模式缩小字号 */
    .basket-list-toggle .btn-text-mobile {
        font-size: 12px;
    }

    /* 导出按钮：紧凑模式缩小字号 */
    .basket-btn-export-main .btn-text-mobile {
        font-size: 12px;
        white-space: nowrap;
    }

    .basket-list-toggle,
    .basket-btn-export-main {
        padding: 4px 8px;
    }

    .basket-export-mode-trigger {
        padding: 0 6px;
    }

    /* 关闭按钮：缩小到 24px，与其他紧凑按钮高度统一 */
    .basket-panel-close {
        width: 24px;
        height: 24px;
        font-size: 14px;
        padding: 0;
        border-radius: 4px;
    }
}

.math-display {
    display: block;
    text-align: center;
    padding: 8px 0;
    overflow-x: auto;
}

.question-card.highlight-flash {
    border-left-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.2), var(--shadow-md);
    transition: box-shadow 0.3s ease;
}

.bottom-spacer {
    flex-shrink: 0;
    pointer-events: none;
}

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.85);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
    gap: 12px;
}

.loading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border-light);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay .loading-text {
    color: var(--text-secondary);
    font-size: 14px;
}

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    color: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    opacity: 0;
    transform: translateX(40px);
    transition: all 0.3s ease;
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

.toast-info {
    background: linear-gradient(135deg, #2563EB, #3B82F6);
}

.toast-success {
    background: linear-gradient(135deg, #10B981, #34D399);
}

.toast-warning {
    background: linear-gradient(135deg, #F59E0B, #FBBF24);
}

.toast-error {
    background: linear-gradient(135deg, #EF4444, #F87171);
}


/* ========== Navigation Guide Animation ========== */
.nav-guide-overlay {
    position: fixed;
    inset: 0;
    z-index: 1999;
    background: rgba(15, 23, 42, 0.7);
    opacity: 0;
    transition: opacity 0.35s ease;
    pointer-events: auto;
}

.nav-guide-overlay.active {
    opacity: 1;
}

.nav-guide-overlay.spotlight {
    background: transparent;
    /* Use mask to create spotlight effect */
    -webkit-mask-image: radial-gradient(
        ellipse var(--spot-w, 60px) var(--spot-h, 60px) at var(--spot-x, 50%) var(--spot-y, 50%),
        transparent 90%,
        black 91%
    );
    mask-image: radial-gradient(
        ellipse var(--spot-w, 60px) var(--spot-h, 60px) at var(--spot-x, 50%) var(--spot-y, 50%),
        transparent 90%,
        black 91%
    );
    background: rgba(15, 23, 42, 0.7);
}

.nav-guide-tooltip {
    position: fixed;
    z-index: 2000;
    display: flex;
    align-items: center;
    gap: 10px;
    background: white;
    color: var(--text-primary);
    padding: 10px 16px;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    font-size: 14px;
    font-weight: 500;
    opacity: 0;
    transform: translateY(8px);
    transition: all 0.3s ease;
    pointer-events: none;
    max-width: 85vw;
}

.nav-guide-tooltip.active {
    opacity: 1;
    transform: translateY(0);
}

.nav-guide-step {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
}

.nav-guide-text {
    white-space: nowrap;
}

.nav-guide-highlight {
    position: relative;
    z-index: 2001 !important;
    box-shadow: 0 0 0 3px var(--primary-color), 0 0 20px rgba(37, 99, 235, 0.3) !important;
    border-radius: 6px;
}

.nav-guide-highlight::before {
    content: '';
    position: absolute;
    inset: -10px;
    z-index: 2001;
}

.nav-guide-z-up {
    z-index: 2000 !important;
}

.nav-guide-z-up .nav-guide-highlight::before {
    z-index: 2001;
}

.nav-guide-skip {
    position: fixed;
    top: 12px;
    right: 16px;
    z-index: 2002;
    background: none;
    color: rgba(255, 255, 255, 0.7);
    border: none;
    padding: 4px 8px;
    font-size: 14px;
    cursor: pointer;
}

.nav-guide-skip:active {
    color: white;
}

/* ========== Local JSON2 structured editor ========== */
.btn-json2-edit {
    border: 1px solid #CBD5E1;
    background: #F8FAFC;
    color: #334155;
    padding: 5px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    white-space: nowrap;
}

.btn-json2-edit:hover {
    border-color: #94A3B8;
    background: #F1F5F9;
}

.btn-json2-edit:disabled {
    cursor: wait;
    opacity: 0.6;
}

.json2-editor-active > .question-content,
.json2-editor-active > .answer-content {
    display: none;
}

.json2-editor-panel {
    margin: 12px 0 0;
    border-top: 1px solid #E2E8F0;
    background: #F8FAFC;
    color: #1E293B;
    overflow: hidden;
}

.json2-editor-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border-bottom: 1px solid #E2E8F0;
    background: #FFFFFF;
}

.json2-editor-heading,
.json2-editor-toolbar-actions,
.json2-editor-block-toolbar,
.json2-editor-span-controls,
.json2-editor-display-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
}

.json2-editor-heading {
    min-width: 0;
    flex-wrap: wrap;
}

.json2-editor-identity,
.json2-editor-status,
.json2-editor-asset-label {
    color: #64748B;
    font-size: 12px;
}

.json2-editor-status {
    color: #0F766E;
}

.json2-editor-toolbar-actions button,
.json2-editor-action {
    border: 1px solid #CBD5E1;
    background: #FFFFFF;
    color: #334155;
    padding: 5px 9px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
    white-space: nowrap;
}

.json2-editor-toolbar-actions .json2-editor-save-close {
    border-color: #0F766E;
    background: #0F766E;
    color: #FFFFFF;
}

.json2-editor-toolbar-actions button:disabled {
    cursor: wait;
    opacity: 0.6;
}

.json2-editor-action:hover,
.json2-editor-toolbar-actions .json2-editor-cancel:hover {
    background: #F1F5F9;
}

.json2-editor-action-danger {
    border-color: #FCA5A5;
    color: #B91C1C;
}

.json2-editor-body {
    padding: 14px;
}

.json2-editor-section + .json2-editor-section {
    margin-top: 18px;
}

.json2-editor-section-title {
    margin: 0 0 8px;
    color: #334155;
    font-size: 14px;
}

.json2-editor-block {
    margin: 8px 0;
    border-left: 3px solid #CBD5E1;
    background: #FFFFFF;
    padding: 9px 10px;
}

.json2-editor-block-toolbar {
    justify-content: flex-start;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.json2-editor-block-label,
.json2-editor-inline-label {
    color: #475569;
    font-size: 12px;
    font-weight: 650;
}

.json2-editor-inline-list {
    display: grid;
    gap: 8px;
}

.json2-editor-inline {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    align-items: start;
    gap: 8px;
    padding: 7px 0;
    border-top: 1px solid #F1F5F9;
}

.json2-editor-inline:first-child {
    border-top: 0;
}

.json2-editor-text-input,
.json2-editor-math-input,
.json2-editor-cell input {
    box-sizing: border-box;
    width: 100%;
    border: 1px solid #CBD5E1;
    border-radius: 4px;
    padding: 6px 8px;
    background: #FFFFFF;
    color: #0F172A;
    font: inherit;
    resize: vertical;
}

.json2-editor-math-input {
    min-height: 44px;
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

.json2-editor-inline-math {
    grid-template-columns: 42px minmax(160px, 1fr) minmax(100px, auto) auto;
    align-items: center;
}

.json2-editor-math-preview {
    min-height: 24px;
    overflow-x: auto;
    padding: 4px 6px;
}

.json2-editor-display-toggle {
    color: #64748B;
    font-size: 12px;
    white-space: nowrap;
}

.json2-editor-image-preview {
    display: block;
    max-width: min(100%, 320px);
    max-height: 180px;
    object-fit: contain;
    border: 1px solid #E2E8F0;
    background: #FFFFFF;
}

.json2-editor-break-preview,
.json2-editor-blank-preview {
    color: #0F766E;
    font-size: 12px;
}

.json2-editor-unknown {
    margin: 0;
    max-width: 100%;
    overflow: auto;
    color: #92400E;
    font: 12px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace;
    white-space: pre-wrap;
}

.json2-editor-empty,
.json2-editor-empty-inline {
    color: #94A3B8;
    font-size: 12px;
}

.json2-editor-table-grid {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.json2-editor-table-grid td,
.json2-editor-table-grid th {
    min-width: 90px;
    border: 1px solid #CBD5E1;
    padding: 6px;
    vertical-align: top;
    text-align: left;
    font-weight: 400;
}

.json2-editor-span-controls {
    flex-wrap: wrap;
    margin-bottom: 6px;
    color: #64748B;
    font-size: 11px;
}

.json2-editor-span-controls label {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.json2-editor-span-controls input {
    width: 48px;
    padding: 3px 4px;
}

@media (max-width: 640px) {
    .json2-editor-toolbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .json2-editor-inline-math {
        grid-template-columns: 42px minmax(0, 1fr);
    }

    .json2-editor-inline-math .json2-editor-math-preview,
    .json2-editor-inline-math .json2-editor-display-toggle {
        grid-column: 2;
    }

    .json2-editor-table-grid {
        min-width: 560px;
    }

    .json2-editor-table {
        overflow-x: auto;
    }
}

/* Structured editor interaction states and modal controls. */
.json2-editor-section-header,
.json2-editor-cell-toolbar,
.json2-editor-image-fields,
.json2-editor-inline-controls,
.json2-editor-modal-actions,
.json2-editor-options-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.json2-editor-section-header {
    justify-content: space-between;
    gap: 12px;
}

.json2-editor-toolbar-button {
    border: 1px solid #CBD5E1;
    background: #FFFFFF;
    color: #334155;
}

.json2-editor-toolbar-button:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

.json2-editor-block,
.json2-editor-inline,
.json2-editor-cell {
    transition: border-color 120ms ease, box-shadow 120ms ease, background-color 120ms ease;
}

.json2-editor-selected {
    border-color: #0F766E !important;
    box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.15);
    background: #F0FDFA;
}

.json2-editor-inline {
    position: relative;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    padding: 7px 0;
}

.json2-editor-inline-text {
    grid-template-columns: 42px minmax(0, 1fr) auto;
}

.json2-editor-inline-controls {
    align-self: start;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.json2-editor-icon-action {
    min-width: 30px;
    min-height: 28px;
    padding: 3px 7px;
    border: 1px solid #CBD5E1;
    background: #FFFFFF;
    color: #475569;
    cursor: pointer;
}

.json2-editor-icon-action:hover,
.json2-editor-toolbar-button:hover {
    border-color: #94A3B8;
    background: #F1F5F9;
}

.json2-editor-math-preview {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    cursor: pointer;
}

.json2-editor-image-fields {
    align-items: stretch;
    flex-wrap: wrap;
    margin-top: 7px;
}

.json2-editor-image-src {
    flex: 1 1 260px;
    min-width: 180px;
}

.json2-editor-image-width {
    width: 82px;
}

.json2-editor-image-fields input {
    box-sizing: border-box;
    border: 1px solid #CBD5E1;
    padding: 5px 7px;
    color: #334155;
    background: #FFFFFF;
}

.json2-editor-cell-toolbar {
    justify-content: flex-end;
    min-height: 28px;
}

.json2-editor-cell-toolbar .json2-editor-action {
    padding: 3px 6px;
    font-size: 11px;
}

.json2-editor-options {
    margin-top: 12px;
    border-top: 1px solid #E2E8F0;
    padding-top: 10px;
}

.json2-editor-options-title {
    margin: 0 0 8px;
    color: #475569;
    font-size: 12px;
}

.json2-editor-option {
    margin: 8px 0;
    border-left: 2px solid #CBD5E1;
    padding-left: 10px;
}

.json2-editor-option-label {
    display: block;
    margin-bottom: 5px;
    color: #475569;
    font-size: 12px;
}

.json2-editor-modal {
    position: fixed;
    inset: 0;
    z-index: 10050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(15, 23, 42, 0.42);
}

.json2-editor-modal-dialog {
    box-sizing: border-box;
    width: min(680px, 100%);
    max-height: min(720px, 100%);
    overflow: auto;
    border: 1px solid #CBD5E1;
    border-radius: 8px;
    padding: 18px;
    background: #FFFFFF;
    box-shadow: 0 18px 48px rgba(15, 23, 42, 0.22);
}

.json2-editor-modal-title {
    margin: 0 0 14px;
    color: #1E293B;
    font-size: 16px;
}

.json2-editor-modal-source-label,
.json2-editor-modal-preview-label {
    display: block;
    margin: 8px 0 5px;
    color: #475569;
    font-size: 12px;
    font-weight: 650;
}

.json2-editor-modal-dialog > .json2-editor-math-input {
    box-sizing: border-box;
    width: 100%;
    min-height: 110px;
    resize: vertical;
}

.json2-editor-formula-modal-preview {
    min-height: 54px;
    overflow-x: auto;
    border: 1px solid #E2E8F0;
    padding: 12px;
    background: #F8FAFC;
}

.json2-editor-formula-modal-error {
    min-height: 20px;
    margin-top: 7px;
    color: #B91C1C;
    font-size: 12px;
}

.json2-editor-formula-modal-error.is-valid {
    color: #0F766E;
}

.json2-editor-modal-actions {
    justify-content: flex-end;
    margin-top: 14px;
}

@media (max-width: 640px) {
    .json2-editor-inline,
    .json2-editor-inline-text {
        grid-template-columns: 42px minmax(0, 1fr);
    }

    .json2-editor-inline-controls {
        grid-column: 2;
        justify-content: flex-start;
    }

    .json2-editor-section-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .json2-editor-modal-dialog {
        padding: 14px;
    }
}

/* Keep a paragraph visually close to Renderer2 while retaining node-level editing. */
.json2-editor-inline-list {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    column-gap: 2px;
    row-gap: 4px;
    min-height: 32px;
    line-height: 1.65;
}

.json2-editor-inline {
    display: inline-flex;
    flex: 0 1 auto;
    align-items: baseline;
    min-width: 0;
    max-width: 100%;
    gap: 5px;
    margin: 0;
    border: 1px solid transparent;
    border-radius: 3px;
    padding: 2px 4px;
    vertical-align: baseline;
}

.json2-editor-inline-label {
    display: none;
}

.json2-editor-text-preview {
    display: inline;
    min-height: 1.4em;
    max-width: 100%;
    cursor: text;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.json2-editor-text-preview.is-empty::before {
    color: #94A3B8;
    content: '空文本';
    font-size: 12px;
}

.json2-editor-inline-text .json2-editor-text-input {
    border: 0;
    border-radius: 0;
    padding: 0;
    outline: none;
    box-shadow: none;
    background: transparent;
    line-height: inherit;
    width: auto;
    min-width: 4em;
    max-width: min(100%, 42rem);
    flex: 0 1 auto;
    resize: vertical;
}

.json2-editor-inline-text textarea.json2-editor-text-input {
    width: min(100%, 34rem);
    min-height: 2.2em;
}

.json2-editor-inline-math[data-display="true"] {
    flex-basis: 100%;
    width: 100%;
}

.json2-editor-inline-break {
    flex-basis: 100%;
    width: 100%;
    min-height: 4px;
    border-color: transparent;
    padding-top: 0;
    padding-bottom: 0;
}

.json2-editor-inline-break .json2-editor-break-preview {
    min-height: 16px;
}

.json2-editor-inline-controls {
    position: static;
    justify-content: flex-end;
    flex-wrap: nowrap;
    border: 1px solid #CBD5E1;
    border-radius: 4px;
    padding: 2px;
    background: #FFFFFF;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.12);
    display: none;
    opacity: 1;
    pointer-events: none;
    transform: none;
    transition: opacity 120ms ease;
}

.json2-editor-inline:hover > .json2-editor-inline-controls,
.json2-editor-inline:focus-within > .json2-editor-inline-controls,
.json2-editor-inline.json2-editor-selected > .json2-editor-inline-controls {
    display: flex;
    opacity: 1;
    pointer-events: auto;
}

.json2-editor-range-selected {
    border-color: #93C5FD !important;
    background: #EFF6FF !important;
}

.json2-editor-inline.json2-editor-selected {
    position: relative;
    z-index: 2;
    border-color: #0F766E !important;
    background: #F0FDFA !important;
    box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.15);
}

.json2-editor-icon-action {
    min-width: 28px;
    min-height: 26px;
    padding: 2px 5px;
    font-size: 11px;
}

.json2-editor-math-preview {
    max-width: min(100%, 42rem);
    overflow-x: auto;
    padding: 2px 3px;
}

.json2-editor-image-preview {
    max-width: min(100%, 240px);
    max-height: 96px;
    object-fit: contain;
}

.json2-editor-inline-image {
    flex-wrap: wrap;
    align-items: center;
}

.json2-editor-inline-image .json2-editor-image-fields {
    flex: 1 1 100%;
    width: 100%;
    max-height: 0;
    margin-top: 0;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transition: max-height 120ms ease, margin-top 120ms ease, opacity 120ms ease;
}

.json2-editor-inline-image:hover .json2-editor-image-fields,
.json2-editor-inline-image:focus-within .json2-editor-image-fields,
.json2-editor-inline-image.json2-editor-selected .json2-editor-image-fields {
    max-height: 100px;
    margin-top: 5px;
    opacity: 1;
    pointer-events: auto;
}

.json2-editor-inline-image .json2-editor-asset-label {
    max-width: 18rem;
    overflow: hidden;
    color: #64748B;
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 640px) {
    .json2-editor-inline,
    .json2-editor-inline-text {
        grid-template-columns: none;
    }

    .json2-editor-inline-controls {
        grid-column: auto;
        max-width: min(100vw - 32px, 280px);
        overflow-x: auto;
    }

    .json2-editor-inline-text .json2-editor-text-input,
    .json2-editor-inline-text textarea.json2-editor-text-input {
        max-width: calc(100vw - 72px);
    }
}

/* Keep editing controls discoverable without changing the question flow when
   a run is hovered or selected. */
.json2-editor-panel {
    overflow: visible;
}

.questions-scroll.json2-editor-scroll-host {
    scroll-padding-top: 88px;
}

.json2-editor-paragraph,
.json2-editor-table {
    scroll-margin-top: 88px;
}

.json2-editor-paragraph > .json2-editor-block-toolbar .json2-editor-action,
.json2-editor-inline-controls button,
.json2-editor-cell-toolbar button {
    scroll-margin-top: 88px;
}

.json2-editor-toolbar {
    position: sticky;
    top: 0;
    z-index: 30;
    flex-wrap: wrap;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}

.json2-editor-heading {
    flex: 1 1 240px;
}

.json2-editor-toolbar-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
}

.json2-editor-status {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    border-radius: 999px;
    padding: 2px 8px;
    background: #F1F5F9;
}

.json2-editor-panel[data-dirty="true"] .json2-editor-status {
    background: #FFF7ED;
    color: #C2410C;
}

.json2-editor-block {
    border: 1px solid #E2E8F0;
    border-left: 3px solid #CBD5E1;
    border-radius: 6px;
    padding: 8px 10px 10px;
}

.json2-editor-block-toolbar {
    min-height: 28px;
    margin-bottom: 6px;
    border-bottom: 1px solid #F1F5F9;
    padding-bottom: 5px;
}

.json2-editor-block-label {
    margin-right: auto;
}

.json2-editor-block-toolbar .json2-editor-action {
    padding: 4px 7px;
    font-size: 11px;
}

.json2-editor-paragraph > .json2-editor-block-toolbar .json2-editor-action {
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-2px);
    transition: opacity 120ms ease, transform 120ms ease, visibility 120ms ease;
}

.json2-editor-paragraph:hover > .json2-editor-block-toolbar .json2-editor-action,
.json2-editor-paragraph:focus-within > .json2-editor-block-toolbar .json2-editor-action,
.json2-editor-paragraph.json2-editor-selected > .json2-editor-block-toolbar .json2-editor-action {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.json2-editor-inline {
    cursor: grab;
    user-select: none;
    border: 1px solid transparent;
    transition: border-color 120ms ease, background-color 120ms ease;
}

.json2-editor-inline:hover,
.json2-editor-inline.json2-editor-inline-hovered {
    border: 1px solid #94A3B8;
    background: #F8FAFC;
}

.json2-editor-inline:active {
    cursor: grabbing;
}

.json2-editor-inline-math {
    gap: 0;
}

.json2-editor-inline:focus-visible,
.json2-editor-block:focus-visible,
.json2-editor-cell:focus-visible {
    outline: 2px solid #2563EB;
    outline-offset: 2px;
    scroll-margin-top: 72px;
}

.json2-editor-inline-controls {
    position: absolute;
    top: calc(100% + 3px);
    right: 0;
    z-index: 40;
    display: flex;
    visibility: hidden;
    max-width: min(360px, calc(100vw - 32px));
    opacity: 0;
    pointer-events: none;
    transform: translateY(-2px);
    transition: opacity 120ms ease, transform 120ms ease, visibility 120ms ease;
}

.json2-editor-inline:hover > .json2-editor-inline-controls,
.json2-editor-inline:focus-within > .json2-editor-inline-controls,
.json2-editor-inline.json2-editor-selected > .json2-editor-inline-controls {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.json2-editor-empty-paragraph-input {
    min-height: 30px;
    border-style: dashed;
    color: #64748B;
    background: #F8FAFC;
}

.json2-editor-empty-paragraph-input:hover,
.json2-editor-empty-paragraph-input:focus-visible {
    border-color: #0F766E;
    background: #F0FDFA;
    color: #0F766E;
}

.json2-editor-table {
    overflow-x: auto;
}

.json2-editor-cell {
    position: relative;
    padding-top: 34px !important;
}

.json2-editor-cell-toolbar {
    position: absolute;
    top: 4px;
    right: 4px;
    z-index: 4;
    min-height: 24px;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transition: opacity 120ms ease, visibility 120ms ease;
}

.json2-editor-cell:hover .json2-editor-cell-toolbar,
.json2-editor-cell:focus-within .json2-editor-cell-toolbar,
.json2-editor-cell.json2-editor-selected .json2-editor-cell-toolbar {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}

.json2-editor-formula-modal-preview {
    min-height: 64px;
    display: flex;
    align-items: center;
}

.json2-editor-formula-modal-preview .katex-display {
    margin: 0;
}

.json2-editor-modal-dialog {
    max-height: min(720px, calc(100dvh - 36px));
}

@media (max-width: 640px) {
    .questions-scroll.json2-editor-scroll-host {
        scroll-padding-top: 116px;
    }

    .json2-editor-paragraph,
    .json2-editor-table {
        scroll-margin-top: 116px;
    }

    .json2-editor-paragraph > .json2-editor-block-toolbar .json2-editor-action,
    .json2-editor-inline-controls button,
    .json2-editor-cell-toolbar button {
        scroll-margin-top: 116px;
    }

    .json2-editor-toolbar {
        align-items: stretch;
        padding: 10px;
    }

    .json2-editor-toolbar-actions {
        width: 100%;
        justify-content: stretch;
    }

    .json2-editor-toolbar-actions button {
        flex: 1 1 auto;
    }

    .json2-editor-inline-controls {
        top: calc(100% + 2px);
        right: auto;
        left: 0;
    }

    .json2-editor-cell {
        padding-top: 30px !important;
    }
}

/* Keep editor feedback inside the webpage instead of the host application's UI. */
.json2-editor-notice {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 10070;
    max-width: min(420px, calc(100vw - 32px));
    border: 1px solid #BFDBFE;
    border-radius: 6px;
    padding: 10px 12px;
    background: #EFF6FF;
    color: #1E40AF;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.16);
    font-size: 13px;
    line-height: 1.5;
}

.json2-editor-notice[data-type="error"] {
    border-color: #FCA5A5;
    background: #FEF2F2;
    color: #991B1B;
}

/* Keep selection feedback visible without making the editing canvas noisy. */
.json2-editor-selection-status {
    display: none;
    align-items: center;
    min-height: 22px;
    border: 1px solid #BFDBFE;
    border-radius: 999px;
    padding: 2px 8px;
    background: #EFF6FF;
    color: #1D4ED8;
    font-size: 12px;
    white-space: nowrap;
}

.json2-editor-selection-status[data-count]:not([data-count="0"]) {
    display: inline-flex;
}

.json2-editor-inline[aria-selected="true"] {
    outline: 1px solid rgba(15, 118, 110, 0.24);
    outline-offset: 1px;
}

.json2-editor-table-row.json2-editor-selected > td,
.json2-editor-table-row.json2-editor-selected > th {
    background: #F0FDFA;
    box-shadow: inset 0 2px 0 #0F766E, inset 0 -2px 0 #0F766E;
}

.json2-editor-confirm-modal {
    position: fixed;
    inset: 0;
    z-index: 10060;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(15, 23, 42, 0.42);
}

.json2-editor-confirm-dialog {
    box-sizing: border-box;
    width: min(440px, 100%);
    border: 1px solid #CBD5E1;
    border-radius: 8px;
    padding: 20px;
    background: #FFFFFF;
    box-shadow: 0 18px 48px rgba(15, 23, 42, 0.22);
}

.json2-editor-confirm-title {
    margin: 0;
    color: #1E293B;
    font-size: 16px;
}

.json2-editor-confirm-message {
    margin: 10px 0 0;
    color: #475569;
    font-size: 13px;
    line-height: 1.6;
}

.json2-editor-confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 18px;
}

.json2-editor-confirm-dialog button:focus-visible,
.json2-editor-toolbar button:focus-visible,
.json2-editor-action:focus-visible {
    outline: 2px solid #2563EB;
    outline-offset: 2px;
}

@media (max-width: 640px) {
    .json2-editor-heading {
        flex: 0 0 auto;
        width: 100%;
    }

    .json2-editor-notice {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }

    .json2-editor-confirm-dialog {
        padding: 16px;
    }

    .json2-editor-confirm-actions {
        flex-direction: column-reverse;
    }

    .json2-editor-confirm-actions button {
        width: 100%;
    }
}



/* Teaching numbers are navigation cues, separate from the readable topic name. */
.teaching-label {
    display: inline-flex;
    align-items: baseline;
    gap: 0.5em;
    min-width: 0;
    max-width: 100%;
    vertical-align: baseline;
}
.teaching-label > .teaching-label-number {
    flex: 0 0 auto;
    color: var(--teaching-number-color, #64748b);
    font-size: 0.88em;
    font-weight: 400;
    font-variant-numeric: tabular-nums;
    letter-spacing: normal;
    white-space: nowrap;
}
.teaching-label > .teaching-label-name {
    min-width: 0;
    overflow-wrap: anywhere;
    white-space: normal;
}
.tree-item-label.teaching-label {
    white-space: normal;
    line-height: 1.5;
    overflow: visible;
}
.tree-item.level-1 .teaching-label-name { font-weight: 600; }
.tree-item.active .teaching-label-number,
.tree-item.find-match-active .teaching-label-number {
    color: inherit;
}
.card-tag-knowledge.teaching-label { text-align: left; }

.question-retry-card {
    box-sizing: border-box;
    width: min(100%, 520px);
    margin: clamp(24px, 8vh, 88px) auto;
    padding: 32px 28px;
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    background: #fff;
    text-align: center;
    color: #334155;
    box-shadow: 0 8px 28px rgba(15, 23, 42, .04);
}
.question-retry-icon {
    display: inline-grid;
    place-items: center;
    width: 52px;
    height: 52px;
    margin-bottom: 16px;
    border-radius: 16px;
    background: #eff6ff;
    color: #2563eb;
    font-size: 30px;
}
.question-retry-card h2 { margin: 0 0 12px; font-size: 20px; line-height: 1.5; color: #0f172a; }
.question-retry-description { margin: 0 auto 24px; max-width: 360px; font-size: 15px; line-height: 1.8; white-space: pre-line; }
.question-retry-button {
    min-width: 156px;
    min-height: 44px;
    padding: 10px 22px;
    border: 0;
    border-radius: 10px;
    background: #2563eb;
    color: #fff;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}
.question-retry-button:hover:not(:disabled) { background: #1d4ed8; }
.question-retry-button:focus-visible { outline: 3px solid #93c5fd; outline-offset: 3px; }
.question-retry-button:disabled { background: #e2e8f0; color: #64748b; cursor: default; }
.question-retry-hint { margin: 18px 0 0; color: #64748b; font-size: 12px; line-height: 1.8; }
.question-retry-contact { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.question-retry-copy { min-height: 44px; border: 0; border-radius: 6px; background: transparent; padding: 8px 6px; color: #2563eb; font: inherit; cursor: pointer; }
.question-retry-copy:hover { text-decoration: underline; }
.question-retry-copy:focus-visible { outline: 2px solid #93c5fd; outline-offset: 2px; }
@media (max-width: 600px) {
    .question-retry-card { padding: 28px 18px; margin: 24px auto; border-radius: 14px; }
    .question-retry-card h2 { font-size: 18px; }
    .question-retry-button { width: 100%; }
}
