* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #000; }
body { font-family: "Songti SC", "STSong", "SimSun", "Noto Serif SC", serif; color: #f0e6d2; }
#app { position: relative; width: 100%; height: 100%; }
#game-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }

/* ---------- 标题画面 ---------- */
.screen {
  position: absolute; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 50% 35%, #1c3a4a 0%, #0a1520 70%, #050a10 100%);
}
.title-inner { text-align: center; }
.title-inner h1 {
  font-size: 84px; letter-spacing: 22px; color: #e8d9a8;
  text-shadow: 0 0 30px rgba(120, 200, 255, .45), 0 4px 8px rgba(0,0,0,.8);
  margin-bottom: 10px;
}
.subtitle { color: #9fc3cc; letter-spacing: 6px; margin-bottom: 46px; }
.menu-btn {
  font-family: inherit; font-size: 24px; letter-spacing: 10px;
  padding: 12px 54px; cursor: pointer;
  color: #f0e6d2; background: rgba(30, 60, 75, .6);
  border: 1px solid #7ba8b0; border-radius: 4px;
  transition: all .25s;
}
.menu-btn:hover { background: rgba(90, 150, 170, .5); box-shadow: 0 0 18px rgba(130, 210, 235, .5); }
.title-help { margin-top: 54px; color: #6f8f99; font-size: 14px; line-height: 1.9; letter-spacing: 2px; }

/* ---------- 剧情黑边 ---------- */
.letterbox {
  position: absolute; left: 0; width: 100%; height: 0; z-index: 20;
  background: #000; transition: height .6s ease;
}
#letterbox-top { top: 0; }
#letterbox-bottom { bottom: 0; }
.letterbox.active { height: 11%; }

/* ---------- 对话框 ---------- */
#dialogue-box {
  position: absolute; left: 50%; bottom: 6%; transform: translateX(-50%);
  width: min(860px, 88%); min-height: 128px; z-index: 30;
  background: linear-gradient(180deg, rgba(12, 22, 30, .92), rgba(8, 14, 20, .95));
  border: 1px solid #5f8a94; border-radius: 6px;
  padding: 16px 26px 30px;
  box-shadow: 0 6px 30px rgba(0,0,0,.6), inset 0 0 40px rgba(70, 130, 150, .08);
}
#dialogue-name {
  display: inline-block; margin-bottom: 8px;
  font-size: 19px; color: #ffd98a; letter-spacing: 3px;
  border-bottom: 1px solid rgba(255, 217, 138, .4); padding-bottom: 3px;
}
#dialogue-name:empty { display: none; }
#dialogue-text { font-size: 19px; line-height: 1.75; letter-spacing: 1px; min-height: 60px; }
#dialogue-next {
  position: absolute; right: 20px; bottom: 8px;
  font-size: 12px; color: #7ba8b0; animation: bob 1.1s infinite;
}
@keyframes bob { 0%,100% { transform: translateY(0);} 50% { transform: translateY(3px);} }

/* ---------- 探索HUD ---------- */
#hud { position: absolute; inset: 0; z-index: 15; pointer-events: none; }
#hud-quest {
  position: absolute; top: 18px; left: 20px;
  background: rgba(8, 16, 22, .7); border-left: 3px solid #ffd98a;
  padding: 10px 18px; font-size: 15px; letter-spacing: 1px; line-height: 1.6;
  border-radius: 0 4px 4px 0; max-width: 380px;
}
#hud-quest .q-title { color: #ffd98a; font-size: 13px; letter-spacing: 3px; margin-bottom: 2px; }
#interact-tip {
  position: absolute; left: 50%; bottom: 18%; transform: translateX(-50%);
  background: rgba(8, 16, 22, .85); border: 1px solid #5f8a94;
  padding: 8px 22px; border-radius: 20px; font-size: 16px; letter-spacing: 2px;
}
#interact-tip b { color: #ffd98a; }

/* ---------- 战斗UI ---------- */
#battle-ui { position: absolute; inset: 0; z-index: 25; pointer-events: none; }
#turn-banner {
  position: absolute; top: 20%; left: 50%; transform: translateX(-50%);
  font-size: 34px; letter-spacing: 12px; color: #ffd98a;
  text-shadow: 0 0 24px rgba(255, 200, 100, .6), 0 3px 6px #000;
  animation: bannerIn .5s ease;
}
@keyframes bannerIn { from { opacity: 0; transform: translateX(-50%) scale(1.4);} to { opacity: 1; transform: translateX(-50%) scale(1);} }

#battle-timeline {
  position: absolute; top: 16px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 8px;
}
.tl-chip {
  padding: 5px 14px; font-size: 14px; letter-spacing: 2px;
  background: rgba(10, 18, 26, .8); border: 1px solid #3d5a63; border-radius: 3px; color: #9fc3cc;
}
.tl-chip.now { border-color: #ffd98a; color: #ffd98a; box-shadow: 0 0 10px rgba(255, 217, 138, .35); }
.tl-chip.foe { color: #e08f8f; }
.tl-chip.foe.now { border-color: #ff9a9a; color: #ff9a9a; box-shadow: 0 0 10px rgba(255,120,120,.35); }

#party-status { position: absolute; left: 22px; bottom: 22px; display: flex; flex-direction: column; gap: 10px; }
.member-card {
  width: 250px; background: rgba(8, 16, 22, .85); border: 1px solid #3d5a63;
  border-radius: 5px; padding: 9px 14px;
}
.member-card.active { border-color: #ffd98a; box-shadow: 0 0 14px rgba(255, 217, 138, .3); }
.member-card.dead { opacity: .45; filter: grayscale(1); }
.member-card .m-name { font-size: 16px; color: #f0e6d2; letter-spacing: 2px; margin-bottom: 5px; }
.bar { height: 8px; background: #1a262e; border-radius: 4px; overflow: hidden; margin-bottom: 4px; }
.bar > div { height: 100%; border-radius: 4px; transition: width .35s; }
.bar.hp > div { background: linear-gradient(90deg, #4caf6d, #8fdc8f); }
.bar.ap > div { background: linear-gradient(90deg, #4a8fd4, #8fc8ff); }
.bar-label { font-size: 11px; color: #7ba8b0; display: flex; justify-content: space-between; }

#battle-menu {
  position: absolute; right: 26px; bottom: 26px; width: 240px;
  display: flex; flex-direction: column; gap: 6px; pointer-events: auto;
}
.action-btn {
  font-family: inherit; text-align: left; cursor: pointer;
  font-size: 17px; letter-spacing: 3px; padding: 10px 18px;
  color: #d8e6e2; background: rgba(10, 20, 28, .88);
  border: 1px solid #3d5a63; border-radius: 4px; transition: all .15s;
  position: relative;
}
.action-btn:hover:not(:disabled), .action-btn.selected { border-color: #ffd98a; color: #ffd98a; padding-left: 26px; }
.action-btn:disabled { opacity: .38; cursor: default; }
.action-btn .cost { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: 13px; color: #8fc8ff; letter-spacing: 0; }
.action-btn .elem { font-size: 12px; margin-left: 6px; }
.menu-title { font-size: 13px; color: #7ba8b0; letter-spacing: 3px; padding: 2px 4px; }

#qte-hint {
  position: absolute; left: 50%; top: 58%; transform: translate(-50%, -50%);
  text-align: center; z-index: 28;
}
#qte-hint .qte-key {
  display: inline-block; font-size: 44px; font-weight: bold; color: #fff;
  width: 84px; height: 84px; line-height: 80px; border-radius: 50%;
  border: 4px solid #ffd98a; background: rgba(20, 30, 40, .75);
  box-shadow: 0 0 30px rgba(255, 217, 138, .5);
}
#qte-hint .qte-ring {
  position: absolute; left: 50%; top: 40px; transform: translate(-50%, -50%);
  width: 84px; height: 84px; border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, .85); pointer-events: none;
}
#qte-hint .qte-label { margin-top: 14px; font-size: 17px; letter-spacing: 4px; color: #f0e6d2; text-shadow: 0 2px 4px #000; }
#qte-hint.danger .qte-key { border-color: #ff8f8f; box-shadow: 0 0 30px rgba(255, 120, 120, .55); }

#battle-log {
  position: absolute; left: 50%; bottom: 24px; transform: translateX(-50%);
  font-size: 15px; letter-spacing: 1px; color: #cfe3dd; text-align: center;
  text-shadow: 0 2px 4px #000; max-width: 460px; line-height: 1.6;
}

/* 浮动伤害数字 */
.dmg-float {
  position: absolute; z-index: 26; pointer-events: none;
  font-size: 30px; font-weight: bold; color: #ffe9b0;
  text-shadow: 0 0 8px rgba(255, 160, 60, .8), 0 2px 3px #000;
  animation: dmgUp 1s ease-out forwards;
}
.dmg-float.heal { color: #a8f0b8; text-shadow: 0 0 8px rgba(80, 220, 120, .8), 0 2px 3px #000; }
.dmg-float.miss { color: #9fc3cc; font-size: 22px; }
.dmg-float.crit { font-size: 42px; color: #ffb35c; }
@keyframes dmgUp { 0% { opacity: 0; transform: translateY(10px) scale(.6);} 15% { opacity: 1; transform: translateY(0) scale(1.15);} 100% { opacity: 0; transform: translateY(-56px) scale(1);} }

/* ---------- 提示 ---------- */
#toast {
  position: absolute; top: 13%; left: 50%; transform: translateX(-50%); z-index: 40;
  background: rgba(8, 18, 24, .9); border: 1px solid #ffd98a; color: #ffe9b0;
  padding: 12px 34px; border-radius: 4px; font-size: 18px; letter-spacing: 3px;
  animation: bannerIn .4s ease;
}

/* ---------- 结局 ---------- */
#ending-screen { background: #000; z-index: 60; }
#ending-text {
  font-size: 22px; line-height: 2.6; letter-spacing: 4px; text-align: center;
  color: #d8cfa8; white-space: pre-line;
  animation: fadeIn 3s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
