
*{box-sizing:border-box}html,body{margin:0;height:100%}
:root{
  --bg:#0e0e11;
  --bg-elev:#1a1a1f;
  --bg-elev2:#23232a;
  --line:#2a2a31;
  --line-soft:#20202a;
  --txt:#ececf1;
  --txt-dim:#9aa0ab;
  --accent:#2b8cff;
  --accent-dim:#1c6fd4;
  --danger:#a33;
  --radius:16px;
  --radius-sm:10px;
  --shadow:0 1px 0 rgba(255,255,255,.03), 0 8px 24px -14px rgba(0,0,0,.7);
}
body{font:15px/1.4 system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;
  background:var(--tg-theme-bg-color,#0e0e11);color:var(--tg-theme-text-color,#ececf1);
  -webkit-tap-highlight-color:transparent;-webkit-font-smoothing:antialiased}
.screen{display:none;min-height:100vh;padding:12px}
.screen.on{display:block}
h1{font-size:20px;margin:6px 0 14px}
.card{background:var(--tg-theme-secondary-bg-color,#1a1a1f);border-radius:var(--radius);
  padding:14px;margin:0 0 10px;box-shadow:var(--shadow)}
.card-head{display:flex;align-items:center;justify-content:space-between;gap:8px;margin:0 0 8px}
.card-head h3{font-size:13px;font-weight:700;letter-spacing:.3px;text-transform:uppercase;
  color:var(--txt-dim);margin:0}
button,input{font:inherit;border:0;border-radius:var(--radius-sm)}
button{background:var(--tg-theme-button-color,#2b8cff);color:var(--tg-theme-button-text-color,#fff);
  padding:12px 14px;cursor:pointer;font-weight:600;transition:filter .12s ease,transform .06s ease}
button:active{transform:translateY(1px)}
button.ghost{background:var(--bg-elev2);color:#ececf1}
button.danger{background:var(--danger)}
button[disabled]{opacity:.45}
input{background:#29292c;color:#fff;padding:12px;width:100%;margin:4px 0;
  border:1px solid transparent}
input:focus{outline:none;border-color:var(--accent-dim)}
.row{display:flex;gap:6px;align-items:center;flex-wrap:wrap}
.row>*{flex:1 1 auto}
.row.compact>*{flex:0 0 auto}
.input-row{display:flex;gap:8px;align-items:center;flex-wrap:nowrap}
.input-row input{flex:1 1 auto;min-width:0;margin:0}
.input-row button{flex:0 0 auto;white-space:nowrap}
.muted{color:#9aa0ab;font-size:13px}
.stack{display:flex;flex-direction:column;gap:10px}
.pill{font-size:12px;color:#7db5ff}
.tag{font-size:11px;padding:2px 7px;border-radius:99px;background:var(--bg-elev2);color:#bbb}
.nopoint{color:#e5a03a;font-size:13px}
.nopoint:empty{display:none}
.lobby{display:flex;flex-direction:column;gap:14px;padding-top:6px}
.brand{display:flex;align-items:center;gap:12px;margin:4px 0 2px}
.brand-mark{width:44px;height:44px;border-radius:13px;flex:none;display:grid;place-items:center;
  background:linear-gradient(135deg,var(--accent),#7a5cff);color:#fff;font-size:18px}
.brand-text h1{font-size:20px;margin:0 0 2px}
.brand-text .muted{font-size:13px}
.path{padding:16px}
.path .path-title{font-weight:700;font-size:16px;margin:0 0 2px}
.path .path-sub{color:var(--txt-dim);font-size:13px;margin:0 0 10px}
.path .path-cta{width:100%}
.path.secondary{background:transparent;border:1px dashed var(--line);box-shadow:none}
video{width:100%;aspect-ratio:16/9;background:#000;border-radius:12px;display:block}
iframe{width:100%;aspect-ratio:16/9;border:0;border-radius:12px;background:#000}
.frame{aspect-ratio:16/9;background:#000;border-radius:12px;display:grid;place-items:center;color:#888;text-align:center;padding:16px}
#metaLine{display:flex;align-items:center;justify-content:space-between;gap:8px;
  margin:8px 2px 0;min-height:22px}
#metaLine .pill{cursor:pointer;font-size:12px;letter-spacing:.4px}
#metaLine .muted{font-size:12px}
.code-chip{padding:3px 10px;border-radius:999px;background:var(--bg-elev2);
  color:#cfe0ff}
#nowTitle{font-size:13px;color:#9aa;margin:4px 2px 0;
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.empty{display:none;flex-direction:column;align-items:center;text-align:center;gap:6px;
  padding:22px 16px;background:var(--bg-elev);border-radius:var(--radius);margin:8px 0 0;box-shadow:var(--shadow)}
.empty.on{display:flex}
.empty-mark{font-size:34px;line-height:1}
.empty-title{font-weight:700;font-size:15px}
.empty-hint{color:var(--txt-dim);font-size:13px;max-width:340px}
.qitem{display:flex;gap:8px;align-items:center;padding:6px 0;border-bottom:1px solid #20202a}
.qitem .thumb{width:74px;height:42px;object-fit:cover;border-radius:6px;background:#1b1b22;flex:none}
.qitem .qmeta{flex:1;min-width:0}
.qitem .qtitle{font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.qitem .muted{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:12px}
.qitem.now{border-left:3px solid var(--accent);padding-left:8px;border-bottom:1px solid #20202a}
.qitem:first-child{border-top:0}
.qtitle{font-weight:600;word-break:break-word}
.stage{position:relative;border-radius:12px;overflow:hidden;background:#000;display:flex;flex-direction:column;height:auto;max-height:none;min-height:0}
#roomBar{position:fixed;left:0;right:0;bottom:0;transform:none;
  z-index:900;display:flex;gap:6px;width:100%;
  padding:6px 8px calc(6px + env(safe-area-inset-bottom));
  background:rgba(20,20,24,.97);border-top:1px solid #2a2a30;border-radius:0;
  backdrop-filter:blur(8px)}
#roomBar button{flex:1;min-width:0;min-height:46px;display:flex;align-items:center;justify-content:center;
  padding:8px 10px;border-radius:10px;font-size:14px;line-height:1.1;background:transparent;color:#c9ccd4}
#roomBar button.nav-btn.active{background:var(--bg-elev2);color:#fff;outline:1px solid var(--tg-theme-button-color,#2b8cff)}
#roomBar button.ghost{flex:0 0 auto;min-width:76px;padding:8px 12px;background:var(--bg-elev2)}
.screen{padding-top:6px}
#screen-room::before{content:'';display:block;height:calc(max(52px, env(safe-area-inset-top) + 44px))}
body.fs #screen-room::before{display:none}
body.fs #roomBar{display:none}
#screen-room{padding-bottom:calc(66px + env(safe-area-inset-bottom))}
#roomWrap{display:flex;flex-direction:column;gap:10px}
#pane-watch{min-width:0}
#pane-chat{min-width:0}
#chatInline{height:34vh;overflow:auto;display:flex;flex-direction:column;gap:6px}
#chatInline .msg{align-self:flex-start;max-width:92%}
#chatInline .mine{align-self:flex-end}
#chatInline .msg .body{border-radius:8px;padding:7px 10px;font-size:14px;
  background:#23232a;word-break:break-word}
#chatInline .mine .body{background:#2b8cff;color:#fff}
#chatInline .msg .who{display:none}
#chatInline .msg:not(.mine) .who{display:block;font-size:11px;color:#8a8a95;
  margin:0 0 2px 4px}
#chatLog{height:42vh;overflow:auto;display:flex;flex-direction:column;gap:6px}
.msg .who{font-size:12px;color:#9aa}
.msg .body{background:#2a2a2f;border-radius:12px;padding:8px 10px;display:inline-block;word-break:break-word}
.msg.mine{align-self:flex-end;text-align:right}
.msg.mine .body{background:var(--tg-theme-button-color,#2b8cff);color:#fff}
@media (min-width:900px){
  #roomWrap{display:grid;grid-template-columns:minmax(0,1fr) 380px;gap:12px;align-items:start;height:auto}
  #roomBar{display:none}
  #screen-room{padding-bottom:12px}
  #pane-chat{display:flex !important;flex-direction:column;gap:10px;height:calc(var(--appvh,100vh) - 74px);overflow-y:auto;scrollbar-width:thin}
  #chatCard{flex:1 1 auto;display:flex;flex-direction:column;min-height:220px;margin:0}
  #chatLog{height:auto;flex:1 1 auto;min-height:0}
  #chatCard .row{flex-wrap:nowrap}
  #chatCard .row input{flex:1 1 auto;min-width:0}
  #chatCard .row button{flex:0 0 auto;white-space:nowrap}
  #pane-watch{height:auto;max-height:calc(var(--appvh,100vh) - 74px);display:flex;flex-direction:column}
  #chatInlineCard{display:none !important}
  #emptyRoom{display:none !important}
  .stage{flex:0 1 auto;width:100%;height:auto;max-height:calc(var(--appvh,100vh) - 74px);min-height:0;aspect-ratio:16/9}
  .movie{flex:1 1 auto;min-height:0}
  .movie video,.movie iframe{width:100%;height:100%;object-fit:contain}
  #nowTitle{margin-top:8px}
  .movie .frame{max-width:100%;width:100%}
}
@media (min-width:900px) and (max-width:1180px){
  #roomWrap{grid-template-columns:minmax(0,1fr) 320px}
}
body.fs #roomWrap{display:block !important;height:auto}
body.fs #pane-chat{display:none !important}
body.fs #emptyRoom{display:none !important}
body.fs .stage{height:var(--appvh,100dvh);max-height:var(--appvh,100dvh)}
.movie{flex:1;min-height:0;display:flex;align-items:center;justify-content:center;background:#000;width:100%;position:relative}
.movie video,.movie iframe{max-width:100%;max-height:100%;width:auto;height:auto}
.movie .frame{max-width:100%}
body.fs{overflow:hidden}
body.fs .screen{padding:0}
body.fs .tabbar,
body.fs #nowTitle{display:none}
body.fs #pane-watch{position:static}
body.fs .stage{position:fixed;inset:0;z-index:1000;height:var(--appvh,100dvh);border-radius:0;padding-top:env(safe-area-inset-top);display:block}
body.fs .movie{position:absolute;inset:0;height:100%;width:100%;padding:0;display:flex;align-items:center;justify-content:center}
body.fs .movie video,
body.fs .movie iframe,
body.fs .movie .frame{max-width:100%;max-height:100%;width:100%;height:100%;aspect-ratio:auto;border-radius:0;object-fit:contain;background:#000}
body.fs #fschat{left:auto;right:calc(6px + env(safe-area-inset-right));top:auto;
  bottom:calc(10px + env(safe-area-inset-bottom));width:min(210px,44vw);max-height:56vh;
  overflow:hidden;display:flex;flex-direction:column;justify-content:flex-end;
  background:linear-gradient(to left,rgba(0,0,0,.62),rgba(0,0,0,.30) 70%,transparent);
  border-radius:12px;pointer-events:none;align-items:flex-end;
  -webkit-mask-image:linear-gradient(to left,#000 88%,transparent)}
body.fs.fsopen #fschat{bottom:calc(76px + env(safe-area-inset-bottom))}
body.fs #fschat .body{background:rgba(40,40,46,.62);backdrop-filter:blur(3px);font-size:13px}
body.fs #fschat .mine .body{background:rgba(43,140,255,.62)}
@media (orientation:landscape) and (max-width:1180px){
  body.fs #fschat{opacity:.34}
}
body.fs .fsline{position:fixed;left:0;right:0;bottom:0;top:auto;
  margin:0 auto;                                      
  width:min(560px,94vw);display:flex;gap:8px;padding:8px 0 calc(8px + env(safe-area-inset-bottom));
  background:linear-gradient(to top,rgba(0,0,0,.72),rgba(0,0,0,.10) 70%,transparent);
  border-top:none;z-index:1100;pointer-events:auto;
  visibility:hidden;opacity:0}
body.fs .fsline.open{display:flex;visibility:visible;opacity:1}
body.fs.typing .fsline{display:flex;visibility:visible;opacity:1}
#fsHandle{display:none}
body.fs #fsHandle{display:block;position:fixed;left:0;right:0;bottom:calc(4px + env(safe-area-inset-bottom));
  margin:0 auto;width:64px;height:5px;border-radius:3px;
  background:rgba(255,255,255,.42);z-index:1090;cursor:pointer}
body.fs.fsopen #fsHandle,body.fs.typing #fsHandle{opacity:0;pointer-events:none}
.fsline{display:none}
body:not(.fs) .fsline{display:none !important}
#fsExit{display:none}
#fsBtn{flex:0 0 auto;min-width:52px;padding:8px 12px;font-size:17px;line-height:1}
#fsBtn.on{background:#2b8cff;border-color:#2b8cff;color:#fff}
body.fs #roomBar #fsBtn{display:none}   
body.fs #fsExit{display:flex;align-items:center;justify-content:center;
  position:fixed;top:calc(10px + env(safe-area-inset-top));left:14px;
  width:44px;height:44px;border-radius:50%;z-index:1200;
  background:rgba(0,0,0,.55);border:1px solid rgba(255,255,255,.28);
  color:#fff;font-size:19px;line-height:1;padding:0;
  -webkit-tap-highlight-color:transparent;backdrop-filter:blur(6px)}
body.fs #fsExit:active{background:rgba(0,0,0,.8)}
body.fs #fsHandle{height:12px;width:min(180px,46vw);padding:4px 0;
  background:transparent;border-radius:8px}
body.fs #fsHandle::after{content:'';display:block;height:4px;border-radius:3px;
  background:rgba(255,255,255,.55);margin:4px auto 0;width:min(140px,36vw)}
#rotBtn.on{background:#2b8cff;border-color:#2b8cff;color:#fff}
body.fs .fsline input{flex:1 1 auto;min-width:0}
body.fs .fsline button{flex:0 0 auto;padding:12px 16px}
body.fs #playerVideo{width:100%;height:100%;object-fit:contain;background:#000;border-radius:0}
body.rot #playerVideo,
body.rot #movie iframe,
body.rot #movie .frame{
  transform:rotate(90deg);
  transform-origin:center center;
  width:var(--appvh,100dvh);
  height:100vw;
  max-width:var(--appvh,100dvh);
  max-height:100vw;
  position:absolute;left:50%;top:50%;
  translate:-50% -50%;
}
#fschat{display:none;position:absolute;left:0;right:0;bottom:56px;flex:0 1 auto;
  min-height:0;max-height:34vh;overflow-y:auto;flex-direction:column;gap:4px;
  padding:8px 10px 4px;z-index:5;pointer-events:auto;
  background:linear-gradient(to top,rgba(0,0,0,.72),rgba(0,0,0,.28) 65%,transparent);
  -webkit-mask-image:linear-gradient(to top,#000 84%,transparent)}
.fschat{pointer-events:auto}
body.fs #fschat{display:flex}
@media (min-width:900px){
  #fschat{display:none !important}
}
.fschat{flex:1;min-height:0;overflow-y:auto;display:flex;flex-direction:column;gap:4px;padding:8px 10px 2px;scrollbar-width:none}
.fschat::-webkit-scrollbar{display:none}
.fschat .msg{max-width:92%}
.fschat .body{background:#2a2a2f;border-radius:10px;padding:6px 10px;display:inline-block;word-break:break-word}
.fschat .mine{align-self:flex-end;text-align:right}
.fschat .mine .body{background:#2b8cff}
.fsline{display:flex;gap:6px;padding:8px 10px 10px;background:#111114;border-top:1px solid #26262b}
.fsline input{flex:1;margin:0}
#playerStage.fs{position:fixed;inset:0}
