/* ========================================
   COLLECTION STATS (the stats redesign, Phase 3, 2026-10-27)
   The Pokémon /stats page and /u/{username}/stats, rendered by
   templates/shared/tcg/collection-stats.php and its partials in
   templates/shared/tcg/collection-stats/, driven by
   public/js/shared/tcg/collection-stats.js. The handoff's screenshots are the
   design (SPEC sections 2 to 12; the build contract sections 6 and 7).

   Loaded last, after set-detail.css, set-list.css, style.css and footer.css
   (page-heading.css comes first, from head-foundation.php). Reused classes
   keep their own rules: the goal switch, the set label and the locked cell
   (set-detail.css), the set tile (set-list.css), .premium-pill,
   .ttcg-textlink and .submit (style.css), .coming-soon-badge
   (nav-dropdowns.css), the sign-up panel and the milestone strip
   (set-detail.css; the strip's solid look is here). Every new class starts
   with cs-.

   Bands: 1200px and up the figures four in a row; 1024px and up the desktop
   layout (as many Closest tiles as fit at a 310px pitch, the breakdowns side
   by side, Recent Activity in two columns); 600 to 1023px one column, the
   tiles in an edge-to-edge swipe row, every target 44px; under 600px the
   Closest and New Set lists, the figures in pairs, the missing cards as a
   list, 20px panel padding.

   Text colours are the text-safe tokens (Important Note 40); gold is for
   Premium only (Important Note 39). Measured ratios are beside each new
   colour.
   ======================================== */

.cs-page {
  /* The set header's hairline and hover tint (set-detail.css), which
     .goal-switch and .set-panel__signup read. */
  --sh-hairline: color-mix(in srgb, var(--colour-text) 8%, transparent);
  --sh-hover: color-mix(in srgb, var(--colour-text) 12%, transparent);
  /* The body's side padding (style.css), for the edge-to-edge swipe row. */
  --cs-gutter: clamp(16px, 5vw, 140px);
  /* The open Closest button. --colour-secondary (#1F8AC0) is 3.85:1 under
     white text; its text-safe shade (--primary-hover) is 6.1:1, in both
     themes (the fill does not change with the theme). The ring and the
     panel's edge stay --colour-secondary: 3.85:1 on white, 3.33 on the dark
     page, enough for a graphic. */
  --cs-open-fill: #1461B8;
  /* Recent Activity chips, each on its own tint over the card (paper).
     Light: added #1E6B6B 4.98:1, removed #A3360A 5.42:1, changed the text
     colour. Dark (below): added #7DD3D3 5.13:1, removed #FDBA74 5.5:1.
     --colour-trend-*-text drop under 4.5:1 on these tints. */
  --cs-chip-added-fg: #1E6B6B;
  --cs-chip-added-bg: rgba(45, 138, 138, 0.12);
  --cs-chip-removed-fg: #A3360A;
  --cs-chip-removed-bg: rgba(194, 65, 12, 0.10);
  --cs-chip-changed-fg: var(--colour-text);
  --cs-chip-changed-bg: color-mix(in srgb, var(--colour-text) 8%, transparent);
  max-width: 1600px;
  margin: 0 auto;
  padding: var(--space-40) 0 var(--space-64);
  font-family: var(--font-paragraph);
  font-weight: var(--font-weight-sm);
  color: var(--colour-text);
}

[data-theme="dark"] .cs-page {
  --cs-chip-added-fg: #7DD3D3;
  --cs-chip-added-bg: rgba(94, 189, 189, 0.12);
  --cs-chip-removed-fg: #FDBA74;
  --cs-chip-removed-bg: rgba(249, 115, 22, 0.12);
}

/* A class with a display value beats the UA's [hidden] rule: the panels, the
   Show All buttons, the opener's Browse Expansions link (a .ttcg-textlink)
   and the milestone strip all start hidden. */
.cs-page [hidden] {
  display: none !important;
}

/* The set tiles inherit the page font on the Expansions index (Montserrat
   700 from <body>); here the page sets Hind, so the tile gets it back. */
.cs-page .set-tile-wrap {
  font-family: var(--font-header);
  font-weight: var(--font-weight-lg);
}

/* Page-wide defaults at the lowest specificity (:where), so every class
   rule wins over them, the reused ones included (the tile's .exp-body p
   keeps its 4px margin, its link keeps its inset focus ring). */
:where(.cs-page) :is(h2, h3, h4) {
  margin: 0;
  font-family: var(--font-header);
  font-weight: 700;
  color: var(--colour-text);
}

:where(.cs-page) p {
  margin: 0;
}

:where(.cs-page) :is(a, button):focus-visible {
  outline: 3px solid var(--colour-focus-ring);
  outline-offset: 2px;
}

/* ── Heading and controls (6.1) ── */
header.ttcg-page-head.cs-head {
  margin-bottom: 20px;
}

.cs-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 12px 24px;
}

.cs-goal {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
}

/* set-detail.css moves the switch before its label under 1024px
   (order: -1, for the set header); here the label stays first. */
.cs-goal .goal-switch {
  order: 0;
}

.cs-goal .goal-switch__option:focus-visible {
  outline: 3px solid var(--colour-focus-ring);
  outline-offset: 2px;
}

.cs-public {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px 10px;
}

.cs-public__label {
  font-family: var(--font-header);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--colour-text);
}

.cs-public__note {
  flex-basis: 100%;
  font-family: var(--font-paragraph);
  font-size: 13px;
  line-height: 1.4;
  color: var(--colour-text-muted);
  text-align: right;
}

.cs-public__note .ttcg-textlink {
  font-size: 13px;
}

/* The Public Stats switch: a 44 x 24 track and an 18px knob. Off, the track
   is the text colour at 50% (3.5:1 on white, 4.3 on the dark page); on, the
   secondary blue (3.85 and 3.33). Its hit area is 44px tall under 1024px. */
.cs-switch {
  position: relative;
  flex: none;
  width: 44px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: color-mix(in srgb, var(--colour-text) 50%, transparent);
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.cs-switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #FFFFFF;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s ease;
}

.cs-switch[aria-checked="true"] {
  background: var(--colour-secondary);
}

.cs-switch[aria-checked="true"]::after {
  transform: translateX(20px);
}

.cs-switch:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.cs-share {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--colour-secondary);
  border-radius: var(--radius-xs);
  background: transparent;
  font-family: var(--font-header);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--colour-secondary-text);
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.cs-share:hover {
  background: color-mix(in srgb, var(--colour-secondary) 10%, transparent);
}

.cs-share svg {
  flex: none;
}

/* ── Opener (6.2) ── */
.cs-opener {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 0 0 32px;
}

.cs-opener__text {
  flex: 0 1 auto;
  max-width: 90ch;
  font-family: var(--font-paragraph);
  font-size: 20px;
  font-weight: 400;
  line-height: 1.45;
  color: var(--colour-text);
}

.cs-opener__text strong {
  font-weight: 700;
}

.cs-opener__text .ttcg-textlink {
  vertical-align: baseline;
}

.cs-opener__next {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-top: -6px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--colour-text-muted);
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.cs-opener__next:hover {
  background: var(--sh-hover);
  color: var(--colour-text);
}

@media (min-width: 1024px) {
  .cs-opener__text {
    font-size: 24px;
  }

  .cs-opener__next {
    margin-top: -4px;
  }
}

/* ── Figures (6.3) ── */
/* One paper card; 1px hairlines between the figures are the card's own
   hairline-over-paper background showing through a 1px gap. A row with an
   odd figure out spans it, so no empty cell shows that background. */
.cs-figures {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin: 0 0 48px;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: linear-gradient(var(--sh-hairline), var(--sh-hairline)) var(--colour-paper);
  box-shadow: var(--shadow-resting);
}

.cs-figures > .cs-figure:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

.cs-figure {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  margin: 0;
  background: var(--colour-paper);
}

.cs-figures > .cs-figure {
  container-type: inline-size;
  padding: 24px 28px;
}

.cs-figure dd {
  margin: 0;
}

.cs-figure__value {
  font-family: var(--font-header);
  font-size: var(--text-lg);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.01em;
  color: var(--colour-text);
  overflow-wrap: anywhere;
}

/* 39px where the figure has room, down to 25px (the phone's pair). */
.cs-figures .cs-figure__value {
  font-size: clamp(25px, 16cqi, 39.06px);
}

.cs-figure__sub {
  font-family: var(--font-paragraph);
  font-size: 14px;
  line-height: 1.4;
  color: var(--colour-text-muted);
}

.cs-delta {
  font-weight: 600;
}

.cs-delta--up {
  color: var(--colour-trend-positive-text);
}

.cs-delta--down {
  color: var(--colour-trend-negative-text);
}

@media (min-width: 1200px) {
  .cs-figures {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
  }

  .cs-figures > .cs-figure:last-child:nth-child(odd) {
    grid-column: auto;
  }
}

/* ── The milestone strip, solid (SPEC 2 item 5) ── */
/* Under the figures, 24px below them. The award glyph sits in a gold disc
   before the text; the button is the landing page's solid gold one
   (.lp-premium-cta): #1a1a1a on the gold, 7.9:1. */
.cs-page > .milestone-strip {
  max-width: none;
  margin: -24px 0 48px;
}

.milestone-strip--solid {
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  gap: 20px;
}

.milestone-strip__glyph {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--colour-premium) 22%, transparent);
  color: var(--colour-premium-text);
}

.milestone-strip--solid .milestone-strip__kicker .set-label {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  color: var(--colour-text);
}

.milestone-strip--solid .milestone-strip__line {
  font-family: var(--font-paragraph);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.45;
}

.milestone-strip--solid .milestone-strip__cta {
  justify-content: center;
  min-height: 44px;
  padding: 10px 24px;
  border: 0;
  background: var(--colour-premium);
  font-size: 16px;
  color: #1a1a1a;
}

.milestone-strip--solid .milestone-strip__cta:hover {
  background: var(--colour-premium-hover);
  color: #1a1a1a;
  box-shadow: none;
}

@media (max-width: 1023px) {
  .milestone-strip--solid {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas:
      "glyph text dismiss"
      "cta   cta  cta";
  }

  .milestone-strip--solid .milestone-strip__glyph {
    grid-area: glyph;
    align-self: start;
  }

  .milestone-strip--solid .milestone-strip__cta {
    justify-self: start;
    font-size: 16px;
  }
}

/* ── Sections ── */
.cs-section {
  margin: 0 0 56px;
}

.cs-section__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px 24px;
  margin: 0 0 20px;
}

.cs-section__head h2 {
  font-size: var(--text-md);
  line-height: 1.2;
}

.cs-section__sub,
.cs-section__note {
  font-family: var(--font-paragraph);
  font-size: 14px;
  line-height: 1.45;
  color: var(--colour-text-muted);
}

.cs-section__sub {
  margin-top: 4px;
}

/* ── Badges and bars ── */
.cs-badge {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  padding: 2px 6px;
  border: 1px solid var(--colour-border);
  border-radius: 6px;
  font-family: var(--font-header);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.04em;
  color: var(--colour-text);
  white-space: nowrap;
}

.cs-bar {
  display: block;
  position: relative;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--bar-track);
}

.cs-bar__fill {
  display: block;
  height: 100%;
  border-radius: inherit;
}

.cs-bar__fill--card   { background: var(--colour-chart-4); }
.cs-bar__fill--base   { background: var(--colour-chart-1); }
.cs-bar__fill--master { background: var(--colour-chart-2); }
.cs-bar__fill--grand  { background: var(--colour-chart-3); }

.cs-chevron {
  flex: none;
  transition: transform 0.2s ease;
}

[aria-expanded="true"] .cs-chevron {
  transform: rotate(180deg);
}

/* ── Closest to Complete (6.4) and Start With a New Set (6.7) ── */
/* The section is the size container the tile row is fitted to. */
.cs-closest,
.cs-newsets {
  container: cs-tiles / inline-size;
}

.cs-closest__row {
  display: flex;
  gap: 24px;
}

.cs-closest__list {
  display: none;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Positioned, so the visually hidden labels inside take their place from
   the set: in the swipe row they then scroll and clip with it (positioned
   from the section, a tile scrolled out of view widened the page). */
.cs-set {
  position: relative;
  display: flex;
  flex: none;
  flex-direction: column;
  gap: 12px;
  width: var(--card-width-sm);
  min-width: 0;
}

/* The open set's tile carries a 2px ring in the secondary blue. */
.cs-set:has(> .cs-set__toggle[aria-expanded="true"]) .expansion {
  outline: 2px solid var(--colour-secondary);
  outline-offset: 3px;
}

/* The row under each tile is the set's button: "6 cards left" and the
   cost to finish. Open, it fills with the open blue and its text turns
   white. */
.cs-set__toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 40px;
  padding: 6px 12px 6px 14px;
  border: 1px solid var(--colour-border);
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--colour-text);
  text-decoration: none;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.cs-set__toggle:hover {
  background: var(--sh-hover);
}

.cs-set__left {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-header);
  font-size: 15px;
  line-height: 1.2;
  white-space: nowrap;
}

.cs-set__left strong {
  font-weight: 700;
}

.cs-set__cost {
  min-width: 0;
  font-family: var(--font-paragraph);
  font-size: 13px;
  line-height: 1.3;
  color: var(--colour-text-muted);
  text-align: right;
}

.cs-set__toggle[aria-expanded="true"] {
  border-color: var(--cs-open-fill);
  background: var(--cs-open-fill);
  color: #FFFFFF;
}

.cs-set__toggle[aria-expanded="true"] .cs-set__cost {
  color: #FFFFFF;
}

/* The Premium pill on the open blue: its tint would fall to 1.2:1 there, so
   it sits on white (#7A5810 on #FAFAFA, 6.2:1) in both themes. */
.cs-set__toggle[aria-expanded="true"] .premium-pill {
  background: #FAFAFA;
  color: #7A5810;
}

/* Desktop: as many 286px tiles as fit at a 310px pitch (n fit when the row
   is at least 310n - 24 wide), spread edge to edge. The grid keeps a full
   row's columns when fewer sets are listed, so a tile always sits where a
   full row would put it, and the notch formula (SPEC 6) holds:
   x = i * (W - 286) / (n - 1) + 143. */
@media (min-width: 1024px) {
  .cs-closest__row {
    display: grid;
    grid-template-columns: repeat(var(--cs-cols, 4), var(--card-width-sm));
    justify-content: space-between;
    column-gap: 24px;
  }

  .cs-closest__row,
  .cs-panels {
    --cs-cols: 4;
  }

  @container cs-tiles (min-width: 1526px) {
    .cs-closest__row,
    .cs-panels {
      --cs-cols: 5;
    }
  }

  @container cs-tiles (max-width: 1525.98px) {
    .cs-closest__row > .cs-set:nth-child(n + 5) {
      display: none;
    }
  }

  @container cs-tiles (max-width: 1215.98px) {
    .cs-closest__row,
    .cs-panels {
      --cs-cols: 3;
    }

    .cs-closest__row > .cs-set:nth-child(n + 4) {
      display: none;
    }
  }

  @container cs-tiles (max-width: 905.98px) {
    .cs-closest__row,
    .cs-panels {
      --cs-cols: 2;
    }

    .cs-closest__row > .cs-set:nth-child(n + 3) {
      display: none;
    }
  }
}

/* 600 to 1023px: every tile in an edge-to-edge swipe row that snaps to a
   tile and shows no scrollbar; collection-stats.js scrolls the open tile
   into view. The vertical padding keeps the open ring and the hover lift
   inside the scroller. */
@media (min-width: 600px) and (max-width: 1023px) {
  .cs-closest__row {
    margin: -10px calc(-1 * var(--cs-gutter)) -8px;
    padding: 10px var(--cs-gutter) 8px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: var(--cs-gutter);
    scrollbar-width: none;
  }

  .cs-closest__row::-webkit-scrollbar {
    display: none;
  }

  .cs-set {
    scroll-snap-align: start;
  }

  .cs-set__toggle {
    min-height: 44px;
  }
}

/* ── The open-set panel (6.4; SPEC 7) ── */
.cs-panels {
  margin-top: 20px;
}

/* The notch sits under the open tile's centre: --notch-x is set by
   collection-stats.js from the tile's real position; without it the
   desktop formula above (or the swipe row's 310px pitch) stands in. */
.cs-panel {
  position: relative;
  padding: 28px 32px;
  border: 2px solid var(--colour-secondary);
  border-radius: var(--radius-sm);
  background: var(--colour-paper);
  box-shadow: var(--shadow-resting);
}

.cs-panel::before {
  content: "";
  position: absolute;
  top: -9px;
  left: var(--notch-x, calc(var(--i, 0) * 310px + 141px));
  width: 16px;
  height: 16px;
  box-sizing: border-box;
  border-top: 2px solid var(--colour-secondary);
  border-left: 2px solid var(--colour-secondary);
  background: var(--colour-paper);
  transform: translateX(-50%) rotate(45deg);
}

/* The open tile is scrolled out of the panel's width (the swipe row). */
.cs-panel.is-notchless::before {
  display: none;
}

@media (min-width: 1024px) {
  .cs-panel::before {
    left: var(--notch-x, calc(var(--i, 0) * (100cqi - var(--card-width-sm)) / max(1, var(--cs-cols, 4) - 1) + 141px));
  }
}

.cs-panel__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px 32px;
  margin: 0 0 20px;
}

.cs-panel__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  margin: 0 0 6px;
  font-family: var(--font-paragraph);
  font-size: 14px;
  line-height: 1.4;
  color: var(--colour-text-muted);
}

.cs-panel__head h3 {
  font-size: var(--text-md);
  line-height: 1.2;
}

.cs-panel__left {
  text-align: right;
}

.cs-panel__count {
  font-family: var(--font-header);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--colour-text);
}

.cs-panel__cost {
  margin-top: 2px;
  font-family: var(--font-paragraph);
  font-size: 14px;
  line-height: 1.4;
  color: var(--colour-text-muted);
}

/* The money row: the set header's figures in a hairline grid, one row of
   as many cells as the viewer gets (two by two on a phone). */
.cs-panel__money {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 1px;
  margin: 0 0 28px;
  overflow: hidden;
  border: 1px solid var(--sh-hairline);
  border-radius: 12px;
  background: linear-gradient(var(--sh-hairline), var(--sh-hairline)) var(--colour-paper);
}

.cs-panel__money > .cs-figure {
  gap: 4px;
  padding: 14px 16px;
}

.cs-panel__money .set-label {
  letter-spacing: 0;
  text-transform: none;
}

.cs-panel__money .cs-figure__value {
  font-size: 20px;
  line-height: 1.2;
}

.cs-panel__money .cs-figure__value.is-unavailable {
  font-family: var(--font-paragraph);
  font-size: 16px;
  font-weight: 400;
  color: var(--colour-text-muted);
}

.cs-panel__money .cs-figure__sub {
  font-size: 13px;
}

/* The Most Expensive Card's name links to its card; the link covers the
   whole cell, so the target is the cell. */
.cs-panel__money > .cs-figure {
  position: relative;
}

.cs-panel__money .cs-figure__sub a {
  color: inherit;
  text-decoration: none;
}

.cs-panel__money .cs-figure__sub a::after {
  content: "";
  position: absolute;
  inset: 0;
}

.cs-panel__money .cs-figure__sub a:hover {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.cs-page .cs-panel__money .cs-figure__sub a:focus-visible {
  outline: none;
}

.cs-page .cs-panel__money .cs-figure__sub a:focus-visible::after {
  outline: 3px solid var(--colour-focus-ring);
  outline-offset: -3px;
}

.cs-panel__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 24px;
  margin: 0 0 16px;
}

.cs-panel__title {
  font-size: 18px;
  line-height: 1.3;
}

.cs-panel__links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 20px;
}

/* Soon tools: muted, with the Soon pill, not links. */
.cs-soon {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-family: var(--font-header);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--colour-text-muted);
  cursor: default;
}

.cs-missing__more {
  margin-top: 16px;
}

.cs-panel__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--sh-hairline);
}

.cs-note {
  font-family: var(--font-paragraph);
  font-size: 13px;
  line-height: 1.5;
  color: var(--colour-text-muted);
}

/* ── The Closest and New Set lists (under 600px) ── */
.cs-setrow {
  padding: 1px;
  border: 1px solid var(--colour-border);
  border-radius: var(--radius-sm);
  background: var(--colour-paper);
}

/* Open: a 2px secondary frame. The closed row's 1px padding takes the
   border's second pixel, so nothing inside moves. */
.cs-setrow:has(> .cs-setrow__toggle[aria-expanded="true"]) {
  padding: 0;
  border: 2px solid var(--colour-secondary);
}

.cs-setrow__toggle {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  grid-template-areas:
    "badge name left"
    "badge meta left"
    "badge bar  bar";
  align-items: center;
  column-gap: 14px;
  row-gap: 2px;
  min-height: 44px;
  padding: 14px 16px;
  border-radius: calc(var(--radius-sm) - 2px);
  color: var(--colour-text);
  text-decoration: none;
}

.cs-page .cs-setrow__toggle:focus-visible {
  outline-offset: -3px;
}

.cs-setrow__toggle > .cs-badge {
  grid-area: badge;
  width: 52px;
  height: 52px;
  padding: 0;
  border: 1px solid var(--sh-hairline);
  border-radius: 10px;
  background: var(--sh-hairline);
  font-size: 12px;
}

.cs-setrow__name {
  grid-area: name;
  min-width: 0;
  font-family: var(--font-header);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.cs-setrow__meta {
  grid-area: meta;
  min-width: 0;
  font-family: var(--font-paragraph);
  font-size: 13px;
  line-height: 1.35;
  color: var(--colour-text-muted);
}

.cs-setrow__toggle > .cs-bar {
  grid-area: bar;
  margin-top: 8px;
}

.cs-setrow__left {
  grid-area: left;
  align-self: start;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-header);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
}

.cs-setrow__toggle[aria-expanded="true"] .cs-setrow__left,
.cs-setrow__link .cs-setrow__left {
  color: var(--colour-secondary-text);
}

.cs-setrow__link .cs-setrow__left {
  align-self: center;
}

/* The open panel, moved into its row by collection-stats.js under 600px:
   the row's frame is its frame, so it loses its own edge and notch. */
.cs-setrow > .cs-panel {
  margin: 0;
  padding: 20px;
  border: 0;
  border-top: 1px solid var(--sh-hairline);
  border-radius: 0 0 calc(var(--radius-sm) - 2px) calc(var(--radius-sm) - 2px);
  box-shadow: none;
}

.cs-setrow > .cs-panel::before {
  display: none;
}

@media (max-width: 599px) {
  .cs-closest__row {
    display: none;
  }

  .cs-closest__list {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .cs-panels {
    margin-top: 12px;
  }

  .cs-panel {
    padding: 20px;
  }

  .cs-panel::before {
    display: none;
  }

  .cs-panel__head h3 {
    font-size: 22px;
  }

  .cs-panel__left {
    flex-basis: 100%;
    text-align: left;
  }

  .cs-panel__money {
    grid-auto-flow: row;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cs-panel__money > .cs-figure:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }

  .cs-panel__links {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
}

/* ── Across Your N Sets (6.5) ── */
/* The tiers strip: one paper card, hairlines between the tiers. */
.cs-tiers {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1px;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: linear-gradient(var(--sh-hairline), var(--sh-hairline)) var(--colour-paper);
  box-shadow: var(--shadow-resting);
}

.cs-tier {
  min-width: 0;
  padding: 22px 28px;
  background: var(--colour-paper);
}

.cs-tier__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  margin: 0 0 12px;
}

.cs-tier__name {
  font-family: var(--font-header);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--colour-text);
}

.cs-goal-badge {
  padding: 3px 8px;
  border: 1px solid var(--colour-border);
  border-radius: 999px;
  font-family: var(--font-header);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--colour-text);
}

.cs-tier__pct {
  margin-left: auto;
  font-family: var(--font-header);
  font-size: var(--text-md);
  font-weight: 700;
  line-height: 1;
  color: var(--colour-text);
}

.cs-tier__count {
  margin-top: 10px;
  font-family: var(--font-paragraph);
  font-size: 13px;
  line-height: 1.4;
  color: var(--colour-text-muted);
}

.cs-breakdowns {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
  align-items: start;
  margin-top: 24px;
}

.cs-card {
  min-width: 0;
  padding: 24px 28px;
  border-radius: var(--radius-sm);
  background: var(--colour-paper);
  box-shadow: var(--shadow-resting);
}

.cs-card__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 16px;
  margin: 0 0 8px;
}

.cs-card__head h3 {
  font-size: 18px;
  line-height: 1.3;
}

.cs-card__scope {
  font-family: var(--font-header);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--colour-text-muted);
}

.cs-card__sub {
  margin: 0 0 16px;
  font-family: var(--font-paragraph);
  font-size: 13px;
  line-height: 1.5;
  color: var(--colour-text-muted);
}

.cs-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.cs-tabs [role="tab"] {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 6px 10px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  font-family: var(--font-header);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--colour-text-muted);
  cursor: pointer;
}

.cs-tabs [role="tab"]:hover {
  color: var(--colour-text);
}

.cs-tabs [role="tab"][aria-selected="true"] {
  border-bottom-color: var(--colour-secondary);
  color: var(--colour-text);
}

/* Without JavaScript every tab panel shows, one under another;
   collection-stats.js marks the card is-tabbed when it hides all but one. */
.cs-tabpanel + .cs-tabpanel {
  margin-top: 24px;
}

.cs-bycard.is-tabbed .cs-tabpanel + .cs-tabpanel {
  margin-top: 0;
}

.cs-rows {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* A breakdown row, one line from 1024px: the badge or type dot (rarity and
   type rows), the name, the bar, "214 of 486" and the percentage. Fixed
   columns, so the bars line up down a card. A linked row opens All Cards,
   filtered to it. */
.cs-row {
  display: grid;
  grid-template-columns: minmax(0, 10rem) minmax(48px, 1fr) minmax(7.5rem, auto) 3.25rem;
  grid-template-areas: "name bar count pct";
  align-items: center;
  min-height: 40px;
  margin: 0 -10px;
  padding: 4px 10px;
  border-radius: 8px;
  color: var(--colour-text);
  text-decoration: none;
}

.cs-row:has(> .cs-badge, > .cs-type-dot) {
  grid-template-columns: 2.75rem minmax(0, 8.5rem) minmax(48px, 1fr) minmax(7.5rem, auto) 3.25rem;
  grid-template-areas: "lead name bar count pct";
}

a.cs-row:hover {
  background: var(--sh-hover);
}

.cs-row > .cs-badge {
  grid-area: lead;
  justify-self: start;
  width: 2.125rem;
  min-width: 0;
  padding: 3px 0;
  font-size: 10px;
}

.cs-row > .cs-type-dot {
  grid-area: lead;
  justify-self: start;
  margin-left: 0.75rem;
}

.cs-row__name {
  grid-area: name;
  min-width: 0;
  padding-right: 16px;
  font-family: var(--font-header);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.cs-row > .cs-bar {
  grid-area: bar;
}

.cs-row__count {
  grid-area: count;
  justify-self: end;
  padding-left: 16px;
  font-family: var(--font-header);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
}

.cs-row__pct {
  grid-area: pct;
  justify-self: end;
  font-family: var(--font-paragraph);
  font-size: 13px;
  line-height: 1.3;
  color: var(--colour-text-muted);
  white-space: nowrap;
}

.cs-more {
  margin-top: 12px;
}

/* Type dots: the type's colour, decorative (the name carries the type).
   Trainer and energy kinds share the muted grey. */
.cs-type-dot {
  display: inline-block;
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--colour-text-muted);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15);
}

.cs-type-dot.type-grass     { background: #78C850; }
.cs-type-dot.type-fire      { background: #F08030; }
.cs-type-dot.type-water     { background: #6890F0; }
.cs-type-dot.type-lightning { background: #F8D030; }
.cs-type-dot.type-psychic   { background: #F85888; }
.cs-type-dot.type-fighting  { background: #C03028; }
.cs-type-dot.type-darkness  { background: #705848; }
.cs-type-dot.type-metal     { background: #B8B8D0; }
.cs-type-dot.type-dragon    { background: #7038F8; }
.cs-type-dot.type-fairy     { background: #EE99AC; }
.cs-type-dot.type-colorless { background: #C0C0C0; }
/* Card colours (One Piece's Colour tab, Phase 5): the old stats page's
   values. Decorative like the type dots: the row's name says the colour. */
.cs-type-dot.type-red       { background: #D9342B; }
.cs-type-dot.type-green     { background: #2E8B57; }
.cs-type-dot.type-blue      { background: #2874D0; }
.cs-type-dot.type-purple    { background: #7B4BC8; }
.cs-type-dot.type-black     { background: #555555; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35); }
.cs-type-dot.type-yellow    { background: #D6A700; }

/* Generation, locked: the generations' names over empty tracks at 35%
   (decorative, aria-hidden in the markup) under the Premium card. The two
   share one grid cell, so the card never overflows a short list. */
.cs-lock {
  display: grid;
  min-height: 240px;
}

.cs-lock > * {
  grid-area: 1 / 1;
}

.cs-rows--muted {
  opacity: 0.35;
}

.cs-lock__card {
  z-index: 1;
  align-self: center;
  justify-self: center;
  width: min(340px, 100%);
  padding: 20px 24px;
  border: 1px solid color-mix(in srgb, var(--colour-premium) 60%, transparent);
  border-radius: 12px;
  background: var(--colour-bg);
  box-shadow: var(--shadow-floating);
  text-align: center;
}

.cs-lock__card p {
  font-family: var(--font-paragraph);
  font-size: 14px;
  line-height: 1.5;
  color: var(--colour-text);
}

.cs-lock__card .cs-lock__title {
  margin-bottom: 6px;
  font-family: var(--font-header);
  font-size: 16px;
  font-weight: 700;
}

.cs-lock__note {
  margin-top: 14px;
}

.cs-lock__card .cs-lock__note {
  font-family: var(--font-header);
  font-weight: 600;
  color: var(--colour-premium-text);
}

/* The Premium button: solid gold, #1a1a1a text (7.9:1). */
.cs-btn-premium {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  margin-top: 14px;
  padding: 10px 22px;
  border-radius: var(--radius-xs);
  background: var(--colour-premium);
  font-family: var(--font-header);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
  color: #1a1a1a;
  text-decoration: none;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.cs-btn-premium:hover {
  background: var(--colour-premium-hover);
  color: #1a1a1a;
  transform: translateY(-1px);
}

@media (min-width: 1024px) {
  .cs-tiers {
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
  }

  .cs-breakdowns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 600px) and (max-width: 1023px) {
  .cs-tiers {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cs-tiers > .cs-tier:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }
}

/* Under 1024px a row takes two lines, the bar under its label: with a lead,
   the percentage sits under the badge; without one, under the count. */
@media (max-width: 1023px) {
  .cs-row {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "name count"
      "bar  pct";
    row-gap: 6px;
    column-gap: 12px;
    min-height: 44px;
    padding-block: 6px;
  }

  .cs-row:has(> .cs-badge, > .cs-type-dot) {
    grid-template-columns: 2.75rem minmax(0, 1fr) auto;
    grid-template-areas:
      "lead name count"
      "pct  bar  bar";
    column-gap: 0;
  }

  .cs-row__name {
    padding-right: 12px;
  }

  .cs-row__count {
    padding-left: 0;
  }

  .cs-row:has(> .cs-badge, > .cs-type-dot) .cs-row__pct {
    justify-self: start;
  }

  .cs-tabs [role="tab"] {
    min-height: 44px;
  }

  .cs-lock {
    min-height: 280px;
  }
}

@media (max-width: 599px) {
  .cs-tier,
  .cs-card {
    padding: 20px;
  }
}

/* ── Recent Activity (6.6) ── */
.cs-activity {
  padding: 28px;
  border-radius: var(--radius-sm);
  background: var(--colour-paper);
  box-shadow: var(--shadow-resting);
}

.cs-activity > .cs-section__head {
  margin-bottom: 4px;
}

.cs-activity__day {
  margin: 20px 0 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--sh-hairline);
  font-size: var(--text-xs);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.cs-page .cs-activity__day {
  color: var(--colour-text-muted);
}

.cs-activity__list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px 32px;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* A row: the thumbnail, the card and its details, the change. The card's
   link covers the row (the ::after below), so the whole row is the target. */
.cs-activity__row {
  position: relative;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 50px;
}

.cs-activity__row > picture {
  grid-column: 1;
  display: block;
  width: 36px;
  height: 50px;
}

.cs-activity__thumb {
  display: block;
  width: 36px;
  height: 50px;
  border-radius: 4px;
  background: var(--bar-track);
  object-fit: cover;
}

.cs-activity__info {
  grid-column: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 8px;
  min-width: 0;
}

.cs-activity__name {
  font-family: var(--font-header);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--colour-text);
  text-decoration: none;
  overflow-wrap: anywhere;
}

.cs-activity__name::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 6px;
}

.cs-activity__name:hover {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

/* The ring goes on the row, which the link covers. */
.cs-page .cs-activity__name:focus-visible {
  outline: none;
}

.cs-page .cs-activity__name:focus-visible::after {
  outline: 3px solid var(--colour-focus-ring);
  outline-offset: 2px;
}

.cs-activity__meta {
  flex-basis: 100%;
  font-family: var(--font-paragraph);
  font-size: 13px;
  line-height: 1.35;
  color: var(--colour-text-muted);
}

.cs-new,
.cs-delta-chip {
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-header);
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

.cs-new {
  background: var(--cs-chip-added-bg);
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--cs-chip-added-fg);
}

.cs-delta-chip {
  grid-column: 3;
  font-size: 13px;
}

.cs-delta-chip--added {
  background: var(--cs-chip-added-bg);
  color: var(--cs-chip-added-fg);
}

.cs-delta-chip--removed {
  background: var(--cs-chip-removed-bg);
  color: var(--cs-chip-removed-fg);
}

.cs-delta-chip--changed {
  background: var(--cs-chip-changed-bg);
  color: var(--cs-chip-changed-fg);
}

@media (min-width: 1024px) {
  .cs-activity__list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 599px) {
  .cs-activity {
    padding: 20px;
  }
}

/* ── New account (6.7) ── */
.cs-guide {
  position: relative;
  margin: 0 0 48px;
  padding: 32px;
  border-radius: var(--radius-sm);
  background: var(--colour-paper);
  box-shadow: var(--shadow-resting);
}

.cs-guide h2 {
  padding-right: 48px;
  font-size: var(--text-md);
  line-height: 1.2;
}

.cs-guide > p {
  max-width: 46rem;
  margin-top: 8px;
  font-size: 16px;
  line-height: 1.55;
  color: var(--colour-text);
}

.cs-guide__dismiss {
  position: absolute;
  top: 12px;
  right: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  font-size: 24px;
  line-height: 1;
  color: var(--colour-text);
  cursor: pointer;
}

.cs-guide__dismiss:hover {
  background: var(--sh-hover);
}

.cs-guide__steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin: 24px 0 28px;
  padding: 0;
  list-style: none;
}

.cs-guide__steps li {
  padding: 20px;
  border: 1px solid var(--sh-hairline);
  border-radius: 12px;
}

.cs-guide__n {
  display: block;
  margin-bottom: 6px;
  font-family: var(--font-header);
  font-size: var(--text-md);
  font-weight: 700;
  line-height: 1;
  color: var(--colour-secondary-text);
}

.cs-guide__steps h3 {
  margin-bottom: 4px;
  font-size: 16px;
  line-height: 1.3;
}

.cs-guide__steps p {
  font-size: 14px;
  line-height: 1.45;
  color: var(--colour-text-muted);
}

.cs-guide__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 24px;
}

/* .submit is written for a form (width 50%, block, centred); here it is a
   link in a row, 48px tall, as the sign-up panel's Sign Up! is. */
.submit.cs-btn {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: auto;
  min-height: 48px;
  margin: 0;
  padding-block: 0;
  text-decoration: none;
}

.cs-newsets__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 12px;
  padding: 0 4px;
  font-family: var(--font-paragraph);
  font-size: 14px;
  line-height: 1.4;
  color: var(--colour-text-muted);
}

@media (max-width: 599px) {
  .cs-guide {
    padding: 20px;
  }

  .cs-guide__steps {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }
}

/* ── Signed out, private, not found (6.7) ── */
.cs-signup {
  max-width: 480px;
  margin: 0 0 48px;
}

.cs-private {
  max-width: 640px;
  margin: 0 0 48px;
  padding: 32px;
  border-radius: var(--radius-sm);
  background: var(--colour-paper);
  box-shadow: var(--shadow-resting);
}

.cs-private__icon {
  display: block;
  margin-bottom: 16px;
  color: var(--colour-text-muted);
}

.cs-private h2 {
  font-size: var(--text-md);
  line-height: 1.2;
}

.cs-private > p {
  margin-top: 8px;
  font-size: 16px;
  line-height: 1.55;
  color: var(--colour-text);
}

.cs-private__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 24px;
  margin-top: 24px;
}

@media (max-width: 599px) {
  .cs-private {
    padding: 20px;
  }
}

/* ── The toast (collection-stats.js creates it on <body>) ── */
/* Inverse colours: #FAFAFA on #121212 in light theme and the reverse in
   dark, 18:1. */
.cs-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: calc(var(--z-modal, 1000) + 10);
  box-sizing: border-box;
  width: max-content;
  max-width: calc(100vw - 32px);
  padding: 12px 18px;
  border-radius: var(--radius-xs);
  background: #121212;
  box-shadow: var(--shadow-floating);
  font-family: var(--font-header);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  color: #FAFAFA;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 16px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

[data-theme="dark"] .cs-toast {
  background: #FAFAFA;
  color: #121212;
}

.cs-toast.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, 0);
}

/* The link to copy by hand when the clipboard is not available. */
.cs-toast__input {
  display: block;
  box-sizing: border-box;
  width: min(420px, calc(100vw - 68px));
  margin-top: 8px;
  padding: 6px 8px;
  border: 1px solid currentColor;
  border-radius: 6px;
  background: transparent;
  font-family: var(--font-paragraph);
  font-size: 14px;
  color: inherit;
}

/* ── The share sheet (Phase 4; share-sheet.php, a <dialog> after </main>) ──
   Outside .cs-page, so it sets the hairline and hover tints itself. The
   options are the goal switch's look (set-detail.css): the text colour on
   the hairline track, the primary fill with #FAFAFA text when chosen (7.8:1).
   The page behind does not scroll while it is open (html.cs-sheet-open). */
html.cs-sheet-open {
  overflow: hidden;
}

.cs-sheet {
  --sh-hairline: color-mix(in srgb, var(--colour-text) 8%, transparent);
  --sh-hover: color-mix(in srgb, var(--colour-text) 12%, transparent);
  box-sizing: border-box;
  width: min(880px, calc(100vw - 32px));
  max-width: none;
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--colour-paper);
  box-shadow: var(--shadow-floating);
  color: var(--colour-text);
  font-family: var(--font-paragraph);
  /* The page's weight (.cs-page sets it); the body's would make the Hind
     notes bold. */
  font-weight: var(--font-weight-sm);
  overflow: auto;
  overscroll-behavior: contain;
}

.cs-sheet::backdrop {
  background: rgba(0, 0, 0, 0.55);
}

.cs-sheet__inner {
  padding: 24px;
}

.cs-sheet__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.cs-sheet__title {
  margin: 0;
  font-family: var(--font-header);
  font-size: 22px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--colour-text);
}

.cs-sheet__close {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--colour-text);
  cursor: pointer;
}

.cs-sheet__close:hover {
  background: var(--sh-hover);
}

.cs-sheet__close:focus-visible,
.cs-sheet__download:focus-visible,
.cs-sheet__copy:focus-visible {
  outline: 3px solid var(--colour-focus-ring);
  outline-offset: 2px;
}

.cs-sheet__body {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, 1fr);
  gap: 24px;
  align-items: start;
}

.cs-sheet__preview {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 240px;
  margin: 0;
  padding: 12px;
  border-radius: var(--radius-xs);
  background: var(--sh-hairline);
}

.cs-sheet__img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: min(460px, 60dvh);
  border-radius: 10px;
  transition: opacity 0.2s ease;
}

.cs-sheet.is-loading .cs-sheet__img {
  opacity: 0.5;
}

/* The skeleton (SPEC 19): where something arrives after the page, the box
   it will fill shimmers in the holo gradient at 40%, 1.6 s, and stands still
   under reduced motion (style.css's global rule). The stats page itself
   arrives whole from the server, so this is for the share preview while a
   card draws and for All Activity's Load More while a page is fetched. */
.cs-skeleton,
.cs-sheet.is-loading .cs-sheet__preview,
.cs-log__more.is-loading {
  background-image: var(--holo-gradient);
  background-size: 400% 400%;
  animation: ttcg-stats-shimmer 1.6s ease-in-out infinite;
}

.cs-sheet.is-loading .cs-sheet__preview {
  background-color: var(--sh-hairline);
}

@keyframes ttcg-stats-shimmer {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.cs-sheet__controls {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

.cs-sheet__group {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.cs-sheet__legend {
  display: block;
  margin: 0 0 8px;
  padding: 0;
}

.cs-sheet__options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border-radius: 14px;
  background: var(--sh-hairline);
}

.cs-sheet__option {
  position: relative;
  display: flex;
  min-width: 0;
}

/* The radio covers its segment, invisible: the label and the keyboard
   reach it as usual, and the segment shows its state. */
.cs-sheet__option input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.cs-sheet__seg {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 6px 8px;
  border-radius: 10px;
  font-family: var(--font-header);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
  color: var(--colour-text);
  transition: background-color 0.2s ease, color 0.2s ease;
}

.cs-sheet__seg small {
  font-family: var(--font-paragraph);
  font-size: 12px;
  font-weight: var(--font-weight-sm);
  line-height: 1.3;
  color: inherit;
}

.cs-sheet__option:hover input:not(:checked):not(:disabled) + .cs-sheet__seg {
  background: var(--sh-hover);
}

.cs-sheet__option input:checked + .cs-sheet__seg {
  background: var(--colour-primary);
  color: #FAFAFA;
}

.cs-sheet__option input:focus-visible + .cs-sheet__seg {
  outline: 3px solid var(--colour-focus-ring);
  outline-offset: 2px;
}

.cs-sheet__option input:disabled {
  cursor: not-allowed;
}

.cs-sheet__option input:disabled + .cs-sheet__seg {
  opacity: 0.5;
}

.cs-sheet__hint,
.cs-sheet__note,
.cs-sheet__status {
  margin: 8px 0 0;
  font-family: var(--font-paragraph);
  font-size: 13px;
  line-height: 1.45;
  color: var(--colour-text-muted);
}

.cs-sheet__note,
.cs-sheet__status {
  margin: 0;
}

.cs-sheet__status:empty {
  display: none;
}

.cs-sheet__value {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.cs-sheet__value[hidden] {
  display: none;
}

.cs-sheet__value-label {
  font-family: var(--font-header);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--colour-text);
}

.cs-sheet__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
}

/* .submit (style.css) is a centred block at half width; here it sits in
   the row at its own width. */
.cs-sheet__download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: auto;
  min-height: 44px;
  margin: 0;
  padding: 0 24px;
  text-decoration: none;
}

.cs-sheet__download:hover,
.cs-sheet__download:visited {
  color: #FAFAFA;
  text-decoration: none;
}

.cs-sheet__manual {
  box-sizing: border-box;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--colour-border);
  border-radius: 6px;
  background: transparent;
  font-family: var(--font-paragraph);
  font-size: 14px;
  color: var(--colour-text);
}

.cs-sheet__manual[hidden] {
  display: none;
}

@media (max-width: 1023px) {
  .cs-sheet__close,
  .cs-sheet__seg {
    min-height: 44px;
  }

  .cs-sheet__close {
    width: 44px;
    height: 44px;
  }

  .cs-sheet__copy {
    min-height: 44px;
  }
}

@media (max-width: 759px) {
  .cs-sheet__body {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
  }

  .cs-sheet__preview {
    min-height: 0;
  }

  .cs-sheet__img {
    max-height: 36dvh;
  }
}

/* Phones: a sheet from the bottom edge. */
@media (max-width: 599px) {
  .cs-sheet {
    width: 100%;
    max-height: calc(100dvh - 24px);
    margin: auto 0 0;
    border-radius: 16px 16px 0 0;
  }

  .cs-sheet__inner {
    padding: 20px 20px calc(20px + env(safe-area-inset-bottom, 0px));
  }

  .cs-sheet__title {
    font-size: 20px;
  }
}

/* ── Under 1024px: the heading stacks, every target is 44px ── */
@media (max-width: 1023px) {
  header.ttcg-page-head.cs-head {
    flex-direction: column;
    align-items: stretch;
    gap: 20px;
  }

  .cs-controls {
    justify-content: flex-start;
  }

  .cs-public {
    justify-content: flex-start;
  }

  .cs-public__note {
    text-align: left;
  }

  /* The switch's hit area: 52 x 44 around the 44 x 24 track. */
  .cs-switch::before {
    content: "";
    position: absolute;
    inset: -10px -4px;
  }

  .cs-share {
    min-height: 44px;
  }

  .cs-page .ttcg-textlink {
    min-height: 44px;
  }

  .cs-page .cs-opener__text .ttcg-textlink {
    min-height: 0;
  }

  .cs-figures {
    margin-bottom: 40px;
  }

  .cs-page > .milestone-strip {
    margin-top: -16px;
  }
}

/* ── Under 600px: the phone layout ── */
@media (max-width: 599px) {
  .cs-controls {
    justify-content: space-between;
    gap: 16px;
  }

  /* "Goal" above a full-width control, one column per tier, 44px tall
     (set-detail.css's under-1024px rule gives the columns and the height). */
  .cs-goal {
    flex: 1 1 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .cs-opener__text {
    font-size: 19px;
  }

  /* The figures in pairs: Value (or Collecting Since) and Left to Complete
     full width, Cards and Sets Started side by side at 25px. */
  .cs-figures > .cs-figure {
    padding: 18px 20px;
  }

  .cs-figures > .cs-figure--value,
  .cs-figures > .cs-figure--since,
  .cs-figures > .cs-figure--left {
    grid-column: 1 / -1;
  }
}

/* ========================================
   ALL ACTIVITY (the stats redesign, Phase 6, 2026-10-30)
   templates/shared/tcg/collection-activity.php: <main class="cs-page
   cs-log-page">, so the page's tokens, defaults and the activity rows above
   apply. The toolbar is the shared one (set-detail.css, server mode); the
   log is one card like Recent Activity, its days as h2s with a tally (the
   changes, then the copies added and removed in the rows' chips), Load More
   or the window's end line under the last day. Colours are the page's
   tokens: muted text #595959 on paper (7.0:1) and #B0B0B0 on the dark
   paper; the end line's Premium link is --colour-premium-text (Important
   Note 39: it is a Premium link).
   ======================================== */
.cs-log-page > header.ttcg-page-head.cs-head {
  margin-bottom: 24px;
}

.cs-log__export {
  text-decoration: none;
}

.cs-log__toolbar .set-toolbar {
  margin-bottom: 16px;
}

.cs-log__summary,
.cs-log__newest {
  margin: 0 0 16px;
  font-family: var(--font-paragraph);
  font-size: 14px;
  line-height: 1.45;
  color: var(--colour-text-muted);
}

.cs-log__summary > span:first-child {
  font-weight: 600;
  color: var(--colour-text);
}

.cs-log {
  padding: 8px 28px 28px;
  border-radius: var(--radius-sm);
  background: var(--colour-paper);
  box-shadow: var(--shadow-resting);
}

.cs-log__day + .cs-log__day {
  margin-top: 8px;
}

.cs-log__dayhead {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 16px;
  margin: 20px 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--sh-hairline);
}

.cs-page .cs-log__daytitle {
  font-size: var(--text-xs);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--colour-text-muted);
}

.cs-log__continued {
  margin-left: 4px;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
}

.cs-log__tally {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  font-family: var(--font-paragraph);
  font-size: 13px;
  line-height: 1.3;
  color: var(--colour-text-muted);
}

.cs-log__tally .cs-delta-chip {
  font-size: 12px;
}

.cs-activity__time {
  white-space: nowrap;
}

.cs-log__foot {
  display: flex;
  justify-content: center;
  margin-top: 28px;
}

.cs-log__more {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 24px;
  border: 1px solid var(--colour-secondary);
  border-radius: var(--radius-xs);
  font-family: var(--font-header);
  font-size: 14px;
  font-weight: 600;
  color: var(--colour-secondary-text);
  text-decoration: none;
  transition: background-color 0.2s ease;
}

.cs-log__more:hover {
  background: color-mix(in srgb, var(--colour-secondary) 10%, transparent);
}

.cs-log__more.is-loading {
  cursor: progress;
  color: var(--colour-text-muted);
}

.cs-log__end {
  font-family: var(--font-paragraph);
  font-size: 14px;
  line-height: 1.45;
  text-align: center;
  color: var(--colour-text-muted);
}

.cs-log__premium {
  font-weight: 600;
  color: var(--colour-premium-text);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.cs-log__end .premium-pill {
  margin-left: 4px;
  vertical-align: 1px;
}

.cs-log__empty {
  padding: 32px 0 12px;
  text-align: center;
}

.cs-log__emptytext {
  font-family: var(--font-header);
  font-size: 16px;
  font-weight: 700;
}

.cs-log__emptysub {
  margin-top: 6px;
  font-size: 14px;
  color: var(--colour-text-muted);
}

.cs-log__empty .ttcg-textlink {
  display: inline-block;
  margin-top: 12px;
}

.cs-log--error {
  padding: 28px;
}

.cs-log--error h2 {
  font-size: var(--text-md);
}

.cs-log--error p {
  margin-top: 8px;
  color: var(--colour-text-muted);
}

@media (max-width: 1023px) {
  .cs-log__more {
    width: 100%;
  }

  /* 44px under 1024, as every other link on the page. */
  .cs-log__premium {
    display: inline-block;
    padding: 12px 0;
  }
}

@media (max-width: 599px) {
  .cs-log {
    padding: 4px 20px 20px;
  }

  .cs-log__dayhead {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ========================================
   VALUE HISTORY (the stats redesign, Phase 7, 2026-10-31; SPEC section 19)
   templates/shared/tcg/collection-value.php: <main class="cs-page
   cs-vh-page">, so the page's tokens, the figures and the deltas above
   apply. The range switch is a row of links (7D, 30D, 90D, All) in the
   goal switch's look: the active one the primary fill with #FAFAFA text
   (7.82:1), a disabled one (an owner without Premium) muted and not a link.
   The chart, By Set and Biggest Movers are paper cards. Under the lock the
   made-up content is blurred 6px at 60% opacity with no pointer events
   (the set header's locked-cell pattern), the lock panel over it.
   ======================================== */
.cs-vh-page > header.ttcg-page-head.cs-head {
  margin-bottom: 24px;
}

.cs-vh-ranges {
  display: inline-flex;
  flex-wrap: nowrap;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--colour-border);
  border-radius: 12px;
}

.cs-vh-range {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 8px;
  font-family: var(--font-header);
  font-size: 14px;
  font-weight: 700;
  color: var(--colour-text);
  text-decoration: none;
}

a.cs-vh-range:hover {
  background: color-mix(in srgb, var(--colour-text) 8%, transparent);
}

.cs-vh-range.is-active {
  background: var(--colour-primary);
  color: #FAFAFA;
}

a.cs-vh-range.is-active:hover {
  background: var(--colour-primary);
}

.cs-vh-range[aria-disabled="true"] {
  color: var(--colour-text-muted);
  cursor: not-allowed;
}

.cs-vh-figures {
  margin-bottom: 32px;
}

.cs-vh-card {
  margin: 0 0 32px;
  padding: 24px 28px 28px;
  border-radius: var(--radius-sm);
  background: var(--colour-paper);
  box-shadow: var(--shadow-resting);
}

.cs-vh-card h2 {
  margin: 0;
  font-family: var(--font-header);
  font-size: var(--text-md, 25px);
  font-weight: 700;
  line-height: 1.2;
  color: var(--colour-text);
}

.cs-vh-card__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 16px;
  margin-bottom: 16px;
}

.cs-vh-card__sub,
.cs-vh-chart__split,
.cs-vh-note,
.cs-vh-attrib,
.cs-vh-chart__empty,
.cs-vh-message p {
  margin: 0;
  font-family: var(--font-paragraph);
  font-size: 14px;
  line-height: 1.45;
  color: var(--colour-text-muted);
}

.cs-vh-note,
.cs-vh-attrib {
  margin-top: 12px;
}

.cs-vh-attrib a,
.cs-vh-message a {
  color: var(--colour-secondary-text);
}

.cs-vh-chart__plot {
  position: relative;
  height: 280px;
}

.cs-vh-chart__fallback {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: var(--colour-trend-positive);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

.cs-vh-chart__empty {
  padding: 48px 0;
  text-align: center;
}

.cs-vh-message h2 {
  margin-bottom: 8px;
}

.cs-vh-message a {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
}

.cs-vh-panels {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: 0 32px;
}

.cs-vh-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-paragraph);
  font-size: 14px;
}

.cs-vh-table th,
.cs-vh-table td {
  padding: 10px 0;
  border-bottom: 1px solid var(--sh-hairline);
  text-align: right;
  font-weight: 400;
  color: var(--colour-text);
}

.cs-vh-table thead th {
  padding-top: 0;
  font-family: var(--font-header);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--colour-text-muted);
}

.cs-vh-table th:first-child {
  text-align: left;
}

.cs-vh-table td + td,
.cs-vh-table th + th {
  padding-left: 16px;
  white-space: nowrap;
}

.cs-vh-table td.cs-delta {
  font-weight: 600;
}

.cs-vh-table a,
.cs-vh-mover__name a {
  color: var(--colour-text);
  font-weight: 600;
  text-decoration: none;
}

.cs-vh-table a:hover,
.cs-vh-mover__name a:hover {
  text-decoration: underline;
}

.cs-vh-code {
  margin-left: 4px;
  font-size: 12px;
  color: var(--colour-text-muted);
}

.cs-vh-movers__side {
  margin: 8px 0 4px;
  font-family: var(--font-header);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--colour-text-muted);
}

.cs-vh-movers__list {
  margin: 0 0 8px;
  padding: 0;
  list-style: none;
}

.cs-vh-mover {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--sh-hairline);
  font-family: var(--font-paragraph);
  font-size: 14px;
}

.cs-vh-mover__name {
  overflow-wrap: anywhere;
}

.cs-vh-mover__meta {
  grid-column: 1;
  font-size: 12px;
  color: var(--colour-text-muted);
}

.cs-vh-mover__change {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  white-space: nowrap;
}

.cs-vh-locked {
  position: relative;
}

.cs-vh-locked__inner {
  filter: blur(6px);
  opacity: 0.6;
  pointer-events: none;
  user-select: none;
}

.cs-vh-lock {
  position: absolute;
  top: 24px;
  left: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: min(480px, calc(100% - 32px));
  padding: 28px;
  border-radius: var(--radius-sm);
  background: var(--colour-paper);
  box-shadow: var(--shadow-raised, var(--shadow-resting));
  text-align: center;
  transform: translateX(-50%);
}

.cs-vh-lock h2 {
  margin: 0;
  font-family: var(--font-header);
  font-size: var(--text-md, 25px);
  font-weight: 700;
  color: var(--colour-text);
}

.cs-vh-lock p {
  margin: 0;
  font-family: var(--font-paragraph);
  font-size: 15px;
  line-height: 1.5;
  color: var(--colour-text-muted);
}

/* The navbar's Premium button, at body size: in the panel it is one of two links. */
.cs-vh-lock__button {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: 18px;
}

.cs-vh-lock .ttcg-textlink {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
}

@media (min-width: 1024px) {
  .cs-vh-panels {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}

@media (max-width: 599px) {
  .cs-vh-card {
    padding: 20px 16px 24px;
  }

  .cs-vh-chart__plot {
    height: 220px;
  }

  .cs-vh-ranges {
    width: 100%;
  }

  .cs-vh-range {
    flex: 1 1 0;
    min-width: 0;
  }
}

/* The stats page's Collection Value figure: Premium's 44px sparkline (a gap
   where a day is not drawn), the range links and "Value History »"; Free's
   "See Value Over Time" with the Premium pill (its text the Premium text
   token: a Premium link, Important Note 39). */
.cs-figure__spark svg {
  display: block;
  width: 100%;
  height: 44px;
  fill: none;
  stroke: var(--colour-trend-positive);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

.cs-figure__history {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  font-family: var(--font-paragraph);
  font-size: 14px;
}

.cs-figure__ranges {
  display: inline-flex;
  gap: 2px;
}

.cs-figure__ranges a,
.cs-figure__history > .ttcg-textlink {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.cs-figure__ranges a {
  min-width: 36px;
  justify-content: center;
  border-radius: 6px;
  font-family: var(--font-header);
  font-size: 12px;
  font-weight: 700;
  color: var(--colour-text-muted);
  text-decoration: none;
}

.cs-figure__ranges a:hover {
  color: var(--colour-text);
  background: color-mix(in srgb, var(--colour-text) 8%, transparent);
}

.cs-figure__premium {
  gap: 6px;
  color: var(--colour-premium-text);
}

/* ========================================
   PIN A SET (the stats redesign Phase 9, item 1, 2026-10-31; SPEC 18 and 20)
   collection-stats/closest.php and panel.php. The pin glyph is the text
   colour, never gold (Important Note 39: gold is Premium); the Wishlist
   heart in a pinned set's missing list is --colour-chart-5 (SPEC 20).
   ======================================== */
.cs-set__pin {
  display: inline-flex;
  align-items: center;
  margin-right: 6px;
  color: var(--colour-text);
}

.cs-set__pinned {
  margin: 6px 0 0;
  font-family: var(--font-paragraph);
  font-size: 13px;
  line-height: 1.4;
  color: var(--colour-text-muted);
  text-align: center;
}

.cs-setrow__pin {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--colour-text);
}

.cs-pin-notices {
  margin: 0 0 16px;
}

.cs-pin-notice {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  margin: 0 0 8px;
  padding: 10px 16px;
  border: 1px solid var(--colour-border);
  border-radius: var(--radius-sm);
  background: var(--colour-paper);
  font-family: var(--font-paragraph);
  font-size: 14px;
  line-height: 1.45;
  color: var(--colour-text);
}

.cs-pin-notice__icon {
  flex: none;
  color: var(--colour-text);
}

.cs-panel__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 20px;
}

/* A button that reads as the site's text links (.ttcg-textlink). */
button.cs-pin-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

button.cs-pin-btn[aria-busy="true"] {
  opacity: 0.6;
  cursor: progress;
}

.cs-wish {
  flex: none;
  margin-right: 4px;
  vertical-align: -2px;
  color: var(--colour-chart-5);
}

/* ── Stats per Collection (Phase 9; SPEC sections 18 and 20) ──
   The heading's switcher (a GET form: a select and its Show button, both
   with the Share button's secondary-blue border, 3.85:1 on white and 3.33
   on the dark page), the static "Goal · Collection" label in a collection's
   view, the collection's name over the figures, and Cards Left: the missing
   cards on one paper card, in the panels' card markup. Without Premium the
   lock is Value History's (.cs-vh-locked, .cs-vh-lock). */
.cs-switcher {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin: 0;
}

.cs-switcher__select,
.cs-switcher__go {
  min-height: 40px;
  border: 1px solid var(--colour-secondary);
  border-radius: var(--radius-xs);
  font-family: var(--font-header);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
}

.cs-switcher__select {
  max-width: 260px;
  padding: 0 12px;
  background-color: var(--colour-paper);
  color: var(--colour-text);
  cursor: pointer;
}

.cs-switcher__go {
  padding: 0 16px;
  background: transparent;
  color: var(--colour-secondary-text);
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.cs-switcher__go:hover {
  background: color-mix(in srgb, var(--colour-secondary) 10%, transparent);
}

.cs-switcher__select:focus-visible {
  outline: 3px solid var(--colour-focus-ring);
  outline-offset: 2px;
}

.cs-goal--static .cs-goal__static {
  font-family: var(--font-header);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--colour-text);
}

.cs-collection-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 24px;
  margin: 0 0 20px;
}

.cs-collection-head__name {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
  margin: 0;
  font-size: inherit;
  font-weight: inherit;
}

/* From 600px the switcher stays on one line beside the goal label. */
@media (min-width: 600px) {
  .cs-switcher {
    flex-wrap: nowrap;
    flex: 0 0 auto;
  }
}

.cs-collection-head__title {
  font-family: var(--font-header);
  font-size: var(--text-md, 25px);
  font-weight: 700;
  line-height: 1.2;
  color: var(--colour-text);
  overflow-wrap: anywhere;
}

.cs-cardsleft__card {
  padding: 28px 32px;
  border-radius: var(--radius-sm);
  background: var(--colour-paper);
  box-shadow: var(--shadow-resting);
}

.cs-cardsleft__empty {
  margin: 0;
  font-family: var(--font-paragraph);
  font-size: 16px;
  line-height: 1.5;
  color: var(--colour-text);
}

.cs-cardsleft__note {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--sh-hairline);
}

/* The lock panel sits over the made-up content: keep room for it. */
.cs-collection-locked {
  min-height: 420px;
}

@media (max-width: 1023px) {
  /* 16px, as style.css's form rule: iOS Safari zooms a smaller field on focus. */
  .cs-switcher__select,
  .cs-switcher__go {
    min-height: 44px;
    font-size: 16px;
  }

  .cs-cardsleft__card {
    padding: 20px;
  }
}

@media (max-width: 599px) {
  .cs-switcher {
    flex: 1 1 100%;
  }

  .cs-switcher__label {
    flex-basis: 100%;
  }

  .cs-switcher__select {
    flex: 1 1 auto;
    min-width: 0;
    max-width: none;
  }

  .cs-collection-head__title {
    font-size: 20px;
  }

  /* A collection's figures have no Sets Started beside Cards: it takes the row. */
  .cs-figures > .cs-figure--cards:not(:has(+ .cs-figure--sets)) {
    grid-column: 1 / -1;
  }
}

/* ── TRADE LIST (Phase 9, SPEC 18) ──
   The For Trade section: the owner's switch row (the Public Stats switch's
   look), its note, the spare copies in the panels' card markup, the rest
   behind a native disclosure, and a visitor's "Message {Name}" Soon pill. */
.cs-trade__switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.cs-trade__label {
  font-family: var(--font-header);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--colour-text);
}

.cs-trade__note {
  margin: 8px 0 0;
}

.cs-trade__switch + .cs-trade__note + .cs-missing,
.cs-trade__note + .cs-cardsleft__empty {
  margin-top: 24px;
}

.cs-trade__message {
  margin: 0;
}

.cs-trade__more {
  margin-top: 20px;
}

.cs-trade__more > summary {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.cs-trade__more[open] > summary {
  margin-bottom: 20px;
}

@media (max-width: 1023px) {
  .cs-trade__more > summary {
    min-height: 44px;
  }
}


/* ── COMPARE WITH A FRIEND (Phase 9, SPEC 18 and 19) ──
   The Compare link beside Share (the Share button's look), and the compare
   page: the figure pairs as a table, Shared Sets with two bars each (teal
   chart-2 the viewer, violet chart-4 the owner, on the neutral track), the
   trade lists in the panels' card markup. Data in the text colour. */
a.cs-compare-link {
  text-decoration: none;
}

a.cs-compare-link:hover {
  background: color-mix(in srgb, var(--colour-secondary) 10%, transparent);
}

.cs-compare > section + section {
  margin-top: 48px;
}

.cs-compare__table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-family: var(--font-paragraph);
  font-size: 16px;
  color: var(--colour-text);
}

.cs-compare__table th,
.cs-compare__table td {
  padding: 12px 8px;
  border-bottom: 1px solid var(--sh-hairline);
  text-align: left;
}

.cs-compare__table thead th {
  overflow-wrap: anywhere;
  font-family: var(--font-header);
  font-size: 14px;
  font-weight: 700;
  color: var(--colour-text);
}

.cs-compare__table tbody th {
  font-family: var(--font-header);
  font-weight: 600;
}

.cs-compare__table td {
  font-family: var(--font-header);
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.cs-compare__table tbody tr:last-child th,
.cs-compare__table tbody tr:last-child td {
  border-bottom: 0;
}

.cs-compare__key {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 8px;
  border-radius: 3px;
  vertical-align: -1px;
}

.cs-compare__key--mine,
.cs-compare__fill--mine {
  background: var(--colour-chart-2);
}

.cs-compare__key--theirs,
.cs-compare__fill--theirs {
  background: var(--colour-chart-4);
}

.cs-compare__sets {
  display: grid;
  gap: 24px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.cs-compare__setname {
  margin: 0 0 8px;
  font-family: var(--font-header);
  font-size: 16px;
  font-weight: 600;
}

.cs-compare__code {
  font-size: 13px;
  font-weight: 600;
  color: var(--colour-text-muted);
}

.cs-compare__bars {
  display: grid;
  grid-template-columns: minmax(64px, max-content) 1fr max-content;
  align-items: center;
  gap: 6px 12px;
  font-family: var(--font-paragraph);
  font-size: 14px;
  color: var(--colour-text);
}

.cs-compare__who {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 160px;
}

.cs-compare__bar {
  position: relative;
  height: 8px;
  border-radius: 999px;
  background: var(--bar-track);
  overflow: hidden;
}

.cs-compare__fill {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 999px;
}

.cs-compare__count {
  font-variant-numeric: tabular-nums;
}

.cs-compare__h3 {
  margin: 0 0 16px;
  font-family: var(--font-header);
  font-size: 18px;
  font-weight: 700;
  color: var(--colour-text);
}

.cs-compare__h3 + .cs-cardsleft__empty {
  margin-bottom: 0;
}

.cs-compare__trades .cs-missing + .cs-compare__h3,
.cs-compare__trades .cs-cardsleft__empty + .cs-compare__h3 {
  margin-top: 32px;
}

.cs-compare__table thead th:first-child {
  width: 40%;
}

@media (max-width: 599px) {
  .cs-compare__table th,
  .cs-compare__table td {
    padding: 10px 4px;
  }

  .cs-compare__table td {
    font-size: 14px;
  }

  .cs-compare__table thead th:first-child {
    width: 36%;
  }

  .cs-compare__table tbody th {
    font-size: 13px;
  }

  .cs-compare__who {
    max-width: 96px;
  }
}

/* A page's own share card (Compare, Year in Review): the Post card as a
   preview and three download links. */
.cs-sharecard__preview {
  display: block;
  width: 100%;
  max-width: 600px;
  height: auto;
  border-radius: var(--radius-sm);
}

.cs-sharecard__links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 16px;
  margin: 16px 0 0;
  font-family: var(--font-paragraph);
  font-size: 15px;
  color: var(--colour-text);
}

/* ── YEAR IN REVIEW (Phase 9, SPEC 18) ──
   The stats page's banner in the window, and the year's page: the figures
   (the page's own), copies by month as one bar per month in the chart-1
   blue on the neutral track, the Bests, the share card. */
.cs-year-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 16px;
  margin: 0 0 24px;
  padding: 16px 24px;
  border-radius: var(--radius-sm);
  background: var(--colour-paper);
  box-shadow: var(--shadow-resting);
  font-family: var(--font-paragraph);
  font-size: 16px;
  color: var(--colour-text);
}

.cs-year > section {
  margin-top: 48px;
}

.cs-year .cs-vh-locked {
  margin-top: 48px;
}

.cs-year__bars {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.cs-year__bars > li {
  display: grid;
  grid-template-columns: 40px 1fr 56px;
  align-items: center;
  gap: 12px;
  font-family: var(--font-paragraph);
  font-size: 15px;
  color: var(--colour-text);
}

.cs-year__bar {
  position: relative;
  height: 10px;
  border-radius: 999px;
  background: var(--bar-track);
  overflow: hidden;
}

.cs-year__fill {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 999px;
  background: var(--colour-chart-1);
}

.cs-year__count {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.cs-year__bestlist {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 24px 32px;
  margin: 0;
}

.cs-year__bestlist dd {
  margin: 0;
}

.cs-year__bestlist .cs-year__bestvalue {
  margin-top: 6px;
  font-family: var(--font-header);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--colour-text);
  overflow-wrap: anywhere;
}

.cs-year__message {
  margin-top: 8px;
}

@media (max-width: 1023px) {
  .cs-year-banner .ttcg-textlink,
  .cs-sharecard__links .ttcg-textlink {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
  }
}

/* Trade List by picks (1 Nov 2026): the owner's Add All Duplicates and each
   card's Remove (the pin buttons' text-link look). */
.cs-trade__actions {
  margin: 16px 0 0;
}

.cs-trade__remove {
  margin-top: 4px;
}

