:root {
  --orange: #FF8A3D;
  --orange-deep: #F2681C;
  --orange-dark: #C9520E;
  --orange-soft: #FFE3C4;
  --teal: #2BB8A6;
  --teal-deep: #128F82;
  --gold: #FFD166;
  --ink: #24172F;
  --ink-2: #5D4B60;
  --muted: #9A8A93;
  --cream: #FFF7EC;
  --card: #FFFFFF;
  --line: #F1E2D0;
  --shadow-card: 0 8px 20px rgba(89, 52, 19, 0.07);
  --shadow-orange: 0 5px 0 #D95F17, 0 10px 20px rgba(255, 122, 45, 0.24);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body {
  margin: 0;
  min-height: 100%;
  background: #170E28;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: none;
}
body {
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  overflow-x: hidden;
}
button {
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
h2, h3, p { margin: 0; }
img { display: block; }

.app {
  position: relative;
  width: 100%;
  max-width: 560px;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: #241540;
  overflow: hidden;
}

/* ---------------- stage ---------------- */
.stage {
  position: relative;
  flex: none;
  height: clamp(420px, 58vh, 540px);
  min-height: 420px;
  overflow: hidden;
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;
  outline: none;
}
.scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center bottom;
  pointer-events: none;
}
.stage-shade {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(17, 9, 31, 0.32) 0%, rgba(17, 9, 31, 0) 22%, rgba(17, 9, 31, 0) 68%, rgba(14, 7, 27, 0.42) 100%),
    radial-gradient(120% 60% at 50% 110%, rgba(255, 138, 61, 0.14), transparent 70%);
}
.stage::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 70px rgba(12, 6, 24, 0.26);
}

/* hud */
.hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 5;
  padding: calc(10px + env(safe-area-inset-top)) 16px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.player-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 4px 13px 4px 4px;
  border-radius: 999px;
  color: #FFF7EC;
  background: linear-gradient(135deg, rgba(34, 19, 54, 0.82), rgba(51, 28, 70, 0.62));
  border: 1px solid rgba(255, 226, 184, 0.26);
  box-shadow: 0 8px 20px rgba(13, 5, 24, 0.26), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}
.avatar {
  position: relative;
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  display: grid;
  place-items: center;
  color: #FFF8ED;
  font-size: 15px;
  font-weight: 900;
  background: linear-gradient(145deg, #FFB062, #F2681C);
  border: 1.5px solid rgba(255, 235, 204, 0.75);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.18);
}
.avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.avatar-text { line-height: 1; transform: translateY(-0.5px); }
.player-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding-right: 2px;
}
.player-meta b {
  max-width: 148px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13.5px;
  font-weight: 800;
  letter-spacing: 0.01em;
}
.player-meta small {
  display: flex;
  align-items: center;
  gap: 3px;
  color: rgba(255, 229, 194, 0.72);
  font-size: 10.5px;
  line-height: 1;
}
.player-meta small .mp-icon {
  width: 11px;
  height: 11px;
  color: #FFD166;
}
.icon-btn {
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #FFE6B8;
  background: rgba(33, 18, 52, 0.72);
  border: 1px solid rgba(255, 225, 178, 0.3);
  box-shadow: 0 8px 20px rgba(12, 5, 23, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  transition: transform 0.12s ease, background 0.2s ease;
}
.icon-btn .mp-icon { width: 23px; height: 23px; }
.icon-btn:active { transform: scale(0.92); background: rgba(58, 32, 79, 0.85); }
.icon-btn.glass { color: #FFD166; }

/* wallet */
.wallet {
  position: absolute;
  top: calc(63px + env(safe-area-inset-top));
  left: 16px;
  right: 16px;
  z-index: 4;
  padding: 11px 15px 10px;
  border-radius: 21px;
  color: #FFF9EF;
  background:
    radial-gradient(120% 150% at 90% 0%, rgba(255, 172, 92, 0.22), transparent 55%),
    linear-gradient(135deg, rgba(34, 19, 55, 0.9), rgba(55, 29, 76, 0.74));
  border: 1px solid rgba(255, 213, 156, 0.34);
  box-shadow: 0 14px 32px rgba(15, 6, 27, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.14);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}
.wallet-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.wallet-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: rgba(255, 235, 210, 0.75);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
}
.wallet-label .mp-icon { width: 14px; height: 14px; opacity: 0.85; }
.rate-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 4px 8px;
  border-radius: 999px;
  color: #9AF2DF;
  background: rgba(43, 184, 166, 0.16);
  border: 1px solid rgba(91, 224, 203, 0.32);
  font-size: 10.5px;
  font-weight: 700;
  white-space: nowrap;
}
.rate-pill .mp-icon { width: 12px; height: 12px; color: #8DF4D8; }
.rate-pill b { font-size: 12.5px; font-weight: 900; }
.money-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-height: 40px;
  margin-top: 1px;
}
.money {
  display: inline-block;
  font-size: clamp(29px, 8.4vw, 37px);
  line-height: 1.12;
  font-weight: 900;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: #FFF8E8;
  text-shadow: 0 2px 0 rgba(99, 45, 9, 0.22), 0 0 24px rgba(255, 187, 92, 0.18);
}
.money.bump { animation: moneyBump 0.18s ease; }
.boost-tag {
  padding: 3px 7px;
  border-radius: 7px;
  background: linear-gradient(180deg, #FFD166, #FFA62E);
  color: #6E3908;
  font-size: 11px;
  font-weight: 900;
  box-shadow: 0 2px 0 rgba(140, 73, 12, 0.3);
}
.wallet-bottom {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  color: rgba(255, 233, 207, 0.62);
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
}
.mini-dot {
  flex: none;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: rgba(255, 219, 174, 0.45);
}

/* tap cue */
.tap-cue {
  position: absolute;
  left: 50%;
  top: 55%;
  z-index: 3;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 17px;
  border-radius: 999px;
  color: #FFF4DC;
  background: linear-gradient(180deg, rgba(43, 24, 66, 0.78), rgba(29, 15, 48, 0.84));
  border: 1px solid rgba(255, 210, 137, 0.62);
  box-shadow: 0 0 0 6px rgba(255, 138, 61, 0.1), 0 10px 24px rgba(12, 5, 23, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.16);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.02em;
  pointer-events: none;
  animation: cueFloat 2.8s ease-in-out infinite;
  white-space: nowrap;
}
.tap-cue .mp-icon { width: 20px; height: 20px; color: #FFD166; }
.tap-cue b { color: #FFD166; font-size: 15px; font-weight: 900; font-variant-numeric: tabular-nums; }
.cue-ring {
  position: absolute;
  inset: -9px;
  border-radius: inherit;
  border: 1px solid rgba(255, 192, 104, 0.5);
  animation: ringPulse 2.1s ease-out infinite;
  pointer-events: none;
}
.stage.tapped .tap-cue { animation: cueTap 0.22s ease; }

.stage-status {
  position: absolute;
  left: 16px;
  bottom: 14px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(25, 13, 43, 0.58);
  border: 1px solid rgba(255, 219, 172, 0.16);
  color: rgba(255, 240, 220, 0.82);
  font-size: 10.5px;
  font-weight: 600;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  pointer-events: none;
  white-space: nowrap;
}
.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #5BE7B7;
  box-shadow: 0 0 0 0 rgba(91, 231, 183, 0.6);
  animation: livePulse 1.8s ease-out infinite;
}
.sep { opacity: 0.4; }

.buff-strip {
  position: absolute;
  right: 16px;
  bottom: 50px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border-radius: 999px;
  color: #FFF4DA;
  background: linear-gradient(180deg, rgba(255, 138, 61, 0.26), rgba(110, 38, 22, 0.62));
  border: 1px solid rgba(255, 196, 105, 0.5);
  box-shadow: 0 4px 14px rgba(20, 7, 10, 0.3);
  font-size: 10.5px;
  font-weight: 700;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  pointer-events: none;
  white-space: nowrap;
}
.buff-strip .mp-icon { width: 14px; height: 14px; color: #FFD166; }
.buff-strip b:last-child { color: #FFE29C; font-variant-numeric: tabular-nums; }

.fx-layer {
  position: absolute;
  inset: 0;
  z-index: 8;
  pointer-events: none;
  overflow: hidden;
}
.float-text {
  position: absolute;
  font-size: 21px;
  font-weight: 900;
  letter-spacing: -0.01em;
  color: #FFE08A;
  text-shadow: 0 2px 0 #B95012, 0 0 18px rgba(255, 189, 92, 0.65);
  transform: translate(-50%, -50%);
  animation: floatUp 0.95s cubic-bezier(0.18, 0.72, 0.24, 1) forwards;
  white-space: nowrap;
}
.float-text.big { font-size: 27px; color: #FFF3BE; }
.tap-ripple {
  position: absolute;
  width: 84px;
  height: 84px;
  margin-left: -42px;
  margin-top: -42px;
  border-radius: 50%;
  border: 2px solid rgba(255, 211, 130, 0.72);
  background: radial-gradient(circle, rgba(255, 196, 107, 0.18), transparent 68%);
  animation: rippleOut 0.55s ease-out forwards;
  pointer-events: none;
}
.coin-pop {
  position: absolute;
  width: 9px;
  height: 9px;
  margin: -4.5px 0 0 -4.5px;
  border-radius: 50%;
  background: linear-gradient(180deg, #FFE9A1, #FFB12E);
  box-shadow: 0 0 8px rgba(255, 196, 90, 0.8);
  animation: coinFly 0.72s ease-out forwards;
  pointer-events: none;
}

/* ---------------- panel ---------------- */
.panel {
  position: relative;
  z-index: 6;
  margin-top: -24px;
  padding: 15px 16px calc(14px + env(safe-area-inset-bottom));
  border-radius: 28px 28px 0 0;
  background:
    radial-gradient(90% 40% at 50% 0%, #FFFDF8 0%, #FFF6EA 58%, #FFF1E2 100%);
  box-shadow: 0 -12px 34px rgba(17, 7, 30, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  flex: 1;
}
.panel-grip {
  width: 38px;
  height: 4px;
  margin: 0 auto 12px;
  border-radius: 4px;
  background: #E8D6C1;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.eyebrow {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 4px;
  color: #B08967;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
}
.eyebrow .live-dot { width: 5px; height: 5px; }
.panel-head h2 {
  font-size: 20px;
  line-height: 1.18;
  font-weight: 900;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.panel-rank {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
  padding: 7px 10px;
  border-radius: 12px;
  background: #FFF1DD;
  border: 1px solid #F4DEC2;
  color: #8A5A30;
  transition: transform 0.12s ease;
}
.panel-rank:active { transform: scale(0.96); }
.panel-rank span { font-size: 10.5px; font-weight: 700; }
.panel-rank b { color: var(--orange-deep); font-size: 12.5px; font-weight: 900; }
.panel-rank small { color: #B79879; font-size: 9px; letter-spacing: 0.08em; }

.upgrade-list {
  display: grid;
  gap: 9px;
  margin-top: 12px;
}
.up-card {
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr) 78px;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 18px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-card);
  transition: transform 0.14s ease, border-color 0.2s ease;
}
.up-card.nudge { animation: cardNudge 0.28s ease; }
.up-card.nudge { border-color: #FFB273; }
.up-icon {
  width: 50px;
  height: 50px;
  border-radius: 15px;
  display: grid;
  place-items: center;
  color: #FFF9EF;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.26), 0 5px 12px rgba(0, 0, 0, 0.12);
}
.up-icon.ad { background: linear-gradient(145deg, #FFB05F, #FF762B); }
.up-icon.staff { background: linear-gradient(145deg, #4BD6C0, #199B90); }
.up-icon .mp-icon { width: 27px; height: 27px; }
.up-copy { min-width: 0; }
.up-top {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.up-top h3 {
  font-size: 14.5px;
  font-weight: 900;
  letter-spacing: -0.01em;
  color: #332237;
  white-space: nowrap;
}
.lv-pill {
  flex: none;
  padding: 2px 6px;
  border-radius: 6px;
  background: #FFF0DC;
  color: #D96A1C;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.02em;
}
.lv-pill.teal { background: #E3F9F5; color: #138E82; }
.up-copy p {
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #9A8A8F;
  font-size: 11px;
  font-weight: 500;
}
.up-copy p b { color: #6C4B2E; font-weight: 800; }
.buy-btn {
  width: 78px;
  height: 56px;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  background: linear-gradient(180deg, #FFA657, #FF7A2D);
  color: #FFF9EF;
  box-shadow: var(--shadow-orange);
  transition: transform 0.08s ease, box-shadow 0.12s ease, filter 0.2s ease;
}
.buy-btn span { font-size: 12.5px; font-weight: 900; letter-spacing: 0.04em; line-height: 1.35; }
.buy-btn small {
  font-size: 12px;
  font-weight: 900;
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
  color: #FFF5DF;
}
.buy-btn:active { transform: translateY(3px); box-shadow: 0 2px 0 #D95F17, 0 4px 10px rgba(255, 122, 45, 0.2); }
.buy-btn.locked {
  background: #F5EBDE;
  color: #B4A18D;
  box-shadow: none;
  border: 1px solid #EBDCC9;
}
.buy-btn.locked small { color: #B4A18D; }
.buy-btn.ready { animation: readyPulse 2.2s ease-in-out infinite; }

.quick-stats {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 9px 11px;
  border-radius: 15px;
  background: linear-gradient(180deg, #FFF3E2, #FFEEDB);
  border: 1px solid #F4DFC4;
}
.quick-stats > div {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.quick-stats span {
  color: #B19072;
  font-size: 9.5px;
  font-weight: 600;
  white-space: nowrap;
}
.quick-stats b {
  color: #4A3326;
  font-size: 14px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.rank-link {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 7px 5px 7px 9px;
  border-radius: 10px;
  color: #D96A1C;
  background: #FFF9F0;
  border: 1px solid #F1D7B8;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
  transition: transform 0.12s ease;
}
.rank-link:active { transform: scale(0.95); }
.rank-link .mp-icon { width: 15px; height: 15px; }
.rank-link .chev { width: 13px; height: 13px; opacity: 0.7; }
.safe-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 9px;
  color: #B4A08F;
  font-size: 9.5px;
  font-weight: 500;
  text-align: center;
}
.safe-note .mp-icon { width: 11px; height: 11px; opacity: 0.8; }

/* ---------------- modal base ---------------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(16, 8, 27, 0.6);
  -webkit-backdrop-filter: blur(7px);
  backdrop-filter: blur(7px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.24s ease, visibility 0.24s ease;
}
.modal.show { opacity: 1; visibility: visible; }
.modal.center { align-items: center; padding: 20px; }
.modal-card {
  transform: translateY(26px) scale(0.97);
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.24s ease;
}
.modal.show .modal-card { transform: translateY(0) scale(1); opacity: 1; }
.modal-sheet {
  width: 100%;
  max-width: 560px;
  max-height: 86vh;
  max-height: 86dvh;
  transform: translateY(102%);
  transition: transform 0.32s cubic-bezier(0.2, 0.8, 0.2, 1);
  border-radius: 27px 27px 0 0;
  background: #FFF8EE;
  box-shadow: 0 -20px 50px rgba(8, 3, 16, 0.42);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal.show .modal-sheet { transform: translateY(0); }

/* offline */
#offlineModal { z-index: 70; }
.offline-card {
  position: relative;
  width: 100%;
  max-width: 348px;
  margin: auto;
  padding: 25px 20px 20px;
  border-radius: 27px;
  overflow: hidden;
  text-align: center;
  color: #FFF8EC;
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(255, 163, 84, 0.25), transparent 58%),
    linear-gradient(180deg, #2C1A46, #1B102E);
  border: 1px solid rgba(255, 208, 143, 0.32);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
.offline-beam {
  position: absolute;
  top: -110px;
  left: 50%;
  width: 230px;
  height: 230px;
  margin-left: -115px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 193, 105, 0.35), transparent 68%);
  pointer-events: none;
}
.offline-coin {
  position: relative;
  width: 62px;
  height: 62px;
  margin: 0 auto 12px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #FFE99A, #FFB12E);
  border: 3px solid #FFDF8D;
  box-shadow: 0 0 0 7px rgba(255, 196, 91, 0.12), 0 10px 24px rgba(255, 157, 44, 0.28);
  color: #98540D;
  font-family: Arial, sans-serif;
  font-size: 31px;
  font-weight: 900;
  animation: coinBob 3s ease-in-out infinite;
}
.modal-kicker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: #FFD18F;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
}
.modal-kicker .mp-icon { width: 13px; height: 13px; }
.offline-card h2 {
  margin-top: 6px;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -0.02em;
}
.offline-desc {
  margin: 7px auto 0;
  max-width: 250px;
  color: rgba(255, 235, 208, 0.7);
  font-size: 12px;
  line-height: 1.55;
}
.offline-desc b { color: #FFE7BC; font-weight: 800; }
.offline-amount {
  margin-top: 10px;
  font-size: 37px;
  line-height: 1.2;
  font-weight: 900;
  letter-spacing: -0.02em;
  color: #FFE08A;
  text-shadow: 0 2px 0 rgba(143, 65, 8, 0.32), 0 0 24px rgba(255, 192, 91, 0.32);
  font-variant-numeric: tabular-nums;
}
.offline-note {
  margin-top: 3px;
  color: rgba(255, 231, 198, 0.52);
  font-size: 10.5px;
}
.primary-btn {
  width: 100%;
  min-height: 52px;
  margin-top: 18px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: linear-gradient(180deg, #FFA657, #FF7A2D);
  color: #FFF9EF;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 0.04em;
  box-shadow: 0 5px 0 #C9520E, 0 12px 24px rgba(255, 122, 45, 0.25);
  transition: transform 0.08s ease, box-shadow 0.12s ease;
}
.primary-btn .mp-icon { width: 18px; height: 18px; }
.primary-btn:active { transform: translateY(3px); box-shadow: 0 2px 0 #C9520E; }

/* leaderboard */
#rankModal { z-index: 65; }
.rank-sheet {
  padding: 18px 16px calc(12px + env(safe-area-inset-bottom));
}
.sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  flex: none;
}
.sheet-head .modal-kicker { color: #C07634; justify-content: flex-start; }
.sheet-head h2 {
  margin-top: 3px;
  font-size: 23px;
  font-weight: 900;
  letter-spacing: -0.02em;
}
.sheet-sub {
  margin-top: 4px;
  color: #A18C7A;
  font-size: 11px;
}
.close-btn {
  width: 36px;
  height: 36px;
  color: #7A624F;
  background: #FFF1DF;
  border: 1px solid #F0DDC7;
  box-shadow: none;
}
.close-btn .mp-icon { width: 19px; height: 19px; }
.podium {
  display: grid;
  grid-template-columns: 1fr 1.13fr 1fr;
  align-items: end;
  gap: 7px;
  margin: 16px 0 10px;
  flex: none;
}
.podium-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  min-width: 0;
}
.podium-item .avatar { width: 44px; height: 44px; border-width: 2px; font-size: 16px; }
.podium-item.p1 .avatar {
  width: 56px;
  height: 56px;
  font-size: 20px;
  border: 2.5px solid #FFD166;
  box-shadow: 0 0 0 5px rgba(255, 209, 102, 0.18), 0 6px 16px rgba(162, 95, 14, 0.2);
}
.podium-name {
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
  color: #49352C;
  font-size: 10.5px;
  font-weight: 800;
}
.podium-score {
  color: #C77A1F;
  font-size: 10.5px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.podium-base {
  width: 100%;
  height: 42px;
  margin-top: 1px;
  border-radius: 11px 11px 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  font-weight: 900;
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 2px 0 rgba(120, 62, 10, 0.2);
}
.podium-item.p1 .podium-base {
  height: 62px;
  background: linear-gradient(180deg, #FFE29A, #FFC24B);
  color: #7C490B;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.55);
}
.podium-item.p2 .podium-base {
  height: 48px;
  background: linear-gradient(180deg, #E6EEF4, #BCCDDB);
  color: #52677A;
}
.podium-item.p3 .podium-base {
  height: 38px;
  background: linear-gradient(180deg, #FFD3A7, #E79E65);
  color: #7C471A;
}
.rank-list {
  flex: 1;
  min-height: 80px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 2px 1px 8px;
  overscroll-behavior: contain;
}
.rank-row {
  display: grid;
  grid-template-columns: 24px 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 8px;
  margin-bottom: 6px;
  border-radius: 12px;
  background: #FFFFFF;
  border: 1px solid #F4E7D8;
}
.rank-row.me { background: #FFF0DA; border-color: #FFB56A; box-shadow: 0 4px 12px rgba(214, 122, 31, 0.1); }
.rank-num {
  text-align: center;
  color: #B3A091;
  font-size: 12px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}
.rank-row .avatar { width: 34px; height: 34px; font-size: 13px; border-width: 1.5px; }
.rank-main { min-width: 0; }
.rank-main b {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #44312B;
  font-size: 12.5px;
  font-weight: 800;
}
.rank-main small {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-top: 1px;
  color: #B39C87;
  font-size: 9px;
}
.me-chip {
  padding: 1px 5px;
  border-radius: 5px;
  background: #FF8A3D;
  color: #FFF8EE !important;
  font-size: 8px !important;
  font-weight: 800;
}
.rank-score {
  color: #8C5A26;
  font-size: 12.5px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.rank-empty, .rank-loading {
  padding: 28px 12px;
  text-align: center;
  color: #AB9784;
  font-size: 12px;
  line-height: 1.6;
}
.rank-footer {
  flex: none;
  margin-top: 2px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #2A193F;
  color: #FFF3DE;
  font-size: 11.5px;
  font-weight: 700;
  text-align: center;
  line-height: 1.5;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}
.rank-footer b { color: #FFD166; font-weight: 900; }

/* strategy event */
#eventModal { z-index: 72; }
.event-card {
  position: relative;
  width: 100%;
  max-width: 400px;
  margin: auto;
  padding: 17px 16px 15px;
  border-radius: 25px;
  background:
    radial-gradient(100% 50% at 50% 0%, #FFFDF9, transparent 62%),
    linear-gradient(180deg, #FFF9F0, #FFF1E1);
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45), inset 0 1px 0 #FFF;
}
.event-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.event-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 9px;
  border-radius: 999px;
  background: #FFE6C6;
  color: #C76015;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.06em;
}
.event-tag .mp-icon { width: 13px; height: 13px; }
.event-live {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #A58B72;
  font-size: 9.5px;
  font-weight: 700;
}
.event-live .live-dot { width: 5px; height: 5px; }
.event-icon {
  width: 58px;
  height: 58px;
  margin: 12px auto 8px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  color: #FFF8EC;
  background: linear-gradient(145deg, #FFB05F, #FF6F2B);
  box-shadow: 0 8px 20px rgba(255, 111, 43, 0.28), inset 0 2px 0 rgba(255, 255, 255, 0.24);
  transform: rotate(-3deg);
}
.event-icon .mp-icon { width: 32px; height: 32px; }
.event-card h2 {
  text-align: center;
  color: #2E1E32;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: -0.02em;
}
.event-desc {
  margin: 6px auto 0;
  max-width: 310px;
  text-align: center;
  color: #806D66;
  font-size: 12px;
  line-height: 1.6;
}
.event-choices { margin-top: 13px; display: grid; gap: 8px; }
.choice-btn {
  width: 100%;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 15px;
  align-items: center;
  gap: 9px;
  padding: 10px;
  border-radius: 15px;
  text-align: left;
  background: #FFFFFF;
  border: 1px solid #F0DDC6;
  box-shadow: 0 4px 12px rgba(102, 61, 24, 0.05);
  transition: transform 0.1s ease, border-color 0.2s ease;
}
.choice-btn:active { transform: scale(0.98); }
.choice-btn.gain { border-color: #F6D4B0; }
.choice-btn.rep { border-color: #BCE8E0; }
.choice-icon {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  color: #D96A1C;
  background: #FFF0DC;
}
.choice-btn.rep .choice-icon { color: #128F82; background: #E2F8F4; }
.choice-icon .mp-icon { width: 21px; height: 21px; }
.choice-copy { min-width: 0; }
.choice-copy b {
  display: block;
  color: #3F2C31;
  font-size: 13px;
  font-weight: 900;
  line-height: 1.25;
}
.choice-copy small {
  display: block;
  margin-top: 2px;
  color: #9A867A;
  font-size: 10.5px;
  line-height: 1.4;
}
.choice-arrow { color: #C8B4A1; }
.choice-arrow .mp-icon { width: 15px; height: 15px; }
.event-foot {
  margin-top: 10px;
  text-align: center;
  color: #B29C88;
  font-size: 9.5px;
}

/* toast */
.toast {
  position: fixed;
  left: 50%;
  top: 45%;
  z-index: 90;
  max-width: calc(100vw - 48px);
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(29, 16, 47, 0.94);
  border: 1px solid rgba(255, 209, 138, 0.28);
  color: #FFF3DC;
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.4;
  text-align: center;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.36);
  opacity: 0;
  transform: translate(-50%, 10px);
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* animations */
@keyframes moneyBump { 50% { transform: scale(1.045); } }
@keyframes cueFloat { 0%, 100% { transform: translate(-50%, -50%); } 50% { transform: translate(-50%, calc(-50% - 4px)); } }
@keyframes cueTap { 40% { transform: translate(-50%, -50%) scale(0.94); } }
@keyframes ringPulse {
  0% { transform: scale(0.94); opacity: 0.75; }
  75%, 100% { transform: scale(1.12); opacity: 0; }
}
@keyframes livePulse {
  0% { box-shadow: 0 0 0 0 rgba(91, 231, 183, 0.55); }
  70% { box-shadow: 0 0 0 5px rgba(91, 231, 183, 0); }
  100% { box-shadow: 0 0 0 0 rgba(91, 231, 183, 0); }
}
@keyframes readyPulse {
  0%, 100% { box-shadow: 0 5px 0 #D95F17, 0 10px 20px rgba(255, 122, 45, 0.24); }
  50% { box-shadow: 0 5px 0 #D95F17, 0 10px 26px rgba(255, 138, 61, 0.56); }
}
@keyframes floatUp {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.7); }
  16% { opacity: 1; transform: translate(-50%, -62%) scale(1.08); }
  100% { opacity: 0; transform: translate(-50%, -155%) scale(1); }
}
@keyframes rippleOut {
  0% { opacity: 0.9; transform: scale(0.4); }
  100% { opacity: 0; transform: scale(1.35); }
}
@keyframes coinFly {
  0% { opacity: 1; transform: translate(0, 0) scale(1); }
  100% { opacity: 0; transform: translate(var(--dx, 0px), var(--dy, -46px)) scale(0.4); }
}
@keyframes coinBob { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-5px) rotate(3deg); } }
@keyframes cardNudge {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  55% { transform: translateX(4px); }
  80% { transform: translateX(-2px); }
}

/* small screens */
@media (max-width: 370px) {
  .stage { height: 410px; min-height: 410px; }
  .hud { padding-left: 13px; padding-right: 13px; }
  .wallet { left: 13px; right: 13px; padding-left: 13px; padding-right: 13px; }
  .panel { padding-left: 13px; padding-right: 13px; }
  .up-card { grid-template-columns: 46px minmax(0, 1fr) 72px; gap: 8px; }
  .up-icon { width: 46px; height: 46px; }
  .buy-btn { width: 72px; height: 53px; }
  .buy-btn span { font-size: 11.5px; }
  .buy-btn small { font-size: 11px; }
  .panel-head h2 { font-size: 18px; }
  .tap-cue { padding: 9px 14px; font-size: 13px; }
  .quick-stats { gap: 6px; padding-left: 9px; padding-right: 9px; }
  .quick-stats b { font-size: 13px; }
  .rank-link { font-size: 10px; padding-left: 7px; }
}

@media (min-width: 560px) {
  body { background: #120A1F; }
  .app { box-shadow: 0 0 70px rgba(0, 0, 0, 0.55); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
