/* =========================================================
   League Home v3 (league/home.html only): one-handed, easier-on-the-eyes pass.
   Same markup, same live data and scripts as league/home.html; this file only restyles.
   Everything is scoped to html[data-ht] (set on league/home.html) so no other page is touched.
   ========================================================= */

/* ---- 1. Softer dark palette (no pure white on near-black) ---- */
html[data-ht][data-theme="dark"] {
  --main-bg: #121317;
  --main-surface: #1a1c21;
  --main-surface-2: #212329;
  --main-border: #2c2f37;
  --main-text: #e3e5ea;
  --main-text-muted: #a3a8b3;
  --main-text-strong: #f0f1f4;
  --topbar-bg: rgba(18, 19, 23, 0.94);
  --link: #8ab4f8;
  --accent-num: #9cc3fb;
  --table-head: #1d1f25;
  --chip-bg: #1f2a3d;
  --chip-border: #34476a;
  --chip-text: #d3e1f8;
  --shadow: none;
}
html[data-ht][data-theme="light"] {
  --main-bg: #f2f3f5;
  --main-text: #262b33;
  --main-text-strong: #15181d;
}

html[data-ht] body .lg-community [hidden] { display: none !important; }

/* ---- 2. Readable base type ---- */
html[data-ht] body .lg-community {
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  max-width: 980px;
  margin-left: auto;
  margin-right: auto;
}
html[data-ht] body .lg-community .lg-muted,
html[data-ht] body .lg-community .cm-slate-note { color: var(--main-text-muted) !important; }
html[data-ht] body .lg-community h2 { font-size: 1.15rem; font-weight: 700; letter-spacing: -0.01em; }

/* ---- 3. Calmer cards: flat, one border, more air ---- */
html[data-ht] body .lg-community .lg-card {
  background: var(--main-surface) !important;
  border: 1px solid var(--main-border) !important;
  border-radius: 16px;
  box-shadow: none !important;
}
html[data-ht] body .lg-community .cm-section { padding: 1rem; }
html[data-ht] body .lg-community .cm-section-head { margin-bottom: 0.6rem; gap: 0.5rem; align-items: center; }

/* ---- 4. Slobtastic banner: original look, a touch calmer ---- */
html[data-ht] body .cm-hero { filter: saturate(0.85); }

/* ---- 5. Bigger tap targets (44px) everywhere you press ---- */
html[data-ht] body .lg-community .lg-btn,
html[data-ht] body .lg-community .cm-sched-btn,
html[data-ht] body .lg-community .cm-tx-tool,
html[data-ht] body .lg-community .cm-weeks-now,
html[data-ht] body .lg-community .cm-link,
html[data-ht] body .lg-community .cm-tile {
  min-height: 44px !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
html[data-ht] body .lg-community .cm-sched-btn {
  background: transparent !important;
  color: var(--link) !important;
  border: 1px solid var(--main-border) !important;
  box-shadow: none !important;
  padding: 0 0.85rem;
  font-size: 0.9rem;
  border-radius: 999px;
}
html[data-ht] body .lg-community .cm-weeks-arrows button { width: 44px; height: 44px; }
html[data-ht] body .lg-community .cm-wk { min-height: 52px; min-width: 64px; }
html[data-ht] body .lg-community .cm-link { padding: 0 0.6rem; }

html[data-ht] body .cm-weeks-head { flex-wrap: nowrap !important; align-items: center; }
html[data-ht] body .cm-weeks-head .cm-kicker { white-space: nowrap; flex: 0 0 auto; }
html[data-ht] body .cm-weeks-status { flex: 1 1 auto; min-width: 0; font-size: 0.85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html[data-ht] body .cm-weeks-arrows { flex: 0 0 auto; display: inline-flex; gap: 0.25rem; margin-left: auto; }

/* ---- 8. Matchup cards: each team on its own row, so full names fit ---- */
html[data-ht] body .cm-scoreboard { gap: 0.6rem; }
html[data-ht] body .cm-slate-card { border-radius: 14px; overflow: hidden; }
html[data-ht] body .cm-game {
  grid-template-columns: minmax(0, 1fr) auto !important;
  grid-template-rows: auto auto;
  column-gap: 0.75rem !important;
  row-gap: 0.45rem !important;
  padding: 0.75rem 0.85rem !important;
  background: var(--main-surface-2) !important;
}
html[data-ht] body .cm-game-side,
html[data-ht] body .cm-game-side.is-right {
  grid-column: 1;
  justify-content: flex-start !important;
  text-align: left !important;
  gap: 0.6rem !important;
}
html[data-ht] body .cm-game-side.is-right { flex-direction: row-reverse; grid-row: 2; }
html[data-ht] body .cm-game-side.is-right .cm-game-meta { flex: 1; }
html[data-ht] body .cm-game-side:not(.is-right) { grid-row: 1; }
html[data-ht] body .cm-game-side:not(.is-right) .cm-game-meta { flex: 1; }
html[data-ht] body .cm-game-meta,
html[data-ht] body .cm-game-meta.is-right {
  flex-direction: row !important;
  align-items: baseline !important;
  justify-content: space-between;
  text-align: left !important;
  gap: 0.6rem;
}
html[data-ht] body .cm-game-name {
  font-size: 0.98rem !important;
  font-weight: 600 !important;
  white-space: normal !important;
  overflow: visible !important;
  line-height: 1.3;
}
html[data-ht] body .cm-game-score { font-size: 1.05rem !important; flex: 0 0 auto; }
html[data-ht] body .cm-game-mid {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
}
html[data-ht] body .cm-game-mid .cm-vs-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 44px; min-height: 44px; border-radius: 12px;
  font-size: 0.72rem;
}
html[data-ht] body .cm-game-mid .cm-vs-badge {
  background: var(--main-surface) !important;
  border: 1px solid var(--main-border) !important;
  color: var(--main-text-muted) !important;
  box-shadow: none !important;
}
html[data-ht] body .cm-game .lg-team-avatar-fallback,
html[data-ht] body .cm-game .lg-team-avatar { width: 32px !important; height: 32px !important; flex: 0 0 32px; font-size: 0.72rem; }
/* MOTW keeps its gold edge, just quieter */
html[data-ht] body .cm-slate-card.is-motw-card { border-color: rgba(232, 197, 71, 0.55) !important; }
html[data-ht] body .cm-game.is-motw::after { display: none; }
html[data-ht] body .hx-motw-tags { padding: 0.65rem 0.85rem 0.2rem !important; }
html[data-ht] body .hx-motw-note { font-size: 0.88rem !important; }

/* series summary + whole strip is the "More" button */
html[data-ht] body .hx-sum {
  font-size: 0.88rem !important;
  padding: 0.55rem 0.85rem !important;
  min-height: 44px;
}
html[data-ht] body .hx-s-k { font-size: 0.68rem !important; }
html[data-ht] body .hx-more,
html[data-ht] body .hx-open .hx-more::after { font-size: 0.8rem !important; }
html[data-ht] body .hx-open .hx-more { font-size: 0 !important; }
html[data-ht] body .hx-more { padding: 0.35rem 0; }
html[data-ht] body .cm-slate-details { padding: 0.35rem 0.85rem 0.75rem; }
html[data-ht] body .cm-slate-details .hx-pill { font-size: 0.82rem !important; }

/* ---- 9. Standings: roomier rows, same columns ---- */
html[data-ht] body .hx-st { font-size: 0.95rem; width: 100%; }
html[data-ht] body .hx-st td,
html[data-ht] body .hx-st th { padding-top: 0.6rem !important; padding-bottom: 0.6rem !important; }
html[data-ht] body .hx-st th { font-size: 0.72rem; color: var(--main-text-muted); white-space: nowrap; }
html[data-ht] body .hx-st td:not(.hx-team) { white-space: nowrap; }
html[data-ht] body .hx-st td:not(.hx-team) { font-variant-numeric: tabular-nums; }

/* ---- 10. What's new: original bar, a touch calmer ---- */
html[data-ht] body .wn-box { filter: saturate(0.85); }
html[data-ht] body .wn-toggle { min-height: 40px; }
html[data-ht] body .wn-x { min-width: 40px; min-height: 40px; }

/* ---- 12. Desktop: keep the two-column layout, a bit roomier ---- */
@media (min-width: 1024px) {
  html[data-ht] body .cm-layout { gap: 1.25rem; }
}
@media (prefers-reduced-motion: reduce) { html[data-ht] * { scroll-behavior: auto !important; } }

/* =========================================================
   13. Phones: most useful stuff first, slimmer everything.
   Pure layout (flex order + display:contents). No transforms, no fixed/sticky
   elements, no height tricks: the app shell's fixed bottom tab bar is left alone.
   ========================================================= */
@media (max-width: 767px) {
  html[data-ht] body .lg-wrap.lg-community {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 0.7rem 0.5rem;
    padding-bottom: 1rem;
  }
  html[data-ht] body .lg-community > *,
  html[data-ht] body .lg-community .hx-top > *,
  html[data-ht] body .lg-community .cm-main > *,
  html[data-ht] body .lg-community .cm-side > * { flex: 1 1 100%; min-width: 0; margin: 0 !important; }
  /* let the cards inside these wrappers take part in the ordering */
  html[data-ht] body .lg-community .hx-top,
  html[data-ht] body .lg-community .cm-layout,
  html[data-ht] body .lg-community .cm-main,
  html[data-ht] body .lg-community .cm-side { display: contents !important; }

  /* order: header row -> you -> column -> last week -> weeks -> games -> standings -> moves */
  html[data-ht] body #cm-you { order: 3; }
  html[data-ht] body #hx-col-line { order: 4; }
  html[data-ht] body #hx-around { order: 5; }
  html[data-ht] body #cm-weeks { order: 6; }
  html[data-ht] body .cm-main > section:not(#hx-standings) { order: 7; }
  html[data-ht] body #hx-standings { order: 8; }
  html[data-ht] body .cm-side > section { order: 9; }
  html[data-ht] body #slob-footer { order: 10; }

  /* --- What's new + Slobtastic banner: original, full width --- */
  html[data-ht] body .wn-box { order: 1; }
  html[data-ht] body .cm-hero { order: 2; }

  /* --- your team when picked: the old card (Change / Team history / Matchup + this week's game below), tidied --- */
  html[data-ht] body #cm-you.hx-has-team {
    padding: 0.8rem 0.9rem !important;
    background: linear-gradient(180deg, rgba(47, 95, 184, 0.16), var(--main-surface) 70%) !important;
    border-color: rgba(91, 141, 239, 0.35) !important;
    gap: 0 !important;
  }
  html[data-ht] body #cm-you.hx-has-team .cm-you-main { display: flex; gap: 0.75rem; align-items: flex-start; text-align: left; }
  html[data-ht] body #cm-you.hx-has-team .cm-you-avatar { flex: 0 0 auto; margin-top: 0.15rem; }
  html[data-ht] body #cm-you.hx-has-team .cm-av-lg { width: 44px !important; height: 44px !important; font-size: 0.9rem; }
  html[data-ht] body #cm-you.hx-has-team .cm-you-text { flex: 1; min-width: 0; }
  html[data-ht] body #cm-you.hx-has-team .cm-kicker { font-size: 0.68rem; margin: 0; }
  html[data-ht] body #cm-you.hx-has-team .cm-you-team { font-size: 1.1rem; line-height: 1.25; margin: 0.05rem 0 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  html[data-ht] body #cm-you.hx-has-team .cm-you-team a { color: var(--main-text-strong); text-decoration: none; }
  html[data-ht] body #cm-you.hx-has-team .cm-you-sub { font-size: 0.85rem; color: var(--main-text-muted); margin: 0.1rem 0 0; }
  html[data-ht] body #cm-you.hx-has-team .cm-you-actions { display: flex !important; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.55rem; }
  html[data-ht] body #cm-you.hx-has-team .cm-you-actions .lg-btn {
    min-height: 40px !important; padding: 0 0.9rem; font-size: 0.85rem; border-radius: 999px;
    background: var(--main-surface-2) !important; border: 1px solid var(--main-border) !important; color: var(--main-text) !important; box-shadow: none !important;
  }
  html[data-ht] body #cm-you.hx-has-team .cm-you-vs { display: none !important; }
  /* this week's game, below a divider (same as the old card) */
  html[data-ht] body #cm-you.hx-has-team .hx-you {
    display: flex !important; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.75rem;
    margin: 0.5rem 0 0 !important; padding: 0 !important;
    border-top: 0 !important;
    font-size: 0.82rem; color: var(--main-text-muted);
  }
  html[data-ht] body #cm-you.hx-has-team .hx-you-game {
    flex: 1 1 0; min-width: 0; display: block; min-height: 44px; order: 0;
    padding: 0.62rem 0.7rem; border-radius: 12px;
    background: var(--main-surface-2); border: 1px solid var(--main-border);
    font-size: 0.92rem; line-height: 1.25; color: var(--main-text); text-decoration: none;
  }
  html[data-ht] body #cm-you.hx-has-team .hx-you-game strong { margin-left: 0.3rem; font-weight: 700; color: var(--main-text-strong); }
  html[data-ht] body #cm-you.hx-has-team .ht-series-btn {
    flex: 0 0 auto; min-height: 44px !important; padding: 0 0.9rem; border-radius: 12px; font-size: 0.85rem;
    background: var(--main-surface-2) !important; border: 1px solid var(--main-border) !important; color: var(--link) !important; box-shadow: none !important;
  }
  /* team numbers sit above the divider (with the team), this week's game + Full series below it */
  html[data-ht] body #cm-you.hx-has-team .hx-you > span { flex: 0 0 auto; order: 0; }
  html[data-ht] body #cm-you.hx-has-team .hx-you::before { content: ""; flex: 1 1 100%; height: 0; order: 1; border-top: 1px solid var(--main-border); margin: 0.4rem 0 0.35rem; }
  html[data-ht] body #cm-you.hx-has-team .hx-you-game { order: 2 !important; }
  html[data-ht] body #cm-you.hx-has-team .ht-series-btn { order: 2; align-self: stretch; }
  html[data-ht] body #cm-you.hx-has-team .hx-you > span:first-of-type { margin-left: 0; }
  html[data-ht] body #cm-you.hx-has-team .hx-you-game::after { content: "\203A"; float: right; padding-left: 0.5rem; font-size: 1.2rem; line-height: 1; color: var(--link); }

  html[data-ht] body #cm-you.ht-noteam { padding: 0.45rem 0.5rem 0.45rem 0.85rem !important; }
  html[data-ht] body #cm-you.ht-noteam .cm-you-avatar,
  html[data-ht] body #cm-you.ht-noteam .cm-kicker,
  html[data-ht] body #cm-you.ht-noteam .cm-you-sub,
  html[data-ht] body #cm-you.ht-noteam #cm-you-open,
  html[data-ht] body #cm-you.ht-noteam .hx-you { display: none !important; }
  html[data-ht] body #cm-you.ht-noteam .cm-you-text { display: flex; align-items: center; gap: 0.5rem; width: 100%; }
  html[data-ht] body #cm-you.ht-noteam .cm-you-team { flex: 1; font-size: 0.95rem; font-weight: 600; }
  html[data-ht] body #cm-you.ht-noteam .cm-you-actions { margin: 0; }

  /* --- Weekly Column: compact, whole card is the link --- */
  html[data-ht] body .hx-col-line { padding: 0.7rem 0.85rem !important; gap: 0.35rem 0.6rem !important; flex-wrap: wrap; }
  html[data-ht] body .hx-col-icon { display: none; }
  html[data-ht] body .hx-col-teaser {
    font-size: 0.95rem !important;
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  }
  html[data-ht] body .hx-col-btn { display: none !important; }
  html[data-ht] body .hx-col-text::after { content: "Read the column \203A"; margin-top: 0.3rem; font-size: 0.88rem; font-weight: 700; color: #fff; opacity: 0.95; }

  /* --- week picker: tighter --- */
  html[data-ht] body #cm-weeks { padding: 0.6rem 0.7rem !important; }
  html[data-ht] body .cm-weeks-head { margin-bottom: 0.4rem !important; }
  html[data-ht] body .lg-community .cm-wk { min-height: 48px; min-width: 60px; padding: 0.3rem 0.5rem; }
  html[data-ht] body .lg-community .cm-weeks-arrows button { width: 40px; height: 40px; }

  /* --- clearer section headers, less dead space --- */
  html[data-ht] body .lg-community .cm-section { padding: 0.85rem 0.75rem !important; }
  html[data-ht] body .lg-community .cm-section-head { margin-bottom: 0.55rem; flex-wrap: nowrap; }
  html[data-ht] body .lg-community .cm-section-head h2 {
    font-size: 1.1rem; margin: 0; padding-left: 0.6rem;
    border-left: 3px solid #5b8def; line-height: 1.25;
    display: flex; flex-wrap: wrap; align-items: center; gap: 0.15rem 0.45rem;
  }
  html[data-ht] body .lg-community .cm-sched-btn { min-height: 40px !important; font-size: 0.82rem; padding: 0 0.7rem; white-space: nowrap; }
  html[data-ht] body .cm-slate-note { display: none; }

  /* --- game cards: tighter but readable --- */
  html[data-ht] body .cm-scoreboard { gap: 0.5rem; }
  html[data-ht] body .cm-game { padding: 0.55rem 0.7rem !important; row-gap: 0.3rem !important; }
  html[data-ht] body .cm-game .lg-team-avatar-fallback,
  html[data-ht] body .cm-game .lg-team-avatar { width: 28px !important; height: 28px !important; flex: 0 0 28px; font-size: 0.66rem; }
  html[data-ht] body .cm-game-name { font-size: 0.95rem !important; }
  html[data-ht] body .hx-motw-tags { padding: 0.55rem 0.7rem 0.15rem !important; }
  html[data-ht] body .hx-sum { padding: 0.45rem 0.7rem !important; font-size: 0.84rem !important; flex-direction: row !important; align-items: center !important; }
  html[data-ht] body .hx-more { align-self: center !important; }

  /* --- standings: compact rows on phones --- */
  html[data-ht] body .hx-st { font-size: 0.9rem; }
  html[data-ht] body .hx-st td, html[data-ht] body .hx-st th { padding-top: 0.45rem !important; padding-bottom: 0.45rem !important; }
}

/* "Full series" next to this week's game in the team card (desktop + phones) */
html[data-ht] body #cm-you .ht-series-btn { align-self: flex-start; width: auto; padding: 0 0.9rem; font-size: 0.82rem; border-radius: 999px; }
