:root {
  color-scheme: light;
  --ink: #243049;
  --muted: #5d697e;
  --paper: rgba(255, 255, 255, 0.86);
  --green: #31b86f;
  --mint: #82dfb2;
  --blue: #56bdf2;
  --yellow: #ffe16a;
  --orange: #ff9a42;
  --pink: #ff6f9e;
  --red: #ef5064;
  --shadow: 0 18px 42px rgba(36, 48, 73, 0.18);
}

* {
  box-sizing: border-box;
}

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

body {
  min-width: 320px;
  min-height: 100svh;
  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% 14%, rgba(255, 225, 106, 0.92) 0 96px, transparent 98px),
    radial-gradient(circle at 86% 13%, rgba(130, 223, 178, 0.64) 0 108px, transparent 110px),
    radial-gradient(circle at 84% 88%, rgba(255, 111, 158, 0.38) 0 128px, transparent 130px),
    linear-gradient(135deg, #a8e7ff 0%, #fff2a0 38%, #ffc9dc 72%, #c8f5cf 100%);
}

button,
a {
  color: inherit;
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}

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

a {
  text-decoration: none;
}

.game-shell {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: clamp(10px, 2vw, 18px);
  width: min(1280px, 100vw);
  height: 100svh;
  margin: 0 auto;
  padding: clamp(10px, 2vw, 18px);
}

.topbar {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) minmax(156px, auto);
  align-items: center;
  gap: 12px;
}

.home-link {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border: 4px solid rgba(255, 255, 255, 0.78);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 0 8px 0 rgba(36, 48, 73, 0.14), var(--shadow);
  font-size: 1.45rem;
  font-weight: 1000;
}

.eyebrow,
h1,
h2,
p {
  margin: 0;
}

.eyebrow {
  color: #287f5a;
  font-size: clamp(0.74rem, 1.8vw, 0.9rem);
  font-weight: 950;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  font-size: clamp(2rem, 7vw, 4.7rem);
  line-height: 0.94;
  letter-spacing: 0;
  text-shadow: 0 4px 0 rgba(255, 255, 255, 0.6);
}

.scoreboard {
  display: grid;
  grid-template-columns: repeat(2, minmax(86px, 1fr));
  gap: 8px;
}

.scoreboard span {
  display: grid;
  place-items: center;
  min-height: 50px;
  padding: 8px 10px;
  border: 4px solid rgba(255, 255, 255, 0.78);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: var(--shadow);
  color: #35415f;
  font-size: clamp(0.84rem, 1.8vw, 1rem);
  font-weight: 950;
  white-space: nowrap;
}

.store-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(250px, 320px);
  gap: clamp(10px, 2vw, 16px);
  min-height: 0;
}

.store-floor,
.money-panel {
  position: relative;
  overflow: hidden;
  border: 5px solid rgba(255, 255, 255, 0.78);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.store-floor {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: clamp(10px, 2vw, 16px);
  min-height: 0;
  padding: clamp(12px, 2.4vw, 20px);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.26)),
    repeating-linear-gradient(0deg, rgba(57, 148, 111, 0.14) 0 20px, rgba(255, 255, 255, 0.16) 20px 40px),
    #d6f7e4;
}

.aisle-sign {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 62px;
  padding: 10px 14px;
  border: 4px solid rgba(255, 255, 255, 0.82);
  border-radius: 8px;
  background: linear-gradient(135deg, #31b86f, #56bdf2);
  box-shadow: 0 8px 0 rgba(36, 48, 73, 0.12);
  color: #ffffff;
  font-weight: 1000;
}

.aisle-sign span {
  font-size: clamp(1.05rem, 2.6vw, 1.7rem);
}

.aisle-sign strong {
  min-width: min(260px, 45%);
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.24);
  text-align: center;
}

.item-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(112px, 1fr));
  gap: clamp(8px, 1.5vw, 12px);
  min-height: 0;
}

.grocery-item {
  position: relative;
  display: grid;
  grid-template-rows: minmax(78px, 1fr) auto auto;
  align-items: center;
  justify-items: center;
  min-height: 154px;
  padding: 10px;
  border: 4px solid rgba(255, 255, 255, 0.85);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(255, 255, 255, 0.72)),
    linear-gradient(135deg, var(--item-color), #ffffff);
  box-shadow: inset 0 -6px 0 rgba(36, 48, 73, 0.08), 0 8px 0 rgba(36, 48, 73, 0.12);
  transition: transform 140ms ease, filter 140ms ease;
}

.grocery-item:hover,
.grocery-item:focus-visible,
.grocery-item.is-selected {
  filter: saturate(1.12);
  outline: 5px solid rgba(255, 225, 106, 0.95);
  outline-offset: 0;
  transform: translateY(-3px);
}

.grocery-item.is-paid {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(235, 255, 244, 0.84)),
    linear-gradient(135deg, var(--item-color), #ffffff);
}

.checkmark {
  position: absolute;
  top: 8px;
  right: 8px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 3px solid rgba(255, 255, 255, 0.92);
  border-radius: 50%;
  background: #31b86f;
  color: #ffffff;
  font-size: 1.05rem;
  font-weight: 1000;
  opacity: 0;
  transform: scale(0.5);
}

.grocery-item.is-paid .checkmark {
  opacity: 1;
  transform: scale(1);
  animation: checkPop 260ms ease both;
}

@keyframes checkPop {
  50% {
    transform: scale(1.22) rotate(-8deg);
  }
}

.item-art {
  position: relative;
  display: block;
  width: 82px;
  height: 70px;
}

.item-name {
  max-width: 100%;
  color: #243049;
  font-size: clamp(0.92rem, 1.7vw, 1.08rem);
  font-weight: 1000;
  line-height: 1.05;
  text-align: center;
}

.price-tag {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 76px;
  min-height: 36px;
  margin-top: 8px;
  padding: 6px 12px;
  border-radius: 8px;
  color: #ffffff;
  background: linear-gradient(180deg, #ff6f9e, #ef5064);
  box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.14), 0 5px 0 rgba(36, 48, 73, 0.1);
  font-size: 1.02rem;
}

.apple-body {
  position: absolute;
  left: 18px;
  top: 18px;
  width: 46px;
  height: 42px;
  border-radius: 52% 52% 46% 46%;
  background: #ef5064;
  box-shadow: inset -9px -8px 0 rgba(0, 0, 0, 0.12);
}

.apple-leaf {
  position: absolute;
  left: 47px;
  top: 8px;
  width: 22px;
  height: 14px;
  border-radius: 100% 0;
  background: #31b86f;
  transform: rotate(-22deg);
}

.banana {
  position: absolute;
  left: 12px;
  top: 20px;
  width: 58px;
  height: 30px;
  border-bottom: 13px solid #ffd84d;
  border-radius: 50%;
}

.banana.two {
  top: 28px;
  transform: rotate(-14deg);
}

.carrot {
  position: absolute;
  top: 30px;
  width: 24px;
  height: 42px;
  border-radius: 6px 6px 18px 18px;
  background: #ff9042;
  clip-path: polygon(0 0, 100% 0, 52% 100%);
}

.carrot.one {
  left: 22px;
  transform: rotate(12deg);
}

.carrot.two {
  left: 42px;
  transform: rotate(-9deg);
}

.carrot-top {
  position: absolute;
  left: 30px;
  top: 10px;
  width: 34px;
  height: 28px;
  background: #31b86f;
  clip-path: polygon(48% 100%, 0 10%, 34% 42%, 50% 0, 64% 42%, 100% 10%);
}

.carton,
.cereal-box {
  position: absolute;
  left: 22px;
  top: 8px;
  display: grid;
  place-items: center;
  width: 42px;
  height: 62px;
  border-radius: 8px 8px 6px 6px;
  background: linear-gradient(135deg, #ffffff, #7ed9ff);
  box-shadow: inset 0 -8px 0 rgba(0, 0, 0, 0.08);
  font-size: 0.72rem;
  font-weight: 1000;
}

.carton::before {
  position: absolute;
  top: -12px;
  width: 42px;
  height: 18px;
  background: #ffffff;
  clip-path: polygon(0 100%, 20% 0, 80% 0, 100% 100%);
  content: "";
}

.bread-loaf {
  position: absolute;
  left: 14px;
  top: 22px;
  width: 54px;
  height: 38px;
  border-radius: 26px 26px 10px 10px;
  background: #d4934b;
  box-shadow: inset 0 -8px 0 rgba(0, 0, 0, 0.12);
}

.bread-slice {
  position: absolute;
  left: 28px;
  top: 30px;
  width: 34px;
  height: 32px;
  border-radius: 18px 18px 8px 8px;
  background: #f5c982;
}

.egg {
  position: absolute;
  top: 26px;
  width: 28px;
  height: 38px;
  border-radius: 50% 50% 46% 46%;
  background: #fff8e8;
  box-shadow: inset -5px -6px 0 rgba(0, 0, 0, 0.08);
}

.egg.one {
  left: 12px;
  transform: rotate(-8deg);
}

.egg.two {
  left: 28px;
  top: 18px;
}

.egg.three {
  left: 46px;
  transform: rotate(9deg);
}

.cheese-block {
  position: absolute;
  left: 12px;
  top: 22px;
  width: 62px;
  height: 42px;
  border-radius: 8px;
  background:
    radial-gradient(circle at 22px 15px, rgba(137, 91, 0, 0.28) 0 5px, transparent 6px),
    radial-gradient(circle at 44px 28px, rgba(137, 91, 0, 0.28) 0 6px, transparent 7px),
    #ffc83d;
  clip-path: polygon(0 0, 100% 22%, 100% 100%, 0 100%);
}

.cereal-box {
  background: linear-gradient(135deg, #8b68ff, #ff6f9e);
  color: #ffffff;
}

.juice-bottle {
  position: absolute;
  left: 28px;
  top: 10px;
  width: 34px;
  height: 60px;
  border-radius: 13px 13px 9px 9px;
  background: #ff9f43;
  box-shadow: inset 0 -8px 0 rgba(0, 0, 0, 0.12);
}

.juice-bottle::before {
  position: absolute;
  top: -8px;
  left: 8px;
  width: 18px;
  height: 12px;
  border-radius: 5px 5px 0 0;
  background: #56bdf2;
  content: "";
}

.juice-bottle span {
  position: absolute;
  inset: 24px 6px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.54);
}

.berry {
  position: absolute;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #ca58ff;
  box-shadow: inset -5px -6px 0 rgba(0, 0, 0, 0.12);
}

.berry.one {
  left: 16px;
  top: 34px;
}

.berry.two {
  left: 34px;
  top: 16px;
}

.berry.three {
  left: 48px;
  top: 36px;
}

.yogurt-cup {
  position: absolute;
  left: 20px;
  top: 18px;
  width: 48px;
  height: 52px;
  border-radius: 8px 8px 18px 18px;
  background: linear-gradient(#ffffff 0 24%, #74d8a8 24%);
  box-shadow: inset 0 -7px 0 rgba(0, 0, 0, 0.1);
}

.yogurt-cup span {
  position: absolute;
  left: 10px;
  top: 24px;
  width: 28px;
  height: 18px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.56);
}

.pizza-slice {
  position: absolute;
  left: 18px;
  top: 14px;
  width: 54px;
  height: 58px;
  background:
    radial-gradient(circle at 24px 22px, #ef5064 0 5px, transparent 6px),
    radial-gradient(circle at 35px 38px, #ef5064 0 5px, transparent 6px),
    #ffc83d;
  clip-path: polygon(0 0, 100% 0, 52% 100%);
}

.money-panel {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  gap: 12px;
  min-height: 0;
  padding: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(255, 255, 255, 0.58)),
    linear-gradient(135deg, #f5fffa, #dff7ff);
}

.register-screen {
  display: grid;
  gap: 6px;
  min-height: 142px;
  padding: 14px;
  border: 4px solid #2f435e;
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.16), transparent),
    #263a50;
  box-shadow: inset 0 -7px 0 rgba(0, 0, 0, 0.2);
  color: #ffffff;
}

.register-screen span,
.register-screen small {
  color: #b7ffd9;
  font-size: 0.92rem;
  font-weight: 950;
}

.register-screen strong {
  align-self: center;
  font-size: clamp(2.4rem, 6vw, 4.2rem);
  line-height: 1;
}

.money-buttons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.money-button {
  display: grid;
  place-items: center;
  min-height: 58px;
  border: 4px solid rgba(255, 255, 255, 0.9);
  border-radius: 8px;
  box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.12), 0 6px 0 rgba(36, 48, 73, 0.12);
  font-size: clamp(1.1rem, 3vw, 1.5rem);
  font-weight: 1000;
}

.money-button.coin {
  border-radius: 999px;
  background: linear-gradient(180deg, #ffe88c, #ffc83d);
  color: #5c4500;
}

.money-button.bill {
  background:
    radial-gradient(circle at 18% 50%, rgba(255, 255, 255, 0.35) 0 12px, transparent 13px),
    radial-gradient(circle at 82% 50%, rgba(255, 255, 255, 0.35) 0 12px, transparent 13px),
    linear-gradient(180deg, #7ee0a8, #31b86f);
  color: #093d25;
}

.money-button:active {
  transform: translateY(4px);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.12), 0 2px 0 rgba(36, 48, 73, 0.12);
}

.register-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.clear-button,
.next-button,
.primary-button {
  min-height: 54px;
  padding: 0 12px;
  border-radius: 8px;
  color: #ffffff;
  box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.16), 0 6px 0 rgba(36, 48, 73, 0.12);
  font-weight: 1000;
}

.clear-button {
  background: linear-gradient(180deg, #ff9a42, #ef6f37);
}

.next-button,
.primary-button {
  background: linear-gradient(180deg, #56bdf2, #3476ff);
}

.feedback {
  align-self: stretch;
  min-height: 82px;
  padding: 12px;
  border: 4px solid rgba(255, 255, 255, 0.82);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.76);
  color: var(--muted);
  font-size: clamp(0.98rem, 2vw, 1.12rem);
  font-weight: 950;
  line-height: 1.25;
  text-align: center;
}

.is-overpaid .register-screen {
  animation: shakeRegister 260ms ease;
}

@keyframes shakeRegister {
  25% {
    transform: translateX(-8px);
  }

  50% {
    transform: translateX(8px);
  }

  75% {
    transform: translateX(-5px);
  }
}

.finish-overlay {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(45, 55, 84, 0.26);
  backdrop-filter: blur(5px);
}

.finish-overlay.hidden {
  display: none;
}

.finish-panel {
  display: grid;
  justify-items: center;
  gap: 12px;
  width: min(520px, 94vw);
  padding: clamp(22px, 5vw, 36px);
  border: 5px solid rgba(255, 255, 255, 0.86);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.84)),
    linear-gradient(135deg, #ffe16a, #a6f3ff);
  box-shadow: 0 22px 48px rgba(36, 48, 73, 0.28);
  text-align: center;
}

.finish-panel h2 {
  font-size: clamp(2rem, 7vw, 3.8rem);
  line-height: 0.98;
}

.finish-score {
  display: grid;
  place-items: center;
  min-width: 174px;
  min-height: 108px;
  border-radius: 8px;
  color: #ffffff;
  background: linear-gradient(135deg, #31b86f, #56bdf2);
  box-shadow: inset 0 -8px 0 rgba(0, 0, 0, 0.14);
  font-size: clamp(3rem, 11vw, 5.2rem);
  line-height: 1;
}

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

  .game-shell {
    height: auto;
    min-height: 100svh;
  }

  .topbar {
    grid-template-columns: 46px minmax(0, 1fr);
  }

  .home-link {
    width: 46px;
    height: 46px;
  }

  .scoreboard {
    grid-column: 1 / -1;
  }

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

  .item-grid {
    grid-template-columns: repeat(3, minmax(102px, 1fr));
  }

  .money-panel {
    grid-template-rows: auto auto auto auto;
  }

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

@media (max-width: 560px) {
  .game-shell {
    padding: 8px;
  }

  .aisle-sign {
    align-items: stretch;
    flex-direction: column;
  }

  .aisle-sign strong {
    min-width: 0;
  }

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

  .grocery-item {
    min-height: 148px;
  }

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