html,
body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--page);
}

button,
input {
  font: inherit;
}

.stage {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: var(--page);
}

.field {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 540px;
  height: 960px;
  visibility: hidden;
  overflow: hidden;
  color: var(--ink);
  background:
    radial-gradient(120% 42% at 50% -8%, var(--rim), transparent 58%),
    var(--page);
  font-family: "Avenir Next", "Segoe UI", system-ui, sans-serif;
  user-select: none;
  -webkit-user-select: none;
}

.field.is-ready {
  visibility: visible;
}

.field,
.field * {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

[data-screen] {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
}

[data-screen="start"],
[data-screen="handoff"],
[data-screen="end"] {
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 36px 32px 40px;
  text-align: center;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 104px;
  font-weight: 900;
  line-height: 0.82;
  letter-spacing: -0.05em;
  color: var(--active);
}

h2,
[data-winner-name],
[data-handoff-team] {
  font-size: 64px;
  font-weight: 900;
  line-height: 0.95;
  letter-spacing: -0.04em;
  color: var(--active);
  overflow-wrap: anywhere;
}

.eyebrow,
.progress {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--active);
}

.card .progress {
  color: var(--rim);
}

.hint,
.record,
.warn {
  max-width: 420px;
  font-size: 22px;
  font-weight: 650;
  line-height: 1.35;
  color: var(--muted);
}

.warn {
  color: var(--timer-low);
}

.modes,
.actions {
  display: grid;
  width: 100%;
  gap: 12px;
}

.rounds {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.rounds p {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--active);
}

.stepper {
  display: grid;
  grid-template-columns: 72px 96px 72px;
  gap: 10px;
  align-items: center;
}

.stepper b {
  font-size: 52px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  color: var(--ink);
  text-align: center;
}

.stepper button {
  height: 64px;
  border: 0;
  border-radius: 18px;
  background: var(--team);
  color: var(--team-ink);
  box-shadow: 0 6px 0 var(--card-ink);
  font-size: 36px;
  font-weight: 900;
  cursor: pointer;
  touch-action: manipulation;
}

.stepper button:active {
  transform: translateY(3px);
  box-shadow: 0 3px 0 var(--card-ink);
}

.modes {
  margin-top: 4px;
}

.modes button,
.actions button,
[data-ready],
[data-again] {
  border: 0;
  border-radius: 22px;
  box-shadow: 0 7px 0 var(--card-ink);
  font-size: 32px;
  font-weight: 900;
  letter-spacing: -0.03em;
  cursor: pointer;
  touch-action: manipulation;
}

.modes button,
[data-ready],
[data-again] {
  width: 100%;
  height: 92px;
}

.modes button:active,
.actions button:active,
[data-ready]:active,
[data-again]:active {
  transform: translateY(4px);
  box-shadow: 0 3px 0 var(--card-ink);
}

[data-mode="easy"],
[data-act="yes"],
[data-ready],
[data-again] {
  background: var(--yes);
  color: var(--yes-ink);
}

[data-mode="medium"],
[data-act="skip"] {
  background: var(--skip);
  color: var(--skip-ink);
}

[data-mode="hard"],
[data-act="no"] {
  background: var(--no);
  color: var(--no-ink);
}

button:disabled {
  opacity: 0.38;
  transform: none;
  box-shadow: 0 7px 0 var(--card-ink);
}

button:focus-visible {
  outline: 4px solid var(--active);
  outline-offset: 3px;
}

.scores {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  width: 100%;
}

.scores p {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 10px;
  border-radius: 20px;
  background: var(--team);
  color: var(--team-ink);
}

.scores span {
  font-size: 16px;
  font-weight: 800;
}

.scores b {
  font-size: 44px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.final b {
  font-size: 56px;
}

[data-screen="end"] {
  position: relative;
  overflow: hidden;
  gap: 12px;
}

.winner-lead {
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--active);
}

[data-winner-name] {
  font-size: 76px;
  line-height: 0.9;
}

[data-screen="end"].is-win [data-winner-name] {
  animation: announce 0.72s cubic-bezier(0.2, 1.35, 0.35, 1) both;
}

[data-screen="end"].is-tie [data-winner-name] {
  color: var(--ink);
  animation: rise 0.4s ease both;
}

.scores p.is-champ {
  background: var(--active);
  color: var(--card-ink);
  box-shadow: 0 0 0 4px var(--line);
  animation: lift 0.55s ease 0.2s both;
}

.scores p.is-quiet {
  opacity: 0.72;
}

.confetti {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.confetti i {
  position: absolute;
  top: -24px;
  width: 14px;
  height: 22px;
  border-radius: 4px;
  opacity: 0;
}

.confetti i:nth-child(odd) {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.confetti i:nth-child(4n + 1) { background: var(--active); }
.confetti i:nth-child(4n + 2) { background: var(--rim); }
.confetti i:nth-child(4n + 3) { background: var(--line); }
.confetti i:nth-child(4n) { background: var(--no); }

.confetti i:nth-child(1) { left: 6%; }
.confetti i:nth-child(2) { left: 14%; }
.confetti i:nth-child(3) { left: 22%; }
.confetti i:nth-child(4) { left: 31%; }
.confetti i:nth-child(5) { left: 40%; }
.confetti i:nth-child(6) { left: 48%; }
.confetti i:nth-child(7) { left: 57%; }
.confetti i:nth-child(8) { left: 66%; }
.confetti i:nth-child(9) { left: 74%; }
.confetti i:nth-child(10) { left: 82%; }
.confetti i:nth-child(11) { left: 90%; }
.confetti i:nth-child(12) { left: 18%; }
.confetti i:nth-child(13) { left: 36%; }
.confetti i:nth-child(14) { left: 54%; }
.confetti i:nth-child(15) { left: 72%; }
.confetti i:nth-child(16) { left: 88%; }

[data-screen="end"].is-win .confetti i {
  animation: fall 1.8s ease-in forwards;
}

[data-screen="end"].is-win .confetti i:nth-child(2n) { animation-delay: 0.16s; }
[data-screen="end"].is-win .confetti i:nth-child(3n) { animation-delay: 0.34s; }
[data-screen="end"].is-win .confetti i:nth-child(5n) { animation-duration: 2.1s; }

.top {
  display: grid;
  grid-template-columns: 1fr 138px 1fr;
  gap: 10px;
  align-items: stretch;
  padding: 18px 18px 8px;
}

.plaque {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 8px;
  border: 4px solid transparent;
  border-radius: 20px;
  background: var(--team);
  color: var(--team-ink);
}

.plaque span {
  max-width: 100%;
  overflow: hidden;
  font-size: 15px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plaque b {
  font-size: 40px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.plaque.is-on {
  border-color: var(--line);
  background: var(--active);
  color: var(--card-ink);
}

.clock {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--ink);
}

.clock strong {
  font-size: 52px;
  font-variant-numeric: tabular-nums;
  line-height: 0.9;
}

.clock [data-time-label],
.passes {
  font-size: 13px;
  font-weight: 800;
  color: var(--muted);
}

.bar {
  height: 14px;
  margin: 4px 22px 0;
  overflow: hidden;
  border-radius: 999px;
  background: var(--team);
}

.bar span {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--timer);
  transform: scaleX(1);
  transform-origin: left center;
}

.clock.is-low strong {
  color: var(--timer-low);
  animation: blink 0.6s ease infinite;
}

.bar.is-low span {
  background: var(--timer-low);
}

.card-wrap {
  position: relative;
  display: flex;
  flex: 1;
  min-height: 0;
  padding: 16px 22px 8px;
}

.card-wrap::before {
  content: "";
  position: absolute;
  top: 28px;
  right: 16px;
  bottom: 10px;
  left: 36px;
  border-radius: 36px;
  background: var(--active);
  transform: rotate(3.5deg);
}

.card {
  position: relative;
  z-index: 1;
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 22px 18px 26px;
  border: 8px solid var(--rim);
  border-radius: 36px;
  background: var(--card);
  color: var(--card-ink);
  box-shadow: 0 14px 0 var(--line);
}

.card h2 {
  color: var(--card-ink);
  font-size: 62px;
  text-align: center;
}

.banned-label {
  color: var(--no);
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0.18em;
}

[data-banned] {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  width: 280px;
  max-width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
}

[data-banned] li {
  padding: 9px 16px;
  border-radius: 14px;
  background: var(--chip);
  color: var(--chip-ink);
  font-size: 20px;
  font-weight: 800;
  text-align: center;
  overflow-wrap: anywhere;
}

.actions {
  grid-template-columns: 1fr 1fr 1.15fr;
  padding: 8px 22px 0;
}

.actions button {
  height: 78px;
  font-size: 26px;
}

.finish {
  height: 48px;
  margin: 12px 22px 18px;
  border: 2px solid var(--muted);
  border-radius: 16px;
  background: transparent;
  color: var(--ink);
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
}

.card.is-in {
  animation: rise 0.28s ease;
}

.card.is-ok {
  animation: fly 0.26s ease forwards;
}

.card.is-slip {
  animation: slip 0.26s ease forwards;
}

.card.is-bad {
  animation: shake 0.32s ease;
}

.plaque.is-pop b {
  animation: pop 0.28s ease;
}

.field.cut .card,
.field.cut .plaque b,
.field.cut .clock strong,
.field.cut .confetti i,
.field.cut [data-winner-name],
.field.cut .scores p.is-champ {
  animation: none;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(36px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes fly {
  to {
    opacity: 0;
    transform: translateY(-52px) scale(1.04);
  }
}

@keyframes slip {
  to {
    opacity: 0;
    transform: translateX(-78px) rotate(-6deg);
  }
}

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

@keyframes pop {
  50% {
    transform: scale(1.2);
  }
}

@keyframes blink {
  50% {
    opacity: 0.4;
  }
}

@keyframes announce {
  0% {
    opacity: 0;
    transform: scale(0.35) rotate(-6deg);
  }
  55% {
    opacity: 1;
    transform: scale(1.12) rotate(2deg);
  }
  100% {
    opacity: 1;
    transform: none;
  }
}

@keyframes lift {
  0% {
    transform: translateY(18px) scale(0.92);
  }
  100% {
    transform: none;
  }
}

@keyframes fall {
  0% {
    opacity: 1;
    transform: translateY(0) rotate(0deg);
  }
  100% {
    opacity: 0.2;
    transform: translateY(980px) rotate(280deg);
  }
}
