:root {
  --bg: #16191f; --rail: #0b0d10; --side: #13161b; --panel: #0f1215; --raised: #1d2128; --sel: #232830;
  --line: #262b34; --line2: #2e343e; --text: #e8eaee; --soft: #d5d9e0; --dim: #9aa3b2;
  --hover: #1a1e25; --hover2: #2a303a; --stage: #0b0d10; --dialog: #1b1f26; --notice-bg: #2a2113; --notice-line: #6b5316;
  --accent: #5eead4; --ink: #06201c; --green: #4ade80; --red: #f87171; --danger: #dc2626; --amber: #fbbf24;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.4 Inter, "Segoe UI", system-ui, sans-serif; overflow: hidden; }
button { font: inherit; color: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: var(--text); }
svg { flex: none; }
.hidden { display: none !important; }
.dim { color: var(--dim); }
.small { font-size: 12px; }
.sr { position: absolute; left: -9999px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* layout */
#app { display: flex; height: calc(100vh / var(--ui-zoom, 1) - var(--tb, 0px)); min-width: 640px; }
#rail { width: 72px; flex: none; background: var(--rail); display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 12px 0; overflow-y: auto; }
#side { width: var(--side-w, 240px); flex: none; background: var(--side); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
#main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--bg); }
#right { flex: none; background: var(--side); border-left: 1px solid var(--line); overflow-y: auto; }
#right.members { width: var(--right-w, 220px); padding: 16px 8px; }
#right.callpanel { width: var(--call-w, 320px); padding: 16px; display: flex; flex-direction: column; gap: 16px; }

/* rail */
.rbtn { position: relative; width: 48px; height: 48px; border-radius: 24px; border: 0; background: var(--raised); color: var(--dim); display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 16px; flex: none; transition: border-radius .12s; }
.rbtn:hover { border-radius: 16px; color: var(--text); }
.rbtn.active { border-radius: 16px; background: var(--accent); color: var(--ink); font-weight: 700; }
.rbtn.home { color: var(--text); }
.rbtn.add { background: transparent; border: 1px dashed var(--line2); }
.rbtn .pip { position: absolute; left: -12px; top: 12px; width: 4px; height: 24px; border-radius: 0 4px 4px 0; background: var(--text); }
.rbtn .count { position: absolute; right: -3px; bottom: -3px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; border: 2px solid var(--rail); }
.rsep { width: 32px; height: 2px; background: var(--line); flex: none; }

/* side */
.side-head { height: 52px; flex: none; padding: 0 16px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); font-weight: 600; font-size: 15px; background: transparent; border-left: 0; border-right: 0; border-top: 0; width: 100%; text-align: left; }
.side-search { height: 52px; flex: none; padding: 0 12px; display: flex; align-items: center; border-bottom: 1px solid var(--line); }
.side-search input { width: 100%; height: 32px; border-radius: 6px; background: var(--panel); border: 1px solid var(--line); padding: 0 10px; font-size: 13px; }
.side-body { flex: 1; overflow-y: auto; padding: 16px 8px; display: flex; flex-direction: column; gap: 2px; min-height: 0; }
.sec { padding: 14px 8px 6px; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--dim); display: flex; justify-content: space-between; align-items: center; }
.sec:first-child { padding-top: 0; }
.sec button { border: 0; background: transparent; color: var(--dim); padding: 0; display: flex; }
.item { display: flex; gap: 8px; align-items: center; padding: 7px 8px; border-radius: 6px; color: var(--dim); background: transparent; border: 0; width: 100%; text-align: left; }
.item:hover { background: var(--hover); color: var(--soft); }
.item.sel { background: var(--sel); color: var(--text); font-weight: 500; }
.item.live { color: var(--text); font-weight: 500; }
.item .end { margin-left: auto; font-size: 12px; color: var(--dim); }
.vuser { display: flex; gap: 8px; align-items: center; padding: 4px 8px 4px 34px; color: var(--soft); min-width: 0; border-radius: 6px; }
.vuser:hover { background: var(--hover); }
.vuser .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag { font-size: 11px; font-weight: 600; color: var(--ink); background: var(--accent); border-radius: 4px; padding: 1px 5px; }
.pill { font-size: 11px; font-weight: 600; color: var(--ink); background: var(--accent); border-radius: 999px; padding: 1px 7px; }
.userpanel { flex: none; min-height: 56px; padding: 8px 10px; background: var(--panel); display: flex; align-items: center; gap: 10px; border-top: 1px solid var(--line); }
.userpanel .who { flex: 1; min-width: 0; line-height: 1.25; }
.userpanel .who b { font-size: 13px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ibtn { width: 32px; height: 32px; border-radius: 6px; border: 0; background: transparent; color: var(--dim); display: flex; align-items: center; justify-content: center; }
.ibtn:hover { background: var(--sel); color: var(--text); }
.ibtn.bad { color: var(--red); }
.callbar { flex: none; padding: 10px 12px; background: var(--panel); border-top: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.callbar .ok { color: var(--green); font-weight: 600; font-size: 13px; }
.sidenote { flex: none; padding: 12px 16px; font-size: 12px; line-height: 1.5; color: var(--dim); border-top: 1px solid var(--line); }

/* avatar */
.av { position: relative; flex: none; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 600; }
.av .dot { position: absolute; right: -2px; bottom: -2px; width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--side); background: transparent; box-sizing: border-box; }
.av .dot.on { background: var(--green); border-color: var(--side); }
.av .dot.off { border-color: #6b7280; background: var(--side); }
.speak .av, .av.speak { box-shadow: 0 0 0 2px var(--green); }

/* header & chat */
.head { height: 52px; flex: none; padding: 0 20px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); }
.head h2 { margin: 0; font-size: 15px; font-weight: 600; }
.head .vsep { width: 1px; height: 20px; background: var(--line); }
.msgs { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 0 8px; }
.msgs .filler { min-height: 8px; }
.msg { display: flex; gap: 14px; padding: 2px 20px; position: relative; }
.msg.first { padding-top: 10px; }
.msg:hover { background: rgba(128, 128, 128, .07); }
.msg .gut { width: 40px; flex: none; font-size: 11px; color: var(--dim); text-align: right; padding-top: 4px; visibility: hidden; }
.msg:hover .gut { visibility: visible; }
.msg .name { font-weight: 600; font-size: 15px; }
.msg .time { font-size: 12px; color: var(--dim); margin-left: 8px; }
.msg .txt { font-size: 15px; line-height: 1.5; color: var(--soft); white-space: pre-wrap; overflow-wrap: anywhere; }
.msg .del { position: absolute; right: 20px; top: 4px; display: none; border: 1px solid var(--line2); background: var(--raised); border-radius: 6px; padding: 2px 8px; font-size: 12px; color: var(--red); }
.msg:hover .del { display: block; }
.empty { margin: auto; padding: 40px; text-align: center; color: var(--dim); max-width: 420px; line-height: 1.6; }
.composer { flex: none; padding: 0 20px 20px; }
.composer textarea { flex: 1; min-width: 0; min-height: 48px; max-height: 160px; resize: none; padding: 13px 14px; border-radius: 10px; background: var(--raised); border: 1px solid var(--line); line-height: 1.3; display: block; }

/* members */
.member { display: flex; gap: 10px; align-items: center; padding: 6px 8px; border-radius: 6px; width: 100%; border: 0; background: transparent; text-align: left; }
.member:hover { background: var(--sel); }
.member.offline { opacity: .6; }

/* menu */
.menu { position: fixed; z-index: 60; min-width: 190px; background: var(--raised); border: 1px solid var(--line2); border-radius: 10px; padding: 6px; box-shadow: 0 8px 24px rgba(0, 0, 0, .4); }
.menu button { display: flex; width: 100%; justify-content: space-between; text-align: left; border: 0; background: transparent; padding: 7px 10px; border-radius: 6px; color: var(--text); }
.menu button:hover { background: var(--sel); }
.menu button.bad { color: var(--red); }
.menu hr { border: 0; height: 1px; background: var(--line2); margin: 5px 4px; }

/* buttons & inputs */
.btn { height: 40px; padding: 0 18px; border-radius: 8px; border: 0; background: var(--sel); color: var(--text); font-weight: 500; display: inline-flex; align-items: center; gap: 8px; }
.btn:hover { background: var(--hover2); }
.btn.primary { background: var(--accent); color: var(--ink); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.12); }
.btn.danger { background: var(--danger); color: #fff; font-weight: 600; }
.btn.sm { height: 32px; padding: 0 14px; border-radius: 16px; font-size: 13px; }
.btn.ghost { background: transparent; color: var(--dim); }
.btn:disabled { opacity: .5; cursor: default; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .lbl { font-size: 12px; font-weight: 600; color: var(--dim); }
.input, select.input { height: 40px; width: 100%; border-radius: 8px; background: var(--panel); border: 1px solid var(--line2); padding: 0 12px; }
input[type=range] { width: 100%; margin: 0; accent-color: var(--accent); }
.error { color: var(--red); font-size: 13px; min-height: 18px; }

/* friends */
.tabs { display: flex; gap: 6px; align-items: center; }
.tab { border: 0; background: transparent; color: var(--dim); padding: 5px 12px; border-radius: 6px; font-weight: 500; display: flex; gap: 6px; align-items: center; }
.tab.sel { background: var(--sel); color: var(--text); }
.pagebody { flex: 1; overflow-y: auto; padding: 20px 24px; display: flex; flex-direction: column; gap: 20px; }
.row { display: flex; align-items: center; gap: 14px; padding: 10px 0; border-top: 1px solid var(--line); }
.row:last-child { border-bottom: 1px solid var(--line); }
.row .info { flex: 1; min-width: 0; line-height: 1.35; }
.row .info b { font-size: 15px; display: block; }
.circle { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--raised); color: var(--soft); display: flex; align-items: center; justify-content: center; }
.circle:hover { background: var(--sel); }

/* call stage */
.stage { flex: 1; min-height: 0; padding: 16px 20px 0; display: flex; flex-direction: column; gap: 12px; }
.spot { position: relative; flex: 1; min-height: 200px; border-radius: 12px; background: var(--stage); border: 1px solid var(--line); overflow: hidden; display: flex; align-items: center; justify-content: center; }
.spot video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.spot.speak { box-shadow: 0 0 0 2px var(--green); }
.tiles { flex: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.tiles.grid { flex: 1; min-height: 0; grid-auto-rows: minmax(120px, 1fr); grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.tile { position: relative; height: 114px; border-radius: 10px; background: var(--raised); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.tiles.grid .tile { height: auto; min-height: 120px; }
.tile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tile.speak { box-shadow: 0 0 0 2px var(--green); }
.chip { position: absolute; font-size: 12px; font-weight: 600; color: #fff; background: rgba(11, 13, 16, .8); border-radius: 6px; padding: 2px 8px; }
.chip.bl { left: 8px; bottom: 8px; }
.chip.tr { right: 8px; top: 8px; display: flex; align-items: center; gap: 6px; }
.chip.spotl { left: 12px; bottom: 12px; font-size: 13px; padding: 6px 10px; border-radius: 8px; font-weight: 400; display: flex; gap: 8px; align-items: center; }
.controls { flex: none; height: 84px; display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; }
.cbtn { height: 48px; padding: 0 18px; border-radius: 24px; background: var(--raised); border: 1px solid var(--line2); display: flex; align-items: center; gap: 8px; font-weight: 500; }
.cbtn:hover { background: var(--sel); }
.cbtn.on { background: var(--accent); border-color: var(--accent); color: var(--ink); font-weight: 600; }
.cbtn.bad { background: var(--danger); border-color: var(--danger); color: #fff; font-weight: 600; }
.cbtn.muted { color: var(--red); }
.hostchip { display: inline-flex; align-items: center; gap: 6px; background: var(--raised); border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px 4px 6px; font-weight: 500; }
.card { background: var(--raised); border: 1px solid var(--line); border-radius: 10px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.meter { height: 8px; border-radius: 4px; background: var(--hover2); overflow: hidden; }
.meter > div { height: 100%; background: var(--accent); }
.meter.warn > div { background: var(--amber); }
.pcol { display: flex; flex-direction: column; }
.prow { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.prow .info { flex: 1; min-width: 0; line-height: 1.3; }
.link { border: 0; background: transparent; color: var(--accent); padding: 0; font-weight: 500; font-size: 13px; text-align: left; }
.errtext { color: var(--red); }

/* overlay / modal */
#overlay { position: fixed; inset: 0; z-index: 50; }
.scrim { position: absolute; inset: 0; background: rgba(5, 6, 8, .72); display: flex; align-items: flex-start; justify-content: center; padding-top: 48px; overflow-y: auto; }
.dialog { width: 640px; max-width: calc(100vw - 32px); background: var(--dialog); border: 1px solid var(--line2); border-radius: 14px; padding: 28px; display: flex; flex-direction: column; gap: 18px; box-shadow: 0 16px 48px rgba(0, 0, 0, .5); margin-bottom: 40px; }
.dialog.narrow { width: 440px; margin-top: 80px; }
.dialog h1 { margin: 0; font-size: 20px; }
.dialog .actions { display: flex; gap: 10px; align-items: center; }
.check { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line); }
.check:last-child { border-bottom: 1px solid var(--line); }
.check .st { width: 64px; text-align: right; font-size: 12px; font-weight: 600; }
.good { color: var(--green); } .warn { color: var(--amber); } .bad { color: var(--red); }
.codebox { font: 600 22px/1 ui-monospace, Consolas, monospace; letter-spacing: .08em; background: var(--panel); border: 1px solid var(--line2); border-radius: 8px; padding: 14px; text-align: center; user-select: all; }

/* settings (full screen) */
#settings { position: absolute; inset: 0; background: var(--bg); display: flex; }
#settings nav { width: 260px; flex: none; background: var(--side); border-right: 1px solid var(--line); padding: 32px 16px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
#settings nav .sec { padding-left: 12px; }
#settings nav button { text-align: left; border: 0; background: transparent; padding: 8px 12px; border-radius: 6px; color: var(--soft); }
#settings nav button.sel { background: var(--sel); color: var(--text); font-weight: 600; }
#settings nav button.bad { color: var(--red); }
#settings .content { flex: 1; min-width: 0; padding: 32px 40px; overflow-y: auto; display: flex; flex-direction: column; gap: 20px; }
#settings h1 { margin: 0; font-size: 22px; }
#settings h2 { margin: 0; font-size: 16px; }
.cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 40px; align-items: start; }
.col { display: flex; flex-direction: column; gap: 14px; }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.swrow { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.swrow .t { flex: 1; line-height: 1.35; } .swrow .t div:first-child { font-weight: 500; }
.sw { flex: none; position: relative; width: 42px; height: 24px; border-radius: 12px; border: 0; background: var(--hover2); }
.sw::after { content: ""; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--text); transition: left .1s; }
.sw[aria-checked=true] { background: var(--accent); }
.sw[aria-checked=true]::after { left: 21px; background: var(--ink); }
.seg { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; background: var(--panel); border: 1px solid var(--line2); border-radius: 10px; padding: 4px; }
.seg button { border: 0; background: transparent; padding: 8px 10px; border-radius: 7px; color: var(--soft); font-weight: 500; }
.seg button[aria-pressed=true] { background: var(--accent); color: var(--ink); font-weight: 600; }
.notice { background: var(--notice-bg); border: 1px solid var(--notice-line); border-radius: 10px; padding: 12px 14px; }
.notice b { color: var(--amber); } .notice { color: var(--text); }
.close { position: absolute; right: 40px; top: 32px; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line2); background: transparent; color: var(--dim); display: flex; align-items: center; justify-content: center; }

/* login */
#login { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: var(--bg); overflow-y: auto; padding: 24px; }
#login .box { width: 400px; max-width: 100%; display: flex; flex-direction: column; gap: 14px; }
#login h1 { margin: 0; font-size: 28px; letter-spacing: -.01em; }
#login .mark { width: 48px; height: 48px; border-radius: 16px; background: var(--accent); color: var(--ink); font-weight: 800; display: flex; align-items: center; justify-content: center; }

/* toasts and banners */
#toasts { position: fixed; right: 16px; bottom: 16px; z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.toast { background: var(--raised); border: 1px solid var(--line2); border-radius: 10px; padding: 12px 14px; max-width: 360px; box-shadow: 0 8px 24px rgba(0, 0, 0, .4); display: flex; flex-direction: column; gap: 8px; }
.toast.err { border-color: #7f2d2d; }
#banner { position: fixed; left: 50%; top: calc(var(--tb, 0px) + 10px); transform: translateX(-50%); z-index: 400; max-width: min(92vw, 640px); background: #5a1f1f; color: #fff; border: 1px solid #ef4444; border-radius: 8px; padding: 9px 16px; font-size: 13.5px; font-weight: 600; box-shadow: 0 6px 24px rgba(0,0,0,.55); }
.picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; max-height: 50vh; overflow-y: auto; }
.picker button { border: 1px solid var(--line2); background: var(--panel); border-radius: 10px; padding: 8px; display: flex; flex-direction: column; gap: 6px; text-align: left; }
.picker button:hover, .picker button.sel { border-color: var(--accent); }
.picker img { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: 6px; background: #000; }
.picker span { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 1560px) { .cbtn .t { display: none; } .cbtn { padding: 0 15px; } }
.controls { min-height: 84px; height: auto; padding: 8px 0; }
.stage { overflow: hidden; }
.tiles.grid { overflow: hidden; }

/* pictures, status icons */
.av img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.mi { display: inline-flex; color: var(--red); flex: none; }
.chip .mi { color: #f87171; }
.vuser .mi, .prow .mi { margin-left: 2px; }
.row-icons { display: inline-flex; gap: 4px; align-items: center; }

/* attachments */
.composer .cbox { display: flex; gap: 8px; align-items: flex-end; }
.composer .attach { flex: none; width: 48px; height: 48px; border-radius: 10px; border: 1px solid var(--line); background: var(--raised); color: var(--dim); display: flex; align-items: center; justify-content: center; }
.composer .attach:hover { color: var(--text); background: var(--hover2); }
.pending { display: flex; gap: 8px; flex-wrap: wrap; padding: 0 20px 8px; }
.pending .pf { display: flex; align-items: center; gap: 8px; background: var(--raised); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font-size: 13px; max-width: 320px; }
.pending .pf .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pending .bar { width: 70px; height: 6px; border-radius: 3px; background: var(--hover2); overflow: hidden; flex: none; }
.pending .bar > div { height: 100%; background: var(--accent); width: 0; }
.dragging { outline: 2px dashed var(--accent); outline-offset: -8px; }
.att { margin-top: 4px; }
.att-img { max-width: min(420px, 100%); max-height: 320px; border-radius: 8px; display: block; cursor: zoom-in; background: var(--raised); }
.att-video { max-width: min(480px, 100%); max-height: 340px; border-radius: 8px; background: #000; display: block; }
.att audio { width: min(380px, 100%); display: block; }
.att-file { display: flex; gap: 10px; align-items: center; padding: 10px 12px; background: var(--raised); border: 1px solid var(--line); border-radius: 8px; max-width: 360px; color: var(--text); text-decoration: none; }
.att-file:hover { background: var(--hover2); }
.att-file .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.lightbox { position: fixed; inset: 0; z-index: 70; background: rgba(0, 0, 0, .85); display: flex; align-items: center; justify-content: center; cursor: zoom-out; }
.lightbox img { max-width: 94vw; max-height: 94vh; border-radius: 6px; }

/* menus with sliders */
.menu .vol { padding: 6px 10px; display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--dim); min-width: 220px; }
.menu .vol > div { display: flex; justify-content: space-between; }
.menu .head2 { padding: 8px 10px 4px; display: flex; gap: 8px; align-items: center; font-weight: 600; }
.menu button .hint { color: var(--dim); font-size: 12px; }

/* appearance */
.themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; max-width: 560px; }
.theme-card { border: 2px solid var(--line2); border-radius: 12px; padding: 0; overflow: hidden; background: none; text-align: left; }
.theme-card[aria-pressed=true] { border-color: var(--accent); }
.theme-card .pv { height: 56px; display: flex; }
.theme-card .nmx { padding: 8px 10px; font-weight: 500; background: var(--panel); }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.swatch { width: 32px; height: 32px; border-radius: 50%; border: 2px solid transparent; padding: 0; }
.swatch[aria-pressed=true] { border-color: var(--text); box-shadow: 0 0 0 2px var(--bg) inset; }
.bigav { display: flex; gap: 16px; align-items: center; }

/* ---- watch with me ---- */
.watchbox { flex: none; display: flex; flex-direction: column; gap: 8px; padding: 10px 16px 8px; border-bottom: 1px solid var(--line); background: var(--panel); }
.watchbox .wbar { display: flex; gap: 8px; align-items: center; }
.watchbox .wbar .input { flex: 1; min-width: 0; height: 36px; }
.watchbox .wstage { position: relative; width: 100%; max-width: 960px; margin: 0 auto; aspect-ratio: 16 / 9; max-height: 52vh; background: #000; border-radius: 10px; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.watchbox .wv { width: 100%; height: 100%; border: 0; background: #000; display: block; }
.watchbox .wempty { text-align: center; color: var(--dim); padding: 24px; max-width: 460px; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.watchbox .wempty > div:first-of-type { color: var(--text); font-size: 16px; }
.watchbox .wstatus { text-align: center; }
.hidden { display: none !important; }

/* ---- soundboard ---- */
.board { position: fixed; z-index: 60; left: 50%; bottom: 96px; transform: translateX(-50%); width: min(520px, calc(100vw - 32px)); max-height: 60vh; overflow: auto; background: var(--dialog, var(--raised)); border: 1px solid var(--line2); border-radius: 14px; padding: 12px; box-shadow: 0 12px 40px rgba(0, 0, 0, .45); }
.board .bhead { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.board .bgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.board .bclip { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 10px; background: var(--raised); border: 1px solid var(--line2); text-align: left; min-width: 0; }
.board .bclip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board .bclip:hover { background: var(--sel); }
.board .bclip:active { transform: scale(.97); }
.board .bfoot { display: flex; gap: 12px; align-items: center; margin-top: 10px; }

.watchbox .wstage.idle { aspect-ratio: auto; height: 170px; background: var(--raised); }

/* ---- v1.4 ---- */
#uploads { position: fixed; z-index: 70; right: 16px; top: 56px; width: 320px; max-height: 60vh; overflow: auto; display: flex; flex-direction: column; gap: 8px; }
.upl-item { background: var(--dialog, var(--raised)); border: 1px solid var(--line2); border-radius: 10px; padding: 10px 12px; box-shadow: 0 8px 24px rgba(0, 0, 0, .35); display: flex; flex-direction: column; gap: 6px; }
.upl-item .row { display: flex; gap: 8px; align-items: baseline; min-width: 0; } .upl-item .row b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upl-item.ok .meter > div { background: var(--green); } .upl-item.bad .meter > div { background: var(--red); }
.upl-live .att-file { opacity: .9; }
.xcard { max-width: 460px; padding: 12px; border: 1px solid var(--line2); border-radius: 10px; background: var(--raised); }
.sicon { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; display: block; }
.sicon.sm { width: 24px; height: 24px; border-radius: 6px; flex: none; margin-right: 8px; }
.sicon.lg { width: 72px; height: 72px; border-radius: 16px; }
.sicon.ph { background: var(--accent); color: var(--ink); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 24px; }
.board .bvol { display: flex; align-items: center; gap: 6px; } .board .bvol input { width: 110px; }
#main.chat-hidden .msgs, #main.chat-hidden .composer { display: none; }
#main.chat-hidden .watchbox { flex: 1; min-height: 0; border-bottom: 0; }
#main.chat-hidden .watchbox .wstage { flex: 1; max-height: none; aspect-ratio: auto; max-width: none; }
#main.chat-hidden .watchbox .wstage.idle { height: auto; }

/* layouts */
.lpv { display: flex; gap: 2px; height: 56px; padding: 4px; background: var(--bg); border-radius: 6px; }
.lpv i { display: block; border-radius: 2px; background: var(--line2); } .lpv .m { flex: 1; background: var(--raised); } .lpv .r { width: 8px; } .lpv .s { width: 20px; } .lpv .x { width: 14px; }
.lpv.lv-compact .r { width: 5px; } .lpv.lv-compact .s { width: 13px; } .lpv.lv-compact .x { width: 10px; }
.lpv.lv-mirrored { flex-direction: row-reverse; }
.lpv.lv-focus .x { display: none; }
.lpv.lv-topbar { display: grid; grid-template-columns: 20px 1fr 14px; grid-template-rows: 8px 1fr; } .lpv.lv-topbar .r { grid-column: 1 / -1; width: auto; }
.themes.layouts .theme-card .lpv { margin-bottom: 4px; }

html[data-layout="compact"] #rail { width: 56px; gap: 6px; padding: 8px 0; }
html[data-layout="compact"] #side { width: var(--side-w, 200px); }
html[data-layout="compact"] #right.members { width: var(--right-w, 180px); padding: 10px 6px; }
html[data-layout="compact"] .msgs { font-size: 14px; }
html[data-layout="compact"] .msg { padding-top: 2px; padding-bottom: 2px; }
html[data-layout="mirrored"] #app { flex-direction: row-reverse; }
html[data-layout="mirrored"] #side { border-right: 0; border-left: 1px solid var(--line); }
html[data-layout="mirrored"] #right { border-left: 0; border-right: 1px solid var(--line); }
html[data-layout="focus"] #right.members { display: none; }
html[data-layout="focus"] #side { width: var(--side-w, 210px); }
html[data-layout="topbar"] #app { display: grid; grid-template-columns: var(--side-w, 240px) minmax(0, 1fr) auto; grid-template-rows: 56px minmax(0, 1fr); }
html[data-layout="topbar"] #rail { grid-column: 1 / -1; grid-row: 1; width: auto; flex-direction: row; padding: 0 12px; gap: 8px; overflow-x: auto; overflow-y: hidden; align-items: center; border-bottom: 1px solid var(--line); }
html[data-layout="topbar"] #rail .rsep { width: 1px; height: 28px; margin: 0 2px; }
html[data-layout="topbar"] #rail .rbtn { width: 42px; height: 42px; flex: none; }
html[data-layout="topbar"] #side { grid-column: 1; grid-row: 2; width: auto; }
html[data-layout="topbar"] #main { grid-column: 2; grid-row: 2; min-height: 0; }
html[data-layout="topbar"] #right { grid-column: 3; grid-row: 2; }
html[data-layout="topbar"] #uploads { top: 56px; }

/* v1.5: camera tiles are always landscape (16:9) and only people with a camera on get one */
.tiles { align-items: center; justify-content: center; display: flex; flex-wrap: wrap; }
.tiles.grid { flex: 1; min-height: 0; align-content: center; grid-auto-rows: unset; }
.tile { aspect-ratio: 16 / 9; height: 114px; width: auto; flex: none; background: #000; }
.tiles.grid .tile { min-height: 0; }
.tile video { object-fit: contain; background: #000; }
.nocams { margin: auto; text-align: center; display: flex; flex-direction: column; gap: 8px; align-items: center; max-width: 340px; color: var(--dim, #8b97ab); padding: 24px; }
.nocams b { color: var(--text, #fff); font-size: 16px; }

/* v1.5: the watch player floats in a host that follows you around the app */
.whost { position: fixed; z-index: 40; background: #000; overflow: hidden; display: flex; flex-direction: column; }
.whost.mini { width: 360px; height: 224px; border-radius: 12px; border: 1px solid var(--line2); box-shadow: 0 12px 36px rgba(0, 0, 0, .5); }
.whost.docked { border-radius: 10px; }
.whost .whead { flex: none; display: flex; align-items: center; gap: 2px; padding: 2px 4px 2px 10px; height: 30px; background: var(--raised); cursor: grab; user-select: none; touch-action: none; }
.whost .wtitle { font-size: 12px; color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.whost.docked .whead { display: none; }
.whost .wstage { flex: 1; min-height: 0; position: relative; display: flex; align-items: center; justify-content: center; background: #000; }
.whost .wv { width: 100%; height: 100%; border: 0; background: #000; display: block; }
.whost .wempty { text-align: center; color: var(--dim); padding: 24px; max-width: 460px; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.whost .wempty > div:first-of-type { color: var(--text); font-size: 16px; }
.whost.mini .wempty .small, .whost.mini .wempty svg { display: none; }
.watchbox .wslot { background: transparent; }

/* v1.5: links and embeds in chat */
.txt a.lnk { color: var(--accent, #5eead4); text-decoration: none; word-break: break-all; }
.txt a.lnk:hover { text-decoration: underline; }
.embed { margin-top: 6px; max-width: 480px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: var(--raised); position: relative; }
.embed.img, .embed.vid, .embed.aud { border: 0; background: transparent; }
.embed.wide { max-width: 480px; aspect-ratio: 16 / 9; }
.embed.wide .embed-frame { height: 100%; }
.embed-frame { width: 100%; border: 0; display: block; background: #000; }
.embed-img { max-width: 100%; max-height: 320px; border-radius: 10px; display: block; cursor: zoom-in; }
.embed.vid video { max-width: 100%; max-height: 320px; border-radius: 10px; }
.embed-go { display: block; width: 100%; padding: 0; border: 0; background: none; color: inherit; text-align: left; position: relative; cursor: pointer; aspect-ratio: 16 / 9; }
.embed.plain .embed-go { aspect-ratio: auto; padding: 14px; }
.embed-thumb { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.embed-cap { position: absolute; left: 10px; bottom: 10px; right: 10px; display: flex; gap: 10px; align-items: center; background: rgba(0, 0, 0, .65); color: #fff; border-radius: 8px; padding: 8px 10px; }
.embed.plain .embed-cap { position: static; background: transparent; padding: 0; color: var(--text); }
.embed-play { width: 36px; height: 36px; border-radius: 50%; background: var(--accent, #5eead4); color: #06201c; display: flex; align-items: center; justify-content: center; flex: none; }
.embed-open { display: block; padding: 4px 10px; }

.playing { color: var(--green); }

/* v1.5.1: drag the edge of the left and right panels to resize them (double-click an edge to reset) */
#app { position: relative; overflow: hidden; }
.grip { position: absolute; top: 0; bottom: 0; width: 9px; z-index: 30; cursor: col-resize; touch-action: none; }
.grip::after { content: ""; position: absolute; top: 0; bottom: 0; left: 4px; width: 2px; background: transparent; transition: background .12s; }
.grip:hover::after, .grip.drag::after { background: var(--accent, #5eead4); }
body.resizing { cursor: col-resize; user-select: none; }
body.resizing iframe, body.resizing video { pointer-events: none; }

.whost.pipped { visibility: hidden; pointer-events: none; }
.watchbox .wpipnote { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 10px; align-items: center; justify-content: center; color: var(--dim); background: var(--raised); border-radius: 10px; }
.watchbox .wpipnote > div { color: var(--text); }

.member .playing { font-size: 11px; line-height: 1.2; }

/* v1.6: the Windows app draws its own title bar in the theme colours */
#titlebar { display: none; }
html.frameless { --tb: 32px; }
html.frameless body { padding-top: var(--tb); }
html.frameless #titlebar { display: flex; position: fixed; top: 0; left: 0; right: 0; height: var(--tb); z-index: 100; align-items: center; gap: 8px; padding: 0 12px; background: var(--rail); color: var(--dim); font-size: 12px; font-weight: 600; letter-spacing: .02em; -webkit-app-region: drag; user-select: none; }
html.frameless #titlebar svg { color: var(--accent); }
html.frameless #login { top: var(--tb); }

/* v1.6: the music bot */
.mbox { position: fixed; z-index: 45; left: 330px; bottom: 96px; width: 270px; background: var(--dialog, var(--raised)); border: 1px solid var(--line2); border-radius: 14px; box-shadow: 0 12px 40px rgba(0, 0, 0, .45); overflow: hidden; display: flex; flex-direction: column; }
.mbox.full { width: 380px; max-height: calc(100vh - 140px); }
.mhead { display: flex; align-items: center; gap: 4px; padding: 6px 6px 6px 12px; font-size: 13px; }
.mhead b { margin-left: 6px; }
.mhead .ibtn { width: 28px; height: 28px; }
.ibtn.on { color: var(--accent); }
.ibtn[disabled] { opacity: .35; cursor: default; }
.mstage { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #000; }
.mstage iframe { width: 100%; height: 100%; border: 0; display: block; }
.mbox:not(.full) .mstage { display: block; }
.mbody { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; min-height: 0; }
.mbox:not(.full) .mq, .mbox:not(.full) .madd, .mbox:not(.full) .mline, .mbox:not(.full) .sec { display: none; }
.mtitle { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mprogrow { display: flex; align-items: center; gap: 8px; }
.mprog { flex: 1; height: 6px; border-radius: 3px; background: var(--raised); overflow: hidden; }
.mprog > div { height: 100%; width: 0; background: var(--accent); }
.mctl { display: flex; align-items: center; gap: 2px; }
.mvol { width: 80px; }
.mempty { text-align: center; display: flex; flex-direction: column; gap: 4px; padding: 14px 4px; }
.mmuted { display: flex; gap: 8px; align-items: center; justify-content: space-between; font-size: 12px; color: var(--dim); }
.mq { display: flex; flex-direction: column; gap: 2px; max-height: 220px; overflow-y: auto; }
.mqi { display: flex; align-items: center; gap: 6px; padding: 4px 2px; border-radius: 6px; }
.mqi:hover { background: var(--sel); }
.mqi .ibtn { width: 26px; height: 26px; }
.mhelp { display: flex; flex-direction: column; gap: 4px; font-size: 12px; max-height: 200px; overflow-y: auto; }
.mhelp code { background: var(--raised); padding: 1px 5px; border-radius: 4px; }
.madd { display: flex; gap: 6px; }
.madd .input { flex: 1; min-width: 0; height: 34px; }
.mchk { display: flex; gap: 8px; align-items: center; margin: 6px 0; }
.mrules { max-height: 86vh; overflow-y: auto; }
.botav { width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: var(--ink, #06201c); display: flex; align-items: center; justify-content: center; flex: none; }
.botav.sm { width: 22px; height: 22px; }
.botrow .good { color: var(--green); }
.vuser.botuser { color: var(--dim); gap: 6px; }

/* v1.6.3: the music panel can be dragged by its title and hidden while the music keeps playing */
.mhead { cursor: grab; user-select: none; }
.mbox.away { transform: translateX(-200vw); pointer-events: none; }

/* v1.7: peer to peer video */
.swbar { display: flex; align-items: center; gap: 10px; padding: 6px 12px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.swbar.hidden { display: none; }

/* v1.7.1: download card for shared videos */
.wstage { position: relative; }
.swcard { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: var(--raised, #1b1d22); z-index: 3; padding: 16px; text-align: center; }
.swcard.hidden { display: none; }
.swc-box { width: min(420px, 100%); display: flex; flex-direction: column; gap: 8px; }
.swc-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.swc-big { font-size: 1.15em; font-variant-numeric: tabular-nums; }
.swc-fail { color: var(--danger, #e5534b); }

/* v1.8: scroll bars that belong to the UI */
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--dim) 28%, transparent); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; min-height: 36px; }
:hover::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--dim) 45%, transparent); background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: color-mix(in srgb, var(--dim) 75%, transparent); background-clip: padding-box; }
::-webkit-scrollbar-thumb:active { background: var(--accent); background-clip: padding-box; }
::-webkit-scrollbar-corner { background: transparent; }
.vizcv { display: block; }
.tagline { font-style: italic; }
.botuser, .botrow { cursor: pointer; }

/* mirror camera: only your own picture on your own screen */
.mirrorcam video[data-mine] { transform: scaleX(-1); }

.volbox { display: flex; align-items: center; gap: 6px; padding: 0 8px; }
.volbox input[type=range] { width: 90px; }
.spotvol { position: absolute; left: 12px; bottom: 44px; background: rgba(0,0,0,.6); color: #fff; border-radius: 8px; padding: 6px 4px; opacity: 0; transition: opacity .15s; }
.spot:hover .spotvol, .spotvol:focus-within { opacity: 1; }

/* in-app updates */
.updcard { position: fixed; right: 16px; bottom: 16px; width: 320px; z-index: 60; display: flex; flex-direction: column; gap: 8px; padding: 14px; background: var(--dialog, var(--raised)); border: 1px solid var(--line2, var(--line)); border-radius: 12px; box-shadow: 0 8px 28px rgba(0,0,0,.35); }
.updhead { display: flex; align-items: center; gap: 8px; }
.updnotes { max-height: 72px; overflow: auto; white-space: pre-wrap; }
.updact { display: flex; gap: 8px; justify-content: flex-end; }
.updsplash { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; background: var(--bg); }
.updbox { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.updbox h1 { margin: 0; font-size: 22px; }
.updlogo { width: 64px; height: 64px; border-radius: 18px; background: var(--accent); color: var(--ink, #fff); font-size: 34px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.meter.indet > div { width: 40% !important; animation: indet 1.2s ease-in-out infinite; }
@keyframes indet { 0% { margin-left: -40%; } 100% { margin-left: 100%; } }

/* floating cameras and screen shares while you are somewhere else in the app */
.cminis { position: fixed; inset: 0; pointer-events: none; z-index: 45; }
.cmini { position: fixed; width: 300px; background: #000; border: 1px solid var(--line2); border-radius: 12px; overflow: hidden; box-shadow: 0 12px 36px rgba(0,0,0,.5); pointer-events: auto; display: flex; flex-direction: column; }
.cmhead { display: flex; align-items: center; gap: 2px; padding: 2px 4px 2px 10px; height: 28px; background: var(--raised); cursor: grab; user-select: none; touch-action: none; }
.cmtitle { flex: 1; font-size: 12px; color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmbody { aspect-ratio: 16 / 9; background: #000; display: flex; }
.cmbody video { width: 100%; height: 100%; object-fit: contain; }

/* v1.8.5: full screen and hide buttons on pictures */
.tile, .spot { position: relative; }
.fsbtn { position: absolute; z-index: 5; background: rgba(0,0,0,.55); color: #fff; border-radius: 6px; opacity: 0; transition: opacity .12s; }
.tile:hover .fsbtn, .spot:hover .fsbtn, .fsbtn:focus-visible { opacity: 1; }
.fsbtn.tl { left: 8px; top: 8px; } .fsbtn.tl2 { left: 44px; top: 8px; } .fsbtn.tr2 { right: 12px; top: 12px; opacity: .85; }
.fsbtn.tl3 { left: 80px; top: 8px; } .fsbtn.tr3 { right: 12px; top: 52px; opacity: .85; }
.tile:fullscreen, .spot:fullscreen, .cmini:fullscreen { width: 100vw !important; height: 100vh !important; background: #000; border-radius: 0; }
.tile:fullscreen video, .spot:fullscreen video, .cmini:fullscreen video { width: 100%; height: 100%; object-fit: contain; }
.cmini:fullscreen .cmbody { height: calc(100vh - 34px); }
/* call notices stay visible above the picture */
.stage > .notice { position: sticky; top: 0; z-index: 20; }

/* v1.8.6: live / camera / watching badges */
.lbadges { display: inline-flex; align-items: center; gap: 5px; margin-left: 6px; }
.livetag { background: #e5383b; color: #fff; font-size: 10px; font-weight: 800; letter-spacing: .04em; padding: 1px 5px; border-radius: 4px; }
.watchn { display: inline-flex; align-items: center; font-size: 11px; color: var(--dim); }
.camon { color: var(--green, #3ba55d); }
.callbar .ibtn.on { background: var(--accent); color: #fff; }

.wlib { margin-top: 6px; } .wlist { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; max-height: 220px; overflow: auto; }
.wrow { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; background: var(--raised); }
.wrow.now { outline: 1px solid var(--accent); } .wrow .info { flex: 1; min-width: 0; } .wrow .wt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
