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

:root {
    --cn-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 20px 90px 20px;
}

.flashcard-container {
    width: 100%;
    max-width: 600px;
    perspective: 1000px;
    margin-top: 0;
}

.flashcard {
    position: relative;
    width: 100%;
    height: 450px;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

@media (min-height: 700px) {
    .flashcard { height: 550px; }
}

@media (min-height: 800px) {
    .flashcard { height: 650px; }
}

.flashcard.flipped { transform: rotateY(180deg); }

.flashcard-front, .flashcard-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    background: white;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.flashcard-front {
    justify-content: space-between;
    padding-top: 60px;
    padding-bottom: 60px;
}

.flashcard-front > div:first-child {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.flashcard-back { transform: rotateY(180deg); }

.flashcard-point {
    font-size: 1.8em;
    font-weight: bold;
    color: #0078d4;
    margin-bottom: 20px;
    text-align: center;
}

.flashcard-sentence {
    font-size: 1.5em;
    line-height: 1.8;
    color: #333;
    text-align: center;
    margin-bottom: 20px;
}

.flashcard-full {
    font-size: 1.2em;
    line-height: 2.2;
    color: #333;
    flex: 1;
    overflow-y: auto;
}

.flashcard-full p { margin: 15px 0; }

.flashcard-full div[onclick] {
    transition: all 0.2s;
    border: 1px solid transparent;
}

.flashcard-full div[onclick]:hover {
    background: #e3f2fd !important;
    border-color: #0078d4;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,120,212,0.2);
}

.flashcard-full div[onclick]:active {
    transform: translateY(0);
    background: #bbdefb !important;
}

.flashcard-controls, .flashcard-actions {
    display: flex;
    gap: 10px;
}

/* 合并播放和错题按钮到一行 */
.flashcard-back .flashcard-controls {
    display: none; /* 隐藏原播放按钮区域 */
}

.flashcard-back .flashcard-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.control-btn, .action-btn {
    flex: 1;
    padding: 12px;
    font-size: 1em;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    background: #f0f0f0;
}

.control-btn:hover, .action-btn:hover { background: #e0e0e0; transform: translateY(-2px); }
.control-btn:active, .action-btn:active { transform: translateY(0); opacity: 0.8; }
.flip-btn { background: #0078d4; color: white; }
.flip-btn:hover { background: #005a9c; }
.action-btn { background: #ff6b6b; color: white; }
.action-btn:hover { background: #ff5252; }

/* 左手优化：评分按钮布局 */
.flashcard-ratings {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr;
    grid-template-rows: auto auto;
    gap: 10px;
    margin-top: 15px;
}

.rating-btn {
    padding: 12px;
    font-size: 0.95em;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    color: white;
    min-height: 52px;
    font-weight: 600;
}

.rating-btn.easy { 
    background: #28a745;
    grid-column: 1;
    grid-row: 1;
}
.rating-btn.good { 
    background: #17a2b8;
    grid-column: 2;
    grid-row: 1;
}
.rating-btn.hard { 
    background: #ffc107;
    color: #333;
    grid-column: 3;
    grid-row: 1;
}
.rating-btn.again { 
    background: #dc3545;
    grid-column: 1 / -1;
    grid-row: 2;
}
.rating-btn:active { transform: scale(0.97); opacity: 0.8; }

.flashcard-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    gap: 15px;
}

.nav-btn {
    padding: 12px 24px;
    font-size: 1em;
    border: none;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.nav-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,0.15); }
.nav-btn:active { transform: translateY(0); opacity: 0.8; }
.nav-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.flashcard-counter {
    font-size: 1.1em;
    color: white;
    font-weight: bold;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.flashcard-progress {
    margin-top: 15px;
    height: 8px;
    background: rgba(255,255,255,0.3);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: white;
    transition: width 0.3s;
    box-shadow: 0 0 10px rgba(255,255,255,0.5);
}

rt {
    font-size: 0.65em;
    color: #d9534f;
    font-weight: bold;
}

/* 压缩的顶部标题栏 */
.compact-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 50px;
    background: rgba(102, 126, 234, 0.95);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 70px 0 80px;
    z-index: 99;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.header-content {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.chapter-num {
    color: rgba(255,255,255,0.8);
    font-size: 0.85em;
    white-space: nowrap;
    flex-shrink: 0;
}

.title-scroll-container {
    flex: 1;
    overflow: hidden;
    position: relative;
    height: 24px;
    min-width: 0;
}

.title-scroll {
    color: white;
    font-weight: bold;
    font-size: 1em;
    white-space: nowrap;
    display: inline-block;
    animation: scrollTitle 10s linear infinite;
    padding-right: 50px;
}

.title-scroll.no-scroll {
    animation: none;
    padding-right: 0;
}

@keyframes scrollTitle {
    0% { transform: translateX(0); }
    100% { transform: translateX(-100%); }
}

.mode-badge {
    display: none;
    background: #ff6b6b;
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.8em;
    white-space: nowrap;
    flex-shrink: 0;
}

.mode-badge.show {
    display: block;
}

/* 底部工具栏 */
.bottom-toolbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 70px;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 0 max(20px, env(safe-area-inset-left)) max(10px, env(safe-area-inset-bottom));
    gap: 12px;
    z-index: 99;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.1);
}

.toolbar-btn {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    border: none;
    font-size: 1.4em;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    background: white;
}

.toolbar-btn:active {
    transform: scale(0.95);
    opacity: 0.7;
}

.toolbar-btn.mistakes-btn {
    width: auto;
    min-width: 54px;
    padding: 0 16px;
    border-radius: 27px;
    font-size: 1em;
    background: #ff6b6b;
    color: white;
}

#mistake-badge {
    background: white;
    color: #ff6b6b;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.85em;
    font-weight: bold;
    margin-left: 6px;
}

/* 顶部按钮（仅返回和目录）*/
.top-btn {
    position: fixed;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    color: white;
    font-size: 1.3em;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    z-index: 100;
    transition: all 0.2s;
    background: #6c757d;
}

.top-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,0.3); }
.top-btn:active { transform: translateY(0) scale(0.95); opacity: 0.8; }

.top-btn[onclick*="backToChapters"] {
    top: max(15px, env(safe-area-inset-top));
    right: max(15px, env(safe-area-inset-right));
}

.toc-btn { 
    top: max(15px, env(safe-area-inset-top));
    left: max(15px, env(safe-area-inset-left)); 
    background: #0078d4;
}

/* 面板基础样式 */
.panel {
    display: none;
    position: fixed;
    background: white;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.2);
    z-index: 200;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.panel.open { display: block; }

/* 侧边面板（目录）*/
.side-panel {
    top: max(60px, calc(50px + env(safe-area-inset-top)));
    left: max(15px, env(safe-area-inset-left));
    width: min(320px, 85vw);
    max-height: calc(100vh - 150px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    border-radius: 12px;
    padding: 20px;
    overflow-y: auto;
    transform: translateX(-350px);
}

.side-panel.open {
    transform: translateX(0);
}

.side-panel h3 {
    position: sticky;
    top: -20px;
    background: white;
    z-index: 10;
    margin: -20px -20px 15px -20px;
    padding: 20px 20px 10px;
}

/* 底部抽屉面板 */
.bottom-sheet {
    bottom: 0;
    left: 0;
    right: 0;
    height: 70vh;
    max-height: 70vh;
    border-radius: 20px 20px 0 0;
    padding: 0;
    transform: translateY(100%);
    display: flex;
    flex-direction: column;
}

.bottom-sheet.open {
    transform: translateY(0);
}

/* 底部抽屉拖动指示器 */
.bottom-sheet::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 4px;
    background: #ddd;
    border-radius: 2px;
    z-index: 1;
}

/* 底部抽屉固定标题 */
.bottom-sheet h3 {
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
    margin: 0;
    padding: 20px 20px 15px;
    border-bottom: 2px solid #0078d4;
    flex-shrink: 0;
}

/* 底部抽屉滚动容器 */
.bottom-sheet-content {
    flex: 1;
    overflow-y: scroll;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding: 15px 20px;
    padding-bottom: max(20px, env(safe-area-inset-bottom));
    min-height: 0;
    max-height: 100%;
}

.bottom-sheet-content h4 {
    margin: 15px 0 10px 0;
}

.bottom-sheet-content h4:first-child {
    margin-top: 0;
}

.panel h3 {
    margin: 0 0 15px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #0078d4;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #0078d4;
}

.panel h4 {
    margin: 15px 0 10px 0;
    font-size: 0.9em;
    color: #666;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 5px;
}

.close-btn {
    background: #f0f0f0;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.5em;
    line-height: 1;
    transition: background 0.2s;
}

.close-btn:hover { background: #e0e0e0; }
.close-btn:active { transform: scale(0.95); opacity: 0.8; }

.toc-item {
    padding: 12px;
    margin: 5px 0;
    background: #f8f9fa;
    border-left: 3px solid #0078d4;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.2s;
}

.toc-item:hover { background: #e9ecef; }

.toc-item.active {
    background: #0078d4;
    color: white;
    font-weight: bold;
}

.control-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 10px 0;
}

.control-row label {
    font-size: 0.9em;
    color: #333;
}

.adjuster {
    display: flex;
    gap: 8px;
    align-items: center;
}

.adjuster button {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 4px;
    background: #0078d4;
    color: white;
    cursor: pointer;
    font-size: 1em;
    transition: background 0.2s;
}

.adjuster button:hover { background: #005a9c; }
.adjuster button:active { transform: scale(0.95); opacity: 0.8; }

.adjuster span {
    min-width: 50px;
    text-align: center;
    font-weight: bold;
}

.progress-bar-container {
    width: 100%;
    height: 24px;
    background: #e9ecef;
    border-radius: 12px;
    overflow: hidden;
    margin: 10px 0;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #51cf66, #40c057);
    transition: width 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.8em;
    font-weight: bold;
}

.progress-text {
    font-size: 0.85em;
    color: #666;
    margin-bottom: 10px;
}

.cache-status {
    font-size: 0.85em;
    color: #666;
    margin: 10px 0;
}

.cache-progress-container {
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 10px;
}

.cache-progress-bar {
    height: 100%;
    background: #0078d4;
    width: 0%;
    transition: width 0.3s;
}

.cache-btn {
    width: 100%;
    padding: 10px;
    background: #17a2b8;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background 0.2s;
}

.cache-btn:hover { background: #138496; }
.cache-btn:active { transform: scale(0.98); opacity: 0.8; }

.mistake-item {
    padding: 10px;
    margin: 5px 0;
    background: #fff5f5;
    border-left: 3px solid #ff6b6b;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 0.9em;
}

.mistake-item:hover { background: #ffe0e0; }

.review-mistakes-btn, .clear-mistakes-btn {
    width: 100%;
    padding: 10px;
    margin: 5px 0;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background 0.2s;
}

.review-mistakes-btn {
    background: #28a745;
    color: white;
}

.review-mistakes-btn:hover { background: #218838; }
.review-mistakes-btn:active { transform: scale(0.98); opacity: 0.8; }

.clear-mistakes-btn {
    background: #6c757d;
    color: white;
}

.clear-mistakes-btn:hover { background: #5a6268; }
.clear-mistakes-btn:active { transform: scale(0.98); opacity: 0.8; }

.stat-card {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
    margin: 10px 0;
    border-left: 4px solid #28a745;
}

.stat-card.today { border-left-color: #0078d4; }
.stat-card.review { border-left-color: #ffc107; }
.stat-card.mastered { border-left-color: #28a745; }

.stat-title {
    font-size: 0.85em;
    color: #666;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 2em;
    font-weight: bold;
    color: #333;
}

.stat-detail {
    font-size: 0.8em;
    color: #999;
    margin-top: 5px;
}

.retention-bar {
    width: 100%;
    height: 12px;
    background: #e9ecef;
    border-radius: 6px;
    overflow: hidden;
    margin: 10px 0;
}

.retention-fill {
    height: 100%;
    background: linear-gradient(90deg, #51cf66, #40c057);
    transition: width 0.3s;
}

/* 缓存进度浮动提示 */
.cache-toast {
    position: fixed;
    bottom: max(80px, calc(70px + env(safe-area-inset-bottom)));
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 120, 212, 0.95);
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    z-index: 10000;
    display: none;
    align-items: center;
    gap: 10px;
    min-width: 200px;
    max-width: calc(100vw - 40px);
    animation: slideUp 0.3s ease-out;
}

.cache-toast.show { display: flex; }
.cache-toast.success { background: rgba(40, 167, 69, 0.95); }

.cache-toast-text {
    flex: 1;
    font-size: 0.9em;
}

.cache-toast-progress {
    width: 100%;
    height: 4px;
    background: rgba(255,255,255,0.3);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 6px;
}

.cache-toast-progress-bar {
    height: 100%;
    background: white;
    width: 0%;
    transition: width 0.3s;
}

@keyframes slideUp {
    from { bottom: 60px; opacity: 0; }
    to { bottom: 80px; opacity: 1; }
}

/* 移动端优化 */
@media (max-width: 768px) {
    body { 
        padding: 50px 10px 120px 10px;
    }
    
    .flashcard-container {
        margin-bottom: 0;
    }
    
    .flashcard { height: 465px; }
    
    .flashcard-front, .flashcard-back { padding: 25px; }
    .flashcard-full { font-size: 1em; }
    
    .flashcard-nav {
        margin-top: 5px;
        gap: 12px;
    }
    
    .flashcard-progress {
        margin-top: 5px;
        height: 6px;
    }
    
    .compact-header {
        padding: 0 70px 0 70px;
    }
    
    .bottom-toolbar {
        height: 65px;
        gap: 10px;
    }
    
    .toolbar-btn {
        width: 50px;
        height: 50px;
        font-size: 1.3em;
    }
    
    .toolbar-btn.mistakes-btn {
        min-width: 50px;
        padding: 0 14px;
        font-size: 0.95em;
    }
    
    .top-btn {
        width: 46px;
        height: 46px;
        font-size: 1.2em;
    }
    
    .top-btn[onclick*="backToChapters"] {
        top: max(12px, env(safe-area-inset-top));
        right: max(12px, env(safe-area-inset-right));
    }
    
    .toc-btn {
        top: max(12px, env(safe-area-inset-top));
        left: max(12px, env(safe-area-inset-left));
    }
    
    .side-panel {
        width: min(320px, 85vw);
        left: max(15px, env(safe-area-inset-left));
        max-height: calc(100vh - 130px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    }
    
    .rating-btn {
        min-height: 54px;
        font-size: 1em;
    }
}

/* 超小屏幕优化 */
@media (max-width: 380px) {
    .compact-header {
        padding: 0 60px 0 60px;
        font-size: 0.95em;
    }
    
    .toolbar-btn {
        width: 46px;
        height: 46px;
    }
    
    .toolbar-btn.mistakes-btn {
        min-width: 46px;
        padding: 0 12px;
        font-size: 0.9em;
    }
}

/* iPhone SE3/8 小屏幕优化 (375x667) - 方案B温和优化 */
@media (max-width: 375px) and (max-height: 667px) {
    body { 
        padding: 45px 10px 128px 10px !important;
    }
    
    .flashcard-container {
        margin-bottom: 0;
    }
    
    .flashcard { height: 460px !important; }
    .flashcard-front, .flashcard-back { padding: 18px !important; }
    .flashcard-sentence { padding: 12px !important; }
    .flashcard-full { font-size: 0.88em !important; line-height: 1.9 !important; }
    
    .flashcard-actions { margin-top: 8px !important; gap: 5px !important; }
    .flashcard-ratings { margin-top: 7px !important; gap: 5px !important; }
    
    .control-btn, .action-btn { padding: 8px !important; font-size: 0.85em !important; }
    .rating-btn { padding: 8px !important; font-size: 0.85em !important; min-height: 42px !important; }
    
    .flashcard-nav {
        margin-top: 3px !important;
        gap: 10px !important;
    }
    
    .nav-btn {
        padding: 9px 16px !important;
        font-size: 0.9em !important;
    }
    
    .flashcard-counter {
        font-size: 0.95em !important;
    }
    
    .flashcard-progress {
        margin-top: 3px !important;
        height: 6px !important;
    }
    
    .compact-header {
        height: 42px;
        font-size: 0.88em;
    }
    
    .bottom-toolbar {
        height: 58px;
    }
}

/* iPhone X/XS/11 Pro 优化 (375x812) */
@media (min-width: 375px) and (max-width: 375px) and (min-height: 812px) and (max-height: 812px) {
    body { 
        padding: 50px 10px 125px 10px !important;
    }
    
    .flashcard { height: 580px !important; }
    .flashcard-front, .flashcard-back { padding: 22px !important; }
    .flashcard-full { font-size: 0.95em !important; }
    
    .flashcard-actions { margin-top: 10px !important; gap: 8px !important; }
    .flashcard-ratings { margin-top: 10px !important; gap: 8px !important; }
    
    .control-btn, .action-btn { padding: 10px !important; font-size: 0.9em !important; }
    .rating-btn { padding: 10px !important; font-size: 0.9em !important; min-height: 48px !important; }
    
    .flashcard-nav {
        margin-top: 4px !important;
    }
    
    .flashcard-progress {
        margin-top: 4px !important;
    }
}

/* iPhone 12/13 mini 优化 (375x812+) */
@media (min-width: 375px) and (max-width: 375px) and (min-height: 813px) {
    body { 
        padding: 50px 10px 125px 10px !important;
    }
    
    .flashcard { height: 600px !important; }
    .flashcard-front, .flashcard-back { padding: 24px !important; }
    .flashcard-full { font-size: 0.98em !important; }
    
    .flashcard-actions { margin-top: 12px !important; gap: 8px !important; }
    .flashcard-ratings { margin-top: 12px !important; gap: 8px !important; }
    
    .control-btn, .action-btn { padding: 11px !important; font-size: 0.92em !important; }
    .rating-btn { padding: 11px !important; font-size: 0.92em !important; min-height: 50px !important; }
}

/* iPhone 12/13/14 标准版优化 (390x844) */
@media (min-width: 390px) and (max-width: 428px) and (min-height: 844px) and (max-height: 926px) {
    body { 
        padding: 50px 10px 125px 10px !important;
    }
    
    .flashcard { height: 665px !important; }
    .flashcard-front, .flashcard-back { padding: 25px !important; }
}

/* iPhone 14 Pro Max 等超大屏 (430x932) */
@media (min-width: 428px) and (min-height: 926px) {
    body { 
        padding: 50px 10px 125px 10px !important;
    }
    
    .flashcard { height: 710px !important; }
    .flashcard-front, .flashcard-back { padding: 28px !important; }
}

/* 暗黑模式支持 */
body.dark-mode { 
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%); 
}

body.dark-mode .compact-header {
    background: rgba(26, 26, 46, 0.95);
}

body.dark-mode .bottom-toolbar {
    background: rgba(45, 45, 68, 0.95);
}

body.dark-mode .toolbar-btn {
    background: #3a3a52;
    color: #e0e0e0;
}

body.dark-mode .toolbar-btn.mistakes-btn {
    background: #d32f2f;
}

body.dark-mode .bottom-sheet h3 {
    background: #2d2d44;
}

body.dark-mode .side-panel h3 {
    background: #2d2d44;
}

body.dark-mode .flashcard-front, body.dark-mode .flashcard-back { 
    background: #2d2d44; 
    color: #e0e0e0; 
}

body.dark-mode .flashcard-point { 
    color: #64b5f6; 
}

body.dark-mode .flashcard-sentence, body.dark-mode .flashcard-full { 
    color: #e8e8e8; 
}

body.dark-mode .control-btn, body.dark-mode .action-btn {
    background: #3a3a52;
    color: #e0e0e0;
}

body.dark-mode .control-btn:hover, body.dark-mode .action-btn:hover { 
    background: #4a4a62; 
}

body.dark-mode .flip-btn { 
    background: #1976d2; 
    color: white; 
}

body.dark-mode .flip-btn:hover { 
    background: #1565c0; 
}

body.dark-mode .action-btn { 
    background: #d32f2f; 
    color: white; 
}

body.dark-mode .action-btn:hover { 
    background: #c62828; 
}

body.dark-mode .nav-btn {
    background: #3a3a52;
    color: #e8e8e8;
}

body.dark-mode .nav-btn:hover {
    background: #4a4a62;
}

body.dark-mode .side-panel,
body.dark-mode .bottom-sheet {
    background: #2d2d44;
}

body.dark-mode .panel {
    background: #2d2d44;
    color: #e8e8e8;
}

body.dark-mode .panel h3 {
    color: #64b5f6;
    border-bottom-color: #64b5f6;
}

body.dark-mode .panel h4 {
    color: #c0c0c0;
    border-bottom-color: #4a4a62;
}

body.dark-mode .close-btn {
    background: #3a3a52;
    color: #e8e8e8;
}

body.dark-mode .close-btn:hover {
    background: #4a4a62;
}

body.dark-mode .toc-item {
    background: #3a3a52;
    border-left-color: #64b5f6;
    color: #e8e8e8;
}

body.dark-mode .toc-item:hover {
    background: #4a4a62;
}

body.dark-mode .toc-item.active {
    background: #1976d2;
    color: white;
}

body.dark-mode .control-row label {
    color: #e8e8e8;
}

body.dark-mode .adjuster button {
    background: #1976d2;
}

body.dark-mode .adjuster button:hover {
    background: #1565c0;
}

body.dark-mode .adjuster span {
    color: #e8e8e8;
}

body.dark-mode .stat-card {
    background: #3a3a52;
    color: #e8e8e8;
}

body.dark-mode .stat-title {
    color: #c0c0c0;
}

body.dark-mode .stat-value {
    color: #e8e8e8;
}

body.dark-mode .stat-detail {
    color: #a0a0a0;
}

body.dark-mode .mistake-item {
    background: #3a2a2a;
    border-left-color: #ff6b6b;
    color: #e8e8e8;
}

body.dark-mode .mistake-item:hover {
    background: #4a3a3a;
}

body.dark-mode .retention-bar {
    background: #3a3a52;
}

body.dark-mode .flashcard-full div[onclick] {
    background: #3a3a52 !important;
}

body.dark-mode .flashcard-full div[onclick]:hover {
    background: #1e3a5f !important;
    border-color: #64b5f6;
}

body.dark-mode .flashcard-full div[onclick]:active {
    background: #2a4a7f !important;
}

body.dark-mode .flashcard-full div[onclick] p {
    color: #e8e8e8;
}

body.dark-mode .review-mistakes-btn {
    background: #2e7d32;
}

body.dark-mode .review-mistakes-btn:hover {
    background: #1b5e20;
}

body.dark-mode .clear-mistakes-btn {
    background: #5a6268;
}

body.dark-mode .clear-mistakes-btn:hover {
    background: #4a5258;
}
