#video-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
#video-bg iframe {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 120vw;
  height: 67.5vw;
  min-width: 100vw;
  min-height: 100vh;
  transform: translate(-50%, -50%);
  object-fit: cover;
  filter: grayscale(1) brightness(0.7);
  opacity: 1;
  border: none;
  pointer-events: none;
  background: black;
  overflow: hidden;
}
#video-bg::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 2;
  background: linear-gradient(120deg, #FFD700 0%, #FFC300 40%, #FFB300 70%, #FFF8DC 100%);
  opacity: 0.4;
  mix-blend-mode: lighten;
}

html, body {
  height: 100vh;
  width: 100vw;
  margin: 0;
  padding: 0;
  overflow: hidden;
}
body {
  font-family: Arial, sans-serif;
  background: transparent !important;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  height: 100vh;
  width: 100vw;
  position: relative;
  z-index: 1;
}
#main-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100vw;
  height: 100vh;
}
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: none;
  opacity: 0;
  z-index: 0;
  pointer-events: none;
}

h1 {
  margin-top: 40px;
  margin-bottom: 30px;
  font-size: 2.8em;
  z-index: 1;
}
.titulo {
  color: white;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 3.5em;
  text-align: center;
  width: 100%;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

.grid {
  display: grid;
  grid-template-columns: repeat(4, 300px);
  grid-gap: 48px;
  margin-bottom: 40px;
  z-index: 1;
}
.player {
  position: relative;
  cursor: pointer;
  border-radius: 22px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  transition: box-shadow 0.2s, outline 0.3s cubic-bezier(0.4,0.2,0.2,1);
  background: #fff;
  z-index: 1;
  outline: 0px solid #ffd000;
}
.player.selected {
  box-shadow: 0 8px 32px rgba(0,0,0,0.22);
  outline: 5px solid #ffd000;
}
.player:hover {
  outline: 5px solid #ffd000;
  box-shadow: 0 8px 32px rgba(0,123,255,0.18);
}
.player.selected:hover {
  outline: 5px solid #ffd000;
  box-shadow: 0 8px 32px rgba(0,123,255,0.22);
}
.player img {
  width: 300px;
  height: 300px;
  object-fit: cover;
  display: block;
}
.vote-number {
  position: absolute;
  top: 20px;
  left: 20px;
  background: #ffd000;
  color: #fff;
  font-weight: bold;
  border-radius: 50%;
  width: 70px;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.4em;
  box-shadow: 0 4px 12px rgba(0,0,0,0.18);
  z-index: 2;
}
.buttons {
  margin-bottom: 30px;
  display: flex;
  gap: 20px;
  z-index: 1;
  justify-content: center;
  align-items: center;
  width: 100%;
}
button {
  padding: 10px 24px;
  font-family: 'Quicksand', Arial, sans-serif;
  font-size: 1.1em;
  border: none;
  border-radius: 8px;
  background: #bd9a00;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.438);
  transition: background 0.2s;
}
button:disabled {
  background: #aaa;
  cursor: not-allowed;
}
.success-message {
  background: #fff8dc;
  color: #bfa100;
  padding: 32px 60px;
  border-radius: 18px;
  margin-top: 30px;
  font-size: 2em;
  display: none;
  z-index: 10;
  font-family: 'Bebas Neue', Arial, sans-serif;
  font-weight: bold;
  box-shadow: 0 4px 32px rgba(0,0,0,0.18);
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  min-width: 500px;
}
.success-title {
  font-size: 3.2em;
  font-family: 'Bebas Neue', Arial, sans-serif;
  color: #bfa100;
  margin-bottom: 18px;
  letter-spacing: 2px;
  text-shadow: 0 2px 8px #fff8dc, 0 2px 16px #bfa10044;
  white-space: nowrap;
}
.success-sub {
  font-family: 'Quicksand', Arial, sans-serif;
  font-size: 1.3em;
  color: #bfa100;
  margin-top: 10px;
  font-weight: 400;
  text-align: center;
  letter-spacing: 0.5px;
}
.player-name {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 2em;
  font-family: 'Bebas Neue', Arial, sans-serif;
  background: rgba(0,0,0,0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.4,0.2,0.2,1);
  z-index: 3;
  text-shadow: 0 2px 8px #000;
  letter-spacing: 1px;
}
.player:hover .player-name {
  opacity: 1;
}

.hide-on-success {
  display: none !important;
}

.explicacion {
  font-family: 'Quicksand', Arial, sans-serif;
  font-size: 1.3em;
  color: #ffffff;
  text-align: center;
  margin-bottom: 18px;
  margin-top: -38px;
  letter-spacing: 0.5px;
  font-weight: 400;
  text-shadow: 0 2px 8px #000;
}

.player.not-selected {
  pointer-events: none;
  cursor: default !important;
}
.player::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0);
  z-index: 4;
  border-radius: 22px;
  pointer-events: none;
  transition: background 0.4s;
}
.player.not-selected::after {
  background: rgba(0,0,0,0.5);
}
.player.not-selected .player-name {
  opacity: 0 !important;
}
.player.not-selected:hover {
  outline: none !important;
  box-shadow: none !important;
}
.balon-icono {
  height: 1.1em;
  vertical-align: middle;
  margin: 0 0.25em;
}
.auth-message {
  font-family: 'Quicksand', Arial, sans-serif;
}

#notification-container {
  position: fixed;
  top: 30px;
  right: 30px;
  z-index: 2000;
  pointer-events: none;
}

.notification {
  min-width: 280px;
  max-width: 400px;
  margin-bottom: 16px;
  padding: 18px 32px;
  border-radius: 12px;
  font-family: 'Quicksand', Arial, sans-serif;
  font-size: 1.2em;
  color: #fff;
  box-shadow: 0 4px 24px rgba(0,0,0,0.18);
  opacity: 0;
  transform: translateX(120%);
  transition: opacity 0.3s, transform 0.5s cubic-bezier(0.4,0.2,0.2,1);
  text-shadow: 0 2px 8px #000;
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.notification.show {
  opacity: 1;
  transform: translateX(0);
}

.notification.success {
  background: #2ecc40;
}

.notification.error {
  background: #e74c3c;
}

.carta-presentacion {
  width: 300px;
  height: 300px;
  perspective: 900px;
  cursor: pointer;
  position: relative;
  border-radius: 22px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  background: #fff;
  margin: 0;
  outline: 0px solid #ffd000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.carta-presentacion .carta-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.7s cubic-bezier(.4,2,.6,1);
  transform-style: preserve-3d;
}
.carta-presentacion.flipped .carta-inner {
  transform: rotateY(180deg);
}
.carta-front-p {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 22px;
  background: #222;
  color: #ffd700;
  font-size: 7em;
  font-family: 'Bebas Neue', sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  z-index: 2;
}
.carta-back-p {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 22px;
  background: #fffbe6;
  color: #222;
  transform: rotateY(180deg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1em 0.5em;
  text-align: center;
  z-index: 3;
}
.carta-back-p img {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  margin-bottom: 0.7em;
  object-fit: cover;
  border: 3px solid #ffd700;
}
.carta-back-p .nombre {
  font-size: 1.3em;
  font-weight: bold;
  margin-bottom: 0.5em;
  color: #bfa100;
  font-family: 'Bebas Neue', sans-serif;
}
.carta-back-p .frase {
  font-size: 1.1em;
  color: #444;
  font-style: italic;
} 

#presentacionCartas {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  width: 100vw;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 900;
  background: rgba(0,0,0,0.85);
  transition: all 0.7s;
}
#presentacionCartas .grid {
  display: none;
}
#presentacionCartas.mostrar-grid .grid {
  display: grid;
}
#btnEmpezarPresentacion {
  opacity: 1;
  transition: opacity 0.5s, transform 0.5s, background 0.3s, color 0.3s, box-shadow 0.3s;
  margin-bottom: 2em;
  background: #ffd700;
  color: #222;
  border: none;
  border-radius: 12px;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.5em;
  padding: 0.7em 2.5em;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}
#btnEmpezarPresentacion:hover {
  background: #222;
  color: #ffd700;
  transform: scale(1.07) rotate(-2deg);
  box-shadow: 0 8px 32px rgba(34,34,34,0.18);
  letter-spacing: 2px;
  border: 2px solid #ffd700;
}
#btnEmpezarPresentacion.hide {
  opacity: 0;
  pointer-events: none;
  transform: translateY(40px) scale(0.95);
}
#tituloPresentacion {
  transition: all 0.7s cubic-bezier(.4,2,.6,1);
  margin-bottom: 1em;
  text-align: center;
}
#tituloPresentacion.arriba {
  position: absolute;
  top: 40px;
  left: 0;
  right: 0;
  margin: 0 auto;
  text-align: center;
  font-size: 2.5em;
  z-index: 10;
}

.carta-flip-presentacion {
  opacity: 0;
  transform: scale(0.7);
  transition: opacity 0.5s, transform 0.5s;
}
.carta-flip-presentacion.visible {
  opacity: 1;
  transform: scale(1);
}

.flip-inner-presentacion {
  width: 100%;
  height: 100%;
  transition: transform 0.7s cubic-bezier(.4,2,.6,1);
  transform-style: preserve-3d;
  position: relative;
}
.carta-flip-presentacion.flipped .flip-inner-presentacion {
  transform: rotateY(180deg);
}
.flip-front-presentacion, .flip-back-presentacion {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  border-radius: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  backface-visibility: hidden;
}
.flip-front-presentacion {
  background: #222;
  color: #ffd700;
  font-size: 7em;
  font-family: 'Bebas Neue', sans-serif;
  z-index: 2;
  user-select: none;
}
.flip-back-presentacion {
  background: #fffbe6;
  color: #222;
  transform: rotateY(180deg);
  flex-direction: column;
  z-index: 3;
  padding: 1em 0.5em;
  text-align: center;
}
.flip-back-presentacion img {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  margin-bottom: 0.7em;
  object-fit: cover;
  border: 3px solid #ffd700;
}
.frase-presentacion {
  font-size: 1.1em;
  color: #444;
  font-style: italic;
  margin-top: 0.5em;
} 

.info-hover-nominado {
  display: none;
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  background: rgba(34,34,34,0.85);
  color: #ffd700;
  padding: 18px 0 12px 0;
  text-align: center;
  font-family: Bebas Neue,sans-serif;
  font-size: 1.3em;
  transition: opacity 0.4s cubic-bezier(.4,2,.6,1), transform 0.4s cubic-bezier(.4,2,.6,1);
  opacity: 0;
  transform: translateY(30px) scale(0.97);
  pointer-events: none;
  z-index: 2;
}
.cuadrado-nominado-presentacion .flip-cuadrado.flipped:hover .info-hover-nominado {
  display: block;
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
  animation: infoHoverFadeIn 0.45s cubic-bezier(.4,2,.6,1);
}
@keyframes infoHoverFadeIn {
  from { opacity: 0; transform: translateY(30px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

#presentacionCartas, #mainApp {
  transition: opacity 0.7s cubic-bezier(.4,2,.6,1), visibility 0.7s;
}
#presentacionCartas.fade-out {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}
#mainApp.fade-in {
  opacity: 1 !important;
  pointer-events: auto;
  visibility: visible;
} 

.flip-cuadrado {
  transition: transform 1.1s cubic-bezier(.22,1.5,.5,1.01);
}

#modalNominadoPresentacion {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  width: 100vw; height: 100vh;
  background: rgba(0,0,0,0.82);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  opacity: 0;
  animation: modalNominadoFadeIn 0.7s cubic-bezier(.4,2,.6,1) forwards;
}
#modalNominadoPresentacion.ocultar {
  animation: modalNominadoFadeOut 0.7s cubic-bezier(.4,2,.6,1) forwards;
}
@keyframes modalNominadoFadeIn {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes modalNominadoFadeOut {
  from { opacity: 1; transform: scale(1); }
  to { opacity: 0; transform: scale(0.97); }
}
#modalNominadoPresentacion .contenido {
  text-align: center;
  color: #fff;
  max-width: 90vw;
  max-height: 80vh;
  padding: 48px 32px 36px 32px;
  border-radius: 24px 24px 10px 10px;
  background: rgba(34,34,34,0.95);
  box-shadow: 0 8px 48px rgba(0,0,0,0.45);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
}
#modalNominadoPresentacion .barra-carga {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 7px;
  width: 100%;
  background: rgba(255,255,255,0.18);
  border-radius: 0 0 24px 24px;
  overflow: hidden;
}
#modalNominadoPresentacion .barra-carga .progreso {
  height: 100%;
  width: 0%;
  background: #fff;
  border-radius: 0 0 24px 24px;
  transition: width 3s linear;
}
#modalNominadoPresentacion .nombre {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 3.5em;
  color: #fff;
  margin-bottom: 0.5em;
  letter-spacing: 2px;
}
#modalNominadoPresentacion .frase {
  font-family: 'Quicksand', sans-serif;
  font-size: 1.5em;
  color: #fffbe6;
  margin-top: 0.5em;
  font-style: italic;
}

/* ======================================== */
/* RESPONSIVE - ADAPTACION MOVILES */
/* ======================================== */

/* Tablets grandes */
@media screen and (max-width: 1200px) {
  .grid {
    grid-template-columns: repeat(3, 280px);
    grid-gap: 32px;
  }
  .player, .carta-presentacion {
    width: 280px;
    height: 280px;
  }
  .player img {
    width: 280px;
    height: 280px;
  }
}

/* Tablets */
@media screen and (max-width: 900px) {
  html, body {
    overflow-y: auto;
    overflow-x: hidden;
    height: auto;
  }
  
  #mainApp {
    height: auto !important;
    min-height: 100vh;
    padding: 20px 0 40px 0;
  }
  
  .grid {
    grid-template-columns: repeat(2, 260px);
    grid-gap: 24px;
  }
  
  .player, .carta-presentacion {
    width: 260px;
    height: 260px;
  }
  
  .player img {
    width: 260px;
    height: 260px;
  }
  
  .titulo {
    font-size: 2.5em;
  }
  
  .vote-number {
    width: 60px;
    height: 60px;
    font-size: 2em;
  }
}

/* Moviles - IMPORTANTE - USAR FLEXBOX */
@media screen and (max-width: 768px) {
  html, body {
    overflow-y: auto !important;
    overflow-x: hidden !important;
    height: auto !important;
    min-height: 100vh;
  }
  
  body {
    height: auto !important;
    justify-content: flex-start !important;
    padding-top: 20px;
  }
  
  #mainApp {
    height: auto !important;
    min-height: auto !important;
    padding: 15px 0 30px 0 !important;
  }
  
  #presentacionCartas {
    overflow-y: auto !important;
    overflow-x: hidden !important;
    height: auto !important;
    min-height: 100vh !important;
    justify-content: flex-start !important;
    padding-top: 20px !important;
    padding-bottom: 40px !important;
  }
  
  /* SOLO GRID DE VOTACION */
  #playersGrid {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: 10px !important;
    padding: 0 10px !important;
    margin-bottom: 20px !important;
    max-width: 100vw !important;
  }
  
  /* SOLO GRID DE PRESENTACION */
  #presentacionGrid,
  #presentacionCartas.mostrar-grid #presentacionGrid {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: 10px !important;
    padding: 0 10px !important;
    margin-bottom: 20px !important;
    max-width: 100vw !important;
    grid-template-columns: none !important;
  }
  
  /* CARTAS DE VOTACION */
  #playersGrid .player {
    width: calc(50% - 10px) !important;
    max-width: 180px !important;
    height: auto !important;
    max-height: 180px !important;
    aspect-ratio: 1 / 1 !important;
    border-radius: 14px !important;
    flex-shrink: 0 !important;
  }
  
  /* CARTAS DE PRESENTACION */
  #presentacionGrid > div,
  #presentacionGrid .carta-presentacion,
  #presentacionGrid .carta-flip-presentacion,
  #presentacionGrid .cuadrado-nominado-presentacion {
    width: calc(50% - 10px) !important;
    max-width: 180px !important;
    height: auto !important;
    max-height: 180px !important;
    aspect-ratio: 1 / 1 !important;
    border-radius: 14px !important;
    flex-shrink: 0 !important;
    box-sizing: border-box !important;
  }
  
  #presentacionGrid .carta-inner,
  #presentacionGrid .flip-inner-presentacion {
    width: 100% !important;
    height: 100% !important;
  }
  
  #presentacionGrid .flip-cuadrado {
    width: 100% !important;
    height: 100% !important;
  }
  
  .player img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
  }
  
  .titulo {
    font-size: 1.8em !important;
    margin-top: 15px;
    margin-bottom: 12px;
    padding: 0 15px;
  }
  
  .explicacion {
    font-size: 1em !important;
    margin-top: -10px !important;
    padding: 0 15px;
  }
  
  .vote-number {
    width: 35px !important;
    height: 35px !important;
    font-size: 1.2em !important;
    top: 8px;
    left: 8px;
  }
  
  .player-name {
    font-size: 1em !important;
  }
  
  .buttons {
    flex-direction: column;
    gap: 12px;
    width: 90%;
    padding: 0 5%;
  }
  
  button {
    width: 100%;
    font-size: 1.1em;
    padding: 14px 24px;
    min-height: 50px;
  }
  
  .success-message {
    padding: 20px 25px;
    font-size: 1.2em;
    min-width: 90vw;
    max-width: 90vw;
    white-space: normal;
  }
  
  .success-title {
    font-size: 1.6em;
    white-space: normal;
  }
  
  .success-sub {
    font-size: 1em;
  }
  
  .balon-icono {
    height: 0.9em;
  }
  
  #notification-container {
    top: 10px;
    right: 10px;
    left: 10px;
  }
  
  .notification {
    width: calc(100vw - 20px);
    min-width: auto;
    max-width: none;
    font-size: 1em;
    padding: 12px 20px;
  }
  
  .carta-front-p, .flip-front-presentacion {
    font-size: 3.5em;
  }
  
  .carta-back-p img, .flip-back-presentacion img {
    width: 50px !important;
    height: 50px !important;
  }
  
  .carta-back-p .nombre {
    font-size: 0.9em !important;
  }
  
  .carta-back-p .frase, .frase-presentacion {
    font-size: 0.7em !important;
  }
  
  #btnEmpezarPresentacion {
    font-size: 1.2em;
    padding: 0.8em 2em;
    margin-bottom: 1em !important;
  }
  
  #tituloPresentacion {
    font-size: 2em !important;
    padding: 0 20px;
    margin-bottom: 0.5em !important;
  }
  
  #tituloPresentacion.arriba {
    font-size: 1.5em !important;
    top: 10px;
    padding: 0 10px;
  }
  
  #modalNominadoPresentacion .contenido {
    padding: 28px 20px 24px 20px;
    max-width: 90vw;
  }
  
  #modalNominadoPresentacion .nombre {
    font-size: 2em;
  }
  
  #modalNominadoPresentacion .frase {
    font-size: 1.1em;
  }
}

/* Moviles pequeños */
@media screen and (max-width: 480px) {
  #playersGrid {
    gap: 8px !important;
    padding: 0 8px !important;
  }
  
  #presentacionGrid {
    gap: 8px !important;
    padding: 0 8px !important;
  }
  
  #playersGrid .player {
    width: calc(50% - 8px) !important;
    max-width: 170px !important;
    max-height: 170px !important;
  }
  
  #presentacionGrid > div,
  #presentacionGrid .carta-presentacion,
  #presentacionGrid .carta-flip-presentacion,
  #presentacionGrid .cuadrado-nominado-presentacion {
    width: calc(50% - 8px) !important;
    max-width: 170px !important;
    max-height: 170px !important;
  }
  
  .titulo {
    font-size: 1.5em !important;
  }
  
  .vote-number {
    width: 30px !important;
    height: 30px !important;
    font-size: 1em !important;
    top: 6px;
    left: 6px;
  }
  
  .success-title {
    font-size: 1.4em;
  }
  
  #tituloPresentacion {
    font-size: 1.7em !important;
  }
  
  #tituloPresentacion.arriba {
    font-size: 1.3em !important;
  }
  
  .carta-front-p, .flip-front-presentacion {
    font-size: 3em;
  }
  
  .carta-back-p img, .flip-back-presentacion img {
    width: 45px !important;
    height: 45px !important;
  }
  
  .carta-back-p .nombre {
    font-size: 0.85em !important;
  }
  
  .carta-back-p .frase, .frase-presentacion {
    font-size: 0.65em !important;
  }
  
  #tituloPresentacion {
    font-size: 2em !important;
  }
}

/* Touch devices */
@media (hover: none) and (pointer: coarse) {
  .player:hover .player-name {
    opacity: 0;
  }
  
  .player.selected .player-name {
    opacity: 1;
  }
  
  button {
    min-height: 48px;
  }
}