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

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

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

button {
  font-family: inherit;
  touch-action: manipulation;
}

img {
  display: block;
  max-width: 100%;
  user-select: none;
  -webkit-user-drag: none;
}

[hidden] {
  display: none !important;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.play {
  --pad-top: max(8px, env(safe-area-inset-top, 0px));
  --pad-bot: max(8px, env(safe-area-inset-bottom, 0px));
  --pad-x: max(10px, env(safe-area-inset-left, 0px), env(safe-area-inset-right, 0px));
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: min(100vw, 440px);
  height: 100dvh;
  max-height: 100dvh;
  margin: 0 auto;
  padding: var(--pad-top) var(--pad-x) var(--pad-bot);
  overflow: hidden;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  background-color: var(--ak-bg);
  background-image: var(--ak-backdrop-layer);
  background-size: cover;
  background-position: center top;
  background-repeat: no-repeat;
}

.mute {
  position: absolute;
  top: var(--pad-top);
  right: var(--pad-x);
  z-index: 8;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 2px solid var(--ak-outline);
  border-radius: var(--ak-radius);
  background: var(--ak-surface);
  color: var(--ak-ink);
  box-shadow: var(--ak-shadow);
  cursor: pointer;
}

.mute-icon {
  width: 26px;
  height: 26px;
}

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

.mute.is-muted::after {
  content: '';
  position: absolute;
  width: 3px;
  height: 26px;
  border-radius: 2px;
  background: var(--ak-accent);
  transform: rotate(40deg);
}

.top {
  position: relative;
  z-index: 5;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding-right: 52px;
}

.logo-wrap {
  margin: 0;
  line-height: 0;
}

.play-logo {
  height: min(42px, 6dvh);
  width: auto;
  max-width: min(120px, 34vw);
  object-fit: contain;
  filter: drop-shadow(0 2px 0 var(--ak-glow));
}

.turn {
  min-width: 0;
  padding: 6px 10px;
  border: 2px solid var(--ak-outline);
  border-radius: var(--ak-radius);
  background: var(--ak-surface);
  box-shadow: var(--ak-shadow);
}

.turn-who,
.turn-sub {
  margin: 0;
}

.turn-who {
  font-family: var(--ak-font-display);
  font-size: 18px;
  font-weight: 400;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.turn-sub {
  margin-top: 2px;
  color: var(--ak-ink-muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

.timer {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 56px;
}

.cherry {
  width: 52px;
  aspect-ratio: 300 / 384;
  transform-origin: 50% 16%;
}

.cherry img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.time-kicker {
  margin: 1px 0 0;
  padding: 1px 6px;
  border: 2px solid var(--ak-outline);
  border-radius: 999px;
  background: var(--ak-surface);
  color: var(--ak-ink);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1.4;
  text-transform: uppercase;
}

.voice,
.why {
  position: relative;
  z-index: 5;
  margin: 0;
  padding: 8px 12px;
  border: 2px solid var(--ak-outline);
  border-radius: var(--ak-radius);
  background: var(--ak-surface);
  box-shadow: var(--ak-shadow);
  color: var(--ak-ink);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
}

.voice {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.voice.is-invite {
  border-color: var(--ak-accent-2);
  box-shadow: var(--ak-shadow), 0 0 0 3px color-mix(in srgb, var(--ak-accent-2) 55%, transparent);
}

.hint,
.btn-go,
.btn-alt {
  min-height: 48px;
  border: 2px solid var(--ak-outline);
  border-radius: var(--ak-radius);
  box-shadow: var(--ak-shadow);
  cursor: pointer;
  font-weight: 800;
}

.hint {
  position: relative;
  z-index: 5;
  width: 100%;
  padding: 0 16px;
  background: var(--ak-surface);
  color: var(--ak-ink);
  font-family: var(--ak-font-display);
  font-size: 18px;
  font-weight: 400;
  letter-spacing: 0.04em;
}

.hint:disabled {
  cursor: default;
  opacity: 0.55;
}

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

.stage {
  position: relative;
  z-index: 3;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
}

.specks {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.play.is-ended .specks {
  display: none;
}

.specks i {
  position: absolute;
  width: 8px;
  height: 7px;
  border-radius: 50%;
  background: var(--ak-ink);
  box-shadow: 1px 1px 0 var(--ak-outline);
}

.specks i:nth-child(1) { left: 8%; top: 28%; width: 7px; height: 6px; }
.specks i:nth-child(2) { right: 10%; top: 24%; width: 5px; height: 5px; }
.specks i:nth-child(3) { left: 14%; bottom: 22%; width: 6px; height: 5px; }
.specks i:nth-child(4) { right: 16%; bottom: 30%; width: 9px; height: 7px; }

.clover {
  position: absolute;
  left: 54%;
  top: 55%;
  z-index: 2;
  width: min(76%, 48dvh, 308px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  touch-action: manipulation;
}

.cookie {
  position: absolute;
  width: 46%;
  min-width: 48px;
  min-height: 48px;
  aspect-ratio: 358 / 384;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  pointer-events: auto;
}

.cookie[data-slot="north"] { left: 27%; top: 0; }
.cookie[data-slot="east"] { right: 0; top: 27%; }
.cookie[data-slot="south"] { left: 27%; bottom: 0; }
.cookie[data-slot="west"] { left: 0; top: 27%; }

.cookie:disabled {
  cursor: default;
}

.cookie-body,
.clue-body,
.mini-body {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
}

.shell {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.face {
  position: absolute;
  left: 16%;
  width: 68%;
  top: 37%;
  height: 46%;
  border-radius: 46%;
  background: var(--ak-surface);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--ak-outline) 28%, transparent);
  overflow: hidden;
  pointer-events: none;
}

.face svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.pip {
  stroke-width: 2px;
  stroke-linejoin: round;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

.tone-cocoa { fill: var(--ak-ink); stroke: var(--ak-accent-2); }
.tone-mint { fill: var(--ak-accent-2); stroke: var(--ak-outline); }
.tone-cherry { fill: var(--ak-accent); stroke: var(--ak-outline); }

.cookie.is-real .cookie-body {
  filter: drop-shadow(0 0 8px var(--ak-accent-2)) drop-shadow(0 0 10px var(--ak-glow));
}

.cookie.is-real .cookie-body::after,
.cookie.is-coach .cookie-body::after {
  content: '';
  position: absolute;
  inset: 2%;
  border-radius: 50%;
  border: 3px solid var(--ak-accent-2);
  pointer-events: none;
}

.cookie.is-coach .cookie-body::after {
  border-style: dashed;
}

.finger {
  position: absolute;
  left: 50%;
  bottom: -6px;
  z-index: 3;
  width: 22px;
  height: 22px;
  margin-left: -11px;
  border: 2px solid var(--ak-outline);
  border-radius: 50%;
  background: var(--ak-accent-2);
  box-shadow: var(--ak-shadow);
  pointer-events: none;
}

.crumb {
  position: absolute;
  z-index: 3;
  pointer-events: none;
}

.cookie .crumb,
.clue .crumb {
  right: 14%;
  bottom: 30%;
  width: 36%;
  height: 28%;
  opacity: 0;
  z-index: 4;
}

.cookie.is-no .crumb,
.clue.is-slow .crumb,
.pair.is-miss .crumb {
  opacity: 1;
}

.crumb-svg {
  display: block;
  width: 100%;
  height: 100%;
  fill: var(--ak-ink);
}

.clue {
  position: absolute;
  left: 50%;
  bottom: -3%;
  z-index: 3;
  width: min(58%, 28dvh, 220px);
  aspect-ratio: 380 / 384;
  transform: translateX(-50%);
  pointer-events: none;
}

.why {
  flex: none;
}

.recap {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: repeat(5, minmax(0, 1fr));
  gap: 4px;
  z-index: 4;
}

.pair {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 0;
  min-height: 0;
  padding: 2px;
  border: 2px solid var(--ak-outline);
  border-radius: 14px;
  background: color-mix(in srgb, var(--ak-surface) 88%, transparent);
  box-shadow: var(--ak-shadow);
}

.mini {
  position: relative;
  flex: 1 1 0;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  height: 100%;
}

.mini-body {
  height: 100%;
  width: auto;
  max-width: 100%;
  aspect-ratio: 358 / 384;
}

.mini.is-true .mini-body {
  filter: drop-shadow(0 0 4px var(--ak-accent-2)) drop-shadow(0 0 6px var(--ak-glow));
}

.pair .crumb {
  right: 4%;
  bottom: 6%;
  width: 16px;
  height: 14px;
}

.result {
  position: relative;
  z-index: 5;
  flex: none;
  pointer-events: auto;
}

.result-card {
  padding: 10px 12px 12px;
  border: 2px solid var(--ak-outline);
  border-radius: var(--ak-radius);
  background: var(--ak-surface);
  box-shadow: var(--ak-shadow);
}

.result-says {
  margin: 0;
  color: var(--ak-ink);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.35;
  text-align: center;
}

.result-says:focus {
  outline: none;
}

.result-says:focus-visible {
  outline: 3px solid var(--ak-focus);
  outline-offset: 3px;
}

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

.btn-go,
.btn-alt {
  width: 100%;
  padding: 0 12px;
  font-family: var(--ak-font-display);
  font-size: 18px;
  font-weight: 400;
  letter-spacing: 0.03em;
}

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

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

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

.fx i {
  position: absolute;
  width: 8px;
  height: 12px;
  border-radius: 3px;
  opacity: 0;
}

.fx i.is-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.cookie:focus-visible .cookie-body,
.hint:focus-visible,
.mute:focus-visible,
.btn-go:focus-visible,
.btn-alt:focus-visible {
  outline: 3px solid var(--ak-focus);
  outline-offset: 3px;
}

.cookie:focus-visible .cookie-body {
  border-radius: 50%;
}

.hint:active,
.btn-go:active,
.btn-alt:active,
.mute:active {
  background: var(--ak-choice-bg);
}

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

@media (prefers-reduced-motion: no-preference) {
  .play-logo {
    animation: logo-bob 3.4s ease-in-out infinite;
  }

  .voice.is-invite {
    animation: invite 1.6s ease-in-out infinite;
  }

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

  .cherry {
    animation: stem 2.6s ease-in-out infinite;
  }

  .cherry.is-hurry {
    animation: wobble 0.24s ease-in-out infinite;
  }

  .cookie-body {
    animation: bob 3.1s ease-in-out infinite;
  }

  .cookie[data-slot="east"] .cookie-body { animation-delay: -0.5s; }
  .cookie[data-slot="south"] .cookie-body { animation-delay: -1.1s; }
  .cookie[data-slot="west"] .cookie-body { animation-delay: -1.7s; }

  .clue-body {
    animation: bob 3.5s ease-in-out infinite;
  }

  .cookie:active .cookie-body {
    scale: 1.1 0.8;
  }

  .cookie.is-coach .cookie-body::after,
  .finger {
    animation: poke 0.9s ease-in-out infinite;
  }

  .cookie.is-no .crumb,
  .clue.is-slow .crumb {
    animation: crumb-drop 520ms cubic-bezier(0.2, 0.8, 0.3, 1) both;
  }

  .clover.is-spin .cookie-body {
    animation: spin-settle 720ms cubic-bezier(0.34, 1.2, 0.64, 1) both;
  }

  .clover.is-spin .cookie[data-slot="east"] .cookie-body { animation-delay: 40ms; }
  .clover.is-spin .cookie[data-slot="south"] .cookie-body { animation-delay: 80ms; }
  .clover.is-spin .cookie[data-slot="west"] .cookie-body { animation-delay: 120ms; }

  .specks i {
    animation: drift 4.8s ease-in-out infinite;
  }

  .specks i:nth-child(2) { animation-delay: -1.2s; }
  .specks i:nth-child(3) { animation-delay: -2.4s; }
  .specks i:nth-child(4) { animation-delay: -3s; }

  .play.is-win .mini.is-true .mini-body {
    animation: chase 1.5s ease-in-out infinite;
  }

  .play.is-win .pair:nth-child(2) .mini.is-true .mini-body { animation-delay: 0.12s; }
  .play.is-win .pair:nth-child(3) .mini.is-true .mini-body { animation-delay: 0.24s; }
  .play.is-win .pair:nth-child(4) .mini.is-true .mini-body { animation-delay: 0.36s; }
  .play.is-win .pair:nth-child(5) .mini.is-true .mini-body { animation-delay: 0.48s; }
  .play.is-win .pair:nth-child(6) .mini.is-true .mini-body { animation-delay: 0.6s; }
  .play.is-win .pair:nth-child(7) .mini.is-true .mini-body { animation-delay: 0.72s; }
  .play.is-win .pair:nth-child(8) .mini.is-true .mini-body { animation-delay: 0.84s; }
  .play.is-win .pair:nth-child(9) .mini.is-true .mini-body { animation-delay: 0.96s; }
  .play.is-win .pair:nth-child(10) .mini.is-true .mini-body { animation-delay: 1.08s; }

  .result.is-in .result-card {
    animation: card-in 420ms cubic-bezier(0.22, 1, 0.36, 1) both;
  }

  .fx i {
    animation: sprinkle 980ms ease-out forwards;
  }

  .hint:active,
  .btn-go:active,
  .btn-alt:active,
  .mute:active {
    transform: translateY(3px);
    box-shadow: none;
  }
}

@keyframes logo-bob {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -3px; }
}

@keyframes bob {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -4px; }
}

@keyframes drift {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -6px; }
}

@keyframes stem {
  0%, 100% { rotate: -5deg; }
  50% { rotate: 6deg; }
}

@keyframes wobble {
  0%, 100% { rotate: -10deg; }
  50% { rotate: 10deg; }
}

@keyframes invite {
  0%, 100% { box-shadow: var(--ak-shadow), 0 0 0 3px color-mix(in srgb, var(--ak-accent-2) 40%, transparent); }
  50% { box-shadow: var(--ak-shadow), 0 0 0 5px color-mix(in srgb, var(--ak-accent-2) 70%, transparent); }
}

@keyframes cue {
  0% { scale: 0.94 1.06; }
  55% { scale: 1.06 0.94; }
  100% { scale: 1 1; }
}

@keyframes poke {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 5px; }
}

@keyframes crumb-drop {
  0% { opacity: 1; translate: 0 -14px; scale: 0.35; }
  70% { opacity: 1; translate: 4px 8px; scale: 1.05; }
  100% { opacity: 1; translate: 6px 12px; scale: 1; }
}

@keyframes spin-settle {
  0% { rotate: 0deg; scale: 1 1; }
  55% { rotate: 210deg; scale: 1.1 0.86; }
  100% { rotate: 360deg; scale: 1 1; }
}

@keyframes chase {
  0%, 100% { filter: drop-shadow(0 0 2px var(--ak-accent-2)) drop-shadow(0 0 4px var(--ak-glow)); }
  40% { filter: drop-shadow(0 0 8px var(--ak-accent-2)) drop-shadow(0 0 12px var(--ak-glow)); }
}

@keyframes card-in {
  from { translate: 0 16px; opacity: 0; }
  to { translate: 0 0; opacity: 1; }
}

@keyframes sprinkle {
  0% { opacity: 1; transform: translate(0, 0) rotate(0deg) scale(1); }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)) rotate(var(--rot)) scale(0.6); }
}
