/* v2.16 card shop */

.shop-panel {
  align-items: start;
  padding-top: clamp(24px, 4vw, 42px);
  padding-bottom: clamp(28px, 5vw, 54px);
}

.shop-shell {
  width: min(100%, 920px);
  position: relative;
  z-index: 1;
}

.shop-header {
  text-align: center;
}

.shop-header .scene-title {
  font-size: clamp(1.8rem, 5vw, 3.2rem);
}

.shop-balance {
  margin: 20px auto 0;
  width: fit-content;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border: 1px solid rgba(255, 225, 145, .34);
  border-radius: 999px;
  background: rgba(18, 15, 11, .72);
  color: #e9dfcf;
  font-size: .78rem;
  font-weight: 850;
}

.shop-balance strong {
  color: #ffd86a;
  font-size: 1rem;
}

.shop-pack-card {
  width: min(100%, 560px);
  margin: 24px auto 0;
  padding: 24px;
  display: grid;
  grid-template-columns: 128px 1fr;
  gap: 24px;
  align-items: center;
  border: 1px solid rgba(220, 195, 150, .35);
  border-radius: 20px;
  background: rgba(20, 16, 12, .88);
  box-shadow: 0 18px 38px rgba(0, 0, 0, .25);
  text-align: left;
}

.shop-pack-art {
  width: 112px;
  aspect-ratio: .72;
  margin: auto;
  display: grid;
  place-items: center;
  border: 2px solid #a9d33d;
  border-radius: 13px;
  background:
    radial-gradient(circle at 50% 35%, rgba(201, 255, 80, .3), transparent 26%),
    repeating-linear-gradient(45deg, rgba(184, 236, 61, .08) 0 8px, rgba(14, 29, 17, .04) 8px 16px),
    #16241a;
  color: #c8ff48;
  font-size: 2rem;
  font-weight: 1000;
  letter-spacing: .08em;
  box-shadow: 0 10px 24px rgba(0, 0, 0, .34), inset 0 0 0 4px rgba(255, 255, 255, .035);
}

.shop-pack-info h3 {
  margin: 0;
  color: #fff1d7;
  font-size: 1.35rem;
}

.shop-pack-info p {
  margin: 8px 0 0;
  color: #b9afa1;
  font-size: .78rem;
  line-height: 1.7;
}

.shop-pack-price {
  margin-top: 15px;
  display: flex;
  align-items: baseline;
  gap: 6px;
  color: #ffd86a;
  font-weight: 950;
}

.shop-pack-price strong {
  font-size: 1.45rem;
}

.shop-buy-button {
  margin-top: 15px;
  min-width: 180px;
}

.shop-buy-button:disabled {
  cursor: default;
  opacity: .45;
  transform: none;
}

.shop-message {
  min-height: 1.4em;
  margin: 12px 0 0;
  color: #b8afa2;
  font-size: .7rem;
}

.shop-message.success {
  color: #c8ff48;
}

.shop-message.error {
  color: #ff9b91;
}

html.pack-open-active,
body.pack-open-active {
  overflow: hidden;
}

.pack-result[hidden] {
  display: none !important;
}

.pack-result.pack-open-modal {
  position: fixed;
  inset: 0;
  z-index: 1400;
  margin: 0;
  padding: max(18px, env(safe-area-inset-top)) 16px max(18px, env(safe-area-inset-bottom));
  display: grid;
  place-items: center;
  border: 0;
  background: rgba(5, 6, 6, .78);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  overscroll-behavior: contain;
}

.pack-open-dialog {
  width: min(100%, 760px);
  max-height: min(88dvh, 760px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 20px;
  border: 1px solid rgba(231, 203, 153, .4);
  border-radius: 22px;
  background:
    radial-gradient(circle at 50% 15%, rgba(188, 135, 65, .2), transparent 34%),
    linear-gradient(180deg, #3f2b1b, #1e1711 70%);
  box-shadow:
    0 28px 70px rgba(0, 0, 0, .55),
    inset 0 0 0 2px rgba(255, 255, 255, .025);
}

.pack-open-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.pack-open-title-wrap {
  text-align: left;
}

.pack-result-title {
  margin: 0;
  color: #f4ead8;
  font-size: 1rem;
  font-weight: 950;
  letter-spacing: .14em;
}

.pack-open-title-wrap small {
  display: block;
  margin-top: 4px;
  color: #b9afa1;
  font-size: .68rem;
  letter-spacing: .08em;
}

.pack-open-close {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .13);
  border-radius: 999px;
  background: rgba(15, 13, 11, .74);
  color: #f3eadb;
  font: inherit;
  font-size: 1.45rem;
  line-height: 1;
  cursor: pointer;
}

.pack-open-close:hover,
.pack-open-close:focus-visible {
  border-color: rgba(200, 255, 72, .62);
  outline: none;
  box-shadow: 0 0 0 3px rgba(200, 255, 72, .1);
}

.pack-result-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.pack-result-card {
  min-width: 0;
  padding: 14px 10px 12px;
  border: 1px solid rgba(231, 203, 153, .3);
  border-radius: 16px;
  background: rgba(18, 15, 12, .86);
  text-align: center;
  overflow: hidden;
  animation: packReveal .42s cubic-bezier(.2,.85,.25,1) both;
}

.pack-result-card:nth-child(2) { animation-delay: .08s; }
.pack-result-card:nth-child(3) { animation-delay: .16s; }

.pack-result-preview {
  width: min(100%, 116px);
  margin: 0 auto;
  pointer-events: none;
}

.pack-result-preview .card-face {
  width: 100%;
  min-height: 150px;
}

.pack-result-name {
  display: block;
  margin-top: 10px;
  overflow-wrap: anywhere;
  color: #fff0d5;
  font-size: .78rem;
  font-weight: 900;
}

.pack-open-actions {
  margin-top: 20px;
  display: flex;
  justify-content: center;
}

.pack-open-ok {
  min-width: min(240px, 70vw);
}

/* The shop intentionally does not show the player's collection.
   Owned counts are only shown in the deck editor. */
.shop-collection,
.shop-section-heading,
.shop-collection-grid,
.shop-owned-card,
.pack-result-owned {
  display: none !important;
}

.shop-actions {
  margin-top: 26px;
}

@keyframes packReveal {
  from { opacity: 0; transform: translateY(16px) scale(.9) rotateY(28deg); }
  to { opacity: 1; transform: translateY(0) scale(1) rotateY(0); }
}

@media (max-width: 760px) {
  .shop-panel {
    padding: 16px 10px 24px;
  }

  .shop-pack-card {
    grid-template-columns: 82px 1fr;
    gap: 15px;
    padding: 17px 14px;
  }

  .shop-pack-art {
    width: 76px;
    font-size: 1.35rem;
  }

  .shop-pack-info h3 {
    font-size: 1rem;
  }

  .shop-pack-info p {
    font-size: .7rem;
  }

  .pack-result.pack-open-modal {
    padding-left: 10px;
    padding-right: 10px;
  }

  .pack-open-dialog {
    width: min(100%, 430px);
    max-height: 90dvh;
    padding: 16px 14px;
    border-radius: 18px;
  }

  .pack-open-header {
    margin-bottom: 12px;
  }

  .pack-result-cards {
    grid-template-columns: 1fr;
    gap: 9px;
  }

  .pack-result-card {
    display: grid;
    grid-template-columns: 112px minmax(0, 1fr);
    align-items: center;
    gap: 15px;
    padding: 9px 12px;
    text-align: left;
  }

  .pack-result-preview {
    width: 112px;
    margin: 0;
  }

  .pack-result-preview .card-face {
    min-height: 148px;
  }

  .pack-result-name {
    margin-top: 0;
    font-size: .82rem;
    line-height: 1.5;
  }

  .pack-open-actions {
    margin-top: 14px;
  }
}

@media (max-width: 390px) {
  .pack-result-card {
    grid-template-columns: 104px minmax(0, 1fr);
    gap: 11px;
  }

  .pack-result-preview {
    width: 104px;
  }

  .pack-result-preview .card-face {
    min-height: 140px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pack-result-card {
    animation: none;
  }
}
