/* 蹦一蹦 — 竖屏卡通跳跃游戏 · 成品界面样式 */
:root {
  --orange: #FF8A3D;
  --orange-light: #FFB15D;
  --orange-deep: #E96A18;
  --orange-dark: #C9550E;
  --cream: #FFF9EE;
  --cream-2: #FFF3DF;
  --ink: #4A2E1B;
  --ink-soft: #7B5940;
  --muted: #9C7C60;
  --teal: #46C2AE;
  --gold: #F5A623;
  --shadow-warm: rgba(108, 62, 22, .2);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: #F6EAD4;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
button { font-family: inherit; -webkit-tap-highlight-color: transparent; }
button:focus-visible { outline: 3px solid rgba(255, 138, 61, .55); outline-offset: 3px; }

.stage {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  max-width: 560px;
  margin: 0 auto;
  overflow: hidden;
  background: linear-gradient(180deg, #FFE2BC 0%, #E8F6EA 52%, #BDEDE8 100%);
  touch-action: none;
  isolation: isolate;
}
@media (min-width: 561px) {
  .stage { box-shadow: 0 0 90px rgba(60, 90, 70, .26); }
}

canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.vignette {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  background:
    radial-gradient(130% 92% at 50% 38%, rgba(255, 255, 255, 0) 56%, rgba(112, 62, 20, .14) 100%),
    linear-gradient(180deg, rgba(255, 240, 214, .26) 0%, rgba(255, 240, 214, 0) 18%);
}

/* ---------- HUD ---------- */
.hud {
  position: absolute;
  z-index: 20;
  top: calc(env(safe-area-inset-top, 0px) + 12px);
  left: 16px;
  right: 16px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity .3s ease, transform .3s ease;
}
.stage.playing .hud { opacity: 1; transform: none; }

.score-card {
  min-width: 94px;
  padding: 7px 15px 8px;
  border-radius: 19px;
  background: linear-gradient(180deg, rgba(255, 253, 247, .93), rgba(255, 245, 229, .86));
  border: 1.5px solid rgba(255, 255, 255, .98);
  box-shadow: 0 7px 18px rgba(54, 96, 77, .14), inset 0 1px 0 #fff;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.score-label {
  display: block;
  font-size: 9.5px;
  font-weight: 900;
  letter-spacing: .22em;
  color: #A9855F;
}
#score {
  display: block;
  margin: 1px 0 0;
  font-size: 31px;
  line-height: 1;
  font-weight: 900;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  transform-origin: 24% 72%;
}
#score.bump { animation: scoreBump .24s cubic-bezier(.2, .9, .3, 1.4); }
.score-best {
  display: block;
  margin-top: 3px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .04em;
  color: #A9855F;
}
.score-best b { color: var(--orange-deep); font-weight: 900; }

.hud-right {
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.chip {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 7px 11px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 253, 247, .92), rgba(255, 245, 229, .86));
  border: 1.5px solid rgba(255, 255, 255, .98);
  box-shadow: 0 6px 15px rgba(54, 96, 77, .13), inset 0 1px 0 #fff;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  font-size: 12px;
  font-weight: 800;
  color: #8A6B51;
}
.chip .mp-icon { width: 17px; height: 17px; color: var(--gold); }
.chip b { font-size: 15px; font-weight: 900; color: var(--ink); font-variant-numeric: tabular-nums; }

.sound {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, .98);
  background: linear-gradient(180deg, rgba(255, 253, 247, .92), rgba(255, 245, 229, .86));
  color: #86603F;
  box-shadow: 0 6px 15px rgba(54, 96, 77, .14), inset 0 1px 0 #fff;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  pointer-events: auto;
  cursor: pointer;
  transition: transform .12s ease;
}
.sound:active { transform: scale(.9); }
.sound .mp-icon { width: 20px; height: 20px; }

/* ---------- 蓄力条 ---------- */
.charge {
  position: absolute;
  z-index: 22;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 68px);
  width: min(66%, 300px);
  transform: translate(-50%, 12px) scale(.96);
  opacity: 0;
  pointer-events: none;
  transition: opacity .16s ease, transform .18s cubic-bezier(.2, .9, .3, 1.2);
}
.stage.charging .charge { opacity: 1; transform: translate(-50%, 0) scale(1); }
.charge-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 0 6px 6px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .16em;
  color: #FFF9EE;
  text-shadow: 0 1px 4px rgba(90, 50, 20, .55);
}
#chargePct { font-size: 13px; letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.charge-track {
  position: relative;
  height: 14px;
  border-radius: 999px;
  background: rgba(255, 252, 243, .58);
  border: 1.5px solid rgba(255, 255, 255, .95);
  box-shadow: inset 0 2px 4px rgba(80, 50, 20, .16), 0 7px 18px rgba(80, 50, 20, .2);
  overflow: hidden;
}
.charge-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #FFD76E 0%, #FFB24A 42%, #FF8A3D 72%, #FF6420 100%);
  box-shadow: 0 0 14px rgba(255, 140, 61, .9);
  transition: width .04s linear;
}
.charge.full .charge-fill { animation: chargePulse .5s ease-in-out infinite; }
.charge-tick {
  position: absolute;
  top: 2px;
  bottom: 2px;
  width: 1.5px;
  border-radius: 2px;
  background: rgba(122, 74, 30, .18);
}

/* ---------- 操作提示 ---------- */
.hint {
  position: absolute;
  z-index: 21;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 18px);
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 15px 8px 12px;
  border-radius: 999px;
  background: rgba(74, 46, 27, .34);
  border: 1px solid rgba(255, 255, 255, .22);
  color: #FFF9EE;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .03em;
  white-space: nowrap;
  pointer-events: none;
  -webkit-backdrop-filter: blur(9px);
  backdrop-filter: blur(9px);
  transform: translateX(-50%);
  opacity: 0;
  transition: opacity .35s ease, transform .35s ease;
}
.stage.playing .hint { opacity: 1; }
.hint.hide { opacity: 0 !important; transform: translate(-50%, 8px); }
.hint .mp-icon { width: 17px; height: 17px; color: #FFDDAA; }

/* ---------- 开始页 ---------- */
.overlay {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
}
.overlay[hidden] { display: none !important; }

.overlay-start {
  justify-content: space-between;
  padding: calc(env(safe-area-inset-top, 0px) + 24px) 16px calc(env(safe-area-inset-bottom, 0px) + 14px);
  background:
    linear-gradient(180deg, rgba(255, 238, 208, .48) 0%, rgba(255, 238, 208, 0) 26%),
    linear-gradient(180deg, rgba(255, 247, 232, 0) 46%, rgba(255, 244, 225, .72) 66%, rgba(255, 241, 218, .94) 100%);
}

.start-top {
  text-align: center;
  animation: brandIn .6s cubic-bezier(.2, .8, .3, 1) both;
}
.brand-kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 13px;
  border-radius: 999px;
  background: rgba(255, 253, 247, .72);
  border: 1px solid rgba(255, 255, 255, .95);
  box-shadow: 0 4px 12px rgba(110, 70, 30, .12);
  color: #7D5A3A;
  font-size: 10.5px;
  font-weight: 900;
  letter-spacing: .12em;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.brand-kicker .mp-icon { width: 15px; height: 15px; color: #F08A3C; }

.logo {
  position: relative;
  display: inline-block;
  margin: 12px 0 0;
  font-size: clamp(56px, 17vw, 76px);
  line-height: 1;
  font-weight: 900;
  letter-spacing: .06em;
  color: var(--orange);
  -webkit-text-stroke: 5px #FFF9EE;
  paint-order: stroke fill;
  text-shadow: 0 5px 0 #E06A1B, 0 6px 0 #E06A1B, 0 15px 24px rgba(198, 95, 30, .32);
  transform: rotate(-2.5deg);
  filter: drop-shadow(0 2px 0 rgba(255, 255, 255, .7));
}
.logo-text { position: relative; z-index: 1; display: inline-block; }
.logo .logo-spark {
  position: absolute;
  z-index: 0;
  width: 22px;
  height: 22px;
  color: #FFD46A;
  filter: drop-shadow(0 1px 2px rgba(170, 100, 20, .35));
  animation: twinkle 2.2s ease-in-out infinite;
}
.logo .spark-a { top: -12px; right: -24px; width: 26px; height: 26px; }
.logo .spark-b { bottom: 0; left: -26px; width: 17px; height: 17px; animation-delay: .9s; }

.tagline {
  margin: 11px 0 0;
  font-size: 12.5px;
  font-weight: 900;
  letter-spacing: .2em;
  color: #6B4A30;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .9), 0 4px 10px rgba(255, 250, 240, .6);
}

.start-bottom { animation: panelUp .6s cubic-bezier(.16, .9, .3, 1.08) .08s both; }
.start-panel {
  width: 100%;
  max-width: 372px;
  margin: 0 auto;
  padding: 16px 15px 13px;
  border-radius: 30px;
  background: linear-gradient(180deg, rgba(255, 253, 247, .97) 0%, rgba(255, 246, 231, .97) 100%);
  border: 2px solid rgba(255, 255, 255, .99);
  box-shadow: 0 26px 54px rgba(92, 62, 28, .24), inset 0 1px 0 #FFF, inset 0 -2px 0 rgba(233, 190, 132, .25);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}
.best-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: max-content;
  margin: -31px auto 12px;
  padding: 6px 15px;
  border-radius: 999px;
  background: linear-gradient(180deg, #FFF6E4, #FFE9C4);
  border: 1.5px solid #FFFDF7;
  box-shadow: 0 5px 14px rgba(190, 120, 40, .2), inset 0 1px 0 #FFF;
  color: #96704A;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .06em;
  white-space: nowrap;
}
.best-pill .mp-icon { width: 15px; height: 15px; color: var(--gold); }
.best-pill b { color: var(--orange-deep); font-size: 14px; font-weight: 900; font-variant-numeric: tabular-nums; }

.rule-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.rule {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 0;
  padding: 9px 3px 8px;
  border-radius: 17px;
  background: linear-gradient(180deg, #FFFCF6, #FFF5E6);
  border: 1px solid #F7E7D1;
  box-shadow: inset 0 1px 0 #FFF, 0 3px 8px rgba(150, 110, 60, .06);
  text-align: center;
}
.rule-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  margin-bottom: 2px;
  border-radius: 11px;
  background: linear-gradient(160deg, #FFF0D9, #FFDDBA);
  border: 1px solid #FFE7CC;
  color: #F07A24;
  box-shadow: inset 0 1px 0 #FFF8EC;
}
.rule-icon .mp-icon { width: 18px; height: 18px; }
.rule b { font-size: 12px; font-weight: 900; color: var(--ink); white-space: nowrap; }
.rule small { font-size: 9.5px; font-weight: 600; color: #A08266; white-space: nowrap; }

.btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  height: 55px;
  border: none;
  border-radius: 19px;
  font-size: 17.5px;
  font-weight: 900;
  letter-spacing: .08em;
  color: #fff;
  cursor: pointer;
  overflow: hidden;
  transition: transform .12s ease, box-shadow .12s ease;
}
.btn .mp-icon { width: 24px; height: 24px; }
.btn-primary {
  margin-top: 13px;
  background: linear-gradient(180deg, #FFB15D 0%, #FF8A3D 52%, #FB7623 100%);
  box-shadow: 0 6px 0 var(--orange-dark), 0 15px 26px rgba(255, 122, 31, .38), inset 0 1px 0 rgba(255, 255, 255, .5);
  text-shadow: 0 1px 2px rgba(150, 60, 10, .3);
}
.btn-primary::after {
  content: "";
  position: absolute;
  top: -30%;
  left: -40%;
  width: 42%;
  height: 170%;
  background: linear-gradient(100deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, .38), rgba(255, 255, 255, 0));
  transform: rotate(14deg);
  animation: btnShine 3.6s ease-in-out infinite;
  pointer-events: none;
}
.btn-primary:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 var(--orange-dark), 0 7px 13px rgba(255, 122, 31, .32), inset 0 1px 0 rgba(255, 255, 255, .4);
}
.start-foot {
  margin: 9px 0 0;
  text-align: center;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .08em;
  color: #A98D71;
}

/* ---------- 结算 ---------- */
.overlay-over {
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(66, 43, 25, .45);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  animation: fadeIn .26s ease both;
}
.over-card {
  position: relative;
  width: 100%;
  max-width: 344px;
  padding: 26px 20px 13px;
  border-radius: 30px;
  background: linear-gradient(180deg, #FFFDF7, #FFF3DF);
  border: 2px solid #FFF;
  box-shadow: 0 28px 64px rgba(40, 24, 12, .38), inset 0 1px 0 #FFF;
  text-align: center;
  animation: popIn .44s cubic-bezier(.2, .9, .3, 1.15) both;
}
.new-best {
  position: absolute;
  top: -15px;
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  border-radius: 999px;
  background: linear-gradient(180deg, #FFB15D, #FF7B23);
  border: 2px solid #FFF7E9;
  box-shadow: 0 5px 13px rgba(255, 122, 31, .42);
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .1em;
  white-space: nowrap;
}
.new-best .mp-icon { width: 15px; height: 15px; }
.new-best[hidden] { display: none; }

.over-kicker {
  margin: 2px 0 0;
  font-size: 9.5px;
  font-weight: 900;
  letter-spacing: .26em;
  color: #B39476;
}
.over-card h2 {
  margin: 6px 0 0;
  font-size: 24px;
  font-weight: 900;
  letter-spacing: .05em;
  color: var(--ink);
}
.final-score {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
  margin: 5px 0 13px;
  color: #FF7A23;
  text-shadow: 0 4px 0 rgba(224, 106, 27, .15);
}
.final-score span {
  font-size: 60px;
  line-height: 1;
  font-weight: 900;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
  animation: scorePop .5s cubic-bezier(.2, .9, .3, 1.3) .12s both;
}
.final-score small { font-size: 16px; font-weight: 900; color: #C58B5E; }

.over-stats {
  display: flex;
  padding: 10px 4px;
  border-radius: 19px;
  background: #FFF8EC;
  border: 1px solid #F7E7D2;
}
.over-stats > div {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.over-stats > div + div { border-left: 1px solid #F0E1CE; }
.over-stats span { font-size: 9.5px; font-weight: 700; color: #A08266; letter-spacing: .05em; }
.over-stats b { font-size: 19px; font-weight: 900; color: var(--ink); font-variant-numeric: tabular-nums; }

.over-card .btn-primary { margin-top: 15px; height: 52px; }
.link-btn {
  margin-top: 5px;
  padding: 9px 16px;
  border: none;
  background: transparent;
  color: #A08266;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  cursor: pointer;
  border-radius: 10px;
}
.link-btn:active { color: var(--orange-deep); }

/* ---------- 小屏适配 ---------- */
@media (max-height: 720px) {
  .overlay-start { padding-top: calc(env(safe-area-inset-top, 0px) + 16px); }
  .logo { font-size: clamp(50px, 15vw, 66px); margin-top: 8px; }
  .tagline { margin-top: 8px; font-size: 11.5px; }
  .start-panel { padding: 13px 13px 11px; border-radius: 26px; }
  .rule { padding: 7px 3px 7px; }
  .rule-icon { width: 29px; height: 29px; border-radius: 10px; }
  .rule b { font-size: 11.5px; }
  .btn { height: 51px; }
  .start-foot { margin-top: 7px; }
}
@media (max-height: 640px) {
  .brand-kicker { display: none; }
  .logo { font-size: 46px; margin-top: 0; }
  .tagline { font-size: 10.5px; letter-spacing: .14em; }
  .best-pill { margin-bottom: 9px; }
  .rule small { display: none; }
  .rule { padding: 6px 3px; }
  .rule b { font-size: 11px; }
  .rule-icon { margin-bottom: 0; }
  .start-panel { padding: 11px 12px 10px; }
  .over-card { padding-top: 21px; }
  .final-score span { font-size: 50px; }
}

/* ---------- 动效 ---------- */
@keyframes scoreBump {
  0% { transform: scale(1); }
  38% { transform: scale(1.3); }
  100% { transform: scale(1); }
}
@keyframes scorePop {
  from { opacity: 0; transform: scale(.6); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes twinkle {
  0%, 100% { transform: scale(.85) rotate(-8deg); opacity: .75; }
  50% { transform: scale(1.16) rotate(6deg); opacity: 1; }
}
@keyframes brandIn {
  from { opacity: 0; transform: translateY(-14px); }
  to { opacity: 1; transform: none; }
}
@keyframes panelUp {
  from { opacity: 0; transform: translateY(36px) scale(.97); }
  to { opacity: 1; transform: none; }
}
@keyframes popIn {
  from { opacity: 0; transform: translateY(20px) scale(.94); }
  to { opacity: 1; transform: none; }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes chargePulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.25); }
}
@keyframes btnShine {
  0%, 58% { left: -46%; }
  78%, 100% { left: 118%; }
}

@media (prefers-reduced-motion: reduce) {
  .logo-spark, .btn-primary::after, .final-score span { animation: none !important; }
  .start-top, .start-bottom, .over-card, .overlay-over { animation: none !important; }
}
