/* =============================================================
   ParlayDesk — canonical navbar geometry
   Single source of truth for the "normal" ParlayDesk topbar shared by:
     /apps (Builder/Schedule/Active/History/Stats), /community, /u/:handle,
     /community/post/:id, the authenticated homepage, and the authenticated
     public shared-parlay page.
   Only cross-page GEOMETRY lives here (sizes, spacing, layout). Colors and
   :root theme tokens (--bg0, --panel, --accent, etc.) stay page-owned so
   each page's own theme still applies — this file only ever reads them via
   var(...), never defines them. Per-page responsive/mobile-collapse rules
   (e.g. Builder's sport switcher + mobile nav drawer) also stay page-owned;
   this file covers desktop/base geometry only.
   Admin (2026-10-13) uses this same topbar via /admin-static/admin-shell.js;
   its sidebar/workspace layout lives in /admin-static/admin.css.
   ============================================================= */

/* Root scrollbar: pages that need a vertical scrollbar get one, pages that
   don't show none. Authenticated pages (<html class="pd-app">) keep their
   layout still when it comes or goes — see "Scrollbar reserve" below
   (2026-11-12; replaces the 2026-09-26 decision that accepted the shift).
   No scrollbar-gutter: Chrome paints a reserved gutter with the root's
   background color only, which showed as a dark strip with the topbar and
   footer stopping short.
   When a real scrollbar exists, its track is transparent and shows the
   html background — without background-color it paints UA-default white
   (body's own background still paints the page). Only reads the page-owned
   --bg1 token (fallback = its value everywhere). */
html {
  background-color: var(--bg1, #020617);
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 100;
  background: linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,0));
}

/* ─── Scrollbar reserve (authenticated pages, desktop) ───
   /pd-scroll-reserve.js sets --pd-sb-reserve on <html> to the platform's
   scrollbar width while the root shows NO vertical scrollbar (0 while one
   is shown; 0 for overlay scrollbars). Padding <body> by it lays every
   in-flow element out in exactly the width it has with the scrollbar, so
   nothing moves when the scrollbar comes or goes. The full-width bars then
   continue across that reserved strip (same background and 1 px line), so
   the navbar and footer still reach the right edge. Below 769 px (phone and
   tablet layouts) nothing changes. */
@media (min-width: 769px) {
  html.pd-app body { padding-right: var(--pd-sb-reserve, 0px); }
  html.pd-app .site-footer { position: relative; }
  /* The continuation copies the bar's own box: same height INCLUDING the
     bar's 1 px border, the same background and border (inherit), so the
     browser composites it exactly like the bar (the band also repeats under
     the border row there). Its box starts at the bar's padding edge, hence
     height = 100% + the 1 px border. */
  html.pd-app :is(.topbar, .site-footer)::after {
    content: "";
    position: absolute;
    left: 100%;
    width: var(--pd-sb-reserve, 0px);
    height: calc(100% + 1px);
    box-sizing: border-box; /* apps/styles.css's `*` reset doesn't reach ::after */
    background: inherit;
    pointer-events: none;
  }
  html.pd-app .topbar::after { top: 0; border-bottom: inherit; }
  html.pd-app .site-footer::after { bottom: 0; border-top: inherit; }
}

.topbar-left,
.topbar__left  { display: flex; align-items: center; gap: 12px; min-width: 0; flex-shrink: 0; }

.topbar-right,
.topbar__right { display: flex; align-items: center; gap: 10px; margin-left: auto; min-width: 0; flex-shrink: 0; }

/* ─── Brand ─── */
.brand-link,
.brand {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: inherit;
}

/* Canonical compact icon (2026-09-29): the favicon / PWA "PD" artwork itself,
   not a CSS lookalike. icon-192.png is the favicon.png artwork at 192px (>=3x
   this 34px box). Radius 20% = the artwork's own corner, so the shadow follows
   its shape. The "PD" text stays in the markup but is not painted. */
.brand-mark,
.brand__mark {
  width: 34px; height: 34px; border-radius: 20%; flex-shrink: 0;
  background: url("/icons/icon-192.png") center / 100% 100% no-repeat;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; color: transparent;
  box-shadow: 0 10px 20px rgba(59,130,246,.25);
}

.brand-name,
.brand__name { font-weight: 600; font-size: 15px; }
.brand-sub   { font-size: 12px; color: var(--muted); margin-top: 1px; }

/* ─── Section nav (Builder/Schedule/Active/History/Stats/Community pills) ─── */
.topbar__nav { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1 1 auto; flex-wrap: wrap; }
/* Pages that swap this nav in client-side after an auth check start it
   `hidden` — same specificity as the rule above, so without this override
   the later `display:flex` would win over the browser's default
   `[hidden]{display:none}` and the nav would show before auth resolves. */
.topbar__nav[hidden] { display: none; }

.mode-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.mode-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* Some pages render this pill as <a>, others (Builder) as <button>.
     Builder's own styles.css has a global `button,input,select{height:42px}`
     reset — since this rule never declared its own `height`, that global
     42px won uncontested and was the actual root cause of Builder's
     navbar reading ~7px taller than Community's (an <a> isn't affected by
     that rule at all). `height:auto` here beats it on specificity and
     lets padding + line-height size the pill the same way on every page.
     appearance:none is kept too so a native <button>'s own focus/theming
     chrome never reintroduces a similar gap. */
  appearance: none;
  -webkit-appearance: none;
  height: auto;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.04);
  color: rgba(255,255,255,.85);
  padding: 10px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  font-family: inherit;
  line-height: 1;
  text-decoration: none;
  transition: transform .08s ease, background .12s ease, border-color .12s ease;
}
.mode-tab:hover { background: rgba(255,255,255,.06); }
.mode-tab:active { transform: translateY(1px); }
.mode-tab.active {
  background: rgba(80,140,255,.18);
  border-color: rgba(80,140,255,.35);
  color: #fff;
}

.nav-divider {
  width: 1px;
  align-self: stretch;
  min-height: 22px;
  background: var(--border);
  flex-shrink: 0;
}

/* ─── Account menu ─── */
.account-menu { position: relative; }

.account-menu::before {
  content: "";
  position: absolute; top: 100%; left: 0; right: 0; height: 10px;
}

.account-btn {
  height: 40px; padding: 0 14px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--panel2);
  color: var(--text); font-size: 13px; cursor: pointer; font-family: inherit;
  transition: background 150ms;
}
.account-btn:hover { background: var(--panel); }

/* Menu palette (2026-11-19): ONE look on every page. It used to paint from
   the page's own tokens (--panel/--panel2/--bg0/--bg1/--border/--text/
   --muted), and pages on shared.css (Community, Account, Billing, legal,
   homepage…) define --bg0/--bg1 lighter (#0f172a/#020617) than /apps
   (#070c18/#050812), so the same menu changed shade between pages. These
   tokens hold the /apps (reference) values and are scoped to the menu, so
   no page token can change it and nothing outside the menu is affected. */
.account-dropdown {
  --pd-dd-tint:    linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.035));
  --pd-dd-base:    linear-gradient(180deg, #070c18, #050812);
  --pd-dd-border:  rgba(255,255,255,.09);
  --pd-dd-text:    #e5e7eb;
  --pd-dd-muted:   #94a3b8;
  --pd-dd-hover:   rgba(255,255,255,.06);
  --pd-dd-shadow:  0 20px 40px rgba(0,0,0,.4);
  position: absolute; top: calc(100% + 6px); right: 0;
  min-width: 250px; display: none; flex-direction: column; gap: 2px;
  padding: 8px; border-radius: 12px; border: 1px solid var(--pd-dd-border);
  color: var(--pd-dd-text);
  /* Opaque dark base first so the menu stays readable even where
     backdrop-filter isn't supported/applied (notably mobile Safari) —
     the subtle panel gradient just tints it, it's not what hides the
     page behind it. */
  background: var(--pd-dd-tint), var(--pd-dd-base);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--pd-dd-shadow);
  z-index: 200;
  animation: navbarDdFade 120ms ease-out;
  /* Cap + scroll internally instead of expanding the page's scrollable
     area on short views. */
  max-height: calc(100vh - 90px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.15) transparent;
}
.account-dropdown::-webkit-scrollbar { width: 8px; }
.account-dropdown::-webkit-scrollbar-track { background: transparent; }
.account-dropdown::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 999px; }
.account-dropdown::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.25); }

@keyframes navbarDdFade {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.account-menu.open .account-dropdown { display: flex; }

/* ─── Identity header ───
   The whole block is a link to the user's own Community profile
   (/api/community/me/profile) — a real <a>, not a button, so it's a normal
   keyboard-focusable/middle-clickable navigation target like every other
   row in this menu. */
.dd-identity {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px 10px;
  color: inherit; text-decoration: none;
  border-radius: 8px;
}
.dd-identity:hover { background: var(--pd-dd-hover, rgba(255,255,255,.06)); }

.dd-avatar {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff; font-size: 13px; font-weight: 700;
  overflow: hidden;
}
.dd-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* User avatars, every surface (2026-10-12). Every avatar <img> carries
   class pd-avatar-img plus intrinsic width/height attributes, so it can
   never render at the photo's natural size — not even before (or without)
   the page's own avatar CSS. It fills its round/square frame (cover, so a
   non-square upload is cropped, never stretched). The no-drag / no-callout
   / no-select rules (and the avatar-only context-menu handler in
   account-dropdown.js) are a casual deterrent only: anything a browser
   displays can still be captured.
   :where() keeps this at zero specificity, so each surface's own size rule
   (.pdn-avatar 32px, .profile-avatar img 100% of 64px, ...) still wins; the
   96px cap (largest avatar drawn is 64px) holds even when a frame has no
   size of its own. */
:where(img.pd-avatar-img) {
  display: block;
  width: 100%; height: 100%;
  max-width: 96px; max-height: 96px;
  object-fit: cover;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.dd-identity-text { min-width: 0; flex: 1; }

.dd-identity-name-row { display: flex; align-items: center; gap: 6px; min-width: 0; }
.dd-identity-name {
  font-size: 13px; font-weight: 600; color: var(--pd-dd-text, var(--text));
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0;
}
.dd-identity-handle {
  font-size: 12px; color: var(--pd-dd-muted, var(--muted)); margin-top: 1px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Reuses the same visual language as shared.css's .pro-badge (gold PRO
   pill) — a distinct amber/gray pair scoped to this menu so ADMIN reads as
   a different, higher tier at a glance without a third unrelated color. */
.dd-identity-badge {
  flex-shrink: 0; display: inline-flex; align-items: center;
  padding: 1px 6px; border-radius: 5px;
  font-size: 9px; font-weight: 700; letter-spacing: .05em;
}
.dd-identity-badge.pro   { color: #1a1a1a; background: #f5b400; }
.dd-identity-badge.admin { color: #fff; background: var(--accent); }
.dd-identity-badge[hidden] { display: none; }

.dd-divider { height: 1px; background: var(--pd-dd-border, var(--border)); margin: 4px 6px; flex-shrink: 0; }

.account-dropdown button {
  display: flex; align-items: center; gap: 10px;
  height: 36px; border-radius: 8px; border: 1px solid transparent;
  background: transparent; color: var(--pd-dd-text); text-align: left;
  padding: 0 10px; cursor: pointer; font-size: 13px; font-family: inherit;
  white-space: nowrap; width: 100%; flex-shrink: 0;
}
.account-dropdown button:hover  { background: var(--pd-dd-hover); }
.account-dropdown button.danger { color: var(--missed); }

.dd-icon { width: 15px; height: 15px; flex-shrink: 0; color: var(--pd-dd-muted, var(--muted)); }
.account-dropdown button:hover .dd-icon  { color: var(--pd-dd-text); }
.account-dropdown button.danger .dd-icon { color: var(--missed); }

.dd-badge-soon {
  margin-left: auto; flex-shrink: 0;
  font-size: 10px; font-weight: 500; padding: 2px 6px; border-radius: 5px;
  background: var(--panel); border: 1px solid var(--border); color: var(--muted);
  text-transform: uppercase; letter-spacing: .04em;
}

.dd-status-dot {
  width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
  background: var(--hit); box-shadow: 0 0 5px var(--hit);
}
.dd-status-dot.degraded { background: var(--pending); box-shadow: 0 0 5px var(--pending); }
.dd-status-dot.issue    { background: var(--missed);  box-shadow: 0 0 5px var(--missed); }

/* ─── Nav utility buttons (logged-out Login/Create Free Account CTAs) ─── */
.nav-btn {
  height: 40px;
  padding: 0 16px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  line-height: 1;
  transition: background 150ms, box-shadow 150ms, transform 100ms;
}

.nav-btn.primary {
  background: linear-gradient(135deg, var(--accent), #2563eb);
  color: #fff;
  border: none;
  box-shadow: 0 4px 12px rgba(59,130,246,.3);
}
.nav-btn.primary:hover {
  box-shadow: 0 6px 18px rgba(59,130,246,.45);
  transform: translateY(-1px);
}

.nav-btn.secondary {
  background: var(--panel2);
  color: var(--text);
  border: 1px solid var(--border);
}
.nav-btn.secondary:hover {
  background: var(--panel);
  border-color: rgba(255,255,255,0.18);
}


/* =============================================================
   RESPONSIVE SECTION NAVIGATION — every page whose section nav uses the
   canonical `#topbarNav` id: Builder/Research/Schedule/Active/History/
   Stats (app.html, which also carries the `#sportSwitcher` state source),
   Community + profiles + posts, Account, Billing, Help, Notifications,
   Status, the legal pages, the homepage and the signed-in share page.
   Scoped to the id, not the bare `.topbar__nav` class (2026-10-03: the
   homepage used its own `#homeTopbarNav` and kept the pre-10-01 pills
   until it moved onto `#topbarNav` too).

   One component, three layouts. The controls are built by /mobile-nav.js
   (`.pd-mnav`: a page slot + a sport slot, each a control + its menu);
   CSS alone decides which parts show. The header is ONE row in FULL and
   COMPACT and never wraps; only MOBILE uses a second row, by design.

   FULL    ≥1240px : brand | flat section tabs … [sport ▾] | ? bell Account
   COMPACT 561–1239: brand | [icon Section ▾] [icon Sport ▾] … | ? bell Account
   MOBILE  ≤560px  : brand … ? bell Account
                     [icon Section ▾ (fills)]           [icon Sport ▾]

   [Sport ▾] only on sport-scoped sections (Builder, Research, Schedule,
   Stats — the allowlist in mobile-nav.js); everywhere else its slot is
   [hidden] and the section control / actions close the gap.

   Since Unified Game Center Phase 1 (2026-11-09, nine sections) FULL
   starts at 1320px: at 1200 the ninth tab put the sport control under the
   "?" button, and below ~1304 the tabs come closer than 48px to the sport
   control. At 1320: ~64px tabs→sport, ~60px sport→actions.
   (History) 1240 = Builder's FULL row measured at its natural size (1166px: brand
   124 + tabs 584 + sport 98 + ?/bell/Account 190 + gaps/padding) plus
   ~74px of slack, so the tabs never sit flush against the sport control
   or the actions. Builder is the widest page (only one with `?`); every
   page switches at the same width so the header never differs between
   pages at one window size. Keep in sync with FULL_MIN in mobile-nav.js.

   The `#sportSwitcher` pill row (app.html) is never displayed: it stays
   in the DOM as app.js's sport state, and the sport menu forwards picks
   to it.
   ============================================================= */
#topbarNav { flex-wrap: nowrap; }
#topbarNav .sport-switcher-group,
#topbarNav .nav-divider { display: none; }

.pd-mnav { display: none; }
#topbarNav .pd-mnav {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.pd-mnav__slot { position: relative; min-width: 0; }
.pd-mnav__slot--sport { flex: 0 0 auto; }

/* ─── Controls (desktop size; MOBILE enlarges to 44px touch targets) ─── */
.pd-mnav__ctl {
  appearance: none;
  -webkit-appearance: none;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 40px;
  margin: 0;
  padding: 0 11px 0 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.04);
  color: #fff;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background .12s ease, border-color .12s ease;
}
.pd-mnav__ctl:active { background: rgba(255,255,255,.07); }
/* Menu-open treatment (the active-tab blue) — distinct from the
   current-page marker inside the menu. */
.pd-mnav__ctl.is-open {
  background: rgba(80,140,255,.18);
  border-color: rgba(80,140,255,.35);
}
/* Neutralize the page-level `button:focus` ring/border (apps/styles.css)
   so a clicked control doesn't keep looking "open"; keyboard focus still
   gets a visible outline. */
.pd-mnav__ctl:focus { outline: none; box-shadow: none; }
.pd-mnav__ctl:focus:not(.is-open) { border-color: rgba(255,255,255,.12); }
.pd-mnav__ctl:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.pd-mnav__ctl-icon { display: flex; flex-shrink: 0; color: rgba(255,255,255,.92); }
.pd-mnav__icon { width: 18px; height: 18px; display: block; flex-shrink: 0; }
.pd-mnav__label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pd-mnav__caret {
  width: 15px; height: 15px; flex-shrink: 0;
  color: var(--muted);
  transition: transform .15s ease;
}
.pd-mnav__ctl.is-open .pd-mnav__caret { transform: rotate(180deg); color: #fff; }

/* ─── Menus: overlay the page (absolute inside the sticky .topbar, whose
   z-index:100 stacking context already sits above page content) — same
   surface as the Account dropdown. Each menu is anchored to its own
   control and at least as wide as it: the sport menu is exactly the
   control's width (its labels are short), the page menu grows to fit
   "Community". ─── */
.pd-mnav__menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 2px;
  box-sizing: border-box;
  min-width: 100%;
  width: max-content;
  max-width: calc(100vw - 32px);
  padding: 5px;
  border-radius: 12px;
  border: 1px solid var(--border);
  /* One surface on every page (2026-11-18): the app's own base colours,
     not var(--bg0/--bg1) — shared.css (public sports pages, Community,
     Account) defines those lighter (#0f172a/#020617), which made the
     signed-out sport menu a different shade from the signed-in one. */
  background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.035)), linear-gradient(180deg, var(--pd-menu-bg0, #070c18), var(--pd-menu-bg1, #050812));
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 20px 40px rgba(0,0,0,.4);
  max-height: calc(100vh - 140px);
  max-height: calc(100dvh - 140px);
  overflow-y: auto;
  overscroll-behavior: contain;
  animation: navbarDdFade 120ms ease-out;
}
.pd-mnav__menu[hidden] { display: none; }
.pd-mnav__menu--sport { left: auto; right: 0; width: auto; }

.pd-mnav__item {
  appearance: none;
  -webkit-appearance: none;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 38px;
  margin: 0;
  padding: 0 12px 0 9px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.pd-mnav__item .pd-mnav__icon { color: var(--muted); }
.pd-mnav__item:active { background: rgba(255,255,255,.06); }
.pd-mnav__item:focus { outline: none; box-shadow: none; }
.pd-mnav__item:focus:not(.is-current) { border-color: transparent; }
.pd-mnav__item:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
/* Current page / current sport — ParlayDesk blue. */
.pd-mnav__item.is-current {
  background: rgba(80,140,255,.18);
  border-color: rgba(80,140,255,.35);
  color: #fff;
  font-weight: 600;
}
.pd-mnav__item.is-current .pd-mnav__icon { color: #93b9ff; }

@media (hover: hover) {
  .pd-mnav__ctl:hover { background: rgba(255,255,255,.07); }
  .pd-mnav__ctl.is-open:hover { background: rgba(80,140,255,.22); }
  .pd-mnav__item:hover { background: rgba(255,255,255,.06); }
  .pd-mnav__item.is-current:hover { background: rgba(80,140,255,.22); }
}

/* ─── FULL (≥1240px): flat section tabs + the sport control ─── */
@media (min-width: 1320px) {
  #topbarNav { gap: 16px; }
  #topbarNav .mode-tabs { flex-wrap: nowrap; gap: 2px; flex-shrink: 0; }
  /* Flat: inactive tabs are text with a hover wash; only the current
     page gets the blue highlight. Replaces seven outlined pills. */
  #topbarNav .mode-tab {
    padding: 10px 12px;
    border-radius: 10px;
    border-color: transparent;
    background: transparent;
    color: rgba(255,255,255,.66);
    white-space: nowrap;
    transition: background .12s ease, color .12s ease, border-color .12s ease;
  }
  #topbarNav .mode-tab:focus { box-shadow: none; }
  #topbarNav .mode-tab:focus:not(.active) { border-color: transparent; }
  #topbarNav .mode-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
  #topbarNav .mode-tab.active {
    background: rgba(80,140,255,.18);
    border-color: rgba(80,140,255,.30);
    color: #fff;
  }
  /* Sport control sits at the end of the nav, next to the actions. */
  #topbarNav .pd-mnav { margin-left: auto; }
  .pd-mnav__slot--page { display: none; }
}
/* Eight sections (Tonight, v1.5): a little less padding until the window
   is wide enough, so the sport control keeps its clearance at 1320px. */
@media (min-width: 1320px) and (max-width: 1365.98px) {
  #topbarNav .mode-tab { padding: 10px 9px; }
}
@media (min-width: 1320px) and (hover: hover) {
  #topbarNav .mode-tab:hover { background: rgba(255,255,255,.06); color: #fff; }
  #topbarNav .mode-tab.active:hover { background: rgba(80,140,255,.22); }
}

/* ─── COMPACT + MOBILE (<1240px): the tabs give way to the page control ─── */
@media (max-width: 1319.98px) {
  #topbarNav .mode-tabs { display: none; }
}

/* ─── COMPACT (561–1239px): one row, the two controls follow the brand ─── */
@media (min-width: 720.02px) and (max-width: 1319.98px) {
  /* Fixed-ish width so switching sections doesn't shift the sport control;
     longer page names ("Resp. Gambling") still grow it. */
  .pd-mnav__slot--page { flex: 0 0 auto; }
  .pd-mnav__slot--page .pd-mnav__ctl { min-width: 160px; }
}

/* ─── MOBILE (≤560px): brand/actions row + a full-width controls row ─── */
@media (max-width: 720px) {
  /* column-gap is only the minimum brand↔actions spacing (.topbar__right
     has margin-left:auto). 20px made Builder's brand + ?/bell/Account wrap
     at 375px (2px short) and every page wrap at 320px; 10px keeps them on
     one row there. Builder at <~333px still wraps (one extra 40px button). */
  .topbar:has(#topbarNav) {
    flex-wrap: wrap;
    row-gap: 10px;
    padding-bottom: 10px;
    column-gap: 10px;
  }
  .topbar:has(#topbarNav) .topbar-left,
  .topbar:has(#topbarNav) .topbar__left { order: 1; }
  .topbar:has(#topbarNav) .topbar-right,
  .topbar:has(#topbarNav) .topbar__right { order: 2; margin-left: auto; }
  /* min-height reserves the controls' row before /mobile-nav.js mounts,
     so the header never grows after first paint. */
  #topbarNav {
    order: 3;
    flex-basis: 100%;
    width: 100%;
    min-height: 44px;
  }
  /* Signed-out dual pages keep #topbarNav [hidden] — nothing to reserve. */
  #topbarNav[hidden] { min-height: 0; }

  #topbarNav .pd-mnav { width: 100%; }
  .pd-mnav__slot--page { flex: 1 1 auto; }

  .pd-mnav__ctl {
    height: 44px;
    padding: 0 12px;
    font-size: 15px;
  }
  .pd-mnav__icon { width: 20px; height: 20px; }
  .pd-mnav__caret { width: 16px; height: 16px; }
  .pd-mnav__menu { padding: 6px; }
  .pd-mnav__item {
    gap: 12px;
    height: 44px;
    padding: 0 12px 0 10px;
    font-size: 15px;
  }
}

/* 320-class phones: tighten padding/gaps so long section names fit. */
@media (max-width: 359px) {
  #topbarNav .pd-mnav { gap: 6px; }
  .pd-mnav__ctl { padding: 0 9px; gap: 6px; font-size: 13.5px; }
  .pd-mnav__caret { width: 13px; height: 13px; }
}

/* =============================================================
   PUBLIC SITE CONFIGURATION (Homepage 2.0, 2026-11-17)
   The same #topbarNav, carrying the public links (Home / Game Center /
   Trending / Pricing) for signed-out visitors: `topbar__nav--site` +
   `data-site-nav`. On sign-in PDAccountMenu swaps them for the app's
   sections and drops the class, so everything above applies unchanged.
   Four short links fit flat from 900px; below that the page control
   (/mobile-nav.js) carries them, exactly like every other page.
   ============================================================= */
@media (min-width: 900px) {
  #topbarNav.topbar__nav--site { gap: 4px; }
  #topbarNav.topbar__nav--site .mode-tabs { display: flex; flex-wrap: nowrap; gap: 2px; flex-shrink: 0; }
  #topbarNav.topbar__nav--site .mode-tab {
    padding: 10px 12px;
    border-radius: 10px;
    border-color: transparent;
    background: transparent;
    color: rgba(255,255,255,.7);
    white-space: nowrap;
    transition: background .12s ease, color .12s ease;
  }
  #topbarNav.topbar__nav--site .mode-tab:focus { box-shadow: none; }
  #topbarNav.topbar__nav--site .mode-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
  #topbarNav.topbar__nav--site .mode-tab.active { background: rgba(80,140,255,.16); border-color: rgba(80,140,255,.28); color: #fff; }
  #topbarNav.topbar__nav--site .pd-mnav { display: none; }
}
@media (min-width: 900px) and (hover: hover) {
  #topbarNav.topbar__nav--site .mode-tab:hover { background: rgba(255,255,255,.06); color: #fff; }
}

/* Signed-out CTA label swap ("Create free account" → "Sign up" on phones).
   Same rule the legal / public sports pages each carried (legal.css,
   public-pages.css); defined once here for every page on this navbar. */
.cta-full { display: inline; }
.cta-short { display: none; }
@media (max-width: 440px) {
  .cta-full { display: none; }
  .cta-short { display: inline; }
}

/* ---- iOS focus-zoom guard: ONE shared rule for every page (2026-11-19) ----
   iOS Safari (and every iOS browser — all WebKit) zooms the page when a
   focused text control's computed font-size is below 16px, and the page can
   stay zoomed after the keyboard closes. The earlier guards were per-selector
   lists at max-width 560px (apps/styles.css, research.css, pd-ui.css, …): any
   new component (Builder 2.0 #b2Search 13px, History 2.0 filters 14px, Clerk
   sign-in/up fields 13px) slipped through, and iPhone LANDSCAPE (667–932px
   wide) was never covered at all.
   This sheet is loaded on every page (directly by app.html/public-parlay,
   via shared.css's @import everywhere else, server-rendered public pages
   included), so this is the single root-cause rule:
   - touch-first devices only — (hover: none) and (pointer: coarse) — plus any
     iOS WebKit via @supports (-webkit-touch-callout: none) (iPad with a
     trackpad). Desktop / mouse layouts are untouched.
   - text-like inputs, select, textarea, contenteditable — never checkboxes,
     radios, ranges, file or button-type inputs.
   - !important so component rules of any specificity (and Clerk's own
     classes) can't undercut it; only font-size changes, never the box.
   Pinch-zoom and the viewport meta are deliberately left alone (no
   maximum-scale / user-scalable). Regression: scripts/testIosInputZoom.js
   (static) + scripts/_iosInputZoomAudit.js (WebKit, real pages). */
@media (hover: none) and (pointer: coarse) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]):not([type="hidden"]):not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="image"]),
  select,
  textarea,
  [contenteditable]:not([contenteditable="false"]) {
    font-size: 16px !important;
  }
}
@supports (-webkit-touch-callout: none) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]):not([type="hidden"]):not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="image"]),
  select,
  textarea,
  [contenteditable]:not([contenteditable="false"]) {
    font-size: 16px !important;
  }
}

/* ─── Nested sections in the page menu (v2.2.1 mobile navigation
   correction, 2026-11-23): Research and Game Center are expandable
   parents on phones (≤720px; /mobile-nav.js GROUPS). Wider layouts keep
   the flat menu — the parent is a plain item there and its children never
   show (the page's own tabs do the job). ─── */
.pd-mnav__group { display: contents; }
.pd-mnav__sub,
.pd-mnav__item--parent .pd-mnav__caret,
.pd-mnav__sublabel { display: none; }
.pd-mnav__item-t { flex: 1 1 auto; min-width: 0; }

@media (max-width: 720px) {
  .pd-mnav__group { display: flex; flex-direction: column; gap: 2px; }
  .pd-mnav__item--parent .pd-mnav__caret { display: block; margin-left: auto; transition: transform .15s ease; }
  .pd-mnav__group.is-expanded > .pd-mnav__item--parent .pd-mnav__caret { transform: rotate(180deg); }
  /* The current section's parent: blue text only — the blue fill marks the
     current CHILD (one highlighted destination). */
  .pd-mnav__group.has-current > .pd-mnav__item--parent.is-current {
    background: transparent;
    border-color: transparent;
  }
  .pd-mnav__group.has-current > .pd-mnav__item--parent.is-current .pd-mnav__icon { color: #93b9ff; }
  .pd-mnav__sub:not([hidden]) {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: 0 0 4px 19px;          /* under the parent's icon */
    padding-left: 12px;
    border-left: 1px solid rgba(255,255,255,.12);
  }
  .pd-mnav__item--child {
    height: 40px;
    padding: 0 12px;
    font-size: 14.5px;
    color: var(--muted);
    text-decoration: none;
  }
  .pd-mnav__item--child[hidden] { display: none; }
  .pd-mnav__item--child.is-current { color: #fff; }
  .pd-mnav__pro {
    margin-left: 8px;
    padding: 2px 6px;
    border-radius: 999px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .04em;
    color: #f5c451;
    border: 1px solid rgba(245,196,81,.45);
    line-height: 1.2;
  }
  /* The control names the current sub-section ("Slate Explorer") in place
     of the section name (mobile-nav.js; the parent's icon stays). */
  .pd-mnav__ctl.has-sub .pd-mnav__label { display: none; }
  .pd-mnav__ctl.has-sub .pd-mnav__sublabel:not([hidden]) {
    display: block;
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

/* Phones: the global menu above carries Research's and Game Center's
   sections, so the pages' own section tabs step aside (one navigation
   system, no second row of tabs). Game Center keeps its search, which
   takes the full row. Wider layouts are unchanged. */
@media (max-width: 720px) {
  #researchView #researchModeTabs { display: none !important; }
  .gcx > .gcx-tabs { display: none !important; }
  .gcx.gcx--nosearch { display: none !important; }
  .gcx > .gcx-search { flex: 1 1 100%; margin: 0; }
}
