/* =============================================================================
   shell.css — Arena app shell (B173): top bar, page frame, panel, tabs,
   buttons-as-actions. Loaded AFTER lobby-zen.css / room-zen.css, which still
   own the screen-specific layout; this file replaces their "Zen" chrome
   (bare text bar, 640px column, text-link actions) with the platform look from
   client/platform-arena-mockup.html. Colours/radius come from css/tokens.css,
   so every rule here is mode-aware. Board/stones are untouched.
   ============================================================================= */

/* ── Top bar (lobby + room) ─────────────────────────────────────────────── */
body.zen-lobby .topnav,
body.zen-room .topnav {
  background: var(--c-surface);
  border: none;
  border-bottom: 1px solid var(--c-border);
}
body.zen-lobby .topnav {
  position: sticky;
  top: 0;
  z-index: 40;
  height: 56px;
  max-width: none;
  margin: 0;
  padding: 0 24px;
}
body.zen-lobby .topnav__logo,
body.zen-room .topnav__logo { opacity: 1; border-radius: var(--radius); }
:root[data-mode="dark"] .topnav__logo { filter: invert(1); }
body.zen-lobby .topnav__title,
body.zen-room .topnav__title { color: var(--c-ink); font-weight: 700; font-size: calc(14px * var(--fs-scale, 1)); }
body.zen-lobby .topnav__user,
body.zen-lobby .topnav__online,
body.zen-room .topnav__user { color: var(--c-ink-2); }
body.zen-lobby .topnav__btn,
body.zen-room .topnav__btn { border-radius: var(--radius); padding: 8px; }
body.zen-lobby .topnav__btn:hover,
body.zen-room .topnav__btn:hover { background: var(--c-fill); }
/* TODO #184: the zen-room phone bar is 28px (--zen-topnav-h, #144). 8px padding
   made the leave/gear buttons 32/36px, overflowing the bar and the viewport top.
   Back to room-zen.css's 4px there (24/28px boxes). */
@media (max-width: 768px) {
  body.zen-room .topnav__btn { padding: 4px; }
}

/* ── Top bar on every other page (history, tournament, tournament-match) ──
   Same bar as lobby/room; those two keep their own, more specific rules above. */
.topnav {
  position: sticky;
  top: 0;
  height: 56px;
  max-width: none;
  margin: 0 0 24px;
  padding: 0 24px;
  background: var(--c-surface);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: none;
  border-bottom: 1px solid var(--c-border);
  border-radius: 0;
  box-shadow: none;
}
.topnav__logo { width: 20px; height: 20px; border-radius: var(--radius); }
.topnav__title { font-size: calc(14px * var(--fs-scale, 1)); font-weight: 700; letter-spacing: 0; }
/* Typographic wordmark, same as .pnav__brand (no icon mark); stays visible on phones since there is no logo to fall back on. */
body .topnav .topnav__title { display: inline; font-size: calc(23px * var(--fs-scale, 1)); font-weight: 600; letter-spacing: -0.02em; line-height: 1; }
.topnav__title b { font-weight: 600; color: var(--c-brand-text); }
@media (max-width: 600px) { body .topnav .topnav__title { font-size: calc(19px * var(--fs-scale, 1)); } }
.topnav__user { font-size: calc(12.5px * var(--fs-scale, 1)); font-weight: 500; }
.topnav__badge {
  padding: 0;
  background: none;
  border: none;
  font-size: calc(14px * var(--fs-scale, 1));
  font-weight: 600;
  letter-spacing: 0;
  text-transform: lowercase;
  color: var(--c-ink-3);
}
.topnav__btn {
  padding: 8px;
  background: none;
  border: none;
  border-radius: var(--radius);
  box-shadow: none;
  font-size: calc(14px * var(--fs-scale, 1));
  font-weight: 600;
}
.topnav__btn:hover { background: var(--c-fill); transform: none; box-shadow: none; }
@media (max-width: 860px) { .topnav { padding: 0 14px; margin-bottom: 16px; } }

/* ── Lobby page frame ───────────────────────────────────────────────────── */
body.zen-lobby { --zen-col: 1180px; }   /* = .papp on the platform pages (B193) */
body.zen-lobby .lobby { padding: 28px 24px 80px; }
body.zen-lobby .zen-hero { margin-bottom: 20px; }
body.zen-lobby .zen-hero__eyebrow { display: none; }
body.zen-lobby .zen-hero__title { font-family: var(--font-display); font-size: var(--text-xl); font-weight: 700; letter-spacing: 0; line-height: 1.3; }   /* #292: hero 24-28 > stat 20 > label 14 */

/* Panels: the tab body is one card. */
body.zen-lobby .tab-panel {
  background: var(--c-surface);
  border-radius: var(--radius-lg);
  padding: 20px;
}
:root[data-mode="light"] body.zen-lobby .tab-panel { box-shadow: var(--shadow); }

/* Tabs: underline in the accent colour. */
body.zen-lobby .section-tabs { gap: 24px; margin: 0 0 20px; }
body.zen-lobby .section-tabs__btn {
  padding: 6px 0;
  min-height: 36px;
  border-bottom: 2px solid transparent;
  font-size: var(--text-sm);
}
body.zen-lobby .section-tabs__btn.is-active { border-bottom: 2px solid var(--c-brand); color: var(--c-ink); }

/* Section actions: primary action is a filled button, the rest ghost buttons. */
body.zen-lobby .section-actions { gap: 10px; margin-bottom: 16px; justify-content: flex-end; }
body.zen-lobby .link-action {
  padding: 8px 14px;
  border-radius: var(--radius);
  background: var(--c-fill);
  color: var(--c-ink);
  min-height: 38px;
}
body.zen-lobby .link-action:hover { background: var(--c-border); color: var(--c-ink); }
body.zen-lobby .link-action--primary { background: var(--c-brand); color: var(--c-on-brand); }
body.zen-lobby .link-action--primary:hover { background: var(--c-brand-dark); color: var(--c-on-brand); opacity: 1; }

/* Rows (Arena .row): flat on the page, hairline between, text action. */
body.zen-lobby .room-row { padding: 14px 0; border-radius: 0; }   /* flush with the tabs on the left and the toolbar buttons on the right */
body.zen-lobby .room-row:hover { background: var(--c-hover); }
body.zen-lobby .room-row__bullet { background: var(--c-brand-text); }          /* open seat */
body.zen-lobby .room-row__bullet--ready { background: transparent; border: 1.5px solid var(--c-brand-text); }
body.zen-lobby .room-row__bullet--playing { background: var(--c-warning); border: 0; }
/* The ticket is the control (no Vào/Quan sát button): whole row clickable, keyboard-focusable. */
body.zen-lobby .room-row { cursor: pointer; }
body.zen-lobby .room-row:focus-visible { outline: 2px solid var(--c-brand-text); outline-offset: -2px; }

/* Ticket title = both players, avatar + name, on their own line above the tags. */
body.zen-lobby .room-row__name { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
body.zen-lobby .rplayer { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
body.zen-lobby .rplayer__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 14ch; }
body.zen-lobby .rplayer--empty { display: inline-flex; align-items: center; gap: 8px; color: var(--c-ink-3); font-weight: 400; font-size: var(--text-sm); }
body.zen-lobby .rvs { font-size: var(--text-xs); font-weight: 400; text-transform: none; letter-spacing: .02em; color: var(--c-ink-3); }
body.zen-lobby .pav--xs { width: 24px; height: 24px; font-size: calc(9px * var(--fs-scale, 1)); }
body.zen-lobby .rplayer--empty::before { content: ""; width: 24px; height: 24px; border-radius: 50%; box-sizing: border-box; border: 1px dashed var(--c-border); }

/* Meta line = host as plain text + tag chips (B219 follow-up); wraps instead of truncating. */
body.zen-lobby .room-row__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; white-space: normal; overflow: visible; }
body.zen-lobby .room-row__host { margin-right: 4px; font-size: var(--text-xs); color: var(--c-ink-2); }
body.zen-lobby .rtag { padding: 2px 8px; border-radius: var(--radius); background: var(--c-fill); color: var(--c-ink-2); font-size: var(--text-xs); line-height: 1.5; white-space: nowrap; font-variant-numeric: tabular-nums; }
body.zen-lobby .rtag--rated { background: color-mix(in srgb, var(--c-brand) 18%, transparent); color: var(--c-brand-text); }
body.zen-lobby .rtag--friendly { background: transparent; box-shadow: inset 0 0 0 1px var(--c-border); }

/* Rooms screen (Arena): no card — tabs + actions bar, then the flat list. */
body.zen-lobby #panel-tables { background: none; padding: 0; box-shadow: none; }
body.zen-lobby .room-bar { margin-bottom: 8px; }
body.zen-lobby .room-bar .lobby-bar__actions { flex-wrap: wrap; }

@media (max-width: 860px) {
  body.zen-lobby .topnav { padding: 0 14px; }
  body.zen-lobby .lobby { padding: 16px 12px 80px; }
  body.zen-lobby .tab-panel { padding: 14px; }
  body.zen-lobby #panel-tables { padding: 0; }
  body.zen-lobby .room-row { padding: 12px 0; }
}

/* ── Shared components: Arena radius (pills → 5px) on every page ───────── */
body .btn, body .btn-create, body .btn-secondary, body .btn-join,
body .modal__actions .btn, body .modal__quick, body .gset-btn,
body .state-badge, body .rule-chip, body .lobby__count, body .toast,
body .pill-group, body .pill-group label,
body .gset-segment, body .gset-segment__opt { border-radius: var(--radius); }

/* ── Site links in the top bar (room) — same row as the platform pages' .pnav__links (#190).
   The room hides them ([hidden], set by room-ui.js) while you're seated in an ongoing game (#191 item 6). */
.topnav__links { display: flex; gap: 4px; flex: 1; margin-left: 20px; }
.topnav__links[hidden] { display: none; }
.topnav__links a { padding: 8px 12px; border-radius: var(--radius); font-size: calc(13.5px * var(--fs-scale, 1)); font-weight: 500; color: var(--c-ink-3); text-decoration: none; }
.topnav__links a:hover { color: var(--c-ink); }
.topnav__links a.is-active { background: var(--c-fill); color: var(--c-strong); font-weight: 700; }
@media (max-width: 860px) { .topnav__links { display: none; } }

/* ── Lobby on the site-wide Arena shell (B193, B195) ────────────────────────
   Same 1180px frame as rankings/profile/clubs (.papp); hero row = the mockup's
   .bar: sentence left, the active screen's create action right. */
body.zen-lobby .lobby-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
body.zen-lobby .lobby-bar__actions { display: flex; align-items: center; gap: 10px; }
body.zen-lobby .lobby-bar__actions .link-action { font-size: var(--text-sm); font-weight: 600; }
/* .link-action's display:inline-flex beats the bare [hidden] attribute. */
body.zen-lobby .lobby-bar__actions [hidden] { display: none; }

/* ── "Chơi" dashboard (B195) — platform.css .psplit/.ppanel/.prow + these ── */
/* Ticket: raised surface, 4px-scale padding, 8px gap between tickets; title > meta > action hierarchy. */
body.zen-lobby .prows, body.zen-lobby .hlives { gap: var(--card-gap); }
body.zen-lobby .hrow { width: 100%; box-sizing: border-box; text-align: left; font: inherit; color: inherit; cursor: pointer; gap: 16px; padding: var(--card-pad); border: 0; border-radius: var(--card-radius); background: var(--c-surface-2); }
body.zen-lobby .hrow:hover { background: var(--c-hover); }
body.zen-lobby .hrow .prow__t { font-weight: 600; line-height: 1.35; }
body.zen-lobby .hrow__meta { display: flex; flex-wrap: wrap; gap: 2px 12px; margin-top: 4px; }
body.zen-lobby .hrow .prow__act { padding: 3px 12px; border-radius: var(--radius); }
body.zen-lobby .hrow:hover .prow__act { color: var(--c-ink); }
body.zen-lobby .hbullet { flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--c-ink-3); }
body.zen-lobby .hbullet.on { background: var(--c-brand); }
/* #289 + #295: every navigational "view" action in a lobby card is one quiet outline — empty-state buttons, the forum link, the row's action pill; the quick-match CTA is the only filled button. */
body.zen-lobby :is(.hempty .link-action, .hmore), body.zen-lobby .hrow .prow__act { border-radius: var(--radius-pill); border: 1px solid color-mix(in srgb, var(--c-ink-2) 75%, var(--c-surface)); background: transparent; color: var(--c-ink-2); }
body.zen-lobby :is(.hempty .link-action, .hmore):hover { background: var(--c-fill); color: var(--c-ink); }
body.zen-lobby .hempty { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; padding: 8px 16px; margin: 0; }
body.zen-lobby .hlives { display: flex; flex-direction: column; }
/* #294: an empty Hôm nay / Diễn đàn / Live card is one wrapped row — title, message, entry link — not a full card. */
body.zen-lobby .ppanel.is-empty { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; padding: 12px 20px; }
body.zen-lobby .ppanel.is-empty { min-height: 64px; }   /* #300: same row height with and without the entry button */
body.zen-lobby .ph2 { font-family: var(--font-display); font-size: var(--text-md); font-weight: 700; letter-spacing: 0; }   /* #307: section titles use the display face; 14px serif is too small to read */
body.zen-lobby .ppanel.is-empty .ph2 { margin: 0; flex: 0 0 16ch; }   /* #300: shared title column (longest title "Đang phát trực tiếp" ≈ 15.3ch) so every status starts at one x; ch tracks the font, not a pixel guess */
body.zen-lobby .ppanel.is-empty { flex-wrap: nowrap; }
body.zen-lobby .ppanel.is-empty :is(.hempty > p, .hempty > .link-action, .hmore) { min-width: 0; }
body.zen-lobby .ppanel.is-empty :is(.hempty > p, p.hempty) { display: block; flex: 1 1 0; min-width: 0; margin: 0; padding: 0; line-height: 1.4; }   /* the forum's message is itself the .hempty <p> */   /* #300: status takes the middle and may wrap; the entry button keeps its size on the right */
body.zen-lobby .ppanel.is-empty :is(.hempty > .link-action, .hmore) { flex: none; }
@media (max-width: 480px) { body.zen-lobby .ppanel.is-empty { flex-wrap: wrap; } body.zen-lobby .ppanel.is-empty .ph2 { flex-basis: 100%; } body.zen-lobby .ppanel.is-empty :is(.hempty > p, p.hempty) { flex: 1 1 12ch; } }   /* #300: narrow = status under the title */
/* #305: the right column is only ~320-445px wide in the two-column layout, too narrow for title + status + entry pill on one line (the forum status wrapped). Same stacked row as the phone: status under the title, pill on the right. */
body.zen-lobby .psplit > .hstack:last-child { container-type: inline-size; }
@container (max-width: 520px) { body.zen-lobby .ppanel.is-empty { flex-wrap: wrap; } body.zen-lobby .ppanel.is-empty .ph2 { flex-basis: 100%; } body.zen-lobby .ppanel.is-empty :is(.hempty > p, p.hempty) { flex: 1 1 12ch; } }
body.zen-lobby .ppanel.is-empty :is(.prows, .hlives, .hempty) { display: contents; }
body.zen-lobby .ppanel.is-empty .hempty { padding: 0; }
body.zen-lobby .ppanel.is-empty .hmore { margin: 0; }
body.zen-lobby .qm-line__login { color: var(--c-brand-text); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }   /* ui-audit home F2 */
/* #224: admin news line (full width under the stats), forum "see all", About rules list. */
body.zen-lobby .hnews { grid-column: 1 / -1; }
body.zen-lobby .hnews[hidden] { display: none; }
body.zen-lobby .hnews__line { display: flex; align-items: center; gap: 12px; margin: 0; min-height: 44px; padding: 10px 16px; border-radius: var(--radius-lg); background: var(--c-surface); box-shadow: var(--shadow-card); color: var(--c-ink); text-decoration: none; font-size: var(--text-sm); }
body.zen-lobby a.hnews__line:hover { background: var(--c-hover); }
body.zen-lobby .hnews__tag { flex: none; font-size: var(--text-xs); font-weight: 700; letter-spacing: .01em; text-transform: none; color: var(--c-brand); }
body.zen-lobby .hnews__body { flex: 1; min-width: 0; overflow-wrap: anywhere; }
body.zen-lobby .hnews__go { flex: none; color: var(--c-ink-2); font-size: var(--text-lg); line-height: 1; }
body.zen-lobby .hmore { margin-top: 8px; }
body.zen-lobby .hmore.hmore--text { border: 0; border-radius: 0; padding: 4px 2px; min-height: 0; color: var(--c-brand-text); text-decoration: underline; text-underline-offset: 3px; }   /* #301: a plain text link under a list that already has per-row actions; brand-text on card >= 4.5:1 */
body.zen-lobby .hmore.hmore--text:hover { background: transparent; color: var(--c-ink); }
/* Quick match panel (B197): chips lock while searching. */
body.zen-lobby .pchip:disabled { cursor: default; opacity: .55; }
body.zen-lobby .pchip[aria-pressed="true"]:disabled { opacity: 1; }
body.zen-lobby .qm-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: 12px 0 0; min-height: 1.5em; }   /* status parts are spans, spaced by gap — no "a · b" strings */
/* A7.1 (ui/grid-leaves-home): two card stacks; quick-match group labels, ✓ on the chosen chip, one dominant CTA, learn progress. */
body.zen-lobby .hstack { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
body.zen-lobby .qm-lbl { margin: 16px 0 8px; font-size: var(--text-sm); font-weight: 700; letter-spacing: 0; color: var(--c-ink-2); }   /* sentence case: tracked all-caps 800 read stiff on Vietnamese */
body.zen-lobby .qm-hint { margin: 8px 0 0; font-size: var(--text-sm); line-height: 1.5; color: var(--c-ink-2); }   /* #298: shown while Auto is chosen; reserved in the markup so the first render does not shift */
body.zen-lobby .hp-qm .pchips { margin-bottom: 0; }
body.zen-lobby .hp-qm .qm-grp { flex-basis: 100%; margin: 4px 0 -2px; font-size: var(--text-xs); color: var(--c-ink-3, var(--c-ink-2)); }
body.zen-lobby .hp-qm .qm-grp:first-child { margin-top: 0; }
body.zen-lobby .hp-qm #qm-time.is-auto > .pchip:not(.is-active) { background: var(--c-surface-2); color: var(--c-ink-3); }   /* #293/#297: Auto = no clock preference, so the manual chips lose their fill (text 4.5:1, border 3:1 kept; opacity would break both); NOT :disabled (that means 'searching') */
body.zen-lobby .hp-qm #qm-time.is-auto > .pchip:not(.is-active):hover, body.zen-lobby .hp-qm #qm-time.is-auto > .pchip:focus-visible { background: var(--c-surface-2); color: var(--c-ink); }
body.zen-lobby .hp-qm .pchip { min-height: 38px; padding: 8px 15px; font-size: var(--text-sm); background: var(--c-surface-2); border: 1px solid color-mix(in srgb, var(--c-ink-2) 70%, var(--c-surface)); }   /* #291/#297: boundary >= 3:1 (WCAG 1.4.11) in both modes (62% gave 2.83 in light) from a thin border; the lighter fill, not a heavier line, marks it as a chip */
body.zen-lobby .hp-qm .pchip[aria-pressed="true"] { background: var(--c-brand); border-color: transparent; box-shadow: 0 0 0 2px color-mix(in srgb, var(--c-brand) 35%, transparent); }
body.zen-lobby .hp-qm .pchip[aria-pressed="true"]::before { content: '✓'; margin-right: 6px; font-weight: 700; }
body.zen-lobby .qm-start { margin: 0 0 20px; padding-bottom: 18px; border-bottom: 1px dashed var(--c-border); }   /* #290: CTA first, the chips below only adjust it */
body.zen-lobby .qm-line .rtag { font-size: var(--text-sm); font-weight: 600; padding: 3px 10px; white-space: normal; }
body.zen-lobby .qm-line__note { flex-basis: 100%; font-size: var(--text-sm); font-weight: 400; color: var(--c-ink-2); }   /* a sentence is a note, not a chip */
body.zen-lobby .qm-line .rtag--rule { background: color-mix(in srgb, var(--c-brand) 18%, transparent); color: var(--c-brand-text); }   /* the rule = the main pick */
body.zen-lobby .qm-start .qm-line { margin: 0 0 12px; font-size: var(--text-sm); font-weight: 600; line-height: 1.5; color: var(--c-ink); }   /* #299: "Đang chọn: …" is what the CTA will run — read it first */
body.zen-lobby .qm-start .pactions { margin: 0; gap: 10px; }
body.zen-lobby #qm-actions .link-action { min-height: 40px; padding: 8px 18px; border: 1px solid var(--c-brand-text); border-radius: var(--radius-pill); background: var(--c-surface-2); color: var(--c-brand-text); font-size: var(--text-sm); font-weight: 600; }   /* #297: pill + brand outline = an action, never mistaken for a chip (rounded rect + grey fill) */
body.zen-lobby #qm-actions .link-action:hover { background: var(--c-brand-light); color: var(--c-brand-text); }
body.zen-lobby #qm-actions .link-action--primary { min-height: 48px; padding: 12px 24px; border-color: transparent; background: var(--c-brand); color: var(--c-on-brand); font-size: var(--text-md); font-weight: 700; box-shadow: 0 8px 18px -6px color-mix(in srgb, var(--c-brand) 70%, #000), inset 0 1px 0 rgba(255,255,255,.25); }
body.zen-lobby #qm-actions .link-action--primary:hover { background: var(--c-brand-dark); color: var(--c-on-brand); }
body.zen-lobby .hprog { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
body.zen-lobby .hprog__bar { flex: 1; height: 6px; border-radius: 99px; background: var(--c-surface-2); overflow: hidden; }
body.zen-lobby .hprog__bar i { display: block; height: 100%; border-radius: 99px; background: var(--c-brand); }
/* One column (≤ 860px, same as .psplit): the stacks dissolve so the order is explicit — match, my game, learn, then the rest. */
@media (max-width: 860px) {
  body.zen-lobby .hstack { display: contents; }
  body.zen-lobby .hp-qm { order: 1; } body.zen-lobby .hp-mine { order: 2; } body.zen-lobby .hp-learn { order: 3; }
  body.zen-lobby .hp-today { order: 4; } body.zen-lobby .hp-forum { order: 5; } body.zen-lobby .hp-live { order: 6; } body.zen-lobby .hp-about { order: 7; }
  /* B306: 44px touch targets on phones (desktop sizes unchanged) */
  body.zen-lobby .link-action, body.zen-lobby #qm-actions .link-action, body.zen-lobby .hp-qm .pchip, body.zen-lobby .section-tabs__btn, body.zen-lobby .join-code__input { min-height: 44px; }
}
/* B261: these fill only after /api/home; reserve their typical height while empty so .ppanel does not grow (CLS). */
body.zen-lobby #qm-actions:empty { display: none; }   /* ui-audit home F8: fills only on a user's search (cancel button), so no load-time CLS; the 38px reserve left a dead gap */
body.zen-lobby :is(#home-today, #home-live):empty { min-height: 36px; }
body.zen-lobby #home-learn:empty { min-height: 68px; }
body.zen-lobby #home-mine:empty { min-height: 86px; }
body.zen-lobby #home-forum:empty { min-height: 90px; }
body.zen-lobby .zen-hero__title:empty { min-height: 1.3em; } /* lobby.js sets the text after load; line-height is 1.3 */
@media (max-width: 480px) { body.zen-lobby .zen-hero__title { font-size: var(--text-xl); } }   /* #292: still > stat 18 */

/* Vào bằng mã (Phòng screen, B210): inline code field next to the create button */
body.zen-lobby .join-code { position: relative; display: inline-flex; align-items: center; gap: 8px; }
body.zen-lobby .join-code[hidden], body.zen-lobby .join-code__error[hidden] { display: none; }
body.zen-lobby .join-code__input { width: 84px; min-height: 36px; padding: 6px 10px; text-transform: uppercase; letter-spacing: .12em; text-align: center; border: 1px solid var(--c-border); border-radius: var(--radius); background: var(--c-field); color: var(--c-ink); font: inherit; }
body.zen-lobby .join-code__error { position: absolute; top: calc(100% + 4px); left: 0; white-space: nowrap; font-size: var(--text-xs); color: var(--c-error); }
@media (max-width: 860px) {
  body.zen-lobby .lobby-bar__actions { flex-wrap: wrap; }
  body.zen-lobby .join-code { flex: 1 1 100%; flex-wrap: wrap; }
  body.zen-lobby .join-code__error { position: static; flex-basis: 100%; white-space: normal; }
}

/* ── Lobby type scale for shared platform.css components (px*scale -> --text-* tokens) ──
   platform.css stays as-is for the other pages; the lobby maps its sizes here. */
body.zen-lobby .prow__t { font-size: var(--text-md); }
body.zen-lobby :is(.prow__m, .prow__act, .small, .pnote, .pbtn--sm, .pbadge) { font-size: var(--text-xs); }
body.zen-lobby :is(.pbtn, .pchip, .ptab) { font-size: var(--text-sm); }

/* Room tabs: weight stays equal in every state (500 -> 700 shifted the next tab); the selected tab
   is already marked by its underline + colour. */
body.zen-lobby .ptab, body.zen-lobby .ptab[aria-selected="true"] { font-weight: 600; }
body.zen-lobby .zen-hero__title { text-wrap: balance; }   /* no one-word last line on phones */
body.zen-lobby .qm-start .qm-line { text-wrap: pretty; }   /* no orphan last word */

/* ── Tracking: negative letter-spacing only from ~24px up (hero keeps -0.01em) ─────────
   main.css gives every heading -0.03em and p/li -0.01em; at 12-20px that pulls Vietnamese
   diacritics into neighbouring letters. .ph2 sets its own tracking. */
body.zen-lobby :is(h2, h3, h4, h5, h6):not(.ph2) { letter-spacing: 0; }
body.zen-lobby :is(p, li) { letter-spacing: 0; }
body.zen-lobby .zen-hero__title { letter-spacing: -0.01em; }

/* ── Home M4 "Câu lệnh" (#358, DESIGN.md): greeting row → resume strip → sentence composer + Chơi nhanh → room code; right column = live counts. ── */
body.zen-lobby .hq { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 28px 56px; align-content: start; }
body.zen-lobby .hq[hidden] { display: none; }
body.zen-lobby .hq > :is(.hq-hello, .hnews, #home-mine-card) { grid-column: 1 / -1; }
/* The shared hero (lobby.js) is the rooms/tournaments title; Home has its own greeting row. */
body.zen-lobby .lobby:has(#screen-home.is-active:not([hidden])) .zen-hero { display: none; }
body.zen-lobby .hq-hello { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; font-size: var(--text-md); color: var(--c-ink-2); }
body.zen-lobby .hq-hi b { color: var(--c-ink); font-weight: 800; }
body.zen-lobby .hq-online { display: inline-flex; align-items: center; gap: 8px; min-height: 28px; padding: 0 10px; border-radius: 6px; background: var(--c-fill); font-size: var(--text-sm); font-weight: 700; font-variant-numeric: tabular-nums; }
body.zen-lobby .hq-online[hidden] { display: none; }
body.zen-lobby .hq-online__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c-state-playing); }
@media (min-width: 861px) { body.zen-lobby .hq-online { display: none; } }   /* #366: desktop shows the count on the board */

/* Resume strip = #home-mine-card, compact */
body.zen-lobby .hq #home-mine-card { display: flex; align-items: center; gap: 4px 16px; flex-wrap: wrap; padding: 8px 8px 8px 16px; }
body.zen-lobby .hq #home-mine-card[hidden] { display: none; }
body.zen-lobby .hq #home-mine-card .ph2 { margin: 0; font-size: var(--text-sm); color: var(--c-ink-2); }
body.zen-lobby .hq #home-mine-card .prows { flex: 1; min-width: 0; }
body.zen-lobby .hq #home-mine-card .hrow { padding: 8px 12px; }

/* Sentence composer */
body.zen-lobby .hq-main { min-width: 0; }
body.zen-lobby .hq-q { margin: 0; font-family: var(--font-display); font-size: clamp(34px, 3.3vw + 8px, 60px); line-height: 1.22; font-weight: 900; letter-spacing: -.025em; color: var(--c-ink); text-wrap: pretty; }
body.zen-lobby .hq-blank { display: inline-flex; align-items: center; gap: .18em; padding: 0 .28em; margin: 0 .04em; border: 0; border-bottom: .07em solid var(--c-brand); border-radius: .22em; background: var(--c-brand-light); color: var(--c-brand-text); font: inherit; letter-spacing: inherit; cursor: pointer; transition: background-color var(--duration-fast); }
body.zen-lobby button.hq-blank::after { content: ''; width: .32em; height: .32em; border-right: .08em solid currentColor; border-bottom: .08em solid currentColor; transform: translateY(-.1em) rotate(45deg); opacity: .7; }
body.zen-lobby button.hq-blank[aria-expanded="true"]::after { transform: translateY(.08em) rotate(225deg); }
body.zen-lobby button.hq-blank:hover:not(:disabled), body.zen-lobby button.hq-blank[aria-expanded="true"] { background: color-mix(in srgb, var(--c-brand) 22%, transparent); }
body.zen-lobby button.hq-blank:focus-visible { outline: 3px solid var(--c-ink); outline-offset: 3px; }
body.zen-lobby button.hq-blank:disabled { cursor: default; opacity: .6; }
body.zen-lobby .hq-blank--fixed { border-bottom-style: dashed; cursor: default; }   /* guest: casual only — shows the value, not a control */
/* Listbox: in flow under the sentence on desktop (pushes the button down, never covers it). */
body.zen-lobby .hq-menu { list-style: none; display: grid; gap: 4px; width: max-content; min-width: 220px; max-width: 100%; box-sizing: border-box; margin: 12px 0 0 var(--pick-x, 0); padding: 8px; border-radius: 14px; background: var(--c-surface); border: 1px solid var(--c-border); box-shadow: var(--shadow-lg); animation: hq-pop var(--duration-fast) var(--ease-out); }
body.zen-lobby .hq-menu[hidden] { display: none; }
body.zen-lobby .hq-opt { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border-radius: 10px; font-size: var(--text-md); font-weight: 700; color: var(--c-ink); cursor: pointer; }
body.zen-lobby .hq-opt::before { content: ''; width: 14px; height: 8px; border-left: 2.5px solid currentColor; border-bottom: 2.5px solid currentColor; transform: translateY(-2px) rotate(-45deg); visibility: hidden; }
body.zen-lobby .hq-opt[aria-selected="true"] { background: var(--c-brand-light); color: var(--c-brand-text); }
body.zen-lobby .hq-opt[aria-selected="true"]::before { visibility: visible; }
body.zen-lobby .hq-opt:hover { background: var(--c-fill); }
body.zen-lobby .hq-opt:focus-visible { outline: 2px solid var(--c-ink); outline-offset: -2px; }
@keyframes hq-pop { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: none; } }

/* Chơi nhanh — and the searching pill that replaces it in place */
body.zen-lobby .hq-go { margin-top: 26px; min-height: 72px; }
body.zen-lobby .hq-play { display: inline-flex; align-items: center; gap: 14px; min-height: 72px; padding: 0 36px 0 14px; border: 0; border-radius: 999px; background: var(--c-ink); color: var(--c-on-ink); font: inherit; font-size: 26px; font-weight: 900; cursor: pointer; box-shadow: 0 18px 36px -16px rgba(0,0,0,.6); transition: transform var(--duration-fast) var(--ease-out); }
body.zen-lobby .hq-play[hidden] { display: none; }
body.zen-lobby .hq-play__disc { display: inline-flex; align-items: center; justify-content: center; width: 46px; height: 46px; border-radius: 50%; background: var(--c-brand); color: var(--c-on-brand); }
body.zen-lobby .hq-play__disc .icon { width: 24px; height: 24px; }
body.zen-lobby .hq-play:hover { transform: translateX(4px); }
body.zen-lobby .hq-play:focus-visible { outline: 3px solid var(--c-brand); outline-offset: 3px; }
body.zen-lobby .hq-search { display: inline-flex; align-items: center; gap: 14px; min-height: 72px; box-sizing: border-box; padding: 0 12px 0 24px; border-radius: 999px; background: var(--c-surface); border: 2px solid var(--c-brand); font-size: 20px; font-weight: 800; color: var(--c-ink); }
body.zen-lobby .hq-search[hidden] { display: none; }
body.zen-lobby .hq-search__text { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-variant-numeric: tabular-nums; }
body.zen-lobby .hq-search__text .rtag { font-size: var(--text-sm); font-weight: 700; }
body.zen-lobby .hq-ring { flex: none; width: 28px; height: 28px; box-sizing: border-box; border-radius: 50%; border: 3px solid var(--c-brand-light); border-top-color: var(--c-brand); animation: hq-spin 1s linear infinite; }
@keyframes hq-spin { to { transform: rotate(360deg); } }
body.zen-lobby .hq-search .pactions { margin: 0; }
body.zen-lobby #qm-actions .hq-cancel { min-height: 48px; padding: 0 18px; white-space: nowrap; border: 0; border-radius: 999px; background: var(--c-fill); color: var(--c-ink); font-size: var(--text-md); font-weight: 800; }
body.zen-lobby #qm-actions .hq-cancel:hover { background: color-mix(in srgb, var(--c-fill) 50%, var(--c-ink) 12%); color: var(--c-ink); }
body.zen-lobby .hq .qm-line { margin: 14px 0 0; min-height: 0; }
body.zen-lobby .hq .qm-line:empty { display: none; }

/* #361 T2 Thách đấu: outline twin of Chơi nhanh + accent sword disc; the picker pops under it (bottom sheet ≤860px). */
body.zen-lobby .hq-go { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
body.zen-lobby .hq-chal { display: inline-flex; align-items: center; gap: 12px; min-height: 72px; box-sizing: border-box; padding: 0 30px 0 12px; border: 2px solid var(--c-ink); border-radius: 999px; background: var(--c-surface); color: var(--c-ink); font: inherit; font-size: 22px; font-weight: 900; cursor: pointer; box-shadow: var(--shadow-card); }
body.zen-lobby .hq-chal[hidden] { display: none; }
body.zen-lobby .hq-chal__disc { display: inline-flex; align-items: center; justify-content: center; width: 46px; height: 46px; border-radius: 50%; background: var(--c-accent); color: #fff; }
body.zen-lobby .hq-chal__disc .icon { width: 24px; height: 24px; }
body.zen-lobby .hq-chal:hover, body.zen-lobby .hq-chal[aria-expanded="true"] { background: var(--c-fill); }
body.zen-lobby .hq-chal:focus-visible { outline: 3px solid var(--c-brand); outline-offset: 3px; }
body.zen-lobby .hch { position: absolute; z-index: 40; top: calc(100% + 8px); left: var(--ch-x, 0); display: flex; flex-direction: column; gap: 10px; max-height: var(--ch-max, 70vh); overflow-y: auto; width: 380px; max-width: calc(100vw - 32px); box-sizing: border-box; padding: 14px; border-radius: 16px; background: var(--c-surface); border: 1px solid var(--c-border); box-shadow: var(--shadow-lg); font-size: var(--text-md); animation: hq-pop var(--duration-fast) var(--ease-out); }
/* Bottom sheet (phones, or too little room under the button): above the tab bar like the listbox; the shadow doubles as the scrim. */
body.zen-lobby .hch.hch--sheet { position: fixed; left: 0; right: 0; top: auto; bottom: 0; z-index: 70; width: min(480px, 100%); max-width: none; max-height: 85vh; max-height: 85dvh; margin: 0 auto; padding: 12px 12px calc(14px + env(safe-area-inset-bottom)); border-radius: 18px 18px 0 0; border: 0; box-shadow: 0 0 0 100vmax rgba(0,0,0,.45); }
body.zen-lobby .hch--sheet .hch__list { max-height: 40vh; }
body.zen-lobby .hch__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
body.zen-lobby .hch__title { margin: 0; font-size: var(--text-sm); font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--c-ink-2); }
body.zen-lobby .hch__x { width: 40px; height: 40px; border: 0; border-radius: 50%; background: transparent; color: var(--c-ink-2); font: inherit; cursor: pointer; }
body.zen-lobby .hch__x:hover { background: var(--c-fill); color: var(--c-ink); }
body.zen-lobby .hch__search { min-height: 44px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--c-border); background: var(--c-surface-2); color: var(--c-ink); font: inherit; }
body.zen-lobby .hch__search:focus-visible { outline: 2px solid var(--c-brand); outline-offset: 1px; }
body.zen-lobby .hch__tabs { display: flex; flex-wrap: wrap; gap: 6px; }
body.zen-lobby .hch__tab { min-height: 36px; padding: 0 14px; border: 0; border-radius: 999px; background: var(--c-fill); color: var(--c-ink); font: inherit; font-size: var(--text-sm); font-weight: 700; cursor: pointer; }
body.zen-lobby .hch__tab[aria-pressed="true"] { background: var(--c-ink); color: var(--c-on-ink); }
body.zen-lobby .hch__tab:focus-visible { outline: 2px solid var(--c-brand); outline-offset: 2px; }
body.zen-lobby .hch__note { margin: 4px 2px; font-size: var(--text-sm); color: var(--c-ink-2); }
body.zen-lobby .hch__note[hidden] { display: none; }
body.zen-lobby .hch__list { list-style: none; display: grid; align-content: start; gap: 2px; flex: 0 1 auto; min-height: 104px; max-height: 300px; margin: 0; padding: 0; overflow-y: auto; overscroll-behavior: contain; }
body.zen-lobby .hch > :not(.hch__list) { flex: none; }
body.zen-lobby .hch__list:empty { display: none; }
body.zen-lobby .hch__row { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 52px; padding: 4px 10px; border: 0; border-radius: 10px; background: transparent; color: var(--c-ink); font: inherit; text-align: left; cursor: pointer; }
body.zen-lobby .hch__row:hover { background: var(--c-fill); }
body.zen-lobby .hch__row[aria-pressed="true"] { background: var(--c-brand-light); box-shadow: inset 0 0 0 2px var(--c-brand); }
body.zen-lobby .hch__row:focus-visible { outline: 2px solid var(--c-ink); outline-offset: -2px; }
body.zen-lobby .hch__av { position: relative; display: inline-flex; flex: none; }
body.zen-lobby .hch__av.is-on::after { content: ''; position: absolute; right: -1px; bottom: -1px; width: 10px; height: 10px; border-radius: 50%; background: var(--c-state-playing); border: 2px solid var(--c-surface); }
body.zen-lobby .hch__name { display: grid; flex: 1; min-width: 0; }
body.zen-lobby .hch__dn { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.zen-lobby .hch__st { font-size: var(--text-xs); color: var(--c-ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.zen-lobby .hch__tag { flex: none; padding: 2px 8px; border-radius: 6px; background: var(--c-fill); color: var(--c-ink-2); font-size: var(--text-xs); font-weight: 700; }
body.zen-lobby .hch__rules { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin: 0; font-size: var(--text-sm); color: var(--c-ink-2); }
body.zen-lobby .hch__rules .rtag { font-weight: 700; color: var(--c-ink); }
body.zen-lobby .hch__status { margin: 0; font-size: var(--text-sm); color: var(--c-error); }
body.zen-lobby .hch__status:empty { display: none; }
body.zen-lobby .hch__send { min-height: 52px; border: 0; border-radius: 999px; background: var(--c-ink); color: var(--c-on-ink); font: inherit; font-weight: 900; cursor: pointer; }
body.zen-lobby .hch__send:disabled { background: var(--c-fill); color: var(--c-ink-2); cursor: default; }
body.zen-lobby .hch__send:focus-visible { outline: 3px solid var(--c-brand); outline-offset: 2px; }
body.zen-lobby .hch__foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px; font-size: var(--text-sm); color: var(--c-ink-2); }
body.zen-lobby .hch__more { min-height: 44px; padding: 0; border: 0; background: none; font: inherit; font-weight: 800; color: var(--c-brand-text); cursor: pointer; }

/* #360 N2: labelled tiles for Học / Diễn đàn / Giải đấu / Câu lạc bộ — phones only (desktop keeps the greeting-row icons). */
body.zen-lobby .hq-tiles { display: none; }
/* #362 F: phone status line for the counts (desktop keeps the right-column cards). */
body.zen-lobby .hq-pulse { display: none; }

/* Room code */
body.zen-lobby .hq-or { display: flex; align-items: center; gap: 14px; margin: 34px 0 16px; font-size: var(--text-sm); font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--c-ink-2); }
body.zen-lobby .hq-or::after { content: ''; flex: 1; height: 1px; background: var(--c-border); }
body.zen-lobby .hq-code { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
body.zen-lobby .hq-code__hash { font-size: 44px; font-weight: 900; color: var(--c-ink-2); }
body.zen-lobby .hq-code__box { width: 64px; height: 76px; box-sizing: border-box; padding: 0; text-align: center; border-radius: 16px; border: 2px solid var(--c-border); background: var(--c-surface); color: var(--c-ink); font: inherit; font-weight: 900; font-size: 38px; line-height: 1; text-transform: uppercase; box-shadow: var(--shadow-card); }
body.zen-lobby .hq-code__box:focus-visible { outline: none; border-color: var(--c-brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c-brand) 35%, transparent); }
body.zen-lobby .hq-enter { display: inline-flex; align-items: center; gap: 8px; min-height: 76px; padding: 0 26px; border-radius: 16px; border: 2px solid var(--c-ink); background: transparent; color: var(--c-ink); font: inherit; font-size: 20px; font-weight: 900; cursor: pointer; }
body.zen-lobby .hq-enter .icon { width: 24px; height: 24px; }
body.zen-lobby .hq-enter:hover { background: var(--c-fill); }
body.zen-lobby .hq-enter:focus-visible { outline: 3px solid var(--c-brand); outline-offset: 2px; }
body.zen-lobby .hq-list { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; margin-left: 8px; font-weight: 800; color: var(--c-brand-text); text-decoration: none; }
body.zen-lobby .hq-list:hover { text-decoration: underline; text-underline-offset: 3px; }
body.zen-lobby .hq-list .icon { width: 16px; height: 16px; }
body.zen-lobby .hq-code__err { flex-basis: 100%; margin: 4px 0 0; font-size: var(--text-sm); color: var(--c-error); }
body.zen-lobby .hq-code__err[hidden] { display: none; }

/* Right column (desktop): #366 C "Bảng quán cờ" — an ink scoreboard (dark in both modes) + 4 labelled chips. Hidden ≤860px. */
body.zen-lobby .hq-side { display: grid; gap: 16px; align-content: start; padding-top: 6px; }
body.zen-lobby .hq-board { --hb-bg: #24221e; --hb-plate: #34312c; --hb-ink: #f2f0eb; --hb-ink-2: #b9b5ab; --hb-line: rgba(255,255,255,.14); --hb-live: #8bc34a; --hb-hot: #ee6a20;
  position: relative; display: grid; padding: 18px; border-radius: 20px; background: var(--hb-bg); color: var(--hb-ink); border: 1px solid rgba(255,255,255,.10); box-shadow: 0 22px 40px -22px rgba(0,0,0,.7); overflow: hidden; }
:root[data-mode="light"] body.zen-lobby .hq-board { --hb-bg: #1d1c19; --hb-plate: #2f2d29; border-color: transparent; }
body.zen-lobby .hq-board::before { content: ''; position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.045) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.045) 1px, transparent 1px); background-size: 22px 22px; pointer-events: none; }
body.zen-lobby .hq-board > * { position: relative; }
body.zen-lobby .hq-board__top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 10px; font-size: var(--text-xs); font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--hb-ink-2); }
body.zen-lobby .hq-board__live { display: inline-flex; align-items: center; gap: 6px; color: var(--hb-live); }
body.zen-lobby .hq-board__live i { width: 8px; height: 8px; border-radius: 50%; background: var(--hb-live); animation: hq-blink 1.6s ease-in-out infinite; }
@keyframes hq-blink { 50% { opacity: .3; } }
body.zen-lobby .hq-row { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 14px; margin: 0; padding: 10px 0; border-top: 1px dashed var(--hb-line); }
body.zen-lobby .hq-row__l { display: flex; flex-wrap: wrap; gap: 2px 8px; font-weight: 700; color: var(--hb-ink); }
body.zen-lobby .hq-row__l > span + span { font-weight: 600; color: var(--hb-ink-2); }
/* One plate per digit; a 1-digit value gets a leading "0" plate (CSS only — textContent stays the number). */
body.zen-lobby .hq-dig { display: inline-flex; gap: 3px; font-weight: 900; }
body.zen-lobby .hq-dig > i, body.zen-lobby .hq-dig.is-1::before { display: inline-grid; place-items: center; width: 30px; height: 42px; border-radius: 6px; background: var(--hb-plate); box-shadow: inset 0 -21px 0 rgba(0,0,0,.18); font-style: normal; font-size: 28px; line-height: 1; font-variant-numeric: tabular-nums; color: var(--hb-ink); }
body.zen-lobby .hq-dig.is-1::before { content: '0'; color: rgba(255,255,255,.28); }
body.zen-lobby .hq-row--on .hq-dig:not(.is-zero) > i { color: var(--hb-live); }
body.zen-lobby .hq-dig.is-zero > i { color: rgba(255,255,255,.4); }   /* #292: an empty count must not out-shout a real one */
body.zen-lobby #home-live-one:empty { display: none; }
body.zen-lobby .hq-board .hq-live { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 44px; margin-top: 6px; padding: 8px 12px; border: 0; border-radius: 12px; background: rgba(238,106,32,.16); color: var(--hb-ink-2); font: inherit; font-size: var(--text-sm); text-align: left; cursor: pointer; }
body.zen-lobby .hq-board .hq-live::before { content: ''; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--hb-hot); }
body.zen-lobby .hq-board .hq-live:hover { background: rgba(238,106,32,.26); }
body.zen-lobby .hq-board .hq-live:focus-visible { outline: 2px solid var(--hb-hot); outline-offset: 2px; }
body.zen-lobby .hq-board .hq-live__t { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 800; color: var(--hb-ink); }
body.zen-lobby .hq-board .hq-live__m { flex: none; }
body.zen-lobby .hq-board .hq-live__m::before { content: '· '; }
body.zen-lobby .hub-more { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
body.zen-lobby .hq-chip { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 0 14px; border-radius: 999px; background: var(--c-surface); border: 1.5px solid var(--c-ink); color: var(--c-ink); font-weight: 800; text-decoration: none; transition: background-color var(--duration-fast); }
body.zen-lobby .hq-chip .icon { flex: none; width: 22px; height: 22px; color: var(--c-brand-text); }
body.zen-lobby .hq-chip span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.zen-lobby .hq-chip:hover { background: var(--c-fill); }
body.zen-lobby .hq-chip:focus-visible { outline: 3px solid var(--c-brand); outline-offset: 2px; }

/* One load reveal (rise 14px + fade, 80ms stagger). */
@keyframes hq-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
body.zen-lobby .hq > * { animation: hq-rise var(--duration-slow) var(--ease-out) backwards; }   /* not `both`: a filling opacity/transform animation keeps a stacking context that traps the phone bottom sheet under the tab bar */
body.zen-lobby .hq > :nth-child(4) { animation-delay: 80ms; }
body.zen-lobby .hq > :nth-child(5) { animation-delay: 160ms; }
@media (prefers-reduced-motion: reduce) {
  body.zen-lobby .hq > *, body.zen-lobby .hq-menu, body.zen-lobby .hch { animation: none; }
  body.zen-lobby .hq-board__live i { animation: none; }
  body.zen-lobby .hq-ring { animation: none; border-top-color: var(--c-brand-light); border-color: var(--c-brand); }
  body.zen-lobby .hq-play:hover { transform: none; }
}

@media (max-width: 860px) {
  body.zen-lobby .hq { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  body.zen-lobby .hq-hello { gap: 8px 12px; }
  /* #362 F: the 4 links share ONE card, 4 equal columns (icon over label), hairline dividers. */
  body.zen-lobby .hq-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 22px; padding: 8px 4px; border-radius: 16px; background: var(--c-surface); border: 1px solid var(--c-border); box-shadow: var(--shadow-card); }
  body.zen-lobby .hq-tile { display: grid; justify-items: center; align-content: center; gap: 6px; min-height: 64px; padding: 4px 2px; border-radius: 12px; color: var(--c-ink); font-size: var(--text-sm); font-weight: 800; text-align: center; text-decoration: none; }
  body.zen-lobby .hq-tile + .hq-tile { position: relative; }
  body.zen-lobby .hq-tile + .hq-tile::before { content: ''; position: absolute; left: 0; top: 12px; bottom: 12px; width: 1px; background: var(--c-border); }
  body.zen-lobby .hq-tile .icon { width: 26px; height: 26px; color: var(--c-brand-text); }
  body.zen-lobby .hq-tile:active { background: var(--c-fill); }
  body.zen-lobby .hq-tile:focus-visible { outline: 2px solid var(--c-ink); outline-offset: 2px; }
  body.zen-lobby .hq-q { font-size: 30px; }
  /* Listbox → bottom sheet above the tab bar; the shadow doubles as the scrim. */
  body.zen-lobby .hq-menu { position: fixed; left: 0; right: 0; bottom: 0; z-index: 70; width: auto; max-width: none; margin: 0; padding: 12px 12px calc(12px + env(safe-area-inset-bottom)); border-radius: 18px 18px 0 0; box-shadow: 0 0 0 100vmax rgba(0,0,0,.45); }
  body.zen-lobby .hq-go { margin-top: 18px; min-height: 64px; }
  body.zen-lobby .hq-play { width: 100%; justify-content: flex-start; padding: 0 20px 0 14px; min-height: 64px; font-size: 22px; }
  body.zen-lobby .hq-go { gap: 10px; }
  body.zen-lobby .hq-chal { width: 100%; justify-content: flex-start; padding: 0 20px 0 12px; min-height: 64px; font-size: 22px; }
  body.zen-lobby .hq-chal__disc { width: 46px; height: 46px; }
  body.zen-lobby .hq-search { display: flex; width: 100%; min-height: 64px; gap: 10px; padding: 6px 8px 6px 16px; font-size: var(--text-sm); }
  body.zen-lobby .hq-search__text { flex: 1; min-width: 0; }
  body.zen-lobby #qm-actions .hq-cancel { padding: 0 14px; }
  body.zen-lobby .hq-or { margin: 22px 0 12px; }
  body.zen-lobby .hq-code { gap: 8px; }
  body.zen-lobby .hq-code__hash { font-size: 30px; }
  body.zen-lobby .hq-code__box { width: 48px; height: 60px; font-size: 28px; border-radius: 14px; }
  body.zen-lobby .hq-enter { min-height: 60px; padding: 0 14px; font-size: var(--text-md); }   /* # + 3 boxes + Vào phòng on one row at 375 */
  body.zen-lobby .hq-list { width: 100%; margin: 0; }
  body.zen-lobby .hq > .hq-side { display: none; }   /* #362: counts live in .hq-pulse on phones */
  body.zen-lobby .hq-pulse { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin: 12px 4px 0; font-size: var(--text-sm); color: var(--c-ink-2); }
  body.zen-lobby .hq-pulse__dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--c-state-playing); }
  body.zen-lobby .hq-pulse__part { display: inline-flex; align-items: center; gap: 5px; min-height: 32px; color: inherit; text-decoration: none; }
  body.zen-lobby .hq-pulse__part b { font-size: var(--text-md); font-weight: 900; color: var(--c-ink); font-variant-numeric: tabular-nums; }
  body.zen-lobby .hq-pulse__part b.is-zero { color: var(--c-ink-2); }
  body.zen-lobby a.hq-pulse__part[href] { color: var(--c-brand-text); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
  body.zen-lobby a.hq-pulse__part[href]:focus-visible { outline: 2px solid var(--c-ink); outline-offset: 2px; border-radius: 4px; }
  body.zen-lobby .hq-pulse__sep { width: 1px; height: 14px; background: var(--c-border); }
  /* Phone order (B358 §7): sentence + Chơi nhanh first, code next; resume strip after them. */
  body.zen-lobby .hq > .hq-hello { order: 0; } body.zen-lobby .hq > .hnews { order: 1; }
  body.zen-lobby .hq > .hq-main { order: 2; } body.zen-lobby .hq > #home-mine-card { order: 3; } body.zen-lobby .hq > .hq-side { order: 4; }
}
