/* /<game> Values (pages/values.js, markup pages/values-markup.js): the header, one toolbar row, an aligned table
   (spec/nav/UX.md "Values"). Prefix vl-. Colours: tokens only; the tier colours come from pop.css ([data-tier]). */

/* ================================================================ header: H1 + one muted line left, the kind and the sort right */
/* quick taps on the pills and column names are taps, never a zoom */
.vl :is(.vl-chip, .vl-colsort, .vl-tiers__arrow) { touch-action: manipulation; }
.vl-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "title check" "sub check"; align-items: center; column-gap: 24px; margin-bottom: 20px; }
.vl-title { grid-area: title; margin: 0 0 4px; overflow-wrap: break-word; }
/* overflow: cuts a line's leading "·" (below); the 3px padding keeps a link's focus ring inside the cut */
.vl-sub { grid-area: sub; margin: -3px; padding: 3px; color: var(--color-wolf); font: 400 17px/24px var(--font); overflow: hidden; }
.vl-sub__bit { white-space: nowrap; }   /* a line breaks before a "·", never after it */
/* each line starts with a "· " (values-markup.js headHTML): drawn the width of "· " (0.525em in values Sans) left of
   the edge, where .vl-sub cuts it off, so every line starts on the H1's left edge with its words */
.vl-sub__in { display: block; margin-left: -.525em; }
/* the links read as one string with the line (UX.md rule 16): the chevron's own side space trimmed, so the gap after
   "Just traded ›" before the next "·" is one plain space, like every other gap on the line */
.vl-jt { color: var(--color-link); font-weight: 700; text-decoration: none; border-radius: 4px; }
.vl-jt > svg { vertical-align: -2px; margin: 0 -4px 0 0; }   /* a hair after the word, none before the next " · " */
@media (hover: hover) { .vl-jt:hover { text-decoration: underline; } }
.vl-jt:focus-visible { outline: 2px solid var(--color-macaw); outline-offset: 1px; }
.vl-ctrls { grid-area: check; display: flex; align-items: center; gap: 12px; }
/* the values didn't come (the API is down): the line keeps its links, with no count and no "updated" (the next bit's
   "· " is then the line's first, cut off like the count's) */
.vl-sub.is-off .vl-sub__in > [aria-hidden], .vl-sub.is-off [data-count], .vl-sub.is-off .vl-sub__upd { display: none; }

/* ================================================================ the toolbar + the column names: sticky under the top bar */
/* the side shadows cover a hovered row's background where it reaches past the table (.vl-rows > li) */
.vl-bar { position: sticky; top: var(--f-top-h); z-index: 3; background: var(--color-snow); box-shadow: -12px 0 0 var(--color-snow), 12px 0 0 var(--color-snow); }
.vl-tools { display: flex; align-items: center; gap: 12px; padding: 4px 0 12px; }

/* tier pills: a dot in the tier's colour, the picked one in their selected blue with an × (it takes the tier off); the
   strip scrolls when it is too long, with an arrow at an end where more wait (a mouse can't swipe) */
.vl-tiersbox { position: relative; flex: 1 1 auto; min-width: 0; }
.vl-tiers { overflow-x: auto; scrollbar-width: none; margin: -4px 0; padding: 4px 0; }
.vl-tiers::-webkit-scrollbar { display: none; }
/* The fades follow the strip's own scroll (a scroll-driven animation of the two fade widths), so the server's page has
   them from its first paint, already scrolled to the picked pill by index.html: nothing changes when the app takes over.
   A strip that fits has no scroll timeline, so no fade. Browsers without scroll-driven animations: values.js fades()
   sets has-left / has-right */
@property --vl-fl { syntax: "<length>"; inherits: false; initial-value: 0px; }
@property --vl-fr { syntax: "<length>"; inherits: false; initial-value: 0px; }
@supports (animation-timeline: scroll()) {
  .vl-tiers {
    -webkit-mask-image: linear-gradient(to right, transparent, #000 var(--vl-fl), #000 calc(100% - var(--vl-fr)), transparent);
    mask-image: linear-gradient(to right, transparent, #000 var(--vl-fl), #000 calc(100% - var(--vl-fr)), transparent);
    animation: vl-fl linear both, vl-fr linear both; animation-timeline: scroll(self inline), scroll(self inline);
    animation-range: 0 32px, calc(100% - 32px) 100%;
  }
}
@keyframes vl-fl { from { --vl-fl: 0px; } to { --vl-fl: 32px; } }
@keyframes vl-fr { from { --vl-fr: 32px; } to { --vl-fr: 0px; } }
@supports not (animation-timeline: scroll()) {
  .vl-tiers.has-right { -webkit-mask-image: linear-gradient(to left, transparent, #000 32px); mask-image: linear-gradient(to left, transparent, #000 32px); }
  .vl-tiers.has-left { -webkit-mask-image: linear-gradient(to right, transparent, #000 32px); mask-image: linear-gradient(to right, transparent, #000 32px); }
  .vl-tiers.has-left.has-right {
    -webkit-mask-image: linear-gradient(to right, transparent, #000 32px, #000 calc(100% - 32px), transparent);
    mask-image: linear-gradient(to right, transparent, #000 32px, #000 calc(100% - 32px), transparent);
  }
}
.vl-tiers__in { display: flex; gap: 8px; width: max-content; }
.vl-chip {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px; border: 2px solid var(--color-swan); border-radius: 18px;
  background: var(--color-snow); color: var(--color-eel); font: 700 15px/18px var(--font); text-decoration: none; white-space: nowrap;
}
.vl-chip__dot { width: 10px; height: 10px; border-radius: 50%; background: var(--tier); flex-shrink: 0; }
@media (hover: hover) {
  .vl-chip:not(.is-on):hover { background: var(--color-polar); }
  .vl-chip.is-on:hover { border-color: var(--color-whale); }
}
.vl-chip.is-on { gap: 6px; padding-right: 10px; background: var(--color-iguana); border-color: var(--color-blue-jay); color: var(--color-whale); }
.vl-chip.is-on > .vl-chip__dot { margin-right: 2px; }
.vl-chip:focus-visible { outline: 2px solid var(--color-macaw); outline-offset: -2px; }
button.vl-chip { cursor: pointer; }
/* searching: the search's pill first; nothing found says it below, with its one button, so the pill goes */
.vl.is-empty .vl-chip--q { display: none; }
/* the order's pill: phones only (wider, the sort button says the order in words) */
.vl-chip--sort { display: none; }
.vl-tiers__arrow {
  position: absolute; top: 50%; z-index: 1; display: none; align-items: center; justify-content: center; width: 32px; height: 32px; margin-top: -16px; padding: 0;
  border: 2px solid var(--color-swan); border-radius: 50%; background: var(--color-snow); color: var(--color-wolf); cursor: pointer;
}
.vl-tiers__arrow--l { left: 0; }
.vl-tiers__arrow--r { right: 0; }
@media (hover: hover) {
  .vl-tiersbox:has(.vl-tiers.has-left) .vl-tiers__arrow--l, .vl-tiersbox:has(.vl-tiers.has-right) .vl-tiers__arrow--r { display: flex; }
  .vl-tiers__arrow:hover { background: var(--color-polar); color: var(--color-eel); }
}

/* the game's own ways (values-markup.js wayHTML: Adopt Me!'s Neon and Potion, Steal a Brainrot's Mutation …): menus at
   the toolbar's start, pill-shaped like the tier pills beside them, their word the value picked ("Mega Neon") or the
   plain one ("Normal"); picked, the pills' blue. A phone gives them a row of their own (below) */
.vl-ways { display: flex; gap: 8px; flex-shrink: 0; }
.vl-way { flex-shrink: 0; height: 36px; border-width: 2px; padding: 0 36px 0 14px; text-transform: none; letter-spacing: 0; color: var(--color-eel); font: 700 15px/18px var(--font); white-space: nowrap; }
.vl-way::before { border-radius: 18px; box-shadow: none; }
.vl-way .u-select__chev { right: 14px; }
.vl-way.is-on { color: var(--color-whale); }
.vl-way.is-on::before { background: var(--color-iguana); border-color: var(--color-blue-jay); }
.vl-way.is-on .u-select__chev { color: var(--color-whale); }
.vl-way.is-open { transform: none; isolation: isolate; color: var(--color-whale); } /* (its pill stays drawn: without the transform, isolation keeps ::before over the strip) */
.vl-way.is-open::before { background: var(--color-iguana); border-color: var(--color-blue-jay); }
@media (hover: hover) { .vl-way:not(.is-on):not(.is-open):hover::before { background: var(--color-polar); } }
.vl-way:focus-visible { outline: 2px solid var(--color-macaw); outline-offset: 2px; }

/* the kind: their small segmented control, in the pills' words (not capitals) */
.vl-types { flex-shrink: 0; }
.vl-types .u-seg__opt { min-width: 0; border-bottom-width: 2px; text-transform: none; letter-spacing: 0; font-size: 15px; }
.vl-types .u-seg__opt:active:not(.is-active) { margin-top: 0; height: 36px; }
.vl-types .u-seg__opt.is-active { color: var(--color-whale); }

/* the order: as wide as its widest choice ("Highest value"), so picking another never moves the kind beside it */
/* its frame (.u-select::before) is its border box: it ends on the page's right edge, like the values under it */
.vl-sort { flex-shrink: 0; min-width: 172px; height: 36px; border-width: 2px; padding-right: 38px; text-transform: none; letter-spacing: 0; color: var(--color-eel); }
.vl-sort::before { box-shadow: none; }
.vl-sort .u-select__chev { right: 14px; }
/* open: the picked pill's look (iguana, blue-jay edge, whale words), never the grey face of a button that is off */
.vl-sort.is-open { transform: none; color: var(--color-whale); }
.vl-sort.is-open::before { background: var(--color-iguana); border-color: var(--color-blue-jay); }
.vl-sort.is-open .u-select__chev { color: var(--color-whale); }
.vl-sort__ic, .vl-sort__word { display: none; }
/* the kind as a menu (a game of many kinds): the order's button, its word the kind picked ("All kinds", "Pets") */
.vl-kindsel { flex-shrink: 0; min-width: 172px; height: 36px; border-width: 2px; padding-right: 38px; text-transform: none; letter-spacing: 0; color: var(--color-eel); }
.vl-kindsel::before { box-shadow: none; }
.vl-kindsel .u-select__chev { right: 14px; }
.vl-kindsel.is-on { color: var(--color-whale); }
.vl-kindsel.is-on::before { background: var(--color-iguana); border-color: var(--color-blue-jay); }
.vl-kindsel.is-open { transform: none; color: var(--color-whale); }
.vl-kindsel.is-open::before { background: var(--color-iguana); border-color: var(--color-blue-jay); }
/* a way's menu can be long (Royale High's 38 sets, Steal a Brainrot's 16 mutations): it scrolls inside, never past the
   window */
.vl-waypop .u-list { max-height: 360px; overflow-y: auto; overscroll-behavior: contain; }
/* its menu (values.js: as wide as the button, its right edge on the button's): the chosen order shows by its check only */
.vl-sortpop .u-list__opt { padding: 12px 14px 12px 16px; }   /* the rest: ui.css .u-pop--plain */

/* the column names: small capitals in the label colour, on the table's grid, lined up with the header's left edge */
.vl-cols {
  display: grid; grid-template-columns: var(--vl-grid); align-items: center; column-gap: 16px; height: 36px;
  border-bottom: 2px solid var(--color-swan); color: var(--color-label); font: 700 13px/16px var(--font); letter-spacing: .06em; text-transform: uppercase;
}
.vl.is-empty .vl-cols { display: none; }
/* the names that sort: the same small capitals, darker under the pointer and on the order in use, with its arrow */
.vl-colsort {
  display: inline-flex; align-items: center; gap: 4px; min-width: 0; height: 100%; margin: 0; padding: 0; border: 0; background: none;
  color: inherit; font: inherit; letter-spacing: inherit; text-transform: inherit; cursor: pointer; white-space: nowrap;
}
.vl-colsort.vl-chg, .vl-colsort.vl-val { justify-content: flex-end; }
.vl-colsort.is-on { color: var(--color-eel); }
@media (hover: hover) { .vl-colsort:hover { color: var(--color-eel); } }
.vl-colsort__ic { flex-shrink: 0; }

/* ================================================================ the table */
/* # · item · kind · this week · demand · value */
.vl { --vl-grid: 40px minmax(0, 1fr) 144px 112px 140px 112px; }
/* a tier and a kind picked: every row's kind would read the same, so that column goes */
.vl.is-onekind { --vl-grid: 40px minmax(0, 1fr) 112px 140px 112px; }
.vl.is-onekind .vl-tier { display: none; }
/* a page that names the tier shows the kind alone ("Knife"), one that names the kind shows the tier ("Ancient") */
.vl.is-tier .vl-k-tier, .vl.is-type .vl-k-type { display: none; }
.vl.is-tier .vl-k-type { text-transform: capitalize; }
.vl-k-tiername, .vl.is-type .vl-k-kind { display: none; }
.vl.is-type .vl-k-tiername { display: inline; }
.vl .u-val { gap: 2px; }   /* the coin sits right on its number */
.vl-rows { margin: 0; padding: 0; list-style: none; }
/* Each row reaches 12px past the table on both sides, so its text lines up with the H1 while the hover background
   still has room around it; the hairline under it stays the table's width (drawn inset, not a border) */
.vl-rows > li {
  margin: 0 -12px; padding-bottom: 2px;
  background: linear-gradient(var(--color-swan), var(--color-swan)) 50% 100% / calc(100% - 24px) 2px no-repeat;
}
/* 892 rows: the ones off screen skip layout and paint, so adding more while scrolling stays cheap. The first screen's
   rows are always drawn: one drawn a frame late at its real height (a long name on two lines) pushed the rows under it
   down as the page showed. */
.vl-rows > li { content-visibility: auto; contain-intrinsic-block-size: auto 60px; }   /* the row's 60px: the 2px line under it comes on top */
.vl-rows > li:nth-child(-n + 20) { content-visibility: visible; }
.vl-row {
  display: grid; grid-template-columns: var(--vl-grid); align-items: center; column-gap: 16px; min-height: 60px; padding: 8px 12px;
  border-radius: 12px; color: var(--color-eel); text-decoration: none; font: 400 15px/22px var(--font);
}
@media (hover: hover) { a.vl-row:hover { background: var(--color-polar); } }
.vl-row:focus-visible { outline: 2px solid var(--color-macaw); outline-offset: -2px; }
.vl-skelpic { flex-shrink: 0; width: 40px; height: 40px; border-radius: 10px; }   /* the picture's place, its size (a phone's 48px below) */
.vl-rank { color: var(--color-label); font-weight: 700; font-variant-numeric: tabular-nums; }
.vl-item { display: flex; align-items: center; gap: 14px; min-width: 0; }
.vl-item > .u-pic { flex-shrink: 0; }
.vl-item__text { display: flex; flex-direction: column; min-width: 0; }
.vl-name { font: 700 17px/22px var(--font); overflow-wrap: break-word; }
.vl-kind { display: none; color: var(--color-label); font-size: 15px; line-height: 20px; }
.vl-tier, .vl-want { color: var(--color-wolf); }
.vl-chg, .vl-want, .vl-val { white-space: nowrap; }
.vl-chg, .vl-val { text-align: right; font-variant-numeric: tabular-nums; }
/* every cell's text sits on one 22px line box, centred in the row: the 17px name and value and the 15px cells share
   one baseline as they are (measured from the drawn digits; the 2px the 15px cells were moved down put them 1px under) */
.vl-row .vl-chg .u-chg { font-size: 15px; vertical-align: top; }
.vl-row .vl-chg .u-chg > span { line-height: 22px; }
.vl-row .vl-val .u-val { color: var(--color-eel); font-size: 17px; line-height: 22px; vertical-align: top; }
.vl-row .vl-val .u-val.is-none { color: var(--color-label); }
.vl-none-val { color: var(--color-hare); }
/* demand: the item page's meter, then the word; set off from the right-aligned change before it */
.vl-want { padding-left: 12px; }
.vl-row .vl-want { display: flex; align-items: center; gap: 8px; }
.vl-meter { position: relative; flex-shrink: 0; width: 48px; height: 8px; border-radius: 4px; background: var(--color-swan); overflow: hidden; }
.vl-meter > span { position: absolute; inset: 0 auto 0 0; border-radius: 4px; background: var(--color-macaw); }

/* nothing to show: one line, one button */
.vl-none { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 48px 16px; text-align: center; }
.vl-none p { margin: 0; color: var(--color-eel); font: 700 19px/26px var(--font); overflow-wrap: anywhere; }
.vl-none .u-btn { --h: 44px; }
.vl-end { height: 1px; }
/* past the first rows: "Show more" (quiet), so the footer stays in reach */
.vl-more { display: flex; justify-content: center; padding-top: 24px; }
.vl-more[hidden] { display: none; }
.vl-more .u-btn { --h: 44px; min-width: 240px; }

/* ================================================================ narrower */
@media (max-width: 1099px) {
  .vl { --vl-grid: 40px minmax(0, 1fr) 128px 96px 132px 104px; }
  .vl.is-onekind { --vl-grid: 40px minmax(0, 1fr) 96px 132px 104px; }
}
/* in another order than value (rise, drop, wanted, A–Z) there is no #: a place in that list read as the item's rank */
.vl.is-sorted .vl-rank { display: none; }
.vl.is-sorted { --vl-grid: minmax(0, 1fr) 144px 112px 140px 112px; }
.vl.is-sorted.is-onekind { --vl-grid: minmax(0, 1fr) 112px 140px 112px; }
@media (max-width: 1099px) {
  .vl.is-sorted { --vl-grid: minmax(0, 1fr) 128px 96px 132px 104px; }
  .vl.is-sorted.is-onekind { --vl-grid: minmax(0, 1fr) 96px 132px 104px; }
}
/* the kind and the order go under the line, across the page: the H1 and its line as on every page (4px apart), the two
   rows of filters together (12px apart), set off from the line above them */
@media (max-width: 899px) {
  .vl-head { grid-template-areas: "title" "sub" "check"; grid-template-columns: minmax(0, 1fr); margin-bottom: 8px; }
  .vl-ctrls { justify-content: space-between; margin-top: 16px; }
  /* a game of one kind has the order alone (values-markup.js controlsHTML): it stays beside the H1, not a row of its own */
  .vl-head:has(> .vl-ctrls--sort) { grid-template-areas: "title check" "sub sub"; grid-template-columns: minmax(0, 1fr) auto; column-gap: 16px; }
  .vl-ctrls--sort { margin-top: 0; }
}
/* the sticky toolbar only where the window is tall enough to keep the table in view */
@media (max-height: 700px), (max-width: 899px) {
  .vl-bar { position: static; }
}
@media (max-width: 899px) {
  .vl { --vl-grid: 32px minmax(0, 1fr) 128px 96px 104px; }
  .vl.is-onekind { --vl-grid: 32px minmax(0, 1fr) 96px 104px; }
  .vl.is-sorted { --vl-grid: minmax(0, 1fr) 128px 96px 104px; }
  .vl.is-sorted.is-onekind { --vl-grid: minmax(0, 1fr) 96px 104px; }
  .vl-want { display: none; }
  .vl-row .vl-want { display: none; }
}
/* phones (never smaller than a desktop, read close up and tapped with a thumb): no column names; each row its 48px
   picture, the name with its kind under it, the value on the right with the week's change under it only when it moved
   (a column of "0%" said nothing without its heading); the kind, the order and the tier pills 44px tall */
@media (max-width: 699px) {
  .vl-cols { display: none; }
  .vl-ctrls { gap: 8px; }
  .vl-tools { padding-bottom: 12px; border-bottom: 2px solid var(--color-swan); }
  .vl-rows > li { margin: 0 -8px; background-size: calc(100% - 16px) 2px; }
  .vl-row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "item val" "item chg"; column-gap: 12px; row-gap: 0; padding: 10px 8px; }
  .vl-row:has(> .vl-chg.is-flat) { grid-template-areas: "item val"; }
  .vl-row > .vl-chg.is-flat { display: none; }
  .vl-rank, .vl-tier { display: none; }
  .vl-item { grid-area: item; }
  .vl-item > .u-pic { --s: 48px !important; }   /* UI.pic writes its 40px on the element */
  .vl-skelpic { width: 48px; height: 48px; }
  .vl-kind { display: block; }
  .vl.is-onekind .vl-kind { display: none; }
  .vl-val { grid-area: val; align-self: end; }
  .vl-row:has(> .vl-chg.is-flat) > .vl-val { align-self: center; }
  .vl-chg { grid-area: chg; align-self: start; }
  /* the change's own line as tall as the kind's beside it (20px): the value then lines up with the name */
  .vl-row > .vl-chg { line-height: 20px; }
  .vl-row .vl-chg .u-chg > span { line-height: 20px; }
  .vl-rows > li { contain-intrinsic-block-size: auto 68px; }
  .vl-none { padding: 32px 16px; }
  .vl-more .u-btn { width: 100%; min-width: 0; }
  .vl-sub__upd { display: none; }
  .vl-jt { padding: 11px 0; }   /* a 44px tap round the words; inline, so the line doesn't grow */
  /* the kind: four equal parts, 44px tall; the order: its icon and the word "Sort" (the order itself shows as a pill
     with an × when it isn't Highest value, and its menu checks it) */
  .vl-types { flex: 1 1 auto; min-width: 0; }
  /* (a long kind, Blox Fruits' "Gamepasses", takes the room its word needs; the short ones share the rest) */
  .vl-types .u-seg__opt { flex: 1 1 0; height: 44px; min-width: min-content; padding: 0 8px; }
  .vl-types .u-seg__opt:active:not(.is-active) { height: 44px; }
  .vl-kindsel { flex: 1 1 auto; min-width: 0; height: 44px; justify-content: flex-start; padding-left: 16px; }
  .vl-sort { justify-content: center; gap: 6px; width: auto; min-width: 0; height: 44px; padding: 0 14px; }
  .vl-sort [data-label] { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .vl-sort .u-select__chev { display: none; }
  .vl-sort__ic { display: block; width: 18px; height: 18px; color: var(--color-wolf); }
  .vl-sort__word { display: inline; }
  .vl-chip--sort { display: inline-flex; }
  /* the tier pills: 44px tall, the strip's padding holds their focus ring */
  .vl-chip { height: 44px; padding: 0 14px; }
  .vl-chip.is-on { padding-right: 12px; }
  /* the game's ways: a row of their own over the pills, sharing it equally, 44px tall */
  .vl-tools.has-ways { flex-wrap: wrap; row-gap: 12px; }
  .vl-ways { flex: 1 1 100%; min-width: 0; }
  .vl-way { flex: 1 1 0; min-width: 0; height: 44px; justify-content: flex-start; padding-left: 16px; }
  .vl-way [data-label] { overflow: hidden; text-overflow: ellipsis; }
  .vl-tools.has-ways .vl-tiersbox { flex-basis: 100%; }
}
/* the narrowest phones (320-359px): the order is its icon alone (44px square, its name read out), so the four kinds
   keep their words */
@media (max-width: 359px) {
  .vl-sort { width: 44px; padding: 0; }
  .vl-sort__word { display: none; }
  .vl-types .u-seg__opt { padding: 0 4px; }
}
