/* ==========================================================================
   3D Badge Pack Opener — Minimalist Avezz Native Design (Light & Dark)
   ========================================================================== */

.po-page {
  max-width: 1240px;
  margin: 0 auto;
  padding: 20px 18px 64px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Header */
.po-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.po-header-left { display: flex; flex-direction: column; gap: 3px; }
.po-title {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text);
}
.po-subtitle {
  margin: 0;
  font-size: 13.5px;
  color: var(--text-secondary);
}

.po-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.po-wallet-pill {
  height: 34px;
  padding: 0 13px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--text);
}
.po-wallet-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

/* Main 2-Column Workspace */
.po-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.78fr);
  gap: 18px;
  align-items: stretch;
}

/* 3D Interactive Stage Card */
.po-stage-card {
  position: relative;
  min-height: 520px;
  border-radius: var(--radius-xl);
  overflow: hidden;
  background: radial-gradient(circle at 50% 42%, #181c28 0%, #0d1018 72%, #090b11 100%);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-card);
  user-select: none;
  -webkit-user-select: none;
}

#po-gl-canvas,
#po-fx-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
#po-gl-canvas { z-index: 1; cursor: grab; }
#po-gl-canvas:active { cursor: grabbing; }
#po-fx-canvas { z-index: 3; pointer-events: none; }

.po-stage-top {
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  pointer-events: none;
}
.po-stage-badge {
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(15, 18, 28, 0.72);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  font-size: 11.5px;
  font-weight: 600;
  color: #f5f5f7;
}
.po-stage-back {
  pointer-events: auto;
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(15, 18, 28, 0.78);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #f5f5f7;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.po-stage-back:hover { background: rgba(30, 36, 52, 0.9); }

/* Bottom Frosted Action Bar inside 3D Stage */
.po-stage-bar {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 4;
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  background: rgba(14, 17, 26, 0.78);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.po-stage-meta { min-width: 0; flex: 1; }
.po-stage-name {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.po-stage-desc {
  margin: 3px 0 0;
  font-size: 12.5px;
  color: rgba(245, 245, 247, 0.72);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.po-stage-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.po-btn-primary {
  height: 40px;
  padding: 0 20px;
  border-radius: 999px;
  border: 0;
  background: var(--accent);
  color: #ffffff;
  font-size: 13.5px;
  font-weight: 650;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: transform 0.15s ease, filter 0.15s ease, opacity 0.15s ease;
}
.po-btn-primary:hover:not(:disabled) { filter: brightness(1.08); transform: translateY(-1px); }
.po-btn-primary:disabled { opacity: 0.45; cursor: not-allowed; }

.po-btn-ghost {
  height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: #f5f5f7;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.po-btn-ghost:hover { background: rgba(255, 255, 255, 0.15); }

/* Right Panel: Available Packs */
.po-packs-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.po-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.po-panel-head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.015em;
}
.po-count-pill {
  font-size: 11.5px;
  font-weight: 650;
  color: var(--text-secondary);
  background: var(--surface-muted);
  padding: 2px 9px;
  border-radius: 999px;
}

.po-packs-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  max-height: 454px;
  padding-right: 2px;
}

.po-pack-item {
  width: 100%;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface-subtle);
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}
.po-pack-item:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
}
.po-pack-item.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.po-pack-thumb {
  width: 46px;
  height: 46px;
  border-radius: 11px;
  background: #10131c;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  padding: 5px;
}
.po-pack-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
}
.po-pack-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.po-pack-name {
  font-size: 14px;
  font-weight: 650;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.po-pack-meta {
  font-size: 12px;
  color: var(--text-secondary);
}
.po-pack-price {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  flex-shrink: 0;
}
.po-pack-item.is-active .po-pack-price {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

/* Bottom Section: Possible Drops & Recently Opened */
.po-below {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.po-below-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.po-tabs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  border-radius: 11px;
  background: var(--segment-bg);
}
.po-tab {
  height: 32px;
  padding: 0 13px;
  border-radius: 8px;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 650;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.po-tab.is-active {
  background: var(--segment-active);
  color: var(--text);
  box-shadow: var(--segment-shadow);
}
.po-tab-cnt {
  font-size: 11px;
  color: var(--text-secondary);
}
.po-below-hint {
  font-size: 12px;
  color: var(--text-secondary);
}

.po-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(156px, 1fr));
  gap: 12px;
}
.po-grid[hidden] { display: none; }

.po-badge-tile {
  --r-accent: #94a3b8;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface-subtle);
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}
.po-badge-tile:hover {
  transform: translateY(-2px);
  border-color: var(--r-accent);
  background: var(--surface-hover);
}
.po-badge-tile.is-selected {
  border-color: var(--r-accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--r-accent) 28%, transparent);
}
.po-badge-tile.r-mythic    { --r-accent: #f43f5e; }
.po-badge-tile.r-legendary { --r-accent: #f59e0b; }
.po-badge-tile.r-epic      { --r-accent: #a855f7; }
.po-badge-tile.r-rare      { --r-accent: #3b82f6; }
.po-badge-tile.r-common    { --r-accent: #94a3b8; }

.po-tile-art {
  width: 72px;
  height: 72px;
  border-radius: 12px;
  background: radial-gradient(circle at 50% 45%, color-mix(in srgb, var(--r-accent) 22%, #10131c) 0%, #10131c 75%);
  display: grid;
  place-items: center;
  padding: 8px;
}
.po-tile-art img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
}
.po-tile-name {
  font-size: 13px;
  font-weight: 650;
  color: var(--text);
  line-height: 1.25;
}
.po-tile-sub {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
}
.po-rarity-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--r-accent);
}

.po-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 32px 16px;
  color: var(--text-secondary);
  font-size: 13.5px;
}

@media (max-width: 920px) {
  .po-workspace { grid-template-columns: 1fr; }
  .po-stage-card { min-height: 440px; }
  .po-packs-list {
    flex-direction: row;
    overflow-x: auto;
    max-height: none;
    padding-bottom: 4px;
  }
  .po-pack-item { min-width: 220px; width: auto; flex-shrink: 0; }
}

@media (max-width: 600px) {
  .po-page { padding: 14px 12px 56px; }
  .po-stage-card { min-height: 410px; }
  .po-stage-bar { flex-direction: column; align-items: stretch; gap: 10px; }
  .po-stage-actions { justify-content: stretch; }
  .po-btn-primary, .po-btn-ghost { flex: 1; justify-content: center; }
}
