/* ==========================================================================
   App shell (design-data): the sidebar and its sport picker, the top bar
   and page tabs, the phone's bottom tab bar, the footer disclaimer, and
   everything layered over a page - the search palette, the More menu,
   toasts, dialogs, the slip's launcher, the support widget and the tour's
   card. Loaded after styles.css; tokens only (docs/design-system.md).
   ========================================================================== */

/* the type scale is the type scale on a phone too: no browser text boosting */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

/* ---- sidebar ---- */
.sidebar { background: var(--surface); border-right: 1px solid var(--line); }
.sidebar .sb-top { padding: 14px 14px 10px; }

/* the sport picker: the league's icon in its own colour, the league, its
   sport, a chevron */
.sport-menu { padding: 0 12px 6px; }
.sport-menu .sm-btn {
  grid-template-columns: auto minmax(0, 1fr) auto; column-gap: 10px;
  min-height: 52px; padding: 7px 10px 7px 8px; background: var(--surface-2);
}
.sport-menu .sm-btn > .sm-ico {
  grid-column: 1; grid-row: 1 / span 2; width: 34px; height: 34px; padding: 7px;
  box-sizing: border-box; border-radius: 8px;
  color: var(--accent-text); background: color-mix(in srgb, var(--accent) 16%, var(--surface));
  border: 1px solid var(--accent-line);
}
.sport-menu .sm-btn > .sm-k, .sport-menu .sm-btn > .sm-v { grid-column: 2; }
.sport-menu .sm-btn > .sm-caret { grid-column: 3; }
.sport-menu .sm-k { font: 500 11px/1.3 var(--font-body); letter-spacing: 0; text-transform: none; color: var(--faint); }
.sport-menu .sm-lg { color: var(--text-strong); }
.sport-menu .sm-item[aria-checked="true"] { background: var(--accent-soft); color: var(--text-strong); }
.sport-menu .sm-item[aria-checked="true"] .sm-check { color: var(--accent-text); }

/* the page links: an icon, a label, the selected one marked in the accent */
.sb-nav-list { padding: 6px 10px; gap: 2px; }
.sb-link {
  min-height: 38px; padding: 0 10px; gap: 12px; border-radius: var(--r-control);
  font: 500 14px/1 var(--font-body); color: var(--muted);
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.sb-link .ico { width: 18px; height: 18px; }
.sb-link:hover { color: var(--text-strong); }
.sb-link.on { color: var(--text-strong); background: var(--surface-3); box-shadow: inset 2px 0 0 var(--accent); }
.sb-link.on .ico { color: var(--accent-text); }
.sb-chats-head { font: 600 11px/1 var(--font-body); letter-spacing: .04em; text-transform: uppercase; color: var(--faint); }
.conv-search {
  height: 34px; border-radius: var(--r-control);
  background: var(--surface-2); border: 1px solid var(--line); color: var(--text);
}
.conv-search:focus { outline: none; border-color: var(--accent-line); box-shadow: var(--ring); }
.sb-foot { border-top: 1px solid var(--line); }

/* ---- top bar and page tabs ---- */
.topbar { background: var(--bg); padding: 0 18px; min-height: 56px; }
.topbar .tabs { align-self: stretch; }
.topbar .tab { display: inline-flex; align-items: center; gap: 6px; height: 100%; padding: 0 12px; }
.topbar .tab .i { display: none; }
.topbar .tab.more .i-sm { display: inline-block; width: 14px; height: 14px; }
.topbar .tab.on::after { left: 12px; right: 12px; bottom: 0; height: 2px; background: var(--accent); }
.health { border: 0; padding: 0 4px; font-size: 12px; color: var(--faint); background: transparent; }
/* a tablet keeps the top bar to one row: the status line gives way first */
@media (max-width: 1000px) {
  .topbar { flex-wrap: nowrap; }
  .topbar .health { display: none; }
}
.tb-sport { display: none; }
.tb-sport-body { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }

/* ---- the footer disclaimer: quiet small print at the foot of the column ---- */
.main-col > footer {
  padding: 10px 24px 12px; border-top: 1px solid var(--line);
  background: var(--bg); color: var(--faint);
  font-size: 11.5px; line-height: 1.5; text-align: center;
}
.main-col > footer a { color: var(--muted); text-decoration: none; }
.main-col > footer a:hover { color: var(--text-strong); text-decoration: underline; }
/* clear of the help launcher in the bottom-right corner (both sides, so it stays centred) */
@media (min-width: 621px) {
  .main-col > footer { padding-left: 84px; padding-right: 84px; }
}

/* ---- a phone: a compact top bar with the sport picker, the pages in a
   bottom tab bar (44px targets, clear of the home indicator) ---- */
@media (max-width: 620px) {
  .topbar { min-height: 52px; padding: 0 8px 0 4px; gap: 4px; }
  .topbar .tb-sport {
    display: inline-flex; align-items: center; gap: 8px; min-width: 0; flex: 0 1 auto;
    height: 40px; padding: 0 10px 0 6px; margin-right: auto;
    font: 600 15px/1 var(--font-body); color: var(--text-strong);
    background: transparent; border: 0; border-radius: var(--r-control); cursor: pointer;
  }
  .tb-sport:hover { background: color-mix(in srgb, var(--tint) 5%, transparent); }
  .tb-sport .tb-sport-ico {
    display: inline-grid; place-items: center; width: 30px; height: 30px; flex: none; border-radius: 8px;
    color: var(--accent-text); background: color-mix(in srgb, var(--accent) 16%, var(--surface));
    border: 1px solid var(--accent-line);
  }
  .tb-sport .tb-sport-ico .i { width: 17px; height: 17px; }
  .tb-sport .tb-sport-nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .tb-sport > .i-sm { width: 14px; height: 14px; color: var(--muted); flex: none; }
  .topbar #sbToggle { width: 44px; height: 44px; }
  .topbar-right { gap: 2px; }
  .topbar-right .icon-btn { width: 44px; height: 44px; }

  /* the tab row leaves the top bar for the bottom of the screen */
  .main-col { padding-bottom: calc(58px + env(safe-area-inset-bottom, 0px)); }
  .topbar .tabs {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    display: flex; flex-wrap: nowrap; gap: 0; overflow: visible;
    height: calc(58px + env(safe-area-inset-bottom, 0px));
    padding: 0 env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
    background: var(--surface); border-top: 1px solid var(--line);
    -webkit-mask-image: none; mask-image: none;
  }
  .topbar .tabs .tab {
    flex: 1 1 0; min-width: 0; height: 58px; padding: 7px 2px 6px; border-radius: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    font: 500 11px/1 var(--font-body); color: var(--muted);
  }
  .topbar .tabs .tab[hidden] { display: none; }
  .topbar .tabs .tab .i { display: block; width: 22px; height: 22px; }
  .topbar .tabs .tab.more .i-sm { display: none; }
  .topbar .tabs .tab:hover { background: transparent; color: var(--text); }
  .topbar .tabs .tab.on { color: var(--accent-text); background: transparent; }
  .topbar .tabs .tab.on::after { left: 30%; right: 30%; top: 0; bottom: auto; height: 2px; border-radius: 0 0 2px 2px; }

  /* the disclaimer stays on screen, set small and tight */
  .main-col > footer { padding: 7px 14px 8px; font-size: 10.5px; line-height: 1.4; }
}

/* ---- the search palette ---- */
.palette { background: var(--scrim); }
.palette-card {
  border-radius: var(--r-dialog); border: 1px solid var(--line);
  background: var(--surface); box-shadow: var(--shadow-overlay); overflow: hidden;
}
.palette-input { height: 52px; padding: 0 18px; font-size: 16px; background: transparent; border-bottom: 1px solid var(--line); }
.palette-input:focus { border-bottom-color: var(--line); }
.pal-group { font: 600 11px/1 var(--font-body); letter-spacing: .04em; text-transform: uppercase; color: var(--faint); }
.pal-row { min-height: 40px; border-radius: var(--r-control); gap: 12px; }
.pal-row.on { background: var(--surface-3); }
.pal-ico { display: inline-grid; place-items: center; width: 20px; color: var(--muted); }
.pal-ico .i { width: 18px; height: 18px; }
.pal-row.on .pal-ico { color: var(--accent-text); }

/* ---- the More menu ---- */
.more-menu { background: var(--surface); border: 1px solid var(--line); padding: 6px; min-width: 220px; }
.more-menu button { min-height: 38px; border-radius: var(--r-control); font-size: 14px; }

/* ---- toasts: a status edge, no glow ---- */
.toast {
  border: 1px solid var(--line); border-left: 3px solid var(--line); border-radius: var(--r-card);
  background: var(--surface-2); box-shadow: var(--shadow-overlay); font-size: 13px;
}
.toast.ok { border-left-color: var(--pos); }
.toast.err { border-left-color: var(--neg); }
@media (max-width: 620px) {
  .toasts { bottom: calc(68px + env(safe-area-inset-bottom, 0px)); }
}

/* ---- dialogs and drawers ---- */
.modal { background: var(--scrim); }
.modal-card { border-radius: var(--r-dialog); border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow-overlay); }
.modal-card h2 { font: 600 20px/1.25 var(--font-body); letter-spacing: -.01em; color: var(--text-strong); }
.modal-card .sub { color: var(--muted); }
.modal-card > .x, .drawer-card > .x {
  width: 36px; height: 36px; display: grid; place-items: center; border-radius: var(--r-control);
  color: var(--muted); background: transparent; border: 0; font-size: 22px; line-height: 1;
}
.modal-card > .x:hover, .drawer-card > .x:hover { color: var(--text-strong); background: var(--surface-3); }
.drawer-card { background: var(--surface); border-left: 1px solid var(--line); box-shadow: var(--shadow-overlay); }

/* ---- the slip's launcher and the support launcher ---- */
.slip-fab { border-radius: var(--r-control); background: var(--surface-2); }
.slip-fab:hover { border-color: var(--accent-line); }
.slip-fab-n { background: var(--accent); color: var(--accent-ink); border-radius: 999px; }
/* a wide screen: slip.js lifts the launcher over the pinned footer only on
   a phone or tablet, so here it stacks above the help launcher instead of
   sitting on the footer's 21+ / 1-800-GAMBLER line */
@media (min-width: 901px) {
  .slip-fab { right: 18px; bottom: calc(var(--slip-fab-bottom, 18px) + 62px); }
}
.sup-launch { width: 48px; height: 48px; background: var(--surface-2); transition: border-color var(--t-fast) var(--ease); }
.sup-launch:hover { transform: none; border-color: var(--accent-line); }
.sup.on .sup-launch { border-color: var(--accent-line); }
.sup-dot { background: var(--accent); }
.sup-panel { border-radius: var(--r-dialog); border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow-overlay); }

/* ---- the first-visit tour's card ---- */
.ob-card {
  border: 1px solid var(--line); border-top: 3px solid var(--accent);
  border-radius: var(--r-dialog); background: var(--surface); padding: 18px 18px 14px;
}
.ob-ring { outline: 2px solid var(--accent); outline-offset: 3px; }
.ob-count { font: 600 11px/1.2 var(--font-body); }
.ob-title { font: 600 18px/1.3 var(--font-body); letter-spacing: -.01em; color: var(--text-strong); }
.ob-dots i.on { background: var(--accent); }
.ob-tour button:focus-visible, .ob-try-chip:focus-visible, .ob-empty .ghost-btn:focus-visible { outline: var(--focus); }
@media (max-width: 600px) {
  .ob-card, .ob-card.ob-at { bottom: calc(68px + env(safe-area-inset-bottom, 0px)); }
}

/* ---- focus: visible, in the theme's ring ---- */
.sb-link:focus-visible, .tab:focus-visible, .tb-sport:focus-visible, .pal-row:focus-visible,
.more-menu button:focus-visible, .sport-menu .sm-btn:focus-visible { outline: var(--focus); outline-offset: -2px; }
