:root {
  --green:#0f5132; --green-2:#073b25; --green-3:#176a45; --gold:#c49a3a;
  --cream:#fffaf0; --surface:#fffdf7; --muted:#f2ecdf; --line:#e7dfcf;
  --text:#18211b; --sub:#657067; --danger:#a73636; --shadow:0 14px 35px rgba(26,43,32,.10);
  --radius:22px; --player-h:92px; --nav-h:66px;
}

/* ===== Theme system v1.4 ===== */
:root{color-scheme:light}
:root[data-theme="dark"]{
  color-scheme:dark;
  --green:#4fac79;--green-2:#143c2a;--green-3:#65c18e;--gold:#dfbd67;
  --cream:#0b100d;--surface:#121a15;--muted:#1b251f;--line:#2a352e;
  --text:#edf4ef;--sub:#9eaba2;--danger:#ef8b8b;--shadow:0 14px 35px rgba(0,0,0,.32);
}
:root[data-theme="dark"] .topbar{background:rgba(11,16,13,.92);border-bottom-color:rgba(42,53,46,.9)}
:root[data-theme="dark"] .icon-btn{color:#70c995}
:root[data-theme="dark"] .icon-btn.active{background:#20372a}
:root[data-theme="dark"] .badge{color:#201a0c;border-color:var(--cream)}
:root[data-theme="dark"] .nav-title{color:#7f8d84}
:root[data-theme="dark"] .nav-item{color:#b9c5bd}
:root[data-theme="dark"] .nav-item.active{background:#286943;color:#fff}
:root[data-theme="dark"] .btn.primary{background:#f2f6f3;color:#123b29}
:root[data-theme="dark"] .btn.green{background:#286943;color:#fff}
:root[data-theme="dark"] .btn.soft{background:#1b2a21;color:#bce2ca}
:root[data-theme="dark"] .btn.danger{background:#352020;color:#f1a1a1}
:root[data-theme="dark"] .card,:root[data-theme="dark"] .lecture,:root[data-theme="dark"] .more-link{box-shadow:none}
:root[data-theme="dark"] .feature-card .bubble,:root[data-theme="dark"] .avatar,:root[data-theme="dark"] .play-circle{background:#1c3024;color:#70c995}
:root[data-theme="dark"] .feature-card:hover,:root[data-theme="dark"] .lecture:hover{border-color:#3d5145}
:root[data-theme="dark"] .small-icon{color:#aebbb2}
:root[data-theme="dark"] .searchbox,:root[data-theme="dark"] .choice{background:#101813}
:root[data-theme="dark"] .searchbox input{color:var(--text)}
:root[data-theme="dark"] .pill{color:#b7c4bb}
:root[data-theme="dark"] .modal-wrap{background:rgba(0,0,0,.68)}
:root[data-theme="dark"] .modal:before{background:#526058}
:root[data-theme="dark"] .choice strong{color:#70c995}
:root[data-theme="dark"] .empty{border-color:#39463e}
:root[data-theme="dark"] .error{background:#341e1e;color:#f0aaaa}
:root[data-theme="dark"] .progress{background:#29342d}
:root[data-theme="dark"] .article-meta{color:#8f9d94}
:root[data-theme="dark"] .about-text{color:#c7d2ca}
:root[data-theme="dark"] .skeleton{background:linear-gradient(90deg,#172019 25%,#202b23 37%,#172019 63%);background-size:400% 100%}
:root[data-theme="dark"] .mobile-nav{background:rgba(14,20,16,.98);box-shadow:0 -4px 18px rgba(0,0,0,.18)}
:root[data-theme="dark"] .mobile-nav a{color:#9caaa1}
:root[data-theme="dark"] .mobile-nav a.active{color:#70c995}
:root[data-theme="dark"] select:not(.speed),:root[data-theme="dark"] input:not([type="range"]){background-color:#101813;color:var(--text);border-color:var(--line)}
:root[data-theme="dark"] .theme-select{min-width:104px}
*{box-sizing:border-box} html,body,#app{margin:0;min-height:100%;background:var(--cream);color:var(--text);font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Arial,sans-serif}
body{padding-bottom:calc(var(--player-h) + 18px)} button,input,select{font:inherit} button{cursor:pointer} a{color:inherit;text-decoration:none}
.icon{width:22px;height:22px;display:inline-block;vertical-align:middle;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.app-shell{min-height:100vh}.topbar{position:sticky;top:0;z-index:50;height:68px;background:rgba(255,250,240,.92);backdrop-filter:blur(18px);border-bottom:1px solid rgba(231,223,207,.75);display:flex;align-items:center;padding:0 max(18px,env(safe-area-inset-left));gap:14px}
.brand{display:flex;align-items:center;gap:11px;min-width:0}.brand img{width:42px;height:42px;border-radius:13px;object-fit:cover;border:1px solid var(--line)}.brand strong{font-size:17px}.brand small{display:block;color:var(--sub);font-size:11px;margin-top:2px}
.top-actions{margin-left:auto;display:flex;align-items:center;gap:7px}.icon-btn{border:0;background:transparent;color:var(--green);width:42px;height:42px;border-radius:14px;display:grid;place-items:center;position:relative}.icon-btn:hover{background:var(--muted)}.icon-btn.active{background:#e6f0e9}.badge{position:absolute;right:-3px;top:-2px;background:var(--gold);color:#1f1a0e;font-weight:800;font-size:9px;line-height:1;padding:4px 5px;border-radius:8px;border:2px solid var(--cream);min-width:23px;text-align:center}
.layout{display:grid;grid-template-columns:250px minmax(0,1fr);max-width:1440px;margin:auto}.sidebar{position:sticky;top:68px;height:calc(100vh - 68px);padding:18px 14px 120px;border-right:1px solid var(--line);overflow:auto}.nav-title{font-size:11px;font-weight:800;letter-spacing:.11em;text-transform:uppercase;color:#8b948d;margin:14px 12px 7px}.nav-item{display:flex;align-items:center;gap:12px;padding:11px 13px;border-radius:14px;color:#455047;margin:2px 0;font-weight:650;font-size:14px}.nav-item:hover{background:var(--muted)}.nav-item.active{background:var(--green);color:white}.nav-item .count{margin-left:auto;font-size:11px;opacity:.7}
.main{padding:24px 28px 150px;min-width:0}.content{max-width:1120px;margin:0 auto}.page-head{display:flex;align-items:flex-start;justify-content:space-between;gap:20px;margin-bottom:22px}.page-head h1{font-size:28px;margin:0 0 6px;letter-spacing:-.03em}.page-head p{margin:0;color:var(--sub);max-width:650px}.section{margin:30px 0}.section-head{display:flex;align-items:end;justify-content:space-between;gap:14px;margin-bottom:14px}.section-head h2{margin:0;font-size:20px;letter-spacing:-.02em}.section-head p{margin:3px 0 0;color:var(--sub);font-size:13px}.link-btn{border:0;background:none;color:var(--green);font-weight:750;padding:7px 2px}
.hero{background:linear-gradient(135deg,var(--green-2),var(--green));color:#fff;border-radius:28px;padding:25px;position:relative;overflow:hidden;box-shadow:var(--shadow)}.hero:after{content:"";position:absolute;width:330px;height:330px;border:1px solid rgba(255,255,255,.15);border-radius:50%;right:-130px;top:-120px;box-shadow:0 0 0 45px rgba(255,255,255,.035),0 0 0 90px rgba(255,255,255,.025)}.hero>*{position:relative;z-index:1}.hero-kicker{color:#e8ce88;font-size:12px;font-weight:850;letter-spacing:.1em;text-transform:uppercase}.hero h1{font-size:clamp(28px,5vw,46px);max-width:720px;line-height:1.04;margin:12px 0 12px;letter-spacing:-.045em}.hero p{max-width:680px;color:#e3eee7;line-height:1.6}.hero-actions{display:flex;gap:10px;flex-wrap:wrap;margin-top:20px}.btn{border:0;border-radius:14px;padding:11px 16px;font-weight:750;display:inline-flex;align-items:center;gap:8px;justify-content:center}.btn.primary{background:white;color:var(--green-2)}.btn.green{background:var(--green);color:white}.btn.soft{background:var(--muted);color:var(--green-2)}.btn.ghost{background:transparent;color:inherit;border:1px solid currentColor}.btn.danger{background:#f8e9e9;color:var(--danger)}.btn:disabled{opacity:.5;cursor:not-allowed}
.grid{display:grid;gap:14px}.grid.cards{grid-template-columns:repeat(4,minmax(0,1fr))}.grid.three{grid-template-columns:repeat(3,minmax(0,1fr))}.grid.two{grid-template-columns:repeat(2,minmax(0,1fr))}.card{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);box-shadow:0 5px 20px rgba(35,42,37,.035);overflow:hidden}.pad{padding:18px}.feature-card{padding:18px;min-height:128px;display:flex;flex-direction:column;justify-content:space-between}.feature-card .bubble{width:42px;height:42px;border-radius:14px;background:#e8f0ea;color:var(--green);display:grid;place-items:center}.feature-card h3{margin:16px 0 4px;font-size:15px}.feature-card p{margin:0;color:var(--sub);font-size:12px}.feature-card:hover{border-color:#b8cbbf;transform:translateY(-1px)}
.list{display:flex;flex-direction:column;gap:9px}.lecture{display:grid;grid-template-columns:46px minmax(0,1fr) auto;gap:12px;align-items:center;padding:11px 12px;background:var(--surface);border:1px solid var(--line);border-radius:17px}.lecture:hover{border-color:#b7c9bd}.play-circle{width:44px;height:44px;border-radius:50%;background:#eaf1ec;color:var(--green);display:grid;place-items:center;border:0}.lecture-title{font-weight:780;font-size:14px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.lecture-meta{font-size:12px;color:var(--sub);margin-top:4px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.lecture-actions{display:flex;gap:2px}.small-icon{width:37px;height:37px;border:0;background:transparent;border-radius:12px;display:grid;place-items:center;color:#5d675f}.small-icon:hover{background:var(--muted)}.small-icon.saved{color:var(--gold)}
.category-card{min-height:148px;background-size:cover;background-position:center;position:relative;display:flex;align-items:flex-end;padding:16px;color:white}.category-card:before{content:"";position:absolute;inset:0;background:linear-gradient(180deg,rgba(3,25,15,.05),rgba(3,25,15,.82))}.category-card>*{position:relative}.category-card h3{margin:0;font-size:16px}.category-card p{margin:4px 0 0;font-size:12px;color:#dce8e0}.avatar{width:52px;height:52px;border-radius:18px;background:#e8f0ea;color:var(--green);display:grid;place-items:center;font-weight:850;font-size:18px}
.searchbox{display:flex;align-items:center;gap:10px;background:white;border:1px solid var(--line);border-radius:18px;padding:0 14px;box-shadow:0 4px 18px rgba(32,45,36,.04)}.searchbox input{border:0;outline:0;background:transparent;width:100%;padding:14px 0;color:var(--text)}.filter-row{display:flex;gap:8px;flex-wrap:wrap;margin:12px 0 18px}.pill{border:1px solid var(--line);background:var(--surface);color:#4c584f;padding:8px 12px;border-radius:999px;font-size:12px;font-weight:700}.pill.active{background:var(--green);color:white;border-color:var(--green)}
.player{position:fixed;z-index:100;left:50%;bottom:max(14px,env(safe-area-inset-bottom));transform:translateX(-50%);width:min(980px,calc(100% - 32px));background:rgba(15,45,29,.96);color:white;border:1px solid rgba(255,255,255,.12);border-radius:23px;box-shadow:0 18px 50px rgba(10,25,16,.28);backdrop-filter:blur(18px);padding:10px 14px}.player-main{display:grid;grid-template-columns:minmax(170px,1fr) auto minmax(170px,1fr);gap:13px;align-items:center}.now{min-width:0}.now strong,.now span{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.now strong{font-size:13px}.now span{font-size:11px;color:#bed1c4;margin-top:3px}.controls{display:flex;align-items:center;gap:5px}.pbtn{border:0;background:transparent;color:white;width:39px;height:39px;border-radius:50%;display:grid;place-items:center}.pbtn:hover{background:rgba(255,255,255,.1)}.pbtn.big{width:49px;height:49px;background:white;color:var(--green)}.timeline{display:grid;grid-template-columns:42px 1fr 42px;align-items:center;gap:7px;font-size:9px;color:#c5d4ca}.timeline input{accent-color:#d7b35e;width:100%}.player-side{display:flex;align-items:center;justify-content:flex-end;gap:6px}.speed{border:1px solid rgba(255,255,255,.18);background:transparent;color:#fff;border-radius:10px;padding:6px 8px;font-size:11px}.queue-btn{font-size:11px;color:#d6e1da}
.modal-wrap{position:fixed;inset:0;z-index:200;background:rgba(8,18,12,.5);display:grid;place-items:end center;padding:20px}.modal{background:var(--surface);width:min(560px,100%);max-height:min(80vh,720px);overflow:auto;border-radius:26px;padding:20px;box-shadow:var(--shadow)}.modal h2{margin:0 0 6px}.modal p{color:var(--sub);font-size:13px}.modal-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:10px;margin-top:18px}.choice{padding:17px;border:1px solid var(--line);background:white;border-radius:17px;text-align:left}.choice strong{display:block;color:var(--green)}.choice span{font-size:11px;color:var(--sub)}.sheet-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:16px}.range{width:100%;accent-color:var(--green)}
.toast{position:fixed;z-index:300;left:50%;bottom:130px;transform:translateX(-50%);background:#17251c;color:white;padding:11px 16px;border-radius:14px;box-shadow:var(--shadow);font-size:13px}.empty{padding:34px;text-align:center;border:1px dashed #c9c1b2;border-radius:22px;color:var(--sub)}.empty strong{display:block;color:var(--text);margin-bottom:6px}.error{padding:14px;background:#faeceb;color:#7e2c2a;border-radius:14px;margin:10px 0}.muted{color:var(--sub)}.tiny{font-size:11px}.progress{height:5px;background:#e7e3da;border-radius:99px;overflow:hidden;margin-top:7px}.progress>i{display:block;height:100%;background:var(--gold)}
.article-card{padding:18px}.article-card h3{margin:0 0 7px}.article-card p{color:var(--sub);font-size:13px;line-height:1.55}.article-meta{display:flex;gap:8px;flex-wrap:wrap;font-size:11px;color:#778079}.article-body{font-size:16px;line-height:1.75}.article-body img{max-width:100%;height:auto;border-radius:16px}.article-body a{color:var(--green);text-decoration:underline}.article-body h1,.article-body h2,.article-body h3{line-height:1.25}.tag{background:var(--muted);padding:5px 8px;border-radius:8px}
.reels{height:calc(100vh - 130px);max-height:790px;display:grid;place-items:center}.reel{height:100%;aspect-ratio:9/16;max-width:100%;background:#000;border-radius:24px;overflow:hidden;position:relative}.reel video{width:100%;height:100%;object-fit:contain}.reel-side{position:absolute;right:12px;bottom:70px;display:flex;flex-direction:column;gap:12px}.reel-action{width:44px;height:44px;border:0;border-radius:50%;background:rgba(0,0,0,.42);color:#fff;display:grid;place-items:center}.reel-bottom{position:absolute;left:14px;right:65px;bottom:18px;color:#fff;text-shadow:0 1px 4px #000}.reel-nav{position:absolute;inset:0;display:grid;grid-template-rows:1fr 1fr}.reel-nav button{opacity:0;border:0;background:transparent}
.about-text{white-space:pre-line;line-height:1.8;color:#374039}.theme-select{min-width:104px;border:1px solid var(--line);background:var(--surface);color:var(--text);border-radius:12px;padding:9px 28px 9px 10px}.app-card{display:grid;grid-template-columns:68px 1fr auto;gap:14px;align-items:center;padding:14px}.app-card img{width:64px;height:64px;border-radius:15px;object-fit:cover}.app-card h3{margin:0 0 4px}.app-card p{margin:0;color:var(--sub);font-size:12px}.toggle{display:flex;align-items:center;justify-content:space-between;gap:20px;padding:15px 0;border-top:1px solid var(--line)}
.mobile-nav{display:none}.desktop-only{display:block}.mobile-only{display:none}
.skeleton{background:linear-gradient(90deg,#ece7dc 25%,#f7f3ea 37%,#ece7dc 63%);background-size:400% 100%;animation:shimmer 1.3s ease infinite;border-radius:14px;height:62px}@keyframes shimmer{0%{background-position:100% 0}100%{background-position:0 0}}
@media(max-width:1050px){.grid.cards{grid-template-columns:repeat(2,1fr)}.grid.three{grid-template-columns:repeat(2,1fr)}.layout{grid-template-columns:210px minmax(0,1fr)}.main{padding-inline:20px}.player-main{grid-template-columns:minmax(120px,1fr) auto minmax(120px,1fr)}}
@media(max-width:760px){:root{--nav-h:66px;--player-h:92px}.layout{display:block}.sidebar{display:none}.main{padding:16px 14px 180px}.topbar{height:62px}.brand small{display:none}.brand img{width:38px;height:38px}.brand strong{font-size:15px}.grid.cards,.grid.three,.grid.two{grid-template-columns:1fr 1fr}.hero{padding:21px;border-radius:24px}.hero h1{font-size:31px}.lecture{grid-template-columns:42px minmax(0,1fr) auto}.lecture-actions .small-icon:nth-child(n+3){display:none}.player{bottom:calc(var(--nav-h) + 8px);width:calc(100% - 18px);padding:8px 10px;border-radius:20px}.player-main{grid-template-columns:minmax(0,1fr) auto}.player-side{display:none}.now{grid-row:1}.controls{grid-column:2}.timeline{grid-column:1/-1}.controls .pbtn:first-child,.controls .pbtn:last-child{display:none}.pbtn.big{width:43px;height:43px}.mobile-nav{display:grid;position:fixed;z-index:90;bottom:0;left:0;right:0;height:calc(var(--nav-h) + env(safe-area-inset-bottom));padding-bottom:env(safe-area-inset-bottom);grid-template-columns:repeat(4,1fr);background:rgba(255,253,247,.96);backdrop-filter:blur(18px);border-top:1px solid var(--line)}.mobile-nav a{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;color:#69746c;font-size:9px;font-weight:750}.mobile-nav a.active{color:var(--green)}.mobile-nav .icon{width:20px;height:20px}.page-head h1{font-size:24px}.reels{height:calc(100vh - 200px)}.modal-wrap{padding:8px}.modal-grid{grid-template-columns:1fr 1fr}.desktop-only{display:none}.mobile-only{display:block}}
@media(max-width:480px){.grid.cards,.grid.three,.grid.two{grid-template-columns:1fr}.feature-card{min-height:110px}.page-head{align-items:center}.app-card{grid-template-columns:58px 1fr}.app-card img{width:54px;height:54px}.app-card .btn{display:none}}

/* ===== Mobile-first layout pass v2 ===== */
html{overflow-x:hidden;-webkit-text-size-adjust:100%}
body{overflow-x:hidden;overscroll-behavior-y:auto}
button,a,input,select{touch-action:manipulation}
button,.btn,.icon-btn,.small-icon,.pbtn,.nav-item,.mobile-nav a{min-height:44px}
.main,.content,.page-head>div,.lecture>div,.app-card>div{min-width:0}
.page-head h1,.page-head h2,.lecture-title,.article-card h3,.app-card h3{overflow-wrap:anywhere}

@media(max-width:760px){
  :root{--topbar-h:calc(58px + env(safe-area-inset-top));--nav-h:62px;--player-h:124px;--mobile-gutter:12px}
  body{padding-bottom:0;background:var(--cream)}
  .app-shell{min-height:100dvh}

  /* Safe-area header */
  .topbar{
    top:0;height:var(--topbar-h);min-height:var(--topbar-h);
    padding:env(safe-area-inset-top) max(var(--mobile-gutter),env(safe-area-inset-right)) 0 max(var(--mobile-gutter),env(safe-area-inset-left));
    gap:8px;background:color-mix(in srgb,var(--cream) 96%,transparent);border-bottom-color:var(--line)
  }
  .brand{gap:9px;flex:1;overflow:hidden}
  .brand img{width:36px;height:36px;border-radius:11px;flex:0 0 auto}
  .brand strong{display:block;font-size:14px;line-height:1.1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .brand small{display:none}
  .top-actions{gap:2px;flex:0 0 auto}
  .icon-btn{width:40px;height:40px;border-radius:12px;min-height:40px}
  .badge{right:-2px;top:-3px;font-size:8px;padding:4px;min-width:21px}

  /* Content geometry */
  .layout{display:block;max-width:none}
  .sidebar{display:none}
  .main{
    padding:14px max(var(--mobile-gutter),env(safe-area-inset-right)) calc(var(--nav-h) + var(--player-h) + 34px + env(safe-area-inset-bottom)) max(var(--mobile-gutter),env(safe-area-inset-left));
  }
  .content{max-width:none;width:100%}
  .section{margin:22px 0}
  .section-head{align-items:center;gap:10px;margin-bottom:12px}
  .section-head h2{font-size:18px}
  .section-head p{font-size:12px}
  .link-btn{min-height:40px;padding:8px 3px;white-space:nowrap}

  /* Page headers: allow actions to wrap instead of squeezing titles */
  .page-head{margin-bottom:16px;gap:10px;align-items:flex-start;flex-wrap:wrap}
  .page-head>div:first-child{flex:1 1 210px}
  .page-head h1{font-size:23px;line-height:1.13;margin-bottom:5px}
  .page-head p{font-size:13px;line-height:1.45}
  .page-head>.btn{flex:0 0 auto;min-height:42px;padding:9px 12px}
  .page-head>.icon-btn{margin-left:auto}

  /* Home hero becomes compact enough to leave content above the fold */
  .hero{padding:20px 18px;border-radius:22px;box-shadow:0 10px 28px rgba(26,43,32,.11)}
  .hero:after{width:230px;height:230px;right:-105px;top:-90px}
  .hero-kicker{font-size:10px;letter-spacing:.09em}
  .hero h1{font-size:29px;line-height:1.02;margin:9px 0 10px}
  .hero p{font-size:13px;line-height:1.55;margin:0}
  .hero-actions{gap:8px;margin-top:16px}
  .hero-actions .btn{padding:10px 13px;min-height:43px}

  /* Browse cards stay useful as a compact 2-column dashboard on phones */
  .grid.cards,.grid.three,.grid.two{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
  .feature-card{min-height:106px;padding:13px;border-radius:18px}
  .feature-card .bubble,.bubble{width:37px;height:37px;border-radius:12px}
  .feature-card h3{font-size:13px;margin:11px 0 3px;line-height:1.15}
  .feature-card p{font-size:10.5px;line-height:1.3}
  .category-card{min-height:126px;padding:13px;border-radius:18px}
  .category-card h3{font-size:14px;line-height:1.25}
  .category-card p{font-size:10.5px;line-height:1.35}
  .grid.three>.card.pad{padding:14px;border-radius:18px}
  .avatar{width:44px;height:44px;border-radius:14px;flex:0 0 auto}


  /* Search and filter controls */
  .searchbox{border-radius:15px;padding:0 12px;box-shadow:none}
  .searchbox input{padding:13px 0;font-size:16px;min-width:0} /* 16px prevents iOS zoom */
  .filter-row{flex-wrap:nowrap;overflow-x:auto;gap:7px;margin:10px calc(-1 * var(--mobile-gutter)) 16px;padding:0 var(--mobile-gutter) 3px;scrollbar-width:none;scroll-snap-type:x proximity}
  .filter-row::-webkit-scrollbar{display:none}
  .pill{flex:0 0 auto;padding:8px 11px;min-height:38px;scroll-snap-align:start}

  /* Lecture rows: content first row, actions second row. No mobile feature is hidden. */
  .list{gap:8px}
  .lecture{
    grid-template-columns:42px minmax(0,1fr);
    gap:8px 10px;padding:10px 10px 8px;border-radius:16px;align-items:center;overflow:hidden
  }
  .play-circle{width:42px;height:42px;grid-column:1;grid-row:1;align-self:start}
  .lecture>div:not(.lecture-actions){grid-column:2;grid-row:1;min-width:0;align-self:center}
  .lecture-title{font-size:13px;line-height:1.25;white-space:normal;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;text-overflow:ellipsis;max-width:100%}
  .lecture-meta{font-size:10.5px;line-height:1.35;margin-top:3px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .lecture-actions{
    grid-column:1/-1;grid-row:2;display:flex !important;justify-content:flex-end;gap:2px;
    margin-top:1px;padding-top:4px;border-top:1px solid rgba(231,223,207,.65)
  }
  .lecture-actions .small-icon:nth-child(n){display:grid}
  .small-icon{width:38px;height:38px;min-height:38px;border-radius:11px}
  .lecture>.small-icon:last-child,.lecture>span.tiny:last-child{grid-column:2;grid-row:2;justify-self:end;align-self:center;margin-top:0}
  .progress{margin-top:6px}
  .download-state{font-size:10px}

  /* Articles */
  .article-card{padding:14px;border-radius:18px}
  .article-card h3{font-size:15px;line-height:1.3}
  .article-card p{font-size:12px;line-height:1.5;margin-bottom:0}
  .article-meta{gap:6px;font-size:10.5px}
  .article-body{font-size:15px;line-height:1.72;overflow-wrap:anywhere}
  .article-body pre,.article-body table{max-width:100%;overflow:auto;display:block}
  .article-body iframe,.article-body video{max-width:100%}
  article.card.pad{padding:16px;border-radius:18px}

  /* Empty/error panels */
  .empty{padding:26px 16px;border-radius:18px;font-size:13px}
  .error{font-size:12px;margin-top:0}

  /* Mobile bottom navigation */
  .mobile-nav{
    display:grid;position:fixed;z-index:110;bottom:0;left:0;right:0;
    height:calc(var(--nav-h) + env(safe-area-inset-bottom));padding:0 max(4px,env(safe-area-inset-right)) env(safe-area-inset-bottom) max(4px,env(safe-area-inset-left));
    grid-template-columns:repeat(4,minmax(0,1fr));background:color-mix(in srgb,var(--surface) 98%,transparent);backdrop-filter:blur(20px);border-top:1px solid var(--line);box-shadow:0 -4px 18px rgba(26,43,32,.06)
  }
  .mobile-nav a{min-width:0;gap:2px;font-size:9.5px;line-height:1;padding-top:5px;border-radius:10px}
  .mobile-nav a.active{color:var(--green)}
  .mobile-nav .icon{width:20px;height:20px}

  /* Rebuilt mini player: title + full transport + timeline, without covering nav */
  .player{
    bottom:calc(var(--nav-h) + env(safe-area-inset-bottom) + 7px);width:calc(100% - 16px);
    padding:9px 10px 8px;border-radius:19px;box-shadow:0 14px 36px rgba(10,25,16,.28)
  }
  .player-main{grid-template-columns:minmax(0,1fr) auto;gap:5px 8px;align-items:center}
  .now{grid-column:1;grid-row:1;min-width:0;padding-left:2px}
  .now strong{font-size:12px;line-height:1.2}
  .now span{font-size:9.5px;margin-top:2px}
  .controls{grid-column:2;grid-row:1;gap:0}
  .controls .pbtn:first-child,.controls .pbtn:last-child{display:grid}
  .pbtn{width:34px;height:34px;min-height:34px}
  .pbtn.big{width:42px;height:42px;min-height:42px}
  .controls .pbtn .icon{width:19px;height:19px}
  .timeline{grid-column:1/-1;grid-row:2;grid-template-columns:34px minmax(0,1fr) 34px;gap:5px;font-size:8.5px}
  .timeline input{height:22px;margin:0;min-width:0}
  .player-side{grid-column:1/-1;grid-row:3;display:flex;justify-content:flex-end;gap:2px;margin-top:-2px;min-width:0}
  .player-side .pbtn{width:32px;height:32px;min-height:32px}
  .player-side .pbtn .icon{width:17px;height:17px}
  .player-side .speed{height:32px;min-height:32px;padding:4px 6px;font-size:10px;max-width:65px}
  .queue-btn{font-size:0}

  /* Bottom sheets use dynamic viewport + safe areas */
  .modal-wrap{
    align-items:end;place-items:end center;padding:0;background:rgba(8,18,12,.55)
  }
  .modal{
    width:100%;max-width:none;max-height:min(88dvh,760px);border-radius:24px 24px 0 0;
    padding:18px max(16px,env(safe-area-inset-right)) calc(18px + env(safe-area-inset-bottom)) max(16px,env(safe-area-inset-left));
    overscroll-behavior:contain;-webkit-overflow-scrolling:touch
  }
  .modal:before{content:"";display:block;width:42px;height:4px;border-radius:99px;background:#d8d1c4;margin:-7px auto 13px}
  .modal .page-head{margin-bottom:10px}
  .modal .page-head h2{font-size:20px;line-height:1.2}
  .modal-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin-top:12px}
  .choice{padding:14px 12px;border-radius:15px;min-height:82px}
  .choice strong{font-size:13px;line-height:1.25}
  .choice span{font-size:10.5px;line-height:1.35;display:block;margin-top:3px}
  .sheet-actions{gap:7px;flex-wrap:wrap}
  .sheet-actions .btn{min-height:42px}

  /* Reels should fit the *usable* mobile viewport, not desktop vh math */
  .reels{height:min(68dvh,610px);max-height:calc(100dvh - var(--topbar-h) - var(--nav-h) - 110px);min-height:360px}
  .reel{width:min(100%,390px);height:100%;border-radius:20px}
  .reel-side{right:9px;bottom:68px;gap:9px}
  .reel-action{width:42px;height:42px;min-height:42px}
  .reel-bottom{left:12px;right:58px;bottom:13px;font-size:12px}

  /* Settings / More controls */
  .toggle{gap:12px;padding:13px 0;align-items:center}
  .toggle>div{min-width:0;flex:1}
  .toggle>.btn,.toggle>a.btn,.toggle>select{flex:0 0 auto}
  .toggle select{max-width:88px}
  .more-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin-bottom:14px}
  .more-link{display:flex;align-items:center;gap:9px;padding:11px;border:1px solid var(--line);background:var(--surface);border-radius:15px;font-size:12px;font-weight:750;min-width:0}
  .more-link .icon{width:18px;height:18px;color:var(--green);flex:0 0 auto}
  .more-link span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}

  .app-card{grid-template-columns:52px minmax(0,1fr);gap:11px;padding:11px;border-radius:16px}
  .app-card img{width:52px;height:52px;border-radius:13px}
  .app-card h3{font-size:13px}
  .app-card p{font-size:10.5px;line-height:1.35}
  .app-card .btn{display:none}
  .about-text{font-size:14px;line-height:1.75;overflow-wrap:anywhere}

  .desktop-only{display:none!important}
  .mobile-only{display:block!important}
}

@media(max-width:420px){
  :root{--mobile-gutter:10px}
  .brand strong{font-size:13px}
  .top-actions .icon-btn{width:38px;height:38px;min-height:38px}
  .hero h1{font-size:27px}
  .hero-actions{display:grid;grid-template-columns:1fr 1fr}
  .hero-actions .btn{padding-inline:8px;font-size:12px}
  .grid.cards,.grid.three,.grid.two{grid-template-columns:repeat(2,minmax(0,1fr))}
  .page-head h1{font-size:21px}
  .page-head>.btn{font-size:11px}
  .player{width:calc(100% - 10px)}
  .now strong{font-size:11.5px}
  .now span{max-width:150px}
  .controls .pbtn{width:31px;height:31px;min-height:31px}
  .controls .pbtn.big{width:39px;height:39px;min-height:39px}
  .player-side{justify-content:space-between}
  .player-side .pbtn{width:31px}
  .modal-grid{grid-template-columns:1fr 1fr}
}

@media(max-width:350px){
  .brand strong{display:none}
  .hero-actions{grid-template-columns:1fr}
  .feature-card{min-height:102px;padding:11px}
  .grid.cards,.grid.three,.grid.two{gap:8px}
  .player-side .pbtn:nth-child(2),.player-side .pbtn:nth-child(3){display:none}
  .more-grid{grid-template-columns:1fr}
}

@media(max-width:760px) and (orientation:landscape){
  :root{--player-h:112px}
  .main{padding-bottom:calc(var(--nav-h) + var(--player-h) + 26px + env(safe-area-inset-bottom))}
  .hero{padding-block:16px}
  .hero h1{font-size:25px}
  .reels{height:calc(100dvh - var(--topbar-h) - var(--nav-h) - 30px);min-height:250px}
  .modal{max-height:94dvh}
}

@media(max-width:760px){
  .main{padding-bottom:calc(var(--nav-h) + 28px + env(safe-area-inset-bottom))}
  .app-shell.has-player .main{padding-bottom:calc(var(--nav-h) + var(--player-h) + 34px + env(safe-area-inset-bottom))}
  .toast{bottom:calc(var(--nav-h) + env(safe-area-inset-bottom) + 14px);max-width:calc(100% - 24px);white-space:normal;text-align:center}
  .app-shell.has-player .toast{bottom:calc(var(--nav-h) + var(--player-h) + env(safe-area-inset-bottom) + 14px)}
  .speaker-grid,.article-grid{grid-template-columns:1fr}
  .subject-grid,.tafseer-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  .speaker-grid>.card.pad{min-height:72px}
}

.modal-open,.modal-open body{overflow:hidden}
@media(max-width:760px){
  .top-actions .icon-btn{width:42px;height:42px;min-height:42px}
  .small-icon{width:42px;height:42px;min-height:42px}
  .player-side .speed{font-size:16px;width:68px;max-width:68px;padding:2px 3px}
}
@media(hover:none){
  .feature-card:hover{transform:none;border-color:var(--line)}
  .lecture:hover{border-color:var(--line)}
  .icon-btn:hover,.small-icon:hover,.pbtn:hover,.nav-item:hover{background:inherit}
}

/* ===== Mobile viewport + scroll architecture v3 ===== */
:root{--app-height:100dvh;--player-real-h:0px}
.now-button{appearance:none;-webkit-appearance:none;border:0;background:transparent;color:inherit;text-align:left;padding:0;font:inherit;min-width:0;cursor:pointer}

@media(max-width:760px){
  /* One stable viewport. The content pane is the only vertical scroller. */
  html,body,#app{width:100%;height:100%;min-height:0;overflow:hidden}
  html{overscroll-behavior:none;background:var(--cream)}
  body{padding:0;overscroll-behavior:none;position:relative}
  #app{isolation:isolate}
  .app-shell{
    height:var(--app-height,100dvh);min-height:0;max-height:var(--app-height,100dvh);
    display:flex;flex-direction:column;overflow:hidden;background:var(--cream)
  }
  .topbar{
    position:relative;top:auto;left:auto;right:auto;z-index:120;
    flex:0 0 var(--topbar-h);height:var(--topbar-h);min-height:var(--topbar-h)
  }
  .layout{flex:1 1 auto;min-height:0;height:auto;overflow:hidden}
  .main{
    height:100%;min-height:0;overflow-y:auto;overflow-x:hidden;
    -webkit-overflow-scrolling:touch;overscroll-behavior-y:contain;scrollbar-gutter:stable;
    touch-action:pan-y;scroll-padding-top:12px;
    padding-bottom:calc(var(--nav-h) + 28px + env(safe-area-inset-bottom));
  }
  .app-shell.has-player .main{
    padding-bottom:calc(var(--nav-h) + max(var(--player-real-h),96px) + 26px + env(safe-area-inset-bottom));
    scroll-padding-bottom:calc(var(--nav-h) + max(var(--player-real-h),96px) + 26px + env(safe-area-inset-bottom));
  }
  .content{min-height:min-content}
  .modal-open .main{overflow:hidden!important;touch-action:none}

  /* Player is intentionally compact: primary transport is always visible;
     title opens the details sheet for Share/Download/etc. */
  .player{
    bottom:calc(var(--nav-h) + env(safe-area-inset-bottom) + 6px);
    width:calc(100% - 12px);max-width:none;
    padding:8px 9px 7px;border-radius:18px;
    contain:layout paint;will-change:transform;
    touch-action:pan-y;
  }
  .player-main{grid-template-columns:minmax(0,1fr) auto;grid-template-rows:auto auto;gap:4px 7px}
  .now-button{grid-column:1;grid-row:1;width:100%;border-radius:9px;padding:3px 2px;min-height:38px;touch-action:manipulation}
  .now-button:active{background:rgba(255,255,255,.07)}
  .now strong{font-size:12px;line-height:1.15}
  .now span{font-size:9.5px;line-height:1.15;margin-top:2px}
  .controls{grid-column:2;grid-row:1;align-self:center}
  .controls .pbtn{width:33px;height:36px;min-height:36px}
  .controls .pbtn.big{width:42px;height:42px;min-height:42px}
  .timeline{grid-column:1;grid-row:2;grid-template-columns:30px minmax(72px,1fr) 30px;gap:4px;min-width:0}
  .timeline input{touch-action:pan-x;height:28px}
  .player-side{
    grid-column:2;grid-row:2;display:flex;align-items:center;justify-content:flex-end;gap:1px;
    margin:0;min-width:0
  }
  /* Share + Download remain available by tapping the current title/details.
     Keeping the dock small gives the page much more usable scroll area. */
  .player-side .pbtn:nth-child(2),.player-side .pbtn:nth-child(3){display:none}
  .player-side .pbtn{width:30px;height:30px;min-height:30px}
  .player-side .speed{width:57px;max-width:57px;height:30px;min-height:30px;font-size:14px;padding:1px 2px}
  .queue-btn{display:grid!important;width:30px!important}
  .player button,.player select{touch-action:manipulation}

  /* Stable bottom navigation independent from document scroll / browser chrome. */
  .mobile-nav{position:fixed;z-index:115;transform:translateZ(0);backface-visibility:hidden}

  /* Toasts use the measured player height, so they never cover controls. */
  .app-shell.has-player .toast{bottom:calc(var(--nav-h) + max(var(--player-real-h),96px) + env(safe-area-inset-bottom) + 12px)}

  /* If a long page changes route while scrolled, prevent anchor/focus jumps. */
  .main:focus{outline:none}
}

@media(max-width:390px){
  .player{width:calc(100% - 8px);padding-inline:7px}
  .controls .pbtn{width:30px}
  .controls .pbtn.big{width:39px}
  .timeline{grid-template-columns:27px minmax(60px,1fr) 27px;font-size:8px}
  .player-side .pbtn:first-child{display:none}
}

@media(max-width:760px) and (orientation:landscape){
  .app-shell.has-player .main{padding-bottom:calc(var(--nav-h) + max(var(--player-real-h),86px) + 20px + env(safe-area-inset-bottom))}
  .player{padding-block:5px}
}
.now-button:focus-visible{outline:2px solid rgba(228,189,91,.9);outline-offset:2px}

/* Desktop keeps native document scrolling so mouse-wheel and trackpad events
   always scroll the page. The inner .main scroller is mobile-only. */
@media(min-width:761px){
  html,body,#app{height:auto!important;min-height:100%;overflow-x:hidden!important;overflow-y:visible!important}
  html{overscroll-behavior-y:auto!important}
  body{position:static!important;overflow-y:auto!important;overscroll-behavior-y:auto!important;touch-action:auto!important}
  #app,.app-shell,.layout,.main{height:auto!important;max-height:none!important;min-height:0;overflow:visible!important;touch-action:auto!important}
  .main{display:block}
}
