/* ui/UpgradePicker — contract: ./UpgradePicker.spec.md. Tokens from ui/Theme. */

.qc-picker {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(0, 1fr); /* track = viewport width, so the panel can't overflow */
  justify-items: center;
  /* `safe`: a centred panel taller than the viewport overflows both ends and
     its top can never be scrolled to, which on a landscape phone would hide
     the first card. Safe alignment falls back to start when it would not fit. */
  align-items: safe center;
  padding: 32px 24px;
  overflow-y: auto;
  background: radial-gradient(
    ellipse 90% 80% at 50% 50%,
    color-mix(in oklab, var(--qc-space-0) 62%, transparent),
    color-mix(in oklab, var(--qc-space-0) 88%, transparent)
  );
  backdrop-filter: blur(3px);
  animation: qc-picker-fade var(--qc-dur) ease-out both;
}

.qc-picker__panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
  width: min(1040px, 100%);
}

.qc-picker__header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}

.qc-picker__title {
  display: flex;
  align-items: center;
  gap: 20px;
  margin: 0;
  font-size: clamp(18px, 2.4vw, 26px);
  font-weight: 300;
  line-height: 1;
  letter-spacing: 0.36em;
  text-transform: uppercase;
  color: var(--qc-text);
}

.qc-picker__title::before,
.qc-picker__title::after {
  content: "";
  width: 72px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--qc-line-strong));
}

.qc-picker__title::before {
  margin-right: 0.36em; /* matches the trailing letter-spacing on the right */
}

.qc-picker__title::after {
  transform: scaleX(-1);
}

@media (max-width: 560px) {
  .qc-picker__title {
    letter-spacing: 0.24em;
  }

  .qc-picker__title::before,
  .qc-picker__title::after {
    display: none;
  }
}

.qc-picker__meta {
  margin: 0;
  font-size: 13px;
  color: var(--qc-text-dim);
}

.qc-picker__pending {
  color: var(--qc-rarity-legendary);
}

.qc-picker__cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 18px;
  width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
}

.qc-picker__slot {
  display: flex;
  animation: qc-picker-card 460ms var(--qc-ease-out) both;
  animation-delay: calc(var(--i, 0) * 70ms + 60ms);
}

.qc-picker__slot > .qc-card {
  flex: 1;
  min-height: 260px;
}

.qc-picker__footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 14px 24px;
}

.qc-picker__hint {
  margin: 0;
  font-size: 13px;
  color: var(--qc-text-faint);
}

@keyframes qc-picker-fade {
  from { opacity: 0; }
}

@keyframes qc-picker-card {
  from { opacity: 0; transform: translateY(18px) scale(0.98); }
}

/* A landscape phone: three full cards, a title and a footer in ~300px of
   height. The chrome gives up its air first; the cards themselves tighten in
   ui/UpgradeCard. Picking an upgrade is on a timer, so nothing here may need
   scrolling to reach. */
@media (max-height: 520px) {
  .qc-picker { padding: 10px 14px; }
  .qc-picker__panel { gap: 10px; }
  .qc-picker__header { gap: 5px; }
  .qc-picker__title { gap: 12px; font-size: clamp(14px, 1.9vw, 18px); letter-spacing: 0.26em; }
  .qc-picker__title::before,
  .qc-picker__title::after { width: 40px; }
  .qc-picker__meta { font-size: 11px; }
  .qc-picker__cards { grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr)); gap: 10px; }
  .qc-picker__slot > .qc-card { min-height: 0; }
  .qc-picker__footer { gap: 8px 16px; }
  .qc-picker__hint { font-size: 11px; }
}
