:root {
  color-scheme: light;
  --design-width: 1920;
  --design-height: 1080;
  --stage-width: 1920px;
  --stage-height: 1080px;
  --stage-shell-width: 1620px;
  --selection-panel-width: 1320px;
  --game-board-width: 1580px;
  --brown: #6c3412;
  --brown-deep: #4f210a;
  --brown-rich: #8c430d;
  --cream: #fff6ea;
  --cream-deep: #ffe5b2;
  --gold: #ffcf5d;
  --gold-deep: #f2a81b;
  --sky: #4db8f3;
  --sky-deep: #2497dc;
  --sky-glow: rgba(91, 205, 255, 0.48);
  --gold-glow: rgba(255, 222, 115, 0.5);
  --pink-glow: rgba(255, 153, 203, 0.28);
  --mint: #5ec978;
  --mint-deep: #3ca85a;
  --shadow-brown: rgba(94, 43, 12, 0.18);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  width: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Lilita One", "Arial Rounded MT Bold", "Trebuchet MS",
    "Avenir Next Rounded", sans-serif;
  color: var(--brown);
  background: #f0c09a;
  display: grid;
  place-items: center;
  overflow-x: hidden;
  overflow-y: auto;
}

button,
input,
textarea,
select {
  font: inherit;
}

img {
  display: block;
  max-width: 100%;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.page-shell {
  position: relative;
  width: min(100vw, calc(100vh * 16 / 9), var(--stage-width));
  max-width: var(--stage-width);
  aspect-ratio: 16 / 9;
  min-height: 0;
  max-height: var(--stage-height);
  overflow: hidden;
  padding: 26px 34px 32px;
}

.landscape-lock {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: none;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(180deg, rgba(40, 18, 10, 0.48), rgba(24, 10, 7, 0.72)),
    url("assets/TransitionScreenBG.png") center center / cover no-repeat;
}

.landscape-lock__panel {
  width: min(100%, 560px);
  display: grid;
  justify-items: center;
  gap: 18px;
  padding: clamp(28px, 5vw, 40px) clamp(22px, 5vw, 38px);
  border: 3px solid rgba(255, 234, 185, 0.92);
  border-radius: 32px;
  background: linear-gradient(180deg, rgba(97, 42, 18, 0.9), rgba(56, 22, 10, 0.92));
  box-shadow:
    0 24px 52px rgba(27, 10, 5, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.24);
  text-align: center;
  color: #fff8eb;
  backdrop-filter: blur(10px);
}

.landscape-lock__device {
  position: relative;
  width: 126px;
  height: 78px;
  border: 6px solid #ffe6a3;
  border-radius: 22px;
  background:
    linear-gradient(135deg, rgba(255, 222, 132, 0.95), rgba(255, 179, 65, 0.92));
  box-shadow:
    0 16px 30px rgba(73, 28, 10, 0.28),
    inset 0 0 0 4px rgba(255, 246, 218, 0.34);
  animation: landscape-lock-rotate 1800ms ease-in-out infinite;
}

.landscape-lock__device::before {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255, 252, 245, 0.9), rgba(255, 231, 181, 0.74));
}

.landscape-lock__device::after {
  content: "";
  position: absolute;
  right: 8px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(124, 60, 18, 0.86);
  transform: translateY(-50%);
  box-shadow: 0 0 0 2px rgba(255, 244, 214, 0.3);
}

.landscape-lock__title {
  margin: 0;
  font-size: clamp(1.8rem, 5vw, 2.9rem);
  line-height: 0.96;
  color: #fff8eb;
}

.landscape-lock__message {
  margin: 0;
  max-width: 24ch;
  font-size: clamp(1rem, 2.8vw, 1.34rem);
  line-height: 1.2;
  color: rgba(255, 245, 224, 0.94);
}

body.is-portrait-locked {
  overflow: hidden;
}

body.is-portrait-locked .page-shell {
  visibility: hidden;
  pointer-events: none;
}

body.is-portrait-locked .landscape-lock {
  display: grid;
}

@media (orientation: portrait) {
  body {
    overflow: hidden;
  }

  .page-shell {
    visibility: hidden;
    pointer-events: none;
  }

  .landscape-lock {
    display: grid;
  }
}

.page-background {
  position: fixed;
  inset: 0;
  background: url("assets/TransitionScreenBG.png") center center / cover no-repeat;
}

.page-background::after {
  content: "";
  position: absolute;
  inset: 0;
  background: none;
}

.game-shell {
  position: relative;
  z-index: 1;
  width: min(var(--stage-shell-width), 100%);
  height: 100%;
  margin: 0 auto;
}

.play-surface {
  padding: 0;
  height: 100%;
}

.top-banner {
  position: relative;
}

.top-banner__image {
  width: 100%;
  height: auto;
}

.top-banner__copy {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  padding: 0 clamp(22px, 2.4vw, 40px) 0 clamp(98px, 13vw, 196px);
  overflow: hidden;
}

.top-banner h1 {
  margin: 0;
  width: 100%;
  max-width: 100%;
  font-size: clamp(0.98rem, 1.8vw, 2rem);
  line-height: 1;
  color: var(--brown);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.36);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.selection-screen,
.game-screen {
  margin-top: clamp(10px, 2vw, 24px);
}

.page-shell.is-selection-view .game-shell {
  width: min(1620px, 100%);
  height: 100%;
}

.page-shell.is-selection-view .selection-screen {
  margin-top: clamp(24px, 3.6vw, 54px);
}

.selection-panel {
  width: min(100%, var(--selection-panel-width));
  margin: 0 auto;
  padding-inline: clamp(16px, 1.8vw, 26px);
  overflow-x: clip;
}

.ride-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 248px));
  gap: clamp(28px, 3vw, 42px);
  width: 100%;
  margin: 0 auto;
  align-items: start;
  justify-items: stretch;
  justify-content: center;
}

.ride-card {
  position: relative;
  display: block;
  width: 100%;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 18px;
  background: transparent;
  color: #78380f;
  cursor: pointer;
  isolation: isolate;
  overflow: visible;
  appearance: none;
  -webkit-appearance: none;
  box-shadow: none;
  transition:
    transform 320ms cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 320ms cubic-bezier(0.22, 1, 0.36, 1),
    filter 320ms cubic-bezier(0.22, 1, 0.36, 1),
    opacity 180ms ease;
  opacity: 0;
  transform: translateY(20px);
  animation: ride-card-enter 700ms cubic-bezier(0.18, 0.9, 0.24, 1)
    var(--card-delay, 0ms) forwards;
}

.ride-card::before {
  content: none;
}

.ride-card__panel,
.ride-card__surface {
  display: block;
}

.ride-card__panel {
  position: relative;
  z-index: 1;
}

.ride-card__panel::before {
  content: none;
}

.ride-card:hover:not(:disabled) {
  transform: translateY(-10px) scale(1.05);
  filter: brightness(1.03) saturate(1.04);
  box-shadow:
    0 0 0 8px rgba(255, 239, 155, 0.32),
    0 0 36px rgba(255, 209, 46, 0.82),
    0 0 88px rgba(255, 219, 58, 0.68),
    0 0 150px rgba(255, 226, 76, 0.52);
}

.ride-card:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 8px rgba(255, 239, 155, 0.28),
    0 0 28px rgba(255, 209, 46, 0.72),
    0 0 64px rgba(255, 219, 58, 0.56);
}

.ride-card:disabled {
  cursor: default;
}

.ride-card.is-completed {
  filter: saturate(0.48) brightness(0.96);
}

.ride-card__media {
  position: relative;
  display: block;
  padding: 0;
  border-radius: 18px;
  overflow: visible;
  background: none;
  box-shadow: none;
  z-index: 1;
}

.ride-card__media::after {
  content: none;
}

.ride-card__image {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
  display: block !important;
  border-radius: 18px;
  filter: drop-shadow(0 14px 26px rgba(126, 63, 19, 0.18));
  transition:
    transform 320ms cubic-bezier(0.22, 1, 0.36, 1),
    filter 320ms cubic-bezier(0.22, 1, 0.36, 1);
}

.ride-card:hover:not(:disabled) .ride-card__image {
  transform: translateY(-2px) scale(1.02);
  filter:
    drop-shadow(0 20px 34px rgba(126, 63, 19, 0.24))
    drop-shadow(0 0 26px rgba(255, 214, 74, 0.28));
}

.ride-card:hover:not(:disabled) .ride-card__media {
  transform: none;
  box-shadow: none;
}

.ride-card__badge {
  position: absolute;
  top: clamp(14px, 1.2vw, 18px);
  right: clamp(14px, 1.2vw, 18px);
  z-index: 2;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(119, 63, 19, 0.92);
  color: #fff8eb;
  font-size: 0.88rem;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0.03em;
  box-shadow: 0 10px 18px rgba(96, 43, 12, 0.2);
}

.level-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: clamp(8px, 1vw, 14px);
}

.action-button {
  min-height: 50px;
  padding: 12px 20px;
  border: 0;
  border-radius: 18px;
  font-size: 1rem;
  font-weight: 900;
  color: #fff;
  cursor: pointer;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    opacity 180ms ease,
    filter 180ms ease;
}

.action-button:hover:not(:disabled) {
  transform: translateY(-3px) scale(1.03);
  filter: brightness(1.05);
}

.action-button:active:not(:disabled) {
  transform: translateY(1px) scale(0.98);
}

.action-button:focus-visible {
  outline: 4px solid rgba(255, 238, 188, 0.8);
  outline-offset: 4px;
}

.action-button:disabled {
  cursor: default;
  opacity: 0.5;
}

.action-button__arrow {
  display: block;
  line-height: 1;
}

.action-button--primary {
  background: linear-gradient(180deg, var(--sky) 0%, var(--sky-deep) 100%);
  box-shadow:
    0 16px 24px rgba(32, 123, 182, 0.22),
    0 0 24px rgba(91, 205, 255, 0.18);
}

.action-button--secondary {
  background: linear-gradient(180deg, #ad5f1a 0%, #8f470c 100%);
  box-shadow:
    0 16px 24px rgba(118, 61, 18, 0.2),
    0 0 20px rgba(255, 201, 119, 0.14);
}

.action-button--accent {
  color: var(--brown-deep);
  background: linear-gradient(180deg, #ffe07f 0%, #ffbe39 100%);
  box-shadow:
    0 16px 24px rgba(160, 107, 9, 0.22),
    0 0 20px rgba(255, 224, 122, 0.2);
}

.board-layout {
  margin-top: clamp(18px, 2.6vw, 32px);
  display: grid;
  grid-template-columns: minmax(280px, 0.82fr) minmax(520px, 1.18fr);
  gap: clamp(24px, 4vw, 54px);
  align-items: center;
}

.machine-column {
  display: flex;
  justify-content: center;
  align-items: center;
}

.machine-wrap {
  position: relative;
  width: min(100%, 520px);
  filter: drop-shadow(0 24px 18px rgba(132, 70, 24, 0.16));
}

.machine-wrap::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 12.38%;
  width: 16.4%;
  height: 0.92%;
  transform: translateX(-50%);
  border-radius: 6px;
  background: linear-gradient(180deg, #2b0d03 0%, #6b3418 45%, #170500 100%);
  box-shadow:
    0 0 0 2px rgba(247, 229, 195, 0.84),
    inset 0 1px 1px rgba(255, 255, 255, 0.12),
    inset 0 -2px 5px rgba(0, 0, 0, 0.56),
    0 4px 8px rgba(117, 57, 20, 0.18);
  pointer-events: none;
  z-index: 4;
}

.machine-image {
  width: 100%;
  height: auto;
  user-select: none;
  pointer-events: none;
}

.machine-total,
.machine-meter {
  transition:
    opacity 220ms ease,
    filter 220ms ease;
}

.machine-total {
  position: absolute;
  top: 12.6%;
  left: 50%;
  transform: translateX(-50%);
  width: 40%;
  text-align: center;
  font-size: clamp(1.8rem, 3.8vw, 3.15rem);
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 0.95;
  color: #a92b03;
  text-shadow: 0 2px 10px rgba(255, 235, 175, 0.44);
  white-space: nowrap;
  z-index: 2;
  pointer-events: none;
  animation: goal-glow 1800ms ease-in-out infinite;
}

.machine-meter {
  position: absolute;
  top: 33.15%;
  left: 50%;
  width: 16.7%;
  height: 30.5%;
  transform: translateX(-50%);
  border-radius: 20px;
  overflow: hidden;
  clip-path: inset(0 round 20px);
  isolation: isolate;
  contain: paint;
}

.machine-meter__fill {
  position: absolute;
  inset: auto 0 0;
  height: 0%;
  border-radius: 16px 16px 9px 9px;
  background: linear-gradient(
    180deg,
    #58cf21 0%,
    #b8de00 22%,
    #f0eb00 42%,
    #ffd018 60%,
    #ff9915 79%,
    #ff1530 100%
  );
  box-shadow:
    0 0 10px rgba(255, 229, 95, 0.24),
    inset 0 0 10px rgba(255, 255, 255, 0.16);
  transition:
    height 420ms cubic-bezier(0.25, 1, 0.5, 1),
    box-shadow 280ms ease;
}

.machine-meter__shine {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.24), transparent 24%),
    linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.06),
      transparent 44%,
      rgba(255, 255, 255, 0.08)
    );
  pointer-events: none;
}

.machine-dropzone {
  position: absolute;
  left: 50%;
  bottom: 14.6%;
  width: 46%;
  min-height: 16.5%;
  padding: clamp(10px, 1.5vw, 14px);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 8px;
  transform: translateX(-50%);
  border-radius: 22px;
  border: 2px dashed rgba(129, 65, 19, 0.34);
  background:
    linear-gradient(180deg, rgba(255, 251, 242, 0.92), rgba(255, 239, 205, 0.8));
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.34),
    0 8px 12px rgba(108, 56, 20, 0.12);
  z-index: 3;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease,
    background 180ms ease;
}

.machine-dropzone.is-ready,
.machine-dropzone.is-drop-target {
  border-color: rgba(44, 151, 220, 0.62);
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.38),
    0 0 0 6px rgba(77, 184, 243, 0.16),
    0 12px 18px rgba(48, 124, 169, 0.16);
}

.machine-dropzone.is-drop-target {
  transform: translateX(-50%) scale(1.02);
  background:
    linear-gradient(180deg, rgba(245, 252, 255, 0.96), rgba(220, 244, 255, 0.9));
}

.machine-dropzone.has-money {
  border-style: solid;
}

.machine-dropzone__hint {
  margin: 0;
  font-size: clamp(0.7rem, 0.95vw, 0.9rem);
  font-weight: 900;
  letter-spacing: 0.01em;
  line-height: 1.1;
  text-align: center;
  color: rgba(99, 45, 13, 0.92);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
}

.machine-dropzone.has-money .machine-dropzone__hint {
  font-size: clamp(0.64rem, 0.86vw, 0.82rem);
  opacity: 0.82;
}

.placed-money-layer {
  min-height: clamp(56px, 7vw, 84px);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-content: flex-end;
  gap: 6px 8px;
}

.placed-money {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.placed-money__sprite {
  user-select: none;
  pointer-events: none;
  filter: drop-shadow(0 8px 10px rgba(104, 54, 18, 0.15));
}

.placed-money__sprite--coin {
  width: clamp(32px, 4vw, 46px);
}

.placed-money__sprite--note {
  width: clamp(72px, 10vw, 116px);
}

.ticket-bay {
  position: absolute;
  left: 50%;
  bottom: 5.2%;
  width: 15%;
  height: 7.1%;
  transform: translateX(-50%);
  overflow: hidden;
  pointer-events: none;
  z-index: 3;
}

.ticket-prize {
  position: absolute;
  left: 50%;
  top: 0;
  width: 102%;
  opacity: 0;
  transform: translate(-50%, -92%);
  transform-origin: center top;
}

.ticket-prize__image {
  width: 100%;
  max-width: none;
  filter: drop-shadow(0 8px 12px rgba(121, 67, 24, 0.22));
}

.ticket-prize__text {
  position: absolute;
  left: 50%;
  top: 56%;
  font-size: clamp(0.28rem, 0.56vw, 0.42rem);
  font-weight: 900;
  letter-spacing: 0.14em;
  line-height: 1;
  color: #f07328;
  text-shadow:
    0 1px 0 rgba(255, 246, 220, 0.72),
    0 0 2px rgba(255, 223, 175, 0.46);
  transform: translate(-50%, -50%);
  white-space: nowrap;
}

.confetti-layer {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 28;
  contain: paint;
}

.confetti-layer__canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.confetti-piece {
  position: absolute;
  left: var(--start-x);
  top: var(--start-y);
  width: var(--size);
  height: calc(var(--size) * 1.6);
  border-radius: 4px;
  background: var(--color);
  opacity: 0;
  transform: translate(-50%, -10%) scale(0.62) rotate(0deg);
  box-shadow: 0 2px 4px rgba(97, 48, 16, 0.12);
  animation: confetti-burst var(--duration) cubic-bezier(0.2, 0.85, 0.3, 1)
    var(--delay) forwards;
  will-change: transform, opacity;
}

.confetti-piece--dot {
  height: var(--size);
  border-radius: 999px;
}

.page-shell.is-near-complete .machine-meter__fill {
  box-shadow:
    0 0 12px rgba(255, 240, 125, 0.36),
    0 0 20px rgba(101, 230, 96, 0.14),
    inset 0 0 12px rgba(255, 255, 255, 0.18);
}

.page-shell.is-complete .machine-meter {
  filter:
    drop-shadow(0 0 12px rgba(255, 241, 119, 0.92))
    drop-shadow(0 0 24px rgba(255, 220, 74, 0.54));
  animation: meter-victory-pulse 560ms ease-out 2;
}

.page-shell.is-complete .machine-meter__fill {
  box-shadow:
    0 0 14px rgba(255, 248, 155, 0.56),
    0 0 28px rgba(255, 224, 72, 0.48),
    inset 0 0 14px rgba(255, 255, 255, 0.34);
}

.page-shell.is-complete .machine-meter__shine {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.36), transparent 26%),
    linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.12),
      transparent 44%,
      rgba(255, 252, 216, 0.22)
    );
}

.page-shell.is-ticket-visible .ticket-prize {
  animation: ticket-rise 620ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.controls-column {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.controls-panel {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 780px;
  min-height: clamp(320px, 33vw, 560px);
  padding: clamp(22px, 3vw, 34px);
  border-radius: 28px;
  border: 6px solid #a9551c;
  background:
    radial-gradient(circle at 30% 25%, rgba(255, 245, 221, 0.5), transparent 35%),
    linear-gradient(180deg, rgba(255, 251, 241, 0.97), rgba(255, 246, 233, 0.96));
  box-shadow: 0 24px 36px rgba(111, 57, 22, 0.12);
}

.money-tray {
  width: 100%;
  min-height: inherit;
  display: grid;
  grid-template-columns: repeat(4, minmax(72px, 1fr));
  grid-template-rows: auto 1fr;
  align-items: start;
  justify-items: center;
  column-gap: clamp(18px, 2.6vw, 44px);
  row-gap: clamp(40px, 6vw, 88px);
  flex: 1;
}

.money-button,
.money-decor {
  position: relative;
  display: grid;
  place-items: center;
}

.money-button {
  width: clamp(84px, 9vw, 148px);
  min-height: clamp(84px, 9vw, 148px);
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  transition:
    transform 180ms ease,
    filter 180ms ease,
    opacity 180ms ease,
    box-shadow 180ms ease;
}

.money-button:not([disabled]) {
  cursor: grab;
}

.money-button:hover:not(:disabled) {
  transform: translateY(-6px) scale(1.04);
  filter: brightness(1.08);
}

.money-button:focus-visible {
  outline: 4px solid rgba(72, 183, 244, 0.44);
  outline-offset: 8px;
  border-radius: 28px;
}

.money-button::after {
  content: "";
  position: absolute;
  inset: -14px;
  border-radius: 50%;
  opacity: 0;
  transform: scale(0.9);
  transition:
    opacity 180ms ease,
    transform 180ms ease,
    box-shadow 180ms ease;
}

.money-button--note {
  grid-column: 2 / span 2;
  width: min(100%, 360px);
  min-height: unset;
  align-self: center;
}

.money-button--note::after {
  inset: -16px;
  border-radius: 30px;
}

.money-sprite {
  user-select: none;
  pointer-events: none;
  filter: drop-shadow(0 12px 12px rgba(128, 69, 24, 0.16));
  transition:
    filter 180ms ease,
    transform 180ms ease;
}

.money-button:hover:not(:disabled)::after {
  opacity: 1;
  transform: scale(1);
  box-shadow:
    0 0 0 6px rgba(255, 239, 186, 0.18),
    0 0 28px var(--gold-glow),
    0 0 44px var(--pink-glow);
}

.money-button:hover:not(:disabled) .money-sprite {
  transform: scale(1.02);
  filter:
    drop-shadow(0 14px 16px rgba(128, 69, 24, 0.2))
    drop-shadow(0 0 18px rgba(255, 230, 128, 0.34));
}

.money-sprite--coin {
  width: 100%;
  max-width: 132px;
}

.money-sprite--decor {
  width: 100%;
  max-width: 156px;
  filter: drop-shadow(0 12px 12px rgba(128, 69, 24, 0.13));
}

.money-button--ten {
  width: clamp(96px, 10vw, 160px);
}

.money-sprite--note {
  width: 100%;
  max-width: 360px;
}

.money-button.is-selected {
  transform: translateY(-6px) scale(1.05);
}

.money-button.is-dragging {
  opacity: 0.42;
  transform: scale(0.96);
}

.money-button.is-selected::after {
  opacity: 1;
  transform: scale(1);
  box-shadow:
    0 0 0 6px rgba(255, 203, 106, 0.32),
    0 0 30px rgba(255, 220, 137, 0.32);
}

.money-button.is-inactive,
.money-button.is-inactive:hover {
  transform: none;
  filter: saturate(0.75) brightness(0.92);
  opacity: 0.6;
}

.money-button.is-inactive::after {
  opacity: 0;
  box-shadow: none;
}

.money-button.is-bouncing {
  animation: money-bounce 260ms ease;
}

.money-button.is-denied {
  animation: money-denied 280ms ease;
}

.machine-wrap.is-wrong-answer {
  animation: machine-wrong-answer 440ms cubic-bezier(0.22, 0.8, 0.28, 1);
}

.money-button[disabled] {
  cursor: default;
}

.page-shell.is-game-view {
  --layout-stage-width: min(
    100vw,
    calc(100dvh * var(--design-width) / var(--design-height)),
    calc(var(--design-width) * 1px)
  );
  --layout-stage-height: calc(
    var(--layout-stage-width) * var(--design-height) / var(--design-width)
  );
  /* Reference layout from the target 1920x1080 composition */
  --game-banner-width: calc(var(--layout-stage-width) * 1688 / var(--design-width));
  --game-banner-height: calc(var(--game-banner-width) * 164 / 1688);
  --game-content-width: calc(var(--layout-stage-width) * 1408 / var(--design-width));
  --game-left-panel-width: calc(var(--layout-stage-width) * 914 / var(--design-width));
  --game-machine-width: calc(var(--layout-stage-width) * 420 / var(--design-width));
  --game-rail-width: max(44px, calc(var(--layout-stage-width) * 58 / var(--design-width)));
  --game-section-gap: calc(var(--layout-stage-width) * 26 / var(--design-width));
  --game-column-gap: calc(var(--layout-stage-width) * 74 / var(--design-width));
  --game-layout-shift-x: 0px;
  --game-top-gap: calc(var(--layout-stage-height) * 26 / var(--design-height));
  --game-back-offset: calc(var(--layout-stage-height) * 30 / var(--design-height));
  --game-stack-gap: calc(var(--layout-stage-height) * 22 / var(--design-height));
  --game-check-gap: calc(var(--layout-stage-height) * 30 / var(--design-height));
  --game-dropzone-height: calc(var(--game-left-panel-width) * 945 / 2470);
  --game-tray-height: calc(var(--game-left-panel-width) * 442 / 2488);
  --game-controls-max: var(--game-left-panel-width);
  --game-drop-inset-block-start: max(
    22px,
    calc(var(--layout-stage-height) * 30 / var(--design-height))
  );
  --game-drop-inset-inline: max(
    24px,
    calc(var(--layout-stage-width) * 34 / var(--design-width))
  );
  --game-drop-inset-block-end: max(
    24px,
    calc(var(--layout-stage-height) * 34 / var(--design-height))
  );
  --game-drop-gap: max(10px, calc(var(--layout-stage-width) * 14 / var(--design-width)));
  --game-undo-size: max(44px, calc(var(--layout-stage-width) * 54 / var(--design-width)));
  --game-undo-edge: max(16px, calc(var(--layout-stage-width) * 26 / var(--design-width)));
  --game-tray-padding-inline: max(
    18px,
    calc(var(--layout-stage-width) * 28 / var(--design-width))
  );
  --game-tray-padding-block: max(
    14px,
    calc(var(--layout-stage-height) * 16 / var(--design-height))
  );
  --game-money-gap: max(8px, calc(var(--layout-stage-width) * 12 / var(--design-width)));
  --game-coin-size: max(58px, calc(var(--layout-stage-width) * 74 / var(--design-width)));
  --game-ten-size: max(66px, calc(var(--layout-stage-width) * 88 / var(--design-width)));
  --game-note-size: max(136px, calc(var(--layout-stage-width) * 164 / var(--design-width)));
  --game-note-wide-size: max(
    148px,
    calc(var(--layout-stage-width) * 178 / var(--design-width))
  );
  --game-check-width: max(
    260px,
    calc(var(--layout-stage-width) * 336 / var(--design-width))
  );
  min-height: 0;
  height: 100%;
  overflow-y: auto;
  padding-top: max(
    calc(var(--layout-stage-height) * 18 / var(--design-height)),
    calc(12px + env(safe-area-inset-top))
  );
  padding-right: max(
    calc(var(--layout-stage-width) * 24 / var(--design-width)),
    calc(12px + env(safe-area-inset-right))
  );
  padding-bottom: max(
    calc(var(--layout-stage-height) * 24 / var(--design-height)),
    calc(16px + env(safe-area-inset-bottom))
  );
  padding-left: max(
    calc(var(--layout-stage-width) * 24 / var(--design-width)),
    calc(12px + env(safe-area-inset-left))
  );
}

.page-shell.is-game-view .page-background {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 242, 219, 0.1)),
    url("assets/Background2.png") center bottom / cover no-repeat;
}

.page-shell.is-game-view .page-background::after {
  background:
    radial-gradient(circle at 50% 10%, rgba(255, 255, 255, 0.14), transparent 20%),
    linear-gradient(180deg, rgba(255, 248, 236, 0.05), rgba(255, 232, 205, 0.08));
}

.page-shell.is-game-view .top-banner {
  display: block;
  width: min(100%, var(--game-banner-width));
  margin: 0 auto;
}

.page-shell.is-game-view .top-banner__copy {
  min-width: 0;
  padding:
    0
    max(28px, calc(var(--layout-stage-width) * 36 / var(--design-width)))
    0
    calc(
      max(148px, calc(var(--layout-stage-width) * 194 / var(--design-width))) +
        var(--game-layout-shift-x)
    );
}

.page-shell.is-game-view .top-banner h1 {
  font-size: clamp(
    0.82rem,
    calc(var(--layout-stage-width) * 26 / var(--design-width)),
    1.46rem
  );
  font-weight: 900;
  line-height: 1.04;
  color: #78380f;
  text-shadow: 0 1px 0 rgba(255, 252, 244, 0.52);
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.page-shell.is-game-view .game-shell {
  width: min(var(--stage-shell-width), 100%);
  min-height: 100%;
  height: auto;
}

.page-shell.is-game-view .game-screen {
  position: relative;
  width: min(100%, var(--game-banner-width));
  margin-top: var(--game-top-gap);
  margin-inline: auto;
  display: grid;
  grid-template-columns: minmax(0, var(--game-content-width));
  grid-template-areas:
    "board"
    "check";
  column-gap: 0;
  row-gap: var(--game-check-gap);
  align-items: start;
  justify-content: center;
  padding-top: 0;
  padding-bottom: var(--game-stack-gap);
}

.page-shell.is-game-view .level-actions {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 4;
  justify-content: flex-start;
  gap: 0;
  margin: 0;
}

.page-shell.is-game-view .action-button {
  min-height: max(46px, calc(var(--layout-stage-height) * 46 / var(--design-height)));
  padding: 0 max(16px, calc(var(--layout-stage-width) * 20 / var(--design-width)));
  border-radius: 999px;
  font-size: clamp(
    0.92rem,
    calc(var(--layout-stage-width) * 18 / var(--design-width)),
    1rem
  );
  box-shadow: 0 10px 16px rgba(108, 56, 20, 0.14);
}

.page-shell.is-game-view .action-button--back {
  width: var(--game-rail-width);
  min-width: 0;
  min-height: var(--game-rail-width);
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: #8f470c;
  background: rgba(255, 247, 232, 0.82);
  box-shadow:
    0 8px 18px rgba(111, 57, 18, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(4px);
}

.page-shell.is-game-view .action-button--back .action-button__arrow {
  font-size: clamp(1.7rem, 2.4vw, 2.05rem);
  transform: translateX(-1px);
}

.page-shell.is-game-view .board-layout {
  grid-area: board;
  margin-top: 0;
  width: min(100%, var(--game-content-width));
  margin-inline: auto;
  min-height: 0;
  grid-template-columns:
    minmax(0, var(--game-left-panel-width))
    minmax(0, var(--game-machine-width));
  grid-template-areas: "controls machine";
  gap: var(--game-column-gap);
  justify-content: start;
  align-items: center;
  transform: none;
}

.page-shell.is-game-view .machine-column {
  grid-area: machine;
  justify-content: center;
  align-self: center;
  justify-self: center;
  margin-top: 0;
}

.page-shell.is-game-view .machine-wrap {
  width: min(100%, var(--game-machine-width));
  margin-left: 0;
  filter: drop-shadow(0 20px 24px rgba(121, 63, 24, 0.14));
  transform-origin: 50% 100%;
}

.page-shell.is-game-view .machine-wrap::after {
  content: none;
}

.page-shell.is-game-view .machine-goal {
  position: absolute;
  top: 10.6%;
  left: 50%;
  width: 46%;
  transform: translateX(-50%);
  font-size: clamp(
    2.3rem,
    calc(var(--layout-stage-width) * 60 / var(--design-width)),
    3.65rem
  );
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 0.92;
  text-align: center;
  color: #cc510d;
  text-shadow:
    -2px 0 rgba(255, 250, 236, 0.96),
    0 2px rgba(255, 250, 236, 0.96),
    2px 0 rgba(255, 250, 236, 0.96),
    0 -2px rgba(255, 250, 236, 0.96),
    0 8px 18px rgba(255, 205, 120, 0.24);
  white-space: nowrap;
  max-width: 100%;
  z-index: 2;
  pointer-events: none;
}

.page-shell.is-game-view .machine-total {
  display: none;
}

.page-shell.is-game-view .machine-meter {
  top: 33.2%;
  width: 17%;
  height: 30.8%;
  border-radius: 22px;
  clip-path: inset(0 round 22px);
}

.page-shell.is-game-view .machine-meter__fill {
  border-radius: 16px 16px 9px 9px;
  background: linear-gradient(
    180deg,
    #59d22c 0%,
    #aee332 20%,
    #f6e54a 44%,
    #ffb228 68%,
    #ff6a22 84%,
    #ff2230 100%
  );
  box-shadow:
    0 0 10px rgba(255, 230, 95, 0.24),
    inset 0 0 10px rgba(255, 255, 255, 0.16);
}

.page-shell.is-game-view .machine-meter__shine {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), transparent 20%),
    linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.08),
      transparent 40%,
      rgba(255, 255, 255, 0.04)
    );
}

.page-shell.is-game-view .machine-meter.is-overflowing {
  overflow: hidden;
  clip-path: inset(0 round 22px);
  contain: paint;
  filter: drop-shadow(0 0 12px rgba(255, 70, 70, 0.36));
}

.page-shell.is-game-view .machine-meter.is-overflowing .machine-meter__fill {
  border-radius: 16px 16px 9px 9px;
  background: linear-gradient(
    180deg,
    #ff8b8b 0%,
    #ff5252 28%,
    #ff2929 62%,
    #cf0f1c 100%
  );
  box-shadow:
    0 0 16px rgba(255, 92, 92, 0.34),
    inset 0 0 12px rgba(255, 255, 255, 0.18);
}

.page-shell.is-game-view .ticket-bay {
  left: 49.8%;
  top: 87.25%;
  bottom: auto;
  width: 16.2%;
  height: 15.8%;
  overflow: hidden;
  z-index: 4;
}

.page-shell.is-game-view .ticket-bay::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  width: 74%;
  height: 4.6%;
  transform: translateX(-50%);
  border-radius: 999px;
  background: linear-gradient(180deg, #2b0d03 0%, #6b3418 45%, #170500 100%);
  box-shadow:
    0 0 0 1.2px rgba(247, 229, 195, 0.84),
    inset 0 1px 1px rgba(255, 255, 255, 0.12),
    inset 0 -2px 5px rgba(0, 0, 0, 0.56),
    0 4px 8px rgba(117, 57, 20, 0.18);
  pointer-events: none;
  z-index: 5;
}

.page-shell.is-game-view .ticket-bay::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 0.7%;
  width: 56%;
  height: 1.05%;
  transform: translateX(-50%);
  border-radius: 999px;
  background: rgba(255, 246, 220, 0.14);
  filter: blur(1px);
  pointer-events: none;
  z-index: 6;
}

.page-shell.is-game-view .ticket-prize {
  top: 0;
  width: 78%;
  transform: translate(-50%, -116%);
  z-index: 4;
}

.page-shell.is-game-view .ticket-prize__text {
  font-size: clamp(0.22rem, 0.5vw, 0.36rem);
}

.page-shell.is-game-view .controls-column {
  grid-area: controls;
  display: grid;
  grid-template-rows: auto auto;
  gap: var(--game-stack-gap);
  margin-top: 0;
  align-items: start;
  align-self: center;
  width: min(100%, var(--game-left-panel-width));
  max-width: var(--game-left-panel-width);
  justify-self: start;
  transform: none;
}

@media (max-aspect-ratio: 17 / 10) and (min-width: 961px) {
  .page-shell.is-game-view {
    /* Shorter landscape screens keep the same ratios but tighten the canvas */
    --game-banner-width: calc(var(--layout-stage-width) * 1620 / var(--design-width));
    --game-content-width: calc(var(--layout-stage-width) * 1350 / var(--design-width));
    --game-left-panel-width: calc(var(--layout-stage-width) * 876 / var(--design-width));
    --game-machine-width: calc(var(--layout-stage-width) * 400 / var(--design-width));
    --game-column-gap: calc(var(--layout-stage-width) * 74 / var(--design-width));
    --game-controls-max: var(--game-left-panel-width);
    --game-dropzone-height: calc(var(--game-left-panel-width) * 945 / 2470);
    --game-tray-height: calc(var(--game-left-panel-width) * 442 / 2488);
    --game-top-gap: calc(var(--layout-stage-height) * 18 / var(--design-height));
    --game-stack-gap: calc(var(--layout-stage-height) * 14 / var(--design-height));
    --game-check-gap: calc(var(--layout-stage-height) * 16 / var(--design-height));
  }

  .page-shell.is-game-view .board-layout {
    min-height: 0;
    align-items: start;
    transform: none;
  }

  .page-shell.is-game-view .machine-column {
    align-self: start;
  }

  .page-shell.is-game-view .machine-wrap {
    width: min(100%, var(--game-machine-width));
  }

  .page-shell.is-game-view .check-button {
    width: min(100%, var(--game-check-width));
  }
}

.drop-panel {
  width: 100%;
}

.page-shell.is-game-view .machine-dropzone {
  position: relative;
  left: auto;
  bottom: auto;
  width: 100%;
  min-height: var(--game-dropzone-height);
  aspect-ratio: 2470 / 945;
  padding: 0;
  display: block;
  transform: none;
  border: 0;
  border-radius: 0;
  background: url("assets/Dragarea.png") center center / 100% 100% no-repeat;
  box-shadow: none;
  overflow: hidden;
}

.page-shell.is-game-view .machine-dropzone.is-ready,
.page-shell.is-game-view .machine-dropzone.is-drop-target,
.page-shell.is-game-view .machine-dropzone.has-money {
  border: 0;
  box-shadow: none;
}

.page-shell.is-game-view .machine-dropzone.is-drop-target {
  transform: scale(1.005);
}

.page-shell.is-game-view .machine-dropzone__hint {
  display: none;
}

.page-shell.is-game-view .machine-dropzone.has-money .machine-dropzone__hint {
  display: none;
}

.page-shell.is-game-view .placed-money-layer {
  position: absolute;
  inset: var(--game-drop-inset-block-start) var(--game-drop-inset-inline)
    var(--game-drop-inset-block-end);
  z-index: 1;
  min-height: 0;
  padding: 0;
  justify-content: flex-start;
  align-content: flex-start;
  gap: var(--game-drop-gap);
}

.page-shell.is-game-view .placed-money__sprite--coin {
  width: clamp(
    52px,
    calc(var(--layout-stage-width) * 64 / var(--design-width)),
    72px
  );
}

.page-shell.is-game-view .placed-money__sprite--note {
  width: clamp(
    116px,
    calc(var(--layout-stage-width) * 146 / var(--design-width)),
    164px
  );
}

.undo-button {
  position: absolute;
  right: var(--game-undo-edge);
  bottom: var(--game-undo-edge);
  width: var(--game-undo-size);
  height: var(--game-undo-size);
  border: 0;
  padding: 0;
  border-radius: 0;
  background: none;
  color: transparent;
  font-size: 0;
  line-height: 0;
  box-shadow: none;
  cursor: pointer;
  transition:
    transform 180ms ease,
    opacity 180ms ease,
    filter 180ms ease;
  z-index: 2;
}

.undo-button__image {
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}

.undo-button:hover:not(:disabled) {
  transform: translateY(-3px) scale(1.06) rotate(-8deg);
  filter:
    drop-shadow(0 0 16px rgba(129, 213, 255, 0.42))
    drop-shadow(0 8px 12px rgba(61, 151, 204, 0.18));
}

.undo-button:disabled {
  opacity: 0.45;
  cursor: default;
}

.page-shell.is-game-view .controls-panel {
  width: 100%;
  max-width: var(--game-left-panel-width);
  min-height: var(--game-tray-height);
  aspect-ratio: 2488 / 442;
  padding: var(--game-tray-padding-block) var(--game-tray-padding-inline)
    calc(var(--game-tray-padding-block) + 4px);
  border: 0;
  border-radius: 0;
  background: url("assets/moneyContainer.png") center center / 100% 100% no-repeat;
  box-shadow: none;
}

.page-shell.is-game-view .money-tray {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns:
    repeat(4, minmax(0, 0.72fr))
    minmax(0, 1.16fr)
    minmax(0, 1.32fr);
  align-items: center;
  justify-items: center;
  gap: var(--game-money-gap);
}

.page-shell.is-game-view .money-button {
  width: 100%;
  min-height: 0;
}

.page-shell.is-game-view .money-button--coin {
  max-width: var(--game-coin-size);
  aspect-ratio: 1;
}

.page-shell.is-game-view .money-button--ten {
  max-width: var(--game-ten-size);
}

.page-shell.is-game-view .money-button--note {
  grid-column: auto;
  width: min(100%, var(--game-note-size));
  max-width: var(--game-note-size);
}

.page-shell.is-game-view .money-button--note-wide {
  width: min(100%, var(--game-note-wide-size));
  max-width: var(--game-note-wide-size);
}

.page-shell.is-game-view .money-sprite--coin,
.page-shell.is-game-view .money-sprite--decor,
.page-shell.is-game-view .money-sprite--note {
  width: 100%;
  max-width: 100%;
}

.page-shell.is-game-view .money-button.is-inactive,
.page-shell.is-game-view .money-button.is-inactive:hover {
  opacity: 1;
  filter: none;
}

.page-shell.is-game-view .money-button.is-inactive .money-sprite {
  filter: grayscale(0.68) brightness(0.75);
}

.page-shell.is-game-view .money-button.is-selected::after {
  box-shadow:
    0 0 0 4px rgba(255, 223, 98, 0.24),
    0 0 26px rgba(255, 227, 110, 0.62);
}

.check-button {
  display: block;
  justify-self: center;
  margin-inline: auto;
  width: min(100%, 430px);
  min-height: 0;
  aspect-ratio: 977 / 198;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: url("assets/CheckButton.png") center center / 100% 100% no-repeat;
  color: transparent;
  font-size: 0;
  line-height: 0;
  text-shadow: none;
  box-shadow: none;
  cursor: pointer;
  transition:
    transform 180ms ease,
    opacity 180ms ease,
    filter 180ms ease,
    box-shadow 180ms ease;
  animation: button-breathe 2400ms ease-in-out infinite;
}

.check-button__label {
  display: none;
}

.page-shell.is-game-view .check-button {
  grid-area: check;
  display: block;
  justify-self: center;
  margin: max(22px, calc(var(--layout-stage-height) * 26 / var(--design-height))) 0 0;
  width: min(100%, var(--game-check-width));
}

.success-popup {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(44, 19, 9, 0.14);
  backdrop-filter: blur(6px) saturate(1.06);
  opacity: 0;
  pointer-events: none;
  z-index: 22;
}

.success-popup::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 225, 173, 0.16), transparent 34%),
    linear-gradient(180deg, rgba(46, 19, 8, 0.06), rgba(20, 10, 6, 0.24));
  opacity: 0;
  transition: opacity 220ms ease;
}

.success-popup__screen {
  position: relative;
  width: min(100%, 1220px);
  aspect-ratio: 16 / 9;
  overflow: hidden;
  isolation: isolate;
  border-radius: 38px;
  border: 4px solid rgba(255, 246, 225, 0.82);
  background: #1a0f0c;
  box-shadow:
    0 34px 82px rgba(53, 23, 10, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.26);
  opacity: 0;
  transform: translateY(32px) scale(0.92);
}

.success-popup__image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(1.05) contrast(1.02);
}

.success-popup__lighting {
  position: absolute;
  z-index: 2;
  pointer-events: none;
  opacity: 0;
  mix-blend-mode: screen;
}

.success-popup__lighting--base {
  inset: 0;
}

.success-popup__lighting--beam {
  filter: blur(24px);
}

.success-popup__lighting--glow {
  border-radius: 999px;
  filter: blur(16px);
}

.success-popup__caption {
  position: absolute;
  top: clamp(18px, 3vw, 34px);
  left: clamp(18px, 3vw, 36px);
  z-index: 3;
  display: grid;
  gap: 10px;
  width: min(46%, 520px);
  padding: clamp(16px, 2vw, 22px) clamp(18px, 2.4vw, 26px);
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(63, 28, 16, 0.66), rgba(25, 12, 9, 0.58));
  box-shadow:
    0 18px 36px rgba(34, 13, 7, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(8px);
  opacity: 0;
  transform: translateY(24px);
}

.success-popup__eyebrow {
  margin: 0;
  font-size: clamp(0.78rem, 1.1vw, 0.95rem);
  font-weight: 900;
  letter-spacing: 0.16em;
  line-height: 1;
  text-transform: uppercase;
  color: #fff0b7;
}

.success-popup__caption .success-popup__title {
  font-size: clamp(2.2rem, 4.8vw, 4rem);
  line-height: 0.92;
  color: #fff8eb;
  text-shadow: 0 10px 28px rgba(0, 0, 0, 0.25);
}

.success-popup__caption .success-popup__subtitle {
  max-width: 32ch;
  font-size: clamp(1rem, 2.1vw, 1.32rem);
  line-height: 1.2;
  color: rgba(255, 247, 230, 0.95);
  text-shadow: 0 6px 20px rgba(0, 0, 0, 0.22);
}

.success-popup__burst {
  position: absolute;
  left: 50%;
  top: calc(50% - 250px);
  width: min(84vw, 720px);
  height: 220px;
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 4;
}

.success-popup__spark {
  position: absolute;
  left: 50%;
  top: 50%;
  border-radius: 999px;
  opacity: 0;
  --spark-rotate: 0deg;
  transform-origin: 50% 100%;
  transform: rotate(var(--spark-rotate)) translateY(12px) scale(0.32);
}

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

.success-popup__spark--1,
.success-popup__spark--4 {
  width: 18px;
  height: 74px;
}

.success-popup__spark--2,
.success-popup__spark--5 {
  width: 16px;
  height: 58px;
}

.success-popup__spark--3,
.success-popup__spark--6 {
  width: 12px;
  height: 42px;
}

.success-popup__spark--1 {
  --spark-rotate: -42deg;
  margin-left: -132px;
  margin-top: -28px;
}

.success-popup__spark--2 {
  --spark-rotate: -18deg;
  margin-left: -82px;
  margin-top: -54px;
}

.success-popup__spark--3 {
  --spark-rotate: -2deg;
  margin-left: -22px;
  margin-top: -72px;
}

.success-popup__spark--4 {
  --spark-rotate: 42deg;
  margin-left: 108px;
  margin-top: -28px;
}

.success-popup__spark--5 {
  --spark-rotate: 18deg;
  margin-left: 66px;
  margin-top: -56px;
}

.success-popup__spark--6 {
  --spark-rotate: 2deg;
  margin-left: 10px;
  margin-top: -76px;
}

.success-popup__spark--1::before,
.success-popup__spark--5::before {
  background: linear-gradient(180deg, #ffd96c 0%, #ffb75a 100%);
}

.success-popup__spark--2::before,
.success-popup__spark--4::before {
  background: linear-gradient(180deg, #7fd9ff 0%, #4fa8ff 100%);
}

.success-popup__spark--3::before,
.success-popup__spark--6::before {
  background: linear-gradient(180deg, #ffd5f0 0%, #ff9fd5 100%);
}

.success-popup__spark::after {
  width: 18px;
  height: 18px;
  inset: auto auto -10px 50%;
  transform: translateX(-50%);
  background: #fff7d8;
  box-shadow: 0 0 0 6px rgba(255, 247, 216, 0.16);
}

.success-popup__panel {
  position: relative;
  width: min(100%, 390px);
  padding: 74px 24px 24px;
  border-radius: 34px;
  border: 4px solid rgba(255, 249, 231, 0.98);
  background:
    linear-gradient(180deg, rgba(255, 255, 252, 0.98), rgba(255, 243, 220, 0.98));
  box-shadow:
    0 30px 56px rgba(133, 78, 33, 0.18),
    0 10px 0 rgba(255, 232, 182, 0.74),
    inset 0 1px 0 rgba(255, 255, 255, 0.92);
  text-align: center;
  opacity: 0;
  transform: translateY(36px) scale(0.84);
}

.success-popup__icon-shell {
  position: absolute;
  left: 50%;
  top: -56px;
  width: 120px;
  height: 120px;
  display: grid;
  place-items: center;
  transform: translateX(-50%);
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.78), transparent 28%),
    linear-gradient(180deg, #fff3ae 0%, #ffd45d 54%, #ffb546 100%);
  box-shadow:
    0 18px 28px rgba(255, 187, 94, 0.28),
    inset 0 2px 0 rgba(255, 255, 255, 0.82),
    inset 0 -10px 18px rgba(241, 161, 53, 0.18);
}

.success-popup__icon-glow {
  position: absolute;
  inset: 12px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 240, 0.96), rgba(255, 238, 178, 0.08));
  filter: blur(2px);
}

.success-popup__icon {
  position: relative;
  z-index: 1;
  font-size: 3.5rem;
  line-height: 1;
  filter: drop-shadow(0 8px 14px rgba(179, 99, 20, 0.18));
}

.success-popup__copy {
  display: grid;
  gap: 10px;
  margin-top: 8px;
}

.success-popup__title,
.success-popup__subtitle {
  margin: 0;
}

.success-popup__title {
  font-size: clamp(2rem, 5vw, 2.8rem);
  font-weight: 900;
  line-height: 0.96;
  color: #b65417;
  text-shadow: 0 3px 12px rgba(255, 216, 148, 0.32);
}

.success-popup__subtitle {
  font-size: clamp(1rem, 2.8vw, 1.18rem);
  font-weight: 900;
  line-height: 1.18;
  color: #8f5821;
}

.success-popup[data-theme="merry-go-round"] .success-popup__lighting--base {
  background:
    radial-gradient(circle at 50% 16%, rgba(255, 249, 210, 0.66), transparent 28%),
    radial-gradient(circle at 50% 62%, rgba(255, 198, 94, 0.28), transparent 22%),
    linear-gradient(180deg, rgba(255, 235, 170, 0.08), rgba(255, 124, 60, 0.1));
}

.success-popup[data-theme="merry-go-round"] .success-popup__lighting--beam-1 {
  left: 50%;
  top: -2%;
  width: 44%;
  height: 72%;
  transform: translateX(-50%);
  background: linear-gradient(180deg, rgba(255, 252, 227, 0.78), rgba(255, 219, 124, 0.08));
}

.success-popup[data-theme="merry-go-round"] .success-popup__lighting--beam-2 {
  left: 50%;
  bottom: 5%;
  width: 38%;
  height: 18%;
  transform: translateX(-50%);
  background: radial-gradient(circle, rgba(255, 201, 99, 0.58), rgba(255, 201, 99, 0) 70%);
}

.success-popup[data-theme="merry-go-round"] .success-popup__lighting--glow-1 {
  inset: auto 8% 60% 8%;
  background:
    radial-gradient(circle at 12% 50%, rgba(255, 244, 192, 0.44), transparent 12%),
    radial-gradient(circle at 24% 50%, rgba(255, 244, 192, 0.38), transparent 11%),
    radial-gradient(circle at 76% 50%, rgba(255, 244, 192, 0.38), transparent 11%),
    radial-gradient(circle at 88% 50%, rgba(255, 244, 192, 0.44), transparent 12%);
}

.success-popup[data-theme="merry-go-round"] .success-popup__lighting--glow-2 {
  left: 50%;
  top: 38%;
  width: 36%;
  height: 36%;
  transform: translateX(-50%);
  background: radial-gradient(circle, rgba(255, 223, 134, 0.24), rgba(255, 223, 134, 0) 72%);
}

.success-popup[data-theme="rainbow-slide"] .success-popup__lighting--base {
  background:
    radial-gradient(circle at 50% 14%, rgba(255, 239, 196, 0.56), transparent 28%),
    linear-gradient(
      125deg,
      rgba(255, 167, 197, 0.14),
      rgba(255, 227, 133, 0.08) 28%,
      rgba(173, 233, 255, 0.1) 58%,
      rgba(255, 171, 225, 0.12) 100%
    );
}

.success-popup[data-theme="rainbow-slide"] .success-popup__lighting--beam-1 {
  left: 12%;
  top: 28%;
  width: 78%;
  height: 24%;
  transform: rotate(-15deg);
  background: linear-gradient(
    90deg,
    rgba(255, 140, 182, 0),
    rgba(255, 248, 255, 0.72) 48%,
    rgba(123, 219, 255, 0)
  );
}

.success-popup[data-theme="rainbow-slide"] .success-popup__lighting--beam-2 {
  right: 8%;
  bottom: 16%;
  width: 28%;
  height: 26%;
  background: radial-gradient(circle, rgba(255, 234, 165, 0.46), rgba(255, 234, 165, 0) 70%);
}

.success-popup[data-theme="rainbow-slide"] .success-popup__lighting--glow-1 {
  left: 58%;
  top: 34%;
  width: 24%;
  height: 24%;
  background: radial-gradient(circle, rgba(255, 205, 139, 0.34), rgba(255, 205, 139, 0) 72%);
}

.success-popup[data-theme="rainbow-slide"] .success-popup__lighting--glow-2 {
  right: 10%;
  bottom: 10%;
  width: 30%;
  height: 22%;
  background: radial-gradient(circle, rgba(255, 186, 228, 0.32), rgba(255, 186, 228, 0) 72%);
}

.success-popup[data-theme="giant-wheel"] .success-popup__lighting--base {
  background:
    radial-gradient(circle at 50% 40%, rgba(255, 245, 194, 0.5), transparent 26%),
    radial-gradient(circle at 50% 14%, rgba(255, 230, 172, 0.32), transparent 26%),
    linear-gradient(180deg, rgba(255, 231, 153, 0.06), rgba(255, 145, 78, 0.08));
}

.success-popup[data-theme="giant-wheel"] .success-popup__lighting--beam-1 {
  left: 50%;
  top: 18%;
  width: 26%;
  height: 48%;
  transform: translateX(-50%);
  background: radial-gradient(circle, rgba(255, 248, 220, 0.58), rgba(255, 248, 220, 0) 72%);
}

.success-popup[data-theme="giant-wheel"] .success-popup__lighting--beam-2 {
  left: 50%;
  top: 14%;
  width: 50%;
  height: 56%;
  transform: translateX(-50%);
  background:
    linear-gradient(90deg, rgba(255, 244, 200, 0), rgba(255, 244, 200, 0.26) 50%, rgba(255, 244, 200, 0)),
    linear-gradient(180deg, rgba(255, 244, 200, 0), rgba(255, 244, 200, 0.26) 50%, rgba(255, 244, 200, 0));
}

.success-popup[data-theme="giant-wheel"] .success-popup__lighting--glow-1 {
  left: 50%;
  top: 40%;
  width: 44%;
  height: 78%;
  transform: translate(-50%, -50%);
  border: 2px solid rgba(255, 239, 176, 0.34);
  box-shadow:
    0 0 32px rgba(255, 221, 132, 0.32),
    inset 0 0 28px rgba(255, 255, 255, 0.08);
}

.success-popup[data-theme="giant-wheel"] .success-popup__lighting--glow-2 {
  left: 50%;
  top: 40%;
  width: 12%;
  height: 12%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(255, 222, 109, 0.62), rgba(255, 222, 109, 0) 70%);
}

.success-popup[data-theme="bumper-car"] .success-popup__lighting--base {
  background:
    radial-gradient(circle at 48% 24%, rgba(255, 240, 191, 0.58), transparent 26%),
    radial-gradient(circle at 57% 72%, rgba(255, 193, 114, 0.18), transparent 28%),
    linear-gradient(180deg, rgba(255, 228, 154, 0.06), rgba(255, 132, 74, 0.08));
}

.success-popup[data-theme="bumper-car"] .success-popup__lighting--beam-1 {
  left: 48%;
  top: 12%;
  width: 34%;
  height: 50%;
  transform: translateX(-50%);
  background: linear-gradient(180deg, rgba(255, 249, 214, 0.74), rgba(255, 206, 120, 0.06));
}

.success-popup[data-theme="bumper-car"] .success-popup__lighting--beam-2 {
  right: 10%;
  bottom: 16%;
  width: 24%;
  height: 18%;
  background: radial-gradient(circle at 30% 50%, rgba(255, 218, 130, 0.52), rgba(255, 218, 130, 0) 72%);
}

.success-popup[data-theme="bumper-car"] .success-popup__lighting--glow-1 {
  left: 48%;
  bottom: 14%;
  width: 56%;
  height: 18%;
  transform: translateX(-50%);
  background: radial-gradient(ellipse, rgba(255, 196, 105, 0.3), rgba(255, 196, 105, 0) 70%);
}

.success-popup[data-theme="bumper-car"] .success-popup__lighting--glow-2 {
  right: 14%;
  bottom: 18%;
  width: 18%;
  height: 18%;
  background: radial-gradient(circle, rgba(255, 239, 190, 0.26), rgba(255, 239, 190, 0) 72%);
}

.page-shell.is-success-popup-visible .success-popup {
  opacity: 1;
  pointer-events: none;
}

.page-shell.is-success-popup-visible .success-popup::before {
  opacity: 1;
}

.page-shell.is-success-popup-visible .success-popup__screen {
  animation: success-screen-enter 460ms cubic-bezier(0.18, 0.9, 0.24, 1) forwards;
}

.page-shell.is-success-popup-visible .success-popup__caption {
  animation: success-caption-rise 520ms cubic-bezier(0.2, 0.9, 0.25, 1) 90ms forwards;
}

.page-shell.is-success-popup-visible .success-popup__lighting--base {
  opacity: 0.95;
  animation: success-base-glow 2200ms ease-in-out infinite alternate;
}

.page-shell.is-success-popup-visible .success-popup__lighting--beam {
  opacity: 0.82;
  animation: success-light-sweep 3200ms ease-in-out infinite;
}

.page-shell.is-success-popup-visible .success-popup__lighting--beam-2 {
  animation-delay: 180ms;
}

.page-shell.is-success-popup-visible .success-popup__lighting--glow {
  opacity: 0.78;
  animation: success-glow-pulse 2000ms ease-in-out infinite;
}

.page-shell.is-success-popup-visible .success-popup__lighting--glow-2 {
  animation-delay: 160ms;
}

.page-shell.is-success-popup-visible .success-popup__spark {
  animation: success-spark-burst 760ms cubic-bezier(0.18, 0.9, 0.24, 1) forwards;
}

.page-shell.is-success-popup-visible .success-popup__spark--2,
.page-shell.is-success-popup-visible .success-popup__spark--5 {
  animation-delay: 70ms;
}

.page-shell.is-success-popup-visible .success-popup__spark--3,
.page-shell.is-success-popup-visible .success-popup__spark--6 {
  animation-delay: 130ms;
}

.success-popup[data-theme="giant-wheel"] .success-popup__lighting--glow-1 {
  animation: success-wheel-ring 2200ms linear infinite;
}

.success-popup[data-theme="bumper-car"] .success-popup__lighting--beam-2 {
  animation: success-headlight-pulse 1800ms ease-in-out infinite;
}

@media (max-width: 900px) {
  .success-popup {
    padding: 18px;
  }

  .success-popup__screen {
    border-radius: 28px;
  }

  .success-popup__caption {
    width: min(62%, 420px);
  }

  .success-popup__burst {
    top: calc(50% - 30vw);
    width: min(92vw, 560px);
    height: 180px;
  }
}

@media (max-width: 700px) {
  .success-popup {
    padding: 14px;
  }

  .success-popup__screen {
    border-radius: 22px;
  }

  .success-popup__caption {
    top: auto;
    right: 14px;
    bottom: 14px;
    left: 14px;
    width: auto;
    gap: 8px;
    border-radius: 22px;
  }

  .success-popup__caption .success-popup__title {
    font-size: clamp(1.7rem, 7vw, 2.55rem);
  }

  .success-popup__caption .success-popup__subtitle {
    max-width: none;
    font-size: clamp(0.94rem, 3.8vw, 1.08rem);
  }

  .success-popup__eyebrow {
    font-size: 0.72rem;
  }

  .success-popup__burst {
    top: calc(50% - 34vw);
    width: min(94vw, 420px);
    height: 150px;
  }
}

.check-button.is-retry {
  width: min(100%, calc(var(--game-check-width) * 0.662));
  aspect-ratio: 307 / 94;
  border-radius: 0;
  background: url("assets/TryAgainButton.png") center center / 100% 100% no-repeat;
  box-shadow: none;
  color: transparent;
  text-shadow: none;
  overflow: hidden;
}

.check-button.is-retry .check-button__label {
  display: none;
}

.check-button:hover:not(:disabled) {
  animation: none;
  transform: translateY(-4px) scale(1.03);
  filter:
    brightness(1.06)
    drop-shadow(0 0 16px rgba(123, 218, 255, 0.42))
    drop-shadow(0 10px 18px rgba(66, 151, 204, 0.2));
}

.check-button:active:not(:disabled) {
  transform: translateY(1px) scale(0.985);
}

.check-button:disabled {
  cursor: default;
  opacity: 0.68;
  filter: saturate(0.8) brightness(0.97);
}

@keyframes success-screen-enter {
  0% {
    opacity: 0;
    transform: translateY(32px) scale(0.92);
  }

  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes banner-float {
  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-4px);
  }
}

@keyframes mascot-bob {
  0%,
  100% {
    transform: rotate(0deg) scale(1);
  }

  50% {
    transform: rotate(-2deg) scale(1.03);
  }
}

@keyframes machine-idle-bob {
  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-7px);
  }
}

@keyframes goal-glow {
  0%,
  100% {
    filter: brightness(1);
    text-shadow: 0 2px 10px rgba(255, 235, 175, 0.44);
  }

  50% {
    filter: brightness(1.08);
    text-shadow:
      0 2px 10px rgba(255, 235, 175, 0.44),
      0 0 18px rgba(255, 239, 171, 0.4);
  }
}

@keyframes button-breathe {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }

  50% {
    transform: translateY(-1px) scale(1.01);
  }
}

@keyframes success-caption-rise {
  0% {
    opacity: 0;
    transform: translateY(24px);
  }

  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes success-base-glow {
  0% {
    transform: scale(1);
    filter: brightness(0.96);
  }

  100% {
    transform: scale(1.03);
    filter: brightness(1.08);
  }
}

@keyframes success-light-sweep {
  0%,
  100% {
    transform: translateX(0) scale(1);
    filter: blur(24px) brightness(0.96);
  }

  50% {
    transform: translateX(10px) scale(1.04);
    filter: blur(24px) brightness(1.12);
  }
}

@keyframes success-glow-pulse {
  0%,
  100% {
    transform: scale(0.96);
    filter: blur(16px) brightness(0.92);
  }

  50% {
    transform: scale(1.04);
    filter: blur(18px) brightness(1.16);
  }
}

@keyframes success-wheel-ring {
  0%,
  100% {
    transform: translate(-50%, -50%) scale(0.98);
    opacity: 0.48;
  }

  50% {
    transform: translate(-50%, -50%) scale(1.04);
    opacity: 0.84;
  }
}

@keyframes success-headlight-pulse {
  0%,
  100% {
    transform: scale(0.94);
    filter: blur(24px) brightness(0.88);
  }

  50% {
    transform: scale(1.08);
    filter: blur(28px) brightness(1.18);
  }
}

@keyframes money-bounce {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }
  40% {
    transform: translateY(-10px) scale(1.08);
  }
  70% {
    transform: translateY(-3px) scale(0.98);
  }
}

@keyframes money-denied {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-5px);
  }
  50% {
    transform: translateX(5px);
  }
  75% {
    transform: translateX(-3px);
  }
}

@keyframes machine-wrong-answer {
  0% {
    transform: translateX(0) rotate(0deg);
  }

  16% {
    transform: translateX(-10px) rotate(-1.5deg);
  }

  34% {
    transform: translateX(9px) rotate(1.4deg);
  }

  52% {
    transform: translateX(-7px) rotate(-1deg);
  }

  70% {
    transform: translateX(5px) rotate(0.75deg);
  }

  86% {
    transform: translateX(-2px) rotate(-0.35deg);
  }

  100% {
    transform: translateX(0) rotate(0deg);
  }
}

@keyframes meter-victory-pulse {
  0%,
  100% {
    transform: translateX(-50%) scale(1);
    filter:
      drop-shadow(0 0 12px rgba(255, 241, 119, 0.92))
      drop-shadow(0 0 24px rgba(255, 220, 74, 0.54));
  }
  50% {
    transform: translateX(-50%) scale(1.08);
    filter:
      drop-shadow(0 0 14px rgba(255, 245, 148, 1))
      drop-shadow(0 0 30px rgba(255, 219, 67, 0.78));
  }
}

@keyframes ticket-rise {
  0% {
    opacity: 0;
    transform: translate(-50%, -124%);
  }
  18% {
    opacity: 1;
  }
  100% {
    opacity: 1;
    transform: translate(-50%, 12%);
  }
}

@keyframes success-popup-enter {
  0% {
    opacity: 0;
    transform: translateY(36px) scale(0.84);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes success-icon-bob {
  0%,
  100% {
    transform: translateX(-50%) translateY(0) scale(1);
  }
  50% {
    transform: translateX(-50%) translateY(-4px) scale(1.03);
  }
}

@keyframes success-spark-burst {
  0% {
    opacity: 0;
    transform: rotate(var(--spark-rotate)) translateY(12px) scale(0.32);
  }
  55% {
    opacity: 1;
    transform: rotate(var(--spark-rotate)) translateY(0) scale(1);
  }
  100% {
    opacity: 0.82;
    transform: rotate(var(--spark-rotate)) translateY(0) scale(0.96);
  }
}

@keyframes confetti-burst {
  0% {
    opacity: 0;
    transform: translate(-50%, -10%) scale(0.62) rotate(0deg);
  }
  10% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--tx)), var(--ty))
      scale(1) rotate(var(--rot));
  }
}

@media (max-width: 1100px) {
  .page-shell {
    padding: 20px 20px 28px;
  }

  .page-shell.is-selection-view .game-shell {
    width: min(1240px, 100%);
  }

  .ride-list {
    grid-template-columns: repeat(2, minmax(0, 248px));
    gap: clamp(24px, 4vw, 34px);
    width: 100%;
  }

  .selection-panel {
    width: min(100%, 820px);
  }

  .board-layout {
    grid-template-columns: minmax(250px, 0.8fr) minmax(0, 1fr);
    gap: 26px;
  }

  .machine-wrap {
    width: min(100%, 420px);
  }

  .machine-dropzone {
    width: 50%;
  }
}

@media (max-width: 960px) {
  body {
    display: block;
    overflow-x: hidden;
    overflow-y: auto;
  }

  .page-shell {
    width: 100%;
    max-width: none;
    min-height: 100vh;
    min-height: 100svh;
    min-height: 100dvh;
    max-height: none;
    aspect-ratio: auto;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 18px 14px 24px;
  }

  .page-background {
    position: fixed;
  }

  .game-shell,
  .play-surface {
    height: auto;
    min-height: 0;
  }

  .page-shell.is-selection-view .game-shell,
  .page-shell.is-game-view .game-shell {
    width: 100%;
    min-height: 0;
  }

  .page-shell.is-selection-view .selection-screen {
    margin-top: clamp(18px, 4vw, 28px);
  }

  .page-shell.is-game-view {
    height: auto;
    min-height: 100vh;
    min-height: 100svh;
    min-height: 100dvh;
    overflow-y: visible;
    padding-top: calc(16px + env(safe-area-inset-top));
    padding-right: calc(14px + env(safe-area-inset-right));
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
    padding-left: calc(14px + env(safe-area-inset-left));
  }

  .page-shell.is-game-view .top-banner {
    width: 100%;
  }

  .page-shell.is-game-view .top-banner__copy {
    padding: 0 clamp(18px, 2vw, 26px) 0 clamp(112px, 10vw, 152px);
  }

  .page-shell.is-game-view .top-banner h1 {
    font-size: clamp(0.94rem, 1.65vw, 1.62rem);
  }

  .page-shell.is-game-view .game-screen {
    margin-top: 6px;
    padding-bottom: 26px;
  }

  .page-shell.is-game-view .board-layout {
    width: 100%;
    min-height: 0;
    grid-template-columns: minmax(520px, 1.42fr) minmax(280px, 0.78fr);
    gap: 18px;
    align-items: center;
    transform: none;
  }

  .page-shell.is-game-view .controls-column {
    width: 100%;
    max-width: 820px;
    justify-self: stretch;
    align-self: center;
    gap: 14px;
    transform: none;
  }

  .page-shell.is-game-view .machine-column {
    align-self: center;
  }

  .page-shell.is-game-view .machine-wrap {
    width: min(100%, 400px);
  }

  .page-shell.is-game-view .machine-dropzone {
    min-height: clamp(150px, 32vw, 220px);
  }

  .page-shell.is-game-view .placed-money-layer {
    inset: clamp(18px, 4vw, 28px) clamp(18px, 5vw, 30px)
      clamp(22px, 5vw, 34px);
  }

  .page-shell.is-game-view .controls-panel {
    min-height: 0;
    aspect-ratio: auto;
    overflow: visible;
  }
}

@media (max-width: 860px) {
  .board-layout {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .controls-panel {
    min-height: 0;
  }

  .money-tray {
    row-gap: 34px;
  }

  .machine-dropzone {
    width: 48%;
  }
}

@media (max-width: 720px) {
  .page-shell.is-selection-view .selection-screen {
    margin-top: clamp(22px, 6vw, 34px);
  }

  .ride-list {
    gap: 22px;
  }

  .ride-card {
    min-height: 0;
  }

  .level-actions {
    flex-direction: column;
  }

  .action-button {
    width: 100%;
  }

  .machine-dropzone {
    width: 52%;
    bottom: 15%;
  }
}

@media (max-width: 620px) {
  .page-shell {
    padding: 16px 12px 24px;
  }

  .page-shell.is-selection-view .selection-screen {
    margin-top: clamp(16px, 6vw, 28px);
  }

  .selection-panel {
    width: min(100%, 372px);
  }

  .top-banner__copy {
    padding: 0 14px 0 72px;
  }

  .top-banner h1 {
    font-size: clamp(0.82rem, 3.8vw, 1.02rem);
    line-height: 1.08;
    white-space: normal;
    text-overflow: clip;
  }

  .ride-list {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .ride-card {
    width: 100%;
    min-height: 0;
  }

  .ride-card__badge {
    top: 12px;
    right: 12px;
    padding: 6px 10px;
    font-size: 0.72rem;
  }

  .controls-panel {
    padding: 18px 16px 22px;
    border-width: 4px;
    border-radius: 22px;
  }

  .money-tray {
    grid-template-columns: repeat(3, minmax(70px, 1fr));
    grid-template-rows: auto auto auto;
    row-gap: 28px;
  }

  .money-button--ten {
    grid-column: 3;
    width: clamp(88px, 24vw, 130px);
  }

  .money-button--note {
    grid-column: 1 / -1;
    width: min(100%, 300px);
  }

  .machine-dropzone {
    width: 58%;
    min-height: 17.5%;
    padding: 8px 10px;
    border-radius: 18px;
  }

  .placed-money-layer {
    min-height: 48px;
    gap: 5px 6px;
  }

  .placed-money__sprite--coin {
    width: clamp(28px, 8vw, 34px);
  }

  .placed-money__sprite--note {
    width: clamp(60px, 18vw, 84px);
  }
}

@media (max-width: 860px) {
  .page-shell.is-game-view {
    --game-banner-width: 100%;
    --game-content-width: 100%;
    --game-left-panel-width: 100%;
    --game-controls-max: 100%;
    --game-layout-shift-x: 0px;
    --game-machine-width: min(
      100%,
      max(300px, calc(var(--layout-stage-width) * 372 / var(--design-width)))
    );
    --game-column-gap: calc(var(--layout-stage-height) * 22 / var(--design-height));
    --game-dropzone-height: auto;
    --game-tray-height: auto;
  }

  .page-shell.is-game-view .board-layout {
    min-height: 0;
    grid-template-columns: 1fr;
    grid-template-areas:
      "controls"
      "machine";
    justify-items: center;
    gap: 22px;
    transform: none;
  }

  .page-shell.is-game-view .level-actions {
    position: static;
    margin: 0;
  }

  .page-shell.is-game-view .controls-column {
    width: min(100%, var(--game-controls-max));
    max-width: var(--game-controls-max);
    justify-self: stretch;
    transform: none;
  }

  .page-shell.is-game-view .machine-wrap {
    width: min(100%, var(--game-machine-width));
  }
}

@media (max-width: 960px) {
  .page-shell.is-game-view {
    /* Tablet/mobile ratios stay tied to the same reference canvas */
    --game-banner-width: 100%;
    --game-content-width: 100%;
    --game-left-panel-width: 100%;
    --game-layout-shift-x: 0px;
    --game-rail-width: 44px;
    --game-section-gap: 0px;
    --game-column-gap: calc(var(--layout-stage-width) * 20 / var(--design-width));
    --game-controls-max: min(
      100%,
      max(320px, calc(var(--layout-stage-width) * 720 / var(--design-width)))
    );
    --game-machine-width: min(
      100%,
      max(300px, calc(var(--layout-stage-width) * 390 / var(--design-width)))
    );
    --game-dropzone-height: auto;
    --game-tray-height: auto;
    --game-top-gap: calc(var(--layout-stage-height) * 16 / var(--design-height));
    --game-back-offset: 0px;
    --game-stack-gap: calc(var(--layout-stage-height) * 14 / var(--design-height));
    --game-check-gap: calc(var(--layout-stage-height) * 16 / var(--design-height));
    --game-drop-inset-block-start: max(
      18px,
      calc(var(--layout-stage-height) * 24 / var(--design-height))
    );
    --game-drop-inset-inline: max(
      18px,
      calc(var(--layout-stage-width) * 28 / var(--design-width))
    );
    --game-drop-inset-block-end: max(
      20px,
      calc(var(--layout-stage-height) * 28 / var(--design-height))
    );
    --game-undo-edge: max(14px, calc(var(--layout-stage-width) * 18 / var(--design-width)));
    --game-tray-padding-inline: max(
      18px,
      calc(var(--layout-stage-width) * 22 / var(--design-width))
    );
    --game-tray-padding-block: max(
      14px,
      calc(var(--layout-stage-height) * 14 / var(--design-height))
    );
    --game-money-gap: max(10px, calc(var(--layout-stage-width) * 12 / var(--design-width)));
    --game-coin-size: max(64px, calc(var(--layout-stage-width) * 72 / var(--design-width)));
    --game-ten-size: max(72px, calc(var(--layout-stage-width) * 82 / var(--design-width)));
    --game-note-size: max(
      146px,
      calc(var(--layout-stage-width) * 150 / var(--design-width))
    );
    --game-note-wide-size: max(
      158px,
      calc(var(--layout-stage-width) * 164 / var(--design-width))
    );
    --game-check-width: min(
      100%,
      max(260px, calc(var(--layout-stage-width) * 320 / var(--design-width)))
    );
  }

  .page-shell.is-game-view .game-screen {
    width: 100%;
    grid-template-columns: 1fr;
    grid-template-areas:
      "back"
      "board"
      "check";
    column-gap: 0;
    row-gap: 14px;
    padding-top: 0;
  }

  .page-shell.is-game-view .level-actions {
    justify-self: start;
    margin: 0 0 4px;
  }

  .page-shell.is-game-view .page-background {
    background:
      linear-gradient(
        180deg,
        rgba(255, 255, 255, 0.05),
        rgba(255, 242, 219, 0.1)
      ),
      url("assets/Background2.png") center bottom / cover no-repeat;
  }

  .page-shell.is-game-view .board-layout {
    gap: var(--game-column-gap);
  }

  .page-shell.is-game-view .controls-panel {
    aspect-ratio: auto;
    min-height: 210px;
  }

  .page-shell.is-game-view .money-tray {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    justify-items: center;
    gap: var(--game-money-gap);
  }

  .page-shell.is-game-view .money-button {
    width: 100%;
    min-height: 0;
  }

  .page-shell.is-game-view .money-button--coin,
  .page-shell.is-game-view .money-button--ten {
    max-width: 100%;
  }

  .page-shell.is-game-view .money-button--note {
    grid-column: auto;
    max-width: var(--game-note-size);
  }

  .page-shell.is-game-view .money-button--note-wide {
    max-width: var(--game-note-wide-size);
  }
}

@media (max-width: 820px) {
  .success-popup {
    padding: 18px;
  }

  .success-popup__burst {
    top: calc(50% - 140px);
    width: min(92vw, 360px);
  }

  .success-popup__panel {
    width: min(100%, 350px);
    padding: 68px 18px 18px;
    border-radius: 28px;
  }

  .success-popup__icon-shell {
    width: 104px;
    height: 104px;
    top: -50px;
  }

  .page-shell.is-game-view .level-actions {
    justify-content: flex-start;
    flex-wrap: nowrap;
  }

  .page-shell.is-game-view .game-screen {
    padding-top: 0;
  }

  .page-shell.is-game-view .machine-wrap {
    width: min(100%, var(--game-machine-width));
  }

  .page-shell.is-game-view .machine-goal {
    font-size: clamp(
      2rem,
      calc(var(--layout-stage-width) * 54 / var(--design-width)),
      3.2rem
    );
  }

  .page-shell.is-game-view .controls-column {
    width: min(100%, var(--game-controls-max));
    max-width: var(--game-controls-max);
  }

  .page-shell.is-game-view .machine-dropzone {
    aspect-ratio: 2470 / 945;
    min-height: clamp(170px, 34vw, 220px);
  }

  .page-shell.is-game-view .machine-dropzone__hint {
    width: min(100%, 320px);
    font-size: clamp(1rem, 4.2vw, 1.5rem);
  }

  .page-shell.is-game-view .placed-money-layer {
    inset: var(--game-drop-inset-block-start) var(--game-drop-inset-inline)
      var(--game-drop-inset-block-end);
    justify-content: center;
    gap: var(--game-drop-gap);
  }

  .undo-button {
    right: var(--game-undo-edge);
    bottom: var(--game-undo-edge);
    width: var(--game-undo-size);
    height: var(--game-undo-size);
  }

  .page-shell.is-game-view .money-tray {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    justify-items: center;
    gap: var(--game-money-gap);
  }

  .page-shell.is-game-view .money-button {
    width: 100%;
    min-height: 0;
  }

  .page-shell.is-game-view .money-button--coin,
  .page-shell.is-game-view .money-button--ten {
    max-width: 100%;
  }

  .page-shell.is-game-view .money-button--note {
    grid-column: auto;
    max-width: var(--game-note-size);
  }

  .page-shell.is-game-view .money-button--note-wide {
    max-width: var(--game-note-wide-size);
  }
}

@media (max-width: 620px) {
  .page-shell.is-game-view {
    --game-rail-width: 44px;
    --game-machine-width: min(
      100%,
      max(252px, calc(var(--layout-stage-width) * 320 / var(--design-width)))
    );
    --game-drop-inset-block-start: max(
      16px,
      calc(var(--layout-stage-height) * 18 / var(--design-height))
    );
    --game-drop-inset-inline: max(
      16px,
      calc(var(--layout-stage-width) * 18 / var(--design-width))
    );
    --game-drop-inset-block-end: max(
      18px,
      calc(var(--layout-stage-height) * 20 / var(--design-height))
    );
    --game-coin-size: max(58px, calc(var(--layout-stage-width) * 64 / var(--design-width)));
    --game-ten-size: max(62px, calc(var(--layout-stage-width) * 70 / var(--design-width)));
    --game-note-size: max(172px, calc(var(--layout-stage-width) * 172 / var(--design-width)));
    --game-note-wide-size: max(
      180px,
      calc(var(--layout-stage-width) * 180 / var(--design-width))
    );
    --game-check-width: min(100%, 260px);
  }

  .page-shell.is-game-view .game-screen {
    padding-top: 0;
  }

  .page-shell.is-game-view .action-button--back {
    width: 44px;
    min-height: 44px;
  }

  .page-shell.is-game-view .action-button--back .action-button__arrow {
    font-size: 1.75rem;
  }

  .page-shell.is-game-view .board-layout {
    gap: var(--game-stack-gap);
  }

  .page-shell.is-game-view .machine-wrap {
    width: min(100%, var(--game-machine-width));
  }

  .page-shell.is-game-view .machine-goal {
    width: 48%;
    font-size: clamp(
      1.9rem,
      calc(var(--layout-stage-width) * 52 / var(--design-width)),
      2.7rem
    );
  }

  .page-shell.is-game-view .machine-dropzone {
    min-height: clamp(136px, 40vw, 180px);
  }

  .page-shell.is-game-view .placed-money-layer {
    inset: var(--game-drop-inset-block-start) var(--game-drop-inset-inline)
      var(--game-drop-inset-block-end);
    gap: var(--game-drop-gap);
  }

  .page-shell.is-game-view .placed-money__sprite--coin {
    width: clamp(40px, calc(var(--layout-stage-width) * 42 / var(--design-width)), 52px);
  }

  .page-shell.is-game-view .placed-money__sprite--note {
    width: clamp(84px, calc(var(--layout-stage-width) * 108 / var(--design-width)), 116px);
  }

  .page-shell.is-game-view .controls-panel {
    padding: var(--game-tray-padding-block) var(--game-tray-padding-inline)
      calc(var(--game-tray-padding-block) + 2px);
    overflow: hidden;
  }

  .page-shell.is-game-view .money-tray {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--game-money-gap);
  }

  .page-shell.is-game-view .money-button--note {
    grid-column: 1 / -1;
    width: min(100%, var(--game-note-size));
    max-width: var(--game-note-size);
    justify-self: center;
  }

  .page-shell.is-game-view .money-button--note-wide {
    width: min(100%, var(--game-note-wide-size));
    max-width: var(--game-note-wide-size);
  }
}

@media (max-width: 480px) {
  .page-shell {
    padding: 14px 10px 20px;
  }

  .ride-card {
    width: 100%;
    min-height: 0;
  }

  .ride-list {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .ride-card__badge {
    font-size: 0.66rem;
  }

  .top-banner__copy {
    padding: 0 10px 0 58px;
  }

  .top-banner h1 {
    font-size: clamp(0.72rem, 3.6vw, 0.92rem);
  }

  .page-shell.is-game-view {
    --game-machine-width: min(
      100%,
      max(248px, calc(var(--layout-stage-width) * 280 / var(--design-width)))
    );
    --game-stack-gap: calc(var(--layout-stage-height) * 12 / var(--design-height));
    --game-money-gap: max(8px, calc(var(--layout-stage-width) * 10 / var(--design-width)));
    --game-coin-size: max(52px, calc(var(--layout-stage-width) * 58 / var(--design-width)));
    --game-ten-size: max(56px, calc(var(--layout-stage-width) * 62 / var(--design-width)));
    --game-note-size: max(154px, calc(var(--layout-stage-width) * 154 / var(--design-width)));
    --game-note-wide-size: max(
      160px,
      calc(var(--layout-stage-width) * 160 / var(--design-width))
    );
    --game-tray-padding-inline: max(
      8px,
      calc(var(--layout-stage-width) * 12 / var(--design-width))
    );
  }

  .page-shell.is-game-view .machine-dropzone {
    min-height: clamp(128px, 42vw, 168px);
  }

  .page-shell.is-game-view .controls-panel {
    padding: var(--game-tray-padding-block) var(--game-tray-padding-inline)
      calc(var(--game-tray-padding-block) + 2px);
  }

  .page-shell.is-game-view .money-tray {
    gap: var(--game-money-gap);
  }

  .page-shell.is-game-view .money-button--note {
    width: min(100%, var(--game-note-size));
    max-width: var(--game-note-size);
  }

  .page-shell.is-game-view .money-button--note-wide {
    width: min(100%, var(--game-note-wide-size));
    max-width: var(--game-note-wide-size);
  }
}

@media (max-width: 360px) {
  .page-shell {
    padding: 12px 8px 18px;
  }

  .ride-list {
    grid-template-columns: 1fr;
  }

  .ride-card {
    width: 100%;
    min-height: 0;
  }

  .top-banner__copy {
    padding: 0 8px 0 52px;
  }

  .top-banner h1 {
    font-size: 0.68rem;
  }

  .page-shell.is-game-view {
    --game-machine-width: min(
      100%,
      max(228px, calc(var(--layout-stage-width) * 252 / var(--design-width)))
    );
    --game-note-wide-size: max(
      148px,
      calc(var(--layout-stage-width) * 148 / var(--design-width))
    );
  }
}

@media (orientation: landscape) and (max-height: 520px) {
  .page-shell.is-selection-view {
    padding-top: calc(10px + env(safe-area-inset-top));
    padding-right: calc(10px + env(safe-area-inset-right));
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
    padding-left: calc(10px + env(safe-area-inset-left));
  }

  .page-shell.is-selection-view .top-banner {
    width: min(100%, 760px);
    margin: 0 auto;
  }

  .page-shell.is-selection-view .top-banner__copy {
    align-items: center;
    padding: 0 16px 0 92px;
  }

  .page-shell.is-selection-view .top-banner h1 {
    font-size: clamp(0.72rem, 1.65vw, 0.96rem);
    line-height: 0.98;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .page-shell.is-selection-view .selection-screen {
    margin-top: clamp(8px, 2vh, 14px);
  }

  .page-shell.is-selection-view .selection-panel,
  .page-shell.is-selection-view .ride-list {
    width: 100%;
  }

  .page-shell.is-selection-view .ride-list {
    grid-template-columns: repeat(2, minmax(0, 220px));
    gap: 12px;
  }

  .page-shell.is-selection-view .ride-card {
    width: 100%;
    min-height: 0;
    align-self: start;
  }

  .page-shell.is-selection-view .ride-card__badge {
    top: 8px;
    right: 8px;
    padding: 5px 8px;
    font-size: 0.58rem;
  }
}

@media (orientation: landscape) and (max-height: 520px) and (min-width: 1200px) {
  .page-shell.is-selection-view .ride-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@keyframes ride-card-enter {
  0% {
    opacity: 0;
    transform: translateY(20px);
  }

  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes landscape-lock-rotate {
  0%,
  100% {
    transform: rotate(0deg) scale(0.96);
  }

  35%,
  65% {
    transform: rotate(-90deg) scale(1);
  }
}
