/* ─── host.css — TV Host Screen ─────────────────────────────────────────────
   Designed for 1080p screens, dark theme, large readable text.
   Fullscreen immersive layout for Capacitor/Android TV.
─────────────────────────────────────────────────────────────────────────────*/
@import url('https://fonts.googleapis.com/css2?family=Exo+2:wght@400;700;900&display=swap');

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --red: #e74c3c;
  --blue: #3498db;
  --yellow: #f1c40f;
  --green: #2ecc71;
  --dark: #0d0d1a;
  --card: rgba(255, 255, 255, 0.05);
  --accent: #7c3aed;
  --glow: 0 0 30px rgba(124, 58, 237, 0.6);
  --fs-xl: clamp(1.5rem, 3.5vw, 2.8rem);
  --fs-lg: clamp(1.2rem, 2vw, 2rem);
  --fs-md: clamp(0.9rem, 1.5vw, 1.8rem);
  --fs-sm: clamp(0.7rem, 1vw, 1.2rem);
}

html,
body {
  width: 100%;
  height: 100%;
  font-family: 'Exo 2', 'Segoe UI', sans-serif;
  background: var(--dark);
  color: #fff;
  overflow: hidden;
  user-select: none;
}

/* ── Utility ─────────────────────────────────────────────────────────────── */
.hidden {
  display: none !important;
}

.centered {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

/* ── Screens ─────────────────────────────────────────────────────────────── */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4vh 5vw;
  animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: scale(0.97);
  }

  to {
    opacity: 1;
  }
}

/* ── Particles / BG gradient ─────────────────────────────────────────────── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at 20% 50%, rgba(124, 58, 237, 0.15) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(52, 152, 219, 0.1) 0%, transparent 60%);
  pointer-events: none;
}

/* ── Netflix Setup Mode ──────────────────────────────────────────────────── */
#screen-setup.netflix-mode {
  padding: 0;
  justify-content: flex-start;
  overflow-y: auto;
  overflow-x: hidden;
  background: #000;
  display: block;
}

#setup-bg-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  pointer-events: none;
}

.netflix-rows-container,
.destacados-slider,
#screen-setup > div {
  position: relative;
  z-index: 1;
}

/* ── Destacados Slider ───────────────────────────────────────────────────── */
.destacados-slider {
  position: relative;
  width: 90vw;
  height: 40vh;
  margin: 4vh auto;
  border-radius: 30px;
  /* pastilla */
  overflow: hidden;
  background-size: cover;
  /* keep aspect ratio without stretch */
  background-position: center;
  background-repeat: no-repeat;
  outline: none;
  cursor: pointer;
}

/* Lobby background */
#lobby-bg {
  position: absolute;
  inset: 0;
  z-index: -1;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 1;
  /* full opacity, gradient will handle fade */
}

#lobby-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0) 100%);
}


.destacados-slider.fade-out {
  opacity: 0;
  transition: opacity 0.5s ease-in-out;
}

.destacados-slider.focusable:focus,
.destacados-slider:hover {
  outline: 4px solid #fff;
  outline-offset: -4px;
}

.destacados-slider-overlay {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.7) 0%, transparent 70%),
    linear-gradient(to right, rgba(0, 0, 0, 0.7) 0%, transparent 60%);
}

.destacados-slider-content {
  position: absolute;
  bottom: 10%;
  left: 5%;
  max-width: 60%;
  z-index: 2;
  pointer-events: none;
}

.destacados-slider-content h1 {
  font-size: clamp(2rem, 4vw, 3.5rem);
  font-weight: 900;
  margin-bottom: 10px;
  text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.8);
  color: #fff;
}

.destacados-category {
  background: rgba(255, 255, 255, 0.2);
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 1.2rem;
  font-weight: bold;
  margin-right: 10px;
  display: inline-block;
  backdrop-filter: blur(4px);
}

.destacados-indicators {
  position: absolute;
  bottom: 20px;
  right: 5%;
  display: flex;
  gap: 10px;
  z-index: 2;
}

.d-indicator {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transition: background 0.3s;
}

.d-indicator.active {
  background: #fff;
}

.netflix-rows-container {
  width: 100%;
  position: relative;
  z-index: 3;
  padding-bottom: 5vh;
}

.netflix-rows {
  display: flex;
  flex-direction: column;
  gap: 4vh;
}

.category-row {
  width: 90vw;
  margin: 0 auto;
}

.category-row h2 {
  font-size: var(--fs-md);
  font-weight: 700;
  margin: 0 0 10px 0;
  opacity: 0.9;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.carousel {
  display: flex;
  overflow-x: auto;
  overflow-y: hidden;
  gap: 1.2vw;
  padding: 10px 0 30px 0;
  scroll-behavior: smooth;
  scroll-snap-type: x mandatory;
}

.carousel-wrapper {
  position: relative;
}

.carousel-arrow {
  position: absolute;
  top: 10px;
  /* Match carousel padding top */
  bottom: 30px;
  /* Match carousel padding bottom */
  width: 50px;
  background: rgba(0, 0, 0, 0.5);
  border: none;
  color: #fff;
  font-size: 2.5rem;
  z-index: 20;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.3s, background 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
}

.carousel-wrapper:hover .carousel-arrow {
  opacity: 1;
}

.carousel-arrow:hover {
  background: rgba(0, 0, 0, 0.8);
  font-size: 3rem;
}

.carousel-arrow-left {
  left: 0;
}

.carousel-arrow-right {
  right: 0;
}

.carousel-arrow.hidden {
  visibility: hidden;
  opacity: 0 !important;
}

.carousel::-webkit-scrollbar {
  display: none;
}

.netflix-card {
  position: relative;
  flex: 0 0 14vw;
  aspect-ratio: 2 / 3;
  border-radius: 6px;
  background: var(--card);
  cursor: pointer;
  transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94), box-shadow 0.3s;
  background-size: cover;
  background-position: center;
  scroll-snap-align: start;
  outline: none;
}

.netflix-card:focus,
.netflix-card:hover {
  transform: scale(1.05);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
  border: 3px solid #fff;
  z-index: 10;
}

.netflix-card-title {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.45) 70%, transparent 100%);
  padding: 60px 10px 15px;
  font-size: 1.1rem;
  font-weight: 700;
  text-align: center;
  overflow-wrap: break-word;
  word-wrap: break-word;
  hyphens: auto;
  border-radius: 0 0 6px 6px;
  opacity: 1;
  transition: opacity 0.3s, transform 0.3s;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.8);
}

.netflix-card:focus .netflix-card-title,
.netflix-card:hover .netflix-card-title {
  transform: translateY(-2px);
}

.netflix-card.no-poster .netflix-card-title {
  opacity: 1;
  background: rgba(0, 0, 0, 0.6);
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-primary {
  margin-top: 2em;
  background: linear-gradient(135deg, var(--accent), #2563eb);
  border: none;
  border-radius: 50px;
  color: #fff;
  font-family: inherit;
  font-weight: 700;
  font-size: var(--fs-md);
  padding: 0.7em 2.5em;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.btn-primary:hover,
.btn-primary:focus {
  transform: scale(1.05);
  box-shadow: var(--glow);
  outline: 3px solid #fff;
  outline-offset: 4px;
}

/* ── Lobby ───────────────────────────────────────────────────────────────── */
#screen-lobby {
  justify-content: space-between;
  padding: 3vh 5vw;
}

.lobby-header {
  text-align: center;
}

.lobby-header h2 {
  font-size: var(--fs-lg);
  opacity: 0.7;
}

.quiz-title {
  font-size: var(--fs-xl);
  font-weight: 900;
}

.lobby-join {
  display: flex;
  gap: 6vw;
  align-items: center;
  justify-content: center;
  flex: 1;
}

.join-info {
  text-align: center;
}

.join-label {
  font-size: var(--fs-sm);
  opacity: 0.5;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 0.3em;
}

.join-url {
  font-size: var(--fs-md);
  opacity: 0.8;
  margin-bottom: 0.5em;
}

.pin-code {
  font-size: clamp(3rem, 8vw, 8rem);
  font-weight: 900;
  letter-spacing: 0.1em;
  background: linear-gradient(135deg, #a78bfa, #60a5fa);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

#qr-code {
  border-radius: 12px;
  border: 4px solid rgba(255, 255, 255, 0.2);
  background: #fff;
  padding: 10px;
  max-width: 220px;
  max-height: 220px;
}

.lobby-players {
  text-align: center;
  width: 100%;
}

.lobby-players h3 {
  font-size: var(--fs-md);
  opacity: 0.5;
  margin-bottom: 1em;
}

.player-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.8em;
  max-height: 18vh;
  overflow: hidden;
}

.player-chip {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50px;
  padding: 0.4em 1.2em;
  font-size: var(--fs-sm);
  font-weight: 700;
  animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
  from {
    transform: scale(0);
    opacity: 0;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}

.lobby-footer {
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2vw;
}

.btn-secondary {
  margin-top: 2em;
  background: transparent;
  border-radius: 50px;
  color: rgba(255,255,255,0.6);
  font-family: inherit;
  font-weight: 700;
  font-size: var(--fs-md);
  padding: 0.7em 2.5em;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, color 0.2s;
}

.btn-secondary:hover,
.btn-secondary:focus {
  transform: scale(1.05);
  color: #fff;
  outline: 3px solid rgba(231, 76, 60, 0.7);
  outline-offset: 4px;
}

/* ── Question ────────────────────────────────────────────────────────────── */
#screen-question {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 2vh;
  padding: 2vh 3vw;
}

.question-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--fs-sm);
  opacity: 0.6;
}

.countdown-ring {
  position: relative;
  width: 80px;
  height: 80px;
}

.countdown-ring svg {
  transform: rotate(-90deg);
}

.countdown-ring circle {
  fill: none;
  stroke-width: 8;
  stroke-dasharray: 200;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 1s linear, stroke 0.5s;
}

.countdown-ring .track {
  stroke: rgba(255, 255, 255, 0.1);
}

.countdown-ring .progress {
  stroke: var(--green);
}

.countdown-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  font-weight: 900;
}

.media-area {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.3);
  min-height: 15vh;
}

.media-overlay {
  /* hides YouTube title */
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: linear-gradient(to bottom, rgba(13, 13, 26, 0.95), transparent);
  z-index: 2;
  pointer-events: none;
}

#yt-player {
  width: 100%;
  max-height: 30vh;
}

#question-image {
  max-height: 30vh;
  object-fit: contain;
  border-radius: 8px;
}

.question-text {
  font-size: var(--fs-lg);
  font-weight: 700;
  text-align: center;
  line-height: 1.25;
  padding: 0 2vw;
}

.options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5vh 2vw;
}

.option-btn {
  border: none;
  border-radius: 16px;
  color: #fff;
  font-family: inherit;
  font-weight: 700;
  font-size: var(--fs-md);
  cursor: pointer;
  padding: 2.5vh 2vw;
  text-align: center;
  transition: transform 0.15s;
  display: flex;
  align-items: center;
  gap: 1em;
}

.option-btn:hover {
  transform: scale(1.02);
}

.option-btn.red {
  background: var(--red);
}

.option-btn.blue {
  background: var(--blue);
}

.option-btn.yellow {
  background: var(--yellow);
  color: #1a1a1a;
}

.option-btn.green {
  background: var(--green);
  color: #1a1a1a;
}

.option-icon {
  font-size: 1.4em;
}

.answer-count {
  font-size: var(--fs-sm);
  opacity: 0.6;
  text-align: center;
  margin-top: 0.5em;
}

/* ── Verdict ─────────────────────────────────────────────────────────────── */
#screen-verdict {
  gap: 1.5vh;
  justify-content: flex-start;
  padding-top: 3vh;
  overflow-y: auto;
}

.verdict-correct {
  font-size: var(--fs-xl);
  font-weight: 900;
}

.verdict-label {
  font-size: var(--fs-md);
  opacity: 0.6;
}

.answer-bar-container {
  width: 80%;
  max-width: 900px;
}

.answer-bars {
  display: flex;
  gap: 1.5vw;
  align-items: flex-end;
  height: 15vh;
}

.answer-bar {
  flex: 1;
  border-radius: 8px 8px 0 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  transition: height 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
  min-height: 10px;
  padding-bottom: 0.4em;
  font-size: var(--fs-sm);
  font-weight: 700;
}

.answer-bar.red {
  background: var(--red);
}

.answer-bar.blue {
  background: var(--blue);
}

.answer-bar.yellow {
  background: var(--yellow);
  color: #1a1a1a;
}

.answer-bar.green {
  background: var(--green);
  color: #1a1a1a;
}

.answer-bar.correct-bar {
  outline: 4px solid #fff;
}

.mini-leaderboard {
  margin-top: 1em;
  width: 50%;
}

.mini-leaderboard .entry {
  display: flex;
  justify-content: space-between;
  padding: 0.5em 1em;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: var(--fs-sm);
}

.mini-leaderboard .entry .rank {
  opacity: 0.5;
  min-width: 2em;
}


/* ── Ranking ─────────────────────────────────────────────────────────────── */
#screen-ranking {
  justify-content: flex-start;
  padding-top: 3vh;
  overflow-y: auto;
}

#screen-ranking h2 {
  font-size: var(--fs-lg);
  font-weight: 900;
  margin-bottom: 0.6em;
}

.leaderboard-list {
  width: 60%;
  min-width: 400px;
  max-height: 70vh;
  overflow-y: auto;
}

.lb-entry {
  display: flex;
  align-items: center;
  gap: 1.5em;
  padding: 0.8vh 2vw;
  border-radius: 12px;
  background: var(--card);
  margin-bottom: 0.5em;
  animation: slideIn 0.4s ease forwards;
  opacity: 0;
}

@keyframes slideIn {
  from {
    transform: translateX(-40px);
    opacity: 0;
  }

  to {
    transform: none;
    opacity: 1;
  }
}

.lb-rank {
  font-size: var(--fs-lg);
  font-weight: 900;
  min-width: 2em;
  text-align: center;
}

.lb-nick {
  flex: 1;
  font-size: var(--fs-md);
  font-weight: 700;
}

.lb-score {
  font-size: var(--fs-md);
  font-weight: 900;
  color: var(--yellow);
}

.lb-streak {
  font-size: var(--fs-sm);
}

.lb-entry:nth-child(1) {
  background: rgba(255, 215, 0, 0.15);
  border: 1px solid gold;
}

.lb-entry:nth-child(2) {
  background: rgba(192, 192, 192, 0.1);
  border: 1px solid silver;
}

.lb-entry:nth-child(3) {
  background: rgba(205, 127, 50, 0.1);
  border: 1px solid #cd7f32;
}

/* ── Podium ──────────────────────────────────────────────────────────────── */
#screen-podium {
  background: radial-gradient(circle, #1a0a2e, #0d0d1a);
  justify-content: space-between;
  padding: 4vh 5vw 3vh;
}

#screen-podium h1 {
  font-size: var(--fs-xl);
  font-weight: 900;
  margin-bottom: 1vh;
}

.podium-stage {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 2vw;
  flex: 1;
  width: 100%;
  max-width: 1200px;
}

.podium-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6em;
  border-radius: 20px 20px 0 0;
  padding: 2em 3vw 1.5em;
  animation: riseUp 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  opacity: 0;
  min-width: 14vw;
  text-align: center;
}

@keyframes riseUp {
  from {
    transform: translateY(60px);
    opacity: 0;
  }

  to {
    transform: none;
    opacity: 1;
  }
}

.podium-block.first {
  background: linear-gradient(180deg, rgba(255, 215, 0, 0.3) 0%, rgba(255, 215, 0, 0.08) 100%);
  border: 1px solid rgba(255, 215, 0, 0.4);
  border-bottom: none;
  align-self: stretch;
  animation-delay: 0.1s;
}

.podium-block.second {
  background: linear-gradient(180deg, rgba(192, 192, 192, 0.25) 0%, rgba(192, 192, 192, 0.06) 100%);
  border: 1px solid rgba(192, 192, 192, 0.3);
  border-bottom: none;
  padding-top: 8vh;
  animation-delay: 0.4s;
}

.podium-block.third {
  background: linear-gradient(180deg, rgba(205, 127, 50, 0.25) 0%, rgba(205, 127, 50, 0.06) 100%);
  border: 1px solid rgba(205, 127, 50, 0.3);
  border-bottom: none;
  padding-top: 12vh;
  animation-delay: 0.6s;
}

.podium-crown {
  font-size: 3rem;
}

.podium-nick {
  font-size: var(--fs-lg);
  font-weight: 900;
  line-height: 1.2;
  word-break: break-word;
  max-width: 12vw;
}

.podium-score {
  font-size: var(--fs-md);
  color: #f1c40f;
  font-weight: 700;
  opacity: 0.9;
}

.podium-pos {
  font-size: 1.4rem;
  font-weight: 900;
  opacity: 0.5;
}

/* ─── Comment Banner ─────────────────────────────────────────────────────────── */
.comment-banner {
  position: fixed;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%) translateY(150px);
  background: linear-gradient(135deg, #7c3aed, #ec4899);
  color: white;
  padding: 15px 35px;
  border-radius: 50px;
  font-size: 2rem;
  font-weight: 900;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  gap: 20px;
  transition: all 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 9999;
  opacity: 0;
}

.comment-banner.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ── Persistent Room Info (Badge) ─────────────────────────────────────────── */
.persistent-room-info {
  position: fixed;
  top: 2rem;
  right: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(13, 13, 26, 0.6);
  backdrop-filter: blur(12px);
  padding: 0.6rem 2rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
  z-index: 1000;
  animation: slideInDown 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.persistent-room-info .label {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 2px;
  opacity: 0.6;
  margin-bottom: -2px;
}

.persistent-room-info .pin {
  font-size: 2.2rem;
  font-weight: 900;
  background: linear-gradient(135deg, #a78bfa, #60a5fa);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: 2px;
}

@keyframes slideInDown {
  from {
    transform: translateY(-100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}