:root {
  --bg: #0e0f14;
  --bg-soft: #14161d;
  --panel: #191c25;
  --panel-2: #1f232e;
  --line: #272c3a;
  --text: #e7e9f0;
  --muted: #8b91a6;
  --accent: #7c6cff;
  --accent-soft: #7c6cff22;
  --live: #35d39a;
  --danger: #ff5b6e;
  --radius: 14px;
  --shadow: 0 18px 45px -20px rgba(0, 0, 0, .9);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 "Segoe UI", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 650;
  letter-spacing: -.02em;
}

[hidden] {
  display: none !important;
}

/* ------------------------------------------------------------------ botões */

.btn {
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  padding: 11px 18px;
  border-radius: 10px;
  font: inherit;
  font-weight: 550;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .1s;
}

.btn:hover {
  background: #262b38;
  border-color: #333a4c;
}

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

.btn-primary {
  background: var(--accent);
  border-color: transparent;
  color: #fff;
}

.btn-primary:hover {
  background: #8d7fff;
}

.btn-block {
  width: 100%;
}

.btn-sm {
  padding: 7px 13px;
  font-size: 13px;
}

.btn-ghost {
  background: transparent;
}

.linkish {
  background: none;
  border: 0;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ------------------------------------------------------------------ lobby */

.lobby {
  min-height: 100%;
  display: grid;
  place-content: center;
  gap: 18px;
  padding: 24px;
  background:
    radial-gradient(70ch 50ch at 50% -20%, #241f4d 0%, transparent 70%),
    var(--bg);
}

.lobby-card {
  width: min(420px, 92vw);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 26px;
  box-shadow: var(--shadow);
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 24px;
}

.brand h1 {
  font-size: 26px;
  line-height: 1.1;
}

.brand p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.brand-mark {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 13px;
  background: linear-gradient(150deg, var(--accent), #4ac6ff);
  position: relative;
}

.brand-mark::before {
  content: "";
  position: absolute;
  inset: 12px 10px 16px;
  border-radius: 4px;
  background: var(--panel);
}

.brand-mark::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 9px;
  width: 14px;
  height: 3px;
  border-radius: 2px;
  transform: translateX(-50%);
  background: var(--panel);
}

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

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

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

input[type="text"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

input::placeholder {
  color: #5d6479;
}

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--muted);
  font-size: 12px;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.join-row {
  display: flex;
  gap: 10px;
}

#codeInput {
  flex: 1;
  text-transform: uppercase;
  letter-spacing: .3em;
  font-weight: 650;
  font-family: ui-monospace, "Cascadia Mono", monospace;
}

.preview,
.error {
  margin: 14px 0 0;
  font-size: 13px;
  padding: 10px 12px;
  border-radius: 10px;
}

.preview {
  background: #14251f;
  border: 1px solid #1f4437;
  color: #7de3b8;
}

.error {
  background: #2a161b;
  border: 1px solid #4d222b;
  color: #ff9aa7;
}

.how {
  margin-top: 22px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
  font-size: 13px;
  color: var(--muted);
}

.how summary {
  cursor: pointer;
  color: var(--text);
  font-weight: 550;
}

.how p {
  margin: 12px 0 0;
}

.how strong {
  color: var(--text);
  font-weight: 600;
}

.lobby-foot {
  margin: 0;
  text-align: center;
}

/* ------------------------------------------------------------------- sala */

.room {
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-soft);
}

.spacer {
  flex: 1;
}

.chip {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 13px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

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

.chip-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
}

.chip strong {
  font-family: ui-monospace, "Cascadia Mono", monospace;
  letter-spacing: .16em;
  font-size: 15px;
}

.badge {
  flex: none;
  white-space: nowrap;
  font-size: 12px;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--muted);
}

.badge.ok {
  color: var(--live);
  border-color: #1f4437;
  background: #14251f;
}

.badge.bad {
  color: var(--danger);
  border-color: #4d222b;
  background: #2a161b;
}

.stage-wrap {
  display: grid;
  grid-template-columns: 1fr 310px;
  min-height: 0;
}

.stage-wrap.collapsed {
  grid-template-columns: 1fr 0;
}

.stage-wrap.collapsed .sidebar {
  display: none;
}

/* ------------------------------------------------------------- palco/telas */

.stage {
  position: relative;
  min-width: 0;
  padding: 14px;
  overflow: auto;
}

.tiles {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  align-content: start;
}

.stage.focused .tiles {
  grid-template-columns: 1fr;
}

.stage.focused .tile:not(.is-focused) {
  display: none;
}

.tile {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
  border: 1px solid var(--line);
  aspect-ratio: 16 / 9;
  cursor: zoom-in;
}

.tile.is-focused {
  cursor: zoom-out;
}

/* Uma tela só (ou uma em foco) ocupa todo o palco, em vez de deixar sobra embaixo. */
.tiles:has(> .tile:only-child),
.stage.focused .tiles {
  height: 100%;
  align-content: stretch;
}

.tile:only-child,
.tile.is-focused {
  aspect-ratio: auto;
}

.tile video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #000;
}

.tile-tag {
  position: absolute;
  left: 10px;
  bottom: 10px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(10, 11, 15, .78);
  backdrop-filter: blur(8px);
  font-size: 13px;
  font-weight: 550;
}

.tile-tag::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--live);
  box-shadow: 0 0 0 3px #35d39a33;
}

.tile-full {
  position: absolute;
  top: 10px;
  right: 10px;
  border: 0;
  border-radius: 8px;
  padding: 6px 10px;
  font: inherit;
  font-size: 12px;
  color: #fff;
  background: rgba(10, 11, 15, .78);
  backdrop-filter: blur(8px);
  cursor: pointer;
  opacity: 0;
  transition: opacity .15s;
}

.tile:hover .tile-full {
  opacity: 1;
}

.stage-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  text-align: center;
  gap: 6px;
  color: var(--muted);
  padding: 20px;
  pointer-events: none;
}

.stage-empty h2 {
  font-size: 17px;
  color: var(--text);
}

.stage-empty p {
  margin: 0;
  font-size: 13px;
  max-width: 34ch;
}

.stage-empty strong {
  color: var(--text);
}

.stage-empty-mark {
  width: 58px;
  height: 44px;
  border-radius: 9px;
  border: 2px dashed #333a4c;
  margin-bottom: 10px;
}

/* ---------------------------------------------------------------- sidebar */

.sidebar {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 0;
  border-left: 1px solid var(--line);
  background: var(--bg-soft);
}

.sidebar h3 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--muted);
  padding: 14px 14px 8px;
  display: flex;
  align-items: center;
  gap: 7px;
}

.count {
  background: var(--panel-2);
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 11px;
  color: var(--text);
}

.people-block {
  border-bottom: 1px solid var(--line);
  max-height: 38vh;
  overflow: auto;
}

.people {
  list-style: none;
  margin: 0;
  padding: 0 8px 12px;
}

.person {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border-radius: 9px;
  font-size: 14px;
}

.person:hover {
  background: var(--panel);
}

.avatar {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #0e0f14;
  border: 2px solid transparent;
  transition: border-color .12s, box-shadow .12s;
}

.person.speaking .avatar {
  border-color: var(--live);
  box-shadow: 0 0 0 3px #35d39a26;
}

.person-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.person-tag {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 5px;
}

.person-tag.live {
  color: var(--live);
  border-color: #1f4437;
}

.mini {
  border: 0;
  background: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  padding: 2px 4px;
  border-radius: 6px;
}

.mini:hover {
  color: var(--text);
  background: var(--panel-2);
}

.mini.off {
  color: var(--danger);
}

/* ------------------------------------------------------------------- chat */

.chat-block {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 0;
}

.messages {
  overflow-y: auto;
  padding: 4px 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.msg {
  font-size: 14px;
  word-break: break-word;
}

.msg-head {
  display: flex;
  align-items: baseline;
  gap: 7px;
  margin-bottom: 1px;
}

.msg-nick {
  font-weight: 650;
  font-size: 13px;
}

.msg-time {
  font-size: 10px;
  color: #5d6479;
}

.msg-body {
  color: #cdd2e0;
  white-space: pre-wrap;
}

.msg-body a {
  color: #8fa6ff;
}

.msg.system {
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
  text-align: center;
  padding: 2px 0;
}

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

.chat-form input {
  flex: 1;
}

/* --------------------------------------------------------------- controles */

.controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-top: 1px solid var(--line);
  background: var(--bg-soft);
  flex-wrap: wrap;
}

.ctl {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 10px 16px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
  font-weight: 550;
  font-size: 14px;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}

.ctl:hover {
  background: #262b38;
}

.ctl[aria-pressed="false"] {
  color: var(--danger);
  border-color: #4d222b;
  background: #24151a;
}

.ctl-share.active {
  background: var(--accent);
  border-color: transparent;
  color: #fff;
}

.ctl-danger {
  color: var(--danger);
}

.ctl-danger:hover {
  background: #2a161b;
  border-color: #4d222b;
}

.ctl-select {
  gap: 8px;
  padding: 7px 10px 7px 14px;
}

.ctl-select .ctl-text {
  color: var(--muted);
  font-size: 12px;
}

select {
  background: var(--bg-soft);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  outline: none;
}

.ctl-icon {
  width: 17px;
  height: 17px;
  background: currentColor;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
}

.ctl-icon[data-icon="mic"] {
  -webkit-mask-image: var(--i-mic);
  mask-image: var(--i-mic);
}

.ctl-icon[data-icon="screen"] {
  -webkit-mask-image: var(--i-screen);
  mask-image: var(--i-screen);
}

.ctl-icon[data-icon="leave"] {
  -webkit-mask-image: var(--i-leave);
  mask-image: var(--i-leave);
}

:root {
  --i-mic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round'%3E%3Crect x='9' y='2' width='6' height='11' rx='3'/%3E%3Cpath d='M5 11a7 7 0 0 0 14 0M12 18v4'/%3E%3C/svg%3E");
  --i-screen: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='2' y='4' width='20' height='13' rx='2'/%3E%3Cpath d='M8 21h8'/%3E%3C/svg%3E");
  --i-leave: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4M16 17l5-5-5-5M21 12H9'/%3E%3C/svg%3E");
}

.only-narrow {
  display: none;
}

.audio-sink {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

/* ------------------------------------------------------------------ toasts */

.toasts {
  position: fixed;
  bottom: 84px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  z-index: 50;
  pointer-events: none;
}

.toast {
  background: var(--panel-2);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 13.5px;
  animation: rise .2s ease-out;
  pointer-events: auto;
}

.toast.bad {
  border-color: #4d222b;
  color: #ff9aa7;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

/* ------------------------------------------------------------------ mobile */

@media (max-width: 820px) {
  .stage-wrap {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto;
  }

  .sidebar {
    border-left: 0;
    border-top: 1px solid var(--line);
    max-height: 45vh;
  }

  .only-wide {
    display: none;
  }

  .only-narrow {
    display: inline;
  }

  .topbar {
    gap: 6px;
    padding: 8px 10px;
  }

  .badge {
    font-size: 11px;
    padding: 4px 9px;
  }

  .stage {
    padding: 10px;
  }

  /* Na vertical, esticar a tela só cria tarja preta: melhor manter o 16:9. */
  .tiles:has(> .tile:only-child) {
    height: auto;
    align-content: start;
  }

  .tile:only-child {
    aspect-ratio: 16 / 9;
  }

  .stage-wrap.collapsed {
    grid-template-rows: 1fr 0;
  }

  .tiles {
    grid-template-columns: 1fr;
  }

  .ctl-text {
    display: none;
  }

  .controls {
    gap: 8px;
    padding: 10px;
  }

  .ctl {
    padding: 10px 13px;
  }
}

/* ------------------------------------------------------------ landing / SEO */

/* A entrada agora rola: a card fica no primeiro "dobra", o conteúdo indexável abaixo. */
.lobby {
  height: 100%;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  place-content: unset;
}

.lobby-card {
  margin-top: max(24px, calc(50vh - 300px));
}

.brand-name {
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent);
}

.brand h1 {
  font-size: 21px;
  line-height: 1.2;
}

.lobby-hint {
  margin: 18px 0 0;
  text-align: center;
  font-size: 12.5px;
  color: var(--muted);
}

.scroll-hint {
  margin: 22px 0 0;
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  opacity: .8;
}

.scroll-hint:hover {
  color: var(--text);
}

.landing {
  width: min(760px, 92vw);
  margin: 12vh auto 0;
  display: grid;
  gap: 56px;
}

.landing-block h2 {
  font-size: 24px;
  margin-bottom: 18px;
}

.landing-block h3 {
  font-size: 15.5px;
  margin-bottom: 6px;
}

.landing-block p,
.landing-block li,
.landing-block dd {
  color: #b5bacb;
  font-size: 15px;
  line-height: 1.6;
}

.landing-block strong {
  color: var(--text);
  font-weight: 600;
}

.steps {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: passo;
  display: grid;
  gap: 14px;
}

.steps li {
  counter-increment: passo;
  position: relative;
  padding: 16px 18px 16px 62px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.steps li::before {
  content: counter(passo);
  position: absolute;
  left: 18px;
  top: 16px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-content: center;
  font-weight: 700;
  font-size: 14px;
  color: #0e0f14;
  background: var(--accent);
}

.steps strong {
  display: block;
  margin-bottom: 2px;
}

.uses {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 14px;
}

.uses article {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.uses p {
  margin: 0;
  font-size: 14px;
}

.why {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 12px;
}

.why li {
  padding-left: 22px;
  position: relative;
}

.why li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--live);
}

.faq {
  margin: 0;
  display: grid;
  gap: 4px;
}

.faq dt {
  font-weight: 600;
  padding-top: 14px;
}

.faq dd {
  margin: 4px 0 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.faq dd:last-child {
  border-bottom: 0;
}

/* ------------------------------------------------------------------ rodapé */

.site-foot {
  width: min(760px, 92vw);
  margin: 72px auto 40px;
  text-align: center;
}

.pix {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  margin-bottom: 28px;
}

.pix-title {
  margin: 0;
  font-weight: 650;
  font-size: 17px;
}

.pix-text {
  margin: 0 0 6px;
  font-size: 13.5px;
  color: var(--muted);
  max-width: 44ch;
}

.pix-qr {
  width: 160px;
  height: 160px;
  border-radius: 12px;
  background: #fff;
  padding: 8px;
}

.pix-key {
  font-size: 12px;
  color: var(--muted);
  word-break: break-all;
}

.foot-line {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

@media (max-width: 820px) {
  .landing {
    margin-top: 8vh;
    gap: 40px;
  }
}

/* ------------------------------------------------------------------- tags */

.tags-intro {
  margin: -8px 0 16px;
}

.tags {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.tags li {
  font-size: 13.5px;
  color: #b5bacb;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
}
