/* TOWER STACK 专属主题：工业琥珀 / 施工现场 */
* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  overflow: hidden;
  background: #120f0a;
  font-family: "Segoe UI", -apple-system, system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

#stage { position: fixed; inset: 0; }

#game {
  position: absolute;
  inset: 0;
  display: block;
  touch-action: none;
  cursor: pointer;
}

#vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 45%, transparent 58%, rgba(10, 6, 2, 0.6) 100%);
}

/* ---------- HUD ---------- */
#hud {
  position: absolute;
  top: 0; left: 0; right: 0;
  max-width: 620px;
  margin: 0 auto;
  padding: calc(8px + env(safe-area-inset-top)) 14px 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: none;
  color: #ffedd6;
}

.hud-box { min-width: 86px; }
.hud-box.right { margin-left: auto; text-align: right; }

.hud-label {
  font-size: 10px;
  letter-spacing: 3px;
  text-transform: uppercase;
  opacity: 0.55;
}

.hud-value {
  font-size: 25px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 12px rgba(255, 160, 40, 0.4);
  line-height: 1.1;
}

.hud-chip {
  margin: 0 auto;
  padding: 4px 16px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1px;
  color: #ffd79a;
  background: rgba(255, 170, 50, 0.1);
  border: 1px solid rgba(255, 170, 50, 0.3);
}

#btn-mute, .hud-home {
  pointer-events: auto;
  width: 36px; height: 34px;
  border: 1px solid rgba(255, 200, 120, 0.25);
  border-radius: 8px;
  background: rgba(255, 170, 50, 0.08);
  color: #ffedd6;
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: background 0.15s;
}
#btn-mute:hover, .hud-home:hover { background: rgba(255, 170, 50, 0.2); }
#btn-mute.off { opacity: 0.45; }

/* ---------- 覆盖层 ---------- */
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: rgba(12, 8, 3, 0.66);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s;
  z-index: 10;
  overflow-y: auto;
}
.overlay.show { opacity: 1; visibility: visible; }

.panel {
  width: min(390px, 100%);
  padding: 0 26px 26px;
  border-radius: 14px;
  background: linear-gradient(170deg, #221a10, #171008);
  border: 1px solid rgba(255, 170, 50, 0.22);
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.6);
  text-align: center;
  color: #ffedd6;
  transform: translateY(12px);
  transition: transform 0.35s cubic-bezier(0.2, 1.3, 0.4, 1);
  overflow: hidden;
}
.overlay.show .panel { transform: none; }

/* 施工警示条 */
.panel::before {
  content: '';
  display: block;
  height: 10px;
  margin: 0 -26px 24px;
  background: repeating-linear-gradient(-45deg, #ffb02e 0 14px, #171008 14px 28px);
}

.logo {
  font-size: 38px;
  font-weight: 900;
  letter-spacing: 3px;
  color: #ffb02e;
  text-shadow: 0 4px 24px rgba(255, 160, 40, 0.35);
}
.logo span { color: #ff5d3a; }

.tagline {
  margin-top: 6px;
  font-size: 13px;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: #c9a276;
}

.btn-primary {
  width: 100%;
  padding: 15px;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 4px;
  color: #1c1207;
  cursor: pointer;
  background: linear-gradient(120deg, #ffb02e, #ff7a2e);
  box-shadow: 0 10px 26px rgba(255, 140, 40, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transition: transform 0.12s, filter 0.12s;
}
.btn-primary:hover { filter: brightness(1.1); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(1px) scale(0.98); }

.btn-hero {
  margin: 26px auto 20px;
  display: block;
  width: 80%;
  padding: 18px;
  font-size: 20px;
  letter-spacing: 7px;
  border-radius: 12px;
}

.howto.slim {
  list-style: none;
  margin: 0 0 18px;
  display: grid;
  gap: 9px;
}
.howto.slim li {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 13px;
  color: #d8b992;
}
.howto.slim li i { font-style: normal; font-size: 17px; }
.howto.slim li b { color: #ffedd6; }

.meta-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
  font-size: 12px;
}
.text-link { color: #ffc887; text-decoration: none; }
.text-link:hover { text-decoration: underline; }
.meta-dot { opacity: 0.4; }

/* ---------- 结算 ---------- */
.over-title {
  margin-top: 4px;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 7px;
  text-transform: uppercase;
  color: #ffd79a;
}

.record-badge {
  display: none;
  margin: 12px auto 0;
  width: fit-content;
  padding: 4px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 800;
  color: #1c1207;
  background: linear-gradient(100deg, #ffd75e, #ffb02e);
  animation: badge-pop 0.5s cubic-bezier(0.2, 1.8, 0.4, 1);
}
.record-badge.show { display: block; }
@keyframes badge-pop { from { transform: scale(0.3); opacity: 0; } }

.final-score {
  margin: 8px 0 4px;
  font-size: 62px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  color: #ffb02e;
  text-shadow: 0 6px 30px rgba(255, 150, 40, 0.4);
}
.final-score::after {
  content: ' FLOORS';
  font-size: 15px;
  letter-spacing: 3px;
  color: #c9a276;
}

.stats-row {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 14px 0 16px;
}
.stat {
  flex: 1;
  padding: 10px 6px;
  border-radius: 8px;
  background: rgba(255, 170, 50, 0.07);
  border: 1px solid rgba(255, 170, 50, 0.18);
}
.stat-v { font-size: 20px; font-weight: 900; font-variant-numeric: tabular-nums; }
.stat-k { font-size: 10px; color: #c9a276; margin-top: 2px; letter-spacing: 1px; text-transform: uppercase; }

/* ---------- 提交与榜单 ---------- */
.submit-row { display: flex; gap: 8px; }
.text-input {
  flex: 1;
  min-width: 0;
  padding: 11px 13px;
  border-radius: 8px;
  border: 1px solid rgba(255, 200, 120, 0.25);
  background: rgba(10, 6, 2, 0.6);
  color: #ffedd6;
  font-size: 14px;
  outline: none;
}
.text-input:focus { border-color: rgba(255, 176, 46, 0.6); }
.btn-secondary {
  padding: 11px 18px;
  border: 1px solid rgba(255, 176, 46, 0.5);
  border-radius: 8px;
  background: rgba(255, 170, 50, 0.12);
  color: #ffd79a;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}
.btn-secondary:hover { background: rgba(255, 170, 50, 0.25); }
.submit-status { min-height: 18px; margin: 8px 0 4px; font-size: 12px; color: #ffc887; }
.submit-status .text-link { color: #ffb02e; }

.leaderboard-card {
  margin: 10px 0 16px;
  padding: 14px;
  border-radius: 10px;
  background: rgba(255, 170, 50, 0.05);
  border: 1px solid rgba(255, 170, 50, 0.15);
  text-align: left;
}
.card-title {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #c9a276;
  margin-bottom: 10px;
}
.board-list { display: grid; gap: 5px; }
.board-row {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 6px 9px;
  border-radius: 7px;
  background: rgba(255, 240, 220, 0.04);
  font-size: 13px;
}
.board-rank { font-weight: 900; color: #ffb02e; }
.board-name { font-weight: 600; }
.board-meta { font-size: 10px; color: #c9a276; }
.board-score { font-weight: 900; font-variant-numeric: tabular-nums; }
.board-empty { font-size: 12px; color: #c9a276; padding: 8px 2px; }
