:root {
  --bg-0: #064523;
  --bg-1: #08351f;
  --panel: #10251f;
  --panel-2: #082f23;
  --panel-3: #193c31;
  --field: #071f19;
  --line: #14533a;
  --line-soft: #23684d;
  --ink: #ffffff;
  --muted: #b8cec2;
  --dim: #88a798;
  --accent: #00c838;
  --accent-strong: #36e06d;
  --accent-dark: #064523;
  --warning: #ff5a76;
  --success: #00c838;
  --sky-top: #bfefff;
  --sky-mid: #67cfff;
  --sky-bottom: #2ea6e8;
  --platform-top: #00c838;
  --platform-side: #6f522f;
  --shadow: rgba(0, 20, 11, 0.28);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  margin: 0;
  padding: 10px 0 20px;
  background:
    linear-gradient(180deg, #043f25 0 72px, rgba(11, 82, 43, 0.95) 72px, #064322 100%),
    var(--bg-0);
  color: var(--ink);
  font-family:
    "Segoe UI", "Helvetica Neue", Arial, ui-sans-serif, system-ui,
    sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
  touch-action: manipulation;
}

.balance-top {
  width: min(1198px, calc(100vw - 28px));
  min-height: 44px;
  margin: 0 auto 10px;
  display: flex;
  justify-content: center;
  pointer-events: none;
}

.balance-pill {
  min-height: 44px;
  display: inline-grid;
  grid-template-columns: auto auto 32px;
  align-items: center;
  gap: 10px;
  padding: 6px 7px 6px 14px;
  border-radius: 8px;
  background: #073720;
  box-shadow: 0 14px 28px rgba(0, 20, 11, 0.18);
  pointer-events: auto;
}

.balance-pill span {
  color: var(--dim);
  font-size: 0.72rem;
  font-weight: 700;
}

.balance-pill strong {
  color: var(--ink);
  font-family: "Consolas", "SFMono-Regular", Menlo, monospace;
  font-size: 1rem;
  font-weight: 800;
}

.reset-balance {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 7px;
  background: var(--panel-3);
  color: #ffffff;
  cursor: pointer;
  font-size: 1.22rem;
  font-weight: 800;
  line-height: 1;
}

.reset-balance:hover:not(:disabled) {
  background: var(--accent);
}

.reset-balance:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.game-shell {
  width: min(1198px, calc(100vw - 28px));
  min-height: clamp(620px, calc(100vh - 148px), 760px);
  margin: 40px auto 0;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 16px;
  overflow: visible;
  border: 0;
  border-radius: 10px;
  background: transparent;
  box-shadow: none;
}

.betting-panel {
  display: flex;
  flex-direction: column;
  background: var(--panel-2);
  border: 0;
  border-radius: 10px;
  box-shadow: 0 18px 35px rgba(0, 20, 11, 0.22);
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 42px;
  height: auto;
  margin: 20px 16px 0;
  padding: 4px;
  gap: 4px;
  border: 0;
  border-radius: 8px;
  background: var(--field);
}

.tab {
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 700;
  font-size: 0.86rem;
}

.tab.is-active {
  background: #273d37;
  color: #ffffff;
}

.tab:disabled {
  cursor: not-allowed;
  opacity: 0.75;
}

.controls {
  margin: 0;
  padding: 16px;
  min-height: 0;
  border-radius: 0;
  background: transparent;
}

.field-label,
.mode-field legend {
  display: block;
  margin: 0 0 8px;
  color: #ffffff;
  font-size: 0.88rem;
  font-weight: 700;
}

.amount-control {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) repeat(3, 43px);
  align-items: center;
  min-height: 44px;
  height: 44px;
  margin-bottom: 14px;
  overflow: hidden;
  border: 0;
  border-radius: 8px;
  background: var(--field);
  box-shadow: none;
}

.currency {
  width: 18px;
  height: 18px;
  margin-left: 14px;
  border-radius: 50%;
  background: var(--accent);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: "Consolas", "SFMono-Regular", Menlo, monospace;
  font-size: 0.76rem;
  font-weight: 700;
}

.amount-control input {
  width: 100%;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  padding: 0 10px;
  background: transparent;
  color: #ffffff;
  font-family: "Consolas", "SFMono-Regular", Menlo, monospace;
  font-size: 1.08rem;
  font-weight: 700;
}

.amount-control button {
  min-width: 0;
  height: 100%;
  border: 0;
  border-left: 1px solid rgba(116, 201, 143, 0.12);
  background: var(--panel-3);
  color: #ffffff;
  cursor: pointer;
  font-size: 0.76rem;
  font-weight: 700;
}

.amount-control button:hover {
  background: #235341;
}

.mode-field {
  margin: 0 0 16px;
  padding: 0;
  border: 0;
}

.mode-switch {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  min-height: 42px;
  overflow: hidden;
  border: 0;
  border-radius: 8px;
  padding: 4px;
  gap: 4px;
  background: var(--field);
}

.mode-switch button {
  min-width: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #d7e7df;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 700;
}

.mode-switch button:first-child {
  border-left: 0;
}

.mode-switch button.is-active {
  background: var(--accent);
  color: #ffffff;
}

.mode-switch button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.primary-action,
.cashout-action {
  width: 100%;
  min-height: 40px;
  border-radius: 7px;
  cursor: pointer;
  font-weight: 800;
}

.primary-action {
  border: 0;
  background: var(--accent);
  color: #ffffff;
  box-shadow: none;
}

.primary-action:hover:not(:disabled) {
  filter: brightness(1.07);
}

.primary-action:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: none;
}

.cashout-action {
  margin-top: 10px;
  border: 0;
  background: var(--panel-3);
  color: #ffffff;
  box-shadow: none;
}

.cashout-action:hover:not(:disabled) {
  background: #235341;
}

.primary-action:disabled,
.cashout-action:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(100%);
  white-space: nowrap;
}

.play-panel {
  min-width: 0;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--panel);
  box-shadow: 0 18px 35px rgba(0, 20, 11, 0.2);
}

.sky-stage {
  --reveal-duration: 520ms;
  --particle-duration: 780ms;
  --jump-face-duration: 460ms;
  --fall-face-duration: 720ms;
  --win-popup-duration: 980ms;
  --result-popup-duration: 680ms;
  position: relative;
  min-height: 704px;
  height: 100%;
  overflow: hidden;
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.3), transparent 22%),
    linear-gradient(180deg, var(--sky-top) 0%, var(--sky-mid) 62%, var(--sky-bottom) 100%);
  box-shadow: inset 0 0 0 1px rgba(210, 247, 255, 0.28);
}

.sky-stage.is-fast {
  --reveal-duration: 260ms;
  --particle-duration: 390ms;
  --jump-face-duration: 230ms;
  --fall-face-duration: 360ms;
  --win-popup-duration: 490ms;
  --result-popup-duration: 340ms;
}

.speed-toggle {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 50;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 7px;
  background: rgba(7, 31, 25, 0.86);
  color: #ffffff;
  box-shadow: 0 10px 20px rgba(0, 20, 11, 0.18);
  cursor: pointer;
}

.speed-toggle:hover {
  background: rgba(25, 60, 49, 0.94);
}

.speed-toggle.is-fast {
  background: var(--accent);
  color: #ffffff;
}

.speed-toggle svg {
  width: 18px;
  height: 18px;
  filter: drop-shadow(0 1px 0 rgba(0, 20, 11, 0.28));
}

.seed-toggle {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 55;
  min-height: 30px;
  border: 0;
  border-radius: 7px;
  padding: 5px 12px;
  background: rgba(25, 60, 49, 0.92);
  color: #a6c3b6;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 800;
}

.seed-toggle:hover,
.seed-toggle[aria-expanded="true"] {
  background: var(--accent);
  color: #ffffff;
}

.seed-panel {
  position: absolute;
  right: 14px;
  bottom: 52px;
  z-index: 65;
  width: min(320px, calc(100% - 28px));
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: 9px;
  background: rgba(8, 47, 35, 0.97);
  box-shadow: 0 18px 42px rgba(0, 20, 11, 0.36);
}

.seed-panel[hidden] {
  display: none;
}

.seed-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.seed-title-row span {
  color: #ffffff;
  font-size: 0.82rem;
  font-weight: 800;
}

.seed-title-row strong {
  color: var(--accent-strong);
  font-family: "Consolas", "SFMono-Regular", Menlo, monospace;
  font-size: 0.92rem;
  font-weight: 900;
}

.seed-input {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  outline: 0;
  padding: 0 10px;
  background: var(--field);
  color: #ffffff;
  font-family: "Consolas", "SFMono-Regular", Menlo, monospace;
  font-size: 0.82rem;
  font-weight: 800;
}

.seed-input:focus-visible {
  box-shadow: 0 0 0 2px rgba(54, 224, 109, 0.32);
}

.seed-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.seed-actions button {
  min-height: 34px;
  border: 0;
  border-radius: 7px;
  background: var(--panel-3);
  color: #ffffff;
  cursor: pointer;
  font-size: 0.76rem;
  font-weight: 800;
}

.seed-actions button:hover:not(:disabled) {
  background: #235341;
}

.seed-input:disabled,
.seed-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.sun {
  position: absolute;
  top: 28px;
  right: 36px;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: #ffe271;
  box-shadow: 0 0 0 12px rgba(255, 226, 113, 0.2), 0 0 44px rgba(255, 203, 61, 0.45);
}

.distant-cloud {
  position: absolute;
  width: 150px;
  height: 44px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  filter: blur(0.2px);
}

.distant-cloud::before,
.distant-cloud::after {
  content: "";
  position: absolute;
  bottom: 10px;
  border-radius: 50%;
  background: inherit;
}

.distant-cloud::before {
  left: 24px;
  width: 54px;
  height: 54px;
}

.distant-cloud::after {
  right: 26px;
  width: 70px;
  height: 70px;
}

.cloud-a {
  top: 78px;
  left: 10%;
  animation: cloudDrift 17s linear infinite alternate;
}

.cloud-b {
  top: 202px;
  right: 12%;
  width: 120px;
  transform: scale(0.86);
  opacity: 0.72;
  animation: cloudDrift 19s linear infinite alternate-reverse;
}

.cloud-c {
  bottom: 164px;
  left: 12%;
  width: 132px;
  transform: scale(0.72);
  opacity: 0.5;
  animation: cloudDrift 23s linear infinite alternate;
}

.hills {
  position: absolute;
  left: -6%;
  right: -6%;
  bottom: -88px;
  height: 190px;
  border-radius: 50% 50% 0 0;
}

.hills-back {
  bottom: -110px;
  background: #8fdf72;
  opacity: 0.68;
  transform: rotate(-2deg);
}

.hills-front {
  bottom: -132px;
  background: #16904e;
  transform: rotate(2deg);
}

.tower-grid {
  position: absolute;
  inset: 104px clamp(18px, 7vw, 82px) 74px;
  z-index: 5;
  display: grid;
  grid-template-rows: repeat(8, minmax(56px, 1fr));
  gap: 10px;
}

.tower-grid:not(.is-active-round) .cloud-choice.is-hidden {
  opacity: 0.48;
  filter: saturate(0.74) brightness(0.9);
}

.tower-row {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--choice-count, 3), minmax(72px, 140px));
  justify-content: center;
  gap: clamp(8px, 2vw, 18px);
  transition: opacity 160ms ease, filter 160ms ease, transform 160ms ease;
}

.tower-grid.is-active-round .tower-row.is-locked-row {
  opacity: 0.38;
  filter: saturate(0.78) brightness(0.88);
}

.tower-grid.is-active-round .tower-row.is-past-row {
  opacity: 0.66;
  filter: saturate(0.9);
}

.tower-row.is-selectable,
.tower-row.is-revealing-row {
  transform: scale(1.012);
}

.tower-row.is-selectable .cloud-body,
.tower-row.is-revealing-row .cloud-body {
  box-shadow:
    inset 0 -9px 0 rgba(72, 150, 89, 0.16),
    0 8px 0 rgba(6, 69, 35, 0.14),
    0 0 0 3px rgba(0, 200, 56, 0.34),
    0 0 22px rgba(0, 200, 56, 0.22);
}

.cloud-choice {
  --reveal-delay: 0ms;
  position: relative;
  min-width: 0;
  min-height: 56px;
  border: 0;
  background: transparent;
  cursor: pointer;
  isolation: isolate;
  touch-action: manipulation;
}

.cloud-choice:disabled {
  cursor: default;
}

.cloud-choice.is-current:not(:disabled) {
  filter: drop-shadow(0 8px 0 rgba(6, 69, 35, 0.16));
}

.cloud-choice.is-current:not(:disabled):hover .cloud-body {
  transform: translateY(-4px) scale(1.03);
}

.cloud-choice.is-current:not(:disabled):active .cloud-body {
  transform: translateY(0) scale(0.98);
}

.cloud-body {
  position: absolute;
  inset: 20px 0 6px;
  z-index: 3;
  border-radius: 999px;
  background: #ffffff;
  box-shadow:
    inset 0 -9px 0 rgba(72, 150, 89, 0.16),
    0 8px 0 rgba(6, 69, 35, 0.14);
  transition: transform 170ms ease, opacity 220ms ease;
}

.cloud-body::before,
.cloud-body::after {
  content: "";
  position: absolute;
  bottom: 12px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: inset 0 -7px 0 rgba(72, 150, 89, 0.15);
}

.cloud-body::before {
  left: 14%;
  width: 42%;
  height: 38px;
}

.cloud-body::after {
  right: 11%;
  width: 48%;
  height: 45px;
}

.cloud-choice.is-current .cloud-body {
  background: #f5fff2;
}

.cloud-choice.is-current .cloud-body::before,
.cloud-choice.is-current .cloud-body::after {
  background: #f5fff2;
}

.multiplier {
  position: absolute;
  left: 50%;
  top: 54%;
  z-index: 4;
  width: 96%;
  transform: translate(-50%, -50%);
  color: #064523;
  text-shadow:
    0 2px 0 #ffffff,
    0 3px 0 rgba(13, 42, 24, 0.2);
  font-size: 13px;
  font-weight: 950;
  line-height: 1;
  pointer-events: none;
}

.multiplier.is-long {
  font-size: 11px;
}

.cloud-choice.is-current .multiplier {
  color: var(--accent-dark);
  font-size: 14px;
}

.cloud-choice.is-cleared {
  opacity: 0;
  pointer-events: none;
}

.cloud-choice.is-revealing-platform .cloud-body,
.cloud-choice.is-revealing-empty .cloud-body {
  animation: cloudVanish var(--reveal-duration) ease-out var(--reveal-delay) forwards;
}

.cloud-choice.is-revealing-platform .multiplier,
.cloud-choice.is-revealing-empty .multiplier {
  animation: multiplierFade var(--reveal-duration) ease-out var(--reveal-delay) forwards;
}

.cloud-choice.is-final-reveal .cloud-body,
.cloud-choice.is-final-reveal .multiplier {
  animation-timing-function: ease;
}

.particle {
  position: absolute;
  left: var(--x);
  top: var(--y);
  z-index: 4;
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: inset 0 -3px 0 rgba(72, 150, 89, 0.12);
  animation: puffAway var(--particle-duration) ease-out forwards;
  pointer-events: none;
}

.platform {
  position: absolute;
  left: 50%;
  top: 54%;
  z-index: 1;
  width: 78%;
  height: 20px;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  background: var(--platform-top);
  box-shadow:
    inset 0 5px 0 rgba(255, 255, 255, 0.24),
    0 9px 0 var(--platform-side),
    0 15px 12px rgba(6, 69, 35, 0.18);
  opacity: 1;
}

.cloud-choice.is-revealing-platform .platform {
  animation: platformUnderCloud var(--reveal-duration) ease-out both;
}

.cloud-choice.is-final-reveal.is-revealing-platform .platform {
  animation: platformFinalReveal var(--reveal-duration) ease-out var(--reveal-delay) both;
}

.cloud-choice.is-landed .platform {
  filter: brightness(1.08);
}

.platform::before {
  content: "";
  position: absolute;
  left: 14%;
  right: 14%;
  top: 7px;
  height: 4px;
  border-radius: 999px;
  background: rgba(22, 114, 70, 0.34);
}

.player {
  position: absolute;
  left: 50%;
  top: calc(100% - 42px);
  z-index: 20;
  width: 42px;
  height: 42px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  will-change: left, top;
}

.player.has-crown::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -12px;
  z-index: 3;
  width: 32px;
  height: 21px;
  transform: translateX(-50%);
  border-radius: 3px 3px 2px 2px;
  background: linear-gradient(180deg, #fff28a 0%, #ffc10f 56%, #d58100 100%);
  clip-path: polygon(0 100%, 0 34%, 26% 62%, 50% 0, 74% 62%, 100% 34%, 100% 100%);
  box-shadow: 0 3px 0 rgba(0, 20, 11, 0.24);
}

.player::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -12px;
  width: 34px;
  height: 10px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: rgba(6, 69, 35, 0.22);
  filter: blur(1px);
}

.player-face {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  border: 3px solid #063721;
  border-radius: 50%;
  background: linear-gradient(180deg, #ffe271, #ffc10f);
  box-shadow:
    inset 0 5px 0 rgba(255, 255, 255, 0.3),
    0 5px 0 rgba(0, 20, 11, 0.22);
}

.player-face::before,
.player-face::after {
  content: "";
  position: absolute;
  top: 13px;
  width: 5px;
  height: 7px;
  border-radius: 999px;
  background: #063721;
}

.player-face::before {
  left: 11px;
}

.player-face::after {
  right: 11px;
}

.player-face span {
  position: absolute;
  left: 50%;
  bottom: 9px;
  width: 13px;
  height: 6px;
  transform: translateX(-50%);
  border-bottom: 3px solid #063721;
  border-radius: 0 0 999px 999px;
}

.player.is-jumping .player-face {
  animation: squash var(--jump-face-duration) ease-in-out;
}

.player.is-falling .player-face {
  animation: spinFall var(--fall-face-duration) ease-in forwards;
}

.win-popup {
  position: absolute;
  z-index: 40;
  min-width: 116px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(7, 31, 25, 0.94);
  color: #ffffff;
  text-align: center;
  box-shadow: 0 12px 24px rgba(0, 20, 11, 0.28);
  transform: translate(-50%, -100%);
  pointer-events: none;
}

.win-popup[hidden] {
  display: none;
}

.win-popup.is-showing {
  animation: winPopup var(--win-popup-duration) ease-out both;
}

.win-popup strong,
.win-popup span {
  display: block;
  font-family: "Consolas", "SFMono-Regular", Menlo, monospace;
}

.result-popup {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 70;
  width: min(270px, calc(100% - 44px));
  padding: 18px 20px 20px;
  border: 1px solid rgba(54, 224, 109, 0.48);
  border-radius: 10px;
  background: rgba(7, 31, 25, 0.95);
  color: #ffffff;
  text-align: center;
  box-shadow:
    0 22px 42px rgba(0, 20, 11, 0.34),
    inset 0 0 0 1px rgba(255, 255, 255, 0.06);
  transform: translate(-50%, -50%) scale(0.96);
  pointer-events: none;
}

.result-popup[hidden] {
  display: none;
}

.result-popup.is-showing {
  animation: resultPopup var(--result-popup-duration) cubic-bezier(0.18, 0.88, 0.28, 1.2) both;
}

.result-popup span,
.result-popup strong,
.result-popup em {
  display: block;
}

.result-popup span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.result-popup strong {
  margin-top: 7px;
  color: var(--accent-strong);
  font-family: "Consolas", "SFMono-Regular", Menlo, monospace;
  font-size: clamp(2rem, 7vw, 3rem);
  line-height: 0.95;
}

.result-popup em {
  margin-top: 8px;
  color: #ffffff;
  font-family: "Consolas", "SFMono-Regular", Menlo, monospace;
  font-size: 1.05rem;
  font-style: normal;
  font-weight: 900;
}

.win-popup strong {
  color: var(--accent-strong);
  font-size: 1rem;
  line-height: 1.1;
}

.win-popup span {
  margin-top: 2px;
  color: #ffffff;
  font-size: 0.84rem;
  font-weight: 800;
}

@keyframes cloudDrift {
  from {
    translate: -8px 0;
  }
  to {
    translate: 10px 0;
  }
}

@keyframes cloudVanish {
  0% {
    opacity: 1;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(1.16);
  }
}

@keyframes multiplierFade {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%);
  }
}

@keyframes puffAway {
  0% {
    opacity: 0.95;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(calc(var(--dx) - 50%), calc(var(--dy) - 50%)) scale(0.34);
  }
}

@keyframes platformPop {
  from {
    opacity: 0;
    transform: translate(-50%, -42%) scaleX(0.72);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scaleX(1);
  }
}

@keyframes platformUnderCloud {
  0% {
    opacity: 0.58;
    transform: translate(-50%, -40%) scaleX(0.7);
  }
  45% {
    opacity: 0.82;
    transform: translate(-50%, -50%) scaleX(0.96);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, -50%) scaleX(1);
  }
}

@keyframes platformFinalReveal {
  0% {
    opacity: 0;
    transform: translate(-50%, -34%) scaleX(0.7);
  }
  58% {
    opacity: 0;
    transform: translate(-50%, -34%) scaleX(0.7);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, -50%) scaleX(1);
  }
}

@keyframes squash {
  0%,
  100% {
    transform: scale(1);
  }
  48% {
    transform: scale(0.92, 1.1);
  }
}

@keyframes spinFall {
  to {
    transform: rotate(240deg) scale(0.82);
  }
}

@keyframes winPopup {
  0% {
    opacity: 0;
    transform: translate(-50%, -84%) scale(0.94);
  }
  16% {
    opacity: 1;
    transform: translate(-50%, -112%) scale(1);
  }
  78% {
    opacity: 1;
    transform: translate(-50%, -124%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -138%) scale(0.98);
  }
}

@keyframes resultPopup {
  0% {
    opacity: 0;
    transform: translate(-50%, -45%) scale(0.92);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

@media (max-width: 880px) {
  body {
    padding: 10px 0;
  }

  .game-shell {
    width: min(760px, calc(100vw - 20px));
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .betting-panel {
    border-right: 0;
    border-bottom: 1px solid rgba(116, 201, 143, 0.15);
  }

  .controls {
    min-height: 0;
  }

  .play-panel {
    padding: 10px;
  }

  .sky-stage {
    min-height: 650px;
  }

  .tower-grid {
    inset: 76px 12px 70px;
    gap: 7px;
  }
}

@media (max-width: 520px) {
  body {
    padding: 7px 0;
  }

  .game-shell {
    width: calc(100vw - 14px);
    gap: 10px;
  }

  .balance-top {
    width: calc(100vw - 14px);
  }

  .tabs {
    margin: 12px 12px 0;
  }

  .controls {
    padding: 12px;
  }

  .amount-control {
    grid-template-columns: auto minmax(0, 1fr) repeat(3, minmax(34px, 1fr));
  }

  .currency {
    margin-left: 10px;
  }

  .amount-control input {
    padding: 0 6px;
    font-size: 0.98rem;
  }

  .amount-control button,
  .mode-switch button {
    font-size: 0.7rem;
  }

  .tower-row {
    grid-template-columns: repeat(var(--choice-count, 3), minmax(0, 1fr));
    gap: 6px;
  }

  .tower-grid {
    inset: 64px 8px 68px;
  }

  .multiplier {
    font-size: 12px;
  }
}
