:root {
    --primary: #4a69bd;
    --primary-dark: #3c5aa8;
    --secondary: #6a89cc;
    --accent: #e55039;
    --bg: #f1f2f6;
    --card-bg: #ffffff;
    --text: #2f3542;
    --text-light: #57606f;
    --border: #dfe4ea;
    --success: #78e08f;
    --warning: #f6b93b;
}

[data-theme="dark"] {
    --primary: #5f7cce;
    --primary-dark: #4a69bd;
    --secondary: #829bd6;
    --bg: #1e1e2e;
    --card-bg: #2d2d3f;
    --text: #f1f2f6;
    --text-light: #ced6e0;
    --border: #444;
    --success: #2ecc71;
}

body { margin: 0; font-family: 'Segoe UI', system-ui, sans-serif; background: var(--bg); color: var(--text); height: 100vh; display: flex; flex-direction: column; transition: background 0.3s, color 0.3s; }

header { background: var(--card-bg); padding: 15px 20px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); display: flex; justify-content: space-between; align-items: center; z-index: 20; position: relative; transition: background 0.3s; }
.logo { font-size: 1.2rem; font-weight: bold; color: var(--primary); display: flex; align-items: center; gap: 10px; }
.header-controls { display: flex; gap: 15px; align-items: center; }
.theme-btn { cursor: pointer; font-size: 1.2rem; color: var(--text); background: none; border: none; padding: 5px; transition: 0.3s; }
.theme-btn:hover { transform: rotate(15deg); color: var(--warning); }
.menu-btn { display: none; cursor: pointer; font-size: 1.2rem; color: var(--text); margin-right: 10px; }

.main-container { flex: 1; display: flex; overflow: hidden; position: relative; }

.sidebar { width: 260px; background: var(--card-bg); border-right: 1px solid var(--border); padding: 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 20px; transition: transform 0.3s ease, background 0.3s; }
.filter-group h3 { font-size: 0.85rem; text-transform: uppercase; color: var(--text-light); margin-bottom: 10px; opacity: 0.7; }
.filter-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; cursor: pointer; padding: 10px; border-radius: 8px; transition: 0.2s; font-size: 0.95rem; color: var(--text); }
.filter-item:hover { background: rgba(0,0,0,0.05); }
[data-theme="dark"] .filter-item:hover { background: rgba(255,255,255,0.1); }
.filter-item.active { background: var(--primary); color: white; }
.badge { font-size: 0.75rem; background: rgba(0,0,0,0.1); padding: 2px 8px; border-radius: 10px; }
.filter-item.active .badge { background: rgba(255,255,255,0.2); color: white; }

.content-area { flex: 1; padding: 30px; overflow-y: auto; display: flex; flex-direction: column; align-items: center; position: relative; }

.progress-container { width: 100%; max-width: 600px; height: 6px; background: var(--border); border-radius: 3px; margin-bottom: 20px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--primary); width: 0%; transition: width 0.3s; }

.card-container { perspective: 1000px; width: 100%; max-width: 600px; min-height: 400px; position: relative; }
.card { width: 100%; height: 100%; position: relative; transform-style: preserve-3d; transition: transform 0.6s; border-radius: 20px; box-shadow: 0 10px 30px rgba(0,0,0,0.1); background: var(--card-bg); cursor: pointer; }
.card.flipped { transform: rotateY(180deg); cursor: default; }

.card-face { position: absolute; width: 100%; height: 100%; backface-visibility: hidden; padding: 40px; box-sizing: border-box; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; border-radius: 20px; overflow-y: auto; }
.card-back { transform: rotateY(180deg); background: var(--card-bg); justify-content: flex-start; padding-top: 40px; }

.tag { display: inline-block; padding: 4px 12px; border-radius: 20px; font-size: 0.8rem; font-weight: 600; margin-bottom: 20px; background: rgba(74, 105, 189, 0.1); color: var(--primary); }
.question-text { font-size: 1.5rem; line-height: 1.6; margin-bottom: 30px; font-weight: 600; }

.question-review-header {
    width: 100%;
    text-align: left;
    font-size: 1rem;
    color: var(--text-light);
    font-weight: 600;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border);
    opacity: 0.8;
}

.answer-text { font-size: 1.1rem; line-height: 1.6; color: var(--text); white-space: pre-wrap; text-align: left; width: 100%; }

.options-list { display: flex; flex-direction: column; gap: 10px; width: 100%; margin-top: 20px; }
.option-btn { padding: 12px; border: 2px solid var(--border); border-radius: 10px; background: transparent; color: var(--text); cursor: pointer; transition: 0.2s; text-align: left; font-size: 1rem; }
.option-btn:hover { border-color: var(--primary); background: rgba(74, 105, 189, 0.05); }
.option-btn.correct { background: var(--success); border-color: var(--success); color: white; }
.option-btn.wrong { background: var(--accent); border-color: var(--accent); color: white; }

.controls { 
    width: 100%; 
    max-width: 600px; 
    margin-top: 30px; 
    height: 60px; 
    display: flex; 
    gap: 10px;
}

.btn-nav {
    flex: 0 0 50px; 
    height: 50px;
    border: none;
    border-radius: 12px;
    background: var(--card-bg);
    color: var(--text);
    border: 1px solid var(--border);
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    transition: 0.2s;
}
.btn-nav:active { transform: scale(0.95); }

.center-control-area {
    flex: 1; 
    position: relative;
    height: 50px;
}

.btn-reveal { 
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 12px;
    background: var(--primary); 
    color: white; 
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(74, 105, 189, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
}

.grading-grid {
    display: none; 
    width: 100%;
    height: 100%;
    gap: 8px;
    display: flex;
}
.grading-grid.show {
    display: flex; 
}

.btn-grade {
    flex: 1;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    color: #fff;
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    line-height: 1.1;
    transition: transform 0.1s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.btn-grade span { font-size: 0.7em; opacity: 0.85; font-weight: normal; }
.btn-grade:active { transform: scale(0.95); }

.bg-again { background: #dfe6e9; color: #2d3436; } 
.bg-hard { background: #fab1a0; color: #fff; } 
.bg-good { background: #74b9ff; color: #fff; } 
.bg-easy { background: #55efc4; color: #2d3436; } 

.hint-text { margin-top: 10px; color: var(--text-light); font-size: 0.8rem; opacity: 0.7; }

/* --- 收藏星星样式 --- */
.star-btn { 
    position: absolute; 
    top: 20px; 
    right: 20px; /* 固定在最右侧 */
    font-size: 1.5rem; 
    color: var(--border); 
    cursor: pointer; 
    transition: 0.3s; 
    z-index: 5; 
    width: 40px; 
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.star-btn.active { color: var(--warning); transform: scale(1.1); }

/* --- 新增：重难点火焰样式 --- */
.priority-btn {
    position: absolute;
    top: 20px;
    right: 70px; /* 在星星左侧 (20px + 40px + 10px间距) */
    font-size: 1.5rem;
    color: var(--border);
    cursor: pointer;
    transition: 0.3s;
    z-index: 5;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.priority-btn:hover { color: #ff7675; }
.priority-btn.active {
    color: var(--accent); /* 火焰色 */
    transform: scale(1.1);
    filter: drop-shadow(0 2px 5px rgba(229, 80, 57, 0.4));
}

.note-section {
    width: 100%;
    margin-top: 25px;
    border-top: 1px dashed var(--border);
    padding-top: 15px;
    text-align: left;
}
.note-label {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.note-input {
    width: 100%;
    min-height: 80px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    color: var(--text);
    font-family: inherit;
    font-size: 0.95rem;
    resize: vertical;
    transition: border-color 0.3s, box-shadow 0.3s;
    box-sizing: border-box;
}
.note-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(74, 105, 189, 0.1); }
.save-status { font-size: 0.75rem; color: var(--success); opacity: 0; transition: opacity 0.3s; font-weight: bold; }
.save-status.show { opacity: 1; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 768px) {
    .menu-btn { display: block; }
    .sidebar { position: absolute; left: 0; top: 0; bottom: 0; z-index: 100; transform: translateX(-100%); box-shadow: 5px 0 15px rgba(0,0,0,0.1); }
    .sidebar.show { transform: translateX(0); }
    .overlay.show { display: block; }
    .overlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); z-index: 90; }
    
    .btn-grade { font-size: 0.8rem; padding: 0 2px; }
}