/* styles.css — 奧術戰帥 2D */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #0c0f08; }
body {
  font-family: "Microsoft JhengHei", "PingFang TC", "Noto Sans TC", sans-serif;
  color: #e8e4d8;
  user-select: none;
  -webkit-user-select: none;
}
.hidden { display: none !important; }
#app { position: fixed; inset: 0; }
#game { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: crosshair; }

/* ---------- HUD ---------- */
#hud { position: absolute; inset: 0; pointer-events: none; }
#hud-top { position: absolute; top: 12px; left: 12px; right: 12px; display: flex; justify-content: space-between; align-items: flex-start; }
#hud-status {
  background: rgba(12, 15, 10, 0.72); border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px; padding: 10px 14px; min-width: 240px;
}
#hud-mode { font-size: 14px; letter-spacing: 2px; color: #cbd5b0; }
.counts { font-size: 26px; font-weight: bold; display: flex; gap: 10px; align-items: baseline; margin: 2px 0 6px; }
.cnt.blue { color: #7fa8ee; text-shadow: 0 0 8px rgba(91,142,230,0.6); }
.cnt.red { color: #ee7a6a; text-shadow: 0 0 8px rgba(224,87,74,0.6); }
.vs { font-size: 13px; color: #9a9a8a; }
.morale-row { display: flex; gap: 6px; margin-bottom: 6px; }
.morale { flex: 1; height: 6px; background: rgba(255,255,255,0.12); border-radius: 3px; overflow: hidden; }
.morale div { height: 100%; background: #5b8ee6; transition: width 0.4s; }
.morale.red div { background: #e0604c; }
#hud-timer { font-size: 15px; color: #d8d4c4; font-variant-numeric: tabular-nums; }
.bar-row { display: flex; align-items: center; gap: 8px; font-size: 12px; margin-top: 5px; }
.bar-row > span:first-child { width: 30px; color: #cbd5b0; }
.bar { flex: 1; height: 8px; background: rgba(255,255,255,0.12); border-radius: 4px; overflow: hidden; }
.bar div { height: 100%; background: #c9a04a; transition: width 0.3s; }
#keep-bar { background: #ffd75e !important; }
.bar-row > span:last-child { width: 44px; text-align: right; color: #d8d4c4; }

#minimap-wrap { background: rgba(12,15,10,0.72); border: 1px solid rgba(255,255,255,0.12); border-radius: 8px; padding: 4px; }
#minimap { display: block; border-radius: 6px; }

#task-line {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%);
  background: rgba(12,15,10,0.6); border-radius: 6px; padding: 6px 18px;
  font-size: 15px; letter-spacing: 3px; color: #ffd75e;
}

#hud-bottom { position: absolute; left: 12px; right: 12px; bottom: 12px; display: flex; justify-content: space-between; align-items: flex-end; pointer-events: none; }
#squad-panel { background: rgba(12,15,10,0.72); border: 1px solid rgba(255,255,255,0.12); border-radius: 8px; padding: 10px 12px; min-width: 300px; }
#player-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 13px; }
.plabel { color: #ffd75e; font-weight: bold; letter-spacing: 2px; }
.hpbar { width: 120px; height: 10px; background: rgba(255,255,255,0.12); border-radius: 5px; overflow: hidden; }
#player-hp { height: 100%; background: linear-gradient(90deg, #d9534f, #e0a33c); width: 100%; transition: width 0.2s; }
#player-hpnum { font-variant-numeric: tabular-nums; width: 34px; }
#kill-count { margin-left: auto; color: #ffd75e; font-size: 13px; }
.squad { display: flex; align-items: center; gap: 8px; padding: 3px 0; font-size: 12.5px; opacity: 0.75; border-radius: 4px; }
.squad.sel { opacity: 1; background: rgba(255,215,94,0.08); }
.squad .mark { width: 18px; height: 18px; line-height: 18px; text-align: center; background: rgba(255,255,255,0.1); border-radius: 4px; color: #ffd75e; font-size: 11px; }
.squad .slabel { width: 76px; }
.squad-bar { flex: 1; height: 5px; background: rgba(255,255,255,0.1); border-radius: 3px; overflow: hidden; }
.squad-bar div { height: 100%; background: #7fa8ee; }
.squad .sinfo { color: #a8a898; font-size: 11.5px; white-space: nowrap; }

#spellbar { display: flex; gap: 6px; align-items: flex-end; pointer-events: none; }
.spell {
  background: rgba(12,15,10,0.72); border: 1px solid rgba(255,255,255,0.14);
  border-radius: 8px; padding: 8px 10px; text-align: center; min-width: 74px;
  transition: transform 0.08s, border-color 0.2s;
}
.spell .key { display: block; font-size: 12px; color: #ffd75e; font-weight: bold; }
.spell .sname { display: block; font-size: 12px; margin-top: 2px; }
.spell-note { font-size: 11px; color: #8a9a78; align-self: center; padding: 0 6px 6px; }

#toast {
  position: absolute; left: 50%; top: 26%; transform: translateX(-50%);
  background: rgba(12,15,10,0.85); border: 1px solid rgba(255,215,94,0.4);
  padding: 10px 26px; border-radius: 8px; font-size: 17px; letter-spacing: 2px;
  color: #ffd75e; transition: opacity 0.5s; text-align: center;
}
#toast.fade { animation: toastfade 2.2s forwards; }
@keyframes toastfade { 0% { opacity: 1; } 70% { opacity: 1; } 100% { opacity: 0; } }

#hint {
  position: absolute; left: 50%; bottom: 130px; transform: translateX(-50%);
  background: rgba(12,15,10,0.85); border: 1px solid rgba(255,255,255,0.2);
  padding: 8px 22px; border-radius: 8px; font-size: 14px; color: #d8d4c4;
}

#vignette {
  position: absolute; inset: 0; pointer-events: none;
  box-shadow: inset 0 0 140px 60px rgba(160, 20, 10, 0.85);
  opacity: 0; transition: opacity 0.25s;
}
#flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
#flash.fade { animation: flashfade 0.3s forwards; }
@keyframes flashfade { from { opacity: 0.35; } to { opacity: 0; } }

/* ---------- 主選單 ---------- */
#menu {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 20px;
  background: radial-gradient(ellipse at 50% 30%, #1c2416 0%, #0c0f08 70%);
}
#menu h1 { font-size: 52px; letter-spacing: 12px; color: #e8e4d8; text-shadow: 0 0 30px rgba(142,230,255,0.35); }
#menu h1 .v2d { color: #8ee6ff; font-size: 30px; letter-spacing: 4px; }
#menu .tagline { color: #9aa88a; letter-spacing: 4px; font-size: 15px; }
#menu-cards { display: flex; gap: 18px; margin-top: 10px; }
.card {
  width: 250px; background: rgba(22, 28, 18, 0.85); border: 1px solid rgba(255,255,255,0.14);
  border-radius: 12px; padding: 22px 20px; cursor: pointer; pointer-events: auto;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.card:hover { transform: translateY(-4px); border-color: #ffd75e; box-shadow: 0 8px 30px rgba(255,215,94,0.15); }
.card h3 { font-size: 19px; color: #ffd75e; letter-spacing: 3px; margin-bottom: 8px; }
.card p { font-size: 13px; color: #b8b4a4; line-height: 1.6; min-height: 63px; }
.card .rec { display: block; margin-top: 10px; font-size: 12px; color: #8ee6ff; }
.menu-foot button {
  background: none; border: 1px solid rgba(255,255,255,0.25); color: #d8d4c4;
  padding: 8px 22px; border-radius: 6px; cursor: pointer; font-size: 14px; font-family: inherit;
}
.menu-foot button:hover { border-color: #ffd75e; color: #ffd75e; }

/* ---------- 覆蓋層 ---------- */
.overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 16px;
  background: rgba(8, 10, 6, 0.78); z-index: 10;
}
.overlay h2 { font-size: 34px; letter-spacing: 8px; }
#result-title.win { color: #ffd75e; text-shadow: 0 0 30px rgba(255,215,94,0.6); }
#result-title.lose { color: #9aa0a8; }
#result-reason { color: #b8b4a4; font-size: 16px; letter-spacing: 2px; }
#result-stats { display: flex; flex-direction: column; gap: 6px; min-width: 280px; margin: 8px 0; }
.stat { display: flex; justify-content: space-between; font-size: 15px; background: rgba(255,255,255,0.05); padding: 8px 16px; border-radius: 6px; }
.stat span { color: #a8a898; }
.stat b { color: #e8e4d8; font-variant-numeric: tabular-nums; }
.stamp {
  font-style: normal; display: inline-block; margin-left: 8px; padding: 1px 8px;
  border: 1px solid #d9534f; color: #ff8a7a; border-radius: 4px; font-size: 11px;
  transform: rotate(-6deg); animation: stampin 0.3s;
}
@keyframes stampin { from { transform: rotate(-6deg) scale(2); opacity: 0; } to { transform: rotate(-6deg) scale(1); opacity: 1; } }
.advice { font-size: 13px; color: #9aa88a; background: rgba(255,255,255,0.04); padding: 8px 16px; border-radius: 6px; max-width: 420px; }

.overlay button, .col button, .row button {
  background: rgba(30, 36, 24, 0.9); border: 1px solid rgba(255,255,255,0.22); color: #e8e4d8;
  padding: 10px 30px; border-radius: 8px; cursor: pointer; font-size: 16px; font-family: inherit;
  letter-spacing: 3px; transition: border-color 0.15s, color 0.15s;
}
.overlay button:hover, .row button:hover, .col button:hover { border-color: #ffd75e; color: #ffd75e; }
.col { display: flex; flex-direction: column; gap: 10px; min-width: 220px; }
.row { display: flex; gap: 12px; }

#ovl-intro { background: rgba(8, 10, 6, 0.5); }
#intro-task { font-size: 20px; letter-spacing: 6px; color: #cbd5b0; margin-bottom: 12px; }
#intro-num { font-size: 120px; font-weight: bold; color: #ffd75e; text-shadow: 0 0 50px rgba(255,215,94,0.5); }
#intro-num.pop { animation: numpop 0.65s; }
#intro-num.charge { font-size: 84px; color: #ff9a4a; text-shadow: 0 0 60px rgba(255,120,40,0.8); }
@keyframes numpop { 0% { transform: scale(1.6); opacity: 0; } 30% { transform: scale(1); opacity: 1; } 100% { transform: scale(0.94); opacity: 0.85; } }

#help-body table { border-collapse: collapse; min-width: 420px; }
#help-body th, #help-body td { padding: 6px 14px; font-size: 14px; text-align: left; border-bottom: 1px solid rgba(255,255,255,0.08); }
#help-body th { color: #ffd75e; white-space: nowrap; }
.help-tip { margin-top: 10px; color: #9aa88a; font-size: 13px; }
.sliders { display: flex; gap: 24px; margin-top: 6px; }
.sliders label { font-size: 14px; color: #b8b4a4; display: flex; align-items: center; gap: 8px; }
