/* ============================================================================
   POKÉSPIRE · TWO-STAGE ROGUELIKE SHOP & COMPACT STS2 RUG (css/shop-stage.css)
   1. Full-bleed Merchant Room Entry Stage (.shop-stage-room)
   2. High-proportion Compact STS2 Counter Rug (.shop-stage-counter)
   3. 5 Merchant Theme Palettes + Purchase Light Beam & HUD Absorption Pulse
   ============================================================================ */

/* Theme palettes per roguelike merchant */
#app .run-shop[data-shop-theme="friendly"] {
  --shop-sky-a: #f3f9ff;
  --shop-sky-b: #dfeeff;
  --shop-floor-a: #e8f1fa;
  --shop-floor-b: #d6e4f2;
  --shop-rug-bg: #eef5f2;
  --shop-rug-pattern: rgba(15, 118, 110, 0.08);
  --shop-rug-border: rgba(13, 148, 136, 0.28);
  --shop-accent: #0284c7;
  --shop-accent-soft: rgba(14, 165, 233, 0.14);
  --shop-canopy-a: #0ea5e9;
  --shop-canopy-b: #ffffff;
}

#app .run-shop[data-shop-theme="blackmarket"] {
  --shop-sky-a: #ede9fe;
  --shop-sky-b: #dbe1f7;
  --shop-floor-a: #dde1ef;
  --shop-floor-b: #c7cee2;
  --shop-rug-bg: #ede9f7;
  --shop-rug-pattern: rgba(109, 40, 217, 0.08);
  --shop-rug-border: rgba(124, 58, 237, 0.30);
  --shop-accent: #7c3aed;
  --shop-accent-soft: rgba(124, 58, 237, 0.14);
  --shop-canopy-a: #4c1d95;
  --shop-canopy-b: #f5f3ff;
}

#app .run-shop[data-shop-theme="collector"] {
  --shop-sky-a: #fefce8;
  --shop-sky-b: #e6f6ec;
  --shop-floor-a: #efe8d5;
  --shop-floor-b: #dfd2b6;
  --shop-rug-bg: #f3f4e8;
  --shop-rug-pattern: rgba(21, 128, 61, 0.08);
  --shop-rug-border: rgba(22, 163, 74, 0.30);
  --shop-accent: #15803d;
  --shop-accent-soft: rgba(22, 163, 74, 0.14);
  --shop-canopy-a: #d97706;
  --shop-canopy-b: #fef3c7;
}

#app .run-shop[data-shop-theme="alchemist"] {
  --shop-sky-a: #faf5ff;
  --shop-sky-b: #e9d5ff;
  --shop-floor-a: #e8e0f5;
  --shop-floor-b: #d8c8ec;
  --shop-rug-bg: #f4eefb;
  --shop-rug-pattern: rgba(147, 51, 234, 0.08);
  --shop-rug-border: rgba(168, 85, 247, 0.30);
  --shop-accent: #9333ea;
  --shop-accent-soft: rgba(147, 51, 234, 0.14);
  --shop-canopy-a: #7e22ce;
  --shop-canopy-b: #faf5ff;
}

#app .run-shop[data-shop-theme="royal"] {
  --shop-sky-a: #fffbeb;
  --shop-sky-b: #fee2e2;
  --shop-floor-a: #f8ece6;
  --shop-floor-b: #edd5cb;
  --shop-rug-bg: #fbf3ea;
  --shop-rug-pattern: rgba(180, 83, 9, 0.08);
  --shop-rug-border: rgba(217, 119, 6, 0.34);
  --shop-accent: #b45309;
  --shop-accent-soft: rgba(217, 119, 6, 0.14);
  --shop-canopy-a: #b91c1c;
  --shop-canopy-b: #fef3c7;
}

/* Override base .run-shop layout so both stages use full viewport without scrollbars */
#app .run-shop.shop-stage-room,
#app .run-shop.shop-stage-counter {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: calc(var(--run-hud-size, 96px) + 6px) clamp(14px, 2.2vw, 34px) clamp(12px, 2vh, 22px) !important;
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden !important;
  background: linear-gradient(180deg, var(--shop-sky-a, #f3f9ff) 0%, var(--shop-sky-b, #dfeeff) 100%) !important;
  color: #0f172a !important;
}

/* ============================================================================
   STAGE 1: MERCHANT ENTRY ROOM (.shop-stage-room) — STS2 Shop Room Composition
   ============================================================================ */
.shop-room-backdrop {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.shop-room-canopy {
  position: absolute;
  top: 0;
  left: -4%;
  right: -4%;
  height: clamp(120px, 21vh, 195px);
  background:
    repeating-linear-gradient(
      90deg,
      var(--shop-canopy-a) 0 54px,
      var(--shop-canopy-b) 54px 108px
    );
  opacity: 0.18;
  border-bottom: 3px solid rgba(15, 23, 42, 0.08);
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.95) 50%, transparent 100%);
  -webkit-mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.95) 50%, transparent 100%);
}

.shop-room-lanterns .shop-lantern {
  position: absolute;
  top: calc(var(--run-hud-size, 96px) + 26px);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 250, 220, 0.96) 0%, rgba(251, 191, 36, 0.45) 52%, transparent 74%);
  box-shadow: 0 0 42px 14px rgba(251, 191, 36, 0.24);
  animation: shopLanternGlow 3.6s ease-in-out infinite;
}
.shop-room-lanterns .shop-lantern.l1 { right: 28%; }
.shop-room-lanterns .shop-lantern.l2 { right: 14%; top: calc(var(--run-hud-size, 96px) + 52px); animation-delay: -1.6s; }

@keyframes shopLanternGlow {
  0%, 100% { transform: scale(1); opacity: 0.82; }
  50% { transform: scale(1.12); opacity: 1; }
}

.shop-room-floor {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 44%;
  background:
    repeating-linear-gradient(90deg, rgba(15, 23, 42, 0.03) 0 1px, transparent 1px 48px),
    repeating-linear-gradient(0deg, rgba(15, 23, 42, 0.03) 0 1px, transparent 1px 28px),
    linear-gradient(180deg, var(--shop-floor-a) 0%, var(--shop-floor-b) 100%);
  border-top: 2px solid rgba(255, 255, 255, 0.82);
}

.shop-room-stage {
  position: relative;
  z-index: 2;
  width: min(95vw, 1340px);
  height: min(76vh, 590px);
  display: grid;
  grid-template-columns: minmax(0, 0.72fr) minmax(0, 1.38fr);
  align-items: end;
  gap: clamp(18px, 3vw, 48px);
  padding: 0 clamp(12px, 2.4vw, 36px) clamp(28px, 5.5vh, 62px);
}

/* Left: Player Trainer & Animated Pixel Partner */
.shop-room-player {
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.shop-actor-pad {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 10px;
  padding-bottom: 18px;
}

.shop-ground-rug.is-player-rug {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: clamp(230px, 23vw, 320px);
  height: clamp(50px, 6.5vh, 72px);
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(255, 255, 255, 0.85) 0%, var(--shop-accent-soft) 56%, transparent 78%);
  border: 2px solid rgba(255, 255, 255, 0.72);
  box-shadow: 0 14px 28px -12px rgba(15, 23, 42, 0.16);
}

.shop-player-trainer {
  position: relative;
  z-index: 2;
  height: clamp(146px, 23vh, 212px);
  width: auto;
  image-rendering: pixelated;
  object-fit: contain;
  object-position: bottom center;
  transform: scaleX(-1);
  filter: drop-shadow(0 12px 14px rgba(15, 23, 42, 0.22));
}

.shop-player-partner {
  position: relative;
  z-index: 3;
  height: clamp(86px, 13.5vh, 126px);
  width: auto;
  image-rendering: pixelated;
  object-fit: contain;
  object-position: bottom center;
  transform: scaleX(-1);
  filter: drop-shadow(0 10px 12px rgba(15, 23, 42, 0.22));
}

/* Right: Clickable Merchant & Perspective Rug Stall with Real Miniature Cards & Items */
.shop-room-stall {
  position: relative;
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  text-align: left;
  color: inherit;
  transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

.shop-room-stall:hover {
  transform: translateY(-4px);
}

.shop-room-stall:focus-visible {
  outline: 3px solid var(--shop-accent);
  outline-offset: 8px;
  border-radius: 24px;
}

.shop-merchant-speech {
  position: relative;
  align-self: flex-end;
  margin-right: clamp(18px, 4vw, 68px);
  max-width: 420px;
  margin-bottom: 14px;
  padding: 13px 18px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.96);
  border: 1.5px solid rgba(148, 163, 184, 0.34);
  box-shadow:
    inset 0 1px 0 #ffffff,
    0 18px 36px -14px rgba(15, 23, 42, 0.16);
}

.shop-merchant-speech::after {
  content: "";
  position: absolute;
  right: 84px;
  bottom: -9px;
  width: 16px;
  height: 16px;
  background: rgba(255, 255, 255, 0.96);
  border-right: 1.5px solid rgba(148, 163, 184, 0.34);
  border-bottom: 1.5px solid rgba(148, 163, 184, 0.34);
  transform: rotate(45deg);
}

.shop-merchant-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
}

.shop-merchant-meta strong {
  font-size: 15px;
  font-weight: 900;
  color: #0f172a;
}

.shop-merchant-meta span {
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--shop-accent-soft);
  color: var(--shop-accent);
  font-size: 11.5px;
  font-weight: 800;
}

.shop-merchant-speech p {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.5;
  color: #334155;
}

.shop-stall-scene {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: clamp(4px, 1vw, 14px);
  width: 100%;
}

.shop-stall-rug-wrap {
  position: relative;
  flex: 0 0 auto;
  padding-top: 8px;
}

.shop-room-sale-sign {
  position: absolute;
  left: 14px;
  top: -12px;
  z-index: 8;
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: linear-gradient(135deg, #f97316 0%, #ef4444 100%);
  color: #ffffff;
  font-size: 19px;
  font-weight: 900;
  display: grid;
  place-items: center;
  transform: rotate(-10deg);
  box-shadow: 0 8px 18px -4px rgba(239, 68, 68, 0.52);
  border: 2px solid #ffffff;
}

.shop-stall-rug {
  --mini-card-w: clamp(44px, 4.3vw, 60px);
  --mini-card-h: calc(var(--mini-card-w) / 0.718);
  --mini-scale: 0.285;
  position: relative;
  padding: 16px 22px 18px;
  border-radius: 20px;
  background:
    repeating-linear-gradient(135deg, var(--shop-rug-pattern) 0 12px, transparent 12px 24px),
    var(--shop-rug-bg);
  border: 2.5px solid var(--shop-rug-border);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.92),
    0 22px 38px -14px rgba(15, 23, 42, 0.24),
    0 6px 0 rgba(15, 23, 42, 0.06);
  transform: perspective(760px) rotateX(27deg) rotateZ(-1.2deg);
  transform-origin: center bottom;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: box-shadow 0.2s ease, border-color 0.2s ease, transform 0.22s ease;
}

.shop-room-stall:hover .shop-stall-rug {
  border-color: var(--shop-accent);
  transform: perspective(760px) rotateX(24deg) rotateZ(-0.6deg) translateY(-2px);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.96),
    0 0 0 4px var(--shop-accent-soft),
    0 26px 46px -14px rgba(15, 23, 42, 0.28);
}

.shop-rug-mini-top {
  display: grid;
  grid-template-columns: repeat(5, var(--mini-card-w));
  gap: clamp(7px, 0.9vw, 12px);
  align-items: center;
}

.shop-rug-mini-bottom {
  display: grid;
  grid-template-columns: calc(var(--mini-card-w) * 2 + clamp(7px, 0.9vw, 12px)) auto auto;
  align-items: center;
  gap: clamp(10px, 1.4vw, 18px);
}

.shop-rug-mini-special {
  display: grid;
  grid-template-columns: repeat(2, var(--mini-card-w));
  gap: clamp(7px, 0.9vw, 12px);
}

/* Real shrunken PTCG card sitting flat on the rug */
.shop-rug-mini-card {
  position: relative;
  width: var(--mini-card-w);
  height: var(--mini-card-h);
  overflow: hidden;
  border-radius: 5px;
  box-shadow: 0 3px 6px rgba(15, 23, 42, 0.22);
  pointer-events: none;
}

.shop-rug-mini-card.is-sold {
  visibility: hidden;
}

.shop-rug-mini-card.is-sale {
  box-shadow: 0 0 0 1.5px #ef4444, 0 4px 8px rgba(239, 68, 68, 0.28);
}

.shop-rug-mini-scale {
  position: absolute;
  top: 0;
  left: 0;
  width: calc(var(--mini-card-w) / var(--mini-scale));
  height: calc(var(--mini-card-h) / var(--mini-scale));
  transform: scale(var(--mini-scale));
  transform-origin: top left;
  pointer-events: none;
}

#app .shop-rug-mini-scale .poke-card.is-card3d {
  width: 100% !important;
  height: 100% !important;
  margin: 0 !important;
  pointer-events: none !important;
  box-shadow: none !important;
}

/* Real shrunken 3 relics + 3 potions 2x3 grid on the rug */
.shop-rug-mini-wares {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.shop-rug-mini-ware-row {
  display: grid;
  grid-template-columns: repeat(3, 28px);
  gap: 8px;
  align-items: center;
  justify-items: center;
}

.shop-rug-mini-item {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.55);
}

.shop-rug-mini-item.is-sold {
  visibility: hidden;
}

.shop-rug-mini-item img {
  width: 24px;
  height: 24px;
  object-fit: contain;
  image-rendering: pixelated;
  filter: drop-shadow(0 3px 3px rgba(15, 23, 42, 0.25));
}

.shop-rug-mini-remove {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 35%, #fef08a 0%, #eab308 68%, #a16207 100%);
  border: 2px solid #ca8a04;
  box-shadow: 0 3px 6px rgba(15, 23, 42, 0.26);
}

.shop-rug-mini-remove.is-sold {
  opacity: 0.25;
  filter: grayscale(1);
}

.shop-merchant-actors {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  align-items: flex-end;
  margin-left: -10px;
  padding-bottom: 6px;
  pointer-events: none;
}

.shop-merchant-sprite {
  height: clamp(146px, 23vh, 212px);
  width: auto;
  image-rendering: pixelated;
  object-fit: contain;
  object-position: bottom center;
  filter: drop-shadow(0 14px 16px rgba(15, 23, 42, 0.24));
  transition: transform 0.22s ease;
}

.shop-room-stall:hover .shop-merchant-sprite {
  transform: scale(1.04) translateY(-3px);
}

.shop-merchant-companion {
  height: clamp(76px, 12vh, 110px);
  width: auto;
  image-rendering: pixelated;
  object-fit: contain;
  object-position: bottom center;
  margin-left: -14px;
  filter: drop-shadow(0 8px 12px rgba(15, 23, 42, 0.22));
}

.shop-stall-cta {
  margin-top: 14px;
  padding: 8px 22px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  border: 1.5px solid var(--shop-rug-border);
  color: var(--shop-accent);
  font-size: 13.5px;
  font-weight: 900;
  letter-spacing: 0.04em;
  box-shadow: 0 10px 22px -10px rgba(15, 23, 42, 0.18);
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.shop-room-stall:hover .shop-stall-cta {
  background: var(--shop-accent);
  border-color: var(--shop-accent);
  color: #ffffff;
  transform: scale(1.04);
}

/* Bottom-Right Proceed Button (Matches STS2 "前进" button placement) */
.shop-proceed-btn {
  position: fixed;
  right: clamp(20px, 3vw, 40px);
  bottom: clamp(20px, 3.6vh, 38px);
  z-index: 20;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 28px;
  border-radius: 999px;
  border: 0;
  background: linear-gradient(135deg, #0ea5e9 0%, #2563eb 100%);
  color: #ffffff;
  font: 900 17px/1 "Noto Sans SC", "PingFang SC", sans-serif;
  letter-spacing: 0.06em;
  cursor: pointer;
  box-shadow:
    0 16px 32px -8px rgba(37, 99, 235, 0.48),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
  transition: transform 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease;
}

.shop-proceed-btn svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 2.6;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.shop-proceed-btn:hover {
  transform: translateX(3px) translateY(-2px);
  box-shadow: 0 20px 38px -8px rgba(37, 99, 235, 0.6);
  filter: brightness(1.04);
}

/* ============================================================================
   STAGE 2: COMPACT STS2 COUNTER RUG (.shop-stage-counter)
   Full-proportion rug, zero header/section text clutter, 5-col tight alignment
   ============================================================================ */
.shop-return-arrow {
  position: fixed;
  left: clamp(12px, 1.6vw, 24px);
  top: 56%;
  transform: translateY(-50%);
  z-index: 30;
  width: 56px;
  height: 52px;
  border-radius: 16px;
  border: 1.5px solid rgba(148, 163, 184, 0.38);
  background: rgba(255, 255, 255, 0.96);
  color: #0f172a;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 #ffffff,
    0 14px 28px -10px rgba(15, 23, 42, 0.22);
  transition: transform 0.16s ease, border-color 0.16s ease, color 0.16s ease, background 0.16s ease;
}

.shop-return-arrow svg {
  width: 26px;
  height: 26px;
  stroke: currentColor;
  stroke-width: 2.8;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.shop-return-arrow:hover {
  transform: translateY(-50%) translateX(-3px);
  background: #f0f9ff;
  border-color: var(--shop-accent);
  color: var(--shop-accent);
}

/* Main Rug Board — fills ~90% of viewport width & height cleanly */
.shop-rug-board {
  --shop-card-w: clamp(138px, min(14.8vw, 24.5vh), 218px);
  position: relative;
  width: min(92vw, 1300px);
  max-height: calc(100vh - var(--run-hud-size, 96px) - 24px);
  padding: clamp(14px, 2.2vh, 26px) clamp(20px, 3vw, 44px);
  border-radius: 28px;
  background:
    repeating-linear-gradient(135deg, var(--shop-rug-pattern) 0 16px, transparent 16px 32px),
    var(--shop-rug-bg);
  border: 2px solid var(--shop-rug-border);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.94),
    0 26px 56px -22px rgba(15, 42, 78, 0.22),
    0 6px 18px -6px rgba(15, 23, 42, 0.08);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: clamp(12px, 2.1vh, 22px);
}

/* Merchant Reaction Bubble on Purchase */
.shop-rug-speech {
  position: absolute;
  top: 10px;
  right: clamp(24px, 4vw, 56px);
  z-index: 40;
  max-width: 300px;
  padding: 10px 18px;
  border-radius: 18px;
  background: rgba(15, 23, 42, 0.9);
  color: #f8fafc;
  font-size: 13.5px;
  font-weight: 800;
  line-height: 1.45;
  box-shadow: 0 14px 30px -10px rgba(15, 23, 42, 0.4);
  pointer-events: none;
  animation: shopSpeechPop 0.24s cubic-bezier(0.22, 1, 0.36, 1);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.shop-rug-speech.is-fading {
  opacity: 0;
  transform: translateY(-6px);
}

@keyframes shopSpeechPop {
  from { opacity: 0; transform: translateY(6px) scale(0.92); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Top Row: 5 Cards Tight Grid */
.shop-rug-row-top {
  display: grid;
  grid-template-columns: repeat(5, var(--shop-card-w));
  justify-content: space-between;
  align-items: start;
  gap: clamp(8px, 1.3vw, 18px);
}

/* Bottom Row: 2 Special Cards + 3x2 Relics/Potions + Removal Medallion */
.shop-rug-row-bottom {
  display: grid;
  grid-template-columns: calc(var(--shop-card-w) * 2 + clamp(8px, 1.3vw, 18px)) minmax(220px, 1fr) minmax(136px, 0.62fr);
  align-items: center;
  gap: clamp(14px, 2.2vw, 32px);
}

.shop-rug-special-cards {
  display: grid;
  grid-template-columns: repeat(2, var(--shop-card-w));
  justify-content: space-between;
  align-items: start;
  gap: clamp(8px, 1.3vw, 18px);
}

/* Individual Card Slot */
.shop-card-slot {
  position: relative;
  width: var(--shop-card-w);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  transition: transform 0.16s cubic-bezier(0.22, 1, 0.36, 1);
}

.shop-card-slot.is-sold {
  aspect-ratio: 0.64;
  visibility: hidden;
  pointer-events: none;
}

.shop-card-slot.is-affordable:hover {
  transform: translateY(-6px) scale(1.035);
  z-index: 12;
}

.shop-card-slot.is-unaffordable {
  cursor: not-allowed;
}

.shop-card-slot.is-unaffordable .shop-card-body {
  opacity: 0.78;
}

.shop-card-body {
  width: 100%;
  position: relative;
  isolation: isolate;
}

#app .shop-card-body > .poke-card.ptcg-v2,
#app .shop-card-body > .poke-card.ptcg-v2:hover,
#app .shop-card-body > .poke-card.ptcg-v2.is-tilting {
  z-index: 1 !important;
}

#app .shop-card-slot .poke-card.is-card3d {
  width: 100% !important;
  height: auto !important;
  aspect-ratio: 0.718 !important;
  margin: 0 !important;
  pointer-events: auto;
}

/* Red % Sale Ribbon (matches STS2 corner % badge) */
.shop-sale-ribbon {
  position: absolute;
  top: -7px;
  right: -7px;
  z-index: 80;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: #ffffff;
  font-size: 16px;
  font-weight: 900;
  display: grid;
  place-items: center;
  transform: translate3d(0, 0, 2px) rotate(10deg);
  border: 2px solid #ffffff;
  box-shadow: 0 6px 14px -3px rgba(220, 38, 38, 0.55);
  pointer-events: none;
}

/* Ultra-compact Price Tag (Coin icon + number, zero bulky box) */
.shop-card-price-row {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
}

.shop-tag-price {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-family: "Barlow Condensed", "Noto Sans SC", sans-serif;
  font-size: clamp(16px, 1.55vw, 21px);
  font-weight: 800;
  line-height: 1;
  color: #0f172a;
  font-variant-numeric: tabular-nums;
}

.shop-tag-price .shop-coin-ico {
  width: 18px;
  height: 18px;
  image-rendering: pixelated;
}

.shop-tag-price s {
  font-size: 0.74em;
  color: #94a3b8;
  margin-right: 2px;
}

.shop-tag-price.is-sale b {
  color: #16a34a;
}

.shop-tag-price.is-unaffordable b {
  color: #dc2626;
}

.shop-tag-price.is-muted {
  font-family: "Noto Sans SC", sans-serif;
  font-size: 13px;
  font-weight: 800;
  color: #94a3b8;
}

/* Middle Area: 2x3 Compact Relics (Row 1) & Potions (Row 2) */
.shop-rug-items-grid {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(14px, 2.4vh, 26px);
}

.shop-items-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(64px, 92px));
  justify-content: center;
  gap: clamp(10px, 1.8vw, 26px);
}

.shop-item-slot {
  position: relative;
  appearance: none;
  border: 0;
  background: transparent;
  padding: 6px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  border-radius: 16px;
  transition: transform 0.16s cubic-bezier(0.22, 1, 0.36, 1), background 0.16s ease;
}

.shop-item-slot.is-sold {
  min-width: 64px;
  min-height: 86px;
  visibility: hidden;
  pointer-events: none;
}

.shop-item-slot.is-affordable:hover {
  transform: translateY(-5px) scale(1.08);
  background: rgba(255, 255, 255, 0.65);
}

.shop-item-slot:disabled {
  cursor: not-allowed;
}

.shop-item-slot:disabled .shop-item-icon-wrap img {
  opacity: 0.65;
  filter: saturate(0.75);
}

.shop-item-icon-wrap {
  width: clamp(50px, 5vw, 68px);
  height: clamp(50px, 5vw, 68px);
  border-radius: 18px;
  background: radial-gradient(circle at 50% 42%, rgba(255, 255, 255, 0.94) 0%, rgba(255, 255, 255, 0.45) 70%, transparent 100%);
  display: grid;
  place-items: center;
}

.shop-item-icon-wrap img {
  width: clamp(40px, 4vw, 54px);
  height: clamp(40px, 4vw, 54px);
  object-fit: contain;
  image-rendering: pixelated;
  filter: drop-shadow(0 6px 8px rgba(15, 23, 42, 0.22));
}

.shop-item-sale-dot {
  position: absolute;
  top: 2px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: #ef4444;
  color: #ffffff;
  font-size: 11px;
  font-weight: 900;
  display: grid;
  place-items: center;
  border: 1.5px solid #ffffff;
  box-shadow: 0 4px 10px rgba(220, 38, 38, 0.4);
}

/* Right Area: Large Circular Card Removal Medallion (STS2 Iconic Coin) */
.shop-rug-remove-zone {
  display: flex;
  align-items: center;
  justify-content: center;
}

.shop-remove-medallion {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: transform 0.18s cubic-bezier(0.22, 1, 0.36, 1), filter 0.18s ease;
}

.shop-remove-medallion.is-affordable:hover {
  transform: translateY(-5px) scale(1.06);
  filter: drop-shadow(0 12px 22px rgba(217, 119, 6, 0.32));
}

.shop-remove-medallion:disabled {
  cursor: not-allowed;
}

.shop-remove-medallion.is-used .shop-remove-coin {
  opacity: 0.38;
  filter: grayscale(0.85);
}

.shop-remove-coin {
  width: clamp(92px, 9.8vw, 134px);
  height: clamp(92px, 9.8vw, 134px);
  display: block;
  filter: drop-shadow(0 12px 20px rgba(15, 23, 42, 0.2));
}

.shop-remove-coin svg {
  width: 100%;
  height: 100%;
  display: block;
}

.shop-remove-coin .coin-outer {
  fill: #eab308;
  stroke: #a16207;
  stroke-width: 2.5;
}

.shop-remove-coin .coin-inner {
  fill: #fef08a;
  stroke: #ca8a04;
  stroke-width: 2;
  stroke-dasharray: 4 3;
}

.shop-remove-coin .coin-card {
  fill: #92400e;
  opacity: 0.85;
}

.shop-remove-coin .coin-crack {
  fill: none;
  stroke: #fef08a;
  stroke-width: 3.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ============================================================================
   PURCHASE BEAM CANVAS & HUD ABSORPTION PULSE
   ============================================================================ */
.shop-purchase-beam-canvas {
  position: fixed;
  inset: 0;
  z-index: 9990;
  pointer-events: none;
}

@keyframes shopHudAbsorbPulse {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(251, 191, 36, 0.85); }
  35% { transform: scale(1.16); box-shadow: 0 0 0 12px rgba(251, 191, 36, 0.35), 0 0 24px rgba(249, 115, 22, 0.65); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(251, 191, 36, 0); }
}

.shop-hud-absorb-pulse {
  animation: shopHudAbsorbPulse 0.48s cubic-bezier(0.22, 1, 0.36, 1) !important;
}

/* ============================================================================
   RESPONSIVE ADJUSTMENTS
   ============================================================================ */
@media (max-width: 980px) {
  #app .run-shop.shop-stage-counter {
    overflow-y: auto !important;
    justify-content: flex-start;
  }
  .shop-rug-board {
    --shop-card-w: clamp(120px, 17vw, 170px);
    max-height: none;
  }
  .shop-rug-row-bottom {
    grid-template-columns: 1fr;
    justify-items: center;
  }
  .shop-room-stage {
    grid-template-columns: 1fr;
    height: auto;
  }
  .shop-room-player {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .shop-player-partner,
  .shop-merchant-companion,
  .shop-room-lanterns .shop-lantern {
    animation: none !important;
  }
}
