:root {
  --bg: #0e1116;
  --bg-soft: #131922;
  --surface: #171d26;
  --surface-2: #1d2530;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #e8edf4;
  --text-dim: #97a3b4;
  --text-faint: #6b7788;
  --accent: #4ade80;
  --accent-dim: rgba(74, 222, 128, 0.14);
  --amber: #fbbf24;
  --rose: #f87171;
  --blue: #60a5fa;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background:
    radial-gradient(1000px 600px at 15% -10%, rgba(74, 222, 128, 0.07), transparent 60%),
    radial-gradient(800px 500px at 90% 110%, rgba(96, 165, 250, 0.06), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

button, input, select { font-family: inherit; font-size: inherit; color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }

.muted { color: var(--text-dim); }
.tiny { font-size: 12.5px; }
.center { text-align: center; }
[hidden] { display: none !important; }

/* ---------- 按钮 ---------- */
.btn {
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  border-radius: 11px;
  padding: 11px 18px;
  cursor: pointer;
  transition: transform .08s ease, background .16s ease, border-color .16s ease, opacity .16s;
  font-weight: 550;
}
.btn:hover { background: #232c39; border-color: rgba(255,255,255,.2); }
.btn:active { transform: scale(.98); }
.btn.primary {
  background: var(--accent);
  border-color: transparent;
  color: #06210f;
  font-weight: 700;
}
.btn.primary:hover { background: #63e894; }
.btn.ghost { background: transparent; }
.btn.block { width: 100%; }
.btn.sm { padding: 7px 12px; font-size: 13px; border-radius: 9px; }
.btn.danger { background: transparent; border-color: rgba(248,113,113,.4); color: var(--rose); }
.btn.danger:hover { background: rgba(248,113,113,.1); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ---------- 登录 ---------- */
.auth-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.auth-card {
  width: 100%;
  max-width: 380px;
  background: linear-gradient(180deg, rgba(255,255,255,.035), transparent), var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 30px 26px 22px;
  box-shadow: var(--shadow);
}
.brand { display: flex; align-items: center; gap: 14px; margin-bottom: 24px; }
.brand h1 { font-size: 21px; }
.brand p { margin: 2px 0 0; font-size: 13px; }
.brand-mark {
  width: 48px; height: 48px;
  display: grid; place-items: center;
  border-radius: 14px;
  background: var(--accent-dim);
  color: var(--accent);
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 700;
  border: 1px solid rgba(74, 222, 128, .25);
}

.tabs { display: flex; gap: 6px; background: var(--bg-soft); padding: 4px; border-radius: 12px; margin-bottom: 20px; }
.tab {
  flex: 1; border: 0; background: transparent; color: var(--text-dim);
  padding: 8px; border-radius: 9px; cursor: pointer; font-weight: 550; transition: all .16s;
}
.tab.active { background: var(--surface-2); color: var(--text); box-shadow: 0 1px 8px rgba(0,0,0,.2); }

.field { display: block; margin-bottom: 14px; }
.field span { display: block; font-size: 12.5px; color: var(--text-dim); margin-bottom: 6px; }
.field input {
  width: 100%;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 12px 14px;
  outline: none;
  transition: border-color .16s, background .16s;
}
.field input:focus { border-color: rgba(74, 222, 128, .5); background: #101720; }
.error { color: var(--rose); font-size: 13px; margin: 4px 0 12px; }
.auth-card .btn.primary { margin-top: 6px; }
.auth-card .muted.tiny { margin-top: 16px; }

/* ---------- 应用骨架 ---------- */
.app { display: flex; flex-direction: column; min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 12px 18px;
  background: rgba(14, 17, 22, .82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 10px; }
.dot {
  font-weight: 650; font-size: 14px;
  padding-left: 10px; position: relative;
}
.dot::before {
  content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 5px; height: 5px; border-radius: 50%; background: var(--accent);
}
.pill {
  font-size: 12.5px; color: var(--text-dim);
  border: 1px solid var(--border); border-radius: 999px;
  padding: 4px 10px; background: var(--surface);
}
.pill b { color: var(--text); }
.pill.accent { color: var(--amber); border-color: rgba(251,191,36,.25); background: rgba(251,191,36,.07); }

.main { flex: 1; width: 100%; max-width: 620px; margin: 0 auto; padding: 20px 18px 96px; }
.view-title { font-size: 19px; margin-bottom: 16px; }
.sub-title { font-size: 14px; color: var(--text-dim); margin: 26px 0 12px; font-weight: 550; }

/* ---------- 目标卡 ---------- */
.goal-card {
  display: flex; align-items: center; gap: 22px;
  background: linear-gradient(180deg, rgba(255,255,255,.03), transparent), var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.ring-wrap { position: relative; width: 106px; height: 106px; flex: 0 0 auto; }
.ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 9; stroke-linecap: round; }
.ring-bg { stroke: rgba(255,255,255,.07); }
.ring-fg {
  stroke: var(--accent);
  stroke-dasharray: 327;
  stroke-dashoffset: 327;
  transition: stroke-dashoffset .5s ease;
}
.ring-text {
  position: absolute; inset: 0;
  display: flex; align-items: baseline; justify-content: center; gap: 1px;
  font-size: 13px; color: var(--text-dim);
}
.ring-text b { font-size: 26px; color: var(--text); font-variant-numeric: tabular-nums; }
.ring-text span { font-size: 12px; }
.ring-text i { font-style: normal; }

.goal-meta { flex: 1; min-width: 0; }
.goal-meta h2 { font-size: 18px; margin-bottom: 4px; }
.goal-meta p { margin: 0 0 14px; font-size: 13px; }
.goal-meta .btn { width: 100%; }

.mini-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.mini {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 14px 10px; text-align: center;
}
.mini b { display: block; font-size: 19px; font-variant-numeric: tabular-nums; }
.mini span { font-size: 12px; color: var(--text-dim); }

/* ---------- 卡片学习 ---------- */
.card-stage { display: flex; flex-direction: column; gap: 16px; }
.stage-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

.word-card {
  background: linear-gradient(180deg, rgba(255,255,255,.035), transparent 40%), var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  min-height: 300px;
  padding: 34px 22px 22px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  box-shadow: var(--shadow);
  animation: cardIn .22s ease;
}
@keyframes cardIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.word-front { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.word {
  font-family: var(--serif);
  font-size: clamp(34px, 9vw, 46px);
  font-weight: 600;
  letter-spacing: -0.02em;
  text-align: center;
  word-break: break-word;
  margin: 0;
}
.phonetic { color: var(--text-faint); font-size: 14px; margin: 0; font-family: var(--serif); }

.word-back { margin-top: 22px; width: 100%; border-top: 1px dashed var(--border); padding-top: 20px; }
.trans { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.trans li {
  font-size: 16px; color: var(--text);
  padding-left: 14px; position: relative;
}
.trans li::before {
  content: ''; position: absolute; left: 0; top: .62em;
  width: 4px; height: 4px; border-radius: 50%; background: var(--accent);
}
.reveal { margin-top: 28px; background: transparent; border-style: dashed; color: var(--text-dim); width: 100%; max-width: 280px; }

.grade-bar { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.btn.grade {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 14px 8px; border-radius: 13px; font-weight: 650;
}
.btn.grade em { font-style: normal; font-size: 11.5px; font-weight: 400; opacity: .65; }
.btn.grade.bad { border-color: rgba(248,113,113,.35); color: #fca5a5; background: rgba(248,113,113,.08); }
.btn.grade.mid { border-color: rgba(251,191,36,.35); color: #fcd34d; background: rgba(251,191,36,.08); }
.btn.grade.good { border-color: rgba(74,222,128,.35); color: #86efac; background: rgba(74,222,128,.09); }
.btn.grade:hover { filter: brightness(1.18); }

/* ---------- 测验 ---------- */
.quiz-wrap { display: flex; flex-direction: column; gap: 14px; }
.quiz-card {
  text-align: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: 20px;
  padding: 30px 20px 26px; box-shadow: var(--shadow);
}
.quiz-card .word { margin: 10px 0 6px; }
.options { display: grid; gap: 10px; }
.option {
  text-align: left; padding: 15px 16px; border-radius: 13px;
  background: var(--surface); border: 1px solid var(--border);
  cursor: pointer; transition: all .14s; font-size: 14.5px;
}
.option:hover { border-color: var(--border-strong); background: var(--surface-2); }
.option.correct { border-color: rgba(74,222,128,.6); background: rgba(74,222,128,.13); color: #b6f7cd; }
.option.wrong { border-color: rgba(248,113,113,.6); background: rgba(248,113,113,.12); color: #fecaca; }
.option.disabled { pointer-events: none; opacity: .75; }

/* ---------- 统计 ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat-box {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 16px 12px;
}
.stat-box b { display: block; font-size: 22px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.stat-box span { font-size: 12px; color: var(--text-dim); }

.chart { display: flex; align-items: flex-end; gap: 8px; height: 130px; padding: 0 2px; }
.chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.chart-bar {
  width: 100%; max-width: 34px; border-radius: 6px 6px 3px 3px;
  background: linear-gradient(180deg, var(--accent), rgba(74,222,128,.35));
  min-height: 3px; transition: height .4s ease;
}
.chart-bar.empty { background: rgba(255,255,255,.08); }
.chart-label { font-size: 11px; color: var(--text-faint); }
.chart-val { font-size: 11px; color: var(--text-dim); font-variant-numeric: tabular-nums; }

/* ---------- 我的 ---------- */
.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 4px 16px; margin-bottom: 14px;
}
.row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 0; border-bottom: 1px solid var(--border);
}
.row:last-child { border-bottom: 0; }
.row > span { color: var(--text-dim); font-size: 14px; }
select {
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: 9px;
  padding: 8px 10px; outline: none; cursor: pointer; max-width: 190px;
}
.stepper { display: flex; align-items: center; gap: 10px; }
.stepper b { min-width: 30px; text-align: center; font-variant-numeric: tabular-nums; }

/* ---------- 底栏 ---------- */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  display: flex;
  background: rgba(14,17,22,.92);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
}
.nav-btn {
  flex: 1; border: 0; background: transparent; color: var(--text-faint);
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 8px 4px; border-radius: 11px; cursor: pointer; font-size: 11.5px;
  transition: color .16s, background .16s;
}
.nav-btn span { font-size: 17px; filter: grayscale(.55); transition: filter .16s; }
.nav-btn.active { color: var(--text); background: rgba(255,255,255,.045); }
.nav-btn.active span { filter: none; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%);
  background: var(--surface-2); border: 1px solid var(--border-strong);
  color: var(--text); padding: 10px 18px; border-radius: 999px;
  font-size: 13.5px; z-index: 100; box-shadow: var(--shadow);
  animation: toastIn .18s ease;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

@media (max-width: 380px) {
  .goal-card { gap: 14px; padding: 16px; }
  .ring-wrap { width: 88px; height: 88px; }
  .ring-text b { font-size: 22px; }
  .main { padding: 16px 14px 92px; }
}


/* ========== 卡片配图（必应图片联想） ========== */
.card-img {
  display: block;
  width: 100%;
  max-width: 300px;
  height: 170px;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  margin: 2px 0 16px;
  animation: cardIn .22s ease;
}
.card-img[hidden] { display: none; }

/* ========== 桌面端布局：底部导航改为左侧竖栏 ========== */
.nav-brand { display: none; }

@media (min-width: 900px) {
  .app { padding-left: 232px; }

  .tabbar {
    top: 0;
    right: auto;
    bottom: 0;
    left: 0;
    width: 232px;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 6px;
    padding: 22px 14px;
    border-top: 0;
    border-right: 1px solid var(--border);
    background: rgba(14, 17, 22, .78);
    backdrop-filter: blur(18px);
  }

  .nav-brand {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 4px 12px 16px;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--border);
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: .02em;
  }
  .nav-brand span { font-size: 19px; }

  .nav-btn {
    flex: 0 0 auto;
    flex-direction: row;
    justify-content: flex-start;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 11px 13px;
    border-radius: 12px;
    font-size: 14px;
    text-align: left;
  }
  .nav-btn span { font-size: 17px; }
  .nav-btn:not(.active):hover {
    background: rgba(255, 255, 255, .05);
    color: var(--text-dim);
  }
  .nav-btn.active { background: var(--accent-dim); color: var(--text); }

  .topbar { padding: 14px 34px; }
  .main { max-width: 900px; padding: 28px 34px 64px; }
  .word-card { min-height: 380px; padding: 40px 32px 30px; }
  .word { font-size: 46px; }
  .card-img { height: 200px; max-width: 340px; }
  .grade-bar, .stat-grid, .mini-stats { gap: 14px; }
  .auth-card { max-width: 420px; }
}

/* ================= 答题模式（百词斩式） ================= */

#card-stage { position: relative; }
.round-tip { text-align: center; letter-spacing: .1em; margin: 0; }

.answer-card {
  min-height: 210px;
  padding: 26px 22px 22px;
}
.answer-card .word { margin: 0; }
.answer-card .word.zh {
  font-family: var(--sans);
  font-size: clamp(20px, 5.6vw, 27px);
  line-height: 1.5;
  font-weight: 600;
  letter-spacing: 0;
}

.card-options { display: grid; gap: 10px; margin-top: 2px; }
.card-options .option {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  font-size: 14.5px;
  line-height: 1.45;
  padding: 13px 15px;
}
.card-options .opt-key {
  flex: 0 0 22px;
  height: 22px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--text-faint);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, .03);
}
.card-options .opt-text { flex: 1 1 auto; min-width: 0; }
.card-options .option.correct .opt-key { color: #b6f7cd; border-color: rgba(74, 222, 128, .5); }
.card-options .option.wrong .opt-key { color: #fecaca; border-color: rgba(248, 113, 113, .5); }

/* 打击感：抖动 / 冲击 / 闪光 / 火花 */
@keyframes wb-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-9px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(3px); }
}
@keyframes wb-punch {
  0% { transform: scale(1); }
  35% { transform: scale(1.032); }
  100% { transform: scale(1); }
}
.hit-bad { animation: wb-shake .42s ease-in-out; }
.hit-good { animation: wb-punch .34s ease-out; }

.hit-flash {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 45;
  opacity: 0;
}
.hit-flash.flash-good { animation: wb-flash-good .45s ease-out; }
.hit-flash.flash-bad { animation: wb-flash-bad .45s ease-out; }
@keyframes wb-flash-good {
  0% { opacity: 1; background: radial-gradient(circle at 50% 46%, rgba(74, 222, 128, .26), transparent 62%); }
  100% { opacity: 0; background: radial-gradient(circle at 50% 46%, rgba(74, 222, 128, .26), transparent 62%); }
}
@keyframes wb-flash-bad {
  0% { opacity: 1; background: radial-gradient(circle at 50% 46%, rgba(248, 113, 113, .3), transparent 62%); }
  100% { opacity: 0; background: radial-gradient(circle at 50% 46%, rgba(248, 113, 113, .3), transparent 62%); }
}

.burst-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 46;
  overflow: hidden;
}
.burst-layer .spark {
  position: absolute;
  width: 7px;
  height: 7px;
  margin: -3.5px 0 0 -3.5px;
  border-radius: 50%;
  background: #7ef0a8;
  box-shadow: 0 0 10px rgba(126, 240, 168, .9);
  animation: wb-spark .72s ease-out forwards;
}
@keyframes wb-spark {
  0% { transform: translate(0, 0) scale(1); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(.2); opacity: 0; }
}

/* 连击提示 */
.combo {
  position: fixed;
  top: 15%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 47;
  padding: 7px 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  color: #08130c;
  background: linear-gradient(135deg, #7ef0a8, #4ade80);
  box-shadow: 0 10px 30px rgba(74, 222, 128, .32);
  white-space: nowrap;
}
.combo b { font-size: 19px; }
.combo.pop { animation: wb-combo .5s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes wb-combo {
  0% { transform: translateX(-50%) scale(.6); opacity: 0; }
  55% { transform: translateX(-50%) scale(1.12); opacity: 1; }
  100% { transform: translateX(-50%) scale(1); }
}

/* 轮次横幅 */
.round-banner {
  position: fixed;
  top: 33%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 48;
  display: flex;
  flex-direction: column;
  gap: 5px;
  align-items: center;
  padding: 17px 26px;
  border-radius: 18px;
  background: rgba(12, 16, 24, .93);
  border: 1px solid var(--border-strong);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .55);
  text-align: center;
  max-width: min(88vw, 420px);
}
.round-banner strong { font-size: 17px; }
.round-banner span { font-size: 13px; color: var(--text-dim); }
.round-banner.pop { animation: wb-banner .45s cubic-bezier(.2, 1.3, .4, 1); }
@keyframes wb-banner {
  0% { transform: translateX(-50%) scale(.85); opacity: 0; }
  100% { transform: translateX(-50%) scale(1); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .hit-bad, .hit-good, .combo.pop, .round-banner.pop, .burst-layer .spark { animation: none; }
}

