/* =====================================================================
   Block English · Estilos
   ===================================================================== */
:root {
  --fondo: #0f1233;
  --fondo-2: #1a1f4d;
  --tarjeta: rgba(255, 255, 255, 0.06);
  --borde: rgba(255, 255, 255, 0.12);
  --texto: #f5f6ff;
  --texto-suave: #b8bce0;
  --primario: #ff7a45;
  --primario-2: #ffb347;
  --secundario: #4f8dff;
  --secundario-2: #7dd3fc;
  --terciario: #a855f7;
  --exito: #22c55e;
  --error: #ef4444;
  --oro: #fbbf24;
  --celda: rgba(255, 255, 255, 0.07);
  --celda-borde: rgba(255, 255, 255, 0.05);
  --radio: 20px;
  --sombra: 0 20px 60px rgba(0, 0, 0, 0.45);
  --tam-celda: 40px;
  --gap-celda: 4px;
}

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

html, body { height: 100%; }

body {
  font-family: 'Nunito', system-ui, sans-serif;
  background: radial-gradient(1200px 800px at 10% 10%, #2a1f6b 0%, transparent 60%),
              radial-gradient(1000px 700px at 90% 90%, #0b3d5c 0%, transparent 60%),
              linear-gradient(160deg, var(--fondo) 0%, var(--fondo-2) 100%);
  color: var(--texto);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

h1, h2, h3 { font-family: 'Fredoka', 'Nunito', sans-serif; letter-spacing: 0.3px; }
h2 { font-size: 1.9rem; margin-bottom: 8px; }
h3 { font-size: 1.5rem; }

.oculto { display: none !important; }
.centrado { text-align: center; }
.texto-suave { color: var(--texto-suave); line-height: 1.5; font-size: 0.98rem; }

/* ---------- Fondo animado ---------- */
.bg-shapes { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.bg-shapes span {
  position: absolute; width: 80px; height: 80px; border-radius: 18px; opacity: 0.12;
  animation: flotar 14s ease-in-out infinite;
}
.bg-shapes span:nth-child(1) { left: 5%;  top: 15%; background: var(--primario);  animation-delay: 0s; }
.bg-shapes span:nth-child(2) { left: 85%; top: 10%; background: var(--secundario); animation-delay: -3s; width: 120px; height: 120px; }
.bg-shapes span:nth-child(3) { left: 75%; top: 70%; background: var(--terciario); animation-delay: -6s; }
.bg-shapes span:nth-child(4) { left: 15%; top: 75%; background: var(--exito);     animation-delay: -9s; width: 60px; height: 60px; }
.bg-shapes span:nth-child(5) { left: 50%; top: 5%;  background: var(--oro);       animation-delay: -2s; width: 50px; height: 50px; }
.bg-shapes span:nth-child(6) { left: 45%; top: 85%; background: var(--secundario-2); animation-delay: -11s; width: 90px; height: 90px; }
@keyframes flotar {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-30px) rotate(15deg); }
}

/* ---------- Pantallas ---------- */
.pantalla {
  display: none; position: relative; z-index: 1;
  min-height: 100vh; padding: 24px 16px; align-items: center; justify-content: center;
}
.pantalla.activa { display: flex; animation: aparecer 0.35s ease; }
@keyframes aparecer { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.tarjeta {
  width: 100%; max-width: 480px;
  background: var(--tarjeta); border: 1px solid var(--borde);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-radius: var(--radio); padding: 28px 24px; box-shadow: var(--sombra);
  position: relative;
}
.tarjeta-menu { text-align: center; max-width: 440px; }
.tarjeta-ranking { max-width: 560px; }

/* ---------- Logo ---------- */
.logo { margin-bottom: 26px; }
.logo h1 { font-size: 2.8rem; line-height: 1; font-weight: 700; }
.logo h1 span { color: var(--primario-2); }
.logo .subtitulo { color: var(--texto-suave); margin-top: 8px; font-size: 0.95rem; }
.logo-bloques { display: inline-grid; grid-template-columns: repeat(2, 30px); gap: 5px; margin-bottom: 14px; }
.logo-bloques i { width: 30px; height: 30px; border-radius: 8px; display: block; animation: latido 2.2s ease-in-out infinite; }
.logo-bloques .b1 { background: var(--primario); }
.logo-bloques .b2 { background: var(--secundario); animation-delay: 0.2s; }
.logo-bloques .b3 { background: var(--exito); animation-delay: 0.4s; }
.logo-bloques .b4 { background: var(--terciario); animation-delay: 0.6s; }
@keyframes latido { 0%, 100% { transform: scale(1); } 50% { transform: scale(0.85); } }

/* ---------- Botones ---------- */
.btn {
  font-family: 'Fredoka', sans-serif; font-weight: 600; font-size: 1.05rem;
  border: none; border-radius: 14px; padding: 13px 20px; cursor: pointer; color: #fff;
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
}
.btn:active { transform: scale(0.96); }
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; filter: none; transform: none; }
.btn-primario   { background: linear-gradient(135deg, var(--primario), var(--primario-2)); box-shadow: 0 8px 24px rgba(255, 122, 69, 0.35); }
.btn-secundario { background: linear-gradient(135deg, var(--secundario), var(--secundario-2)); box-shadow: 0 8px 24px rgba(79, 141, 255, 0.35); }
.btn-terciario  { background: rgba(255, 255, 255, 0.1); border: 1px solid var(--borde); }
.btn-texto { background: none; color: var(--texto-suave); font-size: 0.95rem; text-decoration: underline; padding: 8px; }
.btn-ancho { width: 100%; }
.btn-pequeno { padding: 8px 14px; font-size: 0.9rem; border-radius: 10px; }
.btn-grande { width: 100%; padding: 16px 20px; text-align: left; justify-content: flex-start; }
.btn-grande .icono { font-size: 1.7rem; width: 42px; text-align: center; }
.btn-grande span:last-child { display: flex; flex-direction: column; }
.btn-grande strong { font-size: 1.15rem; }
.btn-grande small { font-family: 'Nunito', sans-serif; font-weight: 600; opacity: 0.85; font-size: 0.82rem; }
.botones-menu { display: flex; flex-direction: column; gap: 12px; }
.btn-volver {
  background: none; border: none; color: var(--texto-suave); cursor: pointer;
  font-family: 'Nunito', sans-serif; font-weight: 700; font-size: 0.95rem; margin-bottom: 14px; padding: 4px 0;
}
.btn-volver:hover { color: var(--texto); }
.fila-botones { display: flex; gap: 10px; margin-top: 16px; }
.fila-botones .btn { flex: 1; }

/* ---------- Campos ---------- */
.campo { display: block; margin: 16px 0; }
.campo span { display: block; font-weight: 700; margin-bottom: 6px; font-size: 0.9rem; color: var(--texto-suave); }
.campo input {
  width: 100%; padding: 13px 14px; font-size: 1.05rem; font-family: inherit; font-weight: 600;
  border-radius: 12px; border: 2px solid var(--borde); background: rgba(0, 0, 0, 0.25); color: var(--texto); outline: none;
  transition: border-color 0.15s;
}
.campo input:focus { border-color: var(--secundario); }
.input-codigo { text-transform: uppercase; letter-spacing: 6px; font-family: 'Fredoka', sans-serif; font-size: 1.5rem !important; text-align: center; }
.mensaje-error { color: #fca5a5; background: rgba(239, 68, 68, 0.15); border: 1px solid rgba(239, 68, 68, 0.4); padding: 10px 12px; border-radius: 10px; margin-top: 12px; font-size: 0.92rem; }

/* ---------- Select ---------- */
.campo select {
  width: 100%; padding: 13px 14px; font-size: 1.05rem; font-family: inherit; font-weight: 700;
  border-radius: 12px; border: 2px solid var(--borde); background: rgba(0, 0, 0, 0.25); color: var(--texto); outline: none;
  -webkit-appearance: none; appearance: none; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--texto-suave) 50%), linear-gradient(135deg, var(--texto-suave) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%; background-size: 6px 6px; background-repeat: no-repeat;
}
.campo select:focus { border-color: var(--secundario); }
.campo select option { background: #1a1f4d; color: var(--texto); }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 6px; background: rgba(0, 0, 0, 0.25); padding: 5px; border-radius: 12px; margin: 14px 0; }
.tab {
  flex: 1; border: none; background: transparent; color: var(--texto-suave); font-family: 'Fredoka', sans-serif;
  font-weight: 600; font-size: 1rem; padding: 10px; border-radius: 9px; cursor: pointer; transition: all 0.15s;
}
.tab.activa { background: rgba(255, 255, 255, 0.12); color: var(--texto); }
.tab-contenido { display: none; }
.tab-contenido.activa { display: block; animation: aparecer 0.25s ease; }

/* ---------- Sala de espera ---------- */
.codigo-sala {
  font-family: 'Fredoka', sans-serif; font-size: 3.6rem; font-weight: 700; letter-spacing: 10px; text-align: center;
  background: linear-gradient(135deg, var(--primario-2), var(--primario)); -webkit-background-clip: text; background-clip: text; color: transparent;
  margin: 14px 0 22px; padding: 14px; border: 2px dashed var(--borde); border-radius: 16px; user-select: all; cursor: pointer;
}
.jugadores-sala { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.jugador-chip {
  flex: 1; background: rgba(0, 0, 0, 0.25); border: 1px solid var(--borde); border-radius: 14px; padding: 14px 10px;
  display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center;
}
.jugador-chip .avatar {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 1.2rem;
  background: linear-gradient(135deg, var(--secundario), var(--terciario));
}
.jugador-chip .nombre { font-weight: 800; font-size: 1.05rem; word-break: break-word; }
.jugador-chip .estado-chip { font-size: 0.75rem; color: var(--texto-suave); text-transform: uppercase; letter-spacing: 1px; }
.jugador-chip.esperando .avatar { background: rgba(255, 255, 255, 0.1); animation: pulso 1.4s infinite; }
.jugador-chip.esperando .nombre { color: var(--texto-suave); font-style: italic; }
.jugador-chip.listo { border-color: var(--exito); }
.vs { font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 1.4rem; color: var(--primario-2); }
@keyframes pulso { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

.sala-info { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; font-size: 0.85rem; font-weight: 800; color: var(--texto-suave); }
.sala-info span { background: rgba(0, 0, 0, 0.25); border: 1px solid var(--borde); padding: 5px 12px; border-radius: 999px; }
.chip-dificultad.d-1 { color: #86efac; } .chip-dificultad.d-2 { color: #fde68a; } .chip-dificultad.d-3 { color: #fca5a5; }
.jugadores-sala { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.jugador-chip.propio { border-color: var(--primario); }
.jugador-chip .desconectado { font-size: 0.7rem; color: #fca5a5; }

/* Marcador en vivo (versus con varios jugadores) */
.marcador-vivo { display: flex; flex-direction: column; gap: 5px; background: var(--tarjeta); border: 1px solid var(--borde); border-radius: 14px; padding: 8px 10px; }
.marcador-fila { display: grid; grid-template-columns: 26px 1fr auto; align-items: center; gap: 8px; font-size: 0.9rem; font-weight: 700; padding: 3px 6px; border-radius: 8px; }
.marcador-fila .pos { color: var(--texto-suave); font-family: 'Fredoka', sans-serif; }
.marcador-fila .nombre { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.marcador-fila .pts { font-family: 'Fredoka', sans-serif; color: var(--secundario-2); }
.marcador-fila.propio { background: rgba(255, 122, 69, 0.15); }
.marcador-fila.propio .pts { color: var(--primario-2); }
.marcador-fila.off .nombre { opacity: 0.5; text-decoration: line-through; }

/* ---------- Aviso de conexión ---------- */
.aviso-conexion {
  position: fixed; top: 10px; left: 50%; transform: translateX(-50%); z-index: 50;
  background: rgba(251, 191, 36, 0.18); border: 1px solid rgba(251, 191, 36, 0.5); color: #fde68a;
  padding: 7px 14px; border-radius: 999px; font-size: 0.85rem; font-weight: 700; display: flex; align-items: center; gap: 8px;
}
.aviso-conexion .punto { width: 8px; height: 8px; border-radius: 50%; background: var(--oro); animation: pulso 1s infinite; }

/* ---------- Juego ---------- */
#pantalla-juego { padding: 12px 10px 20px; align-items: flex-start; }
.juego-layout { width: 100%; max-width: 520px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; }

.hud {
  display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: stretch;
  background: var(--tarjeta); border: 1px solid var(--borde); border-radius: 16px; padding: 10px 12px;
}
.hud-bloque { display: flex; flex-direction: column; justify-content: center; position: relative; }
.hud-etiqueta { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 1px; color: var(--texto-suave); font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-valor { font-family: 'Fredoka', sans-serif; font-size: 1.9rem; font-weight: 700; line-height: 1.1; }
.hud-jugador .hud-valor { color: var(--primario-2); }
.hud-rival { text-align: right; align-items: flex-end; }
.hud-rival .hud-valor { color: var(--secundario-2); }
.hud-valor.pop { animation: pop 0.3s ease; }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.25); } 100% { transform: scale(1); } }

.puntos-flotantes {
  position: absolute; left: 0; top: -6px; font-family: 'Fredoka', sans-serif; font-weight: 700; color: var(--exito); font-size: 1.1rem;
  opacity: 0; pointer-events: none;
}
.puntos-flotantes.animar { animation: subir 0.9s ease forwards; }
@keyframes subir { 0% { opacity: 1; transform: translateY(0); } 100% { opacity: 0; transform: translateY(-28px); } }

.hud-centro { align-items: center; gap: 2px; }
.vidas { display: flex; gap: 4px; font-size: 1.5rem; line-height: 1; }
.corazon { color: #ff4d6d; transition: transform 0.2s; text-shadow: 0 0 10px rgba(255, 77, 109, 0.6); }
.corazon.vacio { color: rgba(255, 255, 255, 0.18); text-shadow: none; }
.corazon.ganada { animation: ganar-vida 0.6s ease; }
.corazon.perdida { animation: perder-vida 0.5s ease; }
@keyframes ganar-vida { 0% { transform: scale(0.3); } 50% { transform: scale(1.5) rotate(-10deg); } 100% { transform: scale(1); } }
@keyframes perder-vida { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.temporizador { font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 1.35rem; letter-spacing: 1px; color: var(--texto); }
.temporizador.urgente { color: var(--error); animation: pulso 0.8s infinite; }
.bonus-cuenta { font-size: 0.72rem; font-weight: 800; color: var(--oro); letter-spacing: 0.5px; margin-top: 2px; }
.bonus-cuenta.pronto { animation: pulso 0.7s infinite; }
.etiqueta-modal.bonus { color: var(--oro); background: rgba(251, 191, 36, 0.15); }
.modal-caja.bonus { border-color: rgba(251, 191, 36, 0.5); box-shadow: 0 0 40px rgba(251, 191, 36, 0.25), var(--sombra); }

.hud-salir { justify-content: center; }
.hud-salir .btn { align-self: flex-end; }

/* Tablero */
.tablero-contenedor { display: flex; justify-content: center; }
.tablero {
  display: grid; grid-template-columns: repeat(8, var(--tam-celda)); grid-template-rows: repeat(8, var(--tam-celda)); gap: var(--gap-celda);
  background: rgba(0, 0, 0, 0.3); padding: 8px; border-radius: 16px; border: 1px solid var(--borde); touch-action: none; position: relative;
}
.celda { width: var(--tam-celda); height: var(--tam-celda); border-radius: 7px; background: var(--celda); border: 1px solid var(--celda-borde); transition: background 0.1s, transform 0.1s; }
.celda.llena { border-color: rgba(255, 255, 255, 0.25); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.25), inset 0 2px 0 rgba(255, 255, 255, 0.25); }
.celda.previa { background: rgba(255, 255, 255, 0.28) !important; }
.celda.previa-invalida { background: rgba(239, 68, 68, 0.3) !important; }
.celda.previa-linea { box-shadow: 0 0 0 2px var(--oro) inset; }
.celda.colocada { animation: colocar 0.25s ease; }
.celda.eliminar { animation: eliminar 0.35s ease forwards; }
.tablero.limpiar .celda.llena { animation: eliminar 0.5s ease forwards; }
@keyframes colocar { 0% { transform: scale(0.5); } 60% { transform: scale(1.12); } 100% { transform: scale(1); } }
@keyframes eliminar { 0% { transform: scale(1); filter: brightness(2); } 100% { transform: scale(0); opacity: 0; } }

/* Colores de piezas */
.c-1 { background: linear-gradient(135deg, #ff7a45, #ff9d6b); }
.c-2 { background: linear-gradient(135deg, #4f8dff, #7dd3fc); }
.c-3 { background: linear-gradient(135deg, #22c55e, #86efac); }
.c-4 { background: linear-gradient(135deg, #a855f7, #d8b4fe); }
.c-5 { background: linear-gradient(135deg, #fbbf24, #fde68a); }
.c-6 { background: linear-gradient(135deg, #ec4899, #f9a8d4); }
.c-7 { background: linear-gradient(135deg, #14b8a6, #5eead4); }

/* Piezas disponibles */
.piezas { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pieza-slot {
  min-height: 110px; background: rgba(0, 0, 0, 0.22); border: 1px solid var(--borde); border-radius: 14px;
  display: grid; place-items: center; padding: 8px; touch-action: none; cursor: grab; transition: opacity 0.2s, transform 0.2s;
}
.pieza-slot.vacia { opacity: 0.25; cursor: default; }
.pieza-slot.no-cabe { opacity: 0.45; }
.pieza-slot.arrastrando { opacity: 0.25; }
.pieza-slot.nueva { animation: colocar 0.35s ease; }
.pieza { display: grid; gap: 3px; pointer-events: none; }
.pieza i { display: block; border-radius: 5px; }
.pieza i.vacio { background: transparent; }
.pieza-slot .pieza i { width: 22px; height: 22px; }

/* Pieza que se arrastra */
.pieza-arrastre { position: fixed; z-index: 40; pointer-events: none; left: 0; top: 0; will-change: transform; }
.pieza-arrastre .pieza { gap: var(--gap-celda); }
.pieza-arrastre .pieza i { width: var(--tam-celda); height: var(--tam-celda); border-radius: 7px; box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5); }
.pieza-arrastre .pieza i.vacio { box-shadow: none; }

.pista-juego { text-align: center; color: var(--texto-suave); font-size: 0.85rem; }

/* ---------- Modal pregunta ---------- */
.modal { position: fixed; inset: 0; z-index: 60; background: rgba(5, 6, 25, 0.78); backdrop-filter: blur(6px); display: flex; align-items: center; justify-content: center; padding: 16px; animation: aparecer 0.25s ease; }
.modal-caja { width: 100%; max-width: 460px; background: linear-gradient(160deg, #23285f, #171b45); border: 1px solid var(--borde); border-radius: var(--radio); padding: 24px; box-shadow: var(--sombra); animation: entrar-modal 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.2); }
@keyframes entrar-modal { from { transform: scale(0.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-cabecera { text-align: center; margin-bottom: 16px; }
.etiqueta-modal { display: inline-block; font-size: 0.75rem; font-weight: 800; letter-spacing: 1.5px; text-transform: uppercase; color: var(--primario-2); background: rgba(255, 122, 69, 0.15); padding: 4px 12px; border-radius: 999px; margin-bottom: 8px; }
.pregunta { text-align: center; background: rgba(0, 0, 0, 0.28); border-radius: 14px; padding: 16px; margin-bottom: 14px; }
.pregunta-tipo { font-size: 0.85rem; color: var(--texto-suave); font-weight: 700; }
.pregunta-palabra { font-family: 'Fredoka', sans-serif; font-size: 2.2rem; font-weight: 700; color: var(--secundario-2); margin-top: 4px; }
.opciones { display: grid; gap: 10px; }
.opcion {
  font-family: 'Nunito', sans-serif; font-weight: 700; font-size: 1.05rem; text-align: left; color: var(--texto);
  background: rgba(255, 255, 255, 0.07); border: 2px solid var(--borde); border-radius: 12px; padding: 13px 14px; cursor: pointer;
  transition: all 0.15s; display: flex; align-items: center; gap: 10px;
}
.opcion .letra { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: rgba(255, 255, 255, 0.12); font-family: 'Fredoka', sans-serif; font-size: 0.9rem; flex-shrink: 0; }
.opcion:hover:not(:disabled) { border-color: var(--secundario); background: rgba(79, 141, 255, 0.15); }
.opcion:disabled { cursor: default; }
.opcion.correcta { border-color: var(--exito); background: rgba(34, 197, 94, 0.25); animation: pop 0.4s ease; }
.opcion.incorrecta { border-color: var(--error); background: rgba(239, 68, 68, 0.25); animation: perder-vida 0.4s ease; }
.pregunta-resultado { text-align: center; margin-top: 14px; font-weight: 800; min-height: 1.4em; font-size: 1.05rem; }
.pregunta-resultado.ok { color: #86efac; }
.pregunta-resultado.mal { color: #fca5a5; }

/* ---------- Resultados ---------- */
#pantalla-resultados h2 { text-align: center; font-size: 2.1rem; }
.resultado-puntajes { display: flex; flex-direction: column; gap: 8px; margin: 20px 0 14px; }
.resultado-puntajes.dos { flex-direction: row; }
.resultado-fila { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 10px; background: rgba(0, 0, 0, 0.25); border: 2px solid var(--borde); border-radius: 12px; padding: 10px 12px; }
.resultado-fila .pos { font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 1.2rem; color: var(--texto-suave); text-align: center; }
.resultado-fila .nombre { font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.resultado-fila .puntaje { font-family: 'Fredoka', sans-serif; font-size: 1.5rem; font-weight: 700; color: var(--secundario-2); }
.resultado-fila.propio { border-color: var(--primario); }
.resultado-fila.propio .puntaje { color: var(--primario-2); }
.resultado-fila.ganador { border-color: var(--oro); box-shadow: 0 0 24px rgba(251, 191, 36, 0.25); }
.resultado-fila.ganador .pos { color: var(--oro); }
.resultado-jugador { flex: 1; background: rgba(0, 0, 0, 0.25); border: 2px solid var(--borde); border-radius: 16px; padding: 16px 10px; text-align: center; display: flex; flex-direction: column; gap: 4px; }
.resultado-jugador .nombre { font-weight: 800; color: var(--texto-suave); word-break: break-word; }
.resultado-jugador .puntaje { font-family: 'Fredoka', sans-serif; font-size: 2.4rem; font-weight: 700; }
.resultado-jugador.propio .puntaje { color: var(--primario-2); }
.resultado-jugador.rival .puntaje { color: var(--secundario-2); }
.resultado-jugador.ganador { border-color: var(--oro); box-shadow: 0 0 30px rgba(251, 191, 36, 0.3); }
.resultado-jugador.ganador .nombre::before { content: '👑 '; }
.resultado-stats { display: flex; justify-content: center; gap: 18px; flex-wrap: wrap; margin-bottom: 18px; color: var(--texto-suave); font-size: 0.9rem; font-weight: 700; }
.resultado-stats b { color: var(--texto); }
#guardar-ranking-msg { margin-top: 8px; min-height: 1.2em; }

/* ---------- Ranking ---------- */
.ranking-lista { display: flex; flex-direction: column; gap: 8px; max-height: 60vh; overflow-y: auto; padding-right: 4px; }
.ranking-fila { display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 10px; background: rgba(0, 0, 0, 0.22); border: 1px solid var(--borde); border-radius: 12px; padding: 10px 12px; animation: aparecer 0.3s ease both; }
.ranking-fila .pos { font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 1.2rem; text-align: center; color: var(--texto-suave); }
.ranking-fila:nth-child(1) .pos { color: var(--oro); font-size: 1.5rem; }
.ranking-fila:nth-child(2) .pos { color: #cbd5e1; font-size: 1.35rem; }
.ranking-fila:nth-child(3) .pos { color: #d97706; font-size: 1.3rem; }
.ranking-fila .info { display: flex; flex-direction: column; min-width: 0; }
.ranking-fila .nombre { font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ranking-fila .meta { font-size: 0.75rem; color: var(--texto-suave); }
.ranking-fila .meta .modo { text-transform: uppercase; letter-spacing: 1px; font-weight: 800; }
.ranking-fila .meta .modo.versus { color: var(--secundario-2); }
.ranking-fila .meta .modo.practica { color: var(--primario-2); }
.ranking-fila .puntaje { font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 1.3rem; color: var(--primario-2); }

/* ---------- Ayuda ---------- */
.lista-ayuda { padding-left: 20px; display: flex; flex-direction: column; gap: 10px; line-height: 1.5; color: var(--texto-suave); }
.lista-ayuda strong { color: var(--texto); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 70;
  background: rgba(20, 22, 60, 0.95); border: 1px solid var(--borde); color: var(--texto); padding: 12px 18px; border-radius: 12px;
  font-weight: 700; box-shadow: var(--sombra); max-width: 90vw; text-align: center; animation: aparecer 0.25s ease;
}

/* ---------- Responsive ---------- */
@media (max-width: 420px) {
  :root { --tam-celda: 36px; --gap-celda: 3px; }
  .hud-valor { font-size: 1.5rem; }
  .codigo-sala { font-size: 2.8rem; letter-spacing: 7px; }
  .pieza-slot .pieza i { width: 18px; height: 18px; }
  .pieza-slot { min-height: 96px; }
  .logo h1 { font-size: 2.3rem; }
}
@media (max-width: 350px) {
  :root { --tam-celda: 32px; --gap-celda: 3px; }
}
/* Pantallas grandes (laptop / proyector) */
@media (min-width: 900px) and (min-height: 800px) {
  :root { --tam-celda: 52px; --gap-celda: 5px; }
  .juego-layout { max-width: 640px; }
  .hud-valor { font-size: 2.3rem; }
  .pieza-slot .pieza i { width: 26px; height: 26px; }
  .pieza-slot { min-height: 130px; }
}
