* { margin: 0; padding: 0; box-sizing: border-box; user-select: none; -webkit-tap-highlight-color: transparent; }

html, body {
  width: 100%; height: 100%; overflow: hidden;
  background: #041e3a;
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
}

#gameCanvas { display: block; width: 100vw; height: 100vh; cursor: crosshair; }

.hidden { display: none !important; }

/* ---------- 登录遮罩 ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at center, rgba(8,60,110,.92), rgba(2,16,36,.97));
}

.auth-panel {
  width: 340px; padding: 40px 32px; text-align: center;
  background: linear-gradient(160deg, rgba(16,80,140,.55), rgba(6,32,64,.75));
  border: 1px solid rgba(80,190,255,.35);
  border-radius: 20px;
  box-shadow: 0 0 60px rgba(0,160,255,.25), inset 0 1px 0 rgba(255,255,255,.12);
  backdrop-filter: blur(8px);
}

.game-title {
  font-size: 34px; color: #ffd94d; letter-spacing: 2px;
  text-shadow: 0 2px 0 #b8860b, 0 0 24px rgba(255,200,40,.6);
}
.subtitle { color: #8fd4ff; margin: 10px 0 24px; font-size: 14px; letter-spacing: 4px; }

.auth-panel input {
  width: 100%; padding: 12px 16px; margin-bottom: 14px;
  background: rgba(2,24,48,.8); color: #dff2ff;
  border: 1px solid rgba(90,190,255,.4); border-radius: 10px;
  font-size: 15px; outline: none;
}
.auth-panel input:focus { border-color: #4fc3ff; box-shadow: 0 0 12px rgba(79,195,255,.4); }

.auth-btns { display: flex; gap: 12px; margin-top: 6px; }

.btn {
  flex: 1; padding: 12px 0; border: none; border-radius: 10px;
  font-size: 16px; font-weight: bold; cursor: pointer; letter-spacing: 2px;
  transition: transform .12s, box-shadow .12s;
}
.btn:active { transform: scale(.96); }
.btn-primary {
  background: linear-gradient(180deg, #ffd94d, #f0a020); color: #5a3200;
  box-shadow: 0 4px 0 #a86410, 0 6px 16px rgba(240,160,32,.4);
}
.btn-secondary {
  background: linear-gradient(180deg, #37b6ff, #1b7fd4); color: #fff;
  box-shadow: 0 4px 0 #0f5494, 0 6px 16px rgba(27,127,212,.4);
}

.auth-error { color: #ff7b7b; min-height: 20px; margin-top: 12px; font-size: 13px; }
.auth-tip { color: rgba(160,215,255,.55); font-size: 12px; margin-top: 4px; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; z-index: 10; pointer-events: none; }
#hud button { pointer-events: auto; }

.top-bar {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 18px;
  background: linear-gradient(180deg, rgba(2,20,42,.75), transparent);
}

.user-info {
  display: flex; align-items: center; gap: 8px;
  color: #ffe9a8; font-size: 18px; font-weight: bold;
  text-shadow: 0 1px 3px rgba(0,0,0,.6);
}
.user-name { color: #9fdcff; font-size: 15px; margin-right: 4px; }
.coin-icon { font-size: 20px; }
#coinCount { min-width: 60px; transition: color .2s; }
#coinCount.flash-up { color: #7bff9e; }
#coinCount.flash-down { color: #ff8f8f; }

.top-actions { display: flex; gap: 8px; }

.icon-btn {
  width: 40px; height: 40px; border: none; border-radius: 10px;
  background: rgba(8,46,86,.75); color: #cfeaff; font-size: 18px;
  cursor: pointer; border: 1px solid rgba(90,190,255,.3);
  transition: background .15s;
}
.icon-btn:hover { background: rgba(20,80,140,.85); }

/* ---------- 底部 ---------- */
.bottom-bar {
  position: absolute; bottom: 14px; left: 0; right: 0;
  display: flex; justify-content: center; align-items: flex-end; gap: 40px;
  pointer-events: none;
}
.bottom-bar > * { pointer-events: auto; }

.mult-panel {
  display: flex; align-items: center; gap: 10px;
  background: rgba(4,28,56,.8); padding: 8px 14px; border-radius: 16px;
  border: 1px solid rgba(90,190,255,.3);
}
.mult-btn {
  width: 42px; height: 42px; border: none; border-radius: 50%;
  background: linear-gradient(180deg, #37b6ff, #1b6fc4); color: #fff;
  font-size: 24px; font-weight: bold; cursor: pointer;
  box-shadow: 0 3px 0 #0d4c8c;
}
.mult-btn:active { transform: translateY(2px); box-shadow: none; }
.mult-display {
  min-width: 78px; text-align: center; color: #ffd94d;
  font-size: 24px; font-weight: bold; line-height: 1.05;
  text-shadow: 0 0 10px rgba(255,200,60,.5);
}
.mult-display small { display: block; font-size: 11px; color: #8fd4ff; font-weight: normal; }

.skill-panel { display: flex; gap: 12px; }
.skill-btn {
  position: relative; width: 64px; height: 64px;
  border: 1px solid rgba(120,210,255,.45); border-radius: 16px;
  background: rgba(6,36,70,.85); cursor: pointer; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  transition: box-shadow .15s;
}
.skill-btn:hover { box-shadow: 0 0 16px rgba(80,190,255,.5); }
.skill-btn.active { box-shadow: 0 0 20px #ffd94d; border-color: #ffd94d; }
.skill-btn.disabled { opacity: .45; cursor: not-allowed; }
.skill-icon { font-size: 26px; }
.skill-cost { font-size: 11px; color: #ffd94d; font-weight: bold; }
.skill-cd {
  position: absolute; inset: 0; display: none;
  align-items: center; justify-content: center;
  background: rgba(0,10,24,.72); color: #fff; font-size: 20px; font-weight: bold;
}
.skill-btn.on-cd .skill-cd { display: flex; }

/* ---------- 排行榜 ---------- */
.side-panel {
  position: absolute; top: 64px; right: 14px; width: 240px;
  background: rgba(4,26,52,.92); border: 1px solid rgba(90,190,255,.35);
  border-radius: 14px; padding: 12px; pointer-events: auto;
  box-shadow: 0 8px 30px rgba(0,0,0,.5);
}
.side-header {
  display: flex; justify-content: space-between; align-items: center;
  color: #ffd94d; font-size: 16px; font-weight: bold; margin-bottom: 8px;
}
.side-header .icon-btn { width: 28px; height: 28px; font-size: 13px; }
.board-list { list-style: none; }
.board-list li {
  display: flex; justify-content: space-between; padding: 7px 10px;
  color: #cfeaff; font-size: 14px; border-radius: 8px;
}
.board-list li:nth-child(odd) { background: rgba(30,90,150,.25); }
.board-list li:first-child { color: #ffd94d; font-weight: bold; }
.board-list .me { color: #7bff9e; }

/* ---------- Toast ---------- */
.toast {
  position: absolute; top: 70px; left: 50%; transform: translateX(-50%);
  background: rgba(4,30,60,.9); color: #ffe9a8;
  border: 1px solid rgba(255,210,90,.4); border-radius: 10px;
  padding: 8px 20px; font-size: 14px; pointer-events: none;
  animation: toastIn .25s ease-out;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, -8px); } to { opacity: 1; transform: translate(-50%, 0); } }
