/* ════════════════════════════════════════════════════════
   Mochi's Shop — coin shopping
   ════════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100vh;
  min-height: 100vh;
  width: 100vw;
  overflow: hidden;
  font-family: 'Fredoka', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  color: #3a2818;
}

body {
  position: relative;
  background: transparent;
  display: flex;
  flex-direction: column;
}

/* ─── Shop interior backdrop ───────────────────────── */
.shop-bg {
  position: fixed;
  inset: 0;
  z-index: -3;
  pointer-events: none;
}
.wallpaper {
  position: absolute;
  inset: 0;
  bottom: 30%;
  background:
    /* subtle floral pattern */
    radial-gradient(circle at 20% 30%, rgba(232, 190, 220, 0.12) 0 8px, transparent 9px),
    radial-gradient(circle at 70% 60%, rgba(232, 190, 220, 0.12) 0 8px, transparent 9px),
    radial-gradient(circle at 40% 80%, rgba(232, 190, 220, 0.12) 0 8px, transparent 9px),
    /* warm cream gradient */
    linear-gradient(180deg, #f8e6cd 0%, #f3d9b8 60%, #e8c89c 100%);
  background-size: 80px 80px, 80px 80px, 80px 80px, 100% 100%;
}
.wallpaper-stripe {
  /* Decorative chair rail molding */
  position: absolute;
  left: 0; right: 0;
  bottom: 30%;
  height: 8px;
  background: linear-gradient(180deg, #b07a4a 0%, #8b5a3c 50%, #6b4226 100%);
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}
.wainscot {
  /* Wood paneling below the chair rail */
  position: absolute;
  left: 0; right: 0;
  bottom: 18%;
  height: 12%;
  background:
    repeating-linear-gradient(90deg,
      #d4a574 0px, #d4a574 60px,
      #c89760 60px, #c89760 62px,
      #d4a574 62px, #d4a574 122px),
    linear-gradient(180deg, #c89760 0%, #a87440 100%);
  border-bottom: 4px solid #8b5a3c;
  box-shadow: inset 0 -4px 8px rgba(0,0,0,0.2);
}
.floor {
  position: absolute;
  left: 0; right: 0;
  bottom: 0;
  height: 18%;
  background:
    /* wood plank seams */
    repeating-linear-gradient(90deg,
      transparent 0px, transparent 80px,
      rgba(80, 50, 20, 0.3) 80px, rgba(80, 50, 20, 0.3) 82px),
    linear-gradient(180deg, #8b5a3c 0%, #6b4226 100%);
  box-shadow: inset 0 8px 16px rgba(0, 0, 0, 0.25);
}

/* ─── Window ───────────────────────────────────────── */
.window {
  position: fixed;
  top: 70px;
  left: 24px;
  width: 130px;
  height: 130px;
  z-index: -1;
  pointer-events: none;
}
.window-pane {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #87cdf0 0%, #b0d8e8 60%, #f5d3b0 100%);
  overflow: hidden;
  border-radius: 4px;
  box-shadow: inset 0 0 24px rgba(255, 255, 255, 0.5);
}
.window-sky {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 80% 80%, rgba(255, 255, 200, 0.4) 0%, transparent 50%);
}
.window-sun {
  position: absolute;
  top: 20%;
  right: 15%;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff5a0 0%, #ffd96e 60%, transparent 90%);
  filter: blur(1px);
  animation: sunGlow 3s ease-in-out infinite;
}
@keyframes sunGlow {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.15); }
}
.window-cloud {
  position: absolute;
  font-size: 24px;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,0.1));
  opacity: 0.85;
  animation: cloudDrift 30s linear infinite;
}
.cloud-a { top: 20%; left: -30%; animation-duration: 35s; }
.cloud-b { top: 40%; left: -30%; animation-duration: 50s; animation-delay: -15s; font-size: 18px; }
.cloud-c { top: 10%; left: -30%; animation-duration: 45s; animation-delay: -30s; font-size: 14px; }
@keyframes cloudDrift {
  from { transform: translateX(0); }
  to   { transform: translateX(220%); }
}
.window-bird {
  position: absolute;
  top: 30%;
  left: -10%;
  font-size: 16px;
  animation: birdFly 18s linear infinite;
  animation-delay: 6s;
  opacity: 0;
}
@keyframes birdFly {
  0%   { opacity: 0; transform: translate(0, 0); }
  10%  { opacity: 1; }
  50%  { transform: translate(60px, -8px); }
  90%  { opacity: 1; }
  100% { opacity: 0; transform: translate(150px, 0); }
}
.window-frame {
  position: absolute;
  inset: 0;
  border: 8px solid #6b4226;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3),
              inset 0 0 0 2px #8b5a3c,
              inset 0 0 0 4px #6b4226;
  pointer-events: none;
}
.window-frame::before, .window-frame::after {
  content: '';
  position: absolute;
  background: #6b4226;
}
.window-frame::before {
  top: 50%; left: 0; right: 0;
  height: 4px;
  transform: translateY(-2px);
}
.window-frame::after {
  left: 50%; top: 0; bottom: 0;
  width: 4px;
  transform: translateX(-2px);
}
.window-sill {
  position: absolute;
  bottom: -8px;
  left: -10px;
  right: -10px;
  height: 12px;
  background: linear-gradient(180deg, #8b5a3c 0%, #6b4226 100%);
  border-radius: 2px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.25);
}
.window-plant {
  position: absolute;
  bottom: -6px;
  right: -2px;
  font-size: 28px;
  z-index: 2;
  filter: drop-shadow(0 2px 3px rgba(0,0,0,0.25));
}

/* ─── HUD ──────────────────────────────────────────── */
.hud {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px 4px;
  z-index: 10;
}
.shop-sign {
  text-align: center;
  flex: 1;
  margin-left: 110px; /* clear the window */
}
.shop-name {
  display: block;
  font-family: 'Caveat', cursive;
  font-size: 32px;
  font-weight: 700;
  color: #6b4226;
  text-shadow: 0 2px 0 rgba(255, 248, 220, 0.6), 0 4px 6px rgba(0,0,0,0.15);
  line-height: 1;
}
.shop-tagline {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #8b5a3c;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.bag-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: linear-gradient(180deg, #fff8e0 0%, #ffe9b8 100%);
  border: 3px solid #ffd96e;
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 700;
  font-size: 18px;
  color: #6b4226;
  box-shadow: 0 4px 0 rgba(0,0,0,0.15), 0 6px 12px rgba(0,0,0,0.18);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.bag-btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 rgba(0,0,0,0.15), 0 3px 6px rgba(0,0,0,0.18);
}
.bag-btn--bump {
  animation: bagBump 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes bagBump {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.25) rotate(-6deg); background: linear-gradient(180deg, #ffd96e 0%, #f5b800 100%); }
  100% { transform: scale(1) rotate(0); }
}
.bag-emoji { font-size: 22px; }
.bag-count { font-variant-numeric: tabular-nums; min-width: 16px; }

/* ─── Shelves ──────────────────────────────────────── */
.shelves {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: min-content;
  gap: 10px;
  padding: 8px 16px 4px;
  margin-top: 4px;
  position: relative;
  z-index: 4;
  overflow-y: auto;
  align-content: start;
  -webkit-overflow-scrolling: touch;
}
.shelves::-webkit-scrollbar { width: 4px; }
.shelves::-webkit-scrollbar-thumb { background: rgba(107, 66, 38, 0.4); border-radius: 2px; }
@media (max-width: 720px) {
  .shelves { grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 6px 12px 4px; }
}
@media (max-width: 480px) {
  .shelves { grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 4px 10px 2px; }
}

.shelf-item {
  position: relative;
  background: linear-gradient(180deg, #fff8e0 0%, #ffeec8 100%);
  border: 3px solid #c89760;
  border-radius: 12px;
  padding: 6px 4px 10px;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  box-shadow: 0 3px 0 rgba(0,0,0,0.18), 0 5px 7px rgba(0,0,0,0.2);
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.18s ease;
  animation: shelfBob var(--bob-dur, 3s) ease-in-out infinite;
  animation-delay: var(--bob-delay, 0s);
}
@keyframes shelfBob {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50%      { transform: translateY(-2px) rotate(var(--bob-tilt, 0deg)); }
}
.shelf-item:hover, .shelf-item:focus-visible {
  transform: translateY(-4px) scale(1.05);
  box-shadow: 0 8px 0 rgba(0,0,0,0.18), 0 10px 14px rgba(0,0,0,0.25);
  animation-play-state: paused;
}
.shelf-item:active { transform: translateY(-1px) scale(0.97); }
.shelf-item--out {
  animation: itemSwoop 0.5s cubic-bezier(0.5, 0, 0.5, 1) forwards;
  pointer-events: none;
}
@keyframes itemSwoop {
  0%   { transform: scale(1); }
  60%  { transform: translate(-30%, 60%) scale(1.3) rotate(-15deg); }
  100% { transform: translate(-50%, 200%) scale(0.5) rotate(20deg); opacity: 0; }
}
.shelf-item-emoji {
  font-size: 30px;
  line-height: 1;
  filter: drop-shadow(0 2px 3px rgba(0,0,0,0.25));
}
.shelf-item-name {
  font-size: 11px;
  font-weight: 600;
  color: #6b4226;
  margin-top: 1px;
}
.price-tag-mini {
  position: absolute;
  top: -8px;
  right: -6px;
  background: linear-gradient(180deg, #ffd96e 0%, #f5b800 100%);
  color: #6b4226;
  font-family: 'Caveat', cursive;
  font-weight: 700;
  font-size: 16px;
  padding: 2px 8px 2px 14px;
  border-radius: 4px 12px 12px 4px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.25);
  font-variant-numeric: tabular-nums;
  /* hole punch on the left like a real price tag */
}
.price-tag-mini::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 5px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid #6b4226;
  transform: translateY(-50%);
}
.shelf-item--owned .shelf-item-emoji {
  filter: drop-shadow(0 2px 3px rgba(0,0,0,0.25)) brightness(0.9);
}
.shelf-item--owned::after {
  content: '✓';
  position: absolute;
  top: 4px;
  left: 6px;
  font-size: 12px;
  font-weight: 700;
  color: #4caf50;
  text-shadow: 0 0 3px #fff;
}

/* ─── Counter area ─────────────────────────────────── */
.counter-area {
  flex: 0 0 auto;
  display: flex;
  align-items: end;
  gap: 0;
  padding: 8px 16px 4px;
  position: relative;
  z-index: 5;
  height: 200px;
}
@media (max-width: 480px) {
  .counter-area { height: 160px; padding: 6px 12px 4px; }
}

/* ─── Shopkeeper (Mochi) ───────────────────────────── */
.shopkeeper {
  position: relative;
  flex: 0 0 auto;
  width: 130px;
  height: 100%;
  margin-right: -8px;
  display: flex;
  align-items: end;
}
@media (max-width: 480px) {
  .shopkeeper { width: 100px; margin-right: -16px; }
}
.cat {
  width: 100%;
  height: auto;
  filter: drop-shadow(0 6px 6px rgba(0,0,0,0.25));
  animation: catBob 4s ease-in-out infinite;
  transform-origin: bottom center;
}
@keyframes catBob {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50%      { transform: translateY(-3px) rotate(0.5deg); }
}
.cat--happy .cat-eyes { display: none; }
.cat--happy .cat-eyes-happy { display: block !important; }
.cat--happy .cat-mouth-bound { d: path('M 60 73 Q 70 80 80 73'); }
.cat-eye-white, .cat-pupil, .cat-eye-shine {
  transition: transform 0.15s ease, opacity 0.15s ease;
  transform-origin: center;
}
.cat-eyes--blink .cat-eye-white { transform: scaleY(0.1); }
.cat-eyes--blink .cat-pupil     { transform: scaleY(0.1); }
.cat-eyes--blink .cat-eye-shine { opacity: 0; }
.cat--surprised .cat-eye-white { transform: scale(1.3); }
.cat--surprised .cat-pupil     { transform: scale(0.8); }

.speech-bubble {
  position: absolute;
  bottom: calc(100% - 40px);
  left: 60%;
  background: #fff;
  border: 3px solid #6b4226;
  border-radius: 16px;
  padding: 10px 14px;
  font-family: 'Caveat', cursive;
  font-size: 22px;
  font-weight: 700;
  color: #3a2818;
  white-space: nowrap;
  z-index: 6;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
  animation: bubblePop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes bubblePop {
  from { transform: scale(0.5); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
.speech-bubble[hidden] { display: none; }
.speech-bubble::before {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 24px;
  width: 0; height: 0;
  border: 8px solid transparent;
  border-top-color: #6b4226;
}
.speech-bubble::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 26px;
  width: 0; height: 0;
  border: 6px solid transparent;
  border-top-color: #fff;
}

/* ─── Counter ──────────────────────────────────────── */
.counter {
  flex: 1;
  position: relative;
  height: 100%;
  background: linear-gradient(180deg, #d4a574 0%, #b07a4a 50%, #8b5a3c 100%);
  border-radius: 12px 12px 4px 4px;
  border: 3px solid #6b4226;
  box-shadow:
    inset 0 4px 8px rgba(255, 230, 180, 0.4),
    inset 0 -4px 8px rgba(80, 50, 20, 0.3),
    0 6px 14px rgba(0,0,0,0.3);
  overflow: hidden;
}
.counter-edge {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 16px;
  background: linear-gradient(180deg, #e6c08c 0%, #c89760 100%);
  border-bottom: 2px solid #8b5a3c;
}
.counter-surface {
  position: absolute;
  top: 16px; bottom: 0;
  left: 0; right: 0;
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.purchase-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #fff;
  text-shadow: 0 2px 4px rgba(0,0,0,0.4);
  pointer-events: none;
}
.purchase-empty[hidden] { display: none; }
.empty-icon {
  font-size: 32px;
  animation: pointerBounce 1.6s ease-in-out infinite;
}
@keyframes pointerBounce {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-8px); }
}
.empty-text {
  font-family: 'Caveat', cursive;
  font-size: 22px;
  font-weight: 700;
  margin-top: 6px;
}

.purchase-active {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  max-width: 480px;
  background: rgba(255, 248, 220, 0.94);
  border: 3px solid #ffd96e;
  border-radius: 14px;
  padding: 10px 14px;
  position: absolute;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  animation: purchasePop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.purchase-active[hidden] { display: none !important; }
@keyframes purchasePop {
  from { transform: translateX(-50%) scale(0.7) translateY(20px); opacity: 0; }
  to   { transform: translateX(-50%) scale(1) translateY(0); opacity: 1; }
}
.purchase-item-emoji {
  font-size: 56px;
  line-height: 1;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.3));
  flex: 0 0 auto;
  animation: itemFloat 2s ease-in-out infinite;
}
@keyframes itemFloat {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50%      { transform: translateY(-4px) rotate(2deg); }
}
.purchase-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.purchase-item-name {
  font-family: 'Caveat', cursive;
  font-size: 22px;
  font-weight: 700;
  color: #6b4226;
  line-height: 1;
}
.price-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(180deg, #ffd96e 0%, #f5b800 100%);
  color: #6b4226;
  font-weight: 700;
  padding: 3px 10px 3px 18px;
  border-radius: 4px 12px 12px 4px;
  font-variant-numeric: tabular-nums;
  width: fit-content;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  position: relative;
}
.price-tag::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 7px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid #6b4226;
  transform: translateY(-50%);
}
.price-tag-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.7;
}
.price-tag-amount {
  font-size: 18px;
}

.paid-meter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  color: #6b4226;
}
.paid-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.7;
}
.paid-amount {
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  padding: 1px 8px;
  background: #fff;
  border-radius: 8px;
  border: 2px solid #c89760;
  min-width: 48px;
  text-align: center;
}
.paid-amount--bump {
  animation: paidBump 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes paidBump {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.2); background: #fef08a; }
}
.paid-amount--enough { color: #16a34a; border-color: #4ade80; }

.cancel-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  background: transparent;
  border: none;
  font-size: 18px;
  color: #8b5a3c;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  transition: background 0.15s ease, transform 0.1s ease;
}
.cancel-btn:hover { background: rgba(139, 90, 60, 0.15); }
.cancel-btn:active { transform: scale(0.92); }

/* ─── Coin pile (on counter) ───────────────────────── */
.coin-pile {
  position: absolute;
  bottom: 8px;
  left: 0; right: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: center;
  padding: 0 12px;
  pointer-events: none;
  min-height: 0;
}

/* ─── Wallet ───────────────────────────────────────── */
.wallet {
  position: relative;
  background: linear-gradient(180deg, #6b4226 0%, #4a2c18 100%);
  border-top: 4px solid #8b5a3c;
  padding: 10px 16px 12px;
  box-shadow: 0 -6px 16px rgba(0,0,0,0.3);
  z-index: 6;
}
.wallet-grain {
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(90deg,
    transparent 0 100px,
    rgba(255, 220, 180, 0.07) 100px 102px);
  pointer-events: none;
}
.coin-tray {
  display: flex;
  justify-content: space-around;
  gap: 8px;
  position: relative;
}

.coin-slot {
  background: transparent;
  border: none;
  padding: 4px 8px;
  cursor: grab;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  position: relative;
  font-family: inherit;
  touch-action: none;
}
.coin-slot:active { cursor: grabbing; }
.coin-name {
  font-size: 10px;
  font-weight: 600;
  color: #d4a574;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Coin visuals — distinct sizes/colors per real currency */
.coin {
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  position: relative;
  pointer-events: none;
  box-shadow:
    0 3px 6px rgba(0,0,0,0.4),
    inset 0 -2px 4px rgba(0,0,0,0.3),
    inset 0 2px 3px rgba(255,255,255,0.5);
  transition: transform 0.12s ease;
}
.coin-slot:active .coin { transform: scale(1.12); }
.coin-slot:hover .coin { transform: translateY(-2px); }

/* Penny — copper, smallish */
.coin--penny {
  width: 38px; height: 38px;
  background: radial-gradient(circle at 35% 30%,
    #f8a05a 0%, #d97706 35%, #b45309 75%, #78350f 100%);
  color: #4a1a02;
  font-size: 13px;
  border: 2px solid #78350f;
}
/* Nickel — silver, medium-large */
.coin--nickel {
  width: 44px; height: 44px;
  background: radial-gradient(circle at 35% 30%,
    #f8f9fb 0%, #d1d5db 30%, #9ca3af 60%, #4b5563 100%);
  color: #1f2937;
  font-size: 13px;
  border: 2px solid #4b5563;
}
/* Dime — silver, smallest (per real life) */
.coin--dime {
  width: 34px; height: 34px;
  background: radial-gradient(circle at 35% 30%,
    #f8f9fb 0%, #d1d5db 30%, #9ca3af 60%, #4b5563 100%);
  color: #1f2937;
  font-size: 11px;
  border: 2px solid #4b5563;
}
/* Quarter — silver, biggest */
.coin--quarter {
  width: 50px; height: 50px;
  background: radial-gradient(circle at 35% 30%,
    #f8f9fb 0%, #d1d5db 30%, #9ca3af 60%, #4b5563 100%);
  color: #1f2937;
  font-size: 14px;
  border: 2px solid #4b5563;
}

/* Coin edge ridges (decorative) */
.coin::before {
  content: '';
  position: absolute;
  inset: 2px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,0.15);
  pointer-events: none;
}

@media (max-width: 480px) {
  .coin--penny { width: 34px; height: 34px; font-size: 12px; }
  .coin--nickel { width: 40px; height: 40px; font-size: 12px; }
  .coin--dime { width: 30px; height: 30px; font-size: 10px; }
  .coin--quarter { width: 46px; height: 46px; font-size: 13px; }
  .coin-name { font-size: 9px; }
  .wallet { padding: 8px 10px; }
}

/* Coin "ghost" while dragging */
.coin-ghost {
  position: fixed;
  pointer-events: none;
  z-index: 1000;
  transform: translate(-50%, -50%) scale(1.2);
  filter: drop-shadow(0 8px 12px rgba(0,0,0,0.5));
  animation: coinPulse 0.4s ease-out;
}
@keyframes coinPulse {
  0% { transform: translate(-50%, -50%) scale(1); }
  100% { transform: translate(-50%, -50%) scale(1.2); }
}

/* Coin landing on counter */
.coin-on-counter {
  position: absolute;
  pointer-events: none;
  animation: coinDropIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes coinDropIn {
  0%   { transform: scale(1.4) rotate(-30deg); opacity: 0.6; }
  60%  { transform: scale(0.9) rotate(8deg); }
  100% { transform: scale(1) rotate(var(--rot, 0deg)); opacity: 1; }
}
.coin-on-counter--bouncing {
  animation: coinBounceBack 0.6s cubic-bezier(0.5, 0, 0.5, 1) forwards;
}
@keyframes coinBounceBack {
  0%   { opacity: 1; transform: scale(1); }
  40%  { opacity: 1; transform: translate(0, -40px) scale(1.1) rotate(180deg); }
  100% { opacity: 0; transform: translate(var(--back-x, 0), var(--back-y, 200px)) scale(0.6) rotate(360deg); }
}

/* ─── Particles ────────────────────────────────────── */
.particle-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
}
.spark {
  position: absolute;
  font-size: 22px;
  pointer-events: none;
  animation: sparkFly var(--dur, 1.0s) ease-out forwards;
}
@keyframes sparkFly {
  0%   { transform: translate(0, 0) scale(0.4) rotate(0); opacity: 0; }
  20%  { opacity: 1; }
  100% { transform: translate(var(--dx, 0), var(--dy, -120px)) scale(1.1) rotate(var(--rot, 360deg)); opacity: 0; }
}
.coin-glow {
  position: absolute;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 230, 100, 0.7) 0%, rgba(255, 230, 100, 0) 70%);
  pointer-events: none;
  animation: coinGlowPulse 0.4s ease-out forwards;
}
@keyframes coinGlowPulse {
  0%   { transform: scale(0.5); opacity: 1; }
  100% { transform: scale(1.6); opacity: 0; }
}
.confetti {
  position: absolute;
  width: 10px;
  height: 14px;
  pointer-events: none;
  animation: confettiFall var(--dur, 2.4s) cubic-bezier(0.5, 0.05, 0.6, 1) forwards;
}
@keyframes confettiFall {
  0%   { transform: translate(0, 0) rotate(0); opacity: 1; }
  100% { transform: translate(var(--dx, 0), var(--dy, 100vh)) rotate(var(--rot, 720deg)); opacity: 0.4; }
}
.flying-item {
  position: fixed;
  font-size: 56px;
  pointer-events: none;
  z-index: 90;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.4));
  animation: flyToBag 0.9s cubic-bezier(0.55, 0.05, 0.55, 1) forwards;
}
@keyframes flyToBag {
  0%   { transform: scale(1) rotate(0); }
  30%  { transform: translate(var(--mid-x), var(--mid-y)) scale(1.4) rotate(20deg); }
  100% { transform: translate(var(--end-x), var(--end-y)) scale(0.4) rotate(360deg); opacity: 0.6; }
}

/* ─── Inventory overlay ────────────────────────────── */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(58, 40, 24, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  animation: overlayFade 0.3s ease;
}
@keyframes overlayFade {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.overlay[hidden] { display: none; }

.overlay-card {
  background: linear-gradient(180deg, #fff 0%, #fff8e0 100%);
  color: #6b4226;
  border: 4px solid #ffd96e;
  border-radius: 28px;
  padding: 28px 32px;
  text-align: center;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
  max-width: 480px;
  min-width: 320px;
  width: calc(100vw - 40px);
  max-height: 80vh;
  overflow-y: auto;
  animation: cardPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes cardPop {
  from { transform: scale(0.6) translateY(20px); opacity: 0; }
  to   { transform: scale(1) translateY(0); opacity: 1; }
}
.overlay-emoji {
  font-size: 64px;
  line-height: 1;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3));
}
.overlay-title {
  font-family: 'Caveat', cursive;
  font-size: 36px;
  font-weight: 700;
  color: #6b4226;
  margin: 4px 0 0;
}
.overlay-subtitle {
  font-size: 13px;
  color: #8b5a3c;
  margin-bottom: 16px;
  font-weight: 500;
}
.inventory-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}
.inv-item {
  background: linear-gradient(180deg, #fff8e0 0%, #ffeec8 100%);
  border: 2px solid #c89760;
  border-radius: 12px;
  padding: 10px 4px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  position: relative;
}
.inv-item-emoji { font-size: 32px; line-height: 1; }
.inv-item-name { font-size: 10px; font-weight: 600; color: #6b4226; }
.inv-item-count {
  position: absolute;
  top: 2px;
  right: 4px;
  background: #6b4226;
  color: #fff;
  border-radius: 999px;
  padding: 1px 6px;
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.inv-item-count[data-count="1"] { display: none; }
.inventory-empty {
  font-family: 'Caveat', cursive;
  font-size: 22px;
  color: #8b5a3c;
  margin: 24px 0;
}
.big-btn {
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: 22px;
  color: #fff;
  background: linear-gradient(180deg, #d97706 0%, #b45309 100%);
  border: none;
  padding: 14px 36px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 6px 0 rgba(0,0,0,0.18), 0 8px 16px rgba(180, 83, 9, 0.5);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
  text-shadow: 0 1px 0 rgba(0,0,0,0.2);
}
.big-btn:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 rgba(0,0,0,0.18), 0 4px 8px rgba(180, 83, 9, 0.5);
}

/* ─── Mobile ───────────────────────────────────────── */
@media (max-width: 480px) {
  .window { top: 60px; left: 12px; width: 90px; height: 90px; }
  .window-frame { border-width: 6px; }
  .shop-name { font-size: 24px; }
  .shop-tagline { font-size: 10px; }
  .shop-sign { margin-left: 80px; }
  .bag-btn { padding: 6px 10px; font-size: 16px; }
  .bag-emoji { font-size: 18px; }
  .shelf-item { padding: 6px 4px 12px; }
  .shelf-item-emoji { font-size: 28px; }
  .shelf-item-name { font-size: 10px; }
  .price-tag-mini { font-size: 14px; padding: 1px 6px 1px 12px; }
  .empty-text { font-size: 18px; }
  .purchase-item-emoji { font-size: 44px; }
  .purchase-item-name { font-size: 18px; }
  .price-tag-amount { font-size: 16px; }
  .paid-amount { font-size: 16px; min-width: 40px; }
  .speech-bubble { font-size: 18px; padding: 8px 12px; }
  .inventory-grid { grid-template-columns: repeat(3, 1fr); }
  .overlay-card { padding: 22px 20px; }
}
