/**
 * 《方块跳跃》全局样式：复古像素字体、深色面板、HUD 与结算遮罩布局。
 * 画布 #game 使用 max-width + aspect-ratio 在窄屏下等比缩放。
 */
@import url("https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap");

:root {
  --bg: #1a1a2e;
  --panel: #16213e;
  --accent: #7cb342;
  --text: #e8e8e8;
  --danger: #c62828;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Press Start 2P", system-ui, sans-serif;
  font-size: 10px;
  line-height: 1.6;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
}

.shell {
  max-width: 100%;
}

.hud {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  padding: 10px 14px;
  background: var(--panel);
  border: 4px solid #333;
  box-shadow: inset 0 -4px 0 #0d1117;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand h1 {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.5px;
}

.pixel-icon {
  width: 24px;
  height: 24px;
  background: linear-gradient(#7cb342 33%, #5d4037 33% 66%, #4a3728 66%);
  border: 2px solid #222;
  image-rendering: pixelated;
}

.stats {
  display: flex;
  gap: 20px;
}

.stat strong {
  color: var(--accent);
}

#game {
  display: block;
  width: 100%;
  max-width: 960px;
  height: auto;
  aspect-ratio: 960 / 540;
  background: #87ceeb;
  border: 4px solid #222;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  cursor: crosshair;
}

.help {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  color: #aaa;
  font-size: 8px;
}

kbd {
  display: inline-block;
  padding: 4px 6px;
  background: #333;
  border: 2px solid #555;
  border-bottom-width: 4px;
  border-radius: 2px;
  font-size: 8px;
}

.btn {
  font-family: inherit;
  font-size: 8px;
  padding: 10px 16px;
  background: #444;
  color: var(--text);
  border: 3px solid #222;
  border-bottom-width: 5px;
  cursor: pointer;
}

.btn:active {
  transform: translateY(2px);
  border-bottom-width: 3px;
}

.btn.primary {
  background: var(--accent);
  color: #1a1a1a;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  padding: 16px;
}

.overlay.hidden {
  display: none;
}

.card {
  background: var(--panel);
  border: 4px solid #333;
  padding: 28px 24px;
  max-width: 440px;
  text-align: center;
  box-shadow: 0 8px 0 #111;
}

/** 排行榜页：略加宽，标题金色调 */
.card.card--leaderboard {
  max-width: 520px;
  width: min(520px, calc(100vw - 32px));
  padding: 22px 20px 26px;
}

.card--leaderboard #overlay-title {
  color: #ffd54f;
  text-shadow: 0 2px 0 #3e2723;
  font-size: 13px;
  margin-bottom: 4px;
}

.card--leaderboard .overlay-msg {
  margin-bottom: 16px;
  text-align: center;
}

/** 游戏设置页：与排行榜相近宽度，正文左对齐 */
.card.card--settings {
  max-width: 480px;
  width: min(480px, calc(100vw - 32px));
  padding: 22px 20px 26px;
}

.card--settings #overlay-title {
  color: #81c784;
  text-shadow: 0 2px 0 #1b3a1f;
  font-size: 12px;
  margin-bottom: 6px;
}

.card--settings .overlay-msg {
  margin-bottom: 18px;
  text-align: left;
}

.settings-page {
  text-align: left;
}

.settings-lead {
  margin: 0 0 14px;
  font-size: 8px;
  color: #bbb;
  line-height: 1.75;
  text-align: center;
}

.settings-row {
  margin-bottom: 16px;
}

.settings-row-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.settings-label {
  font-size: 9px;
  color: var(--accent);
  letter-spacing: 0.04em;
}

.settings-val {
  font-size: 9px;
  color: #ffd54f;
  min-width: 3.2em;
  text-align: right;
}

.settings-range {
  width: 100%;
  height: 10px;
  margin: 0;
  cursor: pointer;
  accent-color: var(--accent);
}

.settings-foot {
  margin: 4px 0 0;
  font-size: 7px;
  color: #888;
  line-height: 1.65;
  text-align: center;
}

.overlay-msg {
  margin: 0 0 20px;
  font-size: 9px;
  color: #ccc;
  line-height: 1.8;
}

.overlay-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: stretch;
}

.overlay-actions--home {
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.overlay-actions--home .btn {
  flex: 1 1 108px;
  min-width: 96px;
}

/* ---------- 武器外观选择 ---------- */

.weapon-select-page {
  text-align: left;
}

.weapon-select-lead {
  margin: 0 0 14px;
  font-size: 8px;
  color: #bbb;
  line-height: 1.75;
  text-align: center;
}

.weapon-select-section {
  margin-bottom: 16px;
}

.weapon-select-heading {
  margin: 0 0 8px;
  font-size: 9px;
  color: var(--accent);
  letter-spacing: 0.04em;
}

.weapon-select-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.weapon-opt {
  flex: 1 1 104px;
  max-width: 168px;
  margin: 0;
  font-family: inherit;
  font-size: 7px;
  padding: 10px 10px;
  line-height: 1.45;
  background: #252538;
  color: #ddd;
  border: 3px solid #444;
  border-bottom-width: 5px;
  cursor: pointer;
}

.weapon-opt--selected {
  border-color: var(--accent);
  color: #fff;
  background: #1a281c;
  box-shadow: inset 0 0 0 1px rgba(124, 179, 66, 0.35);
}

.weapon-opt:active {
  transform: translateY(2px);
  border-bottom-width: 3px;
}

.weapon-opt--elytra {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.weapon-opt-swatch {
  display: block;
  width: 30px;
  height: 18px;
  border-radius: 2px;
  flex-shrink: 0;
}

.weapon-select-foot {
  margin: 12px 0 0;
  font-size: 7px;
  color: #888;
  text-align: center;
}

.settlement {
  background: rgba(0, 0, 0, 0.35);
  border: 2px solid #444;
  padding: 12px 14px;
  margin-bottom: 14px;
  border-radius: 2px;
}

/** 游戏失败结算：与通关绿调区分 */
.settlement--fail {
  background: rgba(60, 20, 20, 0.45);
  border-color: #6d3535;
}

.settlement--fail .settlement-stat strong {
  color: #ffab91;
}

h2#overlay-title.overlay-title--fail {
  color: #ef5350;
}

.settlement-stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid #333;
  font-size: 8px;
}

.settlement-stat:last-child {
  border-bottom: none;
}

.settlement-stat strong {
  color: var(--accent);
  font-size: 10px;
}

.settlement-rank {
  margin: 10px 0 0;
  font-size: 8px;
  color: #ddd;
  text-align: center;
}

.settlement-sub {
  margin: 0 0 8px;
  font-size: 8px;
  color: #888;
}

.settlement-hint {
  margin: 0;
  font-size: 8px;
  color: #bbb;
  line-height: 1.8;
  text-align: center;
}

.rank-list {
  max-height: 168px;
  overflow-y: auto;
  border: 2px solid #333;
  background: #0d1117;
}

.rank-row {
  display: grid;
  grid-template-columns: 36px 1fr 72px;
  gap: 8px;
  padding: 8px 10px;
  font-size: 8px;
  border-bottom: 1px solid #222;
  align-items: center;
}

.rank-row:last-child {
  border-bottom: none;
}

.rank-row--you {
  background: rgba(124, 179, 66, 0.2);
  color: #fff;
}

.rank-empty {
  padding: 12px;
  font-size: 8px;
  color: #777;
  text-align: center;
}

/* ---------- 游戏排行榜（Top10）页面 ---------- */

.leaderboard-page {
  text-align: center;
}

.leaderboard-hero {
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 2px dashed #3d4a5c;
}

.leaderboard-kicker {
  margin: 0 0 6px;
  font-size: 7px;
  color: #90a4ae;
  letter-spacing: 0.06em;
}

.leaderboard-top-badge {
  margin: 0 0 8px;
  font-size: 15px;
  color: #ffe082;
  letter-spacing: 0.2em;
  text-shadow: 0 2px 0 #4e342e;
}

.leaderboard-rules {
  margin: 0;
  font-size: 7px;
  color: #b0bec5;
  line-height: 1.65;
}

.leaderboard-table {
  text-align: left;
  border: 3px solid #263238;
  border-radius: 4px;
  overflow: hidden;
  background: linear-gradient(180deg, #1a2332 0%, #0d1117 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 4px 0 #0a0a0a;
}

.leaderboard-head {
  display: grid;
  grid-template-columns: 40px 1fr 72px 82px;
  gap: 6px;
  padding: 10px 12px;
  font-size: 7px;
  color: #78909c;
  letter-spacing: 0.04em;
  background: #121a24;
  border-bottom: 2px solid #1e2a36;
}

.leaderboard-head span:nth-child(1),
.leaderboard-head span:nth-child(2) {
  text-align: center;
}

.leaderboard-head span:nth-child(3),
.leaderboard-head span:nth-child(4) {
  text-align: right;
}

.leaderboard-body {
  max-height: 240px;
  overflow-y: auto;
}

.leaderboard-row {
  display: grid;
  grid-template-columns: 40px 1fr 72px 82px;
  gap: 6px;
  align-items: center;
  padding: 10px 12px;
  font-size: 8px;
  border-bottom: 1px solid #1a2430;
  color: #eceff1;
}

.leaderboard-row:last-child {
  border-bottom: none;
}

.leaderboard-rank {
  text-align: center;
  font-weight: bold;
  color: #90a4ae;
}

.leaderboard-diamonds {
  text-align: center;
  color: #69f0ae;
  font-size: 9px;
}

.leaderboard-time,
.leaderboard-date {
  text-align: right;
  color: #b0bec5;
  font-variant-numeric: tabular-nums;
}

.leaderboard-row--gold {
  background: linear-gradient(90deg, rgba(255, 193, 7, 0.14), transparent 88%);
  box-shadow: inset 3px 0 0 #ffc107;
}

.leaderboard-row--gold .leaderboard-rank {
  color: #ffe082;
}

.leaderboard-row--silver {
  background: linear-gradient(90deg, rgba(224, 224, 224, 0.1), transparent 88%);
  box-shadow: inset 3px 0 0 #cfd8dc;
}

.leaderboard-row--silver .leaderboard-rank {
  color: #eceff1;
}

.leaderboard-row--bronze {
  background: linear-gradient(90deg, rgba(255, 152, 0, 0.12), transparent 88%);
  box-shadow: inset 3px 0 0 #ff9800;
}

.leaderboard-row--bronze .leaderboard-rank {
  color: #ffcc80;
}

.leaderboard-empty {
  padding: 22px 14px;
  border: 2px dashed #37474f;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.22);
}

.leaderboard-empty-title {
  margin: 0 0 10px;
  font-size: 10px;
  color: #90a4ae;
}

.leaderboard-empty-hint {
  margin: 0;
  font-size: 7px;
  color: #78909c;
  line-height: 1.75;
}

.card h2 {
  margin: 0 0 12px;
  font-size: 14px;
  color: var(--accent);
}

.card p {
  margin: 0 0 20px;
  font-size: 9px;
  color: #ccc;
  line-height: 1.8;
}

