:root {
  --bg:#0f1115; --panel:#171a21; --panel2:#1c2029; --line:#262b36; --text:#e6e8ec; --muted:#8b93a3;
  --accent:#7aa2f7; --good:#9ece6a; --warn:#e0af68; --bad:#f7768e; --blurple:#5865f2;
}
* { box-sizing:border-box; }
html, body { margin:0; height:100%; background:var(--bg); color:var(--text);
  font:14px/1.5 ui-sans-serif,system-ui,-apple-system,"Segoe UI",sans-serif; }
#app { height:100%; }
button { font:inherit; color:inherit; }
input, select { font:inherit; color:var(--text); background:#0b0d11; border:1px solid var(--line);
  border-radius:8px; padding:7px 10px; }
input:focus, select:focus { outline:2px solid var(--accent); outline-offset:-1px; }
.muted { color:var(--muted); } .small { font-size:12px; } .hide { display:none !important; }
.center { display:flex; align-items:center; justify-content:center; flex-direction:column; gap:14px;
  min-height:100%; padding:24px; text-align:center; }
.btn { background:var(--panel2); border:1px solid var(--line); border-radius:9px; padding:7px 13px;
  cursor:pointer; white-space:nowrap; }
.btn:hover { border-color:var(--accent); } .btn:disabled { opacity:.45; cursor:default; }
.btn.primary { background:var(--accent); border-color:var(--accent); color:#0b0d10; font-weight:600; }
.btn.discord { background:var(--blurple); border-color:var(--blurple); color:#fff; font-weight:600; padding:10px 18px; }
.btn.fluxer { background:#4641d9; border-color:#4641d9; color:#fff; font-weight:600; padding:10px 18px; margin-top:8px; }
.btn.ghost { background:none; border-color:transparent; }
.btn.icon { padding:6px 9px; min-width:36px; }
/* closing a room: red words, and a red edge once it asks "sure?" */
.btn.danger { color:var(--bad); } .btn.danger.armed { border-color:var(--bad); }
.card { background:var(--panel); border:1px solid var(--line); border-radius:14px; padding:20px; }
.logo { font-size:22px; font-weight:700; letter-spacing:-.02em; }
.err { color:var(--bad); }
.avatar { width:28px; height:28px; border-radius:50%; background:var(--panel2); object-fit:cover;
  display:inline-flex; align-items:center; justify-content:center; font-size:12px; font-weight:600;
  flex:none; border:2px solid transparent; }
.avatar.ok { border-color:var(--good); } .avatar.wait { border-color:var(--warn); }
.row { display:flex; gap:10px; align-items:center; flex-wrap:wrap; }
.spacer { flex:1; }
.pill { font-size:11px; padding:2px 8px; border-radius:99px; background:var(--panel2);
  border:1px solid var(--line); color:var(--muted); white-space:nowrap; }
.pill.acc { color:var(--accent); } .pill.warn { color:var(--warn); } .pill.good { color:var(--good); }

/* lobby */
.lobby { max-width:980px; margin:0 auto; padding:18px; }
.topbar { display:flex; align-items:center; gap:12px; padding:10px 0 18px; }
.rooms { display:grid; gap:12px; grid-template-columns:repeat(auto-fill,minmax(240px,1fr)); margin:12px 0 24px; }
.roomcard { background:var(--panel); border:1px solid var(--line); border-radius:12px; overflow:hidden;
  position:relative; }
.roomcard:hover { border-color:var(--accent); }
/* the room's name is the join button; its ::after covers the whole card, and "close" sits above it */
.roomcard .join { background:none; border:0; padding:0; color:inherit; font:inherit; font-weight:600;
  text-align:left; cursor:pointer; display:block; width:100%; }
.roomcard .join::after { content:""; position:absolute; inset:0; border-radius:12px; }
.roomcard .join:focus-visible { outline:none; }
.roomcard .join:focus-visible::after { outline:2px solid var(--accent); outline-offset:-2px; }
.roomcard .btn { position:relative; z-index:1; }
.roomcard .art { height:120px; background:#0b0d11 center/cover no-repeat; }
/* nothing on yet: the room's first letter instead of an empty black block */
.roomcard .art.none { display:flex; align-items:center; justify-content:center; background:var(--panel2);
  color:var(--muted); font-size:34px; font-weight:700; }
.roomcard .body { padding:10px 12px; }

/* room */
.room { display:grid; height:100%; grid-template-rows:auto minmax(0,1fr); grid-template-columns:minmax(0,1fr) 250px; }
.room > header { grid-column:1/-1; display:flex; flex-wrap:wrap; align-items:center; gap:6px 10px; padding:8px 12px;
  border-bottom:1px solid var(--line); background:var(--panel); min-height:48px; min-width:0; }
.room > header .name { font-weight:600; max-width:40vw; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.room > header .hdr-more { display:none; }   /* shown on narrow screens, below */
.stage { position:relative; background:#000; min-height:0; min-width:0; overflow:hidden; }
.stage video { width:100%; height:100%; object-fit:contain; background:#000; display:block; }
.side { border-left:1px solid var(--line); background:var(--panel); overflow:auto; padding:10px; }
.viewer { display:flex; align-items:center; gap:8px; padding:6px 4px; border-radius:8px; }
.viewer .who { flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.empty { position:absolute; inset:0; display:flex; flex-direction:column; align-items:center; justify-content:center;
  gap:12px; text-align:center; padding:20px; background:radial-gradient(circle at 50% 40%,#1a1e28,#07080b); }
.banner { position:absolute; top:12px; left:50%; transform:translateX(-50%); background:rgba(15,17,21,.88);
  border:1px solid var(--line); border-radius:99px; padding:6px 14px; font-size:13px; z-index:3; white-space:nowrap;
  max-width:calc(100% - 24px); overflow:hidden; text-overflow:ellipsis; }
.tapper { position:absolute; inset:0; display:flex; align-items:center; justify-content:center; z-index:4;
  background:rgba(0,0,0,.45); }
.tapper.soft { inset:auto; left:50%; bottom:84px; transform:translateX(-50%); background:none; }
.controls { position:absolute; left:0; right:0; bottom:0; padding:28px 12px 10px; z-index:2;
  background:linear-gradient(transparent,rgba(0,0,0,.85)); transition:opacity .25s; }
.stage.idle .controls { opacity:0; pointer-events:none; } .stage.idle { cursor:none; }
.controls .btn { background:rgba(28,32,41,.85); }
.controls .btn.primary { background:var(--accent); }
.seek { position:relative; height:18px; cursor:pointer; margin-bottom:6px; touch-action:none; }
.seek .track { position:absolute; left:0; right:0; top:7px; height:4px; border-radius:2px; background:rgba(255,255,255,.2); }
.seek .buf { position:absolute; left:0; top:7px; height:4px; border-radius:2px; background:rgba(255,255,255,.35); }
.seek .fill { position:absolute; left:0; top:7px; height:4px; border-radius:2px; background:var(--accent); }
.seek .knob { position:absolute; top:3px; width:12px; height:12px; margin-left:-6px; border-radius:50%; background:#fff; }
.seek .gone { position:absolute; left:0; top:7px; height:4px; border-radius:2px; width:0;
  background:repeating-linear-gradient(45deg,rgba(255,255,255,.08) 0 4px,rgba(0,0,0,.35) 4px 8px); }

/* reactions drifting up, the picker, and "X wants the remote" */
.floats { position:absolute; inset:0; pointer-events:none; overflow:hidden; z-index:3; }
.float { position:absolute; bottom:70px; display:flex; flex-direction:column; align-items:center;
  animation:rise 3s ease-out forwards; }
.float .e { font-size:34px; line-height:1; filter:drop-shadow(0 2px 4px rgba(0,0,0,.6)); }
.float .n { font-size:11px; background:rgba(0,0,0,.55); padding:0 6px; border-radius:99px; margin-top:2px; white-space:nowrap; }
@keyframes rise { 0%{transform:translateY(0) scale(.6);opacity:0} 12%{transform:translateY(-30px) scale(1.1);opacity:1}
  80%{opacity:1} 100%{transform:translateY(-260px) scale(1);opacity:0} }
.picker { position:absolute; right:12px; bottom:64px; z-index:5; display:flex; flex-wrap:wrap; gap:4px; max-width:min(448px, calc(100vw - 24px));
  max-height:min(230px, calc(100% - 80px)); overflow-y:auto; overscroll-behavior:contain;
  background:var(--panel); border:1px solid var(--line); border-radius:12px; padding:6px; }
.picker .btn { font-size:20px; padding:4px 6px; min-width:40px; background:none; border-color:transparent; }
.picker .btn:hover { background:var(--panel2); }
.asks { position:absolute; top:12px; right:12px; z-index:6; display:flex; flex-direction:column; gap:8px; max-width:340px; }
.ask.card { padding:12px 14px; font-size:13px; box-shadow:0 6px 24px rgba(0,0,0,.4); }
.seek .tip { position:absolute; bottom:20px; transform:translateX(-50%); background:#000; padding:1px 6px;
  border-radius:4px; font-size:12px; pointer-events:none; }
.time { font-variant-numeric:tabular-nums; font-size:13px; }
.vol { width:90px; accent-color:var(--accent); }
.menu { position:absolute; bottom:64px; right:12px; background:var(--panel); border:1px solid var(--line);
  border-radius:10px; padding:10px; z-index:5; min-width:240px; max-height:60%; overflow:auto; }
.menu h4, .eps h4 { margin:6px 0; font-size:12px; color:var(--muted); text-transform:uppercase; letter-spacing:.04em; }
.eps h4 { margin:14px 8px 4px; }
.eps h4:first-child { margin-top:2px; }
/* the room header's "⋯" menu (narrow screens): just under the header */
.menu.headmenu { position:fixed; top:52px; bottom:auto; right:8px; z-index:25; min-width:200px; max-height:none; }
.menu.headmenu .btn { margin:2px 0; }
.menu button { display:block; width:100%; text-align:left; background:none; border:0; padding:6px 8px;
  border-radius:6px; cursor:pointer; }
.menu button:hover { background:var(--panel2); } .menu button.on { color:var(--accent); }

/* library drawer */
.drawer { position:fixed; top:0; right:0; bottom:0; width:min(760px,100%); background:var(--bg);
  border-left:1px solid var(--line); z-index:20; display:flex; flex-direction:column; }
.drawer > header { display:flex; gap:8px; align-items:center; padding:10px 12px; border-bottom:1px solid var(--line);
  flex-wrap:wrap; }
.drawer > header.tabsbar { flex-wrap:nowrap; }
.tabs { display:flex; gap:4px; overflow-x:auto; flex:1 1 auto; min-width:0; scrollbar-width:none; }
/* more tabs off to the right: fade the edge so it reads as scrollable */
.tabs.more { -webkit-mask-image:linear-gradient(90deg,#000 calc(100% - 32px),transparent);
  mask-image:linear-gradient(90deg,#000 calc(100% - 32px),transparent); }
/* searching looks across every library: no tab is "the" one meanwhile */
.tabs.searching button.on { color:var(--muted); border-bottom-color:transparent; }
.tabs button { background:none; border:0; border-bottom:2px solid transparent; color:var(--muted);
  padding:6px 10px; cursor:pointer; white-space:nowrap; }
.tabs button.on { color:var(--text); border-bottom-color:var(--accent); }
.grid { display:grid; gap:12px; grid-template-columns:repeat(auto-fill,minmax(118px,1fr)); padding:12px; overflow:auto; }
.poster { background:none; border:0; padding:0; text-align:left; cursor:pointer; position:relative; }
.poster .bar { height:4px; border-radius:2px; background:rgba(255,255,255,.15); margin-top:-6px; position:relative; }
.poster .bar i { display:block; height:4px; border-radius:2px; background:var(--accent); }
/* continue watching: the poster's button and its ✕ side by side; the ✕ is a 24 px dot in a bigger target */
.pcard { position:relative; }
.pcard .poster { display:block; width:100%; }
.pcard .forget { position:absolute; top:0; right:0; width:36px; height:36px; border:0; padding:0; cursor:pointer;
  display:flex; align-items:center; justify-content:center; color:var(--text); font-size:12px;
  background:radial-gradient(circle, rgba(0,0,0,.7) 12px, transparent 12.5px); opacity:0; transition:opacity .15s; }
.pcard:hover .forget, .pcard:focus-within .forget { opacity:1; }
.pcard .forget:focus-visible { outline:2px solid var(--accent); outline-offset:-4px; border-radius:50%; }
@media (hover:none) { .pcard .forget { opacity:.85; } }
.poster img, .poster .ph { width:100%; aspect-ratio:2/3; border-radius:8px; background:var(--panel2); object-fit:cover; display:block; }
.poster:hover img { outline:2px solid var(--accent); }
.poster .t { font-size:12px; margin-top:4px; line-height:1.3; overflow:hidden; display:-webkit-box;
  -webkit-line-clamp:2; -webkit-box-orient:vertical; }
.detail { padding:14px; overflow:auto; }
.detail .top { display:flex; gap:14px; align-items:flex-start; }
.detail .play { margin:10px 0 4px; }
.detail .top img { width:140px; border-radius:10px; flex:none; aspect-ratio:2/3; object-fit:cover; background:var(--panel2); }
.eps { margin-top:12px; }
.ep { display:flex; gap:10px; align-items:center; padding:8px; border-radius:8px; cursor:pointer; }
button.ep { width:100%; background:none; border:0; color:inherit; font:inherit; text-align:left; }
.ep:focus-visible, .poster:focus-visible, .seek:focus-visible {
  outline:2px solid var(--accent); outline-offset:2px; }
/* a channel's logo, or the TV mark while it loads or when it has none */
.logo-tile { width:72px; height:44px; flex:none; border-radius:6px; background:#0b0d11; display:flex;
  align-items:center; justify-content:center; overflow:hidden; }
.logo-tile img { width:100%; height:100%; object-fit:contain; }
/* a dark logo on a see-through background: a light tile so it shows (set in logoTile) */
.logo-tile.light { background:var(--text); }
.ep:hover { background:var(--panel2); }
.more { margin:0 12px 16px; }

.afk { position:fixed; inset:0; z-index:40; background:rgba(5,6,8,.72); display:flex; align-items:center; justify-content:center; }
.afk .card { text-align:center; max-width:360px; }
.afk .count { font-size:28px; font-weight:700; font-variant-numeric:tabular-nums; margin:6px 0 14px; }
.toasts { position:fixed; left:12px; top:58px; display:flex; flex-direction:column; gap:6px; z-index:30; pointer-events:none; }
.toast { background:rgba(23,26,33,.95); border:1px solid var(--line); border-radius:9px; padding:7px 12px;
  font-size:13px; max-width:340px; animation:fade 4s forwards; }
.toast.bad { border-color:#3d2730; color:var(--bad); }
/* in a room the notes sit inside the picture, above the controls, never over the header */
.stage .toasts { position:absolute; top:auto; bottom:84px; left:12px; z-index:6; }
@keyframes fade { 0%{opacity:0;transform:translateY(6px)} 8%{opacity:1;transform:none} 85%{opacity:1} 100%{opacity:0} }

@media (max-width:760px), (max-height:420px) {
  .room { grid-template-columns:minmax(0,1fr); grid-template-rows:auto minmax(0,1fr) auto; }
  .room > header .name { max-width:none; flex:1 1 140px; }
  .side { border-left:0; border-top:1px solid var(--line); max-height:28vh; }
  .vol { display:none; }
  .controls .row { gap:6px; }
  /* one header row on a phone: the room's own actions move into "⋯" */
  .room > header { flex-wrap:nowrap; }
  .room > header .wide { display:none; }
  .room > header .hdr-more { display:inline-flex; }
  .room > header .pill { flex:none; }      /* who has the remote stays whole; the room name shortens instead */
}
@media (max-width:480px) {
  /* the detail page: poster above the words, not a tall strip beside them */
  .detail .top { flex-direction:column; }
  .detail .top img { width:120px; }
  .lobby .topbar .logo { font-size:18px; }
}
@media (max-height:300px) { .side, .room > header .opt { display:none; } }
/* nothing on: no dead player controls (the "nothing on yet" panel has its own buttons) */
.stage.nomedia .controls { display:none; }
/* without the remote: play and the seek bar look as unavailable as they are */
.controls .btn.locked, .seek.locked { opacity:.45; }
.seek.locked { cursor:not-allowed; }
.viewer .devs { font-size:12px; color:var(--muted); }
/* a narrow frame (the small Discord activity) keeps one row of controls: the shortcut list is a keyboard thing anyway */
@media (max-width:560px) { .keys-btn { display:none; } }
.keys .row { padding:3px 4px; }
/* fingers: everything you tap at least 44 px */
@media (pointer:coarse) {
  .btn, .tabs button, .menu button, .roomcard .btn { min-height:44px; }
  .btn.icon, .picker .btn, .room > header .hdr-more { min-width:44px; min-height:44px; }
  .room > header .hdr-more { justify-content:center; }
  .pcard .forget { width:44px; height:44px; }
  .keys-btn { display:none; }
}
/* people who asked their system for less motion: fade, don't fly */
@media (prefers-reduced-motion: reduce) {
  .float { animation-name:still; }
  .toast { animation-name:still; }
  .controls { transition:none; }
}
@keyframes still { 0%{opacity:0} 10%{opacity:1} 80%{opacity:1} 100%{opacity:0} }
/* fingers: a taller seek bar to grab */
@media (pointer:coarse) {
  .seek { height:30px; margin-bottom:2px; }
  .seek .track, .seek .buf, .seek .fill { top:13px; }
  .seek .knob { top:7px; width:16px; height:16px; margin-left:-8px; }
  .seek .tip { bottom:30px; }
}
/* fullscreen (the whole page) and theater (same look, no browser fullscreen - the
   Discord activity frame refuses real fullscreen): the picture takes all of it */
body.fs .room, body.theater .room { grid-template-columns:minmax(0,1fr); grid-template-rows:minmax(0,1fr); }
body.fs .room > header, body.fs .side, body.theater .room > header, body.theater .side { display:none; }
