/* ============================================================
   《词根猎手》样式 2/2 —— 战斗 / 图鉴 / 救援 / 商店 / 动效
   ============================================================ */

/* ---------- 战斗页 ---------- */
.battle-page { position: relative; }
.battle-head {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  font-size: .85rem; color: var(--ink-dim);
  background: var(--card); border: 2px solid var(--line); border-radius: 12px;
  padding: 8px 12px; margin-bottom: 14px;
}
.bt-lv { color: var(--ink); }
.bt-combo { color: var(--torch); font-weight: bold; animation: comboPop .3s; }
@keyframes comboPop { 50% { transform: scale(1.3); } }
.battle-quit { margin-top: 14px; }

.quiz {
  background: linear-gradient(165deg, var(--card-hi), var(--card));
  border: 2px solid var(--line); border-radius: 18px;
  padding: 22px 16px; text-align: center;
  animation: quizIn .4s cubic-bezier(.2,.9,.3,1.2);
  box-shadow: 0 10px 30px rgba(0,0,0,.4);
}
@keyframes quizIn { from { opacity: 0; transform: translateY(24px) scale(.96); } }
.q-word {
  font-size: clamp(1.8rem, 8vw, 2.6rem); letter-spacing: .04em;
  color: var(--ink); text-shadow: 0 2px 0 rgba(0,0,0,.4);
  margin-bottom: 6px;
}
.q-word.big { font-size: clamp(2.2rem, 10vw, 3.2rem); color: var(--gold); }
.q-mean { color: var(--ink-dim); font-size: .95rem; margin-bottom: 10px; }
.q-chip {
  display: inline-block; font-size: .8rem; color: var(--aqua);
  background: rgba(78,205,196,.1); border: 1px solid rgba(78,205,196,.35);
  border-radius: 99px; padding: 3px 12px; margin-left: 6px; vertical-align: middle;
}
.q-ask { margin: 10px 0 16px; font-size: 1rem; color: var(--ink); }
.q-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.q-opt {
  font-family: var(--font-game); font-size: 1.02rem;
  background: #12241a; color: var(--ink);
  border: 2px solid var(--line); border-radius: 12px;
  padding: 14px 8px; cursor: pointer; transition: .15s;
  box-shadow: 0 3px 0 #0a120d;
}
.q-opt:not(:disabled):active { transform: translateY(2px); box-shadow: none; }
.q-opt:not(:disabled):hover { border-color: var(--aqua); }
.q-opt.right { background: rgba(123,237,159,.15); border-color: var(--ok); color: var(--ok); animation: flashOk .5s; }
.q-opt.wrong { background: rgba(255,107,107,.12); border-color: var(--danger); color: var(--danger); animation: shake .4s; }
.q-opt.killed { opacity: .3; text-decoration: line-through; cursor: not-allowed; }
.q-hintbtn { margin-top: 12px; }
@keyframes flashOk { 30% { box-shadow: 0 0 24px var(--ok); } }
@keyframes shake { 20%,60% { transform: translateX(-6px); } 40%,80% { transform: translateX(6px); } }

.explain {
  margin-top: 12px; border-radius: 12px; padding: 10px 14px;
  font-size: .88rem; line-height: 1.6; text-align: left;
  animation: quizIn .3s;
}
.explain.ok { background: rgba(123,237,159,.1); border: 1px solid rgba(123,237,159,.4); color: var(--ok); }
.explain.no { background: rgba(255,107,107,.08); border: 1px solid rgba(255,107,107,.4); color: #ffb3b3; }
.ex-answer { color: var(--gold); }

/* BOSS */
.boss-bar {
  display: flex; align-items: center; gap: 12px;
  background: linear-gradient(135deg, #341d12, #1f120a);
  border: 2px solid #a35c12; border-radius: 14px;
  padding: 10px 14px; margin-bottom: 16px;
  animation: bossPulse 1.6s infinite alternate;
}
@keyframes bossPulse { from { box-shadow: 0 0 6px rgba(255,159,67,.2); } to { box-shadow: 0 0 20px rgba(255,159,67,.45); } }
.boss-face { font-size: 2.2rem; }
.boss-info { flex: 1; text-align: left; }
.boss-name { font-size: .95rem; color: var(--gold); }
.boss-hp { font-size: 1rem; letter-spacing: 2px; }
.boss-timer { font-size: 1.2rem; color: var(--torch); font-weight: bold; }

/* 拆词槽位 */
.slots { display: flex; gap: 8px; justify-content: center; margin: 6px 0 14px; flex-wrap: wrap; }
.slot {
  min-width: 88px; min-height: 74px;
  background: #0d1a12; border: 2px dashed #3d5a46; border-radius: 12px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  cursor: pointer; transition: .2s; padding: 6px;
}
.slot-label { font-size: .68rem; color: var(--ink-dim); }
.slot-val { font-size: 1.15rem; color: var(--ink); }
.slot.filled { border-style: solid; border-color: var(--aqua); background: rgba(78,205,196,.08); }
.slot.right { border-color: var(--ok); background: rgba(123,237,159,.12); animation: flashOk .5s; }
.slot.wrong { border-color: var(--danger); animation: shake .4s; }
.slot.ghosted { border: none; cursor: default; min-width: 150px; }
.slot-tip { font-size: .62rem; color: var(--ink-dim); line-height: 1.5; }

.pool { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 16px; }
.pool-card {
  position: relative;
  font-family: var(--font-game); font-size: 1.05rem;
  background: linear-gradient(165deg, #24382a, #182820);
  color: var(--ink); border: 2px solid #3d5a46; border-radius: 12px;
  padding: 12px 16px; cursor: pointer; transition: .15s;
  box-shadow: 0 3px 0 #0c150f;
}
.pool-card:not(.used):active { transform: translateY(2px); box-shadow: none; }
.pool-card:not(.used):hover { border-color: var(--gold); }
.pool-card.used { opacity: .25; cursor: not-allowed; transform: scale(.94); }
.pool-card.hit { border-color: var(--ok); opacity: .35; }
.pool-card .pc-tag { display: block; font-size: .6rem; color: var(--ink-dim); margin-top: 2px; }
.pool-card.shake { animation: shake .4s; border-color: var(--danger); }
.split-actions { display: flex; gap: 10px; justify-content: center; align-items: center; }
#split-go:disabled { opacity: .4; cursor: not-allowed; }

/* ---------- 教学卡 / 弹窗 ---------- */
#modal { position: fixed; inset: 0; z-index: 100; display: none; align-items: center; justify-content: center; }
#modal.on { display: flex; }
.modal-mask { position: absolute; inset: 0; background: rgba(4,8,6,.78); backdrop-filter: blur(4px); }
#modal-body {
  position: relative; width: min(92vw, 480px); max-height: 84vh; overflow-y: auto;
  background: linear-gradient(165deg, #1a2b20, #101c14);
  border: 2px solid var(--line); border-radius: 20px;
  padding: 18px; animation: quizIn .35s cubic-bezier(.2,.9,.3,1.2);
  box-shadow: 0 20px 60px rgba(0,0,0,.6);
}
.teach-wrap { text-align: center; }
.teach-head { font-size: 1.05rem; color: var(--gold); margin-bottom: 12px; }
.teach-card {
  background: rgba(0,0,0,.28); border: 2px solid var(--line); border-radius: 14px;
  padding: 14px; margin-bottom: 10px; text-align: center;
}
.teach-card.spirit { border-color: #3d6a8a; background: linear-gradient(165deg, rgba(61,106,138,.15), rgba(0,0,0,.3)); }
.teach-card.spirit.again { border-color: #4a7a56; }
.teach-card.boss { border-color: #a35c12; }
.tc-sprite { font-size: 2.6rem; animation: float 3s ease-in-out infinite; }
.tc-sprite.big { font-size: 3.4rem; }
.tc-title { font-size: 1.2rem; margin: 6px 0; color: var(--ink); }
.tc-title span { color: var(--aqua); }
.tc-tag { color: var(--gold); font-size: .9rem; margin-bottom: 6px; }
.tc-name { color: var(--aqua); font-size: .9rem; margin-bottom: 4px; }
.tc-line { color: var(--ink-dim); font-size: .85rem; margin: 6px 0; }
.tc-desc { font-size: .88rem; color: var(--ink-dim); line-height: 1.7; }
.tc-ex { font-size: .82rem; color: var(--ink-dim); line-height: 1.9; margin-top: 8px; border-top: 1px dashed var(--line); padding-top: 8px; }
.tc-ex b { color: var(--ink); }
.teach-btns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 8px; }

/* ---------- 结算 ---------- */
.settle { text-align: center; }
.settle-title { font-size: 1.5rem; margin-bottom: 6px; }
.settle-stars { font-size: 2rem; color: var(--gold); letter-spacing: 6px; text-shadow: 0 0 16px rgba(255,209,102,.5); animation: starsPop .6s cubic-bezier(.2,.9,.3,1.4); }
@keyframes starsPop { from { transform: scale(.3); opacity: 0; } }
.settle-rows { color: var(--ink-dim); font-size: .9rem; margin: 10px 0; line-height: 1.8; }
.settle-spirit {
  background: rgba(78,205,196,.08); border: 1px solid rgba(78,205,196,.35);
  border-radius: 14px; padding: 14px; margin: 10px 0; font-size: .92rem; line-height: 1.7;
}
.ss-sprite { font-size: 2.6rem; display: block; animation: float 2.6s ease-in-out infinite; }
.ss-sprite.sleep { filter: grayscale(1); animation: none; }
.ss-line { color: var(--ink-dim); font-size: .8rem; }
.settle-relic {
  background: rgba(255,209,102,.08); border: 1px solid rgba(255,209,102,.4);
  border-radius: 12px; padding: 12px; margin: 8px 0; font-size: .9rem;
  box-shadow: 0 0 18px rgba(255,209,102,.12); animation: quizIn .4s;
}
.sr-buff { font-size: .78rem; color: var(--gold); margin-top: 4px; }
.settle-ach { color: var(--gold); font-size: .9rem; margin: 8px 0; }

/* ---------- 图鉴 ---------- */
.dex-head { font-size: 1.05rem; margin: 4px 0 12px; }
.dex-head b { color: var(--gold); }
.dim { color: var(--ink-dim); font-size: .8em; }
.dex-legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: .75rem; color: var(--ink-dim); margin-bottom: 12px; }
.dex-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.dex-card {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  background: var(--card); border: 2px solid var(--line); border-radius: 14px;
  color: var(--ink); font-family: var(--font-game);
  padding: 12px 6px; cursor: pointer; transition: .18s;
}
.dex-card:hover { transform: translateY(-3px); }
.dex-card.unknown { border-style: dashed; color: var(--ink-dim); background: #0d1610; }
.dex-card.mastered { border-color: var(--gold); background: linear-gradient(165deg, rgba(255,209,102,.1), var(--card)); }
.dex-card.learning { border-color: #3d6a8a; }
.dex-card.fogged { border-color: #6b5b8a; background: linear-gradient(165deg, rgba(107,91,138,.18), var(--card)); animation: fogFloat 4s ease-in-out infinite; }
@keyframes fogFloat { 50% { box-shadow: 0 0 14px rgba(139,125,175,.35); } }
.dex-num { position: absolute; top: 6px; left: 8px; font-size: .62rem; color: var(--ink-dim); }
.dex-sprite { font-size: 2rem; }
.dex-card.unknown .dex-sprite { filter: brightness(.4); }
.dex-id { font-size: .88rem; }
.dex-mean { font-size: .7rem; color: var(--ink-dim); }
.dex-badge { position: absolute; top: 6px; right: 8px; font-size: .8rem; }

.sp-detail { text-align: center; }
.spd-head { display: flex; align-items: center; gap: 14px; text-align: left; margin-bottom: 10px; }
.spd-sprite { font-size: 3rem; animation: float 3s ease-in-out infinite; }
.spd-name { font-size: 1.2rem; }
.spd-root { color: var(--ink-dim); font-size: .82rem; margin-top: 2px; }
.spd-root b { color: var(--aqua); }
.spd-line { background: rgba(0,0,0,.25); border-radius: 10px; padding: 8px 12px; font-size: .88rem; color: var(--ink-dim); margin-bottom: 10px; }
.spd-ex { text-align: left; font-size: .85rem; line-height: 2; margin-bottom: 10px; }
.spd-exrow { border-bottom: 1px dashed var(--line); padding: 2px 0; }
.spd-exrow b { color: var(--gold); }
.spd-exrow span { color: var(--ink-dim); font-size: .82rem; }
.spd-meta { font-size: .8rem; color: var(--ink-dim); margin-bottom: 6px; }
.spd-fam { font-size: .8rem; color: var(--gold); margin-bottom: 12px; }

/* ---------- 救援 ---------- */
.rescue-empty { text-align: center; padding: 40px 16px; color: var(--ink-dim); line-height: 2; }
.re-icon { font-size: 3rem; margin-bottom: 8px; }
.rescue-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.rescue-card {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  background: linear-gradient(165deg, rgba(107,91,138,.22), var(--card));
  border: 2px solid #6b5b8a; border-radius: 14px; padding: 16px 10px;
  animation: fogFloat 3.5s ease-in-out infinite;
}
.rc-sprite { font-size: 2.4rem; filter: grayscale(.5); }
.rc-name { font-size: .95rem; }
.rc-root { font-size: .75rem; color: var(--ink-dim); margin-bottom: 4px; }
.rescue-card .btn { width: 100%; }
.rescue-meta { text-align: center; color: var(--ink-dim); font-size: .8rem; margin-top: 16px; }

/* ---------- 商店 / 抽卡 ---------- */
.egg-zone { text-align: center; margin: 14px 0 20px; }
.egg-btn {
  display: inline-flex; align-items: center; gap: 14px;
  background: linear-gradient(165deg, #2b3a5e, #1a2540);
  border: 2px solid #4a6a9e; border-radius: 18px;
  color: var(--ink); font-family: var(--font-game);
  padding: 16px 26px; cursor: pointer; transition: .2s;
  box-shadow: 0 5px 0 #101a2e, 0 8px 22px rgba(74,106,158,.3);
}
.egg-btn:active { transform: translateY(3px); box-shadow: 0 2px 0 #101a2e; }
.egg-icon { font-size: 2.6rem; animation: eggWobble 2.4s ease-in-out infinite; }
@keyframes eggWobble { 0%,100% { transform: rotate(0); } 25% { transform: rotate(-8deg); } 75% { transform: rotate(8deg); } }
.egg-text { display: flex; flex-direction: column; align-items: flex-start; }
.egg-text b { font-size: 1.1rem; }
.egg-text span { font-size: .82rem; color: var(--aqua); }
.egg-rates { font-size: .72rem; color: var(--ink-dim); margin-top: 10px; }
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.shop-card {
  display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center;
  background: var(--card); border: 2px solid var(--line); border-radius: 14px;
  padding: 14px 10px; font-size: .9rem;
}
.sc-icon { font-size: 2rem; }
.sc-desc { font-size: .72rem; color: var(--ink-dim); line-height: 1.5; min-height: 34px; }

.egg-open { text-align: center; }
.egg-crack { font-size: 4rem; animation: eggCrack .8s ease; }
@keyframes eggCrack { 0%,100% { transform: scale(1) rotate(0); } 30% { transform: scale(1.2) rotate(-10deg); } 60% { transform: scale(1.15) rotate(10deg); } }
.egg-result {
  margin: 14px auto; width: fit-content; min-width: 220px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  border: 2px solid var(--rar, var(--line)); border-radius: 16px;
  padding: 18px 24px; animation: quizIn .5s cubic-bezier(.2,.9,.3,1.4);
  box-shadow: 0 0 24px color-mix(in srgb, var(--rar, #555) 40%, transparent);
}
.er-rarity { font-size: .75rem; color: var(--rar); letter-spacing: 4px; }
.er-icon { font-size: 3rem; }
.er-label { font-size: 1rem; }

/* ---------- 任务 / 成就 / 排行 ---------- */
.quest-list { margin-bottom: 18px; }
.quest-row {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  background: var(--card); border: 2px solid var(--line); border-radius: 12px;
  padding: 12px 14px; margin-bottom: 8px; font-size: .9rem;
}
.quest-row.done { border-color: #4a7a56; background: linear-gradient(165deg, rgba(123,237,159,.08), var(--card)); }
.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.ach-card {
  display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center;
  background: var(--card); border: 2px dashed var(--line); border-radius: 14px;
  padding: 14px 8px; font-size: .88rem; color: var(--ink-dim);
}
.ach-card span:first-child { font-size: 1.8rem; filter: grayscale(1); }
.ach-card.got { border-style: solid; border-color: var(--gold); color: var(--ink); background: linear-gradient(165deg, rgba(255,209,102,.08), var(--card)); }
.ach-card.got span:first-child { filter: none; }

.rank-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border: 2px solid var(--line); border-radius: 12px;
  padding: 12px 16px; margin-bottom: 8px; font-size: .95rem;
}
.rank-row.me { border-color: var(--gold); background: linear-gradient(165deg, rgba(255,209,102,.1), var(--card)); box-shadow: 0 0 14px rgba(255,209,102,.15); }
.rank-no { font-size: 1.3rem; }
.rank-face { font-size: 1.5rem; }
.rank-name { flex: 1; }
.rank-stars { color: var(--gold); }
.rank-note { font-size: .8rem; color: var(--ink-dim); line-height: 1.8; margin-top: 14px; }

/* ---------- Toast ---------- */
#toast {
  position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%) translateY(20px);
  z-index: 200; max-width: min(88vw, 420px);
  background: rgba(20,32,24,.95); border: 2px solid var(--aqua);
  color: var(--ink); border-radius: 14px; padding: 10px 18px;
  font-size: .88rem; text-align: center; line-height: 1.6;
  opacity: 0; pointer-events: none; transition: .3s;
  box-shadow: 0 8px 30px rgba(0,0,0,.5);
}
#toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast b { color: var(--gold); }

/* ---------- 响应式 ---------- */
@media (max-width: 420px) {
  .q-options { grid-template-columns: 1fr; }
  .home-stats { grid-template-columns: repeat(2, 1fr); }
  .ch-levels { grid-template-columns: 1fr 1fr; }
  .slot { min-width: 76px; min-height: 66px; }
}
