:root {
  --bg: #0a1612;
  --bg-2: #0f1f1a;
  --bg-3: #08110d;
  --surface: #142824;
  --surface-2: #1a342d;
  --surface-focus: #1f3d33;
  --green: #0d4f3c;
  --green-deep: #07382a;
  --gold: #c9a44c;
  --gold-soft: rgba(201, 164, 76, .35);
  --gold-bright: #e6c270;
  --cream: #f5efe1;
  --cream-dim: rgba(245, 239, 225, .68);
  --cream-faint: rgba(245, 239, 225, .42);
  --red: #ef3a44;
  --amber: #e9a23b;
  --radius: 16px;
  --radius-sm: 10px;
  --tile-h: clamp(190px, 28vh, 340px);
  --t-fast: 160ms cubic-bezier(.2, .8, .2, 1);
  --t-med: 260ms cubic-bezier(.2, .8, .2, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

/* Hide scrollbars globally — content is still scrollable, just no track/thumb. */
*, *::before, *::after {
  scrollbar-width: none;        /* Firefox */
  -ms-overflow-style: none;     /* IE / legacy Edge */
}
*::-webkit-scrollbar {           /* Chrome / Safari / new Edge */
  width: 0 !important;
  height: 0 !important;
  display: none;
  background: transparent;
}
*::-webkit-scrollbar-thumb,
*::-webkit-scrollbar-track {
  background: transparent;
  display: none;
}

body {
  background:
    radial-gradient(ellipse 100% 70% at 50% 0%, rgba(13, 79, 60, .18), transparent 60%),
    radial-gradient(ellipse 80% 50% at 50% 100%, rgba(201, 164, 76, .06), transparent 60%),
    var(--bg);
  color: var(--cream);
  font-family: 'Amiri', 'Noto Naskh Arabic', 'Times New Roman', serif;
  overflow: hidden;
  user-select: none;
  -webkit-font-smoothing: antialiased;
}

kbd {
  font-family: 'Inter', system-ui, sans-serif;
  background: rgba(245, 239, 225, .08);
  border: 1px solid rgba(245, 239, 225, .14);
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 0.85em;
  color: var(--cream);
  font-weight: 500;
}

#app { width: 100vw; height: 100vh; position: relative; }

.view {
  position: absolute; inset: 0;
  display: none;
  flex-direction: column;
  opacity: 0;
  transition: opacity var(--t-med);
}
.view.active { display: flex; opacity: 1; }
.hidden { display: none !important; }
#grid-view {
  overflow-y: auto;
  overscroll-behavior-y: contain;
}

.is-focus {
  border-color: var(--gold) !important;
  box-shadow: 0 0 0 3px var(--gold-soft), 0 18px 44px rgba(0, 0, 0, .38);
}

/* ===== Top bar ===== */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: clamp(20px, 3.2vh, 40px) clamp(28px, 4.5vw, 70px) clamp(8px, 1vh, 14px);
  gap: 24px;
}
.brand { display: flex; align-items: baseline; gap: clamp(10px, 1.3vw, 20px); flex-wrap: wrap; }
.brand-ar {
  font-size: clamp(30px, 4.2vw, 60px);
  font-weight: 700;
  color: var(--cream);
  letter-spacing: 0.01em;
  line-height: 1;
}
.brand-divider { color: var(--gold); font-size: clamp(20px, 2.5vw, 32px); }
.brand-en {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: clamp(11px, 1.1vw, 17px);
  color: var(--gold);
  letter-spacing: 0.32em;
  font-weight: 700;
}

.topbar-right { display: flex; align-items: center; gap: clamp(14px, 1.6vw, 24px); }
.data-source {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: clamp(10px, .9vw, 13px);
  letter-spacing: 0.18em;
  font-weight: 600;
  color: var(--cream-dim);
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid rgba(245, 239, 225, .12);
}
.data-source::before {
  content: '';
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--amber);
}
.data-source.live::before { background: #4ade80; box-shadow: 0 0 6px #4ade80; }
.data-source.cache::before, .data-source.snapshot::before { background: var(--amber); }
.data-source.empty::before { background: var(--red); }

.clock-stack { text-align: end; font-family: 'Inter', system-ui, sans-serif; }
.clock {
  font-size: clamp(16px, 1.6vw, 26px);
  color: var(--cream);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  letter-spacing: 0.05em;
}
.hijri {
  font-size: clamp(11px, 1vw, 15px);
  color: var(--cream-dim);
  letter-spacing: 0.18em;
  margin-top: 2px;
}

/* ===== Prayer times strip ===== */
.prayer-strip {
  display: flex;
  align-items: center;
  gap: clamp(20px, 3vw, 48px);
  margin: 0 clamp(28px, 4.5vw, 70px) clamp(14px, 1.8vh, 22px);
  padding: 22px clamp(20px, 2.4vw, 32px);
  min-height: 92px;
  background: rgba(0, 0, 0, .22);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(245, 239, 225, .06);
  border-radius: 14px;
  overflow-x: auto;
  overflow-y: hidden;
  font-family: 'Inter', system-ui, sans-serif;
  animation: psFadeIn 380ms ease both;
}
.prayer-strip[hidden] { display: none; }

.prayer-strip-loc {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--gold);
  flex-shrink: 0;
}
.ps-loc-icon { font-size: 14px; line-height: 1; opacity: .9; }
.ps-loc-text {
  font-size: clamp(11px, .95vw, 13px);
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  line-height: 1.4;
}

.prayer-strip-list {
  display: flex;
  align-items: center;
  gap: clamp(18px, 2.6vw, 36px);
  flex: 1;
  min-width: 0;
}

.ps-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  line-height: 1.3;
  transition: transform var(--t-fast), opacity var(--t-fast);
}
.ps-item-en {
  font-size: 11px;
  line-height: 1.3;
  color: var(--cream-faint);
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.ps-item-row {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  line-height: 1.3;
}
.ps-item-time {
  font-size: clamp(13px, 1.15vw, 15px);
  line-height: 1.3;
  color: var(--cream);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}
.ps-item-ar {
  font-family: 'Amiri', serif;
  font-size: clamp(12px, 1.05vw, 14px);
  line-height: 1.3;
  color: rgba(201, 164, 76, .7);
  direction: rtl;
}
.ps-item.next .ps-item-time { color: var(--gold-bright); }
.ps-item.next .ps-item-ar { color: var(--gold-bright); }
.ps-item.passed { opacity: .42; }

.prayer-strip-label {
  margin-inline-start: auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: rgba(245, 239, 225, .32);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  flex-shrink: 0;
}
.ps-tag-icon { font-size: 12px; }

@keyframes psFadeIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== Channel grid (LTR — visual navigation matches arrow keys) ===== */
.home-preview {
  position: relative;
  margin: 0 clamp(28px, 4.5vw, 70px) clamp(18px, 2vh, 28px);
  min-height: clamp(220px, 28vh, 300px);
  border: 2px solid rgba(245, 239, 225, .08);
  border-radius: calc(var(--radius) + 6px);
  overflow: hidden;
  background: linear-gradient(140deg, #10241e 0%, #08110d 100%);
  cursor: pointer;
  padding: 0;
  text-align: start;
  appearance: none;
}
.home-preview:focus-visible {
  outline: none;
}
.home-preview-media {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 82% 14%, rgba(201, 164, 76, .12), transparent 24%),
    linear-gradient(135deg, rgba(7, 56, 42, .96), rgba(10, 22, 18, .92));
}
.home-preview-media iframe,
.home-preview-media .preview-placeholder {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}
.home-preview-media iframe {
  position: absolute;
  inset: 0;
  pointer-events: none;
  transform: scale(1.22);
  transform-origin: center top;
}
.home-preview-media::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(0,0,0,.78) 0%, rgba(0,0,0,.24) 48%, rgba(0,0,0,.64) 100%),
    linear-gradient(180deg, rgba(0,0,0,.16) 0%, rgba(0,0,0,.4) 100%);
}
.preview-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--cream-dim);
  font-family: 'Inter', system-ui, sans-serif;
  letter-spacing: 0.22em;
  font-size: clamp(12px, 1.2vw, 16px);
}
.home-preview-overlay {
  position: relative;
  z-index: 1;
  min-height: clamp(220px, 28vh, 300px);
  padding: clamp(24px, 3.6vw, 42px);
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 24px;
}
.home-preview-copy {
  max-width: min(64ch, 72%);
}
.home-preview-kicker {
  display: inline-block;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: clamp(11px, .95vw, 14px);
  letter-spacing: 0.32em;
  color: var(--gold);
  font-weight: 700;
  margin-bottom: 10px;
}
.home-preview-ar {
  font-size: clamp(28px, 3.6vw, 58px);
  line-height: 1.12;
  direction: rtl;
}
.home-preview-en {
  margin-top: 8px;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: clamp(12px, 1.1vw, 16px);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--cream-dim);
}
.home-preview-now {
  margin-top: 14px;
  max-width: min(58ch, 100%);
  font-size: clamp(15px, 1.25vw, 18px);
  color: var(--cream);
  direction: rtl;
  line-height: 1.4;
}
.home-preview-meta {
  display: flex;
  flex-direction: column;
  align-items: end;
  gap: 12px;
}
.home-preview-open {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: clamp(10px, .9vw, 13px);
  letter-spacing: 0.24em;
  color: var(--cream-dim);
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(18px, 2.2vw, 36px);
  padding: clamp(16px, 2vh, 32px) clamp(28px, 4.5vw, 70px);
  align-content: start;
}

.tile {
  background: linear-gradient(155deg, var(--surface) 0%, var(--bg-2) 100%);
  border: 2px solid rgba(245, 239, 225, .05);
  border-radius: var(--radius);
  padding: clamp(22px, 2.4vw, 38px);
  height: var(--tile-h);
  display: flex; flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  transition: transform var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
  cursor: pointer;
}
.tile::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(circle at 90% -10%, rgba(13, 79, 60, .5), transparent 55%);
  pointer-events: none;
}
.tile::after {
  content: '';
  position: absolute;
  bottom: -40%; left: -20%;
  width: 80%; height: 80%;
  background: radial-gradient(circle, rgba(201, 164, 76, .08), transparent 60%);
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--t-med);
}
.tile.focused {
  transform: scale(1.045);
  border-color: var(--gold);
  box-shadow: 0 0 0 4px var(--gold-soft), 0 28px 60px rgba(0, 0, 0, .55);
  background: linear-gradient(155deg, var(--surface-focus) 0%, var(--green-deep) 100%);
  z-index: 3;
}
.tile.focused::after { opacity: 1; }
.tile.offline { opacity: .85; }

/* ===== Radio tile distinct styling ===== */
.tile.audio {
  background:
    radial-gradient(ellipse 90% 110% at 0% 100%, rgba(201, 164, 76, .14), transparent 55%),
    linear-gradient(155deg, #1f2a1d 0%, #0e1a16 100%);
  border-color: rgba(201, 164, 76, .14);
}
.tile.audio::before {
  background: radial-gradient(circle at 12% -10%, rgba(201, 164, 76, .25), transparent 50%);
}
.tile.audio.focused {
  background:
    radial-gradient(ellipse 100% 120% at 0% 100%, rgba(201, 164, 76, .26), transparent 60%),
    linear-gradient(155deg, #2a361f 0%, #15281d 100%);
  border-color: var(--gold);
}
.tile.audio .type-badge.radio {
  color: var(--gold-bright);
  background: rgba(201, 164, 76, .14);
  border-color: rgba(201, 164, 76, .4);
}
.tile.audio .name-ar { color: var(--cream); }
.tile.audio .haram-label { color: var(--gold-bright); }

/* ON AIR pill — solid amber instead of red for radio channels */
.live-pill.on-air {
  background: rgba(233, 162, 59, .14);
  border: 1px solid rgba(233, 162, 59, .42);
}
.live-pill.on-air .live-dot {
  background: var(--amber);
  box-shadow: 0 0 8px var(--amber);
}
.live-pill.on-air.offline {
  background: rgba(0, 0, 0, .3);
  border-color: rgba(245, 239, 225, .08);
}
.live-pill.on-air.offline .live-dot {
  background: var(--cream-faint);
  box-shadow: none;
  animation: none;
}

/* Animated soundwave ornament — bottom-right, decorative */
.tile-waves {
  position: absolute;
  right: clamp(20px, 2.2vw, 32px);
  bottom: clamp(20px, 2.2vw, 32px);
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 28px;
  pointer-events: none;
  z-index: 1;
  opacity: 0.55;
}
.tile-waves span {
  width: 3px;
  background: var(--gold);
  border-radius: 2px;
  animation: tileWave 1.2s ease-in-out infinite;
  box-shadow: 0 0 6px rgba(201, 164, 76, .35);
}
.tile-waves span:nth-child(1) { animation-delay: 0s; }
.tile-waves span:nth-child(2) { animation-delay: .15s; }
.tile-waves span:nth-child(3) { animation-delay: .3s; }
.tile-waves span:nth-child(4) { animation-delay: .45s; }
.tile-waves span:nth-child(5) { animation-delay: .6s; }
.tile.offline .tile-waves span { animation: none; opacity: .35; }
.tile.focused .tile-waves { opacity: 0.95; }
.tile.focused .tile-waves span { box-shadow: 0 0 10px rgba(201, 164, 76, .65); }
@keyframes tileWave {
  0%, 100% { height: 4px; }
  50% { height: 28px; }
}
.tile-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  position: relative;
  z-index: 1;
}
.tile .type-badge {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: clamp(10px, .85vw, 12px);
  color: var(--gold);
  letter-spacing: 0.22em;
  font-weight: 600;
  background: rgba(201, 164, 76, .1);
  border: 1px solid rgba(201, 164, 76, .25);
  padding: 5px 10px;
  border-radius: 999px;
}
.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: clamp(10px, .85vw, 12px);
  letter-spacing: 0.22em;
  font-weight: 700;
  color: var(--cream);
  background: rgba(0, 0, 0, .45);
  padding: 5px 10px;
  border-radius: 999px;
}
.live-pill.offline { color: var(--cream-faint); background: rgba(0, 0, 0, .3); }
.live-pill.offline .live-dot { background: var(--cream-faint); box-shadow: none; animation: none; }
.live-dot {
  width: 7px; height: 7px;
  background: var(--red);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--red);
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .4; } }

.tile-body { position: relative; z-index: 1; }
.tile .name-ar {
  font-size: clamp(22px, 2.6vw, 38px);
  line-height: 1.2;
  font-weight: 700;
  color: var(--cream);
  direction: rtl;
}
.tile .name-en {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: clamp(11px, 1vw, 15px);
  color: var(--cream-dim);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-top: 6px;
  font-weight: 500;
}
.tile .now-line {
  font-family: 'Amiri', serif;
  font-size: clamp(13px, 1.1vw, 16px);
  color: var(--cream-dim);
  margin-top: 10px;
  direction: rtl;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tile-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  z-index: 1;
}
.tile .haram-label {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: clamp(10px, .85vw, 13px);
  color: var(--gold);
  letter-spacing: 0.2em;
  font-weight: 600;
}
.tile .haram-ar {
  font-size: clamp(13px, 1.1vw, 17px);
  color: var(--cream-dim);
  direction: rtl;
}

/* ===== Hint footer ===== */
.hint {
  display: flex;
  align-items: center;
  gap: clamp(20px, 2.5vw, 40px);
  padding: 8px clamp(28px, 4.5vw, 70px) clamp(18px, 2.2vh, 30px);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: clamp(11px, 1vw, 15px);
  color: var(--cream-dim);
  letter-spacing: 0.16em;
  font-weight: 500;
}
.hint-spacer { flex: 1; }
.footer-install {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(201, 164, 76, .12);
  border: 1px solid rgba(201, 164, 76, .35);
  color: var(--gold);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: clamp(11px, 1vw, 14px);
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background var(--t-fast), transform var(--t-fast), border-color var(--t-fast);
}
.footer-install:hover, .footer-install:focus-visible {
  background: rgba(201, 164, 76, .22);
  border-color: var(--gold);
  outline: none;
  transform: translateY(-1px);
}
.footer-install[hidden] { display: none; }
.fi-icon { font-size: 13px; }

/* ===== Install banner (first-visit add-to-home-screen prompt) ===== */
.install-banner {
  position: fixed;
  bottom: max(16px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  width: min(calc(100% - 24px), 560px);
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: linear-gradient(140deg, rgba(7, 56, 42, .97), rgba(20, 40, 36, .97));
  border: 1px solid rgba(201, 164, 76, .35);
  border-radius: var(--radius);
  backdrop-filter: blur(20px);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .6);
  animation: ibIn 360ms cubic-bezier(.2, .8, .2, 1) both;
}
.install-banner.hidden { display: none; }
.ib-icon {
  font-size: 32px;
  line-height: 1;
  flex-shrink: 0;
}
.ib-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0;
}
.ib-text strong {
  font-family: 'Amiri', serif;
  font-size: clamp(15px, 1.5vw, 18px);
  font-weight: 700;
  color: var(--cream);
  direction: rtl;
}
.ib-text span {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: clamp(11px, 1vw, 13px);
  color: var(--cream-dim);
  letter-spacing: 0.04em;
  line-height: 1.4;
}
.ib-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}
.ib-btn {
  padding: 8px 14px;
  border-radius: 8px;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  cursor: pointer;
  border: 0;
  white-space: nowrap;
}
.ib-btn.primary {
  background: var(--gold);
  color: #0a1612;
}
.ib-btn.primary:hover { background: var(--gold-bright); }
.ib-btn.ghost {
  background: transparent;
  color: var(--cream-dim);
  border: 1px solid rgba(245, 239, 225, .15);
}
.ib-btn.ghost:hover {
  background: rgba(245, 239, 225, .06);
  color: var(--cream);
}
@keyframes ibIn {
  from { opacity: 0; transform: translate(-50%, 20px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}
@media (max-width: 540px) {
  .install-banner {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 14px 16px;
  }
  .ib-actions { flex-direction: row; }
  .ib-btn { flex: 1; }
}

/* ===== Player view ===== */
#player-view { background: #000; }

.player-stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
}
.player-stage iframe,
.player-stage video,
.player-stage #yt-player {
  width: 100% !important;
  height: 100% !important;
  border: 0;
  display: block;
}
/* YT iframe must not capture pointer events — focus there steals keyboard
   navigation. We provide our own controls (mute button, channel switch). */
.player-stage > iframe { pointer-events: none; }
.player-stage > audio { display: none; }

/* Audio mode: name + bars on stylized background */
.player-stage.audio {
  display: flex;
  align-items: center;
  justify-content: center;
}
.player-stage.audio #yt-player { display: none; }
.audio-bg {
  position: absolute; inset: 0;
  z-index: 0;
}
.audio-bg.kaaba {
  background:
    radial-gradient(ellipse 80% 60% at 50% 50%, rgba(13, 79, 60, .35), transparent 70%),
    linear-gradient(135deg, #07382a 0%, #0a1612 45%, #142824 100%);
}
.audio-bg.nabawi {
  background:
    radial-gradient(ellipse 80% 60% at 50% 50%, rgba(201, 164, 76, .22), transparent 70%),
    linear-gradient(135deg, #2a2418 0%, #0a1612 50%, #1a342d 100%);
}
.audio-stage-inner {
  position: relative;
  z-index: 1;
  text-align: center;
  color: var(--cream);
  padding: 40px;
}
.audio-ornament {
  font-family: 'Amiri', serif;
  font-size: clamp(32px, 4.5vw, 64px);
  color: var(--gold);
  letter-spacing: 0.05em;
  margin-bottom: clamp(24px, 3vh, 48px);
  opacity: .9;
}
.audio-name-ar {
  font-size: clamp(40px, 5.5vw, 92px);
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: clamp(8px, 1vh, 16px);
  direction: rtl;
}
.audio-name-en {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: clamp(14px, 1.4vw, 22px);
  color: var(--cream-dim);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  font-weight: 500;
  margin-bottom: clamp(32px, 4vh, 64px);
}
.audio-bars {
  display: flex;
  gap: clamp(6px, .8vw, 10px);
  align-items: flex-end;
  justify-content: center;
  height: clamp(48px, 8vh, 96px);
}
.audio-bars span {
  width: clamp(6px, .8vw, 10px);
  background: var(--gold);
  border-radius: 4px;
  animation: bar 1.1s ease-in-out infinite;
  box-shadow: 0 0 12px rgba(201, 164, 76, .3);
}
.audio-bars span:nth-child(1) { animation-delay: 0s; }
.audio-bars span:nth-child(2) { animation-delay: .12s; }
.audio-bars span:nth-child(3) { animation-delay: .24s; }
.audio-bars span:nth-child(4) { animation-delay: .36s; }
.audio-bars span:nth-child(5) { animation-delay: .48s; }
.audio-bars span:nth-child(6) { animation-delay: .6s; }
.audio-bars span:nth-child(7) { animation-delay: .72s; }
@keyframes bar {
  0%, 100% { height: 14px; opacity: .5; }
  50% { height: 100%; opacity: 1; }
}

/* ===== Player overlay (HUD) ===== */
.player-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(24px, 4vw, 60px);
  z-index: 10;
  opacity: 1;
  transition: opacity 400ms ease;
}
.player-overlay.hidden { opacity: 0; display: flex !important; pointer-events: none; }
.player-stage:not(.audio) ~ .player-overlay {
  background:
    linear-gradient(180deg, rgba(0, 0, 0, .65) 0%, transparent 22%, transparent 78%, rgba(0, 0, 0, .65) 100%);
}
.now-playing { max-width: 70%; }
.np-label {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: clamp(11px, 1vw, 14px);
  letter-spacing: 0.3em;
  color: var(--gold);
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
}
.np-ar {
  font-size: clamp(28px, 3.4vw, 56px);
  font-weight: 700;
  line-height: 1.15;
  direction: rtl;
}
.np-en {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: clamp(13px, 1.3vw, 19px);
  color: var(--cream-dim);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-top: 6px;
  font-weight: 500;
}
.np-meta {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-top: 18px;
}
.haram-tag {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: clamp(11px, 1vw, 14px);
  color: var(--gold);
  letter-spacing: 0.22em;
  font-weight: 600;
}
.player-hints {
  display: flex;
  gap: clamp(14px, 1.8vw, 28px);
  font-family: 'Inter', system-ui, sans-serif;
  color: var(--cream-dim);
  font-size: clamp(11px, 1vw, 14px);
  letter-spacing: 0.14em;
  font-weight: 500;
  flex-wrap: wrap;
}

/* Player controls (bottom-right corner of HUD) */
.player-controls {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: clamp(12px, 1.4vh, 20px);
  align-self: flex-end;
  pointer-events: auto;
}
.ctrl-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: rgba(20, 40, 36, .85);
  border: 1px solid rgba(201, 164, 76, .35);
  color: var(--cream);
  padding: 10px 18px;
  border-radius: 999px;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: clamp(11px, 1vw, 14px);
  letter-spacing: 0.22em;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast), transform var(--t-fast);
  backdrop-filter: blur(12px);
}
.ctrl-btn:hover, .ctrl-btn:focus-visible {
  background: rgba(31, 61, 51, .95);
  border-color: var(--gold);
  outline: none;
  transform: scale(1.04);
}
.ctrl-btn.muted .ctrl-icon { color: var(--amber); }
.ctrl-btn.unmuted .ctrl-icon { color: #4ade80; }
.ctrl-icon { font-size: 16px; line-height: 1; }
.ctrl-label { line-height: 1; }

/* Tap-to-play (autoplay-blocked fallback) */
.tap-to-play {
  position: absolute;
  inset: 0;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(7, 17, 13, .72);
  backdrop-filter: blur(8px);
  animation: ttpIn 240ms ease;
}
.tap-to-play.hidden { display: none !important; }
.ttp-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  background: linear-gradient(155deg, var(--green-deep), var(--surface-focus));
  border: 2px solid var(--gold);
  color: var(--cream);
  padding: clamp(24px, 3vh, 44px) clamp(40px, 6vw, 80px);
  border-radius: var(--radius);
  cursor: pointer;
  font-family: 'Amiri', serif;
  transition: transform var(--t-fast), box-shadow var(--t-fast);
  box-shadow: 0 0 0 4px var(--gold-soft), 0 24px 60px rgba(0, 0, 0, .6);
}
.ttp-btn:hover, .ttp-btn:focus-visible {
  outline: none;
  transform: scale(1.03);
}
.ttp-icon { font-size: clamp(32px, 4vw, 56px); color: var(--gold); }
.ttp-ar { font-size: clamp(22px, 2.4vw, 36px); font-weight: 700; }
.ttp-en {
  font-family: 'Inter', sans-serif;
  font-size: clamp(11px, 1vw, 14px);
  letter-spacing: 0.32em;
  color: var(--gold);
  font-weight: 700;
}
@keyframes ttpIn { from { opacity: 0; } to { opacity: 1; } }

/* Live pill — RECENT variant */
.live-pill.recent {
  color: var(--cream);
  background: rgba(201, 164, 76, .18);
  border: 1px solid rgba(201, 164, 76, .35);
}
.live-pill.recent .live-dot {
  background: var(--gold);
  box-shadow: 0 0 6px rgba(201, 164, 76, .6);
  animation: none;
}

/* "Stream pending" badge — for audio channels where we haven't located a
   working direct stream URL yet (e.g. Nida' al-Islam) */
.live-pill.pending {
  color: var(--cream-dim);
  background: rgba(233, 162, 59, .18);
  border: 1px solid rgba(233, 162, 59, .35);
}
.live-pill.pending .live-dot {
  background: var(--amber);
  box-shadow: 0 0 6px rgba(233, 162, 59, .6);
  animation: none;
}

/* ===== Banners ===== */
.banner {
  position: absolute;
  top: clamp(20px, 3vh, 40px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 22px;
  border-radius: 999px;
  font-family: 'Inter', system-ui, sans-serif;
  z-index: 20;
  backdrop-filter: blur(20px);
  background: rgba(20, 40, 36, .85);
  border: 1px solid rgba(201, 164, 76, .25);
  animation: bannerIn 360ms cubic-bezier(.2, .8, .2, 1) both;
  pointer-events: none;
}
.banner-icon {
  font-size: 14px;
  color: var(--gold);
}
.banner.no-live .banner-icon { color: var(--amber); }
.banner.stale .banner-icon { color: var(--amber); }
.banner-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.banner-text strong {
  font-family: 'Amiri', serif;
  font-size: clamp(14px, 1.3vw, 18px);
  font-weight: 700;
  color: var(--cream);
}
.banner-text span {
  font-size: clamp(10px, .9vw, 13px);
  letter-spacing: 0.22em;
  color: var(--cream-dim);
  font-weight: 600;
}
@keyframes bannerIn {
  from { opacity: 0; transform: translate(-50%, -10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* ===== Mini-guide (↓) ===== */
.mini-guide {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: clamp(220px, 32vh, 320px);
  z-index: 30;
  background: linear-gradient(180deg, transparent 0%, rgba(7, 17, 13, .82) 30%, var(--bg-3) 100%);
  padding: clamp(20px, 2.5vh, 36px) clamp(28px, 4vw, 60px) clamp(16px, 2vh, 28px);
  animation: miniIn 280ms cubic-bezier(.2, .8, .2, 1) both;
}
.mini-guide.hidden { display: none !important; }
.mini-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: clamp(12px, 1.5vh, 20px);
  font-family: 'Inter', system-ui, sans-serif;
}
.mini-title {
  font-size: clamp(13px, 1.1vw, 16px);
  letter-spacing: 0.3em;
  font-weight: 700;
  color: var(--gold);
}
.mini-hint {
  font-size: clamp(11px, .95vw, 14px);
  color: var(--cream-dim);
  letter-spacing: 0.14em;
  font-weight: 500;
}
.mini-tools {
  display: flex;
  direction: ltr;
  align-items: end;
  gap: clamp(12px, 1.4vw, 20px);
  margin-bottom: 14px;
  font-family: 'Inter', system-ui, sans-serif;
}
.mini-tool {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.mini-search-tool {
  flex: 1;
}
.mini-tool-label,
.mini-status {
  font-size: clamp(10px, .85vw, 12px);
  letter-spacing: 0.22em;
  color: var(--cream-dim);
  font-weight: 600;
}
.mini-tool.focused .mini-tool-label,
.mini-status.focused {
  color: var(--gold);
}
.mini-select,
.mini-search {
  height: 40px;
  border-radius: 999px;
  border: 1px solid rgba(201, 164, 76, .28);
  background: rgba(20, 40, 36, .88);
  color: var(--cream);
  padding: 0 16px;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 13px;
  letter-spacing: 0.12em;
  outline: none;
}
.mini-status.focused {
  border-radius: 999px;
  padding: 11px 16px;
  background: rgba(20, 40, 36, .88);
}
.mini-select {
  min-width: 170px;
  cursor: pointer;
}
.mini-search {
  width: 100%;
}
.mini-select:focus,
.mini-search:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-soft);
}
.mini-search::placeholder {
  color: var(--cream-faint);
  letter-spacing: 0.08em;
}
.mini-status {
  min-width: 88px;
  text-align: end;
  white-space: nowrap;
}
.mini-rail {
  display: flex;
  gap: clamp(12px, 1.4vw, 22px);
  overflow-x: auto;
  scroll-behavior: smooth;
  padding-bottom: 8px;
}
.mini-rail::-webkit-scrollbar { display: none; }
.mini-card {
  flex: 0 0 clamp(180px, 18vw, 280px);
  background: var(--surface);
  border: 2px solid rgba(245, 239, 225, .06);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: transform var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast);
  display: flex;
  flex-direction: column;
}
.mini-card.focused {
  transform: scale(1.05);
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-soft), 0 18px 40px rgba(0, 0, 0, .6);
}
.mini-card .thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  background-color: var(--bg-3);
  background-size: cover;
  background-position: center;
  position: relative;
}
.mini-card .thumb-badge {
  position: absolute;
  top: 8px; left: 8px;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 10px;
  letter-spacing: 0.18em;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  color: var(--cream);
  background: var(--red);
}
.mini-card .thumb-badge.recent { background: rgba(201, 164, 76, .9); color: var(--bg); }
.mini-card .card-body {
  padding: 10px 12px 12px;
}
.mini-card .card-title {
  font-family: 'Amiri', serif;
  font-size: clamp(13px, 1.1vw, 15px);
  color: var(--cream);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  direction: rtl;
}
.mini-card .card-meta {
  margin-top: 8px;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 10px;
  letter-spacing: 0.16em;
  color: var(--cream-faint);
}
.mini-empty {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: clamp(12px, 1.1vw, 15px);
  color: var(--cream-faint);
  letter-spacing: 0.18em;
  padding: 20px 0;
}
@keyframes miniIn {
  from { opacity: 0; transform: translateY(40px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== Program guide (↑) ===== */
.program-guide {
  position: absolute;
  inset: 0;
  z-index: 40;
  background: linear-gradient(180deg, rgba(7, 17, 13, .94) 0%, rgba(7, 17, 13, .98) 100%);
  backdrop-filter: blur(12px);
  padding: clamp(24px, 4vh, 60px) clamp(28px, 4.5vw, 70px);
  display: flex;
  flex-direction: column;
  animation: guideIn 320ms cubic-bezier(.2, .8, .2, 1) both;
}
.program-guide.hidden { display: none !important; }
.pg-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: clamp(20px, 2.5vh, 36px);
  font-family: 'Inter', system-ui, sans-serif;
}
.pg-title {
  font-size: clamp(16px, 1.6vw, 22px);
  letter-spacing: 0.3em;
  font-weight: 700;
  color: var(--gold);
}
.pg-meta {
  font-size: clamp(11px, 1vw, 14px);
  color: var(--cream-dim);
  letter-spacing: 0.18em;
}
.pg-list {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: clamp(8px, 1vh, 14px);
  overflow-y: auto;
}
.pg-list::-webkit-scrollbar { width: 6px; }
.pg-list::-webkit-scrollbar-thumb { background: rgba(201, 164, 76, .3); border-radius: 3px; }
.pg-row {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) 2fr 1.5fr 100px;
  gap: clamp(16px, 2vw, 32px);
  align-items: center;
  padding: clamp(14px, 1.6vh, 22px) clamp(16px, 2vw, 28px);
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  background: rgba(20, 40, 36, .5);
  transition: transform var(--t-fast), border-color var(--t-fast), background var(--t-fast);
}
.pg-row.focused {
  border-color: var(--gold);
  background: linear-gradient(90deg, rgba(31, 61, 51, .9), rgba(7, 56, 42, .5));
  transform: translateX(4px);
}
.pg-row.audio { background: rgba(20, 40, 36, .35); }
.pg-channel { display: flex; flex-direction: column; gap: 4px; }
.pg-channel-ar {
  font-size: clamp(18px, 1.6vw, 24px);
  font-weight: 700;
  color: var(--cream);
  direction: rtl;
}
.pg-channel-en {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: clamp(10px, .9vw, 13px);
  color: var(--cream-dim);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-weight: 500;
}
.pg-now, .pg-next { display: flex; flex-direction: column; gap: 4px; }
.pg-label {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 10px;
  letter-spacing: 0.3em;
  font-weight: 700;
  color: var(--gold);
}
.pg-prog {
  font-family: 'Amiri', serif;
  font-size: clamp(13px, 1.2vw, 17px);
  color: var(--cream);
  direction: rtl;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.pg-prog.dim { color: var(--cream-faint); }
.pg-status {
  display: flex;
  justify-content: flex-end;
  align-items: center;
}
.pg-hint {
  margin-top: clamp(12px, 1.6vh, 22px);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: clamp(11px, 1vw, 14px);
  color: var(--cream-dim);
  letter-spacing: 0.14em;
  text-align: center;
}
@keyframes guideIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ===== Channel flash (when switching with L/R) ===== */
.channel-flash {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 50;
  font-family: 'Amiri', serif;
  font-size: clamp(36px, 4vw, 64px);
  font-weight: 700;
  color: var(--cream);
  text-shadow: 0 4px 20px rgba(0, 0, 0, .8);
  text-align: center;
  pointer-events: none;
  background: rgba(7, 17, 13, .8);
  padding: 18px 36px;
  border-radius: var(--radius);
  border: 2px solid var(--gold);
  direction: rtl;
  animation: flashIn 600ms cubic-bezier(.2, .8, .2, 1) both;
}
.channel-flash .flash-en {
  display: block;
  font-family: 'Inter', sans-serif;
  font-size: clamp(11px, 1vw, 14px);
  font-weight: 600;
  letter-spacing: 0.3em;
  color: var(--gold);
  margin-top: 6px;
}
@keyframes flashIn {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.92); }
  20% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; }
}

/* ===== Responsive ===== */
@media (max-width: 1100px) {
  .pg-row { grid-template-columns: minmax(180px, 1.3fr) 2fr 90px; }
  .pg-next { display: none; }
}
@media (max-width: 900px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 540px) {
  .grid { grid-template-columns: 1fr; }
  .brand-en { display: none; }
}

/* ============================================================
 * Touch feedback layer — pills, edge tints, scrub indicator,
 * pull-to-refresh, tile-preview overlay.
 * Lives at the very top so it always paints above the HUD.
 * ============================================================ */
#touch-fx-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9000;
}

/* Seek / mute pill that pops near the tap point */
.touch-pill {
  position: absolute;
  transform: translate(-50%, -50%) scale(0.85);
  padding: 14px 22px;
  border-radius: 999px;
  background: rgba(7, 56, 42, 0.92);
  border: 1px solid rgba(212, 175, 91, 0.6);
  color: #f5efe1;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.16em;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 220ms ease, transform 260ms cubic-bezier(.2,.8,.2,1);
  box-shadow: 0 12px 30px rgba(0,0,0,.45);
  backdrop-filter: blur(6px);
}
.touch-pill.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}
.touch-pill.out {
  opacity: 0;
  transform: translate(-50%, -50%) scale(1.08);
  transition: opacity 300ms ease, transform 300ms ease;
}

/* Edge tint flashes on swipe */
.touch-edge {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 28%;
  opacity: 0;
  transition: opacity 120ms ease-out;
  background: linear-gradient(90deg, rgba(212,175,91,0.32), rgba(212,175,91,0));
}
.touch-edge-right {
  right: 0;
  left: auto;
  background: linear-gradient(270deg, rgba(212,175,91,0.32), rgba(212,175,91,0));
}
.touch-edge-top {
  inset: 0 0 auto 0;
  width: 100%;
  height: 24%;
  background: linear-gradient(180deg, rgba(212,175,91,0.32), rgba(212,175,91,0));
}
.touch-edge-bottom {
  inset: auto 0 0 0;
  top: auto;
  width: 100%;
  height: 24%;
  background: linear-gradient(0deg, rgba(212,175,91,0.32), rgba(212,175,91,0));
}
.touch-edge.show { opacity: 1; animation: edgeFlash 220ms ease-out; }
@keyframes edgeFlash {
  0%   { opacity: 0; }
  30%  { opacity: 1; }
  100% { opacity: 0; }
}

/* Long-press scrub indicator */
.touch-scrub {
  position: absolute;
  transform: translate(-50%, -130%);
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(7, 56, 42, 0.96);
  border: 1px solid rgba(212, 175, 91, 0.75);
  color: var(--gold, #d4af5b);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.22em;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 180ms ease;
  box-shadow: 0 10px 24px rgba(0,0,0,.55);
}
.touch-scrub.show { opacity: 1; }

/* Pull-to-refresh indicator (lives outside the fx layer so it can sit
   above the topbar yet below banners) */
#pull-refresh {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translate(-50%, -40px);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(7, 56, 42, 0.92);
  border: 1px solid rgba(212, 175, 91, 0.45);
  color: #f5efe1;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.22em;
  opacity: 0;
  transition: opacity 160ms ease, transform 220ms cubic-bezier(.2,.8,.2,1);
  z-index: 9500;
  pointer-events: none;
  box-shadow: 0 8px 20px rgba(0,0,0,.45);
}
#pull-refresh .pr-spinner {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(212, 175, 91, 0.25);
  border-top-color: var(--gold, #d4af5b);
  transition: transform 160ms ease;
}
#pull-refresh.ready .pr-spinner {
  border-color: var(--gold, #d4af5b);
  border-top-color: rgba(245, 239, 225, 0.9);
}
#pull-refresh.loading .pr-spinner {
  animation: prSpin 800ms linear infinite;
}
@keyframes prSpin {
  to { transform: rotate(360deg); }
}

/* Tile long-press preview */
.tile-preview {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9200;
  background: rgba(7, 30, 22, 0.55);
  opacity: 0;
  transition: opacity 220ms ease;
  pointer-events: none;
  padding: 24px;
}
.tile-preview.show {
  opacity: 1;
  pointer-events: auto;
}
.tile-preview .tp-card {
  background: linear-gradient(180deg, rgba(8,53,40,0.96), rgba(6,36,28,0.96));
  border: 1px solid rgba(212, 175, 91, 0.5);
  border-radius: 14px;
  padding: 22px 22px 18px;
  max-width: 360px;
  width: 100%;
  text-align: center;
  color: #f5efe1;
  box-shadow: 0 20px 50px rgba(0,0,0,.6);
}
.tile-preview .tp-name-ar {
  font-family: 'Amiri', serif;
  font-size: 26px;
  line-height: 1.25;
  margin-bottom: 4px;
}
.tile-preview .tp-name-en {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  letter-spacing: 0.22em;
  color: rgba(245, 239, 225, 0.7);
  margin-bottom: 10px;
}
.tile-preview .tp-now {
  font-size: 12px;
  color: rgba(245, 239, 225, 0.85);
  min-height: 16px;
  margin-bottom: 16px;
}
.tile-preview .tp-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}
.tile-preview .tp-open {
  background: var(--gold, #d4af5b);
  color: #07382a;
  border: none;
  border-radius: 999px;
  padding: 10px 26px;
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  letter-spacing: 0.24em;
  font-size: 12px;
  cursor: pointer;
}
.tile-preview .tp-hint {
  font-size: 9px;
  letter-spacing: 0.22em;
  color: rgba(245, 239, 225, 0.5);
}

/* Make the audio stage visibly tappable — subtle hover-pointer hint. */
.player-stage.audio {
  cursor: pointer;
}

/* ============================================================
 * Gesture tutorial overlay (first-time visit on touch devices)
 * ============================================================ */
.gesture-tutorial {
  position: fixed;
  inset: 0;
  z-index: 9800;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(7, 30, 22, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 240ms ease;
  pointer-events: none;
  padding: 24px;
}
.gesture-tutorial.show {
  opacity: 1;
  pointer-events: auto;
}
.gesture-tutorial .gt-card {
  background: linear-gradient(180deg, rgba(8,53,40,0.96), rgba(6,36,28,0.96));
  border: 1px solid rgba(212, 175, 91, 0.55);
  border-radius: 18px;
  padding: 22px 22px 16px;
  max-width: 360px;
  width: 100%;
  color: var(--cream, #f5efe1);
  box-shadow: 0 24px 56px rgba(0,0,0,.6);
  text-align: center;
}
.gesture-tutorial .gt-head {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 14px;
}
.gesture-tutorial .gt-title {
  font-family: 'Amiri', serif;
  font-size: 22px;
  color: var(--gold, #d4af5b);
  letter-spacing: 0.04em;
}
.gesture-tutorial .gt-sub {
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  letter-spacing: 0.22em;
  color: rgba(245, 239, 225, 0.7);
}
.gesture-tutorial .gt-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}
.gesture-tutorial .gt-cue {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 8px;
  border: 1px solid rgba(212, 175, 91, 0.22);
  border-radius: 12px;
  background: rgba(7, 17, 13, 0.35);
}
.gesture-tutorial .gt-cue.gt-cue-two,
.gesture-tutorial .gt-cue.gt-cue-double {
  grid-column: span 2;
}
.gesture-tutorial .gt-arrow {
  font-size: 26px;
  line-height: 1;
  color: var(--gold, #d4af5b);
  text-shadow: 0 0 14px rgba(212, 175, 91, 0.35);
  animation: gtArrowPulse 1800ms ease-in-out infinite;
}
.gesture-tutorial .gt-cue-left  .gt-arrow { animation-name: gtSlideX; --gt-x: -6px; }
.gesture-tutorial .gt-cue-right .gt-arrow { animation-name: gtSlideX; --gt-x:  6px; }
.gesture-tutorial .gt-cue-up    .gt-arrow { animation-name: gtSlideY; --gt-y: -6px; }
.gesture-tutorial .gt-cue-down  .gt-arrow { animation-name: gtSlideY; --gt-y:  6px; }
@keyframes gtSlideX {
  0%,100% { transform: translateX(0); opacity: .85; }
  50%     { transform: translateX(var(--gt-x, 6px)); opacity: 1; }
}
@keyframes gtSlideY {
  0%,100% { transform: translateY(0); opacity: .85; }
  50%     { transform: translateY(var(--gt-y, 6px)); opacity: 1; }
}
@keyframes gtArrowPulse {
  0%,100% { opacity: .8; }
  50%     { opacity: 1; }
}
.gesture-tutorial .gt-label {
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  letter-spacing: 0.18em;
  color: rgba(245, 239, 225, 0.82);
  text-transform: uppercase;
}
.gesture-tutorial .gt-actions {
  display: flex;
  justify-content: center;
}
.gesture-tutorial .gt-dismiss {
  background: var(--gold, #d4af5b);
  color: #07382a;
  border: none;
  border-radius: 999px;
  padding: 10px 28px;
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  letter-spacing: 0.24em;
  font-size: 12px;
  cursor: pointer;
  min-height: 40px;
}

/* ============================================================
 * Edge chevron hints — persistent, non-interactive orientation cues.
 * Only painted on coarse-pointer devices via JS gate; CSS itself also
 * suppresses them on hover-capable devices as a defense in depth.
 * ============================================================ */
#edge-chevrons {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 60;        /* under banners / tutorial; above HUD background */
  opacity: 0;
  transition: opacity 280ms ease;
}
#edge-chevrons.show { opacity: 1; }
#edge-chevrons.dim  { opacity: 0.5; }
.edge-chev {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold, #d4af5b);
  opacity: 0.18;
  text-shadow: 0 0 12px rgba(212, 175, 91, 0.5);
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 700;
  pointer-events: none;
  transition: opacity 220ms ease;
}
.edge-chev .ec-arrow {
  font-size: 32px;
  line-height: 1;
  animation: chevBreathe 2600ms ease-in-out infinite;
}
@keyframes chevBreathe {
  0%, 100% { transform: scale(0.96); opacity: 0.85; }
  50%      { transform: scale(1.04); opacity: 1; }
}
.edge-chev-left   { left: 4vw;  top: 50%; transform: translateY(-50%); }
.edge-chev-right  { right: 4vw; top: 50%; transform: translateY(-50%); }
.edge-chev-top    { top: 10vh;  left: 50%; transform: translateX(-50%); }
.edge-chev-bottom { bottom: 12vh; left: 50%; transform: translateX(-50%); }

/* Hide on non-touch devices entirely (defense in depth — JS won't even
   create the element on hover-capable). */
@media (hover: hover) and (pointer: fine) {
  #edge-chevrons { display: none !important; }
}

/* ============================================================
 * "Tap to unmute" hint pinned over the mute button
 * ============================================================ */
.unmute-hint {
  position: fixed;
  z-index: 9700;
  transform: translate(-50%, -100%);
  background: rgba(7, 56, 42, 0.96);
  border: 1px solid rgba(212, 175, 91, 0.75);
  color: var(--cream, #f5efe1);
  padding: 9px 14px;
  border-radius: 999px;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.16em;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  opacity: 0;
  transition: opacity 200ms ease, transform 240ms cubic-bezier(.2,.8,.2,1);
  pointer-events: none;
  box-shadow: 0 10px 26px rgba(0,0,0,.55);
  white-space: nowrap;
}
.unmute-hint::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -6px;
  width: 10px;
  height: 10px;
  background: rgba(7, 56, 42, 0.96);
  border-right: 1px solid rgba(212, 175, 91, 0.75);
  border-bottom: 1px solid rgba(212, 175, 91, 0.75);
  transform: translate(-50%, 0) rotate(45deg);
}
.unmute-hint.show {
  opacity: 1;
  transform: translate(-50%, -110%);
}
.unmute-hint .uh-icon { font-size: 14px; }
.unmute-hint .uh-text { letter-spacing: 0.18em; }

/* ===== Onboarding modal ===== */
.onboarding {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(16px, 3vh, 40px);
  background: radial-gradient(ellipse 80% 70% at 50% 30%, rgba(13, 79, 60, .65), rgba(7, 17, 13, .96));
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  animation: onbIn 360ms cubic-bezier(.2, .8, .2, 1) both;
  overflow: hidden;
  font-family: 'Inter', system-ui, sans-serif;
}
body.onb-locked { overflow: hidden; }
.onboarding.onb-dismissing { animation: onbOut 320ms ease both; pointer-events: none; }
@keyframes onbIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes onbOut { from { opacity: 1; } to { opacity: 0; transform: scale(1.02); } }

.onb-card {
  width: min(720px, 100%);
  max-height: calc(100vh - clamp(32px, 6vh, 80px));
  background: linear-gradient(155deg, #122621 0%, #08130f 100%);
  border: 1px solid rgba(201, 164, 76, .35);
  border-radius: 22px;
  padding: clamp(28px, 4vh, 56px) clamp(24px, 4vw, 56px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 32px 80px rgba(0, 0, 0, .65), 0 0 0 6px rgba(201, 164, 76, .08);
}
.onb-step { display: flex; flex-direction: column; gap: clamp(18px, 2.4vh, 28px); flex: 1; min-height: 0; }
.onb-step.hidden { display: none; }

.onb-head {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 12px;
  flex-shrink: 0;
  color: var(--cream);
}
.onb-head .onb-brand-ar {
  font-family: 'Amiri', serif;
  font-size: clamp(20px, 2.4vw, 30px);
  font-weight: 700;
  direction: rtl;
}
.onb-head .onb-brand-divider { color: var(--gold); font-size: clamp(16px, 1.8vw, 22px); }
.onb-head .onb-brand-en {
  font-size: clamp(10px, 1vw, 13px);
  letter-spacing: 0.32em;
  font-weight: 700;
  color: var(--gold);
}

/* Step 1 — language */
.onb-lang-q {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 700;
  color: var(--cream);
}
.onb-q-ar {
  font-family: 'Amiri', serif;
  font-size: clamp(26px, 3.6vw, 40px);
  direction: rtl;
}
.onb-q-en {
  font-size: clamp(11px, 1.1vw, 14px);
  letter-spacing: 0.32em;
  color: var(--cream-dim);
  text-transform: uppercase;
}

.onb-lang-boxes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(14px, 2vw, 24px);
}
.onb-lang-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: clamp(28px, 6vh, 56px) clamp(14px, 2vw, 24px);
  background: linear-gradient(155deg, #163128 0%, #0a1a14 100%);
  border: 2px solid rgba(201, 164, 76, .25);
  border-radius: 16px;
  color: var(--cream);
  cursor: pointer;
  transition: transform 200ms cubic-bezier(.2,.8,.2,1), border-color 200ms ease, background 200ms ease, box-shadow 200ms ease;
  font-family: inherit;
}
.onb-lang-btn:hover, .onb-lang-btn:focus-visible {
  outline: none;
  transform: translateY(-3px);
  border-color: var(--gold);
  background: linear-gradient(155deg, #1d3d31 0%, #0e2419 100%);
  box-shadow: 0 0 0 4px rgba(201, 164, 76, .15), 0 24px 50px rgba(0, 0, 0, .55);
}
.onb-lang-btn:active { transform: translateY(-1px); }
.onb-lang-script {
  font-family: 'Amiri', 'Inter', system-ui, sans-serif;
  font-size: clamp(34px, 4.4vw, 52px);
  font-weight: 700;
}
.onb-lang-btn[data-lang="ar"] .onb-lang-script { direction: rtl; }
.onb-lang-sub {
  font-size: clamp(10px, 1vw, 13px);
  letter-spacing: 0.32em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--gold);
}

/* Step 2 — message */
.onb-msg .onb-title {
  font-family: 'Amiri', serif;
  font-size: clamp(22px, 2.8vw, 32px);
  font-weight: 700;
  color: var(--cream);
  text-align: center;
  line-height: 1.3;
}
.onb-msg[dir="rtl"] .onb-title { direction: rtl; }
.onb-msg-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 4px 2px;
}
.onb-msg[dir="rtl"] .onb-msg-body { direction: rtl; }
.onb-msg-body p {
  font-family: 'Amiri', 'Inter', system-ui, sans-serif;
  font-size: clamp(15px, 1.4vw, 18px);
  line-height: 1.85;
  color: var(--cream);
}
.onb-msg[dir="ltr"] .onb-msg-body p { font-family: 'Inter', system-ui, sans-serif; font-size: clamp(14px, 1.25vw, 17px); line-height: 1.7; }
.onb-signoff {
  font-size: clamp(13px, 1.2vw, 16px);
  color: var(--gold);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-align: end;
}
.onb-msg[dir="rtl"] .onb-signoff { font-family: 'Amiri', serif; }
.onb-cta {
  align-self: stretch;
  padding: 14px 22px;
  border-radius: 12px;
  background: var(--gold);
  color: #08130f;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: clamp(13px, 1.2vw, 16px);
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  border: 0;
  cursor: pointer;
  transition: background 180ms ease, transform 180ms ease;
}
.onb-msg[dir="rtl"] .onb-cta { font-family: 'Amiri', 'Inter', sans-serif; letter-spacing: 0.04em; font-size: clamp(15px, 1.4vw, 18px); }
.onb-cta:hover, .onb-cta:focus-visible { outline: none; background: var(--gold-bright); transform: translateY(-1px); }

/* ===== Player home logo (top-left) ===== */
.player-home-logo {
  position: absolute;
  top: clamp(16px, 2.4vh, 28px);
  left: clamp(16px, 2.4vw, 28px);
  z-index: 15;
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding: 10px 16px;
  background: rgba(7, 17, 13, .72);
  border: 1px solid rgba(201, 164, 76, .32);
  border-radius: 999px;
  text-decoration: none;
  color: var(--cream);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: background 180ms ease, border-color 180ms ease, transform 180ms ease;
  font-family: 'Inter', system-ui, sans-serif;
}
.player-home-logo:hover, .player-home-logo:focus-visible {
  background: rgba(13, 38, 30, .9);
  border-color: var(--gold);
  outline: none;
  transform: translateY(-1px);
}
.phl-ar {
  font-family: 'Amiri', serif;
  font-size: clamp(14px, 1.3vw, 17px);
  font-weight: 700;
  direction: rtl;
}
.phl-divider { color: var(--gold); font-size: 12px; }
.phl-en {
  font-size: clamp(9px, .9vw, 11px);
  letter-spacing: 0.3em;
  color: var(--gold);
  font-weight: 700;
}
.player-overlay.hidden ~ .player-home-logo,
.player-overlay.hud.hidden + .tap-to-play + .banner + .banner + .mini-guide + .program-guide ~ .player-home-logo {
  /* fall-through: logo fades with HUD */
  opacity: 0.55;
}

/* ===== Onboarding — mobile ===== */
@media (max-width: 720px) {
  .onboarding { padding: 0; align-items: stretch; }
  .onb-card {
    width: 100%;
    max-height: none;
    min-height: 100dvh;
    border-radius: 0;
    border: 0;
    box-shadow: none;
    padding: max(28px, env(safe-area-inset-top) + 12px) 20px max(28px, env(safe-area-inset-bottom) + 16px);
    gap: 18px;
    justify-content: space-between;
  }
  .onb-lang-boxes { grid-template-columns: 1fr; gap: 14px; }
  .onb-lang-btn { padding: 28px 14px; }
  .onb-lang-script { font-size: clamp(32px, 8vw, 42px); }
  .onb-msg-body p { font-size: 15px; line-height: 1.7; }
  .player-home-logo {
    padding: 8px 12px;
    top: max(env(safe-area-inset-top), 14px);
    left: 12px;
  }
  .phl-en { font-size: 9px; letter-spacing: 0.22em; }
}

/* ===== Gesture tutorial — interactive step layout ===== */
.gt-card .gt-cue-stage {
  min-height: clamp(140px, 22vh, 220px);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: clamp(12px, 2vh, 22px) 0;
}
.gt-card .gt-cue {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
  animation: gtCueIn 320ms cubic-bezier(.2,.8,.2,1) both;
}
@keyframes gtCueIn {
  from { opacity: 0; transform: scale(.92); }
  to { opacity: 1; transform: scale(1); }
}
.gt-card .gt-arrow {
  font-size: clamp(56px, 9vw, 84px);
  line-height: 1;
  color: var(--gold);
  text-shadow: 0 0 22px rgba(201, 164, 76, .35);
}
.gt-card .gt-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.gt-card .gt-label-ar {
  font-family: 'Amiri', serif;
  font-size: clamp(20px, 2.4vw, 26px);
  font-weight: 700;
  color: var(--cream);
  direction: rtl;
}
.gt-card .gt-label-ar em {
  font-style: normal;
  color: var(--cream-dim);
  font-weight: 400;
}
.gt-card .gt-label-en {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: clamp(11px, 1.1vw, 14px);
  letter-spacing: 0.24em;
  font-weight: 700;
  color: var(--gold);
  text-transform: uppercase;
}
.gt-card .gt-label-en em {
  font-style: normal;
  color: var(--cream-dim);
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0.16em;
}

/* Per-step nudge animations on the arrow */
.gt-anim-right .gt-arrow { animation: gtNudgeRight 1.4s ease-in-out infinite; }
.gt-anim-left  .gt-arrow { animation: gtNudgeLeft  1.4s ease-in-out infinite; }
.gt-anim-up    .gt-arrow { animation: gtNudgeUp    1.4s ease-in-out infinite; }
.gt-anim-down  .gt-arrow { animation: gtNudgeDown  1.4s ease-in-out infinite; }
.gt-anim-back  .gt-arrow { animation: gtPulse      1.4s ease-in-out infinite; }
@keyframes gtNudgeRight { 0%,100% { transform: translateX(0); } 50% { transform: translateX(18px); } }
@keyframes gtNudgeLeft  { 0%,100% { transform: translateX(0); } 50% { transform: translateX(-18px); } }
@keyframes gtNudgeUp    { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-14px); } }
@keyframes gtNudgeDown  { 0%,100% { transform: translateY(0); } 50% { transform: translateY(14px); } }
@keyframes gtPulse      { 0%,100% { transform: scale(1); } 50% { transform: scale(1.12); } }

/* Progress dots */
.gt-card .gt-progress {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 10px;
}
.gt-card .gt-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(245, 239, 225, .14);
  transition: background 200ms ease, transform 200ms ease;
}
.gt-card .gt-dot.active {
  background: var(--gold);
  transform: scale(1.4);
}
.gt-card .gt-dot.done {
  background: rgba(201, 164, 76, .55);
}

.gt-card .gt-skip {
  background: transparent;
  border: 1px solid rgba(245, 239, 225, .14);
  color: var(--cream-dim);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.24em;
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  align-self: center;
  transition: background 180ms ease, color 180ms ease, border-color 180ms ease;
}
.gt-card .gt-skip:hover, .gt-card .gt-skip:focus-visible {
  outline: none;
  background: rgba(245, 239, 225, .06);
  color: var(--cream);
  border-color: var(--gold);
}

/* "All set" final state */
.gt-card .gt-cue.gt-done .gt-arrow {
  color: #4ade80;
  text-shadow: 0 0 22px rgba(74, 222, 128, .45);
  animation: none;
}

/* ===== In-app browser bypass banner ===== */
.inapp-bypass {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(7, 17, 13, .82);
  backdrop-filter: blur(18px);
  padding: 16px;
  animation: iabIn 280ms cubic-bezier(.2, .8, .2, 1) both;
  font-family: 'Inter', system-ui, sans-serif;
}
.inapp-bypass.iab-dismissing { animation: iabOut 240ms ease both; }
@keyframes iabIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes iabOut { from { opacity: 1; } to { opacity: 0; } }

.iab-card {
  width: min(440px, 100%);
  background: linear-gradient(155deg, #122621 0%, #08130f 100%);
  border: 2px solid rgba(201, 164, 76, .35);
  border-radius: 20px;
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0,0,0,.6);
}
.iab-icon { font-size: 48px; line-height: 1; }
.iab-text { display: flex; flex-direction: column; gap: 8px; }
.iab-strong {
  font-family: 'Amiri', serif;
  font-size: 19px;
  font-weight: 700;
  color: var(--cream);
}
.iab-detail {
  font-size: 13px;
  line-height: 1.55;
  color: var(--cream-dim);
}
.iab-detail strong { color: var(--cream); font-weight: 700; }
.iab-actions { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.iab-primary, .iab-ghost {
  padding: 14px 18px;
  border-radius: 12px;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  cursor: pointer;
  border: 0;
  transition: background 180ms ease, transform 180ms ease;
}
.iab-primary { background: var(--gold); color: #08130f; }
.iab-primary:hover, .iab-primary:focus-visible {
  background: var(--gold-bright);
  transform: translateY(-1px);
  outline: none;
}
.iab-ghost {
  background: transparent;
  color: var(--cream-dim);
  border: 1px solid rgba(245, 239, 225, .15);
}
.iab-ghost:hover, .iab-ghost:focus-visible {
  background: rgba(245, 239, 225, .06);
  color: var(--cream);
  outline: none;
}
