@font-face {
  font-family: Fortune;
  src: url("assets/fortune-lettering.woff2") format("woff2");
  font-display: swap;
}
@font-face {
  font-family: Barlow;
  src: url("assets/barlow-condensed-900-latin.woff2") format("woff2");
  font-weight: 900;
  font-display: swap;
}
:root {
  --ink: #36251e;
  --red: #c93929;
  --cream: #fff3d8;
  --yellow: #ffcb55;
  font-family: system-ui, "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  color: var(--ink);
  background: var(--cream);
}
* { box-sizing: border-box; }
body {
  min-height: 100svh;
  margin: 0;
  display: flex;
  flex-direction: column;
  background-image: radial-gradient(#ad854f28 .65px, transparent .85px);
  background-size: 5px 5px;
}
h1, h2, h3, p { margin: 0; }
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: .25em; }
button { font: inherit; cursor: pointer; }
button:disabled { cursor: wait; }
:focus-visible { outline: 3px solid #155c87; outline-offset: 5px; }
.wrapper { width: min(1100px, calc(100% - 9vw)); margin-inline: auto; }
.masthead { border-top: 7px solid var(--red); }
.topbar {
  min-height: 78px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid var(--ink);
}
.brand {
  display: inline-block;
  font: italic bold 2.55rem/.95 Georgia, "Times New Roman", serif;
  letter-spacing: -.095em;
  color: var(--red);
  padding-right: .12em;
}
.brand span { font-size: .8em; }
.brand:hover { text-decoration: none; }
.official, .footer-inner a {
  display: inline-flex;
  gap: .65em;
  align-items: center;
  min-height: 44px;
  font-weight: 750;
  font-size: .875rem;
}
.external {
  width: .82em;
  height: .82em;
  border: 1.6px solid;
  border-radius: 1px;
  position: relative;
  margin-right: 2px;
}
.external::after {
  content: "↗";
  position: absolute;
  right: -.31em;
  top: -.42em;
  background: var(--cream);
  font: 900 1em/1 Arial,sans-serif;
}
.stage {
  flex: 1;
  display: grid;
  grid-template-columns: .92fr 1.08fr;
  grid-template-rows: auto auto;
  align-content: center;
  column-gap: 3%;
  padding: clamp(44px, 7vh, 84px) 2.5%;
}
.intro { grid-column: 1; align-self: end; }
.kicker {
  display: flex;
  align-items: center;
  gap: .55em;
  color: #814638;
  font: 900 1.02rem/1 Barlow, sans-serif;
  letter-spacing: .15em;
}
.kicker span { color: var(--red); font-size: 1.08em; }
h1 {
  width: fit-content;
  padding: .08em .12em .15em 0;
  transform: rotate(-5deg);
  font: 400 clamp(74px, 7.7vw, 112px)/.93 Fortune, sans-serif;
  letter-spacing: -.07em;
}
h1 span { display: block; }
h1 span:first-child { color: var(--ink); }
h1 span:last-child { color: var(--red); margin-left: .65em; text-shadow: 1.5px 2.5px var(--cream), 3px 5px var(--ink); }
.lead { font-weight: 900; font-size: clamp(1.3rem, 2.1vw, 1.8rem); margin: 1.05em 0 .42em; letter-spacing: -.035em; }
.explanation { line-height: 1.95; font-weight: 500; font-size: 1rem; }
.controls { grid-column: 1; align-self: start; padding-top: 1.55rem; }
.draw, .again {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 1em;
  min-height: 58px;
  padding: .68em 1.8em;
  background: var(--red);
  color: #fff7e4;
  border: 2.5px solid var(--ink);
  border-radius: 12px;
  box-shadow: 3px 5px 0 var(--ink);
  font-weight: 850;
  font-size: 1.12rem;
  letter-spacing: .035em;
}
.draw:not(:disabled):hover, .again:hover { background: #b52d21; }
.draw:active, .again:active { transform: translate(2px,3px); box-shadow: 1px 2px 0 var(--ink); }
.ticket-icon {
  display: inline-grid;
  place-items: center;
  width: 1.42em;
  height: .98em;
  color: var(--ink);
  background: var(--yellow);
  border: 1px solid var(--ink);
  outline: 1px solid var(--yellow);
  font: 900 1em/1 Arial,sans-serif;
  transform: rotate(-13deg);
}
.display {
  grid-column: 2;
  grid-row: 1 / 3;
  align-self: center;
  display: grid;
  place-items: center;
  position: relative;
  isolation: isolate;
  min-height: 470px;
}
.halo {
  position: absolute;
  z-index: -1;
  width: min(105%, 530px);
  aspect-ratio: 1.05;
  border-radius: 50%;
  transform: rotate(-14deg);
  background-color: #f7cd75;
  background-image: radial-gradient(#d695495c 1px, transparent 1.2px);
  background-size: 6px 6px;
}
.spark {
  position: absolute;
  z-index: 1;
  background: var(--ink);
  clip-path: polygon(50% 0,62% 37%,100% 50%,62% 63%,50% 100%,38% 63%,0 50%,38% 37%);
  pointer-events: none;
}
.spark-a { width: 37px; height: 50px; left: 2%; top: 10%; transform: rotate(8deg); }
.spark-b { width: 24px; height: 34px; right: 0; bottom: 7%; transform: rotate(18deg); }
.vendor {
  position: relative;
  width: min(77%, 378px);
  min-width: 295px;
  container-type: inline-size;
  transform: rotate(3deg);
}
.machine {
  position: relative;
  border: 1.05cqw solid var(--ink);
  border-radius: 6.5cqw 6.5cqw 4.5cqw 4.5cqw;
  padding: 3.7cqw 3.8cqw 3.1cqw;
  background: #d84a37;
  box-shadow: inset .8cqw .8cqw 0 #f88769, inset -1.1cqw -1.1cqw 0 #a52c26, 2.4cqw 2.4cqw 0 #80362b, 3.2cqw 3.2cqw 0 var(--ink);
}
.machine::before, .machine::after {
  content: "";
  position: absolute;
  bottom: -5.6cqw;
  width: 9cqw;
  height: 4.3cqw;
  border: .8cqw solid var(--ink);
  border-radius: 0 0 1.6cqw 1.6cqw;
  background: #65493e;
  z-index: -1;
}
.machine::before { left: 8cqw; }
.machine::after { right: 5.7cqw; }
.marquee {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3cqw;
  background: #fff0c0;
  color: var(--red);
  border: .8cqw solid var(--ink);
  border-radius: 2.9cqw;
  box-shadow: inset 0 -.75cqw #d1a875;
  padding: 1.8cqw 2cqw 2.6cqw;
}
.marquee b {
  font: italic 900 15.2cqw/.97 Barlow, Impact, sans-serif;
  letter-spacing: -.035em;
  text-shadow: .45cqw .55cqw var(--ink);
}
.speed-lines { width: 9cqw; height: 3.4cqw; border-block: .65cqw solid var(--red); position: relative; }
.speed-lines::after { content:""; position:absolute; top:50%; width:100%; height:.55cqw; background:var(--red); transform:translateY(-50%); }
.window {
  position: relative;
  overflow: hidden;
  margin-block: 3cqw 2.8cqw;
  padding: 2.2cqw 1.6cqw 1.9cqw;
  border: 1cqw solid var(--ink);
  border-radius: 2.7cqw;
  background: repeating-linear-gradient(116deg,transparent 0 14%,#fff7 14% 17%,transparent 17% 19%,#fff5 19% 24%,transparent 24% 62%), linear-gradient(#98c5bf,#d3e3cd);
  box-shadow: inset .8cqw 1cqw 0 #5f827b,inset -.7cqw -.4cqw 0 #688e84;
}
.shelf {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2.5cqw;
  padding: 2.2cqw 1.2cqw 1.15cqw;
  border-bottom: 1cqw solid var(--ink);
  background: linear-gradient(to top, #ead7a8 0 4.3cqw, #665047 4.3cqw 5cqw, #f7eaca 5cqw 6.3cqw, transparent 6.3cqw);
}
.shelf + .shelf { margin-top: 1.5cqw; }
.shelf > div { display: grid; justify-items: center; gap: .5cqw; }
.shelf img {
  display: block;
  width: 100%;
  height: 18.6cqw;
  object-fit: contain;
  filter: drop-shadow(.2cqw .8cqw .35cqw #3e2a2455);
}
.shelf span {
  min-width: 82%;
  display: block;
  padding: .28cqw .5cqw;
  border: .38cqw solid #715b44;
  border-radius: .55cqw;
  background: var(--label);
  color: #36251e;
  font: 900 3cqw/1 Barlow, sans-serif;
  text-align: center;
  letter-spacing: .035em;
}
.dashboard { display: flex; align-items: center; gap: 3.3cqw; }
.output-slot {
  width: 49%;
  height: 11cqw;
  display: grid;
  place-items: start center;
  overflow: hidden;
  border: 1cqw solid var(--ink);
  border-radius: 1.6cqw;
  background: #604037;
  box-shadow: inset 0 2cqw 0 #3b2925,0 .55cqw 0 #fb8769;
}
.output-slot span {
  display: grid;
  place-items: center;
  width: 45%;
  height: 7cqw;
  color: var(--red);
  background: #ffdd84;
  border: .45cqw solid var(--ink);
  border-top: 0;
  transform: rotate(-5deg) translateY(-.9cqw);
  font: 900 5cqw/1 sans-serif;
}
.vents { flex: 1; height: 3.2cqw; border-block: .65cqw solid #792d26; }
.push {
  width: max(13cqw,44px);
  height: max(13cqw,44px);
  border: .85cqw solid var(--ink);
  border-radius: 50%;
  box-shadow: .8cqw .9cqw 0 #472b24,inset 0 0 0 .7cqw #fff2a1;
  background: var(--yellow);
  color: var(--ink);
  font: 900 max(3.5cqw,12px)/1 Barlow, sans-serif;
}
.push:hover { background: #ffdf77; }
.push:active { transform: translate(.4cqw,.6cqw); box-shadow: .2cqw .3cqw 0 var(--ink); }
.checker {
  height: 17px;
  background: repeating-conic-gradient(var(--red) 0 25%, var(--cream) 0 50%) 0 0 / 28px 28px;
  border-block: 1px solid var(--red);
}
.footer-inner { min-height: 62px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0 15px; }
.footer-inner a:first-child { font: 900 .9rem/1 Barlow, sans-serif; letter-spacing: .12em; }
dialog {
  inset: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  width: min(88vw, 392px);
  max-height: calc(100dvh - 32px);
  padding: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  border-radius: 14px;
  box-shadow: 6px 9px 0 #36251ea8;
}
dialog::backdrop { background: #291c19ab; }
body:has(dialog[open]) { overflow: hidden; }
.fortune-ticket { background: #fff8e5; border: 3px solid var(--ink); border-radius: 14px; overflow: hidden; }
.stub {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 5px 0 22px;
  min-height: 46px;
  background: var(--red);
  color: #fff7e4;
  border-bottom: 2px dashed var(--ink);
  font: 900 1.13rem/1 Barlow, sans-serif;
  letter-spacing: .1em;
}
.stub button { background: transparent; color: inherit; font: 400 28px/1 sans-serif; border: none; width: 44px; height: 44px; }
.stub button:focus-visible { outline-offset: -4px; outline-color: white; }
.ticket-body { text-align: center; padding: 23px clamp(18px,5vw,32px) 0; }
.ticket-number { font-size: .9rem; font-weight: bold; }
.ticket-number span { margin-left: .5em; }
#rank { margin: .14em 0 .25em; font: 900 clamp(58px,12vw,82px)/1.18 system-ui, sans-serif; color: var(--red); text-shadow: 1.5px 2px #ffe5a9, 3px 3.5px var(--ink); }
#rank:focus { outline: none; }
#fortune-title { font-size: 1.25rem; }
#fortune-message { line-height: 1.85; text-align: start; margin: .7em auto 1.1em; }
.flavor-line { border-block: 1px dashed #8a6b53; padding: .8em .2em; background: #fff0c4; }
.flavor-line span, .flavor-line strong { display: block; }
.flavor-line span { font-size: .875rem; font-weight: 650; }
.flavor-line strong { font-size: 1.17rem; margin-top: .18em; }
.ticket-foot { padding: 17px 0 23px; text-align: center; }
.again { min-height: 44px; font-size: 1rem; padding: .55em 1.65em; }
@media (max-width: 760px) {
  .wrapper { width: min(92%, 560px); }
  .topbar { min-height: 58px; }
  .brand { font-size: 2.05rem; }
  .stage { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 27px 0 30px; }
  .intro, .controls { align-self: center; text-align: center; }
  .kicker { justify-content: center; font-size: .88rem; }
  h1 { display: flex; margin: .12em auto .17em; font-size: clamp(48px,14.2vw,74px); line-height: 1; padding: .04em .16em .16em 0; transform: rotate(-4deg); }
  h1 span:last-child { margin: 0; text-shadow: 1px 1.5px var(--cream), 2px 3px var(--ink); }
  .lead { font-size: 1.12rem; margin: 0 0 .3em; }
  .explanation { font-size: 1rem; line-height: 1.65; text-wrap: pretty; }
  .display { order: 1; width: 100%; min-height: 0; padding: 19px 0 20px; }
  .halo { width: min(88%, 330px); height: 88%; }
  .vendor { width: clamp(211px, 56vw, 286px); min-width: 0; }
  .spark-a { width: 20px; height: 28px; left: 11%; top: 18%; }
  .spark-b { width: 15px; height: 22px; right: 10%; bottom: 17%; }
  .controls { order: 2; padding-top: 4px; }
  .draw { min-height: 51px; }
  .checker { height: 12px; background-size: 21px 21px; }
  .footer-inner { min-height: 50px; }
  .footer-inner a { font-size: .78rem; }
}
@media (max-width: 410px) {
  .explanation { max-width: 21em; }
  .footer-inner { justify-content: center; column-gap: 18px; }
}
