:root {
  color-scheme: light;
  --sky-top: #89d2f5;
  --sky-mid: #c8effc;
  --sky-bottom: #f2fcff;
  --ice: #d8f0fb;
  --ice-strong: #b8def3;
  --blue: #58a9dc;
  --blue-deep: #347eb2;
  --ink: #294b63;
  --muted: #7892a4;
  --cream: #fffdf8;
  --green: #4fd17a;
  --green-deep: #2eb35f;
  --gold: #ecd98f;
  --loss: #e45b4f;
  --gain: #1aa765;
  --soft-shadow: 0 24px 50px rgba(49, 133, 177, 0.2);
  --button-shadow: 0 8px 0 rgba(48, 111, 148, 0.14), 0 14px 24px rgba(48, 125, 169, 0.16);
  font-family:
    "SF Pro Rounded", "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC",
    system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--sky-bottom);
}

body {
  margin: 0;
  color: var(--ink);
}

button {
  font: inherit;
}

button:focus-visible {
  outline: 4px solid rgba(255, 209, 83, 0.88);
  outline-offset: 4px;
}

.scene {
  position: relative;
  isolation: isolate;
  display: grid;
  height: 100svh;
  min-height: 100svh;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 54%, rgba(255, 255, 255, 0.52), transparent 30%),
    linear-gradient(180deg, var(--sky-top) 0%, var(--sky-mid) 58%, var(--sky-bottom) 82%);
}

.sky-glow {
  position: absolute;
  inset: 0;
  z-index: -4;
  background:
    linear-gradient(90deg, transparent 0 12%, rgba(255, 255, 255, 0.2) 30%, transparent 51%),
    radial-gradient(ellipse at 38% 28%, rgba(255, 255, 255, 0.2), transparent 45%);
  pointer-events: none;
}

.sun {
  position: absolute;
  z-index: -2;
  top: 5.8%;
  right: 7.2%;
  width: clamp(68px, 6vw, 110px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 34%, #fffbe1 0 9%, #ffe98b 50%, #ffdc55 100%);
  box-shadow:
    0 0 36px rgba(255, 224, 96, 0.68),
    0 0 90px rgba(255, 236, 150, 0.58);
  animation: sun-pulse 5s ease-in-out infinite;
}

.cloud {
  position: absolute;
  z-index: -1;
  width: 168px;
  height: 54px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.95);
  filter: drop-shadow(0 10px 12px rgba(78, 155, 194, 0.1));
}

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

.cloud::before {
  left: 24px;
  width: 74px;
  height: 74px;
}

.cloud::after {
  right: 22px;
  width: 88px;
  height: 88px;
}

.cloud--left {
  top: 9%;
  left: 6%;
  transform: scale(0.86);
}

.cloud--title {
  top: 5.6%;
  left: 38%;
  transform: scale(0.74);
  opacity: 0.94;
}

.cloud--right {
  top: 27%;
  right: 13%;
  transform: scale(0.72);
}

.cloud--machine {
  top: 20%;
  left: 52.5%;
  transform: scale(0.58);
  opacity: 0.86;
}

.brand {
  position: absolute;
  top: clamp(34px, 4vh, 64px);
  left: 50%;
  z-index: 3;
  width: min(680px, 90vw);
  transform: translateX(-50%);
  text-align: center;
  color: white;
  pointer-events: none;
  user-select: none;
}

.brand__eyebrow {
  margin: 0 0 3px;
  color: rgba(255, 255, 255, 0.78);
  font-size: clamp(9px, 0.75vw, 12px);
  font-weight: 750;
  letter-spacing: 0.34em;
}

.brand h1 {
  margin: 0;
  font-size: clamp(38px, 2.8vw, 62px);
  font-weight: 950;
  letter-spacing: 0.045em;
  line-height: 1.05;
  text-shadow:
    0 4px 0 rgba(75, 146, 185, 0.22),
    0 8px 18px rgba(73, 148, 189, 0.18);
}

.brand__tagline {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 10px 0 0;
  color: rgba(255, 255, 255, 0.86);
  font-size: clamp(12px, 1.1vw, 17px);
  font-weight: 680;
  letter-spacing: 0.3em;
  text-shadow: 0 2px 5px rgba(61, 135, 174, 0.18);
}

.brand__tagline i {
  width: 22px;
  height: 1px;
  background: rgba(255, 255, 255, 0.72);
}

.stage {
  align-self: end;
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns:
    clamp(220px, 15vw, 300px)
    clamp(410px, 25.5vw, 550px)
    clamp(135px, 9vw, 185px);
  align-items: end;
  justify-content: center;
  gap: clamp(20px, 2.3vw, 44px);
  width: min(1200px, 92vw);
  margin: 0 auto clamp(98px, 12vh, 142px);
}

.score-area {
  position: relative;
  padding-bottom: 48px;
}

.scoreboard {
  overflow: hidden;
  border: 4px solid rgba(57, 139, 191, 0.95);
  border-radius: 22px;
  background: rgba(255, 253, 246, 0.95);
  box-shadow:
    0 18px 38px rgba(45, 126, 173, 0.18),
    inset 0 0 0 1px rgba(255, 255, 255, 0.86);
}

.scoreboard__header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 62px;
  padding: 12px 46px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), transparent 56%),
    linear-gradient(180deg, #72bee8, #55a5da);
  color: white;
}

.scoreboard__header h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-shadow: 0 2px 3px rgba(39, 112, 155, 0.26);
}

.scoreboard__sparkle {
  position: absolute;
  left: 20px;
  color: rgba(255, 255, 255, 0.7);
}

.icon-button {
  position: absolute;
  right: 10px;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  color: white;
  background: rgba(255, 255, 255, 0.14);
  font-size: 21px;
  cursor: pointer;
  transition:
    transform 160ms ease,
    background 160ms ease;
}

.icon-button:hover {
  transform: rotate(-25deg);
  background: rgba(255, 255, 255, 0.28);
}

.stats {
  margin: 0;
  padding: 20px 22px 16px;
}

.stats__row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  min-height: 50px;
  border-bottom: 1px solid rgba(84, 123, 147, 0.1);
  font-size: 17px;
}

.stats__row:last-child {
  border-bottom: 0;
}

.stats__row dt {
  color: #617a89;
  font-weight: 600;
}

.stats__row dd {
  margin: 0;
  color: #294b63;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 0.01em;
}

.stats__row--net dd {
  font-size: 29px;
}

.stats__row dd.is-loss {
  color: var(--loss);
}

.stats__row dd.is-gain {
  color: var(--gain);
}

#average-label {
  margin-right: 3px;
  font-size: 15px;
}

.score-caption {
  position: absolute;
  right: 0;
  bottom: 21px;
  left: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  min-height: 37px;
  padding: 7px 12px;
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.94);
  background: linear-gradient(180deg, #83c6ec, #6bb5e4);
  box-shadow: 0 8px 18px rgba(58, 139, 187, 0.16);
  font-size: 14px;
  letter-spacing: 0.03em;
}

.score-legs {
  position: absolute;
  inset: auto 54px 0;
  display: flex;
  justify-content: space-between;
}

.score-legs i {
  width: 14px;
  height: 56px;
  border-radius: 0 0 9px 9px;
  background: linear-gradient(90deg, #a56a36, #ca8b49, #95602e);
  box-shadow: 0 7px 10px rgba(73, 111, 59, 0.13);
}

.machine-area {
  position: relative;
  isolation: isolate;
}

.machine {
  position: relative;
  padding: 46px 24px 18px;
  border: 5px solid rgba(255, 255, 255, 0.82);
  border-radius: 52px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.72), transparent 24%),
    linear-gradient(180deg, rgba(219, 241, 252, 0.91), rgba(169, 215, 242, 0.88));
  box-shadow:
    inset 0 0 0 4px rgba(171, 216, 241, 0.5),
    inset 0 -12px 20px rgba(105, 174, 216, 0.12),
    var(--soft-shadow);
  transition: transform 220ms ease;
}

.machine::after {
  content: "";
  position: absolute;
  inset: 10px;
  z-index: -1;
  border: 2px solid rgba(255, 255, 255, 0.47);
  border-radius: 40px;
  pointer-events: none;
}

.machine__handle {
  position: absolute;
  top: -30px;
  left: 50%;
  width: 150px;
  height: 52px;
  border: 3px solid rgba(255, 255, 255, 0.75);
  border-radius: 28px;
  transform: translateX(-50%);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(219, 238, 249, 0.88));
  box-shadow:
    inset 0 -7px 12px rgba(117, 173, 204, 0.08),
    0 8px 16px rgba(57, 132, 174, 0.12);
}

.machine__screen {
  padding: 17px;
  border: 4px solid rgba(255, 255, 255, 0.84);
  border-radius: 34px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.28), transparent 35%),
    rgba(120, 185, 226, 0.36);
  box-shadow:
    inset 0 10px 20px rgba(74, 146, 190, 0.12),
    0 7px 0 rgba(107, 171, 211, 0.14);
}

.box-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.box-card {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 0.84;
  min-width: 0;
  border: 3px solid rgba(255, 255, 255, 0.92);
  border-radius: 18px;
  color: #77b9e0;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.96), rgba(244, 246, 245, 0.92));
  box-shadow:
    0 7px 0 rgba(69, 139, 181, 0.23),
    0 11px 18px rgba(55, 126, 168, 0.14),
    inset 0 0 18px rgba(255, 255, 255, 0.9);
  cursor: pointer;
  transform-style: preserve-3d;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    border-color 180ms ease,
    filter 180ms ease;
}

.box-card:hover:not(:disabled) {
  transform: translateY(-5px);
  box-shadow:
    0 11px 0 rgba(69, 139, 181, 0.2),
    0 16px 24px rgba(55, 126, 168, 0.18),
    inset 0 0 18px rgba(255, 255, 255, 0.9);
}

.box-card.is-selected {
  border-color: #fff3a7;
  box-shadow:
    0 8px 0 #dcbf5f,
    0 0 0 5px rgba(255, 230, 126, 0.45),
    0 16px 28px rgba(125, 115, 42, 0.2);
  transform: translateY(-6px) scale(1.02);
}

.box-card.is-sold {
  color: #7791a2;
  background:
    linear-gradient(145deg, rgba(215, 226, 232, 0.9), rgba(188, 207, 219, 0.74));
  box-shadow:
    inset 0 10px 16px rgba(105, 139, 160, 0.16),
    0 4px 0 rgba(79, 139, 176, 0.18);
  cursor: not-allowed;
  filter: saturate(0.72);
}

.box-card.is-revealing {
  animation: card-reveal 820ms cubic-bezier(0.2, 0.8, 0.25, 1);
}

.box-card__number {
  position: absolute;
  top: 8px;
  left: 10px;
  color: #9bb2bf;
  font-size: 11px;
  font-weight: 800;
}

.box-card__mark {
  font-size: clamp(30px, 3vw, 44px);
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.75);
}

.box-card__sold {
  font-size: clamp(12px, 1.3vw, 17px);
  font-weight: 850;
  letter-spacing: 0.08em;
}

.box-card__owned-dot {
  position: absolute;
  right: 9px;
  bottom: 8px;
  width: 8px;
  height: 8px;
  border: 2px solid rgba(255, 255, 255, 0.8);
  border-radius: 50%;
  background: var(--dot-color, #7bbde3);
  box-shadow: 0 2px 6px rgba(55, 107, 137, 0.22);
}

.machine__message {
  display: flex;
  align-items: center;
  min-height: 62px;
  margin: 18px 0 14px;
  padding: 13px 20px;
  border: 2px solid rgba(255, 255, 255, 0.43);
  border-radius: 18px;
  color: #718b9b;
  background: rgba(255, 255, 255, 0.64);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.68);
  font-size: 15px;
  font-weight: 620;
}

.machine__message.is-highlighted {
  color: #3e7799;
  background: rgba(255, 250, 216, 0.78);
}

.machine__controls {
  display: grid;
  grid-template-columns: 1fr 1.35fr 1fr;
  gap: 14px;
}

.control {
  min-height: 62px;
  border: 0;
  border-radius: 19px;
  color: white;
  box-shadow: var(--button-shadow);
  cursor: pointer;
  transition:
    transform 140ms ease,
    filter 140ms ease,
    box-shadow 140ms ease;
}

.control:hover:not(:disabled) {
  filter: saturate(1.08) brightness(1.035);
  transform: translateY(-3px);
}

.control:active:not(:disabled) {
  transform: translateY(5px);
  box-shadow: 0 3px 0 rgba(48, 111, 148, 0.14);
}

.control:disabled {
  cursor: not-allowed;
  filter: saturate(0.4);
  opacity: 0.56;
  box-shadow: 0 4px 0 rgba(48, 111, 148, 0.12);
}

.control strong {
  font-size: 18px;
  font-weight: 900;
}

.control small {
  margin-left: 5px;
  font-size: 14px;
  font-weight: 800;
}

.control--shake {
  background: linear-gradient(180deg, #8dcced, #61afe0);
}

.control--draw {
  color: #8a7644;
  background: linear-gradient(180deg, #f8e9a9, var(--gold));
  box-shadow: 0 8px 0 #d5bd67, 0 14px 24px rgba(139, 116, 40, 0.15);
}

.control--refresh {
  background: linear-gradient(180deg, #70dc93, var(--green));
  box-shadow: 0 8px 0 var(--green-deep), 0 14px 24px rgba(39, 155, 81, 0.16);
}

.machine__slot {
  display: grid;
  place-items: center;
  height: 32px;
  margin-top: 21px;
}

.machine__slot span {
  display: block;
  width: 68%;
  height: 26px;
  border: 4px solid rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  background: linear-gradient(180deg, #23485e, #476b7e);
  box-shadow:
    inset 0 5px 9px rgba(19, 49, 67, 0.48),
    0 4px 8px rgba(58, 132, 173, 0.18);
}

.box-number {
  margin: 9px 0 0;
  color: rgba(58, 118, 153, 0.66);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.24em;
  text-align: center;
}

.machine.is-shaking {
  animation: machine-shake 620ms ease-in-out;
}

.cabinet-area {
  padding-bottom: 3px;
}

.cabinet {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 310px;
  overflow: hidden;
  border: 0;
  border-radius: 24px 24px 20px 20px;
  color: white;
  background:
    linear-gradient(110deg, rgba(255, 255, 255, 0.16), transparent 26%),
    linear-gradient(180deg, #62b1e1, #428fca);
  box-shadow:
    -14px 0 0 rgba(194, 231, 250, 0.47),
    0 22px 38px rgba(43, 119, 168, 0.21),
    inset 0 0 0 2px rgba(255, 255, 255, 0.15);
  cursor: pointer;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease;
}

.cabinet:hover {
  transform: translateY(-6px) rotate(-0.5deg);
  box-shadow:
    -14px 0 0 rgba(194, 231, 250, 0.55),
    0 28px 44px rgba(43, 119, 168, 0.25),
    inset 0 0 0 2px rgba(255, 255, 255, 0.2);
}

.cabinet__shine {
  position: absolute;
  top: -30%;
  left: -35%;
  width: 75%;
  height: 160%;
  transform: rotate(14deg);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
}

.cabinet__icon {
  margin-bottom: 8px;
  color: #dff5ff;
  font-size: 19px;
}

.cabinet__title {
  font-size: clamp(24px, 2vw, 30px);
  font-weight: 950;
  letter-spacing: 0.08em;
  line-height: 1.45;
  text-shadow: 0 3px 4px rgba(42, 105, 148, 0.35);
}

.cabinet__count {
  margin-top: 14px;
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  font-size: 13px;
  font-weight: 750;
}

.cabinet__hint {
  position: absolute;
  right: 0;
  bottom: 12px;
  left: 0;
  color: rgba(255, 255, 255, 0.68);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  opacity: 0;
  transition: opacity 180ms ease;
}

.cabinet:hover .cabinet__hint,
.cabinet:focus-visible .cabinet__hint {
  opacity: 1;
}

.hills {
  position: absolute;
  inset: auto 0 0;
  z-index: -1;
  height: 26%;
  pointer-events: none;
}

.hill {
  position: absolute;
  border-radius: 50% 50% 0 0 / 44% 44% 0 0;
}

.hill--back {
  right: 32%;
  bottom: -30%;
  left: -12%;
  height: 125%;
  background:
    linear-gradient(180deg, rgba(189, 243, 174, 0.94), rgba(128, 218, 137, 0.96)),
    #a7e79a;
}

.hill--front {
  right: -15%;
  bottom: -41%;
  left: 36%;
  height: 136%;
  background:
    radial-gradient(circle at 32% 4%, rgba(255, 255, 255, 0.16), transparent 28%),
    linear-gradient(180deg, #91dda0, #70cf8b);
  box-shadow: inset 0 18px 40px rgba(92, 181, 118, 0.1);
}

.land-mascot {
  position: absolute;
  z-index: 1;
  bottom: clamp(24px, 4vh, 54px);
  filter: drop-shadow(0 10px 7px rgba(42, 121, 78, 0.14));
  animation: mascot-bob 3.2s ease-in-out infinite;
}

.land-mascot--left {
  left: 16%;
  animation-delay: -0.5s;
}

.land-mascot--center {
  left: 47%;
  animation-delay: -1.6s;
}

.land-mascot--right {
  right: 16%;
  animation-delay: -2.4s;
}

.tiny-doll,
.prize-doll {
  --hood: #556173;
  --fur: #fff9ec;
  --body: #f6f1df;
  --base: #f0cf65;
  position: relative;
  width: 58px;
  height: 72px;
}

.tiny-doll--red {
  --hood: #e95058;
  --base: #efcb62;
}

.tiny-doll--lilac {
  --hood: #ad8bd2;
  --body: #ebe3f6;
  --base: #c995df;
}

.tiny-doll__ear,
.prize-doll__ear {
  position: absolute;
  z-index: 0;
  top: 5px;
  width: 21px;
  height: 24px;
  border-radius: 8px 13px 5px 12px;
  background: var(--hood);
}

.tiny-doll__ear--left,
.prize-doll__ear--left {
  left: 5px;
  transform: rotate(-29deg);
}

.tiny-doll__ear--right,
.prize-doll__ear--right {
  right: 5px;
  transform: rotate(29deg) scaleX(-1);
}

.tiny-doll__head,
.prize-doll__head {
  position: absolute;
  z-index: 2;
  top: 8px;
  left: 8px;
  width: 43px;
  height: 42px;
  border: 8px solid var(--hood);
  border-radius: 46% 46% 45% 45%;
  background:
    radial-gradient(circle at 35% 48%, #4e5962 0 1.4px, transparent 1.8px),
    radial-gradient(circle at 65% 48%, #4e5962 0 1.4px, transparent 1.8px),
    radial-gradient(ellipse at 50% 63%, #e9a4a2 0 3px, transparent 3.4px),
    var(--fur);
  box-shadow: inset 0 3px 5px rgba(255, 255, 255, 0.65);
}

.tiny-doll__body,
.prize-doll__body {
  position: absolute;
  z-index: 1;
  bottom: 10px;
  left: 15px;
  width: 30px;
  height: 29px;
  border-radius: 45% 45% 34% 34%;
  background: var(--body);
}

.tiny-doll__base,
.prize-doll__base {
  position: absolute;
  right: 7px;
  bottom: 1px;
  left: 7px;
  height: 12px;
  border-radius: 50% 50% 5px 5px;
  background: var(--base);
  box-shadow: 0 4px 5px rgba(64, 101, 64, 0.14);
}

dialog {
  max-width: none;
  max-height: none;
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
}

dialog::backdrop {
  background: rgba(39, 80, 106, 0.28);
  backdrop-filter: blur(8px);
  animation: backdrop-in 180ms ease;
}

.dialog-card {
  position: relative;
  border: 3px solid rgba(255, 255, 255, 0.78);
  border-radius: 32px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.97), rgba(229, 246, 254, 0.98));
  box-shadow: 0 32px 80px rgba(33, 94, 130, 0.34);
}

.dialog-card--result {
  width: min(410px, calc(100vw - 32px));
  padding: 30px 34px 28px;
  text-align: center;
  animation: prize-pop 440ms cubic-bezier(0.18, 0.9, 0.22, 1.22);
}

.dialog-close {
  position: absolute;
  top: 13px;
  right: 13px;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  color: #5f7d8e;
  background: rgba(133, 191, 222, 0.16);
  font-size: 25px;
  cursor: pointer;
}

.dialog-kicker {
  margin: 0 0 4px;
  color: #6baad1;
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.24em;
}

.prize-stage {
  position: relative;
  display: grid;
  place-items: center;
  height: 174px;
}

.prize-stage__halo {
  position: absolute;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(255, 241, 166, 0.85), rgba(255, 241, 166, 0.22) 54%, transparent 70%);
  animation: halo 2.2s ease-in-out infinite;
}

.prize-doll {
  width: 112px;
  height: 142px;
  filter: drop-shadow(0 16px 12px rgba(54, 118, 149, 0.18));
}

.prize-doll__ear {
  top: 12px;
  width: 40px;
  height: 45px;
  border-radius: 13px 25px 9px 22px;
}

.prize-doll__ear--left {
  left: 10px;
}

.prize-doll__ear--right {
  right: 10px;
}

.prize-doll__head {
  top: 16px;
  left: 14px;
  width: 86px;
  height: 84px;
  border-width: 14px;
  background:
    radial-gradient(circle at 34% 48%, #4e5962 0 2.6px, transparent 3.2px),
    radial-gradient(circle at 66% 48%, #4e5962 0 2.6px, transparent 3.2px),
    radial-gradient(ellipse at 50% 64%, #e9a4a2 0 5px, transparent 5.7px),
    var(--fur);
}

.prize-doll__body {
  bottom: 18px;
  left: 28px;
  width: 59px;
  height: 56px;
}

.prize-doll__base {
  right: 11px;
  bottom: 1px;
  left: 11px;
  height: 20px;
}

.dialog-card--result h2 {
  margin: -1px 0 6px;
  color: #2d5570;
  font-size: 31px;
  line-height: 1.1;
}

.result-quote {
  margin: 0;
  color: #7a93a2;
  font-size: 14px;
}

.result-value {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 20px 0;
  padding: 12px 16px;
  border-radius: 15px;
  color: #668392;
  background: rgba(128, 189, 222, 0.12);
}

.result-value strong {
  color: #3189bd;
  font-size: 21px;
}

.dialog-primary {
  width: 100%;
  min-height: 50px;
  border: 0;
  border-radius: 16px;
  color: white;
  background: linear-gradient(180deg, #68d78d, #44bf6b);
  box-shadow: 0 6px 0 #2ea356;
  font-size: 17px;
  font-weight: 850;
  cursor: pointer;
}

.dialog-card--collection {
  width: min(780px, calc(100vw - 32px));
  max-height: min(780px, calc(100svh - 32px));
  overflow: auto;
  padding: 30px;
}

.collection-header {
  text-align: center;
}

.collection-header h2 {
  margin: 4px 0 5px;
  color: #2d5570;
  font-size: 30px;
}

.collection-header > p:last-child {
  margin: 0 0 22px;
  color: #7b93a2;
  font-size: 14px;
}

.collection-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 13px;
}

.collection-card {
  position: relative;
  min-width: 0;
  padding: 16px 8px 12px;
  border: 2px solid rgba(255, 255, 255, 0.82);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.58);
  box-shadow: 0 8px 18px rgba(62, 127, 164, 0.09);
  text-align: center;
}

.collection-card.is-locked {
  color: #91a4af;
  background: rgba(183, 204, 215, 0.18);
}

.collection-card__visual {
  display: grid;
  place-items: center;
  height: 82px;
}

.collection-card .tiny-doll {
  transform: scale(0.88);
}

.collection-card.is-locked .tiny-doll {
  filter: grayscale(1);
  opacity: 0.18;
}

.collection-card strong {
  display: block;
  overflow: hidden;
  color: #456b82;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.collection-card small {
  display: block;
  margin-top: 4px;
  color: #91a4af;
  font-size: 10px;
}

.collection-card__badge {
  position: absolute;
  top: 8px;
  right: 8px;
  display: grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  border-radius: 999px;
  color: white;
  background: #59acd9;
  font-size: 10px;
  font-weight: 800;
}

.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  z-index: 20;
  padding: 11px 18px;
  border: 1px solid rgba(255, 255, 255, 0.54);
  border-radius: 999px;
  color: white;
  background: rgba(42, 87, 112, 0.84);
  box-shadow: 0 13px 30px rgba(36, 80, 106, 0.2);
  font-size: 13px;
  font-weight: 720;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 16px);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

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

.confetti-layer {
  position: fixed;
  inset: 0;
  z-index: 15;
  overflow: hidden;
  pointer-events: none;
}

.confetti {
  position: absolute;
  top: 42%;
  left: 50%;
  width: 9px;
  height: 15px;
  border-radius: 3px;
  background: var(--confetti-color);
  animation: confetti-fall 1.35s cubic-bezier(0.18, 0.7, 0.27, 1) forwards;
}

@keyframes sun-pulse {
  50% {
    box-shadow:
      0 0 46px rgba(255, 224, 96, 0.76),
      0 0 105px rgba(255, 236, 150, 0.62);
  }
}

@keyframes mascot-bob {
  50% {
    transform: translateY(-6px);
  }
}

@keyframes machine-shake {
  0%,
  100% {
    transform: rotate(0);
  }
  18% {
    transform: translateX(-8px) rotate(-1.2deg);
  }
  36% {
    transform: translateX(9px) rotate(1.4deg);
  }
  54% {
    transform: translateX(-6px) rotate(-0.8deg);
  }
  72% {
    transform: translateX(5px) rotate(0.6deg);
  }
}

@keyframes card-reveal {
  0% {
    transform: translateY(-6px) rotateY(0);
  }
  46% {
    transform: translateY(-20px) rotateY(90deg) scale(1.08);
  }
  100% {
    transform: translateY(0) rotateY(180deg);
  }
}

@keyframes prize-pop {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.84);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes halo {
  50% {
    transform: scale(1.08);
    opacity: 0.72;
  }
}

@keyframes backdrop-in {
  from {
    opacity: 0;
  }
}

@keyframes confetti-fall {
  from {
    opacity: 1;
    transform: translate(-50%, -50%) rotate(0);
  }
  to {
    opacity: 0;
    transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) rotate(var(--spin));
  }
}

@media (max-width: 1120px) {
  .stage {
    grid-template-columns: 235px minmax(450px, 510px) 145px;
    gap: 20px;
    width: 96vw;
  }

  .scoreboard__header h2 {
    font-size: 20px;
  }

  .stats {
    padding-inline: 17px;
  }

  .stats__row {
    font-size: 14px;
  }

  .stats__row dd {
    font-size: 17px;
  }

  .stats__row--net dd {
    font-size: 24px;
  }

  .cabinet {
    min-height: 280px;
  }
}

@media (min-width: 881px) and (max-height: 820px) {
  .brand {
    top: 22px;
  }

  .stage {
    margin-bottom: 17vh;
    transform: scale(0.8);
    transform-origin: center bottom;
  }
}

@media (max-width: 880px) {
  .scene {
    display: block;
    height: auto;
    min-height: 100svh;
    overflow-y: auto;
    padding: 118px 16px 120px;
  }

  .brand {
    top: 22px;
  }

  .brand h1 {
    font-size: 38px;
  }

  .brand__eyebrow {
    display: none;
  }

  .brand__tagline {
    margin-top: 7px;
    font-size: 12px;
    letter-spacing: 0.18em;
  }

  .stage {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    width: min(540px, 100%);
    margin: 0 auto;
    gap: 24px 16px;
  }

  .machine-area {
    order: 1;
    width: 100%;
  }

  .score-area {
    order: 2;
    flex: 1 1 290px;
  }

  .cabinet-area {
    order: 3;
    flex: 0 0 150px;
  }

  .cabinet {
    min-height: 100%;
  }

  .cloud--right,
  .cloud--machine {
    display: none;
  }

  .sun {
    top: 105px;
    right: -22px;
  }

  .hills {
    position: fixed;
    height: 18%;
  }

  .land-mascot {
    position: fixed;
    bottom: 18px;
    transform: scale(0.82);
  }
}

@media (max-width: 520px) {
  .scene {
    padding: 104px 12px 115px;
  }

  .brand h1 {
    font-size: 32px;
  }

  .machine {
    padding: 36px 13px 15px;
    border-radius: 34px;
  }

  .machine__handle {
    top: -22px;
    width: 118px;
    height: 39px;
  }

  .machine__screen {
    padding: 10px;
    border-radius: 25px;
  }

  .box-grid {
    gap: 8px;
  }

  .box-card {
    border-radius: 13px;
    box-shadow:
      0 5px 0 rgba(69, 139, 181, 0.23),
      0 8px 13px rgba(55, 126, 168, 0.1);
  }

  .box-card__number {
    top: 5px;
    left: 7px;
    font-size: 9px;
  }

  .machine__message {
    min-height: 52px;
    margin: 14px 0 11px;
    padding: 10px 13px;
    border-radius: 14px;
    font-size: 12px;
  }

  .machine__controls {
    gap: 8px;
  }

  .control {
    min-height: 54px;
    border-radius: 15px;
  }

  .control strong {
    font-size: 14px;
  }

  .control small {
    margin-left: 2px;
    font-size: 11px;
  }

  .machine__slot {
    height: 25px;
    margin-top: 15px;
  }

  .machine__slot span {
    height: 21px;
  }

  .score-area {
    flex-basis: 220px;
  }

  .cabinet-area {
    flex-basis: 104px;
  }

  .cabinet {
    min-height: 293px;
    border-radius: 18px;
  }

  .cabinet__title {
    font-size: 19px;
  }

  .stats__row {
    min-height: 42px;
  }

  .scoreboard__header {
    min-height: 53px;
  }

  .scoreboard__header h2 {
    font-size: 17px;
  }

  .scoreboard__sparkle {
    display: none;
  }

  .icon-button {
    width: 32px;
    height: 32px;
  }

  .collection-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dialog-card--collection {
    padding: 26px 16px 18px;
  }

  .land-mascot--left {
    left: 5%;
  }

  .land-mascot--center {
    left: 44%;
  }

  .land-mascot--right {
    right: 5%;
  }
}

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