:root {
  /* Light (secondary) — imperial navy day */
  --bg: #eef1f6;
  --surface: #ffffff;
  --surface-2: #f3f5f9;
  --line: rgba(18, 28, 48, 0.12);
  --text: #101828;
  --muted: #5b6475;
  --primary: #8b6914;
  --primary-2: #6e5210;
  --accent: #c9a227;
  --live: #c0392b;
  --ready: #1f7a5c;
  --unavailable: #7a8694;
  --folder: #3d5a73;
  --gold: #c9a227;
  --imperial: #1a2744;
  --shadow: 0 14px 36px rgba(12, 20, 40, 0.1);
  --font: "Cairo", system-ui, sans-serif;
  --display: "Noto Kufi Arabic", "Cairo", system-ui, sans-serif;
  --radius-card: 12px;
  --bottom-nav-h: 64px;
}

html[data-theme="dark"] {
  /* Cinematic imperial — default viewing */
  --bg: #070d16;
  --surface: #0f1826;
  --surface-2: #162033;
  --line: rgba(200, 180, 120, 0.12);
  --text: #f0ebe0;
  --muted: #9aa3b5;
  --primary: #d4af37;
  --primary-2: #b8922a;
  --accent: #e8c547;
  --live: #ef4444;
  --ready: #34d399;
  --unavailable: #7b8496;
  --folder: #6a7f9c;
  --gold: #e8c547;
  --imperial: #0a1220;
  --shadow: 0 20px 48px rgba(0, 0, 0, 0.55);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
  font-family: var(--font);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
button { color: inherit; }

.backdrop {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(720px 360px at 90% 0%, rgba(201, 162, 39, 0.1), transparent 55%),
    radial-gradient(560px 300px at 5% 35%, rgba(26, 39, 68, 0.08), transparent 60%),
    linear-gradient(180deg, #f4f2ec 0%, #e8ebf2 100%);
}

html[data-theme="dark"] .backdrop {
  background:
    radial-gradient(800px 400px at 88% -5%, rgba(212, 175, 55, 0.14), transparent 55%),
    radial-gradient(600px 340px at 0% 40%, rgba(40, 70, 120, 0.12), transparent 60%),
    linear-gradient(180deg, #0a1220 0%, #050910 100%);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  width: min(1240px, calc(100% - 32px));
  margin: 14px auto 0;
  padding: 10px 12px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  box-shadow: 0 10px 28px rgba(30, 60, 100, 0.08);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  justify-self: start;
  min-width: 0;
}

.brand-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(145deg, #2a3a5c, #0c1524);
  color: var(--gold);
  font-family: var(--display);
  font-size: 1.2rem;
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.25), inset 0 0 0 1px rgba(212, 175, 55, 0.35);
  flex: 0 0 auto;
}

.brand > span:last-child {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
  min-width: 0;
}

.brand strong,
#header-title {
  font-family: var(--display);
  font-size: 1.02rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.site-header nav { display: flex; gap: 4px; }

.site-header nav a {
  padding: 8px 13px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 0.84rem;
  transition: 0.2s ease;
}

.site-header nav a:hover,
.site-header nav a.active {
  color: var(--text);
  background: var(--surface-2);
}

.header-actions {
  display: flex;
  justify-self: end;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex-wrap: nowrap;
}

.icon-button,
.favorites-button,
.secondary-button,
.primary-button {
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-2);
  cursor: pointer;
  min-height: 40px;
}

.icon-button { width: 40px; }

.favorites-button {
  padding: 7px 13px;
  font-weight: 700;
}

.favorites-button b {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  margin-right: 5px;
  padding: 0 6px;
  border-radius: 7px;
  color: #fff;
  background: var(--primary);
  font-size: 0.7rem;
}

.back-btn { padding: 7px 14px; font-weight: 700; }
.back-btn[hidden] { display: none !important; }

main { position: relative; z-index: 1; }


.hero {
  position: relative;
  width: min(1240px, calc(100% - 32px));
  min-height: clamp(320px, 48vw, 500px);
  margin: 14px auto 0;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  padding: clamp(28px, 5vw, 52px) clamp(22px, 4vw, 48px);
  border-radius: 24px;
  background:
    radial-gradient(920px 460px at 12% 110%, rgba(232, 197, 71, 0.2), transparent 56%),
    radial-gradient(720px 400px at 90% 0%, rgba(70, 110, 190, 0.22), transparent 52%),
    radial-gradient(480px 280px at 48% 40%, rgba(255, 255, 255, 0.04), transparent 70%),
    linear-gradient(155deg, #101a2c 0%, #080e18 42%, #03060c 100%);
  box-shadow: var(--shadow), inset 0 0 0 1px rgba(232, 197, 71, 0.16);
  border: 0;
  animation: heroIn 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes heroIn {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

html[data-theme="dark"] .hero,
.hero.hero-cover,
.hero.hero-cinematic {
  background:
    radial-gradient(920px 460px at 8% 100%, rgba(232, 197, 71, 0.18), transparent 58%),
    radial-gradient(680px 380px at 96% 0%, rgba(70, 110, 190, 0.24), transparent 52%),
    radial-gradient(420px 260px at 55% 45%, rgba(255, 245, 210, 0.05), transparent 72%),
    linear-gradient(150deg, #121c30 0%, #080e18 48%, #02050a 100%);
}

.hero-bg {
  position: absolute;
  inset: -8%;
  background-image: var(--hero-img, none);
  background-size: cover;
  background-position: center 20%;
  opacity: 0;
  transform: scale(1.08);
  transition: opacity 0.7s ease;
  pointer-events: none;
  filter: saturate(1.12) contrast(1.08);
  z-index: 0;
}

.hero.has-poster .hero-bg {
  opacity: 0.82;
  filter: blur(10px) saturate(1.25) contrast(1.08) brightness(0.88);
  transform: scale(1.08);
}

.hero-poster {
  position: absolute;
  inset-inline-start: 4%;
  top: 50%;
  width: min(300px, 38vw);
  height: min(440px, 84%);
  max-height: calc(100% - 36px);
  object-fit: cover;
  object-position: center top;
  border-radius: 16px;
  opacity: 0;
  transform: translateY(-50%) scale(0.96);
  transition: opacity 0.55s ease, transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
  z-index: 4;
  box-shadow:
    0 22px 56px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(232, 197, 71, 0.35);
  background: #0a1018;
}

.hero.has-poster .hero-poster {
  opacity: 1;
  transform: translateY(-50%) scale(1);
}

.hero.has-poster .hero-mark,
.hero.has-poster .hero-ring {
  opacity: 0;
  pointer-events: none;
}

.hero.has-poster .hero-art {
  opacity: 0.35;
  z-index: 1;
}

.hero.has-poster .hero-glow-a {
  inset-inline-start: 0;
  opacity: 0.28;
}

.hero-art {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 1;
}

.hero-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(40px);
  opacity: 0.55;
  animation: glowDrift 9s ease-in-out infinite alternate;
}

.hero-glow-a {
  width: 42%;
  height: 70%;
  inset-inline-start: -8%;
  bottom: -20%;
  background: rgba(212, 175, 55, 0.35);
}

.hero-glow-b {
  width: 36%;
  height: 55%;
  inset-inline-end: -6%;
  top: -18%;
  background: rgba(80, 120, 190, 0.28);
  animation-delay: -3s;
}

@keyframes glowDrift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(2%, -3%, 0) scale(1.08); }
}

.hero-ring {
  position: absolute;
  inset-inline-start: 8%;
  top: 50%;
  width: min(340px, 46vw);
  height: min(340px, 46vw);
  transform: translateY(-50%);
  border-radius: 50%;
  border: 1px solid rgba(232, 197, 71, 0.28);
  box-shadow:
    0 0 0 18px rgba(232, 197, 71, 0.05),
    inset 0 0 60px rgba(232, 197, 71, 0.08);
  animation: ringPulse 6s ease-in-out infinite;
}

.hero-ring::before {
  content: "";
  position: absolute;
  inset: 12%;
  border-radius: 50%;
  border: 1px dashed rgba(232, 197, 71, 0.2);
  animation: ringSpin 28s linear infinite;
}

@keyframes ringPulse {
  0%, 100% { opacity: 0.75; }
  50% { opacity: 1; }
}

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

.hero-mark {
  position: absolute;
  inset-inline-start: 8%;
  top: 50%;
  width: min(340px, 46vw);
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  font-family: var(--display);
  font-size: clamp(5.5rem, 18vw, 9.5rem);
  font-weight: 800;
  line-height: 1;
  color: transparent;
  background: linear-gradient(180deg, #f6e7b0 0%, #e0b83a 40%, #8a6418 100%);
  -webkit-background-clip: text;
  background-clip: text;
  opacity: 0.32;
  letter-spacing: -0.04em;
  user-select: none;
  animation: markFade 1.1s ease 0.15s both;
  filter: drop-shadow(0 12px 40px rgba(232, 197, 71, 0.18));
}

@keyframes markFade {
  from { opacity: 0; transform: translateY(-46%) scale(0.92); }
  to { opacity: 0.32; transform: translateY(-50%) scale(1); }
}

.hero-beams {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(115deg, transparent 40%, rgba(232, 197, 71, 0.07) 50%, transparent 60%),
    repeating-linear-gradient(
      -18deg,
      transparent 0 18px,
      rgba(255, 255, 255, 0.018) 18px 19px
    );
  mix-blend-mode: screen;
  opacity: 0.85;
  animation: beamSweep 10s linear infinite;
}

@keyframes beamSweep {
  from { transform: translateX(0); }
  to { transform: translateX(-3%); }
}

.hero-overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  background:
    linear-gradient(90deg, rgba(3, 6, 12, 0.05) 0%, rgba(3, 6, 12, 0.12) 28%, rgba(3, 6, 12, 0.78) 58%, rgba(3, 6, 12, 0.94) 100%),
    linear-gradient(0deg, rgba(3, 6, 12, 0.55) 0%, transparent 48%);
  pointer-events: none;
}

.hero.has-poster .hero-overlay {
  background:
    linear-gradient(90deg, rgba(3, 6, 12, 0.12) 0%, rgba(3, 6, 12, 0.28) 38%, rgba(3, 6, 12, 0.78) 68%, rgba(3, 6, 12, 0.92) 100%),
    linear-gradient(0deg, rgba(3, 6, 12, 0.45) 0%, transparent 50%);
}

.hero-content {
  position: relative;
  z-index: 5;
  width: min(520px, 100%);
  margin-inline-start: auto;
  text-align: start;
  animation: contentRise 0.75s cubic-bezier(0.22, 1, 0.36, 1) 0.12s both;
}

@keyframes contentRise {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: none; }
}

.hero-brand {
  margin: 0 0 10px;
  color: #e8c547;
  font-family: var(--display);
  font-size: clamp(2rem, 5.5vw, 3.1rem);
  font-weight: 800;
  letter-spacing: 0.01em;
  line-height: 1.15;
  text-shadow: 0 4px 28px rgba(0, 0, 0, 0.55);
}

.hero-brand::after {
  content: "";
  display: block;
  width: 56px;
  height: 3px;
  margin-top: 12px;
  border-radius: 99px;
  background: linear-gradient(90deg, #e8c547, transparent);
}

.hero-film-label {
  margin: 0 0 6px;
  color: #e8c547;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: none;
}

.hero-film-label[hidden] { display: none !important; }

.hero-kicker { display: none !important; }

.hero h1 {
  margin: 0 0 10px;
  color: #f7f1e4;
  font-family: var(--display);
  font-size: clamp(1.05rem, 2.2vw, 1.35rem);
  font-weight: 600;
  line-height: 1.4;
  opacity: 0.95;
}

.hero-content > p:not(.hero-brand) {
  margin: 0 0 22px;
  max-width: 420px;
  color: rgba(235, 228, 210, 0.78);
  font-size: 0.95rem;
  line-height: 1.7;
}

.hero-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hero .primary-button {
  min-width: 148px;
  box-shadow: 0 10px 28px rgba(184, 146, 42, 0.35);
}

.hero .secondary-button {
  color: #f4f0e4;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(232, 197, 71, 0.28);
  backdrop-filter: blur(8px);
}

.hero .secondary-button:hover {
  border-color: rgba(232, 197, 71, 0.55);
  background: rgba(232, 197, 71, 0.1);
}

@media (max-width: 720px) {
  .hero {
    min-height: 320px;
    padding: 28px 18px 30px;
    border-radius: 18px;
    width: calc(100% - 20px);
  }
  .hero-ring,
  .hero-mark {
    inset-inline-start: 50%;
    top: 42%;
    width: min(260px, 70vw);
    height: min(260px, 70vw);
  }
  .hero-ring { transform: translate(-50%, -50%); }
  .hero-mark {
    font-size: 6.5rem;
    opacity: 0.18;
    transform: translate(-50%, -50%);
  }
  .hero-content {
    margin-inline-start: 0;
    width: 100%;
  }
  .hero-brand {
    font-size: clamp(1.75rem, 9vw, 2.25rem);
  }
  .hero.has-poster {
    min-height: 440px;
    padding-top: 210px;
  }
  .hero.has-poster .hero-poster {
    inset-inline-start: auto;
    left: 50%;
    top: 18px;
    width: 124px;
    height: 186px;
    transform: translateX(-50%);
    border-radius: 12px;
  }
  .hero.has-poster .hero-overlay {
    background:
      linear-gradient(180deg, rgba(3, 6, 12, 0.15) 0%, rgba(3, 6, 12, 0.55) 42%, rgba(3, 6, 12, 0.94) 72%),
      linear-gradient(0deg, rgba(3, 6, 12, 0.85) 0%, transparent 40%);
  }
}

.library-strip {
  width: min(1240px, calc(100% - 32px));
  margin: 10px auto 0;
  padding: 8px 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  color: var(--muted);
  font-size: 0.74rem;
}

.library-strip span:first-child {
  color: var(--primary);
  font-weight: 700;
}

.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 11px;
  padding: 11px 18px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s ease, filter 0.2s ease;
}

.primary-button {
  color: #1a1408;
  background: linear-gradient(145deg, #e8c547, #b8922a);
  border: 0;
  box-shadow: 0 8px 22px rgba(184, 146, 42, 0.28);
}

.secondary-button {
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
}

.hero .secondary-button {
  color: #f4f8fb;
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.28);
}

.primary-button:hover,
.secondary-button:hover {
  transform: translateY(-1px);
  filter: brightness(1.03);
}

.discover,
.about {
  width: min(1240px, calc(100% - 32px));
  margin: 36px auto 0;
}

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

.section-heading span,
.about > div > span {
  color: var(--primary);
  font-size: 0.74rem;
  font-weight: 800;
}

.section-heading h2,
.about h2 {
  margin: 2px 0 0;
  font-family: var(--display);
  font-size: clamp(1.5rem, 3vw, 2rem);
}

.section-heading p {
  color: var(--muted);
  font-size: 0.8rem;
}

.search-panel {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 12px;
  margin-bottom: 22px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 6px 18px rgba(12, 40, 70, 0.05);
}

.search-box {
  width: 100%;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-2);
  flex: 1 1 auto;
  min-width: 0;
  position: relative;
}

.search-box span {
  color: var(--muted);
  font-size: 1.3rem;
}

.search-box input {
  width: 100%;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
}

.filters-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 0 0 auto;
  width: 100%;
  max-width: 100%;
}

.filter-all {
  flex: 0 0 auto;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--muted);
  background: var(--surface-2);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.filter-all.active {
  color: #fff;
  border-color: var(--primary);
  background: var(--primary);
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: start;
  overflow: visible;
  max-width: 100%;
  min-width: 0;
  flex: 1 1 auto;
  padding-bottom: 0;
}

.filters::-webkit-scrollbar {
  height: 4px;
}

.filters::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--muted) 40%, transparent);
  border-radius: 4px;
}

.filters button {
  flex: 0 0 auto;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--muted);
  background: var(--surface-2);
  cursor: pointer;
  font-size: 0.78rem;
  white-space: nowrap;
  writing-mode: horizontal-tb;
  width: auto;
  height: auto;
  min-width: max-content;
  max-width: 100%;
  line-height: 1.3;
}

.filters button.active {
  color: #fff;
  border-color: var(--primary);
  background: var(--primary);
}

.media-card.is-blocked {
  opacity: 0.88;
}

.media-card.is-blocked .status-badge.is-unavailable {
  background: color-mix(in srgb, var(--unavailable) 18%, transparent);
  color: var(--unavailable);
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 18px 16px;
  align-items: start;
}

.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 18px 16px;
}
.cat-tile,
.cat-grid .media-card {
  min-width: 0;
  width: 100%;
}
.cat-tile .card-info h3 {
  writing-mode: horizontal-tb;
  white-space: normal;
  word-break: normal;
  overflow-wrap: anywhere;
}

.media-grid[hidden],
#category-list[hidden],
#search-results[hidden],
#empty-state[hidden],
#home-view[hidden],
#category-view[hidden],
.home-view[hidden],
.category-view[hidden] {
  display: none !important;
}

.media-card,
.card {
  min-width: 0;
  width: 100%;
  cursor: pointer;
  animation: reveal 0.4s ease both;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  text-align: right;
  transition: transform 0.2s ease;
}

.media-card:hover,
.card:hover {
  transform: translateY(-3px);
}

.media-card.is-live-cat .poster {
  border: 2px solid color-mix(in srgb, var(--live) 80%, transparent);
  box-shadow: 0 14px 30px rgba(192, 57, 43, 0.2);
}

.media-card.is-live-cat .poster::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
  pointer-events: none;
  z-index: 1;
}

.cat-tile .cat-poster {
  border-color: color-mix(in srgb, var(--cat-accent, var(--primary)) 40%, var(--line));
  background: linear-gradient(155deg, var(--cat-1, #0a2740), var(--cat-2, #145a80));
  box-shadow: 0 12px 26px rgba(8, 30, 50, 0.14);
}

.cat-tile:hover .cat-poster {
  border-color: var(--cat-accent, var(--primary));
  box-shadow: 0 16px 32px rgba(8, 30, 50, 0.18);
}

.cat-tile .cat-poster img {
  object-fit: cover;
  mix-blend-mode: normal;
}

.cat-tile .card-info {
  padding-top: 11px;
}

.cat-tile .card-info h3 {
  font-size: 1.04rem;
  font-weight: 800;
}

.cat-tile .card-info p {
  margin-top: 3px;
  font-size: 0.64rem;
  color: color-mix(in srgb, var(--muted) 90%, var(--cat-accent, var(--muted)));
}

@keyframes reveal {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.poster,
.card-image {
  position: relative;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  border-radius: var(--radius-card);
  border: 1px solid var(--line);
  background: #d9e4ef;
  box-shadow: 0 10px 22px rgba(12, 40, 70, 0.08);
  display: grid;
  place-items: center;
}

.poster img,
.card-image img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.media-card:hover .poster img,
.card:hover .card-image img {
  transform: scale(1.04);
}

.poster::after,
.card-image::after {
  content: "";
  position: absolute;
  inset: 55% 0 0;
  background: linear-gradient(transparent, rgba(8, 36, 58, 0.5));
  pointer-events: none;
}

.card-badges {
  position: absolute;
  z-index: 2;
  inset: 10px 10px auto;
  display: flex;
  justify-content: flex-start;
  gap: 6px;
  pointer-events: none;
}

.card-badges:empty {
  display: none;
}

.card-badges span,
.folder-badge,
.badge-live {
  padding: 4px 8px;
  border-radius: 6px;
  color: #fff;
  background: rgba(11, 79, 122, 0.9);
  font-size: 0.65rem;
  font-weight: 700;
  backdrop-filter: blur(6px);
}

.badge-live {
  background: var(--live);
  animation: live-pulse 2.4s ease infinite;
}

@keyframes live-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.82; }
}

.folder-badge {
  position: absolute;
  z-index: 2;
  top: 10px;
  right: 10px;
}

.play-circle,
.play-badge {
  position: absolute;
  z-index: 3;
  left: 50%;
  top: 48%;
  transform: translate(-50%, -50%) scale(0.8);
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: rgba(11, 79, 122, 0.9);
  opacity: 0;
  transition: 0.22s ease;
  font-size: 0.95rem;
}

.card.is-folder .poster img,
.card.is-folder .card-image img,
.media-card.is-folder .poster img,
.media-card.is-folder .card-image img {
  filter: none;
  object-fit: cover;
}

.media-card:hover .play-circle,
.card:hover .play-badge,
.card:hover .play-circle {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.card-info h3,
.card-copy h3 {
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 1.02rem;
  color: var(--text);
  font-weight: 700;
  line-height: 1.35;
}

.card-info p,
.card-copy p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 500;
}

.status-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 0.65rem;
  font-weight: 700;
}

.status-badge.is-ready {
  color: var(--ready);
  background: color-mix(in srgb, var(--ready) 14%, transparent);
}

.status-badge.is-unavailable {
  color: var(--unavailable);
  background: color-mix(in srgb, var(--unavailable) 14%, transparent);
}

.status-badge.is-folder {
  color: var(--folder);
  background: color-mix(in srgb, var(--folder) 14%, transparent);
}

.status-badge.is-protected {
  color: var(--gold);
  background: color-mix(in srgb, var(--gold) 14%, transparent);
}

.card.no-image .card-image::before,
.media-card.no-image .poster::before {
  content: "بدون غلاف";
  color: var(--muted);
  font-size: 12px;
  z-index: 1;
}

.card.no-image .card-image img,
.media-card.no-image .poster img { display: none; }

.card.no-image .card-image::after,
.media-card.no-image .poster::after { display: none; }

.cover-fallback {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(160deg, rgba(29, 127, 232, 0.12), rgba(20, 50, 90, 0.08)),
    var(--surface-2, #eef3f8);
}

.load-more {
  display: block;
  width: fit-content;
  margin: 28px auto 0;
}

.load-more[hidden] { display: none !important; }

.empty-state {
  padding: 70px 20px;
  border: 1px dashed var(--line);
  border-radius: 18px;
  text-align: center;
  color: var(--muted);
  background: var(--surface);
}

.empty-state span {
  color: var(--primary);
  font-size: 2rem;
}

.empty-state h3 {
  margin: 8px 0 0;
  color: var(--text);
}

.empty-state p { margin: 2px 0; }

.about {
  margin-bottom: 48px;
  padding: 22px 26px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 8px 20px rgba(12, 40, 70, 0.05);
}

.about-compact {
  display: grid;
  gap: 6px;
}

.about-compact > p {
  max-width: 720px;
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.about > div > span {
  color: var(--primary);
  font-size: 0.74rem;
  font-weight: 800;
}

.about h2 {
  margin: 2px 0 0;
  font-family: var(--display);
  font-size: clamp(1.2rem, 2.4vw, 1.55rem);
}

footer {
  position: relative;
  z-index: 1;
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto 28px;
  padding: 20px 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.78rem;
}

footer > strong {
  color: var(--text);
  font-family: var(--display);
  font-size: 0.92rem;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
}

.footer-nav a {
  color: var(--muted);
  font-weight: 600;
  transition: color 0.15s ease;
}

.footer-nav a:hover {
  color: var(--primary);
}

.player-dialog {
  width: min(940px, calc(100% - 24px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: #0b1624;
  color: var(--text);
  overflow: hidden;
}

.player-dialog::backdrop {
  background: rgba(30, 55, 90, 0.45);
  backdrop-filter: blur(8px);
}

.player-shell-wrap {
  display: grid;
  grid-template-rows: auto minmax(0, auto) auto auto;
  background: #0b1624;
}

.player-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  background: #1d2b40;
  color: #fff;
  min-width: 0;
}

.player-top strong {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  order: 1;
}

#player-close {
  flex: 0 0 auto;
  order: 3;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 50%;
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  font-size: 1.5rem;
  cursor: pointer;
}

.player-stage {
  position: relative;
  width: min(100%, calc(70vh * 16 / 9));
  margin-inline: auto;
  aspect-ratio: 16 / 9;
  background: #0b1624;
  line-height: 0;
  overflow: hidden;
}

/* True OS fullscreen: html/body is the Fullscreen API target */
html.player-os-fs,
html.player-os-fs body,
body.player-os-fs {
  overflow: hidden !important;
  background: #000 !important;
  height: 100% !important;
}

html.player-os-fs .backdrop,
html.player-os-fs .site-header,
html.player-os-fs main > *:not(#player-dialog),
html.player-os-fs footer,
body.player-os-fs .backdrop,
body.player-os-fs .site-header,
body.player-os-fs footer {
  display: none !important;
}

html.player-os-fs .player-dialog,
html.player-os-fs .player-dialog.is-fs,
body.player-os-fs .player-dialog,
body.player-os-fs .player-dialog.is-fs,
.player-dialog:fullscreen,
.player-dialog:-webkit-full-screen,
.player-dialog.is-fs {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  width: 100dvw !important;
  height: 100vh !important;
  height: var(--fs-vh, 100dvh) !important;
  max-width: none !important;
  max-height: none !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  overflow: hidden !important;
  background: #000 !important;
  z-index: 2147483000 !important;
}

.player-dialog:fullscreen::backdrop,
.player-dialog:-webkit-full-screen::backdrop,
.player-dialog.is-fs::backdrop {
  background: #000;
}

html.player-os-fs .player-dialog.is-fs .player-shell-wrap,
body.player-os-fs .player-dialog.is-fs .player-shell-wrap,
.player-dialog.is-fs .player-shell-wrap {
  height: 100% !important;
  min-height: 100% !important;
  grid-template-rows: minmax(0, 1fr) !important;
}

html.player-os-fs .player-dialog.is-fs .player-stage,
body.player-os-fs .player-dialog.is-fs .player-stage,
.player-dialog.is-fs .player-stage {
  position: fixed !important;
  inset: 0 !important;
  width: 100% !important;
  height: var(--fs-vh, 100dvh) !important;
  max-width: none !important;
  aspect-ratio: auto !important;
  z-index: 2 !important;
}

/* Hide chrome in CSS fullscreen so stage + logo dominate */
html.player-os-fs .player-top,
html.player-os-fs .player-status,
html.player-os-fs .player-actions,
body.player-os-fs .player-top,
body.player-os-fs .player-status,
body.player-os-fs .player-actions,
.player-dialog.is-fs .player-top,
.player-dialog.is-fs .player-status,
.player-dialog.is-fs .player-actions {
  display: none !important;
}

.player-dialog.is-fs .player-brand-logo.is-on,
html.player-os-fs .player-brand-logo.is-on,
body.player-os-fs .player-brand-logo.is-on {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  z-index: 2147483647 !important;
  pointer-events: none !important;
}

.player-dialog:fullscreen .player-stage,
.player-dialog:-webkit-full-screen .player-stage,
.player-dialog.is-fs .player-stage,
.player-stage:fullscreen,
.player-stage:-webkit-full-screen,
.player-stage.is-fs {
  position: fixed !important;
  inset: 0 !important;
  width: 100% !important;
  height: var(--fs-vh, 100dvh) !important;
  max-width: none !important;
  max-height: none !important;
  margin: 0 !important;
  aspect-ratio: auto !important;
  background: #000 !important;
  z-index: 2147483645 !important;
  display: block !important;
  overflow: hidden;
}

/* When only stage has is-fs (legacy path), pin it to the viewport */
.player-stage.is-fs:not(.player-dialog .player-stage.is-fs),
body.player-fs-lock .player-dialog:not(.is-fs) .player-stage.is-fs {
  position: fixed !important;
  inset: 0 !important;
  z-index: 2147483645;
}

#player-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-height: none;
  display: block;
  background: #0b1624;
  border: 0;
  object-fit: contain;
}

.player-dialog:fullscreen #player-video,
.player-dialog:-webkit-full-screen #player-video,
.player-dialog.is-fs #player-video,
.player-stage:fullscreen #player-video,
.player-stage:-webkit-full-screen #player-video,
.player-stage.is-fs #player-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.player-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-height: none;
  display: block;
  background: #0b1624;
  border: 0;
}

.player-stage:fullscreen .player-frame,
.player-stage:-webkit-full-screen .player-frame,
.player-stage.is-fs .player-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}


.player-fs-btn {
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 50%;
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  font-size: 1.05rem;
  cursor: pointer;
  line-height: 1;
}

.player-fs-btn:hover {
  background: rgba(255, 255, 255, 0.22);
}

body.player-fs-lock {
  overflow: hidden;
}

/* Prevent hidden iframe from still taking layout space */
#player-video[hidden],
.player-frame[hidden] {
  display: none !important;
}

.player-status {
  margin: 0;
  padding: 8px 14px;
  min-height: 0;
  font-size: 0.9rem;
  color: #c7d7eb;
  background: #0b1624;
  border: 0;
}

.player-status:empty {
  display: none;
  padding: 0;
}

/* Covers upstream upstream badge (top-right). Size/position set in app.js. */
.player-brand-logo {
  position: absolute;
  top: 0;
  right: 0;
  height: 22px;
  width: auto;
  max-width: none;
  pointer-events: none;
  z-index: 2147483646;
  object-fit: fill;
  display: none;
}

.player-brand-logo.is-on {
  display: block !important;
}

/* Emperor logo on upstream badge while stage is fullscreen */
.player-stage:fullscreen .player-brand-logo.is-on,
.player-stage:-webkit-full-screen .player-brand-logo.is-on,
.player-stage.is-fs .player-brand-logo.is-on,
.player-stage:fullscreen .player-brand-logo.is-on[hidden],
.player-stage:-webkit-full-screen .player-brand-logo.is-on[hidden],
.player-stage.is-fs .player-brand-logo.is-on[hidden] {
  display: block !important;
  position: absolute !important;
  z-index: 2147483647 !important;
  pointer-events: none !important;
  visibility: visible !important;
  opacity: 1 !important;
}

.player-stage:fullscreen #player-video,
.player-stage:-webkit-full-screen #player-video,
.player-stage.is-fs #player-video {
  z-index: 1;
}

.player-stage:fullscreen .player-brand-logo,
.player-stage:-webkit-full-screen .player-brand-logo,
.player-stage.is-fs .player-brand-logo {
  z-index: 2147483647 !important;
}

html.player-os-fs .player-top,
html.player-os-fs .player-status,
html.player-os-fs .player-actions,
body.player-os-fs .player-top,
body.player-os-fs .player-status,
body.player-os-fs .player-actions {
  display: none !important;
}

html.player-os-fs .player-shell-wrap,
body.player-os-fs .player-shell-wrap {
  height: 100%;
  min-height: 100%;
  grid-template-rows: minmax(0, 1fr);
}

/* Bottom-right custom FS control removed — use native video control only. */


html.player-os-fs .player-brand-logo.is-on,
body.player-os-fs .player-brand-logo.is-on,
.player-dialog.is-fs .player-brand-logo.is-on {
  display: block !important;
  position: absolute !important;
  z-index: 2147483647 !important;
  pointer-events: none;
  visibility: visible !important;
  opacity: 1 !important;
}

.player-top-actions {
  display: flex;
  align-items: center;
  flex: 0 1 auto;
  flex-wrap: nowrap;
  gap: 8px;
  max-width: min(760px, 72vw);
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  min-width: 0;
  order: 2;
}

.player-top-actions::-webkit-scrollbar {
  display: none;
}

.player-extras {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  flex-wrap: nowrap;
}

#player-download,
.player-dl-btn#player-download {
  order: -1;
  flex: 0 0 auto;
}

.dl-quality-dialog {
  z-index: 2147483000 !important;
}
.dl-quality-dialog::backdrop {
  z-index: 2147482999 !important;
}

.player-quality {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  white-space: nowrap;
  font-size: 0.8rem;
  color: #d7e6f8;
}

.player-quality span {
  opacity: 0.85;
}

.player-quality select {
  height: 38px;
  max-width: 210px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: #143052;
  color: #fff;
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
}

#player-rate {
  width: 88px;
}

.player-autonext {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
  min-height: 38px;
  color: #d7e6f8;
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}

.player-autonext input {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

.player-dl-btn {
  min-width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  border: 0;
  border-radius: 999px;
  padding: 0 0.8rem;
  background: var(--primary);
  color: #fff;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
}

.player-dl-btn[hidden] {
  display: none !important;
}

@media (max-width: 900px) {
  .player-dialog {
    width: min(100%, calc(100dvw - 12px));
    max-width: calc(100dvw - 12px);
    margin: auto;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .player-top {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "title close"
      "actions actions";
    align-items: center;
    gap: 8px 10px;
    padding: 10px 10px 8px;
  }

  .player-top strong {
    grid-area: title;
  }

  #player-close {
    grid-area: close;
  }

  .player-top-actions {
    grid-area: actions;
    width: 100%;
    max-width: 100%;
    justify-content: flex-start;
    gap: 6px;
  }

  .player-quality span,
  .player-autonext span {
    display: none;
  }

  .player-quality select {
    max-width: 145px;
    padding: 0.35rem 0.55rem;
    font-size: 0.78rem;
  }

  .player-dl-btn {
    min-width: 38px;
    padding: 0.4rem 0.55rem;
  }
}

.card-download {
  position: absolute;
  left: 10px;
  bottom: 10px;
  z-index: 3;
  border: 0;
  border-radius: 999px;
  width: 36px;
  height: 36px;
  background: rgba(15, 40, 70, 0.82);
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.card-download:hover {
  background: var(--primary);
}

.poster,
.card-image {
  position: relative;
}

.player-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding: 0 16px 16px;
  background: #0b1624;
}

.player-actions[hidden] {
  display: none !important;
}

.player-actions .primary-button {
  width: auto;
  padding: 0.65rem 1rem;
  font-size: 0.88rem;
}

.player-actions .secondary-button {
  width: auto;
  padding: 0.65rem 1rem;
  font-size: 0.88rem;
}

.player-actions .secondary-button[hidden] {
  display: none !important;
}

body.is-browsing .hero,
body.is-browsing .library-strip,
body.is-browsing #about,
body.is-browsing footer {
  display: none;
}

body.is-browsing .site-header nav {
  display: none;
}

@media (max-width: 1100px) {
  .media-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 1050px) {
  .site-header { grid-template-columns: 1fr auto; }
  .site-header nav { display: none; }
}

@media (max-width: 860px) {
  .media-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .hero:not(.has-poster) {
    min-height: 300px;
    padding: 26px 18px 28px;
  }

  .hero-brand { font-size: clamp(1.7rem, 8vw, 2.2rem); }
  .hero h1 { font-size: 1.05rem; }

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

  .search-box { width: 100%; }

  .filters-wrap { width: 100%; }

  .media-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 12px;
  }

  .section-heading { align-items: start; }
  footer { flex-direction: column; align-items: flex-start; gap: 10px; }
}

@media (max-width: 430px) {
  .site-header {
    width: calc(100% - 18px);
    margin-top: 8px;
  }

  .brand small,
  .favorites-button { display: none; }

  .hero,
  .library-strip,
  .discover,
  .about,
  footer {
    width: calc(100% - 18px);
  }

  .hero {
    margin-top: 9px;
    border-radius: 18px;
    padding: 22px 16px;
  }

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

/* Library / recent / suggest / maintenance */
.search-suggest {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  left: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: 0 12px 28px rgba(12, 40, 70, 0.12);
}
.search-suggest[hidden] {
  display: none !important;
}
.search-suggest .suggest-item {
  text-align: right;
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
}
.search-suggest .suggest-item:hover {
  background: var(--surface-2);
}
.card-lib-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}
.lib-btn {
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  width: 30px;
  height: 28px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1;
}
.lib-btn.on {
  color: var(--primary, #0b3d66);
  border-color: currentColor;
  background: color-mix(in srgb, var(--primary, #0b3d66) 12%, transparent);
}
.library-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
}
.recent-section,
.library-section {
  margin-top: 8px;
}
.maintenance-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.maintenance-card {
  max-width: 420px;
  text-align: center;
  padding: 36px 28px;
  border-radius: 22px;
  background: var(--surface, #fff);
  border: 1px solid var(--line, #d7e2ec);
  box-shadow: 0 18px 40px rgba(12, 40, 70, 0.1);
}
.maintenance-card h1 {
  margin: 8px 0 12px;
  font-family: "Noto Kufi Arabic", Cairo, sans-serif;
}
.maintenance-card .primary-button {
  display: inline-flex;
  margin-top: 18px;
}

.live-search-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 12px;
}
.chip-live {
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--primary, #0b3d66) 8%, var(--surface));
  color: var(--text);
  padding: 6px 12px;
  border-radius: 999px;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}
.chip-live:hover {
  border-color: var(--primary, #0b3d66);
  color: var(--primary, #0b3d66);
}
.watching-section {
  margin-top: 10px;
}
.badge-new-ep {
  position: absolute;
  top: 8px;
  inset-inline-start: 8px;
  z-index: 2;
  background: #b42318;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}
.media-card .poster {
  position: relative;
}
.player-fail-title {
  width: 100%;
  margin: 0 0 4px;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
}
.player-actions {
  flex-wrap: wrap;
}
.ghost-button {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  padding: 6px 12px;
  border-radius: 8px;
  font: inherit;
  cursor: pointer;
}
.ghost-button:hover {
  color: var(--primary, #0b3d66);
  border-color: currentColor;
}
.library-section .section-heading {
  align-items: center;
  gap: 12px;
}

/* ===== Redesign v63: rails, live strip, bottom nav, cinematic cards ===== */
body {
  padding-bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px) + 12px);
}

.header-nav {
  display: flex;
  gap: 4px;
}

.desktop-only { display: flex; }

.live-strip {
  width: min(1240px, calc(100% - 32px));
  margin: 14px auto 0;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--live) 28%, var(--line));
  background: color-mix(in srgb, var(--live) 8%, var(--surface));
  overflow: hidden;
}

.live-strip[hidden] { display: none !important; }

.live-strip-label {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--live);
  white-space: nowrap;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--live);
  box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.55);
  animation: livePulse 1.6s ease infinite;
}

@keyframes livePulse {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.5); }
  70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.live-strip-track {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  min-width: 0;
  flex: 1;
}

.live-strip-track::-webkit-scrollbar { display: none; }

.live-chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.live-chip:hover {
  border-color: var(--live);
  transform: translateY(-1px);
}

.live-chip .mini-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--live);
}

.skeleton-card {
  pointer-events: none;
  opacity: 0.55;
}
.skeleton-card .poster,
.skeleton-card .card-info h3,
.skeleton-card .card-info p {
  background: linear-gradient(90deg, rgba(120,130,150,0.12), rgba(120,130,150,0.22), rgba(120,130,150,0.12));
  background-size: 200% 100%;
  animation: skeletonShine 1.1s ease-in-out infinite;
  border-radius: 8px;
  color: transparent;
}
.skeleton-card .poster {
  aspect-ratio: 2 / 3;
  min-height: 120px;
}
.rail-loading {
  display: flex;
  gap: 12px;
  padding: 6px 0 12px;
}
.rail-loading span {
  flex: 0 0 120px;
  height: 170px;
  border-radius: 12px;
  background: linear-gradient(90deg, rgba(120,130,150,0.12), rgba(120,130,150,0.22), rgba(120,130,150,0.12));
  background-size: 200% 100%;
  animation: skeletonShine 1.1s ease-in-out infinite;
}
@keyframes skeletonShine {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

.month-films-section .section-heading {
  gap: 12px;
}

.month-films-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.month-films-tabs .filter-all {
  min-height: 34px;
  padding: 0 14px;
  font-size: 0.86rem;
}

.month-films-section .media-rail .media-card .poster,
.month-films-section .media-rail .card .poster {
  aspect-ratio: 2 / 3;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
}

.month-films-section .media-rail .media-card .poster img,
.month-films-section .media-rail .card .poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}

.month-films-section #month-films-empty {
  margin: 0 0 8px;
  color: var(--muted, #9aa6b8);
}

.media-rail {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding: 4px 2px 14px;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.media-rail::-webkit-scrollbar { height: 5px; }
.media-rail::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--gold) 35%, transparent);
  border-radius: 4px;
}

.media-rail .media-card,
.media-rail .card {
  flex: 0 0 auto;
  width: min(148px, 38vw);
  scroll-snap-align: start;
}

.media-rail .media-card.is-live-wide,
.media-rail .card.is-live-wide {
  width: min(260px, 72vw);
}

.media-rail .media-card.is-live-wide .poster {
  aspect-ratio: 16 / 9;
}

.media-card .poster::after,
.card .poster::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 42%;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.72));
  pointer-events: none;
  opacity: 0.85;
  border-radius: 0 0 var(--radius-card) var(--radius-card);
}

.media-card .card-info h3,
.card .card-copy h3 {
  font-size: 0.88rem;
  line-height: 1.35;
  margin: 0;
}

.media-card .status-badge,
.card .status-badge {
  opacity: 0;
  transition: opacity 0.2s ease;
}

.media-card:hover .status-badge,
.card:hover .status-badge,
.media-card:focus-within .status-badge,
.card:focus-within .status-badge {
  opacity: 1;
}

.media-card .card-lib-actions,
.card .card-lib-actions {
  opacity: 0.55;
  transition: opacity 0.2s ease;
}

.media-card:hover .card-lib-actions,
.card:hover .card-lib-actions,
.media-card:focus-within .card-lib-actions {
  opacity: 1;
}

.media-card:hover,
.card:hover {
  transform: translateY(-4px) scale(1.02);
  z-index: 2;
}

.media-card .poster img,
.card .poster img {
  transition: transform 0.35s ease;
}

.media-card:hover .poster img,
.card:hover .poster img {
  transform: scale(1.06);
}

.cat-grid .cat-tile.is-live-cat {
  grid-column: span 2;
}

.cat-grid .cat-tile.is-live-cat .poster {
  aspect-ratio: 16 / 9;
}

.category-view {
  animation: catEnter 0.35s ease both;
}

@keyframes catEnter {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.empty-compact {
  margin: 8px 0 0;
  padding: 28px 18px;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 16px;
  background: color-mix(in srgb, var(--surface) 80%, transparent);
}

.empty-compact span {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: 8px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--gold) 16%, transparent);
  color: var(--gold);
  font-size: 1.2rem;
}

.empty-compact h3 {
  margin: 0 0 6px;
  font-family: var(--display);
}

.empty-compact p {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.88rem;
}

.search-panel-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  width: 100%;
}

.search-panel-bar .search-box {
  flex: 1;
  min-width: 0;
  width: auto;
}

.bottom-nav {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 60;
  display: none;
  grid-template-columns: repeat(4, 1fr);
  gap: 2px;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(16px);
  box-shadow: 0 -10px 28px rgba(0, 0, 0, 0.2);
}

.bnav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 4px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  cursor: pointer;
  border-radius: 10px;
}

.bnav-item.active,
.bnav-item:hover {
  color: var(--gold);
  background: color-mix(in srgb, var(--gold) 10%, transparent);
}

.bnav-ico {
  font-size: 1.05rem;
  line-height: 1;
}

.bnav-ico.live-ico {
  color: var(--live);
  font-size: 0.7rem;
}

body.search-mode .search-panel {
  position: fixed;
  inset: 0;
  z-index: 70;
  margin: 0;
  padding: 16px 16px calc(20px + env(safe-area-inset-bottom, 0px));
  background: var(--bg);
  overflow: auto;
  border-radius: 0;
  width: 100%;
  max-width: none;
}

body.search-mode .search-close-btn {
  display: inline-flex !important;
}

body.search-mode .bottom-nav {
  display: none;
}

.favorites-button b {
  background: linear-gradient(145deg, #d4af37, #8b6914);
  color: #1a1408;
}

.player-dialog {
  border: 1px solid color-mix(in srgb, var(--gold) 22%, var(--line));
}

.dl-quality-dialog {
  border: 1px solid color-mix(in srgb, var(--gold) 28%, rgba(255, 255, 255, 0.12));
  border-radius: 22px;
  padding: 0;
  margin: auto;
  width: min(400px, calc(100vw - 28px));
  max-width: calc(100vw - 28px);
  color: #f0ebe0;
  background:
    radial-gradient(420px 180px at 100% 0%, rgba(232, 197, 71, 0.16), transparent 55%),
    linear-gradient(180deg, #152238 0%, #0b1624 100%);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.55);
  overflow: hidden;
  font-family: var(--font);
  color-scheme: dark;
}

.dl-quality-dialog:focus {
  outline: none;
}

.dl-quality-dialog::backdrop {
  background: rgba(5, 10, 18, 0.78);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.dl-quality-sheet {
  display: grid;
  gap: 12px;
  padding: 0 0 14px;
  margin: 0;
  background: transparent;
  color: inherit;
}

.dl-quality-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 14px 10px;
  background: linear-gradient(180deg, #1d2b40 0%, rgba(29, 43, 64, 0.55) 100%);
  border-bottom: 1px solid rgba(232, 197, 71, 0.14);
}

.dl-quality-kicker {
  margin: 0 0 4px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--gold);
  opacity: 0.95;
}

.dl-quality-head h2,
.dl-quality-sheet h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1.35;
  color: #fff;
}

.dl-quality-x {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 50%;
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.dl-quality-x:hover {
  background: rgba(255, 255, 255, 0.18);
}

.dl-quality-hint {
  margin: 0;
  padding: 0 16px;
  font-size: 0.82rem;
  color: #9aa3b5;
  line-height: 1.45;
}

.dl-quality-opts {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 0 14px;
}

.dl-quality-btn {
  display: grid;
  grid-template-columns: 44px 1fr;
  align-items: center;
  gap: 12px;
  text-align: right;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(20, 48, 82, 0.72);
  color: #f0ebe0;
  border-radius: 16px;
  padding: 12px 12px;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
}

.dl-quality-ico {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(232, 197, 71, 0.12);
  border: 1px solid rgba(232, 197, 71, 0.22);
  color: var(--gold);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.02em;
}

.dl-quality-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.dl-quality-btn strong {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.98rem;
  font-weight: 800;
  color: #fff;
}

.dl-quality-btn strong em {
  font-style: normal;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
  color: #1a1408;
  background: linear-gradient(145deg, #e8c547, #c9a227);
}

.dl-quality-btn .dl-quality-copy > span {
  font-size: 0.78rem;
  color: #9aa3b5;
  opacity: 1;
}

.dl-quality-btn:hover,
.dl-quality-btn:focus-visible {
  border-color: color-mix(in srgb, var(--gold) 55%, rgba(255, 255, 255, 0.2));
  background: rgba(30, 64, 104, 0.92);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
  outline: none;
  transform: translateY(-1px);
}

.dl-quality-btn.is-recommend {
  border-color: color-mix(in srgb, var(--gold) 50%, rgba(255, 255, 255, 0.15));
  background:
    linear-gradient(135deg, rgba(232, 197, 71, 0.14), transparent 55%),
    rgba(24, 54, 90, 0.9);
}

.dl-quality-btn.is-recommend .dl-quality-ico {
  background: rgba(232, 197, 71, 0.2);
}

.dl-quality-cancel {
  margin: 2px 14px 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: #b7c9df;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 0.7rem;
  cursor: pointer;
  border-radius: 12px;
}

.dl-quality-cancel:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.player-top {
  border-bottom: 1px solid var(--line);
}

@media (max-width: 900px) {
  .site-header nav.header-nav,
  .header-nav {
    display: none;
  }

  .favorites-button {
    display: none;
  }

  .desktop-only,
  .library-strip.desktop-only {
    display: none !important;
  }

  .bottom-nav {
    display: grid;
  }

  .hero {
    min-height: 280px;
    padding: 28px 20px 32px;
    width: calc(100% - 20px);
    border-radius: 16px;
  }

  .hero-brand {
    font-size: clamp(1.45rem, 7vw, 1.9rem);
  }

  .live-strip,
  .discover,
  .library-strip {
    width: calc(100% - 20px);
  }

  .cat-grid .cat-tile.is-live-cat {
    grid-column: span 1;
  }

  .media-card .status-badge,
  .card .status-badge {
    display: none;
  }

  .media-card .card-lib-actions,
  .card .card-lib-actions {
    opacity: 1;
  }
}

@media (min-width: 901px) {
  body { padding-bottom: 24px; }
  .bottom-nav { display: none !important; }
  #search-open-btn { display: none; }
}
