/* ============================================================
 * 单词星际射击 — 样式表
 * 深空主题 / 霓虹蓝青 / 移动优先
 * ============================================================ */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  width: 100%; height: 100%;
  font-family: 'PingFang SC', 'Microsoft YaHei', -apple-system, BlinkMacSystemFont, sans-serif;
  color: #e6f0ff;
  overflow: hidden;
  background: radial-gradient(120% 80% at 50% 0%, #16244f 0%, #0b1230 45%, #05081c 100%);
  user-select: none; -webkit-user-select: none;
}
.hidden { display: none !important; }

/* 星空背景 */
#bgCanvas {
  position: fixed; inset: 0; width: 100%; height: 100%;
  z-index: 0; pointer-events: none;
}

/* 场景容器：每个场景铺满视口 */
.scene {
  position: fixed; inset: 0; z-index: 1;
  display: none;
  flex-direction: column;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
  overflow: hidden;
}
.scene.active { display: flex; }

/* 通用按钮 */
.btn {
  border: none; border-radius: 14px;
  font-size: 16px; font-weight: 700;
  padding: 14px 18px; cursor: pointer;
  transition: transform .08s ease, filter .15s ease;
  font-family: inherit;
}
.btn:active { transform: scale(.96); }
.btn-primary {
  background: linear-gradient(135deg, #38bdf8, #2563eb);
  color: #fff; box-shadow: 0 8px 22px rgba(37,99,235,.45);
}
.btn-ghost {
  background: rgba(125,211,252,.10);
  color: #bfe3ff; border: 1.5px solid rgba(125,211,252,.4);
}
.btn-big { font-size: 19px; padding: 16px 24px; border-radius: 18px; }

/* ============ 主菜单 ============ */
#scene-menu { align-items: center; justify-content: center; }
.menu-inner { width: 100%; max-width: 460px; padding: 24px; text-align: center; }
.game-logo { margin-bottom: 22px; }
.logo-ship { font-size: 56px; filter: drop-shadow(0 6px 14px rgba(56,189,248,.6)); animation: bob 2.4s ease-in-out infinite; }
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
.game-logo h1 {
  font-size: 30px; letter-spacing: 2px; margin-top: 6px;
  background: linear-gradient(90deg, #7dd3fc, #a78bfa, #f0abfc);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.subtitle { color: #9fb6e0; font-size: 14px; margin-top: 6px; letter-spacing: 1px; }
.menu-stats { display: flex; gap: 14px; justify-content: center; margin: 18px 0 22px; }
.stat-box {
  flex: 1; background: rgba(125,211,252,.08);
  border: 1px solid rgba(125,211,252,.25);
  border-radius: 16px; padding: 14px 8px; display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.stat-icon { font-size: 22px; }
.stat-box > span:nth-child(2) { font-size: 22px; font-weight: 800; color: #fde047; }
.stat-label { font-size: 12px; color: #9fb6e0; }
.menu-inner .btn { width: 100%; margin-bottom: 12px; }
#btn-wrongbook { position: relative; }
.badge {
  position: absolute; top: -6px; right: -6px;
  background: #ef4444; color: #fff; border-radius: 999px;
  min-width: 22px; height: 22px; line-height: 22px; font-size: 12px; padding: 0 6px;
  box-shadow: 0 2px 8px rgba(239,68,68,.5);
}
.menu-tip { color: #7d93bd; font-size: 13px; margin-top: 6px; }

/* ============ 页头（选关/错词本） ============ */
.page-head {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 16px; padding-top: calc(14px + env(safe-area-inset-top));
  border-bottom: 1px solid rgba(125,211,252,.18);
}
.page-head h2 { flex: 1; font-size: 19px; text-align: center; }
.head-stars { color: #fde047; font-weight: 700; font-size: 15px; }
.btn-back {
  width: 40px; height: 40px; border-radius: 12px; flex: 0 0 auto;
  background: rgba(125,211,252,.12); color: #bfe3ff; border: 1px solid rgba(125,211,252,.3);
  font-size: 22px; line-height: 1; cursor: pointer;
}
.btn-clear {
  background: rgba(239,68,68,.15); color: #fca5a5; border: 1px solid rgba(239,68,68,.4);
  border-radius: 12px; padding: 8px 12px; font-size: 14px; cursor: pointer; font-family: inherit;
}

/* ============ 选关列表 ============ */
.unit-list { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.unit-card {
  width: 100%; text-align: left; cursor: pointer; font-family: inherit;
  background: linear-gradient(135deg, rgba(37,99,235,.22), rgba(124,58,237,.18));
  border: 1.5px solid rgba(125,211,252,.35); border-radius: 18px;
  padding: 16px; color: #e6f0ff;
  display: flex; flex-direction: column; gap: 10px;
  box-shadow: 0 6px 18px rgba(0,0,0,.3);
  transition: transform .1s ease;
}
.unit-card:active { transform: scale(.98); }
.unit-card.locked { filter: grayscale(.8) brightness(.6); cursor: not-allowed; }
.unit-card.cleared { border-color: rgba(74,222,128,.6); }
.unit-head { display: flex; align-items: center; gap: 12px; }
.unit-ic { font-size: 30px; }
.unit-tt { display: flex; flex-direction: column; }
.unit-title { font-size: 16px; font-weight: 800; }
.unit-en { font-size: 12px; color: #9fb6e0; letter-spacing: 1px; }
.unit-meta { display: flex; align-items: center; justify-content: space-between; }
.unit-stars { color: #fde047; font-size: 15px; letter-spacing: 2px; }
.unit-lock { font-size: 16px; }

/* ============ 小关弹窗 ============ */
.modal {
  position: fixed; inset: 0; z-index: 5;
  background: rgba(3,6,20,.7); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.modal-card {
  width: 100%; max-width: 420px;
  background: linear-gradient(160deg, #16224d, #0c1330);
  border: 1.5px solid rgba(125,211,252,.4); border-radius: 22px;
  padding: 22px; position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,.6);
}
.modal-close {
  position: absolute; top: 14px; right: 14px; width: 34px; height: 34px;
  border-radius: 10px; background: rgba(255,255,255,.08); color: #cbd5e1;
  border: none; font-size: 16px; cursor: pointer;
}
.sub-modal-head { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.sub-unit-icon { font-size: 38px; }
.sub-modal-head h3 { font-size: 20px; }
.sub-modal-head p { font-size: 13px; color: #9fb6e0; letter-spacing: 1px; margin-top: 2px; }
.sub-btns { display: flex; flex-direction: column; gap: 12px; }
.sub-btn {
  display: flex; align-items: center; gap: 12px;
  background: rgba(125,211,252,.10); border: 1.5px solid rgba(125,211,252,.3);
  border-radius: 14px; padding: 14px 16px; cursor: pointer; color: #e6f0ff; font-family: inherit;
  transition: transform .08s ease;
}
.sub-btn:active { transform: scale(.97); }
.sub-btn.locked { filter: grayscale(.7) brightness(.6); cursor: not-allowed; }
.sub-btn-boss { background: linear-gradient(135deg, rgba(249,115,22,.25), rgba(239,68,68,.18)); border-color: rgba(251,146,60,.5); }
.sub-btn-icon { font-size: 24px; }
.sub-btn-name { flex: 1; font-size: 16px; font-weight: 700; text-align: left; }
.sub-stars { color: #fde047; font-size: 13px; letter-spacing: 1px; }

/* ============ 游戏页 ============ */
#scene-game { background: transparent; }
#scene-game .hud {
  position: relative; z-index: 2;
  padding: 10px 14px 8px; padding-top: calc(10px + env(safe-area-inset-top));
  background: linear-gradient(180deg, rgba(8,14,38,.95), rgba(8,14,38,.55));
  border-bottom: 1px solid rgba(125,211,252,.2);
}
.hud-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.btn-back-game { width: 36px; height: 36px; font-size: 20px; }
.hud-hearts { flex: 1; font-size: 20px; letter-spacing: 2px; }
.hud-score { font-size: 15px; color: #bfe3ff; }
.hud-score b { color: #fde047; font-size: 18px; }

.prompt-card {
  background: rgba(125,211,252,.10); border: 1.5px solid rgba(125,211,252,.35);
  border-radius: 14px; padding: 10px 14px; text-align: center;
}
.prompt-meta { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 4px; }
.prompt-dir {
  font-size: 12px; font-weight: 700; color: #0b1230;
  background: linear-gradient(135deg,#7dd3fc,#a78bfa); border-radius: 999px; padding: 2px 10px;
}
.prompt-progress { font-size: 12px; color: #9fb6e0; }
.combo-badge {
  font-size: 12px; font-weight: 800; color: #fff;
  background: linear-gradient(135deg,#f59e0b,#ef4444); border-radius: 999px; padding: 2px 10px;
  animation: pulse .6s ease infinite alternate;
}
@keyframes pulse { to { transform: scale(1.08); } }
.prompt-text { font-size: 21px; font-weight: 800; color: #fff; line-height: 1.25; }

.boss-bar {
  visibility: hidden; display: flex; align-items: center; gap: 8px;
  margin-top: 8px;
}
.boss-bar.vis { visibility: visible; }
.boss-face { font-size: 20px; }
.boss-hp-track { flex: 1; height: 12px; background: rgba(255,255,255,.12); border-radius: 999px; overflow: hidden; }
.boss-hp-fill {
  height: 100%; width: 100%;
  background: linear-gradient(90deg,#f97316,#ef4444);
  transition: width .25s ease;
}

#gameCanvas {
  position: absolute; left: 0;
  z-index: 1;
  touch-action: none;
}
.note-toast {
  position: absolute; left: 50%; transform: translateX(-50%);
  bottom: 18px; z-index: 3;
  max-width: 88%; text-align: center;
  background: rgba(15,23,42,.92); color: #fde68a;
  border: 1px solid rgba(253,224,71,.4); border-radius: 12px;
  padding: 10px 14px; font-size: 13px; line-height: 1.4;
  box-shadow: 0 6px 18px rgba(0,0,0,.4);
}

/* ============ 结算弹窗 ============ */
.result-card { text-align: center; }
.result-card h2 { font-size: 24px; margin-bottom: 10px; }
.result-stars { font-size: 40px; letter-spacing: 6px; margin: 6px 0 16px; }
.result-stars span { color: #3b4670; }
.result-stars span.on { color: #fde047; text-shadow: 0 0 14px rgba(253,224,71,.7); }
.result-rows { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.result-row {
  display: flex; justify-content: space-between; align-items: center;
  background: rgba(125,211,252,.08); border-radius: 12px; padding: 12px 16px;
}
.result-row span { color: #9fb6e0; font-size: 14px; }
.result-row b { font-size: 18px; color: #fff; }
.new-record {
  color: #fde047; font-weight: 800; font-size: 16px; margin-bottom: 12px;
  animation: pulse .8s ease infinite alternate;
}
.result-btns { display: flex; gap: 10px; }
.result-btns .btn { flex: 1; font-size: 14px; padding: 13px 6px; }
#btn-result-next { background: linear-gradient(135deg,#38bdf8,#2563eb); color: #fff; }

/* ============ 错词本 ============ */
.wrong-list { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.wrong-empty { text-align: center; color: #9fb6e0; font-size: 16px; margin-top: 40px; }
.wrong-row {
  display: flex; align-items: center; gap: 10px;
  background: rgba(125,211,252,.08); border: 1px solid rgba(125,211,252,.2);
  border-radius: 12px; padding: 12px 14px;
}
.wrong-en { flex: 1; font-size: 15px; font-weight: 700; color: #fff; }
.wrong-zh { flex: 1; font-size: 13px; color: #9fb6e0; text-align: right; }
.wrong-cnt { font-size: 12px; color: #fca5a5; }
.wrong-del {
  background: rgba(239,68,68,.15); color: #fca5a5; border: 1px solid rgba(239,68,68,.4);
  border-radius: 10px; padding: 6px 10px; font-size: 13px; cursor: pointer; font-family: inherit;
}
.wrong-foot { padding: 14px 16px; padding-bottom: calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid rgba(125,211,252,.18); }
.wrong-foot .btn { width: 100%; }
