:root {
  color-scheme: light;
  font-family:
    Inter, ui-rounded, "Arial Rounded MT Bold", "Segoe UI", sans-serif;
  background: #6c4cff;
  color: #16131c;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

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

body {
  overflow: hidden;
}

button {
  font: inherit;
}

[hidden] {
  display: none !important;
}

.game {
  position: relative;
  min-height: 100svh;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(circle at 16% 18%, rgba(255, 221, 87, 0.95) 0 5%, transparent 5.2%),
    radial-gradient(circle at 88% 78%, rgba(98, 226, 255, 0.9) 0 8%, transparent 8.2%),
    linear-gradient(135deg, #7857ff 0%, #5b3fe8 48%, #4229bd 100%);
}

.game::before {
  position: absolute;
  inset: 0;
  z-index: -2;
  content: "";
  opacity: 0.24;
  background-image: radial-gradient(rgba(255, 255, 255, 0.95) 1.4px, transparent 1.4px);
  background-size: 24px 24px;
  mask-image: linear-gradient(to bottom, black, transparent 86%);
}

.eyebrow {
  position: fixed;
  top: 22px;
  left: 50%;
  z-index: 2;
  margin: 0;
  padding: 8px 14px;
  transform: translateX(-50%) rotate(-1deg);
  border: 2px solid #16131c;
  border-radius: 999px;
  background: #ffdd57;
  box-shadow: 3px 3px 0 #16131c;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.shape {
  position: absolute;
  z-index: -1;
  border: 3px solid #16131c;
  pointer-events: none;
}

.shape--one {
  top: 11%;
  right: 9%;
  width: 70px;
  aspect-ratio: 1;
  transform: rotate(18deg);
  border-radius: 20px;
  background: #ff5f9e;
  box-shadow: 8px 8px 0 rgba(22, 19, 28, 0.75);
  animation: float 5s ease-in-out infinite;
}

.shape--two {
  bottom: 9%;
  left: 7%;
  width: 92px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #bfff4a;
  box-shadow: 8px 8px 0 rgba(22, 19, 28, 0.75);
  animation: float 6s 0.8s ease-in-out infinite reverse;
}

.shape--three {
  top: 20%;
  left: 13%;
  width: 34px;
  aspect-ratio: 1;
  transform: rotate(45deg);
  background: #62e2ff;
  animation: spin 9s linear infinite;
}

.dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 10;
  width: min(470px, calc(100vw - 32px));
  overflow: hidden;
  transform: translate(-50%, -50%);
  border: 3px solid #16131c;
  border-radius: 28px;
  background: #fffdf7;
  box-shadow: 12px 12px 0 #16131c;
  transition:
    top 280ms cubic-bezier(0.22, 1, 0.36, 1),
    left 280ms cubic-bezier(0.22, 1, 0.36, 1),
    opacity 180ms ease,
    scale 180ms ease;
  will-change: top, left;
}

.dialog.is-leaving {
  opacity: 0;
  scale: 0.82;
  pointer-events: none;
}

.dialog__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 3px solid #16131c;
  background: #ffdd57;
}

.dialog__badge {
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.dialog__dots {
  display: flex;
  gap: 6px;
}

.dialog__dots i {
  width: 9px;
  aspect-ratio: 1;
  border: 1.5px solid #16131c;
  border-radius: 50%;
  background: #fff;
}

.dialog__dots i:nth-child(1) {
  background: #ff5f9e;
}

.dialog__dots i:nth-child(2) {
  background: #bfff4a;
}

.dialog__dots i:nth-child(3) {
  background: #62e2ff;
}

.dialog__content {
  padding: 28px 34px 34px;
  text-align: center;
}

.dialog__emoji {
  display: inline-grid;
  width: 68px;
  aspect-ratio: 1;
  place-items: center;
  transform: rotate(-6deg);
  border: 3px solid #16131c;
  border-radius: 20px;
  background: #dcd2ff;
  box-shadow: 5px 5px 0 #16131c;
  font-size: 34px;
}

h1,
h2,
p {
  text-wrap: balance;
}

h1 {
  margin: 22px 0 8px;
  font-size: clamp(38px, 8vw, 58px);
  line-height: 0.98;
  letter-spacing: -0.055em;
}

.dialog__content > p {
  min-height: 24px;
  margin: 0;
  color: #625d69;
  font-size: 15px;
}

.dialog__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 26px;
}

.button {
  min-height: 54px;
  padding: 12px 20px;
  border: 3px solid #16131c;
  border-radius: 16px;
  color: #16131c;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 5px 5px 0 #16131c;
  transition:
    transform 120ms ease,
    box-shadow 120ms ease;
}

.button:hover {
  transform: translate(-2px, -2px);
  box-shadow: 7px 7px 0 #16131c;
}

.button:active {
  transform: translate(4px, 4px);
  box-shadow: 1px 1px 0 #16131c;
}

.button:focus-visible {
  outline: 4px solid #62e2ff;
  outline-offset: 4px;
}

.button--yes {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #bfff4a;
  font-size: 20px;
}

.button--yes span:last-child {
  font-size: 24px;
}

.button--no {
  background: #fff;
  font-size: 18px;
}

.protected-message {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  padding: 20px;
  place-items: center;
}

.protected-message__card {
  position: relative;
  width: min(620px, 100%);
  padding: clamp(34px, 8vw, 64px);
  transform: rotate(-1deg);
  border: 4px solid #16131c;
  border-radius: 34px;
  background: #bfff4a;
  box-shadow: 14px 14px 0 #16131c;
  text-align: center;
  animation: protected-arrival 550ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.protected-message__card::before,
.protected-message__card::after {
  position: absolute;
  content: "✦";
  font-size: clamp(28px, 6vw, 46px);
  animation: spin 7s linear infinite;
}

.protected-message__card::before {
  top: 24px;
  left: 28px;
  color: #6c4cff;
}

.protected-message__card::after {
  right: 28px;
  bottom: 24px;
  color: #ff5f9e;
}

.protected-message__icon {
  display: block;
  margin-bottom: 12px;
  font-size: clamp(60px, 13vw, 92px);
}

.protected-message__label {
  display: inline-block;
  margin: 0;
  padding: 7px 12px;
  transform: rotate(1deg);
  border: 2px solid #16131c;
  border-radius: 999px;
  background: #fffdf7;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.protected-message h1 {
  margin: 20px auto 12px;
  max-width: 520px;
  font-size: clamp(42px, 10vw, 76px);
  line-height: 0.94;
}

.protected-message__card > p:last-child {
  margin: 0;
  font-size: clamp(16px, 3.5vw, 20px);
  font-weight: 700;
}

.result {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  padding: 20px;
  place-items: center;
  visibility: hidden;
  opacity: 0;
  background: rgba(71, 44, 191, 0.76);
  backdrop-filter: blur(12px);
  transition:
    opacity 250ms ease,
    visibility 250ms ease;
}

.result.is-visible {
  visibility: visible;
  opacity: 1;
}

.result__card {
  width: min(580px, 100%);
  padding: clamp(32px, 7vw, 58px);
  transform: translateY(25px) scale(0.92) rotate(-1deg);
  border: 4px solid #16131c;
  border-radius: 34px;
  background: #ffdd57;
  box-shadow: 14px 14px 0 #16131c;
  text-align: center;
  transition: transform 500ms cubic-bezier(0.16, 1, 0.3, 1);
}

.result.is-visible .result__card {
  transform: translateY(0) scale(1) rotate(-1deg);
}

.result__icon {
  display: block;
  margin-bottom: 10px;
  font-size: clamp(58px, 13vw, 92px);
  animation: pop 600ms 150ms both cubic-bezier(0.34, 1.56, 0.64, 1);
}

.result__label {
  display: inline-block;
  margin: 0;
  padding: 7px 12px;
  transform: rotate(1deg);
  border: 2px solid #16131c;
  border-radius: 999px;
  background: #fffdf7;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.result h2 {
  margin: 18px 0 10px;
  font-size: clamp(48px, 12vw, 82px);
  line-height: 0.9;
  letter-spacing: -0.06em;
}

.result__card > p:last-of-type {
  max-width: 430px;
  margin: 0 auto;
  font-size: clamp(16px, 3.5vw, 19px);
  line-height: 1.45;
}

.button--again {
  margin-top: 28px;
  background: #fffdf7;
}

#confetti {
  position: fixed;
  inset: 0;
  z-index: 50;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

@keyframes float {
  0%,
  100% {
    translate: 0 0;
  }
  50% {
    translate: 0 -16px;
  }
}

@keyframes spin {
  to {
    transform: rotate(405deg);
  }
}

@keyframes pop {
  from {
    transform: scale(0) rotate(-18deg);
  }
  to {
    transform: scale(1) rotate(0);
  }
}

@keyframes protected-arrival {
  from {
    transform: translateY(28px) scale(0.88) rotate(2deg);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1) rotate(-1deg);
    opacity: 1;
  }
}

@media (max-width: 540px) {
  .eyebrow {
    top: 14px;
  }

  .dialog {
    box-shadow: 8px 8px 0 #16131c;
  }

  .dialog__content {
    padding: 24px 20px 26px;
  }

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

  .button--no {
    min-height: 48px;
  }

  .shape--one {
    right: -22px;
  }

  .shape--two {
    left: -35px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }

  .dialog {
    transition-duration: 90ms;
  }
}
