/* =====================================================================
   v8: (1) each home section gets its own themed backdrop (both themes)
       (2) light "white" theme: html[data-theme="light"]
   ===================================================================== */

/* ---------- Theme switch button ---------- */
.theme-toggle {
  order: 3; flex-shrink: 0; width: 40px; height: 40px; border-radius: 12px; cursor: pointer; font-size: 1.15rem; line-height: 1;
  display: grid; place-items: center; border: 1px solid var(--glass-line); background: var(--glass); color: var(--text);
  transition: transform .25s, background .2s;
}
.theme-toggle:hover { transform: rotate(-12deg) scale(1.06); }
.theme-toggle span::before { content: "☀️"; }
html[data-theme="light"] .theme-toggle span::before { content: "🌙"; }
.top-inner .lang { order: 3; }
@media (max-width: 1180px) { .theme-toggle { margin-inline-start: auto; } .top-inner .lang { margin-inline-start: 0; } }
.top.compact .theme-toggle { margin-inline-start: auto; }
.top.compact .top-inner .lang { margin-inline-start: 0; }
@media (max-width: 420px) { .theme-toggle { width: 36px; height: 36px; font-size: 1rem; } }

/* ---------- Section backdrops: every section looks like its subject ---------- */
.cat-row.themed {
  position: relative; isolation: isolate; padding: 16px 18px 18px; border-radius: 24px; overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--rc, var(--accent)) 26%, transparent);
  background: linear-gradient(160deg, color-mix(in srgb, var(--rc, var(--accent)) 16%, transparent), transparent 55%);
}
.cat-row.themed::before {   /* subject pattern */
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: .9;
}
.cat-row.themed::after {    /* large faint icon in the corner */
  content: attr(data-icon); position: absolute; z-index: -1; top: -18px; inset-inline-end: -8px; font-size: 150px; line-height: 1;
  opacity: .07; transform: rotate(-12deg); pointer-events: none; filter: saturate(.6);
}
.cat-row.themed .row-head::after { left: 0; right: 0; }
@media (max-width: 640px) { .cat-row.themed { padding: 12px 10px 14px; border-radius: 18px; } .cat-row.themed::after { font-size: 110px; } }

/* Space: starfield + nebula glow */
.cat-row.space::before {
  background:
    radial-gradient(1.4px 1.4px at 12% 22%, color-mix(in srgb, var(--c-space) 90%, #fff) 50%, transparent 51%),
    radial-gradient(1px 1px at 38% 70%, color-mix(in srgb, var(--c-space) 80%, #fff) 50%, transparent 51%),
    radial-gradient(1.8px 1.8px at 72% 30%, color-mix(in srgb, #b06bff 80%, #fff) 50%, transparent 51%),
    radial-gradient(1px 1px at 88% 78%, color-mix(in srgb, var(--c-space) 80%, #fff) 50%, transparent 51%),
    radial-gradient(60% 50% at 85% 0%, color-mix(in srgb, #b06bff 22%, transparent), transparent 70%);
  background-size: 180px 180px, 240px 240px, 300px 300px, 200px 200px, auto;
}
/* Technology: circuit-board grid with nodes */
.cat-row.tech::before {
  background:
    radial-gradient(2.5px 2.5px at 50% 50%, color-mix(in srgb, var(--c-ai) 55%, transparent) 50%, transparent 51%),
    linear-gradient(color-mix(in srgb, var(--c-ai) 10%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--c-ai) 10%, transparent) 1px, transparent 1px);
  background-size: 88px 88px, 44px 44px, 44px 44px;
  mask-image: linear-gradient(180deg, #000, transparent 85%); -webkit-mask-image: linear-gradient(180deg, #000, transparent 85%);
}
/* International: globe lines (latitude rings + meridians) */
.cat-row.intl::before {
  background:
    repeating-radial-gradient(circle at 100% 0%, transparent 0 46px, color-mix(in srgb, var(--c-intl) 16%, transparent) 47px 48px),
    repeating-linear-gradient(90deg, transparent 0 95px, color-mix(in srgb, var(--c-intl) 8%, transparent) 95px 96px);
  mask-image: radial-gradient(90% 90% at 100% 0%, #000, transparent 75%); -webkit-mask-image: radial-gradient(90% 90% at 100% 0%, #000, transparent 75%);
}
/* Sports: pitch stripes + centre circle */
.cat-row.sports::before {
  background:
    radial-gradient(circle at 92% 18%, transparent 0 54px, color-mix(in srgb, var(--c-sports) 26%, transparent) 55px 57px, transparent 58px),
    repeating-linear-gradient(90deg, color-mix(in srgb, var(--c-sports) 7%, transparent) 0 70px, transparent 70px 140px);
}
/* Entertainment: stage spotlights + sparkles */
.cat-row.ent::before {
  background:
    conic-gradient(from 160deg at 20% -10%, transparent 0deg, color-mix(in srgb, var(--c-ent) 18%, transparent) 12deg, transparent 26deg),
    conic-gradient(from 175deg at 80% -10%, transparent 0deg, color-mix(in srgb, #ffb86b 18%, transparent) 12deg, transparent 26deg),
    radial-gradient(1.6px 1.6px at 30% 40%, color-mix(in srgb, var(--c-ent) 80%, #fff) 50%, transparent 51%),
    radial-gradient(1.2px 1.2px at 70% 65%, color-mix(in srgb, #ffb86b 80%, #fff) 50%, transparent 51%);
  background-size: auto, auto, 160px 160px, 220px 220px;
}
/* Wonder: soft ripples */
.cat-row.wonder::before {
  background: repeating-radial-gradient(circle at 0% 100%, transparent 0 30px, color-mix(in srgb, var(--c-wonder) 12%, transparent) 31px 32px);
  mask-image: radial-gradient(80% 90% at 0% 100%, #000, transparent 70%); -webkit-mask-image: radial-gradient(80% 90% at 0% 100%, #000, transparent 70%);
}
/* Crypto & economy: chart grid + rising line */
.cat-row.crypto::before {
  background:
    linear-gradient(162deg, transparent 47%, color-mix(in srgb, #2ecc71 30%, transparent) 48%, transparent 49.5%),
    repeating-linear-gradient(0deg, color-mix(in srgb, var(--c-crypto) 9%, transparent) 0 1px, transparent 1px 38px);
}
/* Trending: warm flame glow */
.cat-row.trending::before {
  background: radial-gradient(70% 60% at 100% 0%, color-mix(in srgb, var(--c-trending) 24%, transparent), transparent 70%),
              radial-gradient(50% 50% at 0% 100%, color-mix(in srgb, #ffb347 14%, transparent), transparent 70%);
}
.cat-row.themed .rc-nav.prev { left: -6px; }
.cat-row.themed .rc-nav.next { right: -6px; }
[dir="rtl"] .cat-row.themed .rc-nav.prev { left: auto; right: -6px; }
[dir="rtl"] .cat-row.themed .rc-nav.next { right: auto; left: -6px; }


/* =====================================================================
   Light theme
   ===================================================================== */
html[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f6fb; --panel: #ffffff; --panel-2: #f1f3f9; --line: rgba(28, 38, 90, .12);
  --text: #1a2040; --muted: #565f7c; --accent-2: #c25e00;
  --glass: rgba(255, 255, 255, .75); --glass-line: rgba(28, 38, 90, .1);
  --sheen: linear-gradient(180deg, rgba(255, 255, 255, .9), rgba(255, 255, 255, 0) 40%);
  --shadow: 0 8px 26px rgba(28, 38, 90, .08);
  --ink: #0f1430;
}
html[data-theme="light"] body {
  color: var(--text);
  background: radial-gradient(900px 500px at 85% -10%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 60%),
              radial-gradient(800px 520px at -10% 30%, rgba(176, 107, 255, .08), transparent 60%), var(--bg);
}
html[data-theme="light"] body::before { opacity: .22; }
html[data-theme="light"] .stars-bg {
  opacity: .5; animation: none;
  background-image: radial-gradient(1.2px 1.2px at 50% 50%, color-mix(in srgb, var(--accent) 30%, transparent) 50%, transparent 51%);
  background-size: 28px 28px;
}

/* Header */
html[data-theme="light"] .top, html[data-theme="light"] .top.scrolled {
  background: rgba(255, 255, 255, .88); box-shadow: 0 10px 30px rgba(28, 38, 90, .1);
}
html[data-theme="light"] .brand { color: var(--ink); }
html[data-theme="light"] nav.cats a, html[data-theme="light"] .dd-btn { color: #3d4565; }
html[data-theme="light"] nav.cats a:not(.active):hover, html[data-theme="light"] .dd-btn:hover { background: rgba(28, 38, 90, .06); color: var(--ink); }
html[data-theme="light"] .top-inner nav.cats { background: rgba(28, 38, 90, .04); }
html[data-theme="light"] .dd-menu { background: rgba(255, 255, 255, .97); box-shadow: 0 18px 40px rgba(28, 38, 90, .16); }
html[data-theme="light"] .lang select, html[data-theme="light"] .lang select option { background: #fff; color: var(--text); }
html[data-theme="light"] .menu-toggle { background: #fff; }

/* Titles: deep navy text (easy on the eyes) with colour only in badges and lines */
html[data-theme="light"] .hero h1 {
  background-image: linear-gradient(120deg, #2d4bdc, #7b2ff7 45%, #d6336c 80%, #2d4bdc);
  filter: none;
}
html[data-theme="light"] .row-head h2, html[data-theme="light"] .side-box > h2 { color: var(--ink); text-shadow: none; }
html[data-theme="light"] .card-body h3, html[data-theme="light"] .article h1, html[data-theme="light"] .cat-banner h1 { color: var(--ink); }
html[data-theme="light"] .see-all, html[data-theme="light"] .sub-tabs .sub-more { color: color-mix(in srgb, var(--rc, var(--accent)) 62%, #10183a); }
html[data-theme="light"] main a:not([class]), html[data-theme="light"] footer a, html[data-theme="light"] .st-row a,
html[data-theme="light"] .tab-empty a, html[data-theme="light"] .sources a { color: color-mix(in srgb, var(--accent) 60%, #10183a); }
html[data-theme="light"] .chip { color: color-mix(in srgb, currentColor 58%, #0d1230); }
html[data-theme="light"] .card .thumb .chip, html[data-theme="light"] .slide .chip { color: #fff; }

/* Panels and cards */
html[data-theme="light"] .side-box, html[data-theme="light"] .ask, html[data-theme="light"] .article,
html[data-theme="light"] .schedule, html[data-theme="light"] .quiz {
  background-color: #fff; box-shadow: var(--shadow); backdrop-filter: none; -webkit-backdrop-filter: none;
}
html[data-theme="light"] .card { background: #fff; box-shadow: 0 6px 20px rgba(28, 38, 90, .08); border-color: var(--line); }
html[data-theme="light"] .card:hover { box-shadow: 0 16px 34px rgba(28, 38, 90, .16); }
html[data-theme="light"] .card .thumb { background: #e8ecf6; }
html[data-theme="light"] .slider { background: #dfe4f2; box-shadow: 0 20px 44px rgba(28, 38, 90, .18); }
html[data-theme="light"] .cat-banner { background: linear-gradient(120deg, color-mix(in srgb, var(--accent) 18%, #fff), #fff); }
html[data-theme="light"] .cat-row.themed { background: linear-gradient(160deg, color-mix(in srgb, var(--rc, var(--accent)) 12%, #fff), rgba(255, 255, 255, .6) 60%); }
html[data-theme="light"] .cat-row.themed::after { opacity: .1; }
html[data-theme="light"] .sub-tabs { background: rgba(255, 255, 255, .8); }
html[data-theme="light"] .sub-tabs [role="tab"], html[data-theme="light"] .sub-tabs > a { color: #4a5373; }
html[data-theme="light"] .sub-tabs [role="tab"]:hover { color: var(--ink); background: rgba(28, 38, 90, .05); }
html[data-theme="light"] .sub-tabs [role="tab"][aria-selected="true"], html[data-theme="light"] .page-tabs > a[aria-current="page"] { color: #fff; }
html[data-theme="light"] .sub-tabs small { background: rgba(28, 38, 90, .08); }
html[data-theme="light"] .sub-tabs [aria-selected="true"] small { background: rgba(255, 255, 255, .25); }
html[data-theme="light"] .rc-nav { background: rgba(255, 255, 255, .95); color: var(--ink); border-color: var(--line); }
html[data-theme="light"] .rc-nav:hover { color: #fff; }
html[data-theme="light"] .rc-dots button { background: rgba(28, 38, 90, .18); }

/* On this day, schedule, quiz, tools */
html[data-theme="light"] .otd-list a { background: linear-gradient(90deg, rgba(255, 170, 80, .12), var(--panel-2) 45%); color: var(--text); }
html[data-theme="light"] .otd-list .year { color: #a34c00; background: linear-gradient(135deg, rgba(255, 170, 80, .3), rgba(255, 107, 181, .18)); }
html[data-theme="light"] .otd-nav { background: #fff; border-color: var(--line); color: var(--ink); }
html[data-theme="light"] .otd-nav:hover { color: #fff; }
html[data-theme="light"] .otd-dots button { background: rgba(28, 38, 90, .18); }
html[data-theme="light"] .sched-item .when strong { color: #c25e00; }
html[data-theme="light"] .sched-item .ev-name { color: var(--ink); }
html[data-theme="light"] .quiz-q .opt.right { background: #e3f6ec; border-color: #2fa36b; }
html[data-theme="light"] .quiz-q .opt.wrong { background: #fde7ea; border-color: #e0465a; }
html[data-theme="light"] .quiz-score .win { color: #1f8a57; }
html[data-theme="light"] .st-pane textarea, html[data-theme="light"] .st-pane input, html[data-theme="light"] .st-pane select { background: #fff; }
html[data-theme="light"] .st-tabs button { background: var(--panel-2); }
html[data-theme="light"] .st-tabs button[aria-selected="true"] { color: #fff; }
html[data-theme="light"] .notice { background: #fff4e5; color: #8a4b00; }
html[data-theme="light"] .ask textarea { background: #fff; color: var(--text); border-color: var(--line); }
html[data-theme="light"] .crumbs a { background: #fff; border: 1px solid var(--line); }
html[data-theme="light"] .rel-list a:hover { background: var(--panel-2); }
html[data-theme="light"] .rthumb { background: #e8ecf6; }
html[data-theme="light"] .tab-empty { background: rgba(255, 255, 255, .7); }
html[data-theme="light"] footer { background: linear-gradient(180deg, #fff, #eef1f8); color: var(--muted); }
html[data-theme="light"] .beat h2 { color: #5a6380; }

/* Phones: logo, theme button, language and menu all on one line */
@media (max-width: 420px) {
  .top-inner { gap: 6px; padding: 8px 10px; }
  .brand { font-size: .98rem; gap: 6px; }
  .brand .logo { width: 30px; height: 30px; font-size: .95rem; border-radius: 10px; }
  .theme-toggle { width: 34px; height: 34px; border-radius: 10px; }
  .top-inner .lang select { max-width: 88px; padding: 6px 8px; font-size: .85rem; }
  .menu-toggle { width: 40px; height: 40px; }
  .menu-toggle .bars { top: 19px; left: 11px; }
}


/* =====================================================================
   v9: live score bar (under the header) and the scores page
   ===================================================================== */
.score-strip { width: calc(100% - 24px); max-width: 1240px; margin: 10px auto 0; }
.ss-inner {
  display: flex; align-items: stretch; gap: 10px; padding: 8px; border-radius: 18px;
  background: var(--glass); border: 1px solid var(--glass-line); box-shadow: var(--shadow);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
html[data-theme="light"] .ss-inner { background: #fff; }
.ss-tabs { display: flex; flex-direction: column; gap: 4px; flex-shrink: 0; }
.ss-tabs button {
  font: inherit; font-size: .78rem; font-weight: 700; cursor: pointer; padding: 4px 10px; border-radius: 9px; white-space: nowrap;
  border: 1px solid transparent; background: none; color: var(--muted); text-align: start;
}
.ss-tabs button[aria-pressed="true"] { color: #fff; background: linear-gradient(135deg, #2ecc71, #17a2b8); }
.ss-track {
  flex: 1; min-width: 0; display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: thin;
  align-items: stretch;
}
.ss-msg { align-self: center; color: var(--muted); font-size: .9rem; padding: 0 8px; white-space: nowrap; }
.ss-all {
  flex-shrink: 0; align-self: center; font-size: .85rem; font-weight: 700; padding: 8px 12px; border-radius: 12px; white-space: nowrap;
  color: color-mix(in srgb, #2ecc71 70%, var(--text)); border: 1px solid color-mix(in srgb, #2ecc71 35%, transparent);
}
.score-strip.soon .ss-tabs { display: none; }
.sc-card {
  flex: 0 0 172px; scroll-snap-align: start; display: flex; flex-direction: column; gap: 3px; padding: 7px 10px; border-radius: 12px;
  color: var(--text); background: var(--panel-2); border: 1px solid var(--line); transition: border-color .2s, transform .2s;
}
.sc-card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, #2ecc71 55%, transparent); }
.sc-card.is-live { border-color: color-mix(in srgb, #ff4d4d 45%, transparent); }
.sc-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: .72rem; color: var(--muted); }
.sc-league { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.sc-state { flex-shrink: 0; font-weight: 800; font-size: .7rem; padding: 1px 6px; border-radius: 6px; background: rgba(127, 140, 180, .15); }
.sc-state.live { color: #fff; background: #e5383b; display: inline-flex; align-items: center; gap: 4px; }
.sc-state.done { color: var(--muted); }
.sc-state .dot { width: 6px; height: 6px; border-radius: 50%; background: #fff; animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: .25; } }
.sc-team { display: flex; justify-content: space-between; gap: 8px; font-size: .88rem; line-height: 1.35; }
.sc-team b { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-team.lead b, .sc-team.lead .sc-score { color: color-mix(in srgb, #2ecc71 60%, var(--text)); }
.sc-score { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (max-width: 640px) {
  .score-strip { width: calc(100% - 16px); margin-top: 8px; }
  .ss-inner { flex-wrap: wrap; gap: 6px; }
  .ss-tabs { flex-direction: row; width: 100%; }
  .ss-all { display: none; }
  .sc-card { flex-basis: 150px; }
}

/* Scores page */
.scores-page .sp-group { margin-top: 18px; }
.scores-page .sp-group h2 { font-size: 1.05rem; margin: 0 0 10px; display: flex; align-items: center; gap: 8px; }
.scores-page .sp-group.live h2::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: #e5383b; animation: blink 1.2s infinite; }
.sp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.sp-card { padding: 12px 14px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); scroll-margin-top: 110px; }
.sp-card.is-live { border-color: color-mix(in srgb, #e5383b 45%, transparent); }
.sp-card.focus { outline: 3px solid #2ecc71; outline-offset: 2px; }
.sp-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; font-size: .8rem; color: var(--muted); }
.sp-league { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-row { display: flex; justify-content: space-between; gap: 10px; padding: 4px 0; font-size: 1rem; }
.sp-row.win .sp-name, .sp-row.win .sp-num { color: color-mix(in srgb, #2ecc71 60%, var(--text)); }
.sp-name { font-weight: 700; }
.sp-num { font-weight: 800; font-variant-numeric: tabular-nums; text-align: end; }
.sp-note { margin: 6px 0 0; font-size: .86rem; }
.sp-note.muted { color: var(--muted); }
.sp-meta { margin-top: 16px; color: var(--muted); }
@media (prefers-reduced-motion: reduce) { .sc-state .dot, .scores-page .sp-group.live h2::before { animation: none; } }


/* Live light on the sport buttons + pulsing live cards */
.live-tag { display: inline-flex; align-items: center; gap: 3px; margin-inline-start: 6px; padding: 0 6px; border-radius: 99px;
  font-size: .7rem; font-weight: 800; color: #fff; background: #e5383b; line-height: 1.5; }
.live-tag .dot { width: 6px; height: 6px; border-radius: 50%; background: #fff; animation: blink 1s infinite; }
.ss-tabs button.has-live:not([aria-pressed="true"]) { color: var(--text); }
.ss-tabs button { display: inline-flex; align-items: center; gap: 4px; }
.sc-card.is-live, .sp-card.is-live { animation: livePulse 2s ease-in-out infinite; }
@keyframes livePulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(229, 56, 59, 0); } 50% { box-shadow: 0 0 0 3px rgba(229, 56, 59, .28); } }
@media (prefers-reduced-motion: reduce) { .live-tag .dot, .sc-card.is-live, .sp-card.is-live { animation: none; } }

/* Score bar: sport buttons in their own row above the match cards */
.ss-inner { flex-wrap: wrap; row-gap: 8px; }
.ss-tabs { flex-direction: row; flex: 1 1 auto; order: 0; gap: 6px; }
.ss-tabs button { font-size: .82rem; padding: 5px 12px; border: 1px solid var(--line); }
.ss-all { order: 1; padding: 5px 12px; font-size: .82rem; display: inline-block; }
.ss-track { order: 2; flex: 1 1 100%; }
@media (max-width: 640px) { .ss-all { display: inline-block; } .ss-tabs { width: auto; } }
