:root {
  --bg: #0b0e1c;
  --card: rgba(255, 255, 255, 0.05);
  --card-2: rgba(255, 255, 255, 0.08);
  --line: rgba(255, 255, 255, 0.1);
  --ink: #e9edff;
  --ink-2: #8c93bb;
  --cy: #22d3ee;
  --vi: #8b5cf6;
  --pk: #fb7185;
  --am: #fbbf24;
  --ok: #34d399;
  --grad: linear-gradient(135deg, #22d3ee 0%, #8b5cf6 100%);
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
}

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

html, body {
  font-family: -apple-system, "PingFang SC", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  min-height: 100%;
}

body {
  background:
    radial-gradient(1100px 520px at 85% -8%, rgba(139, 92, 246, 0.2), transparent 60%),
    radial-gradient(900px 480px at -12% 28%, rgba(34, 211, 238, 0.13), transparent 60%),
    radial-gradient(700px 420px at 110% 88%, rgba(251, 113, 133, 0.08), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  position: relative;
  padding-bottom: 78px;
  display: flex;
  flex-direction: column;
}

/* ===== 顶栏 ===== */
.topbar {
  padding: 16px 18px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(11, 14, 28, 0.9), rgba(11, 14, 28, 0.55));
}
.brand { display: flex; align-items: center; gap: 11px; }
.brand .logo {
  width: 40px; height: 40px; border-radius: 12px;
  background: var(--grad);
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 18px; color: #fff;
  box-shadow: 0 0 18px rgba(139, 92, 246, 0.45);
}
.brand .name { font-size: 17px; font-weight: 800; letter-spacing: 1px; color: var(--ink); }
.brand .sub { font-size: 9px; color: var(--cy); letter-spacing: 3px; margin-top: 2px; opacity: 0.85; }
.slogan { font-size: 12px; color: var(--ink-2); text-align: right; line-height: 1.55; }
.slogan b {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ===== 页面切换 ===== */
.screen { display: none; padding: 16px 16px 8px; flex: 1; }
.screen.active { display: block; }

/* ===== 首页 ===== */
.hero {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 20px 18px 16px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: 20px;
  padding: 1px;
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.55), rgba(139, 92, 246, 0.55), transparent 60%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}
.hero .date { font-size: 12px; color: var(--ink-2); margin-bottom: 6px; letter-spacing: 0.5px; }
.hero h1 { font-size: 20px; font-weight: 800; margin-bottom: 14px; color: var(--ink); }
.hero h1 em {
  font-style: normal;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.task-row { display: flex; gap: 10px; }
.task-box {
  flex: 1;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
}
.task-box .num {
  font-size: 28px; font-weight: 900; line-height: 1.1;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.task-box .lbl { font-size: 12px; color: var(--ink-2); margin-top: 3px; }

.big-btn {
  display: block; width: 100%;
  border: none; cursor: pointer;
  background: var(--grad);
  color: #fff; font-size: 18px; font-weight: 800; letter-spacing: 3px;
  padding: 15px; border-radius: 15px;
  box-shadow: 0 6px 24px rgba(94, 122, 255, 0.35);
  margin-top: 16px;
  font-family: inherit;
  transition: transform 0.1s;
}
.big-btn.secondary {
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--cy);
  box-shadow: none;
}
.big-btn:active { transform: translateY(2px); }

.bank-chips { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line); background: var(--card); color: var(--ink-2);
  border-radius: 999px; padding: 7px 16px; font-size: 14px; cursor: pointer;
  font-family: inherit; font-weight: 600;
  transition: all 0.15s;
}
.chip.on {
  background: var(--grad); border-color: transparent; color: #fff;
  box-shadow: 0 4px 14px rgba(94, 122, 255, 0.3);
}

.stat-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 16px; }
.strip-item {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 11px 4px; text-align: center;
}
.strip-item .v { font-size: 17px; font-weight: 900; color: var(--cy); }
.strip-item .v.hot { color: var(--pk); }
.strip-item .k { font-size: 11px; color: var(--ink-2); margin-top: 3px; }

.section-title {
  font-size: 15px; font-weight: 800; margin: 22px 0 12px;
  display: flex; align-items: center; gap: 9px; letter-spacing: 1px;
}
.section-title::before {
  content: ""; width: 4px; height: 16px; border-radius: 2px;
  background: var(--grad);
  box-shadow: 0 0 8px rgba(34, 211, 238, 0.6);
}

/* ===== 学习会话 ===== */
.session-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.session-head .left { font-size: 13px; color: var(--ink-2); }
.session-head .left b { color: var(--cy); font-size: 16px; }
.link-btn {
  border: none; background: none; color: var(--ink-2); font-size: 13px; cursor: pointer;
  text-decoration: underline; font-family: inherit;
}
.progress-track { height: 6px; background: rgba(255, 255, 255, 0.08); border-radius: 3px; overflow: hidden; }
.progress-bar {
  height: 100%; width: 0%;
  background: var(--grad);
  box-shadow: 0 0 10px rgba(34, 211, 238, 0.7);
  transition: width 0.3s;
}

.card-main {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 28px 18px;
  margin-top: 14px;
  text-align: center;
  min-height: 300px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}
.phase-tag {
  font-size: 11px; color: var(--cy); font-weight: 700; letter-spacing: 3px;
  margin-bottom: 16px; text-transform: uppercase;
}
.word-big {
  font-size: 46px; font-weight: 900; color: #fff;
  letter-spacing: 1px; line-height: 1.15;
  text-shadow: 0 0 24px rgba(34, 211, 238, 0.35);
}
.phon { font-size: 15px; color: var(--ink-2); margin-top: 8px; letter-spacing: 1px; }
.meaning { font-size: 22px; font-weight: 800; margin-top: 12px; color: var(--ink); }
.mnemonic {
  margin-top: 16px;
  background: rgba(251, 191, 36, 0.08);
  border: 1px dashed rgba(251, 191, 36, 0.35);
  color: #fde68a;
  border-radius: 12px;
  padding: 11px 13px;
  font-size: 13px;
  text-align: left;
  line-height: 1.7;
}
.mnemonic b { color: var(--am); }

.btn-row { display: flex; gap: 10px; margin-top: 20px; width: 100%; }
.btn {
  flex: 1; border: none; border-radius: 13px; padding: 13px 8px;
  font-size: 16px; font-weight: 800; cursor: pointer; font-family: inherit;
  transition: transform 0.1s;
}
.btn:active { transform: scale(0.97); }
.btn-grey { background: var(--card-2); color: var(--ink-2); border: 1px solid var(--line); }
.btn-blue { background: rgba(34, 211, 238, 0.16); color: var(--cy); border: 1px solid rgba(34, 211, 238, 0.4); }
.btn-red {
  background: var(--grad); color: #fff;
  box-shadow: 0 4px 18px rgba(139, 92, 246, 0.4);
}
.btn-yellow { background: rgba(251, 191, 36, 0.13); color: var(--am); border: 1px solid rgba(251, 191, 36, 0.35); }
.btn-outline { background: transparent; border: 1.5px solid var(--line); color: var(--ink-2); }

.opts { width: 100%; display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.opt {
  border: 1px solid var(--line); background: var(--card);
  border-radius: 13px;
  padding: 13px 14px; font-size: 16px; text-align: left; cursor: pointer; font-family: inherit;
  font-weight: 600; color: var(--ink);
  transition: all 0.15s;
}
.opt.right {
  border-color: var(--ok);
  background: rgba(52, 211, 153, 0.12);
  color: var(--ok);
  box-shadow: 0 0 14px rgba(52, 211, 153, 0.25);
}
.opt.wrong {
  border-color: var(--pk);
  background: rgba(251, 113, 133, 0.12);
  color: var(--pk);
}
.opt:disabled { cursor: default; }

.spell-input {
  width: 100%; font-size: 22px; text-align: center; padding: 12px;
  border: 1.5px solid var(--line); border-radius: 13px; outline: none;
  font-family: inherit; letter-spacing: 2px; color: #fff; font-weight: 700;
  background: rgba(255, 255, 255, 0.05);
  text-transform: lowercase;
}
.spell-input:focus { border-color: var(--cy); box-shadow: 0 0 14px rgba(34, 211, 238, 0.3); }
.spell-hint { font-size: 12px; color: var(--ink-2); margin-top: 9px; }

.feedback { margin-top: 12px; font-size: 14px; font-weight: 700; min-height: 20px; }
.feedback.ok { color: var(--ok); }
.feedback.bad { color: var(--pk); }

/* ===== 报告页 ===== */
.report-hero {
  background: linear-gradient(150deg, rgba(52, 211, 153, 0.16), rgba(34, 211, 238, 0.12) 55%, rgba(139, 92, 246, 0.16));
  border: 1px solid rgba(52, 211, 153, 0.35);
  border-radius: 20px;
  padding: 22px 18px;
  text-align: center;
  box-shadow: var(--shadow);
  margin-top: 8px;
}
.report-hero .big { font-size: 40px; font-weight: 900; color: var(--ok); text-shadow: 0 0 20px rgba(52, 211, 153, 0.4); }
.report-hero .big small { font-size: 16px; color: var(--ink); font-weight: 600; }
.report-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.report-grid .strip-item {
  box-shadow: none;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
}
.report-grid .v { color: #fff; font-size: 19px; }
.report-grid .k { color: var(--ink-2); }

/* ===== 数据页 ===== */
.rank-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 16px; box-shadow: var(--shadow);
  padding: 16px; margin-bottom: 12px;
}
.rank-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.rank-head .t { font-weight: 800; font-size: 15px; }
.rank-head .n { font-size: 12px; color: var(--ink-2); }
.rank-row { margin-bottom: 12px; }
.rank-row:last-child { margin-bottom: 0; }
.rank-row .lbl { display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-2); margin-bottom: 6px; }
.rank-row .lbl b { color: var(--ink); }
.rank-bar { height: 8px; border-radius: 4px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.rank-bar i { display: block; height: 100%; border-radius: 4px; transition: width 0.4s; }

.chart-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 16px; box-shadow: var(--shadow); padding: 16px;
}
.chart { display: flex; align-items: flex-end; gap: 6px; height: 110px; margin-top: 10px; }
.chart .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; height: 100%; justify-content: flex-end; }
.chart .bar {
  width: 100%;
  background: linear-gradient(180deg, var(--vi), var(--cy));
  border-radius: 4px 4px 0 0;
  min-height: 2px;
  box-shadow: 0 0 8px rgba(139, 92, 246, 0.4);
}
.chart .d { font-size: 9px; color: var(--ink-2); white-space: nowrap; }

/* ===== 设置 / 导入 ===== */
.panel {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 16px; box-shadow: var(--shadow);
  padding: 16px; margin-bottom: 14px;
}
.panel h3 { font-size: 15px; margin-bottom: 10px; }
.panel p { font-size: 13px; color: var(--ink-2); line-height: 1.75; }
.panel code { color: var(--cy); background: rgba(34, 211, 238, 0.1); padding: 1px 5px; border-radius: 4px; }
.setting-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 14px;
}
.setting-row:last-child { border-bottom: none; }
.num-chips { display: flex; gap: 6px; }
.num-chips .chip { padding: 5px 13px; font-size: 13px; }
textarea.io {
  width: 100%; height: 160px;
  border: 1.5px solid var(--line); border-radius: 12px;
  padding: 10px; font-size: 13px; font-family: Consolas, monospace; resize: vertical;
  outline: none; color: var(--ink); background: rgba(255, 255, 255, 0.04);
}
textarea.io:focus { border-color: var(--cy); }
.warn { color: var(--pk); font-size: 12px; }

/* ===== 底部导航 ===== */
.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px;
  background: rgba(13, 16, 32, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  display: flex; z-index: 10;
}
.tab {
  flex: 1; border: none; background: none; padding: 10px 0 12px;
  font-size: 12px; color: var(--ink-2); cursor: pointer; font-family: inherit;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  letter-spacing: 1px;
}
.tab .ico { font-size: 19px; line-height: 1; }
.tab.on { color: var(--cy); font-weight: 700; text-shadow: 0 0 12px rgba(34, 211, 238, 0.5); }

/* toast */
#toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%) translateY(20px);
  background: rgba(23, 27, 52, 0.95); border: 1px solid var(--line);
  color: var(--ink); font-size: 13px;
  padding: 9px 18px; border-radius: 999px; opacity: 0; pointer-events: none;
  transition: all 0.25s; z-index: 99; white-space: nowrap;
  box-shadow: var(--shadow);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.done-note { text-align: center; padding: 40px 10px; color: var(--ink-2); }
.done-note .big-ico { font-size: 52px; margin-bottom: 12px; }
.done-note h2 { color: var(--ok); font-size: 20px; margin-bottom: 8px; }

/* ===== 伴读引擎 ===== */
.coach-bar { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.coach-avatar {
  width: 42px; height: 42px; border-radius: 13px; flex: none;
  background: var(--card-2);
  border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  box-shadow: 0 0 14px rgba(139, 92, 246, 0.3);
}
.coach-bubble {
  flex: 1;
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 3px solid var(--cy);
  border-radius: 6px 14px 14px 6px;
  padding: 9px 12px;
  font-size: 13px; line-height: 1.55; color: var(--ink);
}
.coach-mute {
  border: 1px solid var(--line); background: var(--card);
  width: 36px; height: 36px; border-radius: 12px; font-size: 15px;
  cursor: pointer; flex: none; color: var(--ink-2);
}
.coach-mute:active { transform: scale(0.92); }

/* ===== 单词发音按钮 ===== */
.word-row { display: flex; align-items: center; justify-content: center; gap: 14px; }
.speak-btn {
  border: 1px solid rgba(34, 211, 238, 0.4);
  background: rgba(34, 211, 238, 0.12);
  color: var(--cy);
  font-size: 17px; width: 42px; height: 42px; border-radius: 50%;
  cursor: pointer; flex: none;
  transition: all 0.15s;
}
.speak-btn:active { transform: scale(0.9); box-shadow: 0 0 16px rgba(34, 211, 238, 0.5); }
.speak-btn.big {
  width: auto; border-radius: 999px; padding: 0 22px; height: 42px;
  font-size: 15px; margin-top: 16px; font-weight: 700; font-family: inherit;
}
