/* 单词默写 · 打卡版 —— 移动端优先样式 */

:root {
  --bg: #eef1f8;
  --card: #ffffff;
  --ink: #1e293b;
  --sub: #64748b;
  --line: #e2e8f0;
  --primary: #4f46e5;
  --primary-weak: #eef2ff;
  --en2cn: #4f46e5;
  --en2cn-weak: #eef2ff;
  --cn2en: #0d9488;
  --cn2en-weak: #f0fdfa;
  --ok: #16a34a;
  --ok-weak: #f0fdf4;
  --warn: #d97706;
  --warn-weak: #fffbeb;
  --bad: #dc2626;
  --bad-weak: #fef2f2;
  --radius: 16px;
  --shadow: 0 8px 24px rgba(30, 41, 59, .08);
  --tabbar-h: 60px;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: "Segoe UI", "Microsoft YaHei", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  padding: 16px 14px calc(var(--tabbar-h) + 28px + env(safe-area-inset-bottom));
}

.wrap { max-width: 640px; margin: 0 auto; }
.screen[hidden] { display: none; }

/* ---------- 通用 ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}
.card + .card { margin-top: 14px; }
.card-title { font-size: 15px; font-weight: 700; margin-bottom: 12px; }
.muted { color: var(--sub); font-size: 13px; line-height: 1.6; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row + .row { margin-top: 10px; }
.spacer { flex: 1; }

.btn {
  border: none; border-radius: 12px; padding: 13px 20px;
  font-size: 16px; font-weight: 600; font-family: inherit;
  cursor: pointer; color: #fff; transition: filter .12s, transform .06s;
}
.btn:active { transform: scale(.98); }
.btn:hover { filter: brightness(1.06); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--primary); }
.btn-ghost { background: #e2e8f0; color: #334155; }
.btn-ok { background: var(--ok); }
.btn-bad { background: var(--bad); }
.btn-sm { padding: 9px 14px; font-size: 14px; border-radius: 10px; }
.btn-block { display: block; width: 100%; }
.btn-lg { padding: 16px 20px; font-size: 17px; }

.link {
  background: none; border: none; color: var(--sub); font-size: 13px;
  cursor: pointer; text-decoration: underline; font-family: inherit; padding: 4px;
}
.link:hover { color: var(--ink); }

input[type="text"], textarea, select {
  width: 100%; border: 1.5px solid var(--line); border-radius: 12px;
  padding: 12px 14px; font-size: 15px; font-family: inherit;
  color: var(--ink); background: #fbfcfe; outline: none;
  transition: border-color .15s;
}
input[type="text"]:focus, textarea:focus, select:focus { border-color: var(--primary); }
textarea { min-height: 220px; resize: vertical; line-height: 1.8; }
label.field { display: block; font-size: 13px; font-weight: 600; margin-bottom: 8px; }

/* 顶部标题 */
.app-head { text-align: center; margin-bottom: 16px; }
.app-head h1 { font-size: 20px; letter-spacing: .5px; }
.app-head p { color: var(--sub); font-size: 13px; margin-top: 4px; }
.screen-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.screen-head h2 { font-size: 18px; }

/* ---------- 统计小卡 ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stat-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.stat {
  background: #f8fafc; border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 6px; text-align: center;
}
.stat b { display: block; font-size: 20px; line-height: 1.2; }
.stat span { font-size: 11.5px; color: var(--sub); }
.stat.is-ok b { color: var(--ok); }
.stat.is-bad b { color: var(--bad); }
.stat.is-primary b { color: var(--primary); }

/* ---------- 首页 ---------- */
.streak-hero {
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: #fff; border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow);
}
.streak-hero .big { font-size: 34px; font-weight: 800; line-height: 1.1; }
.streak-hero .sub { opacity: .85; font-size: 13px; margin-top: 4px; }
.streak-hero .mini { display: flex; gap: 18px; margin-top: 14px; font-size: 13px; opacity: .95; }

/* ---------- 热力图 ---------- */
.heat { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.heat-cell {
  aspect-ratio: 1 / 1; border-radius: 6px; background: #eef2f7;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; color: var(--sub);
}
.heat-cell.lv1 { background: #c7d2fe; color: #3730a3; }
.heat-cell.lv2 { background: #818cf8; color: #fff; }
.heat-cell.lv3 { background: #4f46e5; color: #fff; }
.heat-cell.today { outline: 2px solid #1e293b; outline-offset: 1px; }
.heat-legend { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--sub); margin-top: 10px; }
.heat-legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }

/* ---------- 练习页 ---------- */
.quiz-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.progress-track { height: 8px; background: #e2e8f0; border-radius: 99px; overflow: hidden; margin-bottom: 20px; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--primary), #818cf8); transition: width .25s; }
.badge { display: inline-block; font-size: 12.5px; font-weight: 700; padding: 5px 12px; border-radius: 99px; margin-bottom: 14px; }
.badge.en2cn { background: var(--en2cn-weak); color: var(--en2cn); }
.badge.cn2en { background: var(--cn2en-weak); color: var(--cn2en); }
.question-word { font-size: 38px; font-weight: 800; line-height: 1.25; word-break: break-word; min-height: 48px; }
.quiz-hint { color: var(--sub); font-size: 13px; margin-top: 8px; }
.actions { margin-top: 22px; display: flex; flex-direction: column; gap: 10px; }
.answer-box { background: var(--ok-weak); border: 1.5px solid #bbf7d0; border-radius: 12px; padding: 15px 16px; }
.answer-box .answer-label { font-size: 12px; color: #15803d; font-weight: 700; margin-bottom: 5px; }
.answer-word { font-size: 24px; font-weight: 800; word-break: break-word; }
.answer-pair { color: #166534; font-size: 13.5px; margin-top: 5px; opacity: .85; }
.mark-row { display: flex; gap: 10px; }
.mark-row .btn { flex: 1; }

/* ---------- 列表 ---------- */
.list { margin-top: 10px; }
.list-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 12px; margin-top: 8px; background: #fff;
}
.list-item .idx { font-size: 12px; color: var(--sub); width: 20px; flex-shrink: 0; }
.list-item .main { flex: 1; min-width: 0; }
.list-item .en { font-weight: 700; font-size: 15px; word-break: break-word; }
.list-item .cn { color: var(--sub); font-size: 13px; word-break: break-word; margin-top: 2px; }
.pill { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 99px; flex-shrink: 0; }
.pill.bad { background: var(--bad-weak); color: var(--bad); }
.pill.ok { background: var(--ok-weak); color: var(--ok); }
.pill.warn { background: var(--warn-weak); color: var(--warn); }
.pill.mute { background: #f1f5f9; color: var(--sub); }
.empty { text-align: center; color: var(--sub); font-size: 14px; padding: 22px 0; }
.good { text-align: center; color: var(--ok); font-weight: 700; padding: 18px 0; }

/* 每日记录 */
.day-row { display: flex; align-items: center; gap: 10px; padding: 9px 2px; border-bottom: 1px dashed var(--line); font-size: 14px; }
.day-row:last-child { border-bottom: none; }
.day-row .d { width: 88px; color: var(--sub); font-size: 13px; flex-shrink: 0; }
.day-row .n { flex: 1; }
.day-row .r { font-weight: 700; font-size: 13.5px; }

/* ---------- 底部导航 ---------- */
#tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--line);
  display: flex;
}
#tabbar[hidden] { display: none; }
#tabbar button {
  flex: 1; border: none; background: none; font-family: inherit;
  font-size: 11.5px; color: var(--sub); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
}
#tabbar button .ico { font-size: 19px; line-height: 1; }
#tabbar button.active { color: var(--primary); font-weight: 700; }

/* ---------- 提示 ---------- */
#toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 24px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(16px);
  background: #1e293b; color: #fff; padding: 10px 18px; border-radius: 99px;
  font-size: 13.5px; opacity: 0; pointer-events: none; transition: all .25s; z-index: 90;
  max-width: 88vw; text-align: center;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 安装提示条 ---------- */
#installBar {
  background: var(--primary-weak); border: 1px solid #c7d2fe; color: #3730a3;
  border-radius: 12px; padding: 12px 14px; font-size: 13px; line-height: 1.6;
  display: flex; align-items: center; gap: 10px; margin-bottom: 14px;
}
#installBar[hidden] { display: none; }
#installBar button { flex-shrink: 0; }

@media (max-width: 400px) {
  .question-word { font-size: 30px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}
