:root{--fade:linear-gradient(to top,rgba(0,0,0,.55) 0,rgba(0,0,0,.42) 30%,rgba(0,0,0,.22) 60%,rgba(0,0,0,.07) 85%,rgba(0,0,0,0) 100%);--bg:#0b0d12;--line:#262b36;--fg:#eceff4;--mut:#b4bcc8;--acc:#1f6feb;--glass:rgba(24,24,28,.42);--ink:#14161c}
*{box-sizing:border-box}
html,body{margin:0;height:100%;height:100dvh;background:var(--bg);color:var(--fg);font:15px/1.45 system-ui,-apple-system,"Segoe UI",Roboto,sans-serif}
a{color:#7cc4ff}
button{font:inherit}

/* Layout: the player fills the page; chat floats over the video. */
.hl-wrap{height:100%}
.hl-stage{height:100%;display:flex;flex-direction:column}
.hl-player{position:relative;flex:1;min-height:0;background:#000;overflow:hidden}
.hl-video{position:absolute;inset:0}
.hl-tile,.hl-video>div{position:absolute;inset:0}

.hl-overlay{position:absolute;inset:0;display:grid;place-items:center;text-align:center;padding:24px;color:var(--mut);background:rgba(0,0,0,.55);z-index:3}
.hl-overlay[hidden]{display:none}
.hl-tap{position:absolute;top:60px;left:50%;transform:translateX(-50%);z-index:6;border:0;border-radius:999px;padding:10px 18px;font-weight:600;color:#fff;background:rgba(0,0,0,.7);cursor:pointer}
.hl-tap[hidden]{display:none}

/* ---------- Viewer ---------- */
.hl-hostpill{position:absolute;top:10px;left:10px;z-index:6;display:flex;align-items:center;gap:8px;max-width:58%;padding:4px 14px 4px 4px;border-radius:999px;background:rgba(0,0,0,.4);color:#fff;font-weight:600;font-size:14px}
.hl-av{flex:none;width:32px;height:32px;border-radius:50%;display:grid;place-items:center;background:linear-gradient(135deg,#4f93f8,var(--acc));font-weight:700}
.hl-hn{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.hl-who{position:absolute;top:52px;left:12px;z-index:6;padding:3px 10px;border-radius:999px;background:rgba(0,0,0,.4);color:#fff;font-size:12px}
.hl-who:empty{display:none}

.hl-count{position:absolute;top:14px;right:10px;z-index:6;display:flex;align-items:center;gap:6px;padding:5px 12px;border-radius:999px;background:rgba(0,0,0,.4);color:#fff;font-size:13px}
.hl-count[hidden]{display:none}
.hl-count b{font-weight:700}
.hl-livebadge{background:#e5342d;color:#fff;border-radius:4px;padding:1px 6px;font-weight:700;font-size:11px;letter-spacing:.6px}
.hl-livebadge[hidden]{display:none}

.hl-fsbtn{width:44px;height:44px;border:0;border-radius:50%;display:grid;place-items:center;color:#fff;background:rgba(0,0,0,.4);cursor:pointer;padding:0}
.hl-fsbtn svg{width:20px;height:20px}
.hl-fsbtn[hidden]{display:none}

/* Floating chat (bottom-left, over the video) */
.hl-chat{position:absolute;left:0;bottom:0;z-index:5;width:min(420px,86%);max-height:58%;display:flex;flex-direction:column;padding:10px 10px calc(12px + env(safe-area-inset-bottom));pointer-events:none}
.hl-chat::before{content:"";position:absolute;z-index:-1;left:0;bottom:0;width:100vw;top:-48px;background:var(--fade);pointer-events:none}
.hl-msgs{display:flex;flex-direction:column;align-items:flex-start;overflow-y:auto;scrollbar-width:none;pointer-events:auto;
  -webkit-mask-image:linear-gradient(to bottom,transparent 0,#000 28%);mask-image:linear-gradient(to bottom,transparent 0,#000 28%)}
.hl-msgs::-webkit-scrollbar{display:none}
.hl-msg{max-width:100%;margin:0 0 6px;padding:5px 12px;border-radius:16px;background:rgba(0,0,0,.4);color:#fff;font-size:14px;overflow-wrap:anywhere;text-shadow:0 1px 2px rgba(0,0,0,.6)}
.hl-msg b{color:#8ec1ff}
.hl-mine b{color:#a8f0a8}
.hl-sys{background:transparent;color:var(--mut);font-size:12px;padding-left:2px}

.hl-form{display:flex;gap:8px;margin-top:4px;pointer-events:auto}
.hl-form[hidden],.hl-gate[hidden]{display:none}
.hl-form input{flex:1;min-width:0;border:1px solid rgba(255,255,255,.28);background:rgba(0,0,0,.45);color:#fff;border-radius:999px;padding:11px 16px;font:inherit;font-size:16px;outline:none}
.hl-form input::placeholder{color:rgba(255,255,255,.6)}
.hl-form button{flex:none;width:44px;height:44px;border:0;border-radius:50%;background:var(--acc);color:#fff;font-size:18px;cursor:pointer}
.hl-gate{pointer-events:auto;margin-top:4px}
.hl-gate button{border:0;border-radius:999px;background:var(--acc);color:#fff;font-weight:600;padding:12px 20px;min-height:44px;cursor:pointer}

@media (max-width:640px){
  .hl-chat{width:92%;max-height:52%;padding:8px 8px calc(10px + env(safe-area-inset-bottom))}
  .hl-msg{font-size:13px}
}

/* ---------- Broadcaster: camera-first layout (full-bleed preview, tool column, lens row, shutter) ---------- */
body.hl-host .hl-player{position:fixed;inset:0}
body.hl-host .hl-video video{object-fit:cover!important}
body.hl-host .hl-hostpill,body.hl-host .hl-who{display:none}
body.hl-host:not(.hl-islive) .hl-chat,body.hl-host:not(.hl-islive) .hl-count{display:none}
body.hl-host .hl-chat{width:calc(100% - 76px);bottom:0;max-height:40%}
body.hl-host .hl-count{top:calc(18px + env(safe-area-inset-top));left:62px;right:auto}

/* top: back button, status pill */
.hl-hosttop{position:absolute;top:env(safe-area-inset-top);left:0;right:0;height:56px;z-index:7;pointer-events:none}
.hl-back{pointer-events:auto;position:absolute;left:10px;top:6px;width:44px;height:44px;border-radius:50%;display:grid;place-items:center;color:#fff;background:var(--glass);-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px)}
.hl-card{position:absolute;z-index:7;top:calc(14px + env(safe-area-inset-top));left:50%;transform:translateX(-50%);width:max-content;max-width:calc(100% - 150px);padding:7px 14px;border-radius:20px;background:var(--glass);-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);color:#fff;font-size:13px;font-weight:600;line-height:1.3;text-align:center;text-shadow:0 1px 2px rgba(0,0,0,.4)}
body.hl-islive .hl-card{top:calc(64px + env(safe-area-inset-top))}
.hl-status{display:block;overflow-wrap:anywhere}

/* right: translucent tool column */
.hl-tools{position:fixed;z-index:7;right:10px;top:calc(64px + env(safe-area-inset-top));display:flex;flex-direction:column;align-items:center;gap:14px;padding:12px 4px 6px;border-radius:26px;background:var(--glass);-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px)}
.hl-rb{width:52px;border:0;background:none;color:#fff;display:flex;flex-direction:column;align-items:center;gap:3px;padding:0;font-size:11px;line-height:1.1;text-align:center;cursor:pointer;text-shadow:0 1px 3px rgba(0,0,0,.6)}
.hl-rb i{width:30px;height:30px;display:grid;place-items:center;filter:drop-shadow(0 1px 3px rgba(0,0,0,.5))}
.hl-rb svg{width:26px;height:26px}
.hl-rb.hl-off i{color:#ff6b63}
#hl-qtxt{font-size:11px;font-weight:700;border:1.6px solid currentColor;border-radius:6px;padding:3px 4px;line-height:1;font-style:normal}
.hl-ctlx{width:44px;height:32px;border:0;background:none;color:#fff;display:grid;place-items:center;cursor:pointer;padding:0}
.hl-ctlx svg{width:22px;height:22px;transition:transform .2s}
body.hl-ctlmin .hl-ctlx svg{transform:rotate(180deg)}
body.hl-ctlmin .hl-tools .hl-rb:not(#hl-flip){display:none}
body.hl-ctlmin .hl-tools{gap:8px}

/* bottom: lens row (filters) and the shutter (Start / End live) */
.hl-hostpanel{position:fixed;left:0;right:0;bottom:0;z-index:8;display:flex;flex-direction:column;align-items:center;gap:8px;padding:28px 0 calc(12px + env(safe-area-inset-bottom));background:var(--fade)}
.hl-lensname{padding:4px 14px;border-radius:999px;background:var(--glass);-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);font-size:13px;font-weight:700;text-shadow:0 1px 2px rgba(0,0,0,.4)}
.hl-lenses{display:flex;gap:14px;overflow-x:auto;overscroll-behavior-x:contain;width:100%;padding:8px calc(50% - 28px);scrollbar-width:none}
.hl-lenses::-webkit-scrollbar{display:none}
.hl-lens{flex:none;width:56px;display:flex;flex-direction:column;align-items:center;gap:4px;border:0;background:none;color:#fff;font-size:11px;cursor:pointer;padding:0;text-shadow:0 1px 3px rgba(0,0,0,.6)}
.hl-lens i{display:block;width:46px;height:46px;border-radius:50%;border:2px solid rgba(255,255,255,.65);transition:transform .15s ease}
.hl-lens.on i{border-color:#fff;box-shadow:0 0 0 3px var(--acc);transform:scale(1.12)}
.hl-lens.on{font-weight:700}
body.hl-ctlmin .hl-lenses,body.hl-ctlmin .hl-lensname{display:none}
/* live: the bottom is the chat's; End moves to the top-right */
body.hl-islive .hl-hostpanel{display:none}
.hl-endbtn{position:fixed;z-index:7;right:10px;top:calc(14px + env(safe-area-inset-top));height:40px;display:flex;align-items:center;gap:8px;padding:0 16px 0 14px;border:0;border-radius:999px;background:var(--glass);-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);color:#fff;font-size:14px;font-weight:700;cursor:pointer;text-shadow:0 1px 2px rgba(0,0,0,.4)}
.hl-endbtn[hidden]{display:none}
.hl-endbtn i{width:12px;height:12px;border-radius:3px;background:#e5342d}
body.hl-islive .hl-endbtn{display:flex}

/* confirm before ending */
.hl-endq[hidden]{display:none}
.hl-endq-box{position:fixed;z-index:41;left:50%;top:50%;transform:translate(-50%,-50%);width:min(320px,calc(100% - 40px));padding:20px;border-radius:20px;background:rgba(20,22,28,.96);text-align:center}
.hl-endq-box b{font-size:18px}
.hl-endq-box p{margin:6px 0 16px;color:var(--mut);font-size:14px}
.hl-endq-btns{display:flex;gap:10px}
.hl-endq-btns .hl-chip{flex:1;min-height:44px}
.hl-endq .hl-chip-red{background:#e5342d;border-color:#e5342d}
.hl-endq .hl-sheet-bg{background:rgba(0,0,0,.5);z-index:40}

.hl-shutter{display:flex;flex-direction:column;align-items:center;gap:5px;border:0;background:none;color:#fff;padding:0;cursor:pointer}
.hl-ring{display:grid;place-items:center;width:72px;height:72px;border-radius:50%;border:5px solid #fff;box-shadow:0 2px 10px rgba(0,0,0,.35);transition:width .2s ease,height .2s ease}
.hl-dot{width:50px;height:50px;border-radius:50%;background:#e5342d;transition:width .2s ease,height .2s ease,border-radius .2s ease}
.hl-golbl{font-size:12px;font-weight:600;text-shadow:0 1px 3px rgba(0,0,0,.6)}
.hl-shutter:disabled{opacity:.6}
body.hl-islive .hl-ring{width:54px;height:54px;border-width:4px}
body.hl-islive .hl-dot{width:20px;height:20px;border-radius:5px}

/* Bottom sheet for Beauty / Video settings (backdrop is clear so the preview stays visible) */
.hl-sheet[hidden]{display:none}
.hl-sheet-bg{position:fixed;inset:0;z-index:30}
.hl-sheet-box{position:fixed;left:0;right:0;bottom:0;z-index:31;max-height:42%;overflow-y:auto;-webkit-overflow-scrolling:touch;
  padding:12px 16px calc(18px + env(safe-area-inset-bottom));border-radius:22px 22px 0 0;background:rgba(20,22,28,.94);-webkit-backdrop-filter:blur(16px);backdrop-filter:blur(16px)}
.hl-sheet.hl-beauty .hl-sheet-box{background:rgba(16,18,24,.55);padding-top:8px}
.hl-sheet-h{display:flex;align-items:center;justify-content:space-between;font-size:17px;margin-bottom:6px}
.hl-sheet.hl-beauty .hl-sheet-h{font-size:15px;margin-bottom:0}
.hl-sheet-h button{border:0;background:none;color:var(--mut);font-size:30px;line-height:1;width:44px;height:44px;cursor:pointer}
.hl-sheet.hl-beauty .hl-sheet-h button{height:40px}
#hl-pane-beauty[hidden],#hl-pane-settings[hidden],#hl-bt-looks[hidden],#hl-bt-filter[hidden],#hl-bt-adjust[hidden]{display:none}
.hl-tabs{display:flex;gap:6px;margin-bottom:10px}
.hl-tabs button{flex:1;border:0;border-radius:999px;padding:12px 6px;font-size:14px;font-weight:600;color:#fff;background:rgba(255,255,255,.14);cursor:pointer}
.hl-tabs button.on{background:#fff;color:#111}
.hl-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:10px;margin:8px 0}
.hl-grid label{display:flex;flex-direction:column;gap:4px;font-size:13px;color:var(--mut)}
.hl-grid select{width:100%;min-height:42px;border:1px solid #333a4a;background:#0f1115;color:var(--fg);border-radius:8px;padding:8px;font:inherit;font-size:16px}
.hl-filters{display:flex;gap:8px;overflow-x:auto;scrollbar-width:none;margin:0 -16px;padding:0 16px 4px}
.hl-filters::-webkit-scrollbar{display:none}
.hl-filters .hl-chip{flex:none}
.hl-chip{border:1px solid #3a4152;background:#232938;color:#fff;border-radius:999px;padding:9px 16px;font:inherit;font-size:14px;cursor:pointer;min-height:40px}
.hl-chip[hidden]{display:none}
.hl-chip.on{background:var(--acc);border-color:var(--acc)}
.hl-sliders{gap:4px 14px;margin:0}
.hl-sliders input[type=range]{width:100%;min-height:24px;accent-color:var(--acc)}
#hl-b-reset,#hl-full{margin-top:4px}

/* Beauty / settings open: hide the overlays so the full-screen preview shows every change */
body.hl-sheetopen .hl-endbtn,body.hl-sheetopen .hl-hosttop,body.hl-sheetopen .hl-card,body.hl-sheetopen .hl-tools,body.hl-sheetopen .hl-hostpanel,body.hl-sheetopen .hl-chat,body.hl-sheetopen .hl-count{display:none}

/* Shape rule: controls are pills or circles, surfaces (sheet, text pills) use soft radii. Tactile + keyboard states. */
.hl-rb:active,.hl-lens:active,.hl-ctlx:active,.hl-back:active,.hl-fsbtn:active,.hl-tabs button:active,.hl-chip:active,.hl-shutter:active{transform:scale(.95)}
.hl-rb,.hl-lens,.hl-ctlx,.hl-back,.hl-fsbtn,.hl-tabs button,.hl-chip,.hl-shutter{transition:transform .12s ease,background-color .15s ease}
button:focus-visible,select:focus-visible,input:focus-visible,a:focus-visible{outline:2px solid #fff;outline-offset:2px}
@media (prefers-reduced-motion:reduce){*{transition:none!important;animation:none!important}}
@media (prefers-reduced-transparency:reduce){
  .hl-card,.hl-tools,.hl-back,.hl-sheet-box{-webkit-backdrop-filter:none;backdrop-filter:none}
  .hl-card,.hl-tools,.hl-back{background:#2a2c33}
  .hl-sheet-box,.hl-sheet.hl-beauty .hl-sheet-box{background:var(--ink)}
}

/* ---------- Viewer: YouTube-style live page ----------
   Phone / narrow: video on top, title + channel row, then live chat filling the rest (comment box always reachable).
   Desktop (900px+): video and info on the left, live chat as a side column.
   Full screen: the video fills the screen and the chat floats over it (body.hl-fsmode, set by live.js). */
body.hl-watch{--yt-line:#303030;--yt-surface:#272727;--yt-mut:#aaa}
body.hl-watch .hl-wrap{display:flex;flex-direction:column;height:100%;min-height:0}
body.hl-watch .hl-col{flex:none;min-width:0}
body.hl-watch .hl-player{flex:none;height:clamp(200px,52dvh,640px)}
.hl-info{padding:12px 12px 6px}
.hl-title{margin:0 0 6px;font-size:17px;font-weight:600;line-height:1.3;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.hl-chrow{display:flex;align-items:center;justify-content:space-between;gap:10px;min-height:44px}
.hl-chathead{display:none}

/* player controls (bottom bar, like YouTube; always visible on touch screens) */
.hl-ctl{position:absolute;left:0;right:0;bottom:0;z-index:7;display:flex;justify-content:flex-end;padding:6px;background:linear-gradient(to top,rgba(0,0,0,.6),rgba(0,0,0,0));opacity:0;transition:opacity .2s ease}
.hl-player:hover .hl-ctl,.hl-ctl:focus-within{opacity:1}
@media (hover:none){.hl-ctl{opacity:1;background:none}}
.hl-ctl .hl-fsbtn{position:static;width:44px;height:44px}
.hl-fs-off,.hl-fslabel{display:none}

body.hl-watch:not(.hl-fsmode) .hl-hostpill{position:static;flex:1;min-width:0;max-width:none;padding:0;background:none;font-size:15px}
body.hl-watch:not(.hl-fsmode) .hl-av{width:40px;height:40px;font-size:16px}
body.hl-watch:not(.hl-fsmode) .hl-count{position:static;flex:none;background:var(--yt-surface)}

body.hl-watch:not(.hl-fsmode) .hl-chat::before{display:none}
body.hl-watch:not(.hl-fsmode) .hl-chat{position:static;flex:1;min-height:0;width:auto;max-width:none;max-height:none;padding:0;background:var(--bg);border-top:1px solid var(--yt-line);pointer-events:auto}
body.hl-watch:not(.hl-fsmode) .hl-chathead{display:block;padding:12px;font-size:14px;font-weight:600;border-bottom:1px solid var(--yt-line)}
body.hl-watch:not(.hl-fsmode) .hl-msgs{flex:1;min-height:0;align-items:stretch;padding:8px 12px;-webkit-mask-image:none;mask-image:none}
body.hl-watch:not(.hl-fsmode) .hl-msg{max-width:none;margin:0;padding:4px 0;border-radius:0;background:none;font-size:14px;text-shadow:none}
body.hl-watch:not(.hl-fsmode) .hl-msg b{color:var(--yt-mut)}
body.hl-watch:not(.hl-fsmode) .hl-sys{padding-left:0}
body.hl-watch:not(.hl-fsmode) .hl-who{position:static;display:block;padding:6px 12px 0;border-radius:0;background:none;color:var(--yt-mut);font-size:12px}
body.hl-watch:not(.hl-fsmode) .hl-form{margin:0;padding:8px 12px calc(10px + env(safe-area-inset-bottom))}
body.hl-watch:not(.hl-fsmode) .hl-form input{border:0;background:var(--yt-surface)}
body.hl-watch:not(.hl-fsmode) .hl-gate{padding:8px 12px calc(10px + env(safe-area-inset-bottom))}

@media (min-width:640px){
  body.hl-watch .hl-player{height:auto;aspect-ratio:16/9;max-height:56dvh}
}
@media (min-width:900px){
  body.hl-watch:not(.hl-fsmode) .hl-wrap{display:grid;grid-template-columns:minmax(0,1fr) 380px}
  body.hl-watch:not(.hl-fsmode) .hl-col{overflow-y:auto;min-height:0}
  body.hl-watch .hl-player{max-height:calc(100dvh - 130px)}
  .hl-title{font-size:20px}
  body.hl-watch:not(.hl-fsmode) .hl-chat{border-top:0;border-left:1px solid var(--yt-line)}
}

/* full screen: video fills the screen, chat floats over it */
body.hl-fsmode .hl-wrap{display:block}
body.hl-fsmode .hl-player{position:fixed;inset:0;height:auto;max-height:none;aspect-ratio:auto}
body.hl-fsmode .hl-title,body.hl-fsmode .hl-who,body.hl-fsmode .hl-chathead{display:none}
body.hl-fsmode .hl-info,body.hl-fsmode .hl-chrow,body.hl-fsmode .hl-col{display:contents}
body.hl-fsmode .hl-hostpill{position:fixed;top:10px;left:10px;z-index:9}
body.hl-fsmode .hl-count{position:fixed;top:max(64px,calc(60px + env(safe-area-inset-top)));right:10px;z-index:9}
body.hl-fsmode .hl-chat{position:fixed}
body.hl-fsmode .hl-ctl{top:0;bottom:auto;left:auto;z-index:10;opacity:1;background:none;padding:max(10px,env(safe-area-inset-top)) max(10px,env(safe-area-inset-right)) 0 0}
body.hl-fsmode .hl-fsbtn{width:auto;height:44px;padding:0 16px 0 12px;gap:8px;grid-auto-flow:column;border-radius:999px;background:rgba(0,0,0,.65);font:600 14px/1 system-ui,sans-serif;text-shadow:0 1px 2px rgba(0,0,0,.5)}
body.hl-fsmode .hl-fs-on{display:none}
body.hl-fsmode .hl-fs-off{display:block}
body.hl-fsmode .hl-fslabel{display:inline}
