/* =========================================================
 * 全域樣式（Style）— 《暗黑割草》
 * 深紅暗黑風。#ui-layer 內的覆蓋畫面（標題/升級/結算）。
 * 指標事件白名單策略（同 SRW 遊戲的教訓）：
 *   覆蓋層本身不攔截，只有 .hs-screen 與按鈕接收事件。
 * ========================================================= */

:root {
  --hs-bg: #0b0810;
  --hs-panel: rgba(22, 14, 20, 0.94);
  --hs-border: #5a2a3a;
  --hs-gold: #ffd54f;
  --hs-blood: #b03050;
}

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

html, body {
  height: 100%;
  background: radial-gradient(ellipse at center, #160d12 0%, #050308 100%);
  font-family: "Microsoft JhengHei", "PingFang TC", sans-serif;
  overflow: hidden;
  user-select: none;
}


#game-root {
  position: fixed;
  left: 0;
  top: 0;
  /* 尺寸與縮放由 boot.js 的 applyViewport（虛擬視口）設定 */
  transform-origin: 0 0;
  box-shadow: 0 0 70px rgba(176, 48, 80, 0.18);
}

#game-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  touch-action: none;
}
#game-root > #rotate-hint { pointer-events: none; }

/* 橫向提示（手機直向時顯示） */
/* 直向提示：只告知不遮擋（pointer-events:none），2.5 秒後自動淡出 */
#rotate-hint {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(6, 3, 8, 0.85);
  color: #c9a86a;
  font-size: 18px;
  line-height: 1.8;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.6s;
}
@media (orientation: portrait) and (max-width: 980px) {
  #rotate-hint { display: flex; }
}
#rotate-hint.fade { opacity: 0; }

#ui-layer { position: absolute; inset: 0; pointer-events: none; }
#ui-layer > .hs-screen { pointer-events: auto; }

/* ============ 共用畫面 ============ */
.hs-screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(6, 3, 8, 0.88);
  z-index: 20;
  color: #e8e0d8;
}
.hs-btn {
  background: #3a1420;
  border: 1px solid var(--hs-border);
  color: #e8e0d8;
  padding: 8px 20px;
  font-size: 14px;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  margin: 6px;
  transition: all 0.12s;
}
.hs-btn:hover { background: #5a1e30; transform: translateY(-1px); }
.hs-btn-big { font-size: 18px; padding: 12px 34px; background: #6d1526; border-color: #a03048; }
.hs-btn-big:hover { background: #8d1c32; }
.hs-btn-danger { border-color: #7a2030; color: #ff8a9a; }
.dim { color: #887a80; font-size: 12px; }

/* ============ 標題 ============ */
.hs-title { background: radial-gradient(ellipse at 50% 35%, #241018 0%, #060308 75%); }
.hs-logo { font-size: 72px; filter: drop-shadow(0 0 24px rgba(255,80,80,.6)); }
.hs-title h1 {
  font-size: 58px; font-weight: 900; letter-spacing: 16px;
  color: #ff5566;
  text-shadow: 0 0 30px rgba(255,60,80,.7), 0 2px 6px #000;
}
.hs-title h2 {
  font-size: 24px; color: #c9a86a; letter-spacing: 10px; margin: 4px 0 22px;
  text-shadow: 0 0 16px rgba(201,168,106,.5);
}
.hs-controls { text-align: center; font-size: 14px; line-height: 2; margin-bottom: 18px; }
.hs-controls b { color: #ffd54f; }
.hs-best {
  margin: 10px 0 18px;
  padding: 8px 22px;
  border: 1px solid #5a4a2a;
  border-radius: 20px;
  color: #ffd54f;
  background: rgba(60,44,12,.4);
  font-size: 14px;
}
.hs-title .hs-btn-big { margin-top: 12px; }

/* ============ 升級三選一 ============ */
.hs-levelup { background: rgba(8, 4, 16, 0.8); }
.hs-lu-title {
  font-size: 34px; font-weight: 900; color: #4dd0e1;
  text-shadow: 0 0 24px rgba(77,208,225,.7);
  margin-bottom: 26px;
  letter-spacing: 4px;
}
.hs-cards { display: flex; gap: 20px; margin-bottom: 22px; }
.hs-card {
  width: 210px;
  background: linear-gradient(170deg, #241828, #171019);
  border: 2px solid #4a3a4a;
  border-radius: 10px;
  padding: 20px 16px 42px;
  text-align: center;
  cursor: pointer;
  position: relative;
  transition: all 0.15s;
}
.hs-card:hover { transform: translateY(-8px) scale(1.04); }
.hs-card.epic { border-color: #ffb300; box-shadow: 0 0 22px rgba(255,179,0,.35); }
.hs-card.rare { border-color: #42a5f5; box-shadow: 0 0 16px rgba(66,165,245,.3); }
.hs-card.common { border-color: #6a6a7a; }
.hs-card-rar {
  font-size: 11px; letter-spacing: 2px; margin-bottom: 10px;
  color: #889;
}
.hs-card.epic .hs-card-rar { color: #ffb300; }
.hs-card.rare .hs-card-rar { color: #42a5f5; }
.hs-card-name { font-size: 21px; font-weight: 900; margin-bottom: 10px; }
.hs-card-desc { font-size: 13px; color: #b8a8a0; line-height: 1.5; }
.hs-card-key {
  position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%);
  width: 26px; height: 26px; line-height: 26px;
  border: 1px solid #555; border-radius: 4px;
  font-size: 13px; color: #998;
}

/* ============ 暫停 ============ */
.hs-pause-inner { text-align: center; }
.hs-pause h2 { margin-bottom: 20px; letter-spacing: 8px; }
.hs-pause .hs-btn { display: block; width: 220px; margin: 10px auto; }

/* ============ 結算 ============ */
.hs-result h1 { font-size: 46px; margin-bottom: 8px; letter-spacing: 6px; }
.hs-result.fail h1 { color: #ff5566; text-shadow: 0 0 26px rgba(255,60,80,.6); }
.hs-result.win h1 { color: #ffd54f; text-shadow: 0 0 26px rgba(255,213,79,.6); }
.hs-sub { color: #998; margin-bottom: 24px; }
.hs-stats { margin: 10px 0 20px; min-width: 320px; }
.hs-stats > div {
  display: flex; justify-content: space-between;
  padding: 8px 6px;
  border-bottom: 1px dashed #3a2a30;
  font-size: 16px;
}
.hs-stats b { color: #ffd54f; }
.hs-record {
  color: #4dd0e1; font-weight: 900; font-size: 20px;
  margin-bottom: 16px;
  animation: hsglow 1s infinite alternate;
}
@keyframes hsglow { from { text-shadow: 0 0 8px rgba(77,208,225,.4); } to { text-shadow: 0 0 24px rgba(77,208,225,.9); } }

/* ============ 裝備比較面板 ============ */
.hs-equip { background: rgba(6, 3, 8, 0.9); }
.hs-eq-title {
  font-size: 28px; font-weight: 900; color: #ffd54f;
  text-shadow: 0 0 20px rgba(255,213,79,.5);
  margin-bottom: 20px; letter-spacing: 3px;
}
.hs-eq-compare { display: flex; gap: 24px; margin-bottom: 18px; }
.hs-eq-col {
  width: 280px;
  background: linear-gradient(170deg, #241828, #171019);
  border: 2px solid #4a3a4a;
  border-radius: 10px;
  padding: 18px;
  text-align: center;
  min-height: 190px;
}
.hs-eq-col.dim-col { opacity: 0.75; }
.hs-eq-rar { font-size: 19px; font-weight: 900; margin-bottom: 6px; }
.hs-eq-sub { font-size: 12px; color: #998; margin-bottom: 12px; }
.hs-eq-line {
  font-size: 14px; color: #b8e0c8;
  text-align: left;
  padding: 4px 8px;
  margin: 3px 0;
  background: rgba(255,255,255,.04);
  border-radius: 4px;
}
.hs-eq-none { padding: 8px; }
.hs-eq-col .hs-btn { margin-top: 14px; width: 100%; }
.hs-btn-primary { background: #1d5bb8; border-color: #4a8ae8; }
.hs-btn-primary:hover { background: #2a72dd; }

/* ============ 流浪商店 ============ */
.hs-shop { background: rgba(6, 3, 8, 0.9); }
.hs-shop-title {
  font-size: 32px; font-weight: 900; color: #ffd54f;
  text-shadow: 0 0 20px rgba(255,213,79,.5);
  letter-spacing: 6px; margin-bottom: 8px;
}
.hs-shop-gold { margin-bottom: 16px; font-size: 16px; }
.hs-shop-gold b { color: #ffd54f; font-size: 20px; }
.hs-shop-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; min-width: 460px; }
.hs-shop-row {
  display: flex; align-items: center; gap: 12px;
  background: linear-gradient(170deg, #241828, #171019);
  border: 1px solid #4a3a4a;
  border-radius: 8px;
  padding: 10px 16px;
}
.hs-shop-row.sold { opacity: 0.4; }
.hs-shop-name { font-size: 16px; font-weight: bold; width: 170px; text-align: left; }
.hs-shop-desc { flex: 1; text-align: left; }
.hs-btn-buy { min-width: 110px; }
.hs-btn-buy:disabled { opacity: 0.4; }

/* ============ 保管箱 ============ */
.hs-stashpanel { background: rgba(6, 3, 8, 0.92); }
.hs-stash-equipped {
  display: flex; gap: 10px; margin-bottom: 14px;
}
.hs-stash-eq {
  background: rgba(255,255,255,.04);
  border: 1px solid #3a3a44;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 13px;
  display: flex; justify-content: space-between; gap: 10px;
  min-width: 180px;
}
.hs-stash-list {
  width: 560px; max-height: 260px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 6px;
  margin-bottom: 16px;
}
.hs-stash-row {
  display: flex; align-items: center; gap: 10px;
  background: rgba(255,255,255,.04);
  border-radius: 6px; padding: 6px 12px;
  font-size: 13px;
}
.hs-stash-name { width: 150px; text-align: left; font-weight: bold; }
.hs-stash-row .dim { flex: 1; text-align: left; }
.hs-btn-buy { background: #1d5bb8; border-color: #4a8ae8; }

/* RWD */
@media (max-width: 980px) {
