/* 一指上楼梯 —— 竖屏单指蓄力跳跃（成品界面） */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
:root {
  --orange: #FF8A3D;
  --orange-deep: #E8621A;
  --gold: #FFD166;
  --gold-soft: #FFE9B5;
  --sky: #2E8FD8;
  --navy: #0A1C34;
  --navy-2: #122C50;
  --cream: #FFF8EC;
  --ink: #2A1B0E;
  --muted: #8C7460;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --font: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
}
html, body {
  margin: 0; padding: 0; width: 100%; height: 100%;
  overflow: hidden; background: #0B1B33; color: #fff;
  font-family: var(--font);
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
  overscroll-behavior: none;
}
body { position: fixed; inset: 0; }
.app {
  position: fixed; inset: 0; overflow: hidden;
  background: linear-gradient(180deg, #7FC8EA 0%, #A9DDF0 55%, #F5D9A8 100%);
  touch-action: none;
}

/* 参考图铺满整屏（canvas 在其上接管镜头） */
.cover-img {
  position: absolute; top: 0; left: 50%; z-index: 0;
  display: block;
  width: 106.383%; height: 100%;
  object-fit: cover; object-position: 50% 50%;
  transform: translateX(-50%) scaleX(.94);
  transform-origin: 50% 50%;
  pointer-events: none;
  transition: opacity .35s ease;
}
.app.playing .cover-img { opacity: 0; }

#game {
  position: absolute; inset: 0; z-index: 1;
  display: block; width: 100%; height: 100%;
  transform-origin: 50% 50%;
  will-change: transform;
}

/* 游戏中上下压暗，让浮层和画面分层 */
.scene-shade {
  position: absolute; inset: 0; z-index: 2; pointer-events: none;
  opacity: 0; transition: opacity .45s ease;
  background: linear-gradient(180deg,
    rgba(6, 16, 34, 0) 48%,
    rgba(6, 16, 34, .08) 62%,
    rgba(6, 16, 34, .3) 78%,
    rgba(5, 14, 30, .62) 92%,
    rgba(5, 14, 30, .8) 100%);
}
.app.playing .scene-shade { opacity: 1; }

/* 顶部两角柔光，压住原图自带的角落按钮，保证 HUD 清晰 */
.corner-scrim {
  position: absolute; top: 0; z-index: 3;
  width: 180px; height: 110px; pointer-events: none;
  transition: opacity .35s ease;
}
.app.playing .corner-scrim { opacity: 0; }
.scrim-left {
  left: 0;
  background: radial-gradient(140% 130% at 0% 0%, rgba(4, 18, 38, .5) 0%, rgba(4, 18, 38, .2) 36%, rgba(4, 18, 38, 0) 70%);
}
.scrim-right {
  right: 0; width: 200px;
  background: radial-gradient(140% 130% at 100% 0%, rgba(4, 18, 38, .68) 0%, rgba(4, 18, 38, .3) 36%, rgba(4, 18, 38, 0) 70%);
}

/* ============ 顶部 HUD ============ */
.topbar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 10;
  padding: calc(10px + var(--safe-t)) 14px 0;
  display: flex; align-items: flex-start; justify-content: space-between;
  pointer-events: none;
}
.hud-btn {
  pointer-events: auto;
  width: 46px; height: 46px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid rgba(255, 255, 255, .3);
  border-radius: 15px;
  color: #fff; cursor: pointer;
  background: linear-gradient(180deg, #3E82B8 0%, #245F96 55%, #173F6B 100%);
  box-shadow: 0 8px 18px rgba(3, 15, 32, .4), inset 0 1.5px 0 rgba(255, 255, 255, .4), inset 0 -2px 5px rgba(0, 20, 50, .25);
  transition: transform .12s ease, filter .15s ease;
}
.hud-btn .mp-icon { width: 24px; height: 24px; }
.hud-btn:active { transform: scale(.93); filter: brightness(1.08); }

.score-wrap { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.score-cap {
  display: inline-flex; align-items: center; gap: 7px;
  height: 46px; padding: 5px 15px 5px 6px;
  border-radius: 999px;
  background: linear-gradient(180deg, #3B7DB4 0%, #235E94 48%, #143F6B 100%);
  border: 1px solid rgba(255, 255, 255, .34);
  box-shadow: 0 9px 20px rgba(2, 12, 28, .42), inset 0 1.5px 0 rgba(255, 255, 255, .4), inset 0 -2px 6px rgba(0, 20, 50, .28);
  font-variant-numeric: tabular-nums;
}
.coin {
  width: 34px; height: 34px; flex: none; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: #7A4300;
  background: radial-gradient(circle at 34% 27%, #FFF2C2 0%, #FFD166 42%, #F0A21F 100%);
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, .9), inset 0 -2px 3px rgba(150, 80, 0, .3), 0 2px 6px rgba(60, 30, 0, .3);
}
.coin .mp-icon { width: 21px; height: 21px; }
.coin-num {
  font-size: 24px; font-weight: 900; line-height: 1; letter-spacing: -.02em;
  text-shadow: 0 2px 0 rgba(4, 26, 52, .35);
}
.coin-unit { font-size: 10.5px; font-weight: 800; color: rgba(255, 246, 226, .72); margin-left: -2px; }
.score-cap.pop { animation: scorePop .4s cubic-bezier(.2, 1.5, .4, 1); }
@keyframes scorePop {
  0% { transform: scale(1); }
  36% { transform: scale(1.13); box-shadow: 0 9px 26px rgba(255, 178, 70, .6); }
  100% { transform: scale(1); }
}
.best-tag {
  height: 24px; padding: 0 10px; border-radius: 999px;
  display: none; align-items: center; gap: 4px;
  font-size: 10.5px; font-weight: 800; letter-spacing: .03em;
  color: #FFE6AE;
  background: rgba(9, 26, 50, .55);
  border: 1px solid rgba(255, 218, 150, .28);
  box-shadow: 0 4px 10px rgba(0, 0, 0, .16);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.best-tag .mp-icon { width: 13px; height: 13px; color: var(--gold); }
.app.playing .best-tag { display: inline-flex; }

/* ============ 开场按住提示 ============ */
.intro-hint {
  position: absolute; left: 50%; bottom: calc(16px + var(--safe-b));
  z-index: 6;
  display: inline-flex; align-items: center; gap: 8px;
  height: 42px; padding: 0 18px 0 9px;
  border-radius: 999px;
  color: #FFF7E6;
  font-size: 13px; font-weight: 800; letter-spacing: .05em;
  background: linear-gradient(180deg, rgba(16, 43, 78, .88) 0%, rgba(7, 22, 44, .94) 100%);
  border: 1px solid rgba(255, 220, 150, .48);
  box-shadow: 0 12px 28px rgba(1, 10, 24, .38), inset 0 1px 0 rgba(255, 255, 255, .2);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  transform: translate(-50%, 0);
  transition: opacity .3s ease, visibility .3s, transform .3s ease;
  animation: hintFloat 2.8s ease-in-out infinite;
  pointer-events: none;
}
.intro-hint-icon {
  width: 28px; height: 28px; flex: none; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: #613300;
  background: radial-gradient(circle at 35% 28%, #FFF0BA, #FFD166 50%, #F5A623 100%);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, .85), 0 2px 6px rgba(80, 40, 0, .3);
}
.intro-hint-icon .mp-icon { width: 17px; height: 17px; }
.app.playing .intro-hint { opacity: 0; visibility: hidden; transform: translate(-50%, 12px); }
@keyframes hintFloat {
  0%, 100% { transform: translate(-50%, 0); }
  50% { transform: translate(-50%, -5px); }
}

/* ============ 蓄力台 ============ */
.dock {
  position: absolute; left: 12px; right: 12px; z-index: 9;
  bottom: calc(10px + var(--safe-b));
  padding: 11px 14px 10px;
  border-radius: 22px;
  background:
    radial-gradient(120% 100% at 50% 0%, rgba(255, 162, 82, .16) 0%, rgba(255, 162, 82, 0) 60%),
    linear-gradient(180deg, rgba(21, 46, 82, .93) 0%, rgba(8, 21, 42, .96) 70%, rgba(6, 16, 33, .97) 100%);
  border: 1px solid rgba(255, 208, 148, .28);
  box-shadow: 0 18px 40px rgba(2, 8, 20, .48), inset 0 1px 0 rgba(255, 255, 255, .14);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  transform: translateY(140%); opacity: 0; pointer-events: none;
  transition: transform .5s cubic-bezier(.2, .9, .25, 1), opacity .32s ease, border-color .2s;
}
.dock.show { transform: translateY(0); opacity: 1; pointer-events: auto; }
.dock::before {
  content: ""; position: absolute; left: 50%; top: -1px; transform: translateX(-50%);
  width: 52%; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 218, 158, .9), transparent);
}
.dock-top { display: flex; align-items: center; justify-content: space-between; margin: 0 1px 8px; }
.dock-label {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 900; letter-spacing: .16em;
  color: rgba(255, 234, 200, .9);
}
.dock-label .mp-icon { width: 14px; height: 14px; color: var(--gold); }
.dock-floor {
  height: 21px; padding: 0 9px; border-radius: 999px;
  display: inline-flex; align-items: center;
  font-size: 10px; font-weight: 800; letter-spacing: .03em;
  color: rgba(255, 241, 218, .9);
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .12);
  white-space: nowrap;
}
.track {
  position: relative; height: 18px; border-radius: 999px;
  background: rgba(2, 10, 22, .66);
  border: 1px solid rgba(255, 255, 255, .15);
  box-shadow: inset 0 3px 8px rgba(0, 0, 0, .5), inset 0 -1px 0 rgba(255, 255, 255, .07);
  overflow: hidden;
}
.track::after {
  content: ""; position: absolute; left: 7px; right: 7px; top: 3px; height: 4px;
  border-radius: 999px; background: linear-gradient(180deg, rgba(255, 255, 255, .18), transparent);
  pointer-events: none;
}
.zone {
  position: absolute; top: 0; bottom: 0; left: 60%; width: 16%;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255, 209, 102, .12), rgba(255, 209, 102, .62) 50%, rgba(255, 209, 102, .12));
  box-shadow: inset 0 0 0 1px rgba(255, 226, 160, .7), 0 0 14px rgba(255, 190, 80, .4);
  transition: box-shadow .15s ease;
}
.zone::before {
  content: ""; position: absolute; left: 50%; top: 50%; width: 6px; height: 6px;
  transform: translate(-50%, -50%) rotate(45deg);
  border-radius: 1px;
  background: #FFF6D8;
  box-shadow: 0 0 10px rgba(255, 232, 170, .95);
}
.fill {
  position: absolute; top: 0; bottom: 0; left: 0; width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #FF6B22 0%, #FF963D 55%, #FFD166 100%);
  box-shadow: 0 0 16px rgba(255, 138, 61, .55), inset 0 1px 0 rgba(255, 255, 255, .55);
  transition: width .04s linear;
}
.fill::after {
  content: ""; position: absolute; right: 0; top: 0; bottom: 0; width: 3px;
  border-radius: 3px; background: #FFF3CE;
  box-shadow: 0 0 12px #FFE3A3;
  opacity: 0;
}
.dock.charging .fill::after { opacity: 1; }
.thumb {
  position: absolute; top: 50%; left: 0; width: 6px; height: 24px;
  border-radius: 4px; background: #fff;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, .16), 0 2px 8px rgba(0, 0, 0, .45);
  opacity: 0; transition: opacity .15s ease;
  pointer-events: none;
}
.dock-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 9px; gap: 10px; }
.dock-hint {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10.5px; font-weight: 600; letter-spacing: .02em;
  color: rgba(255, 255, 255, .55);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dock-hint .mp-icon { width: 13px; height: 13px; color: rgba(255, 210, 140, .85); flex: none; }
.dock-best { font-size: 10.5px; font-weight: 800; color: rgba(255, 224, 172, .82); font-variant-numeric: tabular-nums; white-space: nowrap; }
.dock.charging {
  border-color: rgba(255, 196, 120, .66);
  box-shadow: 0 18px 46px rgba(255, 120, 40, .2), inset 0 1px 0 rgba(255, 255, 255, .18);
}
.dock.in-zone .zone {
  box-shadow: inset 0 0 0 1.5px rgba(196, 255, 176, .98), 0 0 20px rgba(150, 255, 130, .7);
  background: linear-gradient(90deg, rgba(170, 255, 150, .25), rgba(200, 255, 170, .82) 50%, rgba(170, 255, 150, .25));
}
.dock.in-zone .track { border-color: rgba(190, 255, 170, .5); }
.dock.maxed .fill { background: linear-gradient(90deg, #FF5B3A, #FF3D2E); animation: maxPulse .3s ease-in-out infinite alternate; }
@keyframes maxPulse { from { filter: brightness(.95); } to { filter: brightness(1.25); } }
.dock:not(.show) { pointer-events: none; }

/* ============ 提示 ============ */
.toast {
  position: absolute; left: 50%; top: 23%; z-index: 12;
  transform: translate(-50%, -8px) scale(.9);
  padding: 9px 18px; border-radius: 999px;
  font-size: 14px; font-weight: 900; letter-spacing: .1em;
  color: #4A2600; white-space: nowrap;
  background: linear-gradient(180deg, #FFF3CE, #FFD166);
  border: 1px solid rgba(255, 255, 255, .8);
  box-shadow: 0 10px 26px rgba(80, 40, 0, .35), inset 0 1px 0 #fff;
  opacity: 0; pointer-events: none;
}
.toast.show { animation: toastIn 1.35s cubic-bezier(.2, .9, .2, 1) forwards; }
@keyframes toastIn {
  0% { opacity: 0; transform: translate(-50%, 6px) scale(.82); }
  14% { opacity: 1; transform: translate(-50%, 0) scale(1); }
  72% { opacity: 1; transform: translate(-50%, -4px) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -18px) scale(.98); }
}

/* ============ 暂停 / 结算 共用 ============ */
.pause, .over {
  position: absolute; inset: 0; z-index: 30;
  display: flex; align-items: center; justify-content: center;
  padding: 18px;
  background: rgba(4, 11, 24, .62);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  opacity: 0; visibility: hidden;
  transition: opacity .28s ease, visibility .28s;
}
.pause.show, .over.show { opacity: 1; visibility: visible; }
.sheet {
  position: relative; width: min(342px, 100%);
  padding: 26px 20px 14px;
  border-radius: 27px;
  background: radial-gradient(120% 70% at 50% 0%, #FFFEFA 0%, #FFF8EA 52%, #FFEACD 100%);
  border: 2px solid rgba(255, 255, 255, .92);
  box-shadow: 0 30px 70px rgba(0, 0, 0, .52), inset 0 2px 0 #fff, inset 0 -4px 0 rgba(210, 160, 100, .16);
  text-align: center;
  transform: translateY(16px) scale(.92);
  transition: transform .38s cubic-bezier(.18, 1.28, .35, 1);
}
.pause.show .sheet, .over.show .sheet { transform: translateY(0) scale(1); }
.sheet-badge, .over-badge {
  position: absolute; top: -32px; left: 50%; transform: translateX(-50%);
  width: 60px; height: 60px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  background: linear-gradient(180deg, #FFB35E, #FF7A2F);
  border: 3px solid #FFF8EC;
  box-shadow: 0 10px 24px rgba(200, 90, 20, .45), inset 0 2px 0 rgba(255, 255, 255, .5);
}
.sheet-badge .mp-icon, .over-badge .mp-icon { width: 28px; height: 28px; }
.sheet-title {
  margin: 12px 0 0; font-size: 26px; font-weight: 900; letter-spacing: .04em;
  color: var(--ink);
}
.sheet-sub { margin: 5px 0 0; font-size: 12.5px; font-weight: 600; color: var(--muted); line-height: 1.55; }
.new-record {
  position: absolute; top: 15px; right: 14px;
  height: 24px; padding: 0 10px; border-radius: 999px;
  display: none; align-items: center;
  font-size: 10px; font-weight: 900; letter-spacing: .08em;
  color: #723500;
  background: linear-gradient(180deg, #FFE7AB, #FFB347);
  border: 1px solid rgba(255, 255, 255, .85);
  box-shadow: 0 4px 10px rgba(150, 80, 0, .25);
}
.new-record.show { display: inline-flex; }

.over-stats {
  display: flex; align-items: center; justify-content: center; gap: 16px;
  margin: 17px 0 11px; padding: 13px 10px;
  border-radius: 18px;
  background: rgba(255, 255, 255, .64);
  border: 1px solid rgba(205, 160, 110, .3);
  box-shadow: inset 0 2px 6px rgba(190, 130, 70, .1);
}
.stat { display: flex; align-items: baseline; gap: 4px; }
.stat b { font-size: 29px; font-weight: 900; line-height: 1; color: var(--orange-deep); font-variant-numeric: tabular-nums; }
.stat-k { font-size: 11px; font-weight: 700; color: #9A8068; }
.stat-divider { width: 1px; height: 26px; background: rgba(190, 150, 105, .3); }
.over-floor { font-size: 10.5px; font-weight: 800; letter-spacing: .16em; color: #A78A70; margin-bottom: 15px; }

.howto {
  list-style: none; margin: 15px 0 12px; padding: 12px 13px;
  border-radius: 17px; text-align: left;
  background: rgba(255, 255, 255, .62);
  border: 1px solid rgba(205, 160, 110, .26);
  box-shadow: inset 0 2px 6px rgba(190, 130, 70, .08);
}
.howto li { display: flex; align-items: center; gap: 9px; padding: 4px 0; }
.howto li + li { border-top: 1px dashed rgba(190, 150, 105, .24); }
.howto b {
  width: 21px; height: 21px; flex: none; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10.5px; font-weight: 900; color: #fff;
  background: linear-gradient(180deg, #FFB35E, #FF7A2F);
  box-shadow: 0 2px 5px rgba(190, 80, 20, .25);
}
.howto span { font-size: 12px; font-weight: 600; color: #6F5945; line-height: 1.35; }
.pause-best {
  display: inline-flex; align-items: center; gap: 5px;
  height: 30px; padding: 0 13px; border-radius: 999px;
  margin: 0 auto 13px;
  background: rgba(255, 244, 224, .86);
  border: 1px solid rgba(205, 160, 110, .34);
  color: #9A8068; font-size: 11px; font-weight: 700;
}
.pause-best .mp-icon { width: 15px; height: 15px; color: #F0A21F; }
.pause-best b { font-size: 17px; font-weight: 900; color: var(--orange-deep); line-height: 1; padding: 0 1px; }

.primary-btn {
  width: 100%; height: 50px; border: 0; border-radius: 16px;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  color: #fff; font-family: var(--font); font-size: 17px; font-weight: 900; letter-spacing: .1em;
  background: linear-gradient(180deg, #FFB05A, #FF7A2F 55%, #F26A1B);
  box-shadow: 0 7px 0 #C95012, 0 12px 22px rgba(190, 80, 20, .32), inset 0 2px 0 rgba(255, 255, 255, .5);
  cursor: pointer; transition: transform .1s ease, filter .15s ease;
}
.primary-btn .mp-icon { width: 20px; height: 20px; }
.primary-btn:active { transform: translateY(3px); box-shadow: 0 4px 0 #C95012, 0 8px 16px rgba(190, 80, 20, .3); }
.ghost-btn {
  margin-top: 6px; width: 100%; height: 34px;
  border: 0; background: transparent; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  color: #9B8169; font-family: var(--font); font-size: 12.5px; font-weight: 700; letter-spacing: .06em;
}
.ghost-btn .mp-icon { width: 15px; height: 15px; }
.ghost-btn:active { color: #6E5541; }
.ghost-btn.subtle { height: 26px; margin-top: 0; font-size: 11px; color: #B09A85; }

/* ============ 闪光 ============ */
.flash {
  position: absolute; inset: 0; z-index: 40;
  pointer-events: none; opacity: 0;
  background: radial-gradient(circle at 55% 45%, #FFFDF2 0%, rgba(255, 242, 205, .9) 35%, rgba(255, 230, 180, 0) 72%);
  mix-blend-mode: screen;
}
.flash.on { animation: flashOut .55s ease-out forwards; }
@keyframes flashOut {
  0% { opacity: .9; }
  100% { opacity: 0; }
}

/* ============ 小屏适配 ============ */
@media (max-height: 700px) {
  .hud-btn { width: 42px; height: 42px; border-radius: 14px; }
  .hud-btn .mp-icon { width: 22px; height: 22px; }
  .score-cap { height: 42px; }
  .coin { width: 31px; height: 31px; }
  .coin-num { font-size: 22px; }
  .dock { padding: 9px 12px 8px; }
  .dock-top { margin-bottom: 6px; }
  .track { height: 16px; }
  .dock-foot { margin-top: 7px; }
  .intro-hint { height: 38px; font-size: 12px; bottom: calc(11px + var(--safe-b)); }
}
@media (max-height: 620px) {
  .app.playing .best-tag { display: none; }
  .sheet { padding-top: 23px; }
  .howto { margin: 11px 0 9px; padding: 9px 11px; }
  .howto li { padding: 3px 0; }
  .pause-best { margin-bottom: 10px; }
}
@media (min-width: 560px) {
  .topbar { padding-left: 20px; padding-right: 20px; }
  .dock { left: 18px; right: 18px; }
}
