* { box-sizing: border-box; }
body { margin: 0; font-family: ui-sans-serif, system-ui, sans-serif; background: #0d1117; color: #e6edf3; height: 100vh; height: 100dvh; overflow: hidden; }
.login { position: fixed; inset: 0; display: grid; place-items: center; }
.card { background: #161b22; padding: 2rem; border-radius: 14px; width: 300px; display: flex; flex-direction: column; gap: .75rem; box-shadow: 0 10px 40px rgba(0,0,0,.5); }
.card h1 { margin: 0 0 .5rem; font-size: 1.4rem; text-align: center; }
input, button { font: inherit; padding: .6rem .7rem; border-radius: 8px; border: 1px solid #30363d; background: #0d1117; color: #e6edf3; }
button { background: #238636; border-color: #238636; cursor: pointer; }
button:hover { filter: brightness(1.1); }
button:disabled { opacity: .5; cursor: default; }
.err { color: #f85149; font-size: .85rem; min-height: 1rem; text-align: center; }
#app { display: grid; grid-template-columns: 1fr 320px; height: 100vh; height: 100dvh; }
.main { display: flex; flex-direction: column; min-width: 0; background: #000; }
#video { flex: 1; width: 100%; min-height: 0; background: #000; }
.bar { display: flex; align-items: center; gap: .5rem; padding: .5rem; background: #0d1117; flex-wrap: wrap; }
.spacer { flex: 1; }
.episodes { display: flex; gap: .35rem; flex-wrap: wrap; }
.episodes button { background: #21262d; border-color: #30363d; padding: .4rem .6rem; font-size: .85rem; }
.episodes button.active { background: #1f6feb; border-color: #1f6feb; }
.vol { display: flex; align-items: center; gap: .4rem; font-size: .8rem; }
.vol input { width: 90px; }
#resync { background: #21262d; border-color: #30363d; }
.side { display: flex; flex-direction: column; border-left: 1px solid #21262d; min-height: 0; }
.panel { display: flex; flex-direction: column; border-bottom: 1px solid #21262d; padding: .6rem; min-height: 0; }
.chatpanel { flex: 1; }
.phead { font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; opacity: .7; margin-bottom: .5rem; }
.status { font-weight: 400; text-transform: none; letter-spacing: 0; opacity: .8; margin-left: .3rem; }
.vctl { display: flex; gap: .4rem; margin-bottom: .5rem; }
.vctl button { flex: 1; font-size: .85rem; }
#mutebtn { background: #21262d; border-color: #30363d; }
.peers { display: flex; flex-direction: column; gap: .35rem; }
.peer { display: flex; align-items: center; gap: .5rem; font-size: .85rem; }
.peer span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.peer input { width: 80px; }
.chat { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: .25rem; font-size: .88rem; margin-bottom: .5rem; }
.msg.sys { opacity: .55; font-style: italic; font-size: .8rem; }
.chatform { display: flex; gap: .4rem; }
.chatform input { flex: 1; }
.chatform button { padding: .5rem .7rem; }
@media (max-width: 720px) { #app { grid-template-columns: 1fr; grid-template-rows: 1fr 40vh; grid-template-rows: 1fr 40dvh; } .side { border-left: none; border-top: 1px solid #21262d; } }

/* v2: screen share + wider volume */
.stage { position: relative; flex: 1; min-height: 0; background: #000; display: flex; }
#video { flex: 1; width: 100%; min-height: 0; background: #000; }
.screenwrap { position: absolute; inset: 0; background: #000; display: flex; flex-direction: column; }
#screen { flex: 1; width: 100%; min-height: 0; background: #000; object-fit: contain; }
.screenbar { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .4rem .6rem; background: #161b22; font-size: .85rem; }
.screenbar button { background: #21262d; border-color: #30363d; padding: .3rem .6rem; }
.vctl { flex-wrap: wrap; }
.vctl button { flex: 1 1 45%; font-size: .82rem; padding: .45rem .3rem; }
#mutebtn, #screenbtn { background: #21262d; border-color: #30363d; }
#screenbtn.active { background: #8957e5; border-color: #8957e5; }
.vol input { width: 80px; }
.vol span { font-size: .75rem; opacity: .6; min-width: 34px; display: inline-block; }
.peer .pv { font-size: .7rem; opacity: .55; min-width: 30px; text-align: right; }
.nsettings { display: flex; flex-wrap: wrap; gap: .5rem .8rem; font-size: .75rem; opacity: .8; margin: .1rem 0 .5rem; }
.nsettings label { display: flex; align-items: center; gap: .25rem; cursor: pointer; }
.nsettings input { width: auto; }

/* mic settings popup */
.modal { position: fixed; inset: 0; height: 100vh; height: 100dvh; background: rgba(0,0,0,.55); display: grid; place-items: center; z-index: 50; }
.modalcard { background: #161b22; border: 1px solid #30363d; border-radius: 12px; padding: 1rem 1.2rem 1.2rem; width: min(93vw, 390px); box-shadow: 0 12px 40px rgba(0,0,0,.5); }
.mhead { display: flex; align-items: center; justify-content: space-between; font-weight: 600; font-size: 1.02rem; }
.mx { background: transparent; border: none; color: #e6edf3; font-size: 1rem; cursor: pointer; padding: .2rem .45rem; }
.mx:hover { color: #f85149; }
.mnote { font-size: .8rem; opacity: .6; margin: .3rem 0 .6rem; line-height: 1.35; }
.arow { display: flex; gap: .65rem; align-items: flex-start; padding: .6rem 0; border-top: 1px solid #21262d; cursor: pointer; }
.arow input { width: auto; margin-top: .2rem; flex: none; }
.arow span { display: flex; flex-direction: column; gap: .15rem; }
.arow b { font-size: .9rem; font-weight: 600; }
.arow em { font-size: .78rem; opacity: .58; font-style: normal; line-height: 1.35; }
#audiobtn { background: #21262d; border-color: #30363d; }
#notifybtn { background: #21262d; border-color: #30363d; }
#notifybtn.active { background: #1f6feb; border-color: #1f6feb; }

/* library / folder browser */
.libbtn { background: #21262d; border-color: #30363d; }
.nowplaying { font-size: .85rem; opacity: .7; margin-left: .1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 42vw; }
.libcard { width: min(94vw, 460px); }
.libfilter { width: 100%; margin-top: .55rem; }
.libitems { max-height: 56vh; overflow-y: auto; margin-top: .5rem; }
.libitem { display: flex; align-items: center; gap: .5rem; padding: .55rem .5rem; border-top: 1px solid #21262d; cursor: pointer; border-radius: 6px; font-size: .9rem; }
.libitem:hover { background: #21262d; }
.libitem.up { color: #8b949e; }
.libitem.playing { color: #3fb950; }
.libitem b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.libempty { opacity: .5; font-size: .85rem; padding: .8rem .5rem; }
