/* Shop sections (shop redesign phase 2, brand-designer, 2026-11-01).
   Dresses the markup rendered by public/shop-sections.js when the
   shopSectionsEnabled switch is on. Load AFTER shop.css. Every class is
   prefixed ss- so nothing collides with shop.css; buy cards keep .shop-card
   (and data-shop-buy) for the delegated Shop.buy listener, and the
   .ss-card rules below win over .shop-card by specificity (.shop-card.ss-card).

   Board: docs/brand/brand.json (Ploposaurus, own-brand, dark-first).
   Every color below is a productPalette token, or that token at an alpha
   written as rgba(<token rgb>, a). There are no other hues in this file.
     background #0A0A1A  surface #1A1040  launchBackground #1A0B2E
     primary #F093FB     secondary #F5576C reward #FBBF24
     success #10B981     foreground #FFFFFF
   Shadows use background (#0A0A1A) at alpha, never black.

   Measured WCAG 2.x contrast (relative luminance, sRGB):
     price button  #0A0A1A on #10B981  7.73:1  (white on it is 2.54:1: banned)
     badge gold    #0A0A1A on #FBBF24 11.74:1
     badge pink    #0A0A1A on #F093FB  9.59:1  (white on it is 2.05:1: banned)
     close/red     #0A0A1A on #F5576C  6.03:1  (white on it is 3.25:1: large only)
     accent text on surface #1A1040: gold 10.55, pink 8.62, red 5.42:1 */

.ss-root {
  /* Primitives: board tokens, verbatim. */
  --ss-ink: #0a0a1a; /* background */
  --ss-surface: #1a1040; /* surface */
  --ss-night: #1a0b2e; /* launchBackground */
  --ss-pink: #f093fb; /* primary */
  --ss-red: #f5576c; /* secondary */
  --ss-gold: #fbbf24; /* reward */
  --ss-green: #10b981; /* success */
  --ss-fg: #ffffff; /* foreground */
  --ss-ink-rgb: 10, 10, 26;
  --ss-pink-rgb: 240, 147, 251;
  --ss-red-rgb: 245, 87, 108;
  --ss-gold-rgb: 251, 191, 36;
  --ss-green-rgb: 16, 185, 129;
  --ss-fg-rgb: 255, 255, 255;

  /* Semantic. */
  --ss-text: var(--ss-fg);
  --ss-text-muted: rgba(var(--ss-fg-rgb), 0.78); /* 11.4:1 on surface */
  --ss-on-accent: var(--ss-ink);
  --ss-buy-bg: var(--ss-green);
  --ss-buy-fg: var(--ss-ink);
  --ss-section-adfree: var(--ss-pink);
  --ss-section-special: var(--ss-gold);
  --ss-section-coins: var(--ss-gold);
  --ss-section-more: var(--ss-red);

  /* Shape and rhythm. */
  --ss-border-w: 3px;
  --ss-radius: 20px;
  --ss-radius-inner: 14px;
  --ss-radius-btn: 14px;
  --ss-section-gap: 24px;
  --ss-card-gap: 12px;
  --ss-card-pad: 14px;
  --ss-target: 44px;
  --ss-card-fill: linear-gradient(180deg, var(--ss-surface) 0%, var(--ss-ink) 100%);
  --ss-lift: 0 6px 0 rgba(var(--ss-ink-rgb), 0.6), 0 10px 22px rgba(var(--ss-ink-rgb), 0.55);

  /* Type: board typography.display / body. One ratio (1.25) across the shop. */
  --ss-display: 'Rajdhani', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --ss-body: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --ss-fs-xs: 0.8rem;
  --ss-fs-sm: 0.875rem;
  --ss-fs-md: 1rem;
  --ss-fs-lg: 1.25rem;
  --ss-fs-xl: 1.5625rem;
  --ss-fs-2xl: 1.953rem;
  --ss-fs-3xl: 2.441rem;

  --ss-accent: var(--ss-pink);
  --ss-accent-rgb: var(--ss-pink-rgb);

  display: flex;
  flex-direction: column;
  gap: var(--ss-section-gap);
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  color: var(--ss-text);
  font-family: var(--ss-body);
  text-align: left;
}
.ss-root *,
.ss-root *::before,
.ss-root *::after {
  box-sizing: border-box;
}

/* Screen background, sections layout only. .screen is transparent, so the
   body's per-biome gradient (game.html body{}, --biome-bg set per biome)
   shows through: green in a green biome, which muddies the green buy
   buttons and status row. :has(.ss-root) matches only while the switch is
   on and ShopSections has rendered; the switch-off shop has no .ss-root and
   keeps the biome gradient exactly as today. A WebView without :has() falls
   back to that same biome gradient. Literal hexes because the --ss-* tokens
   are scoped inside .ss-root: surface #1A1040 to background #0A0A1A. */
#shop-screen:has(.ss-root) {
  background: radial-gradient(ellipse at 50% 0%, #1a1040 0%, #0a0a1a 70%);
}

/* ---------------------------------------------------------- sticky header */
/* Inside #shop-screen (padding 1rem, scroll container) top:0 sticks to the
   top of the scrollport. The header carries the safe-area inset itself. */
.ss-header {
  position: sticky;
  /* Chromium sticks at the scroller's padding edge, so top:0 left a
     (--sat + 1rem) strip where scrolled cards showed above the header.
     Pull it up by #shop-screen's padding-top (game.html #shop-screen{}). */
  top: calc(-1rem - var(--sat, 0px));
  z-index: 5;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: calc(var(--sat, 0px) + 8px) 4px 10px;
  background: var(--ss-night);
  border-bottom: var(--ss-border-w) solid transparent;
  border-image: linear-gradient(90deg, var(--ss-pink), var(--ss-red), var(--ss-gold)) 1;
}
.ss-coin-pill {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: var(--ss-target);
  padding: 4px 12px 4px 4px;
  border-radius: 999px;
  background: var(--ss-ink);
  border: 2px solid rgba(var(--ss-gold-rgb), 0.55);
  font-family: var(--ss-display);
  font-weight: 700;
  font-size: var(--ss-fs-lg);
  font-variant-numeric: tabular-nums;
  color: var(--ss-gold);
  line-height: 1;
}
.ss-coin-pill-icon {
  width: 30px;
  height: 30px;
  flex: none;
  display: grid;
  place-items: center;
}
.ss-coin-pill-icon > * {
  width: 100%;
  height: 100%;
}
.ss-title {
  margin: 0;
  font-family: var(--ss-display);
  font-weight: 700;
  font-size: var(--ss-fs-2xl);
  letter-spacing: 0.06em;
  line-height: 1;
  color: var(--ss-fg);
}
.ss-close {
  justify-self: end;
  width: var(--ss-target);
  height: var(--ss-target);
  display: grid;
  place-items: center;
  padding: 0;
  border: var(--ss-border-w) solid var(--ss-ink);
  border-radius: 50%;
  background: var(--ss-red);
  color: var(--ss-ink);
  box-shadow: 0 3px 0 rgba(var(--ss-ink-rgb), 0.7);
  cursor: pointer;
}
.ss-close svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 3.5;
  stroke-linecap: round;
}

/* ---------------------------------------------------------------- sections */
.ss-section {
  display: flex;
  flex-direction: column;
  gap: var(--ss-card-gap);
}
.ss-section--adfree {
  --ss-accent: var(--ss-section-adfree);
  --ss-accent-rgb: var(--ss-pink-rgb);
}
.ss-section--special {
  --ss-accent: var(--ss-section-special);
  --ss-accent-rgb: var(--ss-gold-rgb);
}
.ss-section--coins {
  --ss-accent: var(--ss-section-coins);
  --ss-accent-rgb: var(--ss-gold-rgb);
}
.ss-section--more {
  --ss-accent: var(--ss-section-more);
  --ss-accent-rgb: var(--ss-red-rgb);
}

.ss-section-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-family: var(--ss-display);
  font-weight: 700;
  font-size: var(--ss-fs-xl);
  line-height: 1.1;
  color: var(--ss-accent);
}
.ss-section-head::before {
  content: '';
  width: 6px;
  height: 1.1em;
  border-radius: 3px;
  background: var(--ss-accent);
  flex: none;
}

/* ------------------------------------------------------------------- cards */
.ss-card,
.shop-card.ss-card {
  position: relative;
  display: grid;
  gap: 10px;
  padding: var(--ss-card-pad);
  border: var(--ss-border-w) solid var(--ss-accent);
  border-radius: var(--ss-radius);
  background: var(--ss-card-fill);
  box-shadow:
    var(--ss-lift),
    inset 0 2px 0 rgba(var(--ss-fg-rgb), 0.08);
  text-align: center;
  align-items: stretch;
  flex-direction: unset;
  min-width: 0;
}
.ss-card--featured {
  box-shadow:
    var(--ss-lift),
    0 0 0 3px rgba(var(--ss-accent-rgb), 0.25),
    inset 0 2px 0 rgba(var(--ss-fg-rgb), 0.08);
}

/* The art well: the accent glows behind the drawing, the one place each card
   carries color beyond its border. */
.ss-art {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  width: 100%;
  border-radius: var(--ss-radius-inner);
  background:
    radial-gradient(circle at 50% 55%, rgba(var(--ss-accent-rgb), 0.32) 0%, rgba(var(--ss-accent-rgb), 0) 68%),
    rgba(var(--ss-ink-rgb), 0.55);
  overflow: hidden;
}
.ss-art > svg,
.ss-art > img {
  width: 82%;
  height: 82%;
  object-fit: contain;
}

/* Badge: a tab sitting on the top border. Dark ink on the accent, never white. */
.ss-badge {
  position: absolute;
  top: calc(-1 * var(--ss-border-w) - 11px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 1;
  padding: 3px 10px 2px;
  border: 2px solid var(--ss-ink);
  border-radius: 8px;
  font-family: var(--ss-display);
  font-weight: 700;
  font-size: var(--ss-fs-xs);
  letter-spacing: 0.04em;
  line-height: 1.2;
  white-space: nowrap;
  color: var(--ss-on-accent);
  background: var(--ss-gold);
}
.ss-badge--popular {
  background: var(--ss-pink);
}
.ss-badge--best {
  background: var(--ss-gold);
}

/* --------------------------------------------------- outlined numerals */
/* Section-accent fill, a 3px ink outline, and a 4px ink drop: the ink ring
   separates the bright fill from the card the way a cartoon outline does.
   (An accent extrude was tried and read as a wavy underline at 20px.)
   The outline is a 12-way text-shadow ring, the fallback the brief asked for,
   used as the primary because -webkit-text-stroke on HTML text strokes
   centered on the glyph edge and eats the fill wherever paint-order is not
   honoured for HTML text (Chromium in the 2026-11-01 render). The thin
   -webkit-text-stroke below only smooths the ring's corners. */
.ss-num {
  display: block;
  font-family: var(--ss-display);
  font-weight: 700;
  font-size: var(--ss-fs-2xl);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  color: var(--ss-accent);
  -webkit-text-stroke: 1px var(--ss-ink);
  text-shadow:
    3px 0 0 var(--ss-ink),
    -3px 0 0 var(--ss-ink),
    0 3px 0 var(--ss-ink),
    0 -3px 0 var(--ss-ink),
    2px 2px 0 var(--ss-ink),
    -2px 2px 0 var(--ss-ink),
    2px -2px 0 var(--ss-ink),
    -2px -2px 0 var(--ss-ink),
    3px 1.5px 0 var(--ss-ink),
    -3px 1.5px 0 var(--ss-ink),
    3px -1.5px 0 var(--ss-ink),
    -3px -1.5px 0 var(--ss-ink),
    0 5px 0 var(--ss-ink),
    2px 5px 0 var(--ss-ink),
    -2px 5px 0 var(--ss-ink);
}
.ss-num-unit {
  display: block;
  margin-top: 2px;
  font-family: var(--ss-display);
  font-weight: 700;
  font-size: var(--ss-fs-sm);
  letter-spacing: 0.08em;
  color: var(--ss-text);
}
.ss-card-title {
  margin: 0;
  font-family: var(--ss-display);
  font-weight: 700;
  font-size: var(--ss-fs-lg);
  line-height: 1.15;
  color: var(--ss-text);
}
.ss-card-line {
  margin: 0;
  font-size: var(--ss-fs-sm);
  line-height: 1.4;
  color: var(--ss-text-muted);
}

/* ------------------------------------------------------------ price button */
/* Dark ink on brand green: 7.73:1. A chunky lip under the button, drawn in
   background ink, makes it read as pressable without a darker green. */
.ss-buy {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  min-height: 48px;
  padding: 8px 12px;
  border: var(--ss-border-w) solid var(--ss-ink);
  border-radius: var(--ss-radius-btn);
  background-color: var(--ss-buy-bg);
  background-image: linear-gradient(180deg, rgba(var(--ss-fg-rgb), 0.28) 0%, rgba(var(--ss-fg-rgb), 0) 55%);
  color: var(--ss-buy-fg);
  font-family: var(--ss-display);
  font-weight: 700;
  font-size: var(--ss-fs-lg);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  white-space: nowrap;
  box-shadow: 0 4px 0 rgba(var(--ss-ink-rgb), 0.85);
  cursor: pointer;
  transition:
    transform 0.08s,
    box-shadow 0.08s;
}
.ss-buy:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 rgba(var(--ss-ink-rgb), 0.85);
}
.ss-buy[disabled] {
  cursor: default;
  background-image: none;
  background-color: rgba(var(--ss-green-rgb), 0.18);
  border-color: rgba(var(--ss-green-rgb), 0.55);
  color: var(--ss-green); /* 7.73:1 on ink; owned state */
  box-shadow: none;
}
/* Secondary route button (Open Season Pass, Den): outlined, same footprint. */
.ss-route {
  background-color: var(--ss-ink);
  background-image: none;
  border-color: var(--ss-accent);
  color: var(--ss-accent);
}
.ss-root :focus-visible {
  outline: 3px solid var(--ss-fg);
  outline-offset: 3px;
}

/* ------------------------------------------------------- Ad-Free (wide) */
.ss-adfree-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: calc(var(--ss-card-gap) + 8px) var(--ss-card-gap);
}
.ss-card.ss-card--wide {
  grid-template-columns: 76px 1fr;
  grid-template-areas: 'art body' 'buy buy';
  align-items: center;
  text-align: left;
  column-gap: 14px;
}
.ss-card--wide .ss-art {
  grid-area: art;
}
.ss-card--wide .ss-body {
  grid-area: body;
  min-width: 0;
  display: grid;
  gap: 4px;
}
.ss-card--wide .ss-buy {
  grid-area: buy;
  font-size: var(--ss-fs-xl);
}
.ss-card--wide .ss-num-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.ss-card--wide .ss-num-unit {
  margin: 0;
}
.ss-card--wide .ss-badge {
  left: auto;
  right: 14px;
  transform: none;
}

/* "Automatic ads paused until X": a status row, not a card. */
.ss-status {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--ss-target);
  padding: 10px 14px;
  border-radius: var(--ss-radius-inner);
  border: 2px solid rgba(var(--ss-green-rgb), 0.6);
  background: rgba(var(--ss-green-rgb), 0.12);
  font-size: var(--ss-fs-sm);
  font-weight: 600;
  line-height: 1.35;
  color: var(--ss-text);
}
.ss-status-dot {
  width: 22px;
  height: 22px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--ss-green);
  color: var(--ss-ink);
}
.ss-status-dot svg {
  width: 12px;
  height: 12px;
  stroke: currentColor;
  stroke-width: 4;
  fill: none;
}

/* -------------------------------------------------------- Special Offer */
.ss-card.ss-card--special {
  grid-template-columns: 1fr;
  padding: 0;
  overflow: hidden;
  text-align: left;
}
.ss-card--special .ss-art {
  aspect-ratio: 640 / 280;
  border-radius: 0;
}
.ss-special-body {
  display: grid;
  gap: 10px;
  padding: 0 var(--ss-card-pad) var(--ss-card-pad);
}
.ss-rewards {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.ss-reward {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: rgba(var(--ss-ink-rgb), 0.6);
  border: 2px solid rgba(var(--ss-accent-rgb), 0.45);
  display: grid;
  place-items: center;
}
.ss-special-foot {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 12px;
}
.ss-special-price {
  font-family: var(--ss-display);
  font-weight: 700;
  font-size: var(--ss-fs-xl);
  font-variant-numeric: tabular-nums;
  color: var(--ss-accent);
}

/* ------------------------------------------------------------------ Coins */
.ss-coin-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: calc(var(--ss-card-gap) + 8px) 10px;
  padding-top: 6px;
}
.ss-section--more .ss-card--coin {
  --ss-accent: var(--ss-gold);
  --ss-accent-rgb: var(--ss-gold-rgb);
}
.ss-card.ss-card--coin {
  padding: 10px 10px 12px;
  gap: 8px;
}
.ss-card--coin .ss-num {
  margin-top: -2px;
  margin-bottom: 4px;
}
.ss-more-grid .ss-art {
  max-width: 132px;
  justify-self: center;
}

/* ------------------------------------------------------ More Offers ▾ */
.ss-more-toggle {
  align-self: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 52px;
  min-width: min(100%, 260px);
  padding: 6px 8px 6px 22px;
  border: var(--ss-border-w) solid var(--ss-red);
  border-radius: 999px;
  background: var(--ss-card-fill);
  color: var(--ss-text);
  font-family: var(--ss-display);
  font-weight: 700;
  font-size: var(--ss-fs-xl);
  line-height: 1;
  box-shadow: var(--ss-lift);
  cursor: pointer;
}
.ss-chevron {
  width: 36px;
  height: 36px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 2px solid var(--ss-ink);
  background: var(--ss-red);
  color: var(--ss-ink);
  transition: transform 0.2s ease;
}
.ss-chevron svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 3.5;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ss-more-toggle[aria-expanded='true'] .ss-chevron {
  transform: rotate(180deg);
}

/* Collapsed: 0fr row plus visibility:hidden so nothing inside is focusable.
   The JS toggles aria-expanded on the button and .ss-more-panel--open here. */
.ss-more-panel {
  display: grid;
  grid-template-rows: 0fr;
  visibility: hidden;
  transition:
    grid-template-rows 0.25s ease,
    visibility 0s linear 0.25s;
}
.ss-more-panel--open {
  grid-template-rows: 1fr;
  visibility: visible;
  transition:
    grid-template-rows 0.25s ease,
    visibility 0s;
}
.ss-more-inner {
  min-height: 0;
  overflow: hidden;
  display: grid;
  gap: calc(var(--ss-card-gap) + 8px);
}
.ss-more-panel--open .ss-more-inner {
  padding-top: 14px;
  overflow: visible;
}
.ss-more-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: calc(var(--ss-card-gap) + 8px) 10px;
}

/* ------------------------------------------------------------ footer */
/* The Restore button and odds link are static game.html markup shared with
   the switch-off shop, so they are dressed here only under :has(.ss-root).
   The old .btn-small is 36px tall; this lifts it to the 44px floor and
   swaps the grey fill for the outlined pill. Same weight as a route
   button, so restoring is as easy to find as buying. */
#shop-screen:has(.ss-root) #shop-restore-btn {
  min-height: 44px;
  margin-top: 24px !important;
  padding: 8px 22px;
  border: 2px solid rgba(255, 255, 255, 0.35); /* foreground at alpha */
  border-radius: 999px;
  background: transparent;
  color: #ffffff; /* foreground */
  font-size: 0.875rem;
}
#shop-screen:has(.ss-root) .odds-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 8px;
}
/* ------------------------------------------------------------ responsive */
/* Below 340px the coin row is 2 + 1: the third card spans the row and lays
   out wide so it does not become a giant square. */
@media (max-width: 339px) {
  .ss-root {
    --ss-card-pad: 12px;
  }
  .ss-title {
    font-size: var(--ss-fs-xl);
  }
  .ss-coin-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .ss-coin-grid > .ss-card.ss-card--coin:nth-child(3):last-child {
    grid-column: 1 / -1;
    grid-template-columns: 76px 1fr;
    align-items: center;
  }
  .ss-coin-grid > .ss-card--coin:nth-child(3):last-child .ss-buy {
    grid-column: 1 / -1;
  }
  .ss-card.ss-card--wide {
    grid-template-columns: 64px 1fr;
  }
  .ss-num {
    font-size: var(--ss-fs-xl);
  }
  .ss-buy {
    font-size: var(--ss-fs-md);
  }
}
@media (min-width: 340px) and (max-width: 419px) {
  .ss-card--coin .ss-num {
    font-size: var(--ss-fs-xl);
  }
  .ss-card--coin .ss-buy {
    font-size: var(--ss-fs-md);
    padding: 8px 6px;
  }
}
@media (min-width: 768px) {
  .ss-adfree-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .ss-adfree-list > .ss-status {
    grid-column: 1 / -1;
  }
  .ss-adfree-list > .ss-card--wide:only-of-type {
    grid-column: 1 / -1;
  }
  .ss-card.ss-card--special {
    grid-template-columns: 1.15fr 1fr;
    align-items: stretch;
  }
  .ss-card--special .ss-art {
    aspect-ratio: auto;
    min-height: 100%;
  }
  .ss-special-body {
    padding: var(--ss-card-pad);
    align-content: center;
  }
  .ss-more-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
/* Phone landscape (844x390): the header is the cost; compress it. */
@media (orientation: landscape) and (max-height: 500px) {
  .ss-root {
    --ss-section-gap: 18px;
  }
  .ss-header {
    padding-top: calc(var(--sat, 0px) + 4px);
    padding-bottom: 6px;
  }
  .ss-title {
    font-size: var(--ss-fs-xl);
  }
  .ss-coin-pill {
    font-size: var(--ss-fs-md);
  }
  .ss-card--coin .ss-art {
    width: 72%;
    justify-self: center;
  }
}

/* ------------------------------------------------------------ motion */
@media (prefers-reduced-motion: reduce) {
  .ss-root *,
  .ss-root *::before,
  .ss-root *::after {
    transition: none !important;
    animation: none !important;
  }
  .ss-buy:active {
    transform: none;
  }
}

/* Sandbox pill moved above the sections while the sectioned layout is on (shop-sections.js applyChrome). */
.ss-mode-pill {
  align-self: center;
  margin: 0 0 0.5rem;
}
