/* 考研英语打卡 · 移动优先样式。字号偏大、点击区偏大，晚上背单词不费眼。 */

:root {
  --bg: #F4F5F9;
  --surface: #FFFFFF;
  --surface-2: #F0F2F7;
  --text: #171A20;
  --text-2: #5B6270;
  --text-3: #9AA1AE;
  --border: rgba(16, 24, 40, 0.08);
  --brand: #3B5BDB;
  --brand-ink: #2A44A8;
  --brand-soft: #E8EDFF;
  --ok: #12B76A;
  --ok-soft: #E6F7EF;
  --err: #F04438;
  --err-soft: #FEECEB;
  --warn: #F79009;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 6px 20px rgba(16, 24, 40, .05);
}

html[data-theme="dark"] {
  --bg: #0E1015;
  --surface: #171A21;
  --surface-2: #1F232B;
  --text: #EDEFF3;
  --text-2: #A2A9B6;
  --text-3: #6E7683;
  --border: rgba(255, 255, 255, 0.08);
  --brand: #7C93FF;
  --brand-ink: #AFC0FF;
  --brand-soft: #1E2740;
  --ok: #3DDC97;
  --ok-soft: #12271F;
  --err: #FF7B72;
  --err-soft: #2A1717;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4);
}

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  transition: background .2s, color .2s;
}

body { min-height: 100vh; }

button, input { font-family: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }

.shell {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 0 16px calc(76px + env(safe-area-inset-bottom));
}

.shell.full { padding-bottom: 16px; }

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0 12px;
}
.topbar h1 { font-size: 20px; font-weight: 600; margin: 0; letter-spacing: -.2px; }
.topbar .sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface); border: 1px solid var(--border);
  font-size: 17px;
}

/* ---------- 卡片 ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
}
.card.tight { padding: 14px; }
.card-title { font-size: 13px; color: var(--text-3); margin: 0 0 10px; font-weight: 500; }

/* ---------- 倒计时 ---------- */
.countdown { display: flex; align-items: baseline; gap: 8px; }
.countdown b { font-size: 34px; font-weight: 700; letter-spacing: -1px; color: var(--brand); font-variant-numeric: tabular-nums; }
.countdown span { font-size: 13px; color: var(--text-2); }

.bar { height: 7px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin-top: 12px; }
.bar i { display: block; height: 100%; background: var(--brand); border-radius: 99px; transition: width .4s; }
.bar-legend { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-3); margin-top: 6px; }

/* ---------- 今日任务 ---------- */
.today { display: flex; gap: 16px; align-items: center; }
.ring { position: relative; width: 92px; height: 92px; flex: 0 0 92px; }
.ring svg { transform: rotate(-90deg); }
.ring .val {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; line-height: 1.1;
}
.ring .val b { font-size: 20px; font-variant-numeric: tabular-nums; }
.ring .val small { font-size: 10px; color: var(--text-3); margin-top: 2px; }
.today-info { flex: 1; min-width: 0; }
.today-info h2 { margin: 0 0 6px; font-size: 17px; font-weight: 600; }
.today-info p { margin: 0; font-size: 12.5px; color: var(--text-2); line-height: 1.6; }
.chip {
  display: inline-block; padding: 2px 8px; border-radius: 99px;
  font-size: 11.5px; background: var(--brand-soft); color: var(--brand-ink);
  margin-right: 6px; font-variant-numeric: tabular-nums;
}
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.err { background: var(--err-soft); color: var(--err); }

/* ---------- 按钮 ---------- */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; height: 50px; border-radius: 14px;
  background: var(--brand); color: #fff;
  font-size: 16px; font-weight: 500;
  transition: transform .1s, opacity .2s;
}
.btn:active { transform: scale(.985); }
.btn:disabled { opacity: .45; }
.btn.ghost { background: var(--surface-2); color: var(--text); }
.btn.sm { height: 42px; font-size: 14px; border-radius: 12px; }
.btn-row { display: flex; gap: 10px; }

/* ---------- 数据行 ---------- */
.stats3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px; }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 12px; text-align: center;
}
.stat b { display: block; font-size: 19px; font-variant-numeric: tabular-nums; }
.stat small { font-size: 11px; color: var(--text-3); }

/* ---------- 热力图 ---------- */
.heat {
  display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 12px);
  gap: 3px; overflow-x: auto; padding-bottom: 2px;
}
.heat i { width: 12px; height: 12px; border-radius: 3px; background: var(--surface-2); }
.heat i.l1 { background: rgba(59, 91, 219, .28); }
.heat i.l2 { background: rgba(59, 91, 219, .5); }
.heat i.l3 { background: rgba(59, 91, 219, .72); }
.heat i.l4 { background: var(--brand); }
html[data-theme="dark"] .heat i.l1 { background: rgba(124, 147, 255, .28); }
html[data-theme="dark"] .heat i.l2 { background: rgba(124, 147, 255, .5); }
html[data-theme="dark"] .heat i.l3 { background: rgba(124, 147, 255, .75); }
html[data-theme="dark"] .heat i.l4 { background: var(--brand); }

/* ---------- 列表 ---------- */
.list { display: flex; flex-direction: column; gap: 8px; }
.row {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 13px 14px;
}
.row .grow { flex: 1; min-width: 0; }
.row .t1 { font-size: 15px; font-weight: 500; }
.row .t2 { font-size: 12px; color: var(--text-3); margin-top: 3px; }
.row .right { text-align: right; font-variant-numeric: tabular-nums; }
.row .right b { font-size: 16px; }
.row .right small { display: block; font-size: 11px; color: var(--text-3); }

/* ---------- 底部导航 ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0;
  background: var(--surface);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 50;
}
.tabbar-inner {
  max-width: 560px; margin: 0 auto; display: grid; grid-template-columns: repeat(4, 1fr);
}
.tabbar button {
  padding: 9px 0 8px; display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: 10.5px; color: var(--text-3);
}
.tabbar button.active { color: var(--brand); }
.tabbar .dot { font-size: 19px; line-height: 1; }

/* ---------- 登录 ---------- */
.login-wrap { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 24px; max-width: 420px; margin: 0 auto; }
.brand-mark { text-align: center; margin-bottom: 32px; }
.brand-mark .logo {
  width: 64px; height: 64px; border-radius: 18px; margin: 0 auto 14px;
  background: var(--brand); color: #fff; font-size: 28px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}
.brand-mark h1 { margin: 0; font-size: 22px; font-weight: 600; }
.brand-mark p { margin: 6px 0 0; font-size: 13px; color: var(--text-3); }

.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12.5px; color: var(--text-2); margin-bottom: 6px; }
.field input {
  width: 100%; height: 50px; border-radius: 13px; padding: 0 14px;
  background: var(--surface); border: 1px solid var(--border);
  font-size: 16px; outline: none;
}
.field input:focus { border-color: var(--brand); }

.switch-line { text-align: center; font-size: 13px; color: var(--text-2); margin-top: 18px; }
.switch-line b { color: var(--brand); cursor: pointer; font-weight: 500; }

/* ---------- 打卡卡片 ---------- */
.study-head { display: flex; align-items: center; gap: 12px; padding: 14px 0 8px; }
.study-head .back, .study-head .close { font-size: 22px; color: var(--text-2); }
.study-head .close { color: var(--text-3); }
.study-progress { flex: 1; height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.study-progress i { display: block; height: 100%; background: var(--brand); transition: width .3s; }
.study-count { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }

.nav-row { display: flex; gap: 10px; margin-top: 6px; }
.nav-row .btn { flex: 1; width: auto; }
.nav-row .btn.ghost { color: var(--text-2); }
.nav-hint { flex: 1; align-self: center; text-align: right; font-size: 12.5px; color: var(--text-3); }

.word-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 22px;
  padding: 26px 20px 22px; text-align: center; margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.word-card .tag {
  display: inline-block; font-size: 11px; padding: 2px 9px; border-radius: 99px;
  background: var(--brand-soft); color: var(--brand-ink); margin-bottom: 14px;
}
.word {
  font-size: 40px; font-weight: 600; letter-spacing: -.5px; line-height: 1.15;
  word-break: break-word;
}
.word.long { font-size: 30px; }
.word.longer { font-size: 24px; }
.phonetic { font-size: 14px; color: var(--text-3); margin-top: 8px; font-family: var(--mono, ui-monospace, monospace); }
.speak {
  margin-top: 12px; display: inline-flex; align-items: center; gap: 5px;
  font-size: 12.5px; color: var(--brand); background: var(--brand-soft);
  padding: 6px 14px; border-radius: 99px;
}

.options { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.option {
  display: flex; align-items: center; gap: 10px; text-align: left;
  padding: 15px 16px; border-radius: 14px; font-size: 15px; line-height: 1.45;
  background: var(--surface); border: 1px solid var(--border);
  transition: transform .08s, background .15s, border-color .15s;
  min-height: 56px;
}
.option:active { transform: scale(.99); }
.option .k {
  flex: 0 0 22px; height: 22px; border-radius: 7px; background: var(--surface-2);
  color: var(--text-3); font-size: 11px; display: flex; align-items: center; justify-content: center;
}
.option.correct { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
.option.correct .k { background: var(--ok); color: #fff; }
.option.wrong { background: var(--err-soft); border-color: var(--err); color: var(--err); }
.option.wrong .k { background: var(--err); color: #fff; }
.option.dim { opacity: .45; }

.feedback {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  padding: 14px 16px; margin-bottom: 12px; animation: rise .18s ease-out;
}
.feedback .head { font-size: 13px; font-weight: 500; margin-bottom: 8px; }
.feedback .head.ok { color: var(--ok); }
.feedback .head.bad { color: var(--err); }
.feedback .meaning { font-size: 14px; line-height: 1.6; }
.feedback .eg { font-size: 13px; color: var(--text-2); line-height: 1.6; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border); }

@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.fade { animation: rise .22s ease-out; }

/* ---------- 结算 ---------- */
.result-hero { text-align: center; padding: 22px 0 6px; }
.result-hero .score { font-size: 58px; font-weight: 700; letter-spacing: -2px; color: var(--brand); line-height: 1; font-variant-numeric: tabular-nums; }
.result-hero .label { font-size: 12px; color: var(--text-3); margin-top: 8px; }
.result-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 18px 0; }
.result-grid .cell { text-align: center; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 13px 6px; }
.result-grid .cell b { display: block; font-size: 19px; font-variant-numeric: tabular-nums; }
.result-grid .cell small { font-size: 11px; color: var(--text-3); }

/* ---------- 单词本 ---------- */
.segmented {
  display: flex; gap: 4px; padding: 4px; background: var(--surface-2);
  border-radius: 12px; margin-bottom: 12px; overflow-x: auto;
}
.segmented button {
  flex: 1; white-space: nowrap; padding: 8px 10px; border-radius: 9px;
  font-size: 13px; color: var(--text-2);
}
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.08); }

.search {
  width: 100%; height: 42px; border-radius: 12px; padding: 0 14px;
  background: var(--surface); border: 1px solid var(--border); font-size: 14px; outline: none;
  margin-bottom: 10px;
}

.word-item { display: flex; align-items: flex-start; gap: 10px; }
.word-item .hw { font-size: 16px; font-weight: 500; }
.word-item .ph { font-size: 11.5px; color: var(--text-3); margin-left: 6px; }
.word-item .mn { font-size: 13px; color: var(--text-2); margin-top: 4px; line-height: 1.5; }
.badge { font-size: 10.5px; padding: 2px 7px; border-radius: 99px; background: var(--surface-2); color: var(--text-3); white-space: nowrap; }
.badge.learning { background: var(--brand-soft); color: var(--brand-ink); }
.badge.mastered { background: var(--ok-soft); color: var(--ok); }
.badge.wrong { background: var(--err-soft); color: var(--err); }
.star { font-size: 17px; color: var(--text-3); padding: 2px 4px; }
.star.on { color: var(--warn); }
.spk { width: 34px; height: 34px; flex: none; border-radius: 50%; background: var(--brand-soft); color: var(--brand-ink); font-size: 13px; line-height: 1; display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.spk:active { transform: scale(0.94); }

.empty { text-align: center; padding: 48px 20px; color: var(--text-3); font-size: 13.5px; line-height: 1.7; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 96px; transform: translate(-50%, 12px);
  background: rgba(23, 26, 32, .92); color: #fff; font-size: 13.5px;
  padding: 10px 18px; border-radius: 12px; opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s; z-index: 200; max-width: 80vw; text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 设置 ---------- */
.setting-row { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; border-bottom: 1px solid var(--border); }
.setting-row:last-child { border-bottom: none; }
.setting-row .label { font-size: 14.5px; }
.setting-row .desc { font-size: 11.5px; color: var(--text-3); margin-top: 3px; }
.stepper { display: flex; align-items: center; gap: 12px; }
.stepper button { width: 32px; height: 32px; border-radius: 9px; background: var(--surface-2); font-size: 17px; }
.stepper b { min-width: 34px; text-align: center; font-size: 16px; font-variant-numeric: tabular-nums; }
.setting-row input[type="date"] { border: 1px solid var(--border); background: var(--surface-2); border-radius: 10px; padding: 8px 10px; font-size: 14px; }

@media (min-width: 640px) {
  .shell { padding: 0 20px 96px; }
}
