/* A trade (app/components/adcard.js), prefix ac-. Every item is the Shop tile (ui.css .u-item, spec/cards/PICK.md):
   its tier tile is its only box, so a trade holds no box inside its frame (spec/nav/UX.md rule 15).
   The row (.ac-row in one .ac-rows list): one trade per row, read left to right like a sentence (UX.md rule 19):
   who · You give · ⇄ · You get · the button, in the same columns on every row so the eye runs down "You get". One
   bordered list with 2px hairlines between the rows (half the lines of a stack of cards, the way the Values table and
   Your trades' history read); on phones one card a trade.
   The card (.ac-card): the trade stacked (You give over You get), the ad page's one big trade. Sizes follow the list's,
   the card's or the side's own width (containers). Colours only from tokens.css. */

/* ================================================================ parts of both: who, a side's top line, the buttons */
.ac-quiet { touch-action: manipulation; }   /* quick taps are taps, never a zoom */
.ac-head { display: flex; align-items: center; gap: 12px; min-width: 0; }
.ac-face { flex-shrink: 0; display: flex; border-radius: 50%; }
.ac-who { flex: 1 1 auto; min-width: 0; }
.ac-name { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin: 0; font-size: 19px; font-weight: 700; line-height: 26px; }
/* a name breaks only if it can't fit a line on its own ("KnifeKing / _77" with room to spare was 'anywhere'), and then
   inside its own column: a flex item is never narrower than its longest word without min-width 0 (a 20-character
   Roblox name ran under a phone's Offer button, and into "You give" beside it on desktop) */
.ac-name a { min-width: 0; color: var(--color-eel); text-decoration: none; overflow-wrap: break-word; }
@media (hover: hover) { .ac-name a:hover { color: var(--color-macaw); } }
.ac-meta { margin: 2px 0 0; overflow: hidden; color: var(--color-label); font-size: 15px; line-height: 22px; }
/* " · " between the parts, a plain space each side (UX.md rule 16): each part carries it in front; the line is pulled
   left by its width, so the dot of a part that starts a line is cut off */
.ac-meta__in { display: flex; flex-wrap: wrap; align-items: center; margin-left: -14px; }
.ac-meta__i { position: relative; display: inline-flex; align-items: center; padding-left: 14px; white-space: nowrap; }
.ac-meta__i::before { content: "·"; content: "·" / ""; position: absolute; left: 0; width: 14px; color: var(--color-hare); text-align: center; }
.ac-when { color: inherit; text-decoration: none; white-space: nowrap; }
@media (hover: hover) { .ac-when:hover { color: var(--color-macaw); } }
.ac-stars { display: inline-flex; align-items: center; gap: 3px; color: var(--color-eel); font-weight: 700; white-space: nowrap; }
.ac-stars > svg { color: var(--color-bee); }
.ac-stars__n { color: var(--color-label); font-weight: 400; }

/* a side: "YOU GIVE 🔥2,520" (the label right next to its total), then its tiles; the label in its side's colour (pop.css
   "the side label": You give orange, You get green, on every trade) */
.ac-half { min-width: 0; }
/* "You give 🔥640" reads as one string (UX.md rule 16): a word space between the label and its total */
.ac-half__top { display: flex; flex-wrap: wrap; align-items: center; column-gap: 5px; row-gap: 6px; min-height: 26px; margin-bottom: 12px; }
.ac-half__label { color: var(--color-label); font: 700 15px/20px var(--font); }
.ac-half__total { display: flex; color: var(--color-eel); font-size: 19px; line-height: 24px; }
/* a post that takes any one of its wanted items (wants_any): said beside the label, where the side's total would be */
.ac-half__any { color: var(--color-eel); font: 700 15px/24px var(--font); }
.ac-half__total .u-val { gap: 3px; }
.ac-half__total .u-coin { width: 16px; height: 20px; }
/* "You have them": their green badge (._12f9L), next to the total of what you give */
.ac-ready { flex-shrink: 0; margin-left: 3px; height: auto; min-height: 26px; padding: 3px 10px 3px 7px; letter-spacing: 0; text-transform: none; white-space: nowrap; }
.ac-ready > svg { width: 16px; height: 16px; flex-shrink: 0; }
.ac-items > li { display: flex; min-width: 0; }
/* "+N": the tiles a row's side has no room for (a flat blue slot, like the trade's asks; the trade opens with all of them) */
.ac-items > .ac-more { display: none; }
.u-item--more { cursor: pointer; }
.u-item--more .u-item__slot { border: 0; background: var(--color-iguana); color: var(--color-whale); font-size: 24px; font-variant-numeric: tabular-nums; transition: box-shadow var(--m-fast) var(--m-ease-out); }
@media (hover: hover) { .u-item--more:hover .u-item__slot { box-shadow: inset 0 0 0 2px var(--color-blue-jay); } }
.u-item--more:focus-visible { outline: none; }
.u-item--more:focus-visible .u-item__slot { outline: 2px solid var(--color-macaw); outline-offset: 3px; }
/* "Open to offers": the dashed slot, a "?" in it */
.ac-open .u-item__slot { font-size: 32px; }

/* the buttons */
.ac-foot { display: flex; flex-direction: column; gap: 12px; }
.ac-foot--row { flex-direction: row; align-items: center; gap: 8px; }
.ac-foot--row > .u-btn--block { flex: 1; width: auto; min-width: 0; }
.ac-foot--row .u-iconbtn { --h: 48px; width: 48px; flex-shrink: 0; }
.ac-save.is-on { --fg: var(--color-macaw); }      /* saved: the bookmark fills in blue */
.ac-save.is-on > svg { color: var(--color-macaw); }
/* your own trade: Bump (or until it works "🕐 Bump in 25 min": a muted line with a clock, a state like the trade's
   other times, not a button that can't work), then Take down, a quiet button with its icon like the trade post's
   Save and Report (UX.md rule 5: destructive actions are quiet and ask first) */
.ac-mine { display: grid; grid-template-columns: 1fr 1fr; align-items: center; gap: 8px; }
.ac-mine > .u-btn { min-width: 0; }
.ac-mine > .ac-quiet { justify-content: center; }
.ac-bumpwait { display: flex; align-items: center; justify-content: center; gap: 5px; min-height: 44px; padding: 0 8px; color: var(--color-label); font: 400 14px/18px var(--font); text-align: center; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ac-bumpwait > svg { flex-shrink: 0; color: var(--color-hare); }
.ac-down > svg { flex-shrink: 0; }
.ac-card .ac-bumpwait { min-height: 50px; }
.ac-extras { display: flex; justify-content: center; gap: 8px 24px; flex-wrap: wrap; }
/* Save and Report on the ad page: quiet text buttons under the one big button */
.ac-quiet { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 8px; border: 0; border-radius: 12px; background: none; color: var(--color-wolf); font: 700 15px/20px var(--font); cursor: pointer; }
@media (hover: hover) { .ac-quiet:hover { color: var(--color-eel); background: var(--color-polar); } }
.ac-quiet:focus-visible { outline: 2px solid var(--color-macaw); outline-offset: 2px; }
@media (hover: hover) { .ac-row[data-href]:hover .ac-quiet:hover { background: var(--color-swan); } }   /* over the row's own polar hover */
.ac-quiet.ac-save.is-on, .ac-quiet.ac-save.is-on > svg { color: var(--color-macaw); }
.ac-sentnote { margin: 0; color: var(--color-wolf); font-size: 17px; line-height: 24px; text-align: center; }
.ac-sentnote a { color: var(--color-macaw); font-weight: 700; text-decoration: none; }

/* ================================================================ the row
   Columns: who 200 · You give 1fr · ⇄ 24 · You get 1fr · the button 160. Each side's tiles are 88px columns (three fit
   a side at the page's 1120px); a side keeps the tiles that fit and turns the rest into one "+N" slot. The swap mark
   and the button sit level with the middle of the tiles, the same height on every row. */
.ac-rows { container: acr / inline-size; display: flex; flex-direction: column; min-width: 0; border: 2px solid var(--color-swan); border-radius: 16px; background: var(--color-snow); overflow: hidden; }
.ac-row {
  --ac-tile: 88px;
  --ac-mid: calc(26px + 12px + var(--ac-tile) / 2);   /* the tiles' middle: the side's top line, its gap, half a tile */
  position: relative; display: grid; grid-template-columns: 200px minmax(0, 1fr) 24px minmax(0, 1fr) 160px; grid-template-areas: "who give swap get act";
  column-gap: 16px; align-items: start; min-width: 0; padding: 20px; cursor: pointer; transition: background-color var(--m-fast) var(--m-ease-out);
}
.ac-row + .ac-row { border-top: 2px solid var(--color-swan); }
@media (hover: hover) { .ac-row[data-href]:hover { background: var(--color-polar); } }
.ac-row.is-closed .ac-half { opacity: .6; }
.ac-row > .ac-head { grid-area: who; align-items: flex-start; gap: 10px; }
.ac-row .ac-name { font-size: 17px; line-height: 22px; }
.ac-row .ac-meta { margin-top: 2px; font-size: 14px; line-height: 20px; }
/* a row's two totals a size up: the numbers a kid compares */
.ac-row .ac-half__total { font-size: 22px; line-height: 26px; }
.ac-row .ac-half__total .u-coin { width: 18px; height: 22px; }
.ac-row .ac-half--give { grid-area: give; }
.ac-row .ac-half--get { grid-area: get; }
.ac-row .ac-half { container: acs / inline-size; }
.ac-row .ac-items { grid-template-columns: repeat(auto-fill, var(--ac-tile)); gap: 16px 12px; }
.ac-row .ac-items .u-item__name, .ac-row .ac-items :is(.u-item__val, .u-item__why) { font-size: 14px; line-height: 17px; }
/* the swap mark in a round face (its 40px reach past the 24px column, into the gaps beside it) */
.ac-swap { grid-area: swap; display: flex; justify-content: center; margin-top: calc(var(--ac-mid) - 20px); color: var(--color-macaw); }
.ac-swap > svg { flex: none; box-sizing: content-box; width: 20px; height: 20px; padding: 8px; border: 2px solid var(--color-swan); border-radius: 50%; background: var(--color-snow); box-shadow: 0 2px 0 var(--color-swan); }
.ac-row > .ac-foot { grid-area: act; margin-top: calc(var(--ac-mid) - 24px); }
.ac-row .ac-foot--row .u-btn { --h: 48px; }
.ac-row .ac-mine { grid-template-columns: minmax(0, 1fr); }
.ac-row > .ac-foot:has(> .ac-mine) { margin-top: calc(var(--ac-mid) - 50px); }   /* two buttons: centred on the tiles' middle too */
/* your own trade's Bump (or its wait) as tall as Offer: a row is the same height whoever's it is (the server's first
   HTML can't tell yours from someone else's, and the card didn't move 4px when the app drew it as yours) */
.ac-row .ac-mine > .u-btn { --h: 48px; }
.ac-row .ac-bumpwait { min-height: 48px; }
/* "You have it": a row marks each tile you have (adcard-markup.js); once you have them all, the pill by the total says
   it once instead (a phone shows the marks: the pill has no room there) */
.ac-row.is-ready .ac-half--give .u-item__own { display: none; }
/* a list of one person's trades (o.head false): no who column */
.ac-row--nohead { grid-template-columns: minmax(0, 1fr) 24px minmax(0, 1fr) 160px; grid-template-areas: "give swap get act"; }

/* "+N": the slots that fit a side's width (88px tiles, 12px gaps) decide how many tiles stay (desktop and tablet; a
   phone shows every tile, three a row) */
@media (min-width: 700px) {
  @container acs (min-width: 188px) and (max-width: 287.98px) {
    .ac-items.is-over2 > li:nth-child(n + 2):not(.ac-more) { display: none; }
    .ac-items.is-over2 > .ac-more--2 { display: flex; }
  }
  @container acs (min-width: 288px) and (max-width: 387.98px) {
    .ac-items.is-over3 > li:nth-child(n + 3):not(.ac-more) { display: none; }
    .ac-items.is-over3 > .ac-more--3 { display: flex; }
  }
  @container acs (min-width: 388px) and (max-width: 487.98px) {
    .ac-items.is-over4 > li:nth-child(n + 4):not(.ac-more) { display: none; }
    .ac-items.is-over4 > .ac-more--4 { display: flex; }
  }
  @container acs (min-width: 488px) and (max-width: 587.98px) {
    .ac-items.is-over5 > li:nth-child(n + 5):not(.ac-more) { display: none; }
    .ac-items.is-over5 > .ac-more--5 { display: flex; }
  }
  @container acs (min-width: 588px) and (max-width: 687.98px) {
    .ac-items.is-over6 > li:nth-child(n + 6):not(.ac-more) { display: none; }
    .ac-items.is-over6 > .ac-more--6 { display: flex; }
  }
}

/* tablets and laptops (phones have their own cards below) */
@media (min-width: 700px) {
  /* a list too narrow for three tiles a side on one line (laptops under 1168px, tablets): two lines a trade, who and the
     button on top, the two sides under them in the same columns */
  @container acr (max-width: 1067.98px) {
    .ac-row:not(.ac-row--nohead) { grid-template-columns: minmax(0, 1fr) 24px minmax(0, 1fr); grid-template-areas: "who who act" "give swap get"; row-gap: 16px; }
    .ac-row > .ac-head { align-items: center; }
    .ac-row:not(.ac-row--nohead) > .ac-foot { justify-self: end; width: 160px; margin-top: 0; }
    .ac-row:not(.ac-row--nohead) > .ac-foot:has(> .ac-mine) { width: auto; min-width: 240px; }
    .ac-row:not(.ac-row--nohead) .ac-mine { grid-template-columns: 1fr 1fr; }
  }
  /* without the who column a row stays on one line longer (your page's Up now: the buttons beside the trade, not
     under it), down to two tiles a side; then its button goes under the two sides, on the right */
  @container acr (max-width: 647.98px) {
    .ac-row--nohead { grid-template-columns: minmax(0, 1fr) 24px minmax(0, 1fr); grid-template-areas: "give swap get" "act act act"; row-gap: 16px; }
    .ac-row--nohead > .ac-foot { justify-self: end; width: 160px; margin-top: 0; }
    .ac-row--nohead > .ac-foot:has(> .ac-mine) { width: auto; min-width: 240px; }
    .ac-row--nohead .ac-mine { grid-template-columns: 1fr 1fr; }
  }
}

/* phones: one card a trade, read top to bottom like a card in a game's trade list (the owner, 2026-11-04: the old
   compact card was "too compact … think about what the user sees"): who it is (the picture, name, rating and time, at
   the row's sizes) with the bookmark at the top right; then You give and You get, each a line with its word on the left
   and its total on the right, and its items as real tiles you can recognise (four a row, ~75px on a 390px phone, the
   name and value under each; more than four: three and "+N"); one line between the two sides; and the one button
   across the card's foot. Nothing smaller than on a desktop. */
@media (max-width: 699px) {
  .ac-rows { gap: 12px; border: 0; border-radius: 0; background: none; overflow: visible; }
  .ac-row {
    grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "who save" "give give" "get get" "act act"; row-gap: 16px;
    padding: 16px; border: 2px solid var(--color-swan); border-radius: 16px; background: var(--color-snow);
  }
  .ac-row + .ac-row { border-top-width: 2px; }
  .ac-row > .ac-head { align-self: center; align-items: center; gap: 12px; min-height: 48px; }   /* level with the bookmark beside it, as tall with none (your own) */
  /* the name: a 44px tap target (to their page) over its line; the rest of the card opens the trade */
  .ac-row .ac-name a { position: relative; }
  .ac-row .ac-name a::after { content: ""; position: absolute; inset: -11px -6px; z-index: 1; }
  .ac-row .ac-when { position: relative; z-index: 2; }
  .ac-row a.ac-face { position: relative; }
  .ac-row a.ac-face::after { content: ""; position: absolute; inset: -2px; }
  .ac-swap { display: none; }
  /* a side: its word and total on one line, the tiles under it; the two sides parted by one line */
  .ac-row .ac-half { display: block; }
  .ac-row .ac-half--get { padding-top: 16px; border-top: 2px solid var(--color-swan); }
  .ac-row .ac-half__top { flex-wrap: nowrap; column-gap: 8px; min-height: 24px; }
  .ac-row .ac-half__total { order: 3; margin-left: auto; }
  .ac-row .ac-ready { order: 2; margin-left: 0; }
  .ac-row .ac-items { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px 8px; }
  /* the item fills its tile (the desktop's 12% inset leaves a small picture in a phone's tile) */
  .ac-row .ac-items .u-pic--fill[data-tier] { padding: 6%; }
  .ac-row .ac-items .u-item__name { overflow-wrap: anywhere; }   /* breaks at the <wbr> in its name first (ui-markup.js tileName) */
  /* a side of one item: its value is the side's total, already said on the line above (an ask's second line, "More
     items" or "Any of yours", is what it means, not a value: it stays) */
  .ac-row .ac-items > li:only-child .u-item:not(.u-item--extra) .u-item__val { display: none; }
  /* an ask alone on its side: nothing beside its tile, so its words run on one line each past the tile's edge ("Open to
     offers", "Any of theirs" broke into four short lines) */
  .ac-row .ac-items > li:only-child .u-item--extra :is(.u-item__name, .u-item__val) { white-space: nowrap; }
  /* more than four: three tiles and "+N" (the trade's page has all of them) */
  .ac-row .ac-items.is-over4 > li:nth-child(n + 4):not(.ac-more) { display: none; }
  .ac-row .ac-items.is-over4 > .ac-more--4 { display: flex; }
  /* the buttons: the bookmark at the top right, the one button across the foot */
  .ac-row > .ac-foot--row { display: contents; }
  .ac-row .ac-foot--row > .u-btn--block { grid-area: act; width: 100%; }
  .ac-row .ac-foot--row > .ac-save { grid-area: save; align-self: center; }   /* the desktop's 48px square */
  .ac-row > .ac-foot:not(.ac-foot--row) { grid-area: act; margin-top: 0; }
  .ac-row .ac-mine { grid-template-columns: 1fr 1fr; }
  /* one person's own list (no who line): the sides keep the card's width, the buttons close it (the bookmark beside
     Offer, as on a desktop) */
  .ac-row--nohead { grid-template-columns: minmax(0, 1fr); grid-template-areas: "give" "get" "act"; }
  .ac-row--nohead > .ac-foot--row { display: flex; grid-area: act; margin-top: 0; }
  .ac-row--nohead .ac-foot--row > .u-btn--block { flex: 1; width: auto; }
  .ac-row.is-mine:not(.ac-row--nohead) { grid-template-areas: "who who" "give give" "get get" "act act"; }
}
/* phones under 390px: four tiles a row are ~67px, a size too narrow for an ask's words at 14px ("Dow-ngrade" broke):
   13px keeps "Downgrade" and "More items" whole */
@media (max-width: 389px) {
  .ac-row .ac-items .u-item--extra :is(.u-item__name, .u-item__val) { font-size: 13px; }
}
/* a narrow phone (an iPhone SE, 320px): four a row would be 58px tiles that split every name ("Har vester"), so three
   a row (~80px), up to six in two rows; more than six: five and "+N" */
@media (max-width: 359px) {
  .ac-row .ac-items { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ac-row .ac-items.is-over4 > li:nth-child(n + 4):not(.ac-more) { display: flex; }
  .ac-row .ac-items.is-over4 > .ac-more--4 { display: none; }
  .ac-row .ac-items.is-over6 > li:nth-child(n + 6):not(.ac-more) { display: none; }
  .ac-row .ac-items.is-over6 > .ac-more--6 { display: flex; }
}

/* ================================================================ the card: the trade stacked */
.ac-card { position: relative; display: flex; flex-direction: column; min-width: 0; background: var(--color-snow); border: 2px solid var(--color-swan); border-bottom-width: 4px; border-radius: 16px; padding: 16px 18px 18px; }
.ac-card.is-closed .ac-half { opacity: .6; }
.ac-card > .ac-head { flex-wrap: wrap; gap: 8px 12px; margin-bottom: 18px; }
.ac-card .ac-half__top > .ac-ready { margin-left: auto; }
/* the halves (and the buttons) are the size containers: their width is the card's inside width */
.ac-card .ac-half, .ac-card .ac-foot { container: ac / inline-size; }
.ac-card .ac-items { grid-template-columns: repeat(4, minmax(0, 140px)); gap: 20px 12px; }   /* a tile never grows past 140px, however wide the card */
/* the swap line between the halves */
.ac-flip { height: 2px; margin: 16px 0; background: var(--color-swan); }
.ac-card > .ac-foot { margin-top: 20px; }
/* the ad page's one trade */
.ac-card--big { padding: 22px 24px 20px; }
.ac-card--big .ac-half__label { font-size: 16px; }
.ac-card--big .ac-half__total { font-size: 22px; line-height: 28px; }
.ac-card--big .ac-half__total .u-coin { width: 18px; height: 22px; }
.ac-card--big > .ac-foot { margin-top: 24px; }
/* narrow cards (phones, side spots): three tiles a row, then two, so the longest one-word names fit whole */
@container ac (max-width: 470px) {
  .ac-card .ac-items { grid-template-columns: repeat(3, minmax(0, 140px)); gap: 16px 8px; }
}
@container ac (max-width: 300px) {
  .ac-card .ac-items { grid-template-columns: repeat(2, minmax(0, 140px)); }
  .ac-card .ac-mine { grid-template-columns: 1fr; }
}
@media (max-width: 699px) {
  .ac-card { padding: 14px 14px 16px; }
  .ac-card--big { padding: 18px 16px 16px; }
}
