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

:root {
  --lemon: #f5c518;
  --amber: #e07a3d;
  --teal: #1f7a72;
  --teal-deep: #18635c;
  --ink: #1c2b24;
  --paper: #fffdf6;
  --rose: #e85a71;
  --sky: #ffe98a;
}

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

body {
  color: var(--ink);
  font-family: Nunito, "Trebuchet MS", sans-serif;
  background-color: var(--lemon);
  background-image: linear-gradient(180deg, #fff6cf 0%, var(--lemon) 46%, #f0b429 100%);
}

[hidden] {
  display: none !important;
}

button,
input {
  font: inherit;
}

.stall {
  width: min(1120px, calc(100% - 28px));
  margin: 0 auto;
  padding: 22px 0 32px;
}

.top {
  position: sticky;
  top: 0;
  z-index: 4;
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) auto auto minmax(180px, 240px) auto;
  gap: 12px 18px;
  align-items: end;
  margin-bottom: 14px;
  padding: 10px 0 8px;
  background: #fff3c4;
}

.eyebrow {
  margin: 0 0 4px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--teal-deep);
}

h1,
h2,
.ticket-for,
.scorebox strong {
  font-family: Fraunces, Palatino, "Iowan Old Style", serif;
  font-weight: 560;
  letter-spacing: -0.03em;
}

h1 {
  margin: 0;
  font-size: clamp(2.4rem, 5vw, 3.6rem);
  line-height: 0.9;
}

h1 em {
  font-style: italic;
  font-weight: 560;
}

.card em,
.ticket-for em {
  font-style: italic;
  font-weight: 560;
  color: var(--amber);
}

h2 {
  margin: 0 0 8px;
  font-size: clamp(1.7rem, 3vw, 2.35rem);
  line-height: 1.02;
}

.scorebox strong {
  display: block;
  font-size: 2.5rem;
  line-height: 0.9;
  font-variant-numeric: tabular-nums;
}

.scorebox strong.bump {
  animation: bump 0.28s ease;
}

.label {
  display: block;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--teal-deep);
}

.next {
  width: min(240px, 100%);
}

.next-row {
  display: flex;
  justify-content: flex-start;
  gap: 8px;
  align-items: baseline;
}

.next-row strong {
  font-size: 0.92rem;
}

.rail {
  margin-top: 6px;
  height: 8px;
  border-radius: 99px;
  background: rgba(28, 43, 36, 0.16);
  overflow: hidden;
}

.rail span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--amber));
}

.hearts {
  display: flex;
  gap: 4px;
  min-height: 28px;
}

.heart {
  width: 26px;
  height: 26px;
  display: block;
}

.heart.empty {
  opacity: 0.28;
}

.controls {
  display: flex;
  gap: 8px;
}

.btn {
  min-height: 46px;
  padding: 0.65rem 1.2rem;
  border-radius: 999px;
  font-weight: 800;
  letter-spacing: 0.01em;
  cursor: pointer;
}

.btn-play {
  border: 2px solid var(--teal);
  background: var(--teal);
  color: var(--paper);
}

.btn-pause {
  border: 2px solid var(--ink);
  background: transparent;
  color: var(--ink);
}

.btn:disabled {
  cursor: default;
  opacity: 0.38;
}

.btn:focus-visible {
  outline: 3px solid var(--rose);
  outline-offset: 3px;
}

.btn-play:hover:not(:disabled) {
  background: var(--teal-deep);
}

.btn-pause:hover:not(:disabled) {
  background: rgba(255, 253, 246, 0.45);
}

.playrow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 236px;
  gap: 16px;
  align-items: start;
}

.marquee {
  min-width: 0;
}

.awning {
  display: flex;
  height: 16px;
  overflow: hidden;
  border: 4px solid var(--ink);
  border-bottom: 0;
  border-radius: 16px 16px 0 0;
  background: var(--lemon);
}

.awning span {
  flex: 1;
}

.awning span:nth-child(odd) {
  background: var(--lemon);
}

.awning span:nth-child(even) {
  background: var(--amber);
}

.stage {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 4px solid var(--ink);
  border-radius: 0 0 18px 18px;
  background: var(--sky);
  box-shadow: 0 18px 40px rgba(28, 43, 36, 0.16);
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 12px;
  overflow: auto;
  background: rgba(28, 43, 36, 0.34);
}

.overlay-start {
  align-items: flex-start;
  justify-content: flex-start;
  background: linear-gradient(180deg, rgba(28, 43, 36, 0.28), transparent 62%);
}

.card {
  width: min(420px, 100%);
  padding: 14px 16px 14px;
  border-radius: 18px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 16px 40px rgba(28, 43, 36, 0.2);
}

.card h2 {
  font-size: clamp(1.45rem, 3vw, 2.05rem);
}

.card .eyebrow {
  color: var(--teal);
}

.lede {
  margin: 0 0 14px;
  font-size: 1.02rem;
  line-height: 1.4;
  font-weight: 600;
}

.prize {
  width: 56px;
  height: 56px;
  margin-bottom: 4px;
}

.prize svg {
  display: block;
  width: 56px;
  height: 56px;
}

.card-win {
  background:
    radial-gradient(circle at 100% 0%, rgba(232, 90, 113, 0.2), transparent 42%),
    radial-gradient(circle at 0% 100%, rgba(245, 197, 24, 0.45), transparent 40%),
    var(--paper);
}

.filled {
  margin: -4px 0 14px;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--teal);
}

.ticket {
  padding: 14px 14px 12px 18px;
  border-radius: 14px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 14px 30px rgba(28, 43, 36, 0.14);
  -webkit-mask-image: radial-gradient(circle at 0 11px, transparent 5px, #000 5.5px);
  -webkit-mask-size: 100% 22px;
  -webkit-mask-repeat: repeat-y;
  mask-image: radial-gradient(circle at 0 11px, transparent 5px, #000 5.5px);
  mask-size: 100% 22px;
  mask-repeat: repeat-y;
}

.ticket-head {
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px dashed rgba(28, 43, 36, 0.35);
}

.ticket-for {
  margin: 0;
  font-size: 1.45rem;
  line-height: 1;
}

.stamps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.stamps li {
  display: flex;
  gap: 8px;
  align-items: center;
}

.seal {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: 50%;
  font-size: 0.78rem;
  font-weight: 800;
  transition: transform 0.25s ease, background 0.25s ease, color 0.25s ease;
}

.seal .ok {
  display: none;
}

.stamps li.earned .seal {
  background: var(--rose);
  border-color: var(--rose);
  color: var(--paper);
  transform: rotate(-12deg);
}

.stamps li.earned .n {
  display: none;
}

.stamps li.earned .ok {
  display: inline;
}

.stamp-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.stamp-copy b {
  font-size: 0.92rem;
  line-height: 1.15;
}

.stamp-copy small {
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--teal);
}

.help {
  margin: 12px 4px 0;
  max-width: 68ch;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.4;
}

.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;
}

@media (max-width: 980px) {
  .top {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "brand controls"
      "score hearts"
      "next next";
  }

  .brand { grid-area: brand; }
  .controls { grid-area: controls; align-self: center; }
  .scorebox { grid-area: score; }
  .hearts { grid-area: hearts; justify-self: end; align-self: end; }
  .next { grid-area: next; width: 100%; }
}

@media (max-width: 860px) {
  .playrow {
    grid-template-columns: 1fr;
  }

  .stamps {
    grid-template-columns: 1fr 1fr;
  }

  .ticket {
    -webkit-mask-image: none;
    mask-image: none;
  }
}

@media (max-width: 560px) {
  .stall {
    width: min(100% - 16px, 1120px);
    padding-top: 14px;
  }

  .stamps {
    grid-template-columns: 1fr;
  }

  .controls {
    width: 100%;
  }

  .controls .btn {
    flex: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .seal,
  .scorebox strong.bump {
    transition: none;
    animation: none;
  }
}

@keyframes bump {
  0% { transform: scale(1); }
  40% { transform: scale(1.08); }
  100% { transform: scale(1); }
}
