/* 单词会咬人 — 像素风打宝 */
:root {
  --bg: #1a1c2c;
  --bg2: #33357a;
  --ink: #f4f4f4;
  --dim: #9ba0b8;
  --gold: #ffd23f;
  --common: #c8cbcd;
  --rare: #58c470;
  --epic: #4d9be6;
  --legend: #ffaa5f;
  --blood: #b13e53;
  --stone: #566c86;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background:
    radial-gradient(ellipse at 50% -20%, var(--bg2), transparent 60%),
    var(--bg);
  color: var(--ink);
  font-family: "Hiragino Sans", "Yu Gothic", "PingFang SC", ui-sans-serif, monospace;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  image-rendering: pixelated;
}

#app { width: min(560px, 100vw); padding: 20px 16px 40px; }

.screen { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.hidden { display: none !important; }

/* ---------- 标题 ---------- */
.game-title {
  font-size: 34px;
  letter-spacing: 6px;
  margin-top: 28px;
  text-shadow: 3px 3px 0 #000;
}
.tagline { color: var(--dim); letter-spacing: 3px; }

/* ---------- 村庄 ---------- */
.village-wrap {
  width: 100%;
  border: 3px solid var(--stone);
  background: #12131f;
  padding: 12px 10px 8px;
}
.village-label { font-size: 12px; color: var(--dim); margin-bottom: 8px; letter-spacing: 2px; }
.village {
  min-height: 46px;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 6px;
}
.village-stats { font-size: 12px; color: var(--dim); margin-top: 8px; }

/* 像素小屋：主体 + 三角顶用 clip-path，窗户用 box-shadow */
.house { width: 22px; height: 20px; position: relative; }
.house::before {
  content: "";
  position: absolute; inset: 6px 0 0 0;
  background: var(--house-body, #c2842f);
}
.house::after {
  content: "";
  position: absolute; top: 0; left: -2px; right: -2px; height: 8px;
  background: var(--house-roof, #b13e53);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}
.house .win {
  position: absolute; left: 8px; top: 11px;
  width: 4px; height: 4px; background: var(--gold);
  box-shadow: 0 0 6px var(--gold);
}
.house.hut::before { background: #7a6a53; }
.house.new .win { animation: lightup 1.2s ease; }
@keyframes lightup { 0% { box-shadow: 0 0 14px 6px var(--gold); } 100% { box-shadow: 0 0 6px var(--gold); } }

/* ---------- 按钮 ---------- */
.btn {
  font: inherit; font-size: 16px; letter-spacing: 2px;
  color: var(--ink); background: var(--stone);
  border: 0; outline: 3px solid #000;
  padding: 12px 26px; cursor: pointer;
  box-shadow: inset -3px -3px 0 rgba(0,0,0,.35), inset 3px 3px 0 rgba(255,255,255,.18);
}
.btn:active { transform: translateY(2px); }
.btn:disabled { opacity: .4; cursor: default; }
.btn-primary { background: var(--blood); }
.btn-kill { background: #2e7d46; }
.btn-spare { background: #6b6f8a; }
.hint { font-size: 12px; color: var(--dim); }
.deck-status { font-size: 13px; color: var(--dim); text-align: center; min-height: 18px; }

/* ---------- HUD ---------- */
.hud {
  width: 100%; display: flex; justify-content: space-between;
  font-size: 14px; letter-spacing: 1px; color: var(--dim);
}
#hud-combo.hot { color: var(--gold); }

/* ---------- 洞窟 ---------- */
.cave {
  position: relative; width: 100%; height: 300px;
  background: linear-gradient(#101122, #1d1f38 70%, #262a4a);
  border: 3px solid var(--stone);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  overflow: hidden;
}

/* 史莱姆怪：本体 + 眼睛，色相按单词哈希变化 */
.slime {
  position: relative;
  width: 92px; height: 74px;
  background: var(--slime-hue, #7ac74f);
  border-radius: 46px 46px 14px 14px / 58px 58px 10px 10px;
  box-shadow: inset -8px -10px 0 rgba(0,0,0,.25), 0 6px 0 rgba(0,0,0,.4);
  animation: bob 1.6s ease-in-out infinite;
}
.slime::before { /* 高光 */
  content: ""; position: absolute; left: 16px; top: 10px;
  width: 14px; height: 8px; border-radius: 50%;
  background: rgba(255,255,255,.55); transform: rotate(-18deg);
}
.eye {
  position: absolute; top: 26px; width: 10px; height: 14px;
  background: #1a1c2c; border-radius: 40%;
}
.eye-l { left: 26px; } .eye-r { right: 26px; }
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }

.slime.hurt { animation: hurt .28s steps(2) 1; filter: brightness(2) saturate(0); }
@keyframes hurt { 0% { transform: translateX(0); } 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } 100% { transform: translateX(0); } }
.slime.dead { animation: die .4s steps(3) forwards; }
@keyframes die { to { transform: translateY(24px) scaleY(.2); opacity: 0; } }
.slime.flee { animation: flee .45s steps(4) forwards; }
@keyframes flee { to { transform: translateX(220px); opacity: 0; } }

.monster-word {
  margin-top: 14px; font-size: 30px; font-weight: 700; letter-spacing: 2px;
  text-shadow: 2px 2px 0 #000; text-align: center;
}
.hp { width: 160px; height: 10px; margin-top: 10px; background: #000; outline: 2px solid var(--stone); }
.hp i { display: block; height: 100%; width: 100%; background: var(--blood); transition: width .25s steps(4); }

/* 揭示区 */
.reveal { position: absolute; inset: 0; background: rgba(10,11,22,.92); padding: 22px; display: flex; flex-direction: column; gap: 10px; justify-content: center; }
.reveal-meaning { font-size: 16px; line-height: 1.55; white-space: pre-wrap; }
.reveal-meta { font-size: 13px; color: var(--dim); display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.accent-bar { display: inline-flex; align-items: flex-end; gap: 2px; height: 18px; }
.accent-bar i { width: 6px; background: var(--gold); }

/* 掉落弹窗 */
.loot-pop {
  position: absolute; right: 14px; top: 14px;
  padding: 8px 12px; font-size: 14px; letter-spacing: 1px;
  background: #000; border: 2px solid var(--rare);
  animation: pop .35s steps(4);
}
@keyframes pop { 0% { transform: scale(.4); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
.loot-pop.common { border-color: var(--common); color: var(--common); }
.loot-pop.rare { border-color: var(--rare); color: var(--rare); }
.loot-pop.epic { border-color: var(--epic); color: var(--epic); }
.loot-pop.legend { border-color: var(--legend); color: var(--legend); }

.actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.judge-group { display: flex; gap: 12px; }

/* ---------- 结算 ---------- */
.result-title { font-size: 26px; letter-spacing: 4px; text-shadow: 2px 2px 0 #000; margin-top: 20px; }
.result-stats { font-size: 14px; color: var(--dim); display: flex; gap: 18px; }
.result-loot { width: 100%; display: flex; flex-direction: column; gap: 6px; max-height: 200px; overflow-y: auto; }
.loot-line { display: flex; justify-content: space-between; font-size: 13px; padding: 6px 10px; background: #12131f; border-left: 4px solid var(--common); }
.loot-line.rare { border-color: var(--rare); }
.loot-line.epic { border-color: var(--epic); }
.loot-line.legend { border-color: var(--legend); }
.loot-line .loot-name { color: inherit; }
.loot-line.common { color: var(--common); }
.loot-line.rare { color: var(--rare); }
.loot-line.epic { color: var(--epic); }
.loot-line.legend { color: var(--legend); }
.loot-line.dead { color: var(--dim); border-color: var(--dim); opacity: .7; }
