/* ========== 伤寒论398条文学习游戏 ========== */
:root {
    --bg: #fdf6ec;
    --bg2: #faf0e0;
    --card: #fffef9;
    --card2: #f8f1e2;
    --border: #e0d5c1;
    --text: #3b2e1e;
    --text2: #6b5e4e;
    --text3: #9a8c7a;
    --accent: #b85c38;
    --accent2: #8b4513;
    --green: #5a8f5a;
    --red: #c45555;
    --blue: #4a7fb5;
    --gold: #c9a44b;
    --bookmark: #e6a800;
    --bookmark-glow: #f0c040;
    --sidebar-bg: #2c2416;
    --sidebar-text: #d4c9b0;
    --sidebar-active: #b85c38;
    --shadow: 0 2px 12px rgba(0,0,0,0.07);
    --shadow-lg: 0 4px 24px rgba(0,0,0,0.12);
    --radius: 12px;
    --radius-sm: 8px;
    --font-size-browse: 1.1rem;
}

[data-theme="dark"] {
    --bg: #1a1815;
    --bg2: #24211b;
    --card: #2a2620;
    --card2: #302b24;
    --border: #3e372e;
    --text: #e0d7c8;
    --text2: #b8a99a;
    --text3: #8a7b6a;
    --accent: #d48563;
    --accent2: #e0a070;
    --green: #7ab87a;
    --red: #d47575;
    --blue: #6a9fcf;
    --gold: #dbb955;
    --bookmark: #e6a800;
    --bookmark-glow: #f0c040;
    --sidebar-bg: #1a1612;
    --sidebar-text: #c0b598;
    --sidebar-active: #d48563;
    --shadow: 0 2px 12px rgba(0,0,0,0.3);
    --shadow-lg: 0 4px 24px rgba(0,0,0,0.45);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: "Noto Serif SC", "Songti SC", "STSong", serif;
    background: var(--bg);
    color: var(--text);
    display: flex;
    min-height: 100vh;
    line-height: 1.8;
}

/* ========== 侧边栏 ========== */
.sidebar {
    width: 250px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    padding: 24px 0;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    overflow-y: auto;
    box-shadow: 2px 0 20px rgba(0,0,0,0.2);
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: max(40px, env(safe-area-inset-top) + 20px) 20px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 12px;
    text-align: center;
}

.sidebar-header h2 {
    font-size: 1.25rem;
    color: var(--gold);
    font-weight: 700;
    letter-spacing: 0.05em;
}

.sidebar-header .subtitle {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.45);
    margin-top: 2px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 24px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.92rem;
    color: var(--sidebar-text);
    border-left: 3px solid transparent;
    position: relative;
}

.nav-item:hover {
    background: rgba(255,255,255,0.06);
    color: #fff;
}

.nav-item.active {
    background: rgba(184,92,56,0.2);
    color: var(--sidebar-active);
    border-left-color: var(--sidebar-active);
    font-weight: 600;
}

.nav-item .icon { font-size: 1.1rem; width: 24px; text-align: center; }

.nav-divider {
    height: 1px;
    background: rgba(255,255,255,0.08);
    margin: 8px 24px;
}

.nav-section-label {
    padding: 4px 24px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: rgba(255,255,255,0.3);
    margin-top: 4px;
}

.sidebar-footer {
    margin-top: auto;
    padding: 16px 24px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.contact-us-btn {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    color: var(--sidebar-text);
    padding: 10px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
    width: 100%;
    font-weight: 600;
}

.contact-us-btn:hover {
    background: rgba(255,255,255,0.18);
    color: #fff;
    transform: scale(1.03);
}

/* ========== 联系我们弹窗 ========== */
.contact-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}
.contact-modal {
    background: rgba(255,254,249,0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1.5px solid var(--accent);
    border-radius: 16px;
    padding: 36px;
    width: 380px;
    max-width: 92vw;
    box-shadow: 0 8px 40px rgba(0,0,0,0.18), 0 0 0 1px rgba(184,92,56,0.08);
    position: relative;
    font-family: inherit;
    text-align: center;
}
.contact-modal h3 {
    font-size: 24px;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 28px;
    letter-spacing: 0.08em;
}
.contact-modal .contact-item {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px 18px;
    margin-bottom: 12px;
    text-align: left;
    transition: box-shadow 0.2s;
}
.contact-modal .contact-item:hover {
    box-shadow: var(--shadow);
}
.contact-modal .contact-icon {
    font-size: 28px;
    flex-shrink: 0;
    line-height: 1;
}
.contact-modal .contact-info {
    flex: 1;
    min-width: 0;
}
.contact-modal .contact-label {
    font-size: 15px;
    color: var(--text3);
    margin-bottom: 4px;
}
.contact-modal .contact-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
}
.contact-modal .contact-copy-btn {
    flex-shrink: 0;
    background: transparent;
    border: 1px solid var(--accent);
    color: var(--accent);
    padding: 5px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-family: inherit;
    transition: all 0.15s;
    white-space: nowrap;
}
.contact-modal .contact-copy-btn:hover {
    background: var(--accent);
    color: #fff;
}
.contact-modal .contact-copy-btn.copied {
    background: var(--green);
    border-color: var(--green);
    color: #fff;
}
.contact-modal-close {
    position: absolute;
    top: 14px;
    right: 18px;
    background: none;
    border: none;
    font-size: 26px;
    font-weight: 700;
    color: var(--text3);
    cursor: pointer;
    line-height: 1;
    padding: 2px 8px;
    border-radius: 6px;
    transition: all 0.15s;
}
.contact-modal-close:hover {
    color: var(--accent);
    transform: scale(1.15);
}

/* 暗色模式 - 联系我们弹窗 */
[data-theme="dark"] .contact-modal {
    background: rgba(42,38,32,0.94);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}
[data-theme="dark"] .contact-modal .contact-item {
    background: rgba(48,43,36,0.8);
}

/* ========== 主内容区 ========== */
.main {
    margin-left: 250px;
    flex: 1;
    padding: max(28px, env(safe-area-inset-top) + 16px) 36px 28px;
    width: calc(100% - 250px);
}

.section { display: none; }
.section.active { display: block; animation: fadeIn 0.3s ease; }

/* ========== 页面标题 ========== */
.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent);
    text-align: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border);
}

/* ========== 卡片 ========== */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 24px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
    transition: box-shadow 0.2s, transform 0.15s;
}

.card:hover { box-shadow: var(--shadow-lg); }

/* ========== 按钮 ========== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    cursor: pointer;
    font-size: 0.88rem;
    font-family: inherit;
    transition: all 0.15s;
    background: var(--card);
    color: var(--text);
}

.btn:hover {
    background: var(--bg2);
    border-color: var(--accent);
    transform: translateY(-1px);
}

.btn:active { transform: scale(0.97); }

.btn-primary {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.btn-primary:hover {
    background: var(--accent2);
}

.btn-exit-challenge {
    background: transparent;
    color: #b45309;
    border: 1.5px solid #b45309;
    padding: 6px 22px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-family: inherit;
}
.btn-exit-challenge:hover {
    background: #b45309;
    color: #fff;
}

.btn-success {
    background: var(--green);
    color: #fff;
    border-color: var(--green);
}

.btn-sm {
    padding: 5px 12px;
    font-size: 0.8rem;
    border-radius: 6px;
}

.btn-xs {
    padding: 3px 8px;
    font-size: 0.72rem;
    border-radius: 4px;
}

.btn-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-active {
    background: var(--accent) !important;
    color: #fff !important;
    border-color: var(--accent) !important;
}

/* ========== 输入框 ========== */
.input {
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-family: inherit;
    background: var(--card);
    color: var(--text);
    transition: border-color 0.2s;
    width: 100%;
}

.input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(184,92,56,0.1);
}

.select {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-family: inherit;
    background: var(--card);
    color: var(--text);
    cursor: pointer;
}

/* ========== 进度条 ========== */
.progress-bar {
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--green));
    border-radius: 4px;
    transition: width 0.4s ease;
}

/* ========== 条文浏览 ========== */
.browse-controls {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
    align-items: center;
    padding-left: 50px;
}

.browse-controls-row {
    display: flex;
    gap: 10px;
    align-items: center;
    width: calc(100% - 50px);
}

.browse-controls-row .input { flex: 1; min-width: 120px; }
.browse-controls-row .font-size-controls { flex-shrink: 0; }
.browse-controls .select { width: calc(100% - 50px); }
.browse-controls .font-size-controls { flex-shrink: 0; }

.article-card {
    padding: 16px 20px;
    margin-bottom: 8px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: all 0.2s;
    display: flex;
    gap: 12px;
    align-items: flex-start;
    cursor: pointer;
}

.article-card:hover {
    background: var(--bg2);
    border-color: var(--accent);
}

.article-card.learned {
    border-left: 3px solid var(--green);
}

.article-card.highlight {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(184,92,56,0.2);
    animation: pulse-highlight 0.6s ease;
}

.article-num {
    min-width: 44px;
    font-weight: 700;
    color: var(--accent);
    font-size: calc(var(--font-size-browse) * 0.82);
    padding-top: 2px;
}

.article-text {
    flex: 1;
    font-size: var(--font-size-browse);
    line-height: 1.9;
}

.search-highlight {
    background: #FFF176;
    padding: 1px 3px;
    border-radius: 3px;
    color: inherit;
}

.article-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
    opacity: 0.35;
    transition: opacity 0.2s;
}

.article-card:hover .article-actions { opacity: 1; }

.article-actions .btn-xs {
    padding: 3px 8px;
    font-size: 0.72rem;
}

/* 收藏按钮黄色 */
.article-actions .btn-bookmark {
    color: var(--bookmark);
    border-color: transparent;
    background: transparent;
    font-size: 1rem;
    padding: 2px 6px;
    cursor: pointer;
    transition: all 0.15s;
}

.article-actions .btn-bookmark:hover {
    color: var(--bookmark-glow);
    transform: scale(1.15);
}

.article-actions .btn-bookmark.bookmarked {
    color: var(--bookmark);
    text-shadow: 0 0 6px rgba(230,168,0,0.4);
}

.browse-result-count {
    font-size: 0.82rem;
    color: var(--text3);
    margin-bottom: 12px;
    padding: 4px 0;
}

/* ========== 方剂匹配 ========== */
.match-area {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.match-question {
    flex: 1;
    min-width: 280px;
}

.match-options {
    flex: 1;
    min-width: 280px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.match-option {
    padding: 10px 16px;
    background: var(--card);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.92rem;
    transition: all 0.15s;
    user-select: none;
}

.match-option:hover {
    border-color: var(--accent);
    background: var(--bg2);
    transform: translateX(3px);
}

.match-option.correct {
    border-color: var(--green);
    background: rgba(90,143,90,0.15);
    animation: pulse-correct 0.5s ease;
}

.match-option.wrong {
    border-color: var(--red);
    background: rgba(196,85,85,0.15);
    animation: shake 0.5s ease;
}

.match-artext {
    font-size: 1.05rem;
    line-height: 1.9;
    padding: 16px;
    background: var(--card2);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.match-score {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent);
    text-align: center;
    padding: 8px;
}

/* 限时模式 */
.timer-bar {
    height: 6px;
    background: var(--red);
    border-radius: 3px;
    transition: width 0.1s linear;
    margin-bottom: 12px;
}

.timer-bar.warning { background: var(--bookmark); }
.timer-bar.danger { background: var(--red); }

.timer-text {
    text-align: center;
    font-weight: 700;
    font-size: 1.2rem;
    margin-bottom: 8px;
}

.timer-text.urgent {
    color: var(--red);
    animation: pulse-warn 0.5s ease infinite;
}

/* ========== 填空记忆 ========== */
.fill-blank {
    display: inline-block;
    min-width: 80px;
    border-bottom: 2px dashed var(--accent);
    color: var(--accent);
    font-weight: 600;
    padding: 0 4px;
    margin: 0 2px;
    text-align: center;
}

.fill-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.fill-option {
    padding: 10px 16px;
    background: var(--card);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.92rem;
    transition: all 0.15s;
    user-select: none;
}

.fill-option:hover:not(.correct):not(.wrong):not(.disabled) {
    border-color: var(--accent);
    background: var(--bg2);
    transform: translateX(3px);
}

.fill-option.correct {
    border-color: var(--green);
    background: rgba(90,143,90,0.15);
    animation: pulse-correct 0.5s ease;
}

.fill-option.wrong {
    border-color: var(--red);
    background: rgba(196,85,85,0.15);
    animation: shake 0.5s ease;
}

.fill-option.disabled {
    pointer-events: none;
    opacity: 0.7;
}

/* 篇章筛选下拉 */
.chapter-select {
    background: #fdf6ec;
    border: 1.5px solid #8b7355;
    color: #4a3728;
    padding: 6px 12px;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    outline: none;
    transition: border-color 0.15s;
}
.chapter-select:hover { border-color: var(--accent); }
.chapter-select:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(184,92,56,0.15); }
[data-theme="dark"] .chapter-select {
    background: #2a2620;
    border-color: #5a4f3e;
    color: #d4c9b0;
}

.fill-text {
    font-size: 1.05rem;
    line-height: 2;
    margin-bottom: 16px;
    padding: 16px;
    background: var(--card2);
    border-radius: var(--radius-sm);
}

.fill-full-article {
    margin-top: 12px;
    padding: 10px 14px;
    background: rgba(90,143,90,0.08);
    border-left: 3px solid var(--green);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-size: 0.9rem;
    color: var(--text2);
    line-height: 1.8;
}

/* ========== 终极挑战 ========== */
.daily-header {
    text-align: center;
    padding: 20px;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    color: #fff;
    border-radius: var(--radius);
    margin-bottom: 20px;
}

.daily-header h2 {
    font-size: 1.4rem;
    margin-bottom: 4px;
}

.daily-info {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-top: 12px;
    font-size: 0.9rem;
    opacity: 0.9;
}

.daily-progress {
    font-size: 1rem;
    text-align: center;
    margin: 12px 0;
    color: var(--text2);
}

/* 终极挑战结果详情 */
.daily-result-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    margin-bottom: 4px;
    font-size: 0.85rem;
    background: var(--card);
    border: 1px solid var(--border);
}

.daily-result-item.result-correct {
    border-left: 3px solid var(--green);
}

.daily-result-item.result-wrong {
    border-left: 3px solid var(--red);
}

.daily-result-icon { font-size: 1rem; }

/* 倒计时动画 */
.countdown-circle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 3px solid rgba(255,255,255,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: 700;
    margin: 0 auto;
    position: relative;
}

.countdown-circle::before {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    border: 3px solid transparent;
    border-top-color: #fff;
    animation: spin 1s linear;
}

/* ========== 条方对照 ========== */
.ref-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 14px;
}

.ref-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px 18px;
    transition: box-shadow 0.2s, transform 0.2s;
}

.ref-card:hover {
    box-shadow: 0 2px 12px rgba(184,92,56,0.10);
    transform: translateY(-1px);
}

.ref-card-row1 {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 10px;
}

.ref-card-name {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text);
    white-space: nowrap;
}

.ref-card-chapter {
    font-size: 0.72rem;
    color: var(--text3);
    white-space: nowrap;
    text-align: right;
    flex-shrink: 0;
}

.ref-card-row2 {
    background: var(--card2);
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 0.82rem;
    color: var(--text2);
    line-height: 1.55;
    margin-bottom: 10px;
}

.ref-card-row3 {
    font-size: 0.78rem;
}

.ref-card-row3 .fi-article-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.ref-card-row3 .fi-article-tag {
    font-size: 0.7rem;
    padding: 2px 7px;
}

/* ========== 学习进度 ========== */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px;
    text-align: center;
    transition: transform 0.15s;
}

.stat-card:hover { transform: translateY(-2px); }

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent);
    line-height: 1.2;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text3);
    margin-top: 4px;
}

/* 热力图 */
.heatmap-container {
    overflow-x: auto;
    padding: 8px 0;
}

.heatmap-grid {
    display: grid;
    gap: 3px;
}

.heatmap-cell {
    width: 14px;
    height: 14px;
    border-radius: 2px;
    background: var(--border);
    transition: transform 0.2s;
}

.heatmap-cell:hover { transform: scale(1.5); }

.heatmap-cell.l1 { background: rgba(184,92,56,0.2); }
.heatmap-cell.l2 { background: rgba(184,92,56,0.4); }
.heatmap-cell.l3 { background: rgba(184,92,56,0.6); }
.heatmap-cell.l4 { background: rgba(184,92,56,0.8); }
.heatmap-cell.l5 { background: var(--accent); }

/* 学习趋势图 */
.trend-chart {
    width: 100%;
    height: 200px;
    background: var(--card2);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
}

.trend-bar {
    position: absolute;
    bottom: 0;
    background: var(--accent);
    border-radius: 4px 4px 0 0;
    opacity: 0.85;
    transition: height 0.5s ease;
    min-width: 6px;
}

.trend-bar:hover { opacity: 1; filter: brightness(1.1); }

.trend-label {
    font-size: 0.65rem;
    color: var(--text3);
    text-align: center;
}

/* ========== 错题本 ========== */
.wrongbook-controls {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
    flex-wrap: wrap;
    align-items: center;
}

.wrongbook-filter {
    display: flex;
    gap: 6px;
}

.wrong-item {
    padding: 12px 16px;
    position: relative;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    border-left: 3px solid var(--red);
}

.wrong-item-delete {
    position: absolute;
    top: 8px;
    right: 10px;
    width: 24px;
    height: 24px;
    border: none;
    background: rgba(128,128,128,0.12);
    color: #999;
    border-radius: 50%;
    font-size: 0.9rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.wrong-item-delete:hover {
    background: #e74c3c;
    color: #fff;
}

.wrong-item .question {
    font-size: 0.95rem;
    margin-bottom: 4px;
}

.wrong-item .answers {
    font-size: 0.82rem;
    color: var(--text2);
}

.wrong-item .correct-ans {
    color: var(--green);
    font-weight: 600;
}

.wrong-item .user-ans {
    color: var(--red);
    text-decoration: line-through;
    margin-right: 8px;
}

.wrong-item-type {
    display: inline-block;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 10px;
    margin-right: 6px;
    font-weight: 600;
}

.wrong-item-type.match { background: rgba(74,127,181,0.15); color: var(--blue); }
.wrong-item-type.fill { background: rgba(184,92,56,0.15); color: var(--accent); }

.wrong-article-id {
    display: inline-block;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 10px;
    margin-right: 6px;
    font-weight: 600;
    background: rgba(140,111,75,0.12);
    color: #8c6f4b;
}

/* ========== 弹窗 ========== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease;
}

.modal {
    background: var(--card);
    border-radius: var(--radius);
    padding: 28px;
    max-width: 500px;
    width: 90%;
    box-shadow: var(--shadow-lg);
}

.modal h3 {
    font-size: 1.2rem;
    margin-bottom: 12px;
    color: var(--accent);
}

/* ========== Toast ========== */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--sidebar-bg);
    color: #fff;
    padding: 10px 24px;
    border-radius: 20px;
    font-size: 0.88rem;
    z-index: 300;
    animation: fadeIn 0.3s ease;
    box-shadow: var(--shadow-lg);
}

/* ========== 学习计划 ========== */
.plan-goal {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.plan-goal .input {
    width: 80px;
    text-align: center;
}

.plan-today {
    text-align: center;
    padding: 16px;
}

.plan-today .big-num {
    font-size: 3rem;
    font-weight: 700;
    color: var(--accent);
    line-height: 1;
}

.plan-record-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
}

.plan-status {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
}

.plan-status.done {
    background: rgba(90,143,90,0.15);
    color: var(--green);
}

.plan-status.undone {
    background: rgba(196,85,85,0.12);
    color: var(--red);
}

/* ========== 学习计划增强版 ========== */
.plan-card-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.plan-card-grid .card {
    margin-bottom: 0;
}

.plan-card-full {
    grid-column: 1 / -1;
}

/* 连续学习天数 */
.plan-streak {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 8px 0;
}

.plan-streak-num {
    font-size: 3.5rem;
    font-weight: 700;
    color: var(--accent);
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.plan-streak-fire {
    font-size: 2rem;
}

.plan-streak-info {
    color: var(--text2);
    font-size: 0.88rem;
    line-height: 1.6;
}

/* 学习日历简化版 */
.plan-calendar {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.plan-cal-cell.has-learn {
    background: rgba(184,92,56,0.25);
    color: var(--accent);
    font-weight: 700;
}

.plan-cal-cell.has-goal {
    background: var(--accent);
    color: #fff;
    font-weight: 700;
}

.plan-cal-cell.today-cell {
    border: 2px solid #c9a84c;
    font-weight: 700;
    background: #fdf6e3;
    color: #8a6d20;
}
[data-theme="dark"] .plan-cal-cell.today-cell {
    border-color: #b8943a;
    background: rgba(201,168,76,0.15);
    color: #d4b860;
}

.plan-cal-cell:hover { transform: scale(1.15); z-index: 2; }

/* 今日已学条文列表 */
.plan-learned-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
    max-height: 150px;
    overflow-y: auto;
}

.plan-learned-tag {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    background: rgba(184,92,56,0.1);
    color: var(--accent);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    border: 1px solid transparent;
}

.plan-learned-tag:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.plan-learned-empty {
    color: var(--text3);
    font-size: 0.85rem;
    padding: 16px 0;
    text-align: center;
}

/* 目标达成提示 */
.plan-goal-reached {
    text-align: center;
    padding: 12px;
    margin-top: 12px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, rgba(90,143,90,0.15), rgba(201,164,75,0.15));
    color: var(--green);
    font-weight: 700;
    font-size: 0.95rem;
    animation: goalFadeIn 0.5s ease;
}

@keyframes goalFadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.plan-goal-reached .icon { font-size: 1.2rem; }

/* 总学习统计 compact */
.plan-stat-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 8px;
}

.plan-stat-item {
    text-align: center;
    padding: 12px 8px;
    border-radius: var(--radius-sm);
    background: var(--bg2);
}

.plan-stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--accent);
    line-height: 1.2;
}

.plan-stat-label {
    font-size: 0.75rem;
    color: var(--text3);
    margin-top: 4px;
}
/* ========== 字号滑动条 ========== */
.font-size-controls {
    display: flex;
    gap: 8px;
    align-items: center;
    margin: 0 4px;
}
.font-size-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--accent);
    min-width: 10px;
    text-align: center;
}
.font-size-label-lg {
    font-size: 1.1rem;
    font-weight: 700;
}
.font-size-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 80px;
    height: 5px;
    border-radius: 3px;
    background: var(--border);
    outline: none;
    cursor: pointer;
}
.font-size-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid var(--card);
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: transform 0.15s;
}
.font-size-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}
.font-size-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid var(--card);
    box-shadow: var(--shadow);
    cursor: pointer;
}

/* ========== 滚动条 ========== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text3); }

/* ========== 动画 ========== */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes shake {
    0%,100% { transform: translateX(0); }
    20%,60% { transform: translateX(-6px); }
    40%,80% { transform: translateX(6px); }
}
@keyframes pulse-correct {
    0% { transform: scale(1); }
    50% { transform: scale(1.03); }
    100% { transform: scale(1); }
}
@keyframes pulse-warn {
    0%,100% { opacity: 1; }
    50% { opacity: 0.5; }
}
@keyframes pulse-highlight {
    0% { box-shadow: 0 0 0 0 rgba(184,92,56,0.4); }
    100% { box-shadow: 0 0 0 8px rgba(184,92,56,0); }
}
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ========== 终极挑战：准备界面 ========== */
.daily-prep-card {
    text-align: center;
    max-width: 460px;
    margin: 0 auto;
}
.daily-prep-card .prep-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--accent);
    margin-bottom: 6px;
}
.daily-prep-card .prep-subtitle {
    font-size: 0.85rem;
    color: var(--text2);
    margin-bottom: 20px;
}
.prep-stats {
    display: flex;
    gap: 16px;
    justify-content: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
}
.prep-stat {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 20px;
    min-width: 100px;
}
.prep-stat .val {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--accent);
}
.prep-stat .lbl {
    font-size: 0.72rem;
    color: var(--text3);
    margin-top: 2px;
}
.prep-rules {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px 20px;
    margin-bottom: 20px;
    text-align: left;
    font-size: 0.85rem;
    color: var(--text2);
    line-height: 1.8;
}
.prep-rules b { color: var(--accent); }

/* 终极挑战：实时得分 */
.daily-score-live {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 1rem;
    font-weight: 700;
    color: var(--accent);
    margin-left: 10px;
}
.daily-question-feedback {
    text-align: center;
    font-weight: 700;
    font-size: 0.95rem;
    margin-top: 10px;
    min-height: 24px;
}
.daily-question-feedback.correct-fb { color: var(--green); }
.daily-question-feedback.wrong-fb { color: var(--red); }

/* 终极挑战：新纪录徽章 */
.new-record-badge {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 700;
    padding: 4px 14px;
    border-radius: 12px;
    margin-top: 8px;
}

.redo-badge {
    display: inline-block;
    background: linear-gradient(135deg, #e6a800, #d4950a);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 10px;
}

/* ========== 方剂匹配：新组件 ========== */
.match-header-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}
.match-combo {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--accent);
    color: #fff;
    padding: 3px 12px;
    border-radius: 14px;
    font-size: 0.8rem;
    font-weight: 700;
    animation: pulse-highlight 0.5s ease;
}
.match-combo.hidden { display: none; }

#fangjiInfoContainer {
    width: 100%;
    max-width: 100%;
    display: flex;
    justify-content: center;
}

/* 方剂信息卡片（答后展示） */
.fangji-info-card {
    background: var(--card);
    border: 1px solid var(--accent);
    border-radius: var(--radius-sm);
    padding: 14px 18px;
    margin-top: 14px;
    font-size: 0.85rem;
    color: var(--text2);
    line-height: 1.7;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    word-wrap: break-word;
    overflow-wrap: break-word;
}
.fangji-info-card .fi-name {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--accent);
}
.fangji-info-card .fi-label {
    color: var(--text3);
    font-size: 0.75rem;
}
.fi-article-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}
.fi-article-tag {
    display: inline-block;
    background: var(--card);
    border: 1px solid var(--accent);
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s;
    white-space: nowrap;
}
.fi-article-tag:hover {
    background: var(--accent);
    color: #fff;
}

/* 条文弹窗 */
.article-modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5); z-index: 999;
    display: flex; align-items: center; justify-content: center;
    opacity: 0; pointer-events: none; transition: opacity 0.25s;
}
.article-modal-overlay.show { opacity: 1; pointer-events: auto; }
.article-modal {
    background: var(--card); border-radius: 12px;
    max-width: 640px; width: 90%; max-height: 80vh;
    overflow-y: auto; padding: 28px 32px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.3);
    position: relative;
}
.article-modal-close {
    position: absolute; top: 12px; right: 16px;
    background: none; border: none; font-size: 1.4rem;
    color: var(--text3); cursor: pointer; padding: 4px 8px;
}
.article-modal-close:hover { color: var(--text); }
.article-modal-num {
    font-size: 1.3rem; font-weight: 700;
    color: var(--accent); margin-bottom: 16px;
}
.article-modal-text {
    font-size: 1.05rem; line-height: 2;
    color: var(--text); text-align: justify;
}

/* 方剂速查 tooltip */
.fangji-tooltip {
    position: fixed;
    background: var(--sidebar-bg);
    color: #fff;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    line-height: 1.6;
    max-width: 260px;
    z-index: 350;
    box-shadow: var(--shadow-lg);
    pointer-events: none;
}
.fangji-tooltip .ft-name {
    font-weight: 700;
    color: #ffb74d;
    font-size: 0.88rem;
}
.fangji-tooltip .ft-category {
    font-size: 0.7rem;
    opacity: 0.7;
}

/* 限时模式紧迫感增强 */
@keyframes urgent-pulse {
    0%,100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.15); opacity: 0.6; }
}
.timer-text.urgent {
    color: var(--red);
    animation: urgent-pulse 0.4s ease infinite;
    font-size: 1.2rem;
}

/* 填空正确闪烁 */
.fill-blank.flash-correct {
    color: var(--green);
    animation: pulse-correct 0.5s ease;
}
.card.shake-card {
    animation: shake 0.5s ease;
}
.card.flash-correct-card {
    box-shadow: 0 0 16px rgba(76,167,94,0.5);
}

/* ========== 学习计划 v2 ========== */
.plan-goal-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 20px; }
.plan-goal-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.plan-goal-header { font-size: 1.1rem; font-weight: 700; margin-bottom: 4px; color: var(--text); }
.plan-progress-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.plan-progress-header { font-size: 1rem; font-weight: 600; margin-bottom: 8px; color: var(--text); }
.plan-progress-bar { width: 100%; height: 12px; background: var(--bg2); border-radius: 6px; overflow: hidden; margin: 8px 0; }
.plan-progress-fill { height: 100%; border-radius: 6px; transition: width 0.3s ease; }
.plan-progress-fill.done { background: var(--green); }
.plan-progress-fill.ongoing { background: var(--accent); }
.plan-progress-text { font-size: 0.85rem; color: var(--text2); }
.plan-done-msg { color: var(--green); font-weight: 600; font-size: 0.9rem; margin-top: 4px; }
.plan-section-card { margin-top: 20px; }
.plan-section-card h3 { font-size: 1.1rem; font-weight: 700; color: var(--text); }

.plan-stats-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 20px; }

/* 计划页进度卡片增强 */
.plan-progress-header { font-size: 1.05rem; font-weight: 700; color: var(--text); }
.plan-progress-text { font-size: 0.9rem; color: var(--text2); margin-bottom: 2px; }
.plan-progress-text strong { color: var(--accent); font-size: 1.1rem; }

/* 自定义确认对话框 */
.custom-confirm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}
.custom-confirm-overlay.show {
    opacity: 1;
    pointer-events: auto;
}
.custom-confirm-box {
    background: var(--card);
    border-radius: 16px;
    padding: 24px 28px;
    max-width: 320px;
    width: 85%;
    box-shadow: 0 8px 32px rgba(0,0,0,0.25);
    text-align: center;
}
.custom-confirm-message {
    font-size: 1rem;
    color: var(--text);
    line-height: 1.6;
    margin-bottom: 20px;
}
.custom-confirm-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}
.custom-confirm-btn {
    padding: 10px 24px;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.15s;
}
.custom-confirm-btn.cancel {
    background: var(--bg2);
    color: var(--text2);
}
.custom-confirm-btn.cancel:hover {
    background: var(--border);
}
.custom-confirm-btn.ok {
    background: var(--accent);
    color: #fff;
}
.custom-confirm-btn.ok:hover {
    filter: brightness(1.1);
}

/* 日历格尺寸 */
.plan-cal-cell {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    color: var(--text3);
    background: var(--bg2);
    cursor: default;
    transition: all 0.15s;
    flex-shrink: 0;
}

/* 迷你进度条（匹配/填空页面） */
.mini-progress-row { display: flex; align-items: center; gap: 12px; font-size: 0.82rem; color: var(--text2); margin-bottom: 8px; padding: 10px 14px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow); }
.mini-progress-row span:first-child { font-weight: 600; color: var(--text); white-space: nowrap; }
.mini-progress-row span:first-child strong { color: var(--accent); font-size: 1.05rem; }
.mini-progress-bar { flex: 1; height: 10px; background: var(--bg2); border-radius: 5px; overflow: hidden; }
.mini-progress-fill { height: 100%; border-radius: 5px; transition: width 0.3s ease; }
.mini-progress-fill.done { background: var(--green); }
.mini-progress-fill.ongoing { background: var(--accent); }

/* ========== 响应式 ========== */
/* ========== 响应式增强 ========== */
/* 平板横屏 (769-1024px)：中等布局 */
@media (min-width: 769px) and (max-width: 1024px) {
    .main { padding: 20px 24px; }
    .page-title { font-size: 1.4rem; }
    .card { padding: 16px 20px; }
    .plan-goal-row { gap: 12px; }
    .plan-goal-card { padding: 16px; }
    .plan-progress-card { padding: 16px; }
    .plan-goal-header { font-size: 1rem; }
    .ref-card-grid { grid-template-columns: repeat(2, 1fr); }
    .match-area { gap: 14px; }
    .match-option, .fill-option { padding: 9px 14px; font-size: 0.88rem; }
    .match-artext, .fill-text { padding: 14px; font-size: 1rem; }
    .plan-cal-cell { width: 32px; height: 32px; font-size: 0.68rem; }
    .plan-stat-grid { gap: 10px; }
    .plan-stat-value { font-size: 1.5rem; }
}

/* 手机 (< 768px)：侧边栏折叠 + 单列布局 */
@media (max-width: 768px) {
    .fangji-info-card {
        padding: 12px 14px;
        font-size: 0.8rem;
        margin-top: 12px;
    }
    .fangji-info-card .fi-name {
        font-size: 0.95rem;
    }
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main {
        margin-left: 0;
        width: 100%;
        padding: max(16px, env(safe-area-inset-top) + 8px) 16px 16px;
    }
    .hamburger {
        display: flex !important;
    }
    .page-title { font-size: 1.3rem; margin-bottom: 14px; padding-bottom: 8px; }
    .card { padding: 14px 16px; margin-bottom: 12px; }
    .btn { padding: 7px 14px; font-size: 0.85rem; }
    .btn-sm { padding: 5px 10px; font-size: 0.78rem; }

    /* 方剂匹配 */
    .match-area {
        flex-direction: column;
        gap: 12px;
    }
    .match-option, .fill-option {
        padding: 12px 16px;
        min-height: 44px;
        font-size: 0.9rem;
        display: flex;
        align-items: center;
    }
    .match-artext, .fill-text { padding: 12px 14px; font-size: 0.95rem; }
    .match-question, .match-options { min-width: 0; }
    .match-header-row { flex-wrap: wrap; gap: 8px; }

    /* 填空记忆 */
    .fill-options { gap: 6px; }
    .fill-blank { min-width: 60px; }
    .fill-full-article { padding: 8px 12px; font-size: 0.85rem; }

    /* 条方对照 */
    .ref-card-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    .ref-card { padding: 12px 14px; }
    .ref-card-name { font-size: 0.95rem; }
    .ref-card-row2 { font-size: 0.78rem; padding: 6px 10px; }
    .ref-card-row3 { font-size: 0.72rem; }
    .reference-table { font-size: 0.78rem; }
    .reference-table td, .reference-table th { padding: 6px 8px; }

    /* 学习计划 */
    .plan-goal-row { grid-template-columns: 1fr; gap: 12px; }
    .plan-goal-card { padding: 14px; }
    .plan-progress-card { padding: 14px; }
    .plan-goal-header { font-size: 1rem; }
    .plan-progress-header { font-size: 0.95rem; }
    .plan-progress-bar { height: 10px; }
    .plan-done-msg { font-size: 0.85rem; }
    .mini-progress-row { padding: 6px 10px; font-size: 0.8rem; gap: 8px; }
    .mini-progress-bar { height: 6px; }
    .plan-cal-cell { width: 28px; height: 28px; font-size: 0.62rem; border-radius: 4px; }
    .plan-stat-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .plan-stat-item { padding: 10px 6px; }
    .plan-stat-value { font-size: 1.4rem; }
    .plan-calendar { gap: 3px; }

    /* 浏览页 */
    .browse-controls { flex-direction: column; gap: 6px; padding-left: 50px; margin-bottom: 8px; }
    .browse-controls-row { display: flex; gap: 10px; align-items: center; width: calc(100% - 50px); }
    .browse-controls-row .input { flex: 1; min-width: 100px; }
    .browse-controls-row .font-size-controls { flex-shrink: 0; }
    .browse-controls .select { width: calc(100% - 50px); }
    .article-card { padding: 12px 14px; gap: 8px; }
    .article-num { min-width: 36px; }

    /* 统计卡片 */
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .stat-card { padding: 12px; }
    .stat-value { font-size: 1.5rem; }

    /* 按钮组 */
    .btn-group { gap: 6px; }
    .btn-group .btn { font-size: 0.8rem; padding: 6px 10px; }
    .chapter-select { padding: 5px 10px; font-size: 0.82rem; }
}

/* 小屏手机 (< 480px)：极致紧凑 */
@media (max-width: 480px) {
    .main { padding: max(10px, env(safe-area-inset-top) + 6px) 10px 10px; }
    .page-title { font-size: 1.2rem; margin-bottom: 10px; }
    .card { padding: 10px 12px; margin-bottom: 8px; }
    .btn { padding: 6px 12px; font-size: 0.82rem; }
    .btn-sm { padding: 4px 8px; font-size: 0.75rem; }
    .btn-group { gap: 4px; }
    .btn-group .btn { padding: 5px 8px; font-size: 0.78rem; }

    /* 匹配 */
    .match-option, .fill-option { padding: 10px 12px; font-size: 0.85rem; min-height: 42px; }
    .match-artext, .fill-text { padding: 10px 12px; font-size: 0.9rem; line-height: 1.7; }
    .mini-progress-row { padding: 5px 8px; font-size: 0.75rem; gap: 6px; flex-wrap: wrap; }

    /* 学习计划 */
    .plan-goal-card { padding: 10px 12px; }
    .plan-progress-card { padding: 10px 12px; }
    .plan-progress-header { font-size: 0.88rem; }
    .plan-progress-bar { height: 8px; }
    .plan-goal-row { gap: 8px; }
    .plan-cal-cell { width: 24px; height: 24px; font-size: 0.58rem; }
    .plan-stat-grid { grid-template-columns: repeat(2, 1fr); gap: 6px; }
    .plan-stat-value { font-size: 1.2rem; }
    .plan-stat-label { font-size: 0.68rem; }

    /* 浏览 */
    .browse-controls { flex-direction: column; gap: 6px; padding-left: 50px; margin-bottom: 8px; }
    .browse-controls-row { display: flex; gap: 8px; align-items: center; width: calc(100% - 50px); }
    .browse-controls-row .input { flex: 1; min-width: 80px; }
    .browse-controls-row .font-size-controls { flex-shrink: 0; }
    .browse-controls .select { width: calc(100% - 50px); }
    .article-card { padding: 10px 12px; }
    .article-num { min-width: 32px; }

    /* 卡片 */
    .stat-grid { grid-template-columns: 1fr 1fr; }
    .stat-card { padding: 10px; }
    .stat-value { font-size: 1.3rem; }

    /* 条方 */
    .ref-card { padding: 10px 12px; }
    .ref-card-name { font-size: 0.88rem; }
    .ref-card-row2 { font-size: 0.74rem; padding: 5px 8px; }
}

.hamburger {
    display: none;
    position: fixed;
    top: max(12px, env(safe-area-inset-top) + 12px);
    left: 12px;
    z-index: 150;
    background: var(--accent);
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: none;
    font-size: 1.2rem;
    box-shadow: var(--shadow);
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 99;
}

.sidebar-backdrop.open { display: block; }

/* 打印样式 */
@media print {
    .sidebar, .hamburger, .sidebar-backdrop, .btn, .browse-controls, .nav-item { display: none !important; }
    .main { margin-left: 0 !important; width: 100% !important; padding: 0 !important; }
    body { background: #fff; color: #000; }
    .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
}