@font-face {
  font-family: Decider;
  src: local("Arial Black");
  font-weight: 900;
  font-display: swap;
}
:root {
  font-family: Arial, Helvetica, sans-serif;
  color: #221a35;
  background: #e9e0ff;
  font-synthesis: none;
  --ink: #221a35;
  --purple: #7040ec;
  --mint: #c5f786;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  background-image: radial-gradient(#9177bf30 0.8px, transparent 0.8px);
  background-size: 16px 16px;
}
button {
  font: inherit;
}
[hidden] {
  display: none !important;
}
.masthead {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 22px 16px 12px;
  font-size: 0.6875rem;
  letter-spacing: 1.8px;
  font-weight: 800;
}
.brand-mark {
  font-size: 27px;
  line-height: 1;
  color: var(--purple);
}
main {
  width: 100%;
  max-width: 540px;
  margin: auto;
  flex: 1;
  text-align: center;
  padding: 16px 26px 20px;
}
.eyebrow {
  font-size: 0.625rem;
  letter-spacing: 1.6px;
  font-weight: 800;
  margin: 0 0 12px;
}
.intro h1 {
  font-family: Decider, "Arial Black", Arial, sans-serif;
  font-weight: 900;
  letter-spacing: -3.5px;
  font-size: clamp(2.7rem, 9vw, 4.5rem);
  line-height: 1.02;
  margin: 0;
}
.dc {
  color: var(--purple);
  position: relative;
  display: inline-block;
}
.dc:after {
  content: "";
  position: absolute;
  bottom: -4px;
  left: 1px;
  right: 8px;
  height: 4px;
  background: var(--purple);
  transform: rotate(-4deg);
  border-radius: 100%;
}
.question {
  display: inline-block;
  transform: rotate(8deg);
}
.subtitle {
  font-size: 1rem;
  margin: 17px 0 27px;
  color: #625570;
}
.game {
  max-width: 340px;
  margin: auto;
}
.stage {
  position: relative;
  margin: 0 auto;
  width: min(100%, 300px);
}
.card {
  border: 2px solid var(--ink);
  background: var(--mint);
  border-radius: 19px;
  box-shadow: 6px 7px 0 var(--ink);
  overflow: hidden;
  transform: rotate(-2deg);
}
.card-top,
.card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 15px;
  font-size: 0.625rem;
  font-weight: 800;
  letter-spacing: 1.1px;
}
.card-top {
  border-bottom: 1.5px solid var(--ink);
}
.card-bottom {
  border-top: 1.5px solid var(--ink);
  min-height: 43px;
}
.card-bottom span:last-child {
  font-size: 1rem;
}
.portrait-area {
  position: relative;
  height: 246px;
  overflow: hidden;
  background: #eeffda;
  display: grid;
  place-items: center;
  background-image:
    linear-gradient(#acd08340 1px, transparent 1px),
    linear-gradient(90deg, #acd08340 1px, transparent 1px);
  background-size: 24px 24px;
}
#avatar {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
}
#avatar svg {
  width: 90%;
  height: 100%;
}
#winner {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 40%;
  background: white;
}
#winner.action {
  object-fit: contain;
}
.corner {
  position: absolute;
  width: 17px;
  height: 17px;
  border: 2px solid #221a3560;
  pointer-events: none;
}
.corner-tl {
  top: 12px;
  left: 12px;
  border-right: 0;
  border-bottom: 0;
}
.corner-tr {
  top: 12px;
  right: 12px;
  border-left: 0;
  border-bottom: 0;
}
.corner-bl {
  bottom: 12px;
  left: 12px;
  border-top: 0;
  border-right: 0;
}
.corner-br {
  bottom: 12px;
  right: 12px;
  border-top: 0;
  border-left: 0;
}
.spark {
  position: absolute;
  z-index: 2;
  pointer-events: none;
}
.spark-left {
  left: -28px;
  top: 30px;
  color: var(--purple);
  font-size: 47px;
  transform: rotate(-10deg);
}
.spark-right {
  right: -20px;
  bottom: 27px;
  color: #ff784f;
  font-size: 52px;
  -webkit-text-stroke: 1px var(--ink);
}
.stamp {
  position: absolute;
  right: -19px;
  top: -16px;
  z-index: 3;
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 80px;
  height: 80px;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
  background: #ff916b;
  font-size: 0.5625rem;
  line-height: 1.5;
  letter-spacing: 0.8px;
  transform: rotate(12deg);
  box-shadow: 2px 2px 0 var(--ink);
}
.stamp strong {
  font-size: 0.625rem;
}
.readout {
  margin-top: 28px;
  min-height: 112px;
}
.progress-label {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.875rem;
  font-weight: 700;
  text-align: left;
}
#countdown {
  font-variant-numeric: tabular-nums;
  color: var(--purple);
}
progress {
  display: block;
  width: 100%;
  height: 10px;
  border: 1.5px solid var(--ink);
  border-radius: 99px;
  margin-top: 11px;
  background: #fff;
  overflow: hidden;
  appearance: none;
}
progress::-webkit-progress-bar {
  background: #fff;
}
progress::-webkit-progress-value {
  background: var(--purple);
}
progress::-moz-progress-bar {
  background: var(--purple);
}
#hint {
  font-size: 0.75rem;
  color: #6f617e;
  margin: 12px 0 0;
}
#result .eyebrow {
  color: var(--purple);
  margin-bottom: 5px;
}
h2 {
  font-family: Decider, "Arial Black", Arial, sans-serif;
  font-size: clamp(1.7rem, 7vw, 2.3rem);
  font-weight: 900;
  letter-spacing: -1.2px;
  margin: 0;
}
#result > p:last-child {
  font-size: 0.875rem;
  color: #625570;
  margin: 8px 0 16px;
}
button {
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: var(--ink);
  color: #fff;
  width: 100%;
  min-height: 50px;
  padding: 10px 20px;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: 3px 3px 0 #9a80c7;
  touch-action: manipulation;
  transition:
    transform 0.15s,
    box-shadow 0.15s;
}
button span:first-child {
  font-size: 1.4rem;
  vertical-align: -1px;
  margin-right: 6px;
}
button:hover {
  background: #3e2b5d;
  transform: translateY(-2px);
}
button:active {
  transform: translate(2px, 2px);
  box-shadow: none;
}
button:focus-visible {
  outline: 3px solid var(--purple);
  outline-offset: 5px;
}
#crown {
  position: absolute;
  top: 7px;
  right: 9px;
  font-size: 45px;
  color: #fdd549;
  line-height: 1;
  text-shadow: 2px 2px var(--ink);
  transform: rotate(13deg);
}
#confetti {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
}
.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;
}
.noscript {
  padding: 15px;
  border: 2px solid var(--ink);
  border-radius: 12px;
}
[data-state="winner"] .card {
  background: #ffe675;
  animation: reveal 0.55s cubic-bezier(0.2, 1.5, 0.4, 1) both;
}
[data-state="winner"] .stamp {
  background: #c5f786;
}
[data-state="winner"] .portrait-area {
  background: white;
}
[data-state="winner"] .readout {
  margin-top: 24px;
}
[data-state="error"] button {
  margin-top: 16px;
}
@keyframes reveal {
  from {
    transform: rotate(-5deg) scale(0.9);
  }
  to {
    transform: rotate(2deg) scale(1);
  }
}
@media (min-width: 700px) {
  .masthead {
    padding-top: 28px;
  }
  main {
    padding-top: 30px;
    padding-bottom: 26px;
  }
  .subtitle {
    margin-bottom: 35px;
  }
  .stage {
    width: 300px;
  }
  .portrait-area {
    height: 270px;
  }
  .readout {
    margin-top: 32px;
  }
}
@media (max-height: 760px) and (max-width: 699px) {
  .masthead {
    padding-top: 15px;
    padding-bottom: 8px;
  }
  main {
    padding-top: 8px;
    padding-bottom: 8px;
  }
  .intro h1 {
    font-size: clamp(2.7rem, 10vw, 3.4rem);
  }
  .eyebrow {
    margin-bottom: 9px;
  }
  .subtitle {
    margin: 12px 0 22px;
  }
  .stage {
    max-width: 264px;
  }
  .portrait-area {
    height: 208px;
  }
  .card-top,
  .card-bottom {
    padding: 9px 12px;
  }
  .card-bottom {
    min-height: 34px;
  }
  .readout {
    margin-top: 23px;
    min-height: 95px;
  }
  .stamp {
    width: 70px;
    height: 70px;
    right: -12px;
  }
  #result > p:last-child {
    margin: 6px 0 12px;
  }
  button {
    min-height: 46px;
  }
}
@media (max-width: 350px) {
  main {
    padding-left: 25px;
    padding-right: 25px;
  }
  .intro h1 {
    letter-spacing: -2.5px;
  }
  .stage {
    max-width: 240px;
  }
  .portrait-area {
    height: 188px;
  }
  .spark-left {
    left: -20px;
    font-size: 38px;
  }
  .spark-right {
    right: -13px;
    font-size: 42px;
  }
  .progress-label {
    font-size: 0.75rem;
  }
  .intro .eyebrow {
    font-size: 0.5625rem;
    letter-spacing: 1.2px;
  }
  .subtitle {
    font-size: 0.875rem;
  }
  .stamp {
    width: 65px;
    height: 65px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *:before,
  *:after {
    animation: none !important;
    transition: none !important;
  }
}
