:root {
  --bg: #071313;
  --bg-soft: #0b1b1b;
  --surface: #102323;
  --surface-2: #142c2c;
  --surface-3: #193737;
  --line: rgba(226, 232, 240, 0.1);
  --line-strong: rgba(226, 232, 240, 0.18);
  --text: #f3f7f3;
  --muted: #a6b7b2;
  --faint: #657873;
  --mint: #56d6a0;
  --amber: #f3bd47;
  --red: #f05252;
  --blue: #69a7ff;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
  --font-ar: 'IBM Plex Sans Arabic', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-num: 'Outfit', var(--font-ar);
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  direction: rtl;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(86, 214, 160, 0.08), transparent 330px),
    linear-gradient(90deg, rgba(105, 167, 255, 0.08), transparent 45%),
    var(--bg);
  font-family: var(--font-ar);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, black, transparent 68%);
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

img,
svg {
  display: block;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin-inline: auto;
}

.scroll-sentinel {
  position: absolute;
  top: 64px;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--line);
  background: rgba(7, 19, 19, 0.82);
  backdrop-filter: blur(18px);
  transition: box-shadow 180ms ease, background 180ms ease;
}

.site-header.scrolled {
  background: rgba(7, 19, 19, 0.94);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.25);
}

.header-shell {
  min-height: 68px;
  display: grid;
  grid-template-columns: auto minmax(220px, 1fr) auto;
  align-items: center;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: max-content;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(86, 214, 160, 0.34);
  border-radius: 8px;
  background: #0e2924;
  color: var(--mint);
}

.brand-mark svg {
  width: 26px;
  height: 26px;
  fill: none;
}

.brand-mark circle,
.brand-mark path {
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linejoin: round;
}

.brand-copy {
  display: grid;
  line-height: 1.2;
}

.brand-title {
  font-size: 1rem;
  font-weight: 800;
}

.brand-subtitle {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
}

.search-box {
  position: relative;
  width: 100%;
  max-width: 480px;
}

.search-icon {
  position: absolute;
  top: 50%;
  right: 14px;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  color: var(--faint);
  pointer-events: none;
}

#searchInput {
  width: 100%;
  height: 44px;
  padding: 0 44px 0 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: rgba(16, 35, 35, 0.85);
  outline: none;
  font-size: 0.95rem;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

#searchInput::placeholder {
  color: var(--faint);
}

#searchInput:focus {
  border-color: rgba(86, 214, 160, 0.58);
  box-shadow: 0 0 0 4px rgba(86, 214, 160, 0.12);
  background: var(--surface);
}

.icon-button,
.refresh-button,
.filter-btn,
.league-header,
.empty-action,
.bell-button {
  -webkit-tap-highlight-color: transparent;
}

.search-clear-btn {
  position: absolute;
  top: 50%;
  left: 8px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  transform: translateY(-50%);
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
}

.search-clear-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.search-clear-btn svg {
  width: 18px;
  height: 18px;
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.last-update-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
  font-size: 0.82rem;
  white-space: nowrap;
}

.update-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--faint);
}

.update-dot.fresh {
  background: var(--mint);
  box-shadow: 0 0 0 4px rgba(86, 214, 160, 0.12);
}

.update-dot.error {
  background: var(--red);
  box-shadow: 0 0 0 4px rgba(240, 82, 82, 0.12);
}

.refresh-button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  border: 1px solid rgba(86, 214, 160, 0.28);
  border-radius: 8px;
  color: #071313;
  background: var(--mint);
  font-weight: 800;
}

.refresh-button:hover {
  filter: brightness(1.05);
}

.refresh-button:focus-visible,
.filter-btn:focus-visible,
.date-tab:focus-visible,
.league-header:focus-visible,
.empty-action:focus-visible,
.bell-button:focus-visible {
  outline: 3px solid rgba(86, 214, 160, 0.35);
  outline-offset: 2px;
}

.refresh-button svg {
  width: 18px;
  height: 18px;
}

.refresh-button.loading svg {
  animation: spin 700ms linear infinite;
}

.main-content {
  position: relative;
  z-index: 1;
  padding: 26px 0 44px;
}

.control-panel {
  display: grid;
  gap: 12px;
}

.week-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(16, 35, 35, 0.78);
  box-shadow: var(--shadow);
}

.panel-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--mint);
  font-size: 0.82rem;
  font-weight: 800;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(1.45rem, 2vw, 2rem);
  line-height: 1.25;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(80px, 1fr));
  gap: 8px;
}

.summary-item {
  min-width: 88px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.summary-item span {
  display: block;
  color: var(--text);
  font-family: var(--font-num);
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1;
}

.summary-item small {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.live-summary span {
  color: var(--red);
}

.date-nav-scroll {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.date-tab {
  position: relative;
  min-height: 112px;
  display: grid;
  align-content: space-between;
  justify-items: start;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(7, 19, 19, 0.36);
  text-align: right;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.date-tab:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.045);
}

.date-tab[aria-selected="true"] {
  color: var(--text);
  border-color: rgba(86, 214, 160, 0.65);
  background: #14322d;
}

.date-tab-day {
  font-size: 0.88rem;
  font-weight: 800;
}

.date-tab-num {
  color: var(--text);
  font-family: var(--font-num);
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
}

.date-tab-meta {
  min-height: 24px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  color: var(--faint);
  font-size: 0.78rem;
  font-weight: 700;
}

.date-tab-meta b {
  padding: 1px 7px;
  border-radius: 999px;
  color: #071313;
  background: var(--amber);
  font-size: 0.72rem;
}

.date-tab-count {
  position: absolute;
  top: 10px;
  left: 10px;
  min-width: 26px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(7, 19, 19, 0.58);
  font-family: var(--font-num);
  font-size: 0.78rem;
  font-weight: 800;
}

.date-tab[aria-selected="true"] .date-tab-count {
  color: #071313;
  border-color: var(--mint);
  background: var(--mint);
}

.filters-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}

.filters-scroll::-webkit-scrollbar {
  display: none;
}

.filter-btn {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(16, 35, 35, 0.76);
  font-weight: 800;
  white-space: nowrap;
}

.filter-btn:hover,
.filter-btn.active {
  color: var(--text);
  border-color: rgba(86, 214, 160, 0.48);
  background: var(--surface-2);
}

.filter-badge {
  min-width: 24px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  padding: 0 7px;
  border-radius: 999px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
  font-family: var(--font-num);
  font-size: 0.75rem;
}

.live-spotlight {
  margin-top: 24px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 10px;
}

.section-title h2 {
  font-size: 1rem;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--red);
  box-shadow: 0 0 0 0 rgba(240, 82, 82, 0.4);
  animation: live-ring 1500ms ease-out infinite;
}

.spotlight-list {
  display: grid;
  gap: 10px;
}

.schedule-area {
  display: grid;
  gap: 14px;
  margin-top: 20px;
}

.league-block {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(16, 35, 35, 0.82);
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.18);
}

.league-header {
  width: 100%;
  min-height: 56px;
  display: grid;
  grid-template-columns: 34px 1fr auto 18px;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.035);
  text-align: right;
}

.league-header:hover {
  background: rgba(255, 255, 255, 0.055);
}

.league-logo-wrap {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(7, 19, 19, 0.4);
}

.league-logo {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.league-fallback {
  color: var(--mint);
  font-weight: 800;
}

.league-name {
  overflow: hidden;
  color: var(--text);
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.league-count {
  min-width: 28px;
  height: 26px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  color: #071313;
  background: var(--amber);
  font-family: var(--font-num);
  font-weight: 800;
}

.collapse-icon {
  width: 18px;
  height: 18px;
  color: var(--muted);
  transition: transform 180ms ease;
}

.league-block.collapsed .collapse-icon {
  transform: rotate(-90deg);
}

.league-block.collapsed .matches-list {
  display: none;
}

.matches-list {
  display: grid;
}

.match-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(128px, 166px) minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  min-height: 76px;
  padding: 14px 56px 14px 14px;
  border-top: 1px solid var(--line);
  background: rgba(7, 19, 19, 0.18);
}

.match-row:first-child {
  border-top: 0;
}

.match-row:hover {
  background: rgba(255, 255, 255, 0.035);
}

.match-row--spotlight {
  border: 1px solid rgba(240, 82, 82, 0.28);
  border-radius: 8px;
  background: rgba(240, 82, 82, 0.08);
}

.match-row--live {
  box-shadow: inset -4px 0 0 var(--red);
}

.match-row--giants:not(.match-row--live) {
  box-shadow: inset -4px 0 0 var(--amber);
}

.team {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.team--away {
  flex-direction: row-reverse;
  text-align: left;
}

.team-crest {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  object-fit: contain;
  filter: drop-shadow(0 4px 9px rgba(0, 0, 0, 0.28));
}

.team-name {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 1rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.match-center {
  min-width: 0;
  display: grid;
  justify-items: center;
  gap: 5px;
  text-align: center;
}

.match-time {
  color: var(--amber);
  font-size: 1.08rem;
  font-weight: 800;
  line-height: 1.1;
  white-space: nowrap;
}

.match-countdown {
  color: var(--muted);
  font-family: var(--font-num);
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.status-pill {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.75rem;
  font-weight: 800;
}

.status-pill--live {
  color: #ffe7e7;
  border-color: rgba(240, 82, 82, 0.34);
  background: rgba(240, 82, 82, 0.14);
}

.match-score {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text);
  font-family: var(--font-num);
  font-size: 1.58rem;
  font-weight: 800;
  line-height: 1;
}

.score-separator {
  color: var(--faint);
}

.finished-score {
  color: var(--muted);
}

.match-badge {
  padding: 1px 8px;
  border-radius: 999px;
  color: #071313;
  background: var(--amber);
  font-size: 0.72rem;
  font-weight: 800;
}

.bell-button {
  position: absolute;
  top: 50%;
  right: 14px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  transform: translateY(-50%);
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
}

.bell-button:hover,
.bell-button.active {
  color: var(--amber);
  border-color: rgba(243, 189, 71, 0.32);
  background: rgba(243, 189, 71, 0.1);
}

.bell-button svg {
  width: 20px;
  height: 20px;
}

.skeleton-screen {
  display: grid;
  gap: 14px;
}

.skel-league-block {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(16, 35, 35, 0.82);
}

.skel-header,
.skel-match {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.04));
  background-size: 220% 100%;
  animation: shimmer 1400ms ease-in-out infinite;
}

.skel-header {
  height: 56px;
}

.skel-match {
  height: 72px;
  border-top: 1px solid var(--line);
}

.empty-state,
.error-state {
  min-height: 280px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  padding: 34px 18px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(16, 35, 35, 0.66);
  text-align: center;
}

.empty-mark {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--faint);
  font-family: var(--font-num);
  font-size: 1.4rem;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.03);
}

.empty-state h2,
.error-state h2 {
  color: var(--text);
  font-size: 1.15rem;
}

.empty-state p,
.error-state p {
  max-width: 420px;
  font-size: 0.94rem;
}

.empty-action {
  min-height: 42px;
  margin-top: 6px;
  padding: 0 16px;
  border: 1px solid rgba(86, 214, 160, 0.36);
  border-radius: 8px;
  color: #071313;
  background: var(--mint);
  font-weight: 800;
}

.site-footer {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--line);
  padding: 18px 0;
  color: var(--faint);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.85rem;
  font-weight: 700;
}

.toast-container {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 40;
  display: grid;
  gap: 8px;
  width: min(320px, calc(100vw - 36px));
  pointer-events: none;
}

.toast {
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: var(--surface-2);
  box-shadow: var(--shadow);
  font-size: 0.9rem;
  font-weight: 800;
  pointer-events: auto;
  animation: toast-in 180ms ease both;
}

.toast--success {
  border-color: rgba(86, 214, 160, 0.38);
}

.toast--error {
  border-color: rgba(240, 82, 82, 0.36);
}

.toast.exit {
  opacity: 0;
  transform: translateY(8px);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes live-ring {
  0% {
    box-shadow: 0 0 0 0 rgba(240, 82, 82, 0.36);
  }
  80% {
    box-shadow: 0 0 0 9px rgba(240, 82, 82, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(240, 82, 82, 0);
  }
}

@keyframes shimmer {
  to {
    background-position: -220% 0;
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 900px) {
  .header-shell {
    grid-template-columns: 1fr auto;
  }

  .search-box {
    grid-column: 1 / -1;
    order: 3;
    max-width: none;
    margin-bottom: 12px;
  }

  .panel-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .date-nav-scroll {
    display: flex;
    overflow-x: auto;
    padding-bottom: 6px;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
  }

  .date-nav-scroll::-webkit-scrollbar {
    display: none;
  }

  .date-tab {
    width: 126px;
    flex: 0 0 126px;
    scroll-snap-align: start;
  }
}

@media (max-width: 640px) {
  .shell {
    width: min(100% - 22px, 1180px);
  }

  .header-shell {
    min-height: 62px;
    gap: 10px;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
  }

  .brand-subtitle,
  .last-update-pill,
  .refresh-button span {
    display: none;
  }

  .refresh-button {
    width: 42px;
    padding: 0;
    justify-content: center;
  }

  .main-content {
    padding-top: 16px;
  }

  .week-card {
    padding: 14px;
  }

  .summary-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .date-tab {
    width: 112px;
    flex-basis: 112px;
    min-height: 104px;
  }

  .date-tab-num {
    font-size: 1.75rem;
  }

  .match-row {
    grid-template-columns: 1fr auto 1fr;
    gap: 8px;
    min-height: 72px;
    padding: 12px 44px 12px 10px;
  }

  .team {
    gap: 7px;
  }

  .team-crest {
    width: 30px;
    height: 30px;
  }

  .team-name {
    font-size: 0.86rem;
  }

  .match-center {
    min-width: 86px;
  }

  .match-time {
    font-size: 0.95rem;
  }

  .match-score {
    font-size: 1.22rem;
  }

  .match-countdown,
  .status-pill,
  .match-badge {
    font-size: 0.7rem;
  }

  .bell-button {
    right: 8px;
    width: 30px;
    height: 30px;
  }
}

@media (max-width: 430px) {
  .team {
    display: grid;
    justify-items: center;
    text-align: center;
  }

  .team--away {
    display: grid;
    text-align: center;
  }

  .team-name {
    max-width: 86px;
  }
}
