/* ================================================================
   STORE + RECORDS — the Shop page (view-rewards) and the Collection
   (view-collection, "Records" in the nav). Same language as the arcade
   (games.css): mono section labels, quiet surfaces, one hue doing the
   talking, motion on transform/opacity only. Loaded last so it wins.
   ================================================================ */
:root { --st-ease: cubic-bezier(.2, .8, .2, 1); }

:is(#view-rewards, #view-collection) .st-label {
  display: flex; align-items: baseline; gap: 12px; margin: 30px 0 12px;
  font: 600 11px/1 var(--font-mono); letter-spacing: .2em; text-transform: uppercase; color: var(--text);
}
:is(#view-rewards, #view-collection) .st-k {
  font: 600 10px/1 var(--font-mono); letter-spacing: .2em; text-transform: uppercase; color: var(--text-faint);
}
.rw-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 13px; border-radius: 999px;
  font: 500 12.5px/1 var(--font-body); color: var(--text-dim);
  background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.09);
}
.rw-chip b { color: var(--text); font-family: var(--font-mono); }
button.rw-chip { cursor: pointer; transition: border-color 240ms var(--st-ease), background-color 240ms var(--st-ease); }
button.rw-chip:hover { border-color: rgba(255,255,255,.22); background: rgba(255,255,255,.07); }
.rw-chip-boost { color: #2a1c00; background: var(--gold); border-color: var(--gold); font-weight: 600; }
.rw-chip-boost b { color: inherit; }
.rw-chip-ice { color: #bfe3ff; border-color: rgba(94,184,255,.35); background: rgba(94,184,255,.08); }
.rw-chip-pick { color: color-mix(in srgb, var(--hue-3) 70%, #fff); border-color: color-mix(in srgb, var(--hue-3) 45%, transparent); background: color-mix(in srgb, var(--hue-3) 10%, transparent); }

/* ---- Shop: the balance ------------------------------------------------ */
#view-rewards > .section-head { margin-bottom: 0; }
.rw-hero {
  position: relative; isolation: isolate; overflow: clip;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; flex-wrap: wrap;
  margin: 14px 0 0; padding: 26px 26px 24px; border-radius: 22px;
  border: 1px solid rgba(255,255,255,.08);
  background: radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, var(--gold) 14%, transparent), transparent 55%), var(--surface);
}
/* A record edge in the corner, turning slowly. The one moving thing up here. */
.rw-hero::after {
  content: ''; position: absolute; z-index: -1; right: -70px; top: -90px; width: 280px; height: 280px; border-radius: 50%;
  background: repeating-radial-gradient(circle, rgba(255,255,255,.035) 0 1px, transparent 1px 5px),
              radial-gradient(circle, transparent 18%, color-mix(in srgb, var(--gold) 22%, transparent) 19% 21%, transparent 22%);
  border: 1px solid rgba(255,255,255,.06);
  animation: stTurn 40s linear infinite;
}
@keyframes stTurn { to { transform: rotate(1turn); } }
.rw-hero-bal { display: grid; gap: 8px; }
.rw-hero-bal b { font: 700 clamp(44px, 9vw, 72px)/.9 var(--font-mono); letter-spacing: -.04em; color: var(--gold); }
.rw-hero-u { font: 500 13px/1 var(--font-body); color: var(--text-dim); }
.rw-hero-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
#view-rewards .rw-ladder { margin-top: 0; }

/* ---- Shop: boosts, featured ------------------------------------------- */
.st-feat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.store-feat .shop-item {
  display: grid; grid-template-columns: 92px minmax(0, 1fr) auto; align-items: center; gap: 18px;
  padding: 16px; border-radius: 20px;
}
.store-feat .shop-swatch.sw-boost {
  width: 92px; height: 92px; border-radius: 16px; display: grid; place-items: center; border: 0;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.12);
}
.store-feat .boost-x { font: 800 34px/1 var(--font-mono); letter-spacing: -.04em; color: #1c1300; }
.store-feat .boost-ice { color: #eaf6ff; text-shadow: 0 2px 12px rgba(0,30,60,.6); }
.store-feat .shop-item-desc { -webkit-line-clamp: 3; }
.store-feat .shop-item .btn-primary, .store-feat .shop-item .btn-mini { align-self: center; }

/* ---- Shop: catalogue tabs --------------------------------------------- */
.st-cats {
  display: flex; gap: 4px; padding: 4px; margin-bottom: 16px; width: max-content; max-width: 100%;
  overflow-x: auto; scrollbar-width: none; border-radius: 999px;
  background: var(--surface); border: 1px solid rgba(255,255,255,.08);
}
.st-cats::-webkit-scrollbar { display: none; }
.st-cats button {
  flex: none; display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 16px;
  border: 0; border-radius: 999px; background: none; color: var(--text-dim); cursor: pointer;
  font: 500 13.5px/1 var(--font-body); transition: color 200ms var(--st-ease), background-color 200ms var(--st-ease);
}
.st-cats button:hover { color: var(--text); }
.st-cats button em { font: 500 10.5px/1 var(--font-mono); font-style: normal; color: var(--text-faint); }
.st-cats button[aria-selected="true"] { background: var(--btn-bg); color: var(--btn-ink); font-weight: 600; }
.st-cats button[aria-selected="true"] em { color: inherit; opacity: .65; }

/* ---- Shop: product cards ---------------------------------------------- */
.shop-list.st-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); gap: 14px; flex-direction: initial; }
.st-grid .shop-item {
  display: flex; flex-direction: column; align-items: stretch; gap: 0; padding: 0;
  border-radius: 18px; overflow: hidden; isolation: isolate;
  border: 1px solid rgba(255,255,255,.08); background: var(--surface);
  transition: transform 360ms var(--st-ease), border-color 260ms var(--st-ease), box-shadow 360ms var(--st-ease);
}
.store-feat .shop-item {
  border: 1px solid rgba(255,255,255,.08); background: var(--surface);
  transition: transform 360ms var(--st-ease), border-color 260ms var(--st-ease), box-shadow 360ms var(--st-ease);
}
@media (hover: hover) {
  .st-grid .shop-item:hover, .store-feat .shop-item:hover {
    transform: translateY(-4px); border-color: rgba(255,255,255,.2);
    box-shadow: 0 22px 44px -22px rgba(0,0,0,.9);
  }
  .st-grid .shop-item:hover .shop-swatch { transform: scale(1.04); }
}
.st-grid .shop-item:active, .store-feat .shop-item:active { transform: scale(.985); }
.st-grid .shop-swatch {
  width: 100%; height: auto; aspect-ratio: 16 / 10; border: 0; border-radius: 0; flex: none;
  display: grid; place-items: center; overflow: hidden; padding: 0;
  transition: transform 520ms var(--st-ease);
}
.st-grid .shop-item-info { padding: 14px 16px 4px; }
.st-grid .shop-item-name, .store-feat .shop-item-name { font: 700 15.5px/1.2 var(--font-display); letter-spacing: -.01em; }
.st-grid .shop-item-desc, .store-feat .shop-item-desc {
  margin-top: 5px; font-size: 12.5px; line-height: 1.4; color: var(--text-dim);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.st-grid .shop-item-cost, .store-feat .shop-item-cost { margin-top: 10px; font: 600 13px/1 var(--font-mono); color: var(--gold); }
.st-grid .shop-item > button { margin: 12px 16px 16px; width: calc(100% - 32px); justify-content: center; min-height: 40px; }
.si-own { color: var(--text-faint); font: 600 10.5px/1 var(--font-mono); letter-spacing: .14em; text-transform: uppercase; }
.shop-item.is-short .shop-item-cost { color: var(--text-faint); }
.shop-item.is-active { border-color: color-mix(in srgb, var(--gold) 60%, transparent) !important; box-shadow: 0 0 0 1px color-mix(in srgb, var(--gold) 30%, transparent); }
.shop-item.is-active .si-own { color: var(--gold); }
.shop-item .btn-mini.si-on { color: var(--gold); border-color: color-mix(in srgb, var(--gold) 45%, transparent); opacity: 1; }
.shop-item.is-owned:not(.is-active) .shop-item-name::after {
  content: ''; display: inline-block; width: 6px; height: 6px; margin-left: 8px; border-radius: 50%;
  background: var(--text-faint); vertical-align: middle;
}

/* Swatches by kind. Each previews the real thing. */
.st-grid .sw-theme { position: relative; }
.sw-th { position: absolute; inset: 16% 14%; display: grid; grid-template-rows: auto auto 1fr; gap: 7px; padding: 10px;
  border-radius: 10px; background: rgba(0,0,0,.42); box-shadow: 0 10px 26px -10px rgba(0,0,0,.8); }
.sw-th i { display: block; height: 6px; border-radius: 999px; background: rgba(255,255,255,.75); width: 58%; }
.sw-th i:nth-child(2) { width: 38%; opacity: .5; }
.sw-th i:nth-child(3) { width: 80%; height: 16px; border-radius: 6px; opacity: .22; }
.sw-th b { position: absolute; right: 10px; bottom: 10px; width: 18px; height: 18px; border-radius: 50%; background: rgba(255,255,255,.85); }
.st-grid .shop-swatch.sw-tag { width: 100%; padding: 0 14px; background: radial-gradient(120% 120% at 50% 0%, rgba(255,255,255,.06), transparent 60%), var(--surface-2) !important; }
.st-grid .shop-swatch.sw-tag .tag-chip { font-size: 10px; padding: 6px 9px; max-width: 100%; }
.st-grid .shop-swatch.sw-flair { background: radial-gradient(120% 120% at 50% 0%, rgba(255,255,255,.06), transparent 60%), var(--surface-2) !important; }
.sw-word { font: 800 clamp(18px, 2.2vw, 24px)/1.1 var(--font-display); letter-spacing: -.02em; padding: 0 12px; text-align: center;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.st-grid .shop-swatch.sw-frame { background: radial-gradient(120% 120% at 50% 0%, rgba(255,255,255,.06), transparent 60%), var(--surface-2) !important; }
.sw-frame .pa-wrap { display: inline-block; }
.st-grid .shop-item:hover .sw-frame, .st-grid .shop-item:hover .sw-tag, .st-grid .shop-item:hover .sw-flair { transform: none; }
.shop-suggest { grid-column: 1 / -1; }

/* A category switch deals the cards in, once. Purchases do not replay it. */
.st-grid.st-enter > * { animation: stDeal 460ms var(--st-ease) both; }
.st-grid.st-enter > *:nth-child(2) { animation-delay: 30ms; }  .st-grid.st-enter > *:nth-child(3) { animation-delay: 60ms; }
.st-grid.st-enter > *:nth-child(4) { animation-delay: 90ms; }  .st-grid.st-enter > *:nth-child(5) { animation-delay: 120ms; }
.st-grid.st-enter > *:nth-child(n+6) { animation-delay: 150ms; }
@keyframes stDeal { from { opacity: 0; transform: translateY(10px); } }

#draw-block > .section-head h2 { font: 600 11px/1 var(--font-mono); letter-spacing: .2em; text-transform: uppercase; }
#draw-block > .section-head { margin-top: 30px !important; }

/* ---- Records: the shelf portrait -------------------------------------- */
#view-collection .col-tabs {
  display: flex; gap: 4px; padding: 4px; width: max-content; max-width: 100%; border-radius: 999px;
  background: var(--surface); border: 1px solid rgba(255,255,255,.08); overflow-x: auto; scrollbar-width: none;
}
#view-collection .col-tabs button {
  flex: none; min-height: 40px; padding: 0 18px; border: 0; border-radius: 999px; background: none;
  color: var(--text-dim); font: 500 13.5px/1 var(--font-body); cursor: pointer; transition: color 200ms var(--st-ease), background-color 200ms var(--st-ease);
}
#view-collection .col-tabs button:hover { color: var(--text); }
#view-collection .col-tabs button.active { background: var(--section); color: #0e1a05; font-weight: 600; }

.rc-hero {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 20px;
  padding: 26px; border-radius: 22px; border: 1px solid rgba(255,255,255,.08);
  background: radial-gradient(120% 140% at 0% 0%, var(--section-dim), transparent 55%), var(--surface);
}
.rc-worth { display: flex; align-items: baseline; gap: 10px; margin: 10px 0 14px; }
.rc-worth b { font: 700 clamp(44px, 9vw, 72px)/.9 var(--font-mono); letter-spacing: -.04em; color: var(--section); }
.rc-worth span { font-size: 13px; color: var(--text-dim); }
.rc-facts { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--text-dim); }
.rc-facts b { color: var(--text); font-family: var(--font-mono); font-weight: 600; }
/* Five sleeves leaning on each other, most valuable in front. */
.rc-fan { position: relative; width: 210px; height: 150px; }
.rc-fan span { position: absolute; left: 50%; top: 50%; width: 112px; height: 112px; border-radius: 10px; overflow: hidden;
  background: var(--surface-3); box-shadow: 0 18px 36px -14px rgba(0,0,0,.9), 0 0 0 1px rgba(255,255,255,.08);
  transform: translate(-50%, -50%) translateX(calc((var(--i) - 2) * -26px)) rotate(calc((var(--i) - 2) * -7deg)) scale(calc(1 - var(--i) * .05));
  z-index: calc(5 - var(--i)); transition: transform 520ms var(--st-ease); }
.rc-fan span img { width: 100%; height: 100%; object-fit: cover; }
@media (hover: hover) {
  .rc-hero:hover .rc-fan span { transform: translate(-50%, -50%) translateX(calc((var(--i) - 2) * -34px)) rotate(calc((var(--i) - 2) * -10deg)) scale(calc(1 - var(--i) * .05)); }
}
.rc-split { margin-top: 14px; padding: 16px 18px; border-radius: 18px; border: 1px solid rgba(255,255,255,.08); background: var(--surface); }
.rc-bar { display: flex; gap: 3px; height: 12px; }
.rc-bar i { flex: 0 0 var(--w); min-width: 3px; border-radius: 3px; background: var(--c); transform-origin: left; animation: rcGrow 700ms var(--st-ease) both; }
.rc-bar i.rest { background: rgba(255,255,255,.14); flex: 1 1 var(--w); }
@keyframes rcGrow { from { transform: scaleX(0); } }
.rc-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 12px; font-size: 12.5px; color: var(--text-dim); }
.rc-legend span { display: inline-flex; align-items: center; gap: 7px; min-width: 0; }
.rc-legend em { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.rc-legend b { color: var(--text); font-family: var(--font-mono); font-weight: 600; }
.rc-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; margin-top: 14px; }
.rc-tile {
  display: flex; align-items: center; gap: 12px; padding: 12px; text-align: left; font: inherit; color: inherit; cursor: pointer;
  border-radius: 16px; border: 1px solid rgba(255,255,255,.08); background: var(--surface);
  transition: transform 320ms var(--st-ease), border-color 240ms var(--st-ease);
}
.rc-tile:hover { border-color: rgba(255,255,255,.2); transform: translateY(-2px); }
.rc-tile img { width: 52px; height: 52px; border-radius: 9px; object-fit: cover; background: var(--surface-3); flex: none; }
.rc-tile > span { display: grid; gap: 3px; min-width: 0; }
.rc-tile small { font: 600 9.5px/1 var(--font-mono); letter-spacing: .18em; text-transform: uppercase; color: var(--section); }
.rc-tile b, .rc-tile em { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rc-tile b { font-size: 14px; }
.rc-tile em { font-style: normal; font-size: 12px; color: var(--text-dim); font-family: var(--font-mono); }
.rc-nudge { margin: 12px 2px 0; font-size: 12.5px; color: var(--gold); }
#view-collection .st-label + .col-sorts { margin-top: 0; }

/* Record cards: sleeve first, then words. */
#view-collection .col-grid { grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); gap: 14px; }
#view-collection .col-rec {
  flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 0; padding: 0; overflow: hidden; isolation: isolate;
  border-radius: 18px; border: 1px solid rgba(255,255,255,.08); background: var(--surface);
  transition: transform 360ms var(--st-ease), border-color 260ms var(--st-ease), box-shadow 360ms var(--st-ease);
}
#view-collection .col-rec.owned { background: var(--surface); border-color: rgba(255,255,255,.1); }
@media (hover: hover) {
  #view-collection .col-rec:hover { transform: translateY(-4px); border-color: color-mix(in srgb, var(--section) 55%, transparent); box-shadow: 0 22px 44px -22px rgba(0,0,0,.9); }
  #view-collection .col-rec:hover .fin img, #view-collection .col-rec:hover > img { transform: scale(1.04); }
}
#view-collection .col-rec:active { transform: scale(.985); }
#view-collection .col-rec .fin, #view-collection .col-rec > img { width: 100%; height: auto; aspect-ratio: 1; display: block; overflow: hidden; border-radius: 0; }
#view-collection .col-rec .fin img, #view-collection .col-rec > img { width: 100%; height: 100%; object-fit: cover; border-radius: 0; transition: transform 600ms var(--st-ease); }
#view-collection .col-meta { padding: 12px 14px 4px; }
#view-collection .col-nm { font-size: 14px; }
#view-collection .col-price { font-size: 13.5px; margin-top: 8px; }
#view-collection .col-prov { font-size: 10.5px; }
#view-collection .col-rec > .btn-mini, #view-collection .col-rec > .btn-primary, #view-collection .col-rec > span.btn-mini {
  margin: 10px 14px 0; width: calc(100% - 28px); justify-content: center; text-align: center; min-height: 38px;
}
#view-collection .col-rec > :last-child:is(.btn-mini, .btn-primary) { margin-bottom: 14px; }
#view-collection .col-rec .col-err { margin: 8px 14px 14px; }
.rc-market-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 0 0 14px; font-size: 13px; }
.rc-market-head a { color: var(--text-dim); }

/* Standings: a podium for the top three. */
.rc-podium { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: end; gap: 10px; margin: 6px 0 14px; }
.rc-pod {
  position: relative; display: grid; justify-items: center; gap: 6px; padding: 18px 10px 14px; text-align: center; min-width: 0;
  border-radius: 18px 18px 6px 6px; border: 1px solid rgba(255,255,255,.08); background: var(--surface);
}
.rc-pod.p1 { padding-top: 30px; background: radial-gradient(120% 100% at 50% 0%, color-mix(in srgb, var(--gold) 18%, transparent), transparent 70%), var(--surface); border-color: color-mix(in srgb, var(--gold) 40%, transparent); }
.rc-pod.me { box-shadow: inset 0 0 0 1px var(--section); }
.rc-pod img { width: 54px; height: 54px; border-radius: 50%; object-fit: cover; background: var(--surface-3); }
.rc-pod.p1 img { width: 68px; height: 68px; box-shadow: 0 0 0 2px var(--gold); }
.rc-pod b { font-size: 13.5px; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rc-pod span { font: 600 12.5px/1 var(--font-mono); color: var(--section); }
.rc-pod i { position: absolute; top: 8px; left: 10px; font: 700 11px/1 var(--font-mono); font-style: normal; color: var(--text-faint); }
.rc-pod.p1 i { color: var(--gold); }

@media (max-width: 700px) {
  .rw-hero, .rc-hero { padding: 20px 18px; border-radius: 18px; }
  .rw-hero-chips { justify-content: flex-start; }
  .rc-hero { grid-template-columns: 1fr; }
  .rc-fan { display: none; }
  .st-feat-grid { grid-template-columns: 1fr; }
  .store-feat .shop-item { grid-template-columns: 64px minmax(0, 1fr); gap: 14px; padding: 14px; }
  .store-feat .shop-swatch.sw-boost { width: 64px; height: 64px; border-radius: 12px; }
  .store-feat .boost-x { font-size: 24px; }
  .store-feat .shop-item > button { grid-column: 1 / -1; width: 100%; min-height: 42px; }
  .shop-list.st-grid, #view-collection .col-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .st-grid .shop-item-info { padding: 12px 12px 2px; }
  .st-grid .shop-item > button { margin: 10px 12px 12px; width: calc(100% - 24px); }
  .st-grid .shop-item-desc { display: none; }
  #view-collection .col-meta { padding: 10px 12px 2px; }
  #view-collection .col-rec > .btn-mini, #view-collection .col-rec > .btn-primary, #view-collection .col-rec > span.btn-mini { margin: 8px 12px 0; width: calc(100% - 24px); }
  #view-collection .col-rec > :last-child:is(.btn-mini, .btn-primary) { margin-bottom: 12px; }
  .rc-tiles { grid-template-columns: 1fr; }
  .rc-pod img { width: 42px; height: 42px; } .rc-pod.p1 img { width: 52px; height: 52px; }
}
@media (prefers-reduced-motion: reduce) {
  html:not([data-motion="full"]) .rw-hero::after,
  html:not([data-motion="full"]) .st-grid.st-enter > *,
  html:not([data-motion="full"]) .rc-bar i { animation: none !important; }
}

/* Can't afford it yet: the button stays where it is, but stops shouting. */
.shop-item.is-short .btn-primary:disabled { background: rgba(255,255,255,.06); color: var(--text-faint); box-shadow: none; border-color: rgba(255,255,255,.08); }
.rc-hero { overflow: clip; }
.rc-fan { width: 250px; margin-right: 8px; }
/* The record cards are sleeve-first now, so the skipped-layout placeholder
   has to match their real height or the scrollbar jumps as they render. */
#view-collection .col-grid > * { contain-intrinsic-size: auto 330px; }
@media (max-width: 700px) { #view-collection .col-grid > * { contain-intrinsic-size: auto 290px; } }
