* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

:root {
  --blue: #0984e3;
  --blue-dark: #0768b3;
  --green: #00b894;
  --red: #d63031;
  --amber: #b8860b;
  --bg: #f5f6fa;
  --card: #ffffff;
  --text: #2d3436;
  --muted: #7a8388;
  --line: #e6e9ef;
}

html, body { background: var(--bg); color: var(--text); }
body {
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  max-width: 480px; margin: 0 auto; min-height: 100vh;
  padding: 16px 16px 40px;
}

.view { animation: fade .2s ease; }
.hidden { display: none !important; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; } }

/* header */
.app-header { text-align: center; padding: 12px 0 18px; }
.app-header h1 { font-size: 24px; font-weight: 700; }
.app-header .sub { color: var(--muted); font-size: 14px; margin-top: 4px; }

/* card */
.card {
  background: var(--card); border-radius: 16px; padding: 18px;
  margin-bottom: 16px; box-shadow: 0 2px 10px rgba(0,0,0,.05);
}

/* buttons */
.btn {
  border: none; border-radius: 12px; font-size: 16px; font-weight: 600;
  padding: 13px 16px; cursor: pointer; transition: transform .05s, opacity .15s;
  font-family: inherit;
}
.btn:active { transform: scale(.97); }
.btn-lg { width: 100%; padding: 16px; font-size: 18px; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:active { background: var(--blue-dark); }
.btn-listen { background: #eaf4ff; color: var(--blue); width: 100%; }
.btn-retry { background: #f0f2f5; color: var(--text); flex: 1; }
.btn-mic {
  background: var(--green); color: #fff; width: 100%; padding: 20px;
  font-size: 18px; border-radius: 16px; letter-spacing: 1px;
}
.btn-mic.listening { background: var(--red); animation: pulse 1s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .7; } }

/* task card */
.task-progress { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.ring {
  width: 76px; height: 76px; border-radius: 50%; flex-shrink: 0;
  background: conic-gradient(var(--blue) var(--pct,0%), #e9edf3 0);
  display: flex; align-items: center; justify-content: center;
}
.ring::before {
  content: ''; position: absolute; width: 60px; height: 60px;
  background: var(--card); border-radius: 50%;
}
.ring span { position: relative; font-weight: 700; font-size: 16px; color: var(--blue); }
.task-title { font-size: 18px; font-weight: 700; }
.task-desc { color: var(--muted); font-size: 14px; margin-top: 4px; }

/* calendar */
.cal-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
.cal-head h2 { font-size: 17px; font-weight: 700; }
.cal-month { color: var(--muted); font-size: 14px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-cell {
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  font-size: 13px; color: var(--muted); border-radius: 8px; background: #f7f8fa;
}
.cal-cell.done { background: var(--green); color: #fff; font-weight: 700; }
.cal-cell.today { outline: 2px solid var(--blue); color: var(--blue); font-weight: 700; }
.cal-cell.done.today { color: #fff; }
.cal-cell.blank { background: transparent; }
.cal-legend { margin-top: 12px; font-size: 12px; color: var(--muted); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: middle; margin-right: 3px; }
.dot.done { background: var(--green); }
.dot.today { background: #fff; outline: 2px solid var(--blue); }

/* practice */
.practice-top { display: flex; justify-content: space-between; align-items: center; padding: 4px 0 14px; }
.btn-back { background: none; border: none; font-size: 17px; color: var(--muted); cursor: pointer; }
.practice-count { font-weight: 700; color: var(--text); }
.progress-bar { height: 6px; background: #e9edf3; border-radius: 3px; margin-bottom: 18px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--blue); width: 0; transition: width .3s; }

.sentence-card { text-align: center; }
.scene-tag {
  display: inline-block; background: #eaf4ff; color: var(--blue);
  font-size: 12px; padding: 4px 12px; border-radius: 20px; margin-bottom: 14px;
}
.sentence-en { font-size: 23px; font-weight: 700; line-height: 1.4; margin-bottom: 10px; }
.sentence-zh { color: var(--muted); font-size: 16px; margin-bottom: 18px; }
.btn-eye {
  background: #f0f3ff; border: none; color: var(--blue); font-size: 14px;
  cursor: pointer; padding: 6px 14px; border-radius: 16px; margin-bottom: 12px;
  font-family: inherit;
}
.btn-eye:active { opacity: .7; }

.mic-area { margin-bottom: 16px; }
.mic-hint { text-align: center; color: var(--muted); font-size: 13px; margin-top: 10px; }
.mic-hint.error { color: var(--red); }

/* result */
.result-card { text-align: center; }
.score-row { display: flex; align-items: baseline; justify-content: center; gap: 4px; margin-bottom: 12px; }
.score-num { font-size: 48px; font-weight: 800; }
.score-label { font-size: 18px; color: var(--muted); }
.score-num.good { color: var(--green); }
.score-num.mid { color: var(--amber); }
.score-num.bad { color: var(--red); }
.result-heard { font-size: 14px; color: var(--muted); margin-bottom: 12px; }
.result-heard span { color: var(--text); }
.result-diff-label { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.w-ok { color: var(--green); } .w-miss { color: var(--red); }
.result-diff { font-size: 19px; line-height: 1.7; margin-bottom: 18px; word-spacing: 2px; }
.result-diff .ok { color: var(--green); }
.result-diff .miss { color: var(--red); text-decoration: underline; text-decoration-style: wavy; }
.result-actions { display: flex; gap: 10px; }
.result-actions .btn-primary { flex: 1; }

/* done */
.done-box { text-align: center; padding: 50px 20px; }
.done-emoji { font-size: 64px; margin-bottom: 10px; }
.done-box h1 { font-size: 26px; font-weight: 800; margin-bottom: 24px; }
.done-stats { display: flex; justify-content: center; gap: 40px; margin-bottom: 24px; }
.stat { display: flex; flex-direction: column; }
.stat-num { font-size: 40px; font-weight: 800; color: var(--blue); }
.stat-lbl { font-size: 14px; color: var(--muted); }
.done-tip { color: var(--muted); font-size: 15px; margin-bottom: 30px; line-height: 1.6; }

/* 游戏化:段位卡 */
.stats-card { padding: 16px 18px; }
.level-row { display: flex; align-items: center; gap: 12px; }
.level-badge {
  width: 48px; height: 48px; border-radius: 50%; flex-shrink: 0;
  background: var(--blue); color: #fff; display: flex; align-items: center;
  justify-content: center; font-size: 20px; font-weight: 800;
}
.level-info { flex: 1; min-width: 0; }
.level-title { font-size: 15px; font-weight: 700; margin-bottom: 6px; }
.xp-bar { height: 8px; background: #e9edf3; border-radius: 4px; overflow: hidden; }
.xp-fill { height: 100%; background: var(--blue); width: 0; transition: width .4s; }
.xp-text { font-size: 12px; color: var(--muted); margin-top: 5px; }
.streak-box { text-align: center; flex-shrink: 0; min-width: 46px; }
.streak-num { display: block; font-size: 26px; font-weight: 800; color: #e17055; line-height: 1; }
.streak-lbl { font-size: 11px; color: var(--muted); }

/* 勋章墙 */
.badge-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.badge {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 12px 6px; border-radius: 12px; background: #f7f8fa; text-align: center;
}
.badge.unlocked { background: #eaf4ff; }
.badge.locked { opacity: .45; filter: grayscale(1); }
.badge-icon { font-size: 26px; }
.badge-name { font-size: 12px; color: var(--text); }

/* 14天失败预警横幅(Q5) */
.warning-banner {
  background: #ffeaea; color: var(--red); border: 1.5px solid var(--red);
  border-radius: 12px; padding: 14px 16px; margin-bottom: 14px;
  font-size: 14px; font-weight: 600; line-height: 1.55;
}

/* 完成页奖励 */
.done-reward { font-size: 16px; font-weight: 700; color: var(--blue); margin-bottom: 8px; }
.done-badges { margin-bottom: 16px; line-height: 1.9; }
.new-badge {
  display: inline-block; background: #fff7e0; color: var(--amber);
  padding: 4px 10px; border-radius: 16px; font-size: 14px; font-weight: 600; margin: 2px;
}

/* 内容难度行(仪表盘v2) */
.content-line {
  margin-top: 10px; text-align: center; font-size: 13px; color: var(--muted);
}
.tap-word { cursor: pointer; }
.tap-word:active { opacity: .6; text-decoration: underline; }

/* 段位天梯 */
.ladder { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
.ladder-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 10px; font-size: 14px; color: var(--muted);
}
.ladder-row.reached { color: var(--text); }
.ladder-row.current { background: #eaf4ff; font-weight: 700; color: var(--blue); }
.ladder-lv { width: 40px; font-weight: 700; }
.ladder-title { flex: 1; }
.ladder-xp { font-size: 12px; }
.ladder-mark { min-width: 56px; text-align: right; font-size: 12px; }
.ladder-hint { text-align: center; font-size: 12px; color: var(--muted); margin-top: 10px; cursor: pointer; }
.xp-rules {
  margin-top: 10px; padding: 8px 10px; background: #f7f8fa; border-radius: 8px;
  font-size: 12px; color: var(--muted); text-align: center;
}
.level-row { cursor: pointer; }

/* 每日数字仪表盘(v2) */
.daily-nums {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
  margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line);
}
.dnum { text-align: center; }
.dnum b { display: block; font-size: 20px; font-weight: 800; color: var(--blue); }
.dnum span { font-size: 11px; color: var(--muted); }

/* 词卡/摸底 */
.vocab-word { font-size: 38px; font-weight: 800; margin: 14px 0; letter-spacing: 1px; }
.vocab-gloss { font-size: 22px; font-weight: 700; color: var(--blue); margin: 12px 0 8px; }
.vocab-example { font-size: 18px; margin-bottom: 6px; }
.vocab-example-actions { display: flex; gap: 8px; margin-top: 10px; }
.vocab-example-actions .btn { flex: 1; padding: 10px; font-size: 14px; }
.btn-mic-small { background: var(--green); color: #fff; }
.rating-row { display: flex; gap: 8px; margin-top: 14px; }
.rating-row .btn { flex: 1; padding: 12px 4px; font-size: 14px; line-height: 1.5; }
.btn-rate-no { background: #ffeaea; color: var(--red); }
.btn-rate-hard { background: #fff7e0; color: var(--amber); }
.btn-rate-good { background: #eaf4ff; color: var(--blue); }
.btn-rate-easy { background: #e8f8f0; color: var(--green); }
.btn-rate-yes { background: var(--green); color: #fff; }
#view-placement .btn-rate-no { background: var(--red); color: #fff; }
.task-card .btn-lg { margin-top: 10px; }

/* 登录页 */
.login-box { text-align: center; padding: 70px 24px; }
.login-emoji { font-size: 56px; margin-bottom: 14px; }
.login-box h1 { font-size: 22px; font-weight: 700; margin-bottom: 24px; }
.login-input {
  width: 100%; padding: 14px 16px; font-size: 17px; text-align: center;
  border: 2px solid var(--line); border-radius: 12px; margin-bottom: 14px;
  font-family: inherit; outline: none;
}
.login-input:focus { border-color: var(--blue); }
.login-hint { color: var(--red); font-size: 14px; margin-top: 12px; min-height: 20px; }

/* toast */
.toast {
  position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%);
  background: rgba(45,52,54,.95); color: #fff; padding: 12px 20px;
  border-radius: 12px; font-size: 14px; max-width: 90%; z-index: 100; text-align: center;
}
