* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #000;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  color: #111827;
}

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

/* Camadas de vídeo para alternância suave (Dual-Buffer) */
.video-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease-in-out;
  background: #000;
}

.video-layer.active {
  opacity: 1;
  pointer-events: auto;
}

/* Cortina de transição leve entre comerciais */
.transition-curtain {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at center, rgba(15, 23, 42, 0.6) 0%, rgba(2, 6, 23, 0.9) 100%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 5;
}

.transition-curtain.flash {
  opacity: 1;
}

/* Tela de Fallback / Standby (Previne tela preta em caso de falha de mídia) */
.fallback-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 50%, #f3f4f6 100%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
  z-index: 10;
  text-align: center;
  padding: 20px;
}

.fallback-screen.active {
  opacity: 1;
  pointer-events: auto;
}

.brand-badge {
  font-size: 3.2rem;
  font-weight: 800;
  letter-spacing: 2px;
  text-align: center;
  margin-bottom: 24px;
  color: #ffffff;
  -webkit-text-stroke: 0.5px rgba(0, 0, 0, 0.4);
  text-shadow: 
    0px 1px 2px rgba(0, 0, 0, 0.5),
    0 0 10px #facc15,
    0 0 20px #facc15,
    0 0 35px #eab308;
}

.spinner {
  width: 44px;
  height: 44px;
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-top-color: #111827;
  text-shadow: 2px 2px 0px #facc15;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 20px;
}

.fallback-screen:not(.active) .spinner {
  animation: none; /* Mata a animação quando invisível para economizar CPU */
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.fallback-screen h2 {
  font-size: 1.4rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: #111827;
}

.fallback-screen p {
  font-size: 0.95rem;
  color: #4b5563;
  max-width: 420px;
}

/* HUD / Barra de Status superior */
.hud-bar {
  position: absolute;
  top: 12px;
  left: 16px;
  right: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(240, 240, 240, 0.95);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  padding: 8px 16px;
  border-radius: 9999px;
  font-size: 0.8rem;
  color: #111827;
  z-index: 20;
  transition: opacity 0.4s ease, transform 0.4s ease;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-20px);
}

.hud-bar.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.hud-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dot-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
}

.dot-indicator.offline {
  background: #ef4444;
}

.dot-indicator.syncing {
  background: #f59e0b;
}

/* Modal de Configuração do Dispositivo */
.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  padding: 32px;
  width: 90%;
  max-width: 440px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
  text-align: center;
}

.modal-card h2 {
  font-size: 1.5rem;
  margin-bottom: 12px;
  color: #111827;
}

.modal-card p {
  font-size: 0.95rem;
  color: #4b5563;
  margin-bottom: 24px;
}

.modal-card input {
  width: 100%;
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid #d1d5db;
  background: #ffffff;
  color: #111827;
  font-size: 1.1rem;
  text-align: center;
  margin-bottom: 20px;
  outline: none;
}

.modal-card input:focus {
  border-color: #eab308;
  box-shadow: 0 0 0 3px rgba(234, 179, 8, 0.15);
  outline: none;
}

.btn-primary {
  width: 100%;
  padding: 12px;
  background: #eab308;
  color: #111827;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease;
}

.btn-primary:hover {
  background: #ca8a04;
}

/* Botão Flutuante */
.btn-floating {
  position: absolute;
  bottom: 16px;
  right: 16px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #111827;
  font-size: 1.1rem;
  cursor: pointer;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.3s;
  opacity: 0.3;
}

.btn-floating:hover {
  opacity: 1;
  background: #facc15;
  color: #111827;
  border-color: #facc15;
}
