/* ==========================================================================
   Layout do ecrã de projecção (16:9) — votação ao vivo.
   Tamanhos em vw/vh para escalar com o projector.
   ========================================================================== */

body.layout-ecra {
  margin: 0;
  min-height: 100vh;
  overflow: hidden;
  color: #fff;
  background:
    var(--te-art) 50% 205% / 110% auto no-repeat,
    var(--night-glow),
    var(--night);
}
.e-track { background: rgba(255, 255, 255, 0.08) !important; }
.e-track span { background: linear-gradient(90deg, #5b84ff, #285aff) !important; box-shadow: 0 0 20px rgba(40, 90, 255, 0.5); }
.e-row.is-winner .e-track span { background: var(--te-gradient) !important; box-shadow: 0 0 24px rgba(255, 120, 0, 0.6); }

.e-shell {
  display: grid;
  grid-template-columns: 1fr minmax(240px, 24vw);
  gap: 4vw;
  min-height: 100vh;
  padding: 5vh 5vw 12vh;
}

.e-top { display: flex; align-items: center; gap: 1.2vw; font-size: clamp(12px, 1.1vw, 20px); color: #b9c4da; }
.e-top .brand-logo { height: clamp(40px, 4.5vw, 72px); width: auto; padding: 6px 10px; border-radius: 12px; background: #fff; }
.e-top .live { margin-left: auto; }
.live { display: inline-flex; align-items: center; gap: 8px; padding: 4px 14px; border-radius: 999px; background: rgba(255, 255, 255, 0.12); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: #fff; }
.live::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--te-red); animation: pulse 1.4s ease-in-out infinite; }
.live.is-closed::before { background: #8c98b0; animation: none; }
@keyframes pulse { 50% { opacity: 0.3; } }

.e-title { margin-top: 4vh; }
.e-title p { font-size: clamp(14px, 1.3vw, 24px); color: #b9c4da; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.e-title h1 { margin-top: 1vh; font-size: clamp(32px, 4.2vw, 84px); line-height: 1.05; color: #fff; }

/* Barras de resultados */
.e-bars { display: grid; gap: 3.2vh; margin-top: 6vh; }
.e-row-top { display: flex; align-items: baseline; gap: 1vw; font-size: clamp(16px, 1.7vw, 32px); }
.e-row-top strong { font-weight: 650; }
.e-row-top span { color: #8c98b0; font-size: 0.7em; }
.e-row-top .e-pct { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; color: #fff; font-size: 1em; }
.e-track { height: clamp(14px, 2.2vh, 28px); margin-top: 1.2vh; border-radius: 999px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.e-track span { display: block; height: 100%; border-radius: 999px; background: #4f7bff; transition: width 0.8s ease; }
.e-row.is-winner .e-track span { background: var(--te-red); }

/* Modo resultados ocultos */
.is-hidden-results .e-track span { width: 0 !important; }
.is-hidden-results .e-pct { visibility: hidden; }
.e-hidden-msg { margin-top: 5vh; font-size: clamp(16px, 1.6vw, 30px); color: #b9c4da; }

/* Vencedor */
.e-winner { margin-top: 6vh; }
.e-winner .avatar-xl {
  display: grid;
  place-items: center;
  width: clamp(96px, 11vw, 200px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--te-gradient);
  font-size: clamp(36px, 4vw, 76px);
  font-weight: 700;
  box-shadow: 0 0 0 10px rgba(237, 0, 0, 0.18);
}
.e-winner h2 { margin-top: 4vh; font-size: clamp(36px, 5vw, 96px); line-height: 1; }
.e-winner p { margin-top: 1.5vh; font-size: clamp(16px, 1.8vw, 34px); color: #b9c4da; }

/* Coluna lateral: QR e total */
.e-side { display: flex; flex-direction: column; justify-content: center; gap: 4vh; }
.e-qr { padding: 1.4vw; border-radius: 1.2vw; background: #fff; }
.e-qr svg { width: 100%; height: auto; }
.e-side p { font-size: clamp(14px, 1.3vw, 24px); color: #b9c4da; text-align: center; }
.e-side p strong { color: #fff; }
.e-total { text-align: center; }
.e-total strong { display: block; font-size: clamp(36px, 4.5vw, 88px); font-variant-numeric: tabular-nums; line-height: 1; }
.e-total span { font-size: clamp(12px, 1.1vw, 20px); color: #8c98b0; }

/* Barra do operador (discreta, para a régie) */
.e-ops {
  position: fixed;
  left: 50%;
  bottom: 2.5vh;
  display: flex;
  gap: 6px;
  padding: 6px;
  transform: translateX(-50%);
  border-radius: 12px;
  background: rgba(17, 23, 26, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.1);
  opacity: 0.35;
  transition: opacity 0.2s;
}
.e-ops:hover, .e-ops:focus-within { opacity: 1; }
.e-ops button {
  padding: 8px 14px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #c9d2e3;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.e-ops button[aria-pressed="true"] { background: var(--te-red); color: #fff; }
.e-ops kbd { margin-left: 6px; padding: 0 5px; border-radius: 4px; background: rgba(255, 255, 255, 0.12); font-size: 11px; font-family: inherit; }

@media (max-width: 800px) {
  body.layout-ecra { overflow: auto; }
  .e-shell { grid-template-columns: 1fr; padding-bottom: 16vh; }
  .e-side { flex-direction: row; align-items: center; }
  .e-qr { width: 120px; }
}
@media (prefers-reduced-motion: reduce) {
  .live::before { animation: none; }
  .e-track span { transition: none; }
}

/* ---- Revelação do vencedor ------------------------------------------------ */
.e-suspense {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: grid;
  place-content: center;
  gap: 2vh;
  text-align: center;
  background: radial-gradient(circle at 50% 50%, rgba(18, 24, 40, 0.75), rgba(11, 15, 26, 0.96) 70%);
  backdrop-filter: blur(10px);
  animation: suspense-in 0.4s ease-out;
}
.e-suspense p { font-family: var(--font-display); font-size: clamp(24px, 3.2vw, 60px); font-weight: 800; color: #fff; letter-spacing: -0.02em; }
.e-suspense strong {
  font-family: var(--font-display);
  font-size: clamp(120px, 18vw, 320px);
  font-weight: 800;
  line-height: 1;
  background: var(--te-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: numero 1s ease-out;
}
.e-suspense.is-out { animation: suspense-out 0.5s ease-in forwards; }
@keyframes suspense-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes suspense-out { to { opacity: 0; transform: scale(1.05); } }
@keyframes numero { 0% { transform: scale(1.6); opacity: 0; filter: blur(8px); } 30% { transform: scale(1); opacity: 1; filter: none; } 100% { transform: scale(0.92); opacity: 0.85; } }

.e-winner.reveal .avatar-xl { animation: coroa 1s var(--ease) both; box-shadow: 0 0 0 10px rgba(237, 0, 0, 0.18), 0 0 80px rgba(255, 140, 0, 0.6); }
.e-winner.reveal h2 { animation: rise 0.8s var(--ease) 0.25s both; }
.e-winner.reveal p { animation: rise 0.8s var(--ease) 0.45s both; }
@keyframes coroa { 0% { transform: scale(0.3) rotate(-20deg); opacity: 0; } 60% { transform: scale(1.12) rotate(4deg); opacity: 1; } 100% { transform: none; } }
