:root {
  --bg: #1c1c1e;
  --bg-elevated: #2a2a2d;
  --card: #262629;
  --line: #38383b;
  --text: #ececed;
  --muted: #8a8a90;
  --accent: #34c0a0;        /* 主色：青绿，和墨墨的单词色接近 */
  --accent-soft: rgba(52, 192, 160, .14);
  --know: #34c0a0;
  --vague: #e6a23c;
  --forget: #f06a5a;
  --mastered: #34c0a0;
  --review: #4f8cff;
  --learning: #e6a23c;
  --new: #55555b;
  --radius: 16px;
  --shadow: 0 6px 20px rgba(0, 0, 0, .3);
  --tabbar-h: 58px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  position: relative;
}

/* 顶部栏 */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  position: sticky; top: 0; z-index: 10;
  background: rgba(28, 28, 30, .85);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; }
.logo {
  width: 30px; height: 30px; border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), #3fd8b4);
  color: #08201b; display: grid; place-items: center; font-weight: 800; font-size: 18px;
}
.brand-name { font-weight: 700; font-size: 17px; }
.streak {
  font-size: 14px; font-weight: 600; color: var(--text);
  background: var(--bg-elevated); padding: 5px 11px; border-radius: 20px; border: 1px solid var(--line);
}

/* 主区 */
main { flex: 1; padding: 8px 16px 90px; overflow-y: auto; }

/* 首页 hero */
.hero {
  background: linear-gradient(135deg, #1f5d51, #2b8a75 55%, #34c0a0);
  color: #f2fffb; border-radius: 22px; padding: 24px 22px 26px;
  box-shadow: var(--shadow); margin: 10px 0 16px;
}
.hero-date { font-size: 13px; opacity: .85; }
.hero-title { font-size: 15px; opacity: .95; margin-top: 6px; }
.hero-big { font-size: 54px; font-weight: 800; line-height: 1.1; margin: 2px 0; }
.hero-big .unit { font-size: 18px; font-weight: 500; opacity: .8; }
.hero-sub { font-size: 14px; opacity: .9; margin-bottom: 18px; }

.btn-primary {
  background: var(--accent); color: #06231d; border: none;
  padding: 12px 20px; border-radius: 14px; font-size: 15px; font-weight: 700;
  cursor: pointer; transition: transform .08s, opacity .2s; width: 100%;
}
.btn-primary:active { transform: scale(.98); }
.btn-primary:disabled { opacity: .5; cursor: default; }
.btn-primary.big { padding: 15px; font-size: 16px; }
.hero .btn-primary { background: #eafff9; color: #0c4a3d; }
.hero .btn-primary:disabled { background: rgba(255,255,255,.2); color: #eafff9; }
.btn-ghost { background: transparent; border: none; color: var(--muted); padding: 10px; margin-top: 8px; cursor: pointer; width: 100%; font-size: 14px; }
.btn-danger { background: rgba(240,106,90,.12); color: var(--forget); border: 1px solid rgba(240,106,90,.4); padding: 11px; border-radius: 12px; font-weight: 600; cursor: pointer; width: 100%; }

/* 卡片 */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.card-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; font-size: 15px; }
.card-row:last-child { margin-bottom: 0; }
.tip p { margin: 6px 0 0; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.center { text-align: center; }

/* 进度条 */
.progress { background: #3a3a3e; border-radius: 20px; height: 10px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent), #3fd8b4); border-radius: 20px; transition: width .3s; }

/* 统计小卡 */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.stat-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; text-align: center; }
.stat-num { font-size: 28px; font-weight: 800; color: var(--accent); }
.stat-label { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

/* ---------- 学习卡片（核心，仿墨墨） ---------- */
/* 学习页隐藏顶部栏，卡片直接顶上去 */
body.study-mode .topbar { display: none; }
body.study-mode main { padding-top: 16px; }

.badge-new { background: var(--vague); color: #241800; font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 10px; }
.badge-review { background: var(--accent-soft); color: var(--accent); font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 10px; }

.wordcard {
  position: relative;
  background: var(--card); border: 1px solid var(--line); border-radius: 18px;
  padding: 52px 24px 30px; min-height: 320px;
}
.wordcard.tappable { cursor: pointer; display: flex; flex-direction: column; justify-content: center; }
.wordcard.tappable:active { border-color: var(--accent); }
/* 卡片顶部：左侧 新词/复习 + 考纲标签，右侧 计数 */
.wcard-top { position: absolute; top: 14px; left: 16px; right: 16px; display: flex; align-items: center; justify-content: space-between; gap: 8px; z-index: 1; }
.wt-left { display: flex; align-items: center; gap: 8px; }
.counter-corner { font-size: 13px; color: var(--muted); font-weight: 600; }
.corner-tag { font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 2px 7px; letter-spacing: .3px; }

.word-main { text-align: center; font-size: 44px; font-weight: 800; color: var(--accent); letter-spacing: .5px; }
.phon-line { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 14px; }
.accent { font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; }
.phonetic { color: var(--muted); font-size: 16px; }
.speak { background: transparent; border: none; color: var(--accent); font-size: 18px; cursor: pointer; padding: 2px; }
.speak:active { opacity: .6; }

.divider { height: 1px; background: var(--line); margin: 24px 0 20px; }
.meaning-row { font-size: 20px; font-weight: 600; line-height: 1.55; }
.recall-hint { margin-top: 34px; text-align: center; color: var(--muted); font-size: 13px; letter-spacing: .3px; }
.pos { color: var(--accent); font-style: italic; font-weight: 500; margin-right: 6px; }
.meaning { color: var(--text); }

/* 显示/隐藏例句 */
.reveal.hide { display: none; }
.reveal.show { display: block; }

.section { margin-top: 24px; }
.section-head { color: var(--muted); font-size: 12px; letter-spacing: 1px; margin-bottom: 12px; text-transform: uppercase; }
.ex { margin-bottom: 15px; }
.ex:last-child { margin-bottom: 0; }
.ex-en { font-size: 16px; line-height: 1.65; color: #dcdce0; }
.ex-en .hl { color: var(--accent); }
.ex-zh { font-size: 14px; color: var(--muted); margin-top: 4px; }
.mne-note { font-size: 15px; color: #dcdce0; margin: 0; line-height: 1.7; }

/* 评分按钮：认识 / 模糊 / 忘记（描边风格，固定在底部导航上方） */
.actions {
  position: fixed; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding: 14px 16px 10px;
  background: linear-gradient(to top, var(--bg) 62%, transparent);
  z-index: 15; pointer-events: none;
}
.grade-row { pointer-events: auto; }
.grade-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.grade {
  background: transparent; border: 1.5px solid; border-radius: 12px; padding: 8px 6px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px; transition: transform .08s, background .15s;
}
.grade:active { transform: scale(.96); }
.g-main { font-size: 14px; font-weight: 700; }
.g-sub { font-size: 10px; opacity: .8; }
/* 翻开后底部留白，避免最后的例句/助记被固定按钮遮住 */
.action-spacer { height: 92px; }
.g-know { border-color: var(--know); color: var(--know); }
.g-know:active { background: rgba(52,192,160,.12); }
.g-vague { border-color: var(--vague); color: var(--vague); }
.g-vague:active { background: rgba(230,162,60,.12); }
.g-forget { border-color: var(--forget); color: var(--forget); }
.g-forget:active { background: rgba(240,106,90,.12); }

/* 空状态 */
.empty { text-align: center; padding: 60px 20px; }
.empty-emoji { font-size: 60px; }
.empty-title { font-size: 20px; font-weight: 700; margin: 12px 0 6px; }
.empty .btn-primary { max-width: 240px; margin: 18px auto 0; }

/* 页标题 */
.page-title { font-size: 20px; font-weight: 700; margin: 14px 4px 12px; }

/* 图表 */
.chart { display: flex; align-items: flex-end; gap: 6px; height: 130px; padding-top: 10px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; }
.bar { width: 70%; background: linear-gradient(180deg, #3fd8b4, var(--accent)); border-radius: 5px 5px 0 0; min-height: 4px; }
.bar-x { font-size: 9px; color: var(--muted); margin-top: 5px; transform: rotate(-45deg); white-space: nowrap; }

.stack-bar { display: flex; height: 14px; border-radius: 8px; overflow: hidden; background: var(--new); }
.seg { height: 100%; }
.seg-mastered { background: var(--mastered); }
.seg-review { background: var(--review); }
.seg-learning { background: var(--learning); }
.seg-new { background: var(--new); }
.legend { display: flex; flex-wrap: wrap; gap: 10px 16px; margin-top: 12px; font-size: 12.5px; color: var(--muted); }
.legend .dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: middle; }

/* 词库 */
.slider { width: 100%; accent-color: var(--accent); margin-top: 8px; }
.voice-sel { width: 100%; background: var(--bg-elevated); color: var(--text); border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; font-size: 14px; font-family: inherit; margin-top: 4px; }
.voice-sel:focus { outline: none; border-color: var(--accent); }
.btn-mini { background: var(--accent-soft); color: var(--accent); border: none; border-radius: 10px; padding: 6px 12px; font-size: 13px; font-weight: 600; cursor: pointer; }
.btn-mini:active { opacity: .7; }
.range-label { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }
.import-area { width: 100%; min-height: 90px; background: var(--bg-elevated); border: 1px solid var(--line); border-radius: 12px; padding: 10px; font-family: inherit; font-size: 13px; resize: vertical; margin-bottom: 10px; color: var(--text); }
.import-area:focus { outline: none; border-color: var(--accent); }
code { background: var(--bg-elevated); padding: 1px 5px; border-radius: 5px; font-size: 12px; color: var(--accent); }

.wordtable { width: 100%; border-collapse: collapse; }
.wordtable td { padding: 10px 4px; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: 14px; }
.wordtable td:last-child { text-align: right; white-space: nowrap; }
.pill { font-size: 11px; padding: 3px 9px; border-radius: 10px; color: #fff; }
.s-new { background: #5a5a60; }
.s-learning { background: var(--learning); color: #241800; }
.s-review { background: var(--review); }
.s-mastered { background: var(--mastered); color: #06231d; }

.danger-zone { border-color: rgba(240,106,90,.35); }

/* 底部导航 */
.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: rgba(28,28,30,.94); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line); padding: 8px 0 max(8px, env(safe-area-inset-bottom));
  z-index: 20;
}
.tab {
  background: none; border: none; cursor: pointer; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px;
  padding: 4px 0; transition: color .2s;
}
.tab .ic { font-size: 20px; opacity: .55; transition: all .2s; }
.tab.active { color: var(--accent); font-weight: 600; }
.tab.active .ic { opacity: 1; transform: translateY(-1px); }
