/* 秒算天天练 · 复刻版样式（移动优先，430px 卡片式框架） */
:root {
  --brand: #863bff;
  --brand-2: #6a4bff;
  --brand-soft: #f2ecff;
  --ink: #1f2430;
  --ink-2: #5b6478;
  --ink-3: #98a1b3;
  --line: #ececf3;
  --bg: #f5f6fb;
  --ok: #22c55e;
  --warn: #f59e0b;
  --bad: #ef4444;
  --radius: 20px;
  --shadow: 0 8px 24px rgba(31, 36, 48, .08);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', 'Helvetica Neue', Arial, sans-serif;
  color: var(--ink);
  background: linear-gradient(160deg, #e9e5ff 0%, #f5f6fb 45%, #eef1ff 100%);
  display: flex;
  justify-content: center;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; cursor: pointer; }
.frame {
  width: 100%;
  max-width: 430px;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
  box-shadow: 0 0 40px rgba(31, 36, 48, .12);
  overflow-x: hidden;
}
.screen { min-height: 100vh; padding-bottom: 32px; animation: fade .18s ease; }
@keyframes fade { from { opacity: .4; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* 通用 */
.page { padding: 0 16px; display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; }
.row.between { justify-content: space-between; }
.row.gap { gap: 10px; }
.center-col { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; }
.muted { color: var(--ink-3); }
.small { font-size: 12px; line-height: 1.5; }
.big-num { font-size: 40px; font-weight: 800; letter-spacing: -.5px; }
.big-num small { font-size: 16px; font-weight: 600; color: var(--ink-2); margin-left: 2px; }
.kv { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pad { padding: 16px; }
.pad-t { padding-top: 10px; }
.center { text-align: center; }
.hidden, [hidden] { display: none !important; }

.card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card.pad { padding: 16px; display: flex; flex-direction: column; gap: 10px; }

/* 按钮 */
.btn {
  border: 0; border-radius: 14px; padding: 13px 16px; font-weight: 700; font-size: 15px;
  background: var(--brand-soft); color: var(--brand);
  transition: transform .12s ease, filter .12s ease;
  width: 100%;
}
.btn:active { transform: scale(.975); }
.btn.primary { background: linear-gradient(135deg, #8b4dff, #6a3bff); color: #fff; box-shadow: 0 10px 20px rgba(106, 59, 255, .28); }
.btn.big { padding: 15px 18px; font-size: 16px; }
.btn.ghost { background: #fff; color: var(--ink-2); border: 1px solid var(--line); box-shadow: none; }
.btn.danger { background: #fee2e2; color: #b91c1c; }
.btn.tiny { width: auto; padding: 7px 12px; font-size: 12px; border-radius: 10px; }
.btn.small { width: auto; padding: 8px 12px; font-size: 13px; }
.icon-btn {
  border: 0; background: transparent; font-size: 22px; line-height: 1; width: 34px; height: 34px;
  border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--ink-2);
}
.icon-btn.ghost { opacity: 0; pointer-events: none; }

/* 顶部条 */
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 6px; }
.topbar-title { font-weight: 700; font-size: 17px; }

/* 首页 */
.home-head {
  background: linear-gradient(160deg, #8b4dff 0%, #6a3bff 65%, #5b2fe6 100%);
  color: #fff; padding: 18px 16px 22px; border-radius: 0 0 26px 26px;
  display: flex; flex-direction: column; gap: 16px;
  box-shadow: 0 14px 30px rgba(106, 59, 255, .25);
}
.home-head .muted { color: rgba(255, 255, 255, .72); }
.home .page { margin-top: -12px; }
.avatar, .avatar-big {
  width: 42px; height: 42px; border-radius: 50%; background: rgba(255, 255, 255, .22);
  display: flex; align-items: center; justify-content: center; font-size: 22px;
}
.avatar-big { width: 76px; height: 76px; font-size: 40px; background: var(--brand-soft); }
.name { font-size: 16px; }
.score-row { display: flex; gap: 8px; }
.score-row > div {
  flex: 1; background: rgba(255, 255, 255, .14); border-radius: 14px; padding: 10px 12px;
  display: flex; flex-direction: column;
}
.score-row b { font-size: 20px; }
.score-row span { font-size: 11px; color: rgba(255, 255, 255, .7); }

.today-card .progress { margin-top: 2px; }
.progress { height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, #a06bff, #6a3bff); border-radius: 99px; }

.pill { font-size: 11px; padding: 4px 9px; border-radius: 99px; background: var(--brand-soft); color: var(--brand); white-space: nowrap; }
.pill.mastered { background: #dcfce7; color: #15803d; }
.pill.weak { background: #ffedd5; color: #c2410c; }
.pill.learning { background: #e0e7ff; color: #4338ca; }
.pill.untested { background: #f1f5f9; color: #64748b; }

.quad { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.quad-item {
  background: #fff; border: 0; border-radius: 16px; padding: 14px 6px; display: flex; flex-direction: column;
  align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2); box-shadow: var(--shadow);
}
.q-icon { font-size: 22px; }

.week { display: flex; justify-content: space-between; padding-top: 6px; }
.week-col { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.week-dot {
  width: 30px; height: 30px; border-radius: 50%; background: #f1f3f9; color: var(--ink-3);
  display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700;
}
.week-col.on .week-dot { background: var(--brand-soft); color: var(--brand); }
.week-name { font-size: 10px; color: var(--ink-3); }

.stat-row { display: flex; gap: 8px; }
.stat-box {
  flex: 1; background: #fff; border-radius: 16px; padding: 12px 10px; text-align: center;
  display: flex; flex-direction: column; gap: 2px; box-shadow: var(--shadow);
}
.stat-box b { font-size: 18px; }
.stat-box span { font-size: 11px; color: var(--ink-3); }
.hero-card { background: linear-gradient(160deg, #fff, #f7f4ff); }

/* 注册流程 */
.onboard { padding: 28px 20px; display: flex; flex-direction: column; gap: 14px; }
.onboard-head { text-align: center; margin-bottom: 6px; }
.onboard-head h2 { margin: 6px 0 4px; font-size: 22px; }
.onboard-head p { margin: 0; }
.step { font-size: 12px; color: var(--brand); background: var(--brand-soft); display: inline-block; padding: 3px 10px; border-radius: 99px; }
.input {
  width: 100%; border: 1px solid var(--line); background: #fff; border-radius: 14px;
  padding: 14px 16px; font-size: 16px; outline: none; transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(134, 59, 255, .12); }
.input.big { padding: 16px; font-size: 18px; letter-spacing: .5px; }
.grade-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grade-card {
  background: #fff; border: 2px solid transparent; border-radius: 16px; padding: 16px 12px;
  display: flex; flex-direction: column; gap: 4px; text-align: left; box-shadow: var(--shadow);
}
.grade-card.on { border-color: var(--brand); background: var(--brand-soft); }
.success-badge {
  width: 72px; height: 72px; border-radius: 50%; background: linear-gradient(135deg, #8b4dff, #6a3bff);
  color: #fff; font-size: 36px; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 12px 24px rgba(106, 59, 255, .3);
}

/* 欢迎页 */
.welcome {
  min-height: 100vh; padding: 56px 24px 32px; display: flex; flex-direction: column; align-items: center;
  gap: 12px; position: relative; overflow: hidden;
  background: linear-gradient(180deg, #f0eaff 0%, #f5f6fb 60%);
}
.welcome-glow {
  position: absolute; top: -120px; left: 50%; transform: translateX(-50%);
  width: 340px; height: 340px; border-radius: 50%; background: radial-gradient(circle, rgba(139, 77, 255, .35), transparent 65%);
  filter: blur(10px);
}
.cat { font-size: 76px; position: relative; animation: float 3s ease-in-out infinite; }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.brand { margin: 8px 0 0; font-size: 28px; letter-spacing: 1px; }
.brand-sub { margin: 0 0 12px; color: var(--ink-2); font-size: 14px; text-align: center; }
.welcome-features { width: 100%; display: flex; flex-direction: column; gap: 10px; margin: 10px 0 22px; }
.feature { display: flex; gap: 12px; align-items: center; background: #fff; border-radius: 16px; padding: 12px 14px; box-shadow: var(--shadow); }
.f-icon { font-size: 22px; }
.feature b { display: block; font-size: 14px; }
.welcome .btn { max-width: 100%; }

/* 答题 */
.quiz { padding: 12px 16px 20px; display: flex; flex-direction: column; gap: 12px; }
.quiz-top { display: flex; align-items: center; gap: 12px; }
.quiz-progress { flex: 1; height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; }
.quiz-progress > i { display: block; height: 100%; background: linear-gradient(90deg, #a06bff, #6a3bff); transition: width .2s; }
.timer { font-variant-numeric: tabular-nums; font-weight: 800; color: var(--brand); font-size: 15px; min-width: 46px; text-align: right; }
.quiz-meta { text-align: center; }
.q-card {
  background: #fff; border-radius: 22px; padding: 34px 18px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center; gap: 10px; min-height: 150px; justify-content: center;
  transition: background .15s, box-shadow .15s;
  border: 2px solid transparent;
}
.q-card.ok { border-color: #86efac; background: #f0fdf4; }
.q-card.bad { border-color: #fca5a5; background: #fef2f2; }
.q-template { font-size: 30px; font-weight: 800; letter-spacing: 1px; text-align: center; line-height: 1.5; word-break: break-word; }
.blank {
  display: inline-flex; align-items: center; justify-content: center; min-width: 44px; height: 44px;
  border-bottom: 3px solid var(--brand); color: var(--brand); vertical-align: middle; margin: 0 4px;
}
.blank.circle { border: 2px dashed var(--brand); border-radius: 50%; min-width: 40px; height: 40px; font-size: 20px; }
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choice {
  background: #fff; border: 2px solid var(--line); border-radius: 16px; padding: 20px 12px;
  font-size: 22px; font-weight: 800; box-shadow: var(--shadow); transition: all .15s;
  word-break: break-all;
}
.choice:active { transform: scale(.97); }
.choice.ok { border-color: var(--ok); background: #f0fdf4; color: #15803d; }
.choice.bad { border-color: var(--bad); background: #fef2f2; color: #b91c1c; }
.pad-wrap { display: flex; flex-direction: column; gap: 10px; }
.answer-box { background: #fff; border-radius: 16px; padding: 6px 8px; box-shadow: var(--shadow); }
.answer-input { width: 100%; border: 0; outline: none; font-size: 26px; font-weight: 800; text-align: center; padding: 12px; }
.keypad { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.key {
  background: #fff; border: 0; border-radius: 12px; padding: 16px 0; font-size: 20px; font-weight: 700;
  box-shadow: var(--shadow);
}
.key:active { background: var(--brand-soft); }

/* 结算 */
.result { padding: 24px 16px; display: flex; flex-direction: column; gap: 12px; }
.result-head { text-align: center; }
.result-head h2 { margin: 6px 0 2px; font-size: 20px; }
.stars-big { font-size: 34px; letter-spacing: 4px; }
.star { color: #e2e8f0; }
.star.on { color: #fbbf24; }
.ring {
  width: 132px; height: 132px; border-radius: 50%; margin: 6px auto;
  background: conic-gradient(var(--brand) var(--deg, 0deg), #eef0f7 0);
  display: flex; align-items: center; justify-content: center; position: relative;
}
.ring::after { content: ''; position: absolute; inset: 12px; border-radius: 50%; background: #fff; }
.ring-in { position: relative; z-index: 1; font-size: 24px; font-weight: 800; }
.ring-in b { font-size: 26px; }
.points { color: var(--brand); font-size: 20px; }
.milestone { background: #fff7ed; color: #c2410c; border-radius: 12px; padding: 10px 12px; font-size: 13px; }
.warn { background: #fef2f2; color: #b91c1c; border-radius: 12px; padding: 10px 12px; font-size: 13px; }

/* 列表 / 其它 */
.list-row { display: flex; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.list-row:last-child { border-bottom: 0; }
.menu-row {
  display: flex; justify-content: space-between; align-items: center; width: 100%;
  background: #fff; border: 0; border-bottom: 1px solid var(--line); padding: 15px 16px; font-size: 15px;
}
.menu-row:last-child { border-bottom: 0; }
.chev { color: var(--ink-3); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: #f4f5fa; color: var(--ink-2); border-radius: 8px; padding: 5px 9px; font-size: 12px; }
.chip.on { background: var(--brand-soft); color: var(--brand); }
.kp-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.kp-row:last-child { border-bottom: 0; }
.kp-row .kv { flex: 1; }
.sem-title {
  display: flex; justify-content: space-between; width: 100%; background: #f7f6ff; border: 0;
  border-radius: 12px; padding: 12px; font-weight: 700; margin-top: 6px;
}
.sem-body { padding: 4px 2px 0; }
.empty { text-align: center; padding: 40px 16px; display: flex; flex-direction: column; gap: 6px; }
.empty-icon { font-size: 40px; }
.bars { display: flex; align-items: flex-end; gap: 8px; height: 80px; padding-top: 8px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; justify-content: flex-end; height: 100%; }
.bar { width: 60%; border-radius: 6px 6px 0 0; background: linear-gradient(180deg, #a06bff, #6a3bff); min-height: 2px; }
.bar-label { font-size: 9px; color: var(--ink-3); }
.rank-row { display: flex; align-items: center; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--line); }
.rank-row.me { background: var(--brand-soft); }
.rank-row:last-child { border-bottom: 0; }
.rank-no { width: 24px; font-weight: 800; color: var(--ink-3); }
.rank-name { flex: 1; }
.rank-pt { font-weight: 700; color: var(--brand); }
.poem-entry { text-align: left; border: 0; width: 100%; box-shadow: var(--shadow); }
.poem-title { font-size: 18px; font-weight: 800; text-align: center; }
.poem-prompt { background: #f7f6ff; border-radius: 12px; padding: 14px; line-height: 1.8; font-size: 16px; }
.poem-options { display: flex; flex-direction: column; gap: 8px; }
.poem-opt { border: 2px solid var(--line); background: #fff; border-radius: 12px; padding: 12px; font-size: 15px; text-align: left; }
.poem-opt.ok { border-color: var(--ok); background: #f0fdf4; }
.poem-opt.bad { border-color: var(--bad); background: #fef2f2; }

.steps { background: #f7f6ff; border-radius: 12px; padding: 10px 12px; font-size: 12px; color: var(--ink-2); line-height: 1.7; }
.thinking { border-left: 3px solid var(--brand); padding-left: 10px; font-size: 12px; color: var(--ink-2); line-height: 1.7; }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, #98a1b3 50%), linear-gradient(135deg, #98a1b3 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; }

/* 弹窗 / 提示 */
.mask {
  position: fixed; inset: 0; background: rgba(15, 18, 30, .45); display: flex; align-items: center;
  justify-content: center; padding: 24px; z-index: 50; backdrop-filter: blur(2px);
}
.modal {
  background: #fff; border-radius: 20px; padding: 20px; width: 100%; max-width: 360px;
  display: flex; flex-direction: column; gap: 10px; animation: pop .18s ease;
}
.modal h3 { margin: 0 0 4px; font-size: 17px; }
.modal.wide { max-width: 400px; }
@keyframes pop { from { transform: scale(.94); opacity: .6; } to { transform: none; opacity: 1; } }
.toast {
  position: fixed; left: 50%; bottom: 40px; transform: translate(-50%, 10px); opacity: 0;
  background: rgba(31, 36, 48, .92); color: #fff; padding: 10px 16px; border-radius: 12px;
  font-size: 14px; transition: all .2s; z-index: 60; pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.warn { background: rgba(180, 83, 9, .95); }

/* 撒纸屑 */
.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 40; }
.confetti i {
  position: absolute; top: -14px; width: 8px; height: 14px; border-radius: 2px;
  animation-name: confetti-drop; animation-timing-function: linear; animation-fill-mode: forwards;
}
@keyframes confetti-drop {
  to { transform: translateY(105vh) rotate(540deg); opacity: .9; }
}