html:has(.fatwa-body),
.fatwa-body {
  margin: 0;
  background:
    radial-gradient(900px 420px at 0% 0%, rgba(180, 120, 40, 0.18), transparent 55%),
    linear-gradient(180deg, #1a1208 0%, #24180c 100%);
  color: #f8f1e7;
  font-family: "Segoe UI", Tahoma, sans-serif;
}

.fatwa-home-body {
  min-height: 100svh;
}

.fatwa-home {
  max-width: 1100px;
  margin: 0 auto;
  padding: calc(12px + env(safe-area-inset-top, 0px)) 14px calc(24px + env(safe-area-inset-bottom, 0px));
  position: relative;
}

a.fatwa-close,
button.fatwa-close,
button.fatwa-back {
  text-decoration: none;
  box-sizing: border-box;
  position: static;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #f8f1e7;
  font-size: 1.05rem;
  font-weight: 500;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.fatwa-home__hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.15rem 0 1rem;
}

.fatwa-home__hero h1,
.fatwa-play__hero h1 {
  margin: 0;
  min-width: 0;
  font-size: 1.5rem;
  font-weight: 750;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.fatwa-home-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.fatwa-cat-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 0.75rem;
  min-width: 0;
  min-height: 132px;
  padding: 1rem 0.85rem 0.95rem;
  border-radius: 16px;
  border: 1px solid rgba(232, 194, 122, 0.22);
  background: linear-gradient(160deg, rgba(196, 132, 42, 0.28), rgba(20, 12, 6, 0.72));
  color: inherit;
  text-decoration: none;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
  overflow: hidden;
}

.fatwa-cat-card:hover {
  border-color: rgba(232, 194, 122, 0.55);
}

.fatwa-cat-card__icon {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  background: rgba(26, 18, 8, 0.45);
  color: #f3d7a1;
  font-size: 1.45rem;
}

.fatwa-cat-card__icon .fa-droplet {
  color: #e07a86;
}

.fatwa-cat-card__name {
  display: block;
  width: 100%;
  min-width: 0;
  font-size: 1rem;
  font-weight: 750;
  line-height: 1.35;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.fatwa-home-empty,
.fatwa-list-empty {
  text-align: center;
  color: rgba(248, 241, 231, 0.65);
  padding: 1.5rem 0.5rem;
}

@media (min-width: 430px) {
  .fatwa-home-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 900px) {
  .fatwa-home-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
  }
  .fatwa-cat-card { min-height: 132px; }
}

@media (min-width: 1200px) {
  .fatwa-home-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

html:has(.fatwa-play-body),
.fatwa-play-body {
  height: 100svh;
  max-height: 100svh;
  overflow: hidden;
}

.fatwa-play {
  height: 100%;
  max-width: 860px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-sizing: border-box;
}

.fatwa-play__stage {
  position: relative;
  flex: 1 1 50%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: calc(8px + env(safe-area-inset-top, 0px)) 12px 0;
}

.fatwa-play__hero {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.1rem 0 0.55rem;
}

.fatwa-player-card {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: rgba(20, 12, 6, 0.72);
  border: 1px solid rgba(214, 168, 90, 0.22);
  border-radius: 16px;
  overflow: hidden;
}

.fatwa-screen-wrap {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  background: #0c0804;
  overflow: hidden;
}

.fatwa-screen,
.fatwa-screen iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.fatwa-frame__brand {
  position: absolute;
  left: 10px;
  bottom: 10px;
  z-index: 9;
  pointer-events: none;
  padding: 4px 8px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.55);
}

.fatwa-frame__logo { display: block; height: 26px; width: auto; }

.fatwa-overlay {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(12, 8, 4, 0.78);
  color: rgba(248, 241, 231, 0.8);
}

.fatwa-play-overlay {
  border: none;
  font-size: 2rem;
  color: #f8f1e7;
  cursor: pointer;
}

.fatwa-spinner {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 3px solid rgba(255, 255, 255, 0.15);
  border-top-color: #e8c27a;
  animation: fatwa-spin 0.85s linear infinite;
}

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

.fatwa-screen-btn {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 10;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.55);
  color: #f8f1e7;
  cursor: pointer;
}

.fatwa-now {
  flex: 0 0 auto;
  padding: 0.55rem 0.85rem 0.7rem;
  font-weight: 700;
  line-height: 1.3;
}

.fatwa-list-pane {
  flex: 1 1 50%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0.7rem 12px calc(10px + env(safe-area-inset-bottom, 0px));
}

.fatwa-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  -webkit-overflow-scrolling: touch;
}

.fatwa-video {
  width: 100%;
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 0.7rem;
  align-items: center;
  padding: 0.4rem;
  border-radius: 12px;
  border: 1px solid rgba(232, 194, 122, 0.14);
  background: rgba(20, 12, 6, 0.5);
  color: inherit;
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.fatwa-video.is-playing {
  border-color: #e8c27a;
  background: rgba(196, 132, 42, 0.22);
}

.fatwa-video__thumb {
  width: 96px;
  height: 54px;
  object-fit: cover;
  border-radius: 8px;
  background: #0c0804;
  display: block;
}

.fatwa-video__title {
  font-size: 0.92rem;
  font-weight: 650;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.fatwa-player-card:fullscreen,
.fatwa-player-card:-webkit-full-screen {
  width: 100%;
  height: 100%;
  border-radius: 0;
  background: #1a1208;
}

.hidden { display: none !important; }
