/* 云端跳跳乐 · 王者云巅
   竖屏铺满、无标题栏，所有玩法画面由 canvas 绘制。 */

:root {
  --orange: #FF8A3D;
  --orange-deep: #F2661B;
  --orange-dark: #C34F12;
  --gold: #FFD66B;
  --gold-deep: #E8AC3B;
  --cream: #FFF7E8;
  --ink: #173B5C;
  --ink-soft: #4E6B7E;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #2A8FA8;
  overscroll-behavior: none;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans SC", sans-serif;
  color: var(--ink);
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

.stage {
  position: fixed;
  inset: 0;
  overflow: hidden;
}

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

/* ---------- 顶部 HUD（不是标题栏，只有分数） ---------- */
.hud {
  position: absolute;
  z-index: 6;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 8px;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) 16px 0;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.hud.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.score-pill,
.best-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #FFF9ED;
  background: rgba(16, 51, 75, 0.34);
  border: 1px solid rgba(255, 255, 255, 0.42);
  box-shadow: 0 6px 18px rgba(8, 38, 58, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.28);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-radius: 999px;
  text-shadow: 0 1px 3px rgba(8, 32, 50, 0.35);
}

.score-pill {
  padding: 6px 15px 7px 12px;
}

.score-pill .mp-icon {
  width: 18px;
  height: 18px;
  color: var(--gold);
}

.score-num {
  display: inline-block;
  min-width: 18px;
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.score-num.bump {
  animation: scoreBump 0.32s cubic-bezier(0.2, 1.7, 0.45, 1);
}

.score-unit {
  font-size: 11px;
  font-weight: 700;
  opacity: 0.82;
  margin-top: 3px;
}

.best-pill {
  padding: 6px 12px 6px 10px;
  font-size: 12px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  gap: 4px;
  opacity: 0.92;
}

.best-pill .mp-icon {
  width: 15px;
  height: 15px;
  color: var(--gold);
}

@keyframes scoreBump {
  0% { transform: scale(1); }
  45% { transform: scale(1.38); }
  100% { transform: scale(1); }
}

/* ---------- 操作提示 ---------- */
.hint {
  position: absolute;
  z-index: 7;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 26px);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 17px 9px 13px;
  border-radius: 999px;
  color: #FFF8E9;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  white-space: nowrap;
  background: rgba(14, 48, 70, 0.42);
  border: 1px solid rgba(255, 255, 255, 0.28);
  box-shadow: 0 10px 24px rgba(8, 38, 58, 0.22);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  text-shadow: 0 1px 3px rgba(8, 32, 50, 0.4);
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, 10px);
  transition: opacity 0.35s ease, transform 0.35s ease, visibility 0.35s;
  pointer-events: none;
}

.hint.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
  animation: hintBob 2.6s ease-in-out infinite;
}

.hint .mp-icon {
  width: 17px;
  height: 17px;
  color: var(--gold);
}

@keyframes hintBob {
  0%, 100% { transform: translate(-50%, 0); }
  50% { transform: translate(-50%, -5px); }
}

/* ---------- 弹层 ---------- */
.overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(env(safe-area-inset-top, 0px) + 24px) 20px calc(env(safe-area-inset-bottom, 0px) + 24px);
  background:
    radial-gradient(120% 72% at 50% 44%, rgba(12, 52, 76, 0.04) 0%, rgba(9, 40, 60, 0.18) 62%, rgba(6, 31, 48, 0.5) 100%);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.32s ease, visibility 0.32s;
}

.overlay.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.start-panel,
.over-panel {
  position: relative;
  width: min(86vw, 350px);
  text-align: center;
  border-radius: 30px;
  border: 1.5px solid rgba(255, 226, 168, 0.95);
  background:
    radial-gradient(130% 90% at 12% -12%, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0) 42%),
    linear-gradient(166deg, #FFFCf4 0%, #FFF2DC 56%, #FFE4BE 100%);
  box-shadow:
    0 0 0 4px rgba(255, 211, 128, 0.24),
    0 30px 64px rgba(7, 38, 58, 0.36),
    inset 0 1px 0 #FFFFFF;
  opacity: 0;
  transform: translateY(18px) scale(0.94);
  transition: transform 0.44s cubic-bezier(0.2, 1.2, 0.34, 1), opacity 0.32s ease;
  overflow: hidden;
}

.overlay.is-visible .start-panel,
.overlay.is-visible .over-panel {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.start-panel {
  padding: 26px 22px 21px;
}

.start-panel::before {
  content: "";
  position: absolute;
  left: -18%;
  right: -18%;
  top: -74px;
  height: 150px;
  background:
    radial-gradient(46% 58% at 24% 68%, rgba(255, 255, 255, 0.85) 0%, rgba(255, 255, 255, 0) 72%),
    radial-gradient(42% 52% at 76% 74%, rgba(255, 255, 255, 0.7) 0%, rgba(255, 255, 255, 0) 72%);
  pointer-events: none;
}

/* 王者印记 */
.seal {
  position: relative;
  width: 56px;
  height: 56px;
  margin: 0 auto 11px;
  filter: drop-shadow(0 7px 10px rgba(190, 80, 20, 0.3));
}

.seal::before {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 15px;
  transform: rotate(45deg);
  background: linear-gradient(148deg, #FFB45F 0%, #FF8A3D 42%, #F15F18 100%);
  border: 2px solid #FFE4AC;
  box-shadow:
    inset 0 2px 5px rgba(255, 255, 255, 0.48),
    inset 0 -4px 8px rgba(174, 60, 8, 0.24);
}

.seal::after {
  content: "";
  position: absolute;
  inset: 12px;
  border-radius: 9px;
  transform: rotate(45deg);
  border: 1px solid rgba(255, 246, 214, 0.55);
}

.seal span {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: #FFF7DF;
  font-size: 25px;
  font-weight: 900;
  text-shadow: 0 2px 0 rgba(143, 49, 6, 0.35);
  font-family: "STKaiti", "KaiTi", "PingFang SC", serif;
}

.eyebrow {
  position: relative;
  margin: 0 0 5px;
  color: #B17237;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.3em;
  text-indent: 0.3em;
}

.logo {
  position: relative;
  margin: 0;
  color: var(--ink);
  font-size: clamp(31px, 9.8vw, 41px);
  font-weight: 900;
  line-height: 1.12;
  letter-spacing: 0.005em;
  white-space: nowrap;
  text-shadow: 0 2px 0 #FFFFFF, 0 5px 12px rgba(137, 86, 40, 0.12);
}

.logo em {
  font-style: normal;
  background: linear-gradient(180deg, #FFA24E 0%, #FF7A2E 46%, #E9510F 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: var(--orange-deep);
  filter: drop-shadow(0 2px 0 rgba(255, 255, 255, 0.7));
}

.tagline {
  margin: 9px 0 21px;
  color: #6E7F89;
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.13em;
}

.btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 56px;
  padding: 0 24px;
  border: 0;
  border-radius: 18px;
  font-family: inherit;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0.08em;
  cursor: pointer;
  outline: none;
  transition: transform 0.1s ease, box-shadow 0.1s ease, filter 0.1s ease;
  -webkit-appearance: none;
  appearance: none;
}

.btn .mp-icon {
  width: 23px;
  height: 23px;
}

.btn-primary {
  color: #FFFFFF;
  background: linear-gradient(180deg, #FFAB5C 0%, #FF8739 42%, #F4661A 100%);
  border: 1px solid #FFD99C;
  text-shadow: 0 2px 3px rgba(140, 50, 0, 0.34);
  box-shadow:
    0 6px 0 var(--orange-dark),
    0 13px 24px rgba(190, 70, 15, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.btn-primary:active {
  transform: translateY(5px);
  box-shadow:
    0 1px 0 var(--orange-dark),
    0 5px 10px rgba(190, 70, 15, 0.26),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
  filter: brightness(0.99);
}

.btn:focus-visible {
  outline: 3px solid rgba(23, 59, 92, 0.45);
  outline-offset: 3px;
}

.start-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin-top: 16px;
  color: #987A58;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.start-meta b {
  color: #E86A1F;
  font-size: 13px;
  font-weight: 900;
}

.dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #D9B78A;
}

/* 结束弹层 */
.over-panel {
  padding: 30px 24px 23px;
}

.over-emblem {
  position: relative;
  width: 62px;
  height: 62px;
  margin: -56px auto 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #FFF3CE;
  background: linear-gradient(155deg, #FF9A4A 0%, #F4651A 100%);
  border: 3px solid #FFF4D8;
  box-shadow: 0 9px 20px rgba(186, 68, 13, 0.32), inset 0 -4px 8px rgba(160, 54, 6, 0.18);
}

.over-emblem .mp-icon {
  width: 30px;
  height: 30px;
}

.over-eyebrow {
  margin: 6px 0 0;
  color: #B17237;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.28em;
  text-indent: 0.28em;
}

.over-score {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 5px;
  margin-top: 4px;
}

.over-score span {
  font-size: 70px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.04em;
  color: #F2661B;
  text-shadow: 0 3px 0 #FFD9A2, 0 9px 18px rgba(212, 95, 25, 0.18);
  font-variant-numeric: tabular-nums;
}

.over-score small {
  color: #9B6C44;
  font-size: 16px;
  font-weight: 800;
}

.over-best {
  margin: 8px 0 0;
  color: #8C7357;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.over-best b {
  color: #E86A1F;
  font-weight: 900;
}

.record-badge {
  display: none;
  margin: 11px auto 0;
  width: fit-content;
  padding: 5px 13px;
  border-radius: 999px;
  color: #FFF8E6;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.18em;
  text-indent: 0.18em;
  background: linear-gradient(180deg, #FFAD5D, #F36B1D);
  border: 1px solid #FFE1A8;
  box-shadow: 0 4px 10px rgba(193, 76, 16, 0.28);
}

.record-badge.is-visible {
  display: block;
  animation: badgePop 0.45s cubic-bezier(0.2, 1.7, 0.4, 1);
}

@keyframes badgePop {
  0% { transform: scale(0.6); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.over-panel .btn {
  margin-top: 19px;
}

/* 小屏适配 */
@media (max-height: 700px) {
  .overlay {
    padding-top: calc(env(safe-area-inset-top, 0px) + 16px);
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 16px);
  }
  .start-panel {
    padding: 20px 20px 17px;
  }
  .seal {
    width: 46px;
    height: 46px;
    margin-bottom: 7px;
  }
  .seal span {
    font-size: 21px;
  }
  .logo {
    font-size: clamp(28px, 9vw, 35px);
  }
  .tagline {
    margin: 7px 0 15px;
    font-size: 12px;
  }
  .btn {
    min-height: 50px;
    font-size: 17px;
    border-radius: 16px;
  }
  .start-meta {
    margin-top: 12px;
  }
  .over-panel {
    padding: 25px 21px 18px;
  }
  .over-score span {
    font-size: 57px;
  }
  .over-panel .btn {
    margin-top: 15px;
  }
  .over-emblem {
    width: 54px;
    height: 54px;
    margin-top: -47px;
  }
}

@media (max-height: 570px) {
  .seal {
    display: none;
  }
  .eyebrow {
    margin-top: 2px;
  }
  .start-panel {
    padding-top: 17px;
  }
  .overlay {
    align-items: center;
  }
}

@media (max-width: 345px) {
  .start-panel,
  .over-panel {
    width: 90vw;
    padding-left: 17px;
    padding-right: 17px;
  }
  .logo {
    font-size: 29px;
  }
  .score-pill {
    padding-right: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hint.is-visible,
  .record-badge.is-visible,
  .score-num.bump {
    animation: none;
  }
  .overlay,
  .start-panel,
  .over-panel,
  .hud {
    transition-duration: 0.01s;
  }
}
