/* Paper Studio V2 — 3D Interactive Showcase Gallery & Player Host */

.ps-showcase-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 0%, rgba(196, 148, 86, 0.14), transparent 46%),
    radial-gradient(circle at 86% 12%, rgba(124, 88, 50, 0.1), transparent 40%),
    var(--ps-bg);
}

.ps-showcase-main {
  padding-bottom: 56px;
}

/* 3D Warm-Studio Stage */
.ps-stage-section {
  margin-top: 22px;
}

.ps-stage-frame {
  position: relative;
  border-radius: var(--ps-radius);
  border: 1px solid var(--ps-border);
  background: linear-gradient(180deg, #f5ecde 0%, #eadbc6 100%);
  box-shadow: var(--ps-shadow);
  overflow: hidden;
}

.ps-stage-canvas-wrap {
  position: relative;
  width: 100%;
  height: clamp(340px, 48vh, 480px);
  overflow: hidden;
}

.ps-stage-canvas-wrap canvas {
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
  touch-action: none;
}

.ps-stage-topbar {
  position: absolute;
  top: 14px;
  left: 16px;
  right: 16px;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  pointer-events: none;
}

.ps-stage-pill {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 253, 247, 0.88);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(124, 88, 50, 0.22);
  color: var(--ps-ink);
  font-size: 0.8rem;
  font-weight: 600;
}

.ps-stage-hud {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border-radius: var(--ps-radius-sm);
  background: rgba(255, 253, 247, 0.92);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(124, 88, 50, 0.22);
  box-shadow: 0 8px 24px rgba(68, 44, 18, 0.12);
  flex-wrap: wrap;
}

.ps-stage-hud__info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1 1 280px;
}

.ps-stage-hud__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 0.78rem;
  color: var(--ps-muted);
}

.ps-stage-type-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--ps-accent-soft);
  color: var(--ps-accent);
  border: 1px solid color-mix(in srgb, var(--ps-accent) 26%, transparent);
}

.ps-stage-hud__title {
  margin: 0;
  font-family: var(--ps-heading-font);
  font-size: 1.12rem;
  font-weight: 700;
  color: var(--ps-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ps-stage-hud__subtitle {
  margin: 0;
  font-size: 0.85rem;
  color: var(--ps-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ps-stage-hud__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* 2D Graceful Fallback Gallery inside Stage */
.ps-stage-fallback {
  height: 100%;
  overflow-y: auto;
  padding: 52px 18px 110px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(176px, 1fr));
  gap: 14px;
  align-content: start;
}

.ps-plaque-2d {
  display: flex;
  flex-direction: column;
  text-align: left;
  padding: 8px;
  border-radius: 12px;
  border: 2px solid rgba(124, 88, 50, 0.22);
  background: #fffdf8;
  box-shadow: 0 6px 16px rgba(74, 49, 24, 0.1);
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.ps-plaque-2d:hover,
.ps-plaque-2d[aria-pressed="true"] {
  transform: translateY(-2px);
  border-color: var(--ps-accent);
}

.ps-plaque-2d__media {
  aspect-ratio: 4 / 3;
  border-radius: 8px;
  overflow: hidden;
  background: var(--ps-surface-alt);
  margin-bottom: 8px;
}

.ps-plaque-2d__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ps-plaque-2d__title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--ps-ink);
  margin: 4px 0 0;
  line-height: 1.35;
}

/* Featured Strip below Stage */
.ps-stage-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--ps-surface);
  border-top: 1px solid var(--ps-border);
  overflow-x: auto;
}

.ps-stage-chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--ps-border);
  background: var(--ps-surface-alt);
  color: var(--ps-ink);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.ps-stage-chip[aria-pressed="true"] {
  background: var(--ps-accent);
  border-color: var(--ps-accent);
  color: #ffffff;
}

/* Filterable Multi-Type Catalog */
.ps-catalog-section {
  margin-top: 28px;
}

.ps-catalog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.ps-catalog-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.ps-catalog-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--ps-border);
  background: var(--ps-surface);
  color: var(--ps-ink);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.ps-catalog-tab:hover {
  border-color: var(--ps-accent);
}

.ps-catalog-tab[aria-selected="true"] {
  background: var(--ps-accent);
  border-color: var(--ps-accent);
  color: #ffffff;
}

.ps-catalog-tab__count {
  font-size: 0.76rem;
  opacity: 0.82;
}

.ps-catalog-count {
  font-size: 0.86rem;
  color: var(--ps-muted);
}

/* Play Host Shell (matches portal/play.html layout contract) */
.ps-play-page {
  height: 100vh;
  height: 100dvh;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.ps-play-shell {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
}

.ps-player-host {
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
  min-height: 0;
  position: relative;
}

.ps-play-footer {
  padding: 12px 20px;
  background: var(--ps-bg);
  border-top: 1px solid var(--ps-border);
}

.ps-play-footer[hidden] {
  display: none;
}

.ps-error-box {
  max-width: 560px;
  margin: 48px auto;
  padding: 20px 24px;
  background: var(--ps-surface);
  border: 1px solid var(--ps-border);
  border-radius: var(--ps-radius);
}

body.ps-export-mode .ps-play-footer {
  display: none !important;
}

body.ps-export-mode .ps-player-host {
  width: 100vw;
  height: 100vh;
  min-height: 100vh;
  overflow: hidden;
}

@media (max-width: 680px) {
  .ps-stage-canvas-wrap {
    height: 360px;
  }
  .ps-stage-hud {
    padding: 12px 14px;
  }
}
