/* ═════════ Shop dock: the shop sits at the bottom / left so the map stays in view ═════════ */
.sd {
  position: absolute;
  z-index: 34;
  left: 0;
  right: 0;
  bottom: 0;
  height: min(44%, 23rem);
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  padding: 0 0 env(safe-area-inset-bottom);
  background: #fffaf0;
  border-top: 4px solid #263238;
  border-radius: 1.3rem 1.3rem 0 0;
  box-shadow: 0 -6px 0 rgba(38, 50, 56, 0.18);
  font-family: "Fredoka", "Nunito", system-ui, sans-serif;
  color: #263238;
  animation: sd-up 0.22s cubic-bezier(0.34, 1.3, 0.64, 1) both;
}
.sd[hidden] {
  display: none;
}
@keyframes sd-up {
  from { transform: translateY(40%); opacity: 0; }
}
.sd__head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.6rem 0.4rem 0.9rem;
  border-radius: 1rem 1rem 0 0;
  background: linear-gradient(180deg, #2a9d8f, #1f7a6f);
  border-bottom: 3px solid #263238;
  color: #fff;
}
.sd[data-shop="garden"] .sd__head { background: linear-gradient(180deg, #ab47bc, #7b1fa2); }
.sd[data-shop="train"] .sd__head { background: linear-gradient(180deg, #26a69a, #00796b); }
.sd[data-shop="harbour"] .sd__head { background: linear-gradient(180deg, #42a5f5, #1565c0); }
.sd[data-shop="mountain"] .sd__head { background: linear-gradient(180deg, #8d6e63, #5d4037); }
.sd__title {
  margin: 0;
  flex: 1;
  min-width: 0;
  font-size: 1.15rem;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 2px 0 rgba(38, 50, 56, 0.4);
}
.sd__purse {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: #fff3c4;
  border: 2px solid #263238;
  color: #263238;
  font-weight: 800;
  font-size: 0.85rem;
  white-space: nowrap;
}
.sd__close {
  flex: none;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 3px solid #263238;
  background: #ff9800;
  box-shadow: 0 3px 0 #263238;
  color: #fff;
  font: inherit;
  font-weight: 800;
  font-size: 0.95rem;
  text-shadow: 0 1px 0 rgba(38, 50, 56, 0.4);
  cursor: pointer;
}
.sd__close:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #263238;
}
.sd__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem 0.5rem;
  padding: 0.4rem 0.8rem 0.2rem;
}
.sd__hint {
  margin: 0;
  flex: 1 1 12rem;
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.25;
}
.sd__body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 0 0.7rem 0.7rem;
}
.sd-sec__title {
  margin: 0.4rem 0 0.25rem;
  font-size: 0.9rem;
  font-weight: 800;
  opacity: 0.85;
}
.sd-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(5.6rem, 1fr));
  gap: 0.5rem;
  padding: 0.15rem 0.1rem 0.35rem;
}
.sd .sd-item {
  flex: none;
  min-width: 0;
  gap: 0.1rem;
  padding: 0.3rem 0.3rem 0.4rem;
  border-width: 3px;
  border-radius: 0.95rem;
  box-shadow: 0 3px 0 #263238;
  scroll-snap-align: none;
}
.sd .sd-item .th-item__pic {
  height: 3.2rem;
  border-radius: 0.6rem;
}
.sd .sd-item .th-item__name {
  font-size: 0.82rem;
}
.sd .sd-item .th-item__cost {
  padding: 0 0.4rem;
  font-size: 0.8rem;
  gap: 0.25rem;
  border-width: 2px;
}
.sd .sd-item .th-item__count {
  font-size: 0.72rem;
}
/* placing / moving: the panel shrinks to its top bar — ◀ Back, a picture of the thing and the hint */
.sd.is-mini {
  height: auto;
}
.sd.is-mini .sd__body {
  display: none;
}
.sd.is-mini .sd__bar {
  padding-bottom: 0.55rem;
  flex-wrap: nowrap;
}
.sd.is-mini .sd__purse {
  display: none;
}
@media (min-aspect-ratio: 1/1) and (min-width: 700px) {
  .sd.is-mini {
    bottom: auto;
  }
}
.sd__back {
  flex: none;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 3px solid #263238;
  background: #fffaf0;
  box-shadow: 0 3px 0 #263238;
  color: #263238;
  font: inherit;
  font-weight: 800;
  font-size: 0.95rem;
  cursor: pointer;
}
.sd__back[hidden],
.sd__close[hidden],
.sd__pick[hidden] {
  display: none;
}
.sd__back:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #263238;
}
.sd__pick {
  flex: none;
  width: 3rem;
  height: 3rem;
  border-radius: 0.7rem;
  border: 3px solid #2e7d32;
  background: #e8f5e9;
  overflow: hidden;
}
.sd__pick img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* the picked item: lifted with a green ring */
.sd .sd-item.is-on {
  background: #e8f5e9;
  border-color: #2e7d32;
  box-shadow: 0 3px 0 #2e7d32, 0 0 0 4px rgba(105, 240, 174, 0.75);
  transform: translateY(-2px);
}
/* wide screens: down the left side instead, so the map stays big */
@media (min-aspect-ratio: 1/1) and (min-width: 700px) {
  .sd {
    left: max(0.6rem, env(safe-area-inset-left));
    right: auto;
    top: calc(max(0.75rem, env(safe-area-inset-top)) + 3.6rem);
    bottom: max(0.6rem, env(safe-area-inset-bottom));
    width: min(21rem, 36vw);
    height: auto;
    padding: 0;
    border: 4px solid #263238;
    border-radius: 1.3rem;
    box-shadow: 0 5px 0 rgba(38, 50, 56, 0.3);
    animation-name: sd-left;
  }
  .sd__head {
    border-radius: 1rem 1rem 0 0;
  }
  @keyframes sd-left {
    from { transform: translateX(-30%); opacity: 0; }
  }
}
/* short landscape phones: a slimmer side panel */
@media (min-aspect-ratio: 1/1) and (max-height: 480px) and (min-width: 700px) {
  .sd { top: 0.5rem; width: min(17rem, 34vw); }
  .sd .sd-item .th-item__pic { height: 2.8rem; }
}
@media (prefers-reduced-motion: reduce) {
  .sd { animation: none; }
}

/* a placed thing you tapped: ✋ move · ↻ turn · 🗑️ remove (under it on the map) */
.aa-sel-btns {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 26;
  display: flex;
  gap: 0.45rem;
  pointer-events: auto;
  will-change: transform;
}
.aa-sel-btns[hidden] {
  display: none;
}
.aa-sel-btns .aa-ghost-btn {
  width: 2.9rem;
  height: 2.9rem;
  font-size: 1.35rem;
}
.aa-ghost-btn--move { background: #7e57c2; }
.aa-ghost-btn--del { background: #e53935; }
.aa-ghost-btn--cancel { background: #90a4ae; }

/* JG-072: something a character is wishing for glows */
.sd-item.is-wish {
  position: relative;
  box-shadow: 0 0 0 3px #ffd54f, 0 0 14px 4px rgba(255, 213, 79, 0.85);
  animation: sd-wish-glow 1.6s ease-in-out infinite;
}
.sd-item__wish {
  position: absolute;
  top: -0.55rem;
  left: -0.45rem;
  font-size: 1.25rem;
  line-height: 1;
  filter: drop-shadow(0 1px 0 rgba(38, 50, 56, 0.4));
}
@keyframes sd-wish-glow {
  0%, 100% { box-shadow: 0 0 0 3px #ffd54f, 0 0 8px 2px rgba(255, 213, 79, 0.6); }
  50% { box-shadow: 0 0 0 3px #ffca28, 0 0 18px 6px rgba(255, 213, 79, 0.95); }
}
@media (prefers-reduced-motion: reduce) {
  .sd-item.is-wish { animation: none; }
}

/* JG-079: gift shops — a big emoji instead of a 3D thumbnail */
.sd-item.is-gift .th-item__pic {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.6rem;
  line-height: 1;
}
