:root {
  --color-primary: #1e1b4b;
  --color-on-primary: #ffffff;
  --color-secondary: #4338ca;
  --color-accent: #22c55e;
  --color-accent-soft: rgba(34, 197, 94, 0.16);
  --color-background: #0f0f23;
  --color-foreground: #f8fafc;
  --color-muted: #27273b;
  --color-muted-2: #1a1a32;
  --color-border: #312e81;
  --color-destructive: #ef4444;
  --color-ring: #818cf8;
  --color-text-muted: #a5b4c8;
  --color-pink: #f472b6;
  --color-cyan: #22d3ee;
  --color-amber: #fbbf24;
  --font-display: "Cairo", "IBM Plex Sans Arabic", sans-serif;
  --font-body: "IBM Plex Sans Arabic", "Cairo", sans-serif;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --shadow-card: 0 12px 40px rgba(2, 6, 23, 0.45);
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --header-h: 72px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-foreground);
  background: var(--color-background);
  overflow-x: hidden;
}

img {
  max-width: 100%;
  display: block;
}

button,
input,
select {
  font-family: inherit;
}

button,
a,
select,
input,
.day-chip,
.anime-card {
  cursor: pointer;
}

.skip-link {
  position: absolute;
  inset-inline-start: 12px;
  top: -48px;
  z-index: 1000;
  background: var(--color-accent);
  color: #052e16;
  padding: 8px 14px;
  border-radius: 8px;
  font-weight: 700;
  text-decoration: none;
}

.skip-link:focus {
  top: 12px;
}

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

.bg-glow,
.bg-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.bg-glow {
  background:
    radial-gradient(900px 420px at 90% -10%, rgba(67, 56, 202, 0.45), transparent 60%),
    radial-gradient(700px 380px at 0% 20%, rgba(244, 114, 182, 0.18), transparent 55%),
    radial-gradient(600px 400px at 50% 110%, rgba(34, 197, 94, 0.12), transparent 50%);
}

.bg-grid {
  opacity: 0.18;
  background-image:
    linear-gradient(rgba(248, 250, 252, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(248, 250, 252, 0.06) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, black 0%, transparent 85%);
}

.site-header,
main,
.site-footer {
  position: relative;
  z-index: 1;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(16px);
  background: rgba(15, 15, 35, 0.78);
  border-bottom: 1px solid var(--color-border);
}

.header-inner {
  max-width: 1180px;
  margin: 0 auto;
  min-height: var(--header-h);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: var(--color-cyan);
  background: linear-gradient(160deg, #312e81, #1e1b4b);
  box-shadow: 0 0 0 1px var(--color-border);
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-text strong {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 800;
}

.brand-text small {
  color: var(--color-text-muted);
  font-size: 0.78rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.icon-btn {
  min-width: 48px;
  min-height: 48px;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  background: var(--color-muted-2);
  color: var(--color-amber);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 12px;
  font-weight: 700;
}

.icon-btn:hover,
.icon-btn:focus-visible {
  border-color: var(--color-amber);
}

.header-clock {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  min-width: 120px;
}

.clock-day {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.clock-time {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--color-accent);
}

main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 20px 64px;
}

.hero {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 28px;
  align-items: stretch;
  margin-bottom: 32px;
}

.eyebrow {
  margin: 0 0 8px;
  display: inline-flex;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--color-accent-soft);
  color: #86efac;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.hero h1 {
  margin: 10px 0 12px;
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 3.1rem);
  line-height: 1.2;
  font-weight: 800;
}

.hero h1 em {
  font-style: normal;
  color: var(--color-pink);
}

.lead {
  margin: 0;
  max-width: 52ch;
  color: var(--color-text-muted);
  font-size: 1.05rem;
}

.next-card {
  background: linear-gradient(180deg, rgba(49, 46, 129, 0.35), rgba(30, 27, 75, 0.65));
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-card);
}

.next-label {
  margin: 0 0 12px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--color-cyan);
  text-transform: none;
}

.next-body {
  display: flex;
  gap: 14px;
}

.next-poster-wrap {
  flex: 0 0 90px;
  width: 90px;
  height: 128px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--color-muted);
}

.next-poster-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.next-meta h2 {
  margin: 0 0 6px;
  font-size: 1.05rem;
  line-height: 1.35;
}

.next-when {
  margin: 0 0 12px;
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

.countdown {
  display: flex;
  gap: 8px;
}

.count-unit {
  min-width: 56px;
  padding: 8px 6px;
  border-radius: 12px;
  background: rgba(15, 15, 35, 0.7);
  text-align: center;
}

.count-unit span {
  display: block;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--color-accent);
}

.count-unit small {
  color: var(--color-text-muted);
  font-size: 0.7rem;
}

.toolbar {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.toggle-row {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.toggle-btn,
.text-btn {
  min-height: 44px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-muted-2);
  color: var(--color-foreground);
  padding: 8px 16px;
  font-weight: 700;
  font-size: 0.9rem;
}

.toggle-btn.is-active {
  background: linear-gradient(180deg, #4338ca, #312e81);
  border-color: #6366f1;
}

.text-btn {
  background: transparent;
  color: var(--color-cyan);
}

.search-wrap,
.select-wrap {
  position: relative;
}

.search-wrap {
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  inset-inline-start: 14px;
  color: var(--color-text-muted);
  pointer-events: none;
}

.search-wrap input,
.select-wrap select {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-muted-2);
  color: var(--color-foreground);
  padding: 10px 14px;
  font-size: 1rem;
  outline: none;
  transition: border-color 180ms var(--ease), box-shadow 180ms var(--ease);
}

.search-wrap input {
  padding-inline-start: 42px;
}

.search-wrap input:focus,
.select-wrap select:focus {
  border-color: var(--color-ring);
  box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.35);
}

.select-wrap label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.78rem;
  color: var(--color-text-muted);
  font-weight: 600;
}

.day-nav {
  margin: 8px 0 28px;
}

.day-track {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
  scrollbar-width: thin;
}

.day-chip {
  flex: 1 0 auto;
  min-width: 92px;
  min-height: 64px;
  border: 1px solid var(--color-border);
  border-radius: 16px;
  background: var(--color-muted-2);
  color: var(--color-foreground);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 8px 10px;
  transition: transform 180ms var(--ease), background 180ms var(--ease), border-color 180ms var(--ease);
}

.day-chip small {
  color: var(--color-text-muted);
  font-size: 0.72rem;
}

.day-chip strong {
  font-size: 0.95rem;
}

.day-chip:hover {
  transform: translateY(-2px);
  border-color: var(--color-ring);
}

.day-chip.is-today {
  box-shadow: inset 0 0 0 1px rgba(34, 197, 94, 0.4);
}

.day-chip.is-active {
  background: linear-gradient(180deg, #4338ca, #312e81);
  border-color: #6366f1;
}

.day-chip:focus-visible {
  outline: 3px solid var(--color-ring);
  outline-offset: 2px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 16px;
}

.section-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.4rem;
}

.section-sub {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

.status-bar {
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fecaca;
}

.status-bar.is-info {
  background: rgba(34, 197, 94, 0.1);
  border-color: rgba(34, 197, 94, 0.3);
  color: #bbf7d0;
}

.hour-block {
  margin-bottom: 28px;
}

.hour-label {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 12px;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--color-cyan);
}

.hour-label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(to left, transparent, var(--color-border));
}

.anime-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.anime-card {
  display: grid;
  grid-template-columns: 86px 1fr;
  gap: 12px;
  padding: 10px;
  border-radius: var(--radius-md);
  background: rgba(26, 26, 50, 0.88);
  border: 1px solid var(--color-border);
  text-align: start;
  color: inherit;
  width: 100%;
  transition: transform 180ms var(--ease), border-color 180ms var(--ease), background 180ms var(--ease);
}

.anime-card:hover {
  transform: translateY(-3px);
  border-color: #6366f1;
  background: #22223d;
}

.anime-card:focus-visible {
  outline: 3px solid var(--color-ring);
  outline-offset: 2px;
}

.anime-card img {
  width: 86px;
  height: 122px;
  object-fit: cover;
  border-radius: 10px;
  background: var(--color-muted);
}

.card-body h3 {
  margin: 0 0 6px;
  font-size: 1rem;
  line-height: 1.35;
}

.card-meta {
  margin: 0 0 8px;
  color: var(--color-text-muted);
  font-size: 0.82rem;
}

.time-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--color-accent-soft);
  color: #86efac;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-size: 0.85rem;
}

.time-badge.is-live {
  background: rgba(239, 68, 68, 0.16);
  color: #fca5a5;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.tag {
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.18);
  color: #c7d2fe;
}

.empty-state {
  padding: 48px 20px;
  text-align: center;
  color: var(--color-text-muted);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-lg);
}

.watch-panel {
  margin-bottom: 28px;
  padding: 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: rgba(26, 26, 50, 0.7);
}

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

.watch-item {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 8px;
  border-radius: 12px;
  background: var(--color-muted-2);
  border: 1px solid transparent;
  color: inherit;
  text-align: start;
  width: 100%;
}

.watch-item img {
  width: 56px;
  height: 80px;
  object-fit: cover;
  border-radius: 8px;
}

.week-root {
  display: grid;
  grid-template-columns: repeat(7, minmax(150px, 1fr));
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.week-col {
  min-width: 150px;
  background: rgba(26, 26, 50, 0.75);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  padding: 10px;
}

.week-col.is-today {
  border-color: var(--color-accent);
  box-shadow: inset 0 0 0 1px rgba(34, 197, 94, 0.35);
}

.week-col h3 {
  margin: 0 0 10px;
  font-size: 0.95rem;
}

.week-slot {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  margin-bottom: 8px;
  padding: 8px;
  border: 0;
  border-radius: 10px;
  background: #1e1e38;
  color: inherit;
  text-align: start;
}

.week-slot strong {
  font-size: 0.82rem;
  line-height: 1.35;
}

.week-slot span {
  font-variant-numeric: tabular-nums;
  color: var(--color-accent);
  font-size: 0.78rem;
  font-weight: 700;
}

.star-btn {
  min-width: 44px;
  min-height: 44px;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: var(--color-muted-2);
  color: var(--color-text-muted);
}

.star-btn.is-on {
  color: var(--color-amber);
  border-color: var(--color-amber);
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.skeleton-list {
  display: grid;
  gap: 12px;
}

.skeleton-row {
  height: 132px;
  border-radius: 16px;
  background: linear-gradient(90deg, #1a1a32 25%, #27273b 50%, #1a1a32 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}

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

.site-footer {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px 40px;
  color: var(--color-text-muted);
  font-size: 0.88rem;
}

.muted {
  opacity: 0.8;
}

.modal[hidden] {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.72);
}

.modal-panel {
  position: relative;
  z-index: 1;
  width: min(720px, calc(100% - 24px));
  max-height: min(88dvh, 820px);
  overflow: auto;
  margin: 6vh auto 0;
  background: #16162c;
  border: 1px solid var(--color-border);
  border-radius: 24px;
  padding: 22px;
}

.modal-close {
  position: absolute;
  top: 12px;
  inset-inline-start: 12px;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 12px;
  background: var(--color-muted);
  color: var(--color-foreground);
  display: grid;
  place-items: center;
}

.modal-hero {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 16px;
}

.modal-hero img {
  width: 140px;
  height: 198px;
  object-fit: cover;
  border-radius: 14px;
}

.modal-hero h2 {
  margin: 0 0 8px;
  font-size: 1.35rem;
}

.modal-time {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-accent);
}

.synopsis {
  margin-top: 16px;
  color: var(--color-text-muted);
}

@media (max-width: 1100px) {
  .week-root {
    grid-template-columns: repeat(7, minmax(160px, 1fr));
  }
}

@media (max-width: 900px) {
  .hero,
  .toolbar,
  .modal-hero {
    grid-template-columns: 1fr;
  }

  .header-clock {
    align-items: flex-start;
  }
}

@media (max-width: 640px) {
  .toolbar {
    grid-template-columns: 1fr;
  }

  .anime-grid {
    grid-template-columns: 1fr;
  }

  .day-chip {
    min-width: 78px;
  }

  .watch-item {
    grid-template-columns: 56px 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
