* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: linear-gradient(135deg, #e8f7f1 0%, #eaf2fb 45%, #fdeef6 100%);
  background-attachment: fixed;
  color: #2c3e50;
  line-height: 1.6;
}
#app { max-width: 720px; margin: 0 auto; min-height: 100vh; }
.screen { padding: 20px; }
.hidden { display: none !important; }

/* 首页 */
.home-card {
  background: #fff; border-radius: 20px; padding: 36px 28px;
  margin-top: 14vh; box-shadow: 0 8px 30px rgba(40,80,120,0.08);
  text-align: center;
}
.home-card h1 { font-size: 26px; font-weight: 600; color: #1d9e75; }
.subtitle { color: #7a8a99; margin: 8px 0 24px; }
#player-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.player-pick {
  padding: 14px; border: 1px solid #e3e9ee; border-radius: 12px;
  background: #fafcff; cursor: pointer; font-size: 15px; color: #2c3e50;
  transition: .15s;
}
.player-pick:hover { border-color: #1d9e75; background: #f0fbf7; }

/* 顶栏 */
.topbar {
  display: flex; align-items: center; gap: 10px;
  background: #fff; border-radius: 16px; padding: 12px 14px;
  box-shadow: 0 4px 16px rgba(40,80,120,0.06); margin-bottom: 18px;
}
.topbar h2 { font-size: 17px; font-weight: 600; }
.player-info { display: flex; align-items: center; gap: 8px; flex: 1; flex-wrap: wrap; }
.player-info .name { font-weight: 600; }
.chip {
  background: #eef4f8; color: #33586e; border-radius: 999px;
  padding: 4px 10px; font-size: 13px;
}
.chip b { color: #1d9e75; }

/* 语速调节 */
.rate-ctrl { display: flex; align-items: center; gap: 2px; background: #eef4f8; border-radius: 999px; padding: 2px 4px; }
.rate-ctrl .btn.ghost { font-size: 16px; padding: 2px 10px; line-height: 1; }
.rate-label { font-size: 12px; color: #33586e; min-width: 40px; text-align: center; font-weight: 600; }

/* 按钮 */
.btn {
  border: none; border-radius: 12px; padding: 10px 16px;
  font-size: 14px; cursor: pointer; background: #eef4f8; color: #2c3e50;
  transition: .15s;
}
.btn:hover { filter: brightness(0.97); }
.btn.primary { background: #1d9e75; color: #fff; }
.btn.primary:hover { background: #178a65; }
.btn.ghost { background: transparent; font-size: 18px; padding: 6px 10px; }
.btn.small { padding: 6px 12px; font-size: 13px; }
.btn.wide { display: block; width: 100%; margin: 8px 0; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.row { display: flex; gap: 10px; }
.row.center { justify-content: center; }
.row.wrap { flex-wrap: wrap; }
input {
  flex: 1; border: 1px solid #dce4ea; border-radius: 12px;
  padding: 12px 14px; font-size: 15px; outline: none;
}
input:focus { border-color: #1d9e75; }

/* 主菜单网格 */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.mode-card {
  background: #fff; border: 2px solid #dfe7ec; border-radius: 16px;
  padding: 22px 10px; font-size: 15px; cursor: pointer; color: #2c3e50;
  transition: .15s; box-shadow: 0 4px 14px rgba(40,80,120,0.05);
}
.mode-card:hover { border-color: #1d9e75; transform: translateY(-2px); }
.mode-card.alt { background: #f7fafc; }
.mode-card:nth-child(3n+1) { border-color: #1d9e75; }
.mode-card:nth-child(3n+2) { border-color: #e8923a; }
.mode-card:nth-child(3n+3) { border-color: #2f8fd0; }
.mode-card:nth-child(3n+1):hover { border-color: #157a57; }
.mode-card:nth-child(3n+2):hover { border-color: #c47418; }
.mode-card:nth-child(3n+3):hover { border-color: #1f6fae; }

/* 游戏区 */
.q-card {
  background: #fff; border-radius: 18px; padding: 28px 22px; text-align: center;
  box-shadow: 0 6px 20px rgba(40,80,120,0.07); margin-top: 10px;
}
.q-word { font-size: 30px; font-weight: 600; color: #1d9e75; }
.q-phon { color: #8aa; margin: 6px 0 18px; font-size: 15px; }
.q-meaning { font-size: 24px; font-weight: 600; margin-bottom: 18px; }
.options { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.opt {
  border: 2px solid #dfe7ec; border-radius: 16px; padding: 18px 14px;
  background: #fafcff; cursor: pointer; font-size: 16px; line-height: 1.5;
  min-height: 60px; display: flex; align-items: center; justify-content: center;
  text-align: center; transition: .15s;
}
.opt:hover:not(:disabled) { border-color: #1d9e75; transform: translateY(-1px); }
.opt:disabled { cursor: default; }
.opt.correct { background: #d8f3e6; border-color: #1d9e75; color: #157a57; }
.opt.wrong { background: #fde2e2; border-color: #e07a7a; color: #b23; }
.spell-input { text-align: center; font-size: 18px; letter-spacing: 1px; }
.hearts { font-size: 22px; letter-spacing: 4px; margin-bottom: 14px; }
.letter-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.letter-box {
  width: 46px; height: 54px; text-align: center; font-size: 26px; font-weight: 600;
  text-transform: uppercase; border: 2px solid #dfe7ec; border-radius: 12px;
  background: #fafcff; color: #2c3e50; outline: none;
}
.letter-box:focus { border-color: #1d9e75; }
.letter-box.correct { background: #d8f3e6; border-color: #1d9e75; color: #157a57; }
.letter-box.wrong { background: #fde2e2; border-color: #e07a7a; color: #b23; }
.listen-btn {
  border: none; background: #1d9e75; color: #fff; border-radius: 24px;
  min-width: 220px; padding: 22px 26px; font-size: 24px; line-height: 1.4;
  cursor: pointer; margin-bottom: 18px; white-space: normal; word-break: keep-all;
}
.listen-btn:hover { background: #178a65; }
.story-text { text-align: left; font-size: 16px; line-height: 1.9; color: #334; }

#game-feedback { text-align: center; margin: 16px 0; min-height: 24px; font-weight: 600; }
.fb.ok { color: #1d9e75; }
.fb.no { color: #e0584f; }

/* 单词消消乐 */
.match-top { text-align: center; margin-bottom: 10px; }
.match-status { font-size: 18px; font-weight: 700; min-height: 24px; margin-top: 4px; }
.match-status.ok { color: #1d9e75; }
.match-status.no { color: #e0584f; }
.match-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 10px; }
.match-card {
  border: 1px solid #dfe7ec; border-radius: 12px; padding: 16px 8px;
  background: #fafcff; cursor: pointer; font-size: 15px; min-height: 56px;
  display: flex; align-items: center; justify-content: center; transition: .15s;
}
.match-card:hover { border-color: #1d9e75; }
.match-card.sel { border-color: #f0a500; background: #fff7e6; }
.match-card.matched { visibility: hidden; }

/* 面板 */
.panel-body { display: flex; flex-direction: column; gap: 12px; }
.sec-title { font-weight: 700; color: #1d9e75; margin-top: 6px; font-size: 15px; }
#io-preview {
  width: 100%; border: 1px solid #d6e4ec; border-radius: 12px; padding: 10px 12px;
  font-size: 14px; font-family: inherit; resize: vertical; line-height: 1.5; color: #2c3e50;
}
#io-preview:focus { outline: none; border-color: #1d9e75; }
.shop-row, .lb-row, .report-line {
  background: #fff; border: 1px solid #e6edf2; border-radius: 14px;
  padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.lb-row { justify-content: space-between; }
.muted { color: #8aa; font-size: 13px; }
.wrong-list { background: #fff; border: 1px solid #e6edf2; border-radius: 14px; padding: 12px 16px; color: #557; }
.report-line { display: block; }

/* 会了跳过 / 修复锤按钮 */
#skip-word-btn { margin: 4px auto 0; display: block; }
.btn.warn { background: #fff3df; color: #b9770a; border: 1px solid #f0c674; }
.btn.warn:hover { background: #ffe9c2; }

/* 单词本预览 */
.book-card {
  background: #fff; border: 1px solid #e6edf2; border-top: 4px solid #1d9e75;
  border-radius: 16px; padding: 16px 18px; display: flex; flex-direction: column; gap: 8px;
  box-shadow: 0 4px 14px rgba(40,80,120,0.05);
}
.book-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.book-title { font-size: 17px; color: #2c3e50; }
.book-badge { color: #fff; font-size: 12px; padding: 3px 10px; border-radius: 999px; }
.book-desc { line-height: 1.5; }
.book-count { font-size: 13px; color: #1d9e75; font-weight: 600; }
.book-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px;
  margin: 4px 0 8px;
}
.book-cell {
  background: #f7fafc; border: 1px solid #e9f1f5; border-radius: 12px; padding: 10px 12px;
  display: flex; flex-direction: column; gap: 2px;
}
.bc-word { font-size: 16px; color: #2c3e50; }
.bc-phon { font-size: 12px; color: #9ab; }
.bc-mean { font-size: 14px; color: #3a9d7a; }
#menu-extra { margin-top: 14px; }

/* Toast 提示 */
#toast {
  position: fixed; left: 50%; bottom: 26px;
  transform: translateX(-50%) translateY(20px);
  background: #2c3e50; color: #fff; padding: 11px 18px;
  border-radius: 12px; font-size: 14px; line-height: 1.5;
  opacity: 0; pointer-events: none; transition: .3s; z-index: 99;
  white-space: pre-line; max-width: 90%; text-align: center;
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 烟花特效层 */
#fx-canvas {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 80;
}

/* 皮纳塔挑战 */
.pinata-canvas {
  display: block;
  width: 100%;
  border-radius: 18px;
  margin-top: 12px;
  touch-action: none;
  box-shadow: 0 6px 20px rgba(40,80,120,0.07);
  background: linear-gradient(160deg, #eafaf3 0%, #eaf2fb 100%);
}
