:root {
  --orange: #FF8A3D;
  --orange-deep: #F26812;
  --orange-dark: #C74B06;
  --ink: #24324A;
  --ink-soft: #6D7A8E;
  --cream: #FFF8EC;
  --gold: #F7B500;
  --shadow-soft: 0 10px 26px rgba(18, 32, 52, 0.18);
}

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

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #07111e;
  overscroll-behavior: none;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
}

body {
  user-select: none;
  -webkit-user-select: none;
  background:
    radial-gradient(circle at 50% 0%, #173352 0%, #07111e 58%, #040b14 100%);
}

button {
  font-family: inherit;
  border: 0;
  outline: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible {
  outline: 3px solid rgba(255, 194, 92, 0.9);
  outline-offset: 2px;
}

img {
  user-select: none;
  -webkit-user-drag: none;
}

#stage {
  position: relative;
  width: min(100vw, 560px);
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  background: #7ec8f5;
  touch-action: none;
  box-shadow: 0 0 70px rgba(0, 0, 0, 0.55);
  isolation: isolate;
}

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

.svg-defs {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
  pointer-events: none;
}

/* ---------------- 游戏 HUD ---------------- */
.hud {
  position: absolute;
  inset: 0;
  z-index: 12;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.32s ease;
}

.hud.is-show {
  opacity: 1;
}

.hud button {
  pointer-events: auto;
}

.hud-btn {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 14px);
  left: 14px;
  width: 50px;
  height: 50px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(180deg, #65B7FF 0%, #2485F2 58%, #1469D6 100%);
  border: 2px solid rgba(255, 255, 255, 0.8);
  box-shadow:
    0 5px 0 rgba(11, 73, 145, 0.65),
    0 10px 18px rgba(7, 30, 60, 0.32),
    inset 0 2px 0 rgba(255, 255, 255, 0.42);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

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

.hud-btn:active {
  transform: translateY(3px) scale(0.97);
  box-shadow:
    0 2px 0 rgba(11, 73, 145, 0.65),
    0 4px 9px rgba(7, 30, 60, 0.3);
}

.hud-topright {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 14px);
  right: 12px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 7px;
}

.coin-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  height: 46px;
  padding: 4px 14px 4px 6px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(27, 49, 74, 0.88), rgba(13, 28, 47, 0.82));
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 5px 14px rgba(4, 16, 32, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: transform 0.16s ease;
}

.coin-pill.pop {
  transform: scale(1.09);
}

.coin-pill .coin-ico {
  width: 32px;
  height: 32px;
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.28));
}

.coin-pill b {
  min-width: 28px;
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
  color: #fff;
  letter-spacing: 0.3px;
  text-shadow: 0 2px 3px rgba(0, 0, 0, 0.35);
  font-variant-numeric: tabular-nums;
}

.dist-chip {
  display: flex;
  align-items: baseline;
  gap: 3px;
  padding: 4px 10px;
  border-radius: 999px;
  color: #DCEBFA;
  font-size: 10px;
  font-weight: 700;
  background: rgba(12, 28, 48, 0.48);
  border: 1px solid rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.dist-chip b {
  font-size: 13px;
  color: #fff;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

/* 右侧道具栏 */
.item-rail {
  position: absolute;
  top: 29%;
  right: 10px;
  width: 72px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: auto;
}

.item-card {
  position: relative;
  width: 100%;
  padding: 6px 4px 5px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  border-radius: 18px;
  color: var(--ink);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.97) 0%, rgba(237, 244, 253, 0.92) 100%);
  border: 1.5px solid rgba(255, 255, 255, 0.95);
  box-shadow:
    0 5px 12px rgba(13, 30, 55, 0.24),
    inset 0 -3px 0 rgba(125, 146, 178, 0.2),
    inset 0 1px 0 #fff;
  transition: transform 0.14s ease, box-shadow 0.18s ease, background 0.18s ease;
  overflow: visible;
}

.item-card:active {
  transform: scale(0.93);
}

.item-card.is-active {
  background: linear-gradient(180deg, #FFF9E8 0%, #FFE6BE 100%);
  border-color: #FFC14F;
  box-shadow:
    0 0 0 3px rgba(255, 169, 64, 0.34),
    0 6px 16px rgba(180, 92, 8, 0.3),
    inset 0 1px 0 #FFFDF2;
  transform: scale(1.02);
}

.item-art {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  filter: drop-shadow(0 2px 2px rgba(30, 40, 60, 0.18));
  transition: transform 0.2s ease;
}

.item-art svg {
  width: 35px;
  height: 35px;
  display: block;
}

.item-card.is-active .item-art {
  animation: itemBob 1s ease-in-out infinite;
}

@keyframes itemBob {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-3px) rotate(2deg); }
}

.item-name {
  font-size: 10px;
  font-weight: 800;
  line-height: 1.15;
  color: #5C6A80;
  letter-spacing: 0.6px;
}

.item-price {
  min-width: 47px;
  margin-top: 2px;
  padding: 1px 5px 1px 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid #EADBC2;
  color: #7A5A22;
  font-size: 11px;
  font-weight: 900;
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
}

.item-price svg {
  width: 13px;
  height: 13px;
}

.item-card.is-active .item-price {
  background: #FF9F2E;
  border-color: #FF8A12;
  color: #fff;
}

.item-card.is-active .item-price svg {
  display: none;
}

.item-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 21px;
  height: 21px;
  padding: 0 5px;
  display: none;
  align-items: center;
  justify-content: center;
  border-radius: 11px;
  background: linear-gradient(180deg, #FF9B4A, #F26512);
  border: 1.5px solid #fff;
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 3px 6px rgba(120, 50, 4, 0.32);
}

.item-badge.show {
  display: flex;
}

.item-progress {
  position: absolute;
  left: 9px;
  right: 9px;
  bottom: 3px;
  height: 3px;
  border-radius: 3px;
  background: linear-gradient(90deg, #FFD86A, #FF7C1A);
  transform-origin: left center;
  transform: scaleX(0);
  opacity: 0;
  transition: transform 0.12s linear, opacity 0.2s ease;
}

.item-card.is-active .item-progress {
  opacity: 1;
}

/* 左右移动 */
.move-btn {
  position: absolute;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 20px);
  width: 62px;
  height: 62px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #4C5E78;
  background:
    radial-gradient(circle at 35% 25%, #FFFFFF 0%, #EAF2FC 45%, #C1D2E6 100%);
  border: 2px solid rgba(255, 255, 255, 0.95);
  box-shadow:
    0 6px 0 rgba(120, 142, 170, 0.55),
    0 12px 20px rgba(10, 25, 45, 0.26),
    inset 0 2px 2px #fff;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.move-btn .mp-icon {
  width: 27px;
  height: 27px;
  opacity: 0.85;
}

.move-left {
  left: 15px;
}

.move-left .mp-icon {
  margin-left: -2px;
}

.move-right {
  right: 15px;
}

.move-right .mp-icon {
  margin-right: -2px;
}

.move-btn:active {
  transform: translateY(4px) scale(0.96);
  box-shadow:
    0 2px 0 rgba(120, 142, 170, 0.5),
    0 5px 10px rgba(10, 25, 45, 0.22);
}

/* Toast */
.toast {
  position: absolute;
  top: 20%;
  left: 50%;
  max-width: 84%;
  padding: 9px 17px;
  border-radius: 999px;
  background: rgba(15, 29, 47, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.28);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
  white-space: nowrap;
  opacity: 0;
  transform: translate(-50%, -8px) scale(0.94);
  transition: opacity 0.22s ease, transform 0.22s ease;
  pointer-events: none;
  z-index: 60;
}

.toast.is-show {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

/* ---------------- 屏幕通用 ---------------- */
.screen {
  position: absolute;
  inset: 0;
  z-index: 30;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

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

/* ---------------- 开始页 ---------------- */
.start-screen {
  background: #0a1a2c;
}

.cover {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 46%;
  transform: scale(1.03);
  animation: coverDrift 22s ease-in-out infinite alternate;
}

@keyframes coverDrift {
  0% { transform: scale(1.03) translate3d(0, 0, 0); }
  100% { transform: scale(1.1) translate3d(0, -1.2%, 0); }
}

.cover-shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg,
      rgba(5, 18, 34, 0.62) 0%,
      rgba(5, 18, 34, 0.16) 18%,
      rgba(5, 18, 34, 0) 38%,
      rgba(5, 18, 34, 0.08) 52%,
      rgba(6, 18, 33, 0.72) 76%,
      rgba(6, 17, 30, 0.96) 92%,
      #06111e 100%),
    radial-gradient(circle at 50% 44%, transparent 34%, rgba(4, 14, 26, 0.34) 100%);
}

.start-content {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: calc(env(safe-area-inset-top, 0px) + 22px) 20px calc(env(safe-area-inset-bottom, 0px) + 18px);
}

.brand {
  margin-top: 5.2vh;
  width: fit-content;
}

.brand-kicker {
  display: inline-block;
  padding: 4px 11px 5px;
  border-radius: 8px;
  background: linear-gradient(180deg, #FFA75F, #F27118);
  color: #fff;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 2.4px;
  line-height: 1;
  transform: rotate(-2.5deg);
  box-shadow: 0 4px 10px rgba(160, 58, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.4);
  text-shadow: 0 1px 1px rgba(120, 45, 0, 0.35);
}

.brand h1 {
  margin: 9px 0 8px;
  font-family: "Arial Rounded MT Bold", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: clamp(52px, 15.5vw, 74px);
  font-weight: 900;
  line-height: 0.92;
  letter-spacing: -2.5px;
  color: #fff;
  text-shadow:
    0 3px 0 #DB620F,
    0 7px 0 #9E3F05,
    0 12px 2px rgba(40, 14, 0, 0.22),
    0 16px 28px rgba(20, 8, 0, 0.48);
}

.brand h1 span {
  display: inline-block;
  margin-left: 3px;
  color: #FFE15B;
  font-style: italic;
  transform: rotate(4deg) translateY(-2px);
  text-shadow:
    0 3px 0 #E07A06,
    0 7px 0 #9E4A00,
    0 12px 2px rgba(40, 14, 0, 0.22),
    0 16px 28px rgba(20, 8, 0, 0.4);
}

.brand-sub {
  display: inline-block;
  margin: 0;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(8, 24, 43, 0.46);
  border: 1px solid rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  color: #fff;
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: 0.6px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

.start-bottom {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.stat-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.stat-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 11px;
  border-radius: 14px;
  background: rgba(10, 27, 46, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.28);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.stat-ico {
  width: 27px;
  height: 27px;
  flex: 0 0 27px;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.25));
}

.flag-ico {
  display: grid;
  place-items: center;
  color: #FFCE73;
}

.flag-ico .mp-icon {
  width: 22px;
  height: 22px;
}

.stat-txt {
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.stat-txt b {
  color: #fff;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0.2px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.stat-txt b em {
  font-size: 10px;
  font-style: normal;
  color: #C9DFF5;
  margin-left: 1px;
}

.stat-txt small {
  margin-top: 2px;
  color: #B9CEE4;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.8px;
}

.play-btn {
  position: relative;
  width: 100%;
  height: 64px;
  padding: 0 18px;
  border-radius: 21px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  background: linear-gradient(180deg, #FFB069 0%, #FF8A2E 42%, #F26A12 100%);
  border: 2px solid rgba(255, 255, 255, 0.38);
  color: #fff;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 1.5px;
  text-shadow: 0 2px 2px rgba(150, 55, 0, 0.35);
  box-shadow:
    0 6px 0 #BF4E05,
    0 14px 26px rgba(242, 106, 18, 0.46),
    inset 0 2px 0 rgba(255, 255, 255, 0.38);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.play-btn::after {
  content: "";
  position: absolute;
  inset: 5px 8px auto;
  height: 42%;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.26), rgba(255, 255, 255, 0));
  pointer-events: none;
}

.play-btn:active {
  transform: translateY(5px);
  box-shadow:
    0 1px 0 #BF4E05,
    0 6px 14px rgba(242, 106, 18, 0.4),
    inset 0 2px 0 rgba(255, 255, 255, 0.32);
}

.play-ico {
  width: 39px;
  height: 39px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.22);
  border: 2px solid rgba(255, 255, 255, 0.48);
  flex: 0 0 39px;
}

.play-ico .mp-icon {
  width: 25px;
  height: 25px;
  margin-left: 2px;
}

.start-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.ghost-btn {
  height: 43px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 14px;
  background: rgba(9, 25, 44, 0.58);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.4px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: transform 0.12s ease, background 0.12s ease;
}

.ghost-btn .mp-icon {
  width: 18px;
  height: 18px;
  color: #FFD08A;
}

.ghost-btn:active {
  transform: scale(0.97);
  background: rgba(9, 25, 44, 0.78);
}

/* ---------------- 弹窗通用 ---------------- */
.modal-screen {
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(6, 17, 31, 0.56);
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
  z-index: 40;
}

.dialog {
  position: relative;
  width: 100%;
  max-width: 370px;
  padding: 25px 20px 18px;
  border-radius: 30px;
  background:
    radial-gradient(circle at 50% 0%, #FFFDF7 0%, #FFF7EA 62%, #FCEEDB 100%);
  border: 1.5px solid rgba(255, 255, 255, 0.9);
  box-shadow:
    0 28px 70px rgba(2, 10, 22, 0.46),
    inset 0 1px 0 #fff,
    inset 0 -6px 0 rgba(214, 184, 140, 0.16);
  text-align: center;
  transform: translateY(18px) scale(0.96);
  transition: transform 0.32s cubic-bezier(0.2, 0.9, 0.3, 1.16);
}

.modal-screen.is-open .dialog {
  transform: translateY(0) scale(1);
}

.dialog-kicker {
  margin: 0 0 3px;
  color: #E97C22;
  font-size: 9.5px;
  font-weight: 900;
  letter-spacing: 2.4px;
}

.dialog h2 {
  margin: 0;
  color: #28354A;
  font-size: 26px;
  font-weight: 900;
  letter-spacing: -0.5px;
}

.dialog-sub {
  margin: 7px 0 0;
  color: #8A8479;
  font-size: 12.5px;
  line-height: 1.5;
  font-weight: 500;
}

.primary-btn {
  width: 100%;
  height: 52px;
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 16px;
  background: linear-gradient(180deg, #FFA45B 0%, #FF842D 45%, #F16C12 100%);
  border: 1.5px solid rgba(255, 255, 255, 0.45);
  color: #fff;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 0.6px;
  text-shadow: 0 1px 1px rgba(140, 50, 0, 0.3);
  box-shadow:
    0 5px 0 #BC4C05,
    0 10px 20px rgba(235, 100, 16, 0.32),
    inset 0 2px 0 rgba(255, 255, 255, 0.32);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

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

.primary-btn:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 #BC4C05, 0 5px 10px rgba(235, 100, 16, 0.28);
}

.secondary-btn {
  width: 100%;
  height: 45px;
  margin-top: 9px;
  border-radius: 14px;
  background: #FFFDF8;
  border: 1.5px solid #EBDCC6;
  color: #6F5D46;
  font-size: 14px;
  font-weight: 800;
  box-shadow: 0 3px 0 rgba(196, 170, 132, 0.22);
  transition: transform 0.1s ease;
}

.secondary-btn:active {
  transform: translateY(2px);
}

.dialog-links {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.text-btn {
  padding: 6px 2px;
  background: transparent;
  color: #8D7B63;
  font-size: 12.5px;
  font-weight: 800;
}

.text-btn:active {
  opacity: 0.6;
}

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

.close-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #fff;
  border: 1.5px solid #EADBC5;
  color: #7A6650;
  box-shadow: 0 3px 7px rgba(80, 55, 20, 0.1);
}

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

.close-btn:active {
  transform: scale(0.92);
}

.floating-close {
  position: absolute;
  top: 12px;
  right: 12px;
}

/* 结算 */
.over-badge {
  width: 52px;
  height: 52px;
  margin: -2px auto 8px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(180deg, #FFB267, #F27218);
  border: 2px solid #fff;
  box-shadow: 0 6px 14px rgba(220, 100, 10, 0.32);
}

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

.result-grid {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  padding: 11px 6px;
  border-radius: 17px;
  background: #F8EEDD;
  border: 1px solid #F0E0C8;
}

.result-cell {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.result-cell + .result-cell {
  border-left: 1px dashed #E4D2B7;
}

.result-cell small {
  color: #A18D70;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.result-cell b {
  display: flex;
  align-items: center;
  gap: 2px;
  color: #3C3A36;
  font-size: 21px;
  font-weight: 900;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}

.result-cell b em {
  font-style: normal;
  font-size: 10px;
  color: #A18D70;
  margin-left: 1px;
}

.result-cell b.gold {
  color: #C27A00;
}

.result-cell b svg {
  width: 18px;
  height: 18px;
}

.new-record {
  display: none;
  width: fit-content;
  margin: 11px auto 0;
  padding: 5px 12px;
  border-radius: 999px;
  background: linear-gradient(180deg, #FFE066, #FFC21F);
  color: #8A5300;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 1px;
  box-shadow: 0 3px 8px rgba(190, 120, 0, 0.22);
}

.new-record.show {
  display: block;
  animation: recordPop 0.45s cubic-bezier(0.2, 1.4, 0.4, 1);
}

/* 结算页 · 激励视频翻倍 */
.over-dialog {
  max-height: calc(100vh - 44px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.ad-double-btn {
  position: relative;
  width: 100%;
  min-height: 58px;
  margin-top: 11px;
  padding: 8px 12px 8px 9px;
  display: flex;
  align-items: center;
  gap: 9px;
  border-radius: 17px;
  text-align: left;
  background: linear-gradient(180deg, #FFF6D8 0%, #FFE8A6 52%, #FFD66B 100%);
  border: 1.5px solid #F3B62E;
  box-shadow: 0 4px 0 #D99512, 0 8px 16px rgba(214, 140, 12, 0.24), inset 0 1px 0 #FFFDF0;
  transition: transform 0.1s ease, box-shadow 0.1s ease, opacity 0.15s ease;
}

.ad-double-btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #D99512, 0 4px 8px rgba(214, 140, 12, 0.2);
}

.ad-double-btn.is-claimed,
.ad-double-btn:disabled {
  opacity: 0.82;
  box-shadow: 0 3px 0 #C9A45E, inset 0 1px 0 rgba(255, 255, 255, 0.7);
  background: linear-gradient(180deg, #FFF9E8, #F5E7C6);
  border-color: #E4CD9C;
}

.ad-double-ico {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(180deg, #FF9E4D, #F26D12);
  border: 1.5px solid #fff;
  box-shadow: 0 3px 7px rgba(200, 95, 5, 0.3);
}

.ad-double-ico .mp-icon {
  width: 23px;
  height: 23px;
}

.ad-double-txt {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ad-double-txt b {
  color: #7A4A00;
  font-size: 13.5px;
  font-weight: 900;
  letter-spacing: 0.2px;
  line-height: 1.2;
}

.ad-double-txt small {
  color: #A5762A;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.3;
}

.ad-double-tag {
  flex: 0 0 auto;
  padding: 3px 6px;
  border-radius: 6px;
  background: #C97A08;
  color: #FFF4D8;
  font-size: 8.5px;
  font-weight: 900;
  letter-spacing: 0.8px;
}

.ad-double-btn.is-claimed .ad-double-txt b {
  color: #8C6A2A;
}

.ad-double-btn.is-claimed .ad-double-tag {
  background: #B9A47C;
}

@keyframes recordPop {
  0% { transform: scale(0.5) rotate(-5deg); opacity: 0; }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}

/* 暂停 */
.pause-dialog {
  max-width: 340px;
}

.pause-row {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

/* ---------------- 道具兑换 ---------------- */
.sheet-screen {
  place-items: end;
  padding: 0;
  background: rgba(6, 17, 31, 0.5);
  z-index: 45;
}

.sheet {
  width: 100%;
  max-height: 90%;
  padding: 10px 18px calc(env(safe-area-inset-bottom, 0px) + 18px);
  display: flex;
  flex-direction: column;
  border-radius: 28px 28px 0 0;
  background:
    radial-gradient(circle at 50% 0%, #FFFDF8 0%, #FFF7E9 58%, #FFF1DF 100%);
  border-top: 1.5px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 -22px 56px rgba(2, 10, 22, 0.38);
  transform: translateY(102%);
  transition: transform 0.34s cubic-bezier(0.2, 0.9, 0.3, 1);
}

.sheet-screen.is-open .sheet {
  transform: translateY(0);
}

.sheet-grip {
  width: 42px;
  height: 5px;
  flex: 0 0 5px;
  margin: 0 auto 10px;
  border-radius: 99px;
  background: #E3D2BB;
}

.sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.sheet-head h2 {
  margin: 0;
  color: #28354A;
  font-size: 24px;
  font-weight: 900;
  letter-spacing: -0.5px;
}

.sheet-head-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mini-wallet {
  height: 34px;
  padding: 0 10px 0 5px;
  display: flex;
  align-items: center;
  gap: 3px;
  border-radius: 999px;
  background: #FFF4D9;
  border: 1.5px solid #F2D7A0;
  color: #8A5A0B;
  font-size: 15px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.mini-wallet svg {
  width: 23px;
  height: 23px;
}

.shop-list {
  flex: 1;
  margin-top: 12px;
  padding-bottom: 2px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.shop-list::-webkit-scrollbar {
  display: none;
}

.shop-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 18px;
  background: #FFFDF9;
  border: 1.5px solid #F0E3D0;
  box-shadow: 0 4px 12px rgba(88, 58, 18, 0.06);
}

.shop-item.is-shake {
  animation: shopShake 0.36s ease;
}

@keyframes shopShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  55% { transform: translateX(5px); }
  80% { transform: translateX(-2px); }
}

.shop-icon {
  width: 54px;
  height: 54px;
  flex: 0 0 54px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.85);
  box-shadow: inset 0 -3px 0 rgba(90, 55, 10, 0.08);
}

.shop-icon svg {
  width: 35px;
  height: 35px;
  filter: drop-shadow(0 2px 2px rgba(40, 30, 20, 0.16));
}

.shop-icon.ic-magnet {
  background: linear-gradient(160deg, #FFE7E2, #FFCAC3);
}

.shop-icon.ic-shield {
  background: linear-gradient(160deg, #E1F3FF, #B8E1FF);
}

.shop-icon.ic-star {
  background: linear-gradient(160deg, #FFF6CC, #FFE291);
}

.shop-info {
  min-width: 0;
  flex: 1;
}

.shop-info b {
  display: block;
  color: #2E3A4C;
  font-size: 15px;
  font-weight: 900;
  line-height: 1.15;
}

.shop-info p {
  margin: 2px 0 4px;
  color: #918676;
  font-size: 11px;
  line-height: 1.35;
  font-weight: 500;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.shop-stock {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 99px;
  background: #F6EEDF;
  color: #A6844F;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.2px;
}

.shop-buy {
  flex: 0 0 auto;
  min-width: 72px;
  height: 42px;
  padding: 0 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border-radius: 13px;
  background: linear-gradient(180deg, #FFA556, #FF7C22);
  border: 1.5px solid rgba(255, 255, 255, 0.4);
  color: #fff;
  font-size: 14px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 3px 0 #BF4D05, 0 5px 9px rgba(220, 100, 10, 0.24);
  transition: transform 0.1s ease, filter 0.15s ease;
}

.shop-buy svg {
  width: 16px;
  height: 16px;
}

.shop-buy:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #BF4D05;
}

.shop-buy.is-poor {
  filter: grayscale(0.55);
  opacity: 0.62;
}

.shop-note {
  margin: 12px 2px 0;
  display: flex;
  align-items: flex-start;
  gap: 5px;
  color: #9A8B76;
  font-size: 10.5px;
  line-height: 1.45;
  font-weight: 500;
}

.shop-note .mp-icon {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  margin-top: 1px;
  color: #E2A23D;
}

/* 玩法说明 */
.how-dialog {
  max-width: 360px;
  text-align: left;
}

.how-dialog .dialog-kicker,
.how-dialog h2 {
  text-align: center;
}

.how-list {
  margin: 14px 0 4px;
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.how-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px;
  border-radius: 15px;
  background: #FFFBF4;
  border: 1px solid #F2E4D0;
}

.how-num {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, #FFAB5F, #F27218);
  border: 1.5px solid #fff;
  color: #fff;
  font-size: 13px;
  font-weight: 900;
  box-shadow: 0 3px 6px rgba(220, 100, 10, 0.25);
}

.how-row b {
  display: block;
  color: #354154;
  font-size: 13.5px;
  font-weight: 900;
}

.how-row p {
  margin: 2px 0 0;
  color: #8C8273;
  font-size: 11.5px;
  line-height: 1.48;
}

/* ---------------- 响应式 ---------------- */
@media (max-height: 720px) {
  .brand {
    margin-top: 3vh;
  }

  .brand h1 {
    font-size: clamp(44px, 13vw, 58px);
  }

  .item-rail {
    top: 26%;
    width: 64px;
    gap: 6px;
  }

  .item-art,
  .item-art svg {
    width: 31px;
    height: 31px;
  }

  .item-card {
    border-radius: 16px;
    padding: 5px 3px 4px;
  }

  .play-btn {
    height: 58px;
    border-radius: 19px;
  }

  .start-bottom {
    gap: 7px;
  }

  .stat-chip {
    padding: 6px 10px;
  }

  .move-btn {
    width: 56px;
    height: 56px;
  }
}

@media (max-height: 620px) {
  .brand {
    margin-top: 1.4vh;
  }

  .brand-sub {
    display: none;
  }

  .start-content {
    padding-top: calc(env(safe-area-inset-top, 0px) + 12px);
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 10px);
  }

  .stat-row {
    display: none;
  }

  .item-rail {
    top: 22%;
    width: 58px;
    gap: 5px;
  }

  .item-name {
    display: none;
  }

  .item-art,
  .item-art svg {
    width: 29px;
    height: 29px;
  }

  .move-btn {
    width: 52px;
    height: 52px;
  }
}

@media (max-width: 350px) {
  .item-rail {
    right: 7px;
    width: 64px;
  }

  .start-content {
    padding-left: 15px;
    padding-right: 15px;
  }

  .move-left {
    left: 10px;
  }

  .move-right {
    right: 10px;
  }

  .move-btn {
    width: 55px;
    height: 55px;
  }

  .shop-buy {
    min-width: 64px;
    font-size: 13px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cover img,
  .item-card.is-active .item-art,
  .new-record.show {
    animation: none;
  }
}

/* Allow menu panels to scroll while keeping track swipes in the game. */
#stage {
  touch-action: auto;
}

#game {
  touch-action: none;
}

#stage button {
  touch-action: manipulation;
}

.hud:not(.is-show) {
  visibility: hidden;
}

.hud:not(.is-show) button,
.hud:not(.is-show) .item-rail {
  pointer-events: none;
}

.hud.is-show .item-rail {
  pointer-events: auto;
}

@media (max-height: 500px) {
  .start-content {
    justify-content: flex-start;
    gap: 8px;
    overflow-y: auto;
    padding-top: calc(env(safe-area-inset-top, 0px) + 10px);
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 10px);
  }

  .start-content .brand {
    margin-top: 0;
    flex-shrink: 0;
  }

  .start-content .brand h1 {
    font-size: 40px;
  }

  .start-content .start-bottom {
    flex-shrink: 0;
    margin-top: auto;
    gap: 5px;
  }

  .start-content .play-btn {
    min-height: 48px;
  }

  .modal-screen:not(.sheet-screen) {
    align-items: safe center;
    overflow-y: auto;
  }

  .modal-screen:not(.sheet-screen) > .dialog {
    flex-shrink: 0;
  }

  .hud .item-rail {
    top: calc(env(safe-area-inset-top, 0px) + 84px);
    max-height: calc(100% - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 160px);
    overflow: auto;
  }

  .hud.is-show .item-rail {
    pointer-events: auto;
  }
}

/* ---------------- 玩法模式切换（开始页） ---------------- */
.mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  padding: 5px;
  border-radius: 17px;
  background: rgba(8, 24, 43, 0.58);
  border: 1px solid rgba(255, 255, 255, 0.24);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.mode-tab {
  min-width: 0;
  min-height: 46px;
  padding: 6px 8px;
  display: flex;
  align-items: center;
  gap: 7px;
  border-radius: 12px;
  background: transparent;
  color: #C4D9EF;
  text-align: left;
  transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

.mode-tab:active {
  transform: scale(0.98);
}

.mode-tab.is-active {
  color: #fff;
  background: linear-gradient(180deg, #FFA45B 0%, #FF842D 55%, #F16C12 100%);
  box-shadow: 0 3px 0 #C15205, 0 6px 12px rgba(210, 92, 8, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.mode-ico {
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.14);
  color: #FFD08A;
}

.mode-tab.is-active .mode-ico {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}

.mode-ico .mp-icon {
  width: 18px;
  height: 18px;
}

.mode-txt {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1.12;
}

.mode-txt b {
  font-size: 12.5px;
  font-weight: 900;
  letter-spacing: 0.2px;
  white-space: nowrap;
}

.mode-txt small {
  color: rgba(226, 240, 255, 0.72);
  font-size: 9px;
  font-weight: 700;
  white-space: nowrap;
}

.mode-tab.is-active .mode-txt small {
  color: rgba(255, 255, 255, 0.88);
}

.mode-hint {
  margin: -1px 0 0;
  color: #C6DCF2;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.2px;
  text-align: center;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

/* ---------------- 关卡 HUD ---------------- */
.level-chip {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 14px);
  left: 50%;
  width: clamp(126px, 38vw, 184px);
  padding: 7px 10px 8px;
  border-radius: 14px;
  color: #fff;
  background: rgba(9, 25, 44, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.26);
  box-shadow: 0 4px 12px rgba(4, 16, 30, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transform: translateX(-50%);
}

.level-chip.is-off {
  display: none;
}

.level-chip-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.level-chip-tag {
  color: #FFD08A;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.4px;
  white-space: nowrap;
}

.level-chip-num {
  color: #fff;
  font-size: 10.5px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.level-chip-bar {
  height: 5px;
  margin-top: 5px;
  border-radius: 99px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.2);
}

.level-chip-bar span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #FFD86A 0%, #FF9A33 55%, #FF6A12 100%);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.16s linear;
}

/* ---------------- 结算页失败说明 ---------------- */
.level-fail-line {
  margin: 8px 0 0;
  padding: 5px 10px;
  display: inline-block;
  border-radius: 999px;
  background: #FFF2D9;
  border: 1px solid #F3D8A6;
  color: #B46308;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.3;
}

/* ---------------- 关卡完成 ---------------- */
.clear-dialog {
  max-height: calc(100vh - 44px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.clear-badge {
  width: 54px;
  height: 54px;
  margin: -2px auto 8px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(180deg, #FFD86A 0%, #FFB020 52%, #EE8A00 100%);
  border: 2px solid #fff;
  box-shadow: 0 6px 16px rgba(220, 140, 0, 0.36);
}

.clear-badge .mp-icon {
  width: 28px;
  height: 28px;
}

.clear-reward {
  margin-top: 10px;
  padding: 8px 11px;
  border-radius: 13px;
  background: linear-gradient(180deg, #FFF8E8, #FFF0CE);
  border: 1px solid #F3DDAE;
  color: #8F5A0E;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.45;
}

/* ---------------- 角色皮肤 ---------------- */
.skin-sheet {
  max-height: 88%;
}

.skin-note {
  margin: 10px 0 0;
  padding: 8px 10px;
  display: flex;
  align-items: flex-start;
  gap: 6px;
  border-radius: 12px;
  background: #FFF7E6;
  border: 1px solid #F1E0C4;
  color: #907A5B;
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1.4;
}

.skin-note .mp-icon {
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
  margin-top: 1px;
  color: #D98A20;
}

.skin-grid {
  flex: 1 1 auto;
  margin-top: 10px;
  padding-bottom: 4px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  align-content: start;
}

.skin-card {
  min-width: 0;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-radius: 16px;
  background: #FFFDF9;
  border: 1.5px solid #F0E3D0;
  box-shadow: 0 4px 10px rgba(88, 58, 18, 0.06);
}

.skin-card.is-current {
  border-color: #FF9A33;
  box-shadow: 0 0 0 3px rgba(255, 154, 51, 0.18), 0 5px 12px rgba(180, 100, 20, 0.14);
}

.skin-avatar {
  height: 58px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: #fff;
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.12), inset 0 2px 0 rgba(255, 255, 255, 0.25);
}

.skin-avatar .mp-icon {
  width: 34px;
  height: 34px;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.22));
}

.skin-info {
  min-width: 0;
}

.skin-info b {
  display: block;
  color: #3A342B;
  font-size: 12.5px;
  font-weight: 900;
  line-height: 1.2;
}

.skin-info span {
  display: block;
  margin-top: 2px;
  color: #9A8B76;
  font-size: 9px;
  font-weight: 600;
  line-height: 1.3;
}

.skin-action {
  height: 32px;
  border-radius: 10px;
  background: #FFF3DD;
  border: 1px solid #F0D4A8;
  color: #A05D12;
  font-size: 11.5px;
  font-weight: 900;
}

.skin-action:active {
  transform: scale(0.97);
}

.skin-card.is-current .skin-action {
  background: linear-gradient(180deg, #FFA45B, #F16C12);
  border-color: #E3620C;
  color: #fff;
}

.start-actions .ghost-btn:last-child {
  grid-column: 1 / -1;
}

@media (max-width: 360px) {
  .mode-txt b {
    font-size: 11.5px;
  }

  .mode-ico {
    flex-basis: 25px;
    width: 25px;
    height: 25px;
  }

  .mode-tab {
    padding: 6px;
    gap: 5px;
  }
}
