:root{--bg:#0b0d10;--panel:#14181d;--panel2:#1c2229;--line:#262e37;--text:#eef2f6;--muted:#8d99a6;--acc:#3ea6ff;--acc2:#e82127;--r:14px}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{margin:0;height:100%;background:var(--bg);color:var(--text);font:22px/1.3 -apple-system,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;overflow:hidden;user-select:none}
button{font:inherit;color:inherit;background:none;border:0;cursor:pointer}
.hidden{display:none!important}
.muted{color:var(--muted)}.small{font-size:18px}.err{color:#ff6b6b;min-height:1.4em}
/* login */
#login{position:fixed;inset:0;display:flex;align-items:center;justify-content:center}
.login-box{text-align:center}
.login-box h1{font-size:56px;margin:0 0 8px}
.pin-dots{height:48px;display:flex;gap:16px;justify-content:center;margin:20px 0}
.pin-dots span{width:22px;height:22px;border-radius:50%;background:var(--text);display:inline-block;margin-top:13px}
.keypad{display:grid;grid-template-columns:repeat(3,130px);gap:18px;justify-content:center}
.keypad button{height:110px;border-radius:var(--r);background:var(--panel2);font-size:44px}
.keypad button:active{background:var(--acc)}
/* layout */
#app{position:fixed;inset:0;display:flex;flex-direction:column}
.topbar{display:flex;align-items:center;gap:16px;padding:14px 20px;background:var(--panel);border-bottom:1px solid var(--line)}
.tabs{display:flex;gap:8px}
.tab{padding:18px 28px;border-radius:var(--r);font-size:24px;font-weight:600;color:var(--muted)}
.tab.active{background:var(--panel2);color:var(--text);box-shadow:inset 0 -4px 0 var(--acc)}
.search-wrap{flex:1;display:flex;align-items:center;background:var(--panel2);border-radius:var(--r);padding:0 8px 0 20px;margin-left:8px}
#search{flex:1;background:none;border:0;color:var(--text);font:inherit;font-size:24px;padding:16px 0;outline:none}
.icon-btn{width:64px;height:64px;border-radius:var(--r);font-size:28px}
.icon-btn:active{background:var(--line)}
.body{flex:1;display:flex;min-height:0}
.groups{width:340px;overflow-y:auto;background:var(--panel);border-right:1px solid var(--line);padding:10px}
.groups button{display:flex;justify-content:space-between;width:100%;text-align:left;padding:18px 18px;border-radius:12px;font-size:21px;margin-bottom:4px}
.groups button.active{background:var(--acc);color:#001}
.groups button .c{color:var(--muted);font-size:17px;margin-left:8px}
.groups button.active .c{color:#012}
.main{flex:1;overflow-y:auto;padding:20px;-webkit-overflow-scrolling:touch}
.section-title{font-size:26px;font-weight:700;margin:6px 4px 16px}
.grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(300px,1fr));gap:16px}
.grid.posters{grid-template-columns:repeat(auto-fill,minmax(210px,1fr))}
.card{position:relative;background:var(--panel2);border-radius:var(--r);padding:16px;min-height:150px;display:flex;flex-direction:column;gap:10px;text-align:left;overflow:hidden}
.card:active{outline:3px solid var(--acc)}
.card .logo{height:70px;display:flex;align-items:center}
.card .logo img{max-height:70px;max-width:180px;object-fit:contain}
.card .logo .ph{font-size:30px;font-weight:800;color:var(--muted)}
.card .nm{font-weight:650;font-size:22px;padding-right:56px;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}
.card .ep{font-size:18px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.card .ep b{color:var(--text);font-weight:500}
.card .bar{height:5px;background:var(--line);border-radius:3px;overflow:hidden}.card .bar i{display:block;height:100%;background:var(--acc)}
.posters .card{min-height:330px;padding:0}
.posters .card .poster{height:250px;background:#0f1216 center/cover no-repeat;display:flex;align-items:center;justify-content:center;font-size:44px;color:var(--muted)}
.posters .card .poster img{width:100%;height:100%;object-fit:cover}
.posters .card .nm{padding:10px 56px 12px 14px;font-size:19px}
.star{position:absolute;top:6px;right:6px;width:58px;height:58px;font-size:32px;color:var(--muted);border-radius:12px;background:rgba(0,0,0,.35)}
.star.on{color:#ffc93c}
.more{display:block;margin:24px auto;padding:20px 50px;border-radius:var(--r);background:var(--panel2)}
.empty{color:var(--muted);text-align:center;margin-top:120px;font-size:26px}
.btn{padding:16px 28px;border-radius:var(--r);background:var(--panel2);font-weight:600}
.btn:active{background:var(--acc)}
.ep-list .row{display:flex;align-items:center;gap:18px;background:var(--panel2);border-radius:12px;padding:18px 20px;margin-bottom:10px;width:100%;text-align:left}
.ep-list .row .n{color:var(--acc);font-weight:700;min-width:90px}
.season-h{margin:22px 4px 10px;font-weight:700;color:var(--muted)}
/* menu */
.menu{position:fixed;top:96px;right:16px;width:520px;background:var(--panel);border:1px solid var(--line);border-radius:var(--r);padding:16px;z-index:20;box-shadow:0 20px 60px #000a}
.menu-row{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:10px 4px}
.seg{display:flex;background:var(--panel2);border-radius:12px;padding:4px}
.seg button{padding:12px 18px;border-radius:9px;font-size:19px}
.seg button.on{background:var(--acc);color:#001}
/* guide */
.guide-ctrl{display:flex;gap:12px;align-items:center;margin-bottom:14px}
.guide{position:relative;border:1px solid var(--line);border-radius:var(--r);overflow:auto;max-height:calc(100vh - 230px)}
.g-head,.g-row{display:flex;min-width:max-content}
.g-head{position:sticky;top:0;z-index:3;background:var(--panel)}
.g-ch{position:sticky;left:0;z-index:2;width:260px;flex:none;background:var(--panel);border-right:1px solid var(--line);border-bottom:1px solid var(--line);padding:10px 14px;display:flex;align-items:center;gap:10px;font-size:19px;font-weight:600;text-align:left;height:84px;overflow:hidden}
.g-ch img{max-width:64px;max-height:44px;object-fit:contain}
.g-track{position:relative;height:84px;border-bottom:1px solid var(--line);flex:none}
.g-slot{position:absolute;top:0;height:100%;border-left:1px solid var(--line);padding:10px 12px;font-size:17px;color:var(--muted)}
.g-prog{position:absolute;top:4px;bottom:4px;background:var(--panel2);border-radius:8px;padding:8px 12px;overflow:hidden;text-align:left;font-size:18px;white-space:nowrap;text-overflow:ellipsis;border:1px solid var(--line)}
.g-prog.now{background:#1b3247;border-color:#2b5679}
.g-prog small{display:block;color:var(--muted);font-size:15px}
.g-nowline{position:absolute;top:0;bottom:0;width:3px;background:var(--acc2);z-index:1}
/* player */
.player{position:fixed;inset:0;background:#000;z-index:50}
.player canvas,.player video{position:absolute;inset:0;width:100%;height:100%;object-fit:contain;background:#000}
.p-ui{position:absolute;inset:0;display:flex;flex-direction:column;justify-content:space-between;transition:opacity .3s;z-index:3}
.p-ui.idle{opacity:0}
.p-top{display:flex;align-items:center;gap:16px;padding:20px;background:linear-gradient(#000c,#0000)}
.p-title{flex:1;min-width:0}.p-title #p-name{font-size:30px;font-weight:700}.p-title #p-epg{font-size:20px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.p-bottom{padding:20px;background:linear-gradient(#0000,#000c)}
.p-ctrls{display:flex;gap:12px;justify-content:center;flex-wrap:wrap}
.pbtn{min-width:110px;height:84px;padding:0 22px;border-radius:var(--r);background:#ffffff1f;font-size:24px;font-weight:600;backdrop-filter:blur(6px)}
.pbtn.wide{min-width:160px;font-size:30px}
.pbtn:active{background:var(--acc)}
#p-fav{font-size:40px}#p-fav.on{color:#ffc93c}
.seekrow{display:flex;align-items:center;gap:18px;margin-bottom:16px;font-size:20px}
.seekrow input{flex:1;height:50px;accent-color:var(--acc)}
.unmute{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);padding:26px 44px;border-radius:var(--r);background:#000b;font-size:28px;border:2px solid var(--acc)}
.spinner{position:absolute;left:50%;top:50%;width:90px;height:90px;margin:-45px;border:8px solid #ffffff22;border-top-color:var(--acc);border-radius:50%;animation:spin 1s linear infinite;z-index:2}
@keyframes spin{to{transform:rotate(360deg)}}
.p-msg{position:absolute;left:50%;top:58%;transform:translateX(-50%);max-width:70%;text-align:center;background:#000c;padding:20px 30px;border-radius:var(--r);z-index:4;font-size:22px}
.p-msg button{margin:16px 8px 0}
/* Posters: real 2:3 covers, skip layout/paint for off-screen cards (long movie lists) */
.posters .card .poster{height:auto;aspect-ratio:2/3}
.posters .card{min-height:0}
.grid .card{content-visibility:auto;contain-intrinsic-size:auto 420px}
.posters .card .poster{position:relative}
.posters .card .poster .ph{font-size:44px;font-weight:800;color:var(--muted)}
.posters .card .poster img{position:absolute;inset:0;opacity:0;transition:opacity .2s}
.posters .card .poster img.ok{opacity:1}
