*,
*::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;
  line-height: 1.3;
  background-color: var(--ak-bg);
  background-image: var(--ak-bg-art);
  background-size: var(--ak-bg-size);
}

[hidden] {
  display: none !important;
}

button {
  font: inherit;
  touch-action: manipulation;
  -webkit-appearance: none;
  appearance: none;
}

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

img {
  -webkit-user-drag: none;
  user-select: none;
}

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

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

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

.mute {
  position: absolute;
  top: var(--pad-top);
  right: var(--pad-right);
  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-svg {
  width: 26px;
  height: 26px;
}

.mute .slash {
  display: none;
}

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

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

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

.play-logo {
  display: block;
  width: auto;
  height: 36px;
  max-width: 46%;
  object-fit: contain;
}

.turn {
  min-width: 0;
  padding: 4px 10px;
  border: 2px solid var(--ak-outline);
  border-radius: var(--ak-radius);
  background: color-mix(in srgb, var(--ak-surface) 88%, transparent);
  box-shadow: var(--ak-shadow);
}

.turn-who {
  margin: 0;
  font-family: var(--ak-font-display);
  font-size: clamp(16px, 4.6vw, 22px);
  font-weight: var(--ak-title-weight);
  line-height: 1.1;
  color: var(--ak-accent);
}

.turn-sub {
  margin: 2px 0 0;
  color: var(--ak-ink-muted);
  font-size: 13px;
  font-weight: 700;
}

.voice,
.why {
  flex: 0 0 auto;
  margin: 0;
  padding: 7px 10px;
  border: 2px solid var(--ak-outline);
  border-radius: var(--ak-radius);
  background: color-mix(in srgb, var(--ak-surface) 90%, transparent);
  box-shadow: var(--ak-shadow);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.25;
}

.voice {
  min-height: 40px;
}

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

.trench {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  padding: 8px 4px 6px;
  overflow: hidden;
  border: 2px solid var(--ak-outline);
  border-radius: var(--ak-radius);
  background: color-mix(in srgb, var(--ak-surface) 46%, transparent);
  box-shadow: var(--ak-shadow);
}

.words {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-content: center;
  align-items: flex-end;
  gap: 8px 14px;
  width: 100%;
  padding-top: 4px;
}

.play.is-example .words,
.play.is-hold .words {
  pointer-events: none;
}

.word {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 100%;
  padding: 2px 4px 5px;
}

.word-trench {
  position: absolute;
  left: -6px;
  right: -6px;
  bottom: 0;
  z-index: 0;
  width: calc(100% + 12px);
  height: 30px;
  object-fit: cover;
  object-position: center 42%;
  pointer-events: none;
}

.chips {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
  margin-bottom: 4px;
}

.chip {
  position: relative;
  width: var(--chip);
  height: var(--chip);
  min-width: 48px;
  min-height: 48px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ak-bg);
  cursor: pointer;
}

.pop {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
}

.chip img {
  position: absolute;
  left: 50%;
  top: 42%;
  width: 136%;
  height: 136%;
  object-fit: contain;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.face {
  position: absolute;
  left: 50%;
  top: 35%;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 42%;
  height: 42%;
  border-radius: 50%;
  background: var(--ak-accent-2);
  color: var(--ak-bg);
  font-family: var(--ak-font-display);
  font-size: calc(var(--chip) * 0.3);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.04em;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.mark {
  position: relative;
  z-index: 5;
  align-self: center;
  min-width: 16px;
  margin: 0 4px 12px;
  color: var(--ak-ink);
  font-family: var(--ak-font-display);
  font-size: 30px;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  text-shadow: 0 0 6px var(--ak-bg), 0 0 2px var(--ak-bg);
}

.conduit {
  position: relative;
  z-index: 1;
  width: 78%;
  height: 4px;
  margin-top: 1px;
  border-radius: 99px;
  background: var(--ak-accent);
  transform-origin: center;
}

.badge {
  position: relative;
  z-index: 2;
  margin-top: 2px;
  padding: 1px 6px;
  border: 2px solid var(--ak-outline);
  border-radius: var(--ak-radius);
  background: var(--ak-btn-fill);
  color: var(--ak-btn-ink);
  font-family: var(--ak-font-display);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.4;
  text-transform: uppercase;
  pointer-events: none;
}

.word.is-locked .face {
  background: var(--ak-accent-2);
  box-shadow: 0 0 10px var(--ak-glow);
}

.word.is-locked .word-trench {
  filter: saturate(1.35) brightness(1.18);
}

.word.is-fault .chip {
  outline: 3px solid var(--ak-accent);
  outline-offset: 1px;
  border-radius: 50%;
}

.chip.is-picked {
  outline: 3px solid var(--ak-focus);
  outline-offset: 2px;
  border-radius: 50%;
}

.slip {
  position: relative;
  z-index: 2;
  flex: 0 0 auto;
  height: 96px;
  overflow: hidden;
  border-radius: var(--ak-radius);
}

.slip-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 48%;
  pointer-events: none;
}

.slip p {
  position: absolute;
  z-index: 1;
  left: 9%;
  right: 9%;
  top: 12px;
  bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 6px 8px;
  border-radius: 2px;
  background: var(--ak-accent-2);
  box-shadow: 0 -3px 0 var(--ak-accent);
  color: var(--ak-bg);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
}

.actions {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn {
  min-height: 48px;
  padding: 8px 10px;
  border: 2px solid var(--ak-outline);
  border-radius: var(--ak-radius);
  box-shadow: var(--ak-shadow);
  font-family: var(--ak-font-display);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.03em;
  line-height: 1.15;
  text-transform: uppercase;
  cursor: pointer;
}

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

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

.btn-alt,
.hint {
  background: var(--ak-surface);
  color: var(--ak-ink);
}

.hint {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px 0 0;
  text-align: left;
  text-transform: none;
}

.hint img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  flex: 0 0 auto;
}

.hint-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.hint-name {
  font-family: var(--ak-font-display);
  font-size: 14px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.lamps {
  display: flex;
  gap: 5px;
}

.lamps i {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--ak-ink-muted);
  box-shadow: inset 0 0 0 1px var(--ak-outline);
}

#give-up {
  min-height: 48px;
}

.result {
  flex: 0 0 auto;
  z-index: 5;
}

.result-card {
  padding: 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 0 10px;
  font-family: var(--ak-font-display);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
}

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

.result-actions .btn {
  flex: 1 1 0;
  min-height: 48px;
}

.spark {
  position: absolute;
  top: 42%;
  width: 8px;
  height: 8px;
  opacity: 0;
}

@media (min-width: 400px) {
  .play {
    --chip: 52px;
  }
}

@media (hover: hover) {
  .btn-go:hover:not(:disabled) {
    background: var(--ak-btn-hover);
  }
}

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

  .conduit {
    animation: tick 1.6s ease-in-out infinite;
  }

  .word.is-locked .conduit {
    animation: none;
    opacity: 1;
    background: var(--ak-accent-2);
    box-shadow: 0 0 10px var(--ak-glow);
    transform: none;
  }

  .chip .pop {
    animation: bob 3.2s ease-in-out infinite;
    animation-delay: calc(var(--i) * 90ms);
  }

  .chip.is-deal .pop {
    animation: deal 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
    animation-delay: calc((var(--n) - var(--i)) * 28ms);
  }

  .chip.is-hop .pop {
    animation: hop 0.58s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  }

  .word.is-flip .chip .pop {
    animation: flip 0.46s ease-in-out both;
    animation-delay: calc(var(--i) * 40ms);
  }

  .word.is-invite .chip .pop {
    animation: invite 1.05s ease-in-out infinite;
  }

  .word.is-invite .chip.is-deal .pop {
    animation:
      deal 0.4s cubic-bezier(0.22, 1, 0.36, 1) both,
      invite 1.05s ease-in-out 0.48s infinite;
    animation-delay: calc((var(--n) - var(--i)) * 28ms), 0.48s;
  }

  .words.is-shiver {
    animation: shiver 0.42s ease-in-out 1;
  }

  .slip.is-in {
    animation: slip-up 0.58s cubic-bezier(0.22, 1, 0.36, 1) both;
  }

  .turn.is-cue {
    animation: cue 0.42s ease-out 1;
  }

  .lamps i.is-on {
    background: var(--ak-accent);
    box-shadow: 0 0 8px var(--ak-glow);
    animation: lamp 1.8s ease-in-out infinite;
  }

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

  .play.is-win .trench {
    animation: chase 0.9s linear 3;
  }

  .spark {
    animation: spark 0.9s ease-out forwards;
  }

  .btn:active:not(:disabled) {
    transform: translateY(2px) scale(0.98);
  }

  .chip:active .pop {
    animation: none;
    transform: scale(0.92, 1.08);
  }

  .mute:active {
    transform: scale(0.94);
  }
}

@media (prefers-reduced-motion: reduce) {
  .word.is-locked .conduit {
    opacity: 1;
    background: var(--ak-accent-2);
    box-shadow: 0 0 10px var(--ak-glow);
  }

  .lamps i.is-on {
    background: var(--ak-accent);
    box-shadow: 0 0 8px var(--ak-glow);
  }
}

@keyframes bob {
  0%,
  100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

@keyframes tick {
  0%,
  100% { opacity: 0.28; transform: scaleX(0.45); }
  38% { opacity: 1; transform: scaleX(1); }
  52% { opacity: 0.45; transform: scaleX(0.7); }
  70% { opacity: 0.95; transform: scaleX(0.9); }
}

@keyframes hop {
  0% { transform: translateY(0) scale(1, 1); }
  28% { transform: translateY(-16px) scale(0.9, 1.12); }
  52% { transform: translateY(0) scale(1.08, 0.88); }
  72% { transform: translateY(-7px) scale(0.96, 1.06); }
  100% { transform: translateY(0) scale(1, 1); }
}

@keyframes deal {
  0% { transform: translateX(42px) scale(0.86, 1.08); opacity: 0; }
  68% { transform: translateX(-3px) scale(1.05, 0.94); opacity: 1; }
  100% { transform: translateX(0) scale(1, 1); opacity: 1; }
}

@keyframes flip {
  0% { transform: rotateX(0) scale(1, 1); }
  45% { transform: rotateX(90deg) scale(0.86, 1.08); }
  100% { transform: rotateX(0) scale(1, 1); }
}

@keyframes invite {
  0%,
  100% { transform: translateY(0) scale(1, 1); }
  50% { transform: translateY(-6px) scale(1.04, 0.96); }
}

@keyframes shiver {
  0%,
  100% { transform: translateX(0); }
  18% { transform: translateX(-7px); }
  40% { transform: translateX(7px); }
  62% { transform: translateX(-4px); }
  80% { transform: translateX(3px); }
}

@keyframes slip-up {
  0% { transform: translateY(120%); }
  70% { transform: translateY(-8px); }
  100% { transform: translateY(0); }
}

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

@keyframes lamp {
  0%,
  100% { box-shadow: 0 0 4px var(--ak-glow); }
  50% { box-shadow: 0 0 10px var(--ak-glow); }
}

@keyframes ready {
  0%,
  100% { box-shadow: var(--ak-shadow); }
  50% { box-shadow: var(--ak-shadow), 0 0 16px var(--ak-glow); }
}

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

@keyframes spark {
  0% { transform: translate3d(0, 0, 0) rotate(0deg) scale(1); opacity: 1; }
  100% { transform: translate3d(var(--dx), var(--dy), 0) rotate(180deg) scale(0.35); opacity: 0; }
}
