/* 字体声明 */
@font-face {
    font-family: 'LXGW WenKai Screen';
    src: url('../fonts/LXGWWenKaiScreen.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'LXGW WenKai';
    src: url('../fonts/LXGWWenKai.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

:root {
    /* 主色系统 - 墨青色 */
    --primary-50: #f0f5f3;
    --primary-100: #dfe9e5;
    --primary-200: #bdd5cd;
    --primary-300: #8db8a7;
    --primary-400: #5a8f7e;
    --primary-500: #487a6a;
    --primary-600: #3d6659;
    --primary-700: #2e4d43;
    --primary-800: #23392f;
    --primary-900: #1a2720;

    /* 强调色系统 - 竹绿色 */
    --accent-50: #eef7f1;
    --accent-100: #d8f0e0;
    --accent-200: #b3e1c3;
    --accent-300: #88ce9f;
    --accent-400: #6fc089;
    --accent-500: #5aad74;
    --accent-600: #4a8f5f;
    --accent-700: #3a7249;
    --accent-800: #2d5737;
    --accent-900: #1f3c26;

    /* 中性色系统 - 宣纸色系 */
    --neutral-50: #faf8f5;
    --neutral-100: #f5f2ed;
    --neutral-200: #e8e3da;
    --neutral-300: #d4cdc0;
    --neutral-400: #a89f8e;
    --neutral-500: #8a7f6e;
    --neutral-600: #5e564a;
    --neutral-700: #3f3932;
    --neutral-800: #2a2520;
    --neutral-900: #1a1816;

    /* 功能色 */
    --success-color: #5aad74;
    --warning-color: #d69e2e;
    --error-color: #c74438;
    --info-color: #487a6a;

    /* 动画变量 */
    --transition-duration: 0.3s;
    --transition-fast: 0.2s;
    --transition-slow: 0.5s;
    --easing: cubic-bezier(0.4, 0, 0.2, 1);
    --easing-in: cubic-bezier(0.4, 0, 1, 1);
    --easing-out: cubic-bezier(0, 0, 0.2, 1);
    --easing-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);

    /* 响应式字体系统 */
    --font-family-base: 'LXGW WenKai Screen', 'Source Han Sans SC', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    --font-family-heading: 'LXGW WenKai', 'Source Han Serif SC', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', serif;
    --font-size-base: clamp(16px, 2.2vw, 19px);
    --font-size-sm: clamp(14px, 1.8vw, 16px);
    --font-size-md: clamp(17px, 2.4vw, 20px);
    --font-size-lg: clamp(20px, 3.2vw, 26px);
    --font-size-xl: clamp(28px, 4.5vw, 36px);

    /* 响应式行高系统 */
    --line-height-tight: 1.5;
    --line-height-base: 1.8;
    --line-height-relaxed: 2.1;

    /* 间距系统 */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;

    /* 圆角系统 */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-full: 9999px;

    /* 阴影系统 */
    --shadow-sm: 0 2px 6px rgba(42, 37, 32, 0.04);
    --shadow-md: 0 8px 16px rgba(42, 37, 32, 0.08);
    --shadow-lg: 0 15px 30px rgba(72, 122, 106, 0.2);
    --shadow-hover: 0 12px 24px rgba(72, 122, 106, 0.15);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* GPU 加速和性能优化 */
.question-content,
.subject-card,
.btn,
.progress-bar-fill,
.ai-tip-container {
    transform: translateZ(0);
    backface-visibility: hidden;
    will-change: transform;
}

.progress-bar-fill {
    contain: layout style paint;
}

body {
    font-family: var(--font-family-base);
    font-size: var(--font-size-base);
    line-height: var(--line-height-base);
    color: var(--neutral-800);
    background: radial-gradient(circle at top left, rgba(90, 143, 126, 0.08), transparent 55%),
                radial-gradient(circle at bottom right, rgba(111, 192, 137, 0.1), transparent 50%),
                linear-gradient(135deg, var(--neutral-50) 0%, var(--neutral-100) 100%);
    min-height: 100vh;
    padding: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch; /* iOS 惯性滚动 */
}

.container {
    max-width: 960px;
    min-height: 100vh;
    margin: 0 auto;
    background: rgba(250, 248, 245, 0.95);
    border-radius: 0;
    box-shadow: 0 25px 60px rgba(42, 37, 32, 0.12);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    overflow: visible;
    border: 1px solid rgba(212, 205, 192, 0.45);
    display: flex;
    flex-direction: column;
    padding: 0 20px;
}

.header {
    position: relative; /* 为绝对定位的主题切换按钮提供定位上下文 */
    background: linear-gradient(135deg, rgba(72, 122, 106, 0.92) 0%, rgba(90, 143, 126, 0.88) 100%);
    color: #fff;
    text-align: center;
    padding: 18px 10px 14px;
    flex-shrink: 0;
    margin: 0 -20px;
    border-radius: 0;
}

.header h1 {
    font-size: var(--font-size-xl);
    font-weight: 700;
    text-shadow: 0 10px 30px rgba(15, 23, 42, 0.2);
    margin-bottom: 12px;
}

.subtitle {
    font-size: var(--font-size-md);
    opacity: 0.92;
    letter-spacing: 0.05em;
}

.main-content {
    padding: 0;
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    -webkit-overflow-scrolling: touch; /* iOS 惯性滚动 */
}

/* 内容滚动区域 */
.main-content > :not(.controls):not(.question-content) {
    flex-shrink: 0;
}

.main-content > .progress-info,
.main-content > .question-content,
.main-content > .instruction {
    margin: 0 clamp(4px, 2vw, 36px);
}

/* 让 AI 提示容器与题目区域保持相同左右边距（对齐宽度） */
.main-content > .ai-tip-container {
    margin: clamp(24px, 2.5vw, 48px) clamp(4px, 2vw, 36px) 0;
}

.main-content > .progress-info {
    margin-top: 48px;
}

.main-content > .question-content {
    margin-top: 32px;
    margin-bottom: auto;
    flex: 0 0 auto;
    overflow-y: auto;
    max-height: 100%;
}

.main-content > .instruction {
    margin-top: 32px;
    margin-bottom: 32px;
}

.progress-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 18px 22px;
    background: var(--neutral-50);
    border-radius: 18px;
    border: 1px solid var(--neutral-100);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45);
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.progress-info span {
    font-weight: 600;
    color: var(--neutral-600);
    letter-spacing: 0.02em;
}

.progress-info span span {
    color: var(--primary-500);
    font-size: 1.15em;
    margin: 0 4px;
}

.progress-percentage {
    color: var(--primary-600);
    font-weight: 700;
    font-size: var(--font-size-md);
}

.progress-bar-container {
    width: 100%;
    height: 8px;
    background: rgba(90, 143, 126, 0.1);
    border-radius: 999px;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 1px 3px rgba(42, 37, 32, 0.1);
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-400) 0%, var(--primary-600) 100%);
    border-radius: 999px;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    width: 0%;
    position: relative;
    box-shadow: 0 1px 3px rgba(72, 122, 106, 0.4);
}

.progress-bar-fill::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.4) 50%, transparent 100%);
    animation: shimmer 2.5s ease-in-out infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

.question-content {
    position: relative;
    background-image:
        repeating-linear-gradient(0deg, /* 纸质纹理 */
            transparent,
            transparent 2px,
            rgba(42, 37, 32, 0.008) 2px,
            rgba(42, 37, 32, 0.008) 4px
        ),
        linear-gradient(135deg, var(--neutral-50) 0%, rgba(255, 255, 255, 0.98) 100%);
    border-radius: 20px;
    padding: 28px clamp(20px, 4vw, 32px);
    box-shadow: 0 18px 45px rgba(42, 37, 32, 0.08);
    border: 1px solid rgba(212, 205, 192, 0.7);
    font-size: var(--font-size-lg);
    line-height: var(--line-height-relaxed);
    color: var(--neutral-800);
    text-align: left;
    white-space: pre-line;
    transition: background 0.4s ease, border-color 0.4s ease, color 0.3s ease;
}

/* 随机抽背模式：添加内部装饰性边框（装裱效果） */
body:not(.browse-mode) .question-content::before {
    content: "";
    position: absolute;
    inset: 16px;
    border-radius: 16px;
    border: 2px dashed var(--primary-200);
    opacity: 0.4;
    pointer-events: none;
    transition: border-color 0.4s ease, opacity 0.4s ease;
}

/* 随机抽背模式：显示答案后的样式（竹简绿） */
body:not(.browse-mode) .question-content.revealed {
    background-image:
        repeating-linear-gradient(0deg,
            transparent,
            transparent 2px,
            rgba(42, 37, 32, 0.008) 2px,
            rgba(42, 37, 32, 0.008) 4px
        ),
        linear-gradient(135deg, rgba(111, 192, 137, 0.12) 0%, rgba(111, 192, 137, 0.03) 100%);
    border-color: rgba(90, 173, 116, 0.35);
    color: var(--neutral-800);
}

body:not(.browse-mode) .question-content.revealed::before {
    border-color: var(--accent-300);
    opacity: 0.5;
}

/* 明牌浏览模式：移除装饰性边框和背景 */
.browse-mode .question-content {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
}

.blank {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: clamp(4ch, var(--blank-width, 7ch), 24ch);
    padding: 0 0.4em;
    position: relative;
    margin: 0 6px;
    height: 1.1em;
    cursor: pointer;
}

/* 墨迹下划线效果 */
.blank::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg,
        transparent 0%,
        var(--primary-400) 10%,
        var(--primary-500) 50%,
        var(--primary-400) 90%,
        transparent 100%);
    filter: blur(0.5px);
    opacity: 0.9;
    animation: pulse 1.8s ease-in-out infinite;
}

.blank:focus {
    outline: none;
}

.blank:focus::after {
    box-shadow: 0 0 0 3px rgba(72, 122, 106, 0.35);
}

/* Clickable blank state - enhanced visual feedback */
.blank:not(.blank-cooling):not(.revealed) {
    cursor: pointer;
    transition: background-color 0.2s, opacity 0.2s, box-shadow 0.2s;
}

.blank:not(.blank-cooling):not(.revealed):hover {
    background-color: rgba(90, 173, 116, 0.15);
}

.blank:not(.blank-cooling):not(.revealed):active {
    background-color: rgba(90, 173, 116, 0.25);
}

/* Cooling state - disabled appearance */
.blank.blank-cooling {
    cursor: not-allowed;
    opacity: 0.5;
    pointer-events: none;
    transition: opacity 0.2s;
}

.blank.blank-cooling::after {
    animation: none;
    opacity: 0.3;
}

/* Revealed state */
.blank.revealed {
    cursor: default;
}

.blank.revealed::after {
    animation: none;
}







mark {
    background: linear-gradient(135deg, var(--accent-200) 0%, var(--accent-100) 100%);
    color: var(--accent-700);
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px dashed var(--accent-400);
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(90, 173, 116, 0.15);
}

.controls {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    flex-shrink: 0;
    padding: 18px clamp(4px, 2vw, 20px) 20px;
    /* 将底部控制区背景不透明度调整为 70% */
    background: linear-gradient(to top, rgba(255, 255, 255, 0.7) 0%, rgba(255, 255, 255, 0.7) 70%, transparent 100%);
    box-shadow: 0 -10px 25px rgba(15, 23, 42, 0.04);
    margin: 0 -20px -20px;
    border-radius: 0;
}



















/* 移动端按钮显示控制（混合检测：宽度 + 触摸设备） */


/* 桌面端隐藏按钮（同时满足：宽屏 + 精确指针） */


/* Browse mode hides non-essential chrome */
.browse-mode .progress-info { display: none !important; }
.browse-mode .controls { display: none !important; }

/* Mode selection overlay */
.mode-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(2px);
}
.mode-card {
    background: #fff;
    border-radius: 16px;
    padding: 24px 20px;
    width: min(720px, 92vw);  /* 增加宽度以容纳 3 列学科卡片 */
    box-shadow: 0 25px 60px rgba(15, 23, 42, 0.22);
    text-align: center;
    box-sizing: border-box;  /* 确保 padding 包含在宽度内 */
    overflow: hidden;  /* 防止内容溢出 */
}
.mode-card h2 { margin-bottom: 8px; }
.mode-card p { color: #475569; margin-bottom: 16px; }
.mode-actions { display: flex; gap: 12px; justify-content: center; }
.mode-actions .btn { padding: 12px 22px; }

/* King mode button styling */
.mode-btn-king {
    background: linear-gradient(135deg, #ffd700 0%, #ffb700 100%);
    color: #8b4513;
    font-weight: 700;
    box-shadow: 0 15px 30px rgba(255, 215, 0, 0.4);
}

.mode-btn-king:hover {
    background: linear-gradient(135deg, #ffed4e 0%, #ffd700 100%);
    transform: translateY(-3px);
    box-shadow: 0 18px 35px rgba(255, 215, 0, 0.5);
}

/* Transcendent mode button styling */
.mode-btn-transcendent {
    background: linear-gradient(135deg, #ff6b6b 0%, #ff8787 100%);
    color: #7f1d1d;
    font-weight: 700;
    box-shadow: 0 15px 30px rgba(255, 107, 107, 0.4);
}

.mode-btn-transcendent:hover {
    background: linear-gradient(135deg, #ff8787 0%, #ffa5a5 100%);
    transform: translateY(-3px);
    box-shadow: 0 18px 35px rgba(255, 107, 107, 0.5);
}

/* Subject selection grid - 智能自适应布局 */
.subject-grid {
    display: grid;
    /* 默认 3 列布局，每列最小 180px，充分利用对话框宽度 */
    grid-template-columns: repeat(3, minmax(180px, 1fr));
    gap: 16px;
    margin-top: 20px;
    width: 100%;
}

/* 中等屏幕：2 列布局 */
@media (max-width: 640px) {
    .subject-grid {
        grid-template-columns: repeat(2, minmax(160px, 1fr));
        gap: 14px;
    }
}

/* 小屏幕：单列布局 */
@media (max-width: 420px) {
    .subject-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

.subject-card {
    position: relative;
    background-image:
        repeating-linear-gradient(0deg,
            transparent,
            transparent 2px,
            rgba(42, 37, 32, 0.008) 2px,
            rgba(42, 37, 32, 0.008) 4px
        ),
        linear-gradient(135deg, rgba(90, 143, 126, 0.08) 0%, rgba(90, 143, 126, 0.02) 100%);
    border: 2px solid rgba(90, 143, 126, 0.2);
    border-radius: 12px;
    padding: 10px 14px;
    cursor: pointer;
    transition: all 0.3s var(--easing-bounce);
    text-align: center;
    min-height: 110px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: visible;
}

/* 书角装饰 */
.subject-card::before {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg,
        transparent 50%,
        var(--primary-300) 50%,
        var(--primary-400) 100%);
    border-radius: 0 12px 0 0;
    opacity: 0.6;
    transition: opacity 0.3s ease;
}

.subject-card:hover {
    transform: translateY(-12px) scale(1.02);
    box-shadow: 0 20px 40px rgba(72, 122, 106, 0.25);
    border-color: var(--primary-500);
    background-image:
        repeating-linear-gradient(0deg,
            transparent,
            transparent 2px,
            rgba(42, 37, 32, 0.008) 2px,
            rgba(42, 37, 32, 0.008) 4px
        ),
        linear-gradient(135deg, rgba(90, 143, 126, 0.15) 0%, rgba(90, 143, 126, 0.05) 100%);
}

.subject-card:hover::before {
    opacity: 0.9;
}

.empty-subject {
    border-style: dashed;
    border-color: rgba(90, 143, 126, 0.35);
    background: rgba(250, 248, 245, 0.65);
    color: var(--neutral-500);
    cursor: not-allowed;
    opacity: 0.85;
    box-shadow: none;
}

.empty-subject::before {
    display: none;
}

.empty-subject:hover {
    transform: none;
    box-shadow: none;
    border-color: rgba(90, 143, 126, 0.35);
    background: rgba(250, 248, 245, 0.55);
}

.empty-subject .subject-icon {
    opacity: 0.7;
}

.subject-empty {
    margin-top: 6px;
    font-style: italic;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.subject-hint {
    margin-bottom: 16px;
    color: var(--text-muted);
    font-size: 0.98rem;
    transition: color 0.3s ease;
}

.subject-hint-warning {
    color: var(--warning-color);
    font-weight: 600;
}

.subject-icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
    line-height: var(--line-height-tight);
}

.subject-name {
    font-weight: 700;
    color: var(--primary-700);
    margin-bottom: 6px;
    font-size: var(--font-size-md);
}

.subject-count {
    font-size: var(--font-size-sm);
    color: var(--neutral-600);
}

/* Book selection list */
.book-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
    /* 移除滚动限制，完整展示所有书籍 */
    overflow-x: hidden;  /* 禁用水平滚动 */
    width: 100%;  /* 确保容器宽度不超出 */
}

.book-item {
    position: relative;
    background: var(--neutral-50);
    border: 2px solid transparent;
    border-radius: 10px;
    padding: 16px 18px 16px 28px;  /* 左侧留出书脊空间 */
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

/* 书脊色块 */
.book-item::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 6px;
    background: var(--primary-500);
    transition: width 0.25s ease, box-shadow 0.25s ease;
}

/* 奇数行 - 墨青色书脊 */
.book-item:nth-child(odd)::before {
    background: linear-gradient(180deg, var(--primary-400) 0%, var(--primary-600) 100%);
}

/* 偶数行 - 竹绿色书脊 */
.book-item:nth-child(even)::before {
    background: linear-gradient(180deg, var(--accent-400) 0%, var(--accent-600) 100%);
}

.book-item:hover {
    background: var(--neutral-100);
    border-color: var(--primary-400);
    transform: translateX(12px);
}

.book-item:hover::before {
    width: 8px;
    box-shadow: 2px 0 8px rgba(72, 122, 106, 0.3);
}

.book-name {
    font-weight: 600;
    color: var(--neutral-800);
    font-size: var(--font-size-md);
}

.book-count {
    font-size: var(--font-size-sm);
    color: var(--neutral-600);
    background: rgba(79, 124, 255, 0.1);
    padding: 4px 12px;
    border-radius: 12px;
}

/* Back button */
.back-btn {
    position: absolute;
    top: 20px;
    left: 20px;
    background: transparent;
    border: none;
    color: var(--neutral-600);
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    padding: 8px 12px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.back-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--primary-600);
    transform: translateX(-2px);
}

.mode-card {
    position: relative;  /* 为返回按钮提供定位上下文 */
}

/* Browse list styling - 移动端优化版 */
.browse-item {
    position: relative;
    padding: 14px 16px 14px 50px;  /* 左侧留出序号空间 */
    margin: 10px 0;
    background: var(--neutral-50);
    border-radius: 10px;
    border: 1px solid rgba(90, 143, 126, 0.12);
    line-height: var(--line-height-relaxed);
    font-size: var(--font-size-lg);
    box-shadow: 0 2px 6px rgba(42, 37, 32, 0.04);
}

/* 斑马纹交替背景 */
.browse-item:nth-child(even) {
    background: rgba(90, 143, 126, 0.03);
}

.browse-index {
    position: absolute;
    left: 12px;
    top: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    background: linear-gradient(135deg, var(--primary-400), var(--primary-600));
    color: #fff;
    font-weight: 700;
    font-size: 0.85rem;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(72, 122, 106, 0.25);
}

/* 答案高亮样式增强 */
.browse-item mark {
    background: linear-gradient(135deg, var(--accent-200), var(--accent-100));
    color: var(--accent-700);
    padding: 2px 6px;
    border-radius: 5px;
    border: 1px dashed var(--accent-400);
    font-weight: 700;
}

.btn {
    position: relative;
    padding: 14px 32px;
    border-radius: 999px;
    border: none;
    font-size: var(--font-size-md);
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    line-height: 1.2;
    min-height: 48px;
    -webkit-text-size-adjust: 100%;
    box-sizing: border-box;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* 光泽效果 */
.btn::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg,
        rgba(255, 255, 255, 0.2) 0%,
        transparent 50%);
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.btn:hover::before {
    opacity: 0.8;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-400) 0%, var(--primary-600) 100%);
    color: #fff;
    box-shadow: 0 15px 30px rgba(72, 122, 106, 0.3);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--accent-400) 0%, var(--accent-600) 100%);
    color: #fff;
    box-shadow: 0 15px 28px rgba(90, 173, 116, 0.32);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.btn:active {
    transform: translateY(0);
    animation: buttonPulse 0.6s ease-out;
}

.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* 按钮脉冲动画 */
@keyframes buttonPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(72, 122, 106, 0.4);
    }
    70% {
        box-shadow: 0 0 0 20px rgba(72, 122, 106, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(72, 122, 106, 0);
    }
}

/* ========================================
   水墨晕染加载动画
   ======================================== */

/* 加载容器 */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(250, 248, 245, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.loading-overlay.active {
    opacity: 1;
    pointer-events: all;
}

/* 双圆环加载器 */
.ink-loading {
    position: relative;
    width: 80px;
    height: 80px;
}

/* 外圆环 - 墨青色 */
.ink-loading::before {
    content: "";
    position: absolute;
    inset: 0;
    border: 4px solid transparent;
    border-top-color: var(--primary-400);
    border-right-color: var(--primary-400);
    border-radius: 50%;
    animation: inkSpin 1.5s cubic-bezier(0.68, -0.55, 0.27, 1.55) infinite;
    filter: blur(1px);
    opacity: 0.8;
}

/* 内圆环 - 竹绿色 */
.ink-loading::after {
    content: "";
    position: absolute;
    inset: 12px;
    border: 4px solid transparent;
    border-bottom-color: var(--accent-400);
    border-left-color: var(--accent-400);
    border-radius: 50%;
    animation: inkSpin 1s cubic-bezier(0.68, -0.55, 0.27, 1.55) infinite reverse;
    filter: blur(0.8px);
    opacity: 0.9;
}

/* 旋转动画 */
@keyframes inkSpin {
    0% {
        transform: rotate(0deg);
        opacity: 0.8;
    }
    50% {
        opacity: 1;
    }
    100% {
        transform: rotate(360deg);
        opacity: 0.8;
    }
}

/* 加载文字 */
.loading-text {
    position: absolute;
    top: calc(50% + 60px);
    left: 50%;
    transform: translateX(-50%);
    font-size: var(--font-size-sm);
    color: var(--neutral-600);
    font-weight: 600;
    letter-spacing: 0.1em;
    animation: loadingFade 2s ease-in-out infinite;
}

@keyframes loadingFade {
    0%, 100% {
        opacity: 0.4;
    }
    50% {
        opacity: 1;
    }
}

/* ========================================
   完成界面动画
   ======================================== */

/* 完成容器 */
.completion-overlay {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg,
        rgba(250, 248, 245, 0.98) 0%,
        rgba(245, 242, 237, 0.98) 100%);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

.completion-overlay.active {
    opacity: 1;
    pointer-events: all;
    animation: fireworks 3s ease-out;
}

/* 烟花背景动画 */
@keyframes fireworks {
    0%, 100% {
        background: linear-gradient(135deg,
            rgba(250, 248, 245, 0.98) 0%,
            rgba(245, 242, 237, 0.98) 100%);
    }
    20% {
        background: radial-gradient(circle at 20% 30%,
            rgba(111, 192, 137, 0.15) 0%,
            transparent 50%),
        linear-gradient(135deg,
            rgba(250, 248, 245, 0.98) 0%,
            rgba(245, 242, 237, 0.98) 100%);
    }
    40% {
        background: radial-gradient(circle at 80% 40%,
            rgba(90, 143, 126, 0.15) 0%,
            transparent 50%),
        linear-gradient(135deg,
            rgba(250, 248, 245, 0.98) 0%,
            rgba(245, 242, 237, 0.98) 100%);
    }
    60% {
        background: radial-gradient(circle at 50% 70%,
            rgba(111, 192, 137, 0.15) 0%,
            transparent 50%),
        linear-gradient(135deg,
            rgba(250, 248, 245, 0.98) 0%,
            rgba(245, 242, 237, 0.98) 100%);
    }
}

/* 完成卡片 */
.completion-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 24px;
    padding: 48px;
    max-width: 500px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(42, 37, 32, 0.15);
    border: 1px solid rgba(212, 205, 192, 0.5);
    animation: cardSlideIn 0.8s var(--easing-bounce);
}

@keyframes cardSlideIn {
    0% {
        opacity: 0;
        transform: translateY(30px) scale(0.9);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* 金色印章图标 */
.completion-icon {
    width: 120px;
    height: 120px;
    margin: 0 auto 24px;
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 60px;
    box-shadow: 0 8px 24px rgba(251, 191, 36, 0.4),
                inset 0 2px 8px rgba(255, 255, 255, 0.3);
    border: 4px solid #fcd34d;
    animation: stampBounce 1s var(--easing-bounce);
    position: relative;
}

/* 印章光晕 */
.completion-icon::before {
    content: "";
    position: absolute;
    inset: -12px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(251, 191, 36, 0.3) 0%, transparent 70%);
    animation: glowPulse 2s ease-in-out infinite;
}

@keyframes stampBounce {
    0% {
        opacity: 0;
        transform: scale(0) rotate(-180deg);
    }
    50% {
        transform: scale(1.2) rotate(10deg);
    }
    70% {
        transform: scale(0.9) rotate(-5deg);
    }
    85% {
        transform: scale(1.05) rotate(2deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

@keyframes glowPulse {
    0%, 100% {
        opacity: 0.5;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.1);
    }
}

/* 完成标题 */
.completion-title {
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: var(--primary-600);
    margin-bottom: 16px;
    animation: titleFadeIn 0.8s ease 0.3s backwards;
}

@keyframes titleFadeIn {
    0% {
        opacity: 0;
        transform: translateY(10px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 完成描述 */
.completion-desc {
    font-size: var(--font-size-md);
    color: var(--neutral-600);
    margin-bottom: 32px;
    line-height: var(--line-height-relaxed);
    animation: titleFadeIn 0.8s ease 0.5s backwards;
}

/* 统计卡片网格 */
.completion-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 32px;
    animation: titleFadeIn 0.8s ease 0.7s backwards;
}

.completion-stat {
    background: linear-gradient(135deg,
        rgba(111, 192, 137, 0.08) 0%,
        rgba(111, 192, 137, 0.03) 100%);
    border: 2px solid var(--accent-300);
    border-radius: 12px;
    padding: 20px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.completion-stat:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(90, 173, 116, 0.2);
}

.completion-stat-value {
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: var(--accent-600);
    margin-bottom: 4px;
}

.completion-stat-label {
    font-size: var(--font-size-sm);
    color: var(--neutral-600);
}

/* 完成按钮 */
.completion-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    animation: titleFadeIn 0.8s ease 0.9s backwards;
}

kbd {
    background: rgba(148, 163, 184, 0.2);
    border: 1px solid rgba(148, 163, 184, 0.5);
    border-radius: 6px;
    padding: 2px 8px;
    font-family: 'Cascadia Code', 'Fira Code', monospace;
    font-size: var(--font-size-sm);
    box-shadow: inset 0 -2px 0 rgba(15, 23, 42, 0.08);
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}

.fade-in {
    animation: fadeInUp 0.45s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(18px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}





/* 书籍列表下的王者模式分隔区 */
.king-mode-section {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid rgba(79, 124, 255, 0.15);
}

.king-divider {
    text-align: center;
    color: var(--neutral-600);
    font-size: var(--font-size-sm);
    margin-bottom: 16px;
    font-weight: 600;
    letter-spacing: 0.1em;
}

.king-mode-section .mode-btn-king {
    width: 100%;  /* 在书籍列表中占满宽度 */
    justify-content: center;
}

.king-mode-section .mode-btn-transcendent {
    width: 100%;
    justify-content: center;
    margin-bottom: 12px;  /* 与王者模式按钮间距 */
}

/* Multi-book selection (Transcendent Mode) */
.book-checkbox-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 20px 0;
    max-height: 400px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 4px;
}

.book-checkbox-item {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    background: #f8f9fa;
    border: 2px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.25s ease;
    width: 100%;
    box-sizing: border-box;
}

.book-checkbox-item:hover {
    background: rgba(255, 107, 107, 0.08);
    border-color: rgba(255, 107, 107, 0.3);
}

.book-checkbox-item.selected {
    background: rgba(255, 107, 107, 0.12);
    border-color: #ff6b6b;
    box-shadow: 0 2px 8px rgba(255, 107, 107, 0.15);
}

.book-checkbox {
    width: 20px;
    height: 20px;
    margin-right: 12px;
    cursor: pointer;
    accent-color: #ff6b6b;
    flex-shrink: 0;
}

.book-checkbox-item .book-name {
    flex: 1;
    font-weight: 600;
    color: var(--neutral-800);
    font-size: var(--font-size-md);
    text-align: left;
}

.book-checkbox-item .book-count {
    font-size: var(--font-size-sm);
    color: var(--neutral-600);
    background: rgba(255, 107, 107, 0.1);
    padding: 4px 12px;
    border-radius: 12px;
    flex-shrink: 0;
}

.selection-summary {
    font-size: var(--font-size-md);
    color: var(--neutral-700);
    text-align: center;
    margin: 16px 0;
    font-weight: 600;
}

.selection-summary span {
    color: #ff6b6b;
    font-weight: 700;
    font-size: 1.1em;
}

.confirm-btn {
    width: 100%;
    background: linear-gradient(135deg, #ff6b6b 0%, #ff8787 100%);
    color: white;
    padding: 14px 24px;
    border-radius: 12px;
    border: none;
    font-size: var(--font-size-md);
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 20px rgba(255, 107, 107, 0.3);
}

.confirm-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #ff8787 0%, #ffa5a5 100%);
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(255, 107, 107, 0.4);
}

.confirm-btn:disabled {
    background: linear-gradient(135deg, #cbd5e1 0%, #94a3b8 100%);
    cursor: not-allowed;
    opacity: 0.6;
    transform: none;
    box-shadow: none;
}

/* ==========================================
   夜间模式样式 (Dark Mode)
   ========================================== */

/* 平滑过渡动画 */
body, .container, .question-content, .btn, .subject-card, .book-item,
.progress-info, .mode-card, .browse-item, .header {
    transition: background 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                color 0.3s ease,
                border-color 0.4s ease,
                box-shadow 0.3s ease;
}

/* 将原 theme-dark.css 合并于此，统一由 base.css 提供 */
html.dark-mode {
    --primary-400: #60a5fa;
    --primary-500: #3b82f6;
    --primary-600: #2563eb;

    --accent-400: #4ade80;
    --accent-500: #22c55e;

    --neutral-50: #1e293b;
    --neutral-100: #334155;
    --neutral-300: #64748b;
    --neutral-600: #cbd5e1;
    --neutral-800: #f1f5f9;

    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;

    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
}

html.dark-mode body {
    background: radial-gradient(circle at top left, rgba(96, 165, 250, 0.15), transparent 55%),
                radial-gradient(circle at bottom right, rgba(74, 222, 128, 0.12), transparent 50%),
                linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: var(--text-primary);
}

html.dark-mode .container {
    background: rgba(30, 41, 59, 0.85);
    border: 1px solid rgba(71, 85, 105, 0.6);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.4);
}

html.dark-mode .header {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.9) 0%, rgba(34, 197, 94, 0.85) 100%);
    color: #fff;
}

html.dark-mode .progress-info {
    background: var(--bg-secondary);
    border: 1px solid var(--neutral-100);
    box-shadow: inset 0 0 0 1px rgba(100, 116, 139, 0.3);
}

html.dark-mode .progress-info span {
    color: var(--text-secondary);
}

html.dark-mode .progress-info span span {
    color: var(--primary-400);
}

html.dark-mode .progress-percentage {
    color: var(--primary-400);
}

html.dark-mode .progress-bar-container {
    background: rgba(96, 165, 250, 0.15);
}

html.dark-mode .progress-bar-fill {
    background: linear-gradient(90deg, var(--primary-400) 0%, var(--primary-600) 100%);
    box-shadow: 0 1px 3px rgba(96, 165, 250, 0.5);
}

html.dark-mode .question-content {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--neutral-100);
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.3);
}

html.dark-mode:not(.browse-mode) body .question-content {
    background: linear-gradient(135deg, rgba(96, 165, 250, 0.12) 0%, rgba(96, 165, 250, 0.04) 100%);
    border-color: rgba(96, 165, 250, 0.25);
    box-shadow: inset 0 1px 0 rgba(148, 163, 184, 0.3);
}

html.dark-mode:not(.browse-mode) body .question-content::after {
    border-color: rgba(96, 165, 250, 0.3);
}

html.dark-mode:not(.browse-mode) body .question-content.revealed {
    background: linear-gradient(135deg, rgba(74, 222, 128, 0.2) 0%, rgba(74, 222, 128, 0.06) 100%);
    border-color: rgba(74, 222, 128, 0.4);
    color: #a7f3d0;
}

html.dark-mode:not(.browse-mode) body .question-content.revealed::after {
    border-color: rgba(74, 222, 128, 0.35);
}

html.dark-mode .blank {
    border-bottom-color: var(--primary-400);
    background: linear-gradient(135deg, rgba(96, 165, 250, 0.25) 0%, rgba(96, 165, 250, 0.12) 100%);
}

html.dark-mode .blank:focus {
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.4);
}

html.dark-mode mark {
    background: linear-gradient(135deg, rgba(74, 222, 128, 0.35) 0%, rgba(74, 222, 128, 0.18) 100%);
    color: #a7f3d0;
}

html.dark-mode .controls {
    background: linear-gradient(to top, rgba(30, 41, 59, 0.7) 0%, rgba(30, 41, 59, 0.7) 70%, transparent 100%);
    box-shadow: 0 -10px 25px rgba(0, 0, 0, 0.15);
}

html.dark-mode .btn-primary {
    background: linear-gradient(135deg, var(--primary-500) 0%, var(--primary-600) 100%);
    box-shadow: 0 15px 30px rgba(59, 130, 246, 0.4);
}

html.dark-mode .btn-secondary {
    background: linear-gradient(135deg, rgba(251, 146, 60, 0.95) 0%, rgba(249, 115, 22, 0.9) 100%);
    color: #fed7aa;
    box-shadow: 0 15px 28px rgba(251, 146, 60, 0.35);
}

html.dark-mode .btn-secondary:hover {
    box-shadow: 0 18px 32px rgba(251, 146, 60, 0.45);
}

html.dark-mode .btn-nav {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    box-shadow: 0 15px 30px rgba(139, 92, 246, 0.4);
}

html.dark-mode .btn-nav:hover:not(:disabled) {
    box-shadow: 0 18px 35px rgba(139, 92, 246, 0.5);
}

html.dark-mode .btn-nav:disabled {
    background: linear-gradient(135deg, #555 0%, #444 100%);
}

html.dark-mode .btn-nav.complete {
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
    box-shadow: 0 15px 30px rgba(16, 185, 129, 0.4);
}

html.dark-mode .btn-nav.complete:hover:not(:disabled) {
    box-shadow: 0 18px 35px rgba(16, 185, 129, 0.5);
}

html.dark-mode .mode-overlay {
    background: rgba(0, 0, 0, 0.6);
}

html.dark-mode .mode-card {
    background: var(--bg-secondary);
    border: 1px solid var(--neutral-100);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5);
}

html.dark-mode .mode-card h2 {
    color: var(--text-primary);
}

html.dark-mode .mode-card p {
    color: var(--text-secondary);
}

html.dark-mode .mode-btn-king {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: #78350f;
    box-shadow: 0 15px 30px rgba(251, 191, 36, 0.5);
}

html.dark-mode .mode-btn-king:hover {
    background: linear-gradient(135deg, #fcd34d 0%, #fbbf24 100%);
    box-shadow: 0 18px 35px rgba(251, 191, 36, 0.6);
}

html.dark-mode .subject-card {
    background: linear-gradient(135deg, rgba(96, 165, 250, 0.12) 0%, rgba(96, 165, 250, 0.04) 100%);
    border: 2px solid rgba(96, 165, 250, 0.3);
}

html.dark-mode .subject-card:hover {
    border-color: var(--primary-500);
    background: linear-gradient(135deg, rgba(96, 165, 250, 0.18) 0%, rgba(96, 165, 250, 0.08) 100%);
    box-shadow: 0 12px 24px rgba(96, 165, 250, 0.3);
}

html.dark-mode .empty-subject {
    border-color: rgba(96, 165, 250, 0.45);
    background: rgba(15, 23, 42, 0.85);
    color: rgba(226, 232, 240, 0.8);
}

html.dark-mode .empty-subject:hover {
    border-color: rgba(96, 165, 250, 0.45);
    background: rgba(15, 23, 42, 0.8);
}

html.dark-mode .empty-subject .subject-icon {
    opacity: 0.85;
}

html.dark-mode .subject-empty {
    color: rgba(226, 232, 240, 0.75);
}

html.dark-mode .subject-hint {
    color: rgba(226, 232, 240, 0.7);
}

html.dark-mode .subject-hint-warning {
    color: #facc15;
}

html.dark-mode .subject-name {
    color: var(--primary-400);
}

html.dark-mode .subject-count {
    color: var(--text-secondary);
}

html.dark-mode .book-item {
    background: var(--bg-tertiary);
    border: 2px solid transparent;
}

html.dark-mode .book-item:hover {
    background: rgba(96, 165, 250, 0.1);
    border-color: var(--primary-400);
}

html.dark-mode .book-name {
    color: var(--text-primary);
}

html.dark-mode .book-count {
    color: var(--text-secondary);
    background: rgba(96, 165, 250, 0.15);
}

html.dark-mode .back-btn {
    color: var(--text-secondary);
}

html.dark-mode .back-btn:hover {
    background: rgba(96, 165, 250, 0.1);
    color: var(--primary-400);
}

html.dark-mode .browse-item {
    background: var(--bg-secondary);
    border: 1px solid rgba(96, 165, 250, 0.18);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

html.dark-mode .browse-item:nth-child(even) {
    background: rgba(96, 165, 250, 0.06);
}


/* === Subject Selection 学科选择 === */










/* === Book Selection 书籍选择 === */










/* === Back Button 返回按钮 === */




/* === Browse List 明牌浏览列表 === */








/* === Instruction 操作说明（已全局隐藏,此处为未来备用） === */


/* === Keyboard Shortcut 键盘快捷键 === */


/* === King Mode Section 王者模式分隔区 === */




/* ==========================================
   主题切换按钮样式 - 右上角极简设计
   ========================================== */

.theme-toggle {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: transparent; /* 默认透明背景 */
    border: none;
    color: rgba(255, 255, 255, 0.9); /* 白色图标，适配渐变背景 */
    font-size: 1.4rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* hover 状态：显示淡色背景 */
.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: scale(1.1);
}

/* active 状态：缩放反馈 */
.theme-toggle:active {
    transform: scale(0.95);
    background: rgba(255, 255, 255, 0.3);
}

/* 夜间模式下的切换按钮样式 */






/* 图标平滑切换动画 */
.theme-icon-light,
.theme-icon-dark,
.theme-icon-auto {
    transition: transform 0.25s ease, opacity 0.25s ease;
}

.theme-toggle:hover .theme-icon-light,
.theme-toggle:hover .theme-icon-dark,
.theme-toggle:hover .theme-icon-auto {
    transform: rotate(15deg) scale(1.1);
}

/* 平板端调整 */


/* 移动端调整 */


/* ============================================
   AI 助记功能样式
   ============================================ */

/* AI 按钮 - 显示在题目下方 */
.ai-memory-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    max-width: 200px;
    margin: 16px auto 0;
    padding: 10px 18px;
    font-size: clamp(13px, 1.5vw, 15px);
    font-weight: 600;
    color: #fff;
    background: linear-gradient(135deg, var(--accent-400) 0%, var(--accent-600) 100%);
    border: 2px solid var(--accent-500);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 4px 12px rgba(90, 173, 116, 0.2);
    z-index: 10;
    opacity: 0;
    animation: fadeInButton 0.4s ease forwards;
}

/* AI 按钮中的镇镇 logo */
.ai-button-logo {
    width: 24px;
    height: 24px;
    object-fit: contain;
    margin-right: -2px;
}

@keyframes fadeInButton {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ai-memory-button:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 20px rgba(90, 173, 116, 0.35);
    background: linear-gradient(135deg, var(--accent-500) 0%, var(--accent-700) 100%);
    border-color: var(--accent-600);
}

.ai-memory-button:active {
    transform: translateY(-1px) scale(1.02);
}

.ai-memory-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* AI 提示容器 - 竹简卷轴效果 */
.ai-tip-container {
    margin-top: 24px;
    padding: 28px clamp(20px, 4vw, 32px);
    background-image:
        repeating-linear-gradient(0deg,
            transparent,
            transparent 2px,
            rgba(42, 37, 32, 0.008) 2px,
            rgba(42, 37, 32, 0.008) 4px
        ),
        linear-gradient(135deg, rgba(111, 192, 137, 0.08) 0%, rgba(111, 192, 137, 0.03) 100%);
    border: 2px solid transparent;
    background-clip: padding-box;
    border-radius: 20px;
    box-shadow: 0 4px 20px rgba(90, 173, 116, 0.12);
    animation: expandContainer 0.3s ease-out;
    position: relative;
    transform: translateZ(0);
    backface-visibility: hidden;
}

@keyframes expandContainer {
    from {
        max-height: 0;
        opacity: 0;
        padding-top: 0;
        padding-bottom: 0;
    }
    to {
        max-height: 1000px;
        opacity: 1;
        padding-top: 28px;
        padding-bottom: 28px;
    }
}

/* 渐变边框 (竹简绿色) */
.ai-tip-container::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 20px;
    padding: 2px;
    background: linear-gradient(135deg,
        var(--accent-500) 0%,
        var(--accent-400) 50%,
        var(--accent-600) 100%);
    -webkit-mask: linear-gradient(#fff 0 0) content-box,
                  linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    z-index: -1;
}

/* 装饰性虚线边框 */
.ai-tip-container::after {
    content: "";
    position: absolute;
    inset: 16px;
    border: 1px dashed var(--accent-300);
    border-radius: 14px;
    opacity: 0.3;
    pointer-events: none;
}

/* AI 提示内容 */
.ai-tip-content {
    position: relative;
    z-index: 1;
    /* 流式渲染优化：减少布局计算 */
    overflow-anchor: auto;
}

/* ai-tip-header、icon、title 组件已移除 */

.ai-tip-text {
    /* 正文字号缩小为题目文本的 80% */
    font-size: calc(var(--font-size-lg) * 0.8);
    line-height: 1.5;
    color: var(--text-primary);
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* ========== Markdown 内容美化样式（iPad 优化） ========== */
/* 统一的排版度量，围绕 iPad 视口做了收紧与对齐 */
.ai-tip-text {
  --md-leading: 1.5;
  --md-space-xs: 0.36em;
  --md-space-sm: 0.56em;
  --md-space-md: 0.80em;
  --md-space-lg: 1.2em;
}

/* h1 - 保留原有下划线设计 */
.ai-tip-text h1 {
  font-size: 1.4em;
  font-weight: 700;
  line-height: 1.2;
  color: var(--primary-600);
  border-bottom: 2px solid var(--primary-300);
  padding-bottom: 0.5em;
  margin: 0.8em 0 0.6em;
}

/* h2 - 大章节卡片化设计（竹简风格） */
.ai-tip-text h2 {
  font-size: 1.25em;
  font-weight: 700;
  line-height: 1.2;
  color: var(--accent-700);
  /* 卡片效果 - 竹绿色 */
  background: linear-gradient(90deg,
      rgba(111, 192, 137, 0.12) 0%,
      rgba(111, 192, 137, 0.03) 100%);
  padding: 0.6em 0.8em;
  margin: 1.2em 0 0.6em;
  border-left: 4px solid var(--accent-500);
  border-radius: 8px;
  transition: all 0.2s ease;
}

/* h2 hover 效果 */
.ai-tip-text h2:hover {
  background: linear-gradient(90deg,
      rgba(111, 192, 137, 0.18) 0%,
      rgba(111, 192, 137, 0.06) 100%);
  transform: translateX(4px);
}

/* h3 - 子章节轻量化设计 */
.ai-tip-text h3 {
  font-size: 1.08em;
  font-weight: 600;
  line-height: 1.3;
  color: var(--accent-600);
  margin: 0.8em 0 0.4em;
  padding-left: 0.5em;
  border-left: 3px solid var(--accent-400);
  transition: color 0.2s ease;
}

.ai-tip-text h3:hover {
  color: var(--accent-700);
}

/* h4 - 保持简洁 */
.ai-tip-text h4 {
  font-size: 0.95em;
  font-weight: 600;
  line-height: 1.4;
  color: var(--neutral-700);
  margin: var(--md-space-sm) 0 var(--md-space-xs);
}

/* 段落 */
.ai-tip-text p {
  margin: var(--md-space-sm) 0;
  line-height: var(--md-leading);
}
.ai-tip-text p:empty { display: none; }
.ai-tip-text p:has(> br:only-child) { display: none; }

/* 列表（紧凑但不拥挤） */
.ai-tip-text ul,
.ai-tip-text ol {
  margin: var(--md-space-sm) 0;
  padding-left: 1.6em;  /* 从 1.4em 增大 */
}

/* 无序列表项 */
.ai-tip-text ul li {
  margin: 0.35em 0;  /* 从 0.3em 增大 */
  line-height: 1.5;  /* 从 1.4 增大 */
  position: relative;
}

/* 自定义 bullet 样式 */
.ai-tip-text ul li::marker {
  color: var(--accent-500);
  font-size: 1.1em;
}

/* 有序列表项 */
.ai-tip-text ol li {
  margin: 0.35em 0;
  line-height: 1.5;
}

.ai-tip-text ol li::marker {
  color: var(--primary-600);
  font-weight: 600;
}

.ai-tip-text li > p { margin: 0; line-height: inherit; }
.ai-tip-text li > p + p { margin-top: 0.25em; }

/* 相邻元素的局部压缩，避免块与块之间出现大空带 */
.ai-tip-text h1 + ul,
.ai-tip-text h2 + ul,
.ai-tip-text h3 + ul,
.ai-tip-text h4 + ul { margin-top: var(--md-space-xs); }
.ai-tip-text ul + h1,
.ai-tip-text ul + h2,
.ai-tip-text ul + h3,
.ai-tip-text ul + h4 { margin-top: var(--md-space-sm); }
.ai-tip-text p + ul,
.ai-tip-text ul + p { margin-top: var(--md-space-xs); }

/* 行内高亮与代码块 */
/* Strong - 添加背景高亮 */
.ai-tip-text strong {
  font-weight: 700;
  color: var(--primary-700);
  background: linear-gradient(180deg,
      transparent 0%,
      transparent 60%,
      rgba(90, 143, 126, 0.2) 60%,
      rgba(90, 143, 126, 0.2) 100%);
  padding: 0 0.15em;
  border-radius: 2px;
}

/* Em - 添加点状下划线 */
.ai-tip-text em {
  font-style: italic;
  color: var(--accent-600);
  border-bottom: 1px dotted var(--accent-400);  /* 点状下划线 */
}

/* Code - 竹简标签风格 */
.ai-tip-text code {
  background: linear-gradient(135deg,
      rgba(111, 192, 137, 0.12) 0%,
      rgba(111, 192, 137, 0.08) 100%);
  color: var(--accent-700);
  padding: 0.2em 0.5em;
  border-radius: 6px;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 0.88em;
  font-weight: 600;
  border: 1px solid var(--accent-300);
  box-shadow: 0 1px 3px rgba(90, 173, 116, 0.1);
  transition: all 0.15s ease;
}

/* Code hover 效果 */
.ai-tip-text code:hover {
  background: linear-gradient(135deg,
      rgba(111, 192, 137, 0.18) 0%,
      rgba(111, 192, 137, 0.12) 100%);
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(90, 173, 116, 0.15);
}
.ai-tip-text pre {
  background: var(--neutral-50);
  border: 1px solid var(--neutral-200);
  border-radius: 10px;
  padding: 0.8em;
  margin: var(--md-space-md) 0;
  overflow-x: auto;
}
.ai-tip-text pre code {
  background: none;
  padding: 0;
  color: var(--neutral-800);
  border: none;
  box-shadow: none;
}

/* 引用与分隔线 */
.ai-tip-text blockquote {
  border-left: 4px solid var(--accent-500);
  background: linear-gradient(90deg,
      rgba(111, 192, 137, 0.08) 0%,
      rgba(111, 192, 137, 0.02) 100%);
  padding: 0.6em 1em;
  margin: var(--md-space-sm) 0;
  color: var(--neutral-700);
  font-style: italic;
  border-radius: 8px;
  position: relative;
}

/* 引用块左上角装饰引号 */
.ai-tip-text blockquote::before {
  content: """;
  position: absolute;
  top: -0.2em;
  left: 0.3em;
  font-size: 2.5em;
  color: var(--accent-400);
  opacity: 0.3;
  font-family: Georgia, serif;
  line-height: 1;
}
.ai-tip-text hr {
  border: none;
  border-top: 2px solid var(--neutral-200);
  margin: var(--md-space-sm) 0;
}

/* 链接 */
.ai-tip-text a { color: var(--primary-500); text-decoration: underline; }
.ai-tip-text a:hover { color: var(--primary-700); }

/* 首末元素去除外边距 */
.ai-tip-text > *:first-child { margin-top: 0; }
.ai-tip-text > *:last-child { margin-bottom: 0; }

/* iPad（横竖屏）微调：收紧行高与间距，确保一屏信息密度 */


/* 加载状态 */
.ai-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 32px 16px;
}

.ai-loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(52, 168, 83, 0.2);
    border-top-color: var(--accent-500);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.ai-loading-text {
    font-size: clamp(14px, 1.5vw, 16px);
    color: var(--text-secondary);
    font-weight: 500;
    animation: pulseFade 1.5s ease-in-out infinite;
}

@keyframes pulseFade {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* 错误状态 */
.ai-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 24px 16px;
    text-align: center;
}

.ai-error-icon {
    font-size: 2.5rem;
}

.ai-error-message {
    font-size: clamp(14px, 1.5vw, 16px);
    color: var(--text-secondary);
    line-height: 1.6;
}

.ai-retry-button {
    margin-top: 8px;
    padding: 10px 24px;
    font-size: clamp(13px, 1.4vw, 15px);
    font-weight: 600;
    color: var(--bg-primary);
    background: linear-gradient(135deg, var(--accent-500), var(--accent-600));
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(52, 168, 83, 0.2);
}

.ai-retry-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(52, 168, 83, 0.3);
}

.ai-retry-button:active {
    transform: translateY(0);
}

/* 夜间模式适配 */






/* 夜间模式渐变边框 */




/* 移除了 ai-tip-header 与 ai-tip-title 的暗色样式 */

/* Markdown 暗色模式样式 */


/* h2 夜间模式卡片效果 */
































/* 移动端适配 */






/* ============================================
   流式渲染动画样式
   ============================================ */

/* 流式渲染光标动画 */
.streaming-cursor {
    display: inline-block;
    width: 2px;
    height: 1em;
    background-color: var(--primary-color);
    margin-left: 2px;
    animation: cursor-blink 1s step-end infinite;
    vertical-align: baseline;
}

@keyframes cursor-blink {
    0%, 50% {
        opacity: 1;
    }
    51%, 100% {
        opacity: 0;
    }
}

/* 流式内容淡入效果 */
.ai-tip-content.streaming .ai-tip-text {
    animation: content-fadein 0.2s ease-in;
}

@keyframes content-fadein {
    from {
        opacity: 0.85;
    }
    to {
        opacity: 1;
    }
}

/* 深色模式适配 */


/* ============================================
   页脚样式 (Site Footer)
   ============================================ */

.site-footer {
    padding: 0 0;
    text-align: center;
    font-size: var(--font-size-sm);
    color: var(--neutral-600);
    background: transparent;
    border-top: none;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    line-height: 1.5;
    margin: 0;
}

.footer-logo {
    height: 30px;
    width: auto;
    vertical-align: middle;
    margin: 0;
    display: inline-block;
}

/* ============================================
   全局滚动条隐藏（允许滚动但不显示滚动条）
   ============================================ */
html, body, .main-content, .question-content {
    /* Firefox */
    scrollbar-width: none;
    /* IE/Edge 旧版 */
    -ms-overflow-style: none;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar,
.main-content::-webkit-scrollbar,
.question-content::-webkit-scrollbar {
    width: 0;
    height: 0;
}

/* 夜间模式适配 */


/* 移动端适配 */




/* ========================================
   搜索容器样式(明牌浏览模式专用)
   ======================================== */

.search-container {
    margin: 48px clamp(4px, 2vw, 36px) 24px;
    padding: 20px 24px;
    background: var(--neutral-50);
    border-radius: 18px;
    border: 1px solid var(--neutral-200);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

/* 搜索输入框包装器 */
.search-input-wrapper {
    position: relative;
    margin-bottom: 12px;
}

/* 搜索输入框 */
.search-input {
    width: 100%;
    padding: 12px 40px 12px 16px;
    font-size: var(--font-size-md);
    border: 2px solid var(--primary-300);
    border-radius: 12px;
    outline: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: #fff;
    color: var(--text-primary);
}

.search-input:focus {
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(79, 124, 255, 0.15);
}

.search-input::placeholder {
    color: var(--neutral-400);
}

/* 清空按钮 */
.search-clear-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    border: none;
    background: var(--neutral-300);
    color: #fff;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-clear-btn:hover {
    background: var(--neutral-500);
    transform: translateY(-50%) scale(1.1);
}

/* 搜索统计 */
.search-stats {
    font-size: var(--font-size-sm);
    color: var(--neutral-600);
    text-align: center;
    font-weight: 500;
}

.search-stats span {
    color: var(--primary-600);
    font-weight: 700;
}

/* 无结果提示 */
.no-results-message {
    margin-top: 16px;
    padding: 12px 16px;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 10px;
    text-align: center;
    color: var(--neutral-700);
    font-size: var(--font-size-sm);
}

.no-results-message #searchKeyword {
    font-weight: 700;
    color: var(--primary-600);
}

/* 关键字高亮 */
.search-highlight {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.5), rgba(255, 215, 0, 0.3));
    color: #8b4513;
    padding: 2px 4px;
    border-radius: 4px;
    font-weight: 700;
    box-shadow: 0 1px 2px rgba(255, 215, 0, 0.3);
}

/* ========================================
   暗黑模式适配
   ======================================== */





















/* ========================================
   移动端响应式优化
   ======================================== */

/* ========================================
   调试信息栏
   ======================================== */

.debug-info-bar {
    display: none;
    background: rgba(0, 0, 0, 0.85);
    color: #00ff00;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    padding: 4px 8px;
    align-items: center;
    gap: 8px;
    backdrop-filter: blur(4px);
    border-top: 1px solid #333;
}

.debug-label {
    color: #ffff00;
    font-weight: bold;
}

.debug-info {
    color: #00ff00;
    opacity: 0.9;
}

/* 暗黑模式下的调试栏 */
[data-theme="dark"] .debug-info-bar {
    background: rgba(20, 20, 20, 0.95);
    border-top: 1px solid #444;
}




/* ==================== 练习统计面板 - Footer 版本 ==================== */

/* Footer 中的统计面板 */
.site-footer .stats-panel {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    font-size: 0.75rem;
    padding: 0.5rem 0;
    margin-left: 1rem;
    flex-wrap: wrap;
}

/* 单个统计项 */
.site-footer .stat-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* 统计标签 */
.site-footer .stat-label {
    color: #666;
    font-weight: 500;
}

/* 统计数值 */
.site-footer .stat-value {
    color: #2196F3;
    font-weight: 700;
    font-size: 0.875rem;
    min-width: 2ch;
    text-align: center;
}

/* ===== 排名显示样式 ===== */

/* 排名数值 */
.site-footer .stat-rank-value {
    transition: color 0.3s ease;
}

/* 排名颜色编码 */
/* Top 30: 金色 (#FFD700) */
.site-footer .stat-rank-value.rank-top-30 {
    color: #FFD700;
    font-weight: 800;
}

/* Top 100: 银色/蓝色 (#64B5F6) */
.site-footer .stat-rank-value.rank-top-100 {
    color: #64B5F6;
    font-weight: 700;
}

/* Top 200: 铜色/绿色 (#66BB6A) */
.site-footer .stat-rank-value.rank-top-200 {
    color: #66BB6A;
    font-weight: 600;
}

/* 其他排名: 灰色 (#999) */
.site-footer .stat-rank-value.rank-other {
    color: #999;
    font-weight: 500;
}

/* 排名不可用（N/A） */
.site-footer .stat-rank-value.rank-na {
    color: #ccc;
    font-style: italic;
}

/* 排名计算中 */
.site-footer .stat-rank-value.rank-loading {
    color: #ffa500;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* 奖牌图标样式 */
.site-footer .rank-medal {
    font-size: 0.9em;
    margin-right: 0.1em;
}

/* 高排名加粗效果 (Top 10%) */
.site-footer .stat-rank-value.rank-high {
    text-shadow: 0 0 2px rgba(255, 215, 0, 0.3);
}

/* 排名 tooltip */
.site-footer .stat-rank {
    position: relative;
    cursor: help;
}

.site-footer .stat-rank .stat-value::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.25rem 0.5rem;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    font-size: 0.75rem;
    white-space: nowrap;
    border-radius: 0.25rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    margin-bottom: 0.25rem;
}

.site-footer .stat-rank:hover .stat-value::after {
    opacity: 1;
}

/* 桌面布局：水平排列在 footer 中 */
@media (min-width: 768px) {
    .site-footer .stats-panel {
        flex-direction: row;
        flex-wrap: nowrap;
    }
}

/* 移动端布局：footer 中换行显示 */
@media (max-width: 767px) {
    .site-footer {
        flex-direction: column;
        align-items: center;
    }
    
    .site-footer .stats-panel {
        margin-left: 0;
        margin-top: 0.5rem;
        width: 100%;
        justify-content: center;
        gap: 0.5rem;
    }
}

/* 加载状态 */
.site-footer #stats-loading {
    color: #999;
    font-style: italic;
    font-size: 0.75rem;
}

/* 错误状态 */
.site-footer #stats-error {
    color: #e74c3c;
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    background: rgba(231, 76, 60, 0.1);
    border-radius: 4px;
}

/* 隐藏统计面板 */
.site-footer .stats-panel[style*="display: none"] {
    display: none !important;
}

/* ========================================
 * 排名功能隐藏 (临时禁用)
 * 恢复排名功能时，删除以下 CSS 规则即可
 * ======================================== */

/* 隐藏排名统计项（今日排名、历史排名） */
.site-footer .stat-item.stat-rank {
    display: none !important;
}

/* 隐藏历史累计总数（配合排名功能显示） */
.site-footer #stats-historical-total {
    display: none !important;
}
