/* 云端跳跳乐8 — 竖屏卡通云上跳跃 */
:root {
  --orange: #FF8A3D;
  --orange-deep: #E9631B;
  --orange-soft: #FFB26E;
  --cream: #FFF8EC;
  --cream-deep: #FFE9CC;
  --ink: #26364D;
  --ink-soft: #667A93;
  --sky: #58B9EA;
  --gold: #FFC94D;
  --teal: #39B8C8;
  --card-shadow: 0 24px 60px rgba(21, 61, 101, .30);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: #58B9EA;
  color: var(--ink);
  font-family: var(--font);
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

body { touch-action: none; }

.game {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  background: linear-gradient(180deg, #5FBDF0 0%, #A9E0FB 55%, #FFF1D8 100%);
}

.game::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  background: radial-gradient(125% 82% at 50% 40%, rgba(20, 66, 105, 0) 56%, rgba(20, 66, 105, .13) 100%);
}

#world {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

/* ---------- 顶部计分 ---------- */
.hud {
  position: absolute;
  z-index: 20;
  top: calc(env(safe-area-inset-top, 0px) + 14px);
  left: 16px;
  right: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity .3s ease, transform .3s ease;
}

body[data-phase="play"] .hud {
  opacity: 1;
  transform: translateY(0);
}

.hud-pill {
  display: inline-flex;
  align-items: center;
  height: 42px;
  padding: 0 14px 0 8px;
  border-radius: 999px;
  background: rgba(255, 253, 247, .78);
  border: 1px solid rgba(255, 255, 255, .9);
  box-shadow: 0 6px 18px rgba(28, 83, 129, .16), inset 0 1px 0 rgba(255, 255, 255, .9);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
  backdrop-filter: blur(12px) saturate(1.2);
}

.hud-score { gap: 8px; }

.hud-ico {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(160deg, var(--orange-soft), var(--orange));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .55);
}

.hud-ico .mp-icon { width: 17px; height: 17px; }

.hud-num {
  display: inline-block;
  min-width: 20px;
  font-size: 20px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: -.01em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  text-align: left;
}

.hud-unit {
  margin-top: 2px;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-soft);
}

.hud-best {
  gap: 6px;
  padding: 0 13px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
}

.hud-best .mp-icon { width: 17px; height: 17px; color: var(--orange); }
.hud-best span { font-size: 14px; color: var(--ink); font-weight: 800; font-variant-numeric: tabular-nums; }

.hud-num.pop { animation: scorePop .34s cubic-bezier(.2, .9, .3, 1.4); }

@keyframes scorePop {
  0% { transform: scale(1); }
  40% { transform: scale(1.32); color: var(--orange-deep); }
  100% { transform: scale(1); }
}

/* ---------- 操作提示 ---------- */
.hint {
  position: absolute;
  z-index: 15;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 28px);
  transform: translate(-50%, 10px);
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px 9px 12px;
  border-radius: 999px;
  background: rgba(27, 62, 95, .36);
  border: 1px solid rgba(255, 255, 255, .28);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .01em;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity .35s ease, transform .35s ease, visibility .35s;
  white-space: nowrap;
}

.hint .mp-icon { width: 18px; height: 18px; opacity: .95; }

body[data-phase="play"] .hint.show {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

/* ---------- 通用屏幕层 ---------- */
.screen {
  position: absolute;
  inset: 0;
  z-index: 25;
  display: flex;
  flex-direction: column;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity .32s ease, visibility .32s;
}

.screen.show { opacity: 1; visibility: visible; }
.screen.show .btn { pointer-events: auto; }

/* ---------- 开始界面 ---------- */
.start {
  align-items: center;
  justify-content: space-between;
  padding: calc(env(safe-area-inset-top, 0px) + 26px) 20px calc(env(safe-area-inset-bottom, 0px) + 26px);
}

.start-veil {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(120% 52% at 50% 0%, rgba(37, 108, 163, .30) 0%, rgba(37, 108, 163, 0) 72%),
    linear-gradient(180deg, rgba(36, 112, 170, .20) 0%, rgba(36, 112, 170, 0) 38%),
    linear-gradient(0deg, rgba(43, 96, 137, .16) 0%, rgba(43, 96, 137, 0) 32%);
}

.brand {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 420px;
  padding-top: 6px;
  animation: brandIn .7s cubic-bezier(.16, .84, .32, 1) both;
}

@keyframes brandIn {
  from { opacity: 0; transform: translateY(-14px); }
  to { opacity: 1; transform: translateY(0); }
}

.brand-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 13px 0 9px;
  border-radius: 999px;
  color: #2E5878;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .12em;
  background: rgba(255, 250, 240, .82);
  border: 1px solid rgba(255, 255, 255, .85);
  box-shadow: 0 5px 16px rgba(26, 80, 127, .18);
}

.brand-tag .mp-icon { width: 17px; height: 17px; color: var(--orange); }
.brand-tag span { transform: translateY(.5px); }

.logo {
  margin: 14px 0 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: .94;
  font-weight: 900;
  letter-spacing: .02em;
  filter: drop-shadow(0 12px 18px rgba(20, 71, 115, .22));
}

.logo-top {
  display: block;
  font-size: clamp(42px, 12.6vw, 56px);
  color: #FFFDF6;
  text-shadow:
    0 3px 0 #8CC7E8,
    0 7px 0 rgba(46, 105, 150, .22),
    0 13px 22px rgba(20, 71, 115, .22);
  transform: rotate(-1.5deg);
}

.logo-main {
  display: flex;
  align-items: flex-start;
  gap: 2px;
  margin-top: 2px;
  font-size: clamp(54px, 16.4vw, 72px);
  color: #FFD160;
  letter-spacing: .01em;
  transform: rotate(-1deg);
  text-shadow:
    0 4px 0 #F07A2B,
    0 8px 0 #C95817,
    0 12px 0 rgba(150, 62, 16, .22),
    0 20px 28px rgba(20, 71, 115, .28);
}

.logo-edition {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  margin: 2px 0 0 5px;
  border-radius: 9px;
  font-size: 15px;
  font-weight: 900;
  color: #fff;
  background: linear-gradient(160deg, #FFA566, #F06C21);
  border: 2px solid rgba(255, 255, 255, .72);
  box-shadow: 0 4px 0 rgba(176, 72, 18, .55), 0 8px 14px rgba(20, 71, 115, .2);
  text-shadow: none;
  transform: rotate(7deg);
}

.tagline {
  margin: 16px 0 0;
  max-width: 300px;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.55;
  text-align: center;
  letter-spacing: .04em;
  text-shadow: 0 2px 8px rgba(27, 77, 116, .55);
}

.start-bottom {
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 14px;
  animation: bottomIn .8s .12s cubic-bezier(.16, .84, .32, 1) both;
}

@keyframes bottomIn {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- 按钮 ---------- */
.btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 60px;
  padding: 0 24px;
  border: 0;
  border-radius: 999px;
  font-family: inherit;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: .08em;
  color: #fff;
  background: linear-gradient(180deg, #FFAE68 0%, #FF8A3D 45%, #F4731F 100%);
  box-shadow:
    0 6px 0 #D55812,
    0 16px 28px rgba(198, 79, 16, .36),
    inset 0 2px 0 rgba(255, 255, 255, .5),
    inset 0 -2px 0 rgba(153, 58, 10, .18);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: transform .1s ease, box-shadow .1s ease, filter .18s ease;
}

.btn::after {
  content: "";
  position: absolute;
  inset: 3px 3px 46%;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .34), rgba(255, 255, 255, 0));
  pointer-events: none;
}

.btn-ico {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: #fff;
  background: rgba(255, 255, 255, .22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .28);
  flex: 0 0 auto;
}

.btn-ico .mp-icon { width: 21px; height: 21px; }
.btn-label { position: relative; z-index: 1; transform: translateY(1px); }

.btn:active {
  transform: translateY(4px) scale(.995);
  box-shadow:
    0 2px 0 #D55812,
    0 7px 14px rgba(198, 79, 16, .28),
    inset 0 2px 0 rgba(255, 255, 255, .38);
  filter: brightness(.99);
}

.btn:focus-visible {
  outline: 3px solid rgba(255, 255, 255, .85);
  outline-offset: 3px;
}

.start-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  color: #fff;
  font-size: 12.5px;
  font-weight: 600;
  text-shadow: 0 1px 6px rgba(24, 74, 112, .45);
}

.meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .18);
  border: 1px solid rgba(255, 255, 255, .32);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.meta-chip b { font-size: 13.5px; font-weight: 800; color: #FFF3B8; }
.meta-chip .mp-icon { width: 15px; height: 15px; color: #FFE18A; }
.meta-sep { width: 1px; height: 14px; background: rgba(255, 255, 255, .34); }

/* ---------- 结算界面 ---------- */
.over {
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(19, 52, 84, .34);
  -webkit-backdrop-filter: blur(6px) saturate(1.05);
  backdrop-filter: blur(6px) saturate(1.05);
}

.over.show { pointer-events: auto; }

.over-card {
  position: relative;
  width: min(88vw, 352px);
  margin-top: 22px;
  padding: 34px 22px 20px;
  border-radius: 30px;
  background:
    radial-gradient(110% 55% at 50% 0%, #FFFDF8 0%, rgba(255, 253, 248, 0) 70%),
    linear-gradient(180deg, #FFFDF7 0%, #FFF5E4 100%);
  border: 1px solid rgba(255, 255, 255, .9);
  box-shadow:
    var(--card-shadow),
    inset 0 1px 0 #fff,
    inset 0 -4px 0 rgba(235, 180, 122, .18);
  text-align: center;
  transform: translateY(24px) scale(.96);
  opacity: 0;
  transition: transform .38s cubic-bezier(.18, .9, .32, 1.15), opacity .3s ease;
}

.over.show .over-card { transform: translateY(0) scale(1); opacity: 1; }

.over-badge {
  position: absolute;
  top: -30px;
  left: 50%;
  width: 64px;
  height: 64px;
  margin-left: -32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(165deg, #FFB173 0%, #FF8A3D 58%, #F07122 100%);
  border: 4px solid #FFF9EE;
  box-shadow: 0 9px 20px rgba(196, 82, 23, .30), inset 0 2px 0 rgba(255, 255, 255, .4);
}

.over-badge .mp-icon { width: 31px; height: 31px; }

.over-kicker {
  margin: 6px 0 0;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .18em;
  color: #9A8C79;
}

.over-score {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 5px;
  margin-top: 2px;
  color: var(--ink);
}

.over-score span {
  font-size: 64px;
  line-height: 1.1;
  font-weight: 900;
  letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, #46566D 0%, #26364D 78%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.over-score small {
  font-size: 16px;
  font-weight: 800;
  color: var(--orange);
  transform: translateY(-2px);
}

.over-sub {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin-top: 2px;
  color: #8B8172;
  font-size: 12.5px;
  font-weight: 600;
}

.over-sub b { color: var(--ink); font-weight: 800; }
.dot { width: 3px; height: 3px; border-radius: 50%; background: #C9BBA7; }

.new-best {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 12px;
  padding: 6px 12px;
  border-radius: 999px;
  color: #A45A0E;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .04em;
  background: linear-gradient(180deg, #FFF0BE, #FFDF8B);
  border: 1px solid rgba(255, 255, 255, .8);
  box-shadow: 0 4px 10px rgba(213, 145, 36, .22);
  animation: bestGlow 2.2s ease-in-out infinite;
}

.new-best[hidden] { display: none; }
.new-best .mp-icon { width: 14px; height: 14px; color: #E99A21; }

@keyframes bestGlow {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}

.over-card .btn {
  height: 56px;
  margin-top: 18px;
  font-size: 18px;
}

.over-hint {
  margin: 12px 0 2px;
  font-size: 11.5px;
  font-weight: 500;
  color: #A99D8C;
  letter-spacing: .02em;
}

/* ---------- 小屏适配 ---------- */
@media (max-height: 700px) {
  .start { padding-top: calc(env(safe-area-inset-top, 0px) + 18px); padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 18px); }
  .logo { margin-top: 10px; }
  .logo-top { font-size: 38px; }
  .logo-main { font-size: 52px; }
  .tagline { margin-top: 11px; font-size: 13px; }
  .btn { height: 56px; font-size: 18px; }
  .start-bottom { gap: 11px; }
  .over-card { padding-top: 30px; }
  .over-score span { font-size: 56px; }
}

@media (max-height: 600px) {
  .logo-top { font-size: 32px; }
  .logo-main { font-size: 44px; }
  .tagline { display: none; }
  .over-badge { width: 56px; height: 56px; margin-left: -28px; top: -26px; }
  .over-badge .mp-icon { width: 27px; height: 27px; }
}

@media (min-width: 700px) {
  .brand { max-width: 440px; }
  .start-bottom { max-width: 380px; }
}

@media (prefers-reduced-motion: reduce) {
  .brand, .start-bottom, .new-best { animation: none; }
  .screen, .over-card, .hud { transition-duration: .01ms; }
}
