/* ==================== GI食物小课堂 - 游戏化风格 V7.0 ====================
   V7.0: header flex重构 + 声音选中醒目 + 弹窗开关按钮
   主色: #28544d  配色体系基于深湖绿
   ================================================================== */

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

:root {
  --primary: #28544d;
  --primary-light: #3a7a6f;
  --primary-lighter: #4a9e8f;
  --primary-dark: #1c3d38;
  --primary-glow: rgba(40, 84, 77, 0.15);
  --accent: #f0a500;
  --accent-light: #ffd166;
  --accent-dark: #c88400;
  --success: #2ecc71;
  --success-light: #a8e6cf;
  --warning: #f39c12;
  --warning-light: #ffeaa7;
  --danger: #e74c3c;
  --danger-light: #fab1a0;
  --info: #3498db;
  --bg: #f0f5f3;
  --bg-dark: #e4ede9;
  --card-bg: #FFFFFF;
  --text: #1a2e2a;
  --text-secondary: #5a7a72;
  --text-light: #8fa8a0;
  --border: #d4e0dc;
  --border-light: #e8f0ec;
  --shadow: 0 4px 20px rgba(40, 84, 77, 0.08);
  --shadow-lg: 0 8px 32px rgba(40, 84, 77, 0.12);
  --shadow-glow: 0 4px 20px rgba(40, 84, 77, 0.25);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 24px;
  --gradient-primary: linear-gradient(135deg, #28544d, #3a7a6f);
  --gradient-accent: linear-gradient(135deg, #f0a500, #ffd166);
  --gradient-warm: linear-gradient(135deg, #28544d, #2ecc71);
  --gradient-hero: linear-gradient(135deg, #1c3d38 0%, #28544d 40%, #3a7a6f 100%);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.app { max-width: 520px; margin: 0 auto; min-height: 100vh; position: relative; background: var(--bg); }

/* ============ Auth Pages ============ */
.auth-page {
  display: none; min-height: 100vh;
  background: var(--gradient-hero);
  justify-content: center; align-items: center; padding: 20px;
  position: relative; overflow: hidden;
}
.auth-page::before {
  content: ''; position: absolute; width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(240,165,0,0.08) 0%, transparent 70%);
  top: -200px; right: -200px; border-radius: 50%;
}
.auth-page::after {
  content: ''; position: absolute; width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(46,204,113,0.06) 0%, transparent 70%);
  bottom: -100px; left: -100px; border-radius: 50%;
}
.auth-page.active { display: flex; }

.auth-card {
  background: rgba(255,255,255,0.97);
  border-radius: var(--radius-lg); padding: 44px 32px; width: 100%; max-width: 420px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.2);
  position: relative; z-index: 1;
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.3);
}
.auth-card h2 {
  text-align: center; margin-bottom: 6px; font-size: 28px;
  background: var(--gradient-primary); -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.auth-card .subtitle { text-align: center; color: var(--text-secondary); margin-bottom: 32px; font-size: 14px; }

.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 600; color: var(--text); letter-spacing: 0.3px; }
.form-group input, .form-group select {
  width: 100%; padding: 14px 18px; border: 2px solid var(--border);
  border-radius: var(--radius-sm); font-size: 15px;
  transition: all 0.3s; outline: none; -webkit-appearance: none;
  background: var(--bg);
}
.form-group input:focus, .form-group select:focus {
  border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-glow);
  background: #fff;
}

.btn {
  display: block; width: 100%; padding: 15px; border: none;
  border-radius: var(--radius-sm); font-size: 16px; font-weight: 700;
  cursor: pointer; transition: all 0.3s; text-align: center;
  position: relative; overflow: hidden;
}
.btn::after {
  content: ''; position: absolute; top: 50%; left: 50%;
  width: 0; height: 0; border-radius: 50%;
  background: rgba(255,255,255,0.2);
  transition: width 0.4s, height 0.4s, top 0.4s, left 0.4s;
}
.btn:active::after { width: 300px; height: 300px; top: -100px; left: -100px; }

.btn-primary {
  background: var(--gradient-primary); color: white;
  box-shadow: 0 4px 15px rgba(40,84,77,0.3);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: var(--shadow-glow); }
.btn-primary:active { transform: translateY(0); }

.btn-outline { background: transparent; color: var(--primary); border: 2px solid var(--primary); margin-top: 12px; }
.btn-danger { background: linear-gradient(135deg, var(--danger), #c0392b); color: white; box-shadow: 0 4px 15px rgba(231,76,60,0.3); }

.auth-switch { text-align: center; margin-top: 24px; font-size: 14px; color: var(--text-secondary); }
.auth-switch a { color: var(--accent-dark); text-decoration: none; font-weight: 700; cursor: pointer; }

/* ============ Header V7.0 - flex布局，标题居左，按钮居右不遮挡 ============ */
.header {
  background: var(--gradient-hero);
  color: white; padding: 16px 16px 18px;
  position: sticky; top: 0; z-index: 100;
  border-bottom-left-radius: 20px; border-bottom-right-radius: 20px;
  box-shadow: 0 4px 20px rgba(28,61,56,0.3);
  display: flex; align-items: center; justify-content: space-between;
}
.header::after {
  content: ''; position: absolute; bottom: -8px; left: 50%;
  transform: translateX(-50%); width: 40px; height: 4px;
  background: var(--accent); border-radius: 2px;
}
.header-left { flex: 1; min-width: 0; }
.header-left h1 {
  font-size: 18px; font-weight: 800; letter-spacing: 0.5px;
  text-shadow: 0 2px 4px rgba(0,0,0,0.2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.header-left p { font-size: 11px; opacity: 0.8; margin-top: 2px; letter-spacing: 0.5px; }
.header-right {
  display: flex; gap: 6px; align-items: center;
  flex-shrink: 0; margin-left: 10px;
}
.header-btn {
  background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.25);
  color: white; padding: 6px 10px; border-radius: 20px;
  font-size: 12px; cursor: pointer; transition: all 0.3s;
  backdrop-filter: blur(10px); white-space: nowrap;
}
.header-btn:hover { background: rgba(255,255,255,0.3); transform: scale(1.05); }

/* ============ Pages ============ */
.page { display: none; padding: 20px 16px; padding-bottom: 100px; position: relative; z-index: 1; }
.page.active { display: block; animation: pageIn 0.3s ease; }
@keyframes pageIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ============ Welcome Card ============ */
.welcome-card {
  background: var(--gradient-warm); color: white;
  border-radius: var(--radius-lg); padding: 24px;
  margin-bottom: 20px; position: relative; overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.welcome-card::before {
  content: '🌿'; position: absolute; right: 16px; top: 50%;
  transform: translateY(-50%); font-size: 48px; opacity: 0.15;
}
.welcome-card h3 { font-size: 20px; margin-bottom: 4px; font-weight: 700; }
.welcome-card p { font-size: 13px; opacity: 0.9; }

/* ============ Section Title ============ */
.section-title { margin-bottom: 14px; }
.section-title h3 {
  font-size: 17px; font-weight: 700; color: var(--text);
  display: flex; align-items: center; gap: 6px;
}
.section-title h3::after {
  content: ''; flex: 1; height: 2px;
  background: linear-gradient(90deg, var(--border), transparent);
  margin-left: 8px;
}

/* ============ Category List ============ */
.category-group { margin-bottom: 20px; }
.category-group-title {
  font-size: 15px; font-weight: 700; color: var(--primary);
  padding: 8px 14px; margin-bottom: 10px;
  background: var(--primary-glow); border-radius: var(--radius-sm);
  border-left: 4px solid var(--primary);
  display: flex; align-items: center; gap: 8px;
}
.category-list {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
}
.category-card {
  background: var(--card-bg); border-radius: var(--radius);
  padding: 14px 8px; box-shadow: var(--shadow);
  cursor: pointer; transition: all 0.3s;
  border: 2px solid transparent; text-align: center;
  position: relative; overflow: hidden;
}
.category-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--gradient-primary); opacity: 0; transition: opacity 0.3s;
}
.category-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--primary-light); }
.category-card:hover::before { opacity: 1; }
.category-card:active { transform: translateY(-1px); }
.category-card .category-icon { font-size: 28px; margin-bottom: 6px; }
.category-card .category-name { font-size: 12px; font-weight: 700; margin-bottom: 3px; color: var(--text); line-height: 1.3; }
.category-card .category-count { font-size: 11px; color: var(--text-light); }
.category-card .category-diff {
  display: inline-block; font-size: 10px; padding: 1px 6px;
  border-radius: 8px; margin-top: 4px; font-weight: 600;
}
.diff-easy { background: var(--success-light); color: #27ae60; }
.diff-medium { background: var(--warning-light); color: #e67e22; }
.diff-hard { background: var(--danger-light); color: #c0392b; }

/* ============ Stats ============ */
.stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
.stat-card {
  background: var(--card-bg); border-radius: var(--radius);
  padding: 18px 10px; text-align: center; box-shadow: var(--shadow);
  position: relative; overflow: hidden;
  transition: transform 0.3s;
}
.stat-card:hover { transform: translateY(-2px); }
.stat-card::before {
  content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 3px;
  background: var(--gradient-accent);
}
.stat-num {
  font-size: 28px; font-weight: 800;
  background: var(--gradient-primary); -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.stat-label { font-size: 11px; color: var(--text-secondary); margin-top: 4px; font-weight: 500; }

/* ============ Exam Page ============ */
.exam-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px; padding: 12px 16px;
  background: var(--card-bg); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.exam-progress { flex: 1; margin-right: 16px; }
.exam-progress-text { font-size: 14px; font-weight: 700; color: var(--primary); }
.progress-bar { height: 8px; background: var(--border-light); border-radius: 4px; margin-top: 6px; overflow: hidden; }
.progress-fill {
  height: 100%; border-radius: 4px; transition: width 0.5s ease;
  background: linear-gradient(90deg, var(--primary), var(--success));
  position: relative;
}
.progress-fill::after {
  content: ''; position: absolute; right: 0; top: 0; width: 20px; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4));
  animation: progressShine 2s infinite;
}
@keyframes progressShine { 0%,100% { opacity: 0.3; } 50% { opacity: 0.8; } }

.exam-timer {
  font-size: 18px; font-weight: 800; color: var(--accent-dark);
  white-space: nowrap; display: flex; align-items: center; gap: 4px;
  background: var(--warning-light); padding: 6px 14px; border-radius: 20px;
}

.exam-card {
  background: var(--card-bg); border-radius: var(--radius-lg);
  padding: 24px 20px; box-shadow: var(--shadow-lg); margin-bottom: 16px;
  border: 1px solid var(--border-light);
  position: relative;
}
.exam-card::before {
  content: ''; position: absolute; top: 0; left: 20px; right: 20px; height: 3px;
  background: var(--gradient-primary); border-radius: 0 0 2px 2px;
}
.question-type {
  display: inline-block; background: var(--primary-glow);
  color: var(--primary); padding: 3px 12px; border-radius: 20px;
  font-size: 12px; font-weight: 600; margin-bottom: 12px;
}
.question-text { font-size: 17px; font-weight: 600; line-height: 1.8; color: var(--text); }
.food-info {
  margin-top: 14px; padding: 12px 16px;
  background: linear-gradient(135deg, #fff7ed, #fff3e0);
  border-radius: var(--radius-sm); font-size: 14px;
  border: 1px solid #ffe0b2;
}
.food-name { font-weight: 700; color: var(--accent-dark); }

/* Options */
.options-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.option-item {
  background: var(--card-bg); border: 2px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px; font-size: 15px;
  cursor: pointer; transition: all 0.3s;
  display: flex; align-items: center; gap: 12px;
  position: relative; overflow: hidden;
}
.option-item::before {
  content: ''; position: absolute; top: 0; left: 0; width: 0; height: 100%;
  background: var(--primary-glow); transition: width 0.3s; z-index: 0;
}
.option-item:hover { border-color: var(--primary-light); transform: translateX(4px); }
.option-item:hover::before { width: 100%; }
.option-item.selected { border-color: var(--primary); background: rgba(40,84,77,0.06); box-shadow: 0 0 0 3px var(--primary-glow); }
.option-item.correct { border-color: var(--success); background: rgba(46,204,113,0.08); }
.option-item.wrong { border-color: var(--danger); background: rgba(231,76,60,0.08); }

.option-letter {
  display: inline-flex; width: 32px; height: 32px; border-radius: 50%;
  background: var(--bg-dark); align-items: center; justify-content: center;
  font-weight: 800; font-size: 14px; color: var(--text-secondary);
  flex-shrink: 0; position: relative; z-index: 1;
  transition: all 0.3s;
}
.option-item.selected .option-letter { background: var(--primary); color: white; box-shadow: 0 2px 8px rgba(40,84,77,0.3); }
.option-item.correct .option-letter { background: var(--success); color: white; }
.option-item.wrong .option-letter { background: var(--danger); color: white; }
.option-text { flex: 1; position: relative; z-index: 1; }

/* Exam Actions */
.exam-actions {
  display: flex; flex-direction: column; gap: 10px;
}
.exam-actions-row {
  display: flex; gap: 8px; justify-content: center; flex-wrap: wrap;
}
.exam-actions-row .btn {
  flex: 1; padding: 12px 6px; font-size: 13px; border-radius: 25px; border: none;
  font-weight: 600; max-width: 120px; min-width: 70px;
}
.btn-prev-exam { background: var(--text-light); color: #fff; }
.btn-mark-exam { background: var(--accent); color: #fff; box-shadow: 0 2px 10px rgba(240,165,0,0.3); }
.btn-mark-exam.marked { background: var(--accent-dark); }
/* ★ V7.0新增：弹窗开关按钮样式 */
.btn-popup-toggle { background: var(--info); color: #fff; box-shadow: 0 2px 10px rgba(52,152,219,0.3); }
.btn-popup-toggle.popup-off { background: #95a5a6; }
.btn-next-exam { background: var(--gradient-primary); color: #fff; box-shadow: 0 2px 10px rgba(40,84,77,0.3); }
.btn-submit-exam {
  background: linear-gradient(135deg, var(--danger), #c0392b); color: #fff;
  padding: 14px; border-radius: 25px; font-size: 16px; font-weight: 700;
  box-shadow: 0 4px 15px rgba(231,76,60,0.3);
  border: none; cursor: pointer; transition: all 0.3s;
}
.btn-submit-exam:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(231,76,60,0.4); }

/* ============ Feedback Modal ============ */
.feedback-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  display: flex; justify-content: center; align-items: center;
  z-index: 9990; backdrop-filter: blur(4px);
  animation: feedbackFadeIn 0.3s ease;
}
@keyframes feedbackFadeIn { from { opacity: 0; } to { opacity: 1; } }

.feedback-modal {
  background: white; border-radius: var(--radius-lg);
  padding: 32px 28px; text-align: center; max-width: 380px; width: 90%;
  animation: feedbackBounce 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  position: relative;
}
@keyframes feedbackBounce { from { transform: scale(0.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.feedback-modal.correct-theme { border-top: 5px solid var(--success); }
.feedback-modal.wrong-theme { border-top: 5px solid var(--danger); }
.feedback-emoji { font-size: 56px; margin-bottom: 8px; animation: emojiPop 0.5s ease; }
@keyframes emojiPop { 0% { transform: scale(0); } 60% { transform: scale(1.2); } 100% { transform: scale(1); } }
.feedback-title { font-size: 22px; font-weight: 800; margin-bottom: 6px; }
.feedback-voice-text { font-size: 14px; color: var(--text-secondary); margin-bottom: 14px; font-style: italic; }

.gi-info-card {
  background: linear-gradient(135deg, #f8fffe, #e8f5f0);
  border-radius: var(--radius-sm); padding: 14px; margin-bottom: 14px;
  border: 1px solid var(--border-light);
}
.gi-food-name { font-size: 16px; font-weight: 700; color: var(--primary); margin-bottom: 4px; }
.gi-value-row { display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 6px; }
.gi-value-num { font-size: 28px; font-weight: 800; color: var(--accent-dark); }
.gi-level-tag {
  display: inline-block; padding: 2px 10px; border-radius: 12px;
  font-size: 12px; font-weight: 700; color: white;
}
.gi-level-high { background: var(--danger); }
.gi-level-medium { background: var(--warning); }
.gi-level-low { background: var(--success); }
.gi-explanation { font-size: 13px; color: var(--text-secondary); line-height: 1.6; }

.feedback-correct-answer {
  background: #fff3e0; border-radius: var(--radius-sm);
  padding: 10px 14px; font-size: 13px; color: #e65100;
  margin-bottom: 10px; font-weight: 600;
}
.feedback-countdown {
  font-size: 13px; color: var(--text-light); margin-bottom: 10px;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.feedback-countdown .cd-num {
  display: inline-flex; width: 28px; height: 28px; border-radius: 50%;
  background: var(--primary); color: white; align-items: center;
  justify-content: center; font-weight: 800; font-size: 14px;
}
.feedback-next-btn {
  background: var(--gradient-primary); color: white;
  border: none; padding: 12px 28px; border-radius: 25px;
  font-size: 15px; font-weight: 700; cursor: pointer;
  transition: all 0.3s; box-shadow: 0 4px 15px rgba(40,84,77,0.3);
}
.feedback-next-btn:hover { transform: translateY(-2px); }

/* ============ Result Page ============ */
#confetti-container {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 9995;
}
.confetti-piece {
  position: absolute; width: 10px; height: 10px;
  opacity: 0; animation: confettiFall 3s ease-in forwards;
}
@keyframes confettiFall {
  0% { opacity: 1; transform: translateY(-20px) rotate(0deg); }
  100% { opacity: 0; transform: translateY(100vh) rotate(720deg); }
}

.result-card {
  background: var(--card-bg); border-radius: var(--radius-lg);
  padding: 32px 24px; text-align: center;
  box-shadow: var(--shadow-lg); position: relative; overflow: hidden;
  border: 1px solid var(--border-light);
}
.result-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px;
  background: var(--gradient-primary);
}
.result-stars { font-size: 36px; margin-bottom: 8px; letter-spacing: 8px; }
.result-icon { font-size: 64px; margin-bottom: 10px; }
.result-title { font-size: 20px; font-weight: 800; color: var(--primary); margin-bottom: 8px; }
.result-score {
  font-size: 56px; font-weight: 900;
  background: var(--gradient-primary); -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.result-score small { font-size: 20px; margin-left: 4px; }
.result-detail {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
  margin-top: 24px; padding-top: 20px; border-top: 2px solid var(--border-light);
}
.detail-item { text-align: center; }
.detail-item span { font-size: 12px; color: var(--text-light); display: block; }
.detail-item strong { font-size: 20px; display: block; margin-top: 4px; font-weight: 800; }

.result-actions {
  display: flex; gap: 12px; justify-content: center; margin-top: 20px; flex-wrap: wrap;
}
.result-actions .btn { width: auto; padding: 12px 28px; border-radius: 25px; font-size: 15px; }

/* ============ Ranking ============ */
.ranking-tabs { display: flex; gap: 8px; margin-bottom: 16px; overflow-x: auto; padding: 2px; }
.ranking-tab {
  padding: 10px 18px; border: 2px solid var(--border); border-radius: 25px;
  background: var(--card-bg); font-size: 13px; font-weight: 600;
  cursor: pointer; white-space: nowrap; transition: all 0.3s;
}
.ranking-tab.active { background: var(--gradient-primary); color: white; border-color: var(--primary); box-shadow: var(--shadow-glow); }

.ranking-item {
  display: flex; align-items: center; background: var(--card-bg);
  border-radius: var(--radius); padding: 14px 16px; margin-bottom: 10px;
  box-shadow: var(--shadow); transition: transform 0.2s;
  border: 1px solid var(--border-light);
}
.ranking-item:hover { transform: translateX(4px); }
.ranking-pos {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 16px; margin-right: 14px;
  background: var(--bg-dark); color: var(--text-secondary);
}
.ranking-pos.top1 { background: linear-gradient(135deg, #FFD700, #FFA500); color: white; font-size: 20px; box-shadow: 0 2px 10px rgba(255,215,0,0.4); }
.ranking-pos.top2 { background: linear-gradient(135deg, #C0C0C0, #A0A0A0); color: white; font-size: 20px; }
.ranking-pos.top3 { background: linear-gradient(135deg, #CD7F32, #B8690E); color: white; font-size: 20px; }
.ranking-info { flex: 1; }
.ranking-name { font-weight: 700; font-size: 15px; color: var(--text); }
.ranking-dept { font-size: 12px; color: var(--text-light); }
.ranking-score {
  font-size: 22px; font-weight: 800;
  background: var(--gradient-primary); -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ============ Profile ============ */
.profile-card {
  background: var(--gradient-hero); color: white;
  border-radius: var(--radius-lg); padding: 32px 24px;
  text-align: center; position: relative; overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.profile-card::before {
  content: ''; position: absolute; top: -50px; right: -50px;
  width: 200px; height: 200px; border-radius: 50%;
  background: rgba(240,165,0,0.08);
}
.profile-avatar { font-size: 56px; margin-bottom: 12px; }
.profile-card h3 { font-size: 22px; margin-bottom: 4px; font-weight: 800; }
.profile-card p { font-size: 13px; opacity: 0.8; }

.record-item {
  background: var(--card-bg); border-radius: var(--radius);
  padding: 16px; margin-bottom: 10px; box-shadow: var(--shadow);
  display: flex; justify-content: space-between; align-items: center;
  border: 1px solid var(--border-light); transition: transform 0.2s;
}
.record-item:hover { transform: translateX(4px); }
.record-info .record-category { font-weight: 700; font-size: 14px; color: var(--text); }
.record-info .record-date { font-size: 12px; color: var(--text-light); }
.record-score {
  font-size: 24px; font-weight: 800;
  background: var(--gradient-primary); -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}

.edit-profile-form {
  background: var(--card-bg); border-radius: var(--radius);
  padding: 24px; box-shadow: var(--shadow);
}

/* ============ Admin ============ */
.admin-tabs { display: flex; gap: 8px; margin-bottom: 16px; overflow-x: auto; }
.admin-tab {
  padding: 10px 18px; border: 2px solid var(--border); border-radius: 25px;
  background: var(--card-bg); font-size: 13px; font-weight: 600;
  cursor: pointer; white-space: nowrap; transition: all 0.3s;
}
.admin-tab.active { background: var(--gradient-primary); color: white; border-color: var(--primary); }
.admin-panel { display: none; }
.admin-panel.active { display: block; }
.admin-toolbar { display: flex; gap: 10px; margin-bottom: 16px; align-items: center; }
.admin-search {
  padding: 10px 16px; border: 2px solid var(--border); border-radius: var(--radius-sm);
  font-size: 14px; flex: 1; outline: none; transition: border-color 0.3s;
}
.admin-search:focus { border-color: var(--primary); }
.admin-table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-table th {
  background: var(--bg-dark); padding: 12px 10px; text-align: left;
  font-weight: 700; white-space: nowrap; border-bottom: 2px solid var(--border);
  color: var(--text-secondary);
}
.admin-table td { padding: 12px 10px; border-bottom: 1px solid var(--border-light); }
.btn-small {
  padding: 5px 12px; font-size: 12px; border-radius: 8px;
  border: 1px solid var(--border); background: white; cursor: pointer;
  margin-right: 4px; transition: all 0.2s; font-weight: 600;
}
.btn-small.btn-danger { color: var(--danger); border-color: var(--danger); }
.btn-small.btn-danger:hover { background: var(--danger); color: white; }
.admin-q-item {
  background: var(--card-bg); border-radius: var(--radius);
  padding: 16px; margin-bottom: 10px; box-shadow: var(--shadow);
  border: 1px solid var(--border-light);
}
.admin-q-text { font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.admin-q-meta { font-size: 12px; color: var(--text-secondary); display: flex; gap: 10px; align-items: center; }

/* ============ Bottom Nav ============ */
.bottom-nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 520px;
  background: rgba(255,255,255,0.95); backdrop-filter: blur(20px);
  display: flex; justify-content: space-around;
  padding: 6px 0 env(safe-area-inset-bottom, 6px);
  box-shadow: 0 -4px 20px rgba(40,84,77,0.08);
  z-index: 100; border-top: 1px solid var(--border-light);
  border-radius: 20px 20px 0 0;
}
.nav-item {
  display: flex; flex-direction: column; align-items: center;
  cursor: pointer; padding: 6px 0; flex: 1;
  transition: all 0.3s; position: relative;
}
.nav-item::after {
  content: ''; position: absolute; top: -1px; left: 50%;
  transform: translateX(-50%); width: 0; height: 3px;
  background: var(--primary); border-radius: 0 0 3px 3px;
  transition: width 0.3s;
}
.nav-item.active::after { width: 24px; }
.nav-icon { font-size: 22px; transition: transform 0.3s; }
.nav-item.active .nav-icon { transform: scale(1.1); }
.nav-label { font-size: 10px; color: var(--text-light); margin-top: 2px; font-weight: 500; }
.nav-item.active .nav-label { color: var(--primary); font-weight: 700; }

/* ============ Voice Modal V7.1 - 小屏适配+选中醒目 ============ */
.voice-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
  display: flex; justify-content: center; align-items: center;
  z-index: 9999; padding: 12px;
}
.voice-modal {
  background: white; border-radius: var(--radius-lg);
  max-width: 440px; width: 100%; text-align: center;
  animation: voiceModalIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  max-height: calc(100vh - 24px); overflow-y: auto; padding: 20px 18px;
}
@keyframes voiceModalIn { from { transform: scale(0.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.voice-modal-icon { font-size: 36px; margin-bottom: 4px; }
.voice-modal h2 { font-size: 18px; color: var(--text); margin-bottom: 2px; font-weight: 800; }
.voice-modal-desc { font-size: 12px; color: var(--text-secondary); margin-bottom: 14px; }

.voice-section { margin-bottom: 12px; text-align: left; }
.voice-label { font-size: 12px; font-weight: 700; color: var(--text); margin-bottom: 6px; display: block; }

.voice-gender-options, .voice-lang-options { display: flex; gap: 6px; margin-bottom: 6px; }
.voice-gender-btn, .voice-lang-btn {
  flex: 1; padding: 8px 6px; border: 2px solid var(--border);
  border-radius: var(--radius-sm); background: var(--bg);
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: all 0.3s; text-align: center;
}
.voice-gender-btn.active, .voice-lang-btn.active {
  border-color: var(--primary-dark); background: var(--primary);
  color: #fff; font-weight: 800;
  box-shadow: 0 3px 12px rgba(40,84,77,0.4);
}
.voice-gender-btn:hover, .voice-lang-btn:hover { border-color: var(--primary-light); }

.voice-style-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px;
  max-height: 180px; overflow-y: auto; padding: 2px;
}
.voice-style-card {
  padding: 10px 8px; border: 2px solid var(--border);
  border-radius: var(--radius-sm); background: var(--bg);
  cursor: pointer; transition: all 0.3s; text-align: center;
}
.voice-style-card:hover { border-color: var(--primary-light); transform: translateY(-1px); }
.voice-style-card.active {
  border-color: var(--primary-dark); border-width: 3px;
  background: var(--primary); color: #fff;
  box-shadow: 0 4px 16px rgba(40,84,77,0.5);
  transform: translateY(-2px);
}
.voice-style-card.active .voice-style-name { color: #fff; font-weight: 800; }
.voice-style-card.active .voice-style-desc { color: rgba(255,255,255,0.85); }
.voice-style-emoji { font-size: 20px; margin-bottom: 2px; }
.voice-style-name { font-size: 11px; font-weight: 700; color: var(--text); }
.voice-style-desc { font-size: 10px; color: var(--text-light); margin-top: 1px; }

.voice-actions { display: flex; gap: 8px; margin-top: 12px; }
.voice-preview-btn {
  flex: 1; padding: 10px; border: 2px solid var(--primary);
  border-radius: 25px; background: white; color: var(--primary);
  font-size: 13px; font-weight: 700; cursor: pointer; transition: all 0.3s;
}
.voice-preview-btn:hover { background: var(--primary-glow); }
.voice-confirm-btn {
  flex: 2; padding: 10px; border: none; border-radius: 25px;
  background: var(--gradient-primary); color: white;
  font-size: 15px; font-weight: 700; cursor: pointer;
  box-shadow: 0 4px 15px rgba(40,84,77,0.3); transition: all 0.3s;
}
.voice-confirm-btn:hover { transform: translateY(-2px); }
/* ============ Toast ============ */
.toast {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%) translateY(-100px);
  background: var(--text); color: white; padding: 14px 28px;
  border-radius: 14px; font-size: 14px; z-index: 99999;
  transition: transform 0.3s ease; max-width: 90%; text-align: center;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2); font-weight: 600;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }

/* ============ Loading ============ */
.loading-overlay {
  position: fixed; inset: 0; background: rgba(255,255,255,0.8);
  display: flex; justify-content: center; align-items: center; z-index: 9998;
  backdrop-filter: blur(4px);
}
.loading-spinner {
  width: 44px; height: 44px; border: 4px solid var(--border);
  border-top-color: var(--primary); border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ Modal ============ */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  display: flex; justify-content: center; align-items: center;
  z-index: 9999; padding: 20px; backdrop-filter: blur(4px);
}
.modal {
  background: white; border-radius: var(--radius-lg);
  width: 100%; max-width: 460px; max-height: 80vh; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px 24px; border-bottom: 1px solid var(--border-light);
}
.modal-header h3 { font-size: 17px; font-weight: 700; }
.modal-close { background: none; border: none; font-size: 24px; cursor: pointer; color: var(--text-secondary); }
.modal-body { padding: 24px; }
.modal-footer {
  padding: 14px 24px; border-top: 1px solid var(--border-light);
  display: flex; gap: 10px; justify-content: flex-end;
}
.modal-footer .btn { width: auto; padding: 10px 24px; font-size: 14px; }

/* ============ Dept Search ============ */
.dept-search-wrap { position: relative; width: 100%; }
.dept-search-input {
  width: 100%; padding: 14px 18px; border: 2px solid var(--border);
  border-radius: var(--radius-sm); font-size: 15px; outline: none;
  transition: all 0.3s; box-sizing: border-box; -webkit-appearance: none;
  background: var(--bg);
}
.dept-search-input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-glow); background: #fff; }
.dept-dropdown {
  display: none; position: absolute; top: 100%; left: 0; right: 0;
  max-height: 240px; overflow-y: auto; background: #fff;
  border: 1px solid var(--border); border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12); z-index: 1000;
}
.dept-item {
  padding: 12px 18px; cursor: pointer; font-size: 14px;
  border-bottom: 1px solid var(--border-light); transition: background 0.15s;
}
.dept-item:hover { background: var(--primary-glow); }
.dept-item:last-child { border-bottom: none; }
.dept-empty { color: var(--text-light); cursor: default; text-align: center; }
.dept-empty:hover { background: transparent; }

/* ============ Explanation Box ============ */
.explanation-box {
  background: linear-gradient(135deg, #f0fdf4, #e8f5e9);
  border: 1px solid #a5d6a7; border-radius: var(--radius-sm);
  padding: 16px; margin-top: 14px; font-size: 14px; line-height: 1.7; color: #1b5e20;
}
.explanation-box .exp-title { font-weight: 800; margin-bottom: 4px; }

/* ============ Knowledge Library ============ */
.knowledge-tabs {
  display: flex; gap: 8px; margin-bottom: 16px;
}
.knowledge-tab-btn {
  flex: 1; padding: 12px 16px; border: 2px solid var(--border);
  border-radius: 25px; background: var(--card-bg);
  font-size: 14px; font-weight: 700; cursor: pointer;
  transition: all 0.3s; text-align: center; color: var(--text);
}
.knowledge-tab-btn.active {
  background: var(--gradient-primary); color: white;
  border-color: var(--primary); box-shadow: var(--shadow-glow);
}
.knowledge-tab-btn:hover:not(.active) {
  border-color: var(--primary-light); background: var(--primary-glow);
}

.knowledge-search-bar {
  display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap;
}
.knowledge-search-input {
  flex: 1; min-width: 150px; padding: 12px 16px;
  border: 2px solid var(--border); border-radius: var(--radius-sm);
  font-size: 14px; outline: none; transition: all 0.3s;
  background: var(--card-bg);
}
.knowledge-search-input:focus {
  border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-glow);
}
.knowledge-filter-select {
  padding: 10px 12px; border: 2px solid var(--border);
  border-radius: var(--radius-sm); font-size: 13px;
  background: var(--card-bg); outline: none; cursor: pointer;
  transition: border-color 0.3s; min-width: 100px;
}
.knowledge-filter-select:focus { border-color: var(--primary); }

.knowledge-stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  margin-bottom: 16px;
}
.knowledge-stat-item {
  background: var(--card-bg); border-radius: var(--radius-sm);
  padding: 12px 8px; text-align: center; box-shadow: var(--shadow);
  border: 1px solid var(--border-light);
}
.knowledge-stat-num {
  font-size: 22px; font-weight: 800;
  background: var(--gradient-primary); -webkit-background-clip: text;
  -webkit-text-fill-color: transparent; background-clip: text;
}
.knowledge-stat-label {
  font-size: 11px; color: var(--text-secondary); margin-top: 2px;
}

.food-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px;
}
.food-card {
  background: var(--card-bg); border-radius: var(--radius);
  padding: 16px 14px; box-shadow: var(--shadow);
  cursor: pointer; transition: all 0.3s;
  border: 2px solid transparent; position: relative; overflow: hidden;
}
.food-card:hover {
  transform: translateY(-3px); box-shadow: var(--shadow-lg);
  border-color: var(--primary-light);
}
.food-card:active { transform: translateY(-1px); }
.food-card-name {
  font-size: 15px; font-weight: 700; color: var(--text);
  margin-bottom: 6px; line-height: 1.3;
}
.food-card-category {
  display: inline-block; font-size: 11px; padding: 2px 8px;
  border-radius: 10px; background: var(--bg-dark);
  color: var(--text-secondary); margin-bottom: 8px;
}
.food-card-gi {
  display: flex; align-items: center; gap: 6px;
}
.food-gi-value {
  font-size: 24px; font-weight: 800;
}
.food-gi-value.gi-high { color: var(--danger); }
.food-gi-value.gi-medium { color: var(--warning); }
.food-gi-value.gi-low { color: var(--success); }
.food-gi-tag {
  display: inline-block; padding: 2px 8px; border-radius: 10px;
  font-size: 11px; font-weight: 700; color: white;
}
.food-gi-tag.gi-tag-high { background: var(--danger); }
.food-gi-tag.gi-tag-medium { background: var(--warning); }
.food-gi-tag.gi-tag-low { background: var(--success); }

.food-detail-header {
  text-align: center; padding-bottom: 16px;
  border-bottom: 1px solid var(--border-light); margin-bottom: 16px;
}
.food-detail-name { font-size: 22px; font-weight: 800; color: var(--text); }
.food-detail-gi {
  font-size: 48px; font-weight: 900; margin: 8px 0;
}
.food-detail-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px;
  margin-bottom: 16px;
}
.food-detail-item {
  background: var(--bg); border-radius: var(--radius-sm);
  padding: 12px; text-align: center;
}
.food-detail-item-label {
  font-size: 11px; color: var(--text-light); margin-bottom: 4px;
}
.food-detail-item-value {
  font-size: 18px; font-weight: 700; color: var(--primary);
}
.food-detail-desc {
  background: linear-gradient(135deg, #f8fffe, #e8f5f0);
  border-radius: var(--radius-sm); padding: 14px;
  font-size: 14px; line-height: 1.7; color: var(--text);
  border: 1px solid var(--border-light);
}
.food-detail-tips {
  background: linear-gradient(135deg, #fffde7, #fff8e1);
  border-radius: var(--radius-sm); padding: 14px;
  font-size: 14px; line-height: 1.7; color: #795548;
  border: 1px solid #ffe082; margin-top: 10px;
}

.article-list { display: flex; flex-direction: column; gap: 10px; }
.article-card {
  background: var(--card-bg); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow); cursor: pointer;
  transition: all 0.3s; border: 1px solid var(--border-light);
}
.article-card:hover {
  transform: translateX(4px); box-shadow: var(--shadow-lg);
  border-color: var(--primary-light);
}
.article-card-header {
  display: flex; align-items: flex-start; gap: 12px; margin-bottom: 8px;
}
.article-card-icon { font-size: 32px; flex-shrink: 0; }
.article-card-title {
  font-size: 15px; font-weight: 700; color: var(--text); line-height: 1.4;
}
.article-card-meta {
  display: flex; gap: 10px; font-size: 12px; color: var(--text-light);
  align-items: center;
}
.article-category {
  display: inline-block; background: var(--primary-glow);
  color: var(--primary); padding: 2px 10px; border-radius: 10px;
  font-size: 11px; font-weight: 600;
}
.article-views { color: var(--text-light); }
.article-summary {
  font-size: 13px; color: var(--text-secondary);
  line-height: 1.5; margin-top: 6px;
}

.food-category-section { margin-bottom: 16px; }
.food-category-title {
  font-size: 14px; font-weight: 700; color: var(--primary);
  padding: 6px 12px; margin-bottom: 8px;
  background: var(--primary-glow); border-radius: var(--radius-sm);
  border-left: 3px solid var(--primary);
  display: flex; align-items: center; gap: 6px;
}

.knowledge-empty {
  text-align: center; padding: 48px 20px; color: var(--text-light);
}
.knowledge-empty-icon { font-size: 48px; margin-bottom: 12px; }
.knowledge-empty-text { font-size: 15px; }

.knowledge-pagination {
  display: flex; justify-content: center; gap: 6px;
  margin-top: 16px; flex-wrap: wrap;
}
.knowledge-page-btn {
  padding: 8px 14px; border: 1px solid var(--border);
  border-radius: 8px; background: var(--card-bg);
  font-size: 13px; cursor: pointer; transition: all 0.2s;
}
.knowledge-page-btn.active {
  background: var(--primary); color: white; border-color: var(--primary);
}
.knowledge-page-btn:hover:not(.active) {
  border-color: var(--primary-light); background: var(--primary-glow);
}

/* ============ Responsive ============ */
@media (max-width: 380px) {
  .category-list { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .category-card { padding: 10px 4px; }
  .category-card .category-name { font-size: 11px; }
  .category-card .category-icon { font-size: 24px; }
  .result-detail { grid-template-columns: repeat(2, 1fr); }
  .voice-style-grid { grid-template-columns: 1fr; }
  .food-grid { grid-template-columns: 1fr; }
  .knowledge-search-bar { flex-direction: column; }
  .knowledge-stats { grid-template-columns: 1fr 1fr 1fr; }
  .header-left h1 { font-size: 16px; }
  .exam-actions-row .btn { min-width: 60px; font-size: 12px; padding: 10px 4px; }
}
