/* ── Profile dropdown (click the header avatar while signed in) ─────────── */
.profile-menu {
  position: absolute;
  top: 62px;
  right: 8px;
  background: var(--bg-card, #fff);
  border: 1px solid var(--border, #ddd);
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  z-index: 9999;
  min-width: 190px;
  padding: 6px 0;
  animation: rl-pop 0.15s ease-out;
}
.profile-menu.hidden { display: none; }

.profile-menu-email {
  padding: 8px 14px;
  font-size: 0.78rem;
  color: var(--text-muted, #888);
  border-bottom: 1px solid var(--border, #eee);
  word-break: break-all;
}

.profile-menu-item {
  display: block;
  width: 100%;
  padding: 10px 14px;
  background: none;
  border: none;
  text-align: start;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text-primary, #111);
  transition: background 0.12s;
}
.profile-menu-item:hover { background: var(--bg-surface, #f5f5f5); }
.profile-menu-signout { color: #c0392b; }

/* ── Email/password auth modal ────────────────────────────────────────────── */
#auth-modal {
  position: fixed;
  inset: 0;
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
}

.am-modal { text-align: center; }

.am-close {
  position: absolute;
  top: 14px;
  inset-inline-end: 14px;
  background: none;
  border: none;
  font-size: 1.1rem;
  color: var(--text-muted, #888);
  cursor: pointer;
  line-height: 1;
  padding: 4px;
}
.am-close:hover { color: var(--text-primary, #111); }

.am-google-btn {
  width: 100%;
  background: var(--bg-surface, #f5f5f5);
  color: var(--text-primary, #111);
  border: 1px solid var(--border, #ddd);
  border-radius: 10px;
  padding: .75rem 1.5rem;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.am-google-btn:hover { background: var(--bg-card, #eee); }

.am-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0;
  color: var(--text-muted, #888);
  font-size: .8rem;
}
.am-divider::before, .am-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border, #ddd);
}

.am-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.am-input {
  width: 100%;
  box-sizing: border-box;
  padding: .7rem .9rem;
  border-radius: 10px;
  border: 1px solid var(--border, #ddd);
  background: var(--bg-base, #fff);
  color: var(--text-primary, #111);
  font-size: .92rem;
  text-align: start;
}
.am-input:focus { outline: 2px solid var(--accent-ink, #1a3a6b); outline-offset: 1px; }

.am-primary-btn {
  background: var(--accent, #1a3a6b);
  color: var(--accent-fg, #fff);
  border: none;
  border-radius: 10px;
  padding: .75rem 1.5rem;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  transition: opacity .15s;
}
.am-primary-btn:hover { opacity: .85; }
.am-primary-btn:disabled { opacity: .6; cursor: default; }

.am-toggle-link {
  display: block;
  width: 100%;
  background: none;
  border: none;
  color: var(--accent-ink, #1a3a6b);
  font-size: .82rem;
  cursor: pointer;
  margin-top: 12px;
  padding: 4px;
}
.am-toggle-link:hover { text-decoration: underline; }

.am-error {
  background: rgba(192,57,43,0.1);
  color: #c0392b;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: .8rem;
  margin-bottom: 12px;
  text-align: center;
}

.am-message {
  background: rgba(39,174,96,0.1);
  color: #1e8449;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: .8rem;
  margin-bottom: 12px;
  text-align: center;
  line-height: 1.4;
}

/* ── Favorite teams modal ─────────────────────────────────────────────────── */
#auth-favorites-modal {
  position: fixed;
  inset: 0;
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pm-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
}

.pm-modal {
  position: relative;
  background: var(--bg-card, #fff);
  border: 1px solid var(--border, rgba(0,0,0,0.1));
  border-radius: 20px;
  padding: 26px 22px 20px;
  width: min(480px, 92vw);
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 24px 60px rgba(0,0,0,0.2);
  animation: rl-pop 0.22s ease-out;
}

.pm-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary, #111);
  margin: 0 0 6px;
  text-align: center;
}

.pm-sub {
  font-size: 0.82rem;
  color: var(--text-muted, #666);
  text-align: center;
  margin: 0 0 18px;
  line-height: 1.4;
}

.pm-league-section { margin-bottom: 18px; }
.pm-league-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--accent-ink, #1d428a);
  margin-bottom: 8px;
}
/* The star's meaning previously lived only in a hover title="" tooltip,
   invisible on mobile (no hover) — reported live, 2026-09-18. This repeats
   per-league so it's still visible after scrolling past the modal's own
   top-of-page explanation, not just once above a 30-team NBA list. */
.pm-league-hint {
  font-size: 0.78rem;
  color: var(--text-secondary, #666);
  margin: -4px 0 8px;
}

.pm-team-grid {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--border, #eee);
  border-radius: 10px;
  padding: 4px;
}

.pm-team-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border-radius: 8px;
  transition: background 0.12s;
}
.pm-team-row.checked { background: var(--bg-surface, #f5f5f5); }

.pm-team-checkbox { width: 16px; height: 16px; cursor: pointer; flex-shrink: 0; }

.pm-team-name {
  flex: 1;
  font-size: 0.88rem;
  color: var(--text-primary, #111);
}

.pm-primary-star {
  background: none;
  border: none;
  font-size: 1.1rem;
  color: var(--border, #ccc);
  cursor: pointer;
  padding: 2px 4px;
  flex-shrink: 0;
  transition: color 0.12s;
  /* Hidden until its row is checked — a dimmed "disabled" star everywhere
     read as broken/faded styling rather than "not applicable yet". */
  visibility: hidden;
}
.pm-team-row.checked .pm-primary-star { visibility: visible; }
.pm-primary-star.active { color: #f0b429; }

.pm-done {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 11px;
  background: var(--accent, #1d428a);
  color: var(--accent-fg, #fff);
  border: none;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}
.pm-done:hover { opacity: 0.9; }

/* ── Auth Avatar (top nav) ─────────────────────────────────────────────── */
#auth-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  background: var(--bg-surface, #eee);
  color: var(--text-muted, #888);
  border: 1.5px solid var(--border, #ddd);
  transition: border-color 0.15s;
  flex-shrink: 0;
}

#auth-avatar.signed-in {
  background: var(--team-accent, #1d428a);
  color: var(--accent-fg, #fff);
  border-color: var(--team-accent, #1d428a);
}

/* ── App content-column width ──────────────────────────────────────────
   The whole app is laid out as a centered column (header, nav, every
   screen's outer wrap) capped at a phone-sized 480px — on a wide desktop
   browser that reads as a cramped strip with dead space on both sides.
   Widen the column on larger viewports via one shared variable instead of
   the ~15 places that used to hardcode "480px" independently, so desktop
   and mobile only ever need to agree in one place. */
:root {
  --app-max-width: 480px;
}

@media (min-width: 700px) {
  :root {
    --app-max-width: 900px;
  }
}

/* ── Team accent colors (applied via JS) ───────────────────────────────── */
:root {
  --team-accent: #1d428a;
  --team-accent-bg: #1d428a22;
}

/* ── Basketball term tooltips ──────────────────────────────────────────── */
.term-link {
  color: var(--accent-ink, #1d428a);
  text-decoration: underline dotted;
  cursor: pointer;
  position: relative;
  display: inline;
}

.term-popup {
  position: absolute;
  bottom: calc(100% + 6px);
  right: 0;
  min-width: 220px;
  max-width: 280px;
  background: var(--bg-card, #fff);
  border: 1px solid var(--border, #ddd);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--text-primary, #111);
  box-shadow: 0 4px 16px rgba(0,0,0,0.14);
  z-index: 9999;
  text-align: start;
  white-space: normal;
  pointer-events: none;
}
html[dir="rtl"] .term-popup { direction: rtl; }

/* ── Rate limit modal — Google button ─────────────────────────────────── */
.rl-google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 13px;
  background: #fff;
  border: 1.5px solid #dadce0;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  color: #3c4043;
  cursor: pointer;
  transition: box-shadow 0.15s;
}

.rl-google-btn:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.rl-google-btn svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.rl-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0;
  color: var(--text-muted, #aaa);
  font-size: 0.8rem;
}

.rl-divider::before,
.rl-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border, #eee);
}

/* ── Global search (magnifying glass in the header) ──────────────────────── */
#global-search-modal {
  position: fixed;
  inset: 0;
  z-index: 9998;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
}

.search-modal {
  text-align: center;
}

.search-close {
  position: absolute;
  top: 14px;
  inset-inline-end: 14px;
  background: none;
  border: none;
  font-size: 1.1rem;
  color: var(--text-muted, #888);
  cursor: pointer;
  line-height: 1;
  padding: 4px;
}
.search-close:hover { color: var(--text-primary, #111); }

.search-input {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border, #ddd);
  background: var(--bg-input, #f5f5f5);
  color: var(--text-primary, #111);
  font-size: 1rem;
  margin-bottom: 14px;
}
.search-input:focus {
  outline: none;
  border-color: var(--accent1, #2563eb);
}

.search-results {
  text-align: start;
  max-height: 50vh;
  overflow-y: auto;
}

.search-hint {
  color: var(--text-muted, #888);
  font-size: 0.9rem;
  text-align: center;
  padding: 20px 0;
}

.search-group-label {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent-ink, #1d428a);
  margin: 10px 0 6px;
}

.search-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 8px;
  border-radius: 10px;
  cursor: pointer;
}
.search-row:hover { background: var(--bg-card-hover, rgba(0,0,0,0.04)); }

.search-row-icon { font-size: 1.1rem; flex-shrink: 0; }
.search-row-name {
  flex: 1;
  font-size: 0.95rem;
  color: var(--text-primary, #111);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.search-row-league {
  font-size: 0.78rem;
  color: var(--text-muted, #888);
  flex-shrink: 0;
}
