/* Shoof car client (P2.3). Logical properties (inline-start and -end)
   so the layout mirrors between Arabic (right to left) and English. */
*{margin:0;padding:0;box-sizing:border-box;-webkit-tap-highlight-color:transparent}
[hidden]{display:none !important}
/* Spacing scale (docs/UI-SPACING-PLAN.md): 8 px between sibling controls and
   from a hint to its control, 12 or 16 px between blocks, 24 px or more
   between groups. Controls are 48 px high (--tap), never below 44 (--tap-min). */
:root{--sp-1:4px;--sp-2:8px;--sp-3:12px;--sp-4:16px;--sp-5:24px;--sp-6:32px;--tap:48px;--tap-min:44px}
/* A fixed line height: with `normal`, Arabic lines took the taller line
   height of the fallback font, so the two languages had different gaps. */
body{font-family:'Segoe UI',Tahoma,Roboto,Arial,sans-serif;background:#0f0f0f;color:#f1f1f1;font-size:15px;line-height:1.5;min-height:100vh}
button,input,select{font:inherit;color:inherit}
button{cursor:pointer}
.pw-h,.set h2,.sechead .name,.signin h2{line-height:1.4}

/* Header */
.hdr{position:sticky;top:0;z-index:50;display:flex;align-items:center;gap:10px;padding:10px 12px;background:#0f0f0f;border-bottom:1px solid #272727}
.logo{display:flex;align-items:center;gap:6px;font-weight:700;font-size:1.1rem;white-space:nowrap;background:none;border:none;min-height:44px}
.logo .play{width:26px;height:18px;background:#f00;border-radius:4px;display:flex;align-items:center;justify-content:center}
.logo .play:after{content:'';border-inline-start:7px solid #fff;border-top:4.5px solid transparent;border-bottom:4.5px solid transparent}
[dir=rtl] .logo .play:after{border-inline-start:none;border-inline-end:7px solid #fff}
.sbox{flex:1;display:flex;min-width:0;max-width:420px}
.sbox input{flex:1;min-width:0;height:44px;padding:0 14px;background:#2a2a2a;border:1px solid #4d4d4d;border-start-start-radius:22px;border-end-start-radius:22px;border-inline-end:none;color:#f1f1f1}
.sbox input::placeholder{color:#9a9a9a}
.sbox input:focus{outline:none;border-color:#1c62b9;background:#303030}
.sbox button{height:44px;padding:0 16px;background:#3a3a3a;border:1px solid #4d4d4d;border-start-end-radius:22px;border-end-end-radius:22px}
.hbtn{height:44px;padding:0 14px;background:#272727;border:1px solid #3a3a3a;border-radius:22px;font-size:.88rem;white-space:nowrap;flex-shrink:0}
.hbtn:active,.sbox button:active{opacity:.7}
#account{margin-inline-start:auto}

/* Tabs and chips */
.tabs{display:flex;gap:8px;padding:8px 12px;overflow-x:auto;white-space:nowrap;border-bottom:1px solid #1f1f1f}
.tab{padding:0 18px;height:var(--tap);background:#272727;border-radius:8px;font-size:.88rem;font-weight:500;flex-shrink:0;border:none}
.tab.act{background:#f1f1f1;color:#0f0f0f}
.chips{display:flex;gap:8px;padding:10px 12px 2px;overflow-x:auto;white-space:nowrap}
.chip{height:var(--tap-min);padding:0 16px;background:#1f1f1f;border:1px solid #303030;border-radius:20px;font-size:.85rem;flex-shrink:0}
.chip.on{background:#f1f1f1;color:#0f0f0f;font-weight:600}
.tab:active,.chip:active{opacity:.7}

/* Grid */
.grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(300px,1fr));gap:16px 12px;padding:14px 12px 30px}
.card{cursor:pointer;background:none;border:none;text-align:start;display:block;width:100%}
.card:active{opacity:.7}
.thumb{position:relative;width:100%;aspect-ratio:16/9;background:#1c1c1c;border-radius:10px;overflow:hidden}
.thumb img{width:100%;height:100%;object-fit:cover;display:block}
.thumb img.broken{visibility:hidden}
.dur{position:absolute;inset-inline-end:6px;bottom:6px;background:rgba(0,0,0,.85);padding:2px 6px;border-radius:4px;font-size:.8rem;font-weight:600;direction:ltr}
.dur.live{background:#f00}
.pbar{position:absolute;left:0;right:0;bottom:0;height:4px;background:rgba(255,255,255,.3)}
.pbar div{height:100%;background:#f00;width:0}
.meta{padding:9px 2px 0}
.vtitle{font-size:.92rem;font-weight:500;line-height:1.45;max-height:2.9em;overflow:hidden;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}
.vsub{font-size:.875rem;color:#aaa;margin-top:4px}
.vsub .ch{cursor:pointer}

.sechead{display:flex;align-items:center;gap:10px;padding:12px 12px 0}
.sechead .name{font-size:1.05rem;font-weight:700;flex:1}
.bbtn{min-height:var(--tap);padding:0 18px;background:#272727;border:none;border-radius:8px;font-size:.9rem;text-decoration:none;display:inline-flex;align-items:center;justify-content:center}
.bbtn:active{opacity:.7}
.bbtn.red{background:#c00;color:#fff}
/* Plus checkout closed (server/billing/checkout.js): "Coming soon" */
.bbtn.soon,.pw-btn.soon{background:#272727;color:#ddd;border:1px dashed #666;cursor:default;opacity:1}
.bbtn.soon:active,.pw-btn.soon:active{opacity:1}

.msg{padding:30px 20px;text-align:center;color:#999;font-size:.92rem;line-height:1.6}
.spin{margin:34px auto;width:28px;height:28px;border:3px solid #303030;border-top-color:#f00;border-radius:50%;animation:sp 1s linear infinite}
@keyframes sp{to{transform:rotate(360deg)}}

/* Forms, account and settings */
.setup{max-width:600px;margin:14px auto;padding:0 14px;display:flex;flex-direction:column;gap:12px}
.note{color:#aaa;font-size:.88rem;line-height:1.6}
.note.red{color:#f66}
.sinp{min-height:44px;padding:0 14px;background:#121212;border:1px solid #303030;border-radius:8px}
.sinp:focus{outline:none;border-color:#1c62b9}
.sta{min-height:150px;padding:10px;background:#121212;border:1px solid #303030;border-radius:8px;font-size:.72rem;font-family:monospace;direction:ltr}
.account{display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;padding:44px 24px;min-height:58vh}
.acc-link{color:#8ac0ff;text-decoration:none;font-size:.92rem;margin-top:18px}
.pw-emoji{font-size:2.6rem;margin-bottom:12px}
.pw-h{font-size:1.35rem;font-weight:800;margin-bottom:8px}
.pw-p{color:#bbb;font-size:1.02rem;margin-bottom:22px;max-width:380px;line-height:1.6}
.pw-btn{background:#e63946;color:#fff;text-decoration:none;font-weight:800;font-size:1.1rem;padding:15px 34px;border-radius:13px}
.pw-btn:active{opacity:.85}
.pw-sub{color:#888;font-size:.85rem;margin-top:16px}
.set{max-width:640px;margin:10px auto 30px;padding:0 14px}
.set h2{font-size:1rem;margin:28px 0 10px;color:#ddd}
.set .row,.setup .row{display:flex;flex-wrap:wrap;gap:var(--sp-2)}
.opt{min-height:var(--tap);padding:0 18px;display:inline-flex;align-items:center;justify-content:center;gap:var(--sp-2);background:#1f1f1f;border:1px solid #303030;border-radius:22px;font-size:.88rem}
.opt.on{background:#f1f1f1;color:#0f0f0f;font-weight:600}
.opt[disabled]{opacity:1;color:#777;border-color:#262626}
.hint{color:#888;font-size:.875rem;margin-top:var(--sp-2);line-height:1.6}
.set a.bbtn{color:#f1f1f1}

/* Player */
.pl{position:fixed;inset:0;z-index:100;background:#000;display:flex;flex-direction:column}
.pl-top{display:flex;align-items:center;gap:10px;padding:8px 12px;background:#0a0a0a}
.pl-title{flex:1;font-size:.9rem;font-weight:500;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.pl-stat{font-size:.78rem;color:#9f9;white-space:nowrap}
.pbtn{min-height:var(--tap);padding:0 16px;background:#272727;border:1px solid #3a3a3a;border-radius:8px;color:#eee;font-size:.85rem;white-space:nowrap}
.pbtn:active{opacity:.6}
.stage{flex:1;position:relative;min-height:0;cursor:pointer;background:#000;overflow:hidden}
.stage canvas{position:absolute;inset:0;width:100%;height:100%;object-fit:contain;display:block}
.poster{position:absolute;inset:0;width:100%;height:100%;object-fit:contain;filter:brightness(.55)}
.pp{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:80px;height:80px;border-radius:50%;background:rgba(0,0,0,.65);border:2px solid rgba(255,255,255,.5);display:none;align-items:center;justify-content:center;font-size:2rem;pointer-events:none;z-index:4}
.pp.show{display:flex}
.pp.fade{display:flex;animation:ppfade .7s forwards}
@keyframes ppfade{0%{opacity:1}70%{opacity:1}100%{opacity:0}}
.pl-msg{position:absolute;inset:auto 0 18px 0;margin:0 auto;width:max-content;max-width:90%;background:rgba(0,0,0,.78);padding:10px 16px;border-radius:10px;font-size:.95rem;text-align:center;z-index:5;pointer-events:none}
.paywall{position:absolute;inset:0;background:rgba(10,10,15,.97);display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;padding:24px;z-index:6;cursor:default}
.pl-bar{display:flex;gap:10px;align-items:center;padding:8px 12px;background:#0a0a0a}
/* Media controls follow the direction of time, so they stay left to right in Arabic too. */
.pl-bar{direction:ltr}
.sprite{position:absolute;width:0;height:0;overflow:hidden}
.ic{width:24px;height:24px;fill:currentColor;display:block;flex-shrink:0}
.cbtn{width:48px;height:48px;min-width:48px;display:inline-flex;align-items:center;justify-content:center;padding:0;background:#272727;border:1px solid #3a3a3a;border-radius:10px;color:#fff}
.cbtn .ic{width:26px;height:26px}
.cbtn:active{opacity:.6}
.cbtn[disabled]{opacity:.35}
.pl.live #btnB10,.pl.live #btnF10{display:none}
.pp .ic{width:40px;height:40px;fill:#fff}
.skipfx{position:absolute;top:0;bottom:0;width:34%;display:none;flex-direction:column;align-items:center;justify-content:center;gap:8px;background:rgba(0,0,0,.42);color:#fff;font-weight:700;font-size:1.05rem;text-shadow:0 1px 3px rgba(0,0,0,.85);pointer-events:none;z-index:4}
.skipfx .ic{width:44px;height:44px;filter:drop-shadow(0 1px 3px rgba(0,0,0,.85))}
.skipfx.left{left:0;border-radius:0 50% 50% 0/0 50% 50% 0}
.skipfx.right{right:0;border-radius:50% 0 0 50%/50% 0 0 50%}
.skipfx.show{display:flex}
.lbl{color:#aaa;font-size:.875rem;font-variant-numeric:tabular-nums;white-space:nowrap;direction:ltr}
.tl{flex:1;height:48px;display:flex;align-items:center;cursor:pointer;position:relative;min-width:0;touch-action:none;direction:ltr}
.tl-track{position:relative;width:100%;height:6px;background:#3a3a3a;border-radius:3px}
.tl-buf{position:absolute;left:0;top:0;bottom:0;width:0;background:#666;border-radius:3px}
.tl-fill{position:absolute;left:0;top:0;bottom:0;width:0;background:#f00;border-radius:3px}
.tl-dot{position:absolute;top:50%;left:0;width:16px;height:16px;background:#f00;border-radius:50%;transform:translate(-50%,-50%);box-shadow:0 0 4px rgba(0,0,0,.6)}
.tl.noseek{cursor:default;opacity:.35}
.tl.drag .tl-dot{width:22px;height:22px}
/* The range input is 44 px high for the finger; Chrome keeps the thin track. */
.vol{width:110px;height:var(--tap-min);accent-color:#f33}
.qwrap{position:relative}
/* The bar is always left to right, so the quality button is always at the
   right: the menu opens from the right edge (physical right). Its rows and
   the button label follow the language. */
.qmenu{position:absolute;bottom:56px;right:0;background:#1b1b1b;border:1px solid #333;border-radius:10px;padding:var(--sp-2);display:flex;flex-direction:column;gap:var(--sp-1);min-width:200px;width:max-content;max-width:min(320px,80vw);z-index:10}
[dir=rtl] .qmenu,[dir=rtl] #btnQ{direction:rtl}
.qmenu button{display:flex;align-items:center;justify-content:space-between;gap:var(--sp-3);width:100%;min-height:var(--tap);padding:0 14px;background:none;border:none;border-radius:8px;text-align:start;font-size:.9rem;white-space:nowrap}
.qmenu button.on{background:#333;font-weight:700}
.qmenu button[disabled]{opacity:1;color:#777}
.qmenu .qhead{font-size:.8125rem;color:#999;padding:10px 14px 4px;border-top:1px solid #333;margin-top:var(--sp-1)}
/* The Plus label of a locked quality (menu and Settings). The parent's gap
   places it, so it is correct in both directions. */
.plus-tag{display:inline-flex;align-items:center;height:22px;padding:0 8px;border:1px solid #666;border-radius:11px;color:#ccc;font-size:.8rem;font-weight:600;line-height:1;white-space:nowrap}
/* Live TV tab (P4.2) */
.tv-note{color:#999;font-size:.85rem;padding:4px 12px 0}
.tv-thumb{background:linear-gradient(135deg,#2a1a1a,#151515)}
.tv-name-over{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;padding:10px;text-align:center;font-weight:700;font-size:1.05rem;color:#ddd;z-index:0}
.tv-thumb img{position:relative;z-index:1}
.tv-thumb .dur{z-index:2}

/* Live streams (P4.1): a badge instead of the seek bar */
.live-badge{display:inline-flex;align-items:center;gap:6px;background:#c00;color:#fff;font-weight:700;font-size:.8rem;padding:4px 10px;border-radius:6px;white-space:nowrap}
.live-badge:before{content:'';width:8px;height:8px;border-radius:50%;background:#fff;animation:livedot 1.6s ease-in-out infinite}
@keyframes livedot{50%{opacity:.25}}
.pl.live .tl{visibility:hidden}
.pl.live #tCur,.pl.live #tDur{display:none}
.toast{position:fixed;bottom:84px;left:50%;transform:translateX(-50%);background:#222;border:1px solid #444;padding:10px 18px;border-radius:10px;z-index:200;font-size:.9rem;max-width:90%}

@media (max-width:640px){
  .hdr{flex-wrap:wrap}
  .sbox{order:3;max-width:none;flex-basis:100%}
  .vol{display:none}
}

/* P3: accounts, feeds and the player's account buttons */
.sbox{position:relative}
.sugg{position:absolute;top:48px;inset-inline-start:0;inset-inline-end:0;background:#1b1b1b;border:1px solid #333;border-radius:12px;padding:6px;z-index:60;display:flex;flex-direction:column}
.sugg .sg{min-height:var(--tap);padding:0 14px;background:none;border:none;border-radius:8px;text-align:start;font-size:.95rem}
.sugg .sg:active{background:#333}
.pl-acts{display:flex;gap:6px;flex-shrink:0}
.pbtn.act.on{background:#f1f1f1;color:#0f0f0f;border-color:#f1f1f1}
.pbtn.act[hidden]{display:none}
.cta{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin:10px 12px 0;padding:10px 14px;background:#1a1a22;border:1px solid #2c2c3a;border-radius:12px;color:#ccc;font-size:.9rem}
.note-src{color:#888;font-size:.875rem;padding:10px 14px 0}
.more{display:flex;justify-content:center;padding:6px 0 26px}
.msg.small{padding:4px 20px 26px;font-size:.875rem}
.spin.inline{display:inline-block;margin:0;width:16px;height:16px;border-width:2px;vertical-align:middle}
.signin{max-width:900px;margin:22px auto;padding:0 16px;display:flex;gap:32px;align-items:center;flex-wrap:wrap;justify-content:center}
.signin.notice{flex-direction:column;align-items:stretch;max-width:680px;gap:var(--sp-4)}
.signin h2{font-size:1.4rem;margin-bottom:12px}
.signin.notice h2{margin-bottom:0}
.signin .facts{margin:0;padding-inline-start:22px;line-height:1.7;color:#ddd;display:flex;flex-direction:column;gap:8px}
.signin .row{display:flex;gap:10px;flex-wrap:wrap;margin-top:var(--sp-2)}
.signin .qr{width:260px;height:260px;background:#fff;border-radius:16px;padding:10px;flex-shrink:0;display:flex;align-items:center;justify-content:center}
.signin .qr svg{width:100%;height:100%;display:block}
.signin .qr .msg{color:#333;padding:10px}
.signin .steps{flex:1;min-width:280px}
.signin ol{margin:0 0 12px;padding-inline-start:22px;line-height:1.7;color:#ddd}
.signin .code{font:700 2.2rem/1.2 ui-monospace,monospace;letter-spacing:4px;margin:6px 0 14px;color:#fff;text-align:start}
.signin .st{color:#aaa;min-height:1.4em;line-height:1.6}
.signin .st.ok{color:#3ecf6e}
.signin .st.bad{color:#ff6b6b}
/* 48 px link boxes; the negative margin keeps the first word on the text edge. */
.legal{margin-top:var(--sp-1);margin-inline-start:-4px;font-size:.85rem;color:#888}
.legal a{color:#8ac0ff;text-decoration:none;display:inline-block;padding:14px 4px}
.plus-box{margin:18px 0 6px;padding:20px;border:1px solid #333;border-radius:14px;max-width:440px;display:flex;flex-direction:column;align-items:center;gap:var(--sp-3)}
.plus-box .pw-p{margin-bottom:0}
.plus-box .hint{margin-top:0;text-align:center}
.account .acc-link{margin-top:var(--sp-4)}
#accBack,#nsBack,#siBack{margin-top:var(--sp-3)}
.pw-h.small{font-size:1.1rem;margin-bottom:0}
.paywall .bbtn{margin-top:4px}
.paywall .pw-btn{margin-bottom:14px;border:none;cursor:pointer}
.acct-set .who{display:flex;align-items:center;gap:12px;margin:6px 0 10px}
.acct-set .avatar{width:48px;height:48px;border-radius:50%;object-fit:cover;background:#222}
.acct-set .who .name{font-weight:700;font-size:1rem}
.acct-set .who .sub{color:#999;font-size:.875rem}
.acct-set .kv{display:flex;gap:10px;align-items:center;font-size:.9rem}
.acct-set .kv b{font-family:ui-monospace,monospace;font-size:1.05rem;letter-spacing:1px}
.acct-set .row{display:flex;flex-wrap:wrap;gap:8px;margin-top:6px}
.acct-set .ctl{margin:var(--sp-4) 0}
.acct-set .devs{margin:0;padding-inline-start:20px;line-height:1.7}
.hint.ok{color:#5fd68a}
select.sinp{width:100%;max-width:360px;color:#f1f1f1}
.bbtn.hold{position:relative;overflow:hidden;min-width:220px}
.bbtn.hold .hold-fill{position:absolute;inset-block:0;inset-inline-start:0;width:0;background:rgba(255,255,255,.25)}
.bbtn.hold .hold-label{position:relative}
.pair{display:flex;gap:14px;align-items:center;flex-wrap:wrap;margin-top:10px}
.pair .qr.small{width:200px;height:200px;background:#fff;border-radius:12px;padding:8px}
.pair .qr.small svg{width:100%;height:100%;display:block}
/* The text beside the QR code (help, phone pairing), not under it. */
.pair > div:last-child,.pair > .hint{flex:1;min-width:240px}
.pair .hint{margin-top:0}
.set .hint + .bbtn{margin-top:10px}
@media (max-width:640px){
  .pl-acts .act{padding:0 10px}
  .signin .qr{width:220px;height:220px}
}
[dir=rtl] .signin .code{text-align:right}
.acct-set .avatar.broken{visibility:hidden}
/* P4.6: a link to the message's answer on the help page (the message box ignores taps, the link does not) */
.pl-msg .help-link{pointer-events:auto;display:inline-flex;align-items:center;min-height:var(--tap-min);padding:0 12px;margin-top:var(--sp-1);color:#9cc3ff;text-decoration:underline;font-size:.9rem}
