/*
 * Roster picker. Each letter of a model name is a one-line window holding the
 * letter twice: the muted copy, and an accent copy below it (::after). The
 * active row slides each letter up one line, staggered by its index. The
 * preview stacks layers; the newest wipes in with clip-path while zooming down
 * to size, the one under it sinks and shrinks a touch.
 */
.ro { --ro-dur: .9s; --ro-zoom: 1.22; --ro-stagger: .018s; position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; }
.ro-back { position: absolute; inset: 0; background: #000b; backdrop-filter: blur(6px); opacity: 0; transition: opacity .25s; }
.ro.is-open .ro-back { opacity: 1; }
.ro-sheet {
  position: relative; width: min(1500px, calc(100vw - 40px)); height: calc(100dvh - 40px);
  display: grid; grid-template-columns: 220px minmax(0, 1fr) minmax(300px, 34%); grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas: "head head head" "filters ledger side";
  background: var(--bg); border: 1px solid var(--ln2); border-radius: 18px; box-shadow: 0 40px 120px #000c; overflow: hidden;
  opacity: 0; translate: 0 16px; transition: opacity .25s, translate .35s cubic-bezier(.22, 1, .36, 1);
}
.ro.is-open .ro-sheet { opacity: 1; translate: 0 0; }

/* --- head ------------------------------------------------------------------ */
.ro-head { grid-area: head; display: flex; align-items: center; gap: 20px; padding: 18px 22px; border-bottom: 1px solid var(--ln); }
.ro-head h2 { margin: 0; font: 800 clamp(1.6rem, 2.4vw, 2.3rem)/1 var(--display); text-transform: uppercase; white-space: nowrap; }
.ro-head h2 sup { margin-left: .35em; font: 600 .8rem/1 var(--mono); color: var(--tx2); vertical-align: 1.4em; }
.ro-search { flex: 1; max-width: 560px; margin-left: auto; display: flex; align-items: center; gap: 10px; padding: 0 14px; height: 46px;
  border: 1px solid var(--ln2); border-radius: 999px; background: var(--s1); transition: border-color .2s, background .2s; }
.ro-search:focus-within { border-color: var(--acc); background: var(--s2); }
.ro-search svg { width: 18px; flex: none; fill: none; stroke: var(--tx2); stroke-width: 2; stroke-linecap: round; }
.ro-search input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: none; color: var(--tx); font: inherit; font-size: 1rem; }
.ro-x { flex: none; width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--ln2); background: var(--s1); font-size: 1.6rem; line-height: 1; }
.ro-x:hover { background: var(--s3); border-color: var(--tx2); }

/* --- filters --------------------------------------------------------------- */
.ro-filters { grid-area: filters; overflow: auto; padding: 18px 16px 24px 22px; border-right: 1px solid var(--ln); display: flex; flex-direction: column; gap: 22px; scrollbar-width: thin; }
.ro-group h3 { margin: 0 0 8px; font-size: .85rem; font-weight: 650; color: var(--tx); }
.ro-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ro-chips button { padding: 6px 11px; border: 1px solid var(--ln2); border-radius: 999px; background: var(--s1); color: var(--tx2); font-size: .82rem; transition: background-color .25s, color .25s, border-color .25s; }
.ro-chips button:hover { color: var(--tx); border-color: var(--tx2); }
.ro-chips button[aria-pressed="true"] { background: var(--tx); border-color: var(--tx); color: var(--bg); }
.ro-chips sup { margin-left: 3px; font-size: .72em; opacity: .6; }
.ro-chips .ro-more { border-style: dashed; color: var(--acc); }
.ro-seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 3px; border: 1px solid var(--ln2); border-radius: 999px; background: var(--s1); }
.ro-seg button { padding: 6px 4px; border: 0; border-radius: 999px; background: none; color: var(--tx2); font-size: .82rem; font-weight: 550; }
.ro-seg button:hover { color: var(--tx); }
.ro-seg button[aria-pressed="true"] { background: var(--acc); color: var(--acc-ink); }
.ro-picked:empty { display: none; }
.ro-picked { margin-bottom: 8px; }
.ro-picked button[aria-pressed="true"] { background: var(--acc); border-color: var(--acc); color: var(--acc-ink); font-weight: 600; }
.ro-bsearch { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px; border: 1px solid var(--ln2); border-radius: 10px; background: var(--s1); transition: border-color .2s; }
.ro-bsearch:focus-within { border-color: var(--acc); }
.ro-bsearch svg { width: 15px; flex: none; fill: none; stroke: var(--acc); stroke-width: 2.4; stroke-linecap: round; }
.ro-bsearch input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: none; color: var(--tx); font: inherit; font-size: .85rem; }
.ro-bhint { margin: 6px 0 8px; color: var(--tx2); font-size: .74rem; line-height: 1.35; }
.ro-bsug button { border-style: dashed; text-align: left; }
.ro-bnone { color: var(--tx2); font-size: .78rem; }

/* --- ledger ---------------------------------------------------------------- */
.ro-ledger { grid-area: ledger; overflow: auto; padding: 0 22px 40px; scrollbar-width: thin; overscroll-behavior: contain; }
.ro-list { list-style: none; margin: 0; padding: 0; }
.ro-list li { animation: ro-in .45s cubic-bezier(.22, 1, .36, 1) both; animation-delay: calc(var(--k, 0) * .02s); }
@keyframes ro-in { from { opacity: 0; translate: 0 10px; } }
.ro-yr { position: sticky; top: 0; z-index: 1; padding: 16px 0 6px; background: linear-gradient(var(--bg) 75%, transparent); }
.ro-yr span { font: 700 .8rem/1 var(--mono); color: var(--acc); }
.ro-row {
  width: 100%; display: grid; align-items: center; column-gap: 14px; grid-template-columns: minmax(0, 1fr) 9.5rem 5.6rem 3.8rem 1.1rem .7rem;
  padding: 7px 10px 7px 6px; border: 0; border-bottom: 1px solid var(--ln); border-radius: 0; background: none; color: var(--tx2); text-align: left; outline: none;
  transition: border-color .3s, background-color .3s;
}
.ro-row.is-active { border-bottom-color: var(--acc); background: linear-gradient(90deg, color-mix(in srgb, var(--acc) 9%, transparent), transparent 70%); }
.ro-row:focus-visible { box-shadow: inset 2px 0 var(--acc); }
.ro-row.is-taken { cursor: not-allowed; }
.ro-row.is-taken .ro-name { opacity: .45; }
.ro-maker, .ro-date, .ro-open, .ro-ran { font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: color .3s; }
.ro-date { font-family: var(--mono); font-size: .74rem; }
.ro-row.is-active :is(.ro-maker, .ro-date) { color: var(--tx); }
.ro-open { justify-self: start; padding: 1px 7px; border: 1px solid var(--ln2); border-radius: 999px; font-size: .7rem; }
.ro-open.is-open { border-color: color-mix(in srgb, var(--pos) 50%, transparent); color: var(--pos); }
.ro-ran { text-align: center; color: var(--ln2); }
.ro-ran.yes { color: var(--pos); }
.ro-row .dot { width: .6rem; height: .6rem; }
.ro-who { display: flex; align-items: center; min-width: 0; overflow: hidden; container-type: inline-size; }
.ro-who > svg { flex: none; width: 0; height: .9em; font-size: clamp(22px, 2.1vw, 34px); fill: none; stroke: var(--acc); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; opacity: 0;
  transition: width .45s cubic-bezier(.22, 1, .36, 1), opacity .3s, margin .45s cubic-bezier(.22, 1, .36, 1); }
.ro-row.is-active .ro-who > svg { width: .5em; margin-right: .2em; opacity: 1; }
/* Long names shrink to fit the column (down to a floor), then wrap between
   words. --ro-em is the average uppercase glyph width in em. */
.ro-name { --ro-em: .5; --ro-max: clamp(22px, 2.1vw, 34px); display: inline-flex; flex-wrap: wrap; min-width: 0;
  font: 800 max(18px, min(var(--ro-max), calc((100cqi - 4.5rem) / (var(--n) * var(--ro-em)))))/1.1 var(--display); text-transform: uppercase; letter-spacing: .005em; white-space: nowrap; }
.ro-w { display: inline-flex; flex: none; }
.ro-sp { white-space: pre; }
/* The letter is a one-line window; the glyph and its accent copy slide up
   through it together. */
.ro-l { flex: none; display: inline-block; overflow: hidden; vertical-align: top; }
.ro-g { position: relative; display: inline-block; color: color-mix(in srgb, var(--tx) 72%, var(--bg)); transition: translate .5s cubic-bezier(.65, 0, .35, 1); transition-delay: calc(var(--i) * var(--ro-stagger)); }
.ro-g::after { content: attr(data-ch); position: absolute; left: 0; top: 100%; color: var(--acc); }
.ro-row.is-active .ro-g { translate: 0 -100%; }
.ro-tag { flex: none; margin-left: 10px; padding: 2px 8px; border-radius: 999px; background: var(--s3); color: var(--tx); font: 650 .68rem/1.4 Inter, sans-serif; font-style: normal; }
.ro-tag-a { background: color-mix(in srgb, var(--a) 22%, transparent); color: var(--a); }
.ro-tag-b { background: color-mix(in srgb, var(--b) 22%, transparent); color: var(--b); }
.ro-empty { padding: 40px 0; color: var(--tx2); }
.ro-empty button { margin-left: .4rem; padding: 4px 12px; border: 1px solid var(--ln2); border-radius: 999px; background: var(--s1); }

/* --- preview --------------------------------------------------------------- */
.ro-side { grid-area: side; overflow: auto; padding: 22px 22px 24px; border-left: 1px solid var(--ln); display: flex; flex-direction: column; gap: 18px; scrollbar-width: thin; }
.ro-frame { position: relative; flex: none; aspect-ratio: 16 / 10; overflow: hidden; border-radius: 10px; background: var(--s2); }
.ro-layer { position: absolute; inset: 0; overflow: hidden; }
.ro-layer img, .ro-layer .ro-noimg { display: block; width: 100%; height: 100%; object-fit: cover; }
.ro-noimg { display: grid !important; place-items: center; padding: 20px; background: var(--s2); color: var(--tx2); font: 800 2rem/1 var(--display); text-transform: uppercase; text-align: center; }
.ro-layer.is-in { animation: ro-wipe var(--ro-dur) cubic-bezier(.16, 1, .3, 1) both; }
.ro-layer.is-in > * { animation: ro-zoom var(--ro-dur) cubic-bezier(.16, 1, .3, 1) both; }
.ro-layer.is-under > * { animation: ro-sink var(--ro-dur) cubic-bezier(.16, 1, .3, 1) both; }
@keyframes ro-wipe { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0); } }
@keyframes ro-zoom { from { scale: var(--ro-zoom); } }
@keyframes ro-sink { to { scale: .96; translate: 0 6%; } }
.ro-facts h3 { margin: 0 0 8px; font: 800 clamp(1.8rem, 2.6vw, 2.6rem)/1 var(--display); text-transform: uppercase; overflow-wrap: anywhere; }
.ro-ranline { margin: 0 0 14px; font-weight: 650; font-size: .92rem; }
.ro-ranline.yes { color: var(--pos); }
.ro-ranline.no { color: var(--mix); }
.ro-ranline small { display: block; color: var(--tx2); font-weight: 400; font-size: .8rem; }
.ro-facts dl { margin: 0 0 18px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.ro-facts dt { font-size: .75rem; color: var(--tx2); }
.ro-facts dd { margin: 2px 0 0; font-size: .92rem; font-weight: 550; }
.ro-go { width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 14px 18px; border: 0; border-radius: 12px; background: var(--acc); color: var(--acc-ink); font-weight: 750; font-size: 1rem; transition: filter .2s, translate .2s; }
.ro-go:hover:not(:disabled) { filter: brightness(1.08); translate: 0 -1px; }
.ro-go svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.ro-go:disabled { background: var(--s3); color: var(--tx2); cursor: not-allowed; }

/* --- narrower ---------------------------------------------------------------- */
@media (max-width: 1100px) {
  .ro-sheet { grid-template-columns: 200px minmax(0, 1fr) 300px; }
  .ro-row { grid-template-columns: minmax(0, 1fr) 5.6rem 3.8rem 1.1rem .7rem; }
  .ro-maker { display: none; }
}
@media (max-width: 760px) {
  .ro-sheet { width: 100vw; height: 100dvh; border-radius: 0; border: 0; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto minmax(0, 1fr);
    grid-template-areas: "head" "filters" "ledger"; }
  .ro-head { flex-wrap: wrap; gap: 10px 12px; padding: 12px 16px; }
  .ro-head h2 { font-size: 1.5rem; }
  .ro-x { width: 40px; height: 40px; margin-left: auto; }
  .ro-search { order: 3; flex-basis: 100%; max-width: none; height: 42px; }
  .ro-filters { flex-direction: row; gap: 8px; overflow-x: auto; overflow-y: hidden; padding: 10px 16px; border-right: 0; border-bottom: 1px solid var(--ln); scrollbar-width: none; }
  .ro-group { flex: none; }
  .ro-group h3 { display: none; }
  .ro-chips { flex-wrap: nowrap; }
  .ro-chips button { white-space: nowrap; }
  .ro-seg { grid-auto-columns: auto; }
  .ro-seg button { padding: 6px 10px; }
  .ro-benches { order: -1; display: flex; align-items: center; gap: 6px; }
  .ro-picked { margin: 0; flex-wrap: nowrap; }
  .ro-bsearch { width: 12.5rem; flex: none; }
  .ro-bhint { display: none; }
  .ro-bsug { display: none; flex-wrap: nowrap; }
  .ro-benches:focus-within .ro-bsug { display: flex; }
  .ro-side { display: none; }
  .ro-ledger { padding: 0 16px 32px; }
  .ro-row { grid-template-columns: minmax(0, 1fr) auto .7rem; grid-template-areas: "who open dot" "sub sub sub"; row-gap: 2px; padding: 9px 4px; }
  .ro-who { grid-area: who; }
  .ro-open { grid-area: open; }
  .ro-row .dot { grid-area: dot; }
  .ro-maker { display: inline; grid-area: sub; }
  .ro-date { grid-area: sub; justify-self: end; }
  .ro-ran { display: none; }
  .ro-name { --ro-max: 24px; }
}

/* Reduced motion: no rolling or wiping, instant swap. */
@media (prefers-reduced-motion: reduce) {
  .ro *, .ro *::after, .ro *::before { animation: none !important; transition: none !important; }
}
