/* Sports board (sports-book.js): game cards, time pills, tournament chips and one tile per match,
   with the bet slip as a right-hand column on desktop and a bottom sheet on tablets and phones.
   A tile opens the match on its own page. Checked at PC large, PC medium, tablet, phone and Telegram sizes in light and dark. */

/* The book has its own title and crumbs, so the lobby heading steps aside while it is open. */
#lobby-sports.has-book > .lobby-section-heading { display:none; }
.sports-book .sports-book-back[hidden] { display:none !important; }

/* ---- Slip column (desktop) ---- */
@media(min-width:901px) {
  .sports-book .sports-book-body, .sports-book.has-slip .sports-book-body { grid-template-columns:minmax(0,1fr) minmax(280px,320px); }
}
.sports-slip.is-empty { border-color:var(--line); box-shadow:none; }
.sports-slip-empty { display:grid; justify-items:center; gap:10px; padding:4px 4px 8px; text-align:center; }
.sports-slip-empty > strong { justify-self:start; font-size:16px; }
.sports-slip-empty-icon {
  display:grid; place-items:center; width:52px; height:52px; margin-top:8px; border-radius:50%;
  background:color-mix(in srgb,var(--accent) 16%,transparent); color:var(--accent);
}
.sports-slip-empty-icon svg { width:26px; height:26px; }
.sports-slip-empty p { margin:0; max-width:220px; color:var(--ink); font-size:15px; font-weight:750; line-height:1.35; }
.sports-slip.is-empty .sports-slip-balance { text-align:center; }
@media(max-width:900px) { .sports-slip.is-empty { display:none !important; } }

/* ---- Game cards ---- */
.sports-games {
  grid-column:1/-1; display:grid; grid-auto-flow:column; grid-auto-columns:minmax(118px,1fr); gap:8px; min-width:0;
  overflow-x:auto; padding:2px; scrollbar-width:none; overscroll-behavior-inline:contain; scroll-snap-type:x proximity;
}
.sports-games::-webkit-scrollbar { display:none; }
.sports-game {
  --sport-color:var(--accent); position:relative; display:grid; align-content:space-between; justify-items:start; min-width:0; height:84px; margin:0;
  padding:10px 12px; overflow:hidden; border:1px solid var(--line); border-radius:14px; background:var(--sb-card,var(--paper)); color:var(--ink);
  text-align:start; cursor:pointer; scroll-snap-align:start; transition:border-color .15s,background .15s,transform .15s;
}
.sports-game[data-sport="dota2"] { --sport-color:#ff5a45; }
.sports-game[data-sport="cs2"] { --sport-color:#ffa62b; }
.sports-game[data-sport="soccer"] { --sport-color:#3ddc84; }
.sports-game[data-sport="tennis"] { --sport-color:#c8e83a; }
.sports-game[data-sport="hockey"] { --sport-color:#5ec8ff; }
.sports-game[data-sport="all"] { --sport-color:#ff6a3d; }
.sports-game-name { position:relative; z-index:1; max-width:100%; overflow:hidden; font-size:14px; font-weight:800; text-overflow:ellipsis; white-space:nowrap; }
.sports-game-count { position:relative; z-index:1; color:var(--muted); font-size:12px; font-weight:700; font-variant-numeric:tabular-nums; }
.sports-game-art { position:absolute; right:-6px; bottom:-8px; width:58px; height:58px; pointer-events:none; }
.sports-game-art :is(svg,img) { display:block; width:100%; height:100%; object-fit:contain; }
.sports-game-art.is-top { right:6px; bottom:6px; width:34px; height:34px; color:var(--sport-color); }
.sports-game.is-current { border-color:var(--sport-color); background:linear-gradient(135deg,color-mix(in srgb,var(--sport-color) 30%,var(--sb-card,var(--paper))),var(--sb-card,var(--paper)) 85%); }
.sports-game.is-current .sports-game-count { color:var(--ink); }
.sports-game:disabled { cursor:default; }
.sports-game:disabled .sports-game-name, .sports-game:disabled .sports-game-art { opacity:.55; }
.sports-game:focus-visible, .sports-pill:focus-visible, .sports-tour:focus-visible, .sports-line-open:focus-visible, .sports-line-plus:focus-visible, .sports-line-tour:focus-visible {
  outline:2px solid var(--accent); outline-offset:2px;
}

/* ---- Filters ---- */
.sports-filters { grid-column:1/-1; display:grid; gap:8px; min-width:0; }
.sports-pills, .sports-tours { display:flex; gap:6px; min-width:0; overflow-x:auto; padding:2px; scrollbar-width:none; overscroll-behavior-inline:contain; }
.sports-pills::-webkit-scrollbar, .sports-tours::-webkit-scrollbar { display:none; }
.sports-pill, .sports-tour {
  display:inline-flex; flex:none; align-items:center; gap:7px; min-height:36px; margin:0; padding:0 14px; border:1px solid transparent; border-radius:999px;
  background:color-mix(in srgb,var(--ink) 7%,transparent); color:var(--ink); font-size:13px; font-weight:700; white-space:nowrap; cursor:pointer;
  transition:background .15s,border-color .15s;
}
.sports-pill.is-current { background:var(--accent); color:#03131f; }
.sports-tour { min-height:34px; padding:0 12px; border-color:var(--line); background:var(--sb-card,var(--paper)); font-size:12px; }
.sports-tour.is-current { border-color:var(--accent); background:color-mix(in srgb,var(--accent) 16%,var(--sb-card,var(--paper))); }
.sports-tour > span:last-child { max-width:240px; overflow:hidden; text-overflow:ellipsis; }
.sports-tour-logo { width:18px; height:18px; object-fit:contain; border-radius:4px; }
.sports-tour-mark { flex:none; width:28px; height:24px; padding:3px; border-radius:4px; }
.sports-tour-mark .sports-brand-monogram { font-size:10px; letter-spacing:.03em; }
.sports-board-tournaments { grid-column:1/-1; margin:4px 0 8px; }
/* The desktop slip can narrow the board even on a wide screen. Keep readable cards. */
@container sports-list (max-width:650px) {
  .sports-board-tournaments .sports-row-tournament-cards {
    grid-auto-flow:column; grid-template-columns:none; grid-auto-columns:minmax(248px,78%);
    overflow-x:auto; gap:12px; padding:5px 5px 12px; scroll-snap-type:x proximity; scrollbar-width:thin;
  }
  .sports-board-tournaments .sports-tournament-tile { scroll-snap-align:start; }
}
.sports-tour-dot { width:8px; height:8px; border-radius:50%; background:var(--accent); }
.sports-tour .sports-line-icon { width:16px; height:16px; }

/* ---- Match tiles ---- */
.sports-lines { container:sports-lines / inline-size; grid-column:1/-1; display:grid; gap:10px; min-width:0; }
.sports-line {
  display:grid; min-width:0; overflow:hidden; border:1px solid color-mix(in srgb,var(--line) 85%,transparent); border-radius:14px; background:var(--sb-card,var(--paper));
  transition:border-color .15s;
}
.sports-line-strip {
  display:flex; align-items:center; gap:8px; min-width:0; padding:7px 14px; background:color-mix(in srgb,var(--ink) 5%,transparent);
  color:var(--muted); font-size:12px; font-weight:650;
}
.sports-line-icon { flex:none; width:16px; height:16px; color:var(--muted); }
.sports-line-tour { min-width:0; overflow:hidden; color:inherit; text-decoration:none; text-overflow:ellipsis; white-space:nowrap; }
a.sports-line-tour:hover { color:var(--accent); }
.sports-line-body { display:grid; gap:10px; min-width:0; padding:10px 14px 12px; }
.sports-line-open {
  display:grid; gap:6px; min-width:0; margin:0; padding:2px; border:0; border-radius:8px; background:none; color:var(--ink); text-align:start; cursor:pointer;
}
.sports-line-meta { display:flex; align-items:center; gap:8px; min-width:0; }
.sports-line-time { min-width:0; overflow:hidden; color:var(--muted); font-size:12px; font-weight:650; font-variant-numeric:tabular-nums; text-overflow:ellipsis; white-space:nowrap; }
.sports-line-bo { flex:none; padding:1px 7px; border:1px solid var(--line); border-radius:999px; color:var(--muted); font-size:10px; font-weight:800; letter-spacing:.3px; }
.sports-line-team { display:grid; grid-template-columns:auto minmax(0,1fr); align-items:center; gap:9px; min-width:0; }
.sports-line-team strong { min-width:0; overflow:hidden; font-size:14px; font-weight:750; line-height:1.25; text-overflow:ellipsis; white-space:nowrap; }
.sports-line-mark {
  display:grid; place-items:center; width:24px; height:24px; border:1px solid var(--line); border-radius:50%;
  background:color-mix(in srgb,var(--accent) 12%,transparent); color:var(--ink); font-size:8px; font-weight:800;
}
.sports-line-mark.is-large { width:56px; height:56px; font-size:15px; }
.sports-line-market { display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:end; gap:6px 8px; min-width:0; }
.sports-line-title { grid-column:1/-1; min-width:0; overflow:hidden; color:var(--muted); font-size:12px; font-weight:650; text-overflow:ellipsis; white-space:nowrap; }
.sports-line-options { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:6px; min-width:0; }
.sports-line-options .sports-odds { min-height:42px; }
.sports-line-plus {
  display:grid; place-items:center; min-width:42px; height:42px; margin:0; padding:0 8px; border:1px solid var(--line); border-radius:10px;
  background:color-mix(in srgb,var(--accent) 12%,transparent); color:var(--accent); font-size:13px; font-weight:800; cursor:pointer;
}
@media(hover:hover) {
  .sports-line:hover { border-color:color-mix(in srgb,var(--accent) 45%,var(--line)); }
  .sports-game:not(:disabled):not(.is-current):hover, .sports-tour:hover { border-color:var(--accent); }
  .sports-pill:not(.is-current):hover { background:color-mix(in srgb,var(--ink) 12%,transparent); }
  .sports-line-plus:hover { border-color:var(--accent); }
  .sports-line-open:hover strong { color:var(--accent); }
}
@container sports-lines (min-width:620px) {
  .sports-line-body { grid-template-columns:minmax(0,1fr) minmax(280px,400px); align-items:center; gap:18px; padding:10px 14px 12px; }
}
.sports-lines-empty { display:grid; justify-items:center; gap:6px; padding:56px 18px; text-align:center; }
.sports-lines-empty strong { font-size:18px; }
.sports-lines-empty p { max-width:320px; margin:0; color:var(--muted); font-size:13px; line-height:1.5; }

/* Tiles inside a tournament page sit one per row. */
.sports-tournament-page > .sports-line { grid-column:1/-1; }

/* ---- Match page ---- */
.sports-match-page { grid-column:1/-1; display:grid; gap:14px; min-width:0; --tournament-accent:var(--accent); }
.sports-match-hero { display:grid; min-width:0; overflow:hidden; border:1px solid var(--line); border-radius:16px;
  background:radial-gradient(90% 120% at 50% 0%,color-mix(in srgb,var(--tournament-accent) 18%,transparent),transparent 70%),var(--sb-card,var(--paper)); }
.sports-match-face { display:grid; grid-template-columns:minmax(0,1fr) auto minmax(0,1fr); align-items:center; gap:14px; padding:22px 18px 24px; }
.sports-match-side { display:grid; justify-items:center; gap:10px; min-width:0; text-align:center; }
.sports-match-side strong { max-width:100%; font-size:17px; font-weight:850; line-height:1.25; overflow-wrap:anywhere; }
.sports-match-mid { display:grid; justify-items:center; gap:6px; }
.sports-match-mid .sports-line-time { font-size:13px; color:var(--ink); white-space:normal; text-align:center; max-width:130px; }
.sports-match-markets { display:grid; grid-template-columns:repeat(auto-fill,minmax(min(100%,320px),1fr)); gap:10px; min-width:0; align-items:start; }
.sports-market.is-card { padding:12px 14px; border:1px solid color-mix(in srgb,var(--line) 85%,transparent); border-radius:14px; background:var(--sb-card,var(--paper)); }

@media(max-width:520px) {
  .sports-games { grid-auto-columns:minmax(104px,1fr); }
  .sports-game { height:74px; padding:9px 10px; }
  .sports-game-art { width:50px; height:50px; }
  .sports-game-art.is-top { width:28px; height:28px; }
  .sports-line-body { padding:10px 12px 12px; }
  .sports-line-strip { padding:7px 12px; }
  .sports-match-face { gap:8px; padding:18px 10px 20px; }
  .sports-line-mark.is-large { width:46px; height:46px; font-size:13px; }
  .sports-match-side strong { font-size:15px; }
}
@media(prefers-reduced-motion:reduce) { .sports-game, .sports-line, .sports-pill, .sports-tour { transition:none; } }
.sports-crumbs[hidden] { display:none !important; }
/* Official game wordmarks are wide: give them a wide, short box. */
.sports-game-art:has(img) { right:10px; bottom:9px; width:min(84px,55%); height:26px; }
.sports-game-art img { object-position:right center; }
/* The official wordmarks are white; on light cards they become a dark silhouette. */
:root[data-theme="light"] .sports-game-art img { filter:brightness(0); opacity:.72; }

/* ---- Lobby home: Ставки is one horizontal row of game tiles, like Slots, Mini-games and Chests ----
   The per-game rows, popular tournaments and streamer cards belong to the full Sports page; "Load more" opens it. */
:root body[data-lobby-layout="reference"] #games-hub[data-lobby-section="home"] #lobby-sports .sports-rows {
  display:grid; grid-auto-flow:column; grid-template-columns:none; grid-template-rows:auto;
  grid-auto-columns:calc((100% - (var(--lobby-row-n) - 1) * var(--lobby-row-gap)) / var(--lobby-row-n));
  gap:var(--lobby-row-gap); width:100%; overflow-x:auto; overflow-y:hidden; overscroll-behavior-x:contain;
  padding-block:4px 12px; margin-block:-4px -12px; scroll-snap-type:x mandatory; scrollbar-width:none;
}
:root body[data-lobby-layout="reference"] #games-hub[data-lobby-section="home"] #lobby-sports .sports-rows::-webkit-scrollbar { display:none; }
:root body[data-lobby-layout="reference"] #games-hub[data-lobby-section="home"] #lobby-sports :is(.sports-row,.sports-row-cards) { display:contents; }
:root body[data-lobby-layout="reference"] #games-hub[data-lobby-section="home"] #lobby-sports :is(.sports-row > .lobby-section-heading,.sports-row-tournaments,.sports-row-footer,.sports-row-cards > :not(.sports-row-placeholder),.sports-book-source) { display:none !important; }
:root body[data-lobby-layout="reference"] #games-hub[data-lobby-section="home"] #lobby-sports .sports-row-placeholder { min-width:0; width:auto; scroll-snap-align:start; }
