/* Retrying GitHub Deploy */
:root {
  --bg-color: #0F0E0E;
  /* Fondo oscuro profundo */
  --card-bg: #1A1A1A;
  --primary-color: #E85D04;
  /* Naranja estilo botón */
  --text-main: #FFFFFF;
  --text-muted: #B0B0B0;
  --font-family: system-ui, -apple-system, sans-serif;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
  font-family: var(--font-family);
  background-color: #0F0E0E !important;
  /* Force dark background */
  color: var(--text-main);
  line-height: 1.6;
}

/* MODIFICADOR: Sin Scroll (Para la página de Juego) */
.no-scroll {
  overflow: hidden;
  height: 100vh;
  position: fixed;
  /* Asegura que no se mueva en iOS */
  width: 100%;
}

/* utilidades */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.btn {
  background-color: var(--primary-color);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 9999px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.2s;
}

.btn:hover {
  transform: scale(1.05);
  background-color: #dc5000;
}

/* Navbar */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 0;
}

.logo {
  font-size: 1.5rem;
  font-weight: bold;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  user-select: none;
  transition: opacity 0.2s;
}

.logo:hover {
  opacity: 0.8;
}

.navbar nav a {
  color: var(--text-muted);
  text-decoration: none;
  margin: 0 1rem;
  font-size: 0.9rem;
  transition: color 0.2s;
}

.navbar nav a:hover {
  color: var(--text-main);
}

/* Hero Section */
.hero {
  text-align: center;
  padding: 2rem 0;
  /* Reduced padding slightly */
  min-height: calc(100vh - 140px);
  /* Fill remaining space minus header */
  display: flex;
  flex-direction: column;
  justify-content: center;
  /* Center content vertically */
  align-items: center;
  box-sizing: border-box;
}

.title {
  font-family: 'Georgia', serif;
  /* Simular fuente serif del título */
  font-size: 3.5rem;
  margin-bottom: 1rem;
}

.subtitle {
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto 2.5rem auto;
  font-size: 1.1rem;
}

/* How to Play Typography */
.icon-header {
  font-size: 4rem;
  display: block;
  margin-bottom: 0.5rem;
}

.main-title {
  font-size: 3rem;
  margin: 0;
  font-family: 'Georgia', serif;
}

.subtitle-header {
  font-size: 2rem;
  color: #B0B0B0;
  margin-top: 0;
}

@media (max-width: 768px) {
  .icon-header {
    font-size: 3rem;
  }

  .main-title {
    font-size: 2.2rem;
  }

  .subtitle-header {
    font-size: 1.5rem;
  }
}

/* Grid de tarjetas (Removed) */

.card {
  background-color: var(--card-bg);
  background: linear-gradient(180deg, #1e1e1e 0%, #0f0e0e 100%);
  border-radius: 16px;
  overflow: hidden;
  text-align: left;
  border: 1px solid #333;
}

.card-image-placeholder {
  height: 200px;
  width: 100%;
  background-color: #2a2a2a;
}

/* Gradientes artísticos para las imagenes */
.art-1 {
  background: radial-gradient(circle at center, #d4a373, #222);
}

.art-2 {
  background: radial-gradient(circle at center, #ea580c, #121212);
}

.art-3 {
  background: radial-gradient(circle at center, #65a30d, #1a1a1a);
}

.card-content {
  padding: 2rem;
}

.step-number {
  font-family: 'Georgia', serif;
  font-size: 4rem;
  color: var(--primary-color);
  opacity: 0.9;
  line-height: 1;
  margin-bottom: 0.5rem;
}

.card h3 {
  font-size: 1.5rem;
  margin-bottom: 0.75rem;
  margin-top: 0;
}

.card p {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.7;
}

.highlight {
  color: var(--primary-color);
  font-weight: bold;
}

.hidden {
  display: none !important;
}

/* Animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.instruction-card {
  opacity: 0;
  /* Initially hidden */
  animation: fadeInUp 0.6s ease-out forwards;
}

.step-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.instructions-container {
  padding-bottom: 4rem;
}

/* Hero Buttons */
.hero-actions {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  align-items: center;
  margin-top: 2rem;
}

.btn-large {
  padding: 1rem 2.5rem;
  font-size: 1.5rem;
  border-radius: 50px;
}

.btn-secondary {
  background-color: transparent;
  border: 2px solid #555;
  color: var(--text-main);
}

.btn-secondary:hover {
  background-color: rgba(255, 255, 255, 0.1);
  border-color: var(--text-main);
  transform: scale(1.05);
  /* Match the primary button hover effect */
}

/* Modal Styles */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  backdrop-filter: blur(5px);
}

.modal-content {
  background-color: var(--card-bg);
  padding: 2rem;
  border-radius: 16px;
  border: 1px solid #333;
  text-align: center;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  animation: fadeInUp 0.3s ease-out;
}

.input-dark {
  background-color: #0F0E0E;
  border: 1px solid #333;
  color: white;
  padding: 0.8rem;
  border-radius: 8px;
  width: 80px;
  font-size: 1.5rem;
  text-align: center;
  margin: 1rem 0;
  outline: none;
}

.input-dark:focus {
  border-color: var(--primary-color);
}

.modal-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 1.5rem;
}

/* User added styles for game logic */
#btn-reveal-role {
  transition: transform 0.1s, background-color 0.1s;
  user-select: none;
  /* Prevent text selection */
  -webkit-user-select: none;
  touch-action: none;
}

#btn-reveal-role:active {
  transform: scale(0.95);
  background-color: var(--primary-color) !important;
}

/* Role Reveal Card UI */
.role-card {
  background: var(--card-bg);
  border: 1px solid #333;
  border-radius: 20px;
  padding: 3rem;
  max-width: 400px;
  width: 90%;
  margin: 0 auto;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  min-height: 300px;
  justify-content: center;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.role-card h2 {
  font-size: 2.5rem;
  margin: 0;
  color: white;
}

.role-card .instruction {
  color: var(--text-muted);
  font-size: 1.1rem;
}

.role-card .secret-reveal {
  font-size: 3rem;
  font-weight: bold;
  color: var(--primary-color);
  margin: 1rem 0;
  animation: fadeIn 0.3s ease;
}

.role-card .role-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

#role-secret-container {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: #000000;
  z-index: 9999;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 2rem;
  box-sizing: border-box;
}

#role-secret-container.active {
  display: flex !important;
}

#role-secret-container h1 {
  font-size: 4rem;
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: 2px;
}

#role-secret-container p {
  font-size: 1.5rem;
  color: #cccccc;
  max-width: 80%;
  line-height: 1.4;
}

#voting-grid button {
  padding: 1.5rem;
  font-size: 1.2rem;
  background: #2a2a2a;
  border: 1px solid #444;
  border-radius: 12px;
  color: white;
  cursor: pointer;
  transition: all 0.2s;
}

#voting-grid button:hover {
  background: #3a3a3a;
  border-color: var(--primary-color);
}

/* Fixed Exit Button */
.btn-exit-fixed {
  position: fixed;
  top: 20px;
  right: 20px;
  background: rgba(255, 255, 255, 0.1);
  color: #ff6b6b;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  width: 45px;
  height: 45px;
  font-size: 1.5rem;
  cursor: pointer;
  z-index: 2000;
  display: flex;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(5px);
  transition: all 0.2s ease;
}

.btn-exit-fixed:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: #ef4444;
  transform: rotate(90deg);
}

/* =========================================
   PREMIUM MOBILE DESIGN & RESPONSIVE
   ========================================= */

/* Background Enhancements */
#screen-role-reveal {
  background: radial-gradient(circle at center, #1a1a1a 0%, #000000 100%);
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 100;
  margin: 0;
  padding: 0;
}

/* Premium Card Design */
.role-card {
  background: rgba(25, 25, 25, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.05);
  border-radius: 24px;
  padding: 3rem 2rem;
  width: 85%;
  max-width: 380px;
  margin: 0 auto;
  transform: translateY(0);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* Icon Glow Effect */
.role-icon {
  font-size: 5rem;
  margin-bottom: 1.5rem;
  filter: drop-shadow(0 0 20px rgba(232, 93, 4, 0.2));
  animation: float 6s ease-in-out infinite;
}

/* Typography Boost */
.role-card h2 {
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, #fff 0%, #ccc 100%);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.role-card .instruction {
  font-size: 1.1rem;
  color: #888;
  margin-bottom: 2rem;
  font-weight: 500;
}

/* Premium Action Button */
#btn-card-action {
  width: 100%;
  padding: 1.2rem;
  font-size: 1.3rem;
  font-weight: 700;
  border-radius: 16px;
  background: linear-gradient(135deg, #E85D04 0%, #dc2626 100%);
  box-shadow: 0 10px 20px -5px rgba(232, 93, 4, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.1);
  letter-spacing: 0.5px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

#btn-card-action:active {
  transform: scale(0.96);
  box-shadow: 0 5px 10px -5px rgba(232, 93, 4, 0.4);
}

/* Fixed Exit Button Refinement */
.btn-exit-fixed {
  top: 24px;
  right: 24px;
  width: 48px;
  height: 48px;
  background: rgba(20, 20, 20, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  color: #ff4444;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Floating Animation */
@keyframes float {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-10px);
  }
}

/* Hide logo text on small screens to prevent overlap */
@media (max-width: 768px) {
  .logo-text {
    display: none;
  }
}

/* Base Responsive Utilities */
.fullscreen-center {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 100%;
  padding: 0;
  /* Remove padding as it might conflict */
  box-sizing: border-box;
}

@media (max-width: 768px) {
  .role-card {
    width: 85% !important;
    max-width: 340px !important;
    margin: 0 auto !important;
    padding: 1.5rem 1rem !important;
    border-radius: 24px;
    box-sizing: border-box;
    transform: none !important;

    /* Layout Logic */
    height: auto !important;
    min-height: auto !important;
    max-height: 90vh !important;
    overflow: visible !important;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.5rem;
  }

  /* Compact inner elements for Mobile */
  .role-card .role-icon {
    font-size: 3.5rem !important;
    margin-bottom: 0.2rem !important;
    margin-top: 0 !important;
  }

  .role-card h2 {
    font-size: 1.6rem !important;
    margin: 0.2rem 0 !important;
  }

  .role-card .instruction {
    font-size: 1rem !important;
    margin-bottom: 1rem !important;
    line-height: 1.3;
  }

  .role-card .btn {
    width: 100%;
    padding: 1rem !important;
    font-size: 1.1rem !important;
    margin-top: 0.5rem !important;
  }

  /* Adjust the secret word size if visible */
  .role-card .secret-reveal {
    font-size: 2rem !important;
    margin: 0.5rem 0 !important;
  }

  #screen-role-reveal {
    padding: 0 !important;
    margin: 0 !important;
    box-sizing: border-box;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    position: fixed;
    display: flex;
    justify-content: center;
    align-items: center;
  }
}

/* Typography fix for How To Play on Mobile */
@media (max-width: 768px) {
  .hero .title {
    font-size: 2rem;
    /* Reduce main title size */
  }

  .instruction-card {
    min-height: auto;
    /* Remove forced height */
    aspect-ratio: auto;
    padding: 1.5rem;
  }

  .instruction-card h3 {
    font-size: 1.4rem;
  }

  .instruction-card .step-icon {
    font-size: 3.5rem;
  }
}

/* Game Instruction Step Cards (Blue Style) */
.instruction-step {
  background: rgba(30, 40, 60, 0.6);
  border: 1px solid rgba(100, 150, 255, 0.2);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: transform 0.2s;
}

.instruction-step:hover {
  transform: translateY(-2px);
  background: rgba(40, 50, 80, 0.8);
  border-color: rgba(100, 150, 255, 0.4);
}

.step-badge {
  background: #3b82f6;
  color: white;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: bold;
  flex-shrink: 0;
}

.step-content {
  flex-grow: 1;
}

.step-content h3 {
  margin: 0;
  font-size: 1.1rem;
  color: white;
}

.step-content p {
  margin: 0.2rem 0 0 0;
  font-size: 0.9rem;
  color: #b0c4de;
}

.step-icon {
  font-size: 1.5rem;
  background: rgba(255, 255, 255, 0.1);
  padding: 0.5rem;
  border-radius: 8px;
  width: 40px;
  height: 40px;
  align-items: center;
  display: flex;
  /* Ensure flex behavior */
  justify-content: center;
}

/* =========================================
   COMPACT MODE FOR GAME ROUND
   ========================================= */

/* Desktop & General Tweak: Change buttons position */
#screen-game-round .hero {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  /* Centrar verticalmente en desktop también */
}

#screen-game-round div[style*="margin-top"] {
  margin-top: 1rem !important;
  /* Reducir espacio superior de botones */
}

/* Mobile Fit (No Scroll) */
@media (max-width: 600px),
(max-height: 750px) {

  #screen-game-round .hero {
    padding: 0;
    height: calc(100vh - 70px);
    /* Usar altura exacta disponible */
    justify-content: center;
    /* Empaquetar todo al centro */
    gap: 0.5rem;
  }

  /* SCROLL FIX FOR RESULTS SCREEN (Added dynamically via JS) */
  #screen-game-round.results-mode .hero {
    height: calc(100dvh - 90px) !important;
    /* Constrain height to viewport minus header */
    min-height: 0 !important;
    overflow-y: auto !important;
    /* Enable internal scrolling */
    justify-content: flex-start !important;
    padding-top: 1rem !important;
    padding-bottom: 6rem !important;
    /* Generous padding to ensure button visibility */
    display: block !important;
    -webkit-overflow-scrolling: touch;
    /* Smooth scroll on iOS */

    /* Hide Scrollbar but keep functionality */
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE/Edge */
  }

  #screen-game-round.results-mode .hero::-webkit-scrollbar {
    display: none;
    /* Chrome/Safari */
  }

  /* Título más compacto */
  #screen-game-round h2 {
    font-size: 1.3rem;
    margin: 0.2rem 0;
  }

  /* Lista compacta */
  .game-instructions-list {
    width: 100%;
    margin: 0 !important;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    /* Menos espacio entre items */
  }

  .instruction-step {
    padding: 0.5rem;
    margin-bottom: 0;
    /* Quitar margen externo */
    gap: 0.6rem;
    border-radius: 8px;
    background: rgba(30, 40, 60, 0.4);
    /* Fondo más sutil */
  }

  .step-badge {
    width: 20px;
    height: 20px;
    font-size: 0.8rem;
  }

  .step-icon {
    width: 28px;
    height: 28px;
    font-size: 1rem;
    padding: 0.2rem;
  }

  .step-content h3 {
    font-size: 0.95rem;
    margin-bottom: 0.1rem;
  }

  .step-content p {
    font-size: 0.75rem;
    line-height: 1.1;
  }

  /* Contenedor de botones pegado */
  #screen-game-round div[style*="margin-top"] {
    margin-top: 0.5rem !important;
    gap: 0.5rem !important;
    width: 100%;
    padding: 0 10px;
    box-sizing: border-box;
  }

  #btn-goto-vote,
  #btn-new-word {
    padding: 0.6rem;
    font-size: 0.95rem;
    flex: 1;
    margin: 0;
  }
}

/* =========================================
   USER REQUEST: UNIFORM CARD SIZING
   ========================================= */

/* Enforce a fixed height so both 'Turn' and 'Reveal' cards look identical */
.role-card {
  height: 380px;
  max-height: 60vh;
  justify-content: center;
}

/* When the role is revealed, hide the icon to save space and match the height of the Turn card */
.role-card.revealed-mode .role-icon {
  display: none;
}

/* Adjust title size in revealed mode to compensate visually */
.role-card.revealed-mode h2 {
  margin-bottom: 0.5rem;
  font-size: 2.5rem;
}

/* --- IMPOSTOR ALERT STYLES --- */
.role-card.is-impostor {
  border: 2px solid #ff4444;
  /* Bright red border */
  box-shadow: 0 0 30px rgba(255, 68, 68, 0.4);
  /* Red glow */
  background: radial-gradient(circle at center, #2a1111 0%, #000000 100%);
}

.role-card.is-impostor h2 {
  color: #ff4444 !important;
  text-shadow: 0 0 10px rgba(255, 68, 68, 0.5);
  background: none;
  -webkit-text-fill-color: initial;
}

.role-card.is-impostor .instruction {
  color: #ffcccc;
  font-weight: bold;
  font-size: 1.2rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.role-card.is-impostor .secret-reveal {
  color: #ff4444 !important;
  font-size: clamp(2rem, 7vw, 2.8rem);
  /* Fuente flexible para impostor */
}


/* --- ESTILOS DE CIVIL (SEGURO/AZUL) --- */
.role-card.is-civil {
  border: 2px solid #3B82F6;
  /* Borde Azul Heroico */
  box-shadow: 0 0 30px rgba(59, 130, 246, 0.4);
  /* Resplandor Azul */
  background: radial-gradient(circle at center, #0f1c2e 0%, #000000 100%);
  /* Fondo azul oscuro profundo */
}

.role-card.is-civil h2 {
  color: #3B82F6 !important;
  text-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
  background: none;
  -webkit-text-fill-color: initial;
}

.role-card.is-civil .instruction {
  color: #bfdbfe;
  /* Azul muy claro para texto instructivo */
  font-weight: bold;
  font-size: 1.2rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.role-card.is-civil .secret-reveal {
  color: #3B82F6 !important;
  font-size: clamp(2rem, 8vw, 3rem);
  /* Fuente flexible: se encoge si no hay espacio */
}

/* --- SOLUCIONES DE AJUSTE (LAYOUT) --- */
/* Manejo inteligente de palabras largas */
.role-card .secret-reveal {
  word-wrap: break-word;
  /* Romper palabras largas si es necesario */
  overflow-wrap: break-word;
  hyphens: auto;
  width: 100%;
  line-height: 1.1;
  padding: 0 10px;
  /* Margen de seguridad lateral */
  box-sizing: border-box;
}

/* Espaciado vertical compacto en modo revelado */
.role-card.revealed-mode {
  justify-content: space-between;
  /* Usar space-between para máxima separación controlada */
  padding-top: 2rem;
  padding-bottom: 2rem;
  gap: 0.5rem;
  /* Pequeño espacio flexible entre elementos */
}

.role-card.revealed-mode .secret-reveal {
  margin: auto 0;
  /* Centrar verticalmente en el espacio disponible */
}

.role-card.revealed-mode .instruction {
  margin-bottom: 0.5rem;
}

/* Default color for Civil word */
.role-card:not(.is-impostor) .secret-reveal {
  color: #E85D04;
  font-size: clamp(2rem, 8vw, 3rem);
}

/* BOTÓN NUEVA PALABRA (Rectangular y Resaltante) */
.btn-new-word-rect {
  position: relative;
  display: inline-block;
  width: fit-content;
  height: auto;
  margin: 2rem auto 0 auto;
  /* Centrado extra por si acaso */

  background: rgba(42, 157, 143, 0.2);
  color: #2a9d8f;
  border: 2px solid #2a9d8f;
  padding: 0.8rem 2rem;
  border-radius: 8px;
  font-weight: bold;
  font-size: 1.1rem;
  cursor: pointer;
  z-index: 2000;
  backdrop-filter: blur(5px);
  transition: all 0.3s ease;
  box-shadow: 0 0 10px rgba(42, 157, 143, 0.3);
  text-transform: uppercase;
  letter-spacing: 1px;
  line-height: normal;
  /* Asegurar altura correcta */
}

.btn-new-word-rect:hover {
  background: #2a9d8f;
  color: #000;
  box-shadow: 0 0 20px rgba(42, 157, 143, 0.6);
  transform: translateY(-5px);
}

.btn-new-word-rect.hidden {
  display: none !important;
}

@media (max-width: 600px) {
  .btn-new-word-rect {
    padding: 0.6rem 1.5rem;
    font-size: 1rem;
    margin-top: 1.5rem;
  }
}

@keyframes pulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 10px rgba(42, 157, 143, 0.3);
  }

  50% {
    transform: scale(1.05);
    /* Slight scale */
    box-shadow: 0 0 20px rgba(42, 157, 143, 0.8);
  }

  100% {
    transform: scale(1);
    box-shadow: 0 0 10px rgba(42, 157, 143, 0.3);
  }
}

/* LISTA DE JUGADORES CON SCROLLBAR PERSONALIZADO */
.player-list-scroll {
  list-style: none;
  padding: 0;
  max-width: 400px;
  margin: 0 auto;
  max-height: 40vh;
  /* Un poco menos para asegurar que el botón se vea */
  overflow-y: auto;
  border-radius: 8px;
  padding-right: 5px;
  /* Espacio para el scrollbar */
}

/* Estilos del Scrollbar (Webkit: Chrome, Safari, Edge) */
.player-list-scroll::-webkit-scrollbar {
  width: 8px;
}

.player-list-scroll::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
}

.player-list-scroll::-webkit-scrollbar-thumb {
  background: #333;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.player-list-scroll::-webkit-scrollbar-thumb:hover {
  background: var(--primary-color);
}

/* =========================================
   GLOBAL MOBILE OPTIMIZATIONS
   ========================================= */
@media (max-width: 768px) {

  /* Reducir tamaño de títulos gigantes en móviles */
  .title,
  h1 {
    font-size: clamp(2rem, 5vw, 2.5rem);
  }

  /* Ajustar Hero para pantallas pequeñas */
  .hero {
    padding: 2rem 0;
    min-height: auto;
    /* Permitir que fluya si hace falta */
  }

  /* Aprovechar mejor el ancho en móvil */
  .container {
    padding: 0 16px;
  }

  /* Cartas e instrucciones más compactas */
  .instruction-card,
  .card {
    padding: 1.5rem;
    min-height: auto;
  }

  /* Inputs más amigables (evita zoom en iOS con 16px) */
  input[type="text"],
  input[type="number"] {
    font-size: 16px !important;
    padding: 12px !important;
  }

  /* Botones fáciles de tocar */
  .btn {
    padding: 0.8rem 1.5rem;
  }

  /* Habilitar scroll en TODA la página para móvil */
  html,
  body {
    overflow-y: auto !important;
    height: auto !important;
    position: static !important;
  }

  /* REVERT: Botón 'Hecho' vuelve al flujo normal, ya que ahora hay scroll */
  #btn-start-game {
    position: static;
    transform: none;
    box-shadow: none;
    width: 100%;
    /* Botón ancho fácil de ver */
    margin-top: 1rem;
    display: block;
    /* Asegurar que se comporte como bloque */
  }

  /* Espacio extra en la lista para que no quede tapada por el botón fijo */
  #player-list {
    margin-bottom: 0;
  }
}

/* Stepper Control */
.stepper-control {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  margin: 1.5rem 0;
}

.btn-stepper {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  font-size: 2rem;
  line-height: 1;
  font-weight: bold;
  background-color: var(--card-bg);
  border: 2px solid #555;
  color: white;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}

.btn-stepper:hover {
  border-color: var(--primary-color);
  background-color: #333;
  color: var(--primary-color);
}

.btn-stepper:active {
  transform: scale(0.9);
}

.stepper-value {
  font-size: 3.5rem;
  font-weight: bold;
  min-width: 60px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  color: white;
}