@import url("https://fonts.googleapis.com/css2?family=Nunito:wght@600;700;800;900&display=swap");

:root {
  --bg: #1f242b;
  --surface: #282f37;
  --surface-2: #303842;
  --surface-3: #37414c;
  --line: #414b57;
  --line-soft: #353e48;
  --ink: #f3f5f7;
  --muted: #9ba6b2;
  --gold: #d6a84b;
  --gold-deep: #8f6b27;
  --green: #54be59;
  --green-deep: #2f7d35;
  --green-soft: #2e4632;
  --cyan: #58aec9;
  --purple: #9d7bc5;
  --orange: #d47b4e;
  --danger: #b95750;
  --gap: clamp(8px, 1.45vw, 12px);
  --hud-h: clamp(64px, 10dvh, 82px);
  --nav-h: clamp(62px, 9.2dvh, 76px);
  --spawn-h: clamp(66px, 10.2dvh, 80px);
  --radius-card: clamp(12px, 2.8vw, 18px);
  --radius-button: clamp(13px, 3vw, 19px);
}

* { box-sizing: border-box; }

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--bg);
  color: var(--ink);
  font-family: "Nunito", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input { font: inherit; }

button {
  border: 0;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

body {
  display: grid;
  place-items: center;
}

.app-shell {
  width: min(100vw, 520px);
  height: 100dvh;
  margin: 0 auto;
  padding:
    max(8px, env(safe-area-inset-top))
    clamp(9px, 2.2vw, 13px)
    0;
  display: grid;
  grid-template-rows: var(--hud-h) minmax(0, 1fr) var(--nav-h);
  gap: 0;
  overflow: hidden;
}

.hud,
.workspace,
.screen,
.board-layout,
.board-frame,
.canvas-wrap,
.upgrades-frame,
.upgrades-inner,
.upgrade-grid,
.settings-frame,
.settings-inner {
  min-width: 0;
  min-height: 0;
}

/* HUD */
.hud {
  display: grid;
  grid-template-columns: minmax(0, 1.34fr) minmax(0, 1.08fr) minmax(0, .86fr);
  gap: 0;
  align-items: stretch;
}

.hud-card {
  height: 100%;
  border: 1px solid #4b5662;
  border-radius: 0;
  background: #2b3138;
  box-shadow: none;
}

.hud-money,
.hud-gems {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0 8px;
}

.hud-copy {
  min-width: 0;
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 3px;
}

.hud-money .hud-copy,
.hud-gems .hud-copy {
  justify-items: start;
}

.hud-badge,
.nav-badge,
.spawn-badge,
.upgrade-icon-wrap {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
}

.hud-badge {
  width: auto;
  height: auto;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-size: clamp(22px, 4.6vw, 28px);
  line-height: 1;
}


.hud-mini {
  width: auto;
  height: auto;
  font-size: clamp(12px, 2.6vw, 16px);
}

.hud strong {
  display: block;
  font-size: clamp(17px, 4.15vw, 24px);
  line-height: .95;
  font-weight: 900;
  white-space: nowrap;
  letter-spacing: -.02em;
}

.hud small {
  display: block;
  font-size: clamp(8px, 1.85vw, 10px);
  line-height: 1;
  font-weight: 800;
  white-space: nowrap;
  color: var(--muted);
}

.hud-money small { color: #8ad98e; }

.hud-level {
  padding: 8px 8px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 2px;
}

.level-top {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.level-top strong {
  font-size: clamp(14px, 3.4vw, 20px);
}

.level-progress {
  width: 100%;
  height: clamp(6px, 1dvh, 8px);
  overflow: hidden;
  border-radius: 0;
  background: #3a434e;
}

.level-progress i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 0;
  background: var(--green);
  transition: width .22s ease;
}

.hud-level small {
  text-align: center;
}

/* SCREENS */
.workspace,
.screen {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.screen { display: none; }
.screen.active { display: block; animation: screenIn .16s ease both; }

@keyframes screenIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* BOARD */
.board-layout {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-rows: minmax(0, 1fr) var(--spawn-h);
  gap: 0;
  padding-bottom: 0;
}

.board-frame {
  position: relative;
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  padding: clamp(8px, 1.8vw, 12px);
  padding-top: clamp(34px, 5.2dvh, 44px);
  overflow: hidden;
  border: 1px solid #48535f;
  border-radius: 0;
  background: var(--surface);
}

.dropper {
  position: absolute;
  z-index: 4;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
  width: clamp(66px, 16vw, 84px);
  height: clamp(30px, 4.8dvh, 38px);
  display: grid;
  place-items: center;
  border: 1px solid #6f592d;
  border-top: 0;
  border-radius: 0 0 10px 10px;
  background: #554526;
}

.dropper::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -4px;
  width: 18px;
  height: 4px;
  transform: translateX(-50%);
  background: var(--gold);
}

.dropper span {
  font-size: clamp(16px, 3.8vw, 21px);
  line-height: 1;
}

.canvas-wrap {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: 0;
  background: #242a31;
}

#plinkoCanvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* BUTTONS: intentionally the only raised/shaded pieces */
.spawn-button,
.buy-upgrade,
.nav-button,
.danger-button,
.modal-card header button {
  transition: transform .1s ease, box-shadow .1s ease, filter .12s ease;
}

.spawn-button {
  width: 100%;
  height: 100%;
  align-self: stretch;
  padding: 0 clamp(14px, 3vw, 22px);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(10px, 2.2vw, 14px);
  cursor: pointer;
  border: 1px solid #5dcc61;
  border-radius: 0;
  background: linear-gradient(180deg, #61cd62 0%, #50b953 56%, #419e46 100%);
  box-shadow: 0 5px 0 #2c7432, 0 8px 14px rgba(0,0,0,.18);
  color: #fff;
}

.spawn-button:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #2c7432, 0 3px 7px rgba(0,0,0,.14);
}

.spawn-button:disabled {
  opacity: .54;
  filter: grayscale(.3) saturate(.65);
}

.spawn-badge {
  width: auto;
  height: auto;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.spawn-icon {
  font-size: clamp(21px, 4.7vw, 28px);
  line-height: 1;
}

.spawn-copy {
  min-width: 0;
  display: grid;
  justify-items: start;
  gap: 3px;
}

.spawn-copy > strong {
  font-size: clamp(17px, 4.2vw, 23px);
  line-height: 1;
  font-weight: 900;
  letter-spacing: .025em;
}

.spawn-copy small {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: clamp(9px, 1.9vw, 11px);
  line-height: 1;
  color: rgba(255,255,255,.82);
}

.spawn-copy b {
  color: #efffe9;
  font-weight: 900;
}

.spawn-copy i {
  font-style: normal;
  font-weight: 800;
}

/* UPGRADES */
.upgrades-frame {
  position: relative;
  width: 100%;
  height: 100%;
  padding: clamp(48px, 6.4dvh, 58px) clamp(11px, 2vw, 15px) clamp(11px, 2vw, 15px);
  overflow: hidden;
  border: 1px solid #4a5662;
  border-radius: clamp(16px, 3.4vw, 21px);
  background: #252d35;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.025);
}

.upgrades-title {
  position: absolute;
  z-index: 5;
  top: clamp(14px, 2.2dvh, 19px);
  left: 50%;
  width: calc(100% - clamp(46px, 9vw, 72px));
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(12px, 2.8vw, 20px);
  color: #f3f1eb;
  font-size: clamp(18px, 4.1vw, 24px);
  line-height: 1;
  font-weight: 1000;
  letter-spacing: .055em;
  text-align: center;
}

.upgrades-title::before,
.upgrades-title::after {
  content: "";
  height: 1px;
  flex: 1 1 58px;
  max-width: 128px;
  background: #46525e;
}

.upgrades-inner {
  width: 100%;
  height: 100%;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.upgrade-grid {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(3, minmax(0, 1fr));
  gap: clamp(8px, 1.55vw, 11px);
}

.upgrade-card {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  padding: clamp(9px, 1.7vw, 12px);
  display: grid;
  grid-template-columns: clamp(48px, 10vw, 68px) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto;
  column-gap: clamp(8px, 1.5vw, 11px);
  row-gap: clamp(7px, 1dvh, 10px);
  border: 1px solid #46535f;
  border-radius: clamp(13px, 2.7vw, 17px);
  background: #222a32;
  box-shadow: 0 4px 9px rgba(0,0,0,.13), inset 0 1px 0 rgba(255,255,255,.018);
}

.upgrade-icon-wrap {
  grid-column: 1;
  grid-row: 1;
  width: 100%;
  height: 100%;
  align-self: center;
  justify-self: center;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.upgrade-icon {
  display: block;
  font-size: clamp(34px, 8.1vw, 54px);
  line-height: 1;
  filter: drop-shadow(0 5px 4px rgba(0,0,0,.22));
  transform: translateY(1px);
}

.upgrade-copy {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
  display: grid;
  align-content: center;
  justify-items: start;
  gap: clamp(3px, .55dvh, 5px);
}

.upgrade-card h3 {
  margin: 0;
  color: #f4f2ed;
  font-size: clamp(11px, 2.45vw, 15px);
  line-height: 1.03;
  font-weight: 1000;
  letter-spacing: .015em;
  text-transform: uppercase;
}

.upgrade-level {
  display: inline-flex;
  align-items: center;
  min-height: clamp(19px, 2.9dvh, 23px);
  padding: 1px 6px 0;
  border: 1px solid #356d38;
  border-radius: 4px;
  background: #244a28;
  color: #8de27e;
  font-size: clamp(9px, 1.9vw, 11px);
  line-height: 1;
  font-weight: 1000;
}

.upgrade-stat {
  display: block;
  font-size: clamp(12px, 2.65vw, 16px);
  line-height: 1;
  font-weight: 1000;
}

.upgrade-green .upgrade-stat { color: #7edb72; }
.upgrade-blue .upgrade-stat { color: #71c8f4; }
.upgrade-gold .upgrade-stat { color: #f0c45a; }
.upgrade-purple .upgrade-stat { color: #c294e8; }
.upgrade-orange .upgrade-stat { color: #ef986b; }

.upgrade-card p {
  margin: 0;
  max-width: 19em;
  color: #aeb7c0;
  font-size: clamp(8px, 1.72vw, 10px);
  line-height: 1.22;
  font-weight: 700;
}

.buy-upgrade {
  grid-column: 1 / -1;
  grid-row: 2;
  width: 100%;
  min-height: clamp(34px, 5.2dvh, 43px);
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 1px solid #63c467;
  border-radius: clamp(8px, 1.8vw, 11px);
  background: linear-gradient(180deg, #57b859 0%, #489e4b 62%, #3d8840 100%);
  box-shadow: 0 3px 0 #2b6530, inset 0 1px 0 rgba(255,255,255,.14), 0 5px 9px rgba(0,0,0,.16);
  color: #f5fff3;
  font-size: clamp(14px, 3vw, 18px);
  line-height: 1;
  font-weight: 1000;
  text-shadow: 0 1px 1px rgba(23,60,25,.5);
}

.buy-upgrade:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #2b6530, inset 0 1px 0 rgba(255,255,255,.10), 0 2px 5px rgba(0,0,0,.14);
}

.buy-upgrade:disabled {
  border-color: #4b555f;
  background: #39414a;
  box-shadow: none;
  color: #89939d;
  text-shadow: none;
}

.buy-price { white-space: nowrap; }

/* NAV */
.bottom-nav {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  width: 100%;
  min-width: 0;
  margin: 0;
  align-self: stretch;
}

.nav-button {
  position: relative;
  min-width: 0;
  min-height: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(6px, 1.2vw, 9px);
  cursor: pointer;
  border: 1px solid #4b5662;
  border-bottom: 0;
  border-radius: 0;
  background: linear-gradient(180deg, #3a434d 0%, #303842 61%, #29313a 100%);
  box-shadow: 0 4px 0 #1b2026, 0 6px 10px rgba(0,0,0,.14);
  color: #cbd2d9;
}

.nav-button:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #1b2026, 0 3px 6px rgba(0,0,0,.12);
}

.nav-button.active {
  border-color: #4f8d55;
  background: linear-gradient(180deg, #3b5140 0%, #334638 61%, #2c3c31 100%);
  color: #dff5df;
}

.nav-button.active::after {
  content: "";
  position: absolute;
  left: 22%;
  right: 22%;
  bottom: 6px;
  height: 2px;
  background: #69c76f;
}

.nav-badge {
  width: auto;
  height: auto;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-size: clamp(19px, 4vw, 23px);
  line-height: 1;
}

.nav-button strong {
  min-width: 0;
  font-size: clamp(10px, 2.4vw, 13px);
  line-height: 1;
  font-weight: 900;
  letter-spacing: .035em;
  white-space: nowrap;
}

/* TOAST + SETTINGS */
.app-toast {
  position: fixed;
  z-index: 80;
  left: 50%;
  bottom: max(88px, calc(env(safe-area-inset-bottom) + 82px));
  transform: translate(-50%, 8px);
  max-width: min(88vw, 360px);
  padding: 8px 13px;
  border: 1px solid #414a54;
  border-radius: 999px;
  background: #252b32;
  color: #f4f5f6;
  font-size: clamp(10px, 2.4vw, 13px);
  font-weight: 900;
  text-align: center;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .14s ease, transform .14s ease;
}

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

.board-fx {
  position: absolute;
  inset: 0;
  z-index: 6;
  overflow: hidden;
  pointer-events: none;
}


.juice-hud {
  position: relative;
  z-index: 1;
  width: 100%;
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(96px, .82fr) minmax(0, 2fr);
  align-items: center;
  gap: clamp(8px, 1.8vw, 14px);
  padding: 4px clamp(10px, 2vw, 14px);
  border: 1px solid #46515c;
  border-radius: 0;
  background: #293039;
  box-shadow: none;
  pointer-events: none;
}

.streak-chip {
  position: relative;
  width: 100%;
  min-width: 0;
  min-height: 29px;
  padding: 0 7px 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  opacity: .48;
  transform: none;
  transition: opacity .14s ease;
}

.streak-chip.active {
  opacity: 1;
  transform: none;
}

.streak-chip.hot {
  filter: drop-shadow(0 0 8px rgba(240,190,88,.18));
}

.streak-chip > span {
  display: inline;
  color: #aeb7c0;
  font-size: clamp(7px, 1.55vw, 9px);
  line-height: 1;
  font-weight: 1000;
  letter-spacing: .09em;
}

.streak-chip > strong {
  display: inline;
  margin: 0;
  color: #f6d27b;
  font-size: clamp(15px, 3.6vw, 20px);
  line-height: 1;
  font-weight: 1000;
}

.streak-time {
  position: absolute;
  left: 7px;
  right: 7px;
  bottom: 0;
  width: auto;
  height: 2px;
  margin: 0;
  overflow: hidden;
  border-radius: 99px;
  background: #414a54;
}

.streak-time i,
.juice-meter-track i {
  display: block;
  width: 100%;
  height: 100%;
  transform: scaleX(0);
  transform-origin: left center;
  will-change: transform;
}

.streak-time i { background: #f0be58; }

.juice-meters {
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(9px, 2vw, 16px);
}

.juice-meter {
  min-width: 0;
  padding: 0 1px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.juice-meter-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  font-size: clamp(7px, 1.45vw, 9px);
  line-height: 1;
  font-weight: 1000;
  letter-spacing: .055em;
}

.juice-meter-top span { color: #aeb7c0; }
.juice-meter-top b { color: #dfe4e8; font-size: 1em; }

.juice-meter-track {
  width: 100%;
  height: 4px;
  margin-top: 5px;
  overflow: hidden;
  border-radius: 99px;
  background: #414a54;
}

.rush-meter .juice-meter-track i { background: #f0be58; }
.jackpot-meter .juice-meter-track i { background: #b58be2; }

.rush-meter.active .juice-meter-top span,
.rush-meter.active .juice-meter-top b { color: #ffd97f; }

.jackpot-meter.ready .juice-meter-top span,
.jackpot-meter.ready .juice-meter-top b { color: #d9b9ff; }

.jackpot-meter.ready .juice-meter-track {
  box-shadow: 0 0 8px rgba(181,139,226,.26);
}

.juice-callout {
  position: absolute;
  z-index: 8;
  left: 50%;
  top: 42%;
  width: min(88%, 360px);
  transform: translate(-50%, -50%) scale(.78);
  display: grid;
  justify-items: center;
  gap: 4px;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  filter: drop-shadow(0 5px 12px rgba(0,0,0,.26));
}

.juice-callout.show {
  animation: juiceCalloutPop var(--callout-duration, .84s) cubic-bezier(.18,.82,.2,1) both;
}

.juice-callout strong {
  color: #f4c765;
  font-size: clamp(27px, 8vw, 50px);
  line-height: .9;
  font-weight: 1000;
  letter-spacing: -.035em;
  text-shadow: 0 3px 0 rgba(65,47,17,.58), 0 0 22px rgba(240,190,88,.20);
}

.juice-callout small {
  min-height: 1em;
  color: #f3eee4;
  font-size: clamp(10px, 2.7vw, 15px);
  line-height: 1;
  font-weight: 900;
  letter-spacing: .08em;
}

.juice-callout.blue strong { color: #83daf4; text-shadow: 0 3px 0 rgba(19,61,77,.56), 0 0 22px rgba(97,200,235,.20); }
.juice-callout.purple strong { color: #d3a8ff; text-shadow: 0 3px 0 rgba(62,36,91,.56), 0 0 24px rgba(181,139,226,.24); }
.juice-callout.green strong { color: #84df79; text-shadow: 0 3px 0 rgba(32,72,28,.56), 0 0 22px rgba(101,209,92,.20); }
.juice-callout.rush strong { color: #ffe18b; font-size: clamp(31px, 9vw, 56px); }

.reward-pop.chain {
  color: #f7d67f;
  font-size: clamp(9px, 2vw, 13px);
  font-weight: 1000;
  letter-spacing: .04em;
  animation: chainPop .58s cubic-bezier(.18,.8,.2,1) forwards;
}

.reward-pop.special {
  font-size: clamp(10px, 2.2vw, 14px);
  font-weight: 1000;
  letter-spacing: .045em;
  animation: rewardSpecial .82s cubic-bezier(.18,.76,.2,1) forwards;
}

.board-frame.rush-active {
  border-color: rgba(240,190,88,.78);
  box-shadow: inset 0 0 30px rgba(240,190,88,.055), 0 0 20px rgba(240,190,88,.08);
}

.board-frame.rush-active .dropper {
  border-color: #a78135;
  background: #6a5528;
  animation: rushDropper .6s ease-in-out infinite alternate;
}

@keyframes juiceCalloutPop {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.68); }
  16% { opacity: 1; transform: translate(-50%, -50%) scale(1.15); }
  30% { opacity: 1; transform: translate(-50%, -50%) scale(.98); }
  72% { opacity: 1; transform: translate(-50%, -56%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -72%) scale(.94); }
}

@keyframes chainPop {
  0% { opacity: 0; transform: translate(-50%, 5px) scale(.68); }
  22% { opacity: 1; transform: translate(-50%, -2px) scale(1.12); }
  100% { opacity: 0; transform: translate(-50%, -26px) scale(.92); }
}

@keyframes rewardSpecial {
  0% { opacity: 0; transform: translate(-50%, 7px) scale(.72); }
  18% { opacity: 1; transform: translate(-50%, -2px) scale(1.12); }
  100% { opacity: 0; transform: translate(-50%, -42px) scale(.98); }
}

@keyframes jackpotReadyPulse {
  from { box-shadow: 0 0 0 rgba(181,139,226,0); }
  to { box-shadow: 0 0 16px rgba(181,139,226,.20); }
}

@keyframes rushDropper {
  from { filter: brightness(1); }
  to { filter: brightness(1.16); }
}

@media (max-width: 360px) {
  .juice-hud {
    grid-template-columns: minmax(76px, .72fr) minmax(0, 2fr);
    gap: 7px;
    padding-inline: 7px;
  }
  .streak-chip { padding-inline: 3px; }
  .juice-meters { gap: 7px; }
}

.reward-pop,
.reward-particle,
.slot-burst {
  position: absolute;
  pointer-events: none;
  will-change: transform, opacity;
}

.reward-pop {
  left: 0;
  top: 0;
  transform: translate(-50%, 0);
  font-weight: 1000;
  line-height: 1;
  letter-spacing: .01em;
  text-shadow: 0 2px 0 rgba(17, 20, 24, .28), 0 0 12px rgba(255,255,255,.08);
  filter: drop-shadow(0 4px 10px rgba(0,0,0,.18));
}

.reward-pop.main { font-size: clamp(14px, 2.4vw, 20px); animation: rewardRiseMain .84s cubic-bezier(.18,.78,.2,1) forwards; }
.reward-pop.sub { font-size: clamp(10px, 1.9vw, 14px); animation: rewardRiseSub .78s cubic-bezier(.18,.72,.2,1) forwards; }

.reward-particle {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  left: 0;
  top: 0;
  box-shadow: 0 0 8px currentColor;
  animation: rewardParticle .58s ease-out forwards;
}

.slot-burst {
  width: 16px;
  height: 16px;
  margin-left: -8px;
  margin-top: -8px;
  border-radius: 50%;
  border: 2px solid currentColor;
  opacity: .68;
  animation: slotBurst .42s ease-out forwards;
}

@keyframes rewardRiseMain {
  0% { opacity: 0; transform: translate(-50%, 14px) scale(.68); }
  18% { opacity: 1; transform: translate(-50%, -1px) scale(1.18); }
  34% { opacity: 1; transform: translate(-50%, -10px) scale(.98); }
  100% { opacity: 0; transform: translate(-50%, -54px) scale(1.02); }
}

@keyframes rewardRiseSub {
  0% { opacity: 0; transform: translate(-50%, 8px) scale(.72); }
  20% { opacity: 1; transform: translate(-50%, -2px) scale(1.08); }
  100% { opacity: 0; transform: translate(-50%, -36px) scale(.98); }
}

@keyframes rewardParticle {
  0% { opacity: .98; transform: translate(0,0) scale(1); }
  100% { opacity: 0; transform: translate(var(--tx), var(--ty)) scale(.35); }
}

@keyframes slotBurst {
  0% { opacity: .68; transform: scale(.28); }
  100% { opacity: 0; transform: scale(2.35); }
}

.settings-frame {
  position: relative;
  width: 100%;
  height: 100%;
  padding-top: clamp(28px, 4.4dvh, 36px);
}

.settings-title {
  position: absolute;
  z-index: 5;
  top: 0;
  left: clamp(10px, 2vw, 14px);
  display: flex;
  align-items: center;
  gap: 8px;
  color: #e3ba66;
  font-size: clamp(16px, 3.8vw, 22px);
  line-height: 1;
  font-weight: 900;
  letter-spacing: .08em;
}

.settings-title img {
  width: clamp(22px, 5vw, 30px);
  height: clamp(22px, 5vw, 30px);
  object-fit: contain;
}

.settings-inner {
  width: 100%;
  height: 100%;
  padding: clamp(14px, 3vw, 22px);
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  overscroll-behavior: contain;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface);
}

.settings-inner::-webkit-scrollbar { display: none; }

.settings-list {
  width: min(100%, 520px);
  margin: 0 auto;
  display: grid;
  gap: clamp(10px, 2dvh, 16px);
}

.setting-row {
  min-height: clamp(68px, 11dvh, 88px);
  padding: 0 clamp(15px, 3vw, 22px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid #46515c;
  border-radius: clamp(12px, 2.5vw, 16px);
  background: #2d343d;
  color: #eee8dd;
}

.setting-label {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: clamp(12px, 2.4vw, 17px);
}

.setting-label img {
  width: clamp(34px, 7vw, 44px);
  height: clamp(34px, 7vw, 44px);
  object-fit: contain;
  flex: 0 0 auto;
}

.setting-label strong {
  font-size: clamp(16px, 3.4vw, 20px);
  line-height: 1;
  font-weight: 900;
  letter-spacing: .025em;
  white-space: nowrap;
}

.setting-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.setting-copy small {
  color: #919da8;
  font-size: clamp(8px, 1.75vw, 10px);
  line-height: 1;
  font-weight: 900;
  letter-spacing: .07em;
  white-space: nowrap;
}

.setting-svg {
  width: clamp(34px, 7vw, 44px);
  height: clamp(34px, 7vw, 44px);
  flex: 0 0 auto;
  fill: none;
  stroke: #aeb8c0;
  stroke-width: 3.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sparkle-svg {
  fill: #aeb8c0;
  stroke-width: 1.6;
}

.reset-svg { stroke: #d77872; }

.volume-row {
  min-height: clamp(112px, 16dvh, 132px);
  padding-block: clamp(14px, 2.2dvh, 18px);
  display: grid;
  grid-template-columns: 1fr;
  align-content: center;
  gap: 13px;
}

.volume-head {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.volume-control {
  width: 100%;
  padding-left: clamp(46px, 9.5vw, 61px);
  display: block;
}

.volume-slider-wrap {
  --volume-thumb: 24px;
  position: relative;
  height: 32px;
  display: flex;
  align-items: center;
}

.volume-rail {
  position: absolute;
  left: calc(var(--volume-thumb) / 2);
  right: calc(var(--volume-thumb) / 2);
  top: 50%;
  height: 10px;
  overflow: hidden;
  transform: translateY(-50%);
  border: 1px solid #505c67;
  border-radius: 999px;
  background: #3a444e;
  box-shadow: inset 0 2px 3px rgba(0,0,0,.25);
}

.volume-rail i {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: #d4a94d;
  transform: scaleX(.85);
  transform-origin: left center;
  transition: none;
  will-change: transform;
}

#masterVolume {
  position: absolute;
  z-index: 2;
  inset: 0;
  width: 100%;
  height: 32px;
  margin: 0;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
}

#masterVolume::-webkit-slider-runnable-track {
  height: 8px;
  background: transparent;
}

#masterVolume::-webkit-slider-thumb {
  width: var(--volume-thumb);
  height: var(--volume-thumb);
  margin-top: -7px;
  appearance: none;
  -webkit-appearance: none;
  border: 2px solid #6d7780;
  border-radius: 50%;
  background: #f0eee8;
  box-shadow: 0 2px 5px rgba(0,0,0,.32);
}

#masterVolume::-moz-range-track {
  height: 8px;
  background: transparent;
}

#masterVolume::-moz-range-thumb {
  width: var(--volume-thumb);
  height: var(--volume-thumb);
  border: 2px solid #6d7780;
  border-radius: 50%;
  background: #f0eee8;
  box-shadow: 0 2px 5px rgba(0,0,0,.32);
}

#masterVolume:focus-visible {
  outline: none;
}

#masterVolume:focus-visible::-webkit-slider-thumb {
  outline: 2px solid #d9c68f;
  outline-offset: 3px;
}

#masterVolumeValue {
  min-width: 52px;
  padding: 6px 9px;
  border: 1px solid #635a3f;
  border-radius: 8px;
  background: #252c33;
  color: #e7c575;
  font-size: 13px;
  line-height: 1;
  font-weight: 1000;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.reset-data-button {
  min-width: 102px;
  height: 44px;
  padding: 0 14px;
  cursor: pointer;
  border: 1px solid #8d4a47;
  border-radius: 10px;
  background: #7d3f3c;
  box-shadow: 0 3px 0 #432927, inset 0 1px 0 rgba(255,255,255,.06);
  color: #fff2ed;
  font-size: 12px;
  font-weight: 1000;
  letter-spacing: .04em;
  transition: transform .1s ease, background .15s ease, border-color .15s ease;
}

.reset-data-button:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #432927;
}

.reset-data-button.armed {
  border-color: #d86c64;
  background: #ad4f49;
}

.reset-data-button.done {
  border-color: #4f9660;
  background: #3d764b;
}

.setting-toggle-row { cursor: pointer; }

.switch-control {
  position: relative;
  width: 70px;
  height: 38px;
  flex: 0 0 auto;
}

.switch-control input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.switch-track {
  position: absolute;
  inset: 0;
  border: 1px solid #56616b;
  border-radius: 999px;
  background: #505a64;
  box-shadow: inset 0 2px 2px rgba(0,0,0,.14);
  transition: background .16s ease, border-color .16s ease;
}

.switch-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #e8e9e7;
  box-shadow: 0 2px 5px rgba(0,0,0,.28);
  transition: transform .16s cubic-bezier(.2,.8,.2,1);
}

.switch-control input:checked + .switch-track {
  border-color: #42b54e;
  background: #45b74f;
}

.switch-control input:checked + .switch-track .switch-knob {
  transform: translateX(32px);
}

.switch-control input:focus-visible + .switch-track,
.language-button:focus-visible,
.reset-data-button:focus-visible {
  outline: 2px solid #d9c68f;
  outline-offset: 3px;
}

.language-row { position: relative; }
.language-select { position: relative; flex: 0 0 auto; }

.language-button {
  min-width: 102px;
  height: 46px;
  padding: 0 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 13px;
  cursor: pointer;
  border: 1px solid #56626d;
  border-radius: 10px;
  background: linear-gradient(180deg, #46515b 0%, #37414a 100%);
  box-shadow: 0 3px 0 #232a30, inset 0 1px 0 rgba(255,255,255,.06);
  color: #f1ebdf;
  font-size: 18px;
  line-height: 1;
  font-weight: 900;
}

.language-button:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #232a30;
}

.language-chevron {
  width: 10px;
  height: 10px;
  border-right: 3px solid #bfc5ca;
  border-bottom: 3px solid #bfc5ca;
  transform: translateY(-3px) rotate(45deg);
  transition: transform .14s ease;
}

.language-select.open .language-chevron {
  transform: translateY(3px) rotate(225deg);
}

.language-menu {
  position: absolute;
  z-index: 20;
  top: calc(100% + 7px);
  right: 0;
  width: 156px;
  padding: 5px;
  display: grid;
  gap: 3px;
  border: 1px solid #46515c;
  border-radius: 10px;
  background: #232b32;
  box-shadow: 0 12px 24px rgba(0,0,0,.30);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px) scale(.98);
  transform-origin: top right;
  transition: opacity .12s ease, transform .12s ease, visibility .12s ease;
}

.language-select.open .language-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.language-menu button {
  width: 100%;
  min-height: 40px;
  padding: 0 11px;
  cursor: pointer;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #cbd1d5;
  text-align: left;
  font-size: 14px;
  font-weight: 800;
}

.language-menu button:hover,
.language-menu button[aria-selected="true"] {
  background: #36414b;
  color: #fffaf0;
}

@media (max-width: 380px) {
  .settings-inner { padding: 11px; }
  .settings-list { gap: 8px; }
  .setting-row { min-height: 62px; padding-inline: 12px; gap: 10px; }
  .setting-label { gap: 10px; }
  .setting-label img, .setting-svg { width: 32px; height: 32px; }
  .setting-label strong { font-size: 15px; }
  .setting-copy small { font-size: 7px; }
  .volume-row { min-height: 104px; gap: 10px; }
  .volume-control { width: 100%; padding-left: 44px; }
  .reset-data-button { min-width: 88px; height: 40px; padding-inline: 10px; font-size: 10px; }
  .switch-control { width: 62px; height: 34px; }
  .switch-knob { width: 26px; height: 26px; }
  .switch-control input:checked + .switch-track .switch-knob { transform: translateX(28px); }
  .language-button { min-width: 88px; height: 42px; padding-inline: 12px; font-size: 16px; }
}

.float-particle {
  position: fixed;
  z-index: 200;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #f2d37c;
  pointer-events: none;
  animation: particleFly .52s ease-out forwards;
}

@keyframes particleFly {
  to {
    transform: translate(var(--tx), var(--ty)) scale(.4);
    opacity: 0;
  }
}

/* COMPACT */
@media (max-height: 720px) {
  :root {
    --hud-h: 56px;
    --nav-h: 56px;
    --spawn-h: 58px;
    --gap: 7px;
  }

  .app-shell {
    padding-top: max(6px, env(safe-area-inset-top));
    padding-bottom: 0;
  }

  .board-frame { padding-top: 30px; }
  .dropper { width: 66px; height: 28px; }
  .upgrades-frame { padding: 42px 9px 9px; }
  .upgrades-inner { padding: 0; }
  .settings-frame { padding-top: 26px; }
  .settings-inner { padding: 9px; }
  .settings-list { gap: 7px; }
  .setting-row { min-height: 56px; }
  .upgrade-grid { gap: 7px; }
  .upgrade-card { padding: 7px; grid-template-columns: 38px minmax(0, 1fr); column-gap: 6px; row-gap: 5px; }
  .upgrade-icon { font-size: 27px; }
  .upgrade-card h3 { font-size: 10px; }
  .upgrade-level { min-height: 17px; font-size: 8px; padding-inline: 5px; }
  .upgrade-stat { font-size: 11px; }
  .upgrade-card p { font-size: 7.5px; line-height: 1.12; }
  .buy-upgrade { min-height: 29px; font-size: 12px; }
}

@media (max-width: 380px) {
  .app-shell { padding-inline: 7px; }
  .hud { grid-template-columns: minmax(0, 1.14fr) minmax(0, .98fr) minmax(0, .8fr); gap: 0; }
  .hud-money, .hud-gems { gap: 3px; padding-inline: 6px; }
  .hud-badge { width: auto; height: auto; font-size: 18px; border-radius: 0; }
  .hud-mini { width: 21px; height: 21px; font-size: 11px; }
  .hud strong { font-size: 14px; }
  .hud small { font-size: 8px; }
  .spawn-copy > strong { font-size: 16px; }
  .nav-button strong { font-size: 9px; }
  .nav-badge { width: auto; height: auto; font-size: 17px; }
}

@media (orientation: landscape) and (max-height: 480px) {
  :root {
    --hud-h: 48px;
    --nav-h: 50px;
    --spawn-h: 52px;
    --gap: 5px;
  }

  .app-shell {
    width: min(100vw, 540px);
    padding-top: max(4px, env(safe-area-inset-top));
    padding-bottom: 0;
  }

  .hud { gap: 0; }
  .hud-badge, .nav-badge { width: auto; height: auto; font-size: 16px; }
  .hud strong { font-size: 13px; }
  .hud small, .hud-level small { font-size: 8px; }
  .screen.active.board-screen { grid-template-rows: 34px minmax(0, 1fr); gap: 0; }
  .board-layout { grid-template-rows: minmax(0, 1fr) 58px; gap: 0; padding-bottom: 0; }
  .board-frame { padding: 6px; padding-top: 25px; }
  .dropper { width: 56px; height: 23px; border-radius: 0 0 8px 8px; }
  .spawn-button { padding-inline: 10px; }
  .spawn-badge { width: auto; height: auto; }
  .spawn-icon { font-size: 17px; }
  .spawn-copy { gap: 1px; }
  .spawn-copy > strong { font-size: 14px; }
  .spawn-copy small { font-size: 8px; gap: 6px; }
  .upgrades-frame { padding: 35px 7px 7px; }
  .upgrades-title { top: 10px; font-size: 13px; }
  .settings-frame { padding-top: 22px; }
  .settings-title { font-size: 14px; }
  .settings-inner { padding: 7px; }
  .settings-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .volume-row { grid-column: 1 / -1; }
  .setting-row { min-height: 58px; padding-inline: 10px; gap: 8px; }
  .setting-label { gap: 8px; }
  .setting-label img, .setting-svg { width: 28px; height: 28px; }
  .setting-label strong { font-size: 11px; }
  .setting-copy small { font-size: 6px; }
  .switch-control { width: 54px; height: 30px; }
  .switch-knob { width: 22px; height: 22px; }
  .switch-control input:checked + .switch-track .switch-knob { transform: translateX(24px); }
  .language-button { min-width: 76px; height: 36px; font-size: 14px; }
  .volume-row { min-height: 92px; gap: 8px; }
  .volume-control { width: 100%; padding-left: 36px; }
  #masterVolumeValue { font-size: 11px; }
  .reset-data-button { min-width: 76px; height: 35px; padding-inline: 8px; font-size: 9px; }
  .upgrades-inner { padding: 0; }
  .upgrade-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .upgrade-card { padding: 6px; grid-template-columns: 31px minmax(0, 1fr); column-gap: 5px; row-gap: 4px; }
  .upgrade-icon { font-size: 22px; }
  .upgrade-card h3 { font-size: 8px; }
  .upgrade-level { min-height: 14px; padding-inline: 4px; font-size: 6.5px; }
  .upgrade-stat { font-size: 8px; }
  .upgrade-card p { font-size: 6px; line-height: 1.05; }
  .buy-upgrade { min-height: 24px; font-size: 9px; border-radius: 7px; }
  .nav-button strong { font-size: 9px; }
}

@media (max-height: 360px) {
  .upgrade-card p { display: none; }
}

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

.nav-button + .nav-button {
  border-left-width: 0;
}


.screen.active.board-screen { display: grid; grid-template-rows: clamp(42px, 6.4dvh, 50px) minmax(0, 1fr); gap: 0; }

.hud-money > .hud-badge,
.hud-gems > .hud-badge { flex: 0 0 auto; }

/* v16 vertical flow cleanup */
.workspace { min-height: 0; }
.bottom-nav { align-self: stretch; }

/* v17 square primary controls */
.spawn-button,
.nav-button,
.nav-button:first-child,
.nav-button:last-child {
  border-radius: 0 !important;
}

.spawn-button,
.bottom-nav,
.nav-button {
  margin: 0;
}

.spawn-button {
  border-radius: 0 !important;
}

.nav-button {
  width: 100%;
  height: 100%;
  align-self: stretch;
}

.workspace {
  min-height: 0;
}


/* v19 settings square cleanup */
.settings-inner,
.setting-row,
.volume-rail,
.volume-rail i,
#masterVolumeValue,
.reset-data-button,
.switch-track,
.language-button,
.language-menu,
.language-menu button {
  border-radius: 0 !important;
}

/* keep only circular knobs if desired; comment below if you want them square too */
.switch-knob,
#masterVolume::-webkit-slider-thumb,
#masterVolume::-moz-range-thumb {
  border-radius: 0 !important;
}


/* v20 square upgrades + settings title match */
.upgrades-frame,
.upgrade-card,
.upgrade-level,
.buy-upgrade,
.settings-frame {
  border-radius: 0 !important;
}

.settings-title {
  position: absolute;
  z-index: 5;
  top: clamp(14px, 2.2dvh, 19px);
  left: 50%;
  width: calc(100% - clamp(46px, 9vw, 72px));
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(12px, 2.8vw, 20px);
  color: #f3f1eb;
  font-size: clamp(18px, 4.1vw, 24px);
  line-height: 1;
  font-weight: 1000;
  letter-spacing: .055em;
  text-align: center;
}

.settings-title::before,
.settings-title::after {
  content: "";
  height: 1px;
  flex: 1 1 58px;
  max-width: 128px;
  background: #46525e;
}

.settings-title img,
.settings-title span {
  display: none !important;
}


/* v21 toggle geometry + level spacing */
.switch-track {
  border-radius: 0 !important;
}

.switch-knob {
  top: 4px !important;
  left: 4px !important;
  width: 28px !important;
  height: 30px !important;
  border-radius: 0 !important;
  box-shadow: 0 2px 4px rgba(0,0,0,.24) !important;
}

.switch-control input:checked + .switch-track .switch-knob {
  transform: translateX(30px) !important;
}

.level-top {
  margin-bottom: 4px;
}

@media (max-width: 380px) {
  .switch-knob {
    top: 4px !important;
    left: 4px !important;
    width: 24px !important;
    height: 26px !important;
  }
  .switch-control input:checked + .switch-track .switch-knob {
    transform: translateX(26px) !important;
  }
  .level-top { margin-bottom: 3px; }
}

@media (orientation: landscape) and (max-height: 480px) {
  .switch-knob {
    top: 4px !important;
    left: 4px !important;
    width: 20px !important;
    height: 22px !important;
  }
  .switch-control input:checked + .switch-track .switch-knob {
    transform: translateX(22px) !important;
  }
  .level-top { margin-bottom: 2px; }
}


/* v22 unaffordable upgrades */
.upgrade-card {
  transition: filter .16s ease, opacity .16s ease, border-color .16s ease, background .16s ease;
}

.upgrade-card.is-unaffordable {
  filter: grayscale(1) saturate(0);
  opacity: .52;
  border-color: #46505a;
  background: #252b31;
}

.upgrade-card.is-unaffordable .buy-upgrade {
  cursor: not-allowed;
  filter: grayscale(1) saturate(0);
}

.upgrade-card.is-unaffordable .upgrade-icon {
  filter: grayscale(1) drop-shadow(0 4px 3px rgba(0,0,0,.18));
}


/* v23 — force square master-volume handle in every browser */
#masterVolume::-webkit-slider-thumb {
  width: 22px !important;
  height: 22px !important;
  margin-top: -7px !important;
  -webkit-appearance: none !important;
  appearance: none !important;
  border: 2px solid #6d7780 !important;
  border-radius: 0 !important;
  background: #f0eee8 !important;
  box-shadow: 0 2px 5px rgba(0,0,0,.32) !important;
}

#masterVolume::-moz-range-thumb {
  width: 22px !important;
  height: 22px !important;
  border: 2px solid #6d7780 !important;
  border-radius: 0 !important;
  background: #f0eee8 !important;
  box-shadow: 0 2px 5px rgba(0,0,0,.32) !important;
}

#masterVolume::-ms-thumb {
  width: 22px !important;
  height: 22px !important;
  border: 2px solid #6d7780 !important;
  border-radius: 0 !important;
  background: #f0eee8 !important;
}

.volume-slider-wrap {
  --volume-thumb: 22px;
}


/* v24 — browser-independent square volume thumb */
.volume-slider-wrap {
  --volume-thumb: 22px;
  --volume-pos: .85;
}

.volume-thumb {
  position: absolute;
  z-index: 3;
  top: 50%;
  left: calc((100% - var(--volume-thumb)) * var(--volume-pos));
  width: var(--volume-thumb);
  height: var(--volume-thumb);
  transform: translateY(-50%);
  border: 2px solid #6d7780;
  border-radius: 0 !important;
  background: #f0eee8;
  box-shadow: 0 2px 5px rgba(0,0,0,.32);
  pointer-events: none;
}

#masterVolume::-webkit-slider-thumb {
  opacity: 0 !important;
  border: 0 !important;
  box-shadow: none !important;
}

#masterVolume::-moz-range-thumb {
  opacity: 0 !important;
  border: 0 !important;
  box-shadow: none !important;
}

#masterVolume::-ms-thumb {
  opacity: 0 !important;
  border: 0 !important;
  box-shadow: none !important;
}


/* v25 incremental gameplay */
.hud-card {
  position: relative;
  overflow: visible;
}

.hud-float {
  position: absolute;
  z-index: 25;
  left: 50%;
  bottom: 4px;
  pointer-events: none;
  white-space: nowrap;
  font-size: clamp(11px, 2.7vw, 15px);
  line-height: 1;
  font-weight: 1000;
  letter-spacing: .01em;
  text-shadow: 0 2px 0 rgba(10,14,18,.35), 0 4px 10px rgba(0,0,0,.22);
  animation: hudRewardFloat .82s cubic-bezier(.18,.76,.2,1) forwards;
}

.hud-float-cash { color: #79e176; }
.hud-float-gems { color: #7bd8f1; }

@keyframes hudRewardFloat {
  0% { opacity: 0; transform: translate(-50%, 5px) scale(.84); }
  14% { opacity: 1; transform: translate(-50%, -3px) scale(1.06); }
  70% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -30px) scale(.96); }
}

.spawn-button {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  background: #347f39;
}

.spawn-recharge-fill {
  position: absolute;
  z-index: 0;
  inset: 0;
  transform: scaleX(1);
  transform-origin: left center;
  background: linear-gradient(180deg, #61cd62 0%, #50b953 56%, #419e46 100%);
  pointer-events: none;
  will-change: transform;
}

.spawn-button .spawn-badge,
.spawn-button .spawn-copy {
  position: relative;
  z-index: 1;
}

.spawn-button.recharging {
  border-color: #4b9e4f;
  color: rgba(255,255,255,.86);
}

.spawn-button.ready {
  border-color: #68da6b;
}

.spawn-button.ready .spawn-copy > strong {
  text-shadow: 0 1px 0 rgba(30,75,31,.35);
}

.upgrade-card.is-unaffordable .upgrade-stat,
.upgrade-card.is-unaffordable .upgrade-level,
.upgrade-card.is-unaffordable p {
  filter: grayscale(1);
}

/* v27 risk slots */
.hud-float-negative { color: #ff7b72 !important; }
.juice-callout.danger strong { color: #ff837b; }
.juice-callout.danger small { color: #ffc1bc; }

/* v28 — normalized section shells + compact upgrade list */
.upgrades-frame,
.settings-frame {
  position: relative;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  padding: 0 !important;
  display: grid;
  grid-template-rows: clamp(42px, 6.4dvh, 52px) minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid #4a5662;
  border-radius: 0 !important;
  background: #252d35;
  box-shadow: none;
}

.upgrades-title,
.settings-title {
  position: static !important;
  z-index: 2;
  inset: auto !important;
  width: 100% !important;
  height: 100%;
  min-width: 0;
  transform: none !important;
  padding: 0 clamp(12px, 2.6vw, 18px);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(10px, 2.4vw, 18px);
  color: #f3f1eb;
  font-size: clamp(15px, 3.7vw, 21px);
  line-height: 1;
  font-weight: 1000;
  letter-spacing: .06em;
  text-align: center;
  white-space: nowrap;
  border-bottom: 1px solid #414c57;
  background: #252d35;
}

.upgrades-title::before,
.upgrades-title::after,
.settings-title::before,
.settings-title::after {
  content: "";
  height: 1px;
  min-width: 12px;
  flex: 1 1 80px;
  max-width: 132px;
  background: #46525e;
}

.upgrades-inner,
.settings-inner {
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 0 !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #515d68 transparent;
  border: 0 !important;
  border-radius: 0 !important;
  background: #20272e !important;
}

.upgrades-inner::-webkit-scrollbar,
.settings-inner::-webkit-scrollbar {
  display: block;
  width: 4px;
}
.upgrades-inner::-webkit-scrollbar-thumb,
.settings-inner::-webkit-scrollbar-thumb { background: #515d68; }

.upgrade-grid {
  width: 100%;
  height: auto !important;
  min-height: 100%;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) !important;
  grid-template-rows: none !important;
  grid-auto-rows: minmax(66px, auto);
  align-content: start;
  gap: 0 !important;
}

.upgrade-card {
  min-width: 0;
  min-height: 66px;
  padding: 7px 8px 7px 10px !important;
  display: grid !important;
  grid-template-columns: 42px minmax(0, 1fr) clamp(68px, 16vw, 84px) !important;
  grid-template-rows: 1fr !important;
  align-items: center;
  column-gap: 9px !important;
  row-gap: 0 !important;
  overflow: hidden;
  border: 0 !important;
  border-bottom: 1px solid #3e4954 !important;
  border-radius: 0 !important;
  background: #252d35;
  box-shadow: none !important;
}

.upgrade-card:last-child { border-bottom: 0 !important; }
.upgrade-card:nth-child(even) { background: #28313a; }

.upgrade-icon-wrap {
  grid-column: 1 !important;
  grid-row: 1 !important;
  width: 42px !important;
  height: 42px !important;
  display: grid;
  place-items: center;
  align-self: center;
  justify-self: center;
}

.upgrade-icon {
  font-size: clamp(25px, 6vw, 34px) !important;
  line-height: 1;
  filter: drop-shadow(0 3px 3px rgba(0,0,0,.2));
  transform: none !important;
}

.upgrade-copy {
  grid-column: 2 !important;
  grid-row: 1 !important;
  min-width: 0;
  display: grid !important;
  align-content: center;
  justify-items: stretch !important;
  gap: 3px !important;
}

.upgrade-name-line {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 7px;
}

.upgrade-card h3 {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #f2f1ec;
  font-size: clamp(11px, 2.55vw, 14px) !important;
  line-height: 1;
  font-weight: 1000;
  letter-spacing: .015em;
  white-space: nowrap;
}

.upgrade-level {
  min-height: 17px !important;
  padding: 2px 5px 1px !important;
  flex: 0 0 auto;
  border: 1px solid #356d38;
  border-radius: 0 !important;
  background: #244a28;
  color: #8de27e;
  font-size: 8px !important;
  line-height: 1;
  font-weight: 1000;
}

.upgrade-stat {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: clamp(10px, 2.2vw, 12px) !important;
  line-height: 1.05;
  font-weight: 1000;
  white-space: nowrap;
}

.upgrade-card p {
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #9faab4;
  font-size: clamp(7px, 1.65vw, 9px) !important;
  line-height: 1.1 !important;
  font-weight: 750;
  white-space: nowrap;
}

.buy-upgrade {
  grid-column: 3 !important;
  grid-row: 1 !important;
  width: 100% !important;
  min-width: 0;
  min-height: 38px !important;
  height: 38px;
  padding: 0 5px !important;
  align-self: center;
  justify-self: stretch;
  border-radius: 0 !important;
  font-size: clamp(10px, 2.35vw, 13px) !important;
  white-space: nowrap;
}

/* Settings now uses the exact same section rhythm as Upgrades. */
.settings-list {
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  display: grid;
  gap: 0 !important;
}

.setting-row {
  min-height: clamp(62px, 9.5dvh, 76px) !important;
  padding: 0 clamp(12px, 2.6vw, 18px) !important;
  gap: 12px !important;
  border: 0 !important;
  border-bottom: 1px solid #3e4954 !important;
  border-radius: 0 !important;
  background: #252d35 !important;
}
.setting-row:nth-child(even) { background: #28313a !important; }
.setting-row:last-child { border-bottom: 0 !important; }

.volume-row {
  min-height: clamp(96px, 14dvh, 116px) !important;
  padding-block: 11px !important;
}

@media (max-height: 720px) {
  .upgrades-frame,
  .settings-frame { grid-template-rows: 38px minmax(0, 1fr) !important; }
  .upgrades-title,
  .settings-title { font-size: 13px !important; padding-inline: 10px; }
  .upgrade-card { min-height: 58px; grid-template-columns: 36px minmax(0, 1fr) 66px !important; padding: 5px 7px !important; column-gap: 7px !important; }
  .upgrade-icon-wrap { width: 34px !important; height: 34px !important; }
  .upgrade-icon { font-size: 23px !important; }
  .buy-upgrade { height: 32px; min-height: 32px !important; font-size: 10px !important; }
  .setting-row { min-height: 55px !important; }
  .volume-row { min-height: 88px !important; }
}

@media (orientation: landscape) and (max-height: 480px) {
  .upgrades-frame,
  .settings-frame { grid-template-rows: 32px minmax(0, 1fr) !important; }
  .upgrades-title,
  .settings-title { font-size: 11px !important; }
  .upgrade-card { min-height: 50px; grid-template-columns: 30px minmax(0, 1fr) 60px !important; padding: 4px 6px !important; column-gap: 6px !important; }
  .upgrade-icon-wrap { width: 28px !important; height: 28px !important; }
  .upgrade-icon { font-size: 19px !important; }
  .upgrade-card h3 { font-size: 9px !important; }
  .upgrade-stat { font-size: 8px !important; }
  .upgrade-card p { font-size: 6.5px !important; }
  .upgrade-level { min-height: 13px !important; font-size: 6px !important; padding: 1px 3px !important; }
  .buy-upgrade { height: 27px; min-height: 27px !important; font-size: 8px !important; }
  .setting-row { min-height: 48px !important; }
  .volume-row { min-height: 74px !important; }
}


/* v29 — first custom icon batch */
.game-icon {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}

.hud-icon,
.hud > .hud-card > .hud-badge {
  overflow: visible;
}

.hud-cash-icon { width: clamp(31px, 7vw, 40px); height: clamp(31px, 7vw, 40px); }
.hud-level-icon { width: clamp(18px, 4.2vw, 25px); height: clamp(18px, 4.2vw, 25px); }
.hud-gem-icon { width: clamp(29px, 6.5vw, 37px); height: clamp(29px, 6.5vw, 37px); }

.dropper-icon {
  width: clamp(25px, 5.5vw, 32px);
  height: clamp(25px, 5.5vw, 32px);
}

.spawn-icon-img {
  width: clamp(27px, 5.8vw, 34px);
  height: clamp(27px, 5.8vw, 34px);
}

.nav-board-icon {
  width: clamp(23px, 5vw, 29px);
  height: clamp(23px, 5vw, 29px);
}

@media (max-width: 380px) {
  .hud-cash-icon { width: 29px; height: 29px; }
  .hud-level-icon { width: 17px; height: 17px; }
  .hud-gem-icon { width: 27px; height: 27px; }
  .nav-board-icon { width: 22px; height: 22px; }
}


/* v30 — unified iconitos asset set */
.upgrade-icon-img {
  display: block;
  width: 100% !important;
  height: 100% !important;
  object-fit: contain;
  font-size: 0 !important;
  filter: drop-shadow(0 2px 2px rgba(0,0,0,.18));
}

.nav-ui-icon,
.nav-board-icon {
  width: clamp(23px, 5vw, 29px);
  height: clamp(23px, 5vw, 29px);
  object-fit: contain;
}

.setting-custom-icon {
  width: clamp(34px, 7vw, 44px);
  height: clamp(34px, 7vw, 44px);
  object-fit: contain;
  flex: 0 0 auto;
}

.upgrade-card.is-unaffordable .upgrade-icon-img {
  filter: grayscale(1) brightness(.72) opacity(.72) !important;
}

@media (max-height: 720px) {
  .upgrade-icon-img { width: 34px !important; height: 34px !important; }
}

@media (orientation: landscape) and (max-height: 480px) {
  .upgrade-icon-img { width: 28px !important; height: 28px !important; }
}


/* v31 — pressed Spawn effect without moving the button box */
.spawn-button {
  transform: none !important;
}

.spawn-button .spawn-badge,
.spawn-button .spawn-copy {
  transition: transform .08s ease, filter .08s ease;
}

.spawn-button:active {
  transform: none !important;
  filter: brightness(.94);
  box-shadow:
    inset 0 4px 0 rgba(26, 92, 31, .38),
    inset 0 7px 10px rgba(18, 61, 22, .20),
    0 1px 0 #2c7432,
    0 2px 5px rgba(0,0,0,.13);
}

.spawn-button:active .spawn-badge,
.spawn-button:active .spawn-copy {
  transform: translateY(2px);
}

/* v32 juicy pass */
.spawn-button.push-hype {
  animation: spawnHype .24s cubic-bezier(.2,.84,.28,1);
}

.dropper.dropper-fire {
  animation: dropperKick .28s cubic-bezier(.22,.88,.28,1);
}

.dropper.dropper-golden {
  animation: dropperGolden .54s cubic-bezier(.22,.84,.25,1);
}

.ui-pulse,
.ui-pulse-green,
.ui-pulse-blue,
.ui-pulse-gold,
.ui-pulse-purple,
.auto-online {
  transform-origin: center;
}

.ui-pulse-green { animation: uiPulseGreen .38s ease-out; }
.ui-pulse-blue { animation: uiPulseBlue .38s ease-out; }
.ui-pulse-gold { animation: uiPulseGold .42s ease-out; }
.ui-pulse-purple { animation: uiPulsePurple .48s ease-out; }
.auto-online { animation: autoOnlinePulse .62s ease-out; }

.board-frame.impact-warm { animation: boardWarm .28s ease-out; }
.board-frame.impact-danger { animation: boardDanger .34s ease-out; }
.board-frame.impact-jackpot { animation: boardJackpot .56s cubic-bezier(.18,.84,.18,1); }

.hud-fly {
  position: absolute;
  z-index: 9;
  left: 0;
  top: 0;
  width: 10px;
  height: 10px;
  margin-left: -5px;
  margin-top: -5px;
  pointer-events: none;
  opacity: 0;
  border-radius: 50%;
  animation: hudFly .46s cubic-bezier(.18,.82,.22,1) forwards;
  animation-delay: var(--delay, 0ms);
  will-change: transform, opacity;
}

.hud-fly::before,
.hud-fly::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

.hud-fly-cash::before {
  background: radial-gradient(circle at 35% 35%, rgba(255,255,255,.92), rgba(127,224,113,.95) 42%, rgba(54,126,58,.92) 100%);
  box-shadow: 0 0 12px rgba(121,225,118,.42);
}

.hud-fly-gems::before {
  background: radial-gradient(circle at 35% 35%, rgba(255,255,255,.92), rgba(131,220,245,.96) 44%, rgba(70,140,170,.92) 100%);
  box-shadow: 0 0 12px rgba(123,216,241,.42);
}

.hud-fly::after {
  transform: scale(calc(var(--fly-scale, 1) * 1.32));
  background: rgba(255,255,255,.18);
  filter: blur(3px);
}

.rush-meter.near .juice-meter-track,
.jackpot-meter.near .juice-meter-track {
  box-shadow: 0 0 8px rgba(255,255,255,.08);
}

.rush-meter.critical .juice-meter-track,
.jackpot-meter.critical .juice-meter-track {
  animation: meterAlert .7s ease-in-out infinite;
}

.rush-meter.critical .juice-meter-top b,
.rush-meter.critical .juice-meter-top span {
  color: #ffe7a9;
}

.jackpot-meter.critical .juice-meter-top b,
.jackpot-meter.critical .juice-meter-top span {
  color: #ecd0ff;
}

.upgrade-card {
  position: relative;
  isolation: isolate;
}

.upgrade-card.upgrade-celebrate {
  animation: upgradeCelebrate .48s cubic-bezier(.18,.82,.22,1);
}

.upgrade-card.upgrade-milestone {
  animation: upgradeMilestone .88s cubic-bezier(.18,.82,.22,1);
}

.upgrade-burst,
.upgrade-float {
  position: absolute;
  pointer-events: none;
  z-index: 3;
}

.upgrade-burst {
  left: 50%;
  top: 50%;
  width: 18px;
  height: 18px;
  margin-left: -9px;
  margin-top: -9px;
  border-radius: 50%;
  border: 2px solid rgba(255,226,126,.9);
  box-shadow: 0 0 18px rgba(255,212,95,.2);
  animation: upgradeBurst .52s ease-out forwards;
}

.upgrade-burst.milestone {
  border-color: rgba(211,168,255,.92);
  box-shadow: 0 0 22px rgba(211,168,255,.24);
}

.upgrade-float {
  left: 50%;
  top: 46%;
  transform: translate(-50%, 0);
  padding: 2px 6px;
  background: rgba(27,32,38,.82);
  border: 1px solid rgba(255,255,255,.08);
  color: #ffe28e;
  font-size: clamp(8px, 1.45vw, 10px);
  font-weight: 1000;
  letter-spacing: .04em;
  white-space: nowrap;
  animation: upgradeFloat .76s cubic-bezier(.18,.8,.2,1) forwards;
}

.upgrade-float.milestone {
  color: #d6b2ff;
}

@keyframes spawnHype {
  0% { transform: scaleY(1); filter: brightness(1); }
  35% { transform: scaleY(.96); filter: brightness(.98); }
  100% { transform: scaleY(1); filter: brightness(1.04); }
}

@keyframes dropperKick {
  0% { transform: translateX(-50%) translateY(0); }
  45% { transform: translateX(-50%) translateY(2px) scaleY(.94); }
  100% { transform: translateX(-50%) translateY(0); }
}

@keyframes dropperGolden {
  0% { transform: translateX(-50%) translateY(0); box-shadow: 0 2px 0 #8d6f2e; }
  35% { transform: translateX(-50%) translateY(1px) scale(1.04,.96); box-shadow: 0 0 0 rgba(0,0,0,0), 0 0 14px rgba(255,214,98,.22); }
  100% { transform: translateX(-50%) translateY(0); box-shadow: 0 2px 0 #8d6f2e; }
}

@keyframes uiPulseGreen {
  0% { transform: scale(1); box-shadow: none; }
  40% { transform: scale(1.06); box-shadow: 0 0 0 6px rgba(121,225,118,.08); }
  100% { transform: scale(1); box-shadow: none; }
}

@keyframes uiPulseBlue {
  0% { transform: scale(1); box-shadow: none; }
  40% { transform: scale(1.06); box-shadow: 0 0 0 6px rgba(123,216,241,.08); }
  100% { transform: scale(1); box-shadow: none; }
}

@keyframes uiPulseGold {
  0% { transform: scale(1); box-shadow: none; }
  40% { transform: scale(1.06); box-shadow: 0 0 0 6px rgba(240,190,88,.08); }
  100% { transform: scale(1); box-shadow: none; }
}

@keyframes uiPulsePurple {
  0% { transform: scale(1); box-shadow: none; }
  40% { transform: scale(1.06); box-shadow: 0 0 0 6px rgba(181,139,226,.10); }
  100% { transform: scale(1); box-shadow: none; }
}

@keyframes autoOnlinePulse {
  0% { transform: scale(1); filter: brightness(1); }
  28% { transform: scale(1.03); filter: brightness(1.12); }
  100% { transform: scale(1); filter: brightness(1); }
}

@keyframes boardWarm {
  0% { transform: translateX(0); filter: brightness(1); }
  26% { transform: translateX(-1px); filter: brightness(1.03); }
  52% { transform: translateX(1px); }
  100% { transform: translateX(0); filter: brightness(1); }
}

@keyframes boardDanger {
  0% { transform: translateX(0); filter: brightness(1); }
  20% { transform: translateX(-2px); filter: brightness(.97); }
  40% { transform: translateX(2px); }
  65% { transform: translateX(-1px); }
  100% { transform: translateX(0); filter: brightness(1); }
}

@keyframes boardJackpot {
  0% { transform: scale(1); filter: brightness(1); }
  18% { transform: scale(1.006); filter: brightness(1.05); }
  36% { transform: scale(.998); }
  100% { transform: scale(1); filter: brightness(1); }
}

@keyframes hudFly {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(.68);
  }
  12% {
    opacity: 1;
    transform: translate(calc(-50% + var(--tx, 0px) * .08), calc(-50% + var(--ty, 0px) * .08 - 6px)) scale(var(--fly-scale, 1));
  }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--tx, 0px)), calc(-50% + var(--ty, 0px))) scale(.6);
  }
}

@keyframes meterAlert {
  0%, 100% { box-shadow: 0 0 0 rgba(255,255,255,0); }
  50% { box-shadow: 0 0 12px rgba(255,255,255,.10); }
}

@keyframes upgradeCelebrate {
  0% { transform: scale(1); }
  32% { transform: scale(1.018); }
  100% { transform: scale(1); }
}

@keyframes upgradeMilestone {
  0% { transform: scale(1); box-shadow: 0 4px 9px rgba(0,0,0,.13), inset 0 1px 0 rgba(255,255,255,.018); }
  24% { transform: scale(1.024); box-shadow: 0 0 0 1px rgba(211,168,255,.22), 0 8px 20px rgba(74,52,110,.24); }
  100% { transform: scale(1); box-shadow: 0 4px 9px rgba(0,0,0,.13), inset 0 1px 0 rgba(255,255,255,.018); }
}

@keyframes upgradeBurst {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.4); }
  20% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(3.5); }
}

@keyframes upgradeFloat {
  0% { opacity: 0; transform: translate(-50%, 8px) scale(.9); }
  14% { opacity: 1; transform: translate(-50%, -2px) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -28px) scale(.98); }
}

.board-frame { overflow: visible; }
.board-fx { overflow: visible; }

/* v33 — upgrade press juice + persistent-board tab safety */
.upgrade-card,
.buy-upgrade,
.upgrade-icon-wrap,
.upgrade-copy {
  transform-origin: center;
}

.upgrade-card:not(.is-unaffordable) {
  transition:
    background .09s ease,
    border-color .09s ease,
    filter .09s ease,
    box-shadow .09s ease,
    transform .09s ease;
}

.upgrade-card.upgrade-pressing:not(.is-unaffordable) {
  background: #2c3740;
  border-color: #65717c;
  box-shadow: inset 0 3px 0 rgba(0,0,0,.16) !important;
  filter: brightness(.98);
}

.upgrade-card.upgrade-pressing:not(.is-unaffordable) .upgrade-icon-wrap {
  transform: translateY(1px) scale(.94);
  transition: transform .08s ease;
}

.upgrade-card.upgrade-pressing:not(.is-unaffordable) .upgrade-copy {
  transform: translateY(1px);
  transition: transform .08s ease;
}

.buy-upgrade:not(:disabled) {
  position: relative;
  overflow: hidden;
  transform: none !important;
  transition:
    box-shadow .08s ease,
    filter .08s ease,
    background .08s ease,
    border-color .08s ease;
}

.buy-upgrade:not(:disabled)::after {
  content: "";
  position: absolute;
  left: 9%;
  right: 9%;
  top: 0;
  height: 1px;
  background: rgba(255,255,255,.18);
  opacity: .72;
  pointer-events: none;
}

.buy-upgrade:not(:disabled).is-pressing,
.buy-upgrade:not(:disabled):active {
  transform: none !important;
  background: linear-gradient(180deg, #3c9340 0%, #347f38 100%);
  border-color: #55ad59;
  box-shadow:
    inset 0 4px 0 rgba(27,78,30,.38),
    inset 0 8px 10px rgba(17,50,20,.18),
    0 1px 0 #285d2c !important;
  filter: brightness(.96);
}

.buy-upgrade:not(:disabled).is-pressing::after,
.buy-upgrade:not(:disabled):active::after {
  opacity: .15;
}

.upgrade-card.upgrade-celebrate .upgrade-icon-wrap {
  animation: upgradeIconPop .46s cubic-bezier(.18,.86,.22,1);
}

.upgrade-card.upgrade-celebrate .upgrade-stat {
  animation: upgradeStatPop .5s cubic-bezier(.18,.82,.22,1);
}

.upgrade-card.upgrade-celebrate .buy-upgrade:not(:disabled) {
  animation: upgradeButtonSuccess .5s cubic-bezier(.18,.82,.22,1);
}

@keyframes upgradeIconPop {
  0% { transform: scale(1); }
  34% { transform: scale(1.18) rotate(-3deg); }
  68% { transform: scale(.98) rotate(1deg); }
  100% { transform: scale(1) rotate(0); }
}

@keyframes upgradeStatPop {
  0% { transform: translateY(0) scale(1); filter: brightness(1); }
  32% { transform: translateY(-1px) scale(1.09); filter: brightness(1.2); }
  100% { transform: translateY(0) scale(1); filter: brightness(1); }
}

@keyframes upgradeButtonSuccess {
  0% { filter: brightness(1); }
  30% { filter: brightness(1.15); }
  100% { filter: brightness(1); }
}


/* v34 center upgrade burst on purchase focal point */
.upgrade-burst,
.upgrade-float {
  transform-origin: center;
}

.upgrade-burst {
  margin-left: 0 !important;
  margin-top: 0 !important;
  transform: translate(-50%, -50%);
}

.upgrade-float {
  transform: translate(-50%, -50%);
}

@keyframes upgradeBurst {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.4); }
  20% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(3.5); }
}

@keyframes upgradeFloat {
  0% { opacity: 0; transform: translate(-50%, calc(-50% + 8px)) scale(.9); }
  14% { opacity: 1; transform: translate(-50%, calc(-50% - 2px)) scale(1); }
  100% { opacity: 0; transform: translate(-50%, calc(-50% - 28px)) scale(.98); }
}


/* v35 — dedicated desktop landscape layout */
.desktop-settings-button,
.settings-close-button {
  display: none;
}

@media (min-width: 960px) and (orientation: landscape) {
  :root {
    --desktop-pad: clamp(12px, 1.35vw, 22px);
    --desktop-gap: clamp(12px, 1.25vw, 20px);
  }

  body {
    display: grid;
    place-items: center;
    background: #1f242b;
  }

  .app-shell {
    position: relative;
    width: min(100vw, 1600px) !important;
    max-width: none !important;
    height: 100dvh;
    margin: 0 auto;
    padding: var(--desktop-pad) !important;
    display: grid !important;
    grid-template-columns: minmax(520px, 1.28fr) minmax(410px, .92fr);
    grid-template-rows: clamp(66px, 9.5dvh, 86px) minmax(0, 1fr);
    column-gap: var(--desktop-gap);
    row-gap: 0;
    overflow: hidden;
  }

  .hud {
    grid-column: 1;
    grid-row: 1;
    width: 100%;
    height: 100%;
  }

  .hud strong {
    font-size: clamp(18px, 1.45vw, 24px);
  }

  .hud small {
    font-size: clamp(8px, .72vw, 10px);
  }

  .hud-badge {
    font-size: clamp(22px, 1.8vw, 28px);
  }

  .hud-cash-icon {
    width: clamp(32px, 2.7vw, 42px);
    height: clamp(32px, 2.7vw, 42px);
  }

  .hud-level-icon {
    width: clamp(19px, 1.55vw, 25px);
    height: clamp(19px, 1.55vw, 25px);
  }

  .hud-gem-icon {
    width: clamp(30px, 2.45vw, 38px);
    height: clamp(30px, 2.45vw, 38px);
  }

  .workspace {
    display: contents !important;
  }

  #boardScreen {
    grid-column: 1;
    grid-row: 2;
    display: block !important;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    animation: none !important;
  }

  #upgradesScreen {
    grid-column: 2;
    grid-row: 1 / 3;
    display: block !important;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    animation: none !important;
  }

  .screen.active.board-screen {
    grid-template-rows: clamp(38px, 5.3dvh, 48px) minmax(0, 1fr);
  }

  .board-layout {
    height: 100%;
    grid-template-rows: minmax(0, 1fr) clamp(72px, 10.5dvh, 92px);
  }

  .board-frame {
    padding: clamp(8px, .7vw, 12px);
    padding-top: clamp(34px, 4.7dvh, 44px);
  }

  .dropper {
    width: clamp(70px, 6.2vw, 88px);
    height: clamp(31px, 4.5dvh, 39px);
  }

  .dropper-icon {
    width: clamp(26px, 2.25vw, 33px);
    height: clamp(26px, 2.25vw, 33px);
  }

  .spawn-copy > strong {
    font-size: clamp(14px, 1.2vw, 18px);
    line-height: 1;
  }

  .spawn-copy small {
    font-size: clamp(7px, .66vw, 9px);
    line-height: 1;
  }

  .juice-hud {
    padding-inline: 0;
  }

  /* Upgrades are a permanent desktop control panel. */
  .upgrades-frame {
    height: 100%;
    grid-template-rows: clamp(48px, 6.2dvh, 58px) minmax(0, 1fr) !important;
    border-color: #4a5662;
    background: #252d35;
  }

  .upgrades-title {
    justify-content: center;
    padding: 0 58px 0 18px !important;
    font-size: clamp(15px, 1.25vw, 20px) !important;
    letter-spacing: .075em;
  }

  .upgrades-inner {
    overflow: hidden !important;
    scrollbar-width: none;
  }

  .upgrades-inner::-webkit-scrollbar {
    display: none !important;
  }

  .upgrade-grid {
    height: 100% !important;
    min-height: 0 !important;
    display: grid !important;
    grid-template-columns: 1fr !important;
    grid-auto-rows: minmax(0, auto) !important;
    align-content: start !important;
    gap: 1px !important;
    background: #3e4954;
    overflow: auto !important;
    scrollbar-width: none;
  }

  .upgrade-grid::-webkit-scrollbar {
    display: none !important;
  }

  .upgrade-card,
  .upgrade-card:nth-child(even) {
    min-width: 0;
    min-height: clamp(58px, 7.6dvh, 76px) !important;
    height: auto;
    padding: clamp(6px, .55vw, 9px) clamp(8px, .7vw, 11px) !important;
    grid-template-columns: clamp(38px, 2.9vw, 46px) minmax(0, 1fr) clamp(76px, 6.2vw, 96px) !important;
    grid-template-rows: 1fr !important;
    column-gap: clamp(7px, .62vw, 10px) !important;
    border: 0 !important;
    background: #252d35;
  }

  .upgrade-card:nth-child(even) {
    background: #28313a;
  }

  .upgrade-icon-wrap {
    width: clamp(31px, 2.55vw, 40px) !important;
    height: clamp(31px, 2.55vw, 40px) !important;
  }

  .upgrade-icon-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
  }

  .upgrade-copy {
    gap: 2px !important;
  }

  .upgrade-name-line {
    gap: 5px;
  }

  .upgrade-card h3 {
    font-size: clamp(10px, .88vw, 13px) !important;
    line-height: 1.05;
  }

  .upgrade-level {
    min-height: 15px !important;
    padding: 2px 4px 1px !important;
    font-size: clamp(6px, .5vw, 8px) !important;
  }

  .upgrade-stat {
    font-size: clamp(8.5px, .76vw, 11.5px) !important;
    line-height: 1.05;
  }

  .upgrade-card p {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    white-space: normal !important;
    overflow: hidden;
    text-overflow: clip;
    font-size: clamp(6.8px, .60vw, 9px) !important;
    line-height: 1.13 !important;
  }

  .buy-upgrade {
    height: clamp(30px, 4.4dvh, 38px);
    min-height: clamp(30px, 4.4dvh, 38px) !important;
    padding-inline: 4px !important;
    font-size: clamp(8px, .68vw, 10.5px) !important;
  }

  .desktop-settings-button {
    position: absolute;
    z-index: 40;
    top: calc(var(--desktop-pad) + 6px);
    right: calc(var(--desktop-pad) + 7px);
    width: clamp(34px, 2.8vw, 42px);
    height: clamp(34px, 2.8vw, 42px);
    padding: 7px;
    display: grid;
    place-items: center;
    border: 1px solid #56626e;
    border-radius: 0;
    background: #313a43;
    box-shadow: 0 3px 0 #1b2026, 0 7px 14px rgba(0,0,0,.18);
    cursor: pointer;
    transition: filter .12s ease, box-shadow .1s ease;
  }

  .desktop-settings-button:hover {
    filter: brightness(1.09);
  }

  .desktop-settings-button:active,
  .desktop-settings-button.active {
    box-shadow:
      inset 0 3px 0 rgba(0,0,0,.2),
      0 1px 0 #1b2026,
      0 3px 8px rgba(0,0,0,.15);
    filter: brightness(.96);
  }

  .bottom-nav {
    display: none !important;
  }

  /* Settings becomes a true desktop modal. */
  #settingsScreen {
    position: fixed !important;
    z-index: 100 !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100dvh !important;
    padding: clamp(20px, 3vw, 44px);
    display: none !important;
    align-items: center;
    justify-content: center;
    background: rgba(15, 18, 22, .72);
    animation: none !important;
  }

  #settingsScreen.active {
    display: flex !important;
    animation: desktopModalIn .15s ease both !important;
  }

  #settingsScreen .settings-frame {
    width: min(760px, calc(100vw - 80px));
    height: auto !important;
    max-height: min(560px, calc(100dvh - 70px));
    grid-template-rows: 54px auto !important;
    border: 1px solid #596572;
    background: #252d35;
    box-shadow: 0 18px 48px rgba(0,0,0,.38);
  }

  #settingsScreen .settings-title {
    position: relative !important;
    height: 54px;
    padding: 0 58px !important;
    font-size: 17px !important;
  }

  #settingsScreen .settings-title > span {
    display: inline-block;
  }

  #settingsScreen .settings-title::before,
  #settingsScreen .settings-title::after {
    max-width: 180px;
  }

  .settings-close-button {
    position: absolute;
    z-index: 2;
    top: 8px;
    right: 8px;
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    padding: 0 0 2px;
    border: 1px solid #596572;
    border-radius: 0;
    background: #313a43;
    color: #e7ebef;
    font-size: 25px;
    line-height: 1;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 2px 0 #1b2026;
  }

  .settings-close-button:active {
    box-shadow: inset 0 2px 0 rgba(0,0,0,.2);
  }

  #settingsScreen .settings-inner {
    height: auto;
    overflow: hidden !important;
  }

  #settingsScreen .settings-list {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1px !important;
    background: #3e4954;
  }

  #settingsScreen .setting-row {
    min-height: 72px !important;
    padding: 0 16px !important;
    border: 0 !important;
    background: #252d35 !important;
  }

  #settingsScreen .setting-row:nth-child(even) {
    background: #28313a !important;
  }

  #settingsScreen .volume-row,
  #settingsScreen .reset-row {
    grid-column: 1 / -1;
  }

  #settingsScreen .volume-row {
    min-height: 104px !important;
    display: grid;
    align-content: center;
  }

  #settingsScreen .reset-row {
    min-height: 72px !important;
  }

  #settingsScreen .setting-label strong {
    font-size: 14px;
  }

  #settingsScreen .setting-copy small {
    font-size: 8px;
  }

  @keyframes desktopModalIn {
    from { opacity: 0; }
    to { opacity: 1; }
  }
}

@media (min-width: 960px) and (orientation: landscape) and (max-height: 680px) {
  .app-shell {
    --desktop-pad: 10px;
    --desktop-gap: 10px;
    grid-template-columns: minmax(500px, 1.32fr) minmax(400px, .9fr);
    grid-template-rows: 62px minmax(0, 1fr);
  }

  .upgrades-frame {
    grid-template-rows: 42px minmax(0, 1fr) !important;
  }

  .upgrades-title {
    font-size: 13px !important;
  }

  .upgrade-card {
    grid-template-columns: 32px minmax(0, 1fr) 62px !important;
    padding: 5px 6px !important;
    column-gap: 6px !important;
  }

  .upgrade-icon-wrap {
    width: 29px !important;
    height: 29px !important;
  }

  .upgrade-card h3 {
    font-size: 8.5px !important;
  }

  .upgrade-stat {
    font-size: 7.5px !important;
  }

  .upgrade-card p {
    font-size: 6px !important;
    -webkit-line-clamp: 1;
  }

  .buy-upgrade {
    height: 28px;
    min-height: 28px !important;
    font-size: 7.5px !important;
  }

  #settingsScreen .settings-frame {
    width: min(720px, calc(100vw - 50px));
    max-height: calc(100dvh - 30px);
  }

  #settingsScreen .settings-title {
    height: 46px;
  }

  #settingsScreen .setting-row {
    min-height: 60px !important;
  }

  #settingsScreen .volume-row {
    min-height: 88px !important;
  }

  #settingsScreen .reset-row {
    min-height: 60px !important;
  }
}


@media (min-width: 960px) and (orientation: landscape) {
  .spawn-button {
    height: 100%;
    min-height: 0 !important;
    padding: 0 14px !important;
    align-items: center !important;
  }

  .spawn-badge {
    width: clamp(38px, 3vw, 48px);
    height: clamp(38px, 3vw, 48px);
    flex: 0 0 auto;
  }

  .spawn-copy {
    gap: 2px;
    min-width: 0;
  }
}


/* v37 — Settings icon consistency + visible title */
.settings-title > span,
#settingsScreen .settings-title > span {
  display: inline-block !important;
  color: #f3f1eb !important;
}

.setting-label > img,
.setting-custom-icon,
.setting-audio-icon {
  filter: grayscale(1) brightness(0) invert(1) opacity(.88) !important;
}

.setting-svg:not(.reset-svg) {
  stroke: #eef2f4 !important;
  opacity: .9;
}

.setting-audio-icon {
  width: clamp(34px, 7vw, 44px);
  height: clamp(34px, 7vw, 44px);
  object-fit: contain;
  flex: 0 0 auto;
}

@media (min-width: 960px) and (orientation: landscape) {
  #settingsScreen .settings-title {
    color: #f3f1eb !important;
  }

  #settingsScreen .settings-title > span {
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
  }
}


/* v38 desktop push real fix */
@media (min-width: 960px) and (orientation: landscape) {
  #boardScreen {
    min-height: 0;
    overflow: visible;
  }

  .screen.active.board-screen {
    grid-template-rows: clamp(40px, 5.4dvh, 50px) minmax(0, 1fr) !important;
    gap: 8px !important;
    min-height: 0;
    overflow: visible;
  }

  .board-layout {
    height: 100%;
    min-height: 0;
    grid-template-rows: minmax(0, 1fr) auto !important;
    gap: 8px !important;
    padding-bottom: 10px !important;
    overflow: visible;
  }

  .board-frame {
    min-height: 0;
  }

  .spawn-button {
    height: clamp(68px, 9.5dvh, 84px) !important;
    min-height: clamp(68px, 9.5dvh, 84px) !important;
    max-height: none !important;
    align-self: end !important;
    padding: 0 14px !important;
    overflow: hidden;
    box-shadow: 0 5px 0 #2c7432, 0 8px 14px rgba(0,0,0,.18);
  }

  .spawn-badge {
    width: clamp(40px, 3.15vw, 50px) !important;
    height: clamp(40px, 3.15vw, 50px) !important;
    display: inline-grid;
    place-items: center;
  }

  .spawn-icon-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
  }

  .spawn-copy {
    gap: 3px !important;
  }

  .spawn-copy > strong {
    font-size: clamp(14px, 1.15vw, 18px) !important;
    line-height: 1 !important;
  }

  .spawn-copy small {
    font-size: clamp(7px, .64vw, 9px) !important;
    line-height: 1 !important;
    gap: 6px !important;
  }

  .upgrades-inner {
    overflow: hidden !important;
  }

  .upgrade-grid {
    grid-template-columns: 1fr !important;
    grid-auto-rows: auto !important;
    align-content: start !important;
    overflow: auto !important;
  }
}

@media (min-width: 960px) and (orientation: landscape) and (max-height: 680px) {
  .screen.active.board-screen {
    gap: 6px !important;
  }

  .board-layout {
    grid-template-rows: minmax(0, 1fr) auto !important;
    gap: 6px !important;
    padding-bottom: 8px !important;
  }

  .spawn-button {
    height: 62px !important;
    min-height: 62px !important;
    padding-inline: 12px !important;
  }

  .spawn-badge {
    width: 36px !important;
    height: 36px !important;
  }

  .spawn-copy > strong {
    font-size: 13px !important;
  }

  .spawn-copy small {
    font-size: 7px !important;
  }
}

/* v40 — Moons Studio splash -> Plinko Cash loading -> game */
body.booting .app-shell,
body.booting .desktop-settings-button,
body.booting .app-toast {
  opacity: 0 !important;
  pointer-events: none !important;
}

.app-shell,
.desktop-settings-button {
  transition: opacity .34s ease;
}

body.game-ready .app-shell,
body.game-ready .desktop-settings-button {
  opacity: 1;
}

.startup-flow {
  position: fixed;
  z-index: 9999;
  inset: 0;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: #1f242b;
  color: #f3f5f7;
  isolation: isolate;
  opacity: 1;
}

.startup-stage {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}

.startup-splash {
  z-index: 2;
  opacity: 1;
  transform: translateY(0);
  transition:
    opacity .48s ease,
    transform .52s cubic-bezier(.2,.75,.25,1);
}

.startup-brand-logo {
  display: block;
  width: min(72vw, 390px);
  max-height: 54dvh;
  object-fit: contain;
  opacity: 0;
  transform: translateY(8px) scale(.965);
  animation: startupBrandIn .56s cubic-bezier(.2,.8,.25,1) .08s forwards;
  user-select: none;
  -webkit-user-drag: none;
}

.startup-loading {
  z-index: 1;
  align-content: center;
  justify-items: center;
  gap: clamp(22px, 4.5dvh, 38px);
  padding: 24px;
  opacity: 0;
  transform: translateY(26px);
  transition:
    opacity .48s ease .08s,
    transform .52s cubic-bezier(.2,.75,.25,1) .04s;
}

.startup-game-title {
  display: block;
  width: min(78vw, 430px);
  max-height: 47dvh;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
  filter: drop-shadow(0 10px 18px rgba(0,0,0,.24));
}

.startup-loader {
  width: min(68vw, 340px);
  display: grid;
  gap: 9px;
}

.startup-loader-track {
  width: 100%;
  height: 6px;
  overflow: hidden;
  border: 1px solid #46515c;
  background: #2b323a;
}

.startup-loader-track i {
  display: block;
  width: 100%;
  height: 100%;
  transform: scaleX(0);
  transform-origin: left center;
  background: #55c45a;
  transition: transform .16s cubic-bezier(.2,.75,.25,1);
  will-change: transform;
}

.startup-loader-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #aab4be;
  font-size: clamp(8px, 2vw, 10px);
  line-height: 1;
  font-weight: 900;
  letter-spacing: .12em;
}

.startup-loader-meta b {
  color: #dce2e6;
  font-size: 1em;
  letter-spacing: .04em;
}

.startup-flow.show-loading .startup-splash {
  opacity: 0;
  transform: translateY(-30px);
  pointer-events: none;
}

.startup-flow.show-loading .startup-loading {
  opacity: 1;
  transform: translateY(0);
}

.startup-flow.startup-finished {
  opacity: 0;
  pointer-events: none;
  transition: opacity .46s ease;
}

@keyframes startupBrandIn {
  0% {
    opacity: 0;
    transform: translateY(8px) scale(.965);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (min-width: 960px) and (orientation: landscape) {
  .startup-brand-logo {
    width: min(35vw, 410px);
    max-height: 58dvh;
  }

  .startup-game-title {
    width: min(34vw, 430px);
    max-height: 50dvh;
  }

  .startup-loader {
    width: min(30vw, 360px);
  }
}

@media (orientation: landscape) and (max-height: 520px) {
  .startup-loading {
    gap: 12px;
  }

  .startup-brand-logo {
    width: min(32vw, 300px);
    max-height: 62dvh;
  }

  .startup-game-title {
    width: min(30vw, 300px);
    max-height: 55dvh;
  }

  .startup-loader {
    width: min(34vw, 300px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .startup-brand-logo {
    animation-duration: .01ms !important;
  }

  .startup-splash,
  .startup-loading,
  .startup-flow.startup-finished,
  .startup-loader-track i {
    transition-duration: .01ms !important;
  }
}

/* v41 — separate Music / SFX volume controls */
.volume-input {
  position: absolute;
  z-index: 2;
  inset: 0;
  width: 100%;
  height: 32px;
  margin: 0;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
}

.volume-input::-webkit-slider-runnable-track {
  height: 8px;
  background: transparent;
}

.volume-input::-webkit-slider-thumb {
  width: var(--volume-thumb);
  height: var(--volume-thumb);
  margin-top: -7px;
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  opacity: 0;
}

.volume-input::-moz-range-track {
  height: 8px;
  background: transparent;
}

.volume-input::-moz-range-thumb {
  width: var(--volume-thumb);
  height: var(--volume-thumb);
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  opacity: 0;
}

.volume-input:focus-visible {
  outline: none;
}

.volume-input:focus-visible + .volume-thumb,
.volume-slider-wrap:focus-within .volume-thumb {
  outline: 2px solid #d9c68f;
  outline-offset: 3px;
}

.volume-value {
  min-width: 52px;
  padding: 6px 9px;
  border: 1px solid #635a3f;
  border-radius: 0 !important;
  background: #252c33;
  color: #e7c575;
  font-size: 13px;
  line-height: 1;
  font-weight: 900;
  text-align: center;
}

.audio-volume-row .volume-rail i {
  background: #d4a94d;
}

.sfx-volume-row .volume-rail i {
  background: #69c867;
}

.sfx-volume-row .volume-value {
  border-color: #476c49;
  color: #8fe18a;
}

@media (orientation: landscape) and (max-height: 480px) {
  .volume-value { font-size: 11px; }
}

/* v44 — fix desktop board vertical overflow at the source */
@media (min-width: 960px) and (orientation: landscape) {
  /* The desktop board must remain a two-row grid: juice rail + gameplay.
     display:block made board-layout:100% overflow by the rail height. */
  #boardScreen,
  #boardScreen.screen.active.board-screen {
    display: grid !important;
    grid-template-rows: clamp(40px, 5.4dvh, 50px) minmax(0, 1fr) !important;
    gap: 8px !important;
    height: 100% !important;
    min-height: 0 !important;
    overflow: visible !important;
  }

  #boardScreen .juice-hud {
    min-height: 0;
    height: 100%;
  }

  #boardScreen .board-layout {
    width: 100%;
    height: 100% !important;
    min-height: 0 !important;
    grid-template-rows: minmax(0, 1fr) auto !important;
    gap: 8px !important;
    padding-bottom: 0 !important;
    overflow: visible !important;
  }

  #boardScreen .spawn-button {
    margin-bottom: 0 !important;
  }
}

@media (min-width: 960px) and (orientation: landscape) and (max-height: 680px) {
  #boardScreen,
  #boardScreen.screen.active.board-screen {
    grid-template-rows: 34px minmax(0, 1fr) !important;
    gap: 6px !important;
  }

  #boardScreen .board-layout {
    gap: 6px !important;
    padding-bottom: 0 !important;
  }
}


/* v49 — Gem Powers: overlay control attached to PUSH without consuming board height */
.board-layout {
  position: relative;
}

#boardScreen .spawn-button {
  padding-left: clamp(68px, 17vw, 84px) !important;
  padding-right: clamp(68px, 17vw, 84px) !important;
}

.gem-power-control {
  position: absolute;
  z-index: 24;
  right: 7px;
  bottom: 6px;
  width: clamp(52px, 14vw, 62px);
  height: calc(var(--spawn-h) - 12px);
  pointer-events: none;
}

.gem-power-toggle {
  pointer-events: auto;
  width: 100%;
  height: 100%;
  padding: 5px 3px 4px;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  grid-template-columns: 1fr auto;
  align-items: center;
  justify-items: center;
  column-gap: 1px;
  cursor: pointer;
  border: 1px solid #69cce9;
  border-radius: 0;
  background: linear-gradient(180deg, #3598b8 0%, #277d9a 58%, #1e657f 100%);
  box-shadow: 0 4px 0 #174d61, 0 7px 12px rgba(0,0,0,.2);
  color: #fff;
  overflow: hidden;
}

.gem-power-toggle::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border: 1px solid rgba(255,255,255,.08);
}

.gem-power-toggle > img {
  grid-column: 1;
  grid-row: 1;
  width: clamp(24px, 6.6vw, 31px);
  height: clamp(24px, 6.6vw, 31px);
  object-fit: contain;
  filter: drop-shadow(0 2px 2px rgba(0,0,0,.25));
}

.gem-power-toggle > strong {
  grid-column: 2;
  grid-row: 1;
  align-self: center;
  min-width: 13px;
  font-size: clamp(12px, 3.2vw, 15px);
  line-height: 1;
  font-weight: 900;
  text-shadow: 0 1px 1px rgba(0,0,0,.35);
}

.gem-power-toggle > span {
  grid-column: 1 / 3;
  grid-row: 2;
  font-size: 7px;
  line-height: 1;
  font-weight: 900;
  letter-spacing: .45px;
  opacity: .92;
}

.gem-power-toggle:active,
.gem-power-toggle.menu-open {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #174d61, 0 3px 6px rgba(0,0,0,.18);
  filter: brightness(.96);
}

.gem-power-toggle.armed {
  border-color: #9ee7ff;
  box-shadow: 0 4px 0 #174d61, 0 0 0 2px rgba(105,204,233,.18), 0 7px 12px rgba(0,0,0,.2);
}

.gem-power-toggle.armed > img {
  animation: gemPowerArmedPulse 1.1s ease-in-out infinite;
}

@keyframes gemPowerArmedPulse {
  0%,100% { transform: scale(1); }
  50% { transform: scale(1.11); }
}

.gem-power-menu {
  pointer-events: none;
  position: absolute;
  z-index: 40;
  right: -7px;
  bottom: calc(100% + 10px);
  width: min(330px, calc(100vw - 26px));
  display: grid;
  gap: 0;
  border: 1px solid #536170;
  background: #252c34;
  box-shadow: 0 12px 30px rgba(0,0,0,.36);
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px) scale(.985);
  transform-origin: bottom right;
  transition: opacity .13s ease, transform .13s ease, visibility .13s step-end;
}

.gem-power-menu.open {
  pointer-events: auto;
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  transition: opacity .13s ease, transform .13s ease, visibility 0s;
}

.gem-power-menu-head {
  min-height: 43px;
  padding: 7px 10px 6px;
  display: grid;
  align-content: center;
  gap: 1px;
  border-bottom: 1px solid #43505d;
  background: #2d3640;
}

.gem-power-menu-head span {
  color: #f4f7fa;
  font-size: 12px;
  line-height: 1;
  font-weight: 900;
  letter-spacing: .5px;
}

.gem-power-menu-head small {
  color: #8fa0ad;
  font-size: 7px;
  line-height: 1;
  font-weight: 900;
  letter-spacing: .35px;
}

.gem-power-option {
  width: 100%;
  min-height: 58px;
  padding: 7px 8px;
  display: grid;
  grid-template-columns: 42px minmax(0,1fr) auto;
  align-items: center;
  gap: 8px;
  text-align: left;
  cursor: pointer;
  border-bottom: 1px solid #3c4752;
  border-radius: 0;
  background: #28313a;
  color: #f5f7f9;
}

.gem-power-option:hover:not(:disabled) { background: #303c47; }
.gem-power-option:active:not(:disabled) { background: #253843; }

.gem-power-option:disabled {
  cursor: default;
  opacity: .43;
}

.gem-power-option.is-armed {
  opacity: 1;
  background: #263943;
}

.gem-power-option-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
}

.gem-power-option-icon img {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.gem-power-option-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.gem-power-option-copy strong {
  font-size: 11px;
  line-height: 1;
  font-weight: 900;
  letter-spacing: .2px;
}

.gem-power-option-copy small {
  overflow: hidden;
  color: #99a8b5;
  font-size: 7px;
  line-height: 1.1;
  font-weight: 800;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.gem-power-cost {
  min-width: 42px;
  height: 28px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: 1px solid #397e94;
  background: #213e49;
  color: #c8f4ff;
  font-size: 11px;
  line-height: 1;
  font-weight: 900;
}

.gem-power-cost img {
  width: 17px;
  height: 17px;
  object-fit: contain;
}

.gem-power-cost span {
  color: #86dcf4;
  font-size: 8px;
  letter-spacing: .35px;
}

.gem-power-foot {
  padding: 6px 8px;
  color: #b7c4ce;
  background: #222931;
  font-size: 7px;
  line-height: 1;
  font-weight: 900;
  letter-spacing: .3px;
  text-align: center;
}

@media (min-width: 960px) and (orientation: landscape) {
  #boardScreen .spawn-button {
    padding-left: 76px !important;
    padding-right: 76px !important;
  }

  .gem-power-control {
    right: 8px;
    bottom: 7px;
    width: 58px;
    height: clamp(48px, 7.8dvh, 66px);
  }

  .gem-power-toggle > img { width: 28px; height: 28px; }
  .gem-power-toggle > strong { font-size: 13px; }
  .gem-power-toggle > span { font-size: 6px; }

  .gem-power-menu {
    right: -8px;
    width: 316px;
  }
}

@media (max-width: 380px) {
  #boardScreen .spawn-button {
    padding-left: 60px !important;
    padding-right: 60px !important;
  }
  .gem-power-control { right: 5px; width: 48px; }
  .gem-power-toggle > span { font-size: 6px; }
  .gem-power-menu { right: -5px; width: calc(100vw - 18px); }
}

/* v50 — clearer upgrade values + Drop Ball identity */
.drop-ball-icon {
  position: relative;
  display: block;
  width: clamp(24px, 5.8vw, 32px);
  aspect-ratio: 1;
  border: 2px solid rgba(255,255,255,.88);
  border-radius: 50%;
  background: #f5f7f8;
  box-shadow:
    inset 0 -4px 0 rgba(145,159,170,.34),
    0 3px 5px rgba(0,0,0,.22);
}

.drop-ball-icon::after {
  content: "";
  position: absolute;
  width: 25%;
  aspect-ratio: 1;
  left: 22%;
  top: 18%;
  border-radius: 50%;
  background: rgba(255,255,255,.92);
}

/* The stat is the primary value of an upgrade; make it readable at a glance. */
.upgrade-card .upgrade-stat {
  font-size: clamp(13px, 3vw, 17px) !important;
  line-height: 1.05 !important;
}

/* Secondary line below DROP BALL: ball count + loader state. */
#boardScreen .spawn-copy small {
  font-size: clamp(11px, 2.35vw, 13px) !important;
  gap: clamp(7px, 1.8vw, 11px) !important;
  font-weight: 900;
}

#boardScreen .spawn-copy small b,
#boardScreen .spawn-copy small i {
  letter-spacing: .025em;
}

@media (min-width: 960px) and (orientation: landscape) {
  .upgrade-card .upgrade-stat {
    font-size: clamp(11px, .92vw, 14px) !important;
  }

  #boardScreen .spawn-copy small {
    font-size: clamp(9.5px, .78vw, 11.5px) !important;
    gap: 8px !important;
  }

  #boardScreen .drop-ball-icon {
    width: clamp(26px, 2.2vw, 34px);
  }
}

@media (min-width: 960px) and (orientation: landscape) and (max-height: 680px) {
  .upgrade-card .upgrade-stat {
    font-size: 10px !important;
  }

  #boardScreen .spawn-copy small {
    font-size: 9px !important;
  }

  #boardScreen .drop-ball-icon {
    width: 26px;
  }
}

@media (max-width: 380px), (max-height: 560px) and (orientation: portrait) {
  .upgrade-card .upgrade-stat {
    font-size: 11.5px !important;
  }

  #boardScreen .spawn-copy small {
    font-size: 10px !important;
  }
}

/* v51 — upgrade BUY price/button readability */
/* The purchase price is a primary action, so keep it visually strong on every layout. */
.upgrade-card {
  grid-template-columns: 42px minmax(0, 1fr) clamp(84px, 20vw, 104px) !important;
}

.buy-upgrade {
  min-height: 40px !important;
  height: 40px !important;
  padding-inline: 7px !important;
  font-size: clamp(13px, 3.15vw, 16px) !important;
  line-height: 1 !important;
  letter-spacing: .01em;
  font-weight: 1000 !important;
}

.buy-upgrade .buy-price,
.buy-upgrade strong,
.buy-upgrade span {
  font-size: inherit !important;
  line-height: inherit !important;
}

@media (min-width: 960px) and (orientation: landscape) {
  .upgrade-card,
  .upgrade-card:nth-child(even) {
    grid-template-columns: clamp(38px, 2.9vw, 46px) minmax(0, 1fr) clamp(96px, 7.6vw, 118px) !important;
  }

  .buy-upgrade {
    height: clamp(36px, 4.8dvh, 42px) !important;
    min-height: clamp(36px, 4.8dvh, 42px) !important;
    padding-inline: 6px !important;
    font-size: clamp(12.5px, 1.02vw, 15.5px) !important;
  }
}

@media (min-width: 960px) and (orientation: landscape) and (max-height: 680px) {
  .upgrade-card,
  .upgrade-card:nth-child(even) {
    grid-template-columns: 32px minmax(0, 1fr) 84px !important;
  }

  .buy-upgrade {
    height: 32px !important;
    min-height: 32px !important;
    font-size: 11.5px !important;
    padding-inline: 4px !important;
  }
}

@media (orientation: landscape) and (max-height: 480px) and (max-width: 959px) {
  .upgrade-card {
    grid-template-columns: 30px minmax(0, 1fr) 72px !important;
  }

  .buy-upgrade {
    height: 29px !important;
    min-height: 29px !important;
    font-size: 10.5px !important;
  }
}

/* v52 — DROP BALL + Gems are true sibling buttons */
.board-actions {
  width: 100%;
  height: var(--spawn-h);
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(7px, 1.8vw, 10px);
  position: relative;
}

/* Gem Powers no longer floats inside DROP BALL. */
#boardScreen .board-actions .spawn-button {
  width: 100%;
  height: 100%;
  min-width: 0;
  margin: 0 !important;
  padding-left: clamp(14px, 3vw, 22px) !important;
  padding-right: clamp(14px, 3vw, 22px) !important;
}

#boardScreen .board-actions .gem-power-control {
  position: relative !important;
  right: auto !important;
  bottom: auto !important;
  z-index: 24;
  width: clamp(50px, 13vw, 58px);
  height: auto !important;
  aspect-ratio: 1 / 1;
  align-self: center;
  pointer-events: none;
}

#boardScreen .board-actions .gem-power-toggle {
  position: relative;
  width: 100%;
  height: 100%;
  aspect-ratio: 1 / 1;
  padding: 5px 3px 4px;
}

#boardScreen .board-actions .gem-power-menu {
  right: 0 !important;
  bottom: calc(100% + 10px) !important;
}

@media (min-width: 960px) and (orientation: landscape) {
  #boardScreen .board-actions {
    height: clamp(68px, 9.5dvh, 84px);
    gap: 8px;
  }

  #boardScreen .board-actions .spawn-button {
    height: 100% !important;
    min-height: 0 !important;
    padding-inline: 14px !important;
  }

  #boardScreen .board-actions .gem-power-control {
    width: clamp(50px, 7.4dvh, 60px);
  }

  #boardScreen .board-actions .gem-power-menu {
    right: 0 !important;
    width: 316px;
  }
}

@media (min-width: 960px) and (orientation: landscape) and (max-height: 680px) {
  #boardScreen .board-actions {
    height: 62px;
    gap: 6px;
  }

  #boardScreen .board-actions .gem-power-control {
    width: 48px;
  }
}

@media (max-width: 380px) {
  #boardScreen .board-actions {
    gap: 6px;
  }

  #boardScreen .board-actions .gem-power-control {
    width: 48px;
  }

  #boardScreen .board-actions .gem-power-menu {
    right: 0 !important;
    width: calc(100vw - 18px);
  }
}

/* v53 — Gem button matches DROP BALL height while staying square */
#boardScreen .board-actions {
  gap: 4px !important;
  align-items: stretch !important;
}

#boardScreen .board-actions .gem-power-control {
  height: 100% !important;
  width: auto !important;
  min-width: 0 !important;
  aspect-ratio: 1 / 1 !important;
  align-self: stretch !important;
}

#boardScreen .board-actions .gem-power-toggle {
  width: 100% !important;
  height: 100% !important;
  min-width: 0 !important;
  aspect-ratio: 1 / 1 !important;
}

@media (min-width: 960px) and (orientation: landscape) {
  #boardScreen .board-actions {
    gap: 4px !important;
  }

  #boardScreen .board-actions .gem-power-control {
    height: 100% !important;
    width: auto !important;
  }
}

@media (min-width: 960px) and (orientation: landscape) and (max-height: 680px),
       (max-width: 380px) {
  #boardScreen .board-actions {
    gap: 4px !important;
  }

  #boardScreen .board-actions .gem-power-control {
    height: 100% !important;
    width: auto !important;
  }
}

/* v54 — economy curve telemetry export */
.telemetry-export-button {
  min-width: 118px;
  height: 44px;
  padding: 0 14px;
  border: 1px solid #4e7e9b;
  border-radius: 0;
  background: #315c73;
  box-shadow: 0 3px 0 #213e4e;
  color: #f5fbff;
  font: 1000 11px/1 Nunito, system-ui, sans-serif;
  letter-spacing: .045em;
  cursor: pointer;
  transition: transform .08s ease, filter .12s ease, background .12s ease;
}
.telemetry-export-button:active { transform: translateY(2px); box-shadow: 0 1px 0 #213e4e; }
.telemetry-export-button.done { background: #3e7b51; border-color: #5b9c6d; box-shadow: 0 3px 0 #295437; }
.telemetry-export-button:focus-visible { outline: 2px solid #d9c68f; outline-offset: 3px; }
.telemetry-row .setting-label img { filter: none !important; }

@media (min-width: 960px) and (orientation: landscape) {
  #settingsScreen .telemetry-row { grid-column: 1 / -1; min-height: 72px !important; }
}
@media (min-width: 960px) and (orientation: landscape) and (max-height: 680px) {
  #settingsScreen .telemetry-row { min-height: 60px !important; }
  .telemetry-export-button { min-width: 100px; height: 36px; font-size: 10px; padding-inline: 10px; }
}
@media (max-width: 380px) {
  .telemetry-export-button { min-width: 96px; height: 40px; font-size: 9px; padding-inline: 9px; }
}


/* v55 — progression locks + rebalance clarity */
.upgrade-card.is-locked {
  filter: grayscale(.78) saturate(.38);
  opacity: .58;
  border-color: #424c55 !important;
  background: #242b31 !important;
}
.upgrade-card.is-locked .upgrade-icon-img { filter: grayscale(.75) opacity(.82) !important; }
.upgrade-card.is-locked .upgrade-stat { color: #aab3bc !important; }
.upgrade-card.is-locked .upgrade-level { border-color: #535d66 !important; background: #30383f !important; color: #aab3bc !important; }
.upgrade-card.is-locked .buy-upgrade {
  cursor: not-allowed !important;
  border-color: #505b64 !important;
  background: #353e46 !important;
  color: #aeb7bf !important;
  box-shadow: none !important;
}

/* v59 — prevent accidental text selection across the game UI */
html,
body,
body * {
  -webkit-user-select: none !important;
  user-select: none !important;
  -webkit-touch-callout: none;
}

::selection {
  background: transparent;
}


/* v60 — input reliability: stable interactive targets */
.buy-upgrade,
.spawn-button,
.gem-power-toggle,
.gem-power-option,
.bottom-nav button,
.settings-icon-button,
.telemetry-export-button {
  touch-action: manipulation;
}

.gem-power-cost img[hidden] {
  display: none !important;
}
