/* ===========================================================
   二年级学习工作台 · 样式
   设计约束：触控目标 ≥ 56px、正文 ≥ 17px、高对比、少动效
   =========================================================== */

:root {
  --bg: #f4f7fd;
  --bg-grad-1: #eef4ff;
  --bg-grad-2: #fdf7f0;
  --card: #ffffff;
  --ink: #16233c;
  --ink-2: #5b6b8c;
  --line: #e6edf9;

  --primary: #3f74ff;
  --primary-2: #2f5be0;
  --primary-soft: #e8efff;
  --green: #17b478;
  --green-soft: #e3f8ef;
  --amber: #f59e0b;
  --amber-soft: #fff5e3;
  --pink: #ff6b9d;
  --pink-soft: #ffe9f1;
  --violet: #8b5cf6;
  --violet-soft: #f2ecff;
  --red: #ef4444;

  --radius: 20px;
  --radius-sm: 14px;
  --shadow: 0 10px 28px rgba(31, 58, 110, .08);
  --shadow-lg: 0 18px 44px rgba(31, 58, 110, .14);
  --tap: 56px;
  --font: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui, -apple-system, "Segoe UI", sans-serif;
}

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

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink);
  background:
    radial-gradient(1100px 620px at 12% -10%, var(--bg-grad-1), transparent 62%),
    radial-gradient(880px 520px at 100% 0%, var(--bg-grad-2), transparent 58%),
    var(--bg);
  min-height: 100vh;
  padding-bottom: calc(88px + env(safe-area-inset-bottom));
}

h1, h2, h3, p { margin: 0; }
button { font-family: inherit; font-size: inherit; cursor: pointer; }
input { font-family: inherit; }

.shell {
  max-width: 560px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ---------------- 顶栏 ---------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 2px 12px;
  background: linear-gradient(180deg, rgba(244, 247, 253, .96) 60%, rgba(244, 247, 253, 0));
  backdrop-filter: blur(8px);
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark {
  width: 42px; height: 42px;
  flex: 0 0 42px;
  display: grid; place-items: center;
  font-size: 22px;
  background: #fff;
  border-radius: 13px;
  box-shadow: var(--shadow);
}
.brand h1 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: .2px;
  white-space: nowrap;
}
.brand-sub {
  font-size: 12.5px;
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-right { display: flex; align-items: center; gap: 8px; }

.wallet {
  display: flex; align-items: center; gap: 3px;
  height: 38px; padding: 0 12px;
  background: #fff;
  border-radius: 999px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #b45309;
  box-shadow: var(--shadow);
  font-size: 15px;
}
.wallet-icon { font-size: 14px; }

.icon-btn {
  width: 38px; height: 38px;
  border: 0; border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow);
  font-size: 17px;
  display: grid; place-items: center;
}

/* ---------------- 通用卡片 ---------------- */
.view { padding-top: 4px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 14px;
}

.card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.card-title h2 { font-size: 16.5px; font-weight: 700; }
.card-title .hint { font-size: 12.5px; color: var(--ink-2); font-weight: 500; }

.muted { color: var(--ink-2); }
.small { font-size: 13px; }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: 10px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.wrap { display: flex; flex-wrap: wrap; gap: 8px; }
.grow { flex: 1; min-width: 0; }

/* ---------------- 按钮 ---------------- */
.btn {
  min-height: var(--tap);
  padding: 0 22px;
  border: 0;
  border-radius: 16px;
  background: linear-gradient(180deg, var(--primary), var(--primary-2));
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: .5px;
  box-shadow: 0 8px 18px rgba(63, 116, 255, .28);
  transition: transform .12s ease, box-shadow .12s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.btn:active { transform: translateY(1px) scale(.985); box-shadow: 0 4px 10px rgba(63, 116, 255, .22); }
.btn[disabled] { opacity: .45; box-shadow: none; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-ghost {
  background: #fff;
  color: var(--ink);
  border: 1.5px solid var(--line);
  box-shadow: none;
}
.btn-soft { background: var(--primary-soft); color: var(--primary-2); box-shadow: none; }
.btn-green { background: linear-gradient(180deg, #22c98a, var(--green)); box-shadow: 0 8px 18px rgba(23, 180, 120, .26); }
.btn-danger { background: #fff; color: var(--red); border: 1.5px solid #ffd9d9; box-shadow: none; }
.btn-sm { min-height: 44px; padding: 0 16px; font-size: 15px; border-radius: 13px; }

/* 选择器 chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: #fff;
  color: var(--ink-2);
  font-size: 14.5px;
  font-weight: 600;
  display: inline-flex; align-items: center; gap: 6px;
}
.chip.active {
  background: var(--primary-soft);
  border-color: #b9ccff;
  color: var(--primary-2);
  box-shadow: 0 4px 12px rgba(63, 116, 255, .12);
}

/* ---------------- 今日页 ---------------- */
.hero {
  background: linear-gradient(135deg, #ffffff 0%, #f7faff 55%, #fff8ef 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 14px;
}
.hello { font-size: 20px; font-weight: 800; letter-spacing: .2px; }
.dateline { font-size: 13px; color: var(--ink-2); margin-top: 4px; }

.ring {
  --p: 0;
  width: 92px; height: 92px;
  flex: 0 0 92px;
  border-radius: 50%;
  display: grid; place-items: center;
  background:
    conic-gradient(var(--primary) calc(var(--p) * 1%), #e8eefc 0);
  position: relative;
}
.ring::after {
  content: "";
  position: absolute; inset: 9px;
  background: #fff;
  border-radius: 50%;
  box-shadow: inset 0 2px 8px rgba(31, 58, 110, .06);
}
.ring-inner { position: relative; z-index: 1; text-align: center; line-height: 1.1; }
.ring-num { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.ring-cap { font-size: 11px; color: var(--ink-2); }

.task {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: #fbfdff;
  margin-bottom: 10px;
}
.task:last-child { margin-bottom: 0; }
.task-icon {
  width: 44px; height: 44px;
  flex: 0 0 44px;
  border-radius: 13px;
  display: grid; place-items: center;
  font-size: 21px;
}
.task-name { font-size: 15.5px; font-weight: 700; }
.task-meta { font-size: 12.5px; color: var(--ink-2); }
.task.done { background: var(--green-soft); border-color: #c6eedd; }
.task.done .task-name { color: #0d8a5c; }

.check {
  width: 28px; height: 28px;
  flex: 0 0 28px;
  border-radius: 50%;
  border: 2px dashed #cdd9ee;
  display: grid; place-items: center;
  font-size: 15px;
  color: #fff;
  background: #fff;
}
.task.done .check { background: var(--green); border: 2px solid var(--green); }

.stats-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.stat {
  background: #fbfdff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 8px;
  text-align: center;
}
.stat-num { font-size: 21px; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat-cap { font-size: 11.5px; color: var(--ink-2); }

/* ---------------- 练习通用 ---------------- */
.panel { text-align: center; padding: 8px 4px 4px; }

.progress-line {
  height: 8px;
  border-radius: 999px;
  background: #eaf0fb;
  overflow: hidden;
  margin: 12px 0;
}
.progress-line > i {
  display: block; height: 100%;
  background: linear-gradient(90deg, #6f9bff, var(--primary));
  border-radius: 999px;
  transition: width .25s ease;
}

.question {
  font-size: 40px;
  font-weight: 800;
  letter-spacing: 1px;
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
  padding: 10px 0 4px;
}
.question.small { font-size: 30px; }

.answer-slot {
  display: inline-block;
  min-width: 110px;
  padding: 4px 14px;
  border-bottom: 4px solid var(--primary);
  color: var(--primary-2);
  text-align: center;
}
.answer-slot.empty { color: #c8d5ec; }

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 18px;
}
.key {
  min-height: 62px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 24px;
  font-weight: 700;
  color: var(--ink);
  box-shadow: 0 3px 0 #e9eff9;
  transition: transform .08s ease;
}
.key:active { transform: translateY(2px); box-shadow: none; }
.key.wide { grid-column: span 1; }
.key-ok { background: linear-gradient(180deg, #22c98a, var(--green)); color: #fff; border-color: transparent; box-shadow: 0 3px 0 #0e9c68; }
.key-del { background: var(--amber-soft); color: #b45309; }

.feedback {
  min-height: 30px;
  font-size: 17px;
  font-weight: 700;
  margin-top: 10px;
}
.feedback.ok { color: var(--green); }
.feedback.no { color: var(--red); }

.flash-ok { animation: flashOk .45s ease; }
.flash-no { animation: shake .35s ease; }
@keyframes flashOk { 0% { background: var(--green-soft); } 100% { background: transparent; } }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-7px); }
  75% { transform: translateX(7px); }
}

.big-input {
  width: 100%;
  min-height: 62px;
  border-radius: 16px;
  border: 2px solid var(--line);
  background: #fbfdff;
  padding: 0 18px;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 6px;
  text-align: center;
  color: var(--ink);
  outline: none;
}
.big-input:focus { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 4px rgba(63, 116, 255, .12); }

/* 结算 */
.result-stars { font-size: 34px; letter-spacing: 4px; margin: 6px 0; }
.result-big { font-size: 44px; font-weight: 800; font-variant-numeric: tabular-nums; }

.wrong-item {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #fff7f7;
  border: 1px solid #ffe3e3;
  margin-bottom: 8px;
  font-size: 14px;
}
.wrong-item b { color: var(--red); }

/* 单词卡 */
.flip-card {
  min-height: 220px;
  border-radius: 22px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 24px;
  background: linear-gradient(160deg, #eef3ff, #ffffff 60%, #f6f0ff);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  user-select: none;
}
.flip-word { font-size: 44px; font-weight: 800; letter-spacing: 1px; }
.flip-cn { font-size: 26px; font-weight: 700; color: var(--violet); }
.flip-tip { font-size: 12.5px; color: var(--ink-2); margin-top: 10px; }

/* 专注计时 */
.timer-wrap { position: relative; width: 220px; height: 220px; margin: 6px auto 14px; }
.timer-wrap svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.timer-track { fill: none; stroke: #eaf0fb; stroke-width: 14; }
.timer-bar { fill: none; stroke: url(#timerGrad); stroke-width: 14; stroke-linecap: round; transition: stroke-dashoffset .4s linear; }
.timer-text {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-size: 40px; font-weight: 800;
  font-variant-numeric: tabular-nums;
}

/* 报告 */
.chart { width: 100%; height: 150px; display: block; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--ink-2); margin-top: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; }

.badge-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.badge {
  text-align: center;
  padding: 12px 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: #fbfdff;
  opacity: .45;
  filter: grayscale(1);
}
.badge.on { opacity: 1; filter: none; background: #fff; box-shadow: var(--shadow); }
.badge-icon { font-size: 24px; }
.badge-name { font-size: 11px; font-weight: 600; margin-top: 2px; }

/* 表单 */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.field input[type="text"], .field input[type="number"], .field select {
  width: 100%;
  min-height: 50px;
  border-radius: 13px;
  border: 1.5px solid var(--line);
  background: #fbfdff;
  padding: 0 14px;
  font-size: 16px;
  color: var(--ink);
  outline: none;
}
.field input:focus, .field select:focus { border-color: var(--primary); background: #fff; }

/* ---------------- 底部导航 ---------------- */
.tabbar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: 100%;
  max-width: 560px;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 2px;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, .9);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  z-index: 30;
}
.tab {
  border: 0;
  background: transparent;
  border-radius: 13px;
  padding: 6px 0 4px;
  display: grid;
  gap: 2px;
  justify-items: center;
  color: var(--ink-2);
  font-size: 11.5px;
  font-weight: 600;
  transition: background .15s ease, color .15s ease;
}
.tab-icon { font-size: 19px; line-height: 1; filter: grayscale(.4); }
.tab.active { color: var(--primary-2); background: var(--primary-soft); }
.tab.active .tab-icon { filter: none; }

/* ---------------- toast ---------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(96px + env(safe-area-inset-bottom));
  transform: translate(-50%, 20px);
  background: rgba(22, 35, 60, .94);
  color: #fff;
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 14.5px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease, transform .22s ease;
  z-index: 60;
  max-width: 88vw;
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* 桌面端稍作收敛 */
@media (min-width: 720px) {
  body { font-size: 17px; }
  .shell { padding: 0 20px; }
  .card { padding: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
