/* ═══════════════════════════════════════════════════════════
   NostalGuess — CSS
   Style: Vibrant party game (MakeItMeme / WhoIs TikTok vibe)
   ═══════════════════════════════════════════════════════════ */

:root {
  --bg-dark: #0d0b1a;
  --bg-card: #1a1730;
  --bg-card-hover: #231f42;
  --purple-deep: #6c3ce0;
  --purple-light: #a78bfa;
  --pink-hot: #f43f9e;
  --pink-light: #fb7bb8;
  --cyan: #22d3ee;
  --cyan-dark: #06b6d4;
  --green: #34d399;
  --green-bright: #10b981;
  --yellow: #fbbf24;
  --orange: #fb923c;
  --red: #ef4444;
  --white: #f8f7ff;
  --white-soft: #c4c0d9;
  --text-muted: #8b85a8;

  --gradient-main: linear-gradient(135deg, #6c3ce0 0%, #f43f9e 50%, #fb923c 100%);
  --gradient-card: linear-gradient(145deg, #1e1a3a 0%, #16132e 100%);
  --gradient-glow: linear-gradient(135deg, #a78bfa 0%, #f43f9e 100%);

  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 6px;

  --font-display: 'Bangers', cursive;
  --font-body: 'Nunito', sans-serif;

  --shadow-glow: 0 0 40px rgba(108, 60, 224, 0.3), 0 0 80px rgba(244, 63, 158, 0.15);
  --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.4);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  font-family: var(--font-body);
  background: var(--bg-dark);
  color: var(--white);
  overflow-x: hidden;
}

body {
  background:
    radial-gradient(ellipse at 20% 50%, rgba(108, 60, 224, 0.12) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(244, 63, 158, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 90%, rgba(34, 211, 238, 0.06) 0%, transparent 50%),
    var(--bg-dark);
}

#particles {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* ─── Screens ─────────────────────────────────────────── */
.screen {
  display: none;
  position: relative;
  z-index: 1;
  min-height: 100vh;
  animation: fadeIn 0.4s ease;
}
.screen.active { display: flex; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ─── HOME ────────────────────────────────────────────── */
.home-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  width: 100%;
}

.logo-wrapper {
  text-align: center;
  margin-bottom: 40px;
}

.logo {
  font-family: var(--font-display);
  font-size: clamp(3rem, 8vw, 5.5rem);
  letter-spacing: 4px;
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 4px 20px rgba(244, 63, 158, 0.4));
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: center;
}

.logo-icon {
  -webkit-text-fill-color: initial;
  font-size: 0.8em;
  animation: tvBounce 2s ease-in-out infinite;
}

@keyframes tvBounce {
  0%, 100% { transform: rotate(-5deg) scale(1); }
  50% { transform: rotate(5deg) scale(1.1); }
}

.tagline {
  font-size: 1.15rem;
  color: var(--white-soft);
  margin-top: 8px;
  font-weight: 600;
}

.home-card {
  background: var(--gradient-card);
  border: 1px solid rgba(168, 139, 250, 0.15);
  border-radius: var(--radius);
  padding: 36px;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-card);
}

.input-group {
  margin-bottom: 24px;
}

.input-group label {
  display: block;
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--purple-light);
  margin-bottom: 8px;
}

input[type="text"], textarea {
  width: 100%;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  border: 2px solid rgba(168, 139, 250, 0.2);
  background: rgba(13, 11, 26, 0.6);
  color: var(--white);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  outline: none;
  transition: border-color 0.3s, box-shadow 0.3s;
}

input[type="text"]:focus, textarea:focus {
  border-color: var(--purple-deep);
  box-shadow: 0 0 0 3px rgba(108, 60, 224, 0.25);
}

input::placeholder, textarea::placeholder {
  color: var(--text-muted);
  font-weight: 400;
}

.home-buttons {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.separator {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  position: relative;
}
.separator::before, .separator::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 35%;
  height: 1px;
  background: rgba(168, 139, 250, 0.15);
}
.separator::before { left: 0; }
.separator::after { right: 0; }

.join-row {
  display: flex;
  gap: 10px;
}

.input-code {
  flex: 0 0 130px;
  text-align: center;
  font-family: var(--font-display) !important;
  font-size: 1.4rem !important;
  letter-spacing: 4px;
  text-transform: uppercase;
}

.footer-note {
  margin-top: 32px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  max-width: 440px;
  line-height: 1.6;
}

/* ─── BUTTONS ─────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.25s ease;
  text-transform: uppercase;
  letter-spacing: 1px;
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(rgba(255,255,255,0.1), transparent);
  opacity: 0;
  transition: opacity 0.25s;
}
.btn:hover::after { opacity: 1; }

.btn-primary {
  background: var(--gradient-main);
  color: white;
  box-shadow: 0 4px 20px rgba(108, 60, 224, 0.4);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 30px rgba(108, 60, 224, 0.5);
}

.btn-secondary {
  background: rgba(168, 139, 250, 0.15);
  color: var(--purple-light);
  border: 2px solid rgba(168, 139, 250, 0.3);
}
.btn-secondary:hover {
  background: rgba(168, 139, 250, 0.25);
  transform: translateY(-2px);
}

.btn-accent {
  background: linear-gradient(135deg, var(--green-bright), var(--cyan-dark));
  color: white;
  box-shadow: 0 4px 20px rgba(16, 185, 129, 0.3);
}
.btn-accent:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 30px rgba(16, 185, 129, 0.4);
}

.btn-big {
  padding: 16px 36px;
  font-size: 1.15rem;
  border-radius: var(--radius);
}

.btn-glow {
  animation: glowPulse 2s ease-in-out infinite;
}

@keyframes glowPulse {
  0%, 100% { box-shadow: 0 4px 20px rgba(108, 60, 224, 0.4); }
  50% { box-shadow: 0 4px 40px rgba(244, 63, 158, 0.6), 0 0 60px rgba(108, 60, 224, 0.3); }
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* ─── LOBBY ───────────────────────────────────────────── */
.lobby-container {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 24px;
  padding-top: 40px;
}

.lobby-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 32px;
}

.lobby-title {
  font-family: var(--font-display);
  font-size: 2rem;
  letter-spacing: 2px;
  color: var(--cyan);
}

.lobby-code-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(34, 211, 238, 0.1);
  border: 2px solid rgba(34, 211, 238, 0.3);
  border-radius: var(--radius-sm);
  padding: 10px 18px;
}

.code-label {
  font-size: 0.85rem;
  color: var(--white-soft);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.code-value {
  font-family: var(--font-display);
  font-size: 1.8rem;
  color: var(--cyan);
  letter-spacing: 6px;
}

.btn-copy {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  transition: transform 0.2s;
}
.btn-copy:hover { transform: scale(1.2); }

.lobby-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

@media (max-width: 700px) {
  .lobby-body { grid-template-columns: 1fr; }
}

.lobby-left, .lobby-right {
  background: var(--gradient-card);
  border: 1px solid rgba(168, 139, 250, 0.12);
  border-radius: var(--radius);
  padding: 24px;
}

.lobby-left h3, .lobby-right h3 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  letter-spacing: 1px;
  margin-bottom: 16px;
  color: var(--pink-light);
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--pink-hot);
  color: white;
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 800;
  min-width: 24px;
  height: 24px;
  border-radius: 20px;
  padding: 0 8px;
  vertical-align: middle;
  margin-left: 6px;
}

.player-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.player-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-xs);
  font-weight: 700;
  transition: background 0.2s;
}
.player-list li:hover { background: rgba(255, 255, 255, 0.07); }

.player-list .host-badge {
  background: var(--yellow);
  color: #1a1730;
  font-size: 0.65rem;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.player-list .ready-badge {
  background: var(--green);
  color: #1a1730;
  font-size: 0.65rem;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 800;
}

.helper-text {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 12px;
  line-height: 1.5;
}

textarea {
  resize: vertical;
  min-height: 120px;
  margin-bottom: 12px;
}

.video-status {
  margin-top: 8px;
  font-size: 0.85rem;
  font-weight: 700;
}
.video-status.success { color: var(--green); }
.video-status.error { color: var(--red); }

.host-controls {
  text-align: center;
  margin-top: 32px;
}

/* ─── GAME ────────────────────────────────────────────── */
.game-container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px 24px;
  position: relative;
}

.game-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.game-progress {
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-family: var(--font-display);
  font-size: 1.4rem;
  letter-spacing: 1px;
  color: var(--purple-light);
}
.progress-num { color: var(--cyan); font-size: 2rem; }
.progress-total { color: var(--text-muted); }
.progress-label { font-family: var(--font-body); font-size: 0.85rem; font-weight: 700; margin-right: 6px; color: var(--white-soft); }

.vote-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(251, 191, 36, 0.1);
  border: 1px solid rgba(251, 191, 36, 0.3);
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  font-weight: 800;
  color: var(--yellow);
  font-size: 0.95rem;
}

.video-wrapper {
  position: relative;
  width: 100%;
  max-width: 800px;
  margin: 0 auto 24px;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-glow);
  border: 2px solid rgba(168, 139, 250, 0.2);
}

.video-player {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  background: #000;
}

.video-player iframe {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* Vote section */
.vote-section {
  max-width: 800px;
  margin: 0 auto 20px;
  text-align: center;
}

.vote-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  letter-spacing: 1px;
  margin-bottom: 16px;
  color: var(--yellow);
}

.vote-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.vote-btn {
  padding: 12px 24px;
  border: 2px solid rgba(168, 139, 250, 0.3);
  background: rgba(168, 139, 250, 0.08);
  color: var(--white);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 800;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.25s;
  text-transform: none;
}

.vote-btn:hover {
  background: rgba(108, 60, 224, 0.3);
  border-color: var(--purple-deep);
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(108, 60, 224, 0.3);
}

.vote-btn.selected {
  background: var(--gradient-main);
  border-color: transparent;
  color: white;
  transform: scale(1.05);
  box-shadow: 0 4px 25px rgba(244, 63, 158, 0.4);
}

.vote-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

.vote-feedback {
  margin-top: 12px;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--green);
  min-height: 1.4em;
}

/* Owner message */
.owner-message {
  text-align: center;
  margin: 20px auto;
  max-width: 800px;
  padding: 16px 24px;
  background: rgba(251, 191, 36, 0.1);
  border: 2px solid rgba(251, 191, 36, 0.3);
  border-radius: var(--radius-sm);
  font-weight: 800;
  color: var(--yellow);
  font-size: 1.1rem;
  animation: pulseScale 2s ease-in-out infinite;
}

@keyframes pulseScale {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

/* Host next */
.host-next {
  text-align: center;
  margin: 16px auto;
}

/* Reveal overlay */
.reveal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(13, 11, 26, 0.85);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
}

.reveal-card {
  background: var(--gradient-card);
  border: 2px solid rgba(168, 139, 250, 0.2);
  border-radius: var(--radius);
  padding: 40px;
  max-width: 500px;
  width: 90%;
  text-align: center;
  box-shadow: var(--shadow-glow);
  animation: revealPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes revealPop {
  from { transform: scale(0.7) rotate(-3deg); opacity: 0; }
  to { transform: scale(1) rotate(0); opacity: 1; }
}

.reveal-title {
  font-family: var(--font-display);
  font-size: 1.8rem;
  color: var(--yellow);
  margin-bottom: 16px;
  letter-spacing: 1px;
}

.reveal-owner {
  font-family: var(--font-display);
  font-size: 2.5rem;
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 24px;
  letter-spacing: 2px;
}

.reveal-results {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.reveal-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-radius: var(--radius-xs);
  font-weight: 700;
  font-size: 0.9rem;
}

.reveal-row.correct {
  background: rgba(52, 211, 153, 0.15);
  border: 1px solid rgba(52, 211, 153, 0.3);
  color: var(--green);
}

.reveal-row.wrong {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: var(--red);
}

.reveal-row .voter-name { flex: 1; text-align: left; }
.reveal-row .voted-for { flex: 1; text-align: center; color: var(--white-soft); }
.reveal-row .result-icon { font-size: 1.2rem; }

/* Scoreboard */
.scoreboard {
  position: fixed;
  top: 16px;
  right: 16px;
  background: var(--gradient-card);
  border: 1px solid rgba(168, 139, 250, 0.15);
  border-radius: var(--radius);
  padding: 16px 20px;
  min-width: 180px;
  box-shadow: var(--shadow-card);
  z-index: 50;
}

.scoreboard-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--yellow);
  letter-spacing: 1px;
  margin-bottom: 10px;
}

.scoreboard-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.scoreboard-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 4px 0;
}

.scoreboard-list .score-name { color: var(--white-soft); }
.scoreboard-list .score-value {
  color: var(--cyan);
  font-family: var(--font-display);
  font-size: 1.1rem;
  letter-spacing: 1px;
}

@media (max-width: 900px) {
  .scoreboard {
    position: relative;
    top: auto; right: auto;
    margin: 0 auto 16px;
    max-width: 800px;
  }
}

/* ─── GAME OVER ───────────────────────────────────────── */
.gameover-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  text-align: center;
}

.gameover-title {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 6vw, 4rem);
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 40px;
  letter-spacing: 3px;
}

.podium {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 16px;
  margin-bottom: 40px;
}

.podium-place {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.podium-bar {
  width: 100px;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 12px;
  font-family: var(--font-display);
  font-size: 1.8rem;
  color: rgba(255,255,255,0.9);
  letter-spacing: 2px;
}

.podium-place:nth-child(1) .podium-bar {
  background: linear-gradient(to top, #fbbf24, #f59e0b);
  height: 160px;
}
.podium-place:nth-child(2) .podium-bar {
  background: linear-gradient(to top, #94a3b8, #cbd5e1);
  height: 120px;
}
.podium-place:nth-child(3) .podium-bar {
  background: linear-gradient(to top, #b45309, #d97706);
  height: 90px;
}

.podium-name {
  font-weight: 800;
  font-size: 1rem;
  color: var(--white);
}

.podium-medal {
  font-size: 2rem;
}

.podium-score {
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--cyan);
  letter-spacing: 1px;
}

.final-scores {
  background: var(--gradient-card);
  border: 1px solid rgba(168, 139, 250, 0.12);
  border-radius: var(--radius);
  padding: 24px 32px;
  margin-bottom: 32px;
  min-width: 300px;
}

.final-scores h3 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--pink-light);
  margin-bottom: 16px;
  letter-spacing: 1px;
}

.final-scores .score-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  font-weight: 700;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.final-scores .score-row:last-child { border-bottom: none; }
.final-scores .rank { color: var(--text-muted); width: 30px; }
.final-scores .name { flex: 1; }
.final-scores .pts {
  color: var(--cyan);
  font-family: var(--font-display);
  font-size: 1.1rem;
  letter-spacing: 1px;
}

/* ─── TOAST ───────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

.toast {
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.9rem;
  animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}

.toast.success {
  background: linear-gradient(135deg, var(--green-bright), var(--cyan-dark));
  color: white;
}
.toast.error {
  background: linear-gradient(135deg, var(--red), var(--pink-hot));
  color: white;
}
.toast.info {
  background: linear-gradient(135deg, var(--purple-deep), var(--pink-hot));
  color: white;
}

@keyframes toastIn {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
@keyframes toastOut {
  from { opacity: 1; }
  to { opacity: 0; transform: translateY(-10px); }
}

/* ─── CONFETTI ─────────────────────────────────────────── */
@keyframes confettiFall {
  0% { transform: translateY(-100vh) rotate(0); opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

.confetti-piece {
  position: fixed;
  width: 10px;
  height: 10px;
  top: -10px;
  z-index: 999;
  animation: confettiFall linear forwards;
}

/* ─── Scrollbar ─────────────────────────────────────────── */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb {
  background: rgba(168, 139, 250, 0.3);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(168, 139, 250, 0.5);
}

