/* ============================================================
   iLingFeng 样式 V3.4 (默写界面大修版)
   ============================================================ */

/* --- 1. 全局基础设置 --- */
*, *::before, *::after { box-sizing: border-box; }

:root {
    --primary-color: #2e7d32; 
    --accent-color: #43a047; 
    --light-green: #e8f5e9;
    --bg-color: #f4f6f9;
    --card-shadow: 0 4px 6px rgba(0,0,0,0.05);
    --sidebar-width: 260px;
}

html { scroll-behavior: smooth; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    color: #333;
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    height: 100vh;
    overflow: hidden;
    display: flex;
    -webkit-user-select: none; user-select: none;
}

input, textarea { user-select: text; -webkit-user-select: text; }

/* --- 2. 核心布局容器 --- */
.app-layout { display: flex; width: 100%; height: 100%; position: relative; overflow: hidden; }

/* --- 3. 强制隐藏的弹窗 --- */
#loginOverlay, #flashcardModal, #completionModal, #dictationModal, #dictationSummaryModal, #actionSheetOverlay, #actionSheet, .overlay, .modal {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 2000;
}

/* --- 4. 侧边栏样式 --- */
.sidebar {
    width: var(--sidebar-width); background: white; border-right: 1px solid #e0e0e0;
    display: flex; flex-direction: column; height: 100%; flex-shrink: 0;
    box-shadow: 2px 0 10px rgba(0,0,0,0.03); z-index: 500; transition: transform 0.3s ease;
}
.sidebar-header { padding: 20px 15px; background: white; border-bottom: 1px solid #f0f0f0; display: flex; flex-direction: column; gap: 15px; flex-shrink: 0; }
.sidebar-content { flex: 1; overflow-y: auto; padding: 0; -webkit-overflow-scrolling: touch; }

.nav-item {
    display: block; padding: 10px 15px; margin-bottom: 6px; text-decoration: none; color: #555;
    transition: all 0.2s ease; border: 1px solid transparent; background: #fff;
}
.nav-item:hover, .nav-item.active { background-color: var(--light-green); transform: translateX(3px); }
.nav-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.nav-root { font-weight: 800; color: var(--primary-color); font-family: Consolas, monospace; font-size: 1.1em; text-transform: capitalize; }
.nav-title { font-size: 0.85em; color: #777; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100px; }
.nav-progress-bg { height: 4px; background-color: #eee; border-radius: 2px; overflow: hidden; position: relative; }
.nav-progress-bar { height: 100%; background-color: var(--accent-color); width: 0%; border-radius: 2px; transition: width 0.5s ease; }
.nav-meta { display: flex; justify-content: space-between; font-size: 11px; color: #999; margin-top: 4px; }
.nav-pct { color: var(--primary-color); font-weight: bold; }

.brand-row { display: flex; align-items: center; gap: 10px; color: var(--primary-color); }
.brand-icon { font-size: 24px; animation: swing 2s infinite ease-in-out; display: inline-block; transform-origin: bottom center;}
@keyframes swing { 0%,100%{transform:rotate(-5deg);} 50%{transform:rotate(5deg);} }
.brand-title h2 { margin: 0; font-size: 1.2em; font-weight: 800; color: #2e7d32; }
.brand-title .sub { font-size: 0.75em; color: #888; font-weight: normal; letter-spacing: 1px; }

.search-box-wrapper { position: relative; width: 100%; }
.search-input { width: 100%; box-sizing: border-box; padding: 10px 15px 10px 38px; border-radius: 20px; border: 2px solid #e8f5e9; background: #f1f8e9; font-size: 14px; color: #333; transition: all 0.3s; outline: none; }
.search-input:focus { background: white; border-color: var(--accent-color); box-shadow: 0 4px 10px rgba(46, 125, 50, 0.1); }
.search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: #aaa; font-size: 14px; }

.accordion-header { background: #fff; margin: 8px 12px; padding: 12px 15px; border-radius: 12px; cursor: pointer; font-weight: bold; display: flex; justify-content: space-between; align-items: center; transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1); border: 1px solid #eee; box-shadow: 0 2px 5px rgba(0,0,0,0.02); position: relative; overflow: hidden; }
.accordion-header:hover { transform: translateY(-2px) scale(1.01); box-shadow: 0 5px 12px rgba(0,0,0,0.08); }
.accordion-header:active { transform: scale(0.98); }
.acc-deco-bar { position: absolute; left: 0; top: 0; bottom: 0; width: 6px; }
.theme-a .acc-deco-bar { background: #FF6B6B; } .theme-a .acc-badge { background: #FFEBEE; color: #FF6B6B; }
.theme-e .acc-deco-bar { background: #FFD93D; } .theme-e .acc-badge { background: #FFFDE7; color: #FBC02D; }
.theme-i .acc-deco-bar { background: #4D96FF; } .theme-i .acc-badge { background: #E3F2FD; color: #1976D2; }
.theme-o .acc-deco-bar { background: #6BCB77; } .theme-o .acc-badge { background: #E8F5E9; color: #2E7D32; }
.theme-u .acc-deco-bar { background: #9D4EDD; } .theme-u .acc-badge { background: #F3E5F5; color: #7B1FA2; }
.theme-other .acc-deco-bar { background: #607D8B; } .theme-other .acc-badge { background: #ECEFF1; color: #546E7A; }
.acc-title { margin-left: 10px; font-size: 1.05em; color: #444; }
.acc-badge { font-size: 0.8em; padding: 2px 8px; border-radius: 10px; font-weight: 800; margin-right: 8px;}
.accordion-icon { font-size: 12px; color: #ccc; transition: 0.3s; }
.accordion-header.active .accordion-icon { transform: rotate(180deg); color: #333; }
.accordion-content { max-height: 0; overflow: hidden; transition: max-height 0.3s ease; background-color: white; }
.accordion-content .nav-item { margin: 2px 12px 2px 20px; border-left: 2px solid #eee; border-radius: 0 8px 8px 0; }
.accordion-content .nav-item:hover { border-left-color: var(--accent-color); background: #f9fbe7; }
.search-result-header { padding: 10px 20px; font-size: 12px; color: #999; font-weight: bold; }

/* --- 5. 主内容区域 --- */
.main-content { flex: 1; padding: 20px 40px; overflow-y: auto; position: relative; -webkit-overflow-scrolling: touch; }

.dashboard { background: linear-gradient(135deg, #2e7d32, #66bb6a); color: white; padding: 25px; border-radius: 12px; margin-bottom: 25px; box-shadow: 0 5px 15px rgba(46, 125, 50, 0.3); position: relative; display: flex; flex-direction: column; }
.dashboard-header { display: flex; justify-content: space-between; align-items: flex-start; }
.dashboard h1 { margin: 0; font-size: 2em; letter-spacing: 1px; }
.dashboard .subtitle { opacity: 0.9; margin-top: 5px; font-size: 0.9em; }
.stats-box { margin-top: 15px; display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.stat-item { background: rgba(255,255,255,0.2); padding: 5px 15px; border-radius: 20px; font-weight: bold; }
.timer-badge { background: rgba(255,255,255,0.2); padding: 4px 12px; border-radius: 15px; font-size: 0.85em; font-weight: bold; border: 1px solid rgba(255,255,255,0.3); white-space: nowrap; }
.quote { margin-top: 15px; border-left: 4px solid #f1c40f; padding-left: 12px; padding-top: 6px; padding-bottom: 6px; cursor: pointer; background: transparent; }
.q-en { font-family: "Georgia", serif; font-style: italic; font-size: 1.15em; font-weight: 600; margin-bottom: 5px; display: block; text-shadow: 0 1px 1px rgba(0,0,0,0.1); }
.q-cn { font-family: "Microsoft YaHei", sans-serif; font-style: normal; font-size: 0.95em; opacity: 0.9; display: block; font-weight: normal; }

.toolbar { display: flex; justify-content: flex-end; gap: 10px; margin-bottom: 20px; background: var(--bg-color); padding: 10px 0; z-index: 100; flex-wrap: wrap; }
.btn { padding: 8px 15px; border: none; border-radius: 6px; cursor: pointer; font-weight: bold; transition: 0.2s; font-size: 14px; display: inline-flex; align-items: center; gap: 5px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); white-space: nowrap; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.btn:hover { transform: translateY(-2px); box-shadow: 0 4px 8px rgba(0,0,0,0.15); }
.btn-primary { background-color: var(--accent-color); color: white; }
.btn-success { background-color: #27ae60; color: white; }
.btn-danger { background-color: #e74c3c; color: white; }
.btn-dark { background-color: #34495e; color: white; }
.btn-white { background-color: white; color: #333; border: 1px solid #ddd; }
.btn-sm { padding: 4px 10px; font-size: 12px; border-radius: 4px; margin-left: 5px; }

.dropdown { position: relative; display: inline-block; }
.dropdown-content { display: none; position: absolute; right: 0; top: 100%; background-color: #fff; min-width: 160px; box-shadow: 0 8px 16px rgba(0,0,0,0.2); border-radius: 6px; z-index: 101; }
.dropdown:hover .dropdown-content { display: block; }
.dropdown-item { padding: 10px 15px; text-decoration: none; display: block; color: #333; font-size: 13px; cursor: pointer; border-bottom: 1px solid #eee; }
.dropdown-item:hover { background-color: #f1f1f1; color: var(--primary-color); }
.dropdown-item.danger-item:hover { background-color: #ffebee; color: #e74c3c; }

.family-section { background-color: #fff; border-radius: 10px; margin-bottom: 30px; box-shadow: var(--card-shadow); border: 1px solid #e0e0e0; overflow: hidden; }
.family-header { background-color: #fff; padding: 15px 20px; border-bottom: 2px solid #f0f0f0; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }
.family-title { font-size: 1.2em; font-weight: bold; color: #2c3e50; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.root-badge { background: #e74c3c; color: white; padding: 2px 8px; border-radius: 4px; font-size: 0.8em; white-space: nowrap; }
.header-actions { display: flex; align-items: center; gap: 8px; }
.count-badge { background: #f1f2f6; color: #666; padding: 4px 12px; border-radius: 15px; font-size: 0.85em; font-weight: bold; margin-right: 5px; white-space: nowrap;}
.delete-family-btn { color: #999; cursor: pointer; border:none; background:none; font-size: 1.1em; }
.delete-family-btn:hover { color: #e74c3c; }

.mobile-only { display: none !important; }
.print-btn { display: inline-flex; }

.table-responsive { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; min-width: 600px; }
th, td { padding: 12px 10px; text-align: left; border-bottom: 1px solid #f0f0f0; vertical-align: middle;}
th { background-color: #f8f9fa; color: #555; font-weight: bold; font-size: 0.95em; white-space: nowrap; }
.col-word { width: 15%; min-width: 90px; font-weight: bold; font-size: 1.1em; }
.col-ipa { width: 15%; min-width: 80px; color: #777; font-family: Consolas, monospace; font-size: 0.9em; }
.col-mean { width: 25%; min-width: 120px; }
.col-phrase { width: 25%; min-width: 150px; color: #555; background-color: #fafbfc; font-size: 0.9em; border-left: 1px dashed #eee;}
.col-action { width: 20%; min-width: 140px; text-align: right; } 
.action-wrapper { display: flex; justify-content: flex-end; align-items: center; gap: 4px; }

tr.status-red { background-color: #ffebee; }
tr.status-yellow { background-color: #fff8e1; }
tr.status-green { background-color: #e8f5e9; opacity: 0.8; }
tr.status-green .col-word { color: #2e7d32; }
tr.status-red .col-phrase, tr.status-yellow .col-phrase, tr.status-green .col-phrase { background-color: transparent; }

.blur-content { color: transparent !important; text-shadow: 0 0 10px rgba(0,0,0,0.5); user-select: none; transition: 0.3s; }
.blur-content:hover { text-shadow: none; color: #333 !important; }
.blur-content .root-hl { color: #e74c3c !important; text-shadow: none !important; opacity: 1 !important; }

.toggle-eye { cursor: pointer; opacity: 0.6; border:none; background:none; font-size: 1.1em; }
.toggle-eye:hover { opacity: 1; color: var(--accent-color); }
.active-eye { color: var(--accent-color); opacity: 1; }
.speak-btn { cursor: pointer; color: var(--accent-color); border: none; background: none; font-size: 1.1em; margin-left: 5px; }

.status-dot { width: 14px; height: 14px; border-radius: 50%; display: inline-block; cursor: pointer; border: 2px solid rgba(0,0,0,0.1); margin-left: 2px; }
.dot-red { background-color: #ff5252; } .dot-yellow { background-color: #ffca28; } .dot-green { background-color: #66bb6a; }
.status-dot:hover { transform: scale(1.2); }

.root-hl { color: #e74c3c; font-weight: 800; }

.badge-base { display: inline-flex; align-items: center; justify-content: center; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 12px; font-weight: bold; vertical-align: middle; margin-left: 5px; box-shadow: 0 1px 2px rgba(0,0,0,0.05); }
.tag-mid { background: #f39c12; color: white; } .tag-high { background: #e67e22; color: white; } .tag-freq { background: #27ae60; color: white; } .tag-common { background: #7f8c8d; color: white; }
.tag-streak { background: linear-gradient(135deg, #e8f5e9, #c8e6c9); color: #2e7d32; border: 1px solid #a5d6a7; }
.tag-error { background: linear-gradient(135deg, #ffebee, #ffcdd2); color: #c62828; border: 1px solid #ef9a9a; animation: pulse-red 2s infinite; }
.tag-review { background: linear-gradient(135deg, #fff8e1, #ffecb3); color: #f57f17; border: 1px solid #ffe082; }
@keyframes pulse-red { 0% { box-shadow: 0 0 0 0 rgba(239, 83, 80, 0.4); } 70% { box-shadow: 0 0 0 6px rgba(239, 83, 80, 0); } 100% { box-shadow: 0 0 0 0 rgba(239, 83, 80, 0); } }

.shield-badge { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; font-size: 14px; margin-left: 5px; vertical-align: middle; box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
.shield-bronze { background: #cd7f32; color: white; border: 2px solid #b87333; }
.shield-silver { background: #c0c0c0; color: white; border: 2px solid #a9a9a9; }
.shield-gold { background: #ffd700; color: #b8860b; border: 2px solid #daa520; animation: shine 2s infinite; }
@keyframes shine { 0% { box-shadow: 0 0 0 0 rgba(255, 215, 0, 0.4); } 70% { box-shadow: 0 0 0 6px rgba(255, 215, 0, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 215, 0, 0); } }

/* --- 6. 弹窗与覆盖层 --- */
#loginOverlay { background: linear-gradient(120deg, #84fab0 0%, #8fd3f4 100%); display: flex; justify-content: center; align-items: center; flex-direction: column; overflow: hidden; }
.circles { position: absolute; top: 0; left: 0; width: 100%; height: 100%; overflow: hidden; z-index: 1; }
.circles li { position: absolute; display: block; list-style: none; width: 20px; height: 20px; background: rgba(255, 255, 255, 0.4); animation: animate 25s linear infinite; bottom: -150px; border-radius: 50%; }
.circles li:nth-child(1){ left: 25%; width: 80px; height: 80px; animation-delay: 0s; }
.circles li:nth-child(2){ left: 10%; width: 20px; height: 20px; animation-delay: 2s; animation-duration: 12s; }
.circles li:nth-child(3){ left: 70%; width: 20px; height: 20px; animation-delay: 4s; }
@keyframes animate { 0%{ transform: translateY(0) rotate(0deg); opacity: 1; border-radius: 0; } 100%{ transform: translateY(-1000px) rotate(720deg); opacity: 0; border-radius: 50%; } }
.login-box { position: relative; z-index: 10; background: rgba(255, 255, 255, 0.95); padding: 35px; border-radius: 24px; box-shadow: 0 20px 50px rgba(0,0,0,0.1); text-align: center; width: 320px; backdrop-filter: blur(10px); animation: popIn 0.4s ease; }
@keyframes popIn { from { transform: scale(0.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.login-box h2 { color: #2e7d32; margin-bottom: 10px; font-size: 1.6em; font-weight: 800; }
.login-subtitle { font-size: 0.9em; color: #666; margin-bottom: 20px; display: block; }
.login-input { width: 100%; padding: 12px 15px; margin: 8px 0; border: 2px solid #e0e0e0; border-radius: 12px; box-sizing: border-box; font-size: 15px; background: #f9f9f9; }
.captcha-container { display: none; margin-top: 15px; background: #fffde7; border: 2px dashed #ffd54f; border-radius: 12px; padding: 12px; }
.captcha-title { font-size: 0.85em; color: #f57c00; font-weight: bold; margin-bottom: 8px; display: block; text-align: left;}
.captcha-question { font-size: 1.3em; font-weight: 900; color: #333; margin-bottom: 12px; font-family: monospace; letter-spacing: 1px; }
.captcha-options { display: flex; justify-content: space-between; gap: 8px; }
.captcha-option { flex: 1; padding: 8px 0; border-radius: 8px; background: white; border: 2px solid #e0e0e0; font-weight: bold; color: #555; cursor: pointer; transition: all 0.1s; font-size: 1.1em; }
.captcha-option.selected { background: #4caf50; color: white; border-color: #4caf50; }
.captcha-option.error { background: #ef5350; color: white; border-color: #ef5350; animation: shake 0.3s; }
@keyframes shake { 0%, 100% {transform: translateX(0);} 25% {transform: translateX(-5px);} 75% {transform: translateX(5px);} }
.login-btn { width: 100%; padding: 12px; background: linear-gradient(to right, #43a047, #2e7d32); color: white; border: none; border-radius: 12px; font-size: 16px; cursor: pointer; font-weight: bold; margin-top: 20px; }
.login-btn.disabled { opacity: 0.5; pointer-events: none; background: #ccc; }
.switch-btn { background: none; border: none; color: #666; cursor: pointer; margin-top: 15px; font-size: 13px; text-decoration: underline; }

#actionSheetOverlay, .overlay, .modal { background: rgba(0,0,0,0.5); }
.modal { align-items: center; justify-content: center; padding: 20px; box-sizing: border-box; z-index: 1000; }
.modal-content { background: white; padding: 30px; border-radius: 12px; width: 500px; max-width: 100%; max-height: 90vh; overflow-y: auto; box-shadow: 0 10px 25px rgba(0,0,0,0.2); animation: fadeIn 0.3s; }
.form-control { width: 100%; padding: 10px; border: 1px solid #ddd; border-radius: 6px; box-sizing: border-box; font-size: 16px; }
textarea.form-control { resize: vertical; min-height: 100px; }

/* 闪卡记忆 */
#flashcardModal { background: rgba(0,0,0,0.6); z-index: 9999; justify-content: center; align-items: center; backdrop-filter: blur(5px); }
.flash-container { width: 420px; max-width: 90%; height: auto; max-height: 90vh; background: #fff; border-radius: 24px; box-shadow: 0 20px 60px rgba(0,0,0,0.3); display: flex; flex-direction: column; overflow: hidden; border: none; position: relative; }
.flash-top-nav { padding: 10px 20px; background: white; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #eee; min-height: 55px; }
.flash-close-btn { font-size: 28px; cursor: pointer; color: #555; background: none; border: none; line-height: 1; font-weight: 300; transition: color 0.2s;}
.flash-close-btn:hover { color: #e74c3c; }
.flash-nav-ctrl { display: flex; align-items: center; background: #e8f5e9; border-radius: 30px; padding: 4px; gap: 5px; box-shadow: inset 0 1px 3px rgba(0,0,0,0.05); }
.nav-pill-btn { border: none; background: white; color: var(--primary-color); width: 32px; height: 32px; border-radius: 50%; font-size: 14px; cursor: pointer; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 4px rgba(0,0,0,0.1); transition: all 0.2s; }
.nav-pill-btn:active { transform: scale(0.9); }
.flash-progress-pill { font-size: 14px; font-weight: 800; color: #2e7d32; padding: 0 10px; }
.trans-pill-btn { padding: 6px 12px; border-radius: 20px; background: white; border: 1px solid #e0e0e0; color: #555; font-size: 12px; font-weight: bold; cursor: pointer; display: flex; align-items: center; gap: 4px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); }
.trans-pill-btn:active { background: #f5f5f5; transform: translateY(1px); }
.flash-scroll-area { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 25px 30px; display: flex; flex-direction: column; gap: 15px; width: 100%; box-sizing: border-box; }
.flash-footer { padding: 20px 30px; background: white; border-top: 1px solid #eee; flex-shrink: 0; }
.f-card { background: transparent; border-radius: 0; padding: 0 0 15px 0; box-shadow: none; border: none; border-bottom: 1px dashed #eee; margin-bottom: 10px; animation: slideInRight 0.3s ease; }
@keyframes slideInRight { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.f-word-row { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; flex-wrap: wrap;}
.f-word { font-size: 2.2em; font-weight: 800; color: #333; transition: all 0.3s; margin-bottom: 0; line-height: 1.1; }
.f-ipa { color: #888; font-family: Consolas, monospace; font-size: 1.2em; }
.inline-speak-btn { font-size: 1.2em; margin-left: 8px; cursor: pointer; color: var(--primary-color); background: none; border: none; vertical-align: middle; }
.f-tag-row { margin-bottom: 15px; }
.f-tag-row .tag-badge { font-size: 0.85em; padding: 3px 10px; border-radius: 8px; }
.masked-word { filter: blur(8px); cursor: pointer; user-select: none; opacity: 0.7; }
.f-meaning-box { font-size: 1.2em; line-height: 1.5; color: #444; padding-bottom: 10px; margin-bottom: 10px; transition: all 0.3s; }
.f-meaning-box.masked { filter: blur(6px); cursor: pointer; user-select: none; opacity: 0.6; }
.f-meaning-box.revealed { filter: none; opacity: 1; cursor: text; user-select: text; }
.f-phrase-inline { display: block; margin-top: 8px; color: #666; font-size: 0.9em; font-style: italic; border-top: 1px dotted #eee; padding-top: 6px; }
.game-timer-box { background: linear-gradient(to right, #f8f9fa, #e8f5e9); border-radius: 12px; padding: 8px 15px; margin-top: 5px; border: 1px solid #c8e6c9; display: flex; align-items: center; justify-content: space-between; position: relative; overflow: hidden; }
.timer-left { display: flex; align-items: center; gap: 8px; z-index: 2; }
.timer-icon { font-size: 18px; animation: pulse 1s infinite; }
@keyframes pulse { 0% { transform: scale(1); } 50% { transform: scale(1.2); } 100% { transform: scale(1); } }
.timer-text { font-family: 'Courier New', monospace; font-size: 20px; font-weight: 900; color: #2e7d32; }
.timer-rank { font-size: 12px; font-weight: bold; color: white; padding: 4px 10px; border-radius: 10px; z-index: 2; transition: background-color 0.3s; }
.rank-god { background: linear-gradient(135deg, #ab47bc, #8e24aa); box-shadow: 0 2px 5px rgba(142, 36, 170, 0.3); }
.rank-fast { background: linear-gradient(135deg, #43a047, #2e7d32); }
.rank-avg { background: linear-gradient(135deg, #fbc02d, #f57f17); }
.rank-slow { background: linear-gradient(135deg, #ef5350, #c62828); }
.quiz-container { margin-top: 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.quiz-option { padding: 12px 15px; border: 2px solid #eee; border-radius: 12px; background: white; color: #555; font-size: 15px; font-weight: bold; cursor: pointer; transition: all 0.2s; text-align: left; position: relative; overflow: hidden; display: flex; align-items: center; min-height: 50px; touch-action: manipulation; -webkit-tap-highlight-color: transparent; line-height: 1.3; }
.quiz-option:hover { background-color: #f9f9f9; transform: translateY(-2px); border-color: #ddd; }
.quiz-option:active { transform: scale(0.98); }
.quiz-correct { background-color: #e8f5e9 !important; border-color: #4caf50 !important; color: #2e7d32 !important; box-shadow: 0 4px 10px rgba(76, 175, 80, 0.2); }
.quiz-correct::after { content: '✔'; position: absolute; right: 10px; font-weight: 900; }
.quiz-wrong { background-color: #ffebee !important; border-color: #ef5350 !important; color: #c62828 !important; animation: shake 0.4s; }
.quiz-wrong::after { content: '✘'; position: absolute; right: 10px; font-weight: 900; }
.status-btn-row { display: flex; gap: 15px; margin: 0; opacity: 1; transition: all 0.3s; }
.status-btn-row.disabled { opacity: 0.5; pointer-events: none; filter: grayscale(0.5); }
.status-btn.btn-disabled-style { opacity: 0.3 !important; cursor: not-allowed !important; pointer-events: none !important; background: #e0e0e0 !important; color: #999 !important; box-shadow: none !important; }
.status-btn { flex: 1; padding: 14px 0; border-radius: 10px; border: none; font-size: 14px; font-weight: bold; cursor: pointer; color: white; opacity: 0.9; box-shadow: 0 4px 6px rgba(0,0,0,0.1); }
.status-btn:active { transform: scale(0.95); }
.s-btn-master { background: #66bb6a; }
.s-btn-review { background: #fbc02d; color: #333;}
.s-btn-new { background: #ef5350; }
.mode-hint { background: #fff3e0; color: #e65100; font-size: 12px; padding: 8px 10px; text-align: center; border-bottom: 1px solid #ffe0b2; display: none; }
.mode-reverse .mode-hint { display: block; }
.confetti { position: absolute; width: 8px; height: 8px; background-color: #f00; animation: confetti-fall 1s ease-out forwards; pointer-events: none; z-index: 9999; border-radius: 2px; }
@keyframes confetti-fall { 0% { transform: translate(0, 0) rotate(0deg); opacity: 1; } 100% { transform: translate(var(--tx), var(--ty)) rotate(720deg); opacity: 0; } }

/* 结算弹窗 */
#completionModal { background: rgba(0,0,0,0.7); z-index: 10001; justify-content: center; align-items: center; backdrop-filter: blur(8px); }
.completion-box { background: white; width: 340px; padding: 40px 30px; border-radius: 24px; text-align: center; box-shadow: 0 25px 50px rgba(0,0,0,0.25); animation: popIn 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55); position: relative; overflow: hidden; }
.completion-icon { font-size: 60px; margin-bottom: 10px; animation: float 3s ease-in-out infinite; }
.completion-box h2 { color: #2e7d32; margin: 0 0 10px 0; font-size: 24px; font-weight: 800; }
.completion-quote { color: #666; font-size: 14px; margin-bottom: 25px; line-height: 1.5; font-style: italic; }
.completion-stats { display: flex; justify-content: space-around; margin-bottom: 30px; }
.stat-bubble { background: #f1f8e9; padding: 10px 15px; border-radius: 12px; min-width: 80px; }
.stat-val { display: block; font-size: 20px; font-weight: 900; color: #2e7d32; }
.stat-label { font-size: 12px; color: #888; font-weight: bold; }
@keyframes float { 0% { transform: translateY(0px); } 50% { transform: translateY(-10px); } 100% { transform: translateY(0px); } }
.completion-actions { display: flex; flex-direction: column; gap: 12px; margin-top: 25px; width: 100%; }
.c-btn { width: 100%; padding: 14px; border-radius: 12px; border: none; font-weight: 800; font-size: 15px; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 6px; transition: transform 0.1s; }
.c-btn:active { transform: scale(0.98); }
.c-btn-red { background: linear-gradient(135deg, #ff5252, #e53935); color: white; box-shadow: 0 4px 10px rgba(211, 47, 47, 0.3); }
.c-btn-green { background: linear-gradient(135deg, #66bb6a, #43a047); color: white; box-shadow: 0 4px 10px rgba(56, 142, 60, 0.3); }
.c-btn-gray { background: #f5f5f5; color: #666; border: 1px solid #eee; }

/* 默写模式 */
#dictationModal { background: rgba(0,0,0,0.6); z-index: 11000; justify-content: center; align-items: center; backdrop-filter: blur(5px); }
.dic-scroll-area { justify-content:center; align-items:center; text-align:center; display:flex; flex-direction:column; width:100%; height:100%; }
.dic-card { background: white; border-radius: 20px; padding: 25px 20px; width: 100%; max-width: 320px; box-shadow: 0 10px 30px rgba(0,0,0,0.05); margin-bottom: 20px; position: relative; border: 1px solid #eef2f5; transition: transform 0.3s; }
.dic-card:hover { transform: translateY(-3px); }
.dic-question-text { font-size: 2.2em; font-weight: 900; color: #333; margin: 15px 0; line-height: 1.2; }
.dic-mode-badge { font-size: 12px; color: #999; background: #f5f5f5; padding: 4px 10px; border-radius: 12px; display: inline-block; font-weight: bold; }
.dic-mascot { font-size: 40px; margin-bottom: -15px; z-index: 2; position: relative; animation: float 3s ease-in-out infinite; }
.dic-tags { display: flex; justify-content: center; gap: 5px; flex-wrap: wrap; margin-top: 5px; }
.dic-input-wrapper { width: 100%; max-width: 320px; position: relative; margin-bottom: 10px; display: flex; align-items: center; }
.input-icon { position: absolute; left: 15px; font-size: 20px; opacity: 0.6; z-index: 10; }
.dic-input { width: 100%; padding: 15px 15px 15px 45px; font-size: 20px; text-align: left; border: none; border-bottom: 3px solid #e0e0e0; background: white; color: #333; border-radius: 12px 12px 0 0; outline: none; font-family: Consolas, monospace; font-weight: bold; transition: all 0.3s; }
.dic-input:focus { border-bottom-color: #43a047; background: #fff; box-shadow: 0 -4px 10px rgba(0,0,0,0.03); }
.dic-input.correct { border-bottom-color: #66bb6a; background-color: #e8f5e9; color: #2e7d32; }
.dic-input.wrong { border-bottom-color: #ef5350; background-color: #ffebee; color: #c62828; animation: shake 0.4s; }
.dic-input.masked { color: transparent; text-shadow: 0 0 18px rgba(0,0,0,0.5); pointer-events: none; background-color: #eee; border-color: #ccc; }
.input-feedback-text { height: 20px; font-size: 13px; font-weight: bold; color: #ef5350; margin-top: 5px; }
.dic-tools { display: flex; gap: 10px; align-items: center; }
.tool-icon-btn { width: 40px; height: 40px; border-radius: 50%; border: 1px solid #eee; background: white; display: flex; justify-content: center; align-items: center; font-size: 18px; cursor: pointer; color: #555; box-shadow: 0 2px 5px rgba(0,0,0,0.05); transition: 0.2s; }
.tool-icon-btn:hover { background: #f0f0f0; }
.tool-icon-btn.active { background: #e3f2fd; color: #1976d2; border-color: #bbdefb; }
.dic-submit-btn { padding: 10px 25px; border-radius: 20px; border: none; background: linear-gradient(135deg, #2e7d32, #43a047); color: white; font-size: 16px; font-weight: bold; cursor: pointer; box-shadow: 0 4px 10px rgba(46, 125, 50, 0.3); transition: 0.2s; }
.dic-submit-btn:active { transform: translateY(2px); }
.dic-canvas-wrapper { width: 100%; height: 180px; background: #333; border-radius: 12px; position: relative; overflow: hidden; border: 4px solid #444; cursor: crosshair; display: none; margin-bottom: 20px; }
.dic-canvas-wrapper.active { display: block; animation: fadeIn 0.3s; }
canvas#handwritingBoard { width: 100%; height: 100%; touch-action: none; }
.canvas-tools { position: absolute; bottom: 10px; right: 10px; display: flex; gap: 5px; }
.canvas-btn { background: rgba(255,255,255,0.2); border: 1px solid rgba(255,255,255,0.3); color: white; padding: 4px 8px; border-radius: 6px; cursor: pointer; font-size: 12px; }
.dic-feedback-box { margin-top: 15px; display: none; width: 100%; text-align: center; }
.dic-self-check-btns { display: none; width: 100%; gap: 10px; margin-top: 15px; }
.self-check-btn { flex: 1; padding: 12px; border: none; border-radius: 10px; font-weight: bold; font-size: 15px; cursor: pointer; color: white; box-shadow: 0 4px 6px rgba(0,0,0,0.1); }
.sc-yes { background: linear-gradient(135deg, #66bb6a, #43a047); }
.sc-no { background: linear-gradient(135deg, #ef5350, #c62828); }

/* 反馈动画 */
.feedback-anim { font-size: 1.6em; font-weight: 900; color: #ff6f00; text-shadow: 0 2px 0 #fff, 0 4px 0 rgba(0,0,0,0.1); animation: bounceIn 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55); }
@keyframes bounceIn { 0%{transform:scale(0);} 80%{transform:scale(1.15);} 100%{transform:scale(1);} }

/* 默写结算 */
#dictationSummaryModal { background: rgba(0,0,0,0.7); z-index: 12000; justify-content: center; align-items: center; backdrop-filter: blur(5px); }
.summary-box { background: white; width: 90%; max-width: 450px; border-radius: 20px; padding: 25px; box-shadow: 0 20px 60px rgba(0,0,0,0.3); text-align: center; max-height: 80vh; overflow-y: auto; display:flex; flex-direction:column; }
.summary-score { font-size: 4em; font-weight: 900; color: #2e7d32; line-height:1; margin-bottom:10px; }
.summary-label { color: #888; font-size: 0.9em; text-transform:uppercase; letter-spacing:1px; margin-bottom:20px; display:block; }
.summary-wrong-list { text-align: left; background: #fff8e1; border-radius: 12px; padding: 15px; margin-bottom: 20px; border: 2px dashed #ffe082; }
.summary-wrong-title { color: #f57f17; font-weight:bold; margin-bottom:10px; font-size:0.9em; }
.summary-item { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid rgba(0,0,0,0.05); font-size: 14px; }
.summary-item:last-child { border-bottom: none; }
.w-word { font-weight:bold; color:#c62828; }
.w-mean { color:#666; max-width: 150px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 悬浮按钮 */
#backToTop {
    display: none; position: fixed; bottom: 30px; right: 30px; z-index: 99;
    font-size: 20px; border: none; outline: none; background-color: var(--primary-color); color: white;
    cursor: pointer; padding: 12px; border-radius: 50%; width: 50px; height: 50px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3); transition: all 0.3s;
}
#backToTop:hover { background-color: var(--accent-color); transform: translateY(-3px); }

/* 手机端底部菜单 */
#actionSheet { position: fixed; left: 0; bottom: 0; width: 100%; background: #fff; border-radius: 20px 20px 0 0; padding: 25px 20px; box-sizing: border-box; z-index: 2001; transform: translateY(100%); transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1); box-shadow: 0 -5px 20px rgba(0,0,0,0.1); }
#actionSheet.active { transform: translateY(0); }
.sheet-title { text-align: center; font-weight: bold; color: #333; margin-bottom: 25px; font-size: 1.2em; }
.sheet-actions { display: flex; justify-content: space-between; gap: 15px; }
.sheet-btn { flex: 1; padding: 18px 0; border: none; border-radius: 16px; font-size: 15px; font-weight: 800; color: white; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 8px; transition: transform 0.1s; }
.sheet-btn:active { transform: scale(0.96); }
.sheet-btn span { font-size: 2.4em; filter: drop-shadow(0 2px 3px rgba(0,0,0,0.2)); }
.s-btn-red { background: linear-gradient(135deg, #ff5252, #e53935); box-shadow: 0 6px 15px rgba(255, 82, 82, 0.4); }
.s-btn-yellow { background: linear-gradient(135deg, #ffca28, #fbc02d); box-shadow: 0 6px 15px rgba(255, 202, 40, 0.4); color: #333; }
.s-btn-green { background: linear-gradient(135deg, #66bb6a, #43a047); box-shadow: 0 6px 15px rgba(102, 187, 106, 0.4); }
.sheet-cancel { margin-top: 25px; width: 100%; padding: 15px; border: none; background: #f5f5f5; color: #666; border-radius: 12px; font-weight: bold; cursor: pointer; font-size: 16px; }

/* 移动端覆盖 */
.mobile-menu-btn { display: none; }
@media screen and (max-width: 768px) {
    .sidebar { position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-100%); width: 280px; z-index: 999; }
    .sidebar.active { transform: translateX(0); }
    .overlay { display: none; } .overlay.active { display: block; }
    .mobile-menu-btn { display: flex; position: fixed; left: 15px; bottom: 20px; background: var(--primary-color); color: white; border: none; width: 50px; height: 50px; border-radius: 50%; box-shadow: 0 4px 10px rgba(0,0,0,0.3); z-index: 600; font-size: 24px; cursor: pointer; align-items: center; justify-content: center; }
    .main-content { padding: 15px 12px; width: 100%; box-sizing: border-box; }
    .dashboard { padding: 15px; border-radius: 0 0 15px 15px; margin: -15px -12px 15px -12px; }
    .family-header { flex-direction: column; align-items: flex-start; padding: 12px 15px; }
    .header-actions { width: 100%; justify-content: space-between; margin-top: 10px; }
    /* 🚀 核心修复：强制在手机端显示眼睛按钮 */
    .mobile-only { display: inline-flex !important; }
    .delete-family-btn.mobile-hide, .print-btn.mobile-hide { display: none; }
    th .toggle-eye { display: none; }
    
    thead { display: none; }
    tr { display: flex; flex-wrap: nowrap; align-items: center; padding: 10px 2px; border-bottom: 1px solid #eee; background: #fff; }
    td { padding: 0; border: none !important; box-sizing: border-box; display: block; }
    .col-word { order: 1; flex: 0 0 23%; max-width: 23%; font-size: 1.1em; overflow: hidden; display: flex; align-items: center; padding-left: 8px; }
    .col-action { order: 2; flex: 0 0 9%; display: flex; justify-content: flex-start; padding-left: 0; }
    .col-mean { order: 3; flex: 1; min-width: 0; font-size: 0.95em; color: #555; text-align: left; margin-left: -40px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
    .col-ipa, .col-phrase, .col-mean .tag { display: none !important; }
    .action-wrapper .status-dot, .action-wrapper .btn-white { display: none; }
    .mobile-status-trigger { display: block; width: 26px; height: 26px; border-radius: 50%; border: 3px solid #eee; cursor: pointer; background-color: #e0e0e0; }
    .trigger-red { background-color: #ff5252; border-color: #ffcdd2; }
    .trigger-yellow { background-color: #ffca28; border-color: #ffecb3; }
    .trigger-green { background-color: #66bb6a; border-color: #c8e6c9; }
}
@media screen and (min-width: 769px) { #actionSheet, #actionSheetOverlay { display: none !important; } .mobile-status-trigger { display: none; } }

@keyframes slideUp { from { transform: translateY(50px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }