/* ===== Helpers de grid ===== */

.col-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.col-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}


/* ===== Contenedor principal ===== */

.qeq-game-root, .qeq-rankings-root {
  padding: 1rem;
}

.qeq-game {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}


/* ===== Estados básicos ===== */

.qeq-loading,
.qeq-error {
  font-size: 14px;
  color: #222;
}


/* ===== Título principal animado ===== */

h1.qeq-title {
  font-size: 2.8rem;
  text-align: center;
  margin: 1.5rem 0 2rem;
  letter-spacing: 0em;
  color: #222;
  font-family: "Mochiy Pop P One", Sans-serif;
  font-weight: 600;
  text-transform: none;
}

.qeq-title span {
  display: inline-block;
  opacity: 0;
  transform: scale(0.4) translateY(10px);
  animation: qeq-zoom-in 0.4s forwards cubic-bezier(0.19, 1, 0.22, 1);
}

/* Animación base */
@keyframes qeq-zoom-in {
  0% {
    opacity: 0;
    transform: scale(0.4) translateY(10px);
  }
  60% {
    opacity: 1;
    transform: scale(1.2) translateY(0);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Retrasos letra a letra */
.qeq-title span:nth-child(1)  { animation-delay: 0.00s; }
.qeq-title span:nth-child(2)  { animation-delay: 0.05s; }
.qeq-title span:nth-child(3)  { animation-delay: 0.10s; }
.qeq-title span:nth-child(4)  { animation-delay: 0.15s; }
.qeq-title span:nth-child(5)  { animation-delay: 0.20s; }
.qeq-title span:nth-child(6)  { animation-delay: 0.25s; }
.qeq-title span:nth-child(7)  { animation-delay: 0.30s; }
.qeq-title span:nth-child(8)  { animation-delay: 0.35s; }
.qeq-title span:nth-child(9)  { animation-delay: 0.40s; }
.qeq-title span:nth-child(10) { animation-delay: 0.45s; }
.qeq-title span:nth-child(11) { animation-delay: 0.50s; }
.qeq-title span:nth-child(12) { animation-delay: 0.55s; }
.qeq-title span:nth-child(13) { animation-delay: 0.60s; }
.qeq-title span:nth-child(14) { animation-delay: 0.65s; }
.qeq-title span:nth-child(15) { animation-delay: 0.70s; }
.qeq-title span:nth-child(16) { animation-delay: 0.75s; }


/* ===== Header del juego ===== */

.qeq-game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}


/* ===== Panel "Cómo se juega" ===== */

.qeq-howto-panel {
  margin: 0 auto;
  width: fit-content;
  padding: 20px;
  color: #000;
  font-weight: 500;
  text-align: center;

  border: solid 3px #aba8f7;
  border-radius: 16px;
  background-color: #eae9f7;
}

.qeq-howto-panel h2 {
  color: #000;
}

.qeq-howto-panel ol {
  text-align: left;
  margin-bottom: 20px;
}


/* ===== Topbar y panel de pistas ===== */

.qeq-topbar {
  gap: 0.75rem;
  padding: 0;
  margin-bottom: 20px;
  border-radius: 16px;
  font-size: 12px;
}


.qeq-hints-panel {
  padding: 0.75rem 0.75rem 0.75rem;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
}

.qeq-hints-list {
  padding-inline-start: 0;
  font-size: 14px;
  font-weight: 600;
  color: #222;
  list-style: none;
}

.qeq-hints-list li + li {
  margin-top: 0.15rem;
}

.qeq-hints-empty {
  color: #6b7280;
  list-style: none;
  margin-left: -1.25rem;
}


/* ===== Controles ===== */

.qeq-controls {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.qeq-sidebar {
  display: block;
  text-align: center;
}

  .qeq-sidebar .qeq-points-panel{
    display: grid;
    gap: 20px;
    width: fit-content;
    margin: auto;
    margin-bottom: 20px;
    grid-template-columns: repeat(2, minmax(130px, 1fr));
  }

  .qeq-sidebar-item {
    display: flex;
    flex-direction: column;
    border: solid 3px #aba8f8;
    padding: 10px;
    border-radius: 16px;
    background: #f3f4f6;
  }

  .qeq-sidebar-item.qeq-time-left{
    background: #eae9f7;
  }

  .qeq-sidebar-label {
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 12px;
  }

  .qeq-sidebar-value {
    font-size: 26px;
    font-weight: 700;
    color: #222;
  }

.qeq-action-buttons{
  display: grid;
  grid-template-columns: repeat(1, minmax(130px, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.qeq-sidebar > button{
  margin: 10px 0;
  width: 100%;
  padding: 12px;
  text-transform: uppercase;
  font-size: 18px;
}

.qeq-controls-help {
  margin: 0;
  font-size: 12px;
  color: #6b7280;
}

.qeq-center-code {
  margin: 0 auto 16px;
  width: 300px;
}

/* ===== Botones ===== */

.qeq-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.12s ease, border-color 0.12s ease,
  transform 0.05s ease;
  background: #e5e7eb;
  color: #222;
  padding: 12px 24px;
  text-transform: uppercase;
}

.qeq-btn--primary{
  background: #24b79f;
  border-color: #0d816e;
  color: #ffffff;
}

.qeq-btn--primary:hover{
  background: #0d816e;
}
.qeq-btn--primary:focus{
  background: #24b79f;
  border-width: 2px;
}
.qeq-btn--primary.qeq-btn--active {
  border-color: #463f96;
  background: #463f96;
}

.qeq-btn--secondary, .qeq-btn.qeq-btn--secondary {
  background: #f3f4f6;
  border: solid 1px #d1d5db;
  color: #222;
}

.qeq-btn--secondary:focus{
  border-width: 2px;
}
.qeq-btn--secondary:hover, .qeq-btn--secondary:focus {
  background: #e5e7eb;
  color: #222;
}

.qeq-btn--terciary, .qeq-btn.qeq-btn--terciary {
  background: #cbe6e1;
  border-color: #24b79f;
  color: #222;
}
.qeq-btn--terciary:hover, .qeq-btn--terciary:focus {
  background: #b2e0d8;
}

.qeq-action-buttons .qeq-btn--active {
  background: #463f96;
  color: #ffffff;
  transform: translateY(1px);
  border-color: #463f96;
}


/* ===== Inputs y selects ===== */

.qeq-field-label {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  font-size: 13px;
  color: #222;
}

input.qeq-input,
.qeq-select {
  border-radius: 999px;
  border: 1px solid #d1d5db;
  padding: 0.3rem 0.75rem;
  font-size: 14px;
  outline: none;
  min-width: 0;
}

input.qeq-input:focus,
.qeq-select:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 1px #bfdbfe;
}


/* ===== Tablero ===== */

.qeq-board-wrapper {
  border-radius: 16px;
  border: 1px solid #e5e7eb;
  background-color: #ffffff;
  padding: 0.75rem;
  display: flex;
  gap: 30px;
}

.qeq-board {
  display: grid;
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  gap: 1rem;
}


/* ===== Cartas ===== */

button.qeq-card {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  border: solid 3px #aba8f7;
  border-radius: 16px;
  cursor: pointer;
  background-color: #eae9f7;
  padding: 10px;
  position: relative;
}
button.qeq-card:focus{
  background-color: #eae9f7;

}
.qeq-card:not(.qeq-card--discarded):hover {
  box-shadow: 0 8px 15px -5px gray;
  background-color: #eae9f7;
  transform: translateY(-2px);
}

.qeq-card:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

.qeq-card-image-wrap {
  width: 90%;
  border-radius: 50%;
  border: 4px solid #ffffff;
  position: relative;
  overflow: hidden;
  aspect-ratio: 1 / 1;
  margin: 0 auto;
}

.qeq-card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.qeq-card-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
}

.qeq-card-body {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  text-align: center;
  margin-top: -24px;
}

.qeq-card-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: #000000;
  background-color: #ffffff;
  padding: 4px 6px;
  border-radius: 20px;
  z-index: 1;
  white-space: normal;
  overflow-wrap: break-word;
  word-break: break-word;
  line-height: normal;
}

/* Carta descartada */

button.qeq-card--discarded {
  background: #eae9f7;
  border-color: #9ca3af;
  opacity: 0.5;
  filter: grayscale(100%);
}

button.qeq-card--discarded:hover {
  background-color: #eae9f7;
}
/* Chips */

.qeq-card-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.25rem;
}

.qeq-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  font-size: 16px;
  background: #ffffff;
  color: #000000;
}

.qeq-chip-small {
  font-size: 13px;
  padding: 0.12rem 0.4rem;
  font-weight: 500;
}


/* ===== Panel de resultado y biografías ===== */

.qeq-result-panel {
  margin-top: 0.5rem;
  padding: 0.75rem 0.9rem;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.qeq-result-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: #222;
}

.qeq-result-subtitle {
  margin: 0;
  font-size: 16px;
  color: #4b5563;
}

.qeq-result-score {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 16px;
}

.qeq-result-score span {
  color: #6b7280;
  font-size: 16px;
}

.qeq-result-score strong {
  margin-left: 0.25rem;
  color: #222;
}

.qeq-result-bios {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
}

.qeq-bio-block {
  padding: 0.5rem 0.6rem;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
}

.qeq-bio-block h3 {
  margin: 0 0 0.2rem;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6b7280;
}

.qeq-bio-name {
  margin: 0 0 0.25rem;
  font-size: 14px;
  font-weight: 600;
  color: #222;
}

.qeq-bio-text {
  font-size: 16px;
  color: #374151;
  white-space: pre-wrap;
}


/* ===== Formulario de puntuación ===== */

.qeq-score-form {
  margin-top: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: max-content;
  max-width: 90%;
  margin: 24px auto;
}

.qeq-score-form h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: #222;
}

.qeq-score-form p {
  margin: 0;
  font-size: 14px;
  font-weight: 400;
}

.qeq-score-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.qeq-score-grid-center {
  grid-column: 1 / -1;   /* ocupa toda la fila (las 2 columnas) */
  justify-self: center;  /* centra el bloque dentro del grid */
  text-align: center;
  margin-top: 20px;
  font-size: 14px;
  font-weight: 400;
}

.qeq-score-grid-center .qeq-rating {
  justify-content: center; /* centra las estrellas */
}

.qeq-score-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 24px auto;
}

.qeq-score-status {
  font-size: 14px;
}


/* ===== Modo pantalla completa ===== */

.qeq-game-root--fullscreen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  padding: 100px;
  border-radius: 0;
  border: none;
  background-color: #fff;
}

.qeq-game-root--fullscreen .qeq-game {
  max-width: 1400px;
  margin: 0 auto;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.qeq-game-root--fullscreen .qeq-board-wrapper {
  flex: 1;
  overflow: auto;
}

/* Ocultar el título en modo pantalla completa */
.qeq-game-root--fullscreen .qeq-title {
  display: none !important;
}


/* ===== Responsivo ===== */

@media (max-width: 640px) {
  .qeq-topbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .qeq-board-wrapper {
    padding: 0.5rem;
  }
}

.qeq-main-layout {
  position: relative;
}

/* Overlay del resultado sobre el tablero */
.qeq-result {
  position: absolute;
  inset: 0;
  display: none;            /* se activa con la clase --visible */
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.65); /* fondo semi-transparente */
  z-index: 40;
  padding: 1rem;
}

/* Cuando hay resultado, se muestra */
.qeq-result.qeq-result--visible {
  display: flex;
}

/* Ajuste del panel de resultado como "tarjeta" centrada */
.qeq-result-panel {
  max-width: 900px;
  width: 100%;
  background: #ffffff;
  border-radius: 20px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 20px 45px rgba(15, 23, 42, 0.35);
  text-align: center;
}

/* Tarjetas de biografía con imagen en el modal */

.qeq-result-bios {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}

.qeq-bio-card {
  padding: 0.75rem 0.9rem;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  text-align: left;
}
  .qeq-bio-card.qeq-bio-card-wrong {
    border: solid 3px #ef4444;
    background-color: #fef2f2;
  }
    .qeq-bio-card-wrong .qeq-bio-card-title{
      color: #ef4444;
    }

  .qeq-bio-card.qeq-bio-card-right {
    border: solid 3px #22c55e;
    background-color: #ecfdf5;
  }
    .qeq-bio-card-wrong .qeq-bio-card-title{
      color: #222;
    }

.qeq-bio-card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.qeq-bio-card-avatar-wrap {
  width:100px;
  height: 100px;
  border-radius: 50%;
  border: 4px solid #ffffff;
  overflow: hidden;
  background: #eae9f7;
  flex-shrink: 0;
  position: relative;
}

.qeq-bio-card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  aspect-ratio: 1 / 1;
}

.qeq-bio-card-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
}

.qeq-bio-card-header-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.qeq-bio-card-title {
  margin: 0;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #6b7280;
}

.qeq-bio-name {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: #222;
}

.qeq-bio-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.qeq-bio-chip {
  font-size: 14px;
  padding: 0.1rem 0.45rem;
}

.qeq-bio-text {
  font-size: 13px;
  color: #374151;
  white-space: pre-wrap;
  margin-top: 0.25rem;
}

/* ===== Modal genérico (reemplaza alert) ===== */

.qeq-modal {
  position: absolute;
  inset: 0;
  display: none;
  z-index: 60;
}

.qeq-modal.qeq-modal--visible {
  display: block;
}

.qeq-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.65);
  backdrop-filter: blur(2px);
}

.qeq-modal__panel {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(560px, calc(100% - 2rem));
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 20px;
  box-shadow: 0 20px 45px rgba(15, 23, 42, 0.35);
  padding: 1rem 1rem 0.9rem;
}

.qeq-modal__close {
  position: absolute;
  top: 10px;
  right: 10px;
  color: #222;
  cursor: pointer;
  border: none;
}

.qeq-modal__close:hover {
  color: #464096;
  background-color: #fff;
}

.qeq-modal__title {
  margin: 0 2rem 0.5rem 0;
  font-size: 16px;
  font-weight: 800;
  color: #111827;
}

.qeq-modal__body {
  font-size: 14px;
  color: #222;
}

.qeq-modal__actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.75rem;
  gap: 10px;
}

.qeq-rating {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.qeq-star {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 26px;
  line-height: 1;
  color: #d1d5db;           /* gris */
  padding: 2px;
  transition: transform .08s ease, color .12s ease;
}

.qeq-star.is-active {
  color: #f59e0b;           /* amarillo */
}

.qeq-star.is-hover {
  color: #fbbf24;           /* amarillo más claro */
}

.qeq-star:hover, .qeq-star:focus {
  transform: scale(1.08);
  background: transparent;
}

.qeq-rating-text {
  font-size: 13px;
  color: #6b7280;
  font-weight: 600;
}



@media (min-width:481px) and (max-width: 1024px) {
  .qeq-sidebar{
    display: flex;
    flex-direction: row;
    gap: 20px;
  }
  .qeq-board-wrapper{
    flex-direction: column;
  }
  .qeq-points-panel{
    width: 30%;
  }
  .qeq-action-buttons{
    grid-template-columns: repeat(2, minmax(130px, 1fr));
    margin-top: 0;
    margin-bottom: 20px;
    width: 70%;
  }

}

@media (max-width:480px) {
  h1.qeq-title {
    font-size: 1.8rem;
  }
  h2 {
    font-size: 1.4rem;
  }
  .qeq-howto-panel{
    padding: 16px;
  }
  .qeq-board{
    overflow: scroll;
    grid-template-columns: repeat(9, minmax(130px, 1fr));
  }
  .qeq-sidebar{
    display: flex;
    flex-direction: column;
    gap: 20px;
  }
  .qeq-board-wrapper{
    flex-direction: column;
  }
  .qeq-action-buttons{
    grid-template-columns: repeat(2, minmax(130px, 1fr));
    margin-top: 0;
    margin-bottom: 20px;
  }
  .qeq-score-grid {
    grid-template-columns: repeat(1, minmax(180px, 1fr));
  }
  .qeq-score-actions .qeq-btn{
    width: 100%;
  }
  .qeq-rankings-tabs .qeq-btn{
    width: 100%;
  }
}

/* ===== Rankings (frontend) ===== */
.qeq-rankings {
  margin-top: 12px;
}

.qeq-rankings-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

button.qeq-rankings-tab {
  border: 2px solid #aba8f7;
  background: #f3f4f6;
  color: #222;
}

.qeq-rankings-tab.is-active, .qeq-rankings-tab:hover {
  background: #463f96;
  border-color: #463f96;
  color: #fff;
}

.qeq-rankings-filters {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.qeq-rankings-panels{
  margin-top: 20px;
}
.qeq-rankings-table-wrap {
  overflow: scroll;
}

.qeq-rankings-table{
  margin: 0 auto;
  color: #000;
  font-weight: 500;
  text-align: center;
  background-color: #eae9f7;
}
.qeq-rankings-table{
  border: solid 2px #aba8f7;
  border-radius: 16px;
  border-collapse: separate;
}
.qeq-rankings-table th,
.qeq-rankings-table td {
  border: none;
  padding: 8px 10px;
  text-align: left;
  white-space: nowrap;
}
table thead:first-child tr:first-child th {
    border-block-start: none;
}

.qeq-rankings-empty {
  color: #6b7280;
  font-size: 13px;
}

/* Respeta el atributo hidden SIEMPRE */
[hidden] {
  display: none !important;
}
