:root {
  --orange: #FF8A3D;
  --orange-hi: #FFB36B;
  --orange-deep: #B84F17;
  --ink: #1A0E22;
  --ink-2: #2A1020;
  --cream: #FFF2DE;
  --cyan: #59E6FF;
  --cyan-deep: #0E6C80;
  --violet: #8B6CFF;
  --danger: #FF5A6B;
  --panel: rgba(28, 17, 43, .82);
  --line: rgba(255, 242, 222, .14);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0D0815;
  color: var(--cream);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-user-select: none;
  user-select: none;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}
body { position: fixed; inset: 0; -webkit-touch-callout: none; }
button, input { font-family: inherit; }
input { -webkit-user-select: text; user-select: text; }
button { cursor: pointer; }
.hidden { display: none !important; }

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

/* ---------- shared ---------- */
.avatar {
  position: relative;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50%;
  color: var(--ink-2);
  background:
    radial-gradient(circle at 32% 26%, #FFD7A9 0 18%, transparent 19%),
    linear-gradient(145deg, #FFC078 0%, #FF8A3D 58%, #E2601C 100%);
  border: 2px solid var(--ink-2);
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .28), 0 4px 12px rgba(0, 0, 0, .35);
  overflow: hidden;
}
.avatar .mp-icon { width: 60%; height: 60%; }
.avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  opacity: 0;
  transition: opacity .2s;
}
.avatar img.on { opacity: 1; }
.avatar-sm { width: 38px; height: 38px; }
.avatar-md { width: 44px; height: 44px; }
.avatar-lg { width: 76px; height: 76px; margin: 0 auto 8px; }

.btn {
  width: 100%;
  min-height: 50px;
  padding: 10px 16px;
  border-radius: 16px;
  border: 2px solid var(--ink-2);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: .02em;
  line-height: 1.2;
  touch-action: manipulation;
  transition: transform .08s ease, box-shadow .08s ease, filter .12s ease;
}
.btn .mp-icon { width: 22px; height: 22px; flex: 0 0 auto; }
.btn-primary {
  color: var(--ink-2);
  background: linear-gradient(180deg, #FFB873 0%, #FF8A3D 62%, #F07425 100%);
  box-shadow: 0 6px 0 var(--orange-deep), 0 12px 26px rgba(255, 138, 61, .3), inset 0 1px 0 rgba(255, 255, 255, .45);
}
.btn-ad {
  color: #3A1B12;
  background: linear-gradient(180deg, #FFF9EE 0%, #FFE3C2 100%);
  box-shadow: 0 6px 0 #B98A5F, 0 12px 24px rgba(0, 0, 0, .3), inset 0 1px 0 #fff;
}
.btn-ghost {
  color: var(--cream);
  background: rgba(28, 17, 43, .72);
  border-color: rgba(255, 242, 222, .28);
  box-shadow: 0 6px 0 rgba(0, 0, 0, .4), inset 0 1px 0 rgba(255, 255, 255, .12);
}
.btn:active { transform: translateY(4px); }
.btn-primary:active { box-shadow: 0 2px 0 var(--orange-deep), inset 0 1px 0 rgba(255, 255, 255, .4); }
.btn-ad:active { box-shadow: 0 2px 0 #B98A5F; }
.btn-ghost:active { box-shadow: 0 2px 0 rgba(0, 0, 0, .4); }
.btn[disabled], .btn.is-disabled { opacity: .5; filter: grayscale(.45); pointer-events: none; }

.ad-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 18px;
  padding: 0 5px;
  border-radius: 5px;
  background: var(--orange);
  border: 1px solid var(--ink-2);
  color: var(--ink-2);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .08em;
  flex: 0 0 auto;
}

.icon-btn {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(20, 12, 32, .7);
  color: var(--cream);
  display: grid;
  place-items: center;
  touch-action: manipulation;
}
.icon-btn .mp-icon { width: 19px; height: 19px; }
.icon-btn:active { transform: scale(.92); background: rgba(255, 138, 61, .25); }
.mini-btn {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(255, 242, 222, .24);
  background: rgba(255, 255, 255, .06);
  color: var(--cream);
  display: grid;
  place-items: center;
}
.mini-btn .mp-icon { width: 17px; height: 17px; }

/* ---------- HUD ---------- */
.hud {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: calc(var(--safe-top) + 9px) 12px 0;
  pointer-events: none;
}
.hud-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1 1 auto;
  max-width: 66%;
  padding: 7px 10px 8px 7px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(37, 23, 54, .86), rgba(18, 11, 29, .78));
  box-shadow: 0 8px 24px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .08);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.hud-bars { flex: 1 1 auto; min-width: 0; }
.hud-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
  margin-bottom: 4px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .04em;
}
.hud-meta span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: rgba(255, 242, 222, .9);
}
.hud-meta span:last-child { color: var(--orange); flex: 0 0 auto; }
.bar {
  position: relative;
  height: 7px;
  border-radius: 5px;
  overflow: hidden;
  background: rgba(0, 0, 0, .52);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .5);
}
.bar + .bar { margin-top: 4px; }
.bar i {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: inherit;
  transition: width .14s linear;
}
.bar.hp i { background: linear-gradient(90deg, #FF7A45, #FFC15E); box-shadow: 0 0 8px rgba(255, 138, 61, .6); }
.bar.hp i.low { background: linear-gradient(90deg, #FF3D5A, #FF7A45); animation: lowPulse .7s infinite alternate; }
.bar.en { height: 5px; }
.bar.en i { background: linear-gradient(90deg, #37C5E8, #7BF3FF); box-shadow: 0 0 7px rgba(89, 230, 255, .55); }
.hud-right {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  pointer-events: auto;
  flex: 0 0 auto;
}
.hud-nums {
  text-align: right;
  padding: 5px 9px 6px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(20, 12, 32, .72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .3);
}
.num span { display: block; font-size: 9px; color: rgba(255, 242, 222, .6); letter-spacing: .08em; }
.num b { display: block; font-size: 17px; line-height: 1.1; color: var(--cream); font-weight: 900; }
.scrap-mini {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
  margin-top: 2px;
  color: #FFC56E;
  font-size: 12px;
  font-weight: 900;
}
.scrap-mini .mp-icon { width: 13px; height: 13px; }
#btnSound { margin-top: 2px; flex: 0 0 auto; }

.boss-hud {
  position: fixed;
  top: calc(var(--safe-top) + 76px);
  left: 18px;
  right: 18px;
  z-index: 19;
  padding: 7px 11px 9px;
  border-radius: 12px;
  border: 1px solid rgba(255, 90, 107, .35);
  background: rgba(26, 10, 18, .8);
  box-shadow: 0 8px 26px rgba(0, 0, 0, .4), inset 0 0 22px rgba(255, 60, 80, .08);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.boss-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.boss-top span { font-size: 9px; letter-spacing: .18em; color: var(--danger); font-weight: 900; }
.boss-top b { font-size: 11px; color: var(--cream); letter-spacing: .06em; }
.bar.boss { height: 8px; }
.bar.boss i { background: linear-gradient(90deg, #A8233C, #FF5A6B 60%, #FFB36B); box-shadow: 0 0 10px rgba(255, 90, 107, .65); }

.combo {
  position: fixed;
  top: calc(var(--safe-top) + 128px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 19;
  font-size: 26px;
  font-weight: 900;
  font-style: italic;
  color: #FFD36A;
  text-shadow: 0 2px 0 #832D10, 0 0 18px rgba(255, 170, 60, .75);
  pointer-events: none;
  white-space: nowrap;
}
.combo span { font-size: 12px; font-style: normal; letter-spacing: .1em; color: var(--cream); }
.combo.pop { animation: comboPop .28s ease-out; }

.wave-banner {
  position: fixed;
  top: 27%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 18;
  width: 88%;
  max-width: 340px;
  text-align: center;
  pointer-events: none;
  opacity: 0;
}
.wave-banner.show { animation: bannerIn 2s ease-out forwards; }
.wave-banner b {
  display: block;
  font-size: 30px;
  font-weight: 900;
  letter-spacing: .04em;
  color: var(--cream);
  text-shadow: 0 3px 0 var(--orange-deep), 0 0 28px rgba(255, 138, 61, .7);
}
.wave-banner span {
  display: block;
  margin-top: 5px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .12em;
  color: #FFD7A9;
}

/* ---------- controls ---------- */
.controls {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 30px 16px calc(var(--safe-bottom) + 14px);
  pointer-events: none;
  background: linear-gradient(180deg, rgba(13, 8, 21, 0) 0%, rgba(13, 8, 21, .55) 42%, rgba(13, 8, 21, .9) 100%);
}
.move-pad, .action-pad { display: flex; align-items: flex-end; gap: 9px; pointer-events: auto; }
.move-pad { padding-bottom: 7px; }
.ctrl {
  position: relative;
  width: 60px;
  height: 60px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid rgba(255, 242, 222, .26);
  background: linear-gradient(180deg, rgba(62, 44, 82, .88), rgba(26, 16, 40, .9));
  color: var(--cream);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .06em;
  touch-action: none;
  box-shadow: 0 6px 0 rgba(0, 0, 0, .42), inset 0 1px 0 rgba(255, 255, 255, .16), 0 8px 20px rgba(0, 0, 0, .28);
  transition: transform .07s ease, box-shadow .07s ease, filter .07s ease;
}
.ctrl .mp-icon { width: 25px; height: 25px; }
.ctrl:active, .ctrl.active {
  transform: translateY(4px) scale(.97);
  filter: brightness(1.12);
  box-shadow: 0 2px 0 rgba(0, 0, 0, .42), inset 0 1px 0 rgba(255, 255, 255, .2);
}
.ctrl.jump {
  width: 54px;
  height: 54px;
  color: #07232B;
  border-color: #0B2C35;
  background: linear-gradient(180deg, #8CF1FF, #3CC8E6 72%, #1E9DBA);
  box-shadow: 0 6px 0 #0B5A6B, 0 8px 20px rgba(50, 200, 230, .25), inset 0 1px 0 rgba(255, 255, 255, .5);
}
.ctrl.fire {
  width: 54px;
  height: 54px;
  color: #180F2B;
  border-color: #2A1A4A;
  background: linear-gradient(180deg, #C6B2FF, #8B6CFF 72%, #6B49E0);
  box-shadow: 0 6px 0 #3E288E, 0 8px 20px rgba(139, 108, 255, .3), inset 0 1px 0 rgba(255, 255, 255, .4);
}
.ctrl.attack {
  width: 76px;
  height: 76px;
  color: var(--ink-2);
  border-color: var(--ink-2);
  background: linear-gradient(180deg, #FFC07A, #FF8A3D 68%, #EF6A1C);
  box-shadow: 0 7px 0 var(--orange-deep), 0 12px 26px rgba(255, 138, 61, .36), inset 0 2px 0 rgba(255, 255, 255, .45);
}
.ctrl.attack .mp-icon { width: 32px; height: 32px; }
.ctrl.attack span { font-size: 11px; }

/* ---------- screens ---------- */
.screen {
  position: fixed;
  inset: 0;
  z-index: 30;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: calc(var(--safe-top) + 12px) 20px calc(var(--safe-bottom) + 18px);
  scrollbar-width: none;
  overscroll-behavior: contain;
}
.screen::-webkit-scrollbar { display: none; }
.start-screen {
  background:
    radial-gradient(90% 46% at 50% 104%, rgba(255, 138, 61, .26), transparent 68%),
    linear-gradient(180deg, rgba(10, 6, 18, .34) 0%, rgba(10, 6, 18, .15) 28%, rgba(10, 6, 18, .78) 88%);
}
.start-wrap {
  width: 100%;
  max-width: 430px;
  min-height: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.commander {
  align-self: flex-end;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px 4px 4px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(20, 12, 32, .6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.commander-info { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; max-width: 150px; }
.commander-info span { font-size: 8px; letter-spacing: .14em; color: rgba(255, 242, 222, .55); }
.commander-info b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logo { text-align: center; margin: 4vh 0 0; }
.logo-kicker {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .28em;
  color: var(--orange);
}
.logo-kicker span { display: block; width: 24px; height: 2px; border-radius: 2px; background: linear-gradient(90deg, transparent, var(--orange)); }
.logo-kicker span:last-child { background: linear-gradient(90deg, var(--orange), transparent); }
.logo h1 {
  margin: 8px 0 2px;
  font-size: clamp(42px, 13vw, 62px);
  line-height: 1;
  letter-spacing: .03em;
  font-weight: 900;
  color: #FFF7EA;
  text-shadow:
    0 3px 0 #F07425,
    0 6px 0 #9C3C10,
    0 8px 0 #2A1020,
    0 14px 30px rgba(0, 0, 0, .55);
}
.logo p {
  margin: 10px 0 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .26em;
  color: rgba(255, 242, 222, .68);
}
.menu-stats { display: flex; gap: 10px; }
.stat-chip {
  flex: 1 1 0;
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 9px 12px;
  border-radius: 15px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(44, 28, 63, .78), rgba(20, 12, 32, .72));
  box-shadow: 0 8px 22px rgba(0, 0, 0, .3), inset 0 1px 0 rgba(255, 255, 255, .08);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.stat-chip > .mp-icon { width: 25px; height: 25px; color: var(--orange); flex: 0 0 auto; }
.stat-chip div { min-width: 0; }
.stat-chip span { display: block; font-size: 9px; letter-spacing: .1em; color: rgba(255, 242, 222, .56); }
.stat-chip b { display: block; font-size: 20px; line-height: 1.15; font-weight: 900; color: var(--cream); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-actions { display: flex; flex-direction: column; gap: 9px; padding-bottom: 2px; margin-top: auto; }
.hint { text-align: center; font-size: 10px; letter-spacing: .08em; color: rgba(255, 242, 222, .45); padding-top: 2px; }

/* ---------- game over ---------- */
.over-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(90% 56% at 50% 100%, rgba(255, 90, 60, .2), transparent 64%),
    linear-gradient(180deg, rgba(10, 5, 15, .58), rgba(10, 5, 15, .9));
}
.over-card {
  width: 100%;
  max-width: 380px;
  padding: 22px 18px 18px;
  border-radius: 26px;
  border: 1px solid rgba(255, 242, 222, .16);
  background: linear-gradient(180deg, rgba(46, 27, 62, .95), rgba(21, 12, 34, .97));
  box-shadow: 0 26px 70px rgba(0, 0, 0, .65), inset 0 1px 0 rgba(255, 255, 255, .1);
  text-align: center;
}
.over-kicker { font-size: 9px; font-weight: 900; letter-spacing: .26em; color: var(--danger); }
.over-card h2 {
  margin: 4px 0 16px;
  font-size: 33px;
  font-weight: 900;
  letter-spacing: .06em;
  color: var(--cream);
  text-shadow: 0 3px 0 #8F2A2A, 0 8px 22px rgba(0, 0, 0, .5);
}
.result-row { display: flex; gap: 8px; margin-bottom: 14px; }
.result-row > div {
  flex: 1 1 0;
  min-width: 0;
  padding: 9px 4px 8px;
  border-radius: 13px;
  border: 1px solid rgba(255, 242, 222, .08);
  background: rgba(0, 0, 0, .26);
}
.result-row span { display: block; font-size: 9px; letter-spacing: .1em; color: rgba(255, 242, 222, .55); }
.result-row b { display: block; margin-top: 2px; font-size: 21px; font-weight: 900; color: var(--orange-hi); overflow: hidden; text-overflow: ellipsis; }
.new-best {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 0 auto 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 195, 88, .14);
  border: 1px solid rgba(255, 195, 88, .38);
  color: #FFD36A;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .08em;
}
.new-best .mp-icon { width: 15px; height: 15px; }
.over-card .btn { margin-top: 9px; }
.double-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin-top: 10px;
  font-size: 12px;
  font-weight: 800;
  color: #8BF0B0;
}
.double-note .mp-icon { width: 16px; height: 16px; }
.over-actions { display: flex; gap: 9px; margin-top: 10px; }
.over-actions .btn { margin-top: 0; min-height: 48px; font-size: 14px; }

/* ---------- sheets ---------- */
.sheet {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(4, 2, 9, .68);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}
.sheet-panel {
  width: 100%;
  max-width: 520px;
  max-height: 88vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 18px 18px calc(var(--safe-bottom) + 20px);
  border-radius: 26px 26px 0 0;
  border: 1px solid rgba(255, 242, 222, .14);
  border-bottom: 0;
  background: linear-gradient(180deg, #271834 0%, #150D21 100%);
  box-shadow: 0 -24px 70px rgba(0, 0, 0, .7), inset 0 1px 0 rgba(255, 255, 255, .1);
  animation: sheetUp .28s cubic-bezier(.2, .8, .2, 1);
  scrollbar-width: none;
}
.sheet-panel::-webkit-scrollbar { display: none; }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.sheet-kicker { font-size: 9px; font-weight: 900; letter-spacing: .26em; color: var(--orange); }
.sheet-head h3 { margin: 2px 0 0; font-size: 25px; font-weight: 900; letter-spacing: .04em; }
.wallet-line {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 12px;
  border-radius: 13px;
  border: 1px solid rgba(255, 195, 88, .2);
  background: rgba(255, 195, 88, .07);
  color: #FFD08A;
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 12px;
}
.wallet-line b { font-size: 19px; font-weight: 900; }
.wallet-line .mp-icon { width: 16px; height: 16px; }
.upgrade-list { display: flex; flex-direction: column; gap: 9px; }
.upgrade {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px;
  border-radius: 16px;
  border: 1px solid rgba(255, 242, 222, .08);
  background: rgba(255, 255, 255, .045);
}
.upgrade-icon {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: var(--orange);
  background: radial-gradient(circle at 35% 30%, rgba(255, 179, 107, .3), rgba(255, 138, 61, .08));
  border: 1px solid rgba(255, 138, 61, .25);
}
.upgrade-icon .mp-icon { width: 25px; height: 25px; }
.upgrade-main { flex: 1 1 auto; min-width: 0; }
.upgrade-main b { display: block; font-size: 14px; }
.upgrade-main p { margin: 2px 0 7px; font-size: 10px; line-height: 1.35; color: rgba(255, 242, 222, .58); }
.pips { display: flex; gap: 3px; }
.pip { width: 11px; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .14); }
.pip.on { background: var(--orange); box-shadow: 0 0 6px rgba(255, 138, 61, .45); }
.buy-btn {
  flex: 0 0 auto;
  width: 82px;
  min-height: 40px;
  padding: 4px 5px;
  border-radius: 11px;
  border: 1px solid var(--ink-2);
  background: linear-gradient(180deg, #FFC07A, #FF8A3D);
  color: var(--ink-2);
  font-size: 11px;
  font-weight: 900;
  line-height: 1.1;
  box-shadow: 0 3px 0 var(--orange-deep);
  touch-action: manipulation;
}
.buy-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--orange-deep); }
.buy-btn[disabled] { opacity: .4; filter: grayscale(.5); box-shadow: none; transform: none; }
.sheet-foot { margin-top: 14px; text-align: center; font-size: 10px; color: rgba(255, 242, 222, .38); letter-spacing: .06em; }

.profile-edit { text-align: center; padding: 2px 0 6px; }
.profile-edit label { display: block; text-align: left; font-size: 10px; letter-spacing: .14em; color: rgba(255, 242, 222, .55); margin: 10px 0 6px; }
.profile-edit input {
  width: 100%;
  min-height: 50px;
  padding: 10px 14px;
  border-radius: 13px;
  border: 1px solid rgba(255, 242, 222, .2);
  background: rgba(0, 0, 0, .3);
  color: var(--cream);
  font-size: 16px;
  outline: none;
  margin-bottom: 12px;
}
.profile-edit input:focus { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(255, 138, 61, .16); }

/* ---------- ad demo ---------- */
.ad-mask {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: rgba(3, 2, 7, .9);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.ad-card {
  width: 100%;
  max-width: 340px;
  text-align: center;
  padding: 16px 18px 12px;
  border-radius: 24px;
  border: 3px solid var(--ink-2);
  background: linear-gradient(180deg, #FFF9EE 0%, #FFE3C2 100%);
  color: #24120C;
  box-shadow: 0 22px 60px rgba(0, 0, 0, .65), inset 0 1px 0 #fff;
}
.ad-top { display: flex; align-items: center; justify-content: center; gap: 7px; font-size: 10px; font-weight: 800; letter-spacing: .06em; color: #8A5A3C; }
.ad-art {
  width: 96px;
  height: 96px;
  margin: 14px auto 8px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #2A1020;
  background: radial-gradient(circle at 34% 28%, #FFD9A9 0%, #FFB36B 32%, #FF8A3D 72%);
  box-shadow: inset 0 0 0 6px rgba(255, 255, 255, .4), 0 10px 24px rgba(255, 138, 61, .35);
}
.ad-art .mp-icon { width: 52px; height: 52px; }
.ad-card h3 { margin: 2px 0 4px; font-size: 24px; font-weight: 900; letter-spacing: .04em; }
.ad-card p { margin: 0 0 12px; font-size: 12px; line-height: 1.5; color: #704832; }
.ad-progress { height: 10px; border-radius: 5px; overflow: hidden; background: rgba(42, 16, 32, .16); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .18); }
.ad-progress i { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #FF8A3D, #FFC56E); transition: width .1s linear; }
.ad-count { margin: 7px 0 4px; font-size: 11px; font-weight: 800; color: #8A4A22; letter-spacing: .06em; }
.ad-card .btn { min-height: 48px; margin: 4px 0 2px; }
.ad-close {
  border: 0;
  background: none;
  color: #8A5A3C;
  font-size: 11px;
  font-weight: 700;
  padding: 9px 12px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--safe-bottom) + 118px);
  z-index: 95;
  max-width: 88vw;
  padding: 9px 15px;
  border-radius: 999px;
  border: 1px solid rgba(255, 138, 61, .38);
  background: rgba(24, 13, 38, .95);
  color: var(--cream);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
  opacity: 0;
  transform: translate(-50%, 8px);
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- animations ---------- */
@keyframes lowPulse { from { filter: brightness(1); } to { filter: brightness(1.35); } }
@keyframes comboPop {
  0% { transform: translateX(-50%) scale(.6); opacity: .2; }
  60% { transform: translateX(-50%) scale(1.14); }
  100% { transform: translateX(-50%) scale(1); opacity: 1; }
}
@keyframes bannerIn {
  0% { opacity: 0; transform: translate(-50%, 14px) scale(.9); }
  16% { opacity: 1; transform: translate(-50%, 0) scale(1); }
  76% { opacity: 1; transform: translate(-50%, 0) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -12px) scale(.98); }
}
@keyframes sheetUp { from { transform: translateY(30px); opacity: .4; } to { transform: translateY(0); opacity: 1; } }

@media (max-height: 710px) {
  .logo { margin-top: 1.2vh; }
  .logo h1 { font-size: clamp(36px, 11vw, 46px); }
  .logo p { margin-top: 7px; font-size: 10px; }
  .start-wrap { gap: 10px; }
  .menu-actions { gap: 7px; }
  .btn { min-height: 46px; font-size: 15px; }
  .stat-chip { padding: 7px 10px; }
  .stat-chip b { font-size: 17px; }
  .hint { font-size: 9px; }
  .ctrl { width: 54px; height: 54px; }
  .ctrl.attack { width: 68px; height: 68px; }
  .ctrl.jump, .ctrl.fire { width: 48px; height: 48px; }
}

@media (max-width: 370px) {
  .controls { padding-left: 10px; padding-right: 10px; gap: 10px; }
  .move-pad, .action-pad { gap: 6px; }
  .ctrl { width: 52px; height: 52px; }
  .ctrl.jump, .ctrl.fire { width: 46px; height: 46px; }
  .ctrl.attack { width: 66px; height: 66px; }
  .ctrl.attack .mp-icon { width: 27px; height: 27px; }
  .hud { padding-left: 9px; padding-right: 9px; }
  .hud-left { padding-right: 8px; }
}
@media (min-width: 620px) {
  .screen { padding-left: 28px; padding-right: 28px; }
  .hud { padding-left: 22px; padding-right: 22px; }
  .controls { padding-left: 30px; padding-right: 30px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; transition-duration: .001s !important; }
}
