:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1f2329;
  --text-secondary: #5c6370;
  --border: #e1e4e8;
  --accent: #0d7377;
  --accent-light: #e6f4f4;
  --danger: #c0392b;
  --danger-bg: #fdecea;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
  --radius: 8px;
  --max-width: 960px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { display: flex; align-items: center; gap: 16px; }
.logo {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: var(--radius);
  background: var(--accent); color: #fff; font-weight: 800; font-size: 14px;
}
.brand h1 { margin: 0; font-size: 18px; }
.subtitle { margin: 2px 0 0; color: var(--text-secondary); font-size: 13px; }
.progress-mini { min-width: 160px; }
.progress-mini span { font-size: 12px; color: var(--text-secondary); }
.bar { height: 6px; background: var(--border); border-radius: 3px; margin-top: 6px; overflow: hidden; }
.bar > div { height: 100%; width: 0%; background: var(--accent); transition: width .3s; }
.tabs {
  display: flex;
  gap: 8px;
  padding: 12px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.tab {
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  padding: 8px 14px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 14px;
  white-space: nowrap;
}
.tab:hover { background: var(--bg); color: var(--text); }
.tab.active { background: var(--accent-light); color: var(--accent); border-color: var(--accent); font-weight: 600; }
main { max-width: var(--max-width); margin: 24px auto; padding: 0 24px; min-height: 60vh; }
.panel { display: none; }
.panel.active { display: block; animation: fadeIn .2s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.panel-header { margin-bottom: 18px; }
.panel-header h2 { margin: 0 0 8px; font-size: 22px; }
.panel-header p { margin: 0; color: var(--text-secondary); font-size: 14px; }
.filters, .mode-toggle { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip, .mode {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 13px;
}
.chip.active, .mode.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.search-row { display: flex; gap: 10px; margin-bottom: 16px; }
.search-row input {
  flex: 1; padding: 10px 14px; border: 1px solid var(--border);
  border-radius: var(--radius); font-size: 14px; background: var(--surface);
}
.card-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.term-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow);
  cursor: pointer; transition: transform .1s, box-shadow .1s;
}
.term-card:hover { transform: translateY(-2px); box-shadow: 0 4px 10px rgba(0,0,0,0.08); }
.term-card .term { font-weight: 700; font-size: 16px; margin: 0 0 6px; }
.term-card .cat { font-size: 11px; color: var(--accent); background: var(--accent-light); padding: 2px 8px; border-radius: 999px; }
.term-card .def { margin: 10px 0 0; color: var(--text-secondary); font-size: 14px; display: none; }
.term-card.expanded .def { display: block; }
.term-card.mastered { border-left: 4px solid var(--accent); }
.flash-card, .quiz-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); min-height: 180px;
}
.badge {
  display: inline-block; font-size: 11px; font-weight: 600;
  color: var(--accent); background: var(--accent-light); padding: 3px 10px; border-radius: 999px; margin-bottom: 12px;
}
.flash-card p { font-size: 18px; line-height: 1.7; margin: 0; }
.flash-back { margin-top: 18px; padding-top: 18px; border-top: 1px dashed var(--border); }
.note { font-size: 14px; color: var(--text-secondary); font-style: italic; }
.hidden { display: none !important; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
button {
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  padding: 9px 16px; border-radius: var(--radius); cursor: pointer; font-size: 14px;
}
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-secondary { background: var(--bg); color: var(--text); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-danger { background: var(--danger-bg); color: var(--danger); border-color: var(--danger); }
button:active { transform: translateY(1px); }
.quiz-meta { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.statement { font-size: 17px; line-height: 1.7; }
.question { font-size: 19px; line-height: 1.6; margin: 0 0 12px; }
.hint { color: var(--text-secondary); font-size: 14px; background: var(--bg); padding: 12px; border-radius: var(--radius); margin-bottom: 12px; }
.answer-block { background: var(--accent-light); padding: 16px; border-radius: var(--radius); margin-top: 12px; line-height: 1.7; }
textarea {
  width: 100%; padding: 12px; border: 1px solid var(--border);
  border-radius: var(--radius); font-size: 14px; font-family: inherit; resize: vertical;
}
.self-rating { display: flex; align-items: center; gap: 8px; margin-top: 18px; }
.self-rating button { width: 36px; height: 36px; padding: 0; border-radius: 50%; }
.self-rating button.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; text-align: center; box-shadow: var(--shadow);
}
.stat-card strong { display: block; font-size: 28px; color: var(--accent); }
.stat-card span { font-size: 13px; color: var(--text-secondary); }
.data-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 28px; }
.advanced { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.advanced h3 { margin: 0 0 8px; font-size: 16px; }
.advanced p { color: var(--text-secondary); font-size: 13px; margin: 0 0 12px; }
.advanced select { margin-bottom: 10px; padding: 8px; border-radius: var(--radius); border: 1px solid var(--border); }
.guide-list { display: grid; gap: 18px; margin-bottom: 28px; }
.guide-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.guide-card h3 { margin: 0 0 14px; font-size: 17px; }
.guide-type { font-size: 12px; font-weight: 500; color: var(--accent); background: var(--accent-light); padding: 2px 8px; border-radius: 999px; margin-left: 8px; }
.guide-block { margin-bottom: 18px; }
.guide-block:last-child { margin-bottom: 0; }
.guide-block h4 { margin: 0 0 8px; font-size: 15px; color: var(--text); }
.guide-note { color: var(--text-secondary); font-size: 13px; margin: 0 0 10px; }
.guide-block ul, .guide-block ol { margin: 0; padding-left: 20px; color: var(--text-secondary); font-size: 14px; }
.guide-block li { margin-bottom: 6px; }
.guide-flow { margin-bottom: 10px; }
.guide-notes { list-style: disc; margin-bottom: 10px; }
.guide-examples { background: var(--bg); padding: 12px; border-radius: var(--radius); font-size: 14px; }
.guide-examples p { margin: 0 0 6px; }
.guide-examples p:last-child { margin-bottom: 0; }
.guide-section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 18px; }
.guide-section h3 { margin: 0 0 10px; font-size: 16px; }
.guide-section ul { margin: 0; padding-left: 20px; color: var(--text-secondary); font-size: 14px; }
.guide-section li { margin-bottom: 8px; }
.calc-card .calc-meta { margin-bottom: 14px; }
.calc-card .calc-meta p { margin: 0 0 6px; font-size: 14px; color: var(--text-secondary); }
.formula {
  background: var(--bg); border: 1px dashed var(--border); border-radius: var(--radius);
  padding: 10px 14px; font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 15px; color: var(--text); margin-bottom: 10px; overflow-x: auto;
}
.calc-card .statement { background: var(--bg); padding: 14px; border-radius: var(--radius); margin-bottom: 14px; }
.calc-card .answer-block ol { margin: 0; padding-left: 20px; color: var(--text); }
.calc-card .answer-block li { margin-bottom: 8px; }
.calc-tip { font-size: 13px; color: var(--text-secondary); font-style: italic; margin-top: 10px; }
.site-footer {
  text-align: center; padding: 24px; color: var(--text-secondary); font-size: 13px;
  border-top: 1px solid var(--border); margin-top: 40px;
}
@media (max-width: 640px) {
  .site-header { flex-direction: column; align-items: flex-start; gap: 12px; }
  .brand h1 { font-size: 16px; }
  main { margin: 16px auto; padding: 0 16px; }
  .flash-card, .quiz-card { padding: 18px; }
  .card-list { grid-template-columns: 1fr; }
}
/* 前端密码门 */
.auth-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(246,247,249,0.95);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.auth-overlay.hidden { display: none !important; }
.auth-box {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 10px 40px rgba(0,0,0,0.12);
  max-width: 400px; width: 100%; padding: 32px; text-align: center;
}
.auth-box .logo { display: inline-flex; margin-bottom: 16px; }
.auth-box h2 { margin: 0 0 8px; font-size: 20px; }
.auth-box p { color: var(--text-secondary); font-size: 14px; margin: 0 0 18px; }
.auth-box input {
  width: 100%; padding: 12px; border: 1px solid var(--border);
  border-radius: var(--radius); font-size: 14px; margin-bottom: 12px;
}
.auth-box button { width: 100%; }
.auth-error { color: var(--danger); font-size: 13px; margin-top: 10px; }
.auth-note { font-size: 12px; color: var(--text-secondary); margin-top: 14px; }
/* 每日打卡弹窗 */
.daily-overlay {
  position: fixed; inset: 0; z-index: 900;
  background: rgba(246,247,249,0.96);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.daily-overlay.hidden { display: none !important; }
.daily-box {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 12px 48px rgba(0,0,0,0.14);
  max-width: 720px; width: 100%; max-height: 90vh; overflow-y: auto;
  padding: 28px; position: relative;
}
.daily-close {
  position: absolute; top: 16px; right: 16px;
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--bg); border: 1px solid var(--border);
  color: var(--text-secondary); font-size: 22px; line-height: 1;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.daily-header {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 20px; padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.daily-header h2 { margin: 0 0 4px; font-size: 20px; }
.daily-header p { margin: 0; color: var(--text-secondary); font-size: 14px; }
.daily-body { min-height: 200px; }
.daily-body .badge { margin-bottom: 14px; }
.daily-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.daily-summary { text-align: center; padding: 24px; }
.daily-summary h3 { margin: 0 0 10px; font-size: 22px; color: var(--accent); }
@media (max-width: 640px) {
  .daily-box { padding: 20px 18px; }
  .daily-header h2 { font-size: 17px; }
}
