body {
  background: linear-gradient(180deg, #e3f2fd 0%, #bbdefb 100%);
}
.page {
  padding-top: 56px;
}

/* ===== HEADER ===== */
.shop-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
}
.shop-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: #1565c0;
}

/* Wallet */
.wallet {
  display: flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #fff9c4, #fff176);
  padding: 6px 16px;
  border-radius: 24px;
  font-size: 1.1rem;
  font-weight: 700;
  color: #f57f17;
  box-shadow: var(--shadow-sm);
  transition: transform 0.3s;
}
.wallet .coin {
  font-size: 1.3rem;
}
.wallet.shake {
  animation: wallet-shake 0.4s ease;
}
.wallet.pulse {
  animation: wallet-pulse 0.3s ease;
}
@keyframes wallet-shake {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-6px);
  }
  40% {
    transform: translateX(6px);
  }
  60% {
    transform: translateX(-4px);
  }
  80% {
    transform: translateX(4px);
  }
}
@keyframes wallet-pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.08);
  }
  100% {
    transform: scale(1);
  }
}

/* Recipe book button */
.recipe-book-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  background: linear-gradient(135deg, #ffe0b2, #ffcc80);
  padding: 8px 14px;
  border-radius: 24px;
  font-size: 0.9rem;
  font-weight: 700;
  color: #e65100;
  border: none;
  cursor: pointer;
  min-height: var(--touch-min);
  box-shadow: var(--shadow-sm);
}
.recipe-book-btn:active {
  transform: scale(0.95);
}

/* ===== SHELVES ===== */
.shelves {
  flex: 1;
  overflow-y: auto;
  padding: 0 12px 12px;
  -webkit-overflow-scrolling: touch;
}
.shelf-section {
  margin-bottom: 12px;
}
.shelf-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--c-brown);
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 12px;
  display: inline-block;
  margin-bottom: 6px;
}
.shelf-items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 10px;
}

/* Shop item */
.shop-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 6px 10px;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 14px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  min-height: var(--touch-min);
  /* stagger entrance */
  opacity: 0;
  transform: translateY(16px) scale(0.95);
  transition:
    opacity 0.35s ease,
    transform 0.35s ease;
}
.shop-item.entered {
  opacity: 1;
  transform: none;
}
.shop-item.entering {
  animation: shop-item-enter 0.35s ease both;
}
@keyframes shop-item-enter {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.shop-item:active {
  transform: scale(0.92) !important;
}
.shop-item .item-emoji {
  font-size: 2.8rem;
  line-height: 1;
  transition: transform 0.3s;
}
.shop-item .item-name {
  font-size: 0.8rem;
  color: #555;
  font-weight: 600;
}
.shop-item .item-price {
  font-size: 0.7rem;
  color: #e65100;
  font-weight: 700;
  background: #fff3e0;
  padding: 1px 8px;
  border-radius: 10px;
}
.shop-item.bought {
  opacity: 0.35;
  pointer-events: none;
}
.shop-item.bought .item-emoji {
  transform: scale(0.8);
}
.shop-item.cant-afford {
  animation: item-shake 0.3s ease;
}
@keyframes item-shake {
  0%,
  100% {
    transform: translateX(0) rotate(0);
  }
  25% {
    transform: translateX(-3px) rotate(-2deg);
  }
  75% {
    transform: translateX(3px) rotate(2deg);
  }
}

/* Ripple */
.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 152, 0, 0.3);
  transform: scale(0);
  pointer-events: none;
  animation: ripple-out 0.5s ease-out forwards;
}
@keyframes ripple-out {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

/* Flying clone */
.flying-item {
  position: fixed;
  font-size: 2.5rem;
  z-index: 999;
  pointer-events: none;
  will-change: transform, left, top;
}

/* ===== CART ===== */
.cart-area {
  background: rgba(255, 255, 255, 0.92);
  border-top: 2px solid #e0e0e0;
  padding: 8px 12px;
  min-height: 100px;
}
.cart-area.bounce {
  animation: cart-bounce 0.35s var(--ease-bounce);
}
@keyframes cart-bounce {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.03) translateY(-2px);
  }
  100% {
    transform: scale(1);
  }
}
.cart-label {
  font-size: 0.8rem;
  color: #888;
  margin-bottom: 4px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}
.cart-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  background: var(--c-orange);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0 4px;
}
.cart-count.pop {
  animation: add-pop 0.3s var(--ease-bounce);
}
.cart-items {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 4px 0;
  min-height: 54px;
  align-items: center;
  -webkit-overflow-scrolling: touch;
}
.cart-items:empty::after {
  content: '购物车是空的，点击食材购买吧！';
  color: #bbb;
  font-size: 0.8rem;
  animation: gentle-pulse 2s ease-in-out infinite;
}
@keyframes gentle-pulse {
  0%,
  100% {
    opacity: 0.5;
  }
  50% {
    opacity: 1;
  }
}

.cart-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 4px 8px;
  background: #fff;
  border-radius: 12px;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
  position: relative;
  min-height: var(--touch-min);
  justify-content: center;
}
.cart-item:active {
  transform: scale(0.85);
}
.cart-item .ci-emoji {
  font-size: 1.5rem;
}
.cart-item .ci-name {
  font-size: 0.6rem;
  color: #888;
}
.cart-item::after {
  content: '✕';
  position: absolute;
  top: -4px;
  right: -4px;
  width: 16px;
  height: 16px;
  background: var(--c-red);
  color: #fff;
  font-size: 0.55rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}
.cart-item.entering {
  animation: cart-pop-in 0.4s var(--ease-bounce) forwards;
}
@keyframes cart-pop-in {
  0% {
    transform: scale(0) rotate(-10deg);
    opacity: 0;
  }
  100% {
    transform: scale(1) rotate(0);
    opacity: 1;
  }
}
.cart-item.removing {
  animation: cart-poof 0.3s ease-out forwards;
  pointer-events: none;
}
@keyframes cart-poof {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.15) rotate(5deg);
    opacity: 0.5;
  }
  100% {
    transform: scale(0);
    opacity: 0;
  }
}
.cart-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 6px;
}

/* ===== RECIPE BOOK OVERLAY ===== */
.recipe-book {
  background: linear-gradient(135deg, #fff8e1, #ffecb3);
  border-radius: 20px;
  width: 92%;
  max-width: 500px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: bounce-in 0.35s var(--ease-overshoot);
  overflow: hidden;
}
.rb-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 2px solid rgba(0, 0, 0, 0.08);
}
.rb-header h2 {
  font-size: 1.15rem;
  color: #e65100;
}
.rb-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--c-red);
  color: #fff;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.rb-close:active {
  transform: scale(0.9);
}
.rb-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  -webkit-overflow-scrolling: touch;
}
.rb-card {
  background: #fff;
  border-radius: 14px;
  padding: 10px 12px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}
.rb-card-emoji {
  font-size: 2.8rem;
  flex-shrink: 0;
  line-height: 1;
}
.rb-card-info {
  flex: 1;
  min-width: 0;
}
.rb-card-name {
  font-size: 1rem;
  font-weight: 700;
  color: #333;
  margin-bottom: 4px;
}
.rb-card-row {
  font-size: 0.8rem;
  color: #777;
  line-height: 1.6;
  display: flex;
  flex-wrap: wrap;
  gap: 2px 6px;
  align-items: center;
}
.rb-card-row .label {
  font-weight: 700;
  color: var(--c-text-muted);
  flex-shrink: 0;
}
.rb-ing {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  white-space: nowrap;
}
.rb-ing.has {
  color: var(--c-green-dark);
}
.rb-ing.missing {
  color: #bbb;
}
.rb-card-cost {
  font-size: 0.75rem;
  color: var(--c-orange-dark);
  font-weight: 600;
  margin-top: 2px;
}
.rb-card.can-make {
  border-left: 4px solid var(--c-green);
}
