:root {
  color-scheme: light;
  --ink: #263047;
  --muted: #586179;
  --panel: rgba(255, 255, 255, 0.9);
  --shadow: 0 18px 38px rgba(57, 78, 116, 0.18);
  --tomato: #ff5c67;
  --carrot: #ff9f35;
  --corn: #ffd84d;
  --pea: #55c979;
  --sky: #64d7f5;
  --berry: #b765ff;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  font-family: ui-rounded, "SF Pro Rounded", "Comic Sans MS", system-ui, sans-serif;
  background:
    radial-gradient(circle at 13% 15%, rgba(255, 216, 77, 0.82) 0 8vw, transparent calc(8vw + 2px)),
    radial-gradient(circle at 86% 18%, rgba(100, 215, 245, 0.62) 0 9vw, transparent calc(9vw + 2px)),
    radial-gradient(circle at 82% 88%, rgba(85, 201, 121, 0.48) 0 10vw, transparent calc(10vw + 2px)),
    linear-gradient(135deg, #ffe982 0%, #ffd0a0 34%, #ffacd1 66%, #a8ecff 100%);
}

button {
  border: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
}

button:disabled {
  cursor: not-allowed;
  filter: grayscale(0.7);
  opacity: 0.58;
}

button:focus-visible,
a:focus-visible {
  outline: 4px solid #263047;
  outline-offset: 3px;
}

.game-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
  width: min(1220px, calc(100vw - 28px));
  height: min(860px, calc(100vh - 28px));
  margin: 14px auto;
}

.topbar {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) minmax(190px, auto);
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border: 4px solid rgba(255, 255, 255, 0.86);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.home-link {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  border-radius: 8px;
  color: white;
  background: #ff6f9d;
  box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.15), 0 5px 0 rgba(38, 48, 71, 0.14);
  font-size: 2rem;
  font-weight: 950;
  line-height: 1;
  text-decoration: none;
}

.title-block {
  min-width: 0;
}

.title-block p {
  margin: 0 0 2px;
  color: #a24800;
  font-size: 0.85rem;
  font-weight: 950;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1;
  letter-spacing: 0;
}

h1 {
  overflow-wrap: anywhere;
  font-size: clamp(1.8rem, 4vw, 3.6rem);
}

h2 {
  font-size: 1rem;
}

.status-pill {
  justify-self: end;
  max-width: 100%;
  padding: 12px 15px;
  border-radius: 8px;
  color: white;
  background: #2e8c66;
  box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.16);
  font-size: 1rem;
  font-weight: 950;
  text-align: center;
}

.layout {
  display: grid;
  grid-template-columns: 226px minmax(0, 1fr) 232px;
  min-height: 0;
  gap: 14px;
}

.cookbook,
.pantry,
.stage {
  min-width: 0;
  border: 4px solid rgba(255, 255, 255, 0.86);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.cookbook,
.pantry {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 12px;
}

.panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.panel-title span {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: white;
  box-shadow: inset 0 -4px 0 rgba(38, 48, 71, 0.1);
  font-size: 1.45rem;
}

.recipe-buttons,
.ingredient-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.recipe-button,
.ingredient-button,
.wide-button {
  border-radius: 8px;
  background: white;
  box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.1), 0 4px 0 rgba(38, 48, 71, 0.13);
  font-weight: 950;
  transition: transform 140ms ease, filter 140ms ease, background 140ms ease;
}

.recipe-button:hover,
.ingredient-button:hover,
.wide-button:hover {
  transform: translateY(-2px);
  filter: saturate(1.08);
}

.recipe-button {
  display: grid;
  justify-items: center;
  align-items: center;
  gap: 5px;
  min-height: 64px;
  padding: 7px;
  text-align: center;
}

.recipe-button .recipe-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: var(--recipe-color);
  font-size: 1.45rem;
}

.recipe-button.active {
  color: white;
  background: #5a49d7;
}

.recipe-button strong {
  overflow: hidden;
  max-width: 100%;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.78rem;
}

.recipe-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.5) 0 18px, transparent 18px 34px),
    #fff7d1;
}

.recipe-card strong {
  font-size: 1.04rem;
  line-height: 1.1;
}

.recipe-steps {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.recipe-steps li {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  align-items: center;
  min-height: 36px;
  gap: 8px;
  padding: 5px 7px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  color: #62605a;
  font-size: 0.86rem;
  font-weight: 900;
}

.recipe-steps li.current {
  color: #263047;
  background: #ffffff;
  box-shadow: 0 0 0 3px #ffd84d;
}

.recipe-steps li.done {
  color: white;
  background: #38a96a;
}

.recipe-steps .step-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.84);
  font-size: 1.15rem;
}

.stage {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

.stage-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.54);
}

.self-card {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-width: 0;
  position: relative;
}

.hair {
  position: absolute;
  z-index: 2;
  left: 9px;
  top: 1px;
  width: 64px;
  height: 34px;
  border-radius: 36px 36px 14px 14px;
  background:
    radial-gradient(circle at 12px 28px, #67391f 0 13px, transparent 14px),
    radial-gradient(circle at 25px 16px, #67391f 0 16px, transparent 17px),
    radial-gradient(circle at 43px 16px, #67391f 0 16px, transparent 17px),
    radial-gradient(circle at 56px 28px, #67391f 0 13px, transparent 14px);
}

.face {
  position: relative;
  width: 74px;
  height: 78px;
  border-radius: 50% 50% 44% 44%;
  background: #f0bd89;
  box-shadow: inset 0 -7px 0 rgba(38, 48, 71, 0.1);
}

.eye {
  position: absolute;
  top: 35px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #263047;
}

.eye.left {
  left: 23px;
}

.eye.right {
  right: 23px;
}

.mouth {
  position: absolute;
  left: 50%;
  bottom: 16px;
  width: 22px;
  height: 12px;
  border: 4px solid #263047;
  border-top: 0;
  border-radius: 0 0 18px 18px;
  transform: translateX(-50%);
}

.mouth.slurp {
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 50%;
  background: #263047;
  animation: munch 420ms ease;
}

.self-card strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 1.1rem;
}

.progress-card {
  display: grid;
  justify-items: center;
  gap: 2px;
  min-width: 110px;
  padding: 9px 12px;
  border-radius: 8px;
  background: white;
  box-shadow: inset 0 -4px 0 rgba(38, 48, 71, 0.1);
  font-weight: 950;
}

.progress-card span {
  color: var(--muted);
  font-size: 0.8rem;
}

.kitchen {
  position: relative;
  min-height: 0;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.36), rgba(255, 255, 255, 0)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.45) 0 40px, rgba(255, 255, 255, 0.2) 40px 80px),
    linear-gradient(180deg, #b9f0ff 0 52%, #fff1b8 52% 100%);
}

.counter {
  position: absolute;
  inset: auto 0 0;
  height: 31%;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.2) 0 24px, transparent 24px 48px),
    linear-gradient(#ffb15e, #e98033);
  box-shadow: inset 0 8px 0 rgba(255, 255, 255, 0.32);
}

.pot-zone {
  position: absolute;
  left: 50%;
  bottom: 8%;
  width: min(50%, 380px);
  aspect-ratio: 1.18;
  transform: translateX(-50%);
}

.pot {
  position: absolute;
  inset: 18% 4% 0;
}

.pot-lip {
  position: absolute;
  z-index: 4;
  left: 50%;
  top: 10%;
  width: 82%;
  height: 23%;
  border-radius: 50%;
  background:
    radial-gradient(ellipse at 50% 42%, rgba(255, 255, 255, 0.9) 0 35%, transparent 36%),
    linear-gradient(#fdfff7, #dfe8ed);
  box-shadow: inset 0 -10px 0 rgba(38, 48, 71, 0.1), 0 8px 0 rgba(38, 48, 71, 0.12);
  transform: translateX(-50%);
}

.soup-surface {
  position: absolute;
  z-index: 5;
  left: 50%;
  top: 15%;
  width: 68%;
  height: 15%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 26% 48%, rgba(255, 255, 255, 0.46) 0 9px, transparent 10px),
    radial-gradient(circle at 58% 38%, rgba(255, 255, 255, 0.36) 0 7px, transparent 8px),
    var(--soup-color, #ffa53d);
  box-shadow: inset 0 -7px 0 rgba(124, 55, 22, 0.13);
  transform: translateX(-50%);
  transition: background 180ms ease;
}

.pot-body {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 18%;
  width: 76%;
  height: 70%;
  border-radius: 16% 16% 32% 32%;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.36) 0 18%, transparent 18% 78%, rgba(38, 48, 71, 0.12) 78% 100%),
    #54b4e7;
  box-shadow: inset 0 -20px 0 rgba(38, 48, 71, 0.12), 0 14px 0 rgba(38, 48, 71, 0.14);
  transform: translateX(-50%);
}

.pot-handle {
  position: absolute;
  top: 34%;
  z-index: 1;
  width: 22%;
  height: 26%;
  border: 17px solid #3690c8;
  border-radius: 50%;
}

.pot-handle.left {
  left: 0;
}

.pot-handle.right {
  right: 0;
}

.pot-ingredients {
  position: absolute;
  z-index: 6;
  left: 20%;
  top: 10%;
  width: 60%;
  height: 28%;
  pointer-events: none;
}

.pot-bit {
  position: absolute;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.62);
  font-size: 1.35rem;
  animation: plop 420ms ease both;
}

.steam {
  position: absolute;
  z-index: 0;
  bottom: 73%;
  width: 28px;
  height: 80px;
  border-radius: 999px;
  border: 6px solid rgba(255, 255, 255, 0.74);
  border-left: 0;
  border-bottom: 0;
  animation: steam 2.8s ease-in-out infinite;
}

.steam.one {
  left: 35%;
}

.steam.two {
  left: 50%;
  animation-delay: -0.8s;
}

.steam.three {
  left: 65%;
  animation-delay: -1.5s;
}

.ingredient-button {
  display: grid;
  justify-items: center;
  align-items: center;
  gap: 4px;
  min-height: 72px;
  padding: 7px 6px;
  text-align: center;
}

.ingredient-button .ingredient-picture {
  display: grid;
  place-items: center;
  width: 42px;
  height: 38px;
  border-radius: 8px;
  background: var(--ingredient-color);
  box-shadow: inset 0 -5px 0 rgba(38, 48, 71, 0.12);
  font-size: 1.45rem;
}

.ingredient-button strong {
  overflow: hidden;
  max-width: 100%;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.74rem;
}

.ingredient-button.next {
  background: #fff5bf;
  box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.1), 0 0 0 4px #ffd84d, 0 4px 0 rgba(38, 48, 71, 0.13);
}

.ingredient-button.wrong {
  animation: shake 280ms ease;
}

.wide-button {
  width: 100%;
  min-height: 54px;
  padding: 10px 12px;
}

.reset-button {
  color: white;
  background: #ff6f9d;
}

.serve-button {
  color: white;
  background: #2e8c66;
}

.spoon {
  position: absolute;
  z-index: 15;
  left: calc(50% + 160px);
  top: calc(50% + 20px);
  width: 152px;
  height: 56px;
  padding: 0;
  border-radius: 8px;
  background: transparent;
  filter: drop-shadow(0 9px 0 rgba(38, 48, 71, 0.14));
  transform: rotate(-20deg);
  transition: transform 120ms ease, opacity 160ms ease;
}

.spoon.hidden,
.bowls.hidden {
  pointer-events: none;
  opacity: 0;
}

.spoon.dragging {
  transition: none;
  transform: rotate(-10deg) scale(1.05);
}

.spoon.full .spoon-bowl {
  background:
    radial-gradient(circle at 50% 50%, var(--soup-color, #ffa53d) 0 42%, transparent 43%),
    linear-gradient(#f7fbff, #cbd8df);
}

.spoon-bowl {
  position: absolute;
  left: 0;
  top: 6px;
  width: 62px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(#f7fbff, #cbd8df);
  box-shadow: inset 0 -7px 0 rgba(38, 48, 71, 0.12);
}

.spoon-handle {
  position: absolute;
  left: 50px;
  top: 22px;
  width: 98px;
  height: 13px;
  border-radius: 999px;
  background: linear-gradient(#ffffff, #cad7df);
  transform: rotate(4deg);
}

.bowls {
  position: absolute;
  z-index: 8;
  left: 50%;
  bottom: 7%;
  display: grid;
  grid-template-columns: repeat(4, 72px);
  justify-content: center;
  gap: 14px;
  padding: 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
  transform: translateX(-50%);
  transition: opacity 160ms ease;
}

.bowl {
  position: relative;
  width: 72px;
  height: 54px;
  border-radius: 16px 16px 36px 36px;
  background:
    radial-gradient(ellipse at 50% 15%, var(--fill, transparent) 0 42%, transparent 43%),
    linear-gradient(#ffffff, #e6f2f4);
  box-shadow: inset 0 -8px 0 rgba(38, 48, 71, 0.1), 0 7px 0 rgba(38, 48, 71, 0.12);
}

.bowl::before {
  position: absolute;
  left: 14px;
  top: -11px;
  width: 44px;
  height: 20px;
  border-radius: 50%;
  background: #faffff;
  content: "";
}

.bowl.served {
  --fill: var(--soup-color, #ffa53d);
  animation: bounce 360ms ease;
}

.sparkle-layer {
  position: absolute;
  inset: 0;
  z-index: 30;
  pointer-events: none;
}

.sparkle {
  position: absolute;
  width: 18px;
  height: 18px;
  background: var(--sparkle-color, #ffd84d);
  clip-path: polygon(50% 0, 62% 34%, 98% 35%, 68% 56%, 79% 91%, 50% 70%, 21% 91%, 32% 56%, 2% 35%, 38% 34%);
  animation: sparkle 760ms ease-out forwards;
}

@keyframes plop {
  from {
    opacity: 0;
    transform: translateY(-38px) scale(1.7) rotate(-18deg);
  }
}

@keyframes steam {
  50% {
    opacity: 0.45;
    transform: translateY(-18px) scaleX(1.16);
  }
}

@keyframes shake {
  25% {
    transform: translateX(-7px);
  }
  50% {
    transform: translateX(7px);
  }
  75% {
    transform: translateX(-4px);
  }
}

@keyframes bounce {
  45% {
    transform: translateY(-8px);
  }
}

@keyframes sparkle {
  to {
    opacity: 0;
    transform: translate(var(--dx), var(--dy)) rotate(90deg) scale(0.4);
  }
}

@keyframes munch {
  50% {
    transform: translateX(-50%) scale(1.28);
  }
}

@media (max-width: 980px) {
  body {
    overflow: auto;
  }

  .game-shell {
    height: auto;
  }

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

  .stage {
    min-height: 560px;
  }

  .pantry {
    grid-row: 2;
  }

  .ingredient-buttons {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .topbar,
  .stage-top {
    grid-template-columns: 1fr;
  }

  .home-link,
  .status-pill {
    justify-self: start;
  }

  .ingredient-buttons {
    grid-template-columns: 1fr;
  }

  .bowls {
    grid-template-columns: repeat(2, 72px);
  }
}
