:root {
  --bg-rail: #1e1f22; --bg-side: #2b2d31; --bg-main: #313338; --bg-panel: #232428; --bg-input: #383a40; --bg-float: #111214;
  --hover: #35373c; --active: #404249; --line: #3f4147;
  --text: #dbdee1; --text-hi: #f2f3f5; --muted: #949ba4; --muted2: #80848e;
  --blurple: #5865f2; --blurple-h: #4752c4; --green: #23a55a; --red: #f23f43; --yellow: #f0b232;
  --chat-w: 440px; --radius: 8px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg-rail); color: var(--text);
  font-family: "gg sans", "Segoe UI", "Noto Sans", Roboto, Arial, sans-serif; font-size: 15px; }
button { font: inherit; color: inherit; }
input, textarea, select { font: inherit; color: var(--text); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.ic { display: block; flex: none; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--scroll); border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }
#messages::-webkit-scrollbar-track { background: var(--bg-side); border-radius: 4px; }

/* Barra de título */
#titlebar { height: 30px; background: var(--bg-rail); -webkit-app-region: drag; display: flex; align-items: center; justify-content: center; position: relative; font-size: 13px; font-weight: 600; color: var(--text-hi); }
.tb-logo { position: absolute; left: 10px; top: 6px; }
.tb-logo img { width: 18px; height: 18px; border-radius: 5px; }
.os-darwin .tb-logo { left: 78px; } /* botões vermelho/amarelo/verde do Mac ficam à esquerda */
.screen { position: absolute; top: 30px; left: 0; right: 0; bottom: 0; }

/* Tela inicial */
.card { background: var(--bg-side); border-radius: 12px; padding: 20px; box-shadow: 0 2px 10px #0003; }
.card h2 { margin: 0 0 4px; color: var(--text-hi); font-size: 19px; }
.card p { margin: 0 0 14px; font-size: 14px; }
.home-profile { display: flex; gap: 16px; align-items: flex-end; margin-bottom: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field label { font-size: 12px; font-weight: 700; text-transform: uppercase; color: var(--muted); letter-spacing: .02em; }
.field input, .field select, .field textarea { background: var(--bg-rail); border: 0; border-radius: 4px; padding: 10px; outline: none; }
.field input:focus, .field select:focus { box-shadow: 0 0 0 2px var(--blurple); }
.field input[type=color] { padding: 2px; height: 42px; width: 56px; cursor: pointer; }
.row { display: flex; gap: 10px; }
.row .field:first-child { width: 110px; }
.grow { flex: 1; }
.btn { border: 0; border-radius: 4px; padding: 9px 16px; cursor: pointer; background: var(--btn); color: #fff; font-weight: 600; transition: background .15s; }
.btn:hover { background: var(--btn-h); }
.btn.primary { background: var(--blurple); }
.btn.primary:hover { background: var(--blurple-h); }
.btn.danger { background: #da373c; }
.btn.danger:hover { background: #a12828; }
.btn.big { width: 100%; padding: 12px; font-size: 16px; }
.btn:disabled { opacity: .5; cursor: default; }
.error { color: #fa777c; text-align: center; margin-top: 14px; min-height: 20px; white-space: pre-line; }
#recent { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.recent-item { display: flex; justify-content: space-between; align-items: center; background: var(--bg-rail); border-radius: 6px; padding: 8px 10px; cursor: pointer; font-size: 14px; }
.recent-item:hover { background: var(--hover); }
.recent-item .x { opacity: .5; } .recent-item .x:hover { opacity: 1; color: var(--red); }
.avatar-edit { width: 64px; height: 64px; border-radius: 50%; cursor: pointer; flex: none; position: relative; overflow: hidden; }
.avatar-edit::after { content: 'TROCAR'; position: absolute; inset: 0; background: #000a; color: #fff; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; opacity: 0; transition: .15s; }
.avatar-edit:hover::after { opacity: 1; }

/* Avatares */
.avatar { border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; flex: none; background-size: cover; background-position: center; user-select: none; }

/* Layout principal */
#main { display: flex; }
#rail { width: 72px; background: var(--bg-rail); display: flex; flex-direction: column; align-items: center; padding-top: 12px; gap: 8px; flex: none; }
.rail-item { width: 48px; height: 48px; border-radius: 50%; background: var(--bg-main); display: flex; align-items: center; justify-content: center; cursor: pointer; transition: border-radius .15s, background .15s; position: relative; color: var(--text-hi); font-weight: 700; overflow: hidden; }
.rail-item:hover, .rail-item.active { border-radius: 16px; }
.rail-item.active::before { content: ''; position: absolute; left: -16px; width: 8px; height: 40px; border-radius: 0 4px 4px 0; background: var(--text-hi); }
.rail-item.home img { width: 48px; height: 48px; }
.rail-sep { width: 32px; height: 2px; background: var(--line); border-radius: 1px; }
#rail-room { background: var(--blurple); font-size: 16px; overflow: visible; }

#sidebar { width: 240px; background: var(--bg-side); display: flex; flex-direction: column; flex: none; position: relative; border-top-left-radius: 8px; }
#room-header { height: 48px; padding: 0 12px 0 16px; display: flex; align-items: center; gap: 4px; font-weight: 700; color: var(--text-hi); border-bottom: 1px solid var(--line3); cursor: pointer; flex: none; }
#room-header:hover { background: var(--hover); }
#room-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#room-header .chev { color: var(--muted); font-size: 12px; margin-right: auto; }
.dropdown { position: absolute; top: 52px; left: 8px; right: 8px; background: var(--bg-float); border-radius: 6px; padding: 6px; z-index: 20; box-shadow: 0 8px 16px #0006; }
.dropdown .dd-item { padding: 8px; border-radius: 3px; cursor: pointer; font-size: 14px; display: flex; justify-content: space-between; align-items: center; color: var(--icon); }
.dropdown .dd-item:hover { background: var(--blurple); color: #fff; }
.dropdown .dd-item.danger { color: var(--red); }
.dropdown .dd-item.danger:hover { background: var(--red); color: #fff; }
#channels { flex: 1; overflow-y: auto; padding: 8px 8px 12px; }
.cat { font-size: 12px; font-weight: 700; text-transform: uppercase; color: var(--muted); padding: 16px 8px 4px; letter-spacing: .02em; }
.channel { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 4px; color: var(--muted); cursor: pointer; font-weight: 500; }
.channel:hover { background: var(--hover); color: var(--text); }
.channel.active { background: var(--active); color: var(--text-hi); }
.channel.voice.connected { color: var(--text-hi); }
.channel .ic { color: var(--muted2); }
.channel .timer { margin-left: auto; font-family: Consolas, monospace; font-size: 12px; color: var(--green); }
#voice-users { padding-left: 24px; }
.vu { display: flex; align-items: center; gap: 8px; padding: 4px 8px; border-radius: 4px; cursor: pointer; color: var(--muted); font-size: 14px; }
.vu:hover { background: var(--hover); color: var(--text); }
.vu .avatar { width: 24px; height: 24px; font-size: 11px; }
:is(.vu, .ou) .avatar, .tile.is-voice .avatar, .live-person { position: relative; }
:is(.vu, .ou) .avatar::before, .tile.is-voice .avatar::before,
:is(.tile:not(.is-voice), .live-person)::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  box-shadow: var(--speaking-ring, 0 0 0 2px var(--speak, var(--green)));
  opacity: 0; transition: opacity var(--dur-press, 120ms) var(--ease-out);
}
:is(.vu, .ou).speaking .avatar::before, .tile.is-voice.speaking .avatar::before,
:is(.tile:not(.is-voice), .live-person).speaking::before { opacity: 1; }
:is(.tile:not(.is-voice), .live-person) { --speaking-ring: inset 0 0 0 3px var(--speak, var(--green)); }
:is(.tile:not(.is-voice), .live-person)::before { z-index: 1; }
:is(html.reduce-motion, html.bg-paused) :is(.vu .avatar, .ou .avatar, .tile, .tile .avatar, .live-person)::before { transition: none; }
.vu .nm { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vu .st { display: flex; gap: 3px; color: var(--muted2); }
.vu .st .ic.red { color: var(--red); }
.live { background: var(--red); color: #fff; font-size: 11px; font-weight: 800; border-radius: 8px; padding: 1px 6px; letter-spacing: .02em; }
.ou { display: flex; align-items: center; gap: 10px; padding: 5px 8px; border-radius: 4px; color: var(--muted); font-size: 14px; cursor: pointer; }
.ou:hover { background: var(--hover); color: var(--text); }
.ou .avatar { width: 30px; height: 30px; font-size: 13px; position: relative; }
.ou .avatar::after { content: ''; position: absolute; right: -2px; bottom: -2px; width: 10px; height: 10px; border-radius: 50%; background: var(--green); border: 3px solid var(--bg-side); }
.tag { font-size: 11px; background: var(--blurple); color: #fff; border-radius: 3px; padding: 1px 4px; font-weight: 700; margin-left: 4px; }

#voice-panel { background: var(--bg-panel); border-bottom: 1px solid var(--line2); padding: 8px 8px 8px; flex: none; border-radius: 8px 8px 0 0; margin: 0 8px; }
.vp-top { display: flex; align-items: center; justify-content: space-between; }
.vp-status { display: flex; align-items: center; gap: 8px; min-width: 0; }
#vp-signal { color: var(--green); }
#vp-signal.warn { color: var(--yellow); } #vp-signal.bad { color: var(--red); }
#vp-title { font-size: 14px; font-weight: 700; }
#vp-title.good { color: var(--green); } #vp-title.warn { color: var(--yellow); } #vp-title.bad { color: var(--red); }
#vp-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vp-buttons { display: flex; gap: 8px; margin-top: 8px; }
.vp-btn { flex: 1; background: var(--bg-side); border: 0; border-radius: 6px; height: 32px; display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text); }
.vp-btn:hover { background: var(--active); }
.vp-btn.on { background: var(--green); color: #fff; }

#user-panel { height: 56px; background: var(--bg-panel); display: flex; align-items: center; padding: 0 8px; gap: 2px; flex: none; margin: 0 8px 8px; border-radius: 0 0 8px 8px; }
#voice-panel.hidden + #user-panel { border-radius: 8px; }
.up-user { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; padding: 4px; border-radius: 4px; cursor: pointer; }
.up-user:hover { background: var(--active); }
#up-avatar { width: 32px; height: 32px; font-size: 14px; }
.up-names { min-width: 0; }
#up-name { font-size: 14px; font-weight: 700; color: var(--text-hi); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#up-sub { font-size: 12px; color: var(--muted); }
.icon-btn { width: 32px; height: 32px; border: 0; background: transparent; color: var(--icon); border-radius: 4px; display: flex; align-items: center; justify-content: center; cursor: pointer; flex: none; }
.icon-btn:hover { background: var(--active); color: var(--text-hi); }
.icon-btn.small { width: 24px; height: 24px; }
.icon-btn.off { color: var(--red); }
.icon-btn.off:hover { background: #f23f4322; }

/* Call */
#call { flex: 1; min-width: 320px; background: var(--call-bg); display: flex; flex-direction: column; position: relative; }
.pane-header { height: 48px; display: flex; align-items: center; gap: 8px; padding: 0 16px; font-weight: 700; color: var(--text-hi); flex: none; border-bottom: 1px solid var(--line3); }
#call .pane-header { border-bottom-color: var(--line3); }
.pane-header .ic { color: var(--muted2); }
#call-stage { flex: 1; min-height: 0; position: relative; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.grid { flex: 1; min-height: 0; display: grid; gap: 10px; align-content: center; justify-content: center; }
.tile { position: relative; background: var(--bg-side); border-radius: 10px; overflow: hidden; display: flex; align-items: center; justify-content: center; aspect-ratio: 16/9; cursor: pointer; min-width: 0; min-height: 0; }
.tile .avatar { width: 80px; height: 80px; font-size: 32px; }
.tile .label { position: absolute; left: 10px; bottom: 10px; background: #000a; color: #fff; padding: 3px 8px; border-radius: 6px; font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 6px; max-width: calc(100% - 20px); }
.tile .label span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .label .ic { color: var(--red); }
.tile video { width: 100%; height: 100%; object-fit: contain; background: #000; display: block; }
.tile-body { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.grid .tile { aspect-ratio: auto; width: 100%; height: 100%; min-height: 0; }
.grid .tile .tile-body { position: absolute; inset: 0; }
.tile.is-screen { background: #000; }
.tile .tile-tools { position: absolute; right: 10px; top: 10px; display: flex; gap: 6px; opacity: 0; transition: opacity .15s; }
.tile:hover .tile-tools { opacity: 1; }
.tile-tools button { background: #000a; border: 0; border-radius: 6px; width: 32px; height: 32px; color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.tile-tools button:hover { background: #000d; }
.tile .live { position: absolute; left: 10px; top: 10px; }
.focus-wrap { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 10px; }
.focus-main { flex: 1; min-height: 0; display: flex; }
.focus-main .tile { width: 100%; height: 100%; aspect-ratio: auto; }
.focus-strip { height: 110px; display: flex; gap: 10px; justify-content: center; flex: none; }
.focus-strip .tile { height: 100%; width: auto; }
.focus-strip .tile .avatar { width: 48px; height: 48px; font-size: 20px; }
.call-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; }
.call-empty h2 { margin: 0; color: var(--text-hi); }
.call-empty .avatars { display: flex; gap: -8px; }
.call-empty .avatars .avatar { width: 48px; height: 48px; font-size: 20px; border: 3px solid var(--call-bg); margin-left: -10px; }
.btn.green { background: var(--green); } .btn.green:hover { background: #1a8747; }
#call-controls { display: flex; justify-content: center; gap: 12px; padding: 14px; flex: none; }
.cc-btn { width: 56px; height: 56px; border-radius: 50%; border: 0; background: var(--bg-side); color: var(--text-hi); display: flex; align-items: center; justify-content: center; cursor: pointer; transition: background .15s; }
.cc-btn:hover { background: var(--active); }
.cc-btn.off { background: #fff; color: #111; }
.cc-btn.on { background: var(--green); }
.cc-btn.danger { background: var(--red); } .cc-btn.danger:hover { background: #d83c3e; }

#splitter { width: 4px; cursor: col-resize; background: var(--line3); flex: none; }
#splitter:hover, #splitter.drag { background: var(--blurple); }

/* Chat */
#chat { width: var(--chat-w); min-width: 320px; max-width: 70vw; background: var(--bg-main); display: flex; flex-direction: column; position: relative; flex: none; }
#messages { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 16px 0 8px; }
.msg { padding: 2px 16px 2px 72px; position: relative; min-height: 22px; }
.msg:hover { background: var(--msg-hover); }
.msg.head { margin-top: 16px; }
.msg .avatar { position: absolute; left: 16px; top: 4px; width: 40px; height: 40px; font-size: 17px; cursor: pointer; }
.msg .meta { display: flex; align-items: baseline; gap: 8px; }
.msg .author { font-weight: 600; cursor: pointer; }
.msg .author:hover { text-decoration: underline; }
.msg .time { font-size: 12px; color: var(--muted); }
.msg .hover-time { position: absolute; left: 0; width: 64px; text-align: right; top: 4px; font-size: 11px; color: var(--muted); display: none; }
.msg:not(.head):hover .hover-time { display: block; }
.msg .text { color: var(--text); line-height: 1.375; white-space: pre-wrap; word-wrap: break-word; overflow-wrap: anywhere; user-select: text; }
.msg .text a { color: var(--link); text-decoration: none; } .msg .text a:hover { text-decoration: underline; }
.msg .text code { background: var(--bg-side); border-radius: 4px; padding: 1px 4px; font-family: Consolas, monospace; font-size: 13px; }
.msg .text pre { background: var(--bg-side); border: 1px solid var(--bg-rail); border-radius: 4px; padding: 8px; margin: 4px 0; white-space: pre-wrap; font-family: Consolas, monospace; font-size: 13px; }
.msg.pending { opacity: .5; }
.atts { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; align-items: flex-start; }
.att-img { max-width: min(100%, 400px); max-height: 320px; border-radius: 8px; cursor: zoom-in; display: block; background: var(--bg-side); }
.att-video { max-width: min(100%, 420px); max-height: 320px; border-radius: 8px; background: #000; display: block; }
.att-file { display: flex; align-items: center; gap: 10px; background: var(--bg-side); border: 1px solid var(--line2); border-radius: 8px; padding: 12px; width: min(100%, 400px); }
.att-file .ic { color: var(--icon); }
.att-file .fi { flex: 1; min-width: 0; }
.att-file .fn { max-width: 100%; padding: 0; border: 0; background: transparent; font: inherit; text-align: left; color: var(--link); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.att-file .fn:hover { text-decoration: underline; }
.att-file .fs { font-size: 12px; color: var(--muted); }
.att-file audio { width: 100%; margin-top: 6px; height: 36px; }
.att-dl { cursor: pointer; }
.sys { text-align: center; color: var(--muted); font-size: 12px; margin: 10px 0; }
.welcome { padding: 16px 16px 8px; }
.welcome .big-hash { width: 68px; height: 68px; border-radius: 50%; background: var(--active); display: flex; align-items: center; justify-content: center; color: var(--text-hi); }
.welcome h1 { color: var(--text-hi); margin: 8px 0 4px; font-size: 28px; }
#typing { height: 22px; padding: 0 16px; font-size: 12px; color: var(--text); flex: none; }
#typing b { font-weight: 700; }
#composer { padding: 0 16px 20px; flex: none; }
.composer-row { background: var(--bg-input); border-radius: 8px; display: flex; align-items: flex-start; padding: 4px 8px 4px 6px; }
.composer-row .icon-btn { margin-top: 6px; color: var(--icon); }
#input { flex: 1; background: transparent; border: 0; outline: none; resize: none; padding: 11px 8px; max-height: 40vh; line-height: 1.375; }
#pending-files { display: flex; gap: 8px; flex-wrap: wrap; background: var(--bg-input); border-radius: 8px 8px 0 0; }
#pending-files:not(:empty) { padding: 12px 12px 6px; border-bottom: 1px solid var(--bg-side); }
#pending-files:not(:empty) + .composer-row { border-radius: 0 0 8px 8px; }
.pf { width: 150px; background: var(--bg-side); border-radius: 6px; padding: 8px; position: relative; font-size: 12px; }
.pf .thumb { height: 90px; border-radius: 4px; background: var(--bg-rail) center/cover no-repeat; display: flex; align-items: center; justify-content: center; color: var(--muted); margin-bottom: 6px; }
.pf .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pf .rm { position: absolute; top: -6px; right: -6px; background: var(--bg-float); border: 0; border-radius: 6px; width: 24px; height: 24px; color: var(--red); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.pf .bar { height: 4px; background: var(--bg-rail); border-radius: 2px; margin-top: 6px; overflow: hidden; }
.pf .bar div { height: 100%; background: var(--blurple); width: 0; transition: width .1s; }
#drop-overlay { position: absolute; inset: 8px; border: 2px dashed var(--blurple); border-radius: 12px; background: var(--accent-soft); display: flex; align-items: center; justify-content: center; font-size: 18px; color: #fff; pointer-events: none; z-index: 5; }

/* Modais */
#modal-root .overlay { position: fixed; inset: 0; background: #000b; display: flex; align-items: center; justify-content: center; z-index: 100; animation: fade .12s; }
@keyframes fade { from { opacity: 0 } }
.modal { background: var(--bg-main); border-radius: 12px; width: min(560px, 92vw); max-height: 88vh; display: flex; flex-direction: column; box-shadow: 0 10px 40px #000a; animation: pop .15s; }
@keyframes pop { from { transform: scale(.96); opacity: 0 } }
.modal.wide { width: min(820px, 94vw); }
.modal header { padding: 16px 16px 8px; display: flex; justify-content: space-between; align-items: flex-start; }
.modal header h2 { margin: 0; color: var(--text-hi); font-size: 20px; }
.modal header p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.modal .body { padding: 8px 16px 16px; overflow-y: auto; }
.modal footer { background: var(--bg-side); padding: 14px 16px; border-radius: 0 0 12px 12px; display: flex; justify-content: flex-end; gap: 8px; align-items: center; }
.tabs { display: flex; gap: 4px; margin-bottom: 12px; }
.tab { padding: 6px 12px; border-radius: 4px; cursor: pointer; color: var(--muted); font-weight: 600; }
.tab:hover { background: var(--hover); color: var(--text); }
.tab.active { background: var(--active); color: var(--text-hi); }
.sources { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.src { background: var(--bg-side); border-radius: 8px; padding: 8px; cursor: pointer; border: 2px solid transparent; }
.src:hover { background: var(--hover); }
.src.sel { border-color: var(--blurple); }
.src .th { aspect-ratio: 16/9; background: #111 center/contain no-repeat; border-radius: 4px; }
.src .nm { display: flex; gap: 6px; align-items: center; font-size: 13px; margin-top: 6px; white-space: nowrap; overflow: hidden; }
.src .nm img { width: 16px; height: 16px; }
.src .nm span { overflow: hidden; text-overflow: ellipsis; }
.opts { display: flex; gap: 16px; flex-wrap: wrap; align-items: flex-end; margin-top: 14px; }
.opts .field { margin: 0; }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.check input { width: 18px; height: 18px; accent-color: var(--blurple); }
.addr-list { display: flex; flex-direction: column; gap: 10px; }
.addr { background: var(--bg-side); border-radius: 8px; padding: 12px; }
.addr .t { font-size: 12px; font-weight: 700; text-transform: uppercase; color: var(--muted); display: flex; gap: 8px; align-items: center; }
.addr .v { display: flex; gap: 8px; align-items: center; margin-top: 6px; }
.addr .v code { flex: 1; background: var(--bg-rail); border-radius: 4px; padding: 9px 10px; font-family: Consolas, monospace; font-size: 14px; user-select: all; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.addr .note { font-size: 13px; color: var(--muted); margin-top: 6px; line-height: 1.4; }
.ok { color: var(--green); } .bad { color: #fa777c; } .warn { color: var(--yellow); }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.meter { height: 10px; border-radius: 5px; background: var(--bg-rail); position: relative; overflow: hidden; margin-top: 4px; }
.meter .lvl { position: absolute; left: 0; top: 0; bottom: 0; background: var(--green); width: 0; }
.meter .thr { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--yellow); }
input[type=range] { accent-color: var(--blurple); width: 100%; }
.section-title { font-size: 12px; font-weight: 700; text-transform: uppercase; color: var(--muted); margin: 16px 0 8px; }
.kbd { background: var(--bg-rail); border-radius: 4px; padding: 9px 10px; cursor: pointer; font-family: Consolas, monospace; text-align: center; }
.kbd.rec { box-shadow: 0 0 0 2px var(--red); }

.code-box { background: var(--bg-rail); border-radius: 10px; padding: 18px; text-align: center; }
.code-box .code { font-family: Consolas, monospace; font-size: 38px; font-weight: 800; letter-spacing: .12em; color: var(--text-hi); user-select: all; }
.code-box .btn { margin-top: 12px; }
.code-box .note { color: var(--muted); font-size: 13px; margin-top: 10px; line-height: 1.4; }
details.more { margin-top: 14px; }
details.more summary { cursor: pointer; color: var(--muted); font-size: 13px; font-weight: 600; margin-bottom: 10px; }
#join-addr { font-family: Consolas, monospace; letter-spacing: .05em; }

/* Menu de contexto */
#ctx-menu { position: fixed; background: var(--bg-float); border-radius: 6px; padding: 8px; z-index: 200; width: 240px; box-shadow: 0 8px 16px #0008; font-size: 14px; }
#ctx-menu .ctx-head { display: flex; align-items: center; gap: 8px; padding: 4px 4px 10px; border-bottom: 1px solid var(--line2); margin-bottom: 8px; font-weight: 700; color: var(--text-hi); }
#ctx-menu .ctx-head .avatar { width: 28px; height: 28px; font-size: 12px; }
#ctx-menu .ctx-label { font-size: 12px; color: var(--muted); font-weight: 700; text-transform: uppercase; display: flex; justify-content: space-between; padding: 0 4px; }
#ctx-menu .ctx-row { padding: 6px 4px; }
#ctx-menu .ctx-item { padding: 8px 6px; border-radius: 3px; cursor: pointer; display: flex; justify-content: space-between; color: var(--icon); }
#ctx-menu .ctx-item:hover { background: var(--blurple); color: #fff; }

/* Toasts e lightbox */
#toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 300; align-items: center; pointer-events: none; }
.toast { background: var(--bg-float); color: var(--text-hi); padding: 10px 16px; border-radius: 8px; box-shadow: 0 6px 20px #0008; font-size: 14px; animation: pop .15s; max-width: 520px; text-align: center; }
.toast.err { border-left: 4px solid var(--red); } .toast.ok { border-left: 4px solid var(--green); }
.lightbox { position: fixed; inset: 0; background: #000e; z-index: 250; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 10px; cursor: zoom-out; }
.lightbox img { max-width: 92vw; max-height: 86vh; border-radius: 4px; }
.lightbox-download { border: 0; padding: 0; background: transparent; color: #fff; opacity: .7; font-size: 14px; cursor: pointer; }
.lightbox-download:hover { opacity: 1; text-decoration: underline; }
