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

:root { --k: 1; }

/* Tela do totem (vertical 1080×1920+): textos e selo crescem na mesma proporção
   do modo foto — lidos a ~1 m de distância. */
@media (min-width: 900px) and (min-height: 1400px) {
  :root { --k: 1.7; }
  html { font-size: calc(16px * 1.7); }
}

html,
body {
  width: 100%;
  height: 100%;
  background: #000;
  overflow: hidden;
  font-family: Arial, Helvetica, sans-serif;
}

#media-player {
  position: relative;
  width: 100vw;
  height: 100vh;
  background: #000;
  overflow: hidden;
}

.media-item {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center center;
  background: #000;
  opacity: 0;
  visibility: hidden;
  transform: scale(1.01);
  transition: opacity 1s ease, transform 1.2s ease, visibility 1s ease;
}

.media-item.active {
  opacity: 1;
  visibility: visible;
  transform: scale(1);
}

body.no-transition .media-item {
  transition: none !important;
  transform: scale(1) !important;
}

/* ── Estado vazio / manutenção (B1) ─────────────────────────────────────────── */
#empty-message {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  gap: 0.6rem;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
  color: #888;
  background: #000;
  font-size: 1.1rem;
  line-height: 1.5;
  transition: background 0.6s;
}

#empty-message.active { display: flex; }

/* Ícone grande */
.empty-icon {
  font-size: 3.5rem;
  line-height: 1;
  margin-bottom: 0.4rem;
  color: var(--tenant-primary, #ffd60a);
}
.empty-icon:empty { display: none; }

/* Título */
#empty-title {
  color: #f3f4f6;
  font-family: "Barlow Condensed", "Barlow", sans-serif;
  font-size: 2.2rem;
  letter-spacing: 0.02em;
  font-weight: 700;
}

/* Subtítulo */
#empty-subtitle {
  color: #a9afba;
  font-size: 1rem;
  max-width: calc(480px * var(--k));
}

/* Countdown do retry */
.empty-countdown {
  color: #555;
  font-size: 0.85rem;
  margin-top: 0.8rem;
  font-variant-numeric: tabular-nums;
  min-height: 1.2em;
}

/* Estado: servidor indisponível — fundo levemente âmbar */
#empty-message[data-state="server-down"] {
  background: #0a0800;
}

#empty-message[data-state="server-down"] .empty-icon {
  animation: pulse-icon 2s ease-in-out infinite;
}

@keyframes pulse-icon {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.55; transform: scale(0.92); }
}

#media-image,
#media-video {
  will-change: opacity, transform;
}

#attention-feed {
  position: fixed;
  right: 0;
  bottom: 0;
  width: calc(1px * var(--k));
  height: calc(1px * var(--k));
  opacity: 0;
  pointer-events: none;
}

/* ── Pílula de atenção (Urban Market) ───────────────────────────────────── */
:root {
  --attn-yellow: #f2c500;
  --attn-black: #050505;
}

#attention-panel {
  position: fixed;
  left: 50%;
  bottom: max(1.6rem, 5vh);   /* acima da faixa que TVs com overscan escondem */
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  width: min(92vw, calc(460px * var(--k)));
  padding: 0.95rem 1.25rem;
  color: #fff;
  background: rgba(5, 5, 5, 0.82);
  border: calc(1px * var(--k)) solid rgba(242, 197, 0, 0.30);
  border-radius: calc(22px * var(--k));
  box-shadow:
    0 18px 50px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(calc(14px * var(--k)));
  transform: translateX(-50%);
  pointer-events: none;
  opacity: 0;
  animation: attn-in 0.5s ease forwards;
}

@keyframes attn-in {
  from { opacity: 0; transform: translate(-50%, calc(14px * var(--k))); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* Realce da borda conforme o engajamento aumenta */
#attention-panel[data-state="watching"] {
  border-color: rgba(242, 197, 0, 0.6);
  box-shadow:
    0 18px 50px rgba(0, 0, 0, 0.5),
    0 0 28px rgba(242, 197, 0, 0.22);
}

#attention-panel[data-state="locked"] {
  border-color: var(--attn-yellow);
  box-shadow:
    0 18px 50px rgba(0, 0, 0, 0.5),
    0 0 38px rgba(242, 197, 0, 0.4);
}

#attention-panel[data-state="error"] {
  border-color: rgba(255, 255, 255, 0.22);
}

.attention-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  min-width: 0;
}

/* Ponto pulsante reativo (o "olho" da experiência) */
#attention-dot {
  flex: 0 0 auto;
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 50%;
  background: #888;
  box-shadow: 0 0 0 calc(4px * var(--k)) rgba(255, 255, 255, 0.06);
  transition: background 0.25s ease, box-shadow 0.25s ease;
}

#attention-panel[data-state="idle"] #attention-dot,
#attention-panel[data-state="cooldown"] #attention-dot {
  background: #888;
}

#attention-panel[data-state="searching"] #attention-dot {
  background: var(--attn-yellow);
  animation: attn-pulse 1.4s ease-in-out infinite;
}

#attention-panel[data-state="watching"] #attention-dot {
  background: var(--attn-yellow);
  box-shadow: 0 0 0 calc(4px * var(--k)) rgba(242, 197, 0, 0.18);
  animation: attn-pulse 0.8s ease-in-out infinite;
}

#attention-panel[data-state="locked"] #attention-dot {
  background: var(--attn-yellow);
  box-shadow: 0 0 calc(14px * var(--k)) rgba(242, 197, 0, 0.9);
}

#attention-panel[data-state="error"] #attention-dot {
  background: #888;
}

@keyframes attn-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%      { transform: scale(1.35); opacity: 0.75; }
}

#attention-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 1.02rem;
  font-weight: 800;
  letter-spacing: 0.01em;
}

#attention-panel[data-state="locked"] #attention-label {
  color: var(--attn-yellow);
}

/* Detalhe técnico fica oculto para o público; só aparece em modo debug. */
#attention-detail {
  display: none;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.72rem;
  line-height: 1;
  text-align: center;
}

body.attention-debug #attention-detail {
  display: block;
}

.attention-progress {
  overflow: hidden;
  width: 100%;
  height: 0.4rem;
  background: rgba(255, 255, 255, 0.12);
  border-radius: calc(999px * var(--k));
}

#attention-progress-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #e0b700, var(--attn-yellow));
  border-radius: inherit;
  box-shadow: 0 0 calc(12px * var(--k)) rgba(242, 197, 0, 0.45);
  transition: width 0.16s linear;
}

@media (max-width: 520px) {
  #attention-panel {
    bottom: max(1rem, 4vh);
    padding: 0.8rem 1rem;
    border-radius: calc(18px * var(--k));
  }

  #attention-label {
    font-size: 0.9rem;
  }
}

/* O JS oculta o selo em falha de câmera (só aparece com ?debug=1) */
#attention-panel[hidden] { display: none !important; }
