.psd-directory {
  --psd-accent: #d4dc54;
  --psd-ink: #111111;
  --psd-muted: #6b6b6b;
  --psd-line: rgba(17, 17, 17, 0.1);
  --psd-surface: #f6f6f3;
  --psd-white: #ffffff;
  --psd-spot: #d4dc54;
  font-family: Epilogue, sans-serif;
  color: var(--psd-ink);
  margin: 0 auto;
  padding: 0 0 3rem;
  max-width: 1311px;
}

.psd-layout {
  --psd-panel-height: min(78vh, 820px);
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
  gap: 1.25rem;
  align-items: stretch;
}

/* —— Map panel —— */
.psd-map-panel {
  order: 1;
  position: sticky;
  top: 0.75rem;
  display: flex;
  flex-direction: column;
  height: var(--psd-panel-height);
  max-height: var(--psd-panel-height);
  background: var(--psd-white);
  border: 1px solid var(--psd-line);
  border-radius: 18px;
  overflow: hidden;
}

.psd-dir-panel {
  order: 2;
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: var(--psd-panel-height);
  max-height: var(--psd-panel-height);
}

@media (max-width: 980px) {
  .psd-layout {
    grid-template-columns: 1fr;
    --psd-panel-height: auto;
  }

  /* List first on mobile, map below */
  .psd-dir-panel {
    order: 1;
    height: auto;
    max-height: none;
  }

  .psd-map-panel {
    order: 2;
    position: relative;
    top: 0;
    height: auto;
    max-height: none;
  }
}

.psd-map-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  flex: 0 0 auto;
  gap: 0.65rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--psd-line);
  background: linear-gradient(180deg, #fff 0%, #fafaf7 100%);
}

.psd-floor-tabs {
  display: inline-flex;
  gap: 0.35rem;
  padding: 0.2rem;
  background: var(--psd-surface);
  border-radius: 999px;
}

.psd-floor-tab {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--psd-ink);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.psd-floor-tab.is-active {
  background: var(--psd-accent);
  color: #111;
}

.psd-map-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.psd-map-btn {
  appearance: none;
  border: 1px solid var(--psd-line);
  background: var(--psd-white);
  color: var(--psd-ink);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.psd-map-btn:hover {
  border-color: rgba(17, 17, 17, 0.28);
  transform: translateY(-1px);
}

.psd-map-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(circle at 20% 0%, rgba(212, 220, 84, 0.12), transparent 45%),
    #f3f3ef;
}

.psd-map-frame {
  position: relative;
  flex: 1 1 auto;
  width: 100%;
  min-height: 280px;
  height: auto;
  max-height: none;
  overflow: hidden;
  cursor: grab;
}

@media (max-width: 980px) {
  .psd-map-stage {
    min-height: 280px;
  }

  .psd-map-frame {
    height: min(58vh, 520px);
    max-height: min(58vh, 520px);
    flex: none;
  }
}

.psd-map-frame.is-dragging {
  cursor: grabbing;
}

.psd-map-canvas {
  position: relative;
  width: max-content;
  transform-origin: 0 0;
  will-change: transform;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.psd-map-canvas.is-instant {
  transition: none;
}

.psd-map-media {
  position: relative;
  width: max-content;
  background: #fff;
}

/* Keep map at natural pixel size; JS scales via transform (avoids blurry downsample+zoom). */
.psd-map-img {
  display: block;
  width: auto;
  max-width: none;
  height: auto;
  user-select: none;
  pointer-events: none;
}

.psd-map-img.is-hidden {
  display: none;
}

[data-psd-spots] {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
}

.psd-spot {
  position: absolute;
  width: 22px;
  height: 22px;
  margin: 0;
  padding: 0;
  border-radius: 50%;
  border: 2px solid #111;
  background: rgba(212, 220, 84, 0.85);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.9), 0 2px 8px rgba(0, 0, 0, 0.28);
  transform: translate(-50%, -50%) scale(calc(var(--psd-pin-scale, 1) * 0.9));
  transform-origin: center center;
  opacity: 0.55;
  cursor: pointer;
  transition: opacity 0.2s ease, background 0.2s ease;
  z-index: 6;
  pointer-events: auto;
}

.psd-spot:hover,
.psd-spot.is-active {
  opacity: 1;
  transform: translate(-50%, -50%) scale(calc(var(--psd-pin-scale, 1) * 1.2));
  background: var(--psd-accent);
  z-index: 8;
}

.psd-spot.is-active {
  animation: psd-pulse 1.4s ease-out infinite;
}

.psd-spot.is-dimmed {
  opacity: 0.18;
}

@keyframes psd-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(212, 220, 84, 0.7);
  }
  70% {
    box-shadow: 0 0 0 18px rgba(212, 220, 84, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(212, 220, 84, 0);
  }
}

.psd-spotlight {
  position: absolute;
  width: 96px;
  height: 96px;
  margin: 0;
  border-radius: 50%;
  pointer-events: none;
  z-index: 4;
  opacity: 0;
  background: radial-gradient(
    circle,
    rgba(212, 220, 84, 0.35) 0%,
    rgba(212, 220, 84, 0.12) 45%,
    transparent 70%
  );
  border: 2px solid rgba(212, 220, 84, 0.85);
  transform: translate(-50%, -50%) scale(var(--psd-pin-scale, 1));
  transform-origin: center center;
  transition: opacity 0.25s ease, left 0.35s cubic-bezier(0.22, 1, 0.36, 1),
    top 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.psd-spotlight.is-on {
  opacity: 1;
}

.psd-map-caption {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: baseline;
  flex: 0 0 auto;
  padding: 0.7rem 1rem 0.9rem;
  border-top: 1px solid var(--psd-line);
  font-size: 0.82rem;
  color: var(--psd-muted);
}

.psd-map-caption strong {
  color: var(--psd-ink);
  font-weight: 600;
}

.psd-map-caption .psd-no-map {
  color: #a05a00;
}

/* —— Directory panel —— */
.psd-toolbar {
  position: sticky;
  top: 0;
  z-index: 15;
  flex: 0 0 auto;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
  border: 1px solid var(--psd-line);
  border-radius: 16px;
  padding: 0.85rem;
  margin-bottom: 0.9rem;
}

.psd-toolbar-inner {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.psd-search-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
}

.psd-search {
  position: relative;
  flex: 1 1 180px;
  min-width: min(100%, 160px);
}

.psd-search-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1rem;
  height: 1rem;
  color: var(--psd-muted);
  pointer-events: none;
}

.psd-search-input,
.psd-sort {
  width: 100%;
  border: 1px solid var(--psd-line);
  background: var(--psd-white);
  border-radius: 999px;
  padding: 0.7rem 0.95rem 0.7rem 2.45rem;
  font: inherit;
  font-size: 0.9rem;
  color: var(--psd-ink);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.psd-sort {
  flex: 0 0 auto;
  width: auto;
  min-width: 140px;
  padding-left: 0.95rem;
  cursor: pointer;
}

.psd-search-input:focus,
.psd-sort:focus {
  border-color: var(--psd-accent);
  box-shadow: 0 0 0 3px rgba(212, 220, 84, 0.35);
}

.psd-count {
  margin: 0;
  font-size: 0.8rem;
  color: var(--psd-muted);
  white-space: nowrap;
}

.psd-count strong {
  color: var(--psd-ink);
  font-weight: 600;
}

.psd-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.28rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.psd-chip {
  appearance: none;
  border: 1px solid var(--psd-line);
  background: var(--psd-white);
  color: var(--psd-ink);
  border-radius: 999px;
  padding: 0.26rem 0.5rem;
  font: inherit;
  font-size: 0.65rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.psd-chip:hover {
  border-color: rgba(17, 17, 17, 0.28);
  transform: translateY(-1px);
}

.psd-chip.is-active {
  background: var(--psd-accent);
  border-color: var(--psd-accent);
  color: #111;
}

.psd-list {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  gap: 0.45rem;
  min-height: 0;
  max-height: none;
  overflow: auto;
  padding-right: 0.15rem;
}

@media (max-width: 980px) {
  .psd-list {
    flex: none;
    max-height: none;
  }
}

.psd-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.7rem;
  text-decoration: none;
  color: inherit;
  background: var(--psd-surface);
  border: 1px solid transparent;
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.psd-card:hover,
.psd-card:focus-visible,
.psd-card.is-selected {
  background: var(--psd-white);
  border-color: rgba(212, 220, 84, 0.85);
  outline: none;
}

.psd-card.is-selected {
  box-shadow: 0 0 0 2px rgba(212, 220, 84, 0.35);
}

.psd-card.is-hidden {
  display: none;
}

.psd-thumb {
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--psd-white);
  display: grid;
  place-items: center;
}

.psd-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.psd-fallback {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #eef1c8 0%, #d4dc54 100%);
  color: #111;
  font-size: 0.85rem;
  font-weight: 700;
}

.psd-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  flex: 1;
}

.psd-name {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.psd-cats {
  margin: 0;
  font-size: 0.74rem;
  color: var(--psd-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Beat theme link colors that force black text on dark buttons */
.psd-directory a.psd-store-link,
.psd-directory a.psd-store-link:link,
.psd-directory a.psd-store-link:visited,
.psd-directory a.psd-store-link:active {
  flex: 0 0 auto;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 0.38rem 0.7rem;
  border-radius: 999px;
  background: #111111;
  color: #ffffff;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.2s ease, transform 0.2s ease, color 0.2s ease;
}

.psd-directory a.psd-store-link:hover,
.psd-directory a.psd-store-link:focus-visible {
  background: #2a2a2a;
  color: #ffffff;
  outline: none;
  transform: translateY(-1px);
}

.psd-directory .psd-card.is-selected a.psd-store-link,
.psd-directory .psd-card.is-selected a.psd-store-link:link,
.psd-directory .psd-card.is-selected a.psd-store-link:visited {
  background: var(--psd-accent);
  color: #111111;
}

.psd-empty {
  display: none;
  text-align: center;
  padding: 2rem 1rem;
  color: var(--psd-muted);
  border: 1px dashed var(--psd-line);
  border-radius: 14px;
  background: rgba(246, 246, 243, 0.6);
}

.psd-empty.is-visible {
  display: block;
}

/* —— Gallery modal —— */
.psd-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.psd-modal.is-open {
  display: flex;
}

.psd-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 10, 0.72);
  backdrop-filter: blur(4px);
}

.psd-modal-dialog {
  position: relative;
  z-index: 1;
  width: min(1100px, 100%);
  max-height: min(92vh, 900px);
  background: #111;
  color: #fff;
  border-radius: 18px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
  animation: psd-modal-in 0.28s ease;
}

@keyframes psd-modal-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.psd-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.psd-modal-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.psd-modal-close {
  appearance: none;
  border: 0;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
}

.psd-modal-body {
  position: relative;
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 0.75rem;
  background: #0a0a0a;
}

.psd-modal-body img {
  max-width: 100%;
  max-height: min(72vh, 760px);
  object-fit: contain;
  border-radius: 8px;
  background: #fff;
}

.psd-modal-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  appearance: none;
  border: 0;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 1.4rem;
  cursor: pointer;
}

.psd-modal-nav.prev {
  left: 0.75rem;
}

.psd-modal-nav.next {
  right: 0.75rem;
}

.psd-modal-foot {
  display: flex;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.psd-modal-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  border: 0;
  padding: 0;
  cursor: pointer;
}

.psd-modal-dot.is-active {
  background: var(--psd-accent);
}

body.psd-modal-open {
  overflow: hidden;
}

.screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
