/* 飞行棋大冒险 — HUD 样式 */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #0d1526; }
body { font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif; color: #f1f3f8; }
#app, #app canvas { position: fixed; inset: 0; }
.hidden { display: none !important; }

/* ---------- 顶部 ---------- */
#topBar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 10;
  display: flex; align-items: center; gap: 14px;
  padding: 10px 18px;
  background: linear-gradient(180deg, rgba(10, 16, 32, 0.82), rgba(10, 16, 32, 0));
  pointer-events: none;
}
#logoBanner { height: 44px; filter: drop-shadow(0 2px 6px rgba(0,0,0,.45)); pointer-events: auto; }
#turnBadge {
  padding: 7px 16px; border-radius: 999px; font-weight: 700; font-size: 15px;
  color: #fff; background: #4a5568; box-shadow: 0 2px 10px rgba(0,0,0,.35);
  transition: background .3s;
}
#phaseHint { font-size: 13px; opacity: .92; background: rgba(12,18,36,.6); padding: 6px 12px; border-radius: 8px; }
#soundToggle {
  margin-left: auto; pointer-events: auto; cursor: pointer;
  background: rgba(12,18,36,.6); border: 1px solid rgba(255,255,255,.16);
  border-radius: 8px; font-size: 16px; padding: 5px 10px; color: #fff;
}

/* ---------- 玩家面板 ---------- */
#playersPanel {
  position: fixed; right: 12px; top: 68px; z-index: 10;
  display: flex; flex-direction: column; gap: 8px; width: 218px;
}
.player-card {
  background: rgba(13, 20, 40, 0.78); border: 1px solid rgba(255,255,255,.12);
  border-radius: 12px; padding: 9px 11px; backdrop-filter: blur(6px);
  transition: box-shadow .25s, border-color .25s;
}
.player-card.active { border-color: #ffd54f; box-shadow: 0 0 14px rgba(255, 213, 79, .35); }
.pc-head { font-weight: 700; font-size: 14px; display: flex; justify-content: space-between; }
.pc-extra { font-size: 12px; color: #ffd54f; }
.pc-dots { display: flex; gap: 6px; margin: 5px 0; font-size: 14px; }
.pc-dot { background: rgba(255,255,255,.08); border-radius: 6px; padding: 2px 5px; font-size: 12px; }
.pc-items { display: flex; gap: 5px; flex-wrap: wrap; min-height: 30px; align-items: center; }
.item-empty { font-size: 11px; opacity: .5; }
.item-btn {
  position: relative; width: 34px; height: 34px; border-radius: 8px; cursor: pointer;
  border: 1px solid rgba(255,255,255,.22); background: rgba(255,255,255,.08); padding: 2px;
}
.item-btn:hover { background: rgba(255,255,255,.2); }
.item-btn img { width: 100%; height: 100%; object-fit: cover; border-radius: 6px; }
.item-n {
  position: absolute; right: -4px; bottom: -4px; font-size: 10px; font-weight: 700;
  background: #ffd54f; color: #422; padding: 0 4px; border-radius: 6px;
}

/* ---------- 日志 ---------- */
#logFeed {
  position: fixed; left: 12px; bottom: 12px; z-index: 10;
  width: min(360px, 44vw); max-height: 180px; overflow-y: auto;
  background: rgba(10, 15, 30, .68); border: 1px solid rgba(255,255,255,.1);
  border-radius: 10px; padding: 8px 10px; font-size: 12px; line-height: 1.55;
  backdrop-filter: blur(5px);
}
#logFeed::-webkit-scrollbar { width: 6px; }
#logFeed::-webkit-scrollbar-thumb { background: rgba(255,255,255,.2); border-radius: 3px; }
.log-line { opacity: .92; }
.log-good { color: #7be495; }
.log-bad { color: #ff8f8f; }
.log-turn { color: #ffd54f; font-weight: 700; margin-top: 4px; }
.log-info { color: #cfd8ea; }

/* ---------- 骰子 ---------- */
#diceBox { position: fixed; right: 18px; bottom: 18px; z-index: 10; text-align: center; }
#diceResult { font-size: 30px; font-weight: 800; text-shadow: 0 2px 8px rgba(0,0,0,.5); margin-bottom: 6px; }
#diceResult.pop { animation: pop .4s ease; }
@keyframes pop { 0% { transform: scale(.4); } 60% { transform: scale(1.35); } 100% { transform: scale(1); } }
#diceBtn {
  padding: 13px 30px; font-size: 17px; font-weight: 800; letter-spacing: 2px;
  color: #3a2a05; background: linear-gradient(180deg, #ffe082, #ffb300);
  border: none; border-radius: 14px; cursor: pointer;
  box-shadow: 0 4px 16px rgba(255, 179, 0, .4), inset 0 -3px 0 rgba(0,0,0,.18);
}
#diceBtn:hover { filter: brightness(1.07); }
#diceBtn:active { transform: translateY(2px); }

/* ---------- Toast ---------- */
#toast {
  position: fixed; top: 74px; left: 50%; transform: translateX(-50%) translateY(-8px);
  z-index: 30; background: rgba(16, 24, 48, .92); border: 1px solid rgba(255,255,255,.2);
  padding: 10px 22px; border-radius: 999px; font-size: 14px; font-weight: 600;
  opacity: 0; pointer-events: none; transition: all .3s;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 事件弹窗 ---------- */
#eventModal {
  position: fixed; inset: 0; z-index: 40;
  display: flex; align-items: center; justify-content: center;
  background: rgba(5, 8, 18, .62); backdrop-filter: blur(3px);
}
.modal-card {
  width: min(680px, 92vw); display: flex; gap: 0;
  background: #151d36; border: 1px solid rgba(255,255,255,.16);
  border-radius: 18px; overflow: hidden; box-shadow: 0 18px 60px rgba(0,0,0,.55);
  animation: rise .3s ease;
}
@keyframes rise { from { transform: translateY(26px); opacity: 0; } to { transform: none; opacity: 1; } }
#evImg { width: 240px; object-fit: cover; background: #0c1224; }
.modal-body { padding: 22px 24px; flex: 1; display: flex; flex-direction: column; gap: 10px; }
#evTitle { font-size: 22px; color: #ffd54f; }
#evDesc { font-size: 14px; line-height: 1.7; opacity: .92; white-space: pre-line; }
#evButtons { display: flex; gap: 10px; margin-top: auto; flex-wrap: wrap; }
.ev-btn {
  flex: 1; min-width: 150px; padding: 11px 14px; cursor: pointer; text-align: left;
  background: rgba(255,255,255,.07); color: #f1f3f8;
  border: 1px solid rgba(255,255,255,.2); border-radius: 12px;
}
.ev-btn:hover { background: rgba(255, 213, 79, .16); border-color: #ffd54f; }
.ev-btn b { display: block; font-size: 15px; margin-bottom: 3px; }
.ev-btn small { font-size: 12px; opacity: .75; }

/* ---------- 覆盖层 ---------- */
#setupOverlay, #victoryOverlay {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at center, rgba(18, 28, 58, .88), rgba(6, 9, 20, .96));
  backdrop-filter: blur(4px);
}
.setup-box {
  width: min(560px, 92vw); background: rgba(16, 23, 46, .92);
  border: 1px solid rgba(255,255,255,.16); border-radius: 20px;
  padding: 28px 30px; text-align: center; box-shadow: 0 20px 70px rgba(0,0,0,.6);
}
.setup-logo { width: min(380px, 80%); margin-bottom: 6px; }
.setup-sub { font-size: 13px; opacity: .8; margin-bottom: 18px; }
.setup-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 4px;
  border-bottom: 1px dashed rgba(255,255,255,.1);
}
.setup-dot { width: 16px; height: 16px; border-radius: 50%; box-shadow: 0 0 8px currentColor; }
.setup-name { font-weight: 700; width: 56px; text-align: left; }
.seg { margin-left: auto; display: flex; gap: 6px; }
.seg button {
  padding: 6px 14px; border-radius: 8px; cursor: pointer; font-size: 13px;
  border: 1px solid rgba(255,255,255,.2); background: rgba(255,255,255,.06); color: #cfd6e6;
}
.seg button.on { background: #ffd54f; color: #3a2a05; font-weight: 700; border-color: #ffd54f; }
.rules {
  margin: 16px 0; font-size: 12px; line-height: 1.8; text-align: left;
  background: rgba(255,255,255,.05); border-radius: 10px; padding: 10px 14px; opacity: .88;
}
.rules b { color: #ffd54f; display: block; margin-bottom: 2px; }
#startBtn, #restartBtn {
  padding: 13px 44px; font-size: 18px; font-weight: 800;
  color: #20305a; background: linear-gradient(180deg, #9be7ff, #38a1e8);
  border: none; border-radius: 14px; cursor: pointer;
  box-shadow: 0 4px 18px rgba(56, 161, 232, .45);
}
#vicText { font-size: 24px; margin-bottom: 22px; line-height: 1.6; }

/* ---------- 加载 ---------- */
#loading {
  position: fixed; inset: 0; z-index: 60; background: #0a1020;
  display: flex; align-items: center; justify-content: center; text-align: center;
}
.load-box { font-size: 15px; line-height: 2; }
.load-box small { opacity: .6; }
.spinner {
  width: 42px; height: 42px; margin: 0 auto 14px;
  border: 4px solid rgba(255,255,255,.15); border-top-color: #ffd54f;
  border-radius: 50%; animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 860px) {
  #playersPanel { width: 172px; }
  .modal-card { flex-direction: column; }
  #evImg { width: 100%; max-height: 200px; }
}
