/* Custom in the client's frame (layout A, Tyler 2026-10-28: "A is best"; the accepted mockup shots/a-custom). Owner:
   ui/front/custom.rs. Tokens and the kit only. It loads right before room.css (tools/dev/src/assemble.rs), where these
   rules were, so the cascade round them is unchanged; play.css gives .fit-page and .page-head.

   Tyler, 6 November 2026: "fill the empty space and expand the public rooms area so it doesn't look squeezed
   together. There's no margin between the top." The page is a grid of named areas: the head across, Public rooms down
   the whole left column, and Host a room, Join with a code and Your party down the right. At 1920x1080 the page area
   is 1516x932: the head's 40px and a 20px gap leave the columns 872px, the list 996px wide and the right column 500px.
   Join with a code (177px) and Your party (135px, two lines) take their own height, Host a room the rest (520px), and
   its art what the card's body leaves (212px). Both columns end on the page's bottom edge. */
.custom-page { display: grid; grid-template-columns: minmax(0, 1fr) 500px; grid-template-rows: 40px minmax(0, 1fr) auto auto;
  grid-template-areas: "head head" "list create" "list code" "list party"; gap: 20px; }
.custom-page > .page-head { grid-area: head; }
.custom-page > section { min-width: 0; min-height: 0; }
.custom-list { grid-area: list; }
.custom-create { grid-area: create; }
.custom-code { grid-area: code; }
.custom-party { grid-area: party; }
/* The list, Join with a code and Your party wear the quieter steel rim, so the page's gold marks its main action, Host
   a room (Sol, custom-lobby council round 2: a gold frame on every panel competed with it). The 12px steel frame is
   9-sliced at 5px and drawn 10px over the panel's 8px border, as the room's supporting panels draw it. */
.custom-list.ms, .custom-code.ms, .custom-party.ms { border-image: url('/c/21c428881f7c1c8e8af997a3b077a6db135f5fa9e4787d722abb9f29942ad5cd.png') 5 / 10px stretch; }
/* One inset for every panel, 20px down and 24px in, so the headings and lines in a column share one left edge; the
   gold frame is 2px wider, so Host a room's body is 22px in. A heading sits 14px over what it heads, and every line on
   the page is the body's 18px, Your party's too (Tyler: it was smaller than the rest). */
.custom-list, .custom-code, .custom-party { display: flex; flex-direction: column; gap: 14px; padding: 20px 24px; }
:is(.custom-code, .custom-party, .custom-create-body) p { margin: 0; }
/* The panel headings, "Public rooms" to "Your party": the pixel face a step up from the kit's label, 18px with 0.5px
   tracking where it is 16px with 1px (Opus, custom-lobby council round 5: its thin strokes made them the least
   legible text on screen). room.css sets the room's to match. */
:is(.custom-list-head, .custom-create-body, .custom-code, .custom-party) > .kit-label { font-size: var(--t-m); letter-spacing: 0.5px; }

/* Public rooms: the head, the well and the foot, 16px apart. The well takes the column's height (704px at 1920x1080):
   its column names under 16px of their own space, then the rows from its top, nine 72px rows before they scroll. The
   foot keeps Load more rooms' 40px, so the well never moves when it comes or goes. */
.custom-list { gap: 16px; }
.custom-list-head { display: flex; align-items: center; gap: 14px; min-height: 40px; }
.custom-list-status { flex: 1; }
.custom-table-wrap { flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; overflow: auto; background: var(--plate); border: 2px solid var(--plate-edge); }
.custom-table-wrap > .custom-table { flex: none; }
.custom-table-wrap > p { margin: 16px 24px; }
.custom-list-foot { display: flex; align-items: center; gap: 16px; min-height: 40px; }
/* The list changes only when the player refreshes it, so the line saying so sits at the panel's foot, in the body's
   size and colour as task text (Sol, custom-lobby council round 4: faint task text). */
.custom-list-foot > .custom-list-hint { flex: 1; margin: 0; }
.custom-list-foot > .btn { margin-left: auto; }
/* Fixed columns, so the names over them line up with every row: Status 170px, Players 280px (six pips and "1 of 6
   players"), the Join column 150px, and the room's name the rest (328px), each with a 24px gutter; Join room stands
   at the right, so its column needs none on the left. The names stay on screen while the rows scroll under them. */
.custom-table { width: 100%; table-layout: fixed; border-collapse: separate; border-spacing: 0; }
.custom-table :is(th, td) { padding: 0 24px; text-align: left; }
.custom-table thead th { position: sticky; top: 0; z-index: 1; padding-block: 16px 14px; font: 700 var(--t-name)/1 var(--font-body); letter-spacing: 0.5px; color: var(--text-dim); text-transform: uppercase; background: var(--field); border-bottom: 2px solid var(--trim-dark); }
.custom-table thead th:nth-child(2) { width: 170px; }
.custom-table thead th:nth-child(3) { width: 280px; }
.custom-table thead th:nth-child(4) { width: 150px; }
.custom-table :is(tbody th, td) { height: 72px; border-bottom: 2px solid var(--plate-edge); }
.custom-table tbody th { font: 700 var(--t-m)/1.2 var(--font-body); }
.custom-table tbody th > span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.custom-table .custom-room-code { margin-top: 5px; font: 400 var(--t-s)/1.2 var(--font-body); }
/* A row reads at one size: its status as large as its name and count. */
.custom-table td { white-space: nowrap; }
.custom-table td .pres { font-size: var(--t-m); }
.custom-table td:last-child { padding-left: 0; text-align: right; }
/* A lobby's six seats beside its count: steel pips, a player's lit (custom.rs `seat_pips`). */
.custom-pips { display: inline-flex; gap: 4px; margin-right: 12px; vertical-align: -1px; }
.custom-pip { width: 12px; height: 12px; border: 2px solid var(--steel-line); background: var(--field); }
.custom-pip.taken { border-color: var(--text-dim); background: var(--text); }
/* A row lights only while the pointer or the keyboard is on it: nothing in the list is selected. */
.custom-table tbody tr:is(:hover, :focus-within) { background: var(--you-soft); }
.custom-col-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
/* No rooms, or the first load: the game's moon crest (launch-profile/crest-0.png, the crest every player starts with
   and the room's random bots wear) at its own 96px, a heading and the next step, centred in the well under its column
   names (custom.rs `empty_state`). */
.custom-empty { flex: 1 0 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; text-align: center; }
.custom-empty-crest { flex: none; width: 96px; height: 96px; margin-bottom: 20px; background: url('/c/92438f4886bb21640258621b52271a7a95da5e382c29144c71800f78e774837e.png') 0 0 / 96px 96px no-repeat; image-rendering: pixelated; }
.custom-empty-title { margin: 0; font: 700 var(--t-l)/1.2 var(--font-body); color: var(--text); }
.custom-empty > p.dim { margin: 8px 0 0; }
.btn.custom-empty-create { height: 48px; margin-top: 24px; padding: 0 28px; }

/* Host a room: the art, then the body. The art takes what the column leaves, its crop pinned to its foot, where the two
   champions stand, so a taller card shows more of the keep above them. It is a size container, so the champions keep
   their 1x size while the art is as tall as they are (Barbarian 165px over a 6px foot) and step down to 0.75 and 0.5
   below that, whole rather than cut off at the head. */
.custom-create { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.custom-art { position: relative; flex: 1 1 0; min-height: 0; container: custom-art / size; overflow: hidden; border-bottom: 2px solid var(--trim); background: url('/c/5aa2f22d2986814d0d25fe080ac7652af54421d2cff61be99de4011f6ae72036.png') left -27px bottom -180px / 1920px 1080px no-repeat; image-rendering: pixelated; }
.custom-art::after { content: ''; position: absolute; inset: 0; background: linear-gradient(transparent, var(--scrim)); pointer-events: none; }
.custom-figures { position: absolute; z-index: 1; left: 0; right: 0; bottom: 6px; display: flex; justify-content: center; align-items: flex-end; gap: 60px; }
@container custom-art (max-height: 175.98px) { .custom-figures > .spr { zoom: 0.75; } }
@container custom-art (max-height: 131.98px) { .custom-figures { bottom: 4px; gap: 40px; } .custom-figures > .spr { zoom: 0.5; } }
.custom-create-body { display: flex; flex-direction: column; gap: 12px; padding: 20px 22px 22px; }
.btn.primary.big.custom-private { height: 56px; margin-top: 4px; padding: 0; font-size: var(--t-l); letter-spacing: 4px; }
.btn.custom-public { height: 48px; }
/* Join with a code: the field and Join on one line at one height. Room codes are lower case words: the title's
   upper-case code field would misspell them. */
.custom-code-row { display: flex; gap: 10px; }
.custom-code .input.code { flex: 1; width: auto; min-width: 0; height: 52px; padding: 0 16px; font-weight: 400; letter-spacing: 0; text-transform: none; text-overflow: ellipsis; background: var(--field); }
.custom-code-row > .btn { flex: none; height: 52px; padding: 0 20px; }

/* Compact: a page area smaller than 1516x932 (play.css says why). The text keeps its size; paddings, buttons and rows
   give way, and the right column is a third of the page, 448px to 500px, so the code field still shows its whole
   example (314px) beside Join. */
@container (max-width: 1515.98px) or (max-height: 931.98px) {
  .custom-page { grid-template-columns: minmax(0, 1fr) clamp(448px, calc(34cqw * var(--cq-fix, 1)), 500px); grid-template-rows: auto minmax(0, 1fr) auto auto; gap: 16px; }
  .custom-list, .custom-code, .custom-party { gap: 12px; padding: 16px 20px; }
  .custom-create-body { gap: 10px; padding: 14px 18px 16px; }
  .btn.primary.big.custom-private { height: 50px; font-size: var(--t-m); letter-spacing: 2px; }
  .btn.custom-public { height: 44px; }
  .custom-code-row { gap: 8px; }
  .custom-code .input.code { height: 46px; padding: 0 12px; }
  .custom-code-row > .btn { height: 46px; padding: 0 14px; }
  .custom-table :is(th, td) { padding: 0 16px; }
  .custom-table thead th { padding-block: 14px 12px; }
  .custom-table thead th:nth-child(2) { width: 128px; }
  .custom-table thead th:nth-child(3) { width: 244px; }
  .custom-table thead th:nth-child(4) { width: 124px; }
  .custom-table :is(tbody th, td) { height: 60px; }
  .btn.custom-empty-create { height: 44px; margin-top: 20px; }
}
/* Below 800px of page height three panels and the art no longer fit the right column (at 1366x768 the art would be
   under 60px), so Your party moves under the list, where its line fits on one row, and Host a room keeps the height. */
@container (max-height: 799.98px) {
  .custom-page { grid-template-areas: "head head" "list create" "list code" "party code"; }
}
/* 1366x768 and 1280x720: the gaps, the card's body and the rows tighten again, so the art keeps about 170px and 120px
   and the list five rows. */
@container (max-height: 699.98px) {
  .custom-page { gap: 12px; }
  .custom-list, .custom-code, .custom-party { gap: 10px; padding-block: 12px; }
  .custom-create-body { gap: 8px; padding-block: 12px 14px; }
  .btn.primary.big.custom-private { height: 46px; }
  .btn.custom-public { height: 42px; }
  .custom-code .input.code, .custom-code-row > .btn { height: 44px; }
  .custom-table thead th { padding-block: 12px 10px; }
  .custom-table :is(tbody th, td) { height: 52px; }
  .custom-empty { padding: 8px 24px; }
  .custom-empty-crest { margin-bottom: 12px; }
  .btn.custom-empty-create { margin-top: 14px; }
}
/* Under 1300px of page width the pips go and Players narrows to its words, so a three-word room name keeps its 182px. */
@container (max-width: 1299.98px) {
  .custom-pips { display: none; }
  .custom-table thead th:nth-child(3) { width: 150px; }
}
/* Small: below 1000x560 the page scrolls in one column, and the list shows its column names and five rows. */
@container (max-width: 999.98px) or (max-height: 559.98px) {
  .custom-page { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; grid-template-areas: "head" "list" "create" "code" "party"; }
  .custom-table-wrap { flex: none; height: 340px; }
  .custom-art { flex: none; height: 200px; }
}

/* A phone (Tyler, 2026-11-17: "a lot of the menus are kind of squished and they're not optimized for mobile";
   tests/browser_phone_menus.cjs). The list's columns are fixed for a wide panel: in a phone's panel they took the whole
   width and the room's name had none. Here each room is a row of its own: its name across the top, its status and
   players under it, and Join room at the right. The column names are kept for a screen reader only, as Join's is. */
@media (max-width: 600px), (orientation: landscape) and (max-width: 1099.98px) {
  html.touch .custom-table, html.touch .custom-table > tbody { display: block; }
  html.touch .custom-table > thead th { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
  html.touch .custom-table tbody tr { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: 'name name join' 'status players join';
    align-items: center; gap: 4px 14px; padding: 10px 14px; border-bottom: 2px solid var(--plate-edge); }
  html.touch .custom-table tbody :is(th, td) { height: auto; padding: 0; border: 0; }
  html.touch .custom-table tbody th { grid-area: name; }
  html.touch .custom-table tbody th > span { white-space: normal; overflow-wrap: anywhere; }
  html.touch .custom-table tbody td:nth-of-type(1) { grid-area: status; }
  html.touch .custom-table tbody td:nth-of-type(2) { grid-area: players; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  html.touch .custom-table tbody td:nth-of-type(3) { grid-area: join; }
}
/* Upright, the list's heading and Refresh rooms share the first line and the count goes under them: three in a row,
   each was squeezed onto two lines. A room's status and players each take a line under its name, where side by side
   beside Join room the players were cut to "1 of 6 pla…". */
@media (max-width: 600px) and (orientation: portrait) {
  html.touch .custom-table tbody tr { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: 'name join' 'status join' 'players join'; row-gap: 2px; }
  html.touch .custom-table tbody td:nth-of-type(2) { overflow: visible; }
  html.touch .custom-list-head { flex-wrap: wrap; gap: 2px 12px; }
  html.touch .custom-list-head > .btn { margin-left: auto; }
  html.touch .custom-list-status { order: 3; flex-basis: 100%; }
}
/* A phone on its side: the list down the left and Host a room, Join with a code and Your party down the right, as in a
   wider window, so Create private room is in the window from the start (in one column it was a page and a half down).
   The picture is short, its two champions at 1x. */
@media (orientation: landscape) and (max-width: 1099.98px) {
  html.touch .custom-page { grid-template-columns: minmax(0, 1fr) minmax(0, 400px); grid-template-rows: auto auto auto minmax(0, 1fr);
    grid-template-areas: "head head" "list create" "list code" "list party"; gap: 12px 16px; }
  html.touch .custom-list { min-height: 280px; }
  html.touch .custom-table-wrap { flex: 1 1 0; height: auto; min-height: 0; }
  html.touch .custom-art { height: 96px; }
  html.touch .custom-create-body { gap: 8px; padding: 12px 16px 14px; }
  html.touch :is(.custom-list, .custom-code, .custom-party) { gap: 10px; padding: 12px 16px; }
  /* The creates are 44 px or more under the zoom on its side (kit/scale.rs; phone council round 1, Sol). */
  html.touch .btn.primary.big.custom-private { height: calc(48px / var(--client-scale, 1)); }
  html.touch :is(.btn.custom-public, .custom-code .input.code, .custom-code-row > .btn) { height: calc(44px / var(--client-scale, 1)); }
}
/* The empty list on a phone (phone council round 0): the well takes its words' height, not the column's, and its one
   action, Create public room, is the screen's gold (custom.rs `empty_create_class`). The foot's "Refresh rooms to see
   new ones." said again what the Refresh rooms button over it says, so a phone leaves it out, and the foot with it
   while it holds nothing else. On its side Host a room stands beside the list with both creates, so the well's own
   Create public room would be a second one in view: there the well only says what to do. */
@media (max-width: 600px), (orientation: landscape) and (max-width: 1099.98px) {
  html.touch .custom-list:has(.custom-empty) > .custom-table-wrap { flex: none; height: auto; }
  html.touch .custom-empty { flex: none; padding: 18px 16px 20px; }
  html.touch .custom-empty-crest { width: 64px; height: 64px; margin-bottom: 10px; background-size: 64px 64px; }
  html.touch .custom-empty-title { font-size: var(--t-m); }
  html.touch .custom-empty > p.dim { margin-top: 4px; }
  html.touch .btn.custom-empty-create { height: 48px; margin-top: 16px; padding: 0 24px; }
  html.touch .custom-list-hint { display: none; }
  html.touch .custom-list-foot:not(:has(> .btn)) { display: none; }
}
@media (orientation: landscape) and (max-width: 1099.98px) {
  html.touch .custom-list { min-height: 0; }
  html.touch .custom-list:has(.custom-empty) { align-self: start; }
}
/* Upright, Host a room comes first, under the heading: with friends it is the page's useful action, and below an empty
   list it was under the fold (phone council round 1, Opus). Its picture is a short band, so Create private room is in
   the first screen. Both ways round Host a room is then in view beside or over the empty list with both creates, so
   the well's own Create public room would be a second one: the well only says what to do. An empty list's count, "0
   rooms", said what the well's heading says (round 1), so it shows only while the list holds rooms or is loading
   (Refresh rooms is disabled while it loads). */
@media (max-width: 600px) and (orientation: portrait) {
  html.touch .custom-page { grid-template-areas: "head" "create" "list" "code" "party"; }
  html.touch .custom-art { height: 136px; }
  html.touch .custom-create-body { gap: 8px; padding: 12px 16px 14px; }
}
@media (max-width: 600px), (orientation: landscape) and (max-width: 1099.98px) {
  html.touch .custom-empty > .btn.custom-empty-create { display: none; }
  html.touch .custom-list:has(.custom-empty) .custom-list-head:has(> .btn:enabled) > .custom-list-status { display: none; }
}
/* Host a room is compact on a phone: no picture, its line, then its two creates side by side (Create private room
   keeps the kit's one gold face, which a phone tracks less, kit.css; tracked wide it was the hardest label on the
   screen to read, Opus).
   Upright the public rooms' state and Refresh rooms are then in the first screen under it and Join with a code a
   short way below (phone council round 2, Sol: the list started under the first screen, and joining by code was out
   of sight); on its side Join with a code is in the window under it. "Anyone can join a public room from the list"
   goes: the list is beside or under it. A guest's one create takes the row. */
@media (max-width: 600px) and (orientation: portrait), (orientation: landscape) and (max-width: 1099.98px) {
  html.touch .custom-art { display: none; }
  html.touch .custom-create-body { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 10px; padding: 14px 14px 16px; }
  html.touch .custom-create-body > :not(.btn.custom-private, .btn.custom-public) { grid-column: 1 / -1; }
  html.touch .custom-create-body > p.dim:last-child { display: none; }
  html.touch .custom-create .custom-create-body > .btn:is(.custom-private, .custom-public) { height: auto; min-height: calc(48px / var(--client-scale, 1)); margin: 0;
    padding: 6px 6px; font-size: var(--t-s); line-height: 1.2; white-space: normal; }
  html.touch .custom-create-body:not(:has(> .custom-public)) > .btn.custom-private { grid-column: 1 / -1; }
}
/* Upright the two creates stack, each across the panel on one line: gold Create private room over steel Create public
   room (phone council round 3, Opus: side by side the gold one broke its pixel capitals over two lines beside one line
   of the body face). */
@media (max-width: 600px) and (orientation: portrait) {
  html.touch .custom-create-body { grid-template-columns: minmax(0, 1fr); }
  html.touch .custom-create .custom-create-body > .btn:is(.custom-private, .custom-public) { min-height: 48px; padding-inline: 10px; white-space: nowrap; }
}
/* Upright a long list scrolls in its own well, a few rooms high, so Join with a code stays near. */
@media (max-width: 600px) and (orientation: portrait) {
  html.touch .custom-page { gap: 12px; }
  html.touch .custom-list:not(:has(.custom-empty)) > .custom-table-wrap { flex: none; max-height: 300px; }
}
/* A small phone on its side (568x320, a page under 820 wide): the list and the other panels share the width evenly,
   and the list's heading lets Refresh rooms under it rather than cut it (phone council round 2). */
@media (orientation: landscape) and (max-width: 1099.98px) {
  @container (max-width: 819.98px) {
    html.touch .custom-page { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    html.touch .custom-list-head { flex-wrap: wrap; gap: 4px 10px; }
  }
}
