:root, [data-theme="taverna-escuro"] {
  /* Taverna à noite: madeira escura, luz de lamparina */
  --bg: #15100c; --bg2: #1d1610; --bg3: #2a2017; --line: #3a2c1f; --rail: #110d09;
  --text: #f1e5d3; --muted: #a8937a; --accent: #ec8a2c; --accent2: #b9631c; --accent-ink: #1f1206;
  --danger: #e2574c; --speak: #f2a33a; --link: #f3b26b; --radius: 10px;
  --hover: #2f241a; --active: #3a2b1d; --glow: 0 0 0 1px #ec8a2c33, 0 8px 30px #00000066;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif; color-scheme: dark;
}
[data-theme="taverna-claro"] {
  /* Taverna de dia: pergaminho, carvalho claro, mesmo laranja */
  --bg: #f6eddc; --bg2: #eee1c8; --bg3: #e4d2b2; --line: #d5bf99; --rail: #e6d6b9;
  --text: #2a1d12; --muted: #7a6249; --accent: #d9731a; --accent2: #b45d14; --accent-ink: #fff8ee;
  --danger: #c4392f; --speak: #d9731a; --link: #a9500f;
  --hover: #e7d6b8; --active: #dcc6a0; --glow: 0 0 0 1px #d9731a33, 0 8px 30px #6b4a2333;
  color-scheme: light;
}
* { box-sizing: border-box; }
:root { accent-color: var(--accent); }
::selection { background: color-mix(in srgb, var(--accent) 40%, transparent); }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-size: 14px; }
.hidden { display: none !important; }
.muted { color: var(--muted); } .small { font-size: 12px; } .center { text-align: center; }
.error { color: var(--danger); min-height: 1em; }
button { font: inherit; color: inherit; cursor: pointer; }
input, select { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
input:focus { outline: 2px solid var(--accent2); border-color: transparent; }
.btn { background: var(--bg3); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.icon-btn { background: none; border: 0; color: var(--muted); font-size: 16px; padding: 4px 6px; border-radius: 6px; }
.icon-btn:hover { color: var(--text); background: var(--bg3); }

/* ---- Auth ---- */
#auth { height: 100%; display: grid; place-items: center; }
.auth-card { width: 360px; background: var(--bg2); border: 1px solid var(--line); border-radius: 16px; padding: 28px; }
.brand { margin: 0; font-size: 28px; letter-spacing: -0.5px; }
.tabs { display: flex; gap: 6px; margin: 18px 0 12px; }
.tab { flex: 1; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px; color: var(--muted); }
.tab.active { color: var(--text); border-color: var(--accent2); }
.auth-form { display: grid; gap: 10px; }
.auth-form label { display: grid; gap: 4px; color: var(--muted); font-size: 12px; }

/* ---- Layout ---- */
#app { display: grid; grid-template-columns: 250px 1fr; height: 100%; }
#sidebar { background: var(--bg2); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.server-name { display: flex; justify-content: space-between; align-items: center; padding: 14px 14px; font-weight: 700; font-size: 16px; border-bottom: 1px solid var(--line); }
.channel-group { padding: 10px 8px 0; }
.group-title { text-transform: uppercase; font-size: 11px; color: var(--muted); letter-spacing: .6px; padding: 4px 8px; }
#sidebar ul { list-style: none; margin: 0; padding: 0; }
.ch { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 6px; color: var(--muted); cursor: pointer; }
.ch:hover { background: var(--hover); color: var(--text); }
.ch.active { background: var(--active); color: var(--text); box-shadow: inset 3px 0 0 var(--accent); }
.ch .hash { width: 16px; text-align: center; opacity: .8; }
.vmembers { padding: 2px 0 4px 30px; }
.vmember { display: flex; align-items: center; gap: 6px; padding: 2px 0; color: var(--muted); font-size: 13px; }
.vmember.speaking .avatar.sm { box-shadow: 0 0 0 2px var(--speak); }
.avatar { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--accent2); color: #fff; font-weight: 700; flex: none; background-size: cover; background-position: center; overflow: hidden; }
.avatar.sm { width: 20px; height: 20px; font-size: 10px; }
#voice-status { margin-top: auto; padding: 10px 12px; border-top: 1px solid var(--line); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; } .dot.ok { background: var(--accent); }
.voice-controls { display: flex; gap: 6px; margin-top: 8px; }
.ctl { flex: 1; background: var(--bg3); border: 1px solid var(--line); border-radius: 8px; padding: 7px 0; font-size: 16px; }
.ctl.off { background: color-mix(in srgb, var(--danger) 22%, var(--bg3)); border-color: var(--danger); }
.ctl.on { background: color-mix(in srgb, var(--accent) 25%, var(--bg3)); border-color: var(--accent); }
.ctl.danger:hover { background: var(--danger); }
.user-bar { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); background: var(--rail); }
#voice-status.hidden + .user-bar { margin-top: auto; }
.user-bar #me-name { flex: 1; font-weight: 600; }

#main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
#main-header { padding: 14px 18px; border-bottom: 1px solid var(--line); font-weight: 700; font-size: 15px; }
.view { flex: 1; display: flex; flex-direction: column; min-height: 0; }

/* ---- Chat ---- */
#messages { flex: 1; overflow-y: auto; padding: 14px 18px; }
.msg { display: grid; grid-template-columns: 38px 1fr; gap: 10px; padding: 6px 0; }
.msg .meta { font-size: 12px; color: var(--muted); }
.msg .meta b { color: var(--text); font-size: 14px; margin-right: 6px; }
.msg.bot .meta b { color: var(--accent); }
.msg .body { white-space: pre-wrap; word-break: break-word; line-height: 1.4; }
.msg .body a { color: var(--link); }
.badge { font-size: 10px; background: var(--accent2); color: var(--accent-ink); border-radius: 4px; padding: 1px 4px; margin-right: 6px; }
#composer { padding: 12px 18px 18px; }
#composer input { width: 100%; padding: 12px 14px; background: var(--bg3); border-color: transparent; }

/* ---- Voz ---- */
#stage { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; min-height: 0; }
#screens { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); }
.screen { position: relative; background: #000; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
.screen video { width: 100%; display: block; max-height: 70vh; object-fit: contain; }
.screen .label { position: absolute; left: 8px; bottom: 8px; background: #000a; padding: 3px 8px; border-radius: 6px; font-size: 12px; }
.screen .fs { position: absolute; right: 8px; bottom: 8px; }
#tiles { display: flex; flex-wrap: wrap; gap: 10px; }
.tile { width: 150px; height: 110px; background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); display: grid; place-items: center; align-content: center; gap: 8px; transition: box-shadow .1s; }
.tile .avatar { width: 48px; height: 48px; font-size: 20px; }
.tile.speaking { box-shadow: 0 0 0 3px var(--speak); }
.tile .name { font-size: 13px; }
.tile .flags { font-size: 12px; color: var(--muted); }

#music { border-top: 1px solid var(--line); background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 6%, var(--bg2)), var(--bg2));
  padding: 12px 16px; display: grid; grid-template-columns: 200px minmax(0, 1fr) minmax(220px, 300px); gap: 18px; align-items: center; }
#yt-wrap { position: relative; width: 200px; height: 200px; background: #000; border-radius: 10px; overflow: hidden; box-shadow: 0 8px 22px #0007; }
#yt-wrap iframe, #yt-player { width: 100%; height: 100%; display: block; }
#yt-empty { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 4px; color: var(--muted);
  background: radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--accent) 22%, #000), #000); }
#yt-empty span { font-size: 40px; }
.mp-main { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.mp-title { font-size: 18px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mp-sub { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mp-progress { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; margin-top: 6px; }
.mp-bar { position: relative; flex: 1; height: 6px; border-radius: 4px; background: var(--bg3); cursor: pointer; }
.mp-bar:hover { height: 8px; }
#mp-fill { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: 4px; background: var(--accent); }
#mp-knob { position: absolute; top: 50%; left: 0; width: 12px; height: 12px; border-radius: 50%; background: var(--text); transform: translate(-50%, -50%); opacity: 0; transition: opacity .1s; }
.mp-bar:hover #mp-knob { opacity: 1; }
.mp-ctl { display: flex; align-items: center; gap: 12px; margin-top: 4px; }
.mp-play { width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; cursor: pointer; transition: transform .1s; }
.mp-play:hover { transform: scale(1.06); }
.mp-play svg, .mp-btn svg { width: 22px; height: 22px; fill: currentColor; }
.mp-play .i-pause { display: none; } .mp-play.playing .i-play { display: none; } .mp-play.playing .i-pause { display: block; }
.mp-btn { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 4px; border-radius: 8px; display: grid; }
.mp-btn:hover { color: var(--text); }
.mp-vol { display: flex; align-items: center; gap: 6px; color: var(--muted); margin-left: 8px; }
.mp-vol svg { width: 20px; height: 20px; fill: currentColor; }
.mp-vol input { width: 110px; }
.mp-side { display: flex; flex-direction: column; gap: 6px; min-width: 0; align-self: stretch; }
#m-add { display: flex; gap: 6px; } #m-add input { flex: 1; min-width: 0; } #m-add .btn { padding: 6px 12px; font-size: 16px; }
.mp-next { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
#m-queue { margin: 0; padding: 0; list-style: none; overflow-y: auto; max-height: 120px; display: grid; gap: 2px; counter-reset: q; }
#m-queue li { display: grid; grid-template-columns: 18px 1fr auto; gap: 6px; align-items: center; padding: 4px 6px; border-radius: 6px; font-size: 13px; counter-increment: q; }
#m-queue li::before { content: counter(q); color: var(--muted); font-size: 11px; text-align: right; }
#m-queue li:hover { background: var(--hover); }
#m-queue li .t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#m-queue li .t small { color: var(--muted); }
#m-queue .empty { color: var(--muted); font-size: 12px; padding: 4px 0; }
#m-queue .empty::before { content: none; }
@media (max-width: 1100px) { #music { grid-template-columns: 200px minmax(0, 1fr); } .mp-side { grid-column: 1 / -1; } }

/* ---- Modais ---- */
.modal { position: fixed; inset: 0; background: #000a; display: grid; place-items: center; z-index: 10; }
.modal-card { background: var(--bg2); border: 1px solid var(--line); border-radius: 14px; padding: 18px; width: 460px; max-height: 85vh; overflow-y: auto; }
.modal-card.wide { width: 760px; }
.modal-card header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-size: 16px; }
.modal-card h3 { font-size: 13px; text-transform: uppercase; color: var(--muted); margin: 18px 0 8px; letter-spacing: .5px; }
.row { display: flex; gap: 8px; align-items: end; flex-wrap: wrap; }
.row label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.row input[type=number] { width: 110px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
td, th { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 500; }
.invite-code { font-family: ui-monospace, Consolas, monospace; font-size: 20px; background: var(--bg); padding: 10px; border-radius: 8px; text-align: center; letter-spacing: 2px; }
ul.plain { list-style: none; padding: 0; }
ul.plain li { display: flex; justify-content: space-between; padding: 4px 0; border-bottom: 1px solid var(--line); }
#picker-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pick { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 6px; text-align: left; }
.pick:hover { border-color: var(--accent); }
.pick img { width: 100%; border-radius: 4px; display: block; }
.pick span { display: block; font-size: 12px; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- Grupos ---- */
#channel-tree { flex: 1; overflow-y: auto; padding-bottom: 8px; }
.section { padding: 10px 8px 0; }
.section-title { display: flex; align-items: center; gap: 6px; text-transform: uppercase; font-size: 11px; color: var(--muted); letter-spacing: .6px; padding: 4px 8px; cursor: pointer; user-select: none; }
.section-title:hover { color: var(--text); }
.section-title .chev { transition: transform .15s; font-size: 9px; }
.section.collapsed .chev { transform: rotate(-90deg); }
.section.collapsed ul { display: none; }
.section.grp .section-title { color: var(--accent); }
.checks { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; width: 100%; }
.checks label { display: inline-flex !important; grid: none; gap: 4px; align-items: center; color: var(--text) !important; font-size: 13px !important; }
.gchips { display: flex; flex-wrap: wrap; gap: 4px 10px; }
.gchips label { display: inline-flex; gap: 3px; align-items: center; font-size: 12px; }
.pill { font-size: 11px; background: var(--bg3); border: 1px solid var(--line); border-radius: 10px; padding: 1px 7px; margin-right: 4px; color: var(--muted); }

/* ---- Marca / Taverna ---- */
.server-name { gap: 10px; justify-content: flex-start; background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 10%, var(--bg2)), var(--bg2)); }
.server-name .logo { width: 30px; height: 30px; border-radius: 8px; flex: none; }
.server-name > span { flex: 1; font-family: Georgia, "Times New Roman", serif; letter-spacing: .3px; }
.brand { font-family: Georgia, "Times New Roman", serif; display: flex; align-items: center; gap: 12px; }
.brand img { width: 44px; height: 44px; border-radius: 12px; }
#auth { background: radial-gradient(1200px 600px at 50% -10%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 60%), var(--bg); }
.auth-card { box-shadow: var(--glow); }
#main-header { display: flex; align-items: center; gap: 8px; }
.ch .hash { width: 18px; }
.section-title .gicon { font-size: 13px; }
.user-bar .uname { flex: 1; min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- Configurações (estilo painel lateral) ---- */
.settings-card { display: grid; grid-template-columns: 180px 1fr; gap: 0; padding: 0; width: 820px; height: min(640px, 88vh); overflow: hidden; }
.settings-nav { background: var(--bg); border-right: 1px solid var(--line); padding: 18px 10px; display: flex; flex-direction: column; gap: 2px; }
.settings-nav h2 { font-family: Georgia, serif; font-size: 18px; margin: 0 8px 12px; }
.settings-nav button { text-align: left; background: none; border: 0; padding: 9px 10px; border-radius: 8px; color: var(--muted); }
.settings-nav button:hover { background: var(--hover); color: var(--text); }
.settings-nav button.active { background: var(--active); color: var(--text); box-shadow: inset 3px 0 0 var(--accent); }
.settings-body { padding: 18px 22px; overflow-y: auto; position: relative; }
.settings-body .close { position: absolute; right: 12px; top: 10px; }
.settings-body h3 { margin: 18px 0 8px; }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: 12px; color: var(--muted); }
.field select, .field input[type=password] { width: 100%; }
.avatar-row { display: flex; gap: 16px; align-items: center; margin-bottom: 14px; }
.avatar.xl { width: 84px; height: 84px; font-size: 34px; box-shadow: 0 0 0 3px var(--bg3); }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.swatch { width: 26px; height: 26px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0; }
.swatch.sel { border-color: var(--text); box-shadow: 0 0 0 2px var(--bg2) inset; }
.swatch.none { background: var(--bg3); color: var(--muted); font-size: 12px; }
input[type=color] { width: 34px; height: 28px; padding: 0 2px; }
.theme-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.theme-opt { border: 2px solid var(--line); border-radius: 10px; padding: 10px; text-align: left; background: var(--bg); }
.theme-opt.sel { border-color: var(--accent); }
.theme-opt .prev { height: 46px; border-radius: 6px; margin-bottom: 6px; display: flex; gap: 4px; padding: 6px; }
.theme-opt .prev i { display: block; border-radius: 4px; }
.meter { height: 10px; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; flex: 1; }
.meter > div { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent2), var(--accent), #ffd27a); transition: width .06s linear; }
.row-inline { display: flex; gap: 8px; align-items: center; }
.toggle { display: flex; gap: 8px; align-items: flex-start; margin: 8px 0; font-size: 13px; }
.toggle small { display: block; color: var(--muted); }
.hint { font-size: 12px; color: var(--muted); margin: 4px 0 12px; }

/* ---- Seletor de ícone ---- */
.icon-btn-pick { min-width: 34px; height: 30px; font-size: 16px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.icon-pop { position: fixed; z-index: 30; background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 8px; width: 264px; box-shadow: var(--glow); }
.icon-pop .grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; }
.icon-pop .grid button { font-size: 18px; background: none; border: 0; border-radius: 6px; padding: 4px 0; }
.icon-pop .grid button:hover { background: var(--hover); }
.icon-pop .row-inline { margin-top: 6px; }
.icon-pop input { flex: 1; width: 0; }

/* ---- Balcão da Taverna ---- */
.home-link { margin: 10px 8px 0; font-weight: 600; color: var(--text) !important; background: color-mix(in srgb, var(--accent) 12%, transparent); }
.home-link.active { background: var(--active); }
.home-scroll { flex: 1; overflow-y: auto; padding: 22px 28px; display: flex; flex-direction: column; gap: 18px; }
.stage-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.stage-head h1 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: 30px; letter-spacing: -.3px; display: flex; align-items: center; gap: 10px; }
.stage-head h1 .pill { font-family: "Segoe UI", system-ui, sans-serif; font-size: 12px; }
#home-join { border-radius: 999px; padding: 10px 18px; }
.people { display: flex; gap: 18px; overflow-x: auto; padding: 4px 2px 10px; scrollbar-width: thin; }
.person { flex: none; width: 86px; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; cursor: default; }
.person .ring { position: relative; padding: 3px; border-radius: 50%; background: var(--bg3); }
.person.voice .ring { background: color-mix(in srgb, var(--accent) 55%, var(--bg3)); }
.person.speaking .ring { background: var(--speak); box-shadow: 0 0 0 3px color-mix(in srgb, var(--speak) 35%, transparent); }
.person .avatar { width: 60px; height: 60px; font-size: 24px; box-shadow: 0 0 0 3px var(--bg); }
.person .badge-ic { position: absolute; right: -2px; bottom: -2px; width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center;
  font-size: 12px; background: var(--bg2); border: 2px solid var(--bg); }
.person .pname { font-size: 13px; font-weight: 700; max-width: 86px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person .pstat { font-size: 11px; color: var(--muted); max-width: 86px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person.voice .pstat { color: var(--accent); }
.person.voice { cursor: pointer; }
.hcard { background: var(--bg2); border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; }
.hcard-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.hcard-head h2 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: 20px; }
.board-body { white-space: pre-wrap; line-height: 1.5; }
.board-body a { color: var(--link); }
.board-foot { margin-top: 8px; font-size: 12px; color: var(--muted); }
.board-form { display: grid; gap: 8px; margin-top: 12px; }
.board-form textarea { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; resize: vertical; }
#home-rooms { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.room-card { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; cursor: pointer; display: flex; align-items: center; gap: 10px; }
.room-card:hover { border-color: var(--accent); }
.room-card .ric { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; font-size: 20px; background: color-mix(in srgb, var(--accent) 18%, var(--bg3)); flex: none; }
.room-card .rinfo { min-width: 0; flex: 1; }
.room-card .rinfo b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.room-card .who { display: flex; margin-top: 2px; }
.room-card .who .avatar { width: 24px; height: 24px; font-size: 10px; margin-right: -6px; box-shadow: 0 0 0 2px var(--bg); }
.room-card small { color: var(--muted); }
#home-rooms .empty { color: var(--muted); }
/* ---- Cartões do bot e conquistas ---- */
.msg .card { border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--line)); border-left: 4px solid var(--accent); background: color-mix(in srgb, var(--accent) 7%, var(--bg2));
  border-radius: 8px; padding: 8px 12px; margin-top: 3px; display: inline-block; max-width: 100%; }
.avatar.bot-img { background: var(--bg3); }
.avatar.bot-img img { width: 100%; height: 100%; }
.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.ach { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: var(--bg); }
.ach .ic { font-size: 22px; }
.ach.locked { opacity: .45; filter: grayscale(1); }
.ach b { display: block; font-size: 13px; } .ach small { color: var(--muted); font-size: 11px; }



/* ---- Player sem vídeo (vídeo escondido, mas ativo) ---- */
#music.video-hidden { grid-template-columns: minmax(0, 1fr) minmax(220px, 300px); }
#music.video-hidden #yt-wrap { position: fixed; right: 0; bottom: 0; width: 200px; height: 200px; opacity: 0; pointer-events: none; z-index: -1; }
#m-video.on { color: var(--accent); }
.mp-sub .unlock { color: var(--accent); font-weight: 600; }
@media (max-width: 1100px) { #music.video-hidden { grid-template-columns: minmax(0, 1fr); } }

/* ---- Controle deslizante próprio (o padrão do navegador não preenchia até o fim) ---- */
input[type=range].range { -webkit-appearance: none; appearance: none; height: 6px; border-radius: 4px; outline: none; cursor: pointer; padding: 0; border: 0;
  background: linear-gradient(to right, var(--accent) 0 var(--v, 50%), var(--bg3) var(--v, 50%) 100%); }
input[type=range].range::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: var(--text); border: 2px solid var(--accent); box-shadow: 0 1px 4px #0006; }
input[type=range].range::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: var(--text); border: 2px solid var(--accent); }
input[type=range].range::-moz-range-track { background: transparent; }
input[type=range].range:focus-visible { box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 50%, transparent); }

/* ---- Lista de canais no admin ---- */
#admin-channels .ch-sec { border: 0; padding: 12px 2px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--accent); justify-content: flex-start; }
#admin-channels .ch-row { align-items: center; gap: 8px; padding: 5px 2px; }
#admin-channels .ch-view { display: flex; align-items: center; gap: 8px; min-width: 0; }
#admin-channels .ch-view b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#admin-channels .ch-actions { display: flex; gap: 2px; flex: none; }
#admin-channels .ch-actions button:disabled { opacity: .25; cursor: default; }
#admin-channels .ch-edit { display: flex; gap: 8px; align-items: center; width: 100%; flex-wrap: wrap; }
#admin-channels .ch-edit input { flex: 1; min-width: 160px; }
#admin-channels .editing { background: var(--hover); border-radius: 8px; padding: 8px; }

/* ---- Editar / apagar mensagens ---- */
.msg { position: relative; grid-template-columns: 38px 1fr; border-radius: 8px; padding: 6px 8px; margin: 0 -8px; }
.msg:hover { background: color-mix(in srgb, var(--hover) 55%, transparent); }
.msg-main { min-width: 0; }
.msg-actions { position: absolute; right: 10px; top: -12px; display: none; gap: 2px; background: var(--bg2); border: 1px solid var(--line); border-radius: 8px; padding: 2px; box-shadow: 0 4px 12px #0005; }
.msg:hover .msg-actions { display: flex; }
.msg.editing .msg-actions { display: none; }
.msg-actions .icon-btn { font-size: 14px; padding: 3px 6px; }
.msg .edited { font-size: 11px; color: var(--muted); }
.msg.editing { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.edit-box { width: 100%; resize: none; overflow: hidden; font: inherit; color: var(--text); background: var(--bg3); border: 1px solid var(--accent); border-radius: 8px; padding: 8px 10px; }
.edit-hint { font-size: 11px; color: var(--muted); margin-top: 3px; }
.msg.editing .body { white-space: normal; }
.edit-box { display: block; outline: none; }
.edit-box:focus { box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 35%, transparent); }

/* ---- Microfone / som desligado ao lado do nome ---- */
.vstate { display: inline-flex; align-items: center; color: var(--danger); margin-left: 4px; vertical-align: middle; }
.vstate .st-ic { width: 14px; height: 14px; }
.vstate.on { color: var(--muted); }
.vmember .vstate { margin-left: auto; padding-right: 6px; }
.tile .flags .vstate .st-ic { width: 16px; height: 16px; }
.person .pstat .vstate .st-ic { width: 12px; height: 12px; }

/* =========================================================
   Recursos estilo Discord/TeamSpeak
   ========================================================= */
/* status */
.sdot { position: absolute; right: -2px; bottom: -2px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--bg2); background: #5cc46e; }
.sdot.online { background: #5cc46e; } .sdot.away { background: #f2c14e; } .sdot.dnd { background: var(--danger); } .sdot.invisible, .sdot.offline { background: #7d7d7d; }
.me-status-btn { position: relative; background: none; border: 0; padding: 0; cursor: pointer; border-radius: 50%; }
.me-status-btn .sdot { border-color: var(--rail); }
.me-names { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.15; }
.me-names small { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person .ring { position: relative; }
.person .ring .sdot { right: 2px; bottom: 2px; width: 14px; height: 14px; border-color: var(--bg); }
.person .ring .badge-ic { right: auto; left: -2px; }
.person.st-away .avatar, .person.st-invisible .avatar { opacity: .75; }

/* barra lateral: não lidas, menções, DMs, cadeado */
.ch .cname { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch.unread { color: var(--text); font-weight: 700; }
.ch.unread::before { content: ""; position: absolute; left: -8px; width: 4px; height: 8px; border-radius: 0 4px 4px 0; background: var(--text); }
.ch { position: relative; }
.mbadge { background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; border-radius: 9px; padding: 0 6px; min-width: 18px; text-align: center; }
.ch .lock { font-size: 11px; opacity: .8; } .ch .limit { font-size: 11px; color: var(--muted); background: var(--bg3); border-radius: 6px; padding: 0 5px; }
.dm-section { padding-top: 6px; }
.dm-title { justify-content: space-between; cursor: default; }
.dm-title .icon-btn { font-size: 14px; padding: 0 6px; }
.dm .dm-av { position: relative; display: inline-flex; }
.dm .dm-av .sdot { width: 9px; height: 9px; right: -2px; bottom: -2px; }
.dm-empty { padding: 4px 8px; list-style: none; }
.vmember { cursor: context-menu; }

/* cabeçalho */
#main-header { justify-content: flex-start; }
#pins-btn { margin-left: auto; padding: 5px 10px; font-size: 13px; }
.ptt-badge { margin-left: 10px; font-size: 12px; padding: 2px 8px; border-radius: 10px; background: var(--bg3); color: var(--muted); }
.ptt-badge.live { background: var(--speak); color: var(--accent-ink); }
#main-header .avatar.sm { vertical-align: middle; }

/* mensagens: resposta, menção, imagem, reações, fixada */
.msg.has-reply { grid-template-rows: auto auto; }
.reply-ref { grid-column: 1 / -1; display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); margin: 0 0 2px 20px; cursor: pointer; white-space: nowrap; overflow: hidden; }
.reply-ref .muted { overflow: hidden; text-overflow: ellipsis; }
.reply-ref:hover { color: var(--text); }
.avatar.xs { width: 16px; height: 16px; font-size: 9px; }
.msg.mentioned { background: color-mix(in srgb, var(--accent) 10%, transparent); box-shadow: inset 3px 0 0 var(--accent); }
.mention { background: color-mix(in srgb, var(--accent) 20%, transparent); color: var(--link); border-radius: 4px; padding: 0 3px; font-weight: 600; cursor: pointer; }
.mention.me { background: color-mix(in srgb, var(--accent) 38%, transparent); color: var(--text); }
.msg .attach { display: block; max-width: min(420px, 100%); max-height: 320px; border-radius: 10px; margin-top: 6px; cursor: zoom-in; border: 1px solid var(--line); }
.reacts { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.react { background: var(--bg3); border: 1px solid transparent; border-radius: 8px; padding: 1px 7px; font-size: 13px; cursor: pointer; }
.react b { font-size: 12px; } .react.mine { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 18%, var(--bg3)); }
.react.add { opacity: 0; } .msg:hover .react.add { opacity: 1; }
.msg .pinned { font-size: 11px; }
.msg.flash { animation: flash 1.6s ease-out; }
@keyframes flash { 0%, 40% { background: color-mix(in srgb, var(--accent) 28%, transparent); } 100% { background: transparent; } }

/* compositor */
#composer { position: relative; display: flex; gap: 8px; align-items: center; }
#composer input { flex: 1; }
.attach-btn { cursor: pointer; font-size: 18px; padding: 8px; border-radius: 8px; background: var(--bg3); line-height: 1; }
.attach-btn:hover { background: var(--hover); }
.reply-bar { display: flex; justify-content: space-between; align-items: center; margin: 0 18px -6px; padding: 6px 12px; font-size: 13px; background: var(--bg2); border: 1px solid var(--line); border-bottom: 0; border-radius: 10px 10px 0 0; }
.mention-pop { position: absolute; left: 50px; bottom: 100%; margin-bottom: 6px; width: 320px; background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 4px; box-shadow: var(--glow); z-index: 5; }
.mention-pop button { display: flex; align-items: center; gap: 8px; width: 100%; background: none; border: 0; padding: 6px 8px; border-radius: 6px; text-align: left; }
.mention-pop button.sel, .mention-pop button:hover { background: var(--active); }
#text-view.drop { outline: 3px dashed var(--accent); outline-offset: -8px; }

/* fixadas */
.pins-pop { position: fixed; z-index: 25; width: 380px; max-height: 60vh; overflow-y: auto; background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 8px; box-shadow: var(--glow); }
.pin-item { padding: 8px; border-radius: 8px; cursor: pointer; font-size: 13px; border-bottom: 1px solid var(--line); }
.pin-item:hover { background: var(--hover); }
.pin-item .meta { font-size: 11px; color: var(--muted); }

/* menu de contexto */
.ctx { position: fixed; z-index: 40; min-width: 230px; max-width: 300px; max-height: 80vh; overflow-y: auto; background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 6px; box-shadow: var(--glow); }
.ctx button:not(.btn) { display: flex; align-items: center; gap: 8px; width: 100%; background: none; border: 0; padding: 7px 9px; border-radius: 7px; text-align: left; font-size: 13px; }
.ctx button:not(.btn):hover, .ctx button.sel { background: var(--active); }
.ctx button small { margin-left: auto; font-size: 11px; }
.ctx button .sdot { position: static; border: 0; }
.ctx-title { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); padding: 6px 9px 3px; }
.ctx-sep { height: 1px; background: var(--line); margin: 5px 0; }
.ctx-row { display: flex; align-items: center; gap: 8px; padding: 5px 9px; }
.ctx-row input[type=text], .ctx-row input:not([type]) { flex: 1; }
.ctx-row .range { flex: 1; }
.ctx-head { display: flex; gap: 10px; align-items: center; padding: 6px 8px 8px; }
.ctx-head .avatar { width: 40px; height: 40px; font-size: 16px; }

/* avisos */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 50; display: flex; flex-direction: column; gap: 8px; max-width: 340px; }
.toast { background: var(--bg2); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 10px; padding: 10px 12px; font-size: 13px; box-shadow: var(--glow); animation: tin .2s ease-out; }
.toast.out { opacity: 0; transform: translateY(6px); transition: .3s; }
@keyframes tin { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* visualizador de imagem */
.lightbox { position: fixed; inset: 0; z-index: 60; background: #000c; display: grid; place-items: center; cursor: zoom-out; }
.lightbox img { max-width: 92vw; max-height: 92vh; border-radius: 8px; }

/* voz: câmera, silenciado pelo admin */
.tile { position: relative; overflow: hidden; }
.tile .cam { display: none; }
.tile.has-cam { width: 260px; height: 160px; padding: 0; }
.tile.has-cam .cam { display: block; position: absolute; inset: 0; }
.tile.has-cam .cam video { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile.has-cam > .avatar { display: none; }
.tile.has-cam .name, .tile.has-cam .flags { position: absolute; z-index: 1; background: #000a; color: #fff; padding: 1px 7px; border-radius: 6px; }
.tile.has-cam .name { left: 8px; bottom: 8px; } .tile.has-cam .flags { right: 8px; bottom: 8px; }
.ctl.locked { opacity: .5; cursor: not-allowed; }

/* Game Hub */
.games { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.game { display: flex; align-items: center; gap: 10px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.game .gic { width: 42px; height: 42px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; color: #fff; flex: none; }
.game .ginfo { flex: 1; min-width: 0; } .game .ginfo b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.game small, .event small { color: var(--muted); }
.game .who, .event .who { display: flex; align-items: center; }
.game .who .avatar, .event .who .avatar { width: 24px; height: 24px; font-size: 10px; margin-right: -6px; box-shadow: 0 0 0 2px var(--bg); }

/* jogatinas */
.ev-form { display: grid; gap: 8px; margin-bottom: 12px; }
.ev-form label { display: grid; gap: 3px; color: var(--muted); }
.event { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.event:first-child { border-top: 0; }
.edate { width: 48px; flex: none; text-align: center; background: var(--bg3); border-radius: 10px; padding: 4px 0; line-height: 1.1; }
.edate b { display: block; font-size: 20px; } .edate small { text-transform: uppercase; font-size: 11px; }
.event.live .edate { background: var(--accent); color: var(--accent-ink); } .event.live .edate small { color: inherit; }
.einfo { flex: 1; min-width: 0; display: grid; gap: 3px; }
.einfo .who .small { margin-left: 12px; }
.eact { display: flex; gap: 6px; align-items: center; flex: none; }
.pill.live { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
#m-queue li.empty { display: block; }
