/* --- Cupido 3-way layout (base) --- */
.video-area.cupido-3way {
  display: flex;
  flex-direction: row;
  gap: 4px;
  position: relative;
}
.video-area.cupido-3way .video-tile-local { display: none; }

/* --- HOST: 2 tiles side by side + PiP self centered --- */
.video-area.cupido-host .video-tile-remote,
.video-area.cupido-host .video-tile-right {
  flex: 1;
  min-height: 0;
}
.video-area.cupido-host .video-tile-right { display: block; }

/* --- PARTICIPANT DESKTOP: same 2-tile layout as host --- */
.video-area.cupido-participant .video-tile-remote,
.video-area.cupido-participant .video-tile-right {
  flex: 1;
  min-height: 0;
}
.video-area.cupido-participant .video-tile-right { display: block; }

/* --- PiP container: centered top for both host and participant (desktop) --- */
.video-area.cupido-host .pip-container,
.video-area.cupido-participant .pip-container {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
}

.pip-container {
  width: clamp(140px, 18vw, 260px);
  aspect-ratio: 4/3;
  z-index: 120;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
  border: 2px solid rgba(255,255,255,.3);
  background: #000;
}
.pip-container video {
  width: 100%; height: 100%;
  object-fit: cover;
}
/* Only mirror when it's self (host PiP) */
.cupido-host .pip-container video { transform: scaleX(-1); }
/* Don't mirror host video for participant */
.cupido-participant .pip-container video { transform: none; }

.pip-label {
  position: absolute;
  bottom: 6px; left: 50%;
  transform: translateX(-50%);
  padding: 2px 10px;
  background: rgba(0,0,0,.6);
  color: #fff;
  border-radius: 999px;
  font-size: .65rem;
  font-weight: 700;
  backdrop-filter: blur(4px);
}

/* --- Tile pickers (participant list overlaid on tiles for host) --- */
.tile-picker {
  position: absolute;
  inset: 0;
  z-index: 15;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(6px);
  border-radius: inherit;
  padding: 12px;
  overflow-y: auto;
}
.tile-picker-title {
  font-size: .75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  margin-bottom: 10px;
}
.tile-picker-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  max-height: 80%;
  overflow-y: auto;
}
.tile-picker-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: rgba(255,255,255,.08);
  border: 1px solid var(--stroke-2);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all .15s ease;
  font-size: .85rem;
}
.tile-picker-item:hover {
  background: rgba(255,255,255,.15);
  border-color: var(--pink);
}
.tile-picker-item .name { font-weight: 600; }
.tile-picker-item .info { font-size: .7rem; color: var(--muted); }
.tile-picker-empty {
  color: var(--muted);
  font-size: .8rem;
  text-align: center;
  padding: 20px;
}

/* --- Quiz start bar (host, left side) --- */
.quiz-start-bar {
  position: absolute;
  bottom: 8px;
  left: 8px;
  z-index: 130;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--glass-strong);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  backdrop-filter: blur(12px);
}
.quiz-set-select {
  padding: 8px 12px;
  background: rgba(255,255,255,.06);
  border: 1px solid var(--stroke-2);
  border-radius: var(--radius-sm);
  color: var(--txt);
  font-size: .85rem;
  outline: none;
  min-width: 160px;
}
.quiz-set-select option { background: var(--bg-1); }

/* --- Quiz tile overlays (host view) --- */
.quiz-tile-overlay {
  position: absolute; inset: 0;
  border: 4px solid transparent;
  border-radius: inherit;
  z-index: 10;
  pointer-events: none;
  display: none;
}
.quiz-tile-overlay.buzzer {
  display: block;
  border-color: var(--green);
  background: rgba(34,197,94,.12);
}
.quiz-tile-overlay.other {
  display: block;
  border-color: var(--danger);
  background: rgba(239,68,68,.08);
}
.quiz-tile-overlay.correct {
  display: block;
  border-color: var(--green);
  background: rgba(34,197,94,.2);
  animation: quizFlash .6s ease 3;
}
.quiz-tile-overlay.wrong {
  display: block;
  border-color: var(--danger);
  background: rgba(239,68,68,.2);
  animation: quizFlash .6s ease 3;
}
@keyframes quizFlash {
  0%, 100% { opacity: 1; }
  50% { opacity: .5; }
}

.quiz-tile-label {
  position: absolute;
  top: 8px; left: 50%;
  transform: translateX(-50%);
  padding: 4px 14px;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .05em;
  z-index: 11;
  display: none;
}
.quiz-tile-label.show { display: block; }
.quiz-tile-label.buzzer { background: rgba(34,197,94,.9); color: #fff; }
.quiz-tile-label.other { background: rgba(239,68,68,.7); color: #fff; }
.quiz-tile-label.buzz-green { background: rgba(34,197,94,.9); color: #fff; }
.quiz-tile-label.buzz-red { background: rgba(239,68,68,.7); color: #fff; }

/* Green/red tile overlays for buzzer */
.quiz-tile-overlay.buzz-green {
  display: block;
  border-color: var(--green);
  background: rgba(34,197,94,.18);
}
.quiz-tile-overlay.buzz-red {
  display: block;
  border-color: var(--danger);
  background: rgba(239,68,68,.12);
}

/* --- Tile controls: score + kick + comodines (vertical stack) --- */
.tile-controls {
  position: absolute;
  top: 8px;
  z-index: 15;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.tile-controls-left { left: 8px; }
.tile-controls-right { right: 8px; }

/* Inline score on tile */
.tile-score-inline {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(6px);
  border-radius: 8px;
  padding: 4px 10px;
  min-width: 44px;
}
.tile-score-inline .tile-score-name {
  font-size: .6rem;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.tile-score-inline .tile-score-pts {
  font-size: 1.3rem;
  font-weight: 900;
  font-family: 'Orbitron', monospace;
}
.tile-controls-left .tile-score-pts { color: var(--blue); }
.tile-controls-right .tile-score-pts { color: var(--pink); }

/* Kick button in stack */
.tile-controls .admin-kick-btn {
  position: static;
  width: 44px;
  font-size: .6rem;
  padding: 4px 0;
}

/* Comodines in stack */
.tile-comodines {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.tile-comodin-btn {
  width: 36px;
  height: 36px;
  border: 2px solid rgba(255,255,255,.3);
  border-radius: 50%;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(6px);
  font-size: 1.1rem;
  cursor: pointer;
  transition: transform .2s, border-color .2s, background .2s;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.tile-comodin-btn:hover {
  transform: scale(1.15);
  border-color: var(--blue);
  background: rgba(59,130,246,.3);
}
.tile-comodin-btn:disabled {
  opacity: .3;
  cursor: default;
  transform: none;
}
.tile-comodin-btn.used {
  opacity: .2;
  pointer-events: none;
}

/* Locked state: dimmed with lock icon overlay */
.tile-comodin-btn.locked {
  opacity: .45;
  filter: grayscale(.6);
  position: relative;
}
.tile-comodin-btn.locked::after {
  content: '🔒';
  position: absolute;
  bottom: -4px;
  right: -4px;
  font-size: .55rem;
  line-height: 1;
  background: rgba(0,0,0,.7);
  border-radius: 50%;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.tile-comodin-btn.locked:hover {
  transform: scale(1.1);
  border-color: var(--amber);
  background: rgba(245,158,11,.2);
}

/* Unlocked state: normal look */
.tile-comodin-btn.unlocked {
  opacity: 1;
  filter: none;
  border-color: var(--green);
  box-shadow: 0 0 8px rgba(34,197,94,.3);
}
.tile-comodin-btn.unlocked:hover {
  border-color: var(--blue);
  background: rgba(59,130,246,.3);
}

/* Comodin toast message */
.comodin-toast {
  position: fixed;
  top: 60px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: rgba(0,0,0,.85);
  backdrop-filter: blur(8px);
  color: #fff;
  padding: 10px 24px;
  border-radius: 8px;
  font-size: .85rem;
  font-weight: 600;
  z-index: 300;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s, transform .3s;
  border: 1px solid var(--stroke-2);
}
.comodin-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
