:root {
  --theme: #FF8A3D;
  --theme-deep: #E56412;
  --gold: #FFD45A;
  --gold-deep: #F2A413;
  --navy: #123F6C;
  --navy-deep: #0A2847;
  --cream: #FFF9EC;
  --cream-2: #FFEBC7;
  --ink: #44260B;
  --muted: #8A6740;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --hud-h: 46px;
}

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

html,
body {
  height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  overscroll-behavior: none;
  background: #0a2a48;
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

button,
input {
  font-family: inherit;
}

button {
  border: 0;
  padding: 0;
  background: none;
  color: inherit;
  cursor: pointer;
  outline: none;
}

b {
  font-weight: 900;
}

/* ---------- app shell ---------- */
.app {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: #6EC4F8;
  touch-action: manipulation;
  isolation: isolate;
}

@media (min-width: 720px) {
  .app {
    left: 50%;
    right: auto;
    width: 430px;
    transform: translateX(-50%);
    border-radius: 28px;
    box-shadow: 0 36px 90px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.12);
  }
}

/* ---------- scene ---------- */
.scene {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-image: url("images/gen/scene-portrait.jpg");
  background-position: center top;
  background-size: cover;
  background-repeat: no-repeat;
  transform-origin: top center;
  transition: transform 0.75s cubic-bezier(0.22, 0.82, 0.24, 1), filter 0.55s ease;
  will-change: transform;
}

.scene-glow {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(120% 42% at 50% 0%, rgba(255, 255, 255, 0.26), transparent 62%),
    linear-gradient(180deg, rgba(17, 76, 135, 0.30) 0%, rgba(16, 73, 130, 0.04) 26%, rgba(255, 255, 255, 0) 48%, rgba(255, 191, 117, 0.10) 100%);
}

.is-playing .scene {
  transform: scale(1.06);
  filter: blur(3px) brightness(0.9) saturate(1.06);
}

.is-ended .scene {
  transform: scale(1.04);
  filter: blur(4px) brightness(0.78) saturate(0.92);
}

.is-playing .scene-glow {
  background:
    radial-gradient(120% 45% at 50% 0%, rgba(10, 51, 94, 0.34), transparent 66%),
    linear-gradient(180deg, rgba(10, 51, 94, 0.28) 0%, rgba(10, 51, 94, 0.05) 30%, rgba(6, 30, 56, 0.10) 72%, rgba(6, 30, 56, 0.36) 100%);
}

/* ---------- HUD ---------- */
.hud {
  position: absolute;
  top: calc(var(--safe-top) + 9px);
  left: 0;
  right: 0;
  z-index: 30;
  padding: 0 12px;
  pointer-events: none;
}

.hud-row {
  display: flex;
  align-items: center;
  gap: 7px;
  max-width: 560px;
  margin: 0 auto;
}

.coin-pill,
.timer-pill {
  height: var(--hud-h);
  border-radius: 999px;
  display: flex;
  align-items: center;
  color: #fff;
  background: linear-gradient(180deg, #2E77B4 0%, #1A5185 46%, #103A64 100%);
  border: 2px solid var(--gold);
  box-shadow:
    0 4px 0 rgba(6, 28, 52, 0.58),
    0 9px 18px rgba(6, 34, 65, 0.26),
    inset 0 2px 0 rgba(255, 255, 255, 0.30),
    inset 0 -3px 6px rgba(3, 22, 44, 0.35);
  pointer-events: auto;
}

.coin-pill {
  flex: 0 1 auto;
  min-width: 0;
  padding: 0 11px 0 0;
  gap: 1px;
}

.hud-icon {
  display: block;
  flex: 0 0 auto;
  pointer-events: none;
  filter: drop-shadow(0 2px 2px rgba(4, 24, 45, 0.32));
}

.coin-icon {
  width: 43px;
  height: 43px;
  margin: -3px 1px -3px -4px;
}

.coin-num {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 17px;
  font-weight: 900;
  letter-spacing: 0.3px;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 3px rgba(0, 0, 0, 0.35);
}

.coin-pill.bump .coin-icon {
  animation: coinBump 0.45s ease-out;
}

@keyframes coinBump {
  0% { transform: scale(1) rotate(0); }
  36% { transform: scale(1.2) rotate(-7deg); }
  70% { transform: scale(0.96) rotate(3deg); }
  100% { transform: scale(1) rotate(0); }
}

.timer-pill {
  flex: 0 0 auto;
  margin: 0 auto;
  padding: 0 10px 0 0;
  gap: 2px;
  min-width: 108px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.clock-icon {
  width: 45px;
  height: 43px;
  margin-left: -2px;
}

.timer-num {
  font-size: 19px;
  font-weight: 900;
  letter-spacing: 0.7px;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 3px rgba(0, 0, 0, 0.38);
}

.timer-pill.urgent {
  border-color: #FFB4A0;
  background: linear-gradient(180deg, #E8503A 0%, #C6291F 48%, #971711 100%);
  animation: timerUrgent 0.9s ease-in-out infinite;
}

.timer-pill.urgent .timer-num {
  color: #FFF3B8;
}

@keyframes timerUrgent {
  0%, 100% { transform: scale(1); box-shadow: 0 4px 0 rgba(76, 9, 4, 0.55), 0 9px 18px rgba(90, 12, 6, 0.30), inset 0 2px 0 rgba(255, 255, 255, 0.26); }
  50% { transform: scale(1.045); box-shadow: 0 4px 0 rgba(76, 9, 4, 0.55), 0 0 20px rgba(255, 126, 88, 0.62), inset 0 2px 0 rgba(255, 255, 255, 0.26); }
}

.withdraw-btn {
  flex: 0 0 auto;
  height: var(--hud-h);
  padding: 0 13px 0 4px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 2px;
  color: #733300;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0.5px;
  background: linear-gradient(180deg, #FFF2A8 0%, #FFD155 36%, #FFB01E 68%, #F08B05 100%);
  border: 2px solid #FFF6C7;
  box-shadow:
    0 4px 0 #AE5D00,
    0 9px 18px rgba(74, 35, 0, 0.28),
    inset 0 2px 0 rgba(255, 255, 255, 0.88),
    inset 0 -3px 5px rgba(174, 73, 0, 0.28);
  pointer-events: auto;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}

.withdraw-btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #AE5D00, 0 4px 9px rgba(74, 35, 0, 0.24), inset 0 2px 0 rgba(255, 255, 255, 0.7);
}

.wallet-icon {
  width: 36px;
  height: 33px;
  margin-left: -2px;
}

.withdraw-btn.ready {
  animation: withdrawReady 1.7s ease-in-out infinite;
}

@keyframes withdrawReady {
  0%, 100% { box-shadow: 0 4px 0 #AE5D00, 0 9px 18px rgba(74, 35, 0, 0.28), inset 0 2px 0 rgba(255, 255, 255, 0.88); }
  50% { box-shadow: 0 4px 0 #AE5D00, 0 0 22px rgba(255, 196, 63, 0.92), inset 0 2px 0 rgba(255, 255, 255, 0.88); }
}

/* timer progress */
.timer-track {
  width: calc(100% - 16px);
  max-width: 360px;
  height: 4px;
  margin: 9px auto 0;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(5, 36, 67, 0.24);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.22);
  opacity: 0;
  transform: scaleY(0.6);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.is-playing .timer-track {
  opacity: 1;
  transform: none;
}

.timer-track span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #FFE177 0%, #FFC33E 55%, #FF8A3D 100%);
  box-shadow: 0 0 8px rgba(255, 218, 100, 0.7);
  transition: width 0.18s linear;
}

/* player */
.player-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 170px;
  margin: 7px 3px 0;
  padding: 3px 10px 3px 3px;
  border-radius: 999px;
  background: rgba(12, 52, 91, 0.38);
  border: 1px solid rgba(255, 255, 255, 0.34);
  box-shadow: 0 3px 10px rgba(6, 36, 68, 0.18);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.is-playing .player-chip {
  opacity: 0.72;
  transform: scale(0.94);
  transform-origin: left top;
}

.player-avatar {
  width: 23px;
  height: 23px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 245, 205, 0.92);
  object-fit: cover;
  background: #FFE9C9;
  flex: 0 0 auto;
}

.player-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.2px;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

/* ---------- idle ---------- */
.idle-panel {
  position: absolute;
  left: 50%;
  bottom: calc(26px + var(--safe-bottom));
  transform: translateX(-50%);
  z-index: 24;
  width: min(90vw, 390px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  transition: opacity 0.3s ease, transform 0.38s cubic-bezier(0.3, 1.3, 0.5, 1), visibility 0.3s;
}

.is-playing .idle-panel,
.is-ended .idle-panel {
  opacity: 0;
  visibility: hidden;
  transform: translateX(-50%) translateY(24px) scale(0.94);
  pointer-events: none;
}

.idle-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 12px 0 8px;
  border-radius: 999px;
  color: #77380A;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.4px;
  background: linear-gradient(180deg, #FFF7D2 0%, #FFE39A 100%);
  border: 1px solid #FFFDF0;
  box-shadow: 0 3px 0 rgba(154, 82, 10, 0.35), 0 6px 12px rgba(77, 38, 0, 0.16);
}

 .idle-badge .mp-icon {
  width: 16px;
  height: 16px;
  color: #E36A12;
}

.start-btn {
  position: relative;
  display: block;
  width: min(78vw, 338px);
  border-radius: 999px;
  filter: drop-shadow(0 11px 12px rgba(86, 38, 0, 0.30));
  transition: transform 0.1s ease, filter 0.1s ease;
}

.start-btn img {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;
}

.start-btn::before {
  content: "";
  position: absolute;
  inset: -12% -8%;
  z-index: -1;
  border-radius: 999px;
  background: radial-gradient(50% 50% at 50% 50%, rgba(255, 231, 122, 0.55), rgba(255, 231, 122, 0) 72%);
  animation: startGlow 2.4s ease-in-out infinite;
  pointer-events: none;
}

.start-btn:active {
  transform: translateY(4px) scale(0.985);
  filter: drop-shadow(0 4px 6px rgba(86, 38, 0, 0.32)) brightness(0.98);
}

@keyframes startGlow {
  0%, 100% { opacity: 0.55; transform: scale(0.98); }
  50% { opacity: 1; transform: scale(1.03); }
}

.start-ad {
  position: absolute;
  top: -13px;
  right: 7px;
  display: none;
  align-items: center;
  gap: 4px;
  height: 25px;
  padding: 0 10px 0 7px;
  border-radius: 999px;
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.3px;
  background: linear-gradient(180deg, #FF7D5B, #E63922);
  border: 1.5px solid #FFD7BD;
  box-shadow: 0 3px 8px rgba(105, 21, 5, 0.35);
}

.start-ad .mp-icon {
  width: 14px;
  height: 14px;
}

.start-ad.show {
  display: inline-flex;
}

.idle-note,
.idle-rate {
  border-radius: 999px;
  color: #64320C;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  padding: 5px 12px;
  background: rgba(255, 252, 241, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.92);
  box-shadow: 0 3px 10px rgba(59, 30, 0, 0.13);
  -webkit-backdrop-filter: blur(7px);
  backdrop-filter: blur(7px);
}

.idle-note b {
  color: #E5570F;
  font-size: 13px;
}

.idle-rate {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #8A5A2B;
  font-size: 11px;
}

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

/* ---------- play hint ---------- */
.play-tip {
  position: absolute;
  left: 50%;
  bottom: calc(30px + var(--safe-bottom));
  z-index: 18;
  transform: translateX(-50%) translateY(10px);
  display: flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 16px 0 11px;
  border-radius: 999px;
  color: #FFEDB0;
  font-size: 12.5px;
  font-weight: 800;
  white-space: nowrap;
  background: rgba(9, 39, 70, 0.58);
  border: 1px solid rgba(255, 224, 150, 0.38);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.22);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
}

.play-tip .mp-icon {
  width: 18px;
  height: 18px;
  color: #FFD45A;
}

.is-playing .play-tip {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%);
}

.is-playing.hint-off .play-tip {
  opacity: 0;
  visibility: hidden;
}

/* ---------- envelopes ---------- */
.game-layer {
  position: absolute;
  inset: 0;
  z-index: 10;
  pointer-events: none;
}

.env {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
  padding: 0;
  border: 0;
  background: transparent;
  pointer-events: auto;
  cursor: pointer;
  will-change: transform;
  filter: drop-shadow(0 10px 10px rgba(102, 30, 0, 0.26));
  -webkit-user-drag: none;
}

.env img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  transition: transform 0.1s ease, filter 0.1s ease;
  -webkit-user-drag: none;
}

.env::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 68%;
  width: 34%;
  height: 58%;
  transform: translateX(-50%);
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(255, 241, 182, 0) 0%, rgba(255, 202, 76, 0.48) 58%, rgba(255, 162, 46, 0.12) 100%);
  filter: blur(5px);
  opacity: 0.7;
  pointer-events: none;
  z-index: -1;
}

.env:active img {
  transform: scale(0.9) rotate(-2deg);
  filter: brightness(1.12);
}

.env.is-ambient {
  pointer-events: none;
  opacity: 0.88;
}

.env.is-opening {
  pointer-events: none;
}

.env.is-opening img {
  animation: envPop 0.34s ease-out forwards;
}

@keyframes envPop {
  0% { transform: scale(1); filter: brightness(1); }
  45% { transform: scale(1.16); filter: brightness(1.45); }
  100% { transform: scale(0.4); opacity: 0; }
}

.env.is-claimed {
  pointer-events: none;
  filter: drop-shadow(0 0 12px rgba(255, 214, 97, 0.9));
}

.env.is-claimed img {
  filter: saturate(1.2) brightness(1.12);
}

/* ---------- fx ---------- */
.fx-layer {
  position: absolute;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  overflow: hidden;
}

.float-coin {
  position: absolute;
  transform: translate(-50%, -50%);
  color: #FFE67A;
  font-size: 19px;
  font-weight: 900;
  letter-spacing: 0.3px;
  text-shadow: 0 2px 0 #B85A00, 0 4px 8px rgba(76, 24, 0, 0.35);
  animation: floatCoin 1s cubic-bezier(0.18, 0.72, 0.38, 1) forwards;
  white-space: nowrap;
}

@keyframes floatCoin {
  0% { opacity: 0; transform: translate(-50%, -40%) scale(0.7); }
  22% { opacity: 1; transform: translate(-50%, -95%) scale(1.08); }
  100% { opacity: 0; transform: translate(-50%, -210%) scale(1); }
}

.burst {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
}

.burst .spark {
  position: absolute;
  left: 0;
  top: 0;
  width: 9px;
  height: 9px;
  margin: -4px;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #FFF7C0, #FFD24A 42%, #F59A0B 100%);
  box-shadow: 0 0 7px rgba(255, 205, 70, 0.85);
  animation: sparkFly 0.72s ease-out forwards;
}

@keyframes sparkFly {
  0% { transform: translate(0, 0) scale(1); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(0.2); opacity: 0; }
}

/* reward pop */
.reward-pop {
  position: absolute;
  left: 50%;
  top: 43%;
  z-index: 55;
  transform: translate(-50%, -50%) scale(0.75);
  display: flex;
  align-items: center;
  gap: 9px;
  width: min(78vw, 300px);
  padding: 11px 12px 11px 11px;
  border-radius: 20px;
  color: #fff;
  background: linear-gradient(135deg, rgba(24, 86, 142, 0.96), rgba(10, 51, 92, 0.97));
  border: 2px solid rgba(255, 217, 114, 0.92);
  box-shadow: 0 18px 40px rgba(4, 27, 52, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.28);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.28s cubic-bezier(0.2, 1.5, 0.4, 1), visibility 0.2s;
}

.reward-pop.show {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
}

.reward-pop-ico {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #8A4300;
  background: radial-gradient(circle at 36% 28%, #FFF8CE, #FFD557 48%, #FFA719 100%);
  border: 1.5px solid #FFF4BE;
  box-shadow: 0 3px 7px rgba(69, 30, 0, 0.28), inset 0 1px 2px #fff;
}

.reward-pop-ico .mp-icon {
  width: 23px;
  height: 23px;
}

.reward-pop-main {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.reward-pop-main b {
  font-size: 21px;
  line-height: 1.05;
  color: #FFE273;
  letter-spacing: 0.3px;
  text-shadow: 0 2px 0 rgba(88, 35, 0, 0.4);
  font-variant-numeric: tabular-nums;
}

.reward-pop-main span {
  font-size: 11px;
  font-weight: 700;
  color: rgba(255, 241, 202, 0.86);
  letter-spacing: 0.4px;
}

.reward-pop-gift {
  width: 61px;
  height: 54px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid rgba(255, 232, 164, 0.75);
  box-shadow: 0 4px 10px rgba(39, 17, 0, 0.25);
  flex: 0 0 auto;
}

/* ---------- toast ---------- */
.toast {
  position: absolute;
  top: calc(var(--safe-top) + 74px);
  left: 50%;
  z-index: 120;
  max-width: 82vw;
  padding: 9px 16px;
  border-radius: 999px;
  color: #fff;
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.35;
  text-align: center;
  background: rgba(8, 35, 63, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.3);
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, -8px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
  pointer-events: none;
}

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

/* ---------- modals ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 14px 12px calc(14px + var(--safe-bottom));
  background: rgba(4, 21, 40, 0.62);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.22s ease, visibility 0.22s;
}

.modal.center {
  align-items: center;
}

.modal.show {
  opacity: 1;
  visibility: visible;
}

.sheet {
  position: relative;
  width: 100%;
  max-width: 420px;
  max-height: 88vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 22px 20px calc(18px + var(--safe-bottom) * 0.4);
  border-radius: 26px;
  color: var(--ink);
  background:
    radial-gradient(120% 50% at 50% 0%, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0) 60%),
    linear-gradient(180deg, #FFFDF6 0%, #FFF3D9 100%);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.45), inset 0 1px 0 #fff;
  transform: translateY(20px) scale(0.98);
  transition: transform 0.26s cubic-bezier(0.2, 0.9, 0.3, 1.08);
}

.modal.show .sheet {
  transform: none;
}

.sheet-title {
  margin: 0;
  font-size: 21px;
  line-height: 1.2;
  font-weight: 900;
  letter-spacing: 0.4px;
  text-align: center;
  color: #3E2308;
}

.sheet-sub {
  margin: 7px 0 0;
  font-size: 12.5px;
  line-height: 1.55;
  font-weight: 600;
  text-align: center;
  color: #936B3F;
}

.sheet-note {
  margin: 11px 0 0;
  font-size: 11px;
  line-height: 1.5;
  text-align: center;
  color: #A47C4E;
}

.close-x {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #7F5B33;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(205, 166, 114, 0.35);
  box-shadow: 0 2px 6px rgba(94, 55, 10, 0.10);
}

.close-x .mp-icon {
  width: 19px;
  height: 19px;
}

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

/* primary / secondary buttons */
.btn-primary {
  width: 100%;
  height: 52px;
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 999px;
  color: #6B3100;
  font-size: 16.5px;
  font-weight: 900;
  letter-spacing: 0.4px;
  background: linear-gradient(180deg, #FFF2A6 0%, #FFD45C 36%, #FFB321 70%, #F2920A 100%);
  border: 2px solid #FFF7CF;
  box-shadow: 0 5px 0 #B85F00, 0 10px 18px rgba(110, 54, 0, 0.18), inset 0 2px 0 rgba(255, 255, 255, 0.86);
  transition: transform 0.08s ease, box-shadow 0.08s ease, filter 0.12s ease;
}

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

.btn-primary:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #B85F00, 0 5px 10px rgba(110, 54, 0, 0.16), inset 0 2px 0 rgba(255, 255, 255, 0.76);
}

.btn-primary:disabled {
  color: #9B805D;
  background: linear-gradient(180deg, #F1E7D4 0%, #E5D5BB 100%);
  border-color: #F7EFDD;
  box-shadow: 0 3px 0 #C3AE8F, inset 0 1px 0 rgba(255, 255, 255, 0.8);
  transform: none;
}

.btn-text {
  width: 100%;
  height: 42px;
  margin-top: 6px;
  color: #8C6537;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

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

/* ---------- ad modal ---------- */
.ad-sheet {
  padding-top: 17px;
}

.ad-label {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 10px;
  padding-right: 34px;
  font-size: 11.5px;
  font-weight: 700;
  color: #8E6A43;
}

.ad-tag {
  flex: 0 0 auto;
  padding: 2px 7px;
  border-radius: 5px;
  color: #fff;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.6px;
  background: linear-gradient(180deg, #FFA16F, #F26A34);
}

.ad-media {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 18px;
  background: #2C84C9;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.3), 0 8px 18px rgba(72, 35, 0, 0.14);
}

.ad-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 35%;
  display: block;
}

.ad-media-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(4, 22, 40, 0.12), rgba(4, 22, 40, 0) 42%, rgba(4, 22, 40, 0.44));
}

.ad-caption {
  position: absolute;
  left: 11px;
  bottom: 9px;
  color: #FFF6D6;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.4px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

.ad-count {
  position: absolute;
  top: 9px;
  right: 9px;
  min-width: 28px;
  height: 28px;
  padding: 0 6px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 14px;
  font-weight: 900;
  background: rgba(5, 25, 45, 0.68);
  border: 1px solid rgba(255, 255, 255, 0.35);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.ad-title {
  margin-top: 13px;
  text-align: center;
  font-size: 18px;
  font-weight: 900;
  color: #3E2308;
}

.ad-desc {
  margin-top: 3px;
  text-align: center;
  font-size: 12.5px;
  font-weight: 600;
  color: #8F6A40;
}

.ad-progress {
  height: 7px;
  margin-top: 13px;
  border-radius: 999px;
  overflow: hidden;
  background: #F0DFC2;
  box-shadow: inset 0 1px 2px rgba(113, 68, 20, 0.14);
}

.ad-progress span {
  display: block;
  width: 8%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #FFD45A, #FF9F25);
  box-shadow: 0 0 8px rgba(255, 190, 61, 0.7);
  transition: width 0.3s linear;
}

.ad-note {
  margin-top: 9px;
  text-align: center;
  font-size: 10.5px;
  color: #A78153;
}

/* ---------- end modal ---------- */
.end-sheet {
  padding-top: 28px;
  text-align: center;
  overflow: visible;
}

.end-ribbon {
  position: absolute;
  top: -13px;
  left: 50%;
  transform: translateX(-50%);
  height: 28px;
  padding: 0 18px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 1px;
  background: linear-gradient(180deg, #FF9A5C, #EF5C1D);
  border: 1.5px solid #FFE2BE;
  box-shadow: 0 3px 8px rgba(128, 38, 5, 0.28);
}

.end-clock {
  width: 60px;
  height: 60px;
  margin: 0 auto 9px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #A45C00;
  background: radial-gradient(circle at 36% 28%, #FFF6C7, #FFD661 42%, #FFAF24 100%);
  border: 2px solid #FFF3BD;
  box-shadow: 0 5px 0 #C47700, 0 10px 18px rgba(111, 53, 0, 0.18), inset 0 2px 3px #fff;
}

.end-clock .mp-icon {
  width: 34px;
  height: 34px;
}

.stat-row {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.stat-card {
  flex: 1 1 0;
  min-width: 0;
  padding: 11px 6px 10px;
  border-radius: 17px;
  background: linear-gradient(180deg, #FFFFFF, #FFF6E3);
  border: 1px solid #F2DCB6;
  box-shadow: 0 4px 10px rgba(103, 58, 10, 0.07), inset 0 1px 0 #fff;
}

.stat-card b {
  display: block;
  font-size: 23px;
  line-height: 1.05;
  color: #4B2A0A;
  font-variant-numeric: tabular-nums;
}

.stat-card span {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  font-weight: 700;
  color: #987249;
}

.stat-card.gold {
  background: linear-gradient(180deg, #FFF9DE, #FFEAB8);
  border-color: #F5D58D;
}

.stat-card.gold b {
  color: #C55B00;
}

/* ---------- withdraw ---------- */
.withdraw-sheet {
  padding-top: 16px;
}

.wallet-hero {
  position: relative;
  width: 74px;
  height: 66px;
  margin: 0 auto 7px;
  display: grid;
  place-items: center;
}

.wallet-hero img {
  position: relative;
  z-index: 1;
  width: 70px;
  height: 62px;
  object-fit: contain;
  filter: drop-shadow(0 5px 6px rgba(111, 55, 0, 0.22));
}

.wallet-halo {
  position: absolute;
  inset: -18px -20px;
  border-radius: 50%;
  background: radial-gradient(50% 50% at 50% 50%, rgba(255, 221, 119, 0.72), rgba(255, 221, 119, 0) 70%);
}

.balance-card {
  margin-top: 14px;
  padding: 13px 14px 12px;
  border-radius: 18px;
  background: linear-gradient(180deg, #FFFDF7, #FFF7E8);
  border: 1px solid #F0DAB5;
  box-shadow: inset 0 1px 0 #fff, 0 4px 10px rgba(103, 58, 10, 0.05);
}

.balance-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: 12.5px;
  font-weight: 700;
  color: #8C6537;
  line-height: 1.7;
}

.balance-line b {
  font-size: 17px;
  color: #4B2A0A;
  font-variant-numeric: tabular-nums;
}

.balance-line b.accent {
  color: #E2650F;
}

.progress {
  height: 8px;
  margin-top: 9px;
  border-radius: 999px;
  overflow: hidden;
  background: #F1DFC0;
  box-shadow: inset 0 1px 2px rgba(113, 68, 20, 0.15);
}

.progress span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #FFD75A, #FFA92A 62%, #FF7A2F);
  box-shadow: 0 0 8px rgba(255, 182, 55, 0.6);
  transition: width 0.45s cubic-bezier(0.2, 0.8, 0.3, 1);
}

.progress-tip {
  margin-top: 7px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.4;
  color: #A17A4C;
}

.progress-tip.ok {
  color: #D45C00;
}

.field-label {
  display: block;
  margin: 14px 2px 6px;
  font-size: 12.5px;
  font-weight: 800;
  color: #6E4822;
}

.field {
  display: block;
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border-radius: 14px;
  color: #3E2308;
  font-size: 15px;
  font-weight: 600;
  background: #FFFDF9;
  border: 1.5px solid #E9CFA5;
  box-shadow: inset 0 2px 4px rgba(117, 71, 21, 0.05);
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.field::placeholder {
  color: #BBA17E;
  font-weight: 500;
}

.field:focus {
  border-color: #FFAB4A;
  box-shadow: 0 0 0 3px rgba(255, 150, 61, 0.16), inset 0 2px 4px rgba(117, 71, 21, 0.04);
}

/* ---------- success ---------- */
.success-sheet {
  text-align: center;
  padding-top: 27px;
}

.success-mark {
  width: 66px;
  height: 66px;
  margin: 0 auto 10px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(180deg, #8FE27B, #3EB653);
  border: 3px solid #E9FFD9;
  box-shadow: 0 6px 0 #2A8D3C, 0 12px 22px rgba(25, 112, 45, 0.24), inset 0 2px 3px rgba(255, 255, 255, 0.5);
  animation: successIn 0.45s cubic-bezier(0.2, 1.5, 0.4, 1);
}

.success-mark .mp-icon {
  width: 38px;
  height: 38px;
}

@keyframes successIn {
  0% { transform: scale(0.4); opacity: 0; }
  70% { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(1); }
}

.success-amount {
  margin-top: 13px;
  font-size: 32px;
  font-weight: 900;
  line-height: 1.1;
  color: #E2650F;
  letter-spacing: 0.5px;
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.8);
}

.success-desc {
  margin-top: 7px;
}

/* ---------- small screens ---------- */
@media (max-width: 370px) {
  :root {
    --hud-h: 42px;
  }

  .hud {
    padding: 0 9px;
  }

  .hud-row {
    gap: 5px;
  }

  .coin-icon {
    width: 39px;
    height: 39px;
  }

  .coin-num {
    font-size: 15px;
  }

  .coin-pill {
    padding-right: 8px;
  }

  .clock-icon {
    width: 41px;
    height: 39px;
  }

  .timer-num {
    font-size: 17px;
  }

  .timer-pill {
    min-width: 98px;
  }

  .withdraw-btn {
    padding-right: 10px;
    font-size: 13px;
  }

  .wallet-icon {
    width: 32px;
    height: 29px;
  }

  .player-chip {
    max-width: 150px;
  }

  .idle-panel {
    gap: 8px;
  }

  .idle-note,
  .idle-rate {
    font-size: 11px;
  }

  .sheet {
    padding: 20px 16px 16px;
    border-radius: 23px;
  }
}

@media (max-height: 700px) {
  .idle-panel {
    bottom: calc(17px + var(--safe-bottom));
    gap: 7px;
  }

  .idle-badge {
    height: 25px;
    font-size: 11px;
  }

  .start-btn {
    width: min(70vw, 300px);
  }

  .sheet {
    max-height: 91vh;
  }

  .end-clock {
    width: 52px;
    height: 52px;
    margin-bottom: 6px;
  }

  .end-clock .mp-icon {
    width: 29px;
    height: 29px;
  }
}

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