* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  min-height: 100vh;
  padding: 40px 20px;
  color: #eaf6ff;
  background: linear-gradient(-45deg, #0f2027, #203a43, #2c5364, #1e3c72);
  background-size: 400% 400%;
  animation: gradientShift 12s ease infinite;
}

@keyframes gradientShift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.shop {
  max-width: 1080px;
  margin: 0 auto;
  animation: fadeInUp 0.7s ease both;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(25px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Header */
.shop-header {
  text-align: center;
  margin-bottom: 42px;
  position: relative;
}

.shop-header h1 {
  font-size: 2.6rem;
  background: linear-gradient(90deg, #74ebd5, #9face6, #74ebd5);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shine 4s linear infinite;
}

@keyframes shine {
  to { background-position: 200% center; }
}

.subtitle {
  margin-top: 6px;
  color: rgba(234, 246, 255, 0.7);
  font-size: 1rem;
}

/* The top-right cluster: the account circle and the points badge, in that
   order. They share one absolutely-positioned flex row rather than each being
   pinned to the corner themselves, which is what keeps them from stacking on
   top of each other. */
.header-right {
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.points-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  padding: 10px 18px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

/* Header link back to the landing page. Named for where it goes rather than
   what it looks like — it used to point at /player, which the account circle in
   .header-right now covers on every page. */
.home-link {
  position: absolute;
  top: 0;
  left: 0;
  display: inline-flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  padding: 10px 18px;
  color: #eaf6ff;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.92rem;
  transition: background 0.2s ease;
}

.home-link:hover { background: rgba(255, 255, 255, 0.18); }

.points-badge .coin { color: #ffd76a; font-size: 1.1rem; }
.points-badge .points-label { color: rgba(234, 246, 255, 0.6); font-weight: 400; }

/* Sections */
.shop-section { margin-bottom: 46px; }

.section-title {
  font-size: 1.4rem;
  margin-bottom: 20px;
  padding-left: 12px;
  border-left: 4px solid #74ebd5;
}

/* Grids */
.banner-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 22px;
}

.background-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 22px;
}

.loading {
  grid-column: 1 / -1;
  text-align: center;
  color: rgba(234, 246, 255, 0.6);
  padding: 30px;
}

/* Card */
.card {
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  display: flex;
  flex-direction: column;
}

.card:hover {
  transform: translateY(-6px);
  box-shadow: 0 20px 44px rgba(0, 0, 0, 0.5);
}

/* Banner preview */
.banner-preview {
  height: 130px;
  background-size: cover;
  background-position: center;
  position: relative;
}

/* Profile background preview (same as banner) */
.background-preview {
  height: 130px;
  background-size: cover;
  background-position: center;
  position: relative;
}

/* A three.js scene mounted by animatedBg.js in place of a plain background
   image — see public/animatedBg.js. overflow: hidden is the one thing every
   host actually needs from here: .banner-preview / .background-preview above
   and .card's own clipping already give every current host a position
   context, and .hero-avatar (player.css) sets its own since it's the one
   container here that didn't already have one — a shared rule forcing
   position would have collided with #pageBackdrop's position: fixed. The
   canvas itself is pointer-events: none so it never steals a click meant for
   the card underneath it (equip toggle, buy button, hero interactions). */
.animated-bg-host { overflow: hidden; }
.animated-bg-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}

/* Theme preview — a type 3 assest row has no artwork, so shop.js paints the
   palette's own gradient here instead of a background image. */
.theme-preview {
  height: 130px;
  position: relative;
  background: rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.25);
}

.card-body {
  padding: 16px 18px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}

.card-name { font-size: 1.05rem; font-weight: 600; }

.card-price {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: #ffd76a;
  font-weight: 600;
}

/* A free theme costs no points, so it drops the gold "◆ n points" treatment. */
.card-price-free {
  color: rgba(255, 255, 255, 0.6);
  font-weight: 500;
}

.buy-btn {
  margin-top: auto;
  padding: 11px 16px;
  border: none;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  color: #06232b;
  cursor: pointer;
  background: linear-gradient(90deg, #74ebd5, #9face6);
  background-size: 200% auto;
  transition: background-position 0.4s ease, transform 0.15s ease, opacity 0.2s ease;
}

.buy-btn:hover { background-position: right center; }
.buy-btn:active { transform: scale(0.97); }

.buy-btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  background: rgba(255, 255, 255, 0.15);
  color: rgba(234, 246, 255, 0.7);
}

.badge-owned {
  font-size: 0.75rem;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: #74ebd5;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(20, 40, 55, 0.95);
  border: 1px solid rgba(116, 235, 213, 0.4);
  color: #eaf6ff;
  padding: 14px 24px;
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 50;
}

.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.hidden { display: none; }

/* Narrow: nothing is pinned to a corner any more, both clusters become ordinary
   centred rows above the title. */
@media (max-width: 600px) {
  .header-right { position: static; justify-content: center; margin: 0 auto 16px; }
  .home-link { position: static; margin: 0 auto 16px; }
  .shop-header h1 { font-size: 2rem; }
}
