@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;800&display=swap');

:root {
  --bg-color: #0b0c10;
  --bg-gradient: radial-gradient(circle at top right, #1a1c2e, #0b0c10);
  --card-bg: rgba(255, 255, 255, 0.05);
  --card-border: rgba(255, 255, 255, 0.08);
  --primary-glow: rgba(138, 43, 226, 0.6);
  --text-color: #ffffff;
  --text-secondary: #a0a5c0;

  /* Layout heights — used for viewport calculations */
  --header-h: 73px;
  --host-ctrl-h: 40px;
  --footer-h: 0px;  /* footer hidden during game */

  /* Game Pad Colors */
  --color-red: linear-gradient(135deg, #ff416c, #ff4b2b);
  --color-blue: linear-gradient(135deg, #00b4db, #0083b0);
  --color-yellow: linear-gradient(135deg, #f1c40f, #f39c12);
  --color-green: linear-gradient(135deg, #11998e, #38ef7d);

  --shadow-red: 0 8px 24px rgba(255, 65, 108, 0.4);
  --shadow-blue: 0 8px 24px rgba(0, 180, 219, 0.4);
  --shadow-yellow: 0 8px 24px rgba(241, 196, 15, 0.4);
  --shadow-green: 0 8px 24px rgba(17, 153, 142, 0.4);

  --font-main: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

body {
  font-family: var(--font-main);
  background: var(--bg-color);
  background-image: var(--bg-gradient);
  color: var(--text-color);
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Background floating particles */
.bg-particles {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(circle at 50% 50%, rgba(138, 43, 226, 0.08) 0%, transparent 60%);
}

/* Glass Card styles */
.glass-panel {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 20px;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  transition: transform 0.3s ease, border-color 0.3s ease;
}

.glass-panel:hover {
  border-color: rgba(255, 255, 255, 0.15);
}

/* Common Header */
header {
  padding: clamp(0.6rem, 1.2vh, 1.5rem) clamp(1rem, 2vw, 2rem);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--card-border);
  background: rgba(11, 12, 16, 0.6);
  backdrop-filter: blur(8px);
  flex-shrink: 0;
}

.logo {
  font-weight: 800;
  font-size: 1.8rem;
  letter-spacing: 1px;
  background: linear-gradient(to right, #8a2be2, #4a00e0, #ff007f);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo-icon {
  animation: rotate 6s linear infinite;
}

@keyframes rotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Buttons */
.btn {
  font-family: var(--font-main);
  background: linear-gradient(135deg, #8a2be2, #4a00e0);
  color: white;
  border: none;
  padding: 0.8rem 2rem;
  font-weight: 600;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(138, 43, 226, 0.4);
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(138, 43, 226, 0.6);
}

.btn:active {
  transform: translateY(1px);
}

.btn-secondary {
  background: transparent;
  border: 2px solid var(--text-secondary);
  color: var(--text-color);
  box-shadow: none;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: white;
  box-shadow: none;
}

/* LOBBY VIEW - HOST */
.lobby-container {
  max-width: 1400px;
  width: 96%;
  margin: 0 auto;
  padding: clamp(1rem, 2vh, 2.5rem) clamp(1rem, 2vw, 2.5rem);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(1rem, 2vw, 2.5rem);
  align-items: start;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.lobby-info {
  display: flex;
  flex-direction: column;
  gap: clamp(0.6rem, 1.5vh, 1.5rem);
}

.lobby-info h2 {
  font-size: clamp(1.2rem, 2.5vw, 2.2rem);
  color: var(--text-secondary);
}

.room-pin-display {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 16px;
  padding: clamp(0.8rem, 1.5vh, 1.5rem);
  display: flex;
  flex-direction: column;
  align-items: center;
  border: 1px dashed rgba(255, 255, 255, 0.2);
}

.room-pin-display span {
  font-size: clamp(0.75rem, 1.2vw, 1.2rem);
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 2px;
}

.room-pin-display h1 {
  font-size: clamp(2.5rem, 5vw, 4.5rem);
  font-weight: 800;
  letter-spacing: 6px;
  color: #ff007f;
  text-shadow: 0 0 20px rgba(255, 0, 127, 0.4);
}

.qr-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.qr-card {
  background: white;
  padding: clamp(0.5rem, 1vw, 1rem);
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  display: flex;
  justify-content: center;
  align-items: center;
}

.qr-card canvas {
  width: clamp(140px, 16vw, 220px) !important;
  height: clamp(140px, 16vw, 220px) !important;
}

.players-lobby {
  display: flex;
  flex-direction: column;
  height: clamp(280px, 50vh, 500px);
  border-radius: 16px;
  padding: clamp(0.8rem, 1.5vh, 1.5rem);
  background: rgba(0, 0, 0, 0.15);
}

.players-lobby h3 {
  font-size: clamp(1rem, 1.8vw, 1.4rem);
  margin-bottom: clamp(0.5rem, 1vh, 1rem);
  border-bottom: 1px solid var(--card-border);
  padding-bottom: 0.5rem;
  display: flex;
  justify-content: space-between;
}

.players-lobby h3 span {
  color: #00b4db;
  font-weight: 800;
}

.players-grid {
  flex-grow: 1;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 10px;
  overflow-y: auto;
}

.player-tag {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.5rem 1.2rem;
  border-radius: 50px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.player-tag::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  background: #38ef7d;
  border-radius: 50%;
  box-shadow: 0 0 8px #38ef7d;
}

@keyframes popIn {
  from { transform: scale(0); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* HOST GAME VIEW - Base (se adapta con vh/vw) */
.host-game-container {
  display: flex;
  flex-direction: column;
  max-width: 1600px;
  width: 98%;
  margin: 0 auto;
  gap: clamp(0.3rem, 0.6vh, 0.8rem);
  height: calc(100dvh - var(--header-h));
  overflow: hidden;
  padding: clamp(0.3rem, 0.6vh, 0.6rem) clamp(0.4rem, 0.8vw, 0.8rem);
  flex: 1;
}

.game-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5vh 1.5vw;
  flex-shrink: 0;
}

.category-tag {
  background: linear-gradient(135deg, #8a2be2, #ff007f);
  padding: 0.3vh 1vw;
  border-radius: 50px;
  font-weight: 800;
  font-size: clamp(0.7rem, 1.2vw, 1rem);
  letter-spacing: 1px;
}

.question-progress {
  color: var(--text-secondary);
  font-weight: 600;
  font-size: clamp(0.7rem, 1.1vw, 0.9rem);
}

.question-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 1vh 1.5vw;
  gap: 0.5vh;
  position: relative;
  flex-shrink: 1;
  min-height: 0;
}

.question-display h2 {
  font-size: clamp(1.2rem, 3vw, 2.5rem);
  font-weight: 800;
  line-height: 1.2;
}

.question-image-container {
  max-width: clamp(200px, 35vw, 450px);
  max-height: clamp(100px, 20vh, 250px);
  width: 100%;
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid var(--card-border);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  background: #000;
}

.question-image-container img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* Options Grid Host */
.options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(0.3rem, 0.8vh, 1rem);
  margin-bottom: 0.3rem;
  flex-shrink: 1;
}

.option-card {
  padding: clamp(0.4rem, 1.2vh, 1.2rem) clamp(0.5rem, 1.5vw, 1.5rem);
  font-size: clamp(0.8rem, 1.8vw, 1.4rem);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: clamp(0.5rem, 1vw, 1.2rem);
  cursor: default;
  position: relative;
  overflow: hidden;
}

.option-symbol {
  width: clamp(24px, 3.5vw, 45px);
  height: clamp(24px, 3.5vw, 45px);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.15);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: clamp(0.8rem, 1.5vw, 1.4rem);
  font-weight: 800;
  flex-shrink: 0;
}

.option-card.opt-0 { background: var(--color-red); box-shadow: var(--shadow-red); }
.option-card.opt-1 { background: var(--color-blue); box-shadow: var(--shadow-blue); }
.option-card.opt-2 { background: var(--color-yellow); box-shadow: var(--shadow-yellow); }
.option-card.opt-3 { background: var(--color-green); box-shadow: var(--shadow-green); }

.option-card.incorrect {
  opacity: 0.15;
  filter: grayscale(1);
  transform: scale(0.95);
  transition: all 0.5s ease;
}

.option-card.correct {
  transform: scale(1.03);
  box-shadow: 0 0 30px rgba(255, 255, 255, 0.4);
  z-index: 2;
  transition: all 0.5s ease;
}

.answer-percentage-overlay {
  position: absolute;
  right: 2rem;
  font-size: 2.2rem;
  font-weight: 800;
  background: rgba(0,0,0,0.3);
  padding: 0.2rem 1rem;
  border-radius: 10px;
  animation: popIn 0.3s ease forwards;
}

/* Timer and Answers Count Bar */
.game-status-bar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: clamp(0.5rem, 1.5vw, 2rem);
  align-items: center;
  padding: 0.5vh 1.5vw;
  flex-shrink: 0;
}

.timer-circle-wrap {
  position: relative;
  width: clamp(35px, 5vw, 70px);
  height: clamp(35px, 5vw, 70px);
  display: flex;
  justify-content: center;
  align-items: center;
}

.timer-circle-text {
  font-size: clamp(0.9rem, 2vw, 1.8rem);
  font-weight: 800;
  position: absolute;
}

.timer-bar-container {
  height: clamp(6px, 1vh, 14px);
  background: rgba(255, 255, 255, 0.05);
  border-radius: 50px;
  overflow: hidden;
  border: 1px solid var(--card-border);
}

.timer-bar {
  height: 100%;
  background: linear-gradient(to right, #00b4db, #8a2be2, #ff007f);
  width: 100%;
  transition: width 0.1s linear;
  border-radius: 50px;
  box-shadow: 0 0 10px rgba(138, 43, 226, 0.5);
}

.answers-counter {
  font-size: clamp(0.7rem, 1.2vw, 1rem);
  font-weight: 800;
  color: var(--text-secondary);
}

.answers-counter span {
  font-size: clamp(1rem, 2vw, 1.8rem);
  color: white;
}

/* LEADERBOARD VIEW - HOST */
.leaderboard-view {
  max-width: 900px;
  width: 95%;
  margin: 0 auto;
  padding: clamp(1rem, 2vh, 3rem);
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.leaderboard-view h2 {
  font-size: clamp(1.5rem, 3vw, 2.5rem);
  text-align: center;
  margin-bottom: clamp(1rem, 2vh, 2rem);
  color: var(--text-color);
  background: linear-gradient(to right, #00b4db, #38ef7d);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: clamp(8px, 1vh, 14px);
}

.leaderboard-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: clamp(0.8rem, 1.5vh, 1.5rem) clamp(1rem, 2vw, 2.5rem);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--card-border);
  transition: all 0.3s ease;
}

.leaderboard-row:hover {
  background: rgba(255, 255, 255, 0.06);
  transform: translateX(5px);
}

.leaderboard-left {
  display: flex;
  align-items: center;
  gap: clamp(0.8rem, 1.5vw, 2rem);
}

.leaderboard-rank {
  font-weight: 800;
  font-size: clamp(1rem, 2vw, 1.6rem);
  width: clamp(25px, 3vw, 40px);
  color: var(--text-secondary);
}

.leaderboard-row:nth-child(1) .leaderboard-rank { color: #f1c40f; }
.leaderboard-row:nth-child(2) .leaderboard-rank { color: #bdc3c7; }
.leaderboard-row:nth-child(3) .leaderboard-rank { color: #e67e22; }

.leaderboard-name {
  font-weight: 600;
  font-size: clamp(1rem, 2vw, 1.6rem);
}

.leaderboard-right {
  display: flex;
  align-items: center;
  gap: clamp(0.8rem, 1.5vw, 2rem);
}

.leaderboard-score {
  font-weight: 800;
  font-size: clamp(1.1rem, 2vw, 1.8rem);
}

.streak-badge {
  background: linear-gradient(135deg, #ff4b2b, #ff416c);
  padding: clamp(0.2rem, 0.4vh, 0.4rem) clamp(0.5rem, 1vw, 1rem);
  border-radius: 50px;
  font-size: clamp(0.6rem, 1vw, 0.9rem);
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 4px 10px rgba(255, 75, 43, 0.3);
}

/* PODIUM VIEW - HOST */
.podium-container {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: clamp(1rem, 2vw, 3rem);
  height: clamp(250px, 40vh, 450px);
  margin: clamp(2rem, 4vh, 5rem) auto clamp(1rem, 2vh, 3rem);
  max-width: 900px;
}

.podium-place {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: clamp(120px, 18vw, 220px);
  position: relative;
}

.podium-avatar {
  width: clamp(50px, 8vw, 90px);
  height: clamp(50px, 8vw, 90px);
  border-radius: 50%;
  background: var(--card-bg);
  border: 4px solid var(--card-border);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: clamp(1.5rem, 3vw, 3rem);
  font-weight: 800;
  margin-bottom: 1rem;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  animation: float 4s ease-in-out infinite;
}

.podium-pedestal {
  width: 100%;
  border-radius: 12px 12px 0 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: clamp(1rem, 2vh, 2rem) clamp(0.5rem, 1vw, 1.5rem);
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}

.podium-pedestal h3 {
  font-weight: 800;
  font-size: clamp(2rem, 4vw, 4rem);
}

.podium-name {
  font-size: clamp(0.9rem, 1.8vw, 1.6rem);
  font-weight: 600;
  margin-top: clamp(0.5rem, 1vh, 1rem);
  text-align: center;
}

.podium-score {
  font-weight: 800;
  font-size: clamp(0.8rem, 1.5vw, 1.3rem);
  color: var(--text-secondary);
}

/* Podium Heights and Themes */
.podium-1st { height: clamp(180px, 28vh, 300px); }
.podium-1st .podium-pedestal {
  background: linear-gradient(180deg, rgba(241, 196, 15, 0.25) 0%, rgba(0,0,0,0.4) 100%);
  border-color: rgba(241, 196, 15, 0.4);
}
.podium-1st .podium-avatar {
  border-color: #f1c40f;
  box-shadow: 0 0 20px rgba(241, 196, 15, 0.4);
  background: #f1c40f;
  color: #000;
}

.podium-2nd { height: clamp(140px, 22vh, 240px); }
.podium-2nd .podium-pedestal {
  background: linear-gradient(180deg, rgba(189, 195, 199, 0.2) 0%, rgba(0,0,0,0.4) 100%);
  border-color: rgba(189, 195, 199, 0.3);
}
.podium-2nd .podium-avatar {
  border-color: #bdc3c7;
  box-shadow: 0 0 15px rgba(189, 195, 199, 0.3);
  background: #bdc3c7;
  color: #000;
}

.podium-3rd { height: clamp(110px, 18vh, 200px); }
.podium-3rd .podium-pedestal {
  background: linear-gradient(180deg, rgba(230, 126, 34, 0.15) 0%, rgba(0,0,0,0.4) 100%);
  border-color: rgba(230, 126, 34, 0.25);
}
.podium-3rd .podium-avatar {
  border-color: #e67e22;
  box-shadow: 0 0 10px rgba(230, 126, 34, 0.25);
  background: #e67e22;
  color: #000;
}

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

/* PLAYER SCREENS */
.player-container {
  max-width: 480px;
  width: 95%;
  margin: 0 auto;
  padding: clamp(1rem, 2vh, 2.5rem) clamp(1rem, 3vw, 1.8rem);
  display: flex;
  flex-direction: column;
  gap: clamp(0.8rem, 2vh, 2rem);
  text-align: center;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.player-logo-big {
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  text-align: left;
  gap: 0.5rem;
}

.form-group label {
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.form-input {
  font-family: var(--font-main);
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 1rem;
  font-size: 1.2rem;
  color: white;
  transition: all 0.3s ease;
  text-align: center;
}

.form-input:focus {
  outline: none;
  border-color: #8a2be2;
  box-shadow: 0 0 15px rgba(138, 43, 226, 0.3);
}

.player-status-waiting {
  padding: 3rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
}

.waiting-spinner {
  width: 70px;
  height: 70px;
  border: 5px solid rgba(255, 255, 255, 0.05);
  border-top-color: #ff007f;
  border-bottom-color: #8a2be2;
  border-radius: 50%;
  animation: rotate 1.5s cubic-bezier(0.53, 0.21, 0.29, 0.67) infinite;
}

/* PLAYER GAME CONTROLLER */
.player-game-pad {
  display: grid;
  grid-template-rows: 1fr 1fr;
  grid-template-columns: 1fr 1fr;
  gap: clamp(8px, 1.5vw, 15px);
  height: calc(100dvh - 120px);
  padding: clamp(8px, 1.5vw, 15px);
  width: 100%;
  flex-grow: 1;
}

.pad-btn {
  border: none;
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(0,0,0,0.3);
  transition: transform 0.1s ease, filter 0.3s ease;
  user-select: none;
  -webkit-user-select: none;
}

.pad-btn:active {
  transform: scale(0.95);
  filter: brightness(0.8);
}

.pad-btn.disabled {
  pointer-events: none;
  opacity: 0.3;
  filter: grayscale(0.5);
}

.pad-btn.btn-0 { background: var(--color-red); box-shadow: var(--shadow-red); }
.pad-btn.btn-1 { background: var(--color-blue); box-shadow: var(--shadow-blue); }
.pad-btn.btn-2 { background: var(--color-yellow); box-shadow: var(--shadow-yellow); }
.pad-btn.btn-3 { background: var(--color-green); box-shadow: var(--shadow-green); }

.pad-symbol {
  font-size: 3rem;
  font-weight: 800;
  color: white;
  text-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.pad-label {
  font-size: 1.1rem;
  font-weight: 800;
  color: white;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* PLAYER FEEDBACK SCREEN */
.feedback-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 2rem;
  animation: fadeIn 0.4s ease forwards;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.feedback-screen.correct-ans {
  background: radial-gradient(circle, #1e3c2b 0%, #0d1e15 100%);
}

.feedback-screen.incorrect-ans {
  background: radial-gradient(circle, #3d141e 0%, #1c090e 100%);
}

.feedback-screen.waiting-reveal {
  background: radial-gradient(circle, #1a152d 0%, #0d0a15 100%);
}

.feedback-title {
  font-size: 3rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
}

.correct-ans .feedback-title {
  color: #38ef7d;
  text-shadow: 0 0 20px rgba(56, 239, 125, 0.4);
}

.incorrect-ans .feedback-title {
  color: #ff416c;
  text-shadow: 0 0 20px rgba(255, 65, 108, 0.4);
}

.points-pop {
  font-size: 2.2rem;
  font-weight: 800;
  margin-bottom: 2rem;
  animation: bounceUp 0.5s ease-out forwards;
}

@keyframes bounceUp {
  0% { transform: scale(0.3); opacity: 0; }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); opacity: 1; }
}

.player-score-summary {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 1.3rem;
  color: var(--text-secondary);
}

.player-score-summary span {
  font-size: 2.2rem;
  font-weight: 800;
  color: white;
}

.streak-fire-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.5rem;
  font-weight: 800;
  color: #ff4b2b;
  margin-top: 1rem;
}

.streak-fire {
  font-size: 2.5rem;
  animation: fire-flicker 1.5s ease-in-out infinite alternate;
}

@keyframes fire-flicker {
  0% { transform: scale(1) rotate(-2deg); filter: brightness(1); }
  50% { transform: scale(1.1) rotate(2deg); filter: brightness(1.2); }
  100% { transform: scale(1) rotate(-1deg); filter: brightness(1); }
}

/* ERROR MESSAGE POPUP */
.error-popup {
  background: rgba(255, 65, 108, 0.2);
  border: 1px solid rgba(255, 65, 108, 0.4);
  padding: 1rem;
  border-radius: 12px;
  color: #ff416c;
  font-weight: 600;
  animation: shake 0.4s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}

/* FOOTER — oculto durante el juego activo, visible en lobby */
footer {
  text-align: center;
  padding: 0.6rem;
  color: rgba(255, 255, 255, 0.15);
  font-size: 0.75rem;
  flex-shrink: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.02);
}

/* Responsive fixes */
@media (max-width: 768px) {
  .lobby-container {
    grid-template-columns: 1fr;
    padding: 1.5rem;
    gap: 2rem;
  }
  .options-grid {
    grid-template-columns: 1fr;
  }
  .podium-container {
    height: 300px;
    gap: 0.8rem;
  }
  .podium-place {
    width: 100px;
  }
  .podium-1st { height: 180px; }
  .podium-2nd { height: 140px; }
  .podium-3rd { height: 110px; }
  .podium-avatar {
    width: 50px;
    height: 50px;
    font-size: 1.2rem;
  }
  .podium-name {
    font-size: 1rem;
  }
  .podium-score {
    font-size: 0.8rem;
  }
  .podium-pedestal h3 {
    font-size: 1.8rem;
  }
}

/* Timer urgent styles */
@keyframes timerPulse {
  0% { transform: scale(1); filter: brightness(1); }
  50% { transform: scale(1.15); filter: brightness(1.3); text-shadow: 0 0 15px rgba(255, 65, 108, 0.8); }
  100% { transform: scale(1); filter: brightness(1); }
}

.timer-urgent {
  color: #ff416c !important;
  animation: timerPulse 0.5s ease-in-out infinite !important;
}

/* Player row round results animations */
.round-player-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: clamp(0.2rem, 0.5vh, 0.5rem) clamp(0.4rem, 1vw, 1rem);
  border-radius: 6px;
  animation: slideInRow 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
  opacity: 0;
  font-size: clamp(0.7rem, 1.2vw, 1rem);
}

#round-results-panel {
  max-height: clamp(80px, 15vh, 180px);
  overflow-y: auto;
}

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

/* Avatar Selection Grid */
.avatar-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 0.5rem;
}

.avatar-option {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 0.8rem 0.5rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  transition: all 0.2s ease;
  user-select: none;
  -webkit-user-select: none;
}

.avatar-option:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}

.avatar-option.selected {
  border-color: #8a2be2;
  background: rgba(138, 43, 226, 0.15);
  box-shadow: 0 0 10px rgba(138, 43, 226, 0.3);
}

.avatar-emoji {
  font-size: 1.8rem;
}

.avatar-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
}

/* Character Profile Image Styles */
.avatar-img-inline {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid rgba(255, 255, 255, 0.4);
  vertical-align: middle;
  display: inline-block;
  margin-right: 8px;
  box-shadow: 0 0 8px rgba(138, 43, 226, 0.3);
  background: #121420;
}

.avatar-emoji-inline {
  margin-right: 8px;
  font-size: 1.2rem;
  vertical-align: middle;
}

.avatar-img-podium {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

/* Card Selection Hover Effect */
.avatar-option {
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.avatar-option:active {
  transform: scale(0.92);
}
.avatar-option.selected {
  transform: scale(1.05);
  box-shadow: 0 0 15px rgba(138, 43, 226, 0.5);
  border-color: #8a2be2 !important;
}

/* Smooth pop-in animation for character card preview */
#character-card-container {
  animation: charCardPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes charCardPop {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

/* Escape Option Buttons styling and animations */
.escape-option-btn {
  width: 100%;
  padding: 1rem 0.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  color: #fff;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: none;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  position: relative;
  overflow: hidden;
}

.escape-option-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-1px);
}

.escape-option-btn.selected {
  background: linear-gradient(135deg, #e67e22, #d35400) !important;
  border-color: #f39c12 !important;
  box-shadow: 0 4px 15px rgba(230, 126, 34, 0.3) !important;
  color: #fff !important;
  transform: scale(1.02);
}

.escape-option-btn.disabled {
  pointer-events: none;
  opacity: 0.5;
}

/* 3D Card Flip Animation for TV Roulette */
.flip-card-container {
  background-color: transparent;
  width: 160px;
  height: 230px;
  perspective: 1000px;
}

.flip-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  text-align: center;
  transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  transform-style: preserve-3d;
}

.flip-card-inner.flipped {
  transform: rotateY(180deg);
}

.flip-card-front, .flip-card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  font-size: 1.1rem;
  font-weight: 800;
}

.flip-card-front {
  background: rgba(255, 255, 255, 0.02);
  backdrop-filter: blur(10px);
  color: #fff;
}

.flip-card-back {
  transform: rotateY(180deg);
}

.flip-card-back.safe {
  background: linear-gradient(135deg, #11998e, #38ef7d) !important;
  border-color: #38ef7d !important;
  color: #fff;
  box-shadow: 0 0 20px rgba(56, 239, 125, 0.3);
}

.flip-card-back.deadly {
  background: linear-gradient(135deg, #ff416c, #ff4b2b) !important;
  border-color: #ff416c !important;
  color: #fff;
  box-shadow: 0 0 20px rgba(255, 65, 108, 0.3);
}

/* ==================== GAME BOARD - TRIVIA MURDER PARTY STYLE ==================== */
.game-board {
  padding: clamp(0.4rem, 1vh, 1rem);
  margin-top: 0.2rem;
  background: rgba(0, 0, 0, 0.4) !important;
  border: 1px solid rgba(255, 65, 108, 0.2) !important;
  box-shadow: 0 0 20px rgba(255, 65, 108, 0.1) !important;
  flex-shrink: 0;
  overflow-y: auto;
  max-height: clamp(100px, 18vh, 200px);
}

.board-title {
  text-align: center;
  font-size: clamp(0.6rem, 1vw, 0.9rem);
  font-weight: 800;
  color: #ff416c;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 0.3rem;
  padding-bottom: 0.2rem;
  border-bottom: 1px solid rgba(255, 65, 108, 0.2);
  text-shadow: 0 0 10px rgba(255, 65, 108, 0.3);
}

.board-players-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(clamp(100px, 12vw, 160px), 1fr));
  gap: clamp(3px, 0.5vh, 8px);
}

.board-player-card {
  display: flex;
  align-items: center;
  gap: clamp(4px, 0.8vw, 10px);
  padding: clamp(0.3rem, 0.6vh, 0.6rem) clamp(0.4rem, 0.8vw, 0.8rem);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: all 0.3s ease;
}

.board-player-card.alive {
  border-color: rgba(56, 239, 125, 0.3);
  background: rgba(56, 239, 125, 0.03);
}

.board-player-card.dead {
  border-color: rgba(255, 65, 108, 0.3);
  background: rgba(255, 65, 108, 0.03);
  opacity: 0.7;
}

.board-player-avatar {
  width: clamp(20px, 3vw, 36px);
  height: clamp(20px, 3vw, 36px);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(0.7rem, 1.2vw, 1.1rem);
  background: rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}

.board-player-card.alive .board-player-avatar {
  border: 2px solid #38ef7d;
  box-shadow: 0 0 8px rgba(56, 239, 125, 0.3);
}

.board-player-card.dead .board-player-avatar {
  border: 2px solid #ff416c;
  box-shadow: 0 0 8px rgba(255, 65, 108, 0.3);
}

.board-player-info {
  flex: 1;
  min-width: 0;
}

.board-player-name {
  font-weight: 700;
  font-size: clamp(0.6rem, 1vw, 0.85rem);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.board-player-status {
  font-size: clamp(0.5rem, 0.8vw, 0.7rem);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.board-player-card.alive .board-player-status {
  color: #38ef7d;
}

.board-player-card.dead .board-player-status {
  color: #ff416c;
}

.board-player-score {
  font-weight: 800;
  font-size: clamp(0.6rem, 1vw, 0.85rem);
  color: var(--text-secondary);
}

/* Escape Board in Game View */
.escape-board-section {
  margin-top: 1rem;
  padding: 1.5rem;
  background: rgba(0, 0, 0, 0.4) !important;
  border: 1px solid rgba(241, 196, 15, 0.2) !important;
  border-radius: 16px;
}

.escape-board-title {
  text-align: center;
  font-size: 1rem;
  font-weight: 800;
  color: #f1c40f;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(241, 196, 15, 0.2);
}

.escape-track {
  display: grid;
  grid-template-columns: repeat(11, 1fr);
  gap: 4px;
  padding: 1rem 0;
}

.escape-space {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 0.5rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  min-height: 60px;
  justify-content: center;
}

.escape-space-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.escape-space.players-here {
  border-color: #f1c40f;
  background: rgba(241, 196, 15, 0.1);
}

.escape-player-token {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid #f1c40f;
  margin: 2px;
}

.escape-player-token.alive {
  border-color: #38ef7d;
  background: rgba(56, 239, 125, 0.2);
}

.escape-player-token.dead {
  border-color: #ff416c;
  background: rgba(255, 65, 108, 0.2);
}

/* ==================== RESPONSIVE DESIGN ====================
   Estrategia:
   - TV / Grande (1440px+): escalar fuentes y elementos hacia arriba
   - Laptop (1024–1440px): base styles ya cubiertos con clamp()
   - Tablet landscape (768–1024px): compactar host, mantener 2-col
   - Tablet portrait / Mobile grande (480–768px): 1 col, reducir
   - Celular (360–480px): modo mínimo, sin desbordamiento
   ==================== */

/* ===== TV / Pantalla Grande (1440px+) ===== */
@media (min-width: 1440px) {
  :root {
    --header-h: 80px;
  }
  .question-display h2 {
    font-size: clamp(2rem, 2.5vw, 3.2rem);
  }
  .option-card {
    padding: 1.4rem 2rem;
    font-size: clamp(1rem, 1.4vw, 1.6rem);
  }
  .option-symbol {
    width: 52px;
    height: 52px;
    font-size: 1.6rem;
  }
  .category-tag {
    font-size: clamp(0.85rem, 1vw, 1.1rem);
    padding: 0.5rem 1.5rem;
  }
  .answers-counter span {
    font-size: clamp(1.4rem, 2vw, 2.2rem);
  }
  .timer-circle-text {
    font-size: clamp(1.2rem, 2vw, 2.2rem);
  }
  .board-player-name {
    font-size: 0.95rem;
  }
  .board-player-score {
    font-size: 0.9rem;
  }
  .board-player-avatar {
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
  }
  .leaderboard-name {
    font-size: 1.8rem;
  }
  .leaderboard-score {
    font-size: 2rem;
  }
  .leaderboard-rank {
    font-size: 1.8rem;
  }
  .podium-pedestal h3 {
    font-size: clamp(3rem, 4vw, 5rem);
  }
  .podium-name {
    font-size: clamp(1rem, 1.6vw, 1.8rem);
  }
}

/* ===== 4K (2560px+) ===== */
@media (min-width: 2560px) {
  .question-display h2 {
    font-size: clamp(2.5rem, 2.2vw, 4rem);
  }
  .option-card {
    font-size: clamp(1.2rem, 1.2vw, 2rem);
    padding: 2rem 2.5rem;
  }
  .option-symbol {
    width: 70px;
    height: 70px;
    font-size: 2rem;
  }
  .room-pin-display h1 {
    font-size: clamp(4rem, 5vw, 7rem);
  }
  .leaderboard-name, .leaderboard-score {
    font-size: 2.2rem;
  }
}

/* ===== Tablet landscape (768px–1024px) ===== */
@media (max-width: 1024px) {
  .host-game-container {
    width: 99%;
    gap: clamp(0.3rem, 0.8vh, 1rem);
    padding: 0.4rem 0.6rem;
  }

  .question-display h2 {
    font-size: clamp(1.1rem, 2.5vw, 1.8rem);
  }

  .options-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .option-card {
    padding: clamp(0.5rem, 1.2vh, 1rem) clamp(0.6rem, 1.2vw, 1.2rem);
    font-size: clamp(0.75rem, 1.5vw, 1rem);
  }

  .board-players-grid {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 6px;
  }

  .board-player-card {
    padding: 0.5rem 0.7rem;
  }

  .board-player-avatar {
    width: 26px;
    height: 26px;
    font-size: 0.9rem;
  }

  .board-player-name {
    font-size: 0.75rem;
  }

  .board-player-score {
    font-size: 0.75rem;
  }

  .game-board {
    max-height: clamp(90px, 18vh, 180px);
  }

  .podium-container {
    gap: 1rem;
    height: clamp(200px, 35vh, 320px);
  }

  .podium-place {
    width: clamp(110px, 14vw, 160px);
  }

  .leaderboard-list-container {
    overflow-y: auto;
    max-height: calc(100dvh - 200px);
  }

  /* Sótano en tablet */
  #sotano-view {
    max-width: 100%;
    padding: 1.5rem 2rem;
    margin: 0 auto;
  }

  /* Escape track scroll horizontal en tablet */
  #escape-track-container {
    overflow-x: auto;
  }
}

/* ===== Tablet portrait / Mobile grande (480px–768px) ===== */
@media (max-width: 768px) {
  /* Header */
  header {
    padding: 0.6rem 1rem;
  }

  .logo {
    font-size: 1.2rem;
  }

  /* HOST — Lobby en una columna */
  .lobby-container {
    grid-template-columns: 1fr;
    gap: 1rem;
    padding: 0.8rem;
    align-items: center;
  }

  .lobby-info {
    gap: 0.8rem;
  }

  .players-lobby {
    height: clamp(180px, 35vh, 320px);
  }

  /* HOST — Game View */
  .host-game-container {
    width: 100%;
    gap: clamp(0.25rem, 0.6vh, 0.6rem);
    padding: 0 0.4rem;
  }

  .game-top-bar {
    padding: 0.5rem 0.8rem;
    flex-wrap: wrap;
    gap: 0.4rem;
  }

  .category-tag {
    font-size: 0.7rem;
    padding: 0.3rem 0.7rem;
  }

  .question-progress {
    font-size: 0.75rem;
  }

  .question-display {
    padding: 0.6rem 0.8rem;
    gap: 0.4rem;
  }

  .question-display h2 {
    font-size: clamp(0.9rem, 2.5vw, 1.4rem);
    line-height: 1.25;
  }

  .question-image-container {
    max-height: clamp(80px, 18vh, 150px);
  }

  .options-grid {
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }

  .option-card {
    padding: 0.6rem;
    gap: 6px;
  }

  .option-symbol {
    width: 24px;
    height: 24px;
    font-size: 0.75rem;
  }

  .option-text {
    font-size: clamp(0.75rem, 2vw, 0.9rem);
  }

  .game-status-bar {
    padding: 0.4rem 0.8rem;
    gap: 0.8rem;
  }

  .timer-circle-wrap {
    width: 44px;
    height: 44px;
  }

  .timer-circle-text {
    font-size: 1.2rem;
  }

  .timer-bar-container {
    height: 8px;
  }

  .answers-counter {
    font-size: 0.85rem;
  }

  .answers-counter span {
    font-size: 1.4rem;
  }

  /* Game Board */
  .game-board {
    padding: 0.6rem 0.8rem;
    max-height: clamp(80px, 16vh, 160px);
  }

  .board-title {
    font-size: 0.75rem;
    margin-bottom: 0.4rem;
  }

  .board-players-grid {
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 4px;
  }

  .board-player-card {
    padding: 0.35rem 0.5rem;
    gap: 5px;
  }

  .board-player-avatar {
    width: 22px;
    height: 22px;
    font-size: 0.75rem;
  }

  .board-player-name {
    font-size: 0.65rem;
  }

  .board-player-status {
    font-size: 0.55rem;
  }

  .board-player-score {
    font-size: 0.65rem;
  }

  /* Round Results */
  #round-results-panel {
    flex-direction: column;
    gap: 0.6rem;
    max-height: clamp(100px, 20vh, 200px);
  }

  .results-col {
    padding: 0.6rem;
  }

  .results-col h3 {
    font-size: 0.8rem;
    margin-bottom: 0.4rem;
  }

  .round-player-row {
    padding: 0.4rem 0.5rem;
    font-size: 0.8rem;
  }

  /* Sótano View */
  #sotano-view {
    padding: 1rem 1.2rem;
    margin: 0 auto;
    gap: 1rem;
  }

  #sotano-view h2 {
    font-size: clamp(1.5rem, 5vw, 2.2rem);
  }

  .flip-card-container {
    width: clamp(70px, 18vw, 110px);
    height: clamp(100px, 26vw, 160px);
  }

  .card-emoji {
    font-size: clamp(1.8rem, 5vw, 2.8rem);
  }

  #sotano-timer-box {
    font-size: clamp(2.5rem, 8vw, 4rem);
    min-height: 70px;
  }

  #sotano-roulette-container {
    gap: 1rem;
  }

  /* Escape View */
  #escape-view {
    padding: 0.4rem;
    gap: 0.8rem;
    margin: 0 auto;
  }

  #escape-track-container {
    padding: 0.8rem;
    overflow-x: auto;
  }

  /* escape grid header row */
  #escape-track-container > div:first-child {
    font-size: 0.65rem;
    min-width: 660px;
  }

  #escape-player-rows {
    min-width: 660px;
  }

  #escape-question-text {
    font-size: clamp(1rem, 3.5vw, 1.6rem) !important;
  }

  #escape-options-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }

  /* Leaderboard */
  .leaderboard-view {
    width: 98%;
    padding: 1rem 1.2rem;
  }

  .leaderboard-view h2 {
    font-size: clamp(1.2rem, 3.5vw, 1.8rem);
    margin-bottom: 1rem;
  }

  .leaderboard-row {
    padding: 0.7rem 0.9rem;
  }

  .leaderboard-rank {
    font-size: 1rem;
  }

  .leaderboard-name {
    font-size: 1rem;
  }

  .leaderboard-score {
    font-size: 1rem;
  }

  /* Podium */
  .podium-container {
    gap: 0.6rem;
    height: clamp(180px, 35vh, 280px);
    margin: 1rem auto 0.5rem;
  }

  .podium-place {
    width: clamp(80px, 25vw, 120px);
  }

  .podium-avatar {
    font-size: clamp(1.4rem, 4vw, 2.2rem);
    width: clamp(40px, 10vw, 65px);
    height: clamp(40px, 10vw, 65px);
    margin-bottom: 0.5rem;
  }

  .podium-pedestal h3 {
    font-size: clamp(1.3rem, 3.5vw, 2rem);
  }

  .podium-name {
    font-size: clamp(0.65rem, 1.8vw, 0.9rem);
    margin-top: 0.3rem;
  }

  .podium-score {
    font-size: clamp(0.6rem, 1.5vw, 0.85rem);
  }

  /* Podium heights responsive */
  .podium-1st { height: clamp(140px, 28vh, 220px); }
  .podium-2nd { height: clamp(110px, 22vh, 175px); }
  .podium-3rd { height: clamp(85px, 18vh, 140px); }

  /* Spectator Banner */
  #spectator-banner {
    padding: 0.5rem 0.8rem;
    font-size: 0.75rem;
    flex-wrap: wrap;
    justify-content: center;
  }

  #spectator-names {
    gap: 5px;
  }

  #spectator-names .player-tag {
    font-size: 0.7rem;
    padding: 0.25rem 0.5rem;
  }

  /* Achievements and stats en podio */
  #achievements-section,
  #stats-section {
    padding: 0.8rem;
    margin-top: 1rem;
  }

  #achievements-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
  }

  #stats-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 8px;
  }

  /* PLAYER — Join form */
  .player-container {
    padding: 0.8rem;
    gap: 0.8rem;
  }

  .player-logo-big {
    font-size: 1.8rem;
    margin-bottom: 0.3rem;
  }

  .avatar-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 7px;
  }

  .avatar-emoji {
    font-size: 1.5rem;
  }

  .avatar-label {
    font-size: 0.65rem;
  }

  .avatar-option {
    padding: 0.5rem 0.3rem;
  }

  /* PLAYER — Waiting / Lobby */
  #waiting-view,
  #spectator-view {
    max-width: 100%;
    margin: 0 auto;
    padding: 1.2rem 1rem;
  }

  .player-status-waiting {
    padding: 1rem 0.8rem;
    gap: 1rem;
  }

  .waiting-spinner {
    width: 50px;
    height: 50px;
  }

  /* PLAYER — Sótano */
  #player-sotano-view {
    max-width: 100%;
    margin: 0 auto;
    padding: 1.2rem 1rem;
  }

  #sotano-tap-btn {
    width: clamp(140px, 45vw, 180px);
    height: clamp(140px, 45vw, 180px);
    font-size: 1.4rem;
  }

  /* PLAYER — Escape */
  #player-escape-view {
    max-width: 100%;
    margin: 0 auto;
    padding: 1rem;
  }

  #player-escape-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  /* PLAYER — Game Over */
  #gameover-view {
    max-width: 100%;
    margin: 0 auto;
    padding: 1.5rem 1rem;
  }

  /* PLAYER — Controller */
  .player-game-pad {
    gap: 10px;
    padding: 10px;
    height: calc(100dvh - 105px);
  }

  .pad-symbol {
    font-size: 2.2rem;
  }

  .pad-label {
    font-size: 1rem;
  }
}

/* ===== Celular pequeño (360px–480px) ===== */
@media (max-width: 480px) {
  :root {
    --header-h: 56px;
  }

  header {
    padding: 0.5rem 0.7rem;
  }

  .logo {
    font-size: 1rem;
  }

  /* HOST — Lobby */
  .lobby-container {
    padding: 0.5rem;
    gap: 0.7rem;
  }

  /* HOST — Game View */
  .host-game-container {
    gap: 0.2rem;
    padding: 0 0.3rem;
    height: calc(100dvh - var(--header-h));
  }

  .question-display h2 {
    font-size: clamp(0.85rem, 3vw, 1.1rem);
  }

  .options-grid {
    grid-template-columns: 1fr 1fr;
    gap: 5px;
  }

  .option-card {
    padding: 0.5rem;
  }

  .option-text {
    font-size: 0.75rem;
  }

  .game-board {
    max-height: clamp(70px, 15vh, 130px);
  }

  .board-players-grid {
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  }

  /* Sótano pequeño */
  #sotano-view h2 {
    font-size: 1.4rem;
  }

  .flip-card-container {
    width: clamp(55px, 16vw, 80px);
    height: clamp(80px, 24vw, 115px);
  }

  #escape-question-text {
    font-size: 1rem !important;
  }

  #escape-options-grid {
    grid-template-columns: 1fr 1fr;
    gap: 5px;
  }

  /* Leaderboard pequeño */
  .leaderboard-view {
    padding: 0.8rem;
  }

  .leaderboard-row {
    padding: 0.6rem 0.8rem;
  }

  /* Podium pequeño */
  .podium-container {
    height: clamp(160px, 30vh, 220px);
    gap: 0.4rem;
    margin: 0.5rem auto;
  }

  .podium-place {
    width: clamp(70px, 22vw, 100px);
  }

  .podium-1st { height: clamp(120px, 22vh, 175px); }
  .podium-2nd { height: clamp(95px, 17vh, 140px); }
  .podium-3rd { height: clamp(75px, 14vh, 110px); }

  /* PLAYER — Join form pequeño */
  .player-container {
    padding: 0.5rem;
    gap: 0.6rem;
  }

  .player-logo-big {
    font-size: 1.5rem;
    margin-bottom: 0;
  }

  .avatar-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;
  }

  .avatar-emoji {
    font-size: 1.3rem;
  }

  .avatar-option {
    padding: 0.4rem 0.2rem;
    border-radius: 8px;
  }

  #character-card-container {
    padding: 0.6rem;
    gap: 0.7rem;
  }

  #char-card-img {
    width: 55px;
    height: 55px;
  }

  #char-card-name {
    font-size: 0.95rem;
  }

  #char-card-desc {
    font-size: 0.75rem;
  }

  #char-card-stats {
    font-size: 0.65rem;
  }

  /* PLAYER — game pad pequeño */
  .player-game-pad {
    gap: 8px;
    padding: 8px;
    height: calc(100dvh - 95px);
  }

  .pad-symbol {
    font-size: 2rem;
  }

  .pad-label {
    font-size: 0.9rem;
  }

  /* PLAYER — Tap botón sótano */
  #sotano-tap-btn {
    width: clamp(120px, 38vw, 160px);
    height: clamp(120px, 38vw, 160px);
    font-size: 1.2rem;
  }

  /* PLAYER — Escape opciones */
  #player-escape-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }
}

/* ===== Celular muy pequeño (< 360px) ===== */
@media (max-width: 360px) {
  .player-container {
    padding: 0.4rem;
    gap: 0.5rem;
  }

  .avatar-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
  }

  .avatar-emoji {
    font-size: 1.1rem;
  }

  #char-card-img {
    width: 45px;
    height: 45px;
  }

  .player-game-pad {
    height: calc(100dvh - 88px);
    gap: 6px;
    padding: 6px;
  }

  .pad-symbol {
    font-size: 1.7rem;
  }

  .pad-label {
    font-size: 0.8rem;
  }
}

/* ===== PLAYER MOBILE STYLES (index.html) ===== */
/* Estas clases son helpers adicionales no duplicados */
@media (max-width: 768px) {
  .player-question-text {
    font-size: 1.2rem;
    line-height: 1.3;
  }

  .player-options {
    gap: 8px;
  }

  .player-option-btn {
    padding: 1rem;
    font-size: 1rem;
    min-height: 50px;
  }

  .player-escape-options {
    gap: 6px;
  }

  .player-escape-btn {
    padding: 0.8rem;
    font-size: 0.9rem;
  }
}

@media (max-width: 480px) {
  .player-question-text {
    font-size: 1rem;
  }

  .player-option-btn {
    padding: 0.8rem;
    font-size: 0.9rem;
    min-height: 44px;
  }
}

/* ==================== ANIMATIONS & EFFECTS ==================== */

/* Entrance Animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-50px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(50px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Question Entry Animation */
.question-display {
  animation: fadeInUp 0.5s ease-out;
}

.option-card {
  animation: fadeInScale 0.4s ease-out backwards;
}

.option-card.opt-0 { animation-delay: 0.1s; }
.option-card.opt-1 { animation-delay: 0.2s; }
.option-card.opt-2 { animation-delay: 0.3s; }
.option-card.opt-3 { animation-delay: 0.4s; }

/* Answer Feedback Animations */
@keyframes correctPulse {
  0% { transform: scale(1); box-shadow: 0 0 0 rgba(56, 239, 125, 0.4); }
  50% { transform: scale(1.05); box-shadow: 0 0 30px rgba(56, 239, 125, 0.6); }
  100% { transform: scale(1); box-shadow: 0 0 0 rgba(56, 239, 125, 0); }
}

@keyframes incorrectShake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-8px); }
  20%, 40%, 60%, 80% { transform: translateX(8px); }
}

@keyframes correctGlow {
  0% { border-color: rgba(56, 239, 125, 0.5); box-shadow: 0 0 10px rgba(56, 239, 125, 0.3); }
  50% { border-color: rgba(56, 239, 125, 1); box-shadow: 0 0 40px rgba(56, 239, 125, 0.8); }
  100% { border-color: rgba(56, 239, 125, 0.5); box-shadow: 0 0 10px rgba(56, 239, 125, 0.3); }
}

@keyframes incorrectGlow {
  0% { border-color: rgba(255, 65, 108, 0.5); box-shadow: 0 0 10px rgba(255, 65, 108, 0.3); }
  50% { border-color: rgba(255, 65, 108, 1); box-shadow: 0 0 40px rgba(255, 65, 108, 0.8); }
  100% { border-color: rgba(255, 65, 108, 0.5); box-shadow: 0 0 10px rgba(255, 65, 108, 0.3); }
}

.option-card.correct {
  animation: correctPulse 0.6s ease-out, correctGlow 1.5s ease-in-out;
  background: rgba(56, 239, 125, 0.15) !important;
  border-color: #38ef7d !important;
}

.option-card.incorrect {
  animation: incorrectShake 0.5s ease-out, incorrectGlow 1.5s ease-in-out;
  background: rgba(255, 65, 108, 0.15) !important;
  border-color: #ff416c !important;
}

/* Score Animation */
@keyframes scorePopIn {
  0% { transform: scale(0); opacity: 0; }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes scoreFloatUp {
  0% { transform: translateY(0); opacity: 1; }
  100% { transform: translateY(-30px); opacity: 0; }
}

.score-popup {
  animation: scorePopIn 0.4s ease-out;
}

.score-float {
  animation: scoreFloatUp 1s ease-out forwards;
}

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

.confetti-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1000;
  overflow: hidden;
}

.confetti-piece {
  position: absolute;
  width: 10px;
  height: 10px;
  top: -10px;
  animation: confettiFall 3s ease-in forwards;
}

/* Player Status Animations */
@keyframes deathFade {
  0% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.95); }
  100% { opacity: 0.7; transform: scale(1); }
}

@keyframes resurrectionGlow {
  0% { box-shadow: 0 0 0 rgba(165, 94, 234, 0); }
  50% { box-shadow: 0 0 30px rgba(165, 94, 234, 0.8); }
  100% { box-shadow: 0 0 0 rgba(165, 94, 234, 0); }
}

.board-player-card.just-died {
  animation: deathFade 0.8s ease-out;
}

.board-player-card.just-resurrected {
  animation: resurrectionGlow 1s ease-out;
}

/* Leaderboard Row Animations */
.leaderboard-row {
  animation: slideInLeft 0.4s ease-out backwards;
}

.leaderboard-row:nth-child(1) { animation-delay: 0.1s; }
.leaderboard-row:nth-child(2) { animation-delay: 0.2s; }
.leaderboard-row:nth-child(3) { animation-delay: 0.3s; }
.leaderboard-row:nth-child(4) { animation-delay: 0.4s; }
.leaderboard-row:nth-child(5) { animation-delay: 0.5s; }

/* Round Results Animations */
.round-player-row {
  animation: fadeInUp 0.3s ease-out forwards;
}

/* Sótano Animations */
@keyframes cardFlipDramatic {
  0% { transform: rotateY(0) scale(1); }
  50% { transform: rotateY(90deg) scale(1.1); }
  100% { transform: rotateY(180deg) scale(1); }
}

.flip-card-inner.dramatic-flip {
  animation: cardFlipDramatic 1s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Escape Board Animations */
@keyframes tokenMove {
  0% { transform: translateX(0); }
  25% { transform: translateX(5px); }
  75% { transform: translateX(-5px); }
  100% { transform: translateX(0); }
}

.escape-player-token.moving {
  animation: tokenMove 0.5s ease-in-out;
}

/* Timer Urgency Animation */
@keyframes timerPulse {
  0%, 100% { transform: scale(1); color: #fff; }
  50% { transform: scale(1.1); color: #ff416c; }
}

.timer-urgent .timer-circle-text {
  animation: timerPulse 0.5s ease-in-out infinite;
}

/* Background Particles */
.bg-particles {
  background: 
    radial-gradient(circle at 20% 50%, rgba(138, 43, 226, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(255, 0, 127, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 50% 80%, rgba(0, 180, 219, 0.06) 0%, transparent 50%);
}

@keyframes floatParticle {
  0%, 100% { transform: translateY(0) translateX(0); }
  25% { transform: translateY(-20px) translateX(10px); }
  50% { transform: translateY(-10px) translateX(-10px); }
  75% { transform: translateY(-30px) translateX(5px); }
}

/* Improved Glass Panel */
.glass-panel {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.glass-panel:hover {
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 
    0 12px 40px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

/* Improved Typography */
.question-display h2 {
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  letter-spacing: -0.5px;
}

.option-text {
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  font-size: clamp(0.8rem, 1.5vw, 1.2rem);
  line-height: 1.2;
}

/* Improved Button Hover Effects */
.option-card {
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  cursor: pointer;
}

.option-card:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
}

.option-card:active {
  transform: translateY(0) scale(0.98);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

/* Improved Option Colors */
.option-card.opt-0 {
  border-left: 4px solid #ff416c;
}

.option-card.opt-1 {
  border-left: 4px solid #00b4db;
}

.option-card.opt-2 {
  border-left: 4px solid #f1c40f;
}

.option-card.opt-3 {
  border-left: 4px solid #38ef7d;
}

/* Improved Category Tag */
.category-tag {
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  letter-spacing: 1.5px;
  font-weight: 900;
}

/* Improved Timer */
.timer-bar {
  background: linear-gradient(to right, #ff416c, #ff007f, #8a2be2);
  box-shadow: 0 0 15px rgba(255, 0, 127, 0.5);
}

/* Improved Leaderboard */
.leaderboard-row:nth-child(1) {
  background: linear-gradient(135deg, rgba(241, 196, 15, 0.1), rgba(241, 196, 15, 0.02));
  border-color: rgba(241, 196, 15, 0.3);
}

.leaderboard-row:nth-child(2) {
  background: linear-gradient(135deg, rgba(189, 195, 199, 0.1), rgba(189, 195, 199, 0.02));
  border-color: rgba(189, 195, 199, 0.3);
}

.leaderboard-row:nth-child(3) {
  background: linear-gradient(135deg, rgba(230, 126, 34, 0.1), rgba(230, 126, 34, 0.02));
  border-color: rgba(230, 126, 34, 0.3);
}

/* Improved Podium */
.podium-1st .podium-pedestal {
  background: linear-gradient(135deg, #f1c40f, #f39c12);
  box-shadow: 0 0 30px rgba(241, 196, 15, 0.4);
}

.podium-2nd .podium-pedestal {
  background: linear-gradient(135deg, #bdc3c7, #95a5a6);
  box-shadow: 0 0 25px rgba(189, 195, 199, 0.3);
}

.podium-3rd .podium-pedestal {
  background: linear-gradient(135deg, #e67e22, #d35400);
  box-shadow: 0 0 20px rgba(230, 126, 34, 0.3);
}

/* Improved Sótano */
#sotano-view h2 {
  text-shadow: 0 0 30px rgba(255, 65, 108, 0.6);
}

/* Improved Escape Board */
.escape-track-container {
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.2));
  border: 1px solid rgba(241, 196, 15, 0.15);
}

.escape-space {
  transition: all 0.3s ease;
}

.escape-space:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: translateY(-2px);
}

/* Accessibility Improvements */
.option-card:focus-visible,
.btn:focus-visible {
  outline: 3px solid #8a2be2;
  outline-offset: 2px;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Hide scrollbar but keep functionality */
.game-board::-webkit-scrollbar,
#round-results-panel::-webkit-scrollbar,
#correct-players-list::-webkit-scrollbar,
#incorrect-players-list::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}

.game-board::-webkit-scrollbar-track,
#round-results-panel::-webkit-scrollbar-track,
#correct-players-list::-webkit-scrollbar-track,
#incorrect-players-list::-webkit-scrollbar-track {
  background: transparent;
}

.game-board::-webkit-scrollbar-thumb,
#round-results-panel::-webkit-scrollbar-thumb,
#correct-players-list::-webkit-scrollbar-thumb,
#incorrect-players-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

.game-board::-webkit-scrollbar-thumb:hover,
#round-results-panel::-webkit-scrollbar-thumb:hover,
#correct-players-list::-webkit-scrollbar-thumb:hover,
#incorrect-players-list::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}


