/* ===== CET-6 词汇学习 — 样式表 ===== */
:root {
  --primary: #4f46e5;
  --primary-light: #818cf8;
  --primary-bg: #eef2ff;
  --accent: #f59e0b;
  --accent-bg: #fffbeb;
  --success: #10b981;
  --danger: #ef4444;
  --text: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --border: #e2e8f0;
  --bg: #f8fafc;
  --bg-white: #ffffff;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
  --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,.1), 0 4px 6px rgba(0,0,0,.05);
  --radius: 10px;
  --radius-sm: 6px;
  --transition: 0.2s ease;
}

* { margin:0; padding:0; box-sizing:border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.6; font-size: 15px;
  min-height: 100vh;
}

/* ===== Header ===== */
.header {
  background: var(--bg-white); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100; box-shadow: var(--shadow-sm);
}
.header-inner {
  max-width: 1400px; margin: 0 auto; padding: 12px 24px;
  display: flex; align-items: center; gap: 20px;
}
.logo { font-size: 1.4rem; color: var(--primary); white-space: nowrap; }
.logo span { color: var(--text); font-weight: 400; font-size: 1rem; }

/* Search */
.search-box { position: relative; flex: 1; max-width: 480px; }
.search-box input {
  width: 100%; padding: 10px 44px 10px 16px; border: 2px solid var(--border);
  border-radius: 24px; font-size: 15px; outline: none; background: var(--bg); transition: var(--transition);
}
.search-box input:focus { border-color: var(--primary); background: var(--bg-white); box-shadow: 0 0 0 3px rgba(79,70,229,.1); }
.search-box .btn-icon {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  background: var(--primary); border: none; color: #fff; width: 36px; height: 36px;
  border-radius: 50%; cursor: pointer; font-size: 15px; transition: var(--transition);
}
.search-box .btn-icon:hover { background: var(--primary-light); }

.suggestions-dropdown {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; background: var(--bg-white);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  max-height: 280px; overflow-y: auto; display: none; z-index: 200;
}
.suggestions-dropdown.active { display: block; }
.suggestion-item {
  padding: 10px 16px; cursor: pointer; display: flex; justify-content: space-between; align-items: center;
  border-bottom: 1px solid var(--border); transition: var(--transition);
}
.suggestion-item:last-child { border-bottom: none; }
.suggestion-item:hover, .suggestion-item.active { background: var(--primary-bg); }
.suggestion-item .sw { font-weight: 600; color: var(--text); }
.suggestion-item .sc { font-size: 13px; color: var(--text-secondary); }

.header-nav { display: flex; gap: 8px; }
.btn-nav {
  padding: 8px 16px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-white); cursor: pointer; font-size: 14px; white-space: nowrap; transition: var(--transition);
}
.btn-nav:hover { background: var(--primary-bg); border-color: var(--primary-light); }

/* ===== Main Layout ===== */
.main-layout {
  max-width: 1400px; margin: 0 auto; display: flex; gap: 24px; padding: 20px 24px; min-height: calc(100vh - 70px);
}

/* Sidebar */
.sidebar {
  width: 300px; min-width: 300px; background: var(--bg-white); border-radius: var(--radius);
  border: 1px solid var(--border); box-shadow: var(--shadow-sm); display: flex; flex-direction: column; max-height: calc(100vh - 110px);
}
.sidebar-header { padding: 16px; border-bottom: 1px solid var(--border); }
.sidebar-header h3 { font-size: 1rem; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.count { font-size: 12px; background: var(--primary-bg); color: var(--primary); padding: 2px 8px; border-radius: 10px; font-weight: 500; }
.sidebar-tabs { display: flex; gap: 4px; }
.sidebar-tabs .tab {
  flex: 1; padding: 6px 4px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg); cursor: pointer; font-size: 12px; text-align: center; transition: var(--transition);
}
.sidebar-tabs .tab.active, .sidebar-tabs .tab:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.word-list {
  flex: 1; overflow-y: auto; list-style: none; padding: 8px;
}
.word-list li {
  padding: 8px 12px; cursor: pointer; border-radius: var(--radius-sm); font-size: 14px;
  transition: var(--transition); display: flex; justify-content: space-between; align-items: center;
}
.word-list li:hover { background: var(--primary-bg); }
.word-list li.active { background: var(--primary); color: #fff; }
.word-list li .wl-cn { font-size: 12px; color: var(--text-muted); }
.word-list li.active .wl-cn { color: rgba(255,255,255,.7); }

/* Content */
.content { flex: 1; min-width: 0; }
.view { display: none; }
.view.active { display: block; }

/* Welcome */
.welcome { text-align: center; padding: 60px 20px; }
.welcome-icon { font-size: 64px; margin-bottom: 16px; }
.welcome h2 { font-size: 1.6rem; margin-bottom: 8px; color: var(--text); }
.welcome > p { color: var(--text-secondary); margin-bottom: 30px; }
.welcome-features { display: grid; grid-template-columns: repeat(3,1fr); gap:1px; max-width:720px; margin:0 auto 32px; }
.feature-card { background: var(--bg-white); padding: 24px 16px; border-radius: var(--radius); border: 1px solid var(--border); text-align: center; }
.fc-icon { font-size: 28px; display: block; margin-bottom: 8px; }
.feature-card h4 { font-size: 15px; margin-bottom: 4px; }
.feature-card p { font-size: 13px; color: var(--text-secondary); }
.btn-primary {
  padding: 12px 28px; background: var(--primary); color: #fff; border: none; border-radius: 24px;
  font-size: 15px; cursor: pointer; transition: var(--transition); font-weight: 500;
}
.btn-primary:hover { background: var(--primary-light); transform: translateY(-1px); box-shadow: var(--shadow-md); }

/* Word Detail */
.word-detail { animation: fadeIn .3s ease; }
@keyframes fadeIn { from{opacity:0;transform:translateY(8px)} to{opacity:1;transform:translateY(0)} }

.word-header {
  background: var(--bg-white); border-radius: var(--radius); padding: 24px; margin-bottom: 16px;
  border: 1px solid var(--border); box-shadow: var(--shadow-sm);
}
.word-title { font-size: 2rem; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.word-phonetic { font-size: 1rem; color: var(--text-secondary); margin-bottom: 6px; }
.word-pos { display: inline-block; padding: 2px 10px; background: var(--primary-bg); color: var(--primary); border-radius: 12px; font-size: 13px; font-weight: 500; margin-right: 8px; }
.word-cn { font-size: 1.1rem; color: var(--text-secondary); }
.api-badge { display: inline-block; font-size: 11px; padding: 2px 8px; background: var(--accent-bg); color: var(--accent); border-radius: 10px; margin-left: 8px; }

/* Definition Card */
.def-card {
  background: var(--bg-white); border-radius: var(--radius); padding: 20px 24px; margin-bottom: 16px;
  border: 1px solid var(--border); box-shadow: var(--shadow-sm);
}
.def-card h3 { font-size: 1rem; color: var(--primary); margin-bottom: 12px; display: flex; align-items: center; gap: 6px; }
.def-card h3::before { content: ''; width: 4px; height: 18px; background: var(--primary); border-radius: 2px; display: inline-block; }
.def-text { color: var(--text); line-height: 1.8; margin-bottom: 12px; }

/* Examples */
.examples-list { list-style: none; }
.examples-list li {
  padding: 10px 14px; margin-bottom: 8px; background: var(--bg); border-radius: var(--radius-sm);
  border-left: 3px solid var(--primary-light);
}
.ex-en { color: var(--text); font-style: italic; margin-bottom: 4px; }
.ex-zh { color: var(--text-secondary); font-size: 13px; }

/* Root & Affix */
.root-section {
  background: var(--bg-white); border-radius: var(--radius); padding: 16px 20px; margin-bottom: 16px;
  border: 1px solid var(--border);
}
.root-section h3 { font-size: .95rem; color: var(--primary); margin-bottom: 8px; }
.root-text { color: var(--text-secondary); font-size: 14px; line-height: 1.7; }

/* Phrases */
.phrases-section {
  background: var(--bg-white); border-radius: var(--radius); padding: 16px 20px; margin-bottom: 16px;
  border: 1px solid var(--border);
}
.phrases-section h3 { font-size: .95rem; color: var(--primary); margin-bottom: 8px; }
.phrases-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.phrase-tag { padding: 6px 14px; background: var(--accent-bg); color: #92400e; border-radius: 20px; font-size: 13px; border: 1px solid #fde68a; }

/* Empty / No result */
.empty-state { text-align: center; padding: 40px; color: var(--text-muted); }
.empty-state .emoji { font-size: 48px; display: block; margin-bottom: 12px; }

/* ===== Quiz Modal ===== */
.modal {
  display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15,23,42,.6); z-index: 1000; align-items: center; justify-content: center;
}
.modal.active { display: flex; }
.modal-content {
  background: var(--bg-white); border-radius: var(--radius); padding: 0; width: 560px; max-width: 92vw;
  max-height: 85vh; overflow-y: auto; box-shadow: var(--shadow-lg); animation: slideUp .3s ease;
}
@keyframes slideUp { from{opacity:0;transform:translateY(20px)} to{opacity:1;transform:translateY(0)} }
.modal-header {
  padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex;
  justify-content: space-between; align-items: center;
}
.modal-header h3 { font-size: 1.1rem; }
.btn-close {
  width: 32px; height: 32px; border: none; background: var(--bg); border-radius: 50%;
  cursor: pointer; font-size: 16px; display: flex; align-items: center; justify-content: center; transition: var(--transition);
}
.btn-close:hover { background: #fee2e2; color: var(--danger); }
.quiz-score { text-align: center; padding: 12px; font-size: 16px; font-weight: 600; color: var(--primary); }
#quizQuestion { padding: 20px; text-align: center; }
.quiz-prompt { color: var(--text-secondary); font-size: 14px; margin-bottom: 8px; }
.quiz-word { font-size: 1.8rem; font-weight: 700; color: var(--text); }
.quiz-options { padding: 0 20px 20px; display: flex; flex-direction: column; gap: 10px; }
.quiz-opt {
  padding: 14px 18px; border: 2px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-white); cursor: pointer; font-size: 15px; transition: var(--transition); text-align: left;
}
.quiz-opt:hover { border-color: var(--primary-light); background: var(--primary-bg); }
.quiz-opt.correct { border-color: var(--success); background: #ecfdf5; color: #065f46; }
.quiz-opt.wrong { border-color: var(--danger); background: #fef2f2; color: #991b1b; }
.quiz-opt.disabled { pointer-events: none; opacity: .7; }
#quizFeedback { padding: 0 20px; text-align: center; min-height: 30px; }
.feedback-correct { color: var(--success); font-weight: 600; }
.feedback-wrong { color: var(--danger); font-weight: 600; }
#btnNextQuiz { display: block; margin: 0 auto 20px; }

/* Toast */
.toast {
  display: none; position: fixed; top: 80px; left: 50%; transform: translateX(-50%);
  background: #1e293b; color: #fff; padding: 10px 24px; border-radius: 24px;
  font-size: 14px; z-index: 2000; box-shadow: var(--shadow-lg);
}
.toast.active { display: block; animation: fadeIn .2s ease; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }