/* ===== 单词消消拼 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
:root {
  --bg: #fdf3e3;
  --card: #ffffff;
  --ink: #4a3f35;
  --sub: #9b8a76;
  --red: #f43b47;
  --red-deep: #e62f3c;
  --yellow: #ffdf52;
  --green: #21b573;
  --shadow: 0 4px 16px rgba(120, 85, 40, .08);
  --radius: 18px;
}
html, body { height: 100%; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  max-width: 520px;
  margin: 0 auto;
  min-height: 100vh;
  overflow-x: hidden;
}
button { font-family: inherit; border: none; cursor: pointer; background: none; color: inherit; }
#app { padding: 14px 14px 30px; }

/* ---------- 通用组件 ---------- */
.sect-title { display: flex; align-items: center; gap: 8px; font-size: 17px; font-weight: 800; margin: 20px 0 10px; }
.sect-title::before { content: ""; width: 4px; height: 16px; background: var(--red); border-radius: 2px; }
.btn {
  display: block; width: 100%; padding: 13px; border-radius: 14px;
  font-size: 16px; font-weight: 700; text-align: center; transition: transform .1s, opacity .15s;
}
.btn:active { transform: scale(.97); }
.btn-red { background: linear-gradient(180deg, #ff5a64, var(--red)); color: #fff; box-shadow: 0 4px 10px rgba(244, 59, 71, .3); }
.btn-ghost { border: 2px dashed #e3d3ba; color: var(--sub); background: transparent; }
.btn-line { border: 1.5px solid #eee0c8; color: var(--ink); background: #fff; }
.pill { display: inline-block; padding: 4px 12px; border-radius: 999px; font-size: 13px; font-weight: 700; }
.pill-green { background: var(--green); color: #fff; }
.pill-soft { background: #f6ead2; color: var(--sub); font-weight: 600; }

/* ---------- 首页 ---------- */
.hero { position: relative; text-align: center; padding: 18px 0 6px; }
.hero-badges { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.hero-badges .tag-chip { padding: 5px 14px; border-radius: 999px; color: #fff; font-size: 13px; font-weight: 700; transform: rotate(-3deg); }
.deco-letters { display: flex; justify-content: center; gap: 5px; margin: 6px 0 10px; }
.deco-letters span {
  width: 30px; height: 34px; background: #fff; border-radius: 8px; box-shadow: var(--shadow);
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 16px; color: #6b5b4a; text-transform: uppercase;
  transform: rotate(-2deg);
}
.deco-letters span:nth-child(even) { transform: rotate(3deg) translateY(-3px); }
.deco-letters span:nth-child(3n) { transform: rotate(-1deg) translateY(2px); }
.title-banner {
  display: inline-block; background: linear-gradient(180deg, #ff4d57, var(--red-deep));
  color: #fff; font-size: 30px; font-weight: 900; letter-spacing: 2px;
  padding: 12px 30px; border-radius: 22px; transform: rotate(-2deg);
  box-shadow: 0 6px 0 rgba(214, 40, 49, .35), 0 10px 24px rgba(244, 59, 71, .25);
  margin: 4px 0 14px;
}
.title-banner .y { color: var(--yellow); }
.rule-card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px 16px; font-size: 13.5px; line-height: 1.9; color: #7a6c5c; text-align: left;
}
.rule-card b { color: var(--red); }
.rule-card .heart { color: #ff4b5c; }

.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 14px; }
.stat-cell { background: var(--card); border-radius: 14px; box-shadow: var(--shadow); padding: 10px 4px; text-align: center; }
.stat-cell .n { font-size: 18px; font-weight: 800; color: var(--red); }
.stat-cell .t { font-size: 11px; color: var(--sub); margin-top: 2px; }

.book-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.book-card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px 6px 12px; text-align: center; border: 2.5px solid transparent;
  transition: transform .12s, border-color .12s, background .12s; position: relative;
}
.book-card:active { transform: scale(.96); }
.book-card .ico { font-size: 24px; line-height: 1; }
.book-card .nm { font-size: 16px; font-weight: 800; margin-top: 6px; }
.book-card .sb { font-size: 11px; color: var(--sub); margin-top: 3px; }
.book-card .pg { font-size: 10.5px; color: #c9b391; margin-top: 5px; }
.book-card.done-flash { border-color: var(--green); background: #f0fff8; }

.home-extra { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.extra-card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 13px 14px; display: flex; align-items: center; gap: 10px; text-align: left; width: 100%;
}
.extra-card:active { transform: scale(.97); }
.extra-card .ico { font-size: 22px; }
.extra-card .tx .a { font-size: 14.5px; font-weight: 800; }
.extra-card .tx .b { font-size: 11px; color: var(--sub); margin-top: 2px; }
.footer-tip { text-align: center; color: #c9b391; font-size: 11px; margin-top: 22px; }

/* ---------- 开始页 ---------- */
.start-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 18px; margin-top: 14px; text-align: center; }
.start-card .big-ico { font-size: 44px; }
.start-card h2 { font-size: 22px; margin-top: 8px; }
.start-card .meta { color: var(--sub); font-size: 13px; margin-top: 6px; line-height: 1.8; }
.diff-seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 16px 0 6px; }
.diff-seg button {
  padding: 11px 4px; border-radius: 12px; background: #faf1df; color: #8a7a66;
  font-size: 14px; font-weight: 700; border: 2px solid transparent;
}
.diff-seg button.on { background: #fff0f0; color: var(--red); border-color: var(--red); }
.diff-seg button .d { display: block; font-size: 10.5px; font-weight: 600; opacity: .75; margin-top: 2px; }

/* ---------- 游戏页 ---------- */
.game-top { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 10px; }
.g-hearts { font-size: 18px; letter-spacing: 2px; min-width: 86px; text-align: left; }
.g-score { font-size: 22px; font-weight: 900; color: var(--red); }
.g-quit { font-size: 20px; color: var(--sub); padding: 4px 8px; }
.timebar { height: 10px; background: #f3e6cd; border-radius: 999px; overflow: hidden; margin-bottom: 12px; }
.timebar i { display: block; height: 100%; background: linear-gradient(90deg, #ffc94d, #ff9c3f); border-radius: 999px; transition: width .5s linear; }
.timebar.danger i { background: linear-gradient(90deg, #ff6b6b, var(--red)); }

.word-zone { text-align: center; margin-bottom: 6px; }
.word-hint { font-size: 12px; color: var(--sub); margin-bottom: 7px; }
.letters { display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; min-height: 44px; }
.letter {
  width: 36px; height: 42px; border-radius: 10px; background: #fff;
  box-shadow: var(--shadow), inset 0 -3px 0 #efe2c8;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 900; color: #e8dcc6; text-transform: uppercase;
  transition: all .2s;
}
.letter.lit { color: var(--ink); background: #fff2b8; box-shadow: 0 4px 10px rgba(255, 200, 60, .35), inset 0 -3px 0 #ffe58a; transform: translateY(-3px); }
.letter.lit.pop-anim { animation: letterPop .3s; }
@keyframes letterPop { 0% { transform: translateY(-3px) scale(.5); } 60% { transform: translateY(-6px) scale(1.15); } 100% { transform: translateY(-3px) scale(1); } }
.letters.small .letter { width: 28px; height: 36px; font-size: 16px; border-radius: 8px; }
.word-cn-chip { margin-top: 8px; min-height: 26px; }

/* 棋盘 */
#board {
  position: relative; margin: 10px auto 4px; background: #fffaf0;
  border-radius: 16px; box-shadow: var(--shadow), inset 0 0 0 1px #f4e8cf;
  touch-action: manipulation;
}
.candy {
  position: absolute; border-radius: 26%;
  display: flex; align-items: center; justify-content: center;
  transition: left .22s ease, top .22s ease, opacity .2s;
  cursor: pointer;
}
.candy.sel { box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--red); z-index: 3; }
.candy.pop { animation: candyPop .26s ease forwards; z-index: 2; }
@keyframes candyPop { to { transform: scale(0) rotate(30deg); opacity: 0; } }
.candy.shake { animation: candyShake .3s; }
@keyframes candyShake { 0%,100% { margin-left: 0; } 30% { margin-left: -4px; } 60% { margin-left: 4px; } }
.candy.hintglow { animation: hintGlow 1s infinite; }
@keyframes hintGlow { 50% { box-shadow: 0 0 0 3px #fff, 0 0 12px 4px rgba(255, 200, 60, .8); } }
.score-float {
  position: absolute; font-weight: 900; color: var(--red); font-size: 15px; pointer-events: none;
  animation: floatUp .8s ease forwards; z-index: 5; text-shadow: 0 1px 0 #fff;
}
.score-float.good { color: var(--green); }
@keyframes floatUp { to { transform: translateY(-34px); opacity: 0; } }
.combo-badge {
  position: absolute; left: 50%; top: 42%; transform: translate(-50%, 0);
  background: linear-gradient(180deg, #ff9d3c, #ff7b2d); color: #fff;
  font-size: 22px; font-weight: 900; padding: 8px 22px; border-radius: 999px;
  box-shadow: 0 6px 16px rgba(255, 130, 40, .45); z-index: 6; pointer-events: none;
  animation: comboIn .6s ease forwards;
}
@keyframes comboIn { 0% { transform: translate(-50%, 0) scale(.4); opacity: 0; } 30% { transform: translate(-50%, 0) scale(1.1); opacity: 1; } 75% { opacity: 1; } 100% { transform: translate(-50%, -26px) scale(1); opacity: 0; } }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(60, 42, 20, .45);
  display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px;
}
.modal {
  background: var(--bg); border-radius: 22px; width: 100%; max-width: 400px;
  padding: 22px 20px; animation: modalIn .22s ease;
  max-height: 84vh; display: flex; flex-direction: column;
}
@keyframes modalIn { from { transform: scale(.85); opacity: 0; } }
.modal h3 { text-align: center; font-size: 18px; margin-bottom: 12px; }
.m-body { overflow-y: auto; flex: 1; }
.m-btns { display: flex; gap: 10px; margin-top: 16px; }
.m-btns .btn { flex: 1; }

/* 问答 */
.quiz-word { text-align: center; margin-bottom: 4px; }
.quiz-word .qw { font-size: 30px; font-weight: 900; color: var(--ink); }
.quiz-word .qp { color: var(--sub); font-size: 13px; margin-top: 2px; }
.quiz-tip { text-align: center; color: var(--sub); font-size: 12px; margin-bottom: 14px; }
.quiz-opts { display: grid; gap: 10px; }
.quiz-opts button {
  background: #fff; border-radius: 14px; padding: 13px 14px; text-align: left;
  font-size: 15px; font-weight: 600; color: var(--ink); box-shadow: var(--shadow);
  border: 2px solid transparent; transition: transform .1s, border-color .15s, background .15s;
}
.quiz-opts button:active { transform: scale(.97); }
.quiz-opts button.right { border-color: var(--green); background: #eefff5; color: #128553; }
.quiz-opts button.wrongpick { border-color: var(--red); background: #fff0f0; color: var(--red); }
.quiz-opts button.dim { opacity: .45; }
.quiz-verdict { text-align: center; margin-top: 14px; min-height: 30px; font-weight: 800; font-size: 16px; }
.quiz-verdict .good { color: var(--green); }
.quiz-verdict .bad { color: var(--red); }

/* 结算 */
.result-emoji { text-align: center; font-size: 52px; }
.result-score { text-align: center; font-size: 46px; font-weight: 900; color: var(--red); margin: 4px 0 0; }
.result-label { text-align: center; color: var(--sub); font-size: 13px; }
.new-best { text-align: center; margin: 6px 0; }
.res-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 14px 0; }
.res-grid .cell { background: #fff; border-radius: 12px; box-shadow: var(--shadow); padding: 10px 2px; text-align: center; }
.res-grid .cell .n { font-weight: 800; font-size: 17px; }
.res-grid .cell .t { font-size: 10.5px; color: var(--sub); margin-top: 2px; }
.res-wrong { background: #fff; border-radius: 14px; box-shadow: var(--shadow); padding: 6px 12px; margin-bottom: 14px; }
.res-wrong .wi { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px dashed #f0e6d2; font-size: 13.5px; }
.res-wrong .wi:last-child { border-bottom: none; }
.res-wrong .wi .w { font-weight: 800; }
.res-wrong .wi .m { color: var(--sub); }

/* 错词本 */
.wrong-item {
  background: #fff; border-radius: 14px; box-shadow: var(--shadow);
  padding: 11px 13px; margin-bottom: 9px; display: flex; align-items: center; gap: 10px;
}
.wrong-item .main { flex: 1; min-width: 0; }
.wrong-item .w { font-weight: 800; font-size: 15px; }
.wrong-item .w .bk { font-size: 10px; background: #f6ead2; color: var(--sub); border-radius: 6px; padding: 1px 6px; margin-left: 6px; font-weight: 600; vertical-align: 1px; }
.wrong-item .m { font-size: 12.5px; color: var(--sub); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wrong-item .side { text-align: right; flex-shrink: 0; }
.wrong-item .cnt { font-size: 11px; color: var(--red); font-weight: 700; }
.wrong-item .rm { font-size: 11px; color: #c0a988; margin-top: 3px; }
.empty-tip { text-align: center; color: var(--sub); padding: 40px 0; font-size: 14px; }

/* 同步 */
.sync-tip { font-size: 12.5px; color: #8a7a66; line-height: 1.8; background: #fff; border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; }
.sync-lab { font-size: 13px; font-weight: 700; margin: 10px 0 6px; }
.sync-ta { width: 100%; height: 74px; border: 1.5px solid #eee0c8; border-radius: 12px; padding: 9px; font-size: 12px; resize: none; background: #fff; color: var(--ink); outline: none; }
.sync-btn { width: 100%; padding: 10px; border-radius: 12px; background: #fff0f0; color: var(--red); font-weight: 700; font-size: 14px; margin-top: 8px; }
.seg { display: flex; gap: 8px; }
.seg button { flex: 1; padding: 11px; border-radius: 12px; background: #fff; box-shadow: var(--shadow); font-weight: 700; font-size: 14px; }
.seg button.mr { background: #fff0f0; color: var(--red); }
.contact-line { text-align: center; color: #c9b391; font-size: 11px; margin-top: 14px; }

/* toast */
#toast-root { position: fixed; left: 0; right: 0; top: 14%; display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 99; pointer-events: none; }
.toast {
  background: rgba(50, 38, 22, .88); color: #fff; font-size: 13.5px; font-weight: 600;
  padding: 9px 18px; border-radius: 999px; animation: toastIn .25s ease;
  max-width: 82vw; text-align: center;
}
.toast.good { background: rgba(18, 133, 83, .92); }
.toast.bad { background: rgba(214, 47, 60, .92); }
@keyframes toastIn { from { transform: translateY(-8px); opacity: 0; } }

/* 返回条 */
.page-top { display: flex; align-items: center; gap: 10px; margin: 4px 0 8px; }
.page-top .back { font-size: 22px; padding: 4px 8px; color: var(--ink); }
.page-top .pt { font-size: 18px; font-weight: 800; flex: 1; }
