:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #0d1014;
  color: #fff7e8;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background: #121418;
}

button {
  font: inherit;
}

.app {
  width: min(1180px, 100%);
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 360px;
  grid-template-rows: auto 1fr;
  gap: 18px;
  margin: 0 auto;
  padding: 24px;
}

.scoreboard {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(255, 247, 232, 0.18);
}

.eyebrow {
  margin: 0 0 5px;
  color: #00d5ff;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(40px, 7vw, 88px);
  line-height: 0.92;
  letter-spacing: 0;
}

.title-lockup {
  display: flex;
  align-items: center;
  gap: 18px;
}

.evil-tag {
  display: inline-grid;
  place-items: center;
  min-width: 118px;
  min-height: 54px;
  border: 4px solid #fff7e8;
  border-radius: 8px;
  background: #e60012;
  color: #fff7e8;
  font-size: clamp(28px, 4vw, 50px);
  font-weight: 950;
  letter-spacing: 0.04em;
  line-height: 1;
  text-transform: uppercase;
  transform: rotate(-10deg);
  box-shadow: 7px 7px 0 #450006;
}

.stats {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  gap: 10px;
}

.stats div,
.upgrade {
  border: 1px solid rgba(255, 247, 232, 0.18);
  border-radius: 8px;
  background: rgba(13, 16, 20, 0.72);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.24);
}

.stats div {
  position: relative;
  min-height: 82px;
  display: grid;
  align-content: center;
  padding: 14px;
}

.score-pile.under-attack {
  animation: robbed 0.18s linear infinite;
}

.stats span {
  font-size: 30px;
  font-weight: 900;
}

.stats small {
  color: #c9bfac;
}

.arena {
  position: relative;
  display: grid;
  place-items: center;
  align-content: center;
  min-height: 580px;
  overflow: hidden;
}

.cookie {
  width: min(390px, 78vw);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 10px solid #5a2b16;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 28%, #3b2012 0 5%, transparent 6%),
    radial-gradient(circle at 66% 35%, #3b2012 0 6%, transparent 7%),
    radial-gradient(circle at 44% 68%, #3b2012 0 5%, transparent 6%),
    radial-gradient(circle at 71% 70%, #3b2012 0 4%, transparent 5%),
    #c97832;
  color: #261107;
  box-shadow:
    inset -28px -34px 0 rgba(63, 28, 11, 0.22),
    0 28px 80px rgba(0, 0, 0, 0.38);
  cursor: pointer;
  transition: transform 0.08s ease, filter 0.2s ease;
}

.cookie:hover {
  filter: saturate(1.08);
}

.cookie:active {
  transform: scale(0.96) rotate(3deg);
}

.cookie.broken {
  animation: lie 0.32s steps(2) infinite;
  cursor: wait;
}

.cookie-face {
  font-size: clamp(60px, 14vw, 120px);
  font-weight: 950;
  transform: rotate(-7deg);
}

.headline {
  width: min(620px, 100%);
  min-height: 72px;
  margin: 28px 0 0;
  color: #fff7e8;
  font-size: clamp(20px, 3vw, 34px);
  font-weight: 900;
  line-height: 1.12;
  text-align: center;
}

.floaters {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.grandma {
  position: absolute;
  z-index: 3;
  right: -42px;
  top: -54px;
  width: 118px;
  height: 118px;
  display: grid;
  place-items: center;
  border: 6px solid #fff7e8;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 16%, #f5f0e4 0 15%, transparent 16%),
    radial-gradient(circle at 36% 41%, #111 0 5%, transparent 6%),
    radial-gradient(circle at 64% 41%, #111 0 5%, transparent 6%),
    linear-gradient(#b477ff, #5f2bb8);
  color: #fff7e8;
  box-shadow: 0 18px 60px rgba(255, 68, 68, 0.38);
  cursor: pointer;
  animation: grandmaDrift 1.2s ease-in-out infinite;
}

.grandma.hidden,
.deal.hidden {
  display: none;
}

.grandma-face {
  font-size: 32px;
  font-weight: 950;
}

.grandma-text {
  position: absolute;
  bottom: -30px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #ff4444;
  color: #fff7e8;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  white-space: nowrap;
}

.floater {
  position: absolute;
  color: #ff4444;
  font-size: 26px;
  font-weight: 950;
  animation: floatUp 0.85s ease-out forwards;
}

.shop {
  display: grid;
  align-content: start;
  gap: 12px;
}

.upgrade {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 18px;
}

.upgrade h2 {
  margin: 0 0 6px;
  font-size: 19px;
}

.upgrade p {
  margin: 0;
  color: #c9bfac;
  line-height: 1.35;
}

.deal {
  display: inline-block;
  margin-bottom: 8px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #ff4444;
  color: #fff7e8;
  font-size: 11px;
  font-weight: 950;
  text-transform: uppercase;
}

.buy {
  width: 96px;
  min-height: 58px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: #00d5ff;
  color: #071114;
  cursor: pointer;
}

.buy:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.buy span {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.buy strong {
  font-size: 20px;
}

@keyframes floatUp {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(-90px) scale(1.5);
  }
}

@keyframes lie {
  0%, 100% {
    transform: translateX(0) rotate(0);
    filter: grayscale(0);
  }
  50% {
    transform: translateX(9px) rotate(-5deg);
    filter: grayscale(1);
  }
}

@keyframes grandmaDrift {
  0%, 100% {
    transform: translate(0, 0) rotate(-9deg);
  }
  50% {
    transform: translate(-12px, 8px) rotate(8deg);
  }
}

@keyframes robbed {
  0%, 100% {
    transform: translateX(0);
    box-shadow: 0 18px 60px rgba(255, 68, 68, 0.22);
  }
  50% {
    transform: translateX(-5px);
    box-shadow: 0 18px 60px rgba(255, 68, 68, 0.55);
  }
}

@media (max-width: 860px) {
  .app {
    grid-template-columns: 1fr;
    padding: 18px;
  }

  .scoreboard {
    align-items: stretch;
    flex-direction: column;
  }

  .title-lockup {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .evil-tag {
    min-width: 96px;
    min-height: 44px;
  }

  .arena {
    min-height: 500px;
  }
}

@media (max-width: 520px) {
  .stats {
    grid-template-columns: 1fr 1fr;
  }

  .stats div {
    min-height: 72px;
    padding: 12px;
  }

  .stats span {
    font-size: 24px;
  }

  .upgrade {
    grid-template-columns: 1fr;
  }

  .buy {
    width: 100%;
  }
}
