/* ── Skyy Item Shop — game-store layout ── */

/* Shop card font only — same @font-face pattern as display-name-font.css */
@font-face {
  font-family: "Super Pandora";
  src: url("assets/fonts/Super-Pandora.ttf") format("truetype");
  font-display: swap;
}

@property --shop-accent-h {
  syntax: "<number>";
  inherits: false;
  initial-value: 210;
}

@keyframes shopCardPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
  50% { box-shadow: 0 0 24px 3px var(--shop-card-glow, rgba(120, 200, 255, 0.4)); }
}

@keyframes shopSuccessPop {
  0% { transform: scale(0.94); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes shopSparkle {
  0% { transform: translateY(0) scale(1); opacity: 1; }
  100% { transform: translateY(-20px) scale(0.35); opacity: 0; }
}

/* ── Nav trigger — stacked under Connections ── */
.shop-trigger {
  position: fixed;
  top: calc(20px + 44px);
  left: 20px;
  z-index: 10;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  background: rgba(28, 28, 30, 0.78);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  color: var(--text-primary);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 0 14px var(--accent-glow-soft), 0 4px 16px rgba(0, 0, 0, 0.35);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition), background var(--transition);
}

.shop-trigger[hidden] {
  display: none !important;
}

.shop-trigger__icon {
  width: 0.95rem;
  height: 0.95rem;
  color: var(--accent);
  flex-shrink: 0;
}

.shop-trigger:hover,
.shop-trigger:focus-visible {
  transform: scale(1.05);
  background: rgba(36, 36, 38, 0.88);
  border-color: var(--accent-border);
  box-shadow: 0 0 22px var(--accent-glow), 0 6px 20px rgba(0, 0, 0, 0.4);
  outline: none;
}

body[data-view="shop"] .connections-trigger,
body[data-view="shop"] .skyyjack-trigger,
body[data-view="shop"] .shop-trigger,
body[data-view="plans"] .shop-trigger,
body[data-view="admin"] .shop-trigger,
body[data-view="admin-denied"] .shop-trigger,
body[data-view="profile-unavailable"] .shop-trigger {
  display: none;
}

/* ── Page shell ── */
.shop-page {
  --shop-accent-h: 210;
  position: fixed;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  overflow-x: hidden;
  overflow-y: auto;
  background: radial-gradient(ellipse 120% 80% at 50% 0%, #12121a 0%, #060608 55%, #030304 100%);
  color: #f5f5f7;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.45s cubic-bezier(0.25, 0.1, 0.25, 1),
    visibility 0.45s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.shop-page.is-visible {
  opacity: 1;
  visibility: visible;
}

.shop-page[hidden] {
  display: none !important;
}

.shop-page__ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.shop-page__glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.28;
}

.shop-page__glow--1 {
  top: -8%;
  left: 20%;
  width: min(60vw, 480px);
  height: min(60vw, 480px);
  background: radial-gradient(circle, hsla(220, 80%, 55%, 0.45) 0%, transparent 70%);
}

.shop-page__glow--2 {
  bottom: -10%;
  right: 10%;
  width: min(55vw, 440px);
  height: min(55vw, 440px);
  background: radial-gradient(circle, hsla(280, 70%, 50%, 0.3) 0%, transparent 72%);
}

.shop-page__inner {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding:
    calc(10px + env(safe-area-inset-top, 0px))
    calc(14px + env(safe-area-inset-right, 0px))
    calc(14px + env(safe-area-inset-bottom, 0px))
    calc(14px + env(safe-area-inset-left, 0px));
}

/* ── Coin HUD ── */
.shop-coin-hud {
  position: absolute;
  top: calc(8px + env(safe-area-inset-top, 0px));
  right: calc(14px + env(safe-area-inset-right, 0px));
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 14px 7px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(12, 14, 22, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
}

.shop-coin-hud__icon {
  font-size: 1.05em;
  line-height: 1;
  opacity: 0.95;
}

.shop-coin-hud__value {
  font-variant-numeric: tabular-nums;
}

/* ── Compact header ── */
.shop-page__header {
  position: relative;
  text-align: center;
  margin-bottom: 12px;
  padding-top: 4px;
}

.shop-page__logo-link {
  display: inline-flex;
  margin-bottom: 6px;
  opacity: 0.9;
  transition: opacity var(--transition);
}

.shop-page__logo-link:hover,
.shop-page__logo-link:focus-visible {
  opacity: 1;
  outline: none;
}

.shop-page__logo-img {
  height: 26px;
  width: auto;
}

.shop-page__subtitle {
  margin: 0 0 4px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.72);
}

.shop-page__countdown {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
}

/* ── States ── */
.shop-page__guest,
.shop-page__empty,
.shop-page__loading {
  text-align: center;
  padding: 40px 20px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  margin-top: 20px;
}

.shop-page__guest[hidden],
.shop-page__empty[hidden],
.shop-page__loading[hidden],
.shop-board[hidden] {
  display: none !important;
}

.shop-page__guest-title,
.shop-page__empty-title {
  margin: 0 0 8px;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.shop-page__guest-text,
.shop-page__empty-text {
  margin: 0 0 18px;
  color: rgba(255, 255, 255, 0.58);
  font-size: 0.88rem;
  line-height: 1.5;
}

.shop-page__signin-btn {
  display: inline-flex;
  padding: 11px 24px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, hsla(210, 80%, 52%, 1), hsla(250, 70%, 48%, 1));
  color: #fff;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

.shop-page__loading-spinner {
  width: 32px;
  height: 32px;
  margin: 0 auto 12px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-top-color: hsla(210, 85%, 62%, 1);
  border-radius: 50%;
  animation: shopSpin 0.75s linear infinite;
}

@keyframes shopSpin {
  to { transform: rotate(360deg); }
}

/* ── Shop board ── */
.shop-board {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.shop-section-header {
  margin: 0 0 8px;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(10px);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.65);
  text-align: center;
}

.shop-board__featured-col,
.shop-board__grid-col {
  min-width: 0;
}

#shop-featured {
  min-width: 0;
}

.shop-board__small-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

/* ── Item cards — grid anatomy: media + info only, no flex growth voids ── */
.shop-card {
  --shop-card-glow: rgba(140, 145, 155, 0.22);
  --shop-card-accent: #9aa0aa;
  --shop-media-bg: linear-gradient(160deg, #2a2a32 0%, #18181e 100%);
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  width: 100%;
  height: auto;
  padding: 0;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  background: rgba(8, 8, 12, 0.65);
  overflow: hidden;
  cursor: pointer;
  text-align: center;
  font: inherit;
  color: inherit;
  transition:
    transform 0.22s ease,
    box-shadow 0.22s ease,
    border-color 0.22s ease;
}

.shop-card:hover,
.shop-card:focus-visible {
  transform: translateY(-2px) scale(1.012);
  border-color: rgba(255, 255, 255, 0.22);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45), 0 0 18px var(--shop-card-glow);
  outline: none;
}

.shop-card.is-owned {
  cursor: default;
  opacity: 0.88;
}

.shop-card.is-owned:hover {
  transform: none;
  box-shadow: none;
}

.shop-card.is-busy {
  pointer-events: none;
  opacity: 0.65;
}

.shop-card.is-success-flash {
  animation: shopCardPulse 0.85s ease 2;
}

.shop-card--common {
  --shop-card-glow: rgba(150, 155, 165, 0.25);
  --shop-card-accent: #b0b5bf;
  --shop-media-bg: linear-gradient(155deg, #3a3d44 0%, #222428 45%, #141518 100%);
  border-color: rgba(160, 165, 175, 0.28);
}

.shop-card--rare {
  --shop-card-glow: rgba(60, 160, 255, 0.35);
  --shop-card-accent: #4db8ff;
  --shop-media-bg: linear-gradient(155deg, #1a4a7a 0%, #0e2848 50%, #081828 100%);
  border-color: rgba(60, 160, 255, 0.42);
}

.shop-card--epic {
  --shop-card-glow: rgba(170, 70, 255, 0.38);
  --shop-card-accent: #c060ff;
  --shop-media-bg: linear-gradient(155deg, #5a2088 0%, #321050 50%, #1a0830 100%);
  border-color: rgba(170, 70, 255, 0.45);
}

.shop-card--legendary {
  --shop-card-glow: rgba(255, 170, 50, 0.42);
  --shop-card-accent: #ffb840;
  --shop-media-bg: linear-gradient(155deg, #8a5010 0%, #5a3408 45%, #301c04 100%);
  border-color: rgba(255, 170, 50, 0.48);
}

.shop-card--mythic {
  --shop-card-glow: rgba(255, 80, 180, 0.45);
  --shop-card-accent: #ff68d0;
  --shop-media-bg: linear-gradient(135deg, #6a1050 0%, #401878 35%, #102878 70%, #601040 100%);
  border-color: rgba(255, 100, 200, 0.5);
}

.shop-card__media {
  position: relative;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--shop-media-bg);
}

.shop-card__media-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.28s ease;
}

.shop-card:hover:not(.is-owned) .shop-card__media-img,
.shop-card:focus-visible:not(.is-owned) .shop-card__media-img {
  transform: scale(1.04);
}

.shop-card__media-fallback {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 100%;
  background: var(--shop-media-bg);
  position: relative;
}

.shop-card__media-fallback::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.12) 0%, transparent 45%),
    radial-gradient(circle at 75% 80%, rgba(255, 255, 255, 0.06) 0%, transparent 40%);
  pointer-events: none;
}

.shop-card__media-fallback::after {
  content: "";
  position: absolute;
  inset: 12%;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  pointer-events: none;
}

.shop-card--mythic .shop-card__media-fallback::after {
  border-color: rgba(255, 120, 220, 0.2);
  box-shadow: inset 0 0 24px rgba(255, 100, 200, 0.15);
}

.shop-card__badge {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(6px);
  color: #8dffd4;
  border: 1px solid rgba(141, 255, 212, 0.35);
}

.shop-card__info {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 10px 8px 12px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.62) 0%, rgba(0, 0, 0, 0.82) 100%);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.shop-card__name {
  margin: 0;
  width: 100%;
  font-family: "Super Pandora", sans-serif;
  font-size: 0.82rem;
  font-weight: 400;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  line-height: 1.12;
  text-align: center;
}

.shop-card__type {
  margin: 0;
  width: 100%;
  font-family: "Super Pandora", sans-serif;
  font-size: 0.62rem;
  font-weight: 400;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.48);
  line-height: 1.15;
  text-align: center;
}

.shop-card__price {
  margin: 4px 0 0;
  font-family: "Super Pandora", sans-serif;
  font-size: 0.88rem;
  font-weight: 400;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.95);
  text-align: center;
  line-height: 1.12;
}

.shop-card__price--free {
  color: #8dffd4;
}

.shop-card__price--owned {
  color: rgba(141, 255, 212, 0.75);
}

.shop-card__sparks {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.shop-card__spark {
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--shop-card-accent);
  animation: shopSparkle 0.75s ease forwards;
}

/* ── Modal ── */
.shop-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding:
    calc(16px + env(safe-area-inset-top, 0px))
    calc(16px + env(safe-area-inset-right, 0px))
    calc(16px + env(safe-area-inset-bottom, 0px))
    calc(16px + env(safe-area-inset-left, 0px));
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.shop-modal[hidden] {
  display: none !important;
}

.shop-modal__panel {
  width: 100%;
  max-width: 360px;
  padding: 22px 20px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(165deg, rgba(24, 24, 30, 0.98), rgba(10, 10, 14, 0.98));
  box-shadow: 0 20px 56px rgba(0, 0, 0, 0.55);
  animation: shopSuccessPop 0.25s ease;
}

.shop-modal__title {
  margin: 0 0 6px;
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: center;
}

.shop-modal__meta {
  margin: 0 0 12px;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: center;
  color: var(--shop-modal-accent, rgba(255, 255, 255, 0.45));
}

.shop-modal__price {
  margin: 0 0 12px;
  font-size: 1.25rem;
  font-weight: 800;
  text-align: center;
}

.shop-modal__balance {
  margin: 0 0 18px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.82rem;
  text-align: center;
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.45;
}

.shop-modal__balance-arrow {
  color: rgba(255, 255, 255, 0.35);
  margin: 0 5px;
}

.shop-modal__actions {
  display: flex;
  gap: 8px;
}

.shop-modal__btn {
  flex: 1;
  padding: 11px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

.shop-modal__btn--confirm {
  background: linear-gradient(135deg, hsla(210, 75%, 50%, 0.92), hsla(260, 65%, 48%, 0.92));
  border-color: transparent;
}

.shop-modal__btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* ── Success toast ── */
.shop-toast {
  position: fixed;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  z-index: 45;
  transform: translateX(-50%);
  padding: 12px 20px;
  border-radius: 999px;
  border: 1px solid rgba(141, 255, 212, 0.35);
  background: rgba(10, 22, 18, 0.92);
  backdrop-filter: blur(10px);
  color: #d4fff0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  box-shadow: 0 6px 28px rgba(0, 0, 0, 0.4);
  animation: shopSuccessPop 0.28s ease;
}

.shop-toast[hidden] {
  display: none !important;
}

/* ── Desktop: one-screen board ── */
@media (min-width: 900px) {
  .shop-page {
    overflow-y: hidden;
  }

  .shop-page__inner {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    max-height: 100dvh;
    padding-bottom: 16px;
  }

  .shop-page__header {
    flex-shrink: 0;
    margin-bottom: 18px;
    padding-top: 8px;
  }

  .shop-page__logo-link {
    margin-bottom: 10px;
  }

  .shop-page__logo-img {
    height: 68px;
    width: auto;
  }

  .shop-page__subtitle {
    margin-bottom: 6px;
    font-size: 0.78rem;
  }

  .shop-page__countdown {
    font-size: 0.82rem;
  }

  .shop-board {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: 1.12fr 1fr;
    gap: 12px;
    align-items: start;
    --shop-grid-gap: 10px;
    /* Fill viewport below header; ~200px reserved for logo, labels, chrome */
    --shop-tile-h: clamp(210px, calc((100dvh - 200px) / 2), 320px);
  }

  .shop-board__featured-col,
  .shop-board__grid-col {
    display: flex;
    flex-direction: column;
    min-height: 0;
  }

  /* Featured slot: explicit height = two small rows + gap */
  #shop-featured {
    height: calc(var(--shop-tile-h) * 2 + var(--shop-grid-gap));
  }

  #shop-featured .shop-card--featured {
    height: 100%;
    grid-template-rows: minmax(0, 1fr) auto;
  }

  #shop-featured .shop-card--featured .shop-card__name {
    font-size: 1rem;
  }

  #shop-featured .shop-card--featured .shop-card__type {
    font-size: 0.68rem;
  }

  #shop-featured .shop-card--featured .shop-card__price {
    font-size: 1rem;
  }

  /* Small grid: fixed row heights — cards fill tile, no stretch void */
  .shop-board__small-grid {
    grid-template-rows: repeat(2, var(--shop-tile-h));
    gap: var(--shop-grid-gap);
    align-content: start;
  }

  .shop-board__small-grid .shop-card {
    height: 100%;
    grid-template-rows: minmax(0, 1fr) auto;
  }

  .shop-board__small-grid .shop-card__info {
    padding: 10px 8px 12px;
  }

  .shop-board__small-grid .shop-card__name {
    font-size: 0.78rem;
  }

  .shop-board__small-grid .shop-card__type {
    font-size: 0.6rem;
  }

  .shop-board__small-grid .shop-card__price {
    font-size: 0.84rem;
  }
}

/* ── Mobile ── */
@media (max-width: 899px) {
  .shop-coin-hud {
    top: calc(6px + env(safe-area-inset-top, 0px));
    right: calc(10px + env(safe-area-inset-right, 0px));
    padding: 6px 11px;
    font-size: 0.82rem;
  }

  .shop-page__header {
    padding-top: 32px;
    margin-bottom: 16px;
  }

  .shop-board__featured-col {
    margin-bottom: 4px;
  }

  /* Featured: preserve good mobile proportions */
  #shop-featured .shop-card--featured {
    grid-template-rows: minmax(0, 1fr) auto;
    aspect-ratio: 16 / 11;
  }

  #shop-featured .shop-card--featured .shop-card__name {
    font-size: 0.95rem;
  }

  #shop-featured .shop-card--featured .shop-card__type {
    font-size: 0.68rem;
  }

  #shop-featured .shop-card--featured .shop-card__price {
    font-size: 0.95rem;
  }

  /* Small cards: full-width media, compact tile height */
  .shop-board__small-grid .shop-card {
    grid-template-rows: minmax(0, 1fr) auto;
    aspect-ratio: 3 / 4;
    height: auto;
  }

  .shop-board__small-grid .shop-card__media {
    width: 100%;
  }

  .shop-board__small-grid .shop-card__name {
    font-size: 0.78rem;
  }

  .shop-board__small-grid .shop-card__type {
    font-size: 0.64rem;
  }

  .shop-board__small-grid .shop-card__price {
    font-size: 0.88rem;
  }
}

@media (max-width: 720px) {
  .shop-trigger {
    top: calc(var(--control-top, 20px) + 38px);
    left: var(--control-left, 12px);
    padding: 6px 10px 6px 8px;
    font-size: 0.66rem;
    max-width: calc(100vw - 24px);
  }

  .shop-trigger__label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .shop-board__small-grid {
    gap: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .shop-page {
    transition: none;
  }

  .shop-card.is-success-flash,
  .shop-card__spark,
  .shop-page__loading-spinner,
  .shop-modal__panel,
  .shop-toast,
  .shop-card__media-img {
    animation: none !important;
    transition: none !important;
  }

  .shop-card:hover,
  .shop-card:focus-visible {
    transform: none;
  }
}
