/* Najat TV player — same identity as Najat Radius and Najat Monitor (dark, Cairo, teal + gold).
   Gold has one job: showing where you are (focus, the channel you are on, progress).
   The sign-in screen (.gate) keeps its original look. */
:root {
  --night: #0a1815; --deep: #11221d; --panel: #1c2a20; --line: #22392f;
  --olive: #2f9e88; --gold: #EBA51F; --text: #e9f1ed; --dim: #93aaa1; --danger: #e5484d;
  --gutter: clamp(16px, 4vw, 56px);
  font-family: "Cairo", "Segoe UI", Tahoma, system-ui, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--night); color: var(--text); font-size: 16px; line-height: 1.6; -webkit-tap-highlight-color: transparent; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
.num { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }
:focus { outline: none; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }

/* ── top bar ── */
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: clamp(8px, 2vw, 28px); padding: 14px var(--gutter); background: rgba(12,23,20,.92); backdrop-filter: blur(8px); }
.mark { font-weight: 700; font-size: 22px; letter-spacing: -.5px; white-space: nowrap; }
.mark span { color: var(--gold); }
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; margin-inline-end: auto; }
.tabs a { padding: 6px 14px; border-radius: 99px; color: var(--dim); white-space: nowrap; }
.tabs a.on { color: var(--night); background: var(--text); font-weight: 500; }
.tabs a:hover:not(.on) { color: var(--text); }
.who { border: 1px solid var(--line); background: none; border-radius: 99px; padding: 5px 14px; white-space: nowrap; }

main { padding: 8px 0 80px; min-height: 80vh; }
.wrap { padding: 0 var(--gutter); }
h1 { font-size: clamp(24px, 3.4vw, 40px); font-weight: 600; line-height: 1.25; margin: 18px 0 14px; }
h2 { font-size: 19px; font-weight: 500; margin: 26px var(--gutter) 10px; }
.note { color: var(--dim); }

/* ── hero ── */
.hero { position: relative; min-height: min(62vh, 560px); display: flex; align-items: flex-end; padding: 40px var(--gutter); background: var(--deep) center / cover no-repeat; }
.hero.bare { min-height: 0; padding-top: 56px; }
.hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, var(--night) 4%, rgba(12,23,20,.55) 45%, rgba(12,23,20,.15)); }
.hero > div { position: relative; z-index: 1; max-width: 620px; }
.hero h1 { font-size: clamp(30px, 5vw, 60px); font-weight: 700; margin: 0 0 8px; }
.hero p { margin: 0 0 18px; color: #D5DFDC; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.meta { display: flex; gap: 14px; color: var(--dim); font-size: 14.5px; margin-bottom: 10px; flex-wrap: wrap; }
.btns { display: flex; gap: 10px; flex-wrap: wrap; }
.btn { border: 0; border-radius: 10px; padding: 11px 26px; background: var(--panel); font-weight: 500; }
.btn.play { background: var(--text); color: var(--night); }
.btn.on { background: var(--olive); }
.btn.line { background: none; border: 1px solid var(--line); }
.btn:disabled { opacity: .5; }

/* ── rails ── */
.rail { display: flex; gap: 12px; overflow-x: auto; padding: 6px var(--gutter) 14px; scroll-snap-type: x proximity; scrollbar-width: none; }
.rail::-webkit-scrollbar, .tabs::-webkit-scrollbar { display: none; }
.rail > * { scroll-snap-align: start; flex: none; }
.grid { display: grid; gap: 14px; padding: 6px var(--gutter); grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.grid.channels { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }

/* A channel is known by its number: the number is the tile. */
.ch { position: relative; width: 210px; aspect-ratio: 16 / 9; border-radius: 12px; background: var(--deep); border: 1px solid var(--line); padding: 12px 14px; text-align: start; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; }
.grid .ch { width: auto; }
.ch .n { position: absolute; top: 2px; inset-inline-end: 12px; font-size: 64px; font-weight: 700; line-height: 1; color: var(--line); direction: ltr; }
.ch img { position: absolute; top: 12px; inset-inline-start: 12px; width: 46px; height: 46px; object-fit: contain; border-radius: 8px; background: rgba(255,255,255,.06); }
.ch b { position: relative; font-weight: 500; font-size: 16.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch small { position: relative; color: var(--dim); }
.ch:hover, .ch:focus-visible { background: var(--panel); border-color: var(--gold); }
.ch:focus-visible .n, .ch:hover .n { color: var(--gold); }

.poster { width: 158px; background: none; border: 0; padding: 0; text-align: start; }
.grid .poster { width: auto; }
.poster .art { aspect-ratio: 2 / 3; border-radius: 10px; background: var(--panel) center / cover no-repeat; display: grid; place-items: center; overflow: hidden; position: relative; border: 2px solid transparent; }
.poster .art span { font-size: 56px; font-weight: 700; color: var(--line); }
.poster:hover .art, .poster:focus-visible .art { border-color: var(--gold); }
.poster:focus-visible { outline: none; }
.poster .bar { position: absolute; inset: auto 0 0 0; height: 4px; background: rgba(255,255,255,.2); }
.poster .bar i { display: block; height: 100%; background: var(--gold); }
.poster b { display: block; margin-top: 7px; font-weight: 400; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.poster small { color: var(--dim); font-size: 13px; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px var(--gutter) 12px; scrollbar-width: none; }
.chips button { border: 1px solid var(--line); background: none; border-radius: 99px; padding: 5px 16px; white-space: nowrap; color: var(--dim); }
.chips button.on { background: var(--olive); border-color: var(--olive); color: #fff; }

/* ── detail ── */
.episodes { padding: 0 var(--gutter); display: grid; gap: 8px; max-width: 900px; }
.ep { display: grid; grid-template-columns: 44px 1fr auto; gap: 12px; align-items: center; background: var(--deep); border: 1px solid transparent; border-radius: 10px; padding: 12px 16px; text-align: start; width: 100%; position: relative; overflow: hidden; }
.ep:hover, .ep:focus-visible { border-color: var(--gold); background: var(--panel); }
.ep .k { font-size: 22px; font-weight: 600; color: var(--dim); }
.ep i { position: absolute; inset: auto 0 0 0; height: 3px; background: var(--gold); transform-origin: right; }

/* ── forms / login ── */
.gate { --night: #0C1714; --deep: #12231F; --panel: #1A322C; --line: #2A4A42; --olive: #31695C; --gold: #D79C38; --text: #EEF3F1; --dim: #9DB3AD;
  font-family: "Readex Pro", "Noto Kufi Arabic", "Segoe UI", Tahoma, sans-serif; background: var(--night); color: var(--text); min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.gate form { width: min(380px, 100%); display: grid; gap: 14px; }
.gate .mark { font-size: 44px; }
.gate p { margin: -8px 0 8px; color: var(--dim); }
label { display: grid; gap: 5px; color: var(--dim); font-size: 14px; }
input { background: var(--deep); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; font-size: 16px; color: var(--text); width: 100%; }
input:focus { border-color: var(--gold); }
.err { color: var(--danger); min-height: 1.6em; }
.profiles { display: flex; gap: 22px; flex-wrap: wrap; justify-content: center; }
.profile { background: none; border: 0; display: grid; gap: 8px; justify-items: center; }
.profile div { width: 112px; height: 112px; border-radius: 22px; background: var(--olive); display: grid; place-items: center; font-size: 46px; font-weight: 600; border: 3px solid transparent; }
.profile.kids div { background: var(--gold); color: var(--night); }
.profile:hover div, .profile:focus-visible div { border-color: var(--text); }
.profile:focus-visible { outline: none; }
.box { background: var(--deep); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; max-width: 560px; margin: 0 var(--gutter) 16px; }
.box dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 18px; margin: 0; }
.box dt { color: var(--dim); } .box dd { margin: 0; }
.empty { padding: 12vh var(--gutter); text-align: center; color: var(--dim); }

/* ── player ── */
#player { position: fixed; inset: 0; z-index: 30; background: #000; }
#player video { width: 100%; height: 100%; background: #000; }
#player .bar { position: absolute; top: 0; inset-inline: 0; display: flex; align-items: center; gap: 14px; padding: 16px clamp(14px, 3vw, 36px); background: linear-gradient(rgba(0,0,0,.75), transparent); transition: opacity .25s; }
#player.idle .bar { opacity: 0; pointer-events: none; }
#player.idle { cursor: none; }
#player .bar b { font-size: 19px; font-weight: 500; }
#player .bar .n { color: var(--gold); font-weight: 700; font-size: 26px; }
#player .back { background: rgba(255,255,255,.14); border: 0; border-radius: 99px; padding: 8px 18px; }
#player .msg { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 24px; background: rgba(0,0,0,.78); font-size: 19px; }
#player .msg div { max-width: 460px; display: grid; gap: 16px; justify-items: center; }
#player .hint { margin-inline-start: auto; color: var(--dim); font-size: 14px; }

#toasts { position: fixed; bottom: 22px; inset-inline: 0; display: grid; justify-items: center; gap: 8px; z-index: 50; pointer-events: none; }
.toast { background: var(--text); color: var(--night); padding: 9px 20px; border-radius: 99px; }

@media (max-width: 640px) {
  .ch { width: 168px; aspect-ratio: 4 / 3; } .ch .n { font-size: 44px; }
  .poster { width: 122px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
  .grid.channels { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .top { flex-wrap: wrap; row-gap: 8px; }
  .tabs { order: 3; width: 100%; }
  .who { margin-inline-start: auto; }
  #player .hint { display: none; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; } }
