/* 基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    touch-action: manipulation;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    position: relative;
}

/* 头部样式 */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    text-align: center;
}

.logo {
    font-size: 1.3rem;
    font-weight: bold;
}

/* 工具栏 */
.toolbar {
    padding: 12px 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    border-bottom: 1px solid #eee;
}

a.btn {
    text-decoration: none;
}

.btn-upload,
.btn-download {
    flex-shrink: 0;
    white-space: nowrap;
}

.btn-download:hover {
    background: #5a6268;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(108, 117, 125, 0.3);
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-icon {
    padding: 10px 12px;
    font-size: 18px;
    flex-shrink: 0;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.btn-nav {
    background: #f8f9fa;
    color: #333;
}

.btn-nav:hover:not(:disabled) {
    background: #e9ecef;
}

.btn-nav:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

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

.btn-warning {
    background: #ffc107;
    color: #333;
}

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

.search-box {
    flex: 1;
    min-width: 0;
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 10px 15px 10px 40px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.search-box input:focus {
    outline: none;
    border-color: #667eea;
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
}

.filter-select {
    padding: 10px 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    flex-shrink: 0;
}

.filter-select:focus {
    outline: none;
    border-color: #667eea;
}

/* 模式切换 */
.mode-switch {
    display: flex;
    padding: 10px 20px;
    gap: 10px;
    border-bottom: 1px solid #eee;
    align-items: center;
}

.mode-btn {
    flex: 1;
    padding: 12px;
    border: 2px solid #ddd;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.mode-btn.active {
    border-color: #667eea;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.mode-btn:hover:not(.active) {
    border-color: #667eea;
}

.theme-toggle {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 2px solid #ddd;
    background: white;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.theme-toggle:hover {
    border-color: #667eea;
    transform: scale(1.1);
}

/* 防偷窥悬浮按钮 */
.privacy-toggle {
    position: fixed;
    right: 26px;
    bottom: 44px;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.6);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 30px;
    cursor: grab;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.45);
    z-index: 1100;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: none;
    transition: box-shadow 0.3s ease, border-color 0.3s ease, transform 0.3s ease;
}

.privacy-toggle:active {
    cursor: grabbing;
}

.privacy-toggle:hover {
    box-shadow: 0 12px 32px rgba(102, 126, 234, 0.6);
}

.privacy-toggle.active {
    background: #ff4757;
    border-color: #ff4757;
    color: white;
}

/* 防偷窥遮罩 */
.privacy-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    border-radius: 20px;
}

.privacy-overlay.hidden {
    display: none;
}

/* License 激活遮罩 */
.license-overlay {
    position: fixed;
    inset: 0;
    z-index: 9998;
    background: linear-gradient(135deg, rgba(45, 45, 70, 0.92) 0%, rgba(20, 20, 40, 0.96) 100%);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.license-overlay.hidden {
    display: none;
}

.license-box {
    width: 100%;
    max-width: 380px;
    background: #ffffff;
    border-radius: 16px;
    padding: 34px 30px 26px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.license-icon {
    font-size: 44px;
    margin-bottom: 10px;
}

.license-title {
    font-size: 1.4rem;
    color: #333;
    margin-bottom: 6px;
}

.license-subtitle {
    font-size: 0.9rem;
    color: #888;
    margin-bottom: 22px;
}

.license-input {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 15px;
    letter-spacing: 1px;
    text-align: center;
    box-sizing: border-box;
    margin-bottom: 14px;
    transition: border-color 0.3s ease;
}

.license-input:focus {
    outline: none;
    border-color: #667eea;
}

.license-btn {
    width: 100%;
    justify-content: center;
    padding: 12px;
    font-size: 15px;
}

.license-msg {
    min-height: 20px;
    margin-top: 14px;
    font-size: 0.85rem;
    color: #667eea;
}

.license-msg.error {
    color: #dc3545;
}

body.dark .license-box {
    background: #2a2a4a;
}

body.dark .license-title {
    color: #eee;
}

body.dark .license-subtitle {
    color: #aaa;
}

body.dark .license-input {
    background: #1a1a2e;
    border-color: #3a3a5a;
    color: #eee;
}

body.dark .license-input:focus {
    border-color: #90b4f8;
}

body.dark .license-msg {
    color: #90b4f8;
}

body.dark .license-msg.error {
    color: #ff6b6b;
}

.privacy-content {
    text-align: center;
    color: white;
    animation: privacyFadeIn 0.3s ease;
}

.privacy-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.privacy-text {
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 8px;
}

.privacy-hint {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.6);
}

@keyframes privacyFadeIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* 进度条 */
.progress-section {
    padding: 14px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    border-bottom: 1px solid #eee;
}

.progress-text {
    font-size: 15px;
    font-weight: 600;
    color: #444;
    min-width: 45px;
    text-align: center;
}

.progress-range {
    flex: 1;
    height: 10px;
    -webkit-appearance: none;
    appearance: none;
    background: #e9ecef;
    border-radius: 5px;
    outline: none;
    cursor: pointer;
}

.progress-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

.progress-range::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

.progress-range::-webkit-slider-runnable-track {
    height: 10px;
    border-radius: 5px;
    background: #e9ecef;
}

.progress-range::-moz-range-track {
    height: 10px;
    border-radius: 5px;
    background: #e9ecef;
    border: none;
}

/* 卡片区域 */
.card-container {
    padding: 25px 20px;
    min-height: 260px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: visible;
}

.empty-state {
    text-align: center;
    color: #666;
}

.empty-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.empty-state p {
    margin: 10px 0;
}

.empty-state .hint {
    font-size: 14px;
    color: #999;
}

.card {
    width: 100%;
    max-width: 400px;
    min-height: 300px;
    perspective: 1000px;
    cursor: pointer;
}

.card-inner {
    position: relative;
    width: 100%;
    min-height: 300px;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.card.swiping .card-inner {
    transition: none;
}

.card.swipe-left .card-inner {
    transform: translateX(-120%) rotate(-5deg);
    opacity: 0;
}

.card.swipe-right .card-inner {
    transform: translateX(120%) rotate(5deg);
    opacity: 0;
}

.card.flipped .card-inner {
    transform: rotateY(180deg);
}

.card-front, .card-back {
    position: absolute;
    width: 100%;
    min-height: 100%;
    backface-visibility: hidden;
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.1);
}

.card-front {
    background: white;
    border: 2px solid #667eea;
}

.card-back {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    transform: rotateY(180deg);
}

.chengyu {
    font-size: 1.8rem;
    font-weight: bold;
    color: #333;
    margin-bottom: 15px;
}

.card-front-def {
    font-size: 1.2rem;
    color: #555;
    line-height: 1.7;
    text-align: center;
    margin-bottom: 8px;
}

.card-related {
    font-size: 1.2rem;
    color: #555;
    text-align: center;
    margin-bottom: 4px;
    line-height: 1.7;
}

.card-related .label {
    font-weight: 600;
    color: #667eea;
}

.card-related-back {
    color: rgba(255, 255, 255, 0.85);
    margin-top: 6px;
}

.card-related-back .label {
    color: rgba(255, 255, 255, 0.9);
}

.definition {
    font-size: 1.2rem;
    line-height: 1.6;
    text-align: center;
}

.hint {
    color: #999;
    font-size: 14px;
}

.hidden {
    display: none !important;
}

/* 导航按钮 */
.nav-buttons {
    display: flex;
    justify-content: space-between;
    padding: 0 20px 20px;
    gap: 12px;
}

.nav-buttons .btn {
    margin: 0;
    justify-content: center;
    padding: 14px 20px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 500;
    background: linear-gradient(135deg, #f0f2f5 0%, #e4e7ec 100%);
    color: #444;
    border: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: all 0.2s ease;
}

#prev-btn {
    flex: 1.3;
}

#next-btn {
    flex: 1;
}

.nav-buttons .btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.nav-buttons .btn:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.nav-buttons .btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: #f0f2f5;
    color: #aaa;
    box-shadow: none;
}

/* 操作按钮 */
.action-buttons {
    display: flex;
    gap: 10px;
    padding: 0 20px 20px;
}

.action-buttons .btn {
    flex: 1;
    justify-content: center;
    padding: 16px 10px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 12px;
}

/* 底部统计 */
.stats-bar {
    display: flex;
    justify-content: space-around;
    padding: 15px 20px;
    background: #f8f9fa;
    border-top: 1px solid #eee;
}

.stat {
    display: flex;
    align-items: center;
    gap: 6px;
}

.stat-label {
    color: #666;
    font-size: 13px;
}

.stat-value {
    font-weight: bold;
    font-size: 16px;
    color: #333;
}

/* 数据管理 */
.data-management {
    display: flex;
    gap: 10px;
    padding: 15px 20px;
    border-top: 1px solid #eee;
}

.data-management .btn {
    flex: 1;
    justify-content: center;
}

.btn-export {
    background: #17a2b8;
    color: white;
}

.btn-export:hover {
    background: #138496;
}

.btn-reset {
    background: #dc3545;
    color: white;
}

.btn-reset:hover {
    background: #c82333;
}

/* 粒子特效 */
.particle {
    position: fixed;
    pointer-events: none;
    z-index: 9999;
}

.confetti-piece {
    border-radius: 2px;
    animation: confetti-burst 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

@keyframes confetti-burst {
    0% {
        opacity: 1;
        transform: translate(0, 0) rotate(0deg) scale(1);
    }
    60% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        transform: translate(var(--tx), var(--ty)) rotate(var(--rot)) scale(0.3);
    }
}

.star-particle {
    animation: star-float 1s ease-out forwards;
}

@keyframes star-float {
    0% {
        opacity: 1;
        transform: translate(0, 0) scale(0.5);
    }
    50% {
        opacity: 1;
        transform: translate(calc(var(--tx) * 0.5), calc(var(--ty) * 0.5)) scale(1.2);
    }
    100% {
        opacity: 0;
        transform: translate(var(--tx), var(--ty)) scale(0.8);
    }
}

.encourage-msg {
    position: fixed;
    transform: translateX(-50%);
    font-size: 20px;
    font-weight: bold;
    color: #ff922b;
    text-shadow: 0 2px 8px rgba(255, 146, 43, 0.3);
    pointer-events: none;
    z-index: 9999;
    animation: msg-pop 1.2s ease-out forwards;
    white-space: nowrap;
}

@keyframes msg-pop {
    0% {
        opacity: 0;
        transform: translateX(-50%) translateY(0) scale(0.5);
    }
    20% {
        opacity: 1;
        transform: translateX(-50%) translateY(-10px) scale(1.1);
    }
    40% {
        transform: translateX(-50%) translateY(-15px) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateX(-50%) translateY(-50px) scale(0.9);
    }
}

/* 每日测试 */
.daily-test {
    padding: 22px 20px;
    min-height: 300px;
}

.daily-panel {
    text-align: center;
    animation: dailyFade 0.3s ease;
}

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

.daily-title {
    font-size: 1.5rem;
    margin-bottom: 6px;
    color: #333;
}

.daily-subtitle {
    color: #777;
    font-size: 0.95rem;
    margin-bottom: 22px;
}

.daily-count-label {
    font-size: 0.95rem;
    color: #555;
    margin-bottom: 10px;
    font-weight: 500;
}

.daily-count-select {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-bottom: 14px;
}

.daily-count-btn {
    min-width: 56px;
    padding: 10px 14px;
    border: 2px solid #ddd;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    color: #555;
    transition: all 0.25s ease;
}

.daily-count-btn:hover {
    border-color: #667eea;
}

.daily-count-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
    color: white;
}

.daily-custom {
    margin-bottom: 12px;
}

.daily-custom-input {
    width: 140px;
    padding: 10px 14px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 15px;
    text-align: center;
}

.daily-custom-input:focus {
    outline: none;
    border-color: #667eea;
}

.daily-hint {
    color: #999;
    font-size: 0.9rem;
    margin-bottom: 18px;
}

.daily-ratio {
    font-size: 0.9rem;
    color: #667eea;
    font-weight: 500;
    margin-bottom: 6px;
}

.daily-ratio-note {
    font-size: 0.82rem;
    color: #888;
    margin-bottom: 14px;
}

.daily-start {
    font-size: 16px;
    padding: 12px 44px;
    margin: 0 auto;
}

.daily-wrong-info {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 16px;
    font-size: 0.9rem;
    color: #d2691e;
    background: #fff7ed;
    border: 1px solid #ffd8a8;
    border-radius: 8px;
    padding: 8px 12px;
}

.daily-view-wrong {
    border: none;
    background: transparent;
    color: #667eea;
    font-size: 0.85rem;
    cursor: pointer;
    text-decoration: underline;
    padding: 2px 4px;
    flex-shrink: 0;
}

.daily-view-wrong:hover {
    color: #4458c7;
}

.daily-reset-wrong {
    border: none;
    background: transparent;
    color: #dc3545;
    font-size: 0.85rem;
    cursor: pointer;
    text-decoration: underline;
    padding: 2px 4px;
    flex-shrink: 0;
}

.daily-reset-wrong:hover {
    color: #a71d2a;
}

.daily-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.daily-modal-mask {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
}

.daily-modal-box {
    position: relative;
    background: #fff;
    border-radius: 12px;
    width: 100%;
    max-width: 460px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
}

.daily-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid #eee;
}

.daily-modal-title {
    font-weight: 600;
    color: #333;
}

.daily-modal-close {
    border: none;
    background: transparent;
    font-size: 24px;
    line-height: 1;
    color: #666;
    cursor: pointer;
    padding: 0 6px;
}

.daily-modal-close:hover {
    color: #333;
}

.daily-modal-body {
    overflow-y: auto;
    padding: 14px 18px;
}

.daily-wrong-section + .daily-wrong-section {
    margin-top: 14px;
}

.daily-wrong-section-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: #555;
    margin-bottom: 8px;
}

.daily-wrong-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 6px 0;
    border-bottom: 1px dashed #e5e7ea;
}

.daily-wrong-item:last-child {
    border-bottom: none;
}

.daily-wrong-empty {
    color: #999;
    font-size: 0.9rem;
    text-align: center;
    padding: 8px 0;
}

.daily-result-note {
    font-size: 0.9rem;
    color: #d2691e;
    margin-bottom: 12px;
}

/* 答题面板 */
.daily-quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    font-weight: 600;
    color: #555;
}

.daily-question {
    background: #f8f9fa;
    border: 2px solid #eee;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
}

.daily-q-label {
    font-size: 0.9rem;
    color: #888;
    margin-bottom: 10px;
}

.daily-definition {
    font-size: 1.15rem;
    line-height: 1.6;
    color: #333;
}

.daily-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.daily-option {
    padding: 16px 10px;
    border: 2px solid #ddd;
    border-radius: 10px;
    background: white;
    font-size: 1.05rem;
    font-weight: 600;
    color: #333;
    cursor: pointer;
    transition: all 0.2s ease;
}

.daily-option:hover:not(:disabled) {
    border-color: #667eea;
    transform: translateY(-2px);
}

.daily-option.correct {
    background: #28a745;
    border-color: #28a745;
    color: white;
}

.daily-option.wrong {
    background: #dc3545;
    border-color: #dc3545;
    color: white;
    animation: dailyShake 0.4s ease;
}

.daily-option:disabled {
    cursor: default;
    opacity: 1;
}

@keyframes dailyShake {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-6px);
    }
    75% {
        transform: translateX(6px);
    }
}

.daily-action-row {
    margin-top: 16px;
    display: flex;
    justify-content: center;
    gap: 12px;
    text-align: center;
}

.daily-next,
.daily-prev {
    padding: 12px 32px;
    font-size: 16px;
}

.daily-prev:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* 结果面板 */
.daily-result-icon {
    font-size: 56px;
    margin-bottom: 8px;
}

.daily-result-title {
    font-size: 1.4rem;
    color: #333;
    margin-bottom: 6px;
}

.daily-score {
    font-size: 1.15rem;
    color: #667eea;
    font-weight: 700;
    margin-bottom: 18px;
}

.daily-review {
    text-align: left;
    background: #f8f9fa;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
    max-height: 240px;
    overflow-y: auto;
}

.daily-review-heading {
    font-weight: 700;
    color: #444;
    margin-bottom: 10px;
}

.daily-review-row {
    padding: 8px 0;
    border-bottom: 1px dashed #ddd;
}

.daily-review-row:last-child {
    border-bottom: none;
}

.daily-review-word {
    font-weight: 700;
    color: #dc3545;
    margin-right: 8px;
}

.daily-review-def {
    color: #666;
    font-size: 0.95rem;
}

.daily-review-empty {
    color: #28a745;
    font-weight: 600;
    text-align: center;
}

.daily-result-actions {
    display: flex;
    gap: 10px;
}

.daily-result-actions .btn {
    flex: 1;
    justify-content: center;
}

/* 每日测试 暗黑模式 */
body.dark .daily-title {
    color: #eee;
}

body.dark .daily-subtitle {
    color: #999;
}

body.dark .daily-count-label {
    color: #ccc;
}

body.dark .daily-count-btn {
    background: #1a1a2e;
    color: #ccc;
    border-color: #3a3a5a;
}

body.dark .daily-count-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
    color: white;
}

body.dark .daily-custom-input {
    background: #1a1a2e;
    color: #eee;
    border-color: #3a3a5a;
}

body.dark .daily-hint {
    color: #888;
}

body.dark .daily-ratio {
    color: #90b4f8;
}

body.dark .daily-ratio-note {
    color: #9aa0b5;
}

body.dark .daily-question {
    background: #1a1a2e;
    border-color: #3a3a5a;
}

body.dark .daily-q-label {
    color: #999;
}

body.dark .daily-definition {
    color: #eee;
}

body.dark .daily-quiz-header {
    color: #ccc;
}

body.dark .daily-option {
    background: #1a1a2e;
    color: #eee;
    border-color: #3a3a5a;
}

body.dark .daily-option:hover:not(:disabled) {
    border-color: #667eea;
}

body.dark .daily-option.correct {
    background: #28a745;
    border-color: #28a745;
    color: white;
}

body.dark .daily-option.wrong {
    background: #dc3545;
    border-color: #dc3545;
    color: white;
}

body.dark .daily-result-title {
    color: #eee;
}

body.dark .daily-wrong-info {
    color: #ffb86b;
    background: #2a2a4a;
    border-color: #5a4a2a;
}

body.dark .daily-reset-wrong {
    color: #ff6b6b;
}

body.dark .daily-reset-wrong:hover {
    color: #ff8f8f;
}

body.dark .daily-view-wrong {
    color: #90b4f8;
}

body.dark .daily-view-wrong:hover {
    color: #c3d7ff;
}

body.dark .daily-modal-box {
    background: #2a2a4a;
    border: 1px solid #3a3a5a;
}

body.dark .daily-modal-header {
    border-bottom-color: #3a3a5a;
}

body.dark .daily-modal-title {
    color: #eee;
}

body.dark .daily-modal-close {
    color: #aaa;
}

body.dark .daily-modal-close:hover {
    color: #fff;
}

body.dark .daily-wrong-section-title {
    color: #ccc;
}

body.dark .daily-wrong-item {
    border-bottom-color: #3a3a5a;
}

body.dark .daily-wrong-empty {
    color: #888;
}

body.dark .daily-result-note {
    color: #ffb86b;
}

body.dark .daily-score {
    color: #90b4f8;
}

body.dark .daily-review {
    background: #1a1a2e;
}

body.dark .daily-review-heading {
    color: #ccc;
}

body.dark .daily-review-word {
    color: #ff6b6b;
}

body.dark .daily-review-def {
    color: #aaa;
}

body.dark .daily-review-empty {
    color: #6bcb77;
}

/* 暗黑模式 */
body.dark {
    background: #1a1a2e;
}

body.dark .container {
    background: #16213e;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

body.dark .header {
    background: linear-gradient(135deg, #1a1a2e 0%, #0f3460 100%);
}

body.dark .toolbar {
    border-bottom-color: #2a2a4a;
}

body.dark .search-box input {
    background: #1a1a2e;
    color: #eee;
    border-color: #3a3a5a;
}

body.dark .search-box input::placeholder {
    color: #888;
}

body.dark .search-box input:focus {
    border-color: #667eea;
}

body.dark .filter-select {
    background: #1a1a2e;
    color: #eee;
    border-color: #3a3a5a;
}

body.dark .mode-btn {
    background: #1a1a2e;
    color: #ccc;
    border-color: #3a3a5a;
}

body.dark .mode-btn.active {
    border-color: #667eea;
    color: white;
}

body.dark .theme-toggle {
    background: #1a1a2e;
    color: #eee;
    border-color: #3a3a5a;
}

body.dark .privacy-toggle {
    background: #1a1a2e;
    color: #eee;
    border-color: #3a3a5a;
}

body.dark .privacy-toggle.active {
    background: #ff4757;
    border-color: #ff4757;
    color: white;
}

body.dark .progress-section {
    border-bottom-color: #2a2a4a;
}

body.dark .progress-text {
    color: #ccc;
}

body.dark .progress-range {
    background: #3a3a5a;
}

body.dark .card-front {
    background: #1a1a2e;
    border-color: #667eea;
}

body.dark .card-front .chengyu {
    color: #eee;
}

body.dark .card-front .card-front-def {
    color: #bbb;
}

body.dark .card-front .hint {
    color: #888;
}

body.dark .card-front .card-related {
    color: #ccc;
}

body.dark .card-front .card-related .label {
    color: #90b4f8;
}

body.dark .card-back {
    background: linear-gradient(135deg, #1a1a2e 0%, #0f3460 100%);
}

body.dark .nav-buttons .btn {
    background: linear-gradient(135deg, #1a1a2e 0%, #2a2a4a 100%);
    color: #ccc;
}

body.dark .nav-buttons .btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

body.dark .nav-buttons .btn:disabled {
    background: #1a1a2e;
    color: #555;
}

body.dark .btn-secondary {
    background: #444;
}

body.dark .stats-bar {
    background: #0f1a30;
    border-top-color: #2a2a4a;
}

body.dark .stat-label {
    color: #aaa;
}

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

body.dark .data-management {
    border-top-color: #2a2a4a;
}

body.dark .btn-export {
    background: #0f3460;
}

body.dark .btn-reset {
    background: #8b0000;
}

/* 响应式设计 */
@media (max-width: 600px) {
    body {
        padding: 10px;
    }

    .toolbar {
        gap: 8px;
    }

    /* 移动端工具栏：两行布局，避免按钮把搜索框挤没 */
    /* 第一行：导入 + 下载按钮等宽排列 */
    .toolbar .btn-upload,
    .toolbar .btn-download {
        order: 1;
        flex: 1 1 auto;
        justify-content: center;
        padding: 10px 6px;
        white-space: nowrap;
    }

    /* 第二行：搜索框与筛选器，搜索框独占剩余宽度，不再被压缩 */
    .toolbar .search-box {
        order: 2;
        flex: 1 1 auto;
        min-width: 130px;
    }

    .toolbar .filter-select {
        order: 2;
        flex-shrink: 0;
    }

    .btn-icon {
        padding: 9px 10px;
        font-size: 16px;
    }

    .search-box input {
        padding: 9px 10px 9px 36px;
        font-size: 13px;
    }

    .filter-select {
        padding: 9px 10px;
        font-size: 13px;
    }

    .mode-btn {
        padding: 10px;
        font-size: 13px;
    }

    .theme-toggle {
        width: 36px;
        height: 36px;
        font-size: 17px;
    }

    .privacy-toggle {
        width: 56px;
        height: 56px;
        font-size: 26px;
        right: 16px;
        bottom: 30px;
    }

    .card {
        min-height: 260px;
    }

    .chengyu {
        font-size: 1.3rem;
        margin-bottom: 10px;
    }

    .definition {
        font-size: 1rem;
        line-height: 1.5;
    }

    .card-front-def {
        font-size: 1rem;
        line-height: 1.5;
        margin-bottom: 6px;
    }

    .card-related {
        font-size: 0.95rem;
        margin-bottom: 2px;
    }

    .card-inner {
        min-height: 260px;
    }

    .action-buttons .btn {
        padding: 14px 8px;
        font-size: 15px;
    }

    .nav-buttons .btn {
        padding: 12px 15px;
        font-size: 14px;
    }

    .data-management {
        flex-direction: column;
    }

    .daily-options {
        grid-template-columns: 1fr;
    }

    .daily-title {
        font-size: 1.3rem;
    }
}