/* ============ tokens ============ */
/* Noite carioca: azul-arara profundo, amarelo louro, verde e rosa de bloco. */
:root {
  --bg: #071429;
  --bg-soft: #0b1d38;
  --surface: #0e2340;
  --surface-2: #14304f;
  --surface-3: #1a3a5e;
  --line: #1f4270;
  --line-soft: #17355c;
  --text: #eaf2ff;
  --muted: #8ba5c9;

  --arara: #2e7bff;
  --arara-deep: #1b4fd8;
  --louro: #ffc61e;
  --louro-soft: #ffd85c;
  --verde: #12d18e;
  --laranja: #ff6a3d;
  --rosa: #ff3e8e;

  --accent: var(--louro);
  --accent-soft: var(--louro-soft);
  --accent-dim: rgba(255, 198, 30, 0.16);
  --on-accent: #3a2a00;
  --speaking: var(--verde);
  --danger: #ff5c5c;
  --ok: var(--verde);
  --warn: var(--louro);

  --radius: 16px;
  --radius-sm: 11px;
  --shadow: 0 20px 44px -22px rgba(0, 0, 0, 0.95);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

/* Tema claro: mesma identidade, ground invertido. */
:root[data-theme="light"] {
  --bg: #f4f8ff;
  --bg-soft: #ffffff;
  --surface: #ffffff;
  --surface-2: #eaf1fb;
  --surface-3: #dde8f8;
  --line: #cbdaf0;
  --line-soft: #e2ecfa;
  --text: #0d1d33;
  --muted: #55708f;
  --accent: #0f5bd8;
  --accent-soft: #2e7bff;
  --accent-dim: rgba(15, 91, 216, 0.12);
  --on-accent: #ffffff;
  --shadow: 0 18px 40px -26px rgba(13, 29, 51, 0.5);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  /* Campo de cor: azul-arara no alto, verde e louro nas bordas, laranja no pé.
     Sem padrão nem textura — a geometria fica na marca e nos cards. */
  background:
    radial-gradient(70% 55% at 18% 0%, rgba(46, 123, 255, 0.30), transparent 62%),
    radial-gradient(55% 45% at 92% 8%, rgba(18, 209, 142, 0.20), transparent 60%),
    radial-gradient(60% 50% at 100% 92%, rgba(255, 198, 30, 0.16), transparent 62%),
    radial-gradient(65% 55% at 6% 100%, rgba(255, 62, 142, 0.16), transparent 62%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

.sprite {
  display: none;
}

svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

[hidden] {
  display: none !important;
}

/* Foco sempre visível: navegar por teclado não pode ser adivinhação. */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ============ marca ============ */
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 23px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-mark {
  width: 30px;
  height: 30px;
  flex: none;
  stroke: none;
  filter: drop-shadow(0 3px 10px rgba(7, 20, 41, 0.7));
}

.brand-sm {
  font-size: 16px;
  gap: 8px;
}

.brand-sm .brand-mark {
  width: 22px;
  height: 22px;
}

/* ============ entrada ============ */
.view-join {
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 20px;
  height: 100dvh;
  padding: 24px;
  overflow-y: auto;
}

.join-card {
  width: min(400px, 100%);
  padding: 28px 26px 22px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(20, 48, 79, 0.86), rgba(7, 20, 41, 0.92));
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  animation: rise 0.4s ease both;
}

:root[data-theme="light"] .join-card {
  background: linear-gradient(180deg, #ffffff, #f2f7ff);
}

.join-sub {
  margin: 8px 0 20px;
  color: var(--muted);
}

.join-room {
  margin: 0 0 14px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: var(--accent-dim);
  color: var(--accent-soft);
  font-size: 13.5px;
  font-weight: 600;
}

.field {
  display: block;
  margin-bottom: 14px;
}

.field-label {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.hint {
  text-transform: none;
  letter-spacing: 0;
  opacity: 0.7;
}

input[type="text"],
input[type="password"],
select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  color: var(--text);
  font: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input[type="text"]:focus,
input[type="password"]:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

input::placeholder {
  color: #6f8ab0;
}

.name-row {
  display: flex;
  gap: 8px;
}

.avatar-pick {
  flex: none;
  width: 46px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.avatar-pick:hover {
  border-color: var(--accent);
}

.more {
  margin-bottom: 14px;
}

.more summary {
  color: var(--muted);
  font-size: 13.5px;
  cursor: pointer;
  padding: 6px 0;
}

.more summary:hover {
  color: var(--accent);
}

.more-body {
  padding-top: 12px;
}

.color-row {
  display: flex;
  gap: 8px;
}

.swatch {
  width: 30px;
  height: 30px;
  border: 2px solid transparent;
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.12s;
}

.swatch[aria-pressed="true"] {
  border-color: var(--text);
  transform: scale(1.12);
}

.mic-test {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mic-test .meter {
  flex: 1;
}

.btn {
  padding: 12px 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s, filter 0.15s, opacity 0.15s;
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(180deg, var(--accent-soft), var(--accent));
  color: var(--on-accent);
  box-shadow: 0 12px 26px -12px rgba(255, 198, 30, 0.6);
}

.btn-primary:hover:not(:disabled) {
  filter: brightness(1.07);
}

.btn-quiet {
  border-color: var(--line);
  background: var(--surface-2);
  color: var(--text);
}

.btn-quiet:hover {
  border-color: var(--accent);
}

.btn-block {
  width: 100%;
}

.lobby-status,
.join-foot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.join-foot {
  max-width: 400px;
  margin: 0;
  font-size: 12.5px;
  opacity: 0.75;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  flex: none;
}

.dot-idle {
  background: var(--warn);
  animation: pulse 1.4s ease-in-out infinite;
}

.dot-on {
  background: var(--ok);
  box-shadow: 0 0 8px rgba(18, 209, 142, 0.7);
  animation: none;
}

.dot-off {
  background: var(--danger);
  animation: none;
}

.alert {
  margin: 14px 0 0;
  padding: 10px 12px;
  border: 1px solid rgba(255, 92, 92, 0.4);
  border-radius: var(--radius-sm);
  background: rgba(255, 92, 92, 0.12);
  color: #ffb0b0;
  font-size: 13.5px;
}

:root[data-theme="light"] .alert {
  color: #a11b1b;
}

.rooms-open {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
}

.rooms-title {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.rooms-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.room-line {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  text-align: left;
}

.room-line:hover {
  border-color: var(--accent);
}

.room-name {
  font-weight: 600;
  flex: 1;
}

.room-count,
.room-lock {
  color: var(--muted);
  font-size: 12.5px;
}

/* ============ call ============ */
.view-call {
  display: flex;
  flex-direction: column;
  height: 100dvh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line-soft);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
}

.pill svg {
  width: 15px;
  height: 15px;
}

.pill-quiet {
  background: transparent;
}

.pill-action {
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
}

.pill-action:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.waiting-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 10px 18px 0;
  padding: 10px 14px;
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--accent-dim);
  font-size: 13.5px;
}

.waiting-people {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.waiting-line {
  display: flex;
  align-items: center;
  gap: 6px;
}

.waiting-name {
  font-weight: 600;
}

.btn-mini {
  padding: 5px 10px;
  font-size: 12.5px;
}

.pinned {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 18px 0;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 13.5px;
}

.pinned svg {
  width: 16px;
  height: 16px;
  color: var(--accent);
  flex: none;
}

.pinned span {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.body {
  display: flex;
  flex: 1;
  gap: 14px;
  min-height: 0;
  padding: 14px 18px;
}

.stage {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  min-height: 0;
}

/* --- grade de participantes --- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 240px));
  gap: 14px;
  align-content: center;
  justify-content: center;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 2px;
}

.alone-hint {
  margin: 0 auto;
  max-width: 44ch;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

.alone-hint b {
  color: var(--accent);
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  aspect-ratio: 4 / 3;
  max-height: 250px;
  padding: 14px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  backdrop-filter: blur(6px);
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.18s, box-shadow 0.18s, transform 0.18s;
  animation: rise 0.28s ease both;
}

.card:hover {
  border-color: var(--line);
}

.card.speaking {
  border-color: var(--speaking);
  box-shadow: 0 0 0 1px var(--speaking), 0 0 26px -6px rgba(18, 209, 142, 0.55);
}

.card.broken {
  border-color: rgba(255, 92, 92, 0.55);
}

.card.broken .card-status {
  color: #ff9d97;
}

.card.is-pending {
  opacity: 0.65;
}

.card-top {
  position: absolute;
  top: 9px;
  left: 9px;
  right: 9px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  z-index: 2;
}

.card-badges {
  display: flex;
  gap: 6px;
}

.card-badges svg {
  width: 16px;
  height: 16px;
}

.badge-hand {
  color: var(--louro);
}

.badge-share {
  color: var(--arara);
}

.badge-cam {
  color: var(--verde);
}

.card-role {
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(46, 123, 255, 0.22);
  color: #9dc2ff;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.card.is-local .card-role::after {
  content: " · você";
}

.card:not(.is-local) .card-role:empty {
  display: none;
}

.avatar {
  display: grid;
  place-content: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--av-bg, var(--arara-deep));
  color: #fff;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  transition: transform 0.18s;
}

.avatar-emoji {
  font-size: 30px;
  font-weight: 400;
}

.card.speaking .avatar {
  transform: scale(1.06);
}

.card-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}

.card.has-video .avatar {
  display: none;
}

.card.has-video .card-name,
.card.has-video .card-status,
.card.has-video .card-pronouns,
.card.has-video .card-quality {
  position: relative;
  z-index: 1;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.85);
}

.card.has-video {
  justify-content: flex-end;
}

.card-name {
  display: flex;
  align-items: center;
  gap: 7px;
  max-width: 100%;
  font-weight: 600;
}

.card-name span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mic-off {
  width: 15px;
  height: 15px;
  flex: none;
  color: var(--danger);
}

.card-pronouns,
.card-status,
.card-quality {
  font-size: 12px;
  color: var(--muted);
  position: relative;
  z-index: 1;
}

.card-quality[data-grade="boa"] {
  color: var(--verde);
}

.card-quality[data-grade="ok"] {
  color: var(--louro);
}

.card-quality[data-grade="ruim"] {
  color: var(--danger);
}

/* modo compacto: lista em vez de grade */
.grid.compact {
  display: flex;
  flex-direction: column;
  align-content: start;
  gap: 6px;
}

.grid.compact .card {
  flex-direction: row;
  justify-content: flex-start;
  gap: 12px;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  aspect-ratio: auto;
  height: 56px;
  padding: 8px 14px;
}

.grid.compact .avatar {
  width: 34px;
  height: 34px;
  font-size: 15px;
}

.grid.compact .card-top,
.grid.compact .card-pronouns,
.grid.compact .card-video {
  display: none;
}

.grid.compact .card-status,
.grid.compact .card-quality {
  margin-left: auto;
}

/* --- palco --- */
.share-area {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}

.share-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}

.share-tabs:empty {
  display: none;
}

.tab {
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.tab[aria-selected="true"] {
  border-color: var(--accent);
  background: var(--accent-dim);
  color: var(--accent);
}

.share-frame {
  position: relative;
  flex: 1;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #000;
  overflow: hidden;
}

.share-frame video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  transform-origin: center;
  transition: transform 0.12s ease-out;
}

.share-frame video.is-zoomed {
  cursor: grab;
}

.share-tools {
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 0;
  transition: opacity 0.15s;
}

.share-frame:hover .share-tools,
.share-tools:focus-within {
  opacity: 1;
}

.watchers {
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(7, 20, 41, 0.8);
  color: var(--text);
  font-size: 12px;
}

.icon-btn {
  display: grid;
  place-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(7, 20, 41, 0.72);
  color: var(--text);
  cursor: pointer;
  backdrop-filter: blur(6px);
}

.icon-btn:hover:not(:disabled) {
  border-color: var(--accent);
}

.icon-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.icon-btn-sm {
  width: 30px;
  height: 30px;
}

.icon-btn-sm svg {
  width: 16px;
  height: 16px;
}

/* com tela no palco, os participantes viram uma trilha */
.stage.has-share .grid {
  display: flex;
  flex: none;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 4px;
}

.stage.has-share .card {
  flex: none;
  width: 128px;
  aspect-ratio: auto;
  height: 92px;
  gap: 6px;
  padding: 8px;
}

.stage.has-share .avatar {
  width: 32px;
  height: 32px;
  font-size: 14px;
}

.stage.has-share .card-name {
  font-size: 12.5px;
}

.stage.has-share .card-pronouns,
.stage.has-share .card-status,
.stage.has-share .card-quality,
.stage.has-share .alone-hint {
  display: none;
}

/* --- conversa --- */
.chat {
  display: flex;
  flex-direction: column;
  width: 320px;
  flex: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  animation: slide 0.22s ease both;
}

.chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-soft);
  font-weight: 600;
  font-size: 14px;
}

.chat-log {
  list-style: none;
  margin: 0;
  padding: 12px;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 9px;
  font-size: 14px;
}

.msg {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--surface-2);
  animation: rise 0.2s ease both;
  overflow-wrap: anywhere;
}

.msg-mine {
  background: var(--accent-dim);
}

.msg-system {
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  text-align: center;
}

.msg-name {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.msg code {
  font-family: var(--mono);
  font-size: 12.5px;
  background: rgba(0, 0, 0, 0.25);
  padding: 1px 5px;
  border-radius: 5px;
}

.msg a {
  color: var(--accent);
}

.typing {
  margin: 0;
  padding: 0 12px 6px;
  color: var(--muted);
  font-size: 12.5px;
  font-style: italic;
}

.chat-form {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--line-soft);
}

.chat-form input {
  flex: 1;
}

.btn-send {
  padding: 0 14px;
  display: grid;
  place-content: center;
}

.reaction-row {
  display: flex;
  gap: 4px;
  padding: 0 12px 12px;
  flex-wrap: wrap;
}

.reaction {
  width: 32px;
  height: 32px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: var(--surface-2);
  font-size: 16px;
  cursor: pointer;
  line-height: 1;
}

.reaction:hover {
  border-color: var(--accent);
  transform: scale(1.08);
}

.sound-row {
  padding-top: 0;
  border-top: 1px dashed var(--line-soft);
  margin-top: -6px;
  padding-top: 10px;
}

.status-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--verde);
}

.status-dot[data-status="ausente"] {
  background: var(--louro);
}

.status-dot[data-status="ocupado"] {
  background: var(--danger);
}

.msg-mention {
  border-left: 3px solid var(--accent);
  background: var(--accent-dim);
}

.mention {
  color: var(--accent);
  font-weight: 700;
}

/* layout foco: quem fala ocupa o card grande */
.grid.foco {
  grid-template-columns: repeat(auto-fit, minmax(120px, 160px));
}

.grid.foco .card.is-spotlight {
  grid-column: span 2;
  grid-row: span 2;
  max-height: none;
}

.grid.foco .card.is-spotlight .avatar {
  width: 96px;
  height: 96px;
  font-size: 34px;
}

.menu-info {
  padding: 8px 11px 4px;
  color: var(--muted);
  font-size: 12px;
}

.reactions-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 40;
}

.fly {
  position: absolute;
  bottom: 120px;
  font-size: 34px;
  animation: fly 2.4s ease-out forwards;
}

.badge {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--rosa);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: grid;
  place-content: center;
}

/* ============ controles ============ */
.controls {
  padding: 0 18px calc(16px + env(safe-area-inset-bottom));
}

.controls-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(11, 29, 56, 0.86);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  flex-wrap: wrap;
}

:root[data-theme="light"] .controls-inner {
  background: rgba(255, 255, 255, 0.9);
}

.ctrl {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 15px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
}

.ctrl:hover:not(:disabled) {
  border-color: var(--arara);
}

.ctrl:active {
  transform: translateY(1px);
}

.ctrl:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ctrl svg {
  width: 20px;
  height: 20px;
}

.ctrl[aria-pressed="true"],
.ctrl.is-on {
  border-color: var(--accent);
  background: var(--accent-dim);
  color: var(--accent);
}

.ctrl.is-off {
  border-color: rgba(255, 92, 92, 0.5);
  background: rgba(255, 92, 92, 0.13);
  color: #ff9d97;
}

.ctrl-danger {
  border-color: rgba(255, 92, 92, 0.35);
  color: #ff9d97;
}

.ctrl-danger:hover {
  background: rgba(255, 92, 92, 0.15);
  border-color: var(--danger);
}

/* ============ diálogos ============ */
.dlg {
  width: min(560px, calc(100vw - 32px));
  max-height: 86dvh;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.dlg-sm {
  width: min(400px, calc(100vw - 32px));
}

.dlg::backdrop {
  background: rgba(4, 10, 20, 0.6);
  backdrop-filter: blur(3px);
}

.dlg-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line-soft);
}

.dlg-head h2 {
  margin: 0;
  font-size: 17px;
}

.dlg-body {
  padding: 18px;
  overflow-y: auto;
  max-height: 64dvh;
}

.dlg-foot {
  margin: 0;
  padding: 12px 18px;
  border-top: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 12.5px;
}

.dlg-note {
  color: var(--muted);
  font-size: 12.5px;
  margin: 8px 0 0;
}

.dlg-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 16px;
}

.set-group {
  margin-bottom: 22px;
}

.set-group h3 {
  margin: 0 0 12px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.switch {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  cursor: pointer;
  font-size: 14px;
}

.switch input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.range {
  display: block;
  margin-bottom: 12px;
  font-size: 13.5px;
  color: var(--muted);
}

.range span {
  display: block;
  margin-bottom: 6px;
}

.range b,
.field-label b {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.meter {
  height: 7px;
  border-radius: 999px;
  background: var(--bg-soft);
  overflow: hidden;
}

.meter-lg {
  height: 10px;
  margin-bottom: 14px;
}

.meter-fill {
  width: 0%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--verde), var(--louro));
  transition: width 0.08s linear;
}

.invite-link {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.invite-link input {
  flex: 1;
  font-family: var(--mono);
  font-size: 12.5px;
}

.qr {
  display: block;
  margin: 8px auto 0;
  border-radius: 10px;
  background: #fff;
}

.steps {
  margin: 0 0 18px;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 14px;
  color: var(--muted);
}

.steps b {
  color: var(--text);
}

.stars {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin: 12px 0;
}

.star {
  border: 0;
  background: none;
  color: var(--line);
  font-size: 30px;
  cursor: pointer;
  line-height: 1;
  transition: transform 0.1s;
}

.star.on {
  color: var(--louro);
}

.star:hover {
  transform: scale(1.15);
}

/* ============ menus flutuantes ============ */
.peer-menu,
.emoji-pop {
  position: fixed;
  z-index: 60;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
  animation: rise 0.14s ease both;
}

.peer-menu {
  min-width: 210px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.menu-item {
  padding: 9px 11px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  text-align: left;
  cursor: pointer;
}

.menu-item:hover {
  background: var(--surface-2);
}

.menu-danger {
  color: #ff9d97;
}

.menu-sep {
  height: 1px;
  margin: 4px 0;
  background: var(--line-soft);
}

.menu-range {
  display: block;
  padding: 8px 11px 10px;
  font-size: 12.5px;
  color: var(--muted);
}

.menu-range span {
  display: block;
  margin-bottom: 6px;
}

.emoji-pop {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
  max-width: 300px;
}

.emoji-option {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: none;
  font-size: 19px;
  cursor: pointer;
  line-height: 1;
}

.emoji-option:hover {
  background: var(--surface-2);
}

/* ============ toast ============ */
.toast {
  position: fixed;
  left: 50%;
  bottom: 112px;
  max-width: min(440px, calc(100vw - 32px));
  padding: 11px 17px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(11, 29, 56, 0.96);
  color: var(--text);
  font-size: 13.5px;
  box-shadow: var(--shadow);
  transform: translateX(-50%);
  z-index: 70;
  animation: rise 0.2s ease both;
}

:root[data-theme="light"] .toast {
  background: rgba(255, 255, 255, 0.97);
}

/* ============ animações ============ */
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

@keyframes slide {
  from {
    opacity: 0;
    transform: translateX(14px);
  }
}

@keyframes pulse {
  50% {
    opacity: 0.35;
  }
}

@keyframes fly {
  from {
    opacity: 1;
    transform: translateY(0) scale(0.7);
  }
  30% {
    transform: translateY(-60px) scale(1.1);
  }
  to {
    opacity: 0;
    transform: translateY(-260px) scale(1);
  }
}

/* ============ responsivo ============ */
@media (max-width: 900px) {
  .body {
    flex-direction: column;
    padding: 12px;
  }

  .chat {
    width: auto;
    max-height: 44dvh;
  }
}

@media (max-width: 640px) {
  .grid {
    grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
    gap: 10px;
  }

  .avatar {
    width: 50px;
    height: 50px;
    font-size: 19px;
  }

  .topbar {
    padding: 10px 12px;
  }

  .pill-action span,
  .ctrl-label {
    display: none;
  }

  .controls {
    padding: 0 10px calc(12px + env(safe-area-inset-bottom));
  }

  .ctrl {
    padding: 11px 12px;
  }

  .controls-inner {
    gap: 6px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
