/* Liquid glass monocromático — tokens extraídos de ngcassio.com.br */
:root {
  --bg: #080808;
  --fg: #f4f1ee;
  --fg-strong: #ffffff;
  --muted: rgba(244, 241, 238, .58);
  --faint: rgba(244, 241, 238, .34);
  --line: rgba(255, 255, 255, .06);
  --glass-bg: rgba(20, 20, 20, .35);
  --glass-bg-2: rgba(255, 255, 255, .045);
  --glass-hover: rgba(255, 255, 255, .07);
  --glass-active: rgba(255, 255, 255, .11);
  --glass-border: 1px solid rgba(255, 255, 255, .04);
  --glass-blur: blur(18px) saturate(1.8);
  --glass-shadow:
    inset 0 1px 1px 0 rgba(255, 255, 255, .14),
    inset 0 -1px 1px 0 rgba(255, 255, 255, .04),
    inset 0 18px 30px -22px rgba(255, 255, 255, .12),
    0 20px 50px -20px rgba(0, 0, 0, .7);
  --pill-shadow:
    inset 0 1px 1px 0 rgba(255, 255, 255, .14),
    inset 0 -1px 1px 0 rgba(255, 255, 255, .04),
    inset 0 18px 30px -22px rgba(255, 255, 255, .12);
  --r: 10px;
  --r-lg: 16px;
  --font: 'Onest', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
html { background: var(--bg); color-scheme: dark; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 300 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
[hidden] { display: none !important; }
a { color: var(--fg-strong); text-underline-offset: 3px; text-decoration-color: rgba(255,255,255,.35); }
a:hover { text-decoration-color: #fff; }
::selection { background: rgba(255,255,255,.22); }
:focus-visible { outline: 1px solid rgba(255,255,255,.6); outline-offset: 2px; }

.mono {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 2.2px;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 400;
}

svg { display: block; flex: none; }

/* ---------- fundo ---------- */
.bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.bg .grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(to right, var(--line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--line) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 80% 70% at 50% 30%, #000 30%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 50% 30%, #000 30%, transparent 100%);
  opacity: .55;
}
.bg .glow { position: absolute; border-radius: 50%; filter: blur(90px); opacity: .5; }
.bg .g1 { width: 60vw; height: 40vw; left: 20vw; top: -18vw; background: radial-gradient(closest-side, rgba(255,255,255,.12), transparent); animation: drift 26s ease-in-out infinite alternate; }
.bg .g2 { width: 40vw; height: 40vw; right: -10vw; bottom: -20vw; background: radial-gradient(closest-side, rgba(255,255,255,.07), transparent); animation: drift 32s ease-in-out infinite alternate-reverse; }
@keyframes drift { to { transform: translate(6vw, 4vw) scale(1.1); } }

/* ---------- glass ---------- */
.glass {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: var(--r-lg);
}

.eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 7px 14px 7px 12px;
  border-radius: 500px;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
  border: var(--glass-border);
  box-shadow: var(--pill-shadow);
  font: 400 11px/1 var(--mono); letter-spacing: 2.5px; text-transform: uppercase;
  color: rgba(255,255,255,.88);
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 3px rgba(255,255,255,.12), 0 0 12px rgba(255,255,255,.6); flex: none; }

/* botões */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 22px; border-radius: 500px;
  font-weight: 500; font-size: 15px;
  background: var(--glass-bg-2); border: var(--glass-border); box-shadow: var(--pill-shadow);
  transition: background .2s, transform .1s, opacity .2s;
}
.btn:hover { background: var(--glass-hover); }
.btn:active { transform: scale(.98); }
.btn.primary { background: #f4f1ee; color: #080808; box-shadow: inset 0 -2px 6px rgba(0,0,0,.12), 0 10px 30px -10px rgba(255,255,255,.35); }
.btn.primary:hover { background: #fff; }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn.sm { height: 30px; padding: 0 14px; font-size: 13px; }

.icon-btn {
  width: 34px; height: 34px; border-radius: 500px;
  display: grid; place-items: center;
  color: var(--muted);
  transition: background .2s, color .2s;
}
.icon-btn:hover { background: var(--glass-hover); color: var(--fg-strong); }
.icon-btn.on { background: #f4f1ee; color: #080808; }
.icon-btn.off { color: var(--fg-strong); background: rgba(255,255,255,.08); }
.icon-btn.sm { width: 28px; height: 28px; }

.pill-btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 42px; padding: 0 18px; border-radius: 500px;
  background: var(--glass-bg-2); border: var(--glass-border); box-shadow: var(--pill-shadow);
  backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
  font-weight: 400; font-size: 14px; color: var(--fg);
  transition: background .2s, color .2s;
}
.pill-btn:hover { background: var(--glass-hover); }
.pill-btn.on { background: #f4f1ee; color: #080808; font-weight: 500; }
.pill-btn.off { background: rgba(255,255,255,.1); }
.pill-btn.danger:hover { background: #f4f1ee; color: #080808; }

/* ---------- login ---------- */
.wallpaper {
  position: fixed; inset: -30%; z-index: 0; pointer-events: none; user-select: none;
  display: flex; flex-direction: column; justify-content: center; gap: 22px;
  transform: rotate(-12deg);
  mask-image: radial-gradient(ellipse 60% 55% at 50% 50%, rgba(0,0,0,.25) 0%, #000 70%);
  -webkit-mask-image: radial-gradient(ellipse 60% 55% at 50% 50%, rgba(0,0,0,.25) 0%, #000 70%);
}
.wallpaper .row {
  white-space: nowrap;
  font: 600 64px/1 var(--font); letter-spacing: -1.5px;
  color: transparent; -webkit-text-stroke: 1px rgba(255,255,255,.07);
  animation: wp-slide 90s linear infinite;
}
.wallpaper .row:nth-child(even) { color: rgba(255,255,255,.022); -webkit-text-stroke: 0; animation-direction: reverse; }
.wallpaper .row span { margin-right: 48px; }
@keyframes wp-slide { from { transform: translateX(0); } to { transform: translateX(-50%); } }
.login .card { position: relative; z-index: 1; }
.login { position: fixed; inset: 0; display: grid; place-items: center; padding: 16px; overflow: auto; }
.card { width: min(420px, 100%); padding: 36px 32px 28px; display: flex; flex-direction: column; gap: 16px; }
.card .eyebrow { align-self: flex-start; }
.card h1 { margin: 6px 0 0; font-weight: 500; font-size: 40px; letter-spacing: -1px; line-height: 1.05; color: var(--fg-strong); }
.lead { margin: -6px 0 6px; color: var(--muted); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field span { font: 400 10.5px var(--mono); letter-spacing: 2.2px; text-transform: uppercase; color: var(--faint); }
.field input {
  height: 46px; padding: 0 16px; border-radius: var(--r);
  background: rgba(255,255,255,.035); border: 1px solid rgba(255,255,255,.07);
  box-shadow: inset 0 1px 2px rgba(0,0,0,.4);
  outline: none; transition: border-color .2s, background .2s;
}
.field input:focus { border-color: rgba(255,255,255,.28); background: rgba(255,255,255,.055); }
.field input::placeholder { color: var(--faint); }
.card .btn.primary { margin-top: 6px; height: 48px; }
.err { margin: 0; min-height: 1.2em; font-size: 13.5px; color: var(--fg-strong); }

/* ---------- app layout ---------- */
.app {
  position: fixed; inset: 0;
  display: grid; grid-template-columns: 268px minmax(0, 1fr) 232px;
  gap: 12px; padding: 12px;
}
.app.hide-members { grid-template-columns: 268px minmax(0, 1fr); }
.app.hide-members .members { display: none; }

.side { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.side-head { display: flex; align-items: center; gap: 12px; padding: 16px 16px 14px; border-bottom: 1px solid var(--line); }
.logo {
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center; flex: none;
  background: #f4f1ee; color: #080808;
  font-weight: 600; font-size: 14px; letter-spacing: -.3px;
  box-shadow: 0 0 0 1px rgba(255,255,255,.2), 0 8px 24px -8px rgba(255,255,255,.4);
}
.side-title { display: flex; flex-direction: column; min-width: 0; }
.side-title strong { font-weight: 500; font-size: 16px; color: var(--fg-strong); }
.side-scroll { flex: 1; overflow-y: auto; padding: 10px 10px 16px; }
.group-label { padding: 14px 8px 8px; }
.chan-list, .voice-users, .member-list { list-style: none; margin: 0; padding: 0; }

.chan {
  width: 100%; display: flex; align-items: center; gap: 10px;
  height: 36px; padding: 0 10px; border-radius: var(--r);
  color: var(--muted); text-align: left;
  transition: background .15s, color .15s;
}
.chan span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chan:hover { background: var(--glass-hover); color: var(--fg); }
.chan.active { background: var(--glass-active); color: var(--fg-strong); box-shadow: var(--pill-shadow); }
.chan.unread { color: var(--fg-strong); font-weight: 500; }
.chan .count { font-style: normal; font-size: 10px; letter-spacing: 1px; color: var(--faint); }
.chan.joined { color: var(--fg-strong); }
.chan.joined svg { color: var(--fg-strong); }
.badge {
  font-style: normal; font: 500 10.5px/1 var(--mono);
  min-width: 20px; height: 18px; padding: 0 6px; border-radius: 500px;
  display: grid; place-items: center; background: #f4f1ee; color: #080808;
}

.voice-users { padding: 2px 0 4px 22px; }
.vuser { display: flex; align-items: center; gap: 9px; height: 32px; padding: 0 8px; border-radius: 8px; color: var(--muted); font-size: 14px; }
.vuser .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vuser .dim { color: var(--faint); }
.live {
  font: 500 9px/1 var(--mono); letter-spacing: 1.5px;
  padding: 4px 6px; border-radius: 4px; background: #f4f1ee; color: #080808;
}

.voice-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin: 0 10px; padding: 10px 8px 10px 14px; border-radius: var(--r);
  background: rgba(255,255,255,.04); border: var(--glass-border); box-shadow: var(--pill-shadow);
}
.voice-bar > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.live-text { display: flex; align-items: center; gap: 8px; font-weight: 500; font-size: 13.5px; color: var(--fg-strong); }
.live-text .dot { width: 6px; height: 6px; }

.me {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin: 10px; padding: 8px 6px 8px 8px; border-radius: 500px;
  background: rgba(255,255,255,.04); border: var(--glass-border); box-shadow: var(--pill-shadow);
}
.me-id { display: flex; align-items: center; gap: 10px; min-width: 0; }
.me-id > div { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.me-id strong { font-weight: 500; font-size: 14px; color: var(--fg-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-actions { display: flex; gap: 2px; }

/* avatar */
.av {
  --s: 32px;
  width: var(--s); height: var(--s); border-radius: 50%; flex: none;
  display: grid; place-items: center;
  font-weight: 500; font-size: calc(var(--s) * .38); letter-spacing: -.2px;
  color: #f4f1ee; background: var(--avbg, #1c1c1c);
  box-shadow: inset 0 1px 1px rgba(255,255,255,.18), 0 0 0 1px rgba(255,255,255,.06);
  transition: box-shadow .12s;
  user-select: none;
}
.av.speaking { box-shadow: 0 0 0 2px #f4f1ee, 0 0 18px 2px rgba(255,255,255,.45); }

/* ---------- main ---------- */
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; }
.main-head { display: flex; align-items: center; gap: 10px; height: 60px; padding: 0 14px 0 20px; border-bottom: 1px solid var(--line); flex: none; }
.main-head h2 { margin: 0; display: flex; align-items: center; gap: 8px; font-weight: 500; font-size: 17px; color: var(--fg-strong); letter-spacing: -.2px; min-width: 0; }
.main-head h2 svg { color: var(--faint); }
.main-head h2 span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.spacer { flex: 1; }
.net { color: var(--fg); }
.only-mobile { display: none; }

.chat-view { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.messages { flex: 1; overflow-y: auto; padding: 16px 0 10px; }
.empty { padding: 48px 28px 8px; }
.empty .icon-circle { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: var(--glass-bg-2); box-shadow: var(--pill-shadow); color: var(--fg); margin-bottom: 18px; }
.empty h3 { margin: 0 0 6px; font-weight: 500; font-size: 28px; letter-spacing: -.8px; color: var(--fg-strong); }
.empty p { margin: 0; color: var(--muted); }

.day { display: flex; align-items: center; gap: 14px; margin: 18px 22px 6px; }
.day::before, .day::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.day span { font: 400 10px var(--mono); letter-spacing: 2px; text-transform: uppercase; color: var(--faint); }

.msg { display: flex; gap: 14px; padding: 6px 22px; position: relative; }
.msg:hover { background: rgba(255,255,255,.022); }
.msg.first { margin-top: 10px; }
.msg .av { --s: 38px; margin-top: 2px; }
.msg .body { min-width: 0; flex: 1; }
.msg .meta { display: flex; align-items: baseline; gap: 10px; }
.msg .meta strong { font-weight: 500; color: var(--fg-strong); }
.msg time { font: 400 10.5px var(--mono); letter-spacing: .5px; color: var(--faint); }
.msg .text { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--fg); }
.msg.cont { padding-top: 1px; padding-bottom: 1px; }
.msg.cont time { width: 38px; flex: none; text-align: right; padding-top: 4px; opacity: 0; }
.msg.cont:hover time { opacity: 1; }

.composer {
  display: flex; align-items: flex-end; gap: 6px;
  margin: 6px 16px 16px; padding: 6px 6px 6px 18px; border-radius: 22px;
  background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.06); box-shadow: var(--pill-shadow);
  transition: border-color .2s;
}
.composer:focus-within { border-color: rgba(255,255,255,.18); }
.composer textarea {
  flex: 1; resize: none; border: 0; outline: 0; background: none;
  padding: 7px 0; max-height: 180px; line-height: 1.45;
}
.composer textarea::placeholder { color: var(--faint); }
.composer .send { background: #f4f1ee; color: #080808; width: 36px; height: 36px; }
.composer .send:hover { background: #fff; color: #080808; }

/* ---------- palco (voz/tela) ---------- */
.stage-view { flex: 1; display: flex; flex-direction: column; min-height: 0; padding: 14px; gap: 12px; }
.stage-wrap { flex: 1; min-height: 0; position: relative; display: flex; }
.stage {
  flex: 1; min-height: 0; display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr));
  align-content: center; overflow: auto;
}
.stage[data-count="0"] { display: none; }
.stage[data-count="1"] { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr); align-content: stretch; }
.stage.has-focus { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr); align-content: stretch; }
.stage.has-focus .tile:not(.focused) { display: none; }
.stage.has-focus .tile.focused { aspect-ratio: auto; height: 100%; }
.stage[data-count="1"] .tile { aspect-ratio: auto; height: 100%; max-height: 100%; }

.tile {
  position: relative; overflow: hidden; aspect-ratio: 16 / 9;
  border-radius: var(--r-lg); background: #000;
  box-shadow: var(--glass-shadow); border: var(--glass-border);
  cursor: zoom-in;
}
.stage.has-focus .tile { cursor: zoom-out; }
.tile video { width: 100%; height: 100%; object-fit: contain; background: #000; display: block; }
.tile-bar {
  position: absolute; left: 10px; right: 10px; bottom: 10px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  opacity: .92; transition: opacity .2s;
}
.tile-name {
  display: inline-flex; align-items: center; gap: 8px;
  height: 30px; padding: 0 12px; border-radius: 500px;
  background: rgba(10,10,10,.55); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
  box-shadow: var(--pill-shadow); font-size: 13px; font-weight: 400; color: #fff;
}
.tile .icon-btn { background: rgba(10,10,10,.55); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur); color: #fff; box-shadow: var(--pill-shadow); }
.tile:fullscreen { border-radius: 0; cursor: default; }
.tile:fullscreen video { object-fit: contain; }

.stage-empty {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
  text-align: center; padding: 24px;
}
.stage-empty p { margin: 0; color: var(--muted); max-width: 340px; }

.people { display: flex; gap: 10px; overflow-x: auto; flex: none; padding: 2px; justify-content: center; }
.person {
  display: flex; align-items: center; gap: 10px;
  height: 52px; padding: 0 16px 0 8px; border-radius: 500px; flex: none;
  background: rgba(255,255,255,.04); border: var(--glass-border); box-shadow: var(--pill-shadow);
  font-size: 14px; color: var(--fg);
}
.person .av { --s: 36px; }
.person .dim { color: var(--faint); }
.person.pending { opacity: .55; }

.controls { display: flex; gap: 10px; justify-content: center; flex: none; flex-wrap: wrap; }

/* ---------- membros ---------- */
.members { padding: 6px 10px; overflow-y: auto; min-height: 0; }
.member { display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 8px; border-radius: var(--r); }
.member:hover { background: var(--glass-hover); }
.member .av { --s: 30px; }
.member .info { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.member .info strong { font-weight: 400; font-size: 14px; color: var(--fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member .info .mono { font-size: 9.5px; letter-spacing: 1.6px; }

/* ---------- toasts ---------- */
.toasts { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 50; display: flex; flex-direction: column; gap: 8px; align-items: center; width: min(92vw, 440px); pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 12px;
  padding: 10px 10px 10px 18px; border-radius: 500px; font-size: 14px;
  background: rgba(20,20,20,.7);
  animation: toast-in .25s ease-out; transition: opacity .4s, transform .4s;
}
.toast span { flex: 1; }
.toast.out { opacity: 0; transform: translateY(-8px); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } }
.audio-unlock { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 60; }

.scrim { display: none; }

/* ---------- responsivo ---------- */
@media (max-width: 1100px) {
  .app, .app.hide-members { grid-template-columns: 252px minmax(0, 1fr); }
  .members { display: none; }
  .app.show-members .members {
    display: block; position: fixed; right: 12px; top: 84px; bottom: 12px; width: 240px; z-index: 20;
    background: rgba(20,20,20,.8);
  }
}
@media (max-width: 760px) {
  .app, .app.hide-members { grid-template-columns: minmax(0, 1fr); padding: 8px; gap: 8px; padding-top: max(8px, env(safe-area-inset-top)); padding-bottom: max(8px, env(safe-area-inset-bottom)); }
  .only-mobile { display: grid; }
  .side {
    position: fixed; z-index: 30; left: 8px; top: 8px; bottom: 8px; width: min(300px, 86vw);
    background: rgba(16,16,16,.88);
    transform: translateX(calc(-100% - 16px)); transition: transform .28s cubic-bezier(.2,.8,.2,1);
  }
  .app.drawer-open .side { transform: none; }
  .app.drawer-open .scrim { display: block; position: fixed; inset: 0; z-index: 25; background: rgba(0,0,0,.5); }
  .main-head { padding: 0 8px; height: 54px; }
  .msg { padding: 6px 14px; }
  .composer { margin: 6px 8px 8px; }
  .pill-btn span { display: none; }
  .pill-btn { width: 48px; height: 48px; padding: 0; justify-content: center; }
  .app.show-members .members { top: 70px; right: 8px; }
  .card { padding: 28px 22px 22px; }
  .card h1 { font-size: 34px; }
}
@media (prefers-reduced-motion: reduce) { .bg .glow, .wallpaper .row { animation: none; } }
