* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #0b1020;
  color: #e8ecf4;
  overflow: hidden;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}
#app {
  max-width: 480px;
  height: 100%;
  margin: 0 auto;
  background: linear-gradient(180deg, #131a30 0%, #0b1020 100%);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.view { position: absolute; inset: 0; display: flex; flex-direction: column; }

/* ---------------- 通用 ---------------- */
button { font-family: inherit; cursor: pointer; border: none; outline: none; }
.btn {
  display: block; width: 100%; padding: 13px 16px; margin: 7px 0;
  background: #1c2640; color: #cfd8ef;
  border: 2px solid #33406b; border-radius: 12px;
  font-size: 16px; font-weight: 700;
  box-shadow: 0 2px 0 #0a0f1e;
}
.btn:active { transform: translateY(1px); box-shadow: 0 1px 0 #0a0f1e; }
.btn-primary {
  background: linear-gradient(180deg, #ffd66b, #f0a63c); color: #4a2c05; border-color: #c78a1e;
  box-shadow: 0 3px 0 #a06f12;
}
.btn-big { font-size: 19px; padding: 15px; border-radius: 14px; }
.page-head { position: relative; display: flex; align-items: center; justify-content: center; padding: 14px 14px 8px; }
.page-title { text-align: center; font-size: 20px; color: #e8ecf4; }
.btn-close {
  position: absolute; right: 12px; top: 10px;
  width: 32px; height: 32px; border-radius: 50%;
  background: #e05c4a; color: #fff; font-size: 17px; font-weight: 800; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,.35);
}
.page-view { overflow-y: auto; scrollbar-width: thin; scrollbar-color: #33406b rgba(0,0,0,0); }
.page-view::-webkit-scrollbar { width: 5px; }
.page-view::-webkit-scrollbar-thumb { background: #33406b; border-radius: 3px; }
.page-view::-webkit-scrollbar-track { background: transparent; }

/* ---------------- 首页 ---------------- */
.home-view { align-items: center; justify-content: center; padding: 24px; text-align: center; }
.home-icon { font-size: 52px; margin-bottom: 4px; }
.home-title { font-size: 30px; color: #ffd66b; letter-spacing: 4px; text-shadow: 0 0 18px rgba(255,214,107,.35); }
.home-sub { color: #8fa0c8; font-size: 13px; margin: 6px 0 20px; }
.diff-panel { width: 100%; background: #141b30; border: 2px solid #2a3554; border-radius: 14px; padding: 12px; margin-bottom: 14px; }
.diff-label { font-size: 12px; color: #8fa0c8; margin-bottom: 9px; text-align: left; }
.diff-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.diff-btn {
  background: #1c2640; border: 2px solid #33406b; border-radius: 12px;
  padding: 10px 6px; text-align: center; color: #cfd8ef;
}
.diff-btn.active { background: linear-gradient(180deg, #ffd66b, #f0a63c); border-color: #c78a1e; color: #4a2c05; box-shadow: 0 2px 0 #a06f12; }
.diff-name { display: block; font-size: 16px; font-weight: 800; }
.diff-rev { display: block; font-size: 11px; opacity: .85; margin-top: 2px; }
.home-btns { width: 100%; }
.home-foot { margin-top: 14px; color: #8fa0c8; font-size: 12px; }

/* ---------------- 游戏 ---------------- */
.hud {
  display: flex; align-items: stretch; gap: 4px;
  padding: 8px 8px; background: #10162a;
}
.hud-cell {
  flex: 1 1 0; min-width: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: #16203a; border: 1px solid #2a3554; border-radius: 10px;
  padding: 5px 4px;
}
.hud-label { font-size: 10px; opacity: .8; color: #8fa0c8; }
.hud-val { font-size: 18px; font-weight: 800; color: #ffd66b; white-space: nowrap; }
.hud-val.boost { color: #7bff8a; text-shadow: 0 0 10px rgba(123,255,138,.6); }
.hud-unit { font-size: 10px; color: #8fa0c8; }
.hud-pause {
  flex: 0 0 auto; width: 52px; margin-left: 4px;
  background: #1c2640; border: 2px solid #33406b; border-radius: 10px;
  color: #ffd66b; font-size: 18px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}
.hud-pause:active { transform: translateY(1px); }
.game-mid { flex: 1; display: flex; align-items: center; justify-content: center; min-height: 0; }
#game-wrap {
  position: relative; width: 100%; height: 100%;
  overflow: hidden; background: #0a0f1e;
}
#game { width: 100%; height: 100%; display: block; }
#boost-bar {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 6px;
  background: rgba(20,40,20,.85); border: 2px solid #7bff8a; border-radius: 18px;
  padding: 5px 14px; color: #7bff8a; font-size: 14px; font-weight: 800;
  box-shadow: 0 0 16px rgba(123,255,138,.4);
}
.boost-ico { font-size: 16px; }
.ctrl-hint { text-align: center; color: #8fa0c8; font-size: 12px; padding: 6px 12px 10px; }

/* ---------------- 排行榜 ---------------- */
.tabs { display: flex; gap: 6px; padding: 4px 14px 8px; }
.tab {
  flex: 1; padding: 8px 4px; background: #1c2640; color: #8fa0c8;
  border-radius: 10px; font-size: 13px; font-weight: 700;
}
.tab.active { background: #f0a63c; color: #4a2c05; }
.tabs-sm { padding-top: 2px; }
.lb-note { padding: 0 16px 6px; font-size: 12px; color: #8fa0c8; text-align: center; }
.lb-body { padding: 4px 14px 20px; }
.lb-tip { text-align: center; color: #8fa0c8; padding: 30px 0; font-size: 14px; }
.lb-row {
  display: flex; align-items: center; gap: 10px;
  background: #141b30; border: 2px solid #2a3554; border-radius: 10px;
  padding: 8px 10px; margin: 6px 0;
}
.lb-rank { width: 28px; text-align: center; font-weight: 800; color: #8fa0c8; }
.lb-rank.top { color: #ffd66b; }
.lb-rank.r1 { color: #ffd23e; }
.lb-rank.r2 { color: #c0c8d8; }
.lb-rank.r3 { color: #e09050; }
.lb-user { flex: 1; display: flex; align-items: center; gap: 8px; min-width: 0; }
.lb-avatar { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; background: #2a3554; }
.lb-name { flex: 1; min-width: 0; font-size: 14px; color: #cfd8ef; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-score { font-size: 15px; font-weight: 800; color: #ffd66b; white-space: nowrap; }
.lb-me { color: #7ecbff; }
.lb-me-row { border-color: #3d5a86; }

/* ---------------- 设置 ---------------- */
.setting-row {
  display: flex; align-items: center; justify-content: space-between;
  background: #1c2640; border: 2px solid #2a3554; border-radius: 12px;
  padding: 12px 14px; margin: 14px 0;
}
.setting-label { font-size: 15px; font-weight: 700; color: #cfd8ef; }
.switch {
  position: relative; width: 52px; height: 28px; border-radius: 14px;
  background: #2a3554; border: 2px solid #33406b;
  transition: background .2s;
}
.switch .knob {
  position: absolute; top: 2px; left: 2px; width: 20px; height: 20px;
  border-radius: 50%; background: #8fa0c8; transition: left .2s, background .2s;
}
.switch.on { background: #f0a63c; border-color: #c78a1e; }
.switch.on .knob { left: 26px; background: #fff; }

/* ---------------- 玩法说明 ---------------- */
.help-card { max-height: 80vh; overflow-y: auto; }
.help-body { text-align: left; }
.help-item { font-size: 15px; color: #ffd66b; font-weight: 800; margin: 12px 0 6px; }
.help-line { font-size: 13px; color: #cfd8ef; line-height: 1.8; display: flex; align-items: center; gap: 6px; }
.help-ico { font-size: 16px; width: 22px; text-align: center; }

/* ---------------- 弹层 / 提示 ---------------- */
.mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.6);
  display: flex; align-items: center; justify-content: center; z-index: 50;
}
.confirm-card {
  width: min(84%, 320px); background: #141b30; border-radius: 16px;
  padding: 22px; text-align: center; box-shadow: 0 8px 30px rgba(0,0,0,.5);
  border: 2px solid #33406b;
}
.confirm-title { font-size: 20px; font-weight: 800; color: #ffd66b; margin-bottom: 10px; }
.confirm-text { font-size: 14px; color: #cfd8ef; line-height: 1.6; margin-bottom: 16px; white-space: pre-line; }
.confirm-btns { display: flex; gap: 10px; }
.confirm-btns.col { flex-direction: column; }
.confirm-btns .btn { margin: 0; }
.settle-score-label { font-size: 13px; color: #8fa0c8; margin-top: 6px; }
.settle-score { font-size: 40px; font-weight: 800; color: #ffd66b; margin: 4px 0 8px; text-shadow: 0 0 16px rgba(255,214,107,.4); }
.settle-new { color: #7ecbff; font-weight: 800; margin-bottom: 8px; }
.settle-info { font-size: 13px; color: #8fa0c8; margin-bottom: 16px; line-height: 1.6; white-space: pre-line; }
.toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%);
  background: rgba(0,0,0,.82); color: #fff; font-size: 14px;
  padding: 10px 18px; border-radius: 20px; z-index: 60;
  max-width: 86%; text-align: center;
}

/* ---------------- 电脑端 ---------------- */
@media (min-width: 520px) and (pointer: fine) {
  body { background: #070b16; }
  #app { height: min(100%, 860px); margin: 2vh auto; border-radius: 20px; box-shadow: 0 0 40px rgba(0,0,0,.6); overflow: hidden; }
}
