/* baller24.st — shared styles: tokens, header, footer, multi-stream
   Light and dark themes (toggle in the header), scores-site layout. */
:root {
  --bg: #f3f4f6;
  --surface: #ffffff;
  --surface-2: #f7f8fa;
  --ink: #15171c;
  --muted: #6b7280;
  --line: #e6e8ec;
  --accent: #15171c;
  --accent-ink: #ffffff;
  --live: #16a34a;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 4px 16px rgba(16, 24, 40, .04);
  --font-display: "Nunito", "Segoe UI", system-ui, sans-serif;
  --font-body: "Nunito", "Segoe UI", system-ui, -apple-system, sans-serif;
  --wrap: 1100px;
  --col: 740px;
  --gutter: clamp(14px, 3vw, 28px);
  --header-h: 60px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0f1114;
  --surface: #181b20;
  --surface-2: #1e2228;
  --ink: #f2f4f7;
  --muted: #98a1b0;
  --line: #272b33;
  --accent: #f2f4f7;
  --accent-ink: #0f1114;
  --live: #3ddc84;
  --shadow: none;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #0f1114; --surface: #181b20; --surface-2: #1e2228; --ink: #f2f4f7; --muted: #98a1b0;
    --line: #272b33; --accent: #f2f4f7; --accent-ink: #0f1114; --live: #3ddc84; --shadow: none; color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { animation: none !important; transition: none !important; } }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--ink); font: 500 16px/1.5 var(--font-body); -webkit-font-smoothing: antialiased;
}
main { flex: 1 0 auto; }
a { color: inherit; }
img { max-width: 100%; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 8px; }
.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gutter); }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ── Header ───────────────────────────────────── */
.header { background: var(--surface); border-bottom: 1px solid var(--line); }
.header-top { display: grid; grid-template-columns: 1fr minmax(0, 560px) 1fr; align-items: center; gap: 12px; min-height: var(--header-h); }
.header-top.simple { grid-template-columns: 1fr auto; }
.brand { justify-self: start; text-decoration: none; display: inline-flex; flex-direction: column; font: 800 1.55rem/1 var(--font-display); letter-spacing: -.04em; white-space: nowrap; }
.brand-title { font: inherit; letter-spacing: inherit; }
.brand-tld { color: var(--muted); font-weight: 700; }
.brand-sub { font: 600 0.68rem/1.2 var(--font-body); letter-spacing: .02em; color: var(--muted); margin-top: 3px; }
.header-right { justify-self: end; display: flex; align-items: center; gap: 4px; }

.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  border: 0; background: transparent; color: var(--ink); cursor: pointer; text-decoration: none; font-size: 1.05rem;
  transition: background-color .15s;
}
.icon-btn svg { width: 20px; height: 20px; }
@media (hover: hover) { .icon-btn:hover { background: var(--bg); } }
.i-sun { display: none; }
:root[data-theme="dark"] .i-sun { display: block; }
:root[data-theme="dark"] .i-moon { display: none; }

.search { position: relative; display: block; }
.search svg { position: absolute; left: 14px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search input {
  width: 100%; height: 42px; padding: 0 14px 0 42px; border: 1px solid transparent; border-radius: 12px;
  background: var(--bg); color: var(--ink); font: 500 16px var(--font-body);
  transition: border-color .15s, background-color .15s;
}
.search input::placeholder { color: var(--muted); }
.search input:focus { outline: none; border-color: var(--line); background: var(--surface); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink) 8%, transparent); }
.search input::-webkit-search-cancel-button { -webkit-appearance: none; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px;
  border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font: 700 .9375rem/1 var(--font-body); text-decoration: none; white-space: nowrap; cursor: pointer;
}
.btn-solid { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* Sport tabs (home) */
.tabsbar { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 900; }
.tabs { display: flex; gap: 4px; margin: 0; padding: 0; list-style: none; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  display: inline-flex; align-items: center; gap: 10px; height: 48px; padding: 0 16px; border: 0; border-radius: 12px 12px 0 0;
  background: transparent; color: var(--muted); font: 700 .9375rem var(--font-body); white-space: nowrap; cursor: pointer;
  transition: background-color .15s, color .15s;
}
.tab svg { width: 20px; height: 20px; flex: none; }
@media (hover: hover) { .tab:hover { color: var(--ink); } }
.tab[aria-pressed="true"] { background: var(--bg); color: var(--ink); }

@media (min-width: 768px) {
  .header { position: sticky; top: 0; z-index: 1000; border-bottom: 0; }
  .tabsbar { top: var(--header-h); }
}

/* ── Footer ───────────────────────────────────── */
.section-footer { padding: 28px 0 36px; color: var(--muted); font-size: .8125rem; text-align: center; }
.section-footer p { margin: 0 auto; max-width: 70ch; }
.mirrors { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 14px; margin-bottom: 8px; }
.mirrors a { color: var(--ink); text-decoration: none; font-weight: 700; }
@media (hover: hover) { .mirrors a:hover { text-decoration: underline; } }
.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--live); flex: none; }

/* ── Phones ───────────────────────────────────── */
@media (max-width: 767px) {
  .header-top { grid-template-columns: 1fr auto; grid-template-areas: "brand actions" "search search"; padding-block: 8px 10px; gap: 8px 12px; min-height: 0; }
  .header-top .brand { grid-area: brand; font-size: 1.4rem; }
  .header-top .brand-sub { font-size: 0.62rem; }
  .header-top .header-right { grid-area: actions; }
  .header-top .search { grid-area: search; }
}

/* ── MULTI STREAM OVERLAY ─────────────────────── */
#msOverlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 12, 16, .72);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.ms-modal {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 20px;
  width: 100%;
  max-width: 1160px;
  height: 88vh;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.ms-modal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.ms-modal-title { font: 800 1.1rem var(--font-display); letter-spacing: -.02em; }
.ms-modal-sub { font-size: .8125rem; color: var(--muted); flex: 1; }
.ms-close-btn {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  font: 600 .8125rem var(--font-body);
}
@media (hover: hover) { .ms-close-btn:hover { border-color: var(--accent); } }

.ms-panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 14px;
  flex: 1;
  overflow: hidden;
  min-height: 0;
  height: 0;
}
.ms-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
  height: 100%;
}
.ms-search-area { display: flex; flex-direction: column; height: 100%; min-height: 300px; }
.ms-search-wrap { padding: 10px; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.ms-search-input {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  padding: 10px 12px;
  font: 500 16px var(--font-body); /* 16px stops iOS zoom */
}
.ms-search-input::placeholder { color: var(--muted); }
.ms-results { flex: 1; overflow-y: auto; padding: 6px 0; }
.ms-result-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--line);
}
@media (hover: hover) { .ms-result-item:hover { background: var(--surface-2); } }
.ms-result-sport {
  font-size: .6875rem;
  font-weight: 700;
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 2px 8px;
  border-radius: 999px;
  flex-shrink: 0;
}
.ms-result-title { flex: 1; font-size: .8125rem; line-height: 1.3; }
.ms-result-time { font-size: .75rem; color: var(--muted); flex-shrink: 0; font-variant-numeric: tabular-nums; }
.ms-no-results { padding: 20px; text-align: center; color: var(--muted); font-size: .875rem; }

.ms-player-area { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow: hidden; }
.ms-panel-topbar {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  border-bottom: 1px solid var(--line); flex-shrink: 0;
}
.ms-panel-title { flex: 1; font-size: .75rem; font-weight: 700; line-height: 1.3; }
.ms-change-btn {
  background: var(--surface-2); border: 1px solid var(--line); color: var(--ink);
  padding: 5px 12px; border-radius: 999px; cursor: pointer; font: 600 .75rem var(--font-body); flex-shrink: 0;
}
@media (hover: hover) { .ms-change-btn:hover { border-color: var(--accent); } }
.ms-stream-btns {
  display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 10px;
  flex-shrink: 0; border-bottom: 1px solid var(--line);
}
.ms-stream-btn {
  background: var(--surface-2); border: 1px solid var(--line); color: var(--muted);
  padding: 5px 12px; border-radius: 999px; cursor: pointer; font: 600 .75rem var(--font-body);
}
.ms-stream-btn.active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
@media (hover: hover) { .ms-stream-btn:hover:not(.active) { color: var(--ink); border-color: var(--accent); } }
.ms-iframe-wrap { flex: 1; position: relative; min-height: 200px; background: #000; }
.ms-iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: none; }

@media (max-width: 700px) {
  #msOverlay { padding: 0; align-items: flex-start; }
  .ms-modal { border-radius: 0; height: 100dvh; max-height: 100dvh; border: none; }
  .ms-panels { grid-template-columns: 1fr; overflow-y: auto; gap: 10px; padding: 10px; }
  .ms-panel { min-height: 420px; height: auto; flex-shrink: 0; }
  .ms-player-area { min-height: 420px; }
  .ms-stream-btns { max-height: 76px; overflow-y: auto; }
  .ms-iframe-wrap { min-height: 240px; }
  .ms-search-area { min-height: 300px; }
  .ms-modal-sub { display: none; }
}
