:root {
  --ink: #252018;
  --cream: #fff9e8;
  --yellow: #ffd83d;
  --orange: #ff8a2a;
  --red: #ee4b2b;
  --green: #285943;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 14% 18%, rgba(255, 255, 255, 0.75) 0 4px, transparent 5px),
    radial-gradient(circle at 84% 72%, rgba(255, 255, 255, 0.55) 0 3px, transparent 4px),
    linear-gradient(150deg, #ffef99 0%, #ffc946 48%, #f6a62e 100%);
  background-size:
    80px 80px,
    105px 105px,
    auto;
  font-family: ui-rounded, 'Arial Rounded MT Bold', system-ui, sans-serif;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    115deg,
    transparent 0 70px,
    rgba(89, 59, 20, 0.035) 71px 73px
  );
}

a {
  color: inherit;
}

header {
  position: relative;
  z-index: 2;
  width: min(1050px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.2rem 0 0;
}

.home-link {
  display: inline-flex;
  gap: 0.35rem;
  align-items: center;
  font-size: 0.85rem;
  font-weight: 900;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.09em;
}

.home-link:hover {
  text-decoration: underline;
}

main {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(260px, 0.72fr) minmax(360px, 1.28fr);
  gap: clamp(1.5rem, 5vw, 5rem);
  align-items: center;
  width: min(1050px, calc(100% - 2rem));
  min-height: calc(100vh - 3.5rem);
  margin: 0 auto;
  padding: 2rem 0 4rem;
}

.eyebrow {
  margin: 0 0 0.7rem;
  color: var(--green);
  font-size: 0.76rem;
  font-weight: 950;
  letter-spacing: 0.17em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  max-width: 7ch;
  font-size: clamp(3.5rem, 9vw, 7.3rem);
  line-height: 0.78;
  letter-spacing: -0.085em;
  text-transform: uppercase;
  transform: rotate(-2deg);
  text-shadow: 5px 5px 0 rgba(255, 255, 255, 0.45);
}

.lede {
  max-width: 31rem;
  margin: 1.5rem 0 1.8rem;
  font-size: 1.08rem;
  line-height: 1.55;
}
.lede strong {
  color: #8d331e;
}

.rules {
  display: grid;
  gap: 0.7rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.rules li {
  display: flex;
  gap: 0.7rem;
  align-items: center;
  font-weight: 750;
}
.rule-icon {
  display: grid;
  flex: 0 0 2rem;
  width: 2rem;
  height: 2rem;
  place-items: center;
  border: 2px solid;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.34);
}

.game-card {
  position: relative;
  min-height: min(690px, 76vh);
  overflow: hidden;
  border: 3px solid var(--ink);
  border-radius: 38px;
  background: var(--cream);
  box-shadow:
    12px 14px 0 rgba(62, 43, 20, 0.2),
    inset 0 -10px 0 rgba(236, 195, 87, 0.22);
  isolation: isolate;
}

.card-top {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  border-bottom: 2px dashed rgba(37, 32, 24, 0.25);
}
.label {
  color: #766a58;
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.value {
  display: block;
  margin-top: 0.15rem;
  font-size: 1.15rem;
  font-weight: 950;
}
#streak {
  text-align: right;
}

.stage {
  position: relative;
  display: grid;
  min-height: 460px;
  place-items: center;
  padding: 3rem 1rem 2rem;
}

.sunburst {
  position: absolute;
  width: 90%;
  aspect-ratio: 1;
  border-radius: 50%;
  opacity: 0.18;
  background: repeating-conic-gradient(from 5deg, var(--orange) 0 10deg, transparent 10deg 24deg);
  animation: spin 35s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(1turn);
  }
}

.canary-button {
  --bird-scale: 0.72;
  position: relative;
  z-index: 2;
  width: min(78%, 356px);
  height: 350px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  outline-offset: 10px;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
  will-change: transform;
}

.bird-art {
  display: block;
  width: 100%;
  transform: scale(var(--bird-scale));
  transition: transform 0.2s ease-out;
  transform-origin: 50% 58%;
  will-change: transform;
}
.canary-button svg {
  display: block;
  width: 100%;
  overflow: visible;
  filter: drop-shadow(0 15px 4px rgba(92, 60, 10, 0.16));
}
.canary-button:hover {
  filter: brightness(1.025);
}
.canary-button:active {
  transform: scale(0.96);
}
.canary-button.bump {
  animation: bump 0.18s ease-out;
}
.canary-button.rattle {
  animation: rattle 0.23s ease-in-out;
}
.canary-button.panic {
  animation: panic 0.19s linear;
}
@keyframes bump {
  50% {
    transform: scale(0.94) rotate(-2deg);
  }
}
@keyframes rattle {
  25% {
    transform: translateX(-7px) rotate(-3deg);
  }
  65% {
    transform: translateX(7px) rotate(3deg);
  }
}
@keyframes panic {
  25% {
    transform: translate(-9px, 2px) rotate(-4deg);
  }
  50% {
    transform: translate(7px, -5px) rotate(4deg);
  }
  75% {
    transform: translate(-5px, -2px) rotate(-2deg);
  }
}

.expression {
  opacity: 0;
  transition: opacity 0.16s ease;
}
.face-calm {
  opacity: 1;
  transition: opacity 0.16s ease;
}
.stage[data-mood='uneasy'] .face-calm,
.stage[data-mood='worried'] .face-calm,
.stage[data-mood='panic'] .face-calm {
  opacity: 0;
}
.stage[data-mood='uneasy'] .face-uneasy,
.stage[data-mood='worried'] .face-worried,
.stage[data-mood='panic'] .face-panic {
  opacity: 1;
}

.hint {
  position: relative;
  z-index: 2;
  margin: 1.2rem 0 0;
  font-size: 1.05rem;
  font-weight: 900;
  text-align: center;
}
.hint small {
  display: block;
  margin-top: 0.35rem;
  color: #766a58;
  font-weight: 650;
}

.meter-wrap {
  padding: 0 1.5rem 1.5rem;
}
.meter-head {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  color: #766a58;
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.meter {
  height: 15px;
  overflow: hidden;
  border: 2px solid var(--ink);
  border-radius: 99px;
  background: #ded5c1;
}
.meter-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ffd83d 0%, #ff8a2a 65%, #ee4b2b 100%);
  transition: width 0.18s ease-out;
}

.overlay {
  position: absolute;
  z-index: 5;
  inset: 0;
  display: grid;
  place-content: center;
  padding: 2rem;
  text-align: center;
  background: rgba(255, 249, 232, 0.9);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s;
}
.overlay.show {
  opacity: 1;
  visibility: visible;
}
.boom {
  margin: 0;
  color: var(--red);
  font-size: clamp(4rem, 13vw, 8rem);
  line-height: 0.8;
  letter-spacing: -0.08em;
  text-transform: uppercase;
  transform: rotate(-6deg);
  text-shadow: 5px 5px 0 var(--yellow);
}
.result {
  margin: 1.2rem 0;
  font-size: 1.05rem;
  font-weight: 800;
}
.again {
  justify-self: center;
  border: 2px solid var(--ink);
  border-radius: 99px;
  padding: 0.85rem 1.5rem;
  color: white;
  background: var(--green);
  box-shadow: 4px 5px 0 var(--ink);
  font: inherit;
  font-weight: 950;
  cursor: pointer;
}
.again:active {
  transform: translate(3px, 3px);
  box-shadow: 1px 2px 0 var(--ink);
}

.particle {
  position: absolute;
  z-index: 4;
  left: 50%;
  top: 48%;
  width: 18px;
  height: 18px;
  border: 2px solid var(--ink);
  background: var(--yellow);
  pointer-events: none;
  animation: fly 800ms cubic-bezier(0.1, 0.7, 0.3, 1) forwards;
}
@keyframes fly {
  to {
    translate: var(--x) var(--y);
    rotate: var(--r);
    opacity: 0;
    scale: 0.4;
  }
}

@media (max-width: 760px) {
  main {
    grid-template-columns: 1fr;
    padding-top: 1.3rem;
  }
  h1 {
    max-width: none;
    font-size: clamp(3.4rem, 19vw, 6rem);
  }
  .lede {
    margin: 1.2rem 0;
  }
  .rules {
    display: none;
  }
  .game-card {
    min-height: 535px;
    border-radius: 28px;
  }
  .stage {
    min-height: 450px;
    padding: 1.25rem 1rem 0.75rem;
    overflow: hidden;
  }
  .canary-button {
    width: min(82vw, 320px);
    height: 350px;
  }
  .hint {
    margin-top: 0;
  }
}

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