:root {
  --primary-color: #14445a;
  --inplay: #c80037;
  --inplay-2: #e0004a;
  --primary-color-invert: #e6e6e6;
  --primary-color-hover: #c80037;
  --secondary-color: #648496;
  --font-color: #212529;
  --bg-color: #f1f3f5;
  --heading-color: #212529;
  --content-bg: #fff;
  --panel-bg: #e4e7ea;
  --panel-secondary-bg: #f8fafd;
  --shadow-color: #74818d1a;
  --hover-bg: #e0e6eb57;
  --active-bg: #0000000f;
  --border-color: #e7ebef;
  --border-color-2: #e0e6eb57;
  --light: #eff1f3;
  --loading-bg: #fff9;
  --icon-color: #738a97a3;
  --won: #70c94f;
  --draw: #ff9800;
  --loss: #f14c45;
  --light2: #fdfdfd;
  --light3: #f4f5f6;
  --red: #f14c45;
  --green: #70c94f;
  --nav-active: #c80037;
}

[data-theme="dark"] {
  --primary-color: #e6e6e6;
  --inplay: #ff3e63;
  --inplay-2: #ff5f7e;
  --primary-color-invert: #5e6a78;
  --secondary-color: #a2a6b0;
  --font-color: #e1e1ff;
  --bg-color: #161a1e;
  --heading-color: #202325;
  --content-bg: #24292e;
  --panel-bg: #323e4b;
  --panel-secondary-bg: #3c4a59;
  --shadow-color: #0000001a;
  --hover-bg: #76788e1a;
  --active-bg: #9d9d9d12;
  --border-color: #38404d;
  --border-color-2: #38404d;
  --light: #2b3139;
  --loading-bg: #1e2328cc;
  --icon-color: #c6c6c6;
  --won: #73c734;
  --light2: #1e2329;
  --light3: #2d343b;
  --green: #73c734;
  --nav-active: #c80037;
}

*, ::after, ::before { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: "Titillium Web", Arial, Helvetica, sans-serif;
  font-size: 12.5px;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  background: var(--bg-color);
  color: var(--font-color);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; }

.main-container {
  width: 1100px;
  max-width: 100%;
  margin: 0 auto;
  position: relative;
}

/* ============ HEADER ============ */

header.top-title {
  background: var(--content-bg);
  position: sticky;
  top: 0;
  z-index: 999;
  box-shadow: 0 50px 70px var(--shadow-color);
  border-bottom: 1px solid var(--border-color);
}

header.top-title .main-container {
  display: flex;
  align-items: center;
  height: 50px;
}

/* Logo: wordmark only (white for dark, black for light) */
a.logo {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-shrink: 0;
  padding-right: 14px;
  height: 50px;
}
a.logo .word { height: 38px; width: auto; display: block; }
a.logo .logo-dark { display: none; }
[data-theme="dark"] a.logo .logo-dark { display: block; }
[data-theme="dark"] a.logo .logo-light { display: none; }

/* Sports nav — compact links; active/hover = bold + underline bar */
nav.navbar {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
}

nav.navbar ul {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
  min-width: 0;
}

nav.navbar li { flex-shrink: 0; }

nav.navbar a {
  display: flex;
  align-items: center;
  gap: 5px;
  height: 50px;
  padding: 0 9px;
  font-size: 12.5px;
  line-height: 20px;
  font-weight: 600;
  color: var(--primary-color);
  white-space: nowrap;
  position: relative;
  transition: color .11s;
}

nav.navbar a:hover:after,
nav.navbar a.current:after {
  content: "";
  position: absolute;
  left: 4px;
  right: 4px;
  bottom: 6px;
  height: 3px;
  border-radius: 3px;
  background: var(--nav-active);
}

nav.navbar a.current { font-weight: 700; }

nav.navbar a svg { width: 14px; height: 14px; flex-shrink: 0; display: block; }

   scale it up so all icons render the same visual size */

/* "More" dropdown */
.dropdown { position: relative; }
.dropdown > a { cursor: pointer; }
.dropdown-content {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% - 2px);   /* flush with the nav */
  background: var(--content-bg);
  min-width: 200px;
  box-shadow: 0 8px 20px 0 rgba(0, 0, 0, .25);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 6px;
  z-index: 1000;
}
/* click-only menu (hover-open caused the gap-close problem) */
.dropdown.open .dropdown-content { display: block; }
.dropdown.open > a { color: var(--nav-active); }
.dropdown-content a {
  gap: 8px;
  white-space: nowrap;
}
.dropdown-content a svg { width: 16px; height: 16px; }
.dropdown-content svg.si-football { width: 16px; height: 16px; }
.dropdown-content a {
  display: flex;
  margin: 0;
  height: auto;
  padding: 8px 10px;
  border-radius: 5px;
}
.dropdown-content a:hover { background: var(--hover-bg); }
/* no nav underline bar inside the dropdown */
.dropdown-content a:hover:after,
.dropdown-content a.current:after { display: none; }
.dropdown-content a.current { color: var(--nav-active); }

/* Tools (right side of header) */
.toolsmenu {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 10px;
  gap: 4px;
  flex-shrink: 0;
}

/* Icon links/buttons in toolsmenu (Discord, language etc.) */
.tool-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 35px;
  height: 35px;
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  cursor: pointer;
  border-radius: 50%;
  color: var(--primary-color);
}
.tool-icon:hover { background: var(--hover-bg); color: var(--nav-active); }
.tool-icon svg { width: 18px; height: 18px; }

/* Theme toggle — simple icon button like 2023 */
#themeToggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 35px;
  height: 35px;
  border: 0;
  background: none;
  border-radius: 50%;
  cursor: pointer;
  color: var(--primary-color);
  padding: 0;
}
#themeToggle:hover { background: var(--hover-bg); }
#themeToggle svg { width: 18px; height: 18px; }
#themeToggle .icon-sun { display: none; }
[data-theme="dark"] #themeToggle .icon-sun { display: block; }
[data-theme="dark"] #themeToggle .icon-moon { display: none; }

/* Mobile hamburger */
#mobile_menu { display: none; }
#mobile_menu .burger {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--primary-color);
}
#mobile_menu .burger:hover { background: var(--hover-bg); }
#mmenu {
  display: none;
  position: fixed;
  top: 50px;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--content-bg);
  z-index: 998;
  overflow-y: auto;
  padding: 10px 16px;
}
#mmenu.show { display: block; }
#mmenu a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--primary-color);
  border-bottom: 1px solid var(--border-color);
}
#mmenu a.current { color: var(--nav-active); }
#mmenu a svg { width: 18px; height: 18px; }

/* ============ LAYOUT: ONE CONTENT SHEET ============ */

.contentWrap { flex: 1; padding-top: 10px; }

.content {
  display: flex;
  width: 100%;
  margin: 0 auto;
  min-height: 1000px;
  position: relative;
  padding: 5px 0;
  background: var(--content-bg);
  border-radius: 15px;
  box-shadow: 0 50px 70px var(--shadow-color);
}

.sidebar {
  min-width: 230px;
  max-width: 230px;
  padding: 0 5px;
  position: relative;
  border-right: 1px solid var(--border-color);
}

.sidebar.sidebar-right {
  border-right: 0;
  border-left: 1px solid var(--border-color);
  min-width: 260px;
  max-width: 260px;
}

.livescore-wrap {
  flex: 1;
  min-width: 0;
  padding: 0 5px;
}

#fixtures { background: var(--content-bg); }

/* Match search (below the filters, 2023-new style) */
.match-search {
  position: relative;
  padding: 8px 5px 4px;
}
.match-search svg {
  position: absolute;
  left: 17px;
  top: 50%;
  transform: translateY(-40%);
  width: 15px;
  height: 15px;
  color: var(--secondary-color);
  pointer-events: none;
}
.match-search input {
  width: 100%;
  height: 36px;
  padding: 0 14px 0 36px;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  background: var(--bg-color);
  color: var(--font-color);
  font-family: inherit;
  font-size: 12.5px;
  outline: none;
}
.match-search input::placeholder { color: var(--secondary-color); }
.match-search input:focus { border-color: var(--secondary-color); }

/* ============ PANELS / LEGENDS ============ */

.legend.panel {
  display: flex;
  align-items: center;
  min-height: 45px;
  padding: 0 10px;
  clear: both;
}

.legend.panel h1,
.legend.panel h3 {
  flex: 1;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--secondary-color);
  position: relative;
}

/* Counter badge (orange, like MY LEAGUES / tab counters) */
.counter {
  background: var(--inplay);
  color: #fff;
  border-radius: 50px;
  font-size: 11px;
  font-weight: 600;
  min-width: 17px;
  height: 17px;
  padding: 1px 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* Tab counter sits on the pill's corner like 2023 */
.nav.tabs a .counter {
  position: absolute;
  right: -7px;
  top: -6px;
}

/* Sidebar items */
.sidebar .item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 5px;
  width: 100%;
  min-height: 35px;
  border-radius: 5px;
  cursor: pointer;
}
.sidebar .item:hover { background: var(--light); }

.sidebar .hint {
  color: var(--secondary-color);
  padding: 5px 10px 10px;
  line-height: 1.6;
}

/* Search input (ALL LEAGUES) */
.search-c {
  padding: 0 5px 8px;
}
.search-c input {
  width: 100%;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  background: var(--bg-color);
  color: var(--font-color);
  font-family: inherit;
  font-size: 12.5px;
  outline: none;
}
.search-c input::placeholder { color: var(--secondary-color); }
.search-c input:focus { border-color: var(--secondary-color); }

/* League strip (fixtures grouping) — 2023 markup */
.league {
  scroll-margin-top: 64px;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 35px;
  font-weight: 700;
  letter-spacing: 0.5px;
  margin-top: 5px;
  padding: 0 10px;
  border-radius: 5px;
  background: var(--light);
  cursor: pointer;
  user-select: none;
}
.league img.flag { width: 18px; height: 13px; border-radius: 2px; object-fit: cover; flex-shrink: 0; }
.league .lname { flex: 1; min-width: 0; display: flex; align-items: center; gap: 5px; overflow: hidden; }
.league .lcountry { color: var(--secondary-color); font-weight: 500; white-space: nowrap; }
.league .lname a { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.league .count { color: var(--secondary-color); font-size: 11px; font-weight: 400; margin: 0 4px; }
.league .chev { display: flex; align-items: center; color: var(--secondary-color); }
.league .chev svg { transition: transform .15s; }
.league.closed .chev svg { transform: rotate(-90deg); }

/* Collapse groups */
.collapse { display: none; }
.collapse.show { display: block; }

/* Match row internals (real events) */
.match.i { cursor: pointer; }
.match.i .tm .status_info { color: var(--secondary-color); font-size: 11px; text-align: center; }
.match.i .tm .live-min { color: var(--inplay); font-weight: 700; font-size: 12px; }
.match.i .tm .live-lbl {
  color: var(--inplay);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.match.i .mteams .tname {
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.match.i .score span { background: var(--light3); width: 25px; }
.match.i.live .score span { color: var(--inplay); font-weight: 700; }
.match.i .wf.info a { position: relative; z-index: 11; }
.match.i a.opmatch {
  position: absolute;
  inset: 0;
  opacity: 0;
  z-index: 1;
}

/* Custom events (CUST:) — same strip + rows pattern as leagues,
   with a slim accent "Special" strip and beefier rows */
.league.league-custom {
  color: var(--primary-color-hover);
  cursor: default;
}
.league.league-custom svg { flex-shrink: 0; }
.league.league-custom .lname a { color: var(--primary-color-hover); }
[data-tournament-id^="custom"] .match.i {
  padding: 10px 0;
}
.match.i.single {
  min-height: 52px;
  padding: 12px 0;
}
.match.i.single .mteams .tname {
  font-size: 13.5px;
  font-weight: 600;
}
.match.i.single .tm .live-lbl { font-size: 11px; }
/* Single events have no score column, so draw the same separator
   before the TV/Live buttons that regular rows get from .score */
.match.i.single .wf.info {
  border-left: 1px solid var(--border-color-2);
  align-self: stretch;
  align-items: center;
}

/* Empty state (calendar icon) */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 60px 20px;
}
.empty-state svg {
  width: 80px;
  height: 80px;
  color: var(--secondary-color);
  opacity: .4;
  margin-bottom: 22px;
}
.empty-state h3 { font-size: 16px; font-weight: 700; margin-bottom: 6px; }
.empty-state p { color: var(--secondary-color); margin: 0; max-width: 340px; }

/* Disabled day arrows */
.day-txt .arrow.disabled { opacity: .35; pointer-events: none; }

/* ============ LIVESCORE TABS / DAY NAV ============ */

.nav.tabs.legend {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 40px;
  padding: 5px;
  border-bottom: 1px solid var(--hover-bg);
}

.nav.tabs.legend .left { flex: 1; display: flex; align-items: center; }

.nav.tabs a {
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 3px;
  padding: 5px 14px;
  border-radius: 20px;
  white-space: nowrap;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  color: var(--primary-color);
  cursor: pointer;
  position: relative;
}
.nav.tabs a:hover,
.nav.tabs a.active { background: var(--primary-color-hover); color: #fff; }

.nav.tabs a svg { width: 14px; height: 14px; flex-shrink: 0; }

/* margin-left:auto keeps the day nav pinned right even when
   the status filters are hidden (future days) */
.day-txt { display: flex; align-items: center; gap: 4px; margin-left: auto; }
/* .nav.tabs a pill styles also match the arrows — reset them here */
.nav.tabs .day-txt a.arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  margin: 0;
  border-radius: 50%;
  cursor: pointer;
  background: var(--light);
  color: var(--font-color);
}
.nav.tabs .day-txt a.arrow:hover { background: var(--panel-bg); }
.day-txt .arrow svg { display: block; width: 16px; height: 16px; flex-shrink: 0; }
.day-txt #date_name {
  font-weight: 700;
  font-size: 12px;
  min-width: 90px;
  text-align: center;
  cursor: pointer;
}

/* ============ MATCH ROW (2023 structure) ============ */
/* time/status | stacked teams | score column | TV/LIVE     */

.match.i {
  display: flex;
  align-items: center;
  position: relative;
  padding: 4px 0;
  border-radius: 5px;
}
.match.i:hover { background: var(--hover-bg); }
.match.i:after {
  position: absolute;
  content: "";
  width: 100%;
  height: 1px;
  background: var(--border-color-2);
  bottom: -3px;
  left: 0;
}

.match.i .tm {
  min-width: 70px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--secondary-color);
}

.match.i .mteams { flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.match.i .mteams .trow { display: flex; align-items: center; gap: 6px; min-height: 18px; }
.match.i .mteams img { width: 14px; height: 14px; object-fit: contain; }

.match.i .score {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  border-right: 1px solid var(--border-color-2);
  padding: 0 10px;
  font-weight: 600;
  gap: 2px;
}
.match.i .score span {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  margin: 1px 0;
  text-align: center;
}

.wf.info { display: flex; align-items: center; gap: 6px; padding: 0 10px; }
.live_btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 22px;
  padding: 0 8px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--secondary-color);
  cursor: pointer;
}
.live_btn:hover { border-color: var(--primary-color-hover); color: var(--primary-color-hover); }

/* Skeleton variant of the TV/LIVE buttons */
.wf.info .placeholder-content.btn {
  width: 34px;
  height: 22px;
  border-radius: 4px;
  flex-shrink: 0;
}

/* ============ SKELETON PLACEHOLDERS ============ */

.placeholder-content {
  background: var(--panel-bg);
  border-radius: 4px;
  position: relative;
  overflow: hidden;
}
.placeholder-content::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, var(--hover-bg), transparent);
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer { 100% { transform: translateX(100%); } }

.placeholder-content.line { height: 10px; width: 60%; margin: 0; }
.placeholder-content.circle { width: 18px; height: 18px; border-radius: 50%; flex-shrink: 0; }
.placeholder-content.sq { width: 20px; height: 20px; flex-shrink: 0; }

/* Sidebar skeleton rows: icon + name */
.skel-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 35px;
  padding: 0 10px;
}
.skel-item .placeholder-content.line { width: 55%; }

/* News skeleton (right sidebar) */
.skel-news {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 12px 10px;
  border-bottom: 1px solid var(--border-color-2);
}
.skel-news .placeholder-content { height: 10px; }

/* ============ MODALS (2023 style: top sheet, 0 0 15px 15px) ============ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: #00000080;
  z-index: 2000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}
.modal-overlay.hidden { display: none; }

.modal-dialog {
  background: var(--content-bg);
  width: 95%;
  max-width: min(480px, 100vw);
  min-height: 200px;
  margin: 0 auto;
  border-radius: 0 0 15px 15px;
  box-shadow: 0 0 20px var(--active-bg);
  animation: modalSlide .18s ease-out;
  outline: none;
}
@keyframes modalSlide {
  from { transform: translateY(-16px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.modal-titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px;
  border-bottom: 1px solid var(--border-color);
}
.modal-titlebar h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--font-color);
  flex: 1;
}
.modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 0;
  background: none;
  border-radius: 50%;
  cursor: pointer;
  color: var(--secondary-color);
}
.modal-close:hover { background: var(--hover-bg); color: var(--font-color); }

.modal-body { padding: 10px; }

/* Language cards */
.lang-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 5px;
  cursor: pointer;
  margin-bottom: 4px;
  border: 1px solid transparent;
}
.lang-card:hover { background: var(--light); }
.lang-card.selected {
  background: var(--light);
  border-color: var(--nav-active);
}
.lang-card img { border-radius: 3px; display: block; }
.lang-card .lang-name { display: flex; flex-direction: column; line-height: 1.3; }
.lang-card .second_text { color: var(--secondary-color); font-size: 11px; }

/* ============ MATCH PAGE ============ */

/* --- 2023 skin over match.js-generated markup --- */

/* Single column: match content on top, Match Details section below
   (like the 2023 MATCH INFO section), instead of a side card */
#matchDetailContainer > .grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
#matchDetailContainer > .grid > div { width: 100%; }

/* Flatten cards into the content sheet (2023 was flat panels) */
#matchDetailContainer .card {
  background: transparent;
  border: none;
  box-shadow: none;
  border-radius: 0;
}

/* Tabs → 2023 pill tabs (crimson active), no scrollbar chrome */
#matchDetailContainer .overflow-x-auto {
  gap: 2px;
  justify-content: flex-start;
  padding: 5px;
  border-top: 1px solid var(--hover-bg);
  border-bottom: 1px solid var(--hover-bg);
  scrollbar-width: none;
}
#matchDetailContainer .overflow-x-auto::-webkit-scrollbar { display: none; }
#matchDetailContainer .tab-btn {
  height: auto;
  flex: none;
  margin: 3px;
  padding: 5px 14px;
  border-radius: 20px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  line-height: 20px;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--primary-color) !important;
  border: 0;
  background: none;
  cursor: pointer;
}
#matchDetailContainer .tab-btn:hover { background: var(--hover-bg); }
#matchDetailContainer .tab-btn.active {
  background: var(--primary-color-hover);
  color: #fff !important;
}
#matchDetailContainer .tab-btn::after { display: none !important; }
#matchDetailContainer .tab-btn svg { width: 14px; height: 14px; }

/* ---- 2023 match header (teams | score | teams) ---- */
.cs-mhead-wrap { padding: 22px 10px; }
.cs-mhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 900px;
  margin: 0 auto;
}
.cs-team {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.cs-home { justify-content: flex-end; text-align: right; }
.cs-away { justify-content: flex-start; text-align: left; }
.cs-tlogo { width: 56px; height: 56px; object-fit: contain; flex-shrink: 0; }
.cs-tcol { display: flex; flex-direction: column; min-width: 0; }
.cs-tcountry { color: var(--secondary-color); font-size: 12px; }
.cs-tname {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cs-tname a:hover { color: var(--primary-color-hover); }

.cs-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 130px;
  flex-shrink: 0;
}
.cs-statusline {
  color: var(--secondary-color);
  font-size: 12px;
  font-weight: 600;
}
.cs-score span { font-size: 34px !important; font-weight: 700; }
.cs-score.live span { color: var(--primary-color-hover); }
.cs-badge {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 3px 10px;
  border-radius: 20px;
}
.cs-badge-live { background: var(--primary-color-hover); color: #fff; }
.cs-badge-muted { background: var(--light3); color: var(--secondary-color); }

/* ---- MATCH INFO: vertical rows ---- */
.cs-mdetails {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--border-color);
  padding: 4px 0;
}
.cs-mditem {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-color-2);
}
.cs-mditem:last-child { border-bottom: 0; }
.cs-mditem svg { width: 22px; height: 22px; color: var(--secondary-color); flex-shrink: 0; }
.cs-mdcol { display: flex; flex-direction: column; line-height: 1.4; min-width: 0; }
.cs-mdcol b { font-size: 12.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cs-mdcol span { color: var(--secondary-color); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cs-mdcol a:hover b { color: var(--primary-color-hover); }

/* Hide the old duplicated "Match Details" side card (info now in the strip) */
#matchDetailContainer > .grid > div:last-child > .card { display: none; }

/* JS breadcrumb (Home > Sport > Match) under the crumb strip */
#matchDetailContainer nav[aria-label="breadcrumb"] {
  padding: 8px 10px 4px;
  margin-bottom: 0;
}
/* Hairline under the crumb strip */
.match-crumb { border-bottom: 1px solid var(--border-color); margin-bottom: 4px; }

/* Order inside the header card: score panel → line → tabs → MATCH INFO */
#matchDetailContainer .card__content { display: flex; flex-direction: column; }
#matchDetailContainer .cs-mhead-wrap { order: 1; }
#matchDetailContainer .overflow-x-auto { order: 2; }
#matchDetailContainer .cs-mdetails { order: 3; border-top: 0; }

/* Broadcast tab: aligned like soccersapi — section title as a full
   strip, channel rows underneath at the same left edge */
#tabContent .card__header,
#tab-content-broadcast .card__header {
  background: var(--light);
  border-radius: 5px;
  margin: 6px 5px 4px !important;
  padding: 9px 12px !important;
}
#tabContent .card__header h4,
#tab-content-broadcast .card__header h4 {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
#tabContent .card__content,
#tab-content-broadcast .card__content { padding: 0 5px 8px !important; }

/* Kill Tailwind space-y-6 gaps inside the match layout — they create
   huge empty bands between tabs, broadcast content and the promo */
#matchDetailContainer .space-y-6 {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
#matchDetailContainer .space-y-6 > * { margin: 0 !important; }
#tabContent .card,
#tab-content-broadcast .card {
  padding: 0 !important;
  gap: 0 !important;
  display: block !important; /* kill flex stretching from globals .card */
}
/* globals sets .card__content { flex:1 } — sections stretch to fill
   the card height and dump the extra space as huge gaps. Kill it. */
#tabContent .card__content,
#tab-content-broadcast .card__content {
  flex: none !important;
  gap: 0 !important;
}
#tabContent .card__header { margin: 4px 5px; }

/* Channel/link rows: full width, same look in BOTH themes
   (bg + border from our vars — Tailwind's border was invisible in dark) */
.cs-chlist {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  padding: 2px 2px 6px;
}
.cs-chrow {
  width: 100% !important;
  justify-content: flex-start;
  background: var(--light3) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: 8px !important;
  padding: 11px 14px !important;
}
.cs-chrow:hover { background: var(--light) !important; }
.cs-chrow .cs-chtv { width: 18px; height: 18px; flex-shrink: 0; color: var(--secondary-color); }
.cs-chrow span.font-medium, .cs-chrow > span { font-weight: 700; }
.cs-chrow .cs-viewers {
  margin-left: auto;
  color: var(--inplay);
  font-weight: 700;
  font-size: 12px;
  white-space: nowrap;
}

/* ---- Promo block (every match, editable in match.html) ---- */
.cs-promo {
  display: flex;
  gap: 20px;
  margin: 8px 10px 16px;
  padding: 14px;
  border-radius: 10px;
  background: var(--light3);
}
.cs-promo-player {
  position: relative;
  flex: 1;
  min-height: 300px;
  min-width: 55%;
  border-radius: 10px;
  background: #0b0b0c;
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 20px;
}
.cs-promo-adv { position: absolute; top: 10px; left: 12px; font-size: 11px; color: #bbb; }
.cs-promo-title { font-size: 18px; font-weight: 600; }
.cs-promo-sub { color: #999; font-size: 12px; }
.cs-promo-play {
  width: 85px;
  height: 85px;
  margin: 18px 0;
  border-radius: 50%;
  background: var(--primary-color-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .1s, opacity .1s;
}
.cs-promo-player:hover .cs-promo-play { transform: scale(1.08); opacity: .85; }
.cs-promo-live { position: absolute; bottom: 10px; left: 12px; font-size: 11px; color: #ddd; display: flex; align-items: center; gap: 4px; }
.cs-promo-desc { flex: 1; padding: 6px 4px; font-size: 13px; line-height: 1.6; }
.cs-promo-desc h3 { font-size: 17px; font-weight: 700; margin-bottom: 8px; }
.cs-promo-desc ul { list-style: none; padding: 0; margin: 10px 0; }
.cs-promo-desc li { margin: 8px 0; }
.cs-badge-num {
  background: var(--primary-color-hover);
  border-radius: 5px;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  margin-right: 10px;
  width: 30px;
  display: inline-block;
  text-align: center;
}
.cs-promo-cta {
  display: block;
  width: 100%;
  padding: 15px;
  margin-top: 8px;
  border-radius: 30px;
  background: var(--primary-color-hover);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  text-align: center;
}
.cs-promo-cta:hover { opacity: .85; }
.cs-promo-small { font-size: 11px; color: var(--secondary-color); margin-top: 10px; }

@media (max-width: 700px) {
  .cs-promo { flex-direction: column; }
  .cs-promo-player { min-width: 100%; min-height: 260px; }
}

/* Mobile: horizontal row — team | score | team,
   each team stacked (logo on top, name under), compact */
@media (max-width: 640px) {
  .cs-mhead-wrap { padding: 14px 6px; }
  .cs-mhead { gap: 6px; }
  .cs-team,
  .cs-home,
  .cs-away {
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    text-align: center;
    gap: 6px;
  }
  .cs-tcol { align-items: center; }
  .cs-tlogo { width: 44px; height: 44px; }
  .cs-tname { font-size: 14px; white-space: normal; line-height: 1.25; }
  .cs-tcountry { font-size: 11px; }
  .cs-center { min-width: 96px; }
  .cs-score span { font-size: 26px !important; }
  .cs-statusline { font-size: 11px; }
}

/* Match Details section heading → legend style like 2023 MATCH INFO */
#matchDetailContainer .card__header h4 {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--secondary-color);
}
#matchDetailContainer .card__header .bg-surface-secondary { background: transparent; }

.match-crumb { gap: 8px; }
.match-crumb h1 a:hover { color: var(--primary-color-hover); }
.back-circle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--light);
  color: var(--font-color);
  flex-shrink: 0;
}
.back-circle:hover { background: var(--panel-bg); }
#matchDetailContainer { padding: 0 5px 20px; }

/* ============ LEGAL PAGES ============ */

.content.legal-sheet {
  display: block;
  min-height: 600px;
  padding: 10px 0 30px;
}
.legal-content {
  max-width: 760px;
  margin: 0 auto;
  padding: 20px;
  font-size: 13px;
  line-height: 1.8;
}
.legal-content h1 {
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 6px;
}
.legal-content .legal-sub {
  color: var(--secondary-color);
  margin: 0 0 24px;
}
.legal-content h3 {
  font-size: 16px;
  font-weight: 700;
  margin: 26px 0 8px;
}
.legal-content p { margin: 0 0 12px; }
.legal-content ul { margin: 0 0 12px; padding-left: 22px; }
.legal-content li { margin-bottom: 5px; }
.legal-content a { color: var(--primary-color-hover); }
.legal-content a:hover { text-decoration: underline; }
.legal-content strong, .legal-content b { font-weight: 700; }

/* Settings modal groups */
.set-group { margin-bottom: 16px; }
.set-group:last-child { margin-bottom: 4px; }
.set-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--secondary-color);
  margin: 0 0 8px 2px;
}
.set-opt svg { color: var(--secondary-color); flex-shrink: 0; }
.set-desc { margin: 0 0 10px 2px; font-size: 12px; line-height: 1.5; color: var(--secondary-color); }
.set-desc a { color: var(--primary-color-hover); font-weight: 600; }
.set-desc a:hover { text-decoration: underline; }
.set-opt.selected svg { color: var(--primary-color-hover); }

/* Viewer code input (settings modal) */
.code-row { display: flex; gap: 8px; }
.code-row input {
  flex: 1;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-color);
  color: var(--font-color);
  font-family: inherit;
  font-size: 13px;
  letter-spacing: 0.5px;
  outline: none;
}
.code-row input:focus { border-color: var(--secondary-color); }
.code-row button {
  height: 36px;
  padding: 0 16px;
  border: 0;
  border-radius: 8px;
  background: var(--primary-color-hover);
  color: #fff;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}
.code-row button:hover { opacity: .85; }
.code-row button:disabled { opacity: .5; cursor: wait; }
.code-status { margin-top: 8px; font-size: 12px; font-weight: 600; }
.code-status.ok { color: var(--green); }
.code-status.bad { color: var(--loss); }
.code-remove {
  margin-top: 8px;
  border: 0;
  background: none;
  color: var(--loss);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
}

/* Inline player (viewer-code unlock) */
.cs-inline-player { display: none; margin: 8px 10px 14px; }
.cs-inline-player.show { display: block; }
.cs-ip-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--light);
  border-radius: 8px 8px 0 0;
  padding: 8px 12px;
}
.cs-ip-title { font-weight: 700; font-size: 13px; }
.cs-ip-close {
  display: flex;
  border: 0;
  background: none;
  color: var(--secondary-color);
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
}
.cs-ip-close:hover { background: var(--hover-bg); color: var(--font-color); }
.cs-ip-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 0 0 8px 8px;
  overflow: hidden;
}
.cs-ip-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* ============ MOBILE BOTTOM NAV ============ */

.bottom-nav {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 56px;
  background: var(--content-bg);
  border-top: 1px solid var(--border-color);
  box-shadow: 0 -4px 20px var(--shadow-color);
  z-index: 997;
  padding-bottom: env(safe-area-inset-bottom);
}
.bn-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: 0;
  background: none;
  padding: 0;
  font-family: inherit;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--secondary-color);
  cursor: pointer;
}
.bn-item svg { width: 20px; height: 20px; }
.bn-item.active, .bn-item:active { color: var(--primary-color-hover); }

@media (max-width: 900px) {
  .bottom-nav { display: flex; }
  body { padding-bottom: 60px; }
  /* !important: the base .back-to-top rule is defined later in the file */
  .back-to-top { bottom: 72px !important; right: 14px !important; }
  #mmenu { bottom: 56px; }
}

/* ============ BACK TO TOP ============ */

.back-to-top {
  position: fixed;
  right: 25px;
  bottom: 15px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary-color-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  cursor: pointer;
  z-index: 1000;
  border: 0;
}
.back-to-top:hover { background: #e0004a; }

/* ============ FOOTER ============ */

footer.footer {
  margin-top: 50px;
  background: var(--content-bg);
  border-top: 1px solid var(--border-color);
  box-shadow: 0 0 70px var(--shadow-color);
  text-align: center;
}
footer.footer .main-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 15px 20px;
  font-size: 11.5px;
  font-weight: 300;
  letter-spacing: 0.8px;
  line-height: 1.5;
  color: var(--secondary-color);
}
footer.footer .links { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; }
footer.footer a:hover { color: var(--primary-color-hover); }

/* Footer layout: logo + description + links + copyright */
footer.footer .footer-logo {
  width: auto;
  height: auto;
  padding: 4px 0 2px;
}
footer.footer .footer-logo .word { height: 20px; }
footer.footer .fdesc {
  margin: 0;
  max-width: 560px;
  color: var(--secondary-color);
  line-height: 1.6;
}
footer.footer .links a {
  font-weight: 600;
  color: var(--primary-color);
}
footer.footer .copy { margin: 4px 0 0; }

/* ============ RESPONSIVE: FILTER BAR (mobile) ============ */

@media (max-width: 640px) {
  /* Modal = full-width top sheet on phones (like 2023) */
  .modal-dialog {
    width: 100%;
    max-width: 100%;
  }

  /* Long translated titles (PT/PL) — keep to one line with ellipsis */
  .legend.panel h1 {
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 11px;
  }

  .nav.tabs.legend {
    flex-wrap: wrap;
    padding: 5px 5px 8px;
  }

  /* Day navigation becomes its own full-width row on top:
     arrows on the edges, date centered */
  .nav.tabs.legend .day-txt {
    order: -1;
    width: 100%;
    justify-content: space-between;
    padding-bottom: 6px;
    margin-bottom: 5px;
    border-bottom: 1px solid var(--border-color-2);
  }
  .day-txt #date_name { flex: 1; font-size: 13px; }

  /* Filters scroll horizontally like soccersapi did.
     Top/right padding gives the absolutely-positioned counter
     badge room inside the scroll container (it sticks out of
     the pill and would otherwise be clipped by overflow). */
  #statusFilters {
    flex: none;
    width: 100%;
    min-width: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 7px 10px 2px 0;
  }
  #statusFilters::-webkit-scrollbar { display: none; }
  #statusFilters a { flex-shrink: 0; }
}

/* ============ CHAT (right sidebar) ============ */

.chat-sidebar {
  padding: 0;
  position: sticky;
  top: 12px;
  align-self: flex-start;
}
.chat {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: calc(100vh - 110px);
  min-height: 420px;
  background: var(--content-bg);
  position: relative;   /* anchor for .chat-jump pill */
}
.chat-head {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-color);
  display: flex; align-items: center; gap: 8px;
  flex: none;
}
.chat-head h3 {
  font: 700 .78rem/1 "Titillium Web", sans-serif;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--font-color);
  margin: 0;
}
.chat-head .chat-count {
  margin-inline-start: auto;
  display: flex; align-items: center; gap: 6px;
  font-size: .72rem;
  color: var(--secondary-color);
}
.chat-head .chat-count .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px color-mix(in srgb, var(--green) 60%, transparent);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex; flex-direction: column; gap: 16px;
}
.chat-empty {
  display: grid; place-items: center;
  flex: 1;
  color: var(--icon-color);
  font-size: .85rem;
  padding: 2rem 1rem;
  text-align: center;
  text-wrap: balance;
}

.chat-input {
  padding: 10px;
  border-top: 1px solid var(--border-color);
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  flex: none;
}
/* Stacked composer: textarea takes its own full-width row, Send + logout sit
   on the row below (textarea flex-basis:100% forces the wrap). Roomier than
   cramming all three into one line in the narrow sidebar. */
.chat-input > button:not(.chat-logout-btn) { flex: 1 1 auto; }   /* Send grows */
.chat-input .chat-logout-btn { flex: 0 0 auto; }
.chat-input textarea {
  flex: 1 1 100%;
  padding: 8px 11px;
  background: var(--panel-secondary-bg);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--font-color);
  font: inherit; font-size: .85rem;
  resize: none;
  field-sizing: content;
  min-height: 36px;
  max-height: 120px;
}
.chat-input textarea:focus { outline: 1px solid var(--primary-color-hover); outline-offset: 0; border-color: var(--primary-color-hover); }
@supports (-webkit-touch-callout: none) {
  .chat-input textarea { font-size: 16px; }
}
.chat-input button {
  padding: 8px 13px;
  background: var(--primary-color-hover);
  color: #fff;
  border: 0;
  border-radius: 6px;
  font: 700 .8rem/1.2 "Titillium Web", sans-serif;
  cursor: pointer;
  transition: filter .12s ease;
}
.chat-input button:hover { filter: brightness(1.08); }
.chat-input button:disabled,
.chat-input textarea:disabled { opacity: .5; cursor: not-allowed; }

/* Discord login gate */
.chat-login-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px;
  background: #5865f2;
  color: #fff;
  border-radius: 6px;
  font: 600 .85rem/1 "Titillium Web", sans-serif;
  text-decoration: none;
  transition: filter .12s ease;
}
.chat-login-btn:hover { filter: brightness(1.1); }
.chat-login-btn--inline {
  width: 100%;
  justify-content: center;
  padding: 13px 16px;
  background: linear-gradient(180deg, #5865f2 0%, #4752c4 100%);
  box-shadow: 0 1px 0 rgba(255,255,255,.08) inset, 0 4px 12px rgba(0,0,0,.35);
  transition: transform .12s ease, filter .12s ease;
}
.chat-login-btn--inline:hover { transform: translateY(-1px); filter: brightness(1.06); }
.chat-login-btn--inline svg { width: 22px; height: 22px; }
.chat-login-btn--inline span { font-size: .9rem; }

.chat-gate-bar {
  display: flex; flex-direction: column; gap: 9px;
  width: 100%;
  padding: 4px 4px 2px;
}
.chat-gate-title {
  font: 700 .82rem/1 "Titillium Web", sans-serif;
  color: var(--font-color);
  text-align: center;
  letter-spacing: .02em;
}
.chat-gate-note {
  font-size: .68rem; line-height: 1.35;
  color: var(--icon-color);
  text-align: center;
  max-width: 36ch;
  margin: 0 auto;
  text-wrap: balance;
}
.chat-gate-bar--error .chat-gate-title { color: var(--red); }
.chat-gate-retry {
  display: block; text-align: center;
  font-size: .7rem;
  color: var(--icon-color);
  text-decoration: underline;
  margin-top: 3px;
}
.chat-gate-retry:hover { color: var(--font-color); }

/* Messages */
.chat-msg {
  display: flex; flex-direction: row; gap: 10px; align-items: flex-start;
  padding: 2px 4px;
  font-size: .9rem; line-height: 1.4;
  color: var(--font-color);
  word-wrap: break-word;
}
.chat-msg .msg-avatar {
  flex: 0 0 26px;
  width: 26px; height: 26px;
  border-radius: 50%;
  display: grid; place-items: center;
  color: #fff;
  font: 700 .72rem/1 "Titillium Web", sans-serif;
  user-select: none;
}
.chat-msg .msg-avatar--img { object-fit: cover; background: var(--panel-bg); }
.chat-msg .msg-body-wrap {
  flex: 1 1 auto; min-width: 0;
  display: flex; flex-direction: column; gap: 2px;
}
.chat-msg .msg-meta { display: flex; align-items: baseline; gap: 7px; }
.chat-msg .msg-name { font-weight: 700; font-size: .82rem; color: var(--font-color); cursor: pointer; }
.chat-msg .msg-name:hover { text-decoration: underline; }
.chat-msg .msg-time { font: 500 .68rem/1 "Titillium Web", sans-serif; color: var(--icon-color); flex-shrink: 0; }
.chat-msg .msg-mod-btn {
  margin-left: auto;
  padding: 0 5px; font-size: .9rem; line-height: 1;
  color: var(--icon-color); background: transparent; border: 0;
  border-radius: 4px; cursor: pointer;
  transition: color .12s ease, background .12s ease;
}
.chat-msg .msg-mod-btn:hover { color: var(--font-color); background: var(--hover-bg); }
.chat-msg .msg-body { color: var(--font-color); }

/* Subtle hover highlight for readability (skip system/alert rows). */
.chat-msg:not(.chat-msg--system):hover { background: var(--hover-bg); border-radius: 6px; }

/* Discord-style grouping: consecutive messages from the same user within a
   few minutes drop the avatar + name/time row and tuck up close. The avatar
   column stays (visibility:hidden) so bodies stay aligned. Time shows on hover. */
.chat-msg--grouped { margin-top: -12px; position: relative; }
.chat-msg--grouped .msg-avatar { visibility: hidden; height: 0; }
.chat-msg--grouped .msg-meta { display: none; }

/* Jump-to-latest pill — appears when the reader has scrolled up. */
.chat-jump {
  position: absolute; left: 50%; transform: translateX(-50%);
  bottom: 72px; z-index: 5;
  display: none; align-items: center; gap: 6px;
  padding: 6px 12px; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--primary-color-hover); color: #fff;
  font: 700 .72rem/1 "Titillium Web", sans-serif;
  box-shadow: 0 4px 14px rgba(0,0,0,.35);
}
.chat-jump.show { display: inline-flex; }
.chat-jump svg { width: 13px; height: 13px; }

.chat-msg[data-role="admin"] .msg-name { color: #a16207 !important; }
[data-theme="dark"] .chat-msg[data-role="admin"] .msg-name { color: #facc15 !important; }
.chat-msg[data-role="moderator"] .msg-name { color: #2ecc71 !important; }
.chat-msg .msg-role {
  font-size: .56rem; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; padding: 0 5px; border-radius: 3px;
  background: color-mix(in srgb, currentColor 18%, transparent);
}
.chat-msg .msg-role--moderator { color: #2ecc71; }
.chat-msg .msg-role--admin { color: var(--red); }

.msg-mod-menu {
  z-index: 9999; min-inline-size: 200px; padding: 5px;
  background: var(--content-bg); border: 1px solid var(--border-color);
  border-radius: 6px; box-shadow: 0 8px 24px rgba(0,0,0,.5);
  display: flex; flex-direction: column; gap: 2px;
}
.msg-mod-menu .mod-menu-head {
  padding: 5px 8px; border-bottom: 1px solid var(--border-color);
  display: flex; flex-direction: column; gap: 2px; margin-bottom: 4px;
}
.msg-mod-menu .mod-menu-head strong {
  font: 700 .78rem/1.1 "Titillium Web", sans-serif; color: var(--font-color);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.msg-mod-menu .mod-menu-ip { font: 600 .65rem/1 ui-monospace, monospace; color: var(--red); }
.msg-mod-menu button {
  text-align: left; padding: 6px 9px;
  font: 500 .8rem/1.2 "Titillium Web", sans-serif;
  color: var(--font-color); background: transparent; border: 0;
  border-radius: 4px; cursor: pointer; transition: background .12s ease;
}
.msg-mod-menu button:hover { background: var(--hover-bg); }

/* Ghost logout: `.chat-input button` paints all buttons crimson, so we need
   the extra `.chat-input` specificity to keep logout subtle (only Send stays
   the primary crimson action). */
.chat-input .chat-logout-btn {
  padding: 8px; background: transparent; color: var(--secondary-color);
  border: 1px solid var(--border-color); border-radius: 6px; cursor: pointer; align-self: center;
  transition: color .12s ease, background .12s ease, border-color .12s ease;
}
.chat-input .chat-logout-btn:hover { color: var(--font-color); background: var(--hover-bg); border-color: var(--secondary-color); }
.chat-logout-btn svg { display: block; }

.chat-msg--system {
  align-self: stretch; color: var(--font-color);
  font-size: .75rem; text-align: center; padding: 9px 12px;
  background: color-mix(in srgb, var(--primary-color-hover) 10%, var(--panel-secondary-bg));
  border: 1px solid color-mix(in srgb, var(--primary-color-hover) 25%, transparent);
  border-radius: 6px; text-wrap: balance;
}
.chat-msg--alert {
  color: #fecaca;
  background: color-mix(in srgb, #ef4444 18%, var(--panel-secondary-bg));
  border-color: color-mix(in srgb, #ef4444 55%, transparent);
  font-weight: 600; font-size: .82rem;
}
.chat-msg--in { animation: chatMsgIn .25s ease; }
@keyframes chatMsgIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.msg-mention { color: #f7b733; font-weight: 700; }
.chat-msg--mentioned { background: rgba(247,183,51,.11); border-left: 2px solid #f7b733; border-radius: 6px; padding-left: 6px; }
.msg-reply { font-size: 12px; line-height: 1.3; color: var(--secondary-color); border-left: 2px solid var(--border-color); padding: 1px 0 1px 8px; margin: 0 0 3px; opacity: .9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.msg-reply-btn { background: none; border: 0; color: var(--secondary-color); cursor: pointer; font-size: 14px; line-height: 1; padding: 0 4px; opacity: .6; transition: opacity .12s, color .12s; }
.chat-msg:hover .msg-reply-btn { opacity: 1; }
.msg-reply-btn:hover { opacity: 1; color: var(--font-color); }
.chat-reply-bar { display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: var(--panel-secondary-bg); border-top: 1px solid var(--border-color); font-size: 12.5px; color: var(--font-color); }
.chat-reply-bar__txt { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-reply-bar__txt b { color: #f7b733; }
.chat-reply-bar__x { background: none; border: 0; color: var(--secondary-color); cursor: pointer; font-size: 16px; line-height: 1; padding: 0 4px; }
.chat-reply-bar__x:hover { color: var(--font-color); }

/* ============ FAVORITE LEAGUES (Top Competitions pinning) ============ */
.league .fav-star {
  flex-shrink: 0; width: 22px; height: 22px; padding: 0;
  display: grid; place-items: center; background: transparent; border: 0;
  cursor: pointer; color: var(--icon-color);
  transition: color .12s ease, transform .12s ease;
}
.league .fav-star svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; }
.league .fav-star:hover { color: #f5b301; transform: scale(1.12); }
.league .fav-star.is-fav { color: #f5b301; }
.league .fav-star.is-fav svg { fill: #f5b301; stroke: #f5b301; }
.league.is-fav { background: color-mix(in srgb, var(--primary-color-hover) 10%, var(--light)); box-shadow: inset 3px 0 0 var(--primary-color-hover); }
.league--flash { animation: leagueFlash 1.2s ease; }
@keyframes leagueFlash {
  0%, 100% { box-shadow: inset 3px 0 0 var(--primary-color-hover); }
  30% { box-shadow: 0 0 0 2px var(--primary-color-hover); }
}

/* Sidebar edit toggle */
.fav-edit {
  margin-inline-start: auto; padding: 2px 9px; border-radius: 999px;
  background: var(--light); border: 1px solid var(--border-color);
  color: var(--secondary-color); font: 700 10px/1.6 "Titillium Web", sans-serif;
  text-transform: uppercase; letter-spacing: .05em; cursor: pointer;
}
.fav-edit:hover { color: var(--font-color); }
.fav-edit.active { background: var(--primary-color-hover); color: #fff; border-color: var(--primary-color-hover); }

/* Sidebar favorites list */
.fav-list { display: flex; flex-direction: column; gap: 3px; padding: 4px 0; }
.fav-empty { color: var(--icon-color); font-size: 12px; line-height: 1.45; padding: 8px 6px; }
.fav-hint { color: var(--icon-color); font-size: 11px; line-height: 1.3; padding: 0 4px 6px; }
.fav-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; border-radius: 6px; cursor: pointer;
  background: transparent; border: 1px solid transparent;
  transition: background .12s ease;
}
.fav-chip:hover { background: var(--hover-bg); }
.fav-chip .flag { width: 18px; height: 13px; border-radius: 2px; object-fit: cover; flex-shrink: 0; }
.fav-chip .fav-name { flex: 1; min-width: 0; font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fav-chip .fav-x {
  flex-shrink: 0; width: 18px; height: 18px; border: 0; background: transparent;
  color: var(--icon-color); font-size: 12px; cursor: pointer; border-radius: 4px;
  opacity: 0; transition: opacity .12s ease, color .12s ease;
}
.fav-chip:hover .fav-x { opacity: 1; }
.fav-chip .fav-x:hover { color: var(--red); background: var(--hover-bg); }
.fav-list.editing .fav-chip { background: var(--light); }
.fav-list.editing .fav-chip .fav-x { opacity: 1; }
/* touch-action:none lets a touch-drag on the handle reorder instead of scroll;
   larger padding = easier tap target on mobile. */
.fav-chip .fav-handle {
  flex-shrink: 0; color: var(--icon-color); cursor: grab;
  font-size: 15px; line-height: 1; padding: 6px 4px; margin: -6px 0 -6px -2px;
  touch-action: none; user-select: none; -webkit-user-select: none;
}
.fav-chip .fav-handle:active { cursor: grabbing; }
/* Dragged chip lifts off the list and follows the finger (JS sets translateY);
   the transition animates it settling back into place on drop. */
.fav-list.editing .fav-chip { transition: transform .16s ease; }
.fav-chip.dragging {
  opacity: 1; position: relative; z-index: 20;
  background: var(--content-bg);
  border-color: var(--primary-color-hover);
  box-shadow: 0 8px 22px rgba(0,0,0,.45);
  transition: none;
}

/* ============ ADS ============ */
/* Slot wrapper: discreet "Oglašavanje" label + reserved height (no CLS). */
.ad-slot { margin: 12px 0; display: flex; flex-direction: column; align-items: center; }
.ad-slot .ad-label {
  font-size: .58rem; letter-spacing: .09em; text-transform: uppercase;
  color: var(--icon-color); align-self: flex-start; margin: 0 0 4px 2px;
}
/* EXAMPLE placeholder — swap for {{joinAds .Ads.X}} / real ad code in prod. */
.ad-example {
  width: 100%; max-width: var(--ad-w, 728px);
  min-height: var(--ad-h, 90px);
  display: grid; place-items: center; text-align: center;
  background: repeating-linear-gradient(45deg, var(--panel-secondary-bg), var(--panel-secondary-bg) 11px, var(--panel-bg) 11px, var(--panel-bg) 22px);
  border: 1px dashed var(--border-color); border-radius: 8px;
  color: var(--secondary-color); font: 600 .78rem/1.4 "Titillium Web", sans-serif;
}
/* Placeholder label from data attr (data-d desktop, data-m mobile). */
.ad-example::after { content: attr(data-d); }
.ad-box     { --ad-w: 300px; --ad-h: 250px; }
.ad-infeed  { --ad-w: 728px; --ad-h: 90px; }
.ad-leaderboard { --ad-w: 970px; --ad-h: 90px; }

.ad-top { padding: 10px 12px 0; display: flex; justify-content: center; }

/* Mobile sticky anchor — slim, above the bottom-nav, dismissible. */
.ad-anchor { display: none; }
@media (max-width: 900px) {
  /* Mobile: all banners full-width + consistent height; align .ad-top padding
     to the content column (5px) so leaderboard matches the in-feed width. */
  .ad-top { padding: 10px 5px 0; }
  .ad-leaderboard, .ad-infeed { --ad-w: 100%; --ad-h: 90px; }
  .ad-example[data-m]::after { content: attr(data-m); }
  .ad-anchor {
    display: flex; position: fixed; left: 0; right: 0;
    bottom: calc(56px + env(safe-area-inset-bottom));
    z-index: 995; justify-content: center; align-items: center;
    padding: 5px 8px; background: var(--content-bg); border-top: 1px solid var(--border-color);
    box-shadow: 0 -4px 16px var(--shadow-color);
  }
  .ad-anchor .ad-example { --ad-w: 100%; --ad-h: 50px; min-height: 50px; }
  .ad-anchor .ad-close {
    position: absolute; top: -11px; right: 8px; width: 22px; height: 22px;
    display: grid; place-items: center; border-radius: 50%;
    background: var(--panel-bg); border: 1px solid var(--border-color);
    color: var(--font-color); font-size: 13px; line-height: 1; cursor: pointer;
  }
  body:not(.ad-anchor-closed) { padding-bottom: 120px; }  /* room for nav + anchor */
  body.ad-anchor-closed .ad-anchor { display: none; }
}

/* ============ ADBLOCK MODAL ============ */
html.nx-open, html.nx-open body { overflow: hidden; }
.nx-modal {
  position: fixed; inset: 0; z-index: 3000;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  background: rgba(0, 0, 0, .74);
  -webkit-backdrop-filter: blur(7px); backdrop-filter: blur(7px);
  opacity: 0; visibility: hidden;
  transition: opacity .22s ease, visibility .22s ease;
}
.nx-modal.show { opacity: 1; visibility: visible; }
.nx-card {
  width: 100%; max-width: 440px; text-align: center;
  background: var(--content-bg); color: var(--font-color);
  border: 1px solid var(--border-color); border-radius: 16px;
  padding: 34px 30px; box-shadow: 0 24px 64px rgba(0, 0, 0, .55);
  transform: translateY(10px) scale(.98);
  transition: transform .22s ease;
}
.nx-modal.show .nx-card { transform: none; }
.nx-logo { margin-bottom: 20px; }
.nx-logo img { height: 30px; width: auto; }
.nx-logo .logo-dark { display: none; }
[data-theme="dark"] .nx-logo .logo-dark { display: inline; }
[data-theme="dark"] .nx-logo .logo-light { display: none; }
.nx-badge {
  width: 62px; height: 62px; margin: 0 auto 16px; border-radius: 50%;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--primary-color-hover) 14%, transparent);
  color: var(--primary-color-hover);
}
.nx-badge svg { width: 30px; height: 30px; }
.nx-title { font: 800 1.4rem/1.2 "Titillium Web", sans-serif; margin: 0 0 6px; }
.nx-sub {
  font: 700 .74rem/1.3 "Titillium Web", sans-serif;
  letter-spacing: .06em; text-transform: uppercase;
  color: var(--primary-color-hover); margin: 0 0 14px;
}
.nx-body { font-size: .92rem; line-height: 1.55; color: var(--secondary-color); margin: 0 0 22px; }
.nx-btn {
  width: 100%; padding: 13px 20px; border: 0; border-radius: 10px; cursor: pointer;
  background: var(--primary-color-hover); color: #fff;
  font: 700 .95rem/1.2 "Titillium Web", sans-serif;
  transition: filter .15s ease;
}
.nx-btn:hover { filter: brightness(1.08); }
.nx-btn:disabled { opacity: .6; cursor: default; }
.nx-note { font-size: .78rem; color: var(--red); margin: 12px 0 0; }

/* ============ RESPONSIVE ============ */

@media (max-width: 1220px) {
  .main-container { width: 100%; }
  header.top-title .main-container { padding: 0 12px; }
}

@media (max-width: 1150px) {
  .sidebar.sidebar-right { display: none; }
}

@media (max-width: 900px) {
  .sidebar { display: none; }
  nav.navbar { display: none; }
  #mobile_menu { display: block; }
  a.logo { width: auto; flex: 1; }
  .content { border-radius: 0; }
  .contentWrap { padding-top: 0; }
}

.desktop-only { display: block; }
@media (max-width: 900px) { .desktop-only { display: none; } }

/* Phones: logo stays PROMINENT and scales automatically with the
   viewport (52vw, capped at desktop size) — no fixed breakpoints.
   Tools compress slightly so everything always fits in one row. */
@media (max-width: 900px) {
  a.logo { padding-right: 8px; }
  a.logo .word { height: auto; width: min(52vw, 246px); }
  .toolsmenu { padding: 0 2px; gap: 0; }
  .tool-icon, #themeToggle { width: 32px; height: 32px; }
  .tool-icon svg, #themeToggle svg { width: 16px; height: 16px; }
  #mobile_menu .burger { width: 34px; }
}
@media (max-width: 360px) {
  .tool-icon, #themeToggle { width: 28px; height: 28px; }
}

/* Chat mobile overlay — the bottom-nav "Chat" button slides this panel up
   over the content (adapted to our flex layout). Close via the
   X in the header, the Chat button again, or Escape. */
.chat-mobile-close { display: none; }
@media (max-width: 900px) {
  .chat-mobile-close {
    display: inline-flex; align-items: center; justify-content: center;
    margin-inline-start: 4px;
    width: 30px; height: 30px;
    background: transparent; border: 0; color: var(--secondary-color);
    cursor: pointer; border-radius: 6px;
  }
  .chat-mobile-close:hover { background: var(--hover-bg); color: var(--font-color); }
  .chat-mobile-close svg { width: 18px; height: 18px; }

  body.chat-open { overflow: hidden; }
  /* Selector must out-specify `.sidebar.sidebar-right` (0,2,0) which pins
     width to 260px — hence `.sidebar.sidebar-right.chat-sidebar` (0,3,0). */
  .sidebar.sidebar-right.chat-sidebar {
    display: flex !important;           /* beat .desktop-only + .sidebar display:none; column so .chat fills */
    flex-direction: column;
    position: fixed;
    left: 0; right: 0;
    top: 0;
    bottom: auto;
    /* Explicit height (not top+bottom stretch): a plain vh fallback first, then
       dvh where supported. Avoids env()-in-calc being dropped as invalid, which
       left the panel at content height. Stops 56px short so the bottom-nav
       (z-997) stays visible + tappable below the chat. */
    height: calc(100vh - 56px);
    height: calc(100dvh - 56px);
    z-index: 1000;                       /* above header(999); bottom-nav(997) stays free below */
    min-width: 0; max-width: none; width: auto;
    padding: 0;
    border: 0;
    background: var(--content-bg);
    transform: translateY(100%);
    visibility: hidden;
    transition: transform .28s ease, visibility .28s ease;
  }
  body.chat-open .sidebar.sidebar-right.chat-sidebar { transform: translateY(0); visibility: visible; }
  /* flex:1 + min-height:0 fills the full column height regardless of the
     desktop calc() height — no percentage-height ambiguity. */
  .sidebar.sidebar-right.chat-sidebar .chat {
    flex: 1 1 auto;
    min-height: 0;
    height: auto;
  }
}

/* Touch devices have no hover, so reveal reply/mod affordances permanently and
   enlarge the tap targets a touch. */
@media (hover: none) {
  .msg-reply-btn { opacity: .8; font-size: 16px; padding: 2px 6px; }
  .chat-msg .msg-mod-btn { font-size: 1.05rem; padding: 2px 6px; }
}


/* Admin/Mod istaknutost: outlined badge + suptilni glow oko imena (2026-08-20) */
.chat-msg[data-role="admin"] .msg-name,
.chat-msg[data-role="moderator"] .msg-name {
  text-shadow: 0 0 8px color-mix(in srgb, currentColor 40%, transparent);
}
.chat-msg .msg-role--admin,
.chat-msg .msg-role--moderator {
  border: 1px solid color-mix(in srgb, currentColor 50%, transparent);
  background: color-mix(in srgb, currentColor 18%, transparent);
}


/* Border oko cijele admin/mod poruke (2026-08-20) */
.chat-msg[data-role="admin"],
.chat-msg[data-role="moderator"] {
  border-radius: 9px;
  padding: 7px 9px;
}
.chat-msg[data-role="admin"] {
  border: 1px solid color-mix(in srgb, #a16207 45%, transparent);
  background: color-mix(in srgb, #a16207 8%, transparent);
}
[data-theme="dark"] .chat-msg[data-role="admin"] {
  border-color: color-mix(in srgb, #facc15 40%, transparent);
  background: color-mix(in srgb, #facc15 10%, transparent);
}
.chat-msg[data-role="moderator"] {
  border: 1px solid color-mix(in srgb, #2ecc71 40%, transparent);
  background: color-mix(in srgb, #2ecc71 8%, transparent);
}
/* grupisane admin/mod poruke: ne preklapaj borderove */
.chat-msg[data-role="admin"].chat-msg--grouped,
.chat-msg[data-role="moderator"].chat-msg--grouped { margin-top: 5px; }


/* Fix: dug sadržaj / mention razvlačio kolonu i gurao avatar (2026-08-20) */
.chat-msg .msg-body-wrap { flex: 1 1 auto; min-width: 0; }
.chat-msg .msg-body { overflow-wrap: anywhere; word-break: break-word; }
.chat-msg .msg-meta { min-width: 0; flex-wrap: wrap; }
.chat-msg .msg-name { overflow: hidden; text-overflow: ellipsis; max-width: 100%; }


/* Isključeno grupisanje: SVAKA poruka ima avatar + ime/vrijeme (2026-08-20) */
.chat-msg--grouped { margin-top: 0 !important; }
.chat-msg--grouped .msg-avatar { visibility: visible !important; height: 26px !important; }
.chat-msg--grouped .msg-meta { display: flex !important; }


/* Fix razmak ime<->poruka: meta na JEDAN red (nema wrap/gap) (2026-08-20) */
.chat-msg .msg-meta { flex-wrap: nowrap !important; }
.chat-msg .msg-name { max-width: none !important; flex: 0 1 auto; min-width: 0; white-space: nowrap; }
.chat-msg .msg-time,
.chat-msg .msg-reply-btn,
.chat-msg .msg-mod-btn { flex-shrink: 0; }


/* Ne rezati nick: ime uvijek PUNO (bez ellipsisa), vrijeme se spusti samo ako
   baš nema mjesta (jako dug nick). Za normalne nickove sve stane u 1 red. (2026-08-20) */
.chat-msg .msg-meta { flex-wrap: wrap !important; }
.chat-msg .msg-name {
  flex: 0 0 auto !important;
  overflow: visible !important;
  text-overflow: clip !important;
  white-space: nowrap;
  max-width: none !important;
}


/* Desktop-only: chat malo manji (mobile ≤900px ostaje netaknut) (2026-08-20) */
@media (min-width: 901px) {
  .chat-msg { font-size: .82rem; gap: 8px; }
  .chat-msg .msg-avatar,
  .chat-msg--grouped .msg-avatar {
    flex: 0 0 22px !important; width: 22px !important; height: 22px !important;
    font-size: .64rem !important;
  }
  .chat-msg .msg-name { font-size: .78rem; }
  .chat-msg .msg-time { font-size: .62rem; }
  .chat-msg[data-role="admin"],
  .chat-msg[data-role="moderator"] { padding: 5px 7px; }
  .msg-reply { font-size: 11px; }
}
