* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0;
  height: 100%;
  background: #BFE3FF;
  color: #1F3A5F;
  font-family: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
#stage {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  margin: 0 auto;
  width: 100%;
  max-width: 480px;
  overflow: hidden;
  background: #CFEBFF;
  touch-action: none;
}
#cv {
  position: absolute;
  z-index: 0;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

/* ---------- HUD ---------- */
.hud {
  display: none;
  position: absolute;
  z-index: 2;
  left: 16px;
  right: 16px;
  top: calc(10px + env(safe-area-inset-top));
  pointer-events: none;
}
.hud.show { display: block; }
.hud-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: rgba(255, 255, 255, 0.82);
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 20px;
  padding: 8px 12px 8px 14px;
  box-shadow: 0 6px 18px rgba(38, 84, 140, 0.16);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.meter-col { display: flex; flex-direction: column; gap: 2px; min-width: 76px; }
.meter { display: flex; align-items: baseline; gap: 3px; }
.meter b {
  font-size: 28px;
  line-height: 1;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  color: #1F3A5F;
}
.meter span { font-size: 13px; font-weight: 800; color: #6C8FB8; }
.sky-tag {
  font-size: 11px;
  font-weight: 800;
  color: #7FA3C8;
  letter-spacing: 0.02em;
}
.coinbox {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 18px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #1F3A5F;
}
.coin-ico {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  box-sizing: border-box;
  background:
    radial-gradient(circle at 34% 30%, #FFFDF0 0 18%, transparent 19%),
    radial-gradient(circle at 50% 50%, #FFE9A8 0 40%, #FFC93D 41% 74%, #FF8A3D 75%);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.85), 0 2px 6px rgba(255, 138, 61, 0.4);
}
.hearts { display: flex; gap: 3px; align-items: center; }
.heart { width: 22px; height: 22px; display: block; }

.pow {
  display: none;
  position: absolute;
  z-index: 2;
  left: 50%;
  top: calc(70px + env(safe-area-inset-top));
  transform: translateX(-50%);
  min-width: 132px;
  background: rgba(31, 58, 95, 0.86);
  color: #fff;
  border-radius: 999px;
  padding: 6px 12px 7px;
  text-align: center;
  pointer-events: none;
  box-shadow: 0 6px 16px rgba(31, 58, 95, 0.24);
}
.pow.show { display: block; }
#powText { font-size: 13px; font-weight: 800; letter-spacing: 0.04em; }
.pow-track {
  margin-top: 4px;
  height: 4px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.24);
  overflow: hidden;
}
#powBar { height: 100%; width: 100%; background: #FF8A3D; border-radius: 4px; }

.hint {
  display: none;
  position: absolute;
  z-index: 2;
  left: 16px;
  right: 16px;
  top: 46%;
  transform: translateY(-50%);
  justify-content: center;
  align-items: center;
  pointer-events: none;
}
.hint.show { display: flex; }
.hint span {
  background: rgba(255, 255, 255, 0.9);
  border-radius: 999px;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 800;
  color: #2C5A8C;
  box-shadow: 0 6px 16px rgba(38, 84, 140, 0.16);
}

/* ---------- 面板 ---------- */
.sheet {
  display: none;
  position: absolute;
  z-index: 4;
  left: 16px;
  right: 16px;
  bottom: calc(12px + env(safe-area-inset-bottom));
  max-height: calc(100% - 24px - env(safe-area-inset-top));
  overflow: auto;
  background: #FFFFFF;
  border-radius: 26px;
  padding: 16px 16px 14px;
  box-shadow: 0 10px 30px rgba(38, 84, 140, 0.22);
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}
.sheet.show { display: block; animation: rise 0.42s cubic-bezier(0.2, 0.8, 0.2, 1); }
.sheet.over {
  top: 50%;
  bottom: auto;
  transform: translateY(-50%);
}
.sheet.over.show { animation: pop 0.36s cubic-bezier(0.2, 0.9, 0.2, 1) both; }
@keyframes rise {
  0% { opacity: 0; transform: translateY(28px); }
  100% { opacity: 1; transform: translateY(0); }
}
@keyframes pop {
  0% { opacity: 0; transform: translateY(-50%) scale(0.9); }
  100% { opacity: 1; transform: translateY(-50%) scale(1); }
}
.who { display: flex; align-items: center; gap: 12px; }
.who-txt { min-width: 0; }
.avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #F4FAFF;
  position: relative;
  flex: none;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(38, 84, 140, 0.16);
}
.avatar canvas { width: 100%; height: 100%; display: block; }
.logo {
  font-size: 26px;
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: #1F3A5F;
}
.sub {
  margin-top: 3px;
  font-size: 13px;
  font-weight: 700;
  color: #6C8FB8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rule {
  margin: 12px 0 10px;
  background: #F2F8FF;
  border-radius: 16px;
  padding: 11px 13px;
  font-size: 13px;
  line-height: 1.55;
  font-weight: 700;
  color: #3A6A9C;
}
.rule b { color: #FF8A3D; font-weight: 900; }
.legend {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 10px;
  margin: 0 0 12px;
}
.legend span {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  font-size: 12px;
  font-weight: 800;
  color: #3A6A9C;
}
.dot {
  width: 16px;
  height: 16px;
  flex: none;
  border-radius: 50%;
}
.dot.cloud { background: linear-gradient(180deg, #FFFFFF, #E4F1FF); box-shadow: 0 0 0 2px #D3E7FA; }
.dot.spring { background: linear-gradient(180deg, #B6F0A8, #6FD65A); box-shadow: 0 0 0 2px #DCF6D4; }
.dot.rocket { background: linear-gradient(180deg, #FFD79A, #FF8A3D); box-shadow: 0 0 0 2px #FFE6CC; }
.dot.dragon { background: linear-gradient(180deg, #E4D6FF, #B79BFF); box-shadow: 0 0 0 2px #EDE4FF; }

.skin-block { margin: 0 0 10px; }
.skin-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 0 2px 8px;
}
.skin-head b { font-size: 14px; font-weight: 900; color: #1F3A5F; }
.skin-head span { font-size: 11px; font-weight: 800; color: #8AA9C8; }
.skin-row {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 2px 2px 8px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
  overscroll-behavior-x: contain;
}
.skin-row::-webkit-scrollbar { height: 0; }
.skin-card {
  flex: none;
  width: 84px;
  border: 2px solid #E4EFFB;
  background: #FFFFFF;
  border-radius: 18px;
  padding: 8px 4px;
  scroll-snap-align: start;
  box-shadow: 0 4px 12px rgba(38, 84, 140, 0.08);
  font-family: inherit;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.12s ease, border-color 0.12s ease;
}
.skin-card.is-on { border-color: #FF8A3D; box-shadow: 0 6px 16px rgba(255, 138, 61, 0.28); }
.skin-card:active { transform: translateY(2px) scale(0.98); }
.skin-prev {
  position: relative;
  display: block;
  width: 62px;
  height: 62px;
  margin: 0 auto;
  border-radius: 50%;
  overflow: hidden;
  background: #F4FAFF;
}
.skin-prev canvas { width: 100%; height: 100%; display: block; }
.skin-lock {
  position: absolute;
  right: 0;
  top: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(31, 58, 95, 0.82);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}
.skin-lock .mp-icon { width: 12px; height: 12px; }
.skin-name {
  display: block;
  margin-top: 5px;
  font-size: 11px;
  font-weight: 900;
  color: #1F3A5F;
  text-align: center;
}
.skin-tag {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  margin-top: 2px;
  font-size: 10px;
  font-weight: 800;
  color: #8AA9C8;
  white-space: nowrap;
}
.skin-card.is-on .skin-tag { color: #FF8A3D; }
.skin-now {
  margin: 8px 0 0;
  text-align: center;
  font-size: 12px;
  font-weight: 800;
  color: #8AA9C8;
}

.trial-bar {
  display: none;
  align-items: center;
  gap: 10px;
  background: #FFF6EC;
  border-radius: 16px;
  padding: 10px 12px;
  margin: 0 0 10px;
}
.trial-bar.show { display: flex; }
.trial-bar p {
  flex: 1;
  margin: 0;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.4;
  color: #B4703A;
}

.board {
  margin: 0 0 12px;
  background: #F2F8FF;
  border-radius: 18px;
  padding: 10px 10px 6px;
}
.board-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 2px 4px 6px;
}
.board-head b {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 14px;
  font-weight: 900;
  color: #1F3A5F;
}
.board-head .mp-icon { width: 16px; height: 16px; color: #FF8A3D; }
.board-tip {
  margin-top: 3px;
  font-size: 10px;
  font-weight: 800;
  color: #8AA9C8;
}
.best {
  flex: none;
  font-size: 11px;
  font-weight: 800;
  color: #6C8FB8;
  text-align: right;
  line-height: 1.5;
}
.board-list {
  margin: 0;
  padding: 0 0 4px;
  list-style: none;
}
.board-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 800;
  color: #3A6A9C;
}
.board-list li .rk {
  width: 18px;
  flex: none;
  text-align: center;
  color: #FF8A3D;
  font-weight: 900;
}
.board-list li .nm {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.board-list li .sc { flex: none; font-variant-numeric: tabular-nums; }
.board-empty {
  padding: 8px 6px 10px;
  font-size: 12px;
  font-weight: 800;
  color: #8AA9C8;
  text-align: center;
}

.start-actions { display: flex; gap: 10px; }
.btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 50px;
  border: none;
  border-radius: 16px;
  padding: 0 16px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 900;
  color: #fff;
  background: linear-gradient(180deg, #FFA45C 0%, #FF8A3D 100%);
  box-shadow: 0 6px 16px rgba(255, 138, 61, 0.34);
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.btn:active { transform: translateY(2px); box-shadow: 0 3px 10px rgba(255, 138, 61, 0.3); }
.btn.watch {
  background: linear-gradient(180deg, #5FB6FF 0%, #3D8FE0 100%);
  box-shadow: 0 6px 16px rgba(61, 143, 224, 0.3);
  margin: 0 0 8px;
  width: 100%;
}
.btn.watch:active { box-shadow: 0 3px 10px rgba(61, 143, 224, 0.28); }
.btn.watch .mp-icon { width: 18px; height: 18px; color: #fff; }
.btn.slim { min-height: 40px; font-size: 13px; border-radius: 13px; padding: 0 12px; flex: none; }
.btn.ghost {
  background: #F2F8FF;
  color: #3A6A9C;
  box-shadow: none;
  margin-top: 8px;
}
.btn.ghost:active { background: #E6F1FC; box-shadow: none; }

.score-hero {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
  margin: 14px 0 2px;
}
.score-hero b {
  font-size: 46px;
  line-height: 1;
  font-weight: 900;
  letter-spacing: -0.05em;
  color: #FF8A3D;
  font-variant-numeric: tabular-nums;
}
.score-hero span { font-size: 15px; font-weight: 900; color: #8AA9C8; }
.score-sub {
  text-align: center;
  font-size: 13px;
  font-weight: 800;
  color: #6C8FB8;
}
.badge {
  display: none;
  width: fit-content;
  margin: 8px auto 0;
  padding: 4px 12px;
  border-radius: 999px;
  background: #FFF0E2;
  color: #FF8A3D;
  font-size: 12px;
  font-weight: 900;
}
.badge.show { display: block; }
.rank-line {
  margin: 4px 0 12px;
  text-align: center;
  font-size: 12px;
  font-weight: 800;
  color: #3A6A9C;
}
.ad-hint {
  margin: 0 0 10px;
  text-align: center;
  font-size: 11px;
  font-weight: 800;
  color: #8AA9C8;
}
#unlockBtn { display: none; }
#unlockBtn.show { display: flex; }
#trialHint { display: none; }
#trialHint.show { display: block; }
#adBtn { display: none; }
#adBtn.show { display: flex; }
#adHint { display: none; }
#adHint.show { display: block; }

/* ---------- 广告遮罩 ---------- */
.ad-mask {
  display: none;
  position: absolute;
  z-index: 8;
  inset: 0;
  background: rgba(20, 40, 66, 0.55);
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.ad-mask.show { display: flex; }
.ad-card {
  width: 100%;
  max-width: 300px;
  background: #fff;
  border-radius: 22px;
  padding: 20px 18px 16px;
  text-align: center;
  box-shadow: 0 18px 40px rgba(20, 40, 66, 0.3);
}
.ad-card b { font-size: 15px; font-weight: 900; color: #1F3A5F; }
.ad-card p {
  margin: 10px 0 6px;
  font-size: 34px;
  font-weight: 900;
  color: #FF8A3D;
  font-variant-numeric: tabular-nums;
}
.ad-card span {
  display: block;
  font-size: 12px;
  line-height: 1.5;
  font-weight: 700;
  color: #8AA9C8;
  margin-bottom: 14px;
}

.toast {
  position: absolute;
  z-index: 9;
  left: 50%;
  bottom: 22%;
  transform: translate(-50%, 12px);
  max-width: 80%;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(31, 58, 95, 0.9);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
