:root {
  --orange: #ff8a1a;
  --orange-deep: #e96a00;
  --orange-soft: #ffe3bd;
  --cream: #fff6e9;
  --paper: #fffcf6;
  --ink: #3b1a00;
  --ink-soft: #7a5233;
  --leaf: #3f9142;
  --leaf-deep: #2c6e33;
  --danger: #d93a2b;
  --on-orange: #3b1a00;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --field-hover: #ffc98a;
  --placeholder: #b08e70;
  --error: #b92a14;
  --cell-filled: #fff0d9;
  --meter-peel: #ffcf96;
  --meter-empty: #fff0d4;
  --dashed: #ffd3a1;
  --live-pill: #e8f3e6;
  --live-text: var(--leaf-deep);
  --accent-icon: var(--orange-deep);
  --card-shadow: rgb(140 60 0 / 0.28);
  --backdrop: rgb(233 106 0 / 0.55);
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
}

/* Modo noturno. A chamada é sempre escura e tem seus próprios tons. */

[data-theme='dark'] {
  color-scheme: dark;
}

[data-theme='dark'] body {
  background: #1c0f07;
}

[data-theme='dark'] .home,
[data-theme='dark'] .code-dialog,
.camera-dialog {
  --cream: #1c0f07;
  --paper: #2b1a0e;
  --ink: #fff3e3;
  --ink-soft: #d1b395;
  --orange-soft: #4d3019;
  --field-hover: #7a4d28;
  --placeholder: #a98a6e;
  --error: #ffa594;
  --cell-filled: #3a2413;
  --meter-peel: #6b4020;
  --meter-empty: #3a2413;
  --dashed: #5c3a1f;
  --live-pill: #22371f;
  --live-text: #a6dba1;
  --accent-icon: var(--orange);
  --card-shadow: rgb(0 0 0 / 0.5);
  --backdrop: rgb(10 5 2 / 0.72);
}

[data-theme='dark'] .home {
  color: var(--ink);
  background-image:
    radial-gradient(1.5px 1.5px at 8% 14%, #ffe9c9, transparent),
    radial-gradient(1px 1px at 22% 82%, #ffe9c9, transparent),
    radial-gradient(1.5px 1.5px at 41% 7%, #ffe9c9, transparent),
    radial-gradient(1px 1px at 5% 58%, #ffe9c9, transparent),
    radial-gradient(1.5px 1.5px at 48% 92%, #ffe9c9, transparent),
    radial-gradient(1px 1px at 33% 38%, #ffe9c9, transparent),
    radial-gradient(1.5px 1.5px at 88% 6%, #ffe9c9, transparent),
    radial-gradient(1px 1px at 96% 94%, #ffe9c9, transparent);
}

[data-theme='dark'] .giant-slice {
  --slice-pith: #d4935a;
  filter: brightness(0.62) saturate(1.15);
}

/* Transições de página */

::view-transition {
  pointer-events: none;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.35s;
  animation-timing-function: ease;
}

.theme-change::view-transition-old(root),
.theme-change::view-transition-new(root) {
  animation-duration: 0.7s;
  animation-timing-function: ease-in-out;
}

@media (prefers-reduced-motion: no-preference) {
  .theme-fade,
  .theme-fade * {
    transition: background-color 0.5s ease, color 0.5s ease, border-color 0.5s ease !important;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font: 16px/1.5 ui-rounded, 'SF Pro Rounded', 'Hiragino Maru Gothic ProN', Nunito, system-ui, -apple-system,
    'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
p,
ul {
  margin: 0;
  padding: 0;
}

ul {
  list-style: none;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

:focus-visible {
  outline: 3px solid var(--orange-deep);
  outline-offset: 2px;
}

svg:not(.citrus) {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sprite {
  position: absolute;
}

.slice-peel {
  fill: #ff8412;
}

.slice-pith {
  fill: var(--slice-pith, #fff0d4);
}

/* Início */

.home {
  position: relative;
  min-height: 100dvh;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 460px) minmax(0, 360px);
  gap: 96px;
  justify-content: center;
  align-content: center;
  align-items: center;
  padding: 32px 24px;
}

.giant-slice {
  position: absolute;
  top: 50%;
  right: -18vmin;
  width: 100vmin;
  height: 100vmin;
  margin-top: -50vmin;
  animation: roll-in 1s cubic-bezier(0.2, 0.8, 0.2, 1), spin 240s linear infinite;
  pointer-events: none;
}

@keyframes spin {
  to {
    rotate: 360deg;
  }
}

@keyframes roll-in {
  from {
    translate: 45vmin 0;
    rotate: 60deg;
  }
}

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

.theme-toggle {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 50%;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 8px 22px var(--card-shadow);
  transition: transform 0.2s;
}

.theme-toggle:hover {
  transform: rotate(-18deg) scale(1.06);
}

.theme-toggle svg {
  width: 21px;
  height: 21px;
}

.entry,
.live {
  position: relative;
  z-index: 1;
  animation: rise 0.5s ease-out backwards;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.logo {
  flex: none;
  width: 56px;
  height: 56px;
}

h1 {
  margin-top: 32px;
  font-size: clamp(36px, 5vw, 52px);
  line-height: 1.04;
  letter-spacing: -0.025em;
  font-weight: 800;
  text-wrap: balance;
}

.lede {
  margin-top: 14px;
  color: var(--ink-soft);
  font-size: 17px;
}

.perks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 8px;
  margin-top: 14px;
}

.perks li {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px 4px 9px;
  border-radius: 999px;
  background: var(--orange-soft);
  font-size: 13px;
  font-weight: 600;
}

.perks svg {
  width: 15px;
  height: 15px;
  color: var(--accent-icon);
}

form {
  margin-top: 30px;
}

label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
}

input,
select {
  width: 100%;
  height: 52px;
  padding: 0 18px;
  background: var(--paper);
  border: 2px solid var(--orange-soft);
  border-radius: 16px;
  transition: border-color 0.2s;
}

input:hover,
select:hover:not(:disabled),
.device-toggle:hover {
  border-color: var(--field-hover);
}

input:focus,
select:focus {
  border-color: var(--orange);
  outline: none;
}

input::placeholder {
  color: var(--placeholder);
}

.device-choice {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.device-toggle {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  column-gap: 10px;
  padding: 7px 14px;
  border: 2px solid var(--orange-soft);
  border-radius: 16px;
  background: var(--paper);
  color: var(--ink-soft);
  text-align: left;
  transition: background-color 0.2s, border-color 0.2s;
}

.device-toggle svg {
  grid-row: span 2;
  width: 22px;
  height: 22px;
}

.device-toggle span {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.25;
}

.device-toggle small {
  font-size: 12px;
  line-height: 1.25;
}

.device-toggle[aria-checked='true'] {
  background: var(--orange-soft);
  border-color: var(--orange);
  color: var(--ink);
}

.device-toggle[aria-checked='true'] svg {
  color: var(--accent-icon);
}

.fruit-label {
  margin-top: 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
}

.fruit-options {
  display: grid;
  grid-template-columns: repeat(auto-fill, 46px);
  justify-content: space-between;
  gap: 6px 4px;
  margin-top: 4px;
}

.fruit-option {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  padding: 3px;
  border: 2px solid transparent;
  border-radius: 50%;
  background: transparent;
  transition: border-color 0.2s, background-color 0.2s, scale 0.2s var(--ease);
}

.fruit-option:hover {
  scale: 1.1;
}

.fruit-option[aria-checked='true'] {
  border-color: var(--orange);
  background: var(--orange-soft);
}

.fruit-option .person-fruit {
  width: 100%;
  height: 100%;
  font-size: 15px;
}

.button {
  height: 52px;
  padding: 0 24px;
  border: 2px solid var(--orange);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font-weight: 700;
  transition: background-color 0.2s, transform 0.2s;
}

.button:hover:not(:disabled) {
  background: var(--orange-soft);
}

.button:active:not(:disabled) {
  transform: scale(0.97);
}

.button.primary {
  width: 100%;
  margin-top: 12px;
  background: var(--orange);
  color: var(--on-orange);
  box-shadow: 0 6px 0 var(--orange-deep);
}

.button.primary:hover:not(:disabled),
#screen:hover {
  background: #ff9c3d;
}

.button.primary:active:not(:disabled) {
  transform: translateY(4px);
  box-shadow: 0 2px 0 var(--orange-deep);
}

.join-card {
  margin-top: 22px;
  padding: 14px 16px 16px;
  border-radius: 20px;
  background: var(--orange-soft);
}

.join-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 15px;
  font-weight: 800;
  color: var(--ink);
}

.join-title svg {
  flex: none;
  width: 18px;
  height: 18px;
  color: var(--accent-icon);
}

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

.code-row .button.primary {
  width: auto;
  margin-top: 0;
}

.code-boxes {
  position: relative;
  flex: 1;
  min-width: 0;
  height: 52px;
}

.code-boxes input {
  position: absolute;
  inset: 0;
  z-index: 1;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: transparent;
  caret-color: transparent;
}

.code-boxes input::selection {
  background: transparent;
}

.code-cells {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  height: 100%;
}

.code-cells span {
  display: grid;
  place-items: center;
  background: var(--paper);
  border: 2px solid var(--orange-soft);
  border-radius: 14px;
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 700;
  transition: border-color 0.2s, background-color 0.2s, transform 0.2s;
}

/* Um ponto em cada casa vazia mostra que é para digitar ali, e quantas letras são. */
.code-cells span:empty::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--field-hover);
}

.code-cells span.filled {
  background: var(--cell-filled);
  border-color: var(--field-hover);
}

.code-cells span.current {
  border-color: var(--orange);
  transform: translateY(-2px);
}

.form-error {
  min-height: 24px;
  margin-top: 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--error);
}

.notice {
  margin-top: 8px;
  padding: 10px 14px;
  border-radius: 14px;
  background: var(--orange-soft);
  font-size: 14px;
}

.live {
  animation-delay: 0.2s;
  padding: 22px;
  background: var(--paper);
  border-radius: 28px;
  box-shadow: 0 20px 50px var(--card-shadow);
}

.live-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
}

.live h2 {
  font-size: 19px;
  font-weight: 800;
}

.rooms-total {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px 2px 8px;
  border-radius: 999px;
  background: var(--live-pill);
  font-size: 12px;
  font-weight: 700;
  color: var(--live-text);
  white-space: nowrap;
}

.rooms-total::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--leaf);
  animation: pulse 1.8s ease-in-out infinite;
}

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

.live-hint {
  margin-top: 2px;
  font-size: 13px;
  color: var(--ink-soft);
}

/* Esqueleto, lista e aviso dividem o mesmo espaço, para um trocar pelo outro sem empurrar nada. */
.rooms-area {
  position: relative;
  display: grid;
  margin-top: 14px;
  overflow: hidden;
}

.rooms-area > * {
  grid-area: 1 / 1;
  min-width: 0;
}

:is(.room-skeleton, .rooms-empty)[hidden] {
  position: absolute;
  inset: 0 0 auto;
}

.rooms {
  display: flex;
  flex-direction: column;
  align-self: start;
  gap: 8px;
  max-height: 320px;
  overflow-y: auto;
}

.rooms li {
  flex: none;
  overflow: hidden;
}

.room,
.room-skeleton {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 8px 14px 8px 8px;
  background: var(--cream);
  border: 2px solid transparent;
  border-radius: 18px;
  text-align: left;
  transition: border-color 0.2s;
}

/* Fica no botão, e não na linha: a linha recorta o deslocamento, que faria a lista rolar. */
.room {
  animation: rise 0.35s var(--ease) backwards;
}

.skeleton-gomos,
.skeleton-bar {
  background: var(--meter-empty);
  animation: pulse 1.8s ease-in-out infinite;
}

.skeleton-gomos {
  width: 44px;
  height: 44px;
  border-radius: 50%;
}

.skeleton-bar {
  width: 110px;
  height: 12px;
  border-radius: 999px;
}

.skeleton-bar:last-child {
  width: 44px;
}

.room:hover:not(:disabled) {
  border-color: var(--orange);
}

.room:hover:not(:disabled) .gomos {
  transform: rotate(36deg);
}


.gomos {
  width: 44px;
  height: 44px;
  transition: transform 0.3s;
}

.gomos circle {
  fill: var(--meter-peel);
}

.gomos use {
  fill: var(--meter-empty);
  stroke: var(--meter-empty);
  stroke-width: 6;
  stroke-linejoin: round;
  transition: fill 0.4s ease, stroke 0.4s ease;
}

.gomos use.on {
  fill: var(--orange);
  stroke: var(--orange);
}

.room-label {
  overflow: hidden;
  font-weight: 700;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.room-count {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
}

.rooms-empty {
  padding: 18px;
  border: 2px dashed var(--dashed);
  border-radius: 18px;
  font-size: 14px;
  color: var(--ink-soft);
  text-align: center;
}

.code-dialog {
  width: min(380px, calc(100vw - 32px));
  padding: 26px;
  border: 0;
  border-radius: 28px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 24px 60px rgb(90 40 0 / 0.4);
  opacity: 0;
  translate: 0 14px;
  scale: 0.97;
  transition: opacity 0.25s ease, translate 0.3s var(--ease), scale 0.3s var(--ease), overlay 0.3s allow-discrete,
    display 0.3s allow-discrete;
}

.code-dialog[open] {
  opacity: 1;
  translate: 0;
  scale: 1;
}

@starting-style {
  .code-dialog[open] {
    opacity: 0;
    translate: 0 14px;
    scale: 0.97;
  }
}

.code-dialog::backdrop {
  background: var(--backdrop);
  opacity: 0;
  transition: opacity 0.3s ease, overlay 0.3s allow-discrete, display 0.3s allow-discrete;
}

.code-dialog[open]::backdrop {
  opacity: 1;
}

@starting-style {
  .code-dialog[open]::backdrop {
    opacity: 0;
  }
}

.code-dialog form {
  margin-top: 0;
}

.dialog-logo {
  display: block;
  width: 48px;
  height: 48px;
  margin-bottom: 10px;
}

.code-dialog h2,
.invite h2 {
  font-size: 22px;
  font-weight: 800;
}

.code-dialog p {
  margin-top: 4px;
  color: var(--ink-soft);
  font-size: 14px;
}

.code-dialog .code-boxes {
  margin-top: 16px;
}

.code-dialog .form-error {
  margin-top: 10px;
  color: var(--error);
}

.dialog-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.dialog-actions .button.primary {
  width: auto;
  margin-top: 0;
}

/* Abre dentro da chamada, que é sempre escura, então não segue o tema da tela inicial. */
.camera-dialog {
  width: min(460px, calc(100vw - 32px));
  color-scheme: dark;
}

.camera-preview {
  position: relative;
  aspect-ratio: 16 / 9;
  width: 100%;
  max-height: 50dvh;
  margin: 16px 0 14px;
  overflow: hidden;
  border-radius: 18px;
  background: #000;
}

.camera-preview video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}

.code-dialog .camera-status {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 20px;
  color: var(--ink);
  text-align: center;
}

/* A seta nativa fica colada na borda e não aceita ajuste. */
.camera-dialog select {
  appearance: none;
  padding-right: 48px;
  overflow: hidden;
  text-overflow: ellipsis;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23d1b395' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m3 6 5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 18px center;
  background-size: 16px;
}

.camera-dialog select:disabled {
  background-image: none;
  color: var(--ink-soft);
  opacity: 1;
}

.code-dialog .camera-hint {
  margin-top: 8px;
  font-size: 13px;
}

.camera-dialog .dialog-actions {
  margin-top: 18px;
}

.camera-dialog .button.primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Chamada */

.call {
  --bg: #1c0f07;
  --surface: #2b1a0e;
  --surface-2: #3a2413;
  --line: #4d3019;
  --text: #fff3e3;
  --muted: #c9a988;
  height: 100dvh;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  transition: grid-template-columns 0.35s var(--ease);
  background: var(--bg);
  color: var(--text);
  color-scheme: dark;
}

.main {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  padding: 12px 12px 0;
}

.stage {
  position: relative;
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(var(--cols, 1), minmax(0, 1fr));
  grid-template-rows: repeat(var(--rows, 1), minmax(0, 1fr));
  gap: 8px;
}

.stage.spotlight {
  grid-template-columns: minmax(0, 1fr) repeat(var(--strip-cols, 1), var(--strip-width, 208px));
  grid-template-rows: repeat(var(--strip-rows, 4), minmax(0, 1fr));
}

.stage.spotlight .tile.spot {
  grid-column: 1;
  grid-row: 1 / -1;
}

.stage.spotlight.duo {
  grid-template-columns: repeat(2, minmax(0, 1fr)) repeat(var(--strip-cols, 1), var(--strip-width, 208px));
}

.stage.spotlight.duo.no-strip {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: minmax(0, 1fr);
}

.stage.spotlight .tile.spot.spot-second {
  grid-column: 2;
}

.tile {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border-radius: 18px;
  background: var(--surface);
  cursor: pointer;
  user-select: none;
  container-type: size;
  transition: box-shadow 0.25s ease;
}

.tile video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
  transition: opacity 0.3s ease;
}

.tile.screen video {
  object-fit: contain;
}

.tile.cam.local video {
  transform: scaleX(-1);
}

.tile:not(.has-video) video {
  opacity: 0;
}

.tile.leaving {
  position: absolute;
  z-index: 1;
  pointer-events: none;
}

.avatar {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  place-items: center;
  width: min(96px, 40cqw, 46cqh);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  opacity: 0;
  transition: opacity 0.3s ease;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 28%, #ffffff66, transparent 42%), var(--fruit, var(--orange));
  box-shadow: inset -6px -8px 14px rgb(160 60 0 / 0.35);
  color: var(--ink);
  font-size: min(36px, 18cqh);
  font-weight: 800;
}

.avatar::after {
  content: '';
  position: absolute;
  top: -7%;
  right: 12%;
  width: 36%;
  height: 20%;
  border-radius: 0 100% 0 100%;
  background: var(--leaf);
  transform: rotate(-14deg);
}

.tile:not(.has-video) .avatar {
  opacity: 1;
}

.avatar.has-face,
.person-fruit.has-face {
  background: none;
  box-shadow: none;
}

.avatar.has-face::after {
  display: none;
}

.has-face svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.tile-label {
  position: absolute;
  left: 8px;
  bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: calc(100% - 16px);
  padding: 3px 10px;
  border-radius: 999px;
  background: rgb(28 15 7 / 0.8);
  font-size: 13px;
  font-weight: 600;
}

.tile-label svg {
  flex: none;
  width: 14px;
  height: 14px;
  color: #ff9a8c;
}

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

.tile-status {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--orange);
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
}

.tile-expand,
.tile-mute,
.tile-hide {
  position: absolute;
  top: 8px;
  right: 8px;
  display: none;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: rgb(28 15 7 / 0.8);
  color: var(--text);
  transition: background-color 0.2s, scale 0.2s var(--ease);
}

.tile-expand:hover,
.tile-mute:hover,
.tile-hide:hover {
  scale: 1.08;
}

.tile.screen .tile-expand,
.tile-mute,
.tile-hide {
  display: grid;
}

.tile-mute {
  right: 52px;
}

.tile-hide {
  right: 96px;
}

.tile-mute.off {
  background: var(--orange);
  color: #2a1505;
}

/* Tela cheia da própria transmissão vira um espelho dela mesma. */
.tile.screen.local .tile-expand {
  display: none;
}

.tile-expand svg,
.tile-mute svg,
.tile-hide svg,
.icon-button svg {
  width: 18px;
  height: 18px;
}

.tile:fullscreen {
  border-radius: 0;
  cursor: default;
}

.tile:fullscreen .tile-expand,
.tile:fullscreen .tile-mute {
  top: 16px;
  right: 16px;
  width: 46px;
  height: 46px;
}

.tile:fullscreen .tile-mute {
  right: 70px;
}

.tile:fullscreen .tile-hide {
  display: none;
}

/* A chamada é ao vivo: os controles nativos, com pausa, nunca aparecem. */
.tile video::-webkit-media-controls {
  display: none !important;
}

@container (max-width: 170px) or (max-height: 110px) {
  .tile-expand,
  .tile-mute,
  .tile-hide {
    top: 4px;
    right: 4px;
    width: 28px;
    height: 28px;
  }

  .tile-mute {
    right: 36px;
  }

  .tile-hide {
    right: 68px;
  }

  .tile-expand svg,
  .tile-mute svg,
  .tile-hide svg {
    width: 15px;
    height: 15px;
  }
}

/* Nas miniaturas do celular não cabem três botões. Ocultar segue na lista de pessoas. */
@container (max-width: 100px) {
  .tile-hide {
    display: none;
  }
}

.tile.spot {
  box-shadow: 0 0 0 2px var(--orange);
}

.tile.speaking {
  box-shadow: 0 0 0 3px var(--orange), 0 0 24px rgb(255 138 26 / 0.55);
}

.invite {
  order: 99;
  animation: rise 0.4s var(--ease) backwards;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  padding: 16px;
  border: 2px dashed var(--line);
  border-radius: 18px;
  text-align: center;
  container-type: size;
}

.stage.spotlight .invite {
  grid-row: span var(--invite-rows, 1);
}

/* Se faltar altura, a laranja encolhe antes de cortar o resto. */
.invite-slice {
  flex: 0 1 auto;
  width: 72px;
  height: 72px;
  min-height: 0;
  margin-bottom: 10px;
  animation: spin 30s linear infinite;
}

.invite p {
  color: var(--muted);
  font-size: 14px;
}

.invite .code-chips {
  margin: 14px 0 6px;
  color: var(--ink);
}

.invite .button.primary {
  width: auto;
  height: 44px;
  color: var(--ink);
}

/* No espaço apertado, o que não cabe sai. O código sempre fica à vista. */
@container (max-width: 260px) {
  .invite h2 {
    font-size: 18px;
  }

  .invite .code-chips {
    font-size: 19px;
  }

  .invite .code-chips span {
    width: 28px;
    height: 36px;
    border-radius: 10px;
  }
}

@container (max-height: 230px) {
  .invite-slice {
    display: none;
  }
}

@container (max-height: 180px) {
  .invite .button.primary {
    display: none;
  }
}

@container (max-height: 130px) {
  .invite p {
    display: none;
  }

  .invite .code-chips {
    margin: 6px 0 0;
  }
}

@container (max-height: 100px) {
  .invite h2 {
    font-size: 15px;
    white-space: nowrap;
  }

  .invite .code-chips {
    margin: 0;
    font-size: 17px;
  }

  .invite .code-chips span {
    width: 26px;
    height: 32px;
    border-radius: 9px;
  }
}

@container (max-height: 100px) and (max-width: 290px) {
  .invite h2 {
    display: none;
  }
}

.presenting {
  display: flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  margin: 12px 4px 0;
  padding: 5px 14px;
  border-radius: 999px;
  background: var(--leaf);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.presenting span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
  animation: pulse 1.8s ease-in-out infinite;
}

.controls {
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 12px 0 calc(12px + env(safe-area-inset-bottom));
}

.control {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 92px;
  height: 62px;
  border: 0;
  border-radius: 22px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  transition: background-color 0.2s, transform 0.2s;
}

.control svg {
  width: 22px;
  height: 22px;
}

.control:hover {
  background: #4a2f1a;
}

.control:active {
  transform: scale(0.96);
}

.control.off {
  background: #4a1f15;
  color: #ffb1a3;
}

#people-toggle,
#chat-toggle {
  position: relative;
}

.control.pressed {
  box-shadow: inset 0 0 0 2px var(--orange);
}

.control b {
  position: absolute;
  top: 5px;
  right: 16px;
  display: grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--orange);
  color: var(--ink);
  font-size: 11px;
}

#screen {
  background: var(--orange);
  color: var(--ink);
}

#screen.active {
  background: var(--leaf);
  color: #fff;
}

.control.leave {
  margin-left: 12px;
  background: var(--danger);
  color: #fff;
}

.control.leave:hover {
  background: #ea5244;
}

.side {
  min-width: 0;
  min-height: 0;
  overflow: hidden auto;
  padding: 12px 12px 12px 4px;
  transition: opacity 0.25s ease, visibility 0.25s allow-discrete;
}

.side-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 2px 4px 12px;
}

.brand-small {
  font-size: 18px;
}

.call-time {
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.brand-small .logo {
  width: 30px;
  height: 30px;
}

.code-card {
  position: relative;
  overflow: hidden;
  padding: 14px 16px 16px;
  background: var(--orange);
  border-radius: 22px;
  color: var(--ink);
}

.code-slice {
  position: absolute;
  top: -56px;
  right: -56px;
  width: 130px;
  height: 130px;
  opacity: 0.55;
  pointer-events: none;
}

.code-label {
  position: relative;
  font-size: 13px;
  font-weight: 700;
}

.code-value {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
}

.code-chips {
  display: flex;
  gap: 3px;
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
}

.code-chips span {
  display: grid;
  place-items: center;
  width: 32px;
  height: 40px;
  border-radius: 11px;
  background: var(--cream);
}

.icon-button {
  flex: none;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: var(--ink);
  color: var(--cream);
}

.icon-button:hover {
  background: #5a2c08;
}

.volumes {
  display: grid;
  gap: 12px;
  margin-top: 12px;
  padding: 12px 14px 14px;
  border-radius: 22px;
  background: var(--surface);
}

.volume-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 8px;
  margin: 0;
  color: var(--text);
}

.volume-name {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 700;
}

.volume-name svg {
  flex: none;
  width: 16px;
  height: 16px;
  color: var(--orange);
}

.volume-row output {
  align-self: center;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.volume-row input {
  grid-column: 1 / -1;
  width: 100%;
  height: 20px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  cursor: pointer;
  appearance: none;
}

.volume-row input:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
}

.volume-row input::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(to right, var(--orange) var(--level, 100%), var(--line) var(--level, 100%));
}

.volume-row input::-moz-range-track {
  height: 8px;
  border-radius: 999px;
  background: var(--line);
}

.volume-row input::-moz-range-progress {
  height: 8px;
  border-radius: 999px;
  background: var(--orange);
}

.volume-row input::-webkit-slider-thumb {
  width: 20px;
  height: 20px;
  margin-top: -6px;
  border: 3px solid var(--orange);
  border-radius: 50%;
  background: var(--cream);
  box-shadow: 0 2px 6px rgb(0 0 0 / 0.4);
  appearance: none;
  transition: scale 0.2s var(--ease);
}

.volume-row input::-moz-range-thumb {
  box-sizing: border-box;
  width: 20px;
  height: 20px;
  border: 3px solid var(--orange);
  border-radius: 50%;
  background: var(--cream);
}

.volume-row input:hover::-webkit-slider-thumb,
.volume-row input:active::-webkit-slider-thumb {
  scale: 1.15;
}

.people-title {
  margin: 20px 4px 8px;
  font-size: 14px;
  font-weight: 700;
}

.people-title span {
  font-weight: 500;
  color: var(--muted);
}

.person {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 4px;
  font-size: 14px;
}

.person.speaking .person-fruit {
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--orange);
}

.shortcuts {
  margin: 14px 4px 0;
  color: var(--muted);
  font-size: 12px;
}

.shortcuts kbd {
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--mono);
  font-size: 11px;
}

.person-fruit {
  flex: none;
  transition: box-shadow 0.25s ease;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--fruit, var(--orange));
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

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

.person > svg {
  flex: none;
  width: 16px;
  height: 16px;
  color: var(--muted);
}

.person > svg.alert {
  color: #ff9a8c;
}

.person > svg.on {
  color: var(--orange);
}

.screen-mode {
  display: block;
  margin: 8px 4px 0;
  padding: 5px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
}

.screen-mode:hover {
  border-color: var(--orange);
}

.chat-panel {
  display: none;
  flex-direction: column;
  min-height: 0;
}

.call.chat-open .side {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.call.chat-open .people-panel {
  display: none;
}

.call.chat-open .chat-panel {
  display: flex;
  flex: 1;
}

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

.chat-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0 4px;
  list-style: none;
}

.chat-message {
  margin-top: 10px;
  font-size: 14px;
}

.chat-message:first-child {
  margin-top: 0;
}

.chat-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.chat-head strong {
  overflow: hidden;
  font-size: 13px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.chat-message.mine strong {
  color: var(--orange);
}

.chat-head time {
  flex: none;
  color: var(--muted);
  font-size: 11px;
}

.chat-message p {
  overflow-wrap: anywhere;
}

.chat-form {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.chat-form input {
  height: 42px;
  padding: 0 14px;
  background: var(--surface-2);
  border-color: var(--line);
  border-radius: 14px;
  color: var(--text);
  font-size: 14px;
}

.chat-form input::placeholder {
  color: var(--muted);
}

.chat-form input:hover {
  border-color: var(--muted);
}

.person-hide {
  flex: none;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  transition: background-color 0.2s;
}

.person-hide:hover {
  background: var(--surface-2);
}

.person-hide.off {
  background: var(--orange);
  color: #2a1505;
}

.person-hide svg {
  width: 16px;
  height: 16px;
}

.toast,
.unmute,
.presenting,
.tile-status,
.room-skeleton,
.rooms-empty,
.rooms-total {
  transition: opacity 0.25s ease, translate 0.3s var(--ease), display 0.3s allow-discrete;
}

:is(.toast, .unmute, .presenting, .tile-status, .room-skeleton, .rooms-empty, .rooms-total)[hidden] {
  opacity: 0;
  translate: 0 8px;
}

@starting-style {
  :is(.toast, .unmute, .presenting, .tile-status, .rooms-empty, .rooms-total):not([hidden]) {
    opacity: 0;
    translate: 0 8px;
  }
}

.toast,
.unmute {
  position: fixed;
  left: 50%;
  z-index: 10;
  transform: translateX(-50%);
  max-width: calc(100vw - 32px);
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
}

.toast {
  bottom: calc(92px + env(safe-area-inset-bottom));
  padding: 9px 18px;
  background: var(--cream);
  color: var(--ink);
  box-shadow: 0 10px 30px rgb(0 0 0 / 0.35);
}

.unmute {
  top: 64px;
  padding: 9px 18px;
  border: 0;
  background: var(--orange);
  color: var(--ink);
}

@media (min-width: 861px) {
  .fruit-options {
    grid-template-columns: repeat(13, minmax(0, 1fr));
    gap: 4px 0;
  }

  .fruit-option {
    width: 100%;
    height: auto;
    aspect-ratio: 1;
    padding: 3px;
  }

  /* Largura fixa: ao recolher, o painel desliza para fora em vez de se espremer. */
  .side {
    width: 280px;
  }

  .call.panel-toggled {
    grid-template-columns: minmax(0, 1fr) 0px;
  }

  .call.panel-toggled .side {
    opacity: 0;
    visibility: hidden;
  }
}

/* Notebook: o formulário precisa caber sem rolar. */
@media (min-width: 861px) and (max-height: 860px) {
  h1 {
    margin-top: 14px;
    font-size: 38px;
  }

  .lede {
    margin-top: 8px;
    font-size: 16px;
  }

  .perks {
    margin-top: 10px;
  }

  form {
    margin-top: 16px;
  }

  .join-card {
    margin-top: 16px;
    padding: 10px 14px 12px;
  }

  .join-title {
    margin-bottom: 8px;
  }

  .form-error {
    min-height: 0;
    margin-top: 6px;
  }
}

/* Tela bem baixa: o que apresenta o site sai para o campo do código continuar à vista. */
@media (min-width: 861px) and (max-height: 720px) {
  .lede,
  .perks {
    display: none;
  }
}

@media (max-width: 1080px) {
  .home {
    gap: 48px;
  }

  .giant-slice {
    right: -34vmin;
    opacity: 0.9;
  }
}

@media (max-width: 860px) {
  .home {
    grid-template-columns: minmax(0, 480px);
    gap: 32px;
    align-content: start;
  }

  .giant-slice {
    top: -130px;
    right: -130px;
    width: 300px;
    height: 300px;
    margin-top: 0;
    opacity: 1;
  }

  h1 {
    margin-top: 64px;
  }

  .call {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
  }

  .side {
    grid-row: 1;
    padding: 8px 12px 0;
    overflow: visible;
  }

  .side-header,
  .code-slice,
  .shortcuts {
    display: none;
  }

  .people-panel {
    display: none;
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(86px + env(safe-area-inset-bottom));
    z-index: 5;
    max-height: 50dvh;
    overflow-y: auto;
    padding: 4px 10px 10px;
    border-radius: 22px;
    background: var(--surface-2);
    box-shadow: 0 16px 40px rgb(0 0 0 / 0.5);
    opacity: 0;
    translate: 0 12px;
    transition: opacity 0.25s ease, translate 0.3s var(--ease), display 0.3s allow-discrete;
  }

  .call.panel-toggled .people-panel {
    display: block;
    opacity: 1;
    translate: 0;
  }

  @starting-style {
    .call.panel-toggled .people-panel {
      opacity: 0;
      translate: 0 12px;
    }
  }

  .people-title {
    margin-top: 12px;
  }

  .call.chat-open .side {
    display: block;
    overflow: visible;
  }

  .chat-panel {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(86px + env(safe-area-inset-bottom));
    z-index: 5;
    height: 55dvh;
    padding: 4px 10px 10px;
    border-radius: 22px;
    background: var(--surface-2);
    box-shadow: 0 16px 40px rgb(0 0 0 / 0.5);
  }

  .chat-form input {
    background: var(--surface);
  }

  .invite-slice {
    width: 56px;
    height: 56px;
  }

  .code-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 6px 8px 6px 14px;
    border-radius: 18px;
  }

  .code-value {
    margin-top: 0;
  }

  .code-value .code-chips {
    font-size: 17px;
  }

  .code-value .code-chips span {
    width: 26px;
    height: 32px;
    border-radius: 9px;
  }

  .main {
    padding-top: 8px;
  }

  .stage.spotlight {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    grid-template-rows: minmax(0, 1fr) repeat(var(--phone-rows, 1), 72px);
  }

  .stage.spotlight .tile.spot {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  /* Na faixa de baixo, o convite vira uma tira com o código ao lado do título. */
  .stage.spotlight .invite {
    grid-row: auto;
    grid-column: span var(--invite-cols, 1);
    flex-direction: row;
    gap: 12px;
    padding: 6px 12px;
    border-radius: 14px;
  }

  /* No celular em pé, as duas telas ficam uma sobre a outra. */
  .stage.spotlight.duo {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr)) repeat(var(--phone-rows, 1), 72px);
  }

  .stage.spotlight.duo.no-strip {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: repeat(2, minmax(0, 1fr));
  }

  .stage.spotlight .tile.spot.spot-second {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .controls {
    gap: 6px;
  }

  .control {
    flex: 1;
    width: auto;
    min-width: 0;
    max-width: 92px;
    font-size: 11px;
  }

  .control b {
    right: 8px;
  }

  .control.leave {
    margin-left: 0;
  }
}

/* Sete botões não cabem com texto em telas estreitas. */
@media (max-width: 560px) {
  .control span {
    display: none;
  }

  .control {
    height: 50px;
    border-radius: 18px;
  }

  .control b {
    top: 2px;
    right: 2px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
