@font-face {
  font-family: "Amiri";
  src: url("../fonts/Amiri-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Amiri";
  src: url("../fonts/Amiri-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Noto Naskh Arabic";
  src: url("../fonts/NotoNaskhArabic-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Noto Naskh Arabic";
  src: url("../fonts/NotoNaskhArabic-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #f4efe6;
  --bg-deep: #efe6d8;
  --paper: #fffaf3;
  --ink: #1d1412;
  --muted: #6a5a52;
  --line: rgba(80, 48, 36, 0.12);
  --burgundy: #6b1c26;
  --burgundy-dark: #4a1018;
  --gold: #b8893a;
  --gold-soft: #e8d3a4;
  --shadow: 0 18px 40px rgba(50, 24, 18, 0.12);
  --radius: 22px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bot: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Noto Naskh Arabic", "Amiri", "Geeza Pro", "Times New Roman", serif;
  font-size: 17px;
  line-height: 1.8;
  min-height: 100%;
}
body { position: relative; overflow-x: hidden; }

.bg-glow {
  position: fixed;
  inset: -20% auto auto -20%;
  width: 70vw;
  height: 50vh;
  background: radial-gradient(circle at top right, rgba(184, 137, 58, 0.16), transparent 60%);
  pointer-events: none;
  z-index: 0;
}

#app {
  position: relative;
  z-index: 1;
  max-width: 760px;
  margin: 0 auto;
  padding: calc(18px + var(--safe-top)) 18px calc(40px + var(--safe-bot));
}

.boot, .error {
  text-align: center;
  color: var(--muted);
  padding: 4rem 1rem;
}

header.top {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}
header.top .titles { flex: 1; min-width: 0; }
.back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  color: var(--burgundy);
  text-decoration: none;
  font-size: 22px;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(50, 24, 18, 0.06);
}
.back:active { transform: scale(0.97); }

.brand {
  font-family: "Amiri", serif;
  font-size: 2.15rem;
  font-weight: 700;
  color: var(--burgundy);
  margin: 0;
  letter-spacing: 0;
  line-height: 1.2;
}
.tagline {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.7;
}

h1, h2, h3 { font-family: "Amiri", serif; line-height: 1.35; }
h1 { font-size: 1.7rem; margin: 0 0 6px; }
h2 { font-size: 1.28rem; margin: 0 0 12px; color: var(--burgundy-dark); }
h3 { font-size: 1.12rem; margin: 0 0 8px; }

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}
@media (min-width: 640px) {
  .grid.series { grid-template-columns: 1fr; }
}

.card {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--paper);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
a.card:active { transform: scale(0.99); }
.card-hero {
  display: grid;
  grid-template-columns: 118px 1fr;
  min-height: 176px;
}
@media (min-width: 520px) {
  .card-hero { grid-template-columns: 150px 1fr; min-height: 220px; }
}
.poster-wrap {
  position: relative;
  background: #2a1514;
  overflow: hidden;
}
.poster-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.card-body { padding: 16px 16px 18px; display: flex; flex-direction: column; }
.kicker {
  font-size: 0.78rem;
  color: var(--gold);
  font-weight: 700;
  letter-spacing: 0.02em;
  margin: 0 0 4px;
}
.title-it {
  font-family: "Amiri", Georgia, serif;
  font-size: 1.35rem;
  margin: 0;
  color: var(--burgundy-dark);
}
.title-ar { margin: 2px 0 8px; color: var(--ink); font-weight: 700; }
.blurb { margin: 0; color: var(--muted); font-size: 0.95rem; line-height: 1.75; }
.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
  padding-top: 12px;
}
.chip {
  background: var(--bg-deep);
  color: var(--burgundy-dark);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 0.78rem;
  border: 1px solid var(--line);
}

.series-head {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 16px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 22px;
}
.series-head .poster-wrap { min-height: 180px; }
.series-head .info { padding: 16px 16px 18px 8px; }
@media (min-width: 520px) {
  .series-head { grid-template-columns: 160px 1fr; }
}
.intro { margin: 8px 0 0; color: var(--muted); font-size: 0.98rem; }

.season-list, .episode-list { display: grid; gap: 12px; }
.row {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: inherit;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px 16px;
  box-shadow: 0 8px 22px rgba(50, 24, 18, 0.06);
}
.row:active { transform: scale(0.99); }
.badge {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: linear-gradient(160deg, var(--burgundy), var(--burgundy-dark));
  color: #fffaf3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: "Amiri", serif;
  line-height: 1;
}
.badge strong { font-size: 1.15rem; }
.badge span { font-size: 0.62rem; opacity: 0.85; margin-top: 2px; }
.row .grow { flex: 1; min-width: 0; }
.row .it { margin: 0; font-weight: 700; }
.row .ar { margin: 2px 0 0; color: var(--muted); font-size: 0.92rem; }
.chev { color: var(--gold); font-size: 1.3rem; }

.episode-page .ep-titles { margin-bottom: 18px; }
.episode-page .it-title {
  font-family: "Amiri", Georgia, serif;
  font-size: 1.55rem;
  margin: 0;
  color: var(--burgundy-dark);
}
.episode-page .ar-title { margin: 4px 0 0; color: var(--muted); font-size: 1.05rem; }
.ep-num {
  display: inline-block;
  background: var(--burgundy);
  color: #fffaf3;
  border-radius: 999px;
  padding: 2px 12px;
  font-size: 0.8rem;
  margin-bottom: 8px;
}

.block {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 16px 18px 18px;
  margin-bottom: 14px;
  box-shadow: 0 8px 22px rgba(50, 24, 18, 0.05);
}
.summary p { margin: 0 0 12px; }
.summary p:last-child { margin-bottom: 0; }

.people, .words { list-style: none; margin: 0; padding: 0; }
.people li {
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.people li:last-child { border-bottom: 0; }
.people .name { font-weight: 700; }
.people .role { color: var(--muted); font-size: 0.92rem; display: block; }

.words li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.words li:last-child { border-bottom: 0; }
.words .it {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
  direction: ltr;
  text-align: left;
  font-size: 1.02rem;
}
.words .ar { color: var(--ink); }
.words .hint {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: -4px;
}

.missing {
  background: #f8efe3;
  border: 1px dashed var(--gold);
  color: var(--burgundy-dark);
  border-radius: 18px;
  padding: 16px 18px;
  margin-bottom: 14px;
}

.source {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.7;
}
.footnote { margin-top: 22px; color: var(--muted); font-size: 0.82rem; text-align: center; padding: 0 8px; text-wrap: pretty; }

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