/* Visual preto e branco: fonte do sistema, cinzas neutros, cards arredondados e pills. */

:root {
  --preto: #000;
  --branco: #fff;
  --off-white: #f5f5f7;
  --cinza: #86868b;
  --card: #161617;
  --card-2: #1d1d1f;
  --trilho: #2c2c2e;
  --linha-suave: rgba(255, 255, 255, 0.08);

  --r-card: 28px;
  --r-bloco: 22px;
  --r-pill: 980px;
  --painel: 380px;

  --sf: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', system-ui, 'Segoe UI', Roboto,
    'Helvetica Neue', Helvetica, Arial, sans-serif;
  --ease-apple: cubic-bezier(0.32, 0.72, 0, 1);
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--preto);
  color: var(--off-white);
  font: 15px/1.47 var(--sf);
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--off-white); color: var(--preto); }

/* ---- topo ---- */

.topo {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 52px;
  padding: 0 24px;
  background: rgb(0 0 0 / 0.72);
  backdrop-filter: saturate(1.8) blur(20px);
  -webkit-backdrop-filter: saturate(1.8) blur(20px);
  border-bottom: 1px solid var(--linha-suave);
}

.topo h1 {
  flex: none;
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.015em;
  white-space: nowrap;
}

.desempenho {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: var(--cinza);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---- layout ---- */

.layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--painel);
  grid-template-rows: minmax(0, 1fr);
}

.palco {
  position: relative;
  min-height: 0;
  padding: 24px;
  display: grid;
  place-items: center;
  container-type: size;
}

/* Cabe inteira no palco mantendo a proporção do vídeo (definida pelo JS em --proporcao). */
.moldura {
  --proporcao: 16 / 9;
  position: relative;
  width: min(100cqw, 100cqh * var(--proporcao));
  aspect-ratio: var(--proporcao);
  overflow: hidden;
  border-radius: var(--r-card);
  background: var(--card);
  box-shadow: 0 0 0 1px var(--linha-suave);
}

.moldura video,
.moldura canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.moldura video { object-fit: cover; }
.moldura.espelhado video { transform: scaleX(-1); }

/* ---- aviso (carregamento / erro) ---- */

.aviso {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgb(0 0 0 / 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.aviso[hidden] { display: none; }

.aviso-caixa {
  width: min(440px, 100%);
  padding: 32px 28px;
  border-radius: var(--r-card);
  background: var(--card);
  box-shadow: 0 0 0 1px var(--linha-suave);
  text-align: center;
}

.aviso-titulo {
  margin: 0 0 18px;
  font-size: 21px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

.aviso-detalhe {
  margin: 14px 0 0;
  color: var(--cinza);
  font-size: 14px;
}

.aviso-detalhe:empty { display: none; }

.aviso progress {
  width: 100%;
  height: 4px;
  appearance: none;
  border: 0;
  border-radius: var(--r-pill);
  overflow: hidden;
  background: var(--trilho);
}

.aviso progress::-webkit-progress-bar { background: var(--trilho); }
.aviso progress::-webkit-progress-value { background: var(--off-white); transition: width 0.4s var(--ease-apple); }
.aviso progress::-moz-progress-bar { background: var(--off-white); }
.aviso progress[hidden] { display: none; }

/* botão pill branco */
.aviso button {
  margin-top: 4px;
  padding: 12px 26px;
  border: 0;
  border-radius: var(--r-pill);
  background: var(--branco);
  color: var(--preto);
  font: 500 17px/1 var(--sf);
  cursor: pointer;
  transition: opacity 0.2s ease, transform 0.2s var(--ease-apple);
}

.aviso button:hover { opacity: 0.86; }
.aviso button:active { transform: scale(0.98); }
.aviso button:focus-visible { outline: 2px solid var(--off-white); outline-offset: 3px; }
.aviso button[hidden] { display: none; }

/* ---- painel ---- */

.painel {
  min-height: 0;
  overflow-y: auto;
  padding: 24px 24px 24px 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: thin;
  scrollbar-color: var(--trilho) transparent;
}

.bloco {
  padding: 18px 20px;
  border-radius: var(--r-bloco);
  background: var(--card);
}

.bloco h2 {
  margin: 0 0 10px;
  color: var(--cinza);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0;
}

/* a frase principal em branco, o resto em cinza */
.resumo {
  margin: 0;
  min-height: 2.6em;
  color: var(--cinza);
  font-size: 19px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.015em;
}

.resumo strong { color: var(--off-white); font-weight: inherit; }

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

.vazio { color: var(--cinza); font-size: 14px; }

.item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px 40px;
  align-items: center;
  gap: 12px;
  font-variant-numeric: tabular-nums;
}

.item-nome {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-nome::before {
  content: '';
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cor-item);
}

.item.pessoa { --cor-item: var(--off-white); }
.item.objeto { --cor-item: var(--cinza); }

.barra {
  height: 4px;
  overflow: hidden;
  border-radius: var(--r-pill);
  background: var(--trilho);
}

.barra-preenchimento {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--cor-item);
  transition: width 0.3s var(--ease-apple);
}

.item-valor {
  color: var(--cinza);
  font-size: 13px;
  text-align: right;
}

.rosto {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border-radius: 16px;
  background: var(--card-2);
}

.rosto-emoji {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--trilho);
  font-size: 22px;
  line-height: 1;
}

.rosto-dados {
  display: grid;
  font-size: 14px;
}

.rosto-dados strong { font-weight: 600; }
.rosto-dados span { color: var(--cinza); }

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

.controles { display: grid; gap: 14px; }
.controles h2 { margin-bottom: 0; }

.campo {
  display: grid;
  gap: 8px;
  font-size: 14px;
}

.campo > span {
  display: flex;
  justify-content: space-between;
  color: var(--cinza);
}

.campo output { color: var(--off-white); font-variant-numeric: tabular-nums; }

select {
  width: 100%;
  padding: 10px 36px 10px 14px;
  appearance: none;
  border: 1px solid var(--linha-suave);
  border-radius: 12px;
  background: var(--card-2)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%2386868b' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
    no-repeat right 14px center / 12px;
  color: var(--off-white);
  font: inherit;
  font-size: 15px;
  cursor: pointer;
}

select:disabled { opacity: 0.5; cursor: default; }
select:focus-visible { outline: 2px solid var(--off-white); outline-offset: 2px; }

input[type='range'] { width: 100%; margin: 4px 0; accent-color: var(--off-white); }

/* interruptor no estilo Apple, em preto e branco */
.opcao {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 15px;
  cursor: pointer;
}

.chave {
  position: relative;
  flex: none;
  width: 44px;
  height: 26px;
  margin: 0;
  appearance: none;
  border-radius: var(--r-pill);
  background: var(--trilho);
  cursor: pointer;
  transition: background 0.25s var(--ease-apple);
}

.chave::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--off-white);
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.4);
  transition: transform 0.25s var(--ease-apple), background 0.25s var(--ease-apple);
}

.chave:checked { background: var(--off-white); }
.chave:checked::after { transform: translateX(18px); background: var(--preto); }
.chave:focus-visible { outline: 2px solid var(--off-white); outline-offset: 2px; }
.chave:disabled { opacity: 0.4; cursor: not-allowed; }

/* ---- telas estreitas: vídeo em cima, painel embaixo ---- */

@media (max-width: 860px) {
  body { height: auto; min-height: 100dvh; }
  .layout { grid-template-columns: 1fr; grid-template-rows: auto auto; }
  /* aqui o palco acompanha a altura do vídeo, sem faixas pretas; vídeo em pé fica limitado a 70% da tela */
  .palco { padding: 16px; container-type: inline-size; }
  .moldura { width: min(100cqw, 70dvh * var(--proporcao)); border-radius: var(--r-bloco); }
  .painel { padding: 0 16px 24px; overflow: visible; }
  .topo { padding: 0 16px; }
}

@media (max-width: 520px) {
  .desempenho { font-size: 11px; }
}
