[hidden] {
  display: none !important;
}

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

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
}

body {
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  color: var(--ak-ink);
  font-family: var(--ak-font-body);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
  background-color: var(--ak-bg);
  background-image: var(--ak-bg-art);
  background-size: var(--ak-bg-size);
}

button {
  font-family: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

button:focus-visible,
.card:focus-visible {
  outline: 3px solid var(--ak-focus);
  outline-offset: 2px;
}

.play {
  --stamp-ms: 460ms;
  --peel-ms: 420ms;
  --tick-ms: 280ms;
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(480px, 100%);
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  touch-action: manipulation;
  padding:
    max(8px, env(safe-area-inset-top, 0px))
    max(8px, env(safe-area-inset-right, 0px))
    max(8px, env(safe-area-inset-bottom, 0px))
    max(8px, env(safe-area-inset-left, 0px));
  background-color: transparent;
  background-image: var(--ak-backdrop-layer);
  background-size: cover;
  background-position: center;
  gap: 6px;
}

.play::before {
  content: "";
  position: absolute;
  z-index: 0;
  left: 0;
  right: 0;
  top: 0;
  height: 34%;
  pointer-events: none;
  background: linear-gradient(
    118deg,
    color-mix(in srgb, var(--ak-ink) 28%, transparent) 0%,
    transparent 62%
  );
}

.play > * {
  position: relative;
  z-index: 1;
}

.top {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding-right: 52px;
}

.play-logo {
  height: 44px;
  width: auto;
  max-width: 46%;
  object-fit: contain;
  flex: 0 1 auto;
  filter: drop-shadow(0 2px 0 var(--ak-outline));
}

.turn {
  flex: 1 1 auto;
  min-width: 0;
  padding: 4px 8px;
  border: 2px solid var(--ak-outline);
  border-radius: var(--ak-radius);
  background: var(--ak-surface);
  box-shadow: var(--ak-shadow);
}

.turn-who,
.turn-sub,
.voice,
.why,
.result-says,
.kicker {
  margin: 0;
}

.turn-who {
  font-family: var(--ak-font-display);
  font-weight: var(--ak-title-weight);
  font-size: 20px;
  line-height: 1.05;
}

.turn-sub {
  color: var(--ak-ink-muted);
  font-size: 13px;
}

.prompt {
  display: flex;
  align-items: stretch;
  gap: 6px;
  min-height: 48px;
}

.voice,
.why {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  padding: 8px 10px;
  border: 2px solid var(--ak-outline);
  border-radius: var(--ak-radius);
  background: var(--ak-surface);
  box-shadow: var(--ak-shadow);
  font-size: 15px;
  line-height: 1.25;
}

.voice.is-invite {
  border-color: var(--ak-accent);
  font-family: var(--ak-font-display);
  font-weight: var(--ak-title-weight);
  font-size: 18px;
}

.voice.is-bad,
.why.is-bad {
  border-color: var(--ak-accent-2);
}

.why.is-good {
  border-color: var(--ak-accent);
}

.hint,
.check,
.btn,
.mute {
  border: 2px solid var(--ak-outline);
  border-radius: var(--ak-radius);
  box-shadow: var(--ak-shadow);
  min-height: 48px;
  min-width: 48px;
}

.hint {
  flex: 0 0 auto;
  padding: 0 12px;
  background: var(--ak-choice-bg);
  color: var(--ak-choice-ink);
  font-family: var(--ak-font-display);
  font-weight: var(--ak-title-weight);
  font-size: 16px;
}

.stage {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(96px, 30%) minmax(0, 1fr);
  gap: 6px;
}

.rail {
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  gap: 4px;
}

.tally {
  position: relative;
  width: 100%;
  aspect-ratio: 290 / 384;
  flex: 0 1 auto;
  max-height: 62%;
  filter: drop-shadow(2px 3px 0 var(--ak-outline));
}

.tally img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
  pointer-events: none;
  user-select: none;
}

.win {
  position: absolute;
  left: 18%;
  right: 18%;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.win-money {
  top: 27%;
  height: 23%;
}

.win-minutes {
  top: 55%;
  height: 23%;
}

.win-read {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 100%;
  padding: 1px 2px;
  border: 2px solid var(--ak-outline);
  border-radius: var(--ak-radius);
  background: color-mix(in srgb, var(--ak-surface) 92%, transparent);
  box-shadow: var(--ak-shadow);
}

.kicker {
  font-size: 8px;
  letter-spacing: 0.02em;
  line-height: 1;
  color: var(--ak-ink-muted);
  text-align: center;
}

.digits {
  display: flex;
  justify-content: center;
  min-height: 1em;
  font-family: var(--ak-font-display);
  font-weight: var(--ak-title-weight);
  font-size: clamp(12px, 3.6vw, 16px);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  color: var(--ak-ink);
}

.digit {
  display: inline-block;
}

.win.is-zero .win-read {
  background: var(--ak-accent);
  color: var(--ak-btn-ink);
}

.win.is-zero .kicker,
.win.is-zero .digits {
  color: var(--ak-btn-ink);
}

.win.is-hot .win-read,
.win.is-wrong .win-read {
  background: var(--ak-accent-2);
}

.win.is-hot .kicker,
.win.is-hot .digits,
.win.is-wrong .kicker,
.win.is-wrong .digits {
  color: var(--ak-ink);
}

.needle {
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
  pointer-events: none;
}

.needle-spin {
  display: block;
  width: 100%;
  height: 100%;
}

.fan {
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-auto-rows: minmax(48px, 1fr);
  gap: 6px;
  align-content: stretch;
}

.card {
  --tilt: -2.5deg;
  --lift: 0px;
  position: relative;
  width: 100%;
  height: 100%;
  min-width: 48px;
  min-height: 48px;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--ak-ink);
  overflow: hidden;
  container-type: inline-size;
  transform: translateY(var(--lift)) rotate(var(--tilt));
  filter: drop-shadow(2px 3px 0 var(--ak-outline));
}

.card:nth-child(4n + 1) { --tilt: -3deg; --lift: 2px; }
.card:nth-child(4n + 2) { --tilt: 2.4deg; --lift: 0px; }
.card:nth-child(4n + 3) { --tilt: 3deg; --lift: 3px; }
.card:nth-child(4n + 4) { --tilt: -2deg; --lift: 0px; }

.card.is-on {
  --tilt: 0deg;
  --lift: 0px;
  filter: none;
  box-shadow: inset 0 0 0 3px var(--ak-accent-2);
}

.card.is-coach {
  box-shadow: inset 0 0 0 3px var(--ak-accent-2), 0 0 0 2px var(--ak-glow);
}

.card img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  pointer-events: none;
  user-select: none;
}

.plate {
  position: absolute;
  z-index: 1;
  left: 8%;
  right: 8%;
  top: 30%;
  bottom: 12%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
  padding: 2px 4px;
  border: 2px solid var(--ak-outline);
  border-radius: var(--ak-radius);
  background: var(--ak-surface);
  box-shadow: var(--ak-shadow);
  pointer-events: none;
}

.card.is-do .plate { top: 34%; bottom: 14%; }
.card.is-meal .plate { top: 42%; bottom: 10%; left: 12%; right: 12%; }
.card.is-way .plate { top: 26%; bottom: 16%; }

.kind {
  font-size: 9px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ak-ink-muted);
  line-height: 1;
}

.name {
  font-size: clamp(11px, 13cqi, 15px);
  line-height: 1.05;
}

.figs {
  display: flex;
  justify-content: space-between;
  gap: 4px;
}

.price,
.mins {
  font-family: var(--ak-font-display);
  font-weight: var(--ak-title-weight);
  font-size: clamp(12px, 16cqi, 18px);
  line-height: 1;
}

.card.is-do .price,
.card.is-do .mins,
.card.is-meal .price,
.card.is-meal .mins {
  color: var(--ak-accent-2);
}

.card.is-way .price,
.card.is-way .mins {
  color: var(--ak-accent);
}

.added,
.tap-tag {
  display: none;
  position: absolute;
  z-index: 2;
  top: 5%;
  left: 50%;
  transform: translateX(-50%);
  padding: 2px 6px;
  border: 2px solid var(--ak-outline);
  border-radius: var(--ak-radius);
  font-family: var(--ak-font-display);
  font-size: 11px;
  line-height: 1.1;
  pointer-events: none;
}

.added {
  background: var(--ak-accent);
  color: var(--ak-btn-ink);
}

.tap-tag {
  background: var(--ak-accent-2);
  color: var(--ak-ink);
  font-family: var(--ak-font-body);
  font-size: 13px;
  font-weight: 800;
}

.card.is-on .added,
.card.is-coach .tap-tag {
  display: block;
}

.dock {
  flex: 0 0 auto;
}

.check {
  width: 100%;
  padding: 8px 12px;
  background: var(--ak-btn-fill);
  color: var(--ak-btn-ink);
  font-family: var(--ak-font-display);
  font-weight: var(--ak-title-weight);
  font-size: 18px;
}

.check:disabled {
  opacity: 0.7;
}

.check.is-ready {
  background: var(--ak-accent-2);
  color: var(--ak-ink);
}

.result-card {
  padding: 8px;
  border: 2px solid var(--ak-accent-2);
  border-radius: var(--ak-radius);
  background: var(--ak-surface);
  box-shadow: var(--ak-shadow), 0 0 0 3px var(--ak-glow);
}

.result-says {
  font-family: var(--ak-font-display);
  font-weight: var(--ak-title-weight);
  font-size: 18px;
  line-height: 1.2;
}

.result-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.btn {
  flex: 1 1 0;
  padding: 8px;
  font-family: var(--ak-font-display);
  font-weight: var(--ak-title-weight);
  font-size: 15px;
}

.btn-go {
  background: var(--ak-btn-fill);
  color: var(--ak-btn-ink);
}

.btn-alt {
  background: var(--ak-choice-bg);
  color: var(--ak-choice-ink);
}

.mute {
  position: absolute;
  z-index: 5;
  top: max(6px, env(safe-area-inset-top, 0px));
  right: max(6px, env(safe-area-inset-right, 0px));
  width: 48px;
  height: 48px;
  padding: 8px;
  background: var(--ak-surface);
  color: var(--ak-ink);
}

.mute-icon {
  display: block;
  width: 100%;
  height: 100%;
}

.mute .slash {
  display: none;
}

.mute.is-muted .slash {
  display: block;
}

.mute.is-muted .wave {
  display: none;
}

.fx {
  position: absolute;
  z-index: 6;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.bit {
  position: absolute;
  top: 0;
  width: 9px;
  height: 14px;
  border-radius: 2px;
  opacity: 0;
}

.bit-a { background: var(--ak-accent); }
.bit-b { background: var(--ak-accent-2); }

.play.is-won .card.is-on {
  --tilt: 0deg;
  --lift: 0px;
  box-shadow: inset 0 0 0 4px var(--ak-accent-2);
}

@media (prefers-reduced-motion: no-preference) {
  .tally {
    animation: sway 4.8s ease-in-out infinite;
    transform-origin: 50% 8%;
  }

  .needle-spin {
    animation: needle 3.6s ease-in-out infinite;
    transform-origin: 50% 50%;
  }

  .card:not(.is-on):not(.is-stamp):not(.is-peel) {
    animation: bob 3.2s ease-in-out infinite;
  }

  .card:nth-child(2n) {
    animation-delay: -1.3s;
  }

  .card.is-stamp {
    animation: stamp var(--stamp-ms) cubic-bezier(0.34, 1.56, 0.64, 1);
  }

  .card.is-peel {
    animation: peel var(--peel-ms) cubic-bezier(0.22, 1, 0.36, 1);
  }

  .card:active {
    transform: translateY(var(--lift)) rotate(var(--tilt)) scale(0.96);
  }

  .hint:active,
  .check:active,
  .btn:active,
  .mute:active {
    transform: scale(0.96);
  }

  .is-pop {
    animation: press 180ms ease;
  }

  .turn.is-cue {
    animation: cue 420ms cubic-bezier(0.34, 1.56, 0.64, 1);
  }

  .digit.is-tick {
    animation: tick var(--tick-ms) cubic-bezier(0.34, 1.56, 0.64, 1);
  }

  .win.is-shake .win-read {
    animation: shake 480ms ease;
  }

  .check.is-ready {
    animation: ready 1.1s ease-in-out infinite;
  }

  .play.is-won .tally,
  .play.is-won .needle-spin,
  .play.is-won .card {
    animation: none;
  }

  .play.is-won .win.is-flash .win-read {
    animation: chase 800ms ease-in-out 3;
  }

  .bit {
    animation: fall 1200ms ease-in forwards;
  }
}

@keyframes sway {
  0%, 100% { transform: rotate(-1.1deg); }
  50% { transform: rotate(1.1deg); }
}

@keyframes needle {
  0%, 100% { transform: rotate(-8deg); }
  50% { transform: rotate(8deg); }
}

@keyframes bob {
  0%, 100% { transform: translateY(var(--lift)) rotate(var(--tilt)); }
  50% { transform: translateY(calc(var(--lift) - 4px)) rotate(var(--tilt)); }
}

@keyframes stamp {
  0% { transform: translateY(var(--lift)) rotate(var(--tilt)) scale(1); }
  32% { transform: translateY(calc(var(--lift) - 14px)) rotate(var(--tilt)) scale(1.07); }
  68% { transform: translateY(4px) rotate(0deg) scale(0.94); }
  100% { transform: translateY(0) rotate(0deg) scale(1); }
}

@keyframes peel {
  0% { transform: translateY(0) rotate(0) scale(1); }
  40% { transform: translateY(-16px) rotate(-7deg) scale(1.05); }
  100% { transform: translateY(var(--lift)) rotate(var(--tilt)) scale(1); }
}

@keyframes cue {
  0% { transform: scale(1); }
  40% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

@keyframes tick {
  0% { transform: translateY(-60%); }
  65% { transform: translateY(15%); }
  100% { transform: translateY(0); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-5px); }
  40% { transform: translateX(5px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(3px); }
}

@keyframes press {
  0% { transform: scale(1); }
  40% { transform: scale(0.96); }
  100% { transform: scale(1); }
}

@keyframes ready {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.03); }
}

@keyframes chase {
  0%, 100% { box-shadow: 0 0 0 2px var(--ak-glow), 0 0 0 3px var(--ak-accent); }
  50% { box-shadow: 0 0 0 2px var(--ak-glow), 0 0 0 3px var(--ak-accent-2); }
}

@keyframes fall {
  0% { transform: translateY(0) rotate(0); opacity: 1; }
  100% { transform: translateY(72dvh) rotate(var(--spin, 40deg)); opacity: 0; }
}
