:root {
  --bg-main: #020617;
  --bg-main-alt: #020617;
  --bg-card: #020617;
  --bg-card-soft: rgba(15, 23, 42, 0.8);
  --border-subtle: rgba(148, 163, 184, 0.35);
  --text-main: #e5e7eb;
  --text-muted: #9ca3af;
  --accent: #22c55e;
  --accent-soft: rgba(34, 197, 94, 0.12);
  --accent-strong: #16a34a;
  --danger: #f97373;
  --danger-soft: rgba(248, 113, 113, 0.12);
  --warning: #facc15;
  --warning-soft: rgba(250, 204, 21, 0.12);
  --chip: rgba(15, 23, 42, 0.85);
  --radius-lg: 20px;
  --shadow-soft: 0 20px 60px rgba(15, 23, 42, 0.9);
}

body {
  margin: 0;
  font-family: "Noto Sans Arabic", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, #0f172a 0, #020617 55%, #000 100%);
  color: var(--text-main);
  min-height: 100vh;
}

body.theme-light {
  --bg-main: #e5e7eb;
  --bg-main-alt: #f9fafb;
  --bg-card: #ffffff;
  --bg-card-soft: #ffffff;
  --border-subtle: rgba(148, 163, 184, 0.45);
  --text-main: #0f172a;
  --text-muted: #6b7280;
  --accent: #16a34a;
  --accent-soft: rgba(22, 163, 74, 0.08);
  --accent-strong: #15803d;
  --danger: #b91c1c;
  --danger-soft: rgba(239, 68, 68, 0.08);
  --warning: #b45309;
  --warning-soft: rgba(245, 158, 11, 0.12);
  --chip: #f3f4f6;
  --shadow-soft: 0 16px 45px rgba(15, 23, 42, 0.18);
  background:
    radial-gradient(circle at top left, #f9fafb 0, #e5e7eb 55%, #d1d5db 100%);
  color: var(--text-main);
}

* {
  box-sizing: border-box;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 18px 14px 80px;
}

@media (min-width: 960px) {
  .app-shell {
    padding: 22px 40px 90px;
  }
}

.app-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
}

.title-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.2rem;
  font-weight: 700;
}

.title-row span.trophy {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 30% 0, #fef9c3, #facc15 55%, #b45309 100%);
  box-shadow: 0 0 0 3px rgba(250, 204, 21, 0.25);
  font-size: 1.3rem;
}

.app-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.header-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  border: 1px solid rgba(34, 197, 94, 0.35);
  background: radial-gradient(circle at top left, rgba(34, 197, 94, 0.22), rgba(15, 23, 42, 0.85));
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.7);
}

body.theme-light .badge {
  background: #ecfdf5;
  box-shadow: none;
}

.badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #22c55e;
  box-shadow: 0 0 0 5px rgba(34, 197, 94, 0.25);
}

.now-line {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
}

.now-line strong {
  color: var(--text-main);
}

.theme-toggle {
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  background: var(--chip);
  color: var(--text-main);
  font-size: 0.78rem;
  padding: 6px 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  min-width: 120px;
  justify-content: center;
}

.theme-toggle span.icon {
  font-size: 1.1rem;
}

.theme-toggle:active {
  transform: translateY(1px);
}

.main-grid {
  display: grid;
  gap: 18px;
  align-items: flex-start;
}

@media (min-width: 980px) {
  .main-grid {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1.4fr);
  }
}

.card {
  border-radius: var(--radius-lg);
  background: radial-gradient(circle at top left, rgba(15, 23, 42, 0.96), var(--bg-card-soft));
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-soft);
  padding: 14px 16px 16px;
}

body.theme-light .card {
  background: var(--bg-card);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 6px;
}

.card-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.95rem;
  font-weight: 700;
}

.card-title::before {
  content: "";
  width: 4px;
  height: 18px;
  border-radius: 999px;
  background: linear-gradient(180deg, #22c55e, #38bdf8);
}

.card-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.pill {
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 0.74rem;
  border: 1px solid rgba(148, 163, 184, 0.5);
  background: var(--chip);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.pill .dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #22c55e;
}

.pill.warning .dot {
  background: var(--warning);
}

.pill.danger .dot {
  background: var(--danger);
}

.section-title {
  font-size: 0.88rem;
  font-weight: 600;
  margin: 10px 0 6px;
}

.info-box {
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px dashed rgba(148, 163, 184, 0.5);
  font-size: 0.8rem;
  color: var(--text-muted);
}

body.theme-light .info-box {
  background: #f9fafb;
}

.info-box ol {
  margin: 4px 0 0 18px;
  padding: 0;
}

.info-box li {
  margin-bottom: 3px;
}

.btn-outline {
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.65);
  background: transparent;
  color: var(--text-main);
  font-size: 0.8rem;
  padding: 6px 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.btn-outline .dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #22c55e;
}

.btn-outline:active {
  transform: translateY(1px);
}

.stats-card {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: radial-gradient(circle at top left, rgba(34, 197, 94, 0.16), rgba(15, 23, 42, 0.95));
  font-size: 0.8rem;
}

body.theme-light .stats-card {
  background: linear-gradient(135deg, #ecfdf5, #ffffff);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 6px;
}

.stat-pill {
  border-radius: 12px;
  padding: 6px 8px;
  font-size: 0.78rem;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(148, 163, 184, 0.5);
}

body.theme-light .stat-pill {
  background: #f9fafb;
}

.stat-label {
  color: var(--text-muted);
  margin-bottom: 2px;
  font-size: 0.75rem;
}

.stat-value {
  font-weight: 600;
}

.matches-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}

@media (min-width: 900px) {
  .matches-layout {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.9fr);
  }
}

.filters-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 4px;
  margin-bottom: 8px;
}

.filters-row select,
.filters-row input {
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.6);
  background: rgba(15, 23, 42, 0.8);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.78rem;
  padding: 6px 10px;
  outline: none;
  min-width: 140px;
}

body.theme-light .filters-row select,
body.theme-light .filters-row input {
  background: #f9fafb;
}

.filters-row input::placeholder {
  color: var(--text-muted);
}

.matches-column-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.matches-list {
  border-radius: 16px;
  border: 1px solid var(--border-subtle);
  background: rgba(15, 23, 42, 0.85);
  padding: 6px;
  max-height: 430px;
  overflow: auto;
}

body.theme-light .matches-list {
  background: #f9fafb;
}

.matches-list::-webkit-scrollbar {
  width: 6px;
}

.matches-list::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.7);
  border-radius: 999px;
}

.match-card {
  border-radius: 14px;
  padding: 8px 10px;
  background: radial-gradient(circle at top left, rgba(15, 23, 42, 0.95), #020617);
  border: 1px solid rgba(148, 163, 184, 0.6);
  margin-bottom: 6px;
  font-size: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.match-card.favorite {
  border-color: rgba(34, 197, 94, 0.85);
  box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.4);
}

.match-card.match-soon {
  border-color: rgba(34, 197, 94, 0.95);
  box-shadow:
    0 0 0 1px rgba(34, 197, 94, 0.7),
    0 0 24px rgba(34, 197, 94, 0.55);
  animation: matchSoonPulse 1.4s ease-in-out infinite;
}

body.theme-light .match-card.match-soon {
  box-shadow:
    0 0 0 1px rgba(22, 163, 74, 0.85),
    0 0 26px rgba(34, 197, 94, 0.45);
}

@keyframes matchSoonPulse {
  0% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-1px);
    box-shadow:
      0 0 0 1px rgba(34, 197, 94, 0.9),
      0 0 30px rgba(34, 197, 94, 0.7);
  }
  100% {
    transform: translateY(0);
  }
}

body.theme-light .match-card {
  background: linear-gradient(135deg, #ffffff, #f9fafb);
}

.match-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.match-league-round{
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:4px;
  font-size:0.78rem;
  color:var(--text-muted);
}

.match-league-name{
  font-weight:600;
  color:var(--text-main);
}

.match-round-label,
.match-season-label{
  font-weight:500;
  font-size:0.75rem;
}

.league-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.74rem;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.6);
  color: var(--text-muted);
}

body.theme-light .league-chip {
  background: #f9fafb;
}

.league-logo {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #0f172a;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  color: #e5e7eb;
}

.status-pill {
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 0.72rem;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid rgba(148, 163, 184, 0.7);
}

.status-pill.upcoming {
  background: var(--accent-soft);
  color: var(--accent-strong);
  border-color: rgba(34, 197, 94, 0.7);
}

.status-pill.finished {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: rgba(248, 113, 113, 0.7);
}

.status-pill.live {
  background: rgba(220, 38, 38, 0.95);
  color: #fee2e2;
  border-color: rgba(254, 226, 226, 0.8);
  box-shadow: 0 0 0 2px rgba(248,113,113,0.35);
}

.status-pill.postponed{
  background: var(--warning-soft);
  color: var(--warning);
  border-color: rgba(250, 204, 21, 0.75);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: currentColor;
}

.teams-row {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) 56px minmax(0, 1.1fr);
  gap: 6px;
  align-items: center;
}

.team-side {
  display: flex;
  align-items: center;
  gap: 6px;
}

.team-side.away {
  justify-content: flex-end;
  text-align: left;
  flex-direction: row-reverse;
}

.team-logo {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: #020617;
  border: 1px solid rgba(148, 163, 184, 0.7);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
}

body.theme-light .team-logo {
  background: #ffffff;
}

.team-name-main {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: 0.01em;
  text-shadow: 0 0 8px rgba(15, 23, 42, 0.7);
}

body.theme-light .team-name-main {
  text-shadow: none;
}

.team-name-main.favorite-team {
  color: var(--accent);
  text-shadow: 0 0 10px rgba(34, 197, 94, 0.55);
}

.team-name-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.score-box {
  text-align: center;
  padding: 5px 4px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.7);
  font-weight: 700;
  font-size: 0.9rem;
}

body.theme-light .score-box {
  background: #f9fafb;
}

.match-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.date-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.date-chip strong {
  color: var(--text-main);
}

.channel-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(148, 163, 184, 0.7);
  font-size: 0.74rem;
}

body.theme-light .channel-pill {
  background: #ffffff;
}

.channel-pill span.icon {
  font-size: 0.9rem;
}

.countdown-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.8);
  border: 1px dashed rgba(148, 163, 184, 0.7);
  font-size: 0.74rem;
}

body.theme-light .countdown-pill {
  background: #fefce8;
}

.countdown-pill span.icon {
  font-size: 0.9rem;
  color: var(--warning);
}

.empty-state {
  padding: 16px 10px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.loader {
  text-align: center;
  padding: 20px 10px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.loader::after {
  content: "•••";
  display: inline-block;
  margin-right: 5px;
  animation: blink 1s infinite alternate;
}

@keyframes blink {
  from { opacity: 0.2; }
  to   { opacity: 1; }
}

.footer {
  margin-top: 18px;
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.footer span.brand {
  color: var(--accent);
  font-weight: 600;
}

.matches-strip{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  margin:6px 0 8px;
  font-size:0.78rem;
}

.matches-strip-item{
  flex:1 1 90px;
  min-width:90px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:4px 10px;
  border-radius:999px;
  background:rgba(15,23,42,0.85);
  border:1px solid rgba(148,163,184,0.65);
}

body.theme-light .matches-strip-item{
  background:#f9fafb;
}

.matches-strip-label{
  color:var(--text-muted);
}

.matches-strip-value{
  font-weight:600;
  color:var(--text-main);
}

.standings-header-row{
  display:flex;
  flex-wrap:wrap;
  justify-content:space-between;
  align-items:center;
  gap:6px;
  font-size:0.8rem;
  margin-bottom:6px;
}

.standings-info{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  align-items:center;
}

.standings-season-pill{
  border-radius:999px;
  padding:2px 8px;
  font-size:0.72rem;
  background:var(--accent-soft);
  color:var(--accent-strong);
  border:1px solid rgba(34,197,94,0.6);
}

.standings-season-select{
  border-radius:999px;
  padding:4px 10px;
  font-size:0.75rem;
  background:var(--chip);
  color:var(--text-main);
  border:1px solid rgba(148,163,184,0.65);
  min-width:120px;
  outline:none;
}

body.theme-light .standings-season-select{
  background:#f9fafb;
}

.standings-updated{
  color:var(--text-muted);
  font-size:0.78rem;
}

.standings-table-wrapper{
  border-radius:14px;
  border:1px solid var(--border-subtle);
  background:rgba(15,23,42,0.85);
  overflow:auto;
}

body.theme-light .standings-table-wrapper{
  background:#f9fafb;
}

.standings-table{
  width:100%;
  min-width:520px;
  border-collapse:collapse;
  font-size:0.78rem;
}

.standings-table th,
.standings-table td{
  padding:6px 8px;
  border-bottom:1px solid rgba(148,163,184,0.4);
  text-align:center;
  white-space:nowrap;
}

.standings-table th{
  font-size:0.75rem;
  font-weight:600;
  color:var(--text-muted);
}

.standings-table tr:hover{
  background:rgba(15,23,42,0.75);
}

body.theme-light .standings-table tr:hover{
  background:#eef2ff;
}

.standings-table tr.favorite{
  background:rgba(34,197,94,0.08);
}

body.theme-light .standings-table tr.favorite{
  background:#dcfce7;
}

.standings-team-cell{
  display:flex;
  align-items:center;
  gap:6px;
}

.standings-team-badge{
  width:22px;
  height:22px;
  border-radius:999px;
  background:#020617;
  border:1px solid rgba(148,163,184,0.6);
  display:inline-flex;
  align-items:center;
  justify-content:center;
  font-size:0.7rem;
  font-weight:700;
}

body.theme-light .standings-team-badge{
  background:#ffffff;
}

.standings-pos-pill{
  border-radius:999px;
  padding:2px 7px;
  font-size:0.72rem;
  background:rgba(15,23,42,0.9);
  border:1px solid rgba(148,163,184,0.7);
}

body.theme-light .standings-pos-pill{
  background:#ffffff;
}

.standings-form{
  display:flex;
  flex-wrap:wrap;
  gap:4px;
  justify-content:flex-start;
}

.standings-form span{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:2px 8px;
  border-radius:999px;
  font-size:0.68rem;
  font-weight:600;
  background:rgba(15,23,42,0.85);
  border:1px solid rgba(148,163,184,0.45);
}

.standings-form span.f{
  background:var(--accent-soft);
  color:var(--accent-strong);
  border-color:rgba(34,197,94,0.7);
}

.standings-form span.t{
  background:var(--warning-soft);
  color:var(--warning);
  border-color:rgba(245,158,11,0.7);
}

.standings-form span.kh{
  background:var(--danger-soft);
  color:var(--danger);
  border-color:rgba(248,113,113,0.7);
}

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 999;
  display: flex;
  justify-content: space-around;
  align-items: stretch;
  padding: 6px 10px calc(env(safe-area-inset-bottom, 0) + 6px);
  background: radial-gradient(circle at top, rgba(15,23,42,0.96), rgba(15,23,42,0.98));
  border-top: 1px solid rgba(148,163,184,0.5);
  box-shadow: 0 -10px 40px rgba(15,23,42,0.9);
}

body.theme-light .bottom-nav {
  background: #ffffff;
  box-shadow: 0 -10px 30px rgba(15,23,42,0.12);
}

.bottom-nav-item {
  flex: 1 1 0;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.72rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border-radius: 999px;
  padding: 6px 4px;
  cursor: pointer;
}

.bottom-nav-item.active {
  color: var(--accent-strong);
  background: var(--accent-soft);
}

.bottom-nav-icon {
  font-size: 1.1rem;
  line-height: 1;
}

@media (min-width: 900px) {
  .bottom-nav {
    max-width: 520px;
    margin: 0 auto;
    left: 0;
    right: 0;
    bottom: 14px;
    border-radius: 999px;
  }
}
