:root{
  --bg:#fff;--surface:#fff;--surface-2:#f2f2f2;--surface-3:#e5e5e5;--text:#0f0f0f;--muted:#606060;--line:#e5e5e5;--accent:#ff0033;--accent-soft:#ffe9ee;--hover:#f2f2f2;--sidebar-w:240px;--header-h:64px;--radius:12px;--container:1900px;--shadow:0 2px 10px rgba(0,0,0,.06)
}
html[data-theme="dark"]{--bg:#0f0f0f;--surface:#0f0f0f;--surface-2:#272727;--surface-3:#3f3f3f;--text:#f1f1f1;--muted:#aaa;--line:#3f3f3f;--accent:#ff0033;--accent-soft:#3a1219;--hover:#272727;--shadow:0 2px 12px rgba(0,0,0,.35)}
*{box-sizing:border-box}html{scroll-behavior:smooth}body{margin:0;background:var(--bg);color:var(--text);font:400 14px/1.5 Roboto,Arial,Helvetica,sans-serif}body,button,input,textarea,select{font-family:Roboto,Arial,Helvetica,sans-serif}a{color:inherit}button{border:0}.material-icon{font-size:22px;line-height:1;display:inline-flex;align-items:center;justify-content:center}.skip{position:absolute;left:-9999px}.skip:focus{left:10px;top:10px;z-index:1000;padding:10px;background:var(--surface);border:1px solid var(--line);border-radius:8px}
/* top bar */
.yt-header{position:fixed;top:0;left:0;right:0;height:var(--header-h);z-index:100;background:var(--surface);border-bottom:1px solid var(--line)}.yt-header-inner{height:100%;display:grid;grid-template-columns:var(--sidebar-w) minmax(260px,1fr) auto;align-items:center;gap:20px;padding:0 18px}.brand-wrap{display:flex;align-items:center;gap:12px}.menu-btn,.header-icon{width:40px;height:40px;border-radius:50%;background:transparent;color:var(--text);cursor:pointer}.menu-btn:hover,.header-icon:hover{background:var(--hover)}.brand{display:inline-flex;align-items:center;gap:8px;text-decoration:none;font-weight:800;font-size:20px;letter-spacing:-.5px}.brand-mark{width:34px;height:24px;border-radius:8px;background:var(--accent);display:grid;place-items:center;color:#fff;font-size:12px;position:relative}.brand-mark:after{content:"";border-left:8px solid #fff;border-top:5px solid transparent;border-bottom:5px solid transparent;margin-left:2px}.brand-country{font-size:10px;color:var(--muted);align-self:flex-start;margin-top:4px}.header-search{display:flex;align-items:center;max-width:760px;width:min(760px,100%);justify-self:center}.header-search input{flex:1;height:40px;border:1px solid var(--line);border-radius:20px 0 0 20px;padding:0 18px;background:var(--bg);color:var(--text);outline:none}.header-search input:focus{border-color:#1c62b9;box-shadow:inset 1px 0 0 #1c62b9,0 0 0 1px #1c62b9}.header-search button{width:64px;height:40px;border:1px solid var(--line);border-left:0;border-radius:0 20px 20px 0;background:var(--surface-2);color:var(--text);cursor:pointer}.header-actions{display:flex;align-items:center;gap:4px}.create-btn{display:inline-flex;align-items:center;gap:7px;height:40px;padding:0 14px;background:var(--surface-2);border-radius:20px;text-decoration:none;font-weight:600}.create-btn:hover{background:var(--surface-3)}.header-avatar{width:34px;height:34px;border-radius:50%;object-fit:cover;background:var(--surface-2)}
/* sidebar */
.yt-sidebar{position:fixed;top:var(--header-h);bottom:0;width:var(--sidebar-w);padding:12px 10px;overflow-y:auto;background:var(--surface);border-inline-end:1px solid var(--line);z-index:90}.side-section{padding:8px 0 12px;border-bottom:1px solid var(--line);margin-bottom:8px}.side-item{display:flex;align-items:center;gap:20px;min-height:44px;padding:0 12px;border-radius:10px;text-decoration:none;color:var(--text);font-size:14px}.side-item:hover{background:var(--hover)}.side-item.active{background:var(--surface-2);font-weight:700}.side-item .material-icon{width:22px}.side-title{font-size:12px;color:var(--muted);padding:10px 12px 6px;font-weight:700}.side-footer{padding:14px 12px 26px;color:var(--muted);font-size:11px;line-height:1.8}.side-footer a{text-decoration:none}.side-lang{display:flex;flex-wrap:wrap;gap:8px}.side-mobile-backdrop{display:none}
/* content */
.site-main{margin-top:var(--header-h);margin-inline-start:var(--sidebar-w);min-height:calc(100vh - var(--header-h));padding:20px 26px 52px}.content-inner{max-width:var(--container);margin:auto}.topic-row{display:flex;gap:10px;overflow:auto;padding:0 0 18px;scrollbar-width:none}.topic-row::-webkit-scrollbar{display:none}.topic-chip{white-space:nowrap;text-decoration:none;background:var(--surface-2);padding:8px 13px;border-radius:9px;font-weight:600;font-size:13px}.topic-chip:hover{background:var(--surface-3)}.topic-chip.active{background:var(--text);color:var(--bg)}
/* home */
.home-welcome{padding:22px 0 8px}.home-welcome h1{margin:0;font-size:24px}.home-welcome p{margin:5px 0 0;color:var(--muted)}.section{margin-top:30px}.section-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:16px}.section-head h2{margin:0;font-size:20px}.section-link{font-size:13px;color:var(--muted);text-decoration:none}.section-link:hover{color:var(--text)}.grid.videos{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:34px 18px}.card{min-width:0}.thumb-wrap{position:relative;display:block;aspect-ratio:16/9;border-radius:11px;overflow:hidden;background:#ddd}.thumb-wrap img{width:100%;height:100%;display:block;object-fit:cover;transition:transform .18s ease}.card:hover .thumb-wrap img{transform:scale(1.015)}.duration{position:absolute;bottom:7px;right:7px;background:rgba(0,0,0,.82);color:#fff;border-radius:4px;padding:2px 5px;font-size:11px;font-weight:700}.card-body{display:grid;grid-template-columns:38px minmax(0,1fr);gap:11px;padding-top:11px}.channel-avatar{width:36px;height:36px;border-radius:50%;object-fit:cover;background:var(--surface-2)}.title{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;text-decoration:none;font-weight:700;line-height:1.35;font-size:15px}.channel{display:block;margin-top:5px;color:var(--muted);text-decoration:none;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:13px}.meta{margin-top:2px;color:var(--muted);font-size:12px}
/* watch */
.watch-layout{display:grid;grid-template-columns:minmax(0,1fr) 390px;gap:22px;align-items:start}.player{aspect-ratio:16/9;background:#000;border-radius:12px;overflow:hidden}.player iframe{width:100%;height:100%;border:0}.video-title{margin:14px 0 6px;font-size:20px;line-height:1.35}.video-meta{display:flex;gap:14px;flex-wrap:wrap;color:var(--muted);font-size:13px}.channel-row{display:flex;align-items:center;gap:12px;margin-top:12px;padding:12px 0;border-bottom:1px solid var(--line)}.channel-info{min-width:0}.channel-name{font-weight:700;text-decoration:none}.channel-handle{color:var(--muted);font-size:12px}.subscribe{margin-inline-start:auto;background:var(--text);color:var(--bg);border-radius:20px;padding:9px 16px;font-weight:700;cursor:pointer}.subscribe.subscribed{background:var(--surface-2);color:var(--text)}.actions{display:flex;flex-wrap:wrap;gap:8px;padding:14px 0}.pill{display:inline-flex;align-items:center;gap:7px;background:var(--surface-2);color:var(--text);padding:9px 13px;border-radius:20px;cursor:pointer}.pill:hover{background:var(--surface-3)}.pill.active{font-weight:700}.description{border-radius:12px;background:var(--surface-2);padding:14px;margin-top:6px}.description summary{cursor:pointer;font-weight:700}.comments{margin-top:24px}.comments-head{display:flex;justify-content:space-between;align-items:center}.comments h2{margin:0 0 12px;font-size:18px}.comments textarea{width:100%;min-height:92px;resize:vertical;border:1px solid var(--line);background:var(--bg);color:var(--text);border-radius:10px;padding:12px}.primary{margin-top:9px;background:var(--text);color:var(--bg);padding:9px 15px;border-radius:20px;font-weight:700}.comment{display:flex;gap:10px;padding:14px 0;border-top:1px solid var(--line)}.comment small{color:var(--muted)}.side-title{font-weight:700;font-size:17px;margin:0 0 12px}.side-videos{display:flex;flex-direction:column;gap:13px}.side-card{display:grid;grid-template-columns:155px 1fr;gap:10px}.side-card img{width:155px;aspect-ratio:16/9;object-fit:cover;border-radius:8px;background:var(--surface-2)}.side-card a{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;text-decoration:none;font-weight:700;font-size:13px;line-height:1.35}.side-card small{display:block;color:var(--muted);margin-top:4px}
/* channel */
.channel-cover{height:250px;border-radius:12px;background-size:cover;background-position:center;background-color:var(--surface-2)}.channel-profile{display:flex;align-items:center;gap:16px;padding:18px 2px 15px}.channel-avatar-lg{width:90px;height:90px;border-radius:50%;object-fit:cover;background:var(--surface-2)}.channel-profile h1{font-size:24px;margin:0}.channel-profile p{margin:4px 0 0;color:var(--muted)}.channel-desc{max-width:900px;color:var(--muted);margin:0 0 22px}
/* auth */
.auth-shell{min-height:calc(100vh - 200px);display:grid;place-items:center}.auth-box{width:min(440px,100%);padding:30px;border:1px solid var(--line);border-radius:14px;background:var(--surface)}.auth-box h1{margin:0 0 7px;font-size:28px}.auth-box .muted{color:var(--muted)}.auth-box label{display:block;font-weight:700;margin-top:16px}.auth-box input{width:100%;height:44px;margin-top:7px;border:1px solid var(--line);border-radius:8px;background:var(--bg);color:var(--text);padding:0 12px}.auth-box .primary{width:100%;margin-top:18px;cursor:pointer}.alert{padding:12px 14px;border-radius:10px;margin-bottom:16px;border:1px solid var(--line)}.alert.error{background:var(--accent-soft)}.alert.success{background:#e9f8ef;color:#135b2c}.empty{padding:54px 20px;text-align:center;border:1px dashed var(--line);border-radius:12px;color:var(--muted)}
/* shorts */
.shorts-page{max-width:1020px;margin:auto}.shorts-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:12px}.shorts-head h1{margin:0;font-size:28px}.shorts-head p{margin:3px 0 0;color:var(--muted)}.badge{display:inline-flex;padding:4px 8px;border-radius:5px;background:var(--text);color:var(--bg);font-size:10px;font-weight:800}.shorts-feed{height:calc(100vh - 120px);overflow-y:auto;scroll-snap-type:y mandatory;padding:0 0 30px}.short-item{min-height:calc(100vh - 120px);scroll-snap-align:start;display:grid;grid-template-columns:minmax(0,450px) 320px;justify-content:center;align-items:center;gap:24px}.short-player{position:relative;width:min(100%,450px);aspect-ratio:9/16;border-radius:14px;overflow:hidden;background:#000;box-shadow:0 8px 30px rgba(0,0,0,.2)}.short-player iframe{width:100%;height:100%;border:0}.short-actions{position:absolute;right:10px;bottom:12px;display:flex;flex-direction:column;gap:8px}.short-action{display:inline-flex;align-items:center;justify-content:center;min-width:68px;padding:9px 10px;border-radius:20px;background:rgba(0,0,0,.72);color:#fff;text-decoration:none;font-weight:700;font-size:12px}.short-info{align-self:end;padding:0 0 90px}.short-channel{display:flex;align-items:center;gap:10px;margin-bottom:12px}.short-title{display:block;text-decoration:none;font-size:18px;font-weight:700;line-height:1.45}.shorts-page .avatar{width:40px;height:40px}
/* footer */
.yt-footer{margin-top:30px;border-top:1px solid var(--line);background:var(--surface);padding:28px 24px 40px}.footer-inner{max-width:var(--container);margin:auto}.footer-top{display:flex;flex-wrap:wrap;gap:20px;align-items:center;justify-content:space-between}.footer-links{display:flex;gap:18px;flex-wrap:wrap}.footer-links a,.footer-languages a{color:var(--muted);text-decoration:none}.footer-links a:hover,.footer-languages a:hover{color:var(--text)}.footer-brand{font-weight:800}.footer-languages{display:flex;flex-wrap:wrap;gap:10px 16px;margin-top:20px;padding-top:18px;border-top:1px solid var(--line)}

/* single video page: keep the global navigation hidden until the header menu is opened */
body.watch-page .yt-sidebar{transform:translateX(-260px);box-shadow:none;transition:transform .18s ease;}
body.watch-page .site-main{margin-inline-start:0;padding-left:26px;padding-right:26px;}
body.watch-page .side-mobile-backdrop{display:none;position:fixed;inset:var(--header-h) 0 0;background:rgba(0,0,0,.45);z-index:80;}
body.watch-page.sidebar-open .yt-sidebar{transform:translateX(0);box-shadow:var(--shadow);}
body.watch-page.sidebar-open .side-mobile-backdrop{display:block;}
html[dir="rtl"] body.watch-page .yt-sidebar{transform:translateX(260px);}
html[dir="rtl"] body.watch-page.sidebar-open .yt-sidebar{transform:translateX(0);}
@media(max-width:1280px){:root{--sidebar-w:225px}.grid.videos{grid-template-columns:repeat(3,minmax(0,1fr))}.yt-header-inner{grid-template-columns:var(--sidebar-w) minmax(220px,1fr) auto}.watch-layout{grid-template-columns:minmax(0,1fr) 340px}}
@media(max-width:980px){:root{--sidebar-w:0px}.yt-header-inner{grid-template-columns:auto minmax(120px,1fr) auto;padding:0 10px;gap:8px}.brand-country{display:none}.yt-sidebar{transform:translateX(calc(-1 * 250px));width:250px;transition:transform .18s ease;box-shadow:var(--shadow)}html[dir="rtl"] .yt-sidebar{transform:translateX(250px)}body.sidebar-open .yt-sidebar{transform:translateX(0)!important}.side-mobile-backdrop{display:none;position:fixed;inset:var(--header-h) 0 0;background:rgba(0,0,0,.45);z-index:80}body.sidebar-open .side-mobile-backdrop{display:block}.site-main{margin-inline-start:0;padding:18px 16px 45px}.grid.videos{grid-template-columns:repeat(2,minmax(0,1fr));gap:28px 14px}.watch-layout{grid-template-columns:1fr}.short-item{grid-template-columns:minmax(0,430px);justify-items:center}.short-info{display:none}.shorts-feed{height:calc(100vh - 105px)}.short-item{min-height:calc(100vh - 105px)}}
@media(max-width:620px){.header-search{max-width:none}.header-actions .create-btn{display:none}.header-actions .header-icon:nth-child(2){display:none}.grid.videos{grid-template-columns:1fr}.topic-row{padding-bottom:12px}.channel-cover{height:190px}.channel-profile{flex-wrap:wrap}.channel-profile .subscribe{margin-inline-start:0}.footer-top{display:block}.footer-links{margin-top:14px}.short-player{width:min(92vw,420px)}}
/* Single video polish v5 */
html,body{max-width:100%;overflow-x:hidden}
body.watch-page .site-main{margin-inline-start:0!important;width:100%;padding:22px clamp(14px,3vw,42px) 56px}
body.watch-page .content-inner{width:100%;max-width:1500px;margin:0 auto}
body.watch-page .watch-page-shell{width:100%;max-width:1280px;margin:0 auto}
body.watch-page .watch-main{width:100%;min-width:0}
body.watch-page .player{width:100%;max-width:1280px;margin:0 auto;border-radius:12px;overflow:hidden;background:#000}
body.watch-page .video-title{font-size:22px;font-weight:700;margin:16px 0 7px;overflow-wrap:anywhere}
body.watch-page .channel-row{min-height:68px;gap:12px;flex-wrap:nowrap}
body.watch-page .channel-avatar-link{display:flex;flex:0 0 48px;width:48px;height:48px}
body.watch-page .watch-channel-avatar{display:block!important;width:48px!important;height:48px!important;min-width:48px;max-width:48px;border-radius:50%;object-fit:cover;background:var(--surface-2)}
body.watch-page .channel-info{min-width:0;flex:1}
body.watch-page .channel-name{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:15px}
body.watch-page .subscribe{flex:0 0 auto;white-space:nowrap;text-decoration:none}
.watch-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap;padding:14px 0 10px}
.action-group{display:flex;align-items:center;gap:2px;background:var(--surface-2);border-radius:24px;padding:2px}
.watch-action{display:inline-flex;align-items:center;justify-content:center;gap:7px;min-height:42px;padding:0 15px;border-radius:22px;background:var(--surface-2);color:var(--text);text-decoration:none;cursor:pointer;font-weight:600;white-space:nowrap}
.action-group .watch-action{min-height:38px;padding:0 12px}
.watch-action:hover{background:var(--surface-3)}
.watch-action.active{font-weight:800}
.description{margin-top:4px}
.comments-count{color:var(--muted);font-size:13px}
.watch-related{margin-top:34px;border-top:1px solid var(--line);padding-top:24px}
.watch-related-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:28px 18px}
@media(max-width:1100px){.watch-related-grid{grid-template-columns:repeat(3,minmax(0,1fr))}}
@media(max-width:760px){body.watch-page .site-main{padding:12px 10px 42px}body.watch-page .video-title{font-size:18px}body.watch-page .channel-row{align-items:center}.watch-actions{gap:6px}.watch-action{min-height:38px;padding:0 11px}.watch-action span{font-size:12px}.watch-related-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:20px 12px}}
@media(max-width:520px){body.watch-page .channel-row{flex-wrap:wrap}.subscribe{margin-inline-start:auto}.watch-related-grid{grid-template-columns:1fr}.watch-actions{overflow:visible}.action-group{max-width:100%}.watch-action{padding:0 9px}}

.yt-download-notice{position:fixed;left:50%;bottom:24px;transform:translateX(-50%);z-index:1200;max-width:min(92vw,560px);padding:12px 16px;border-radius:10px;background:rgba(15,15,15,.94);color:#fff;text-align:center;box-shadow:0 8px 28px rgba(0,0,0,.24);font-size:13px}


/* YouTube-style watch layout v6: recommendations beside the player */
body.watch-page .watch-page-shell{max-width:1600px}
body.watch-page .watch-layout{display:grid;grid-template-columns:minmax(0,1fr) 390px;gap:24px;align-items:start}
body.watch-page .watch-main{grid-area:main;min-width:0}
body.watch-page .watch-recommendations{grid-area:side;min-width:0;padding-top:2px}
body.watch-page .watch-recommendations-head{display:flex;align-items:center;justify-content:space-between;margin:0 0 12px}
body.watch-page .watch-recommendations-head h2{font-size:18px;margin:0;font-weight:700}
html[dir="ltr"] body.watch-page .watch-layout{grid-template-areas:"main side"}
html[dir="rtl"] body.watch-page .watch-layout{grid-template-areas:"side main"}
body.watch-page .watch-related-grid{display:none!important}
body.watch-page .watch-recommendations .side-videos{gap:12px}
body.watch-page .watch-recommendations .side-card{grid-template-columns:155px minmax(0,1fr);gap:10px;align-items:start}
body.watch-page .watch-recommendations .side-card img{width:155px;height:87px;aspect-ratio:16/9;object-fit:cover;border-radius:8px;display:block}
body.watch-page .watch-recommendations .side-card a{font-size:13px;line-height:1.35}
body.watch-page .watch-recommendations .side-card .meta{font-size:11px;color:var(--muted);margin-top:3px}
@media(max-width:1250px){body.watch-page .watch-layout{grid-template-columns:minmax(0,1fr) 350px}.watch-recommendations .side-card{grid-template-columns:140px minmax(0,1fr)!important}.watch-recommendations .side-card img{width:140px!important;height:79px!important}}
@media(max-width:980px){body.watch-page .watch-layout{display:block}.watch-recommendations{margin-top:28px!important;border-top:1px solid var(--line);padding-top:20px!important}.watch-recommendations .side-videos{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px 12px}.watch-recommendations .side-card{display:block!important}.watch-recommendations .side-card img{width:100%!important;height:auto!important;aspect-ratio:16/9}.watch-recommendations .side-card > div{padding-top:7px}}
@media(max-width:600px){.watch-recommendations .side-videos{grid-template-columns:1fr}.watch-recommendations .side-card{display:grid!important;grid-template-columns:145px minmax(0,1fr)!important}.watch-recommendations .side-card img{width:145px!important;height:82px!important}}

/* YalaTube v7 — RTL/LTR YouTube-like navigation and topic bar polish */
html[dir="ltr"] .yt-sidebar{left:0;right:auto;border-right:1px solid var(--line);border-left:0}
html[dir="rtl"] .yt-sidebar{right:0;left:auto;border-left:1px solid var(--line);border-right:0}
html[dir="ltr"] .site-main{margin-left:var(--sidebar-w);margin-right:0}
html[dir="rtl"] .site-main{margin-right:var(--sidebar-w);margin-left:0}

/* Header follows reading direction: brand/navigation at the outer edge, search centered, actions opposite. */
.yt-header-inner{direction:inherit}
html[dir="rtl"] .yt-header-inner{grid-template-columns:auto minmax(260px,1fr) var(--sidebar-w)}
html[dir="rtl"] .brand-wrap{justify-content:flex-start}
html[dir="rtl"] .header-actions{justify-content:flex-end}
html[dir="ltr"] .yt-header-inner{grid-template-columns:var(--sidebar-w) minmax(260px,1fr) auto}

/* YouTube-like horizontal category chips */
.topic-row{display:flex;align-items:center;gap:10px;overflow-x:auto;overflow-y:hidden;padding:8px 2px 18px;min-height:54px;direction:ltr}
html[dir="rtl"] .topic-row{direction:rtl}
.topic-chip{display:inline-flex;align-items:center;justify-content:center;height:40px;padding:0 15px;border:0;border-radius:8px;background:var(--surface-2);color:var(--text);font-size:13px;font-weight:600;flex:0 0 auto;transition:background .15s ease,transform .15s ease}
.topic-chip:hover{background:var(--surface-3);transform:translateY(-1px)}
.topic-chip.active{background:var(--text);color:var(--bg)}

/* Arabic content should feel like YouTube: controls and metadata flow naturally RTL. */
html[dir="rtl"] .card-body{grid-template-columns:minmax(0,1fr) 38px}
html[dir="rtl"] .card-body .channel-avatar{grid-column:2}
html[dir="rtl"] .card-body > div{grid-column:1;text-align:right}
html[dir="rtl"] .video-meta,.watch-actions{direction:rtl}
html[dir="rtl"] .side-card{grid-template-columns:minmax(0,1fr) 155px}
html[dir="rtl"] .side-card img{grid-column:2}
html[dir="rtl"] .side-card > div{grid-column:1;text-align:right}

/* Single page — sidebar hidden until the hamburger is pressed; recommendations sit opposite the player. */
html[dir="rtl"] body.watch-page .watch-layout{grid-template-areas:"side main"}
html[dir="ltr"] body.watch-page .watch-layout{grid-template-areas:"main side"}
html[dir="rtl"] body.watch-page .watch-recommendations .side-card{grid-template-columns:minmax(0,1fr) 155px}
html[dir="rtl"] body.watch-page .watch-recommendations .side-card img{grid-column:2}
html[dir="rtl"] body.watch-page .watch-recommendations .side-card > div{grid-column:1;text-align:right}

/* Mobile menu direction */
@media(max-width:980px){
  html[dir="ltr"] .yt-sidebar{left:0;right:auto;transform:translateX(-260px)}
  html[dir="rtl"] .yt-sidebar{right:0;left:auto;transform:translateX(260px)}
  html[dir="ltr"] body.sidebar-open .yt-sidebar{transform:translateX(0)!important}
  html[dir="rtl"] body.sidebar-open .yt-sidebar{transform:translateX(0)!important}
  html[dir="rtl"] .yt-header-inner{grid-template-columns:auto minmax(120px,1fr) auto}
  html[dir="ltr"] .yt-header-inner{grid-template-columns:auto minmax(120px,1fr) auto}
  html[dir="rtl"] .site-main,html[dir="ltr"] .site-main{margin-left:0;margin-right:0}
}

/* Avoid any horizontal page overflow from the watch layout. */
body.watch-page .watch-layout{width:100%;min-width:0}
body.watch-page .watch-main,body.watch-page .watch-recommendations{min-width:0}

/* YalaTube v8 — precise YouTube-like watch geometry */
body.watch-page .watch-page-shell{max-width:1600px;margin-inline:auto}
body.watch-page .watch-layout{display:grid;gap:24px;align-items:start;grid-template-columns:minmax(0,1fr) 390px;grid-template-areas:"main side"}
html[dir="rtl"] body.watch-page .watch-layout{grid-template-columns:390px minmax(0,1fr);grid-template-areas:"side main"}
body.watch-page .watch-main{grid-area:main;min-width:0}
body.watch-page .watch-recommendations{grid-area:side;min-width:0}
body.watch-page .player{width:100%;max-width:none;aspect-ratio:16/9;border-radius:12px;overflow:hidden;background:#000}
body.watch-page .watch-recommendations-head{margin:0 0 12px;display:flex;align-items:center;justify-content:space-between}
body.watch-page .watch-recommendations-head h2{margin:0;font-size:16px;font-weight:700}
body.watch-page .watch-recommendations .side-videos{display:flex;flex-direction:column;gap:14px}
body.watch-page .watch-recommendations .side-card{display:grid;grid-template-columns:155px minmax(0,1fr);gap:10px;align-items:start}
body.watch-page .watch-recommendations .side-card img{width:155px;height:87px;object-fit:cover;aspect-ratio:16/9;border-radius:8px;display:block;background:var(--surface-2)}
body.watch-page .watch-recommendations .side-card a{font-size:13px;line-height:1.4;font-weight:700}
body.watch-page .watch-recommendations .side-card small,body.watch-page .watch-recommendations .side-card .meta{font-size:11px;color:var(--muted);line-height:1.4}
html[dir="rtl"] body.watch-page .watch-recommendations .side-card{grid-template-columns:minmax(0,1fr) 155px}
html[dir="rtl"] body.watch-page .watch-recommendations .side-card img{grid-column:2}
html[dir="rtl"] body.watch-page .watch-recommendations .side-card>div{grid-column:1;text-align:right}
@media(max-width:1250px){
 body.watch-page .watch-layout{grid-template-columns:minmax(0,1fr) 340px}
 html[dir="rtl"] body.watch-page .watch-layout{grid-template-columns:340px minmax(0,1fr)}
 body.watch-page .watch-recommendations .side-card{grid-template-columns:140px minmax(0,1fr)}
 html[dir="rtl"] body.watch-page .watch-recommendations .side-card{grid-template-columns:minmax(0,1fr) 140px}
 body.watch-page .watch-recommendations .side-card img{width:140px;height:79px}
}
@media(max-width:980px){
 body.watch-page .watch-layout,html[dir="rtl"] body.watch-page .watch-layout{display:block}
 body.watch-page .watch-recommendations{margin-top:28px!important;border-top:1px solid var(--line);padding-top:20px!important}
 body.watch-page .watch-recommendations .side-videos{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px 12px}
 body.watch-page .watch-recommendations .side-card,html[dir="rtl"] body.watch-page .watch-recommendations .side-card{display:block;grid-template-columns:none}
 body.watch-page .watch-recommendations .side-card img,html[dir="rtl"] body.watch-page .watch-recommendations .side-card img{width:100%;height:auto;aspect-ratio:16/9}
 body.watch-page .watch-recommendations .side-card>div,html[dir="rtl"] body.watch-page .watch-recommendations .side-card>div{padding-top:7px;text-align:start}
}
@media(max-width:600px){
 body.watch-page .watch-recommendations .side-videos{grid-template-columns:1fr}
 body.watch-page .watch-recommendations .side-card,html[dir="rtl"] body.watch-page .watch-recommendations .side-card{display:grid;grid-template-columns:145px minmax(0,1fr)}
 html[dir="rtl"] body.watch-page .watch-recommendations .side-card{grid-template-columns:minmax(0,1fr) 145px}
 body.watch-page .watch-recommendations .side-card img,html[dir="rtl"] body.watch-page .watch-recommendations .side-card img{width:145px;height:82px}
}


/* YalaTube v9 — robust watch direction by active language */
html[dir="rtl"] body.watch-page .watch-layout,
body.watch-page.lang-ar .watch-layout{
  display:flex!important;
  flex-direction:row!important;
  gap:24px!important;
  align-items:flex-start!important;
  width:100%!important;
}
html[dir="rtl"] body.watch-page .watch-main,
body.watch-page.lang-ar .watch-main{order:2!important; flex:1 1 auto!important; min-width:0!important;}
html[dir="rtl"] body.watch-page .watch-recommendations,
body.watch-page.lang-ar .watch-recommendations{order:1!important; flex:0 0 390px!important; width:390px!important; min-width:0!important;}
html[dir="ltr"] body.watch-page .watch-main,
body.watch-page.lang-ltr .watch-main{order:1!important; flex:1 1 auto!important; min-width:0!important;}
html[dir="ltr"] body.watch-page .watch-recommendations,
body.watch-page.lang-ltr .watch-recommendations{order:2!important; flex:0 0 390px!important; width:390px!important; min-width:0!important;}

html[dir="rtl"] body.watch-page .watch-recommendations .side-card,
body.watch-page.lang-ar .watch-recommendations .side-card{
  display:grid!important;
  grid-template-columns:minmax(0,1fr) 155px!important;
}
html[dir="rtl"] body.watch-page .watch-recommendations .side-card img,
body.watch-page.lang-ar .watch-recommendations .side-card img{grid-column:2!important;}
html[dir="rtl"] body.watch-page .watch-recommendations .side-card>div,
body.watch-page.lang-ar .watch-recommendations .side-card>div{grid-column:1!important; text-align:right!important;}

@media(max-width:1250px){
  html[dir="rtl"] body.watch-page .watch-recommendations,
  body.watch-page.lang-ar .watch-recommendations{flex-basis:340px!important;width:340px!important;}
  html[dir="rtl"] body.watch-page .watch-recommendations .side-card,
  body.watch-page.lang-ar .watch-recommendations .side-card{grid-template-columns:minmax(0,1fr) 140px!important;}
  html[dir="rtl"] body.watch-page .watch-recommendations .side-card img,
  body.watch-page.lang-ar .watch-recommendations .side-card img{width:140px!important;height:79px!important;}
}
@media(max-width:980px){
  html[dir="rtl"] body.watch-page .watch-layout,
  body.watch-page.lang-ar .watch-layout{display:block!important;}
  html[dir="rtl"] body.watch-page .watch-recommendations,
  body.watch-page.lang-ar .watch-recommendations{width:auto!important;flex:none!important;margin-top:28px!important;}
}

/* Keep the page from ever creating a bottom horizontal scrollbar. */
html,body{max-width:100%;overflow-x:hidden;}
body.watch-page .site-main,body.watch-page .content-inner,body.watch-page .watch-page-shell{max-width:100%;overflow-x:clip;}

/* YalaTube v10 — lock watch columns to screen sides, independent of document direction.
   The document can stay RTL/LTR for text while the two-column shell uses a stable LTR flex axis. */
@media(min-width:981px){
  body.watch-page .watch-layout{
    display:flex!important;
    flex-direction:row!important;
    direction:ltr!important;
    gap:24px!important;
    align-items:flex-start!important;
    width:100%!important;
  }
  /* Arabic: recommendations on the left, player on the right. */
  html[dir="rtl"] body.watch-page .watch-recommendations,
  body.watch-page.lang-ar .watch-recommendations{
    order:1!important;
    flex:0 0 390px!important;
    width:390px!important;
    direction:rtl!important;
  }
  html[dir="rtl"] body.watch-page .watch-main,
  body.watch-page.lang-ar .watch-main{
    order:2!important;
    flex:1 1 auto!important;
    min-width:0!important;
    direction:rtl!important;
  }
  /* LTR: player on the left, recommendations on the right. */
  html[dir="ltr"] body.watch-page .watch-main,
  body.watch-page.lang-ltr .watch-main{
    order:1!important;
    flex:1 1 auto!important;
    min-width:0!important;
    direction:ltr!important;
  }
  html[dir="ltr"] body.watch-page .watch-recommendations,
  body.watch-page.lang-ltr .watch-recommendations{
    order:2!important;
    flex:0 0 390px!important;
    width:390px!important;
    direction:ltr!important;
  }
}


/* YalaTube v11 — YouTube-style recommendation rail */
.watch-recommendations{min-width:0;}
.recommendation-tabs{display:flex;align-items:center;gap:8px;overflow-x:auto;scrollbar-width:none;padding:0 0 14px;margin-bottom:2px;direction:inherit;}
.recommendation-tabs::-webkit-scrollbar{display:none;}
.recommendation-tab{appearance:none;border:0;white-space:nowrap;background:var(--surface-2);color:var(--text);padding:8px 14px;border-radius:9px;font-size:13px;font-weight:700;cursor:pointer;line-height:1.2;transition:background .15s ease, color .15s ease;}
.recommendation-tab:hover{background:var(--surface-3);}
.recommendation-tab.active{background:var(--text);color:var(--bg);}
.side-videos{gap:14px;}
.side-card.reco-card{display:grid;grid-template-columns:168px minmax(0,1fr);gap:10px;align-items:start;min-width:0;}
.side-thumb{display:block;position:relative;width:168px;aspect-ratio:16/9;border-radius:9px;overflow:hidden;background:var(--surface-2);}
.side-thumb img{width:100%;height:100%;display:block;object-fit:cover;}
.side-card-info{min-width:0;}
.side-title-link{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;text-decoration:none;font-size:13px;line-height:1.4;font-weight:700;color:var(--text);}
.side-channel{display:block;color:var(--muted);font-size:11px;margin-top:6px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.side-card-info .meta{font-size:11px;line-height:1.35;}
html[dir="rtl"] .side-card.reco-card, body.watch-page.lang-ar .side-card.reco-card{grid-template-columns:minmax(0,1fr) 168px;}
html[dir="rtl"] .side-card.reco-card .side-thumb, body.watch-page.lang-ar .side-card.reco-card .side-thumb{grid-column:2;grid-row:1;}
html[dir="rtl"] .side-card.reco-card .side-card-info, body.watch-page.lang-ar .side-card.reco-card .side-card-info{grid-column:1;grid-row:1;text-align:right;}
html[dir="ltr"] .side-card.reco-card .side-thumb, body.watch-page.lang-ltr .side-card.reco-card .side-thumb{grid-column:1;grid-row:1;}
html[dir="ltr"] .side-card.reco-card .side-card-info, body.watch-page.lang-ltr .side-card.reco-card .side-card-info{grid-column:2;grid-row:1;text-align:left;}
@media(max-width:1250px){
  .side-card.reco-card{grid-template-columns:145px minmax(0,1fr)!important;}
  .side-thumb{width:145px;}
  html[dir="rtl"] .side-card.reco-card,body.watch-page.lang-ar .side-card.reco-card{grid-template-columns:minmax(0,1fr) 145px!important;}
}
@media(max-width:980px){
  .watch-recommendations{margin-top:28px;}
  .side-card.reco-card,html[dir="rtl"] .side-card.reco-card,body.watch-page.lang-ar .side-card.reco-card,html[dir="ltr"] .side-card.reco-card,body.watch-page.lang-ltr .side-card.reco-card{grid-template-columns:180px minmax(0,1fr)!important;}
  .side-thumb{width:180px;}
  html[dir="rtl"] .side-card.reco-card .side-thumb,body.watch-page.lang-ar .side-card.reco-card .side-thumb{grid-column:1;}
  html[dir="rtl"] .side-card.reco-card .side-card-info,body.watch-page.lang-ar .side-card.reco-card .side-card-info{grid-column:2;text-align:right;}
}
@media(max-width:560px){
  .side-card.reco-card,html[dir="rtl"] .side-card.reco-card,body.watch-page.lang-ar .side-card.reco-card,html[dir="ltr"] .side-card.reco-card,body.watch-page.lang-ltr .side-card.reco-card{grid-template-columns:140px minmax(0,1fr)!important;gap:9px;}
  .side-thumb{width:140px;}
  .side-title-link{font-size:12px;}
}

/* YouTube-like comments + recommendation rail refinements v11 */
.comment.youtube-comment{align-items:flex-start}.comment-reply{margin-inline-start:48px;padding-top:10px;padding-bottom:10px}.comment-body{min-width:0;flex:1}.comment-author-line{display:flex;align-items:center;gap:8px;flex-wrap:wrap}.comment-source{font-size:11px;color:var(--muted);padding:3px 7px;border-radius:999px;background:var(--surface-2)}.comment-text{margin-top:4px;line-height:1.7}.comment-tools{display:flex;gap:14px;flex-wrap:wrap;color:var(--muted);font-size:12px;margin-top:7px}.empty-comments{color:var(--muted);padding:16px 0}.recommendation-tabs{display:flex;gap:8px;overflow-x:auto;padding:3px 0 12px;scrollbar-width:none}.recommendation-tabs::-webkit-scrollbar{display:none}.recommendation-tab{border:0;background:var(--surface-2);color:var(--text);border-radius:999px;padding:9px 14px;white-space:nowrap;cursor:pointer;font-weight:700}.recommendation-tab.active{background:var(--text);color:var(--bg)}.watch-recommendations{position:sticky;top:76px}.watch-recommendations .side-videos{max-height:calc(100vh - 145px);overflow:auto;padding-inline-end:4px}.watch-recommendations .side-card{grid-template-columns:140px minmax(0,1fr);gap:10px}.watch-recommendations .side-card img{width:140px;height:79px;border-radius:8px}.watch-recommendations .side-card-info{min-width:0}.watch-recommendations .side-title-link{font-size:13px}.watch-recommendations .side-channel,.watch-recommendations .meta{font-size:11px;color:var(--muted)}
html[dir="rtl"] body.watch-page .watch-recommendations .side-card{grid-template-columns:minmax(0,1fr) 140px}
html[dir="rtl"] body.watch-page .watch-recommendations .side-card img{grid-column:2}
html[dir="rtl"] body.watch-page .watch-recommendations .side-card > div{grid-column:1}
@media(max-width:980px){.watch-recommendations{position:static}.watch-recommendations .side-videos{max-height:none;overflow:visible}.comment-reply{margin-inline-start:24px}}


/* YalaTube v13 — YouTube-style recommendation rail polish */
body.watch-page .watch-recommendations{position:static!important;top:auto!important;}
body.watch-page .watch-recommendations .side-videos{max-height:none!important;overflow:visible!important;padding-inline-end:0!important;}
body.watch-page .watch-recommendations{overflow:visible!important;}
.reco-preview{position:relative;display:block;overflow:hidden;}
.reco-preview img{transition:opacity .16s ease,transform .2s ease;}
.reco-preview.is-previewing img{opacity:.25;transform:scale(1.015);}
.reco-preview .preview-frame{position:absolute;inset:0;width:100%;height:100%;border:0;display:block;pointer-events:none;background:#000;}
.duration-badge{position:absolute;inset-inline-end:6px;inset-block-end:6px;z-index:2;background:rgba(0,0,0,.86);color:#fff;font-size:11px;font-weight:700;line-height:1;padding:5px 6px;border-radius:4px;letter-spacing:.1px;}
.recommendation-tab{flex:0 0 auto;}
@media(min-width:981px){
  body.watch-page .watch-recommendations .side-videos{gap:16px;}
  body.watch-page .watch-recommendations .side-card.reco-card{grid-template-columns:168px minmax(0,1fr)!important;}
  html[dir="rtl"] body.watch-page .watch-recommendations .side-card.reco-card{grid-template-columns:minmax(0,1fr) 168px!important;}
  body.watch-page .watch-recommendations .side-thumb{width:168px;height:95px;}
  body.watch-page .watch-recommendations .side-card-info{padding-top:1px;}
  body.watch-page .watch-recommendations .side-title-link{font-size:14px;line-height:1.35;}
}
@media(max-width:980px){
  body.watch-page .watch-recommendations .side-videos{display:flex!important;flex-direction:column!important;gap:16px!important;}
  body.watch-page .watch-recommendations .side-card.reco-card,html[dir="rtl"] body.watch-page .watch-recommendations .side-card.reco-card{display:grid!important;grid-template-columns:180px minmax(0,1fr)!important;}
  body.watch-page .watch-recommendations .side-thumb{width:180px;height:101px;}
  html[dir="rtl"] body.watch-page .watch-recommendations .side-thumb{grid-column:1!important;}
  html[dir="rtl"] body.watch-page .watch-recommendations .side-card-info{grid-column:2!important;}
}
@media(max-width:560px){
  body.watch-page .watch-recommendations .side-card.reco-card,html[dir="rtl"] body.watch-page .watch-recommendations .side-card.reco-card{grid-template-columns:140px minmax(0,1fr)!important;}
  body.watch-page .watch-recommendations .side-thumb{width:140px;height:79px;}
}


/* YalaTube v17 — clean YouTube-like cards: transparent by default, hover only */
.video-card-ambient{position:relative;border-radius:12px;padding:0 0 8px;overflow:visible;background:transparent;transition:background-color .16s ease,box-shadow .16s ease;}
.video-card-ambient::before{content:none!important;}
.video-card-ambient:hover{background:var(--hover);}
.home-preview{position:relative;}
.home-preview img{transition:opacity .18s ease,transform .18s ease;}
.home-preview.is-previewing img{opacity:.18;transform:scale(1.01);}
.home-preview .preview-frame{position:absolute;inset:0;width:100%;height:100%;border:0;background:#000;z-index:1;pointer-events:none;}
.home-preview .duration{z-index:3;}
.preview-label{position:absolute;left:8px;bottom:7px;z-index:3;background:rgba(0,0,0,.78);color:#fff;border-radius:5px;padding:3px 6px;font-size:10px;font-weight:700;opacity:0;transform:translateY(3px);transition:opacity .16s ease,transform .16s ease;pointer-events:none;}
.home-preview:hover .preview-label{opacity:1;transform:none;}

/* Shorts page: accurate duration badge and card/hover behavior */
.shorts-page .short-card{position:relative;}
.shorts-page .short-duration{position:absolute;right:8px;bottom:8px;z-index:4;background:rgba(0,0,0,.86);color:#fff;border-radius:4px;padding:4px 6px;font-size:11px;font-weight:800;}
.shorts-page .short-player.is-previewing img{opacity:.15;}
@media(max-width:980px){.preview-label{display:none;}}

.shorts-page .short-player .short-poster{display:none;position:absolute;inset:0;width:100%;height:100%;object-fit:cover;z-index:1;}
.shorts-page .short-player iframe{position:absolute;inset:0;z-index:2;}
.shorts-page .short-duration{z-index:5;}


/* v18 — YouTube-like Shorts / Reels desktop feed, normal flow on mobile */
.shorts-page{max-width:1200px;margin:0 auto;padding-bottom:48px}.shorts-head{display:flex;align-items:flex-end;justify-content:space-between;gap:20px;padding:18px 0 22px}.shorts-head h1{margin:8px 0 4px}.shorts-head p{margin:0;color:var(--muted)}.shorts-link{color:var(--text);text-decoration:none;font-weight:700}.shorts-shell{position:relative;display:flex;justify-content:center;align-items:center;min-height:calc(100vh - 190px)}.shorts-feed{width:100%;max-width:760px;display:flex;flex-direction:column;gap:28px;scroll-snap-type:y mandatory;scroll-behavior:smooth}.short-item{position:relative;display:grid;grid-template-columns:minmax(0,1fr) 78px;gap:16px;align-items:end;min-height:calc(100vh - 190px);scroll-snap-align:start}.short-stage{position:relative;width:min(520px,72vw);aspect-ratio:9/16;margin-inline:auto}.short-player{position:relative;width:100%;height:100%;overflow:hidden;border-radius:18px;background:#000;box-shadow:0 20px 70px rgba(0,0,0,.24)}.short-poster{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;z-index:1}.short-iframe-slot{position:absolute;inset:0;z-index:2}.short-iframe-slot iframe{width:100%;height:100%;border:0;display:block}.short-duration{position:absolute;left:10px;bottom:10px;z-index:5;background:rgba(0,0,0,.84);color:#fff;border-radius:4px;padding:5px 7px;font-size:12px;font-weight:800;direction:ltr}.short-sound-pill{position:absolute;right:12px;top:12px;z-index:6;background:rgba(0,0,0,.58);color:#fff;border-radius:999px;padding:7px 10px;font-size:11px}.short-meta-overlay{position:absolute;left:16px;right:96px;bottom:16px;z-index:7;color:#fff;text-shadow:0 1px 4px rgba(0,0,0,.65);pointer-events:none}.short-meta-overlay a{pointer-events:auto}.short-channel{display:inline-flex;align-items:center;gap:9px;color:#fff;text-decoration:none;font-weight:800}.short-channel img{width:34px;height:34px;border-radius:50%;object-fit:cover;border:2px solid rgba(255,255,255,.75)}.short-title{display:block;color:#fff;text-decoration:none;font-size:15px;line-height:1.5;margin-top:8px;font-weight:700}.short-stats{font-size:11px;opacity:.9;margin-top:6px}.short-actions{display:flex;flex-direction:column;align-items:center;gap:12px;padding-bottom:12px}.short-actions form{margin:0}.short-action-btn{width:64px;min-height:64px;border:0;border-radius:999px;background:var(--surface-2);color:var(--text);display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;text-decoration:none;cursor:pointer;box-shadow:0 8px 24px rgba(0,0,0,.08)}.short-action-btn:hover{background:var(--hover);transform:translateY(-1px)}.short-action-btn span{font-size:23px;line-height:1}.short-action-btn b{font-size:10px;font-weight:800}.short-action-btn img{width:28px;height:28px;border-radius:50%;object-fit:cover}.short-nav{position:fixed;z-index:40;left:28px;width:52px;height:52px;border:0;border-radius:50%;background:var(--surface-2);color:var(--text);box-shadow:0 10px 30px rgba(0,0,0,.12);font-size:22px;cursor:pointer}.short-nav:hover{background:var(--hover)}.short-nav-prev{top:calc(50% - 76px)}.short-nav-next{top:calc(50% + 20px)}.shorts-page .empty{margin:60px auto;max-width:640px;text-align:center;padding:40px;border:1px solid var(--border);border-radius:20px;background:var(--surface)}
html[data-theme="dark"] .short-player{box-shadow:0 24px 80px rgba(0,0,0,.5)}
@media(max-width:980px){.short-item{grid-template-columns:minmax(0,1fr) 68px}.short-stage{width:min(500px,68vw)}.short-nav{left:16px}.short-action-btn{width:58px;min-height:58px}}
@media(max-width:700px){.shorts-head{padding:12px 0 18px}.shorts-head p{font-size:12px}.shorts-shell{min-height:0;display:block}.shorts-feed{max-width:none;gap:20px;scroll-snap-type:none}.short-item{display:flex;flex-direction:column;gap:10px;min-height:0;scroll-snap-align:none;align-items:stretch}.short-stage{width:100%;aspect-ratio:9/16}.short-player{border-radius:14px}.short-meta-overlay{left:12px;right:12px;bottom:12px}.short-actions{flex-direction:row;justify-content:flex-start;overflow-x:auto;padding:0 2px 8px;gap:8px}.short-action-btn{width:58px;min-width:58px;min-height:58px}.short-nav{display:none}.short-sound-pill{font-size:10px}.short-title{font-size:14px}}

/* v19 — standalone Shorts pages, one Short per URL, desktop controls + mobile normal flow */
.short-single-page{max-width:1200px;margin:0 auto;padding:14px 0 46px}.short-single-head{display:flex;align-items:center;justify-content:space-between;margin:0 0 14px;padding:0 6px}.short-back{color:var(--text);text-decoration:none;font-weight:800}.short-single-layout{display:grid;grid-template-columns:minmax(0,760px) 88px;justify-content:center;gap:20px;align-items:end}.short-single-stage{min-width:0}.short-single-player{position:relative;width:min(520px,100%);aspect-ratio:9/16;margin:0 auto;border-radius:18px;overflow:hidden;background:#000;box-shadow:0 18px 60px rgba(0,0,0,.2)}.short-youtube-frame,.short-youtube-frame iframe{position:absolute;inset:0;width:100%;height:100%;border:0;display:block}.short-single-duration{position:absolute;left:12px;bottom:12px;z-index:5;background:rgba(0,0,0,.85);color:#fff;border-radius:5px;padding:5px 8px;font-size:12px;font-weight:800;direction:ltr;pointer-events:none}.short-single-info{width:min(520px,100%);margin:12px auto 0}.short-single-channel{display:inline-flex;align-items:center;gap:10px;color:var(--text);text-decoration:none;font-weight:800}.short-single-channel img{width:42px;height:42px;border-radius:50%;object-fit:cover}.short-single-info h1{font-size:18px;line-height:1.5;margin:10px 0 6px}.short-single-stats{font-size:12px;color:var(--muted)}.short-single-actions{display:flex;flex-direction:column;align-items:center;gap:10px;padding-bottom:6px}.short-single-actions form{margin:0}.short-single-action,.short-single-nav{width:64px;min-height:64px;border:0;border-radius:999px;background:var(--surface-2);color:var(--text);display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;text-decoration:none;cursor:pointer;box-shadow:0 6px 20px rgba(0,0,0,.08)}.short-single-action:hover,.short-single-nav:hover{background:var(--hover)}.short-single-action span{font-size:23px;line-height:1}.short-single-action b{font-size:10px}.short-single-action img{width:30px;height:30px;border-radius:50%;object-fit:cover}.short-single-nav{font-size:22px}.short-swipe-hint{text-align:center;color:var(--muted);font-size:11px;margin-top:14px}
@media(min-width:701px){.short-single-page{min-height:calc(100vh - 160px)}.short-single-layout{min-height:calc(100vh - 210px)}.short-single-actions{justify-self:start}}
@media(max-width:700px){.short-single-page{padding:10px 0 30px}.short-single-layout{display:flex;flex-direction:column;align-items:stretch;gap:12px}.short-single-stage{width:100%}.short-single-player{width:100%;max-height:none;border-radius:12px}.short-single-info{padding:0 4px}.short-single-actions{flex-direction:row;flex-wrap:wrap;justify-content:flex-start;overflow:visible;padding:0 4px;gap:7px}.short-single-action,.short-single-nav{width:56px;min-height:56px}.short-swipe-hint{font-size:10px;padding:0 8px}}

/* v22 — dedicated Shorts viewer: one Short per URL, YouTube-like desktop/mobile behavior. */
.short-single-page{max-width:100%;margin:0;padding:0 0 24px;min-height:calc(100vh - 78px)}
.short-single-head{display:none}
.short-single-layout{display:grid;grid-template-columns:minmax(0,520px) 78px;justify-content:center;align-items:center;gap:14px;min-height:calc(100vh - 110px);margin:0 auto}
.short-single-stage{min-width:0;display:flex;flex-direction:column;align-items:center}
.short-single-player{width:min(520px,calc(100vh - 145px)*9/16);max-width:calc(100vw - 160px);height:auto;aspect-ratio:9/16;margin:0;border-radius:14px;background:#000;box-shadow:0 12px 45px rgba(0,0,0,.18)}
.short-single-info{width:min(520px,100%);margin:10px 0 0;text-align:start}
.short-single-channel{display:flex;align-items:center;gap:10px;width:max-content;max-width:100%;margin-inline-start:0}
.short-single-info h1{font-size:18px;line-height:1.45;margin:8px 0 4px;font-weight:800}
.short-single-actions{align-self:center;justify-self:start;display:flex;flex-direction:column;align-items:center;gap:10px;padding:0}
.short-single-action,.short-single-nav{width:56px;min-height:56px}
.short-single-nav{font-size:24px}
.short-swipe-hint{display:none}
.short-comments-note{display:none}
@media(max-width:700px){
 .short-single-page{min-height:0;padding:10px 0 28px}
 .short-single-layout{display:flex;flex-direction:column;gap:10px;min-height:0;width:100%;}
 .short-single-player{width:min(92vw,520px);max-width:92vw;}
 .short-single-info{width:min(92vw,520px);}
 .short-single-actions{flex-direction:row;flex-wrap:wrap;justify-content:center;width:min(92vw,520px);gap:8px}
 .short-single-action,.short-single-nav{width:54px;min-height:54px}
}
/* v23 — YouTube-like Shorts navigation + random sequence */
.short-single-page.v23-random-shorts .short-single-layout{position:relative;display:grid;grid-template-columns:56px minmax(0,520px) 78px;justify-content:center;column-gap:14px;align-items:center;max-width:760px;}
.short-single-page.v23-random-shorts .short-single-stage{grid-column:2;grid-row:1;}
.short-single-page.v23-random-shorts .short-single-navs{grid-column:1;grid-row:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:18px;align-self:center;}
.short-single-page.v23-random-shorts .short-single-actions{grid-column:3;grid-row:1;align-self:center;justify-self:center;}
.short-single-page.v23-random-shorts .short-single-nav{display:flex;position:static;width:52px;min-height:52px;font-size:24px;background:var(--surface-2);box-shadow:0 8px 24px rgba(0,0,0,.12);align-items:center;justify-content:center;border-radius:999px;text-decoration:none;color:var(--text);}
.short-single-page.v23-random-shorts .short-single-nav:hover{background:var(--hover);}
.short-single-page.v23-random-shorts .short-swipe-hint{display:none;}
@media(max-width:700px){
  .short-single-page.v23-random-shorts .short-single-layout{display:flex;flex-direction:column;gap:10px;max-width:none;width:100%;}
  .short-single-page.v23-random-shorts .short-single-stage{order:1;width:100%;}
  .short-single-page.v23-random-shorts .short-single-actions{order:2;width:min(92vw,520px);flex-direction:row;flex-wrap:wrap;justify-content:center;}
  .short-single-page.v23-random-shorts .short-single-navs{display:none;}
}


/* YalaTube v25 — footer stays inside the content area, never underneath the fixed sidebar */
@media(min-width:981px){
  .yt-footer{margin-inline-start:var(--sidebar-w);}
  html[dir="ltr"] .yt-footer{margin-left:var(--sidebar-w);margin-right:0;}
  html[dir="rtl"] .yt-footer{margin-right:var(--sidebar-w);margin-left:0;}
}
@media(max-width:980px){
  .yt-footer{margin-left:0!important;margin-right:0!important;}
}

/* YalaTube v26 — Watch/Single footer uses the full available page width because the sidebar is hidden on watch pages. */
@media(min-width:981px){
  body.watch-page .yt-footer{margin-left:0!important;margin-right:0!important;width:100%!important;max-width:none!important;}
  body.watch-page .yt-footer .footer-inner{width:min(1500px,100%);margin:0 auto;}
}
@media(max-width:980px){
  body.watch-page .yt-footer{margin-left:0!important;margin-right:0!important;width:100%!important;max-width:none!important;}
}


/* v27 homepage sections + infinite feed */
.home-topic-section,.home-shorts-section,.home-feed-section{margin-top:34px}
.home-topic-section .topic-preview-grid{grid-template-columns:repeat(3,minmax(0,1fr))}
.shorts-row-home{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:16px;overflow:hidden}
.home-short-card{display:block;min-width:0;text-decoration:none;color:inherit}
.home-short-thumb{position:relative;aspect-ratio:9/16;border-radius:14px;overflow:hidden;background:var(--surface-2,#f2f2f2)}
.home-short-thumb img{width:100%;height:100%;object-fit:cover;display:block}
.home-short-thumb .duration{position:absolute;bottom:8px;left:8px;background:rgba(0,0,0,.85);color:#fff;border-radius:4px;padding:2px 5px;font-size:11px}
.home-short-title{font-weight:600;font-size:14px;line-height:1.45;margin-top:8px;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.home-short-meta{font-size:12px;color:var(--muted,#606060);margin-top:4px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.feed-loader,.feed-end{display:none;justify-content:center;align-items:center;gap:10px;padding:24px;color:var(--muted,#606060);font-size:14px}
.home-feed-section.is-loading .feed-loader{display:flex}
.home-feed-section.is-end .feed-end{display:flex}
.feed-spinner{width:18px;height:18px;border:2px solid #ddd;border-top-color:#222;border-radius:50%;animation:feedspin .8s linear infinite}
@keyframes feedspin{to{transform:rotate(360deg)}}
[data-theme="dark"] .feed-spinner{border-color:#333;border-top-color:#fff}
@media(max-width:900px){.shorts-row-home{grid-template-columns:repeat(5,minmax(130px,1fr));overflow-x:auto;padding-bottom:4px}.home-topic-section .topic-preview-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:650px){.home-topic-section .topic-preview-grid{grid-template-columns:1fr}.shorts-row-home{grid-template-columns:repeat(5,150px)}}

/* v28 infinite scroll */
.feed-loader{display:none;align-items:center;justify-content:center;gap:10px;padding:24px;color:#60656b;font-size:14px}.feed-spinner{width:18px;height:18px;border:2px solid #d8d8d8;border-top-color:#222;border-radius:50%;animation:yalatube-spin .8s linear infinite}.feed-end{display:none;text-align:center;padding:24px;color:#777;font-size:13px}.infinite-sentinel{width:1px;height:1px;clear:both;overflow:hidden}@keyframes yalatube-spin{to{transform:rotate(360deg)}}
.profile-page{max-width:1200px;margin:0 auto}.profile-banner{height:220px;border-radius:0 0 16px 16px;background:var(--surface-2) center/cover no-repeat}.profile-head{display:flex;align-items:center;gap:18px;padding:18px 8px 8px;border-bottom:1px solid var(--line);flex-wrap:wrap}.profile-avatar{width:96px;height:96px;border-radius:50%;object-fit:cover;background:var(--surface-2);border:4px solid var(--bg);margin-top:-48px}.profile-info{flex:1;min-width:240px}.profile-info h1{margin:0;font-size:24px}.profile-handle{color:var(--muted);font-size:13px;margin-top:4px}.profile-info p{margin:8px 0 0;max-width:760px;color:var(--muted)}.subscription-users{display:flex;gap:14px;flex-wrap:wrap}.subscription-user{display:flex;align-items:center;gap:8px;padding:8px 12px;border-radius:14px;background:var(--surface-2);text-decoration:none}.subscription-user img{width:34px;height:34px;border-radius:50%;object-fit:cover}.profile-editor{max-width:680px}.profile-editor hr{border:0;border-top:1px solid var(--line);margin:24px 0}


/* v35 additions: static pages + news */
.news-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:18px}.home-news-grid{grid-template-columns:repeat(3,minmax(0,1fr))}.news-card{display:block;background:var(--surface,#fff);border:1px solid var(--border,#e5e7eb);border-radius:18px;overflow:hidden;transition:transform .18s ease,background .18s ease;min-width:0}.news-card:hover{background:var(--hover,#f3f4f6);transform:translateY(-2px)}.news-card-thumb{aspect-ratio:16/9;background:#eee;overflow:hidden}.news-card-thumb img{width:100%;height:100%;object-fit:cover;display:block}.news-card-body{padding:14px 15px 17px}.news-card-body h2,.news-card-body h3{margin:7px 0 8px;font-size:18px;line-height:1.45}.news-card-body small{color:#6b7280}.news-category{font-size:12px;color:#6b7280}.news-article{max-width:1000px;margin:0 auto}.news-article-head h1{font-size:34px;line-height:1.35;margin:10px 0}.news-hero{width:100%;max-height:560px;object-fit:cover;border-radius:18px;margin:20px 0}.news-content,.static-content{font-size:18px;line-height:2;color:inherit;white-space:normal}.static-page{max-width:1000px;margin:0 auto}.static-content{background:var(--surface,#fff);border:1px solid var(--border,#e5e7eb);border-radius:18px;padding:24px}.contact-form{margin-top:22px}.contact-form form{display:grid;gap:14px}.contact-form label{display:flex;flex-direction:column;gap:7px;font-weight:700;font-size:14px}.contact-form input,.contact-form textarea{padding:12px 14px;border:1px solid var(--border,#e5e7eb);border-radius:12px;background:var(--surface,#fff);color:inherit}.footer-pages{display:flex;flex-wrap:wrap;gap:14px;margin-top:16px;padding-top:12px;border-top:1px solid var(--border,#e5e7eb)}
@media(max-width:900px){.news-grid,.home-news-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.news-article-head h1{font-size:28px}}
@media(max-width:600px){.news-grid,.home-news-grid{grid-template-columns:1fr}.news-card-body h2,.news-card-body h3{font-size:17px}}


/* YalaTube v36 — Mobile/Tablet responsive stabilization for ALL site pages. */
html, body { max-width:100%; overflow-x:hidden; }
img, iframe, video, svg, canvas { max-width:100%; }

@media (max-width: 980px) {
  .yt-header { height:56px; }
  .yt-header-inner {
    height:56px;
    display:flex!important;
    align-items:center;
    gap:8px;
    padding:0 8px;
    width:100%;
    max-width:100%;
  }
  .brand-wrap { flex:0 0 auto; min-width:0; gap:6px; }
  .brand { font-size:18px; }
  .brand-mark { width:30px; height:21px; border-radius:6px; }
  .menu-btn,.header-icon { width:38px; height:38px; flex:0 0 38px; }
  .header-search {
    flex:1 1 auto;
    min-width:0;
    max-width:none!important;
    width:auto!important;
    justify-self:auto!important;
  }
  .header-search input {
    min-width:0;
    width:100%;
    height:38px;
    padding:0 12px;
    font-size:13px;
  }
  .header-search button { width:48px; height:38px; flex:0 0 48px; }
  .header-actions { flex:0 0 auto; gap:2px; }
  .header-actions .create-btn { display:none!important; }
  .header-actions .header-avatar { width:32px; height:32px; }

  /* Mobile sidebar starts fully off-canvas and only appears after ☰. */
  .yt-sidebar {
    top:56px!important;
    bottom:0!important;
    width:min(300px,88vw)!important;
    max-width:88vw!important;
    inset-inline-start:auto!important;
    inset-inline-end:0!important;
    transform:translateX(105%)!important;
    transition:transform .2s ease!important;
    z-index:120!important;
    box-shadow:0 12px 35px rgba(0,0,0,.22);
    overflow-y:auto!important;
  }
  html[dir="ltr"] .yt-sidebar {
    inset-inline-start:0!important;
    inset-inline-end:auto!important;
    transform:translateX(-105%)!important;
  }
  body.sidebar-open .yt-sidebar { transform:translateX(0)!important; }
  .side-mobile-backdrop {
    inset:56px 0 0 0!important;
    z-index:110!important;
  }

  .site-main {
    margin:0!important;
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    padding:14px 12px 40px!important;
  }
  .content-inner {
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    margin:0!important;
  }
  .topic-row { width:100%; max-width:100%; overflow-x:auto; }
  .section { width:100%; max-width:100%; }
  .grid.videos { grid-template-columns:repeat(2,minmax(0,1fr))!important; gap:22px 12px!important; }
  .card { width:100%; min-width:0; }
  .thumb-wrap { width:100%; }
  .card-body { grid-template-columns:34px minmax(0,1fr); gap:8px; }
  .channel-avatar { width:34px; height:34px; }
  .title { font-size:14px; }
  .channel,.meta { font-size:11px; }

  /* Watch/Single */
  body.watch-page .site-main { padding:10px 10px 36px!important; }
  body.watch-page .watch-page-shell,
  body.watch-page .watch-layout { width:100%!important; max-width:100%!important; min-width:0!important; }
  body.watch-page .watch-layout,
  html[dir="rtl"] body.watch-page .watch-layout,
  body.watch-page.lang-ar .watch-layout,
  body.watch-page.lang-ltr .watch-layout {
    display:block!important;
    flex-direction:initial!important;
    direction:inherit!important;
  }
  body.watch-page .watch-main,
  body.watch-page .watch-recommendations,
  html[dir="rtl"] body.watch-page .watch-main,
  html[dir="rtl"] body.watch-page .watch-recommendations,
  body.watch-page.lang-ar .watch-main,
  body.watch-page.lang-ar .watch-recommendations,
  body.watch-page.lang-ltr .watch-main,
  body.watch-page.lang-ltr .watch-recommendations {
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    flex:none!important;
    order:initial!important;
  }
  body.watch-page .player { width:100%!important; aspect-ratio:16/9; border-radius:10px; }
  body.watch-page .video-title { font-size:18px; line-height:1.5; margin:12px 0 6px; }
  body.watch-page .channel-row { width:100%; flex-wrap:wrap; }
  body.watch-page .actions,.watch-actions { width:100%; overflow:visible!important; }
  body.watch-page .watch-recommendations { margin-top:24px!important; padding-top:18px!important; border-top:1px solid var(--line); }
  body.watch-page .watch-recommendations .side-videos { width:100%; max-width:100%; overflow:visible!important; }

  /* Search / channel / news / profile */
  .news-grid,.home-news-grid { grid-template-columns:repeat(2,minmax(0,1fr))!important; }
  .news-article,.static-page,.profile-page { width:100%; max-width:100%; }
  .news-hero { width:100%; max-height:none; }
  .profile-banner { width:100%; height:170px; }
  .profile-info { min-width:0; width:100%; }
  .channel-cover { width:100%; max-width:100%; }

  /* Shorts */
  .shorts-page,.short-single-page { width:100%!important; max-width:100%!important; }
  .short-single-layout { width:100%!important; max-width:100%!important; }
}

@media (max-width: 650px) {
  .yt-header-inner { padding:0 6px; }
  .brand { font-size:17px; }
  .brand-mark { display:none; }
  .header-search input { font-size:12px; }
  .header-search button { width:44px; flex-basis:44px; }
  .grid.videos { grid-template-columns:1fr!important; gap:24px!important; }
  .topic-row { padding-bottom:10px; }
  .home-welcome h1 { font-size:22px; }
  .section-head { gap:8px; }
  .section-head h2 { font-size:18px; }
  .news-grid,.home-news-grid { grid-template-columns:1fr!important; }
  .profile-banner { height:150px; border-radius:0 0 12px 12px; }
  .profile-avatar { width:76px; height:76px; margin-top:-34px; }

  body.watch-page .video-title { font-size:17px; }
  body.watch-page .description { font-size:13px; }
  body.watch-page .watch-recommendations .side-videos { display:flex!important; flex-direction:column!important; gap:14px!important; }
  body.watch-page .watch-recommendations .side-card.reco-card,
  html[dir="rtl"] body.watch-page .watch-recommendations .side-card.reco-card,
  body.watch-page.lang-ar .watch-recommendations .side-card.reco-card,
  body.watch-page.lang-ltr .watch-recommendations .side-card.reco-card {
    display:grid!important;
    grid-template-columns:140px minmax(0,1fr)!important;
    gap:9px!important;
    width:100%!important;
  }
  html[dir="rtl"] body.watch-page .watch-recommendations .side-card.reco-card { direction:rtl; }
  html[dir="rtl"] body.watch-page .watch-recommendations .side-card.reco-card .side-thumb { grid-column:1!important; }
  html[dir="rtl"] body.watch-page .watch-recommendations .side-card.reco-card .side-card-info { grid-column:2!important; }
  .side-thumb { width:140px!important; height:79px!important; }
  .side-title-link { font-size:12px!important; }

  .shorts-row-home { grid-template-columns:repeat(5,145px)!important; overflow-x:auto!important; }
  .short-single-page.v23-random-shorts .short-single-layout,
  .short-single-layout { width:100%!important; max-width:100%!important; }
  .short-single-stage,.short-single-player,.short-single-info,.short-single-actions { width:100%!important; max-width:100%!important; }
  .short-single-player { border-radius:10px; }
  .short-single-actions { justify-content:center; }
}

@media (max-width: 380px) {
  .header-search input { padding:0 8px; }
  .header-search button { width:40px; flex-basis:40px; }
  .menu-btn,.header-icon { width:36px; height:36px; flex-basis:36px; }
  .side-item { min-height:42px; padding:0 10px; }
}

/* YalaTube v37 — hard mobile width reset for all pages, especially Watch/Single. */
@media (max-width: 980px) {
  html, body { width:100%!important; max-width:100%!important; min-width:0!important; overflow-x:hidden!important; }
  .yt-header, .yt-header-inner, .site-main, .content-inner, .yt-footer, .footer-inner,
  .watch-page-shell, .watch-layout, .watch-main, .watch-recommendations,
  .shorts-page, .short-single-page, .short-single-layout, .short-single-stage,
  .search-page, .channel-page, .profile-page, .news-page, .static-page {
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    box-sizing:border-box!important;
  }

  body.watch-page .site-main {
    margin:0!important;
    padding:8px 10px 34px!important;
  }
  body.watch-page .content-inner {
    margin:0!important;
    padding:0!important;
  }
  body.watch-page .watch-page-shell {
    margin:0!important;
    padding:0!important;
    display:block!important;
  }
  body.watch-page .watch-layout,
  html[dir="rtl"] body.watch-page .watch-layout,
  body.watch-page.lang-ar .watch-layout,
  body.watch-page.lang-ltr .watch-layout {
    display:block!important;
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    margin:0!important;
    padding:0!important;
    transform:none!important;
    direction:inherit!important;
  }
  body.watch-page .watch-main,
  body.watch-page .watch-recommendations,
  html[dir="rtl"] body.watch-page .watch-main,
  html[dir="rtl"] body.watch-page .watch-recommendations {
    display:block!important;
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    margin:0!important;
    padding:0!important;
    flex:none!important;
    order:initial!important;
    transform:none!important;
  }
  body.watch-page .player,
  body.watch-page .player iframe {
    display:block!important;
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
  }
  body.watch-page .player {
    aspect-ratio:16/9!important;
    height:auto!important;
    margin:0!important;
    border-radius:10px!important;
  }
  body.watch-page .watch-recommendations {
    margin-top:22px!important;
    padding:18px 0 0!important;
    border-top:1px solid var(--line)!important;
  }
  body.watch-page .watch-recommendations .side-videos {
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    overflow:visible!important;
  }

  /* Mobile home/search/channel grids: never preserve desktop column sizing. */
  .grid.videos,
  .topic-preview-grid,
  .news-grid,
  .home-news-grid {
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    grid-template-columns:1fr!important;
  }
  .grid.videos > *, .topic-preview-grid > *, .news-grid > *, .home-news-grid > * { min-width:0!important; }

  /* Shorts: no hidden desktop width or horizontal overflow on phones. */
  .short-single-player, .short-stage, .short-player { max-width:92vw!important; }
  .short-single-actions { max-width:92vw!important; }
}

@media (max-width: 650px) {
  .yt-header-inner { width:100%!important; max-width:100%!important; }
  .header-search { width:100%!important; min-width:0!important; }
  body.watch-page .site-main { padding-left:8px!important; padding-right:8px!important; }
  body.watch-page .player { width:100%!important; max-width:100%!important; }
}


/* YalaTube responsive repair v39: one viewport, header first, no horizontal page movement */
html,body{width:100%;max-width:100%;overflow-x:hidden}
body{min-width:0}
.yt-header{width:100%;overflow:hidden}
.yt-header-inner{width:100%;max-width:none;min-width:0}
.site-main,.content-inner,.watch-page-shell,.watch-layout,.watch-main,.watch-recommendations{min-width:0;max-width:100%}

@media (max-width:980px){
  :root{--header-h:56px;--sidebar-w:0px}
  .yt-header{height:var(--header-h)}
  .yt-header-inner{display:flex;align-items:center;gap:8px;padding:0 8px;direction:inherit}
  .brand-wrap{display:flex;align-items:center;gap:6px;flex:0 0 auto;min-width:auto}
  .menu-btn{display:inline-flex!important;align-items:center;justify-content:center;width:40px;height:40px}
  .brand{font-size:18px;white-space:nowrap}
  .brand-mark{width:30px;height:22px}
  .brand-country{display:none}
  .header-search{display:flex;order:2;flex:1 1 auto;width:auto;min-width:0;max-width:none;margin:0}
  .header-search input{min-width:0;width:100%;height:38px}
  .header-search button{width:48px;height:38px;flex:0 0 48px}
  .header-actions{order:3;flex:0 0 auto;gap:2px}
  .header-actions .create-btn{display:none}
  .header-actions .header-icon{display:none}
  .header-avatar{width:32px;height:32px}
  .yt-sidebar{top:var(--header-h);bottom:0;right:0;left:auto;width:min(86vw,280px);transform:translateX(110%);border-inline-start:1px solid var(--line);border-inline-end:0;z-index:110}
  html[dir="ltr"] .yt-sidebar{left:0;right:auto;transform:translateX(-110%);border-inline-start:0;border-inline-end:1px solid var(--line)}
  body.sidebar-open .yt-sidebar{transform:translateX(0)!important}
  html[dir="ltr"] body.sidebar-open .yt-sidebar{transform:translateX(0)!important}
  .side-mobile-backdrop{inset:var(--header-h) 0 0;z-index:100}
  .site-main{margin:0!important;padding:12px 10px 40px!important;width:100%!important}
  .content-inner{width:100%!important;margin:0!important}

  /* Home/search grids */
  .grid.videos{grid-template-columns:repeat(2,minmax(0,1fr));gap:22px 10px}
  .topic-row{width:100%;overflow-x:auto;overscroll-behavior-x:contain}
  .home-short-card{min-width:0}

  /* Watch: player first, recommendations below on phones */
  body.watch-page .watch-page-shell{width:100%!important;max-width:none!important;margin:0!important}
  body.watch-page .watch-layout{display:flex!important;flex-direction:column!important;gap:20px!important;width:100%!important}
  body.watch-page .watch-main{order:1!important;width:100%!important}
  body.watch-page .watch-recommendations{order:2!important;width:100%!important}
  body.watch-page .player{width:100%!important;max-width:none!important;aspect-ratio:16/9;margin:0!important}
  body.watch-page .video-title{font-size:18px}
  body.watch-page .watch-recommendations .side-videos{display:flex!important;flex-direction:column!important;width:100%!important}
  body.watch-page .watch-recommendations .side-card{display:grid!important;grid-template-columns:120px minmax(0,1fr)!important;width:100%!important;gap:10px!important}
  body.watch-page .watch-recommendations .side-card img{width:120px!important;height:68px!important}
  html[dir="rtl"] body.watch-page .watch-recommendations .side-card{direction:rtl}
  html[dir="ltr"] body.watch-page .watch-recommendations .side-card{direction:ltr}

  /* Shorts */
  .shorts-feed{height:auto!important;overflow:visible!important}
  .short-item{min-height:auto!important;grid-template-columns:1fr!important;gap:12px!important}
  .short-player{width:min(100%,420px)!important;margin:auto}
  .short-info{display:none!important}

  /* Footer */
  .yt-footer{width:100%!important;margin:20px 0 0!important}
}

@media (max-width:620px){
  .yt-header-inner{padding:0 6px}
  .brand{font-size:16px}
  .header-search input{font-size:13px;padding:0 10px}
  .header-search button{width:44px;flex-basis:44px}
  .grid.videos{grid-template-columns:1fr!important}
  .card-body{grid-template-columns:34px minmax(0,1fr);gap:8px}
  .title{font-size:14px}
  .channel-avatar{width:32px;height:32px}
  .section{margin-top:22px}
  .section-head h2{font-size:18px}
  body.watch-page .site-main{padding:8px 0 30px!important}
  body.watch-page .player{border-radius:0!important}
  body.watch-page .watch-recommendations{padding:0 10px}
  body.watch-page .watch-recommendations .side-card{grid-template-columns:112px minmax(0,1fr)!important}
  body.watch-page .watch-recommendations .side-card img{width:112px!important;height:63px!important}
  .footer-inner{padding:0 10px}
}

/* v39: light/dark theme asset version marker */

/* YalaTube v41 — FINAL mobile viewport alignment repair. The header and page content
   share the exact same viewport box; no desktop sidebar/grid can shift either axis. */
html, body {
  width: 100% !important;
  max-width: 100vw !important;
  min-width: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow-x: hidden !important;
}

@media (max-width: 980px) {
  .yt-header {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100vw !important;
    height: 56px !important;
    margin: 0 !important;
    padding: 0 !important;
    transform: none !important;
  }
  .yt-header-inner {
    width: 100vw !important;
    max-width: 100vw !important;
    min-width: 0 !important;
    height: 56px !important;
    margin: 0 !important;
    padding: 0 8px !important;
    box-sizing: border-box !important;
    display: grid !important;
    grid-template-columns: auto minmax(0, 1fr) auto !important;
    align-items: center !important;
    gap: 8px !important;
    direction: ltr !important;
  }

  /* Keep brand physically on the right in Arabic, and on the left in LTR. */
  html[dir="rtl"] .brand-wrap { grid-column: 3 !important; direction: rtl !important; }
  html[dir="rtl"] .header-search { grid-column: 2 !important; direction: rtl !important; }
  html[dir="rtl"] .header-actions { grid-column: 1 !important; direction: rtl !important; }
  html[dir="ltr"] .brand-wrap { grid-column: 1 !important; direction: ltr !important; }
  html[dir="ltr"] .header-search { grid-column: 2 !important; direction: ltr !important; }
  html[dir="ltr"] .header-actions { grid-column: 3 !important; direction: ltr !important; }

  .brand-wrap { min-width: 0 !important; width: auto !important; margin: 0 !important; }
  .brand { white-space: nowrap !important; }
  .header-search {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    margin: 0 !important;
  }
  .header-search input { min-width: 0 !important; width: 100% !important; box-sizing: border-box !important; }
  .header-actions { min-width: 0 !important; width: auto !important; margin: 0 !important; }

  /* The page starts exactly below the fixed header and can never be shifted sideways. */
  .site-main,
  .content-inner,
  body.watch-page .site-main,
  body.watch-page .content-inner,
  body.watch-page .watch-page-shell,
  body.watch-page .watch-layout,
  body.watch-page .watch-main,
  body.watch-page .watch-recommendations {
    position: relative !important;
    left: 0 !important;
    right: 0 !important;
    inset-inline: 0 !important;
    transform: none !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    min-width: 0 !important;
    max-width: 100vw !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  .site-main { margin-top: 56px !important; padding: 12px 10px 40px !important; }
  .content-inner { padding: 0 !important; }

  /* Mobile watch page: player and content are stacked, flush with viewport. */
  body.watch-page .site-main { padding: 0 !important; }
  body.watch-page .content-inner { width: 100% !important; }
  body.watch-page .watch-page-shell { padding: 0 !important; }
  body.watch-page .watch-layout { display: flex !important; flex-direction: column !important; gap: 20px !important; }
  body.watch-page .watch-main { order: 1 !important; padding: 0 !important; }
  body.watch-page .watch-recommendations { order: 2 !important; padding: 16px 10px 0 !important; }
  body.watch-page .player { width: 100% !important; max-width: none !important; aspect-ratio: 16 / 9 !important; margin: 0 !important; border-radius: 0 !important; }
  body.watch-page .player iframe { width: 100% !important; height: 100% !important; display: block !important; }

  /* No internal horizontal scrollers on the page itself. */
  .grid, .section, .topic-row, .watch-layout, .watch-page-shell { max-width: 100vw !important; }
}

@media (max-width: 600px) {
  .yt-header-inner { padding: 0 6px !important; gap: 6px !important; }
  .brand { font-size: 16px !important; }
  .brand-mark { width: 28px !important; }
  .header-search input { font-size: 12px !important; }
  .site-main { padding-left: 8px !important; padding-right: 8px !important; }
  body.watch-page .site-main { padding: 0 !important; }
}

/* YalaTube v42 — Arabic mobile layout fix.
   Keep the page/layout axis LTR so RTL cannot mirror the physical viewport.
   Text/content direction remains RTL inside the actual content blocks. */
@media (max-width: 980px) {
  html[dir="rtl"],
  html[dir="rtl"] body {
    width:100% !important;
    max-width:100vw !important;
    min-width:0 !important;
    overflow-x:hidden !important;
  }

  html[dir="rtl"] body .yt-header,
  html[dir="rtl"] body .yt-header-inner {
    left:0 !important;
    right:0 !important;
    width:100vw !important;
    max-width:100vw !important;
    min-width:0 !important;
    box-sizing:border-box !important;
    margin-left:0 !important;
    margin-right:0 !important;
    transform:none !important;
  }

  html[dir="rtl"] body .site-main,
  html[dir="rtl"] body .content-inner,
  html[dir="rtl"] body .watch-page-shell,
  html[dir="rtl"] body .watch-layout,
  html[dir="rtl"] body .watch-main,
  html[dir="rtl"] body .watch-recommendations {
    direction:ltr !important;
    position:relative !important;
    left:0 !important;
    right:0 !important;
    inset-inline-start:0 !important;
    inset-inline-end:0 !important;
    transform:none !important;
    margin-left:0 !important;
    margin-right:0 !important;
    width:100% !important;
    max-width:100vw !important;
    min-width:0 !important;
    box-sizing:border-box !important;
  }

  html[dir="rtl"] body .site-main { margin-top:56px !important; }
  html[dir="rtl"] body .content-inner { margin:0 !important; padding:0 !important; }

  /* Re-apply RTL to the actual text/content surfaces, not the page axis. */
  html[dir="rtl"] body .section,
  html[dir="rtl"] body .section-head,
  html[dir="rtl"] body .card,
  html[dir="rtl"] body .card-body,
  html[dir="rtl"] body .video-title,
  html[dir="rtl"] body .video-meta,
  html[dir="rtl"] body .channel-row,
  html[dir="rtl"] body .channel-info,
  html[dir="rtl"] body .watch-actions,
  html[dir="rtl"] body .description,
  html[dir="rtl"] body .comments,
  html[dir="rtl"] body .news-article,
  html[dir="rtl"] body .news-card,
  html[dir="rtl"] body .profile-page,
  html[dir="rtl"] body .topic-row {
    direction:rtl !important;
  }

  html[dir="rtl"] body.watch-page .watch-layout {
    display:flex !important;
    flex-direction:column !important;
    align-items:stretch !important;
    gap:20px !important;
  }

  html[dir="rtl"] body.watch-page .watch-main,
  html[dir="rtl"] body.watch-page .watch-recommendations {
    flex:0 0 auto !important;
    order:initial !important;
  }

  html[dir="rtl"] body.watch-page .player,
  html[dir="rtl"] body.watch-page .player iframe {
    width:100% !important;
    max-width:100% !important;
    min-width:0 !important;
    display:block !important;
    margin:0 !important;
    box-sizing:border-box !important;
  }

  html[dir="rtl"] body.watch-page .watch-recommendations .side-card {
    direction:rtl !important;
  }

  /* Header physical positions: menu/brand on the right, search center, actions left. */
  html[dir="rtl"] body .yt-header-inner {
    direction:ltr !important;
    display:grid !important;
    grid-template-columns:auto minmax(0,1fr) auto !important;
    align-items:center !important;
  }
  html[dir="rtl"] body .yt-header-inner .brand-wrap { grid-column:3 !important; direction:rtl !important; }
  html[dir="rtl"] body .yt-header-inner .header-search { grid-column:2 !important; direction:rtl !important; }
  html[dir="rtl"] body .yt-header-inner .header-actions { grid-column:1 !important; direction:rtl !important; }
}

@media (max-width: 600px) {
  html[dir="rtl"] body .site-main { padding-left:0 !important; padding-right:0 !important; }
  html[dir="rtl"] body.watch-page .site-main { padding:0 !important; }
  html[dir="rtl"] body .yt-header-inner { padding-left:6px !important; padding-right:6px !important; }
}

/* YalaTube v43 — FINAL Arabic mobile viewport correction */
@media (max-width: 980px) {
  html[dir="rtl"], html[dir="rtl"] body {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow-x: hidden !important;
  }

  html[dir="rtl"] body .yt-header {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    inset-inline: 0 !important;
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    transform: none !important;
  }

  html[dir="rtl"] body .yt-header-inner {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding-inline: 6px !important;
    box-sizing: border-box !important;
  }

  html[dir="rtl"] body .site-main,
  html[dir="rtl"] body .content-inner,
  html[dir="rtl"] body .watch-page-shell,
  html[dir="rtl"] body .watch-layout,
  html[dir="rtl"] body .watch-main,
  html[dir="rtl"] body .watch-recommendations,
  html[dir="rtl"] body .section,
  html[dir="rtl"] body .grid {
    margin-inline-start: 0 !important;
    margin-inline-end: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-inline-start: 0 !important;
    padding-inline-end: 0 !important;
    left: auto !important;
    right: auto !important;
    inset-inline-start: auto !important;
    inset-inline-end: auto !important;
    transform: none !important;
    min-width: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  html[dir="rtl"] body .site-main {
    margin-top: 56px !important;
  }

  html[dir="rtl"] body .content-inner {
    padding-top: 0 !important;
  }

  html[dir="rtl"] body.watch-page .site-main {
    margin-top: 56px !important;
    padding: 0 !important;
  }

  html[dir="rtl"] body.watch-page .watch-layout {
    display: flex !important;
    flex-direction: column !important;
    gap: 20px !important;
  }

  html[dir="rtl"] body.watch-page .watch-main,
  html[dir="rtl"] body.watch-page .watch-recommendations {
    flex: 0 0 auto !important;
  }

  html[dir="rtl"] body .grid.videos {
    grid-template-columns: 1fr !important;
    gap: 20px !important;
  }

  html[dir="rtl"] body .topic-row {
    max-width: 100% !important;
    width: 100% !important;
    overflow-x: auto !important;
  }
}


/* YalaTube v45 — mobile Arabic layout axis reset
   IMPORTANT: keep page/layout axis LTR on mobile, while content surfaces remain RTL.
   This prevents the browser's RTL flex/grid start edge from creating a phantom horizontal viewport. */
@media (max-width: 980px) {
  html,
  html[dir="rtl"],
  html[dir="ltr"] {
    direction: ltr !important;
    writing-mode: horizontal-tb !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow-x: hidden !important;
  }

  body,
  body.lang-ar,
  body.lang-ltr {
    direction: ltr !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow-x: hidden !important;
  }

  .yt-header {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: auto !important;
    width: 100vw !important;
    max-width: 100vw !important;
    min-width: 0 !important;
    margin: 0 !important;
    transform: none !important;
  }

  .yt-header-inner {
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 8px !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 8px !important;
    direction: ltr !important;
    overflow: hidden !important;
  }

  /* Arabic physical header: actions/search on the left, logo/menu on the right. */
  body.lang-ar .yt-header-inner .header-actions { order: 1 !important; direction: rtl !important; flex: 0 0 auto !important; }
  body.lang-ar .yt-header-inner .header-search  { order: 2 !important; direction: rtl !important; flex: 1 1 auto !important; min-width: 0 !important; width: auto !important; max-width: none !important; }
  body.lang-ar .yt-header-inner .brand-wrap     { order: 3 !important; direction: rtl !important; flex: 0 0 auto !important; }
  body.lang-ltr .yt-header-inner .brand-wrap    { order: 1 !important; }
  body.lang-ltr .yt-header-inner .header-search { order: 2 !important; }
  body.lang-ltr .yt-header-inner .header-actions{ order: 3 !important; }

  body.lang-ar .yt-header-inner .header-search input {
    min-width: 0 !important;
    width: 100% !important;
  }

  .yt-sidebar {
    direction: rtl !important;
    position: fixed !important;
    top: var(--header-h) !important;
    bottom: 0 !important;
    width: min(300px, 86vw) !important;
    max-width: 86vw !important;
    min-width: 0 !important;
    z-index: 100 !important;
  }

  /* Main layout axis is always neutral on mobile. */
  .site-main,
  .content-inner,
  .watch-page-shell,
  .watch-layout,
  .watch-main,
  .watch-recommendations,
  .section,
  .grid {
    position: static !important;
    inset: auto !important;
    left: auto !important;
    right: auto !important;
    transform: none !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    margin-inline: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }

  .site-main {
    direction: ltr !important;
    margin-top: var(--header-h) !important;
    padding: 14px 12px 36px !important;
  }

  .content-inner {
    direction: ltr !important;
    padding: 0 !important;
  }

  /* Arabic content/text surfaces. The outer axis stays LTR so widths cannot drift. */
  body.lang-ar .site-main,
  body.lang-ar .content-inner,
  body.lang-ar .section,
  body.lang-ar .section-head,
  body.lang-ar .card,
  body.lang-ar .card-body,
  body.lang-ar .title,
  body.lang-ar .channel,
  body.lang-ar .meta,
  body.lang-ar .topic-row,
  body.lang-ar .home-welcome,
  body.lang-ar .watch-page-shell,
  body.lang-ar .watch-main,
  body.lang-ar .watch-recommendations,
  body.lang-ar .video-title,
  body.lang-ar .video-meta,
  body.lang-ar .channel-row,
  body.lang-ar .channel-info,
  body.lang-ar .watch-actions,
  body.lang-ar .description,
  body.lang-ar .comments,
  body.lang-ar .news-article,
  body.lang-ar .news-card,
  body.lang-ar .profile-page,
  body.lang-ar .yt-footer {
    direction: rtl !important;
  }

  body.lang-ar .grid.videos {
    direction: rtl !important;
    grid-template-columns: 1fr !important;
    gap: 20px !important;
  }

  body.lang-ar .topic-row {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    overscroll-behavior-x: contain !important;
  }

  body.watch-page .watch-layout,
  body.lang-ar.watch-page .watch-layout,
  body.lang-ltr.watch-page .watch-layout {
    display: block !important;
    direction: ltr !important;
  }

  body.watch-page .player,
  body.watch-page .player iframe {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    height: auto !important;
    aspect-ratio: 16 / 9 !important;
    margin: 0 !important;
  }

  body.watch-page .watch-recommendations {
    margin-top: 20px !important;
    padding-top: 18px !important;
  }

  body.lang-ar.watch-page .watch-recommendations .side-card {
    direction: rtl !important;
  }

  footer.yt-footer {
    position: static !important;
    left: auto !important;
    right: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding-left: 12px !important;
    padding-right: 12px !important;
    box-sizing: border-box !important;
    direction: rtl !important;
  }
}

@media (max-width: 600px) {
  .yt-header { height: 56px !important; }
  .yt-header-inner { height: 56px !important; }
  .site-main { margin-top: 56px !important; padding: 12px 10px 28px !important; }
  body.watch-page .site-main { margin-top: 56px !important; padding: 0 0 28px !important; }
  .content-inner { padding: 0 !important; }
  body.watch-page .watch-page-shell { padding: 0 !important; }
  body.lang-ar .watch-main { width: 100% !important; }
  body.lang-ar .watch-recommendations { width: 100% !important; }
}

/* YalaTube v46 — authoritative sidebar behavior: desktop visible, mobile only via ☰. */
@media (min-width: 981px) {
  :root { --sidebar-w: 240px !important; --header-h: 64px !important; }
  body:not(.watch-page) .yt-sidebar {
    display: block !important;
    position: fixed !important;
    top: var(--header-h) !important;
    bottom: 0 !important;
    width: var(--sidebar-w) !important;
    max-width: var(--sidebar-w) !important;
    overflow-y: auto !important;
    transform: none !important;
    visibility: visible !important;
    opacity: 1 !important;
  }
  html[dir="rtl"] body:not(.watch-page) .yt-sidebar { right: 0 !important; left: auto !important; }
  html[dir="ltr"] body:not(.watch-page) .yt-sidebar { left: 0 !important; right: auto !important; }

  body:not(.watch-page) .site-main {
    width: auto !important;
    max-width: none !important;
    min-width: 0 !important;
    margin-top: var(--header-h) !important;
  }
  html[dir="rtl"] body:not(.watch-page) .site-main { margin-right: var(--sidebar-w) !important; margin-left: 0 !important; }
  html[dir="ltr"] body:not(.watch-page) .site-main { margin-left: var(--sidebar-w) !important; margin-right: 0 !important; }

  /* The hamburger is a desktop toggle too, but the sidebar starts open. */
  body:not(.watch-page) .yt-header-inner { min-width: 0 !important; }
}

@media (max-width: 980px) {
  /* Mobile: sidebar is always off-canvas until ☰ is clicked. */
  .yt-sidebar {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: fixed !important;
    top: var(--header-h) !important;
    bottom: 0 !important;
    width: min(86vw, 280px) !important;
    max-width: 86vw !important;
    transform: translateX(110%) !important;
    z-index: 120 !important;
    overflow-y: auto !important;
  }
  html[dir="rtl"] .yt-sidebar { right: 0 !important; left: auto !important; }
  html[dir="ltr"] .yt-sidebar { left: 0 !important; right: auto !important; }
  html[dir="rtl"] .yt-sidebar { transform: translateX(110%) !important; }
  html[dir="ltr"] .yt-sidebar { transform: translateX(-110%) !important; }
  body.sidebar-open .yt-sidebar { transform: translateX(0) !important; }

  .yt-header { position: fixed !important; top: 0 !important; left: 0 !important; right: 0 !important; width: 100vw !important; }
  .yt-header-inner { width: 100vw !important; max-width: 100vw !important; min-width: 0 !important; box-sizing: border-box !important; }
  .site-main { width: 100% !important; max-width: 100% !important; margin-left: 0 !important; margin-right: 0 !important; }

  /* Watch pages keep the sidebar hidden on mobile; ☰ opens it. */
  body.watch-page .yt-sidebar { transform: translateX(110%) !important; }
  html[dir="ltr"] body.watch-page .yt-sidebar { transform: translateX(-110%) !important; }
  body.watch-page.sidebar-open .yt-sidebar { transform: translateX(0) !important; }
}
