:root {
  color-scheme: light;
  --ink: #2d1d31;
  --paper: #fff9eb;
  --cream: #ffefbf;
  --coral: #ff665d;
  --plum: #56324e;
  --muted: #694f58;
  font-family: 'PingFang SC', 'Microsoft YaHei', 'Noto Sans CJK SC', system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button { color: inherit; font: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:focus-visible { outline: 3px dashed #6a36cf; outline-offset: 5px; }
button:disabled { cursor: default; }
.shell { max-width: 1216px; padding: 0 38px 58px; margin: 0 auto; }
.topbar { display: flex; justify-content: space-between; align-items: center; min-height: 87px; }
.wordmark { display: inline-flex; align-items: center; gap: 12px; font-size: 17px; font-weight: 800; letter-spacing: .035em; }
.brand-icon {
  position: relative; width: 29px; height: 29px; border: 2px solid var(--ink); border-radius: 50%;
  background: linear-gradient(#ffd280 47%, var(--ink) 48% 54%, var(--coral) 55%);
  box-shadow: 2px 2px 0 var(--ink); transform: rotate(-28deg);
}
.brand-icon::after { content: ''; position: absolute; top: 4px; left: 5px; width: 7px; height: 4px; border-radius: 100%; background: #fff9e8; transform: rotate(-32deg); }
.sound {
  display: inline-flex; align-items: center; gap: 7px; min-height: 42px; padding: 0 14px;
  border: 1.5px solid var(--ink); border-radius: 999px; background: #fffdfa; font-size: 13px; font-weight: 700;
}
.sound[aria-pressed='true'] { background: #c8eed5; }
.sound-icon { font-size: 17px; line-height: 1; }

.hero {
  display: grid; grid-template-columns: 46% 54%; min-height: 620px; border: 2px solid var(--ink);
  border-radius: 34px; box-shadow: 7px 8px 0 var(--ink); overflow: hidden;
}
.intro { display: grid; place-items: center stretch; padding: 48px clamp(35px, 5.5vw, 80px); background: #fff0cb; }
.intro-content { width: 100%; }
.kicker {
  display: inline-flex; gap: 9px; align-items: center; padding: 7px 12px; border: 1.5px solid var(--ink);
  border-radius: 999px; background: #ffe084; font-size: 13px; font-weight: 800; white-space: nowrap;
}
.kicker > span { width: 7px; height: 7px; border: 1px solid var(--ink); border-radius: 50%; background: #fd7462; }
h1 {
  margin: 23px 0 19px; font-size: clamp(70px, 7.4vw, 110px); font-weight: 950;
  font-family: 'PingFang SC', 'Microsoft YaHei', 'Noto Sans CJK SC', sans-serif;
  line-height: 1.02; letter-spacing: -.075em;
}
h1 > span { position: relative; display: table; white-space: nowrap; color: #c73d42; }
h1 i { position: absolute; left: calc(100% + 9px); top: -.17em; font: 500 .33em/1 system-ui, sans-serif; color: #c73d42; }
.lede { max-width: 24em; margin: 0 0 29px; font-size: 17px; line-height: 1.65; color: #563b45; }
.draw {
  display: inline-flex; align-items: center; justify-content: space-between; gap: 24px;
  min-width: 203px; min-height: 62px; padding: 0 15px 0 21px; border: 2px solid var(--ink);
  border-radius: 15px; background: #ff735e; box-shadow: 4px 5px 0 var(--ink);
  font-size: 22px; font-weight: 850; transition: transform .18s, box-shadow .18s, background .18s;
}
.draw:enabled:hover { transform: translate(-2px, -2px); box-shadow: 6px 7px 0 var(--ink); background: #ff8b74; }
.draw:enabled:active { transform: translate(3px, 4px); box-shadow: 1px 1px 0 var(--ink); }
.draw:disabled { background: #efae8d; }
.button-arrow { display: grid; place-items: center; width: 31px; height: 31px; border: 1.5px solid var(--ink); border-radius: 50%; background: #fff0ca; font-size: 22px; line-height: 1; }
.pool { margin: 20px 0 0; color: var(--muted); font-size: 13px; font-weight: 650; }
.pool strong { color: var(--ink); }
.last-result { display: block; margin: 8px 0 -7px; min-height: 32px; padding: 0; border: 0; background: none; color: #71334a; font-size: 13px; font-weight: 750; text-decoration: underline; text-underline-offset: 3px; }

.playfield {
  position: relative; isolation: isolate; display: grid; place-items: center; overflow: hidden;
  min-width: 0; border-left: 2px solid var(--ink); container-type: inline-size; background-color: #d3c2fb;
  background-image: radial-gradient(#6d52a33c 1px, transparent 1px), radial-gradient(ellipse at 47% 42%, #ebddff 5%, transparent 64%);
  background-size: 17px 17px, 100% 100%;
}
.stage { position: absolute; inset: 0; pointer-events: none; }
.deco { position: absolute; display: block; line-height: 1; }
.star-a { top: 18%; left: 14%; color: #fff0a3; font-size: clamp(22px, 7cqw, 46px); text-shadow: 2px 2px var(--plum), -1px -1px var(--plum); transform: rotate(17deg); }
.star-b { top: 27%; right: 13%; color: #56324e; font-size: clamp(23px, 7cqw, 41px); }
.star-c { top: 69%; right: 13%; color: #fff1bb; font-size: clamp(23px, 6cqw, 35px); text-shadow: 2px 2px var(--plum), -1px -1px var(--plum); }
.star-d { top: 71%; left: 12%; color: #56324e; font-size: clamp(17px, 5cqw, 30px); }
.orbit { width: 14%; height: 7%; border: 1px solid #704eac65; border-radius: 50%; transform: rotate(-45deg); }
.orbit-a { left: 4%; top: 44%; }
.orbit-b { right: 3%; top: 53%; transform: rotate(52deg); }
.dot-a, .dot-b, .dot-c { width: 9px; height: 9px; border: 1.5px solid var(--plum); border-radius: 50%; }
.dot-a { left: 11%; top: 34%; background: #93dec1; }
.dot-b { right: 11%; bottom: 19%; background: #fc8ca2; }
.dot-c { right: 17%; top: 14%; background: #ffda7e; }

.machine {
  position: relative; width: clamp(247px, 60cqw, 365px); aspect-ratio: 1 / 1.36; margin-top: -14px;
  transform: rotate(-3deg); color: #38233a;
}
.machine > div { position: absolute; }
.ground { left: -5%; bottom: -2%; width: 110%; height: 11%; border-radius: 50%; background: #805ab66b; transform: rotate(3deg); }
.top-lid {
  z-index: 3; top: 2%; left: 15%; width: 68%; height: 15%; border: 3px solid currentColor;
  border-radius: 46% 46% 17% 17% / 70% 70% 25% 25%;
  background: linear-gradient(160deg, #ff9b76 2%, #ff7968 58%, #f56263 59% 80%, #c74557 81%);
  box-shadow: inset 0 4px 0 #ffc3a1, 7px 5px 0 #724264;
}
.top-lid > span { position: absolute; top: 47%; width: 4%; height: 16%; border: 1.3px solid currentColor; border-radius: 50%; background: #ffe28b; }
.top-lid > span:nth-child(1) { left: 41%; }
.top-lid > span:nth-child(2) { left: 48%; }
.top-lid > span:nth-child(3) { left: 55%; }
.globe-frame {
  z-index: 2; left: 8%; top: 12%; width: 81%; height: 49%; padding: 3%; border: 3px solid currentColor;
  border-radius: 33% 33% 24% 24% / 19% 19% 20% 20%; background: #fd766a;
  box-shadow: inset 0 0 0 3px #ffbc9e, 8px 5px 0 #754260;
}
.globe {
  position: relative; width: 100%; height: 100%; overflow: hidden; border: 2.5px solid currentColor;
  border-radius: 29% 29% 20% 20% / 18% 18% 18% 18%;
  background: radial-gradient(ellipse at 53% 27%, #eafff8, #bae9df 55%, #81bfb9 100%);
  box-shadow: inset 0 -7px 10px #42818c68;
}
.globe::before { content: ''; position: absolute; inset: 5% 4% auto; height: 45%; border-radius: inherit; border: 3px solid #fff9; border-bottom: 0; }
.glass-shine { position: absolute; top: 12%; left: 10%; width: 6%; height: 49%; border-radius: 60%; background: #fffc; transform: rotate(10deg); pointer-events: none; }
.glass-shine::after { content: ''; position: absolute; left: 150%; top: 11%; width: 55%; height: 48%; border-radius: 60%; background: #fffb; }
.capsules { position: absolute; inset: 0; }
.capsule {
  --upper: #ffeda1; --lower: #ffb84c; --turn: -25deg;
  position: absolute; width: 29%; aspect-ratio: 1; border: 2.1px solid #38233a; border-radius: 50%; rotate: var(--turn);
  background: radial-gradient(ellipse at 30% 22%, #fffdf2 0 8%, transparent 9%),
    linear-gradient(180deg, var(--upper) 0% 48%, #402840 49% 52%, var(--lower) 53% 100%);
  box-shadow: inset -4px -5px 0 #56283c25, 2px 3px 0 #59314b38;
}
.capsule::after { content: ''; position: absolute; left: 13%; right: 13%; top: 55%; height: 8%; border-radius: 50%; background: #fff5; }
.blue { --upper: #e1d5ff; --lower: #a489fa; }
.pink { --upper: #ffd9e9; --lower: #fa80ab; }
.mint { --upper: #dcffeb; --lower: #6bcca6; }
.coral { --upper: #ffe4bd; --lower: #ff8265; }
.ball-1 { left: 31%; bottom: 43%; --turn: -38deg; }
.ball-2 { left: 55%; bottom: 38%; --turn: 39deg; }
.ball-3 { left: 10%; bottom: 31%; --turn: -22deg; }
.ball-4 { left: 70%; bottom: 11%; --turn: -35deg; }
.ball-5 { left: 44%; bottom: 18%; --turn: 15deg; }
.ball-6 { left: 0; bottom: 0; --turn: 22deg; }
.ball-7 { left: 24%; bottom: -3%; --turn: 37deg; }
.ball-8 { left: 52%; bottom: -9%; --turn: -23deg; }
.ball-9 { left: 26%; bottom: 23%; --turn: -49deg; }
.machine-base {
  z-index: 4; left: 3%; top: 56%; width: 91%; height: 34%; padding: 4%; border: 3px solid currentColor;
  border-radius: 10% 10% 13% 13% / 15% 15% 16% 16%; background: linear-gradient(145deg, #ff9173, #fa625e 59%, #d74857);
  box-shadow: inset 0 4px 0 #ffb895, 8px 4px 0 #754260;
}
.machine-panel {
  position: relative; width: 100%; height: 100%; border: 2.5px solid currentColor; border-radius: 10% / 18%;
  background: linear-gradient(153deg, #ffe5ac, #ffcd92 72%); box-shadow: inset 3px 4px 0 #fff1c9;
}
.status-lamps { position: absolute; top: 13%; left: 17%; display: flex; gap: 3px; width: 27%; }
.status-lamps i { width: 17%; aspect-ratio: 1; border-radius: 50%; border: 1px solid currentColor; background: #f68983; }
.status-lamps i:nth-child(2) { background: #ffe181; }
.status-lamps i:nth-child(3) { background: #91d7ae; }
.knob {
  position: absolute; top: 28%; left: 19%; display: grid; width: 29%; aspect-ratio: 1; place-items: center;
  padding: 0; border: 2.5px solid currentColor; border-radius: 50%; background: #c84453; box-shadow: 2px 3px 0 #553447;
}
.knob-disc { display: grid; place-items: center; width: 86%; height: 86%; border: 2px solid currentColor; border-radius: 50%; background: linear-gradient(#ff9981, #f66a69); transition: rotate .25s; }
.knob-disc > span { width: 85%; height: 26%; border: 2px solid currentColor; border-radius: 999px; background: #ffc29c; box-shadow: 0 2px 0 #be475d; rotate: -36deg; }
.knob:enabled:hover .knob-disc { rotate: 30deg; }
.coin-slot { position: absolute; top: 13%; right: 14%; width: 20%; height: 13%; border: 1.5px solid currentColor; border-radius: 999px; background: #fff0c9; }
.coin-slot::after { content: ''; position: absolute; inset: 35% 17%; border-radius: inherit; background: currentColor; }
.chute {
  position: absolute; right: 10%; bottom: 13%; width: 31%; height: 47%; padding: 2%; border: 2px solid currentColor;
  border-radius: 37% 37% 16% 16%; background: #e96364; box-shadow: 2px 3px 0 #965368;
}
.chute > div { width: 100%; height: 100%; border: 1.5px solid currentColor; border-radius: inherit; background: linear-gradient(#382639 2%, #5d3650 72%, #a6576a 73%); }
.machine-foot { z-index: 1; left: 10%; bottom: 4%; width: 78%; height: 12%; border: 3px solid currentColor; border-radius: 11%; background: #b94459; box-shadow: 8px 4px 0 #754260, inset 0 -5px 0 #912e51; }
.prize { z-index: 5; display: none; right: 13%; bottom: 17%; width: 20%; aspect-ratio: 1; }
.prize .capsule { width: 100%; }
[data-state='drawing'] .machine { animation: machine-wiggle .78s ease-in-out; }
[data-state='drawing'] .knob-disc { animation: knob-turn .66s cubic-bezier(.17,.6,.34,1) both; }
[data-state='drawing'] .capsules .capsule { animation: ball-tumble .72s ease-in-out both; }
[data-state='drawing'] .capsules .capsule:nth-child(2n) { animation-delay: .07s; animation-direction: reverse; }
[data-state='drawing'] .prize { display: block; animation: prize-roll .64s .59s both; }
@keyframes machine-wiggle { 0%, 100% { transform: rotate(-3deg); } 22%, 63% { transform: rotate(-5deg); } 43%, 82% { transform: rotate(0); } }
@keyframes knob-turn { to { rotate: 360deg; } }
@keyframes ball-tumble { 0%, 100% { transform: translate(0) rotate(0); } 38% { transform: translate(15%, -45%) rotate(54deg); } 68% { transform: translate(-12%, -9%) rotate(-29deg); } }
@keyframes prize-roll {
  0% { opacity: 0; transform: translate(-14%, -28%) rotate(-60deg) scale(.46); }
  28% { opacity: 1; transform: translate(0, 11%) rotate(10deg) scale(.67); }
  72% { opacity: 1; transform: translate(15%, 118%) rotate(155deg) scale(.92); }
  100% { opacity: 1; transform: translate(55%, 115%) rotate(225deg) scale(1); }
}

.result { width: min(485px, calc(100% - 40px)); max-height: calc(100% - 30px); padding: 0 7px 8px 0; border: 0; background: transparent; color: var(--ink); }
.result::backdrop { background: #30213d91; backdrop-filter: blur(4px); }
.result[open] { animation: ticket-pop .37s cubic-bezier(.18,.76,.29,1.16) both; }
.ticket { position: relative; overflow: hidden; border: 2px solid var(--ink); border-radius: 23px; background: #fff6da; box-shadow: 5px 6px 0 var(--ink); }
.ticket-top { display: flex; align-items: center; justify-content: space-between; min-height: 66px; padding: 9px 16px 9px 22px; border-bottom: 2px dashed #63455d; background: #ffe18d; font-size: 17px; font-weight: 850; }
.ticket-top b { margin-right: 4px; color: #b12e40; }
.close { width: 42px; height: 42px; border: 1.5px solid var(--ink); border-radius: 50%; background: #fff5d8; font-size: 26px; line-height: 1; }
.ticket-body { padding: 26px 23px 24px; }
.ticket h2 { margin: 0; font-size: clamp(23px, 5vw, 33px); line-height: 1.47; overflow-wrap: anywhere; }
.ticket-actions { display: flex; flex-wrap: wrap; gap: 10px; padding: 0 21px 23px; }
.ticket-actions button { min-height: 47px; padding: 0 13px; border: 1.5px solid var(--ink); border-radius: 11px; font-size: 15px; font-weight: 800; }
.ticket-actions button span { margin-left: 4px; }
.accept { background: #9fe2bd; }
.again { background: #fffdf2; }
.ticket-actions button:hover, .close:hover { box-shadow: 2px 2px 0 var(--ink); }
.confetti { position: absolute; z-index: 2; inset: 8% 10% auto; height: 35px; pointer-events: none; }
.confetti i { position: absolute; left: var(--x); opacity: 0; width: 7px; height: 10px; border-radius: 2px; background: var(--color); }
.result[open] .confetti i { animation: confetti .69s .08s both; }
.confetti i:nth-child(1) { --x: 4%; --color: #a675ed; --drift: -24px; }
.confetti i:nth-child(2) { --x: 15%; --color: #f76770; --drift: 12px; }
.confetti i:nth-child(3) { --x: 23%; --color: #5dbb9a; --drift: -20px; }
.confetti i:nth-child(4) { --x: 74%; --color: #f76770; --drift: -4px; }
.confetti i:nth-child(5) { --x: 81%; --color: #a675ed; --drift: 22px; }
.confetti i:nth-child(6) { --x: 93%; --color: #5dbb9a; --drift: 13px; }
@keyframes ticket-pop { from { opacity: 0; transform: translateY(18px) scale(.93) rotate(-3deg); } }
@keyframes confetti { 5% { opacity: 0; transform: translateY(10px); } 30% { opacity: 1; transform: translate(var(--drift), -14px) rotate(100deg); } 73% { opacity: 1; } 100% { opacity: 0; transform: translate(var(--drift), 96px) rotate(240deg); } }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (max-width: 1000px) and (min-width: 701px) {
  .intro { padding-inline: 36px; }
  h1 { font-size: clamp(65px, 9vw, 89px); }
  .hero { min-height: 530px; }
}
@media (max-width: 700px) {
  .shell { padding: 0 18px 28px; }
  .topbar { min-height: 66px; }
  .wordmark { gap: 9px; font-size: 15px; }
  .brand-icon { width: 24px; height: 24px; }
  .sound { min-height: 39px; padding-inline: 10px; }
  .hero { grid-template-columns: 1fr; min-height: auto; border-radius: 25px; box-shadow: 4px 5px 0 var(--ink); }
  .intro { padding: 25px 23px 23px; }
  .kicker { padding: 4px 9px; font-size: 12px; }
  h1 { font-size: clamp(35px, 11vw, 65px); margin: 12px 0 8px; letter-spacing: -.09em; }
  h1 > span { display: inline; }
  h1 i { left: calc(100% + 8px); top: -.02em; }
  .lede { font-size: 14px; margin: 0 0 14px; }
  .draw { min-width: 158px; min-height: 48px; border-radius: 12px; padding: 0 10px 0 14px; font-size: 17px; }
  .button-arrow { width: 25px; height: 25px; font-size: 17px; }
  .pool { margin-top: 12px; font-size: 12px; }
  .playfield { min-height: 340px; border-left: 0; border-top: 2px solid var(--ink); }
  .machine { width: clamp(205px, 58cqw, 238px); margin-top: -8px; }
}
@media (min-width: 440px) and (max-width: 700px) { .playfield { min-height: 375px; } }
@media (max-width: 340px) { .shell { padding-inline: 12px; } .intro { padding-inline: 18px; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0ms !important; transition-duration: .01ms !important; }
  [data-state='drawing'] .prize { display: none; }
}
