/* 斩词 · 定制版 —— 移动优先样式(百词斩风格:绿色主色 + 卡片) */
:root {
  --accent: #1fb281;      /* 主色:百词斩绿 */
  --accent-dark: #159168;
  --blue: #3a8ffe;
  --bg: #f5f6f8;
  --card: #ffffff;
  --text: #1c2230;
  --text-soft: #7a8494;
  --line: #eceef1;
  --danger: #f2545b;
  --shadow: 0 4px 16px rgba(20, 30, 50, 0.06);
  --radius: 16px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  background: #dfe3e8; color: var(--text);
  display: flex; align-items: center; justify-content: center;
}

/* 手机外框:在桌面上居中显示为一部手机;在手机上铺满 */
#phone {
  width: 100%; max-width: 440px; height: 100vh; height: 100dvh; max-height: 940px;
  background: var(--bg); position: relative; overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.18);
}
@media (max-width: 460px) { #phone { max-height: none; box-shadow: none; } }

#app { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.view { padding: 20px 18px 24px; }

/* ---------- 底部 Tab ---------- */
#tabbar {
  display: flex; border-top: 1px solid var(--line); background: #fff;
  padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  flex: 1; border: none; background: none; padding: 11px 0 10px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: 12px; color: var(--text-soft);
}
.tab.active { color: var(--accent); }
.tab-ico { font-size: 23px; }

/* ---------- 首页 ---------- */
.home-head { padding: 6px 2px 12px; }
.streak { font-size: 13px; color: var(--text-soft); }
.streak b { color: var(--danger); font-size: 15px; }
.home-head h1 { font-size: 26px; margin: 6px 0 12px; letter-spacing: 0.5px; }
.book-switch {
  border: none; background: #eaf7f2; color: var(--accent-dark); font-weight: 600;
  padding: 10px 14px; border-radius: 12px; width: 100%; display: flex; justify-content: space-between;
  font-size: 14px; cursor: pointer;
}
.book-switch .chev { color: var(--accent); }

.ring-wrap { display: flex; justify-content: center; margin: 10px 0 6px; }
.ring { width: 180px; height: 180px; }
.ring-bg { fill: none; stroke: #e9edf1; stroke-width: 10; }
.ring-fg { fill: none; stroke: var(--accent); stroke-width: 10; stroke-linecap: round; transform: rotate(-90deg); transform-origin: 60px 60px; transition: stroke-dashoffset .6s ease; }
.ring-pct { fill: var(--text); font-size: 22px; font-weight: 700; text-anchor: middle; }
.ring-sub { fill: var(--text-soft); font-size: 9px; text-anchor: middle; }

.plan { display: flex; gap: 12px; margin: 14px 0 22px; }
.plan-card { flex: 1; background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); text-align: center; }
.plan-num { font-size: 34px; font-weight: 800; line-height: 1; }
.plan-title { font-size: 14px; font-weight: 600; margin-top: 6px; }
.plan-sub { font-size: 11px; color: var(--text-soft); margin-top: 2px; }

/* ---------- 按钮 ---------- */
.btn-primary {
  background: var(--accent); color: #fff; border: none; border-radius: 14px;
  padding: 15px; width: 100%; font-size: 16px; font-weight: 700; cursor: pointer;
  box-shadow: 0 6px 16px rgba(31, 178, 129, .3);
}
.btn-primary.big { padding: 17px; font-size: 17px; }
.btn-primary.disabled { background: #c7cdd6; box-shadow: none; }
.btn-primary:active { transform: translateY(1px); }
.btn-ghost { background: #f0f2f5; color: var(--text-soft); border: none; border-radius: 12px; padding: 13px 18px; font-size: 15px; font-weight: 600; cursor: pointer; }

/* ---------- 斩词学习 ---------- */
.learn { padding-top: 14px; }
.learn-progress { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.learn-bar { flex: 1; height: 6px; background: #e6e9ee; border-radius: 3px; overflow: hidden; }
.learn-bar-fill { height: 100%; background: var(--accent); border-radius: 3px; transition: width .3s; }
.learn-count { font-size: 12px; color: var(--text-soft); }

.word-box { text-align: center; margin: 8px 0 26px; }
.the-word { font-size: 44px; font-weight: 800; letter-spacing: 1px; }
.the-phonetic { color: var(--text-soft); font-size: 16px; margin-top: 8px; }
.audio-btn { margin-top: 14px; background: #eaf7f2; color: var(--accent-dark); border: none; border-radius: 24px; padding: 11px 24px; font-size: 16px; font-weight: 600; cursor: pointer; }
.audio-btn.small { padding: 8px 14px; margin: 0; font-size: 15px; }
.audio-btn.tiny { padding: 6px 12px; margin: 0 0 0 8px; font-size: 14px; }

.options { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.opt {
  background: var(--card); border: 2px solid transparent; border-radius: var(--radius);
  padding: 16px 12px; cursor: pointer; box-shadow: var(--shadow); text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 10px; min-height: 150px; justify-content: center;
  font-size: 16px; color: var(--text); transition: border-color .15s, background .15s;
}
.opt-img { width: 92px; height: 92px; object-fit: cover; border-radius: 12px; background: #f0f2f5; }
.opt-text { font-weight: 600; }
.opt.locked { pointer-events: none; }
.opt.right { border-color: var(--accent); background: #eafaf4; }
.opt.wrong { border-color: var(--danger); background: #fdecec; }
.dunno { display: block; margin: 22px auto 0; background: #f0f2f5; border: none; color: var(--text-soft); font-size: 15px; padding: 12px 28px; border-radius: 22px; cursor: pointer; }

/* 详情卡 */
.detail { text-align: center; padding-top: 8px; }
.detail-badge { display: inline-block; padding: 5px 14px; border-radius: 16px; font-size: 13px; font-weight: 700; margin-bottom: 18px; }
.detail-badge.ok { background: #eafaf4; color: var(--accent-dark); }
.detail-badge.no { background: #fdecec; color: var(--danger); }
.detail-img { width: 140px; height: 140px; object-fit: cover; border-radius: 16px; background: #f0f2f5; display: block; margin: 0 auto 16px; box-shadow: var(--shadow); }
.detail-word { font-size: 36px; font-weight: 800; }
.detail-phonetic { color: var(--text-soft); margin: 8px 0; display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 15px; }
.detail-pos { font-size: 18px; font-weight: 600; margin: 6px 0 20px; }
.detail-example { background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); text-align: left; margin-bottom: 24px; }
.ex-en { font-size: 15px; font-weight: 600; display: flex; align-items: center; }
.ex-cn { font-size: 13px; color: var(--text-soft); margin-top: 6px; }

.finish { text-align: center; padding: 60px 20px; }
.finish-emoji { font-size: 60px; }
.finish h2 { margin: 16px 0 6px; }
.finish p { color: var(--text-soft); margin-bottom: 28px; }

/* ---------- 通用页头 ---------- */
.page-head { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.page-head h1 { font-size: 22px; flex: 1; }
.back { background: none; border: none; font-size: 28px; color: var(--text); cursor: pointer; line-height: 1; padding: 0 4px 0 0; }
.btn-add, .btn-add span { color: var(--accent-dark); }
.btn-add { background: #eaf7f2; border: none; border-radius: 10px; padding: 8px 12px; font-size: 13px; font-weight: 600; cursor: pointer; }
.empty { text-align: center; color: var(--text-soft); font-size: 14px; padding: 40px 20px; line-height: 1.6; }

/* ---------- 词库列表 ---------- */
.book-list { display: flex; flex-direction: column; gap: 12px; }
.book-item { background: var(--card); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); display: flex; align-items: center; gap: 10px; border: 2px solid transparent; }
.book-item.active { border-color: var(--accent); }
.book-main { flex: 1; cursor: pointer; }
.book-name { font-size: 16px; font-weight: 700; }
.book-desc { font-size: 12px; color: var(--text-soft); margin-top: 3px; }
.book-use { border: 1px solid var(--line); background: #fff; color: var(--text-soft); border-radius: 18px; padding: 7px 14px; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.book-use.on { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ---------- 词书详情 ---------- */
.book-sub { color: var(--text-soft); font-size: 13px; margin-bottom: 14px; }
.book-actions { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.chip { background: #eef1f4; border: none; border-radius: 18px; padding: 8px 14px; font-size: 13px; font-weight: 600; color: var(--text); cursor: pointer; }
.chip.danger { background: #fdecec; color: var(--danger); }
.word-list { display: flex; flex-direction: column; gap: 8px; }
.word-row { background: var(--card); border-radius: 12px; padding: 12px 14px; box-shadow: var(--shadow); display: flex; align-items: center; gap: 6px; }
.word-row-main { flex: 1; min-width: 0; }
.wr-word { font-size: 16px; font-weight: 700; display: flex; align-items: baseline; gap: 8px; }
.wr-ph { font-size: 12px; color: var(--text-soft); font-weight: 400; }
.wr-mean { font-size: 13px; color: var(--text-soft); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn { background: #f4f6f8; border: none; font-size: 18px; cursor: pointer; padding: 9px 11px; border-radius: 10px; color: var(--text-soft); margin-left: 2px; }
.icon-btn.danger { color: var(--danger); }

/* ---------- 弹窗 ---------- */
.overlay { position: absolute; inset: 0; background: rgba(0, 0, 0, .4); display: flex; align-items: flex-end; z-index: 20; }
.modal { background: #fff; width: 100%; border-radius: 20px 20px 0 0; padding: 22px 18px calc(22px + env(safe-area-inset-bottom)); }
.modal h3 { margin-bottom: 10px; }
.modal-hint { font-size: 12px; color: var(--text-soft); line-height: 1.7; margin-bottom: 12px; }
.modal-hint code { background: #f0f2f5; padding: 1px 5px; border-radius: 4px; font-size: 11px; }
.import-area { width: 100%; height: 160px; border: 1px solid var(--line); border-radius: 12px; padding: 12px; font-size: 13px; font-family: monospace; resize: none; }
.modal-bar { display: flex; gap: 10px; margin-top: 14px; }
.modal-bar .btn-primary { flex: 1; }

/* ---------- 我的 ---------- */
.me-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 22px; }
.me-stat { background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); text-align: center; }
.ms-ico { font-size: 22px; }
.ms-num { font-size: 26px; font-weight: 800; margin: 4px 0 2px; }
.ms-label { font-size: 12px; color: var(--text-soft); }
.settings { margin-bottom: 22px; }
.settings h3 { font-size: 15px; margin-bottom: 10px; }
.set-row { background: var(--card); border-radius: 12px; padding: 12px 16px; box-shadow: var(--shadow); display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-size: 14px; }
.set-input { width: 70px; text-align: center; border: 1px solid var(--line); border-radius: 8px; padding: 6px; font-size: 15px; }
.data-ops { display: flex; gap: 8px; flex-wrap: wrap; }
.foot-note { text-align: center; color: #aab2bd; font-size: 11px; margin-top: 10px; }
