/* =====================================================================
   Little Shop Game Styles (Ages 5-7)
   Market Stall, Animated Customer, Coin Wallet & Payment Tray
   ===================================================================== */

:root {
  --wood-counter: #92400e;
  --wood-base: #78350f;
  --wood-light: #fef3c7;
  --awning-red: #ef4444;
  --awning-white: #ffffff;
}

body {
  background: radial-gradient(circle at 50% 10%, #fed7aa 0%, #fef08a 60%, #fdba74 100%);
  color: #1e293b;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  overflow: hidden;
}

.game-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  box-sizing: border-box;
  position: relative;
}

/* ---------------------------------------------------------------------
   Workspace Layout
   --------------------------------------------------------------------- */

.shop-workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  max-width: 520px;
  width: 100%;
  margin: 0 auto;
  padding: 4px 12px 10px;
  box-sizing: border-box;
  position: relative;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  gap: 8px;
}

/* ---------------------------------------------------------------------
   Shop Counter Stage & Awning
   --------------------------------------------------------------------- */

.shop-stage {
  position: relative;
  width: 100%;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 4px solid var(--wood-counter);
  border-radius: 24px;
  box-shadow: 0 10px 24px rgba(120, 53, 15, 0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
}

/* Striped Awning Canopy */
.shop-awning {
  display: flex;
  width: 100%;
  height: 28px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.awning-stripe {
  flex: 1;
  height: 100%;
}

.stripe-red {
  background: var(--awning-red);
}

.stripe-white {
  background: var(--awning-white);
}

/* Customer Area */
.counter-top {
  padding: 10px 14px 6px;
  display: flex;
  justify-content: center;
}

.customer-pod {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.customer-avatar {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font-family: inherit;
  font-size: 3.4rem;
  line-height: 1;
  cursor: pointer;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.15));
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  touch-action: manipulation;
}

.customer-avatar:hover {
  transform: scale(1.08);
}

.customer-avatar:focus-visible {
  outline: 3px solid #3b82f6;
  outline-offset: 4px;
  border-radius: 14px;
}

.customer-avatar.happy {
  animation: customerJoy 0.6s ease-in-out;
}

@keyframes customerJoy {
  0%, 100% { transform: translateY(0) scale(1); }
  30% { transform: translateY(-16px) scale(1.15) rotate(6deg); }
  60% { transform: translateY(-8px) scale(1.1) rotate(-6deg); }
}

.wish-bubble {
  flex: 1;
  background: #ffffff;
  border: 3px solid #f59e0b;
  border-radius: 18px;
  padding: 6px 14px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.wish-bubble:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.12);
}

.wish-bubble:focus-visible {
  outline: 3px solid #3b82f6;
  outline-offset: 2px;
}

.item-icon {
  font-size: 2.3rem;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15));
}

.item-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.item-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: #78350f;
  line-height: 1.2;
}

.price-tag {
  font-size: 1.05rem;
  font-weight: 900;
  color: #b45309;
}

.price-value {
  font-size: 1.3rem;
  color: #d97706;
}

/* Payment Tray */
.payment-tray-wrapper {
  background: #fef3c7;
  border-top: 3px dashed #d97706;
  padding: 8px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tray-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 800;
  font-size: 0.95rem;
  color: #78350f;
}

.tray-label-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.paid-sum {
  font-size: 1.25rem;
  font-weight: 900;
  color: #b45309;
}

.price-target {
  font-size: 1.25rem;
  font-weight: 900;
  color: #78350f;
}

.payment-hint {
  font-size: 0.88rem;
  font-weight: 800;
  color: #d97706;
}

.payment-hint.exact {
  color: #059669;
  font-weight: 900;
}

.payment-hint.too-much {
  color: #dc2626;
  font-weight: 900;
}

.payment-tray {
  background: #ffffff;
  border: 3px solid var(--wood-counter);
  border-radius: 16px;
  min-height: 72px;
  max-height: 110px;
  overflow-y: auto;
  box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px;
  align-items: center;
  align-content: flex-start;
  scroll-behavior: smooth;
}

.tray-empty-hint {
  color: #94a3b8;
  font-size: 0.88rem;
  font-weight: 700;
  margin: auto;
  text-align: center;
}

/* Coins in Tray */
.coin-chip {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  transition: transform 0.15s ease, filter 0.15s ease;
  animation: coinDrop 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  flex-shrink: 0;
  touch-action: manipulation;
  border: none;
}

.coin-chip:hover:not(:disabled) {
  transform: translateY(-2px) scale(1.08);
  filter: brightness(1.1);
}

.coin-chip:active:not(:disabled) {
  transform: scale(0.92);
}

.coin-chip:focus-visible {
  outline: 3px solid #3b82f6;
  outline-offset: 2px;
}

.coin-chip:disabled,
.shop-stage.order-finished .coin-chip {
  cursor: default;
  transform: none !important;
  filter: none !important;
  animation: none !important;
}

@keyframes coinDrop {
  0% { transform: translateY(-16px) scale(0.6); opacity: 0; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}

/* ---------------------------------------------------------------------
   Coin Wallet & Controls
   --------------------------------------------------------------------- */

.shop-controls {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

.wallet-container {
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(6px);
  border: 3px solid var(--wood-counter);
  border-radius: 20px;
  padding: 6px 12px 10px;
  box-shadow: 0 6px 16px rgba(120, 53, 15, 0.15);
}

.wallet-title {
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--wood-base);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.coin-buttons-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.coin-btn {
  flex: 1;
  aspect-ratio: 1 / 1;
  max-width: 72px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.22);
  transition: transform 0.12s ease, filter 0.15s ease, opacity 0.2s ease;
  padding: 0;
  touch-action: manipulation;
}

.coin-btn:hover:not(:disabled) {
  transform: translateY(-3px) scale(1.06);
  filter: brightness(1.1);
}

.coin-btn:active:not(:disabled) {
  transform: scale(0.94);
}

.coin-btn:focus-visible {
  outline: 3px solid #3b82f6;
  outline-offset: 3px;
}

.coin-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none !important;
  filter: grayscale(0.2) !important;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.coin-inner {
  width: 82%;
  height: 82%;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.45rem;
  font-weight: 900;
  box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.4), inset 0 -2px 4px rgba(0, 0, 0, 0.25);
}

/* Bronze Coin 1 */
.coin-bronze {
  background: radial-gradient(circle at 35% 35%, #f59e0b 0%, #b45309 60%, #78350f 100%);
  border: 3px solid #fef3c7;
}
.coin-bronze .coin-inner,
.coin-chip.val-1 {
  background: radial-gradient(circle at 40% 40%, #d97706, #92400e);
  color: #fffbeb;
  border: 2px solid #fef3c7;
}

/* Silver Coin 2 */
.coin-silver {
  background: radial-gradient(circle at 35% 35%, #f1f5f9 0%, #94a3b8 60%, #475569 100%);
  border: 3px solid #ffffff;
}
.coin-silver .coin-inner,
.coin-chip.val-2 {
  background: radial-gradient(circle at 40% 40%, #cbd5e1, #64748b);
  color: #0f172a;
  border: 2px solid #ffffff;
}

/* Gold Coin 5 */
.coin-gold {
  background: radial-gradient(circle at 35% 35%, #fef08a 0%, #eab308 60%, #a16207 100%);
  border: 3px solid #fef9c3;
}
.coin-gold .coin-inner,
.coin-chip.val-5 {
  background: radial-gradient(circle at 40% 40%, #facc15, #ca8a04);
  color: #451a03;
  border: 2px solid #fef08a;
}

/* Bimetal Coin 10 */
.coin-bimetal {
  background: radial-gradient(circle at 35% 35%, #fde047 0%, #ca8a04 100%);
  border: 3px solid #fef08a;
}
.coin-bimetal .coin-inner,
.coin-chip.val-10 {
  background: radial-gradient(circle at 40% 40%, #ffffff, #94a3b8);
  color: #1e293b;
  border: 2px solid #eab308;
}

/* Actions Row */
.actions-row {
  display: flex;
  gap: 8px;
  width: 100%;
}

.action-btn {
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 800;
  padding: 10px 16px;
  border-radius: 20px;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
  transition: transform 0.1s ease, filter 0.15s ease, opacity 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  touch-action: manipulation;
}

.action-btn:active:not(:disabled) {
  transform: scale(0.96);
}

.action-btn:focus-visible {
  outline: 3px solid #3b82f6;
  outline-offset: 2px;
}

.action-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  filter: none !important;
  box-shadow: none;
}

.clear-btn {
  flex: 1;
  background: #64748b;
  border-bottom: 3px solid #475569;
}

.pay-btn {
  flex: 1.6;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border-bottom: 4px solid #047857;
  font-size: 1.15rem;
}

@keyframes payPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 4px 10px rgba(16, 185, 129, 0.4); }
  50% { transform: scale(1.04); box-shadow: 0 6px 18px rgba(16, 185, 129, 0.7); }
}

.pay-btn.ready {
  animation: payPulse 1.2s infinite ease-in-out;
  border-bottom-color: #047857;
}

.next-btn {
  flex: 1.6;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  border-bottom: 4px solid #b45309;
  font-size: 1.15rem;
}

.celebration-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.continue-btn {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  border-bottom: 4px solid #b45309;
  padding: 12px 22px;
  font-size: 1.12rem;
}

.play-again-btn {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border-bottom: 4px solid #047857;
  padding: 12px 22px;
  font-size: 1.12rem;
}

.hidden {
  display: none !important;
}

/* ---------------------------------------------------------------------
   Sparks & Celebration Modal
   --------------------------------------------------------------------- */

.sparks-container {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 40;
}

.sparkle {
  position: absolute;
  font-size: 1.5rem;
  animation: sparkBurst 0.8s ease-out forwards;
}

@keyframes sparkBurst {
  0% { transform: translate(0, 0) scale(0.5); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(1.3); opacity: 0; }
}

.celebration-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 150;
  padding: 16px;
  box-sizing: border-box;
}

.celebration-card {
  background: #ffffff;
  border: 4px solid #f59e0b;
  padding: 24px 28px;
  border-radius: 28px;
  text-align: center;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.35);
  max-width: 420px;
  width: 100%;
  animation: cardBounce 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.celebration-icon {
  font-size: 3.2rem;
  margin-bottom: 8px;
}

.celebration-text {
  font-size: 1.25rem;
  font-weight: 800;
  color: #78350f;
  margin-bottom: 20px;
  line-height: 1.4;
}

@keyframes cardBounce {
  0% { transform: scale(0.6); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* ---------------------------------------------------------------------
   Mobile Responsive & Small Height Modes
   --------------------------------------------------------------------- */

@media (max-width: 480px) {
  .customer-avatar {
    font-size: 2.8rem;
  }
  .item-icon {
    font-size: 2rem;
  }
  .item-title {
    font-size: 0.98rem;
  }
  .price-tag {
    font-size: 0.95rem;
  }
  .coin-btn {
    max-width: 60px;
  }
  .coin-inner {
    font-size: 1.25rem;
  }
  .coin-chip {
    width: 38px;
    height: 38px;
    font-size: 1rem;
  }
  .payment-tray {
    min-height: 60px;
  }
  .action-btn {
    font-size: 0.92rem;
    padding: 8px 10px;
  }
}

@media (max-height: 620px) {
  .shop-workspace {
    padding: 2px 8px 6px;
    gap: 4px;
    justify-content: flex-start;
  }
  .shop-awning {
    height: 18px;
  }
  .counter-top {
    padding: 4px 10px 2px;
  }
  .customer-avatar {
    font-size: 2.4rem;
  }
  .wish-bubble {
    padding: 4px 10px;
    gap: 8px;
  }
  .item-icon {
    font-size: 1.8rem;
  }
  .item-title {
    font-size: 0.95rem;
  }
  .payment-tray-wrapper {
    padding: 4px 10px 6px;
    gap: 4px;
  }
  .payment-tray {
    min-height: 52px;
    max-height: 80px;
    padding: 4px;
    gap: 6px;
  }
  .coin-chip {
    width: 34px;
    height: 34px;
    font-size: 0.95rem;
  }
  .wallet-container {
    padding: 4px 8px 6px;
  }
  .wallet-title {
    margin-bottom: 2px;
    font-size: 0.85rem;
  }
  .coin-btn {
    max-width: 50px;
  }
  .coin-inner {
    font-size: 1.15rem;
  }
  .action-btn {
    padding: 6px 10px;
    font-size: 0.92rem;
  }
  .celebration-card {
    padding: 16px 20px;
  }
  .celebration-icon {
    font-size: 2.4rem;
    margin-bottom: 4px;
  }
  .celebration-text {
    font-size: 1.05rem;
    margin-bottom: 12px;
  }
  .continue-btn,
  .play-again-btn {
    padding: 8px 16px;
    font-size: 0.95rem;
  }
}

/* ---------------------------------------------------------------------
   Reduced Motion
   --------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .customer-avatar.happy,
  .coin-chip,
  .celebration-card,
  .sparkle,
  .pay-btn.ready {
    transition: none !important;
    animation: none !important;
  }
}
