/* ── Player-count modal ── */
.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(8, 0, 28, 0.80);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  z-index: 100;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.modal-overlay.hidden {
  display: none;
}

.modal-logo {
  display: flex;
  justify-content: center;
  width: 420px;
  margin-bottom: -50px;
  z-index: 1;
  pointer-events: none;
}

.modal-logo img {
  width: 420px;
  height: auto;
  object-fit: contain;
}

.modal-inner {
  background: transparent;
  border: none;
  padding: 22px 36px 26px;
  width: 290px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  animation: popup-scale-in 0.32s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-title {
  font-size: 36px;
  color: transparent;
  background: linear-gradient(135deg, #ff6ec7, #ffd700, #7efff5);
  -webkit-background-clip: text;
  background-clip: text;
  text-align: center;
}

.modal-question {
  font-size: 22px;
  color: rgba(255,255,255,0.9);
  font-weight: normal;
}

.modal-count-buttons {
  display: flex;
  gap: 14px;
}

.modal-count-btn {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  border: 3px solid rgba(255,255,255,0.28);
  color: white;
  font-size: 30px;
  font-family: 'Bubblegum Sans', cursive;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}

.modal-count-btn:hover {
  background: rgba(255,110,199,0.35);
  border-color: #ff6ec7;
  transform: scale(1.12);
}

.modal-count-btn:active {
  transform: scale(0.94);
}

/* ── Winner screen ── */
#screen-winner {
  background: linear-gradient(135deg, #1a0a3e 0%, #2d0057 50%, #1a0a3e 100%);
  align-items: center;
  justify-content: center;
}

.winner-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  text-align: center;
}

.winner-castle { font-size: 80px; }

#castle-art {
  max-width: 240px;
  max-height: 240px;
  object-fit: contain;
  animation: float 3s ease-in-out infinite;
}

.castle-fallback {
  font-size: 110px;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-12px); }
}

.winner-text {
  font-size: 58px;
  color: transparent;
  background: linear-gradient(135deg, #ffd700, #ff6ec7, #7efff5);
  -webkit-background-clip: text;
  background-clip: text;
  animation: rainbow-shift 2s linear infinite;
}

@keyframes rainbow-shift {
  0%   { filter: hue-rotate(0deg); }
  100% { filter: hue-rotate(360deg); }
}

.winner-subtitle {
  font-size: 22px;
  color: rgba(255,255,255,0.8);
}

/* ── Confetti ── */
#confetti-container {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 5;
}

.confetti-piece {
  position: absolute;
  top: -20px;
  opacity: 0;
  animation: confetti-fall var(--duration, 3s) var(--delay, 0s) ease-in forwards;
}

@keyframes confetti-fall {
  0%   { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(820px) rotate(720deg); opacity: 0; }
}

/* ── Overlay popups ── */
.overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.52);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  animation: overlay-in 0.18s ease-out;
}

.overlay.hidden { display: none; }

@keyframes overlay-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes popup-scale-in {
  from { transform: scale(0.55); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}

.popup-inner {
  background: rgba(26, 10, 62, 0.92);
  border: 2px solid rgba(255, 215, 0, 0.35);
  border-radius: 24px;
  padding: 28px 44px;
  text-align: center;
  max-width: 360px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.6);
  animation: popup-scale-in 0.24s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.popup-icon-fallback {
  font-size: 64px;
  line-height: 1;
}

.popup-inner h2 {
  font-size: 26px;
  color: #ffd700;
  font-family: 'Bubblegum Sans', cursive;
}

.popup-inner p {
  font-size: 16px;
  color: rgba(255,255,255,0.85);
  line-height: 1.5;
}

.popup-skip {
  max-width: 300px;
  padding: 20px 32px;
  border-color: rgba(255, 107, 107, 0.5);
}

#skip-popup-text {
  font-size: 20px;
  color: #fff;
}

/* ── Big button ── */
.big-btn {
  background: linear-gradient(135deg, #ff6ec7, #ff9a3c);
  color: white;
  border: none;
  border-radius: 32px;
  padding: 16px 40px;
  font-family: inherit;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(255,110,199,0.4);
  transition: transform 0.12s, box-shadow 0.12s;
}

.big-btn:active {
  transform: scale(0.95);
  box-shadow: 0 2px 8px rgba(255,110,199,0.3);
}
