/* dialogs.css, owner: track E. Holds: scrim, dialog, drawer, sheets, notices, settings, rules, meld chart, feedback, review, share, stats, avatar, save, rename, status, report, learn, shortcuts (DESIGN_SPEC.md 8.5, 9.12, 9.13).
   Load order 15 of 15: base, primitives, frame, home, room, friends, center, table, rails, chat, coach, meld, peek, results, dialogs.
   Wave 2: every dialog is built on render/dialog-kit.js (scrim > dialog > head, body, foot); the old inline modal styles are gone. The card deck's
   cards.css loads after table.css (track-a0.md), so the faces in a dialog read the deck's rules. */

/* Wave 2 only: the old table (track D1) still stacks its bar at 250 and its overlays at 300, so dialogs sit above them until it is migrated; the toasts
   (1000 in base.css, wave 1) stay above dialogs. D1 or G deletes this block; the spec scale of base.css (drawer 60, dialog 80) then applies. */
:root { --z-dialog: 990; --z-drawer: 960; }

/* ---- Scrim and dialog ---- */
.scrim, .report-dialog-backdrop { position: fixed; inset: 0; z-index: var(--z-dialog); display: flex; align-items: center; justify-content: center; padding: var(--sp-4); background: var(--scrim); overscroll-behavior: contain; }
.scrim--drawer { justify-content: flex-end; padding: 0; z-index: var(--z-drawer); }   /* (the one scrim token, as every modal: the Settings drawer had none and Home stayed at full brightness behind it, fix round 3 m9) */
.scrim--drawer.scrim--through { background: transparent; }
.scrim--through { pointer-events: none; }
.scrim--through > .dialog { pointer-events: auto; }
.scrim--top { align-items: flex-start; padding-top: calc(var(--bar-h) + var(--moved-banner-h, 0px) + var(--sp-4)); overflow-y: auto; }
.dialog, .report-dialog-card {
  display: flex; flex-direction: column; width: min(100%, 35rem); max-height: min(100%, 44rem); min-height: 0; color: var(--text);
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-2xl); box-shadow: var(--e-3);
}
.scrim > .dialog { animation: dialog-in var(--dur) var(--ease-out); }
.dialog--sm { width: min(100%, 27.5rem); }
.dialog--lg { width: min(100%, 47.5rem); }
.dialog.drawer { width: min(26rem, 100%); max-height: none; height: 100%; border-width: 0 0 0 1px; border-radius: 0; background: var(--ink-0); animation-name: drawer-in; }
.dialog__head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); flex: none; padding: var(--sp-5) var(--sp-5) var(--sp-3); }
.dialog__title { min-width: 0; font: var(--t-title-2); overflow-wrap: anywhere; }
.dialog__close { margin: calc(var(--sp-2) * -1) calc(var(--sp-2) * -1) calc(var(--sp-2) * -1) 0; }
.dialog__sub { flex: none; padding: 0 var(--sp-5) var(--sp-3); }
.dialog__body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr); grid-auto-rows: min-content; align-content: start; gap: var(--sp-4); padding: var(--sp-2) var(--sp-5) var(--sp-5); overflow: auto; overscroll-behavior: contain; }
.dialog__body p { text-wrap: pretty; }
.dialog__foot:empty { display: none; }
.dialog__foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: var(--sp-3); flex: none; padding: var(--sp-4) var(--sp-5); border-top: 1px solid var(--hair); }
@keyframes dialog-in { from { opacity: 0; } }
@keyframes sheet-in { from { transform: translateY(100%); } }
@keyframes drawer-in { from { transform: translateX(100%); } }
/* Under 600 a dialog is a bottom sheet: full width, 92dvh at most, a grip, buttons side by side (a status card that lets clicks through stays under the bar). */
@media (max-width: 599.98px) {
  .scrim:not(.scrim--top, .scrim--through), .report-dialog-backdrop { align-items: flex-end; padding: 0; }
  .scrim:not(.scrim--top, .scrim--through) > .dialog, .report-dialog-card { width: 100%; max-height: 92dvh; border-width: 1px 0 0; border-radius: var(--r-2xl) var(--r-2xl) 0 0; animation-name: sheet-in; }
  .scrim:not(.scrim--top, .scrim--through) > .dialog::before { content: ""; flex: none; align-self: center; width: 2.25rem; height: 0.25rem; margin-top: var(--sp-2); border-radius: var(--r-full); background: var(--control-line); }
  /* The table's bar is two rows on a phone (56 and a 36 chip row): a card under it starts lower. */
  .scrim--top { padding-top: calc(var(--bar-h) + 2.5rem + var(--moved-banner-h, 0px) + var(--sp-2)); }
  .scrim--drawer { background: var(--scrim); }
  .dialog.drawer { height: auto; max-height: 92dvh; }
  /* The report, terms, and invite sheets (other tracks build them as .report-dialog-card, with 24 of padding) get the same grip. */
  .report-dialog-card::before { content: ""; flex: none; align-self: center; width: 2.25rem; height: 0.25rem; margin-top: calc(var(--sp-3) * -1); border-radius: var(--r-full); background: var(--control-line); }
  .dialog__foot { padding-bottom: calc(var(--sp-4) + var(--safe-b)); }
  .dialog__foot .btn { flex: 1; }
}
/* A small dialog's buttons share the row; one that wraps fills its row (a lone button keeps its own width). */
.dialog--sm .dialog__foot .btn:not(:only-child) { flex: 1 1 auto; }
/* The old name for a row of dialog buttons (the Learn dialog, the game-over card). */
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--sp-3); }
.dialog-actions.is-centered { justify-content: center; }
.dialog-actions .btn { min-height: var(--hit); }
.dialog-actions :is(.btn--lg, .btn-primary) { min-height: var(--hit-lg); }   /* the one primary of a screen is the large size (8.1): Play Again, Start Learning. The rule above is as strong, so it is said again here */
.waiting-note.is-dim, .is-dim { color: var(--text-dim); }
.is-note { font: var(--t-caption); color: var(--text-dim); }
.is-emphasis { color: var(--gold-strong); font-weight: 700; }

/* ---- Notices (P01 to P03): one sm dialog, centered in the frame ---- */
.notice-page { display: grid; place-items: center; flex: 1; min-height: 50dvh; padding: var(--sp-5) 0; }
.notice-dialog { animation: none; }
.notice-dialog .dialog__foot { flex-direction: column; align-items: stretch; }
.notice-wait { display: flex; align-items: center; gap: var(--sp-3); color: var(--text-dim); }
.notice-loading { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { .notice-loading { position: static; width: auto; height: auto; overflow: visible; clip: auto; } }

/* ---- Status dialogs (pause, away, misdeal, forfeit) and the spectate request ---- */
.status-dialog-body { gap: var(--sp-2); }
.status-hand { display: grid; margin-bottom: var(--sp-2); }
.status-dialog-card > .waiting-note { padding: 0 var(--sp-5) var(--sp-4); text-align: center; }
.spectate-stack { position: fixed; top: calc(var(--bar-h) + var(--moved-banner-h, 0px) + var(--sp-2)); right: var(--sp-2); z-index: var(--z-dialog); display: flex; flex-direction: column; gap: var(--sp-2); width: 20rem; max-width: calc(100% - var(--sp-4)); pointer-events: none; }
@media (max-width: 599.98px) { .spectate-stack { top: calc(var(--bar-h) + 2.5rem + var(--moved-banner-h, 0px) + var(--sp-2)); } }
.spectate-request-panel { pointer-events: auto; display: grid; gap: var(--sp-3); padding: var(--sp-4); background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--e-2); }
.spectate-title { font: var(--t-label); }
.spectate-actions { display: flex; align-items: center; gap: var(--sp-2); }
.spectate-allow { background: var(--gold-wash); border-color: var(--gold-line); color: var(--gold-strong); }
.spectate-dismiss { margin-left: auto; }

/* ---- The skin of dialogs another track builds: the report, the invite list, the public-table terms (D18, D10, D07), and the moved dialog (D13) ---- */
.report-dialog-card { padding: var(--sp-5); gap: var(--sp-3); width: min(100%, 27.5rem); overflow: auto; }
.report-dialog-card.invite-dialog, .report-dialog-card.terms-card { width: min(100%, 35rem); }
.report-dialog-title { font: var(--t-title-2); }
.report-dialog-text { font: var(--t-small); color: var(--text); }
.report-dialog-text ul { padding-left: 1.2em; display: grid; gap: var(--sp-2); margin: var(--sp-2) 0; }
.report-dialog-actions { position: sticky; bottom: calc(var(--sp-5) * -1); display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--sp-3); margin: var(--sp-1) calc(var(--sp-5) * -1) calc(var(--sp-5) * -1); padding: var(--sp-3) var(--sp-5) var(--sp-5); background: var(--panel); border-top: 1px solid var(--hair); }   /* pinned to the foot of the card's own scroll: the primary is in the window on arrival even when the words are taller than a phone (AC-39) */
.report-support-link { color: var(--gold-strong); text-decoration: underline; text-underline-offset: 0.2em; overflow-wrap: anywhere; }
.moved-dialog-backdrop { position: fixed; inset: 0; z-index: var(--z-banner); display: flex; align-items: center; justify-content: center; padding: calc(var(--sp-4) + env(safe-area-inset-top, 0px)) calc(var(--sp-4) + env(safe-area-inset-right, 0px)) calc(var(--sp-4) + env(safe-area-inset-bottom, 0px)) calc(var(--sp-4) + env(safe-area-inset-left, 0px)); background: var(--scrim); }
.moved-dialog { width: 100%; max-width: 27.5rem; display: flex; flex-direction: column; gap: var(--sp-3); padding: var(--sp-5) var(--sp-4) var(--sp-4); border-radius: var(--r-2xl); background: var(--panel); border: 1px solid var(--line); box-shadow: var(--e-3); color: var(--text); }
.moved-dialog:focus { outline: none; }
.moved-dialog-title { font: var(--t-title-3); }
.moved-dialog-text { font: var(--t-small); color: var(--text); }
.moved-dialog-actions { display: flex; flex-direction: column; gap: var(--sp-2); margin-top: var(--sp-2); }
.moved-dialog .btn { min-height: var(--hit); width: 100%; }

/* ---- Meld Chart ---- */
.meld-chart-sub { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); font: var(--t-small); color: var(--text-dim); }
.meld-chart-group h3 { margin-bottom: var(--sp-1); color: var(--gold-strong); font: var(--t-eyebrow); letter-spacing: 0.08em; text-transform: uppercase; }
.meld-chart-note { margin-bottom: var(--sp-2); font: var(--t-caption); color: var(--text-dim); }
.meld-chart-table { width: 100%; table-layout: fixed; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.meld-chart-table thead th { padding: 0 var(--sp-2) var(--sp-1); text-align: right; font: var(--t-eyebrow); color: var(--text-dim); text-transform: uppercase; }
.meld-chart-table thead th:first-child { width: 46%; }
@media (max-width: 599.98px) { .meld-chart-table thead th:first-child { width: 34%; } .meld-chart-table thead th { padding-inline: var(--sp-1); } }
.meld-chart-table tbody th { padding: var(--sp-2) var(--sp-2) var(--sp-2) 0; text-align: left; }
.meld-chart-table tbody td { padding: var(--sp-2); text-align: right; font: var(--t-small); }
.meld-chart-table tbody tr + tr > * { border-top: 1px solid var(--hair); }
.meld-chart-table td.mc-single { color: var(--gold-strong); font-size: max(1.0625rem, 12px); font-weight: 700; }
.mc-name { font: var(--t-small); font-weight: 600; }
.mc-detail { font: var(--t-caption); font-weight: 400; color: var(--text-dim); }
.mc-cards { display: flex; flex-wrap: wrap; gap: var(--sp-1); margin-top: var(--sp-1); }
.mc-chip { display: inline-flex; align-items: center; gap: 0.125rem; min-width: 1.625rem; height: 1.375rem; padding: 0 var(--sp-1); border-radius: var(--r-xs); background: var(--paper); color: var(--suit-black); font-size: max(0.75rem, 12px); font-weight: 700; line-height: 1; }
.mc-chip.suit-H, .mc-chip.suit-D { color: var(--suit-red); }
.mc-chip.is-trump { outline: 2px solid var(--gold); outline-offset: -1px; }
body.four-color-deck .mc-chip.suit-D { color: var(--suit-4c-d, var(--suit-red)); }
body.four-color-deck .mc-chip.suit-C { color: var(--suit-4c-c, var(--suit-black)); }
.meld-chart-notes { padding: var(--sp-3) var(--sp-4) var(--sp-3) var(--sp-6); border-radius: var(--r-lg); background: var(--panel-2); font: var(--t-caption); color: var(--text-dim); display: grid; gap: var(--sp-1); }
.meld-chart-link { display: block; margin: var(--sp-2) auto 0; }

/* ---- Send Feedback, Game Saved, Change Your Name ---- */
.feedback-sub, .save-code-sub { font: var(--t-small); color: var(--text-dim); }
.feedback-kinds.seg { display: flex; flex-wrap: wrap; }
.feedback-kind { flex: 1 1 auto; }
.feedback-text { min-height: 7rem; padding: var(--sp-3) var(--sp-4); resize: vertical; }
.feedback-count { font: var(--t-caption); color: var(--text-dim); text-align: right; }
.feedback-count:not(:empty) { margin-top: var(--sp-1); }
.feedback-count.is-over { color: var(--bad); text-align: left; font-weight: 600; }
.feedback-reason { flex: 1 0 100%; font: var(--t-caption); color: var(--text-dim); text-align: right; }
.feedback-reason[hidden] { display: none; }
/* Both lines are live regions that stay in the page; empty, they take no room (the row they sit in gives its gap back). */
.feedback-status { font: var(--t-small); color: var(--text-dim); }
.feedback-status:empty { margin-top: calc(var(--sp-4) * -1); }
.feedback-status.is-error { display: flex; align-items: flex-start; gap: var(--sp-2); color: var(--bad); }
.save-code-input { text-align: center; }
.save-name-row { display: flex; gap: var(--sp-2); }
.save-name-row .input { flex: 1; min-width: 0; }
.rename-modal .field__error[hidden] { display: none; }

/* ---- Rules & Strategy, Your Stats, Keyboard Shortcuts ---- */
.dialog__sub .seg { display: flex; width: 100%; }
.dialog__sub .seg__item { flex: 1 1 auto; }   /* (auto, not 0: at Larger Text the three Rules tabs wrap to a second row instead of squeezing their words into each other, fix round 2 M1) */
.rules-content { line-height: 1.45; }
.rules-card { overflow: hidden; padding: 0; border: 1px solid var(--hair); border-radius: var(--r-2xl); background: var(--panel-2); }
.rules-card > .coach-picture { margin: 0; min-height: 6rem; }
.rules-card .coach-tag { font-size: max(0.75rem, 12px); }   /* coach.css (track D2) shrinks the tag to 11 px on a short window; the floor is 12 (AC-02) */
.rules-card-body { display: grid; gap: var(--sp-2); padding: var(--sp-3) var(--sp-4) var(--sp-4); }
.rules-num { color: var(--gold-strong); font: var(--t-eyebrow); letter-spacing: 0.09em; }
.rules-content h3 { font: var(--t-title-3); }
.rules-content ul { display: grid; gap: var(--sp-1); padding-left: 1.1em; }
.rules-section.rules-strategy { display: grid; gap: var(--sp-2); padding-top: var(--sp-4); border-top: 1px solid var(--hair); }
.rules-footer { font: var(--t-small); font-style: italic; color: var(--text-dim); }
.rules-links { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.rules-links .btn { max-width: 100%; white-space: normal; text-align: center; }   /* (a long label wraps inside its button at Larger Text, fix round 2 M1) */
.stats-group h3 { margin-bottom: var(--sp-1); }
.stats-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.stats-table th, .stats-table td { padding: var(--sp-2) 0; }
.stats-table th { text-align: left; font: var(--t-small); color: var(--text-dim); }
.stats-table td { text-align: right; font-size: max(1.0625rem, 12px); }
.stats-table tr + tr > * { border-top: 1px solid var(--hair); }
.stats-empty { font: var(--t-small); color: var(--text-dim); }
.shortcuts-group h3 { margin-bottom: var(--sp-2); font: var(--t-eyebrow); letter-spacing: 0.08em; text-transform: uppercase; color: var(--gold-strong); }
.shortcuts-group dl { display: grid; grid-template-columns: 10.75rem 1fr; align-items: center; gap: var(--sp-2) var(--sp-4); }
@media (max-width: 599.98px) { .shortcuts-group dl { grid-template-columns: max-content 1fr; } }
.shortcuts-group dt { display: flex; flex-wrap: wrap; gap: var(--sp-1); }
.shortcuts-group dd { font: var(--t-small); }
.shortcuts-sheet kbd { display: inline-flex; }
.shortcuts-note { font: var(--t-caption); color: var(--text-dim); }

/* ---- Hand review and Share Hand: real mini faces (the deck's own cards, 3.1 rem wide) ---- */
.mini-face { display: inline-block; flex: none; width: 3.1rem; height: 4.34rem; }
.mini-face .card { --card-width: 3.1rem; --card-height: 4.34rem; }
.review-cards { display: flex; flex-wrap: wrap; gap: var(--sp-1); }
.review-who { display: flex; align-items: center; gap: var(--sp-2); margin-bottom: var(--sp-1); font: var(--t-label); }
.review-hand + .review-hand, .review-meld-seat + .review-meld-seat { margin-top: var(--sp-4); }
.review-combo { display: grid; gap: var(--sp-1); margin-top: var(--sp-2); }
.review-combo-name { font: var(--t-small); }
.review-combo-head { display: flex; align-items: baseline; gap: var(--sp-2); }
.review-combo-score { color: var(--gold-strong); font-weight: 700; }
.review-list { display: grid; gap: var(--sp-2); list-style: none; }
.review-trick li { display: flex; align-items: center; gap: var(--sp-3); }
.review-trick .review-who { min-width: 6rem; margin: 0; }
.review-took { color: var(--good); }
.review-step-head { display: flex; align-items: baseline; justify-content: space-between; }
.review-step-count { color: var(--text-dim); font: var(--t-small); }
.review-slider { width: 100%; height: var(--hit); accent-color: var(--gold); }
.review-modal .dialog { height: min(100%, 44rem); }
.review-modal .dialog__body { display: flex; flex-direction: column; gap: var(--sp-3); overflow: hidden; }
.review-step-body { flex: 1; min-height: 9rem; padding: var(--sp-1); overflow: auto; overscroll-behavior: contain; }
.review-actions .review-share { margin-right: auto; }
.share-hand-stage { display: flex; justify-content: center; min-height: 6rem; }
.share-hand-picture { display: block; width: 100%; max-width: min(20rem, 42dvh); height: auto; aspect-ratio: 4 / 5; border-radius: var(--r-lg); box-shadow: var(--e-2); }
.share-hand-picture--tall { max-width: min(20rem, 100%); aspect-ratio: 9 / 16; }
.share-hand-making { display: flex; align-items: center; gap: var(--sp-3); align-self: center; color: var(--text-dim); }
.share-hand-making.is-error { color: var(--bad); }
.share-hand-text, .share-hand-caption { text-align: center; }
.share-hand-actions { justify-content: center; }

/* ---- Settings (a right drawer; a bottom sheet under 600) ---- */
.settings-sheet .dialog__body { gap: var(--sp-5); }
.settings-group { display: grid; gap: var(--sp-2); }
.settings-group h3 { padding: 0 var(--sp-1); font: var(--t-eyebrow); letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-dim); }
.settings-list { border: 1px solid var(--hair); border-radius: var(--r-xl); background: var(--panel); }
.settings-list > * + *, .settings-list > .settings-row + .settings-row { border-top: 1px solid var(--hair); }   /* (.settings-row says border: 0 below it: the second selector is as strong, fix round 3 m9) */
.settings-list > :first-child { border-top-left-radius: var(--r-xl); border-top-right-radius: var(--r-xl); }
.settings-list > :last-child { border-bottom-left-radius: var(--r-xl); border-bottom-right-radius: var(--r-xl); }
.settings-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-3); width: 100%; min-height: 3.25rem; padding: var(--sp-2) var(--sp-4); border: 0; background: transparent; color: var(--text); font: var(--t-body); text-align: left; text-decoration: none; }
.settings-sheet .settings-row { min-height: 3.5rem; }
button.settings-row, a.settings-row { cursor: pointer; }
@media (hover: hover) and (pointer: fine) { button.settings-row:hover, a.settings-row:hover { background: var(--wash-hover); } }
.settings-text { display: flex; flex-direction: column; gap: 0.125rem; flex: 1; min-width: 0; }
.settings-label { font: var(--t-label); }
.settings-caption { font: var(--t-caption); color: var(--text-dim); }
.settings-caption:empty { display: none; }
.settings-value { min-width: 0; max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-dim); font: var(--t-small); }
.settings-value.is-wrap { overflow: visible; white-space: normal; text-align: right; }
.settings-state { min-width: 1.5rem; text-align: right; font: var(--t-caption); color: var(--text-dim); }
.settings-toggle { position: relative; flex: none; width: var(--hit); height: 1.625rem; border-radius: var(--r-full); background: var(--panel); border: 1px solid var(--control-line); transition: background-color var(--dur-fast); }
.settings-thumb { position: absolute; top: 0.1875rem; left: 0.1875rem; width: 1.125rem; height: 1.125rem; border-radius: 50%; background: var(--text-dim); transition: translate var(--dur-fast) var(--ease-out); }
.settings-switch[aria-checked="true"] .settings-toggle { background: var(--gold); border-color: var(--gold); }
.settings-switch[aria-checked="true"] .settings-thumb { background: var(--ink-on-gold); translate: 1.125rem 0; }
.settings-switch:disabled { cursor: default; }
.settings-switch:disabled .settings-label { color: var(--text-faint); }
/* A segmented control of Settings: the rows of the lobby's options (another track's builder) use the same markup. */
.settings-seg { display: inline-flex; flex: none; flex-wrap: wrap; max-width: 100%; gap: 0.1875rem; padding: 0.1875rem; border: 1px solid var(--control-line); border-radius: var(--r-lg); background: var(--panel); }
.settings-seg > button { min-height: var(--hit-sm); padding: 0 var(--sp-3); border: 1px solid transparent; border-radius: var(--r-md); background: transparent; color: var(--text-dim); font-size: max(0.875rem, 12px); font-weight: 600; cursor: pointer; }
.settings-seg > button.is-on, .settings-seg > button[aria-checked="true"] { background: var(--gold-wash); border-color: var(--gold-line); color: var(--gold-strong); }
@media (any-pointer: coarse) { .settings-seg > button { min-height: var(--hit); } }
.settings-acts { display: flex; gap: var(--sp-2); }
.settings-note { padding: 0 var(--sp-1); font: var(--t-caption); color: var(--text-dim); }
.settings-empty { padding: var(--sp-3) var(--sp-4); font: var(--t-small); color: var(--text-dim); }
.settings-danger .settings-label { color: var(--bad); }
.friend-code { font-family: var(--font-mono); font-size: max(1rem, 12px); font-weight: 700; letter-spacing: 0.12em; }
.blocked-list { display: grid; }
.blocked-list .panel-hint { padding: var(--sp-3) var(--sp-4); font: var(--t-small); color: var(--text-dim); }
.blocked-list .public-row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); min-height: 3.5rem; padding: var(--sp-2) var(--sp-4); }
.blocked-list .public-row .btn { min-height: var(--hit); }
.terms-card ul { padding-left: 1.2em; }

/* ---- Avatar picker: chips for the groups, a wrapping grid that scrolls ---- */
.avatar-body { display: flex; flex-direction: column; gap: var(--sp-3); overflow: hidden; }
.avatar-tabs { display: flex; flex-wrap: wrap; flex: none; gap: var(--sp-2); }
.avatar-grid { display: grid; flex: 1; min-height: 0; align-content: start; grid-template-columns: repeat(auto-fill, minmax(3rem, 1fr)); gap: var(--sp-2); padding: var(--sp-1); overflow: auto; overscroll-behavior: contain; }
.avatar-cell { min-width: var(--hit); min-height: var(--hit); border: 1px solid transparent; border-radius: var(--r-lg); background: var(--panel-2); font-size: max(1.5rem, 12px); line-height: 1; cursor: pointer; }
.avatar-cell.is-on { border-color: var(--gold-line); background: var(--gold-wash); }
@media (hover: hover) and (pointer: fine) { .avatar-cell:hover { background: var(--wash-press); } }
.avatar-btn { margin-top: var(--sp-2); }

/* ---- Learn to Play (the builder is track B's, the skin is here) ---- */
.learn-content { overflow: hidden; padding: 0; background: var(--panel); }   /* (the words scroll in .learn-body and the buttons stand under it: Start Learning is in view on arrival, fix round 3 M2) */
.learn-body { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; padding: var(--sp-5) var(--sp-5) var(--sp-3); }   /* (the fan's rotated card tips are a few px wider than its box: they are clipped, not scrolled to) */
.learn-body > * { flex: none; width: min(100%, 34rem); }   /* flex: none: the fan is drawn with absolute cards, so a shrinking column squeezed its box to 0 px and cut the cards at the top (M2) */
.learn-content > .dialog-actions { flex: none; padding: var(--sp-4) var(--sp-5); border-top: 1px solid var(--hair); }
.learn-fan { --cw: min(4rem, 16vw); margin: var(--sp-1) auto var(--sp-4); background: radial-gradient(ellipse 50% 50% at 50% 50%, var(--felt), transparent); }
.learn-title { margin: var(--sp-2) 0 var(--sp-1); text-align: center; font: var(--t-title-1); color: var(--text); }
.learn-sub { margin: 0 0 var(--sp-4); padding-inline: var(--sp-2); text-align: center; color: var(--text-dim); font: var(--t-small); }
.learn-chapters { list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 6rem), 1fr)); gap: var(--sp-2) var(--sp-4); margin: 0 0 var(--sp-4); padding-inline: var(--sp-1); }   /* (three to a row when the words fit, fewer when the text is large: "Scoring" is 98 px at a 28 px root; padding, not side margins, so the list does not overflow its 100 percent width, fix round 2 M1) */
.learn-chapters li { display: flex; align-items: baseline; gap: var(--sp-2); }
.learn-chapters b { color: var(--gold-strong); font: var(--t-small); font-variant-numeric: tabular-nums; }
.learn-chapters span { font: var(--t-label); }
.learn-label { margin: 0 var(--sp-1) var(--sp-2); color: var(--text-dim); font: var(--t-eyebrow); letter-spacing: 0.09em; text-transform: uppercase; }
.learn-choices { display: flex; flex-direction: column; gap: var(--sp-2); margin-bottom: var(--sp-4); }
.learn-choice { display: flex; flex-direction: column; align-items: flex-start; gap: 0.125rem; min-height: var(--hit); padding: var(--sp-3) var(--sp-4); border: 1px solid var(--control-line); border-radius: var(--r-lg); background: var(--panel-2); color: var(--text); font: var(--t-body); text-align: left; cursor: pointer; }
.learn-choice span { color: var(--text-dim); font: var(--t-caption); }
.learn-choice.is-on { border-color: var(--gold); background: var(--gold-wash); }   /* the chosen card's edge is 3:1 against the dialog (--gold-line was 2.8:1: AC-05) */
.learn-choice.is-on span { color: var(--text); }
.learn-choices .learn-choice.is-under { flex-direction: row; align-items: center; gap: var(--sp-3); }
.learn-choices .learn-under { font-style: normal; color: var(--text-dim); font-size: max(1.1rem, 12px); line-height: 1; }
.learn-choices .learn-choice-text { display: flex; flex-direction: column; gap: 0.125rem; color: var(--text); font: var(--t-body); }
.learn-foot { margin-top: var(--sp-3); text-align: center; color: var(--text-dim); font: var(--t-caption); }
@media (max-width: 599.98px) { .learn-content > .dialog-actions { padding-bottom: calc(var(--sp-4) + var(--safe-b)); } .learn-content > .dialog-actions .btn { flex: 1; } .learn-fan { transform: scale(0.8); transform-origin: 50% 100%; margin: 0 auto var(--sp-2); } .learn-title { font-size: max(1.7rem, 12px); } }

/* Where the page has no frame (the table), base.css still draws the old gold ring on everything; a dialog's controls get the one ring (8.1, 11, AC-28):
   --gold-strong, with the 1 px offset on a text field. The primary keeps its own on-gold ring (base.css). */
:is(.scrim, .report-dialog-backdrop, .moved-dialog-backdrop, .spectate-stack) :focus-visible:not(.btn--primary) { outline-color: var(--gold-strong); }
:is(.scrim, .report-dialog-backdrop, .moved-dialog-backdrop, .spectate-stack) :is(input, textarea, select):focus-visible { outline-offset: 1px; }

/* A dialog opened with a click or a tap puts focus on its first control without a ring (R-078). Keep this rule last. */
.is-quiet-focus:focus-visible { outline: none; }

/* Build 32, ported from master's components.css, lobby.css, and coach.css (the redesign has no file by those names) */
.learn-choice .learn-source { margin-top: var(--sp-2); color: var(--text-dim); font: italic var(--t-caption); }
.rules-content .rules-glossary { margin: var(--sp-2) 0 var(--sp-3); }
.rules-content .rules-glossary summary { cursor: pointer; color: var(--gold-strong); font-weight: 600; }
.rules-content .rules-glossary dt { margin-top: var(--sp-2); font-weight: 700; }
.rules-content .rules-glossary dd { margin: var(--sp-1) 0 0; }
.rules-content .rules-strategy h5 { margin: var(--sp-4) 0 var(--sp-1); color: var(--gold-strong); font: var(--t-eyebrow); letter-spacing: 0.06em; text-transform: uppercase; }
.rules-set-caption { margin: var(--sp-1) 0 var(--sp-3); line-height: 1.4; text-align: left; }
.rules-set-caption p { margin: 0 0 var(--sp-2); }
.rules-set-caption .rules-set-source { margin-bottom: 0; font-style: italic; }
.rules-content .rules-set-picker { display: flex; align-self: stretch; width: 100%; box-sizing: border-box; }
.rules-content .rules-set-picker button { flex: 1 1 auto; }   /* (auto basis: the three tabs wrap at Larger Text, fix round 2 M1) */
.settings-row.settings-stack { flex-direction: column; align-items: stretch; gap: var(--sp-2); }
.settings-row.settings-legal { justify-content: flex-start; flex-wrap: wrap; gap: 0 var(--sp-5); }
.settings-row.settings-legal a { display: inline-flex; align-items: center; min-height: var(--hit); color: var(--gold-strong); font: var(--t-small); }
/* Initials: a colored circle, letters from the name. Colors are inline, from server/avatars.js (4.5 to 1 or better). */
.is-initials { font-weight: 800; letter-spacing: 0; line-height: 1; text-transform: none; }
.is-initials .initials-letters[data-letters="2"] { font-size: 0.78em; }
.initials-dot { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; font-size: max(1.05rem, 12px); }
.avatar-cell-initials { display: grid; place-items: center; }
.avatar-inline { display: inline-grid; place-items: center; min-width: 1.6em; height: 1.6em; border-radius: 50%; vertical-align: middle; font-size: 0.9em; }
.avatar-inline.is-initials { padding: 0 0.2em; }
.robot-mark { display: block; width: 82%; height: 82%; margin: auto; object-fit: contain; }
/* Facts: the History and Trivia page */
.trivia-content { max-width: 32.5rem; }
.trivia-card { min-height: 9.5rem; margin: var(--sp-1) 0 var(--sp-3); padding: var(--sp-4); border-radius: var(--r-xl); background: var(--panel-2); border: 1px solid var(--gold-line); }
.trivia-position { margin: 0 0 var(--sp-2); color: var(--gold-strong); font: var(--t-eyebrow); letter-spacing: 0.08em; text-transform: uppercase; }
.trivia-fact { margin: 0; color: var(--text); font: var(--t-lead); font-family: var(--font-serif); }
.trivia-steps { margin-bottom: var(--sp-3); }
.trivia-steps .btn { flex: 1; }
.trivia-all-title { margin: 0 0 var(--sp-2); color: var(--text-dim); font: var(--t-eyebrow); letter-spacing: 0.08em; text-transform: uppercase; }
.trivia-list { margin: 0; padding: 0; list-style: none; }
.trivia-list li { border-top: 1px solid var(--hair); }
.trivia-num { display: inline-block; min-width: 2.2em; padding-inline-end: 0.5em; text-align: end; color: var(--text-dim); font: var(--t-caption); font-weight: 700; font-variant-numeric: tabular-nums; }
.trivia-item { display: block; width: 100%; min-height: var(--hit); padding: var(--sp-2) var(--sp-1); background: none; border: 0; color: var(--text); opacity: 0.85; font: var(--t-small); text-align: start; cursor: pointer; }
.trivia-item.is-on { opacity: 1; color: var(--gold-strong); }
.trivia-link { margin-top: var(--sp-3); }
