/* Salinha — identidade "sala de estar"
   Casa à noite: madeira escura, luz de abajur, sofá, a TV como palco.
   Terracota = ação/marca · mostarda = quem está falando/luz · creme = texto. */
@font-face { font-family: "Outfit"; src: url("outfit.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Fraunces"; src: url("fraunces-900.woff2") format("woff2"); font-weight: 900; font-display: swap; }
@font-face { font-family: "Fraunces"; src: url("fraunces-700i.woff2") format("woff2"); font-weight: 700; font-style: italic; font-display: swap; }

:root {
  color-scheme: dark;
  /* madeira, do mais escuro ao mais claro */
  --bg-0: #140f0c;
  --bg-1: #1b1411;
  --bg-2: #241b16;
  --bg-3: #2e231c;
  --bg-4: #3a2c24;
  --hover: #45352b;
  --line: #f4e9dc14;
  --line-hi: #f4e9dc22;
  /* texto */
  --text: #f4e9dc;
  --muted: #c9b5a2;
  --faint: #8c7766;
  /* marca */
  --terracota: #e2673a;
  --terracota-2: #c9452f;
  --terracota-soft: #e2673a26;
  --mostarda: #e8b33c;
  --oliva: #8fa35f;
  --red: #e5574a;
  --red-soft: #e5574a26;
  /* forma */
  --r-sm: 10px;
  --r: 14px;
  --r-lg: 20px;
  --avatar-r: 10px;
  --tv: #33261f;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font: "Outfit", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Fraunces", Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg-0);
  color: var(--text);
  font: 15px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
::selection { background: var(--terracota); color: #fff; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--bg-4); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

button, input, select { font: inherit; color: inherit; }
button {
  cursor: pointer; border: 0; border-radius: 999px; padding: 10px 18px;
  background: var(--bg-4); font-weight: 600; transition: background .15s, transform .1s;
}
button:hover { background: var(--hover); }
button:active { transform: translateY(1px); }
button.primary { background: var(--terracota); color: #fff; }
button.primary:hover { background: #ec7547; }
button.big { padding: 14px 18px; font-size: 16px; }
button:disabled { opacity: .6; cursor: wait; }

input, select {
  width: 100%; background: var(--bg-1); border: 1.5px solid var(--bg-4); border-radius: var(--r-sm);
  padding: 11px 13px; outline: none; transition: border-color .15s;
}
input::placeholder { color: var(--faint); }
input:focus, select:focus { border-color: var(--mostarda); }
input[type=range] { padding: 0; border: 0; background: transparent; accent-color: var(--terracota); }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--terracota); }
svg { width: 22px; height: 22px; fill: currentColor; display: block; }
a { color: var(--mostarda); }
.muted { color: var(--muted); }

/* rótulos de seção: serifada itálica, minúscula — a "voz" da casa */
.section-label {
  font-family: var(--display); font-style: italic; font-weight: 700; font-size: 15px;
  color: var(--muted); padding: 16px 16px 6px;
}

/* ---------- Entrada ---------- */
.join {
  min-height: 100%; display: grid; place-items: center; align-content: center; gap: 18px; padding: 24px 16px;
  background:
    radial-gradient(circle at 85% 8%, #e8b33c2e 0%, transparent 38%),   /* luz do abajur */
    radial-gradient(circle at 10% 100%, #e2673a1f 0%, transparent 45%),
    var(--bg-1);
}
.card {
  width: min(410px, 100%); background: var(--bg-2);
  border: 1.5px solid var(--bg-4); padding: 28px; border-radius: var(--r-lg);
  display: grid; gap: 16px; box-shadow: 0 30px 70px #0009;
}
.brand { display: flex; align-items: center; gap: 14px; }
.wordmark { font-family: var(--display); font-weight: 900; font-size: 36px; letter-spacing: -.02em; line-height: 1; }
.wordmark span, .side-foot span { color: var(--terracota); }
.tagline { font-family: var(--display); font-style: italic; font-weight: 700; color: var(--mostarda); font-size: 16px; margin-top: 4px; }
.lead { margin: 0; font-size: 14px; }
label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
label small { font-weight: 400; color: var(--faint); }
label input, label select { font-weight: 400; font-size: 15px; color: var(--text); }
.err { color: #ff9b8a; min-height: 1em; margin: 0; font-size: 14px; }
.made-by { color: var(--faint); font-size: 13px; }
.made-by b { color: var(--muted); }

/* ---------- App ---------- */
.app {
  height: 100dvh; display: grid; background: var(--bg-1);
  grid-template-columns: 250px 1fr 320px;
  grid-template-rows: 1fr auto;
  grid-template-areas: "side stage chat" "side controls chat";
}
.tabs { display: none; }
.side { grid-area: side; background: var(--bg-2); display: flex; flex-direction: column; min-height: 0; }
.stage { grid-area: stage; min-height: 0; }
.chat { grid-area: chat; background: var(--bg-2); display: flex; flex-direction: column; min-height: 0; }
.controls { grid-area: controls; }

.side-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 16px 10px 14px 16px; border-bottom: 1.5px solid var(--bg-3);
}
.room-name { font-family: var(--display); font-weight: 900; font-size: 19px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status { color: var(--muted); font-size: 12px; margin-top: 2px; display: flex; align-items: center; gap: 6px; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--oliva); flex: none; }
.status.warn, .empty.warn { color: var(--mostarda); }
.status.warn::before { background: var(--mostarda); }
.icon { padding: 8px; background: transparent; border-radius: var(--r-sm); color: var(--muted); }
.icon:hover { background: var(--bg-3); color: var(--text); }
.icon.sm { padding: 6px; }
.icon.sm svg { width: 18px; height: 18px; }

.people { list-style: none; margin: 0; padding: 0 8px 8px; overflow-y: auto; flex: 1; }
.p-main { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: var(--r-sm); cursor: pointer; }
.p-main:hover { background: var(--bg-3); }
.avatar {
  flex: none; width: 34px; height: 34px; border-radius: var(--avatar-r);
  display: grid; place-items: center; font-weight: 700; color: #fff; font-size: 15px;
  box-shadow: 0 0 0 2px transparent; transition: box-shadow .12s;
}
.avatar.sm { width: 38px; height: 38px; }
.person.speaking .avatar { box-shadow: 0 0 0 2px var(--bg-2), 0 0 0 4px var(--mostarda); }
.person.speaking .p-name { color: var(--text); }
.p-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-weight: 500; }
.p-rtt { font-size: 11px; color: var(--faint); font-variant-numeric: tabular-nums; }
.p-icons { display: flex; align-items: center; gap: 4px; color: var(--red); }
.p-icons svg { width: 16px; height: 16px; }
.live { background: var(--terracota); color: #fff; font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 999px; }
.p-vol { padding: 4px 12px 10px 52px; font-weight: 500; }
.side-foot {
  display: flex; align-items: center; gap: 6px; padding: 12px 16px; border-top: 1.5px solid var(--bg-3);
  font-family: var(--display); font-weight: 900; font-size: 16px; color: var(--muted);
}
.side-foot small { margin-left: auto; font-family: var(--font); font-weight: 400; font-size: 12px; color: var(--faint); }

/* ---------- Telas: cada transmissão é uma TV na sala ---------- */
.stage {
  position: relative; display: grid; gap: 14px; padding: 16px 16px 0; grid-auto-rows: 1fr; overflow: auto;
  background: radial-gradient(circle at 50% 0%, #e8b33c12 0%, transparent 50%);
}
.stage[data-count="2"], .stage[data-count="3"], .stage[data-count="4"] { grid-template-columns: 1fr 1fr; }
.stage.focused { grid-template-columns: 1fr; grid-template-rows: 1fr; }
.stage.focused .tile:not(.is-focus) { display: none; }
.empty { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 14px; color: var(--muted); text-align: center; padding: 24px; }
.empty svg { width: 96px; height: 96px; color: var(--bg-4); }
.empty p { margin: 0; max-width: 340px; font-size: 16px; }
.tile {
  position: relative; background: #000; border-radius: var(--r); overflow: hidden; min-height: 0; display: flex;
  border: 4px solid var(--tv); box-shadow: 0 14px 40px #0008;
}
.tile.is-focus { border-color: #4a372c; }
.tile video { width: 100%; height: 100%; object-fit: contain; background: #000; cursor: zoom-in; }
.tile.is-focus video { cursor: zoom-out; }
.tile::before {
  content: "ao vivo"; position: absolute; top: 10px; left: 10px; z-index: 1;
  background: var(--terracota); color: #fff; font-size: 12px; font-weight: 700;
  padding: 2px 10px; border-radius: 999px;
}
.tile.self::before { content: "você ao vivo"; }
.tile-bar {
  position: absolute; inset: auto 0 0 0; display: flex; align-items: center; gap: 10px; padding: 28px 12px 10px;
  background: linear-gradient(transparent, #000d); opacity: 0; transition: opacity .2s; pointer-events: none;
}
.tile:hover .tile-bar, .tile:focus-within .tile-bar { opacity: 1; }
@media (hover: none) { .tile-bar { opacity: 1; } }
.tile-bar * { pointer-events: auto; }
.tile-name { font-family: var(--display); font-weight: 900; font-size: 16px; white-space: nowrap; }
.tile-stats { flex: 1; font-size: 12px; color: #d8c8b8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tile-actions { display: flex; align-items: center; gap: 2px; }
.tile-actions .icon { color: #fff; }
.tile-actions .icon:hover { background: #ffffff1f; }
.tile-vol { width: 80px; }
.tile:fullscreen { border-radius: 0; border: 0; }
.tile:fullscreen .tile-bar { opacity: 0; }
.tile:fullscreen:hover .tile-bar { opacity: 1; }

/* ---------- Chat ---------- */
.chat-label { border-bottom: 1.5px solid var(--bg-3); padding-bottom: 12px; }
.msgs { flex: 1; overflow-y: auto; padding: 14px 12px; display: flex; flex-direction: column; gap: 14px; }
.msg { display: flex; gap: 10px; }
.msg > div { min-width: 0; }
.msg-head { display: flex; gap: 8px; align-items: baseline; }
.msg-head b { font-weight: 700; }
.msg-head time { font-size: 11px; color: var(--faint); }
.msg-text { white-space: pre-wrap; overflow-wrap: anywhere; color: #e6d8c9; }
.msg.sys { color: var(--faint); font-size: 13px; justify-content: center; font-style: italic; }
.chat-form { display: flex; gap: 8px; padding: 12px; border-top: 1.5px solid var(--bg-3); }
.chat-form input { background: var(--bg-1); border-radius: 999px; padding-left: 16px; }

/* ---------- Controles ---------- */
.controls {
  justify-self: center; display: flex; gap: 8px; align-items: center;
  margin: 14px 12px calc(16px + var(--safe-b)); padding: 8px;
  background: var(--bg-2); border: 1.5px solid var(--bg-4); border-radius: 999px; box-shadow: 0 12px 34px #0009;
}
.ctl { width: 50px; height: 50px; border-radius: 50%; display: grid; place-items: center; padding: 0; background: var(--bg-4); color: var(--text); }
.ctl:hover { background: var(--hover); }
.ctl.off { background: var(--red-soft); color: var(--red); }
.ctl.on { background: var(--mostarda); color: #3a2604; }
.ctl.danger { background: var(--terracota-2); color: #fff; width: 64px; border-radius: 999px; margin-left: 6px; }
.ctl.danger:hover { background: #d9533c; }
.ctl.disabled { opacity: .4; }

/* ---------- Diálogo ---------- */
dialog {
  background: var(--bg-2); color: var(--text); border: 1.5px solid var(--bg-4); border-radius: var(--r-lg);
  padding: 0; width: min(460px, calc(100% - 32px)); max-height: calc(100dvh - 32px); box-shadow: 0 30px 80px #000c;
}
dialog::backdrop { background: #0a0705cc; }
.settings { padding: 22px; display: grid; gap: 18px; }
.settings h2 { margin: 0; font-family: var(--display); font-weight: 900; font-size: 26px; }
fieldset { border: 1.5px solid var(--bg-4); padding: 14px; margin: 0; display: grid; gap: 12px; border-radius: var(--r); }
legend { font-family: var(--display); font-style: italic; font-weight: 700; font-size: 15px; color: var(--mostarda); padding: 0 6px; }
label.check { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 400; font-size: 14px; }
.hint { margin: 0; color: var(--faint); font-size: 12px; }
details[open] > :not(summary) { margin-top: 10px; }
details { display: grid; }
summary { cursor: pointer; color: var(--muted); font-size: 14px; }
.row-end { display: flex; justify-content: flex-end; gap: 8px; }

.toast {
  position: fixed; left: 50%; bottom: calc(104px + var(--safe-b)); transform: translate(-50%, 20px);
  background: var(--bg-3); color: var(--text); padding: 11px 18px; border-radius: var(--r);
  border: 1.5px solid var(--bg-4); box-shadow: 0 12px 40px #000a;
  opacity: 0; pointer-events: none; transition: .2s; max-width: calc(100% - 32px); text-align: center; z-index: 10;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.unlock { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 20; background: var(--terracota); color: #fff; box-shadow: 0 8px 30px #000a; }

/* ---------- Celular ---------- */
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; grid-template-rows: auto 1fr auto; grid-template-areas: "tabs" "main" "controls"; }
  .tabs {
    grid-area: tabs; display: flex; gap: 4px; padding: 8px; padding-top: calc(8px + env(safe-area-inset-top, 0px));
    background: var(--bg-2);
  }
  .tabs button { flex: 1; background: transparent; color: var(--muted); padding: 9px 8px; display: flex; justify-content: center; align-items: center; gap: 6px; }
  .tabs button.active { background: var(--bg-4); color: var(--text); }
  .count, .badge { font-size: 11px; background: var(--bg-1); border-radius: 10px; padding: 0 7px; }
  .badge { background: var(--terracota); color: #fff; }
  .panel { grid-area: main; display: none; }
  body[data-tab="stage"] .stage { display: grid; }
  body[data-tab="people"] .side { display: flex; }
  body[data-tab="chat"] .chat { display: flex; }
  .stage, .stage[data-count] { grid-template-columns: 1fr; padding: 12px 12px 0; }
  .controls { margin: 8px 8px calc(10px + var(--safe-b)); }
  .ctl { width: 52px; height: 52px; }
  .ctl.danger { width: 60px; }
  .chat-label { display: none; }
}

/* ---------- Conta / login ---------- */
.join-fields { display: grid; gap: 16px; }
.auth { display: grid; gap: 12px; }
.auth-login { display: grid; gap: 12px; justify-items: center; padding: 16px; border-radius: var(--r); background: var(--bg-1); border: 1.5px dashed var(--bg-4); text-align: center; }
.pitch { margin: 0; font-size: 14px; color: var(--muted); }
.pitch b { font-family: var(--display); font-weight: 900; font-size: 22px; color: var(--mostarda); display: block; line-height: 1.1; }
.g-btn { min-height: 44px; display: grid; place-items: center; }
.account { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--r); background: var(--bg-1); }
.acc-info { flex: 1; min-width: 0; display: grid; }
.acc-info b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-info small { color: var(--mostarda); font-family: var(--display); font-style: italic; font-weight: 700; font-size: 13px; }
button.link { background: transparent; color: var(--muted); padding: 6px 10px; font-weight: 500; text-decoration: underline; }
button.link:hover { color: var(--text); background: transparent; }
.no-access { margin: 0; padding: 12px 14px; border-radius: var(--r); background: var(--terracota-soft); color: var(--text); font-size: 14px; }
button.link.small { font-size: 12px; justify-self: end; padding: 2px 6px; color: var(--faint); }
.made-by a { color: var(--muted); }

/* ---------- Páginas de texto (privacidade, termos) ---------- */
.doc-page { background: var(--bg-1); }
.doc { max-width: 760px; margin: 0 auto; padding: 32px 16px 64px; line-height: 1.65; color: #e6d8c9; }
.doc-brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-family: var(--display); font-weight: 900; font-size: 24px; }
.doc a.doc-brand { color: var(--text); }
.doc-brand i { color: var(--terracota); font-style: normal; }
.doc h1 { font-family: var(--display); font-weight: 900; font-size: clamp(30px, 6vw, 42px); color: var(--text); margin: 28px 0 4px; line-height: 1.1; }
.doc h2 { font-family: var(--display); font-weight: 900; font-size: 21px; color: var(--text); margin: 32px 0 8px; }
.doc-date { color: var(--faint); margin: 0 0 24px; }
.doc a { color: var(--mostarda); }
.doc b { color: var(--text); }
.doc ul { padding-left: 22px; }
.doc li { margin: 6px 0; }
.doc-back { margin-top: 40px; padding-top: 16px; border-top: 1.5px solid var(--bg-3); }
.about { width: min(410px, 100%); display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.about div { display: grid; gap: 2px; text-align: center; padding: 10px 6px; border-radius: var(--r); background: #241b1680; }
.about b { font-family: var(--display); font-weight: 900; color: var(--mostarda); font-size: 16px; }
.about span { font-size: 12px; color: var(--muted); line-height: 1.3; }
