/* The join page (templates/join.php, nhmsv GAMES_UNIFIED §2.3): the game's header (name + night mode), one card, no
   footer. Colours from tokens.css only; the teams' colours are the identity's blue (a) and sunflower (b). */
body.promo-page:has(.join-page) { background: var(--bg); color: var(--ink); min-height: 100dvh; display: block; padding: 0; }
.join-page { min-height: 100dvh; display: flex; flex-direction: column; }
.join-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: max(12px, env(safe-area-inset-top)) 16px 12px;
  background: var(--brand); color: var(--on-brand); }
.join-brand { display: inline-flex; align-items: center; gap: 8px; font-family: 'Tajawal', sans-serif; font-weight: 800; font-size: 22px; color: inherit; text-decoration: none; min-width: 0; }
.join-brand img { border-radius: 8px; flex: none; }
.join-home { color: inherit; font-weight: 700; text-decoration: none; padding: 8px 10px; border-radius: 10px; }
.join-home:hover { text-decoration: underline; }
/* §10.3: a small footer under the card. */
.join-foot { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; padding: 12px 16px max(16px, env(safe-area-inset-bottom)); font-size: 13px; color: var(--muted); }
.join-foot a { color: inherit; }
.join-theme { color: var(--on-brand); border-color: color-mix(in srgb, var(--on-brand) 35%, transparent); }
.join-main { flex: 1; display: flex; justify-content: center; padding: 20px 16px max(24px, env(safe-area-inset-bottom)); }
.join-card { width: min(480px, 100%); display: flex; flex-direction: column; gap: 16px; align-self: flex-start; }
.join-card h1 { margin: 0; font-size: 26px; }
.join-label { font-weight: 800; font-size: 15px; padding: 0; }
.join-page [hidden] { display: none !important; }
.join-field { display: flex; flex-direction: column; gap: 8px; border: 0; margin: 0; padding: 0; min-width: 0; }
.join-input { min-height: 52px; border: 1.5px solid var(--line); border-radius: 12px; padding: 0 14px; font: inherit; font-size: 18px; background: var(--surface); color: var(--ink); }
.join-input:focus-visible { outline: 3px solid var(--brand); outline-offset: 1px; }
.join-help { margin: 0; color: var(--muted); font-size: 14px; }
.join-left { margin: 0; padding: 10px 14px; border-radius: 12px; background: var(--brand-soft); color: var(--brand-ink); font-weight: 700; }
.join-ok { margin: 0; color: var(--ok); font-weight: 700; }
.join-error { margin: 0; padding: 10px 14px; border-radius: 12px; background: var(--bad-soft); color: var(--bad); font-weight: 700; }
.join-code-locked { display: flex; flex-direction: column; gap: 8px; }
.join-code-show { margin: 0; padding: 12px; border-radius: 14px; background: var(--brand-soft); color: var(--brand-ink); text-align: center;
  font-family: 'Poppins', sans-serif; font-weight: 800; font-size: 34px; letter-spacing: .12em; }
.join-team-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.join-team { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 8px; align-items: center; min-height: 60px; padding: 8px 12px; border: 1.5px solid var(--line); border-radius: 14px; cursor: pointer; background: var(--surface); min-width: 0; }
.join-team input { position: absolute; opacity: 0; pointer-events: none; }
.join-team strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; grid-column: 2; }
.join-team small { color: var(--muted); white-space: nowrap; grid-column: 2; }
.join-team .join-dot { grid-row: 1 / span 2; }
.join-team:has(input:checked) { border-color: var(--ink); box-shadow: 0 0 0 1.5px var(--ink); }
.join-team:has(input:focus-visible) { outline: 3px solid var(--brand); outline-offset: 2px; }
.join-team:has(input:disabled) { opacity: .5; cursor: not-allowed; }
.join-dot { width: 18px; height: 18px; border-radius: 50%; flex: none; }
.team-a .join-dot { background: var(--brand); }
.team-b .join-dot { background: var(--accent); }
.join-submit { width: 100%; min-height: 56px; font-size: 20px; }
.join-link { align-self: center; color: var(--brand-ink); font-weight: 700; }
.join-rejoin-line { margin: 0; text-align: center; }
.join-rejoin-link { background: none; border: 0; padding: 6px 4px; font: inherit; font-size: 14px; color: var(--brand-ink); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.join-rejoin-line.is-hint .join-rejoin-link { font-weight: 700; }
.join-wait-card { text-align: center; align-items: center; }
.join-wait-emoji { font-size: 56px; line-height: 1; }
.join-bell-note { text-align: center; }
.join-card .gu-code input { font-family: 'Poppins', sans-serif; font-size: 30px; font-weight: 800; letter-spacing: .12em; text-align: center; min-height: 64px; }
/* The avatar row (nhmsv GAMES_UNIFIED §2, Nasser 2026-11-21; the «وش؟» app): one row of tiles, «⋯ المزيد» the last tile. */
.av-row { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px; }
.av-row.av-folded { flex-wrap: nowrap; overflow: hidden; }
.av-tile { position: relative; flex: none; width: 56px; height: 56px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface);
  display: grid; place-items: center; cursor: pointer; padding: 0; color: var(--ink); font: inherit; }
.av-tile[hidden], .av-tile.av-off { display: none; }
.av-tile input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.av-tile > span { font-size: 30px; line-height: 1; }
.av-tile:has(input:checked) { border: 2px solid var(--brand); } /* §12.4: a 2px frame in the game's colour only */
.av-tile:has(input:focus-visible) { outline: 3px solid var(--brand); outline-offset: 3px; }
.av-tile:has(input:disabled) { opacity: .35; filter: grayscale(1); cursor: not-allowed; }
.av-more { display: grid; grid-template-rows: auto auto; gap: 0; color: var(--brand-ink); }
.av-more > span { font-size: 22px; font-weight: 800; }
.av-more small { font-size: 11px; font-weight: 700; }

/* GAMES_UNIFIED §12.6: the card's two forms, joining and «الرجوع إلى مكانك». */
.join-card:not(.is-rejoin) [data-only="rejoin"], .join-card.is-rejoin [data-only="join"] { display: none !important; }
.join-rejoin-intro { display: flex; flex-direction: column; gap: 4px; margin-top: -8px; }
.join-rejoin-title { margin: 0; font-weight: 800; font-size: 18px; }
/* §12.4: the button flat (no bottom shadow), the same height and corners as the others. */
.join-submit.gu-primary { box-shadow: none; }
/* §12.5: «المزيد» as a sheet: from the bottom (~70% high) on a phone, centred on a computer; six to a row, scrolling inside. */
.av-sheet { border: 0; padding: 0; background: var(--surface); color: var(--ink); width: min(520px, 100vw); max-width: 100vw; border-radius: 18px; box-shadow: 0 20px 48px rgba(0, 0, 0, .28); }
.av-sheet::backdrop { background: rgba(11, 20, 51, .45); }
.av-sheet[open] { display: flex; flex-direction: column; max-height: 80dvh; }
.av-sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 16px 8px; }
.av-sheet-head h2 { margin: 0; font-size: 18px; }
.av-sheet-x { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: transparent; color: inherit; font-size: 18px; cursor: pointer; }
.av-sheet-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; padding: 8px 16px 20px; overflow-y: auto; overscroll-behavior: contain; }
.av-pick { aspect-ratio: 1; width: 100%; height: auto; font-size: 28px; display: grid; place-items: center; border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface); cursor: pointer; padding: 0; }
.av-pick.is-on { border: 2px solid var(--brand); }
.av-pick:disabled { opacity: .35; cursor: not-allowed; }
@media (max-width: 699.98px) {
  .av-sheet[open] { margin: auto 0 0; width: 100vw; height: 70dvh; max-height: 70dvh; border-radius: 18px 18px 0 0; padding-bottom: env(safe-area-inset-bottom); }
}
.join-card .gu-code input { border-radius: 12px; } /* §12.4 */

/* ==== The join page's master design (nhmsv GAMES_UNIFIED §13, Nasser 2026-11-22): the same structure and sizes in the
   four games, as variables of the same names; only colours, logo and name, decorations and identity icons differ. The
   rejoin form and the avatar sheet use the same values. Font: Tajawal (title bold 800, labels medium 500, hints 400). ==== */
/* §17.1 (Nasser 2026-11-22): the shared sizes equal the sign-in pages' --auth-* (title 22, card padding 20 with 14px
   corners, name 46 and button 48 with 9px corners); only the code field stays 60. tests/JoinTest.php keeps them equal. */
.join-page {
  --join-bar-h: 64px; --join-card-max: 420px; --join-gap-top: 20px; --join-card-pad: 20px; --join-card-r: 14px; --join-section-gap: 20px;
  --join-code-h: 60px; --join-name-h: 46px; --join-btn-h: 48px; --join-avatar: 48px; --join-avatar-gap: 8px;
  --join-title: 22px; --join-label: 14px; --join-hint: 12px; --join-field-r: 9px; --join-btn-r: 9px;
  --join-side: 20px;
}
@media (max-width: 374.98px) { .join-page { --join-side: 16px; } }
/* 13.1: the bar, 64px: logo and name | «الرئيسية» | the theme icon. */
.join-head { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 8px; box-sizing: border-box;
  height: calc(var(--join-bar-h) + env(safe-area-inset-top)); padding: env(safe-area-inset-top) var(--join-side) 0; }
.join-head .join-brand { font-size: 18px; gap: 6px; white-space: nowrap; }
.join-head .join-brand img { width: 28px; height: 28px; }
@media (max-width: 374.98px) { .join-head .join-brand { font-size: 16px; } .join-head .join-brand img { width: 24px; height: 24px; } }
/* «الرئيسية» in the true middle of the bar, whatever the name's width. */
.join-head .join-home { position: absolute; inset-inline-start: 50%; transform: translateX(50%); top: calc(env(safe-area-inset-top) + (var(--join-bar-h) - 40px) / 2); line-height: 24px; }
[dir="ltr"] .join-head .join-home { transform: translateX(-50%); }
/* The card: full width up to 420px, centred, 20px under the bar. */
.join-main { padding: var(--join-gap-top) var(--join-side) 24px; }
.join-card { width: 100%; max-width: var(--join-card-max); box-sizing: border-box; padding: var(--join-card-pad); border-radius: var(--join-card-r); gap: var(--join-section-gap); }
.join-card h1 { font-size: var(--join-title); font-weight: 800; line-height: 1.3; }
.join-label, .join-card .gu-code > label { font-size: var(--join-label); font-weight: 500; line-height: 1.4; }
.join-help, .join-card .gu-code-hint { font-size: var(--join-hint); font-weight: 400; line-height: 1.5; }
.join-field, .join-code-locked { gap: 6px; }
.join-card .gu-code { gap: 6px; }
/* Fields: the code 60px, the name 46px, both with 9px corners. */
.join-card .gu-code input { box-sizing: border-box; height: var(--join-code-h); min-height: var(--join-code-h); border-radius: var(--join-field-r); font-size: 26px; }
.join-code-show { box-sizing: border-box; height: var(--join-code-h); display: grid; place-items: center; padding: 0; border-radius: var(--join-field-r); font-size: 26px; }
.join-card .join-input, .join-card input.join-input { box-sizing: border-box; height: var(--join-name-h); min-height: var(--join-name-h); border-radius: var(--join-field-r); font-size: 16px; }
/* The button: 48px, 9px corners, no shadow. */
.join-submit.gu-btn { box-sizing: border-box; height: var(--join-btn-h); min-height: var(--join-btn-h); border-radius: var(--join-btn-r); font-size: 18px; box-shadow: none; }
/* Avatars: five and «المزيد», 48px with 8px between (smaller only when the card is narrower than six of them). */
.av-row { display: grid; grid-template-columns: repeat(6, minmax(0, var(--join-avatar))); gap: var(--join-avatar-gap); padding: 0; justify-content: start; }
.av-row.av-folded { overflow: visible; }
.av-row:not(.av-folded) { grid-template-columns: repeat(auto-fill, minmax(0, var(--join-avatar))); }
.av-tile { width: 100%; height: auto; aspect-ratio: 1; max-width: var(--join-avatar); box-sizing: border-box; border-radius: var(--join-field-r); }
.av-tile > span { font-size: 26px; }
.av-more small { font-size: 10px; }
.av-pick { border-radius: var(--join-field-r); }
.av-sheet-grid { gap: var(--join-avatar-gap); }
.join-team { border-radius: var(--join-field-r); }
.join-rejoin-intro { margin-top: 0; }
.join-rejoin-title { font-size: 16px; }
.join-rejoin-link { font-size: var(--join-label); }
/* The footer at the bottom, centred. */
.join-foot { justify-content: center; font-size: var(--join-hint); }
