:root {
  --fundo: #f3f1ec;
  --cartao: #ffffff;
  --texto: #1d1d1b;
  --suave: #5c5a55;
  --verde: #658E4A;
  --vermelho: #A94442;
  --destaque: #F8BC3B;
  --gap: 16px;
  --cuco-verde: #B2CA4A;
  --cuco-laranja: #F8BC3B;
  --cuco-magenta: #C12160;
  --cuco-azul: #3990CB;
  --rodape: 12px;
  color-scheme: light;
}

* { box-sizing: border-box; margin: 0; }

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--fundo);
  color: var(--texto);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* 3% de margem: algumas TVs cortam as bordas da imagem. */
#ecra {
  position: absolute;
  inset: 3vh calc(3vw + var(--rodape) + var(--gap) * 3);
  display: flex;
}

.grelha {
  --w: 200px;
  --fh: 200px;
  margin: auto;
  display: grid;
  grid-template-columns: repeat(var(--colunas, 1), var(--w));
  gap: var(--gap);
}

/* Cartão: foto (entre quadrada e 1,5 × mais larga do que alta), faixa de estado, nome e hora. */
.cartao {
  width: var(--w);
  height: calc(var(--fh) + var(--w) * 0.43);
  background: var(--cartao);
  border-radius: calc(var(--w) * 0.05);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  outline: 0 solid var(--destaque);
  transition: opacity 0.4s, outline-width 0.4s;
}

.cartao.chegou { outline-width: calc(var(--w) * 0.04); outline-offset: -2px; }
.cartao.saiu { opacity: 0; }

.foto {
  width: var(--w);
  height: var(--fh);
  flex: none;
  object-fit: cover;
  object-position: center;
  display: block;
  background: #dcd8cf;
}

.iniciais {
  display: grid;
  place-items: center;
  font-size: calc(var(--w) * 0.36);
  font-weight: 700;
  color: var(--suave);
}

.faixa { height: calc(var(--w) * 0.045); flex: none; background: var(--verde); }
.vermelho .faixa { background: var(--vermelho); }

.texto {
  flex: 1;
  min-height: 0;
  padding: calc(var(--w) * 0.03) calc(var(--w) * 0.05) 0;
  display: flex;
  flex-direction: column;
  gap: calc(var(--w) * 0.01);
}

.nome {
  font-size: calc(var(--w) * 0.104);
  font-weight: 700;
  line-height: 1.1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.vermelho .nome { -webkit-line-clamp: 1; }

.hora {
  font-size: calc(var(--w) * 0.094);
  font-weight: 700;
  line-height: 1.15;
  color: var(--suave);
}

/* Barras com as quatro cores do colégio, à esquerda e à direita, dentro da margem de segurança. */
.cores {
  position: fixed;
  top: 3vh;
  bottom: 3vh;
  width: var(--rodape);
  border-radius: calc(var(--rodape) / 2);
  overflow: hidden;
  display: grid;
  grid-template-rows: repeat(4, 1fr);
}

.cores.esquerda { left: 3vw; }
.cores.direita { right: 3vw; }

.cores i:nth-child(1) { background: var(--cuco-verde); }
.cores i:nth-child(2) { background: var(--cuco-laranja); }
.cores i:nth-child(3) { background: var(--cuco-magenta); }
.cores i:nth-child(4) { background: var(--cuco-azul); }

.vazio, .mensagem {
  margin: auto;
  font-size: 32px;
  color: var(--suave);
}

#aviso {
  position: fixed;
  right: calc(3vw + var(--rodape) + var(--gap) * 3);
  bottom: 3vh;
  padding: 6px 14px;
  border-radius: 8px;
  background: var(--vermelho);
  color: #fff;
  font-size: 18px;
  font-weight: 700;
}
