/* =========================================
   ONE PIECE IDENTIDAD (Guess Who deductivo)
   ========================================= */

.container-identidad {
    width: 100%;
    /* Ancho amplio (mismo criterio que .container-character en personaje.css)
       para que el acordeón de temáticas quepa cómodo a 3 columnas. */
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 15px;
    position: relative;
    z-index: 5;
}

/* Secciones que no se benefician del ancho extra (no son una rejilla) se
   recentran con su propio ancho máximo, para que no queden estiradas. */
.identidad-top,
.identidad-history-wrap {
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

/* =========================================
   ZONA SUPERIOR: silueta + vidas + contador
   ========================================= */
.identidad-top {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.identidad-mystery {
    width: 140px;
    height: 140px;
    border-radius: 12px;
    background: linear-gradient(to bottom, #4e342e, #2d201c);
    border: 3px solid #8d6e63;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.4), inset 0 0 25px rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.mystery-silhouette {
    width: 90px;
    height: 90px;
    color: #ffca28;
    opacity: 0.85;
    animation: mysteryPulse 2.5s ease-in-out infinite;
}

@keyframes mysteryPulse {
    0%, 100% { opacity: 0.55; transform: scale(1); }
    50%      { opacity: 0.95; transform: scale(1.06); }
}

.mystery-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
    user-select: none;
}

.mystery-img.hidden,
.mystery-silhouette.hidden {
    display: none;
}

.identidad-status {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.lives-bar {
    display: flex;
    gap: 8px;
    font-size: 2rem;
    background: rgba(255, 248, 225, 0.8);
    padding: 8px 20px;
    border-radius: 50px;
    border: 2px solid #8d6e63;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.2);
}

.life {
    transition: filter 0.3s, opacity 0.3s, transform 0.3s;
}

.life.lost {
    filter: grayscale(100%);
    opacity: 0.35;
    transform: scale(0.85);
}

.question-counter {
    font-family: 'Pirata One', cursive;
    font-size: 1.3rem;
    color: #3e2723;
    background: rgba(255, 248, 225, 0.8);
    padding: 6px 20px;
    border-radius: 50px;
    border: 2px solid #8d6e63;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: baseline;
    gap: 8px;
}

#questionCounter {
    font-size: 1.5rem;
    color: #c62828;
}

/* =========================================
   Contador de candidatos en vivo + botón "Sugerir pregunta"
   (recalculados en el cliente vía bitmasks — ver game-identidad.js)
   ========================================= */
.identidad-toolbar {
    max-width: 700px;
    margin: 0 auto 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.identidad-remaining {
    font-family: 'Pirata One', cursive;
    font-size: 1.05rem;
    color: #3e2723;
    background: rgba(255, 248, 225, 0.8);
    padding: 6px 18px;
    border-radius: 50px;
    border: 2px solid #8d6e63;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.2);
    min-height: 1.2em;
}

.btn-suggest-question {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 16px;
    border-radius: 50px;
    border: 2px solid #ffb300;
    background: rgba(255, 179, 0, 0.12);
    color: #3e2723;
    font-family: 'Roboto', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s;
}

.btn-suggest-question:hover:not(:disabled) {
    background: rgba(255, 179, 0, 0.25);
    box-shadow: 0 0 10px rgba(255, 179, 0, 0.4);
}

.btn-suggest-question:disabled {
    opacity: 0.4;
    cursor: default;
}

/* =========================================
   ZONA CENTRAL: acordeón de temáticas — cada una es un
   select-con-buscador (fila disparadora + panel desplegable).
   Grid de 3 columnas; cuando un panel se abre, ocupa las 3 columnas y
   "empuja" el resto — grid-auto-flow: dense rellena el hueco que deja el
   disparador que queda debajo del panel en vez de dejarlo en blanco.
   ========================================= */
.identidad-theme-accordion {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-auto-flow: dense;
    gap: 10px;
    margin-bottom: 25px;
}

.identidad-theme-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 16px;
    background: radial-gradient(ellipse at center, #fffaf0 10%, #f2e2c2 100%);
    border: 3px ridge #8d6e63;
    border-radius: 20px;
    cursor: pointer;
    font-family: 'Pirata One', cursive;
    color: #3e2723;
    transition: border-color 0.2s, box-shadow 0.2s;
    text-align: left;
}

.identidad-theme-trigger:hover {
    box-shadow: 0 0 10px rgba(255, 179, 0, 0.35);
}

.identidad-theme-trigger:focus-visible {
    outline: none;
    border-color: #ffb300;
    box-shadow: 0 0 10px rgba(255, 179, 0, 0.6);
}

.identidad-theme-trigger.open {
    border-color: #ffb300;
    box-shadow: 0 0 12px rgba(255, 179, 0, 0.5);
}

/* Ninguna opción sin preguntar de este tema aportaría ya información nueva
   (distinto del .exhausted de píldora individual, que es por fin de partida). */
.identidad-theme-trigger.exhausted {
    opacity: 0.55;
}

.identidad-theme-trigger-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgb(62, 39, 35);
    font-size: 1.05rem;
    line-height: 1;
}

.identidad-theme-trigger-label {
    flex: 1;
    font-size: 1rem;
    letter-spacing: 0.5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.identidad-theme-trigger-count {
    font-family: 'Roboto', sans-serif;
    font-size: 0.8rem;
    font-weight: 500;
    color: #8d6e63;
    flex-shrink: 0;
}

.identidad-theme-trigger-arrow {
    flex-shrink: 0;
    width: 9px;
    height: 9px;
    border-right: 2px solid #8d6e63;
    border-bottom: 2px solid #8d6e63;
    transform: rotate(45deg);
    transition: transform 0.2s;
    margin-top: -4px;
}

.identidad-theme-trigger.open .identidad-theme-trigger-arrow {
    transform: rotate(-135deg);
    margin-top: 4px;
}

.identidad-theme-panel {
    grid-column: 1 / -1;
    background: #fffaf0;
    border: 2px solid #ffb300;
    border-radius: 14px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.identidad-theme-panel:empty {
    display: none;
    grid-column: auto;
    border: none;
    box-shadow: none;
    padding: 0;
}

.identidad-theme-search {
    width: 100%;
    padding: 10px 16px;
    border-radius: 50px;
    border: 2px solid #8d6e63;
    background: #fff;
    color: #3e2723;
    font-family: 'Roboto', sans-serif;
    font-size: 0.95rem;
    box-sizing: border-box;
}

.identidad-theme-search:focus {
    outline: none;
    border-color: #ffb300;
    box-shadow: 0 0 10px rgba(255, 179, 0, 0.45);
}

.identidad-theme-search:disabled {
    opacity: 0.6;
    cursor: default;
}

/* Slider denso (edad/altura/recompensa/capítulo — ver identidad_categorias.php
   'range_group'): sustituye a una lista larga de píldoras de umbral por 1
   control por campo. Arrastrar solo actualiza el contador en vivo; hace
   falta pulsar "Preguntar" para gastar una de las preguntas disponibles. */
.identidad-range-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 14px;
    margin-bottom: 10px;
    border-radius: 10px;
    background: rgba(141, 110, 99, 0.08);
}

.identidad-range-group.answered {
    background: rgba(78, 52, 46, 0.06);
}

.identidad-range-group.suggested {
    box-shadow: inset 0 0 0 2px #ffb300;
    animation: suggestedGlow 1.6s ease-in-out infinite;
}

.identidad-range-label {
    color: #3e2723;
    font-family: 'Roboto', sans-serif;
    font-size: 0.92rem;
    font-weight: 600;
    text-align: center;
}

.identidad-range-track {
    width: 100%;
    accent-color: #ffb300;
    cursor: pointer;
}

.identidad-range-track:disabled {
    cursor: default;
    opacity: 0.6;
}

.identidad-range-action {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.identidad-range-ask-btn {
    padding: 6px 18px;
    border: none;
    border-radius: 50px;
    background: #ffb300;
    color: #3e2723;
    font-family: 'Roboto', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.identidad-range-ask-btn:hover:not(:disabled) {
    background: #ffc933;
}

.identidad-range-ask-btn:disabled {
    opacity: 0.5;
    cursor: default;
}

/* Umbrales ya preguntados dentro de este mismo slider (el control solo
   muestra 1 muesca a la vez, esto deja rastro visible de las demás). */
.identidad-range-history {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-top: 6px;
    border-top: 1px solid rgba(141, 110, 99, 0.25);
}

.identidad-range-history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    color: #6d4c41;
    font-family: 'Roboto', sans-serif;
    font-size: 0.82rem;
}

.identidad-theme-options {
    display: flex;
    flex-direction: column;
    max-height: 320px;
    overflow-y: auto;
    border-radius: 10px;
    scrollbar-width: thin;
    scrollbar-color: #8d6e63 #f2e2c2;
}

.identidad-theme-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    padding: 10px 14px;
    border: none;
    border-bottom: 1px solid rgba(141, 110, 99, 0.25);
    background: transparent;
    color: #3e2723;
    font-family: 'Roboto', sans-serif;
    font-size: 0.92rem;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s;
}

.identidad-theme-options .identidad-theme-option:last-child {
    border-bottom: none;
}

.identidad-theme-option:hover:not(:disabled) {
    background: rgba(141, 110, 99, 0.15);
}

.identidad-theme-option:disabled {
    cursor: default;
}

.identidad-theme-option.answered {
    background: rgba(78, 52, 46, 0.06);
    color: #6d4c41;
}

.identidad-theme-option.exhausted {
    opacity: 0.4;
}

/* Contador de candidatos en vivo por opción */
.option-count {
    flex-shrink: 0;
    min-width: 26px;
    padding: 1px 8px;
    border-radius: 50px;
    background: rgba(141, 110, 99, 0.18);
    color: #6d4c41;
    font-family: 'Roboto', sans-serif;
    font-size: 0.78rem;
    font-weight: 600;
    text-align: center;
}

/* Ya se puede deducir con certeza sin gastar una pregunta (0 candidatos la
   cumplen, o la cumplen todos los candidatos restantes): la fila NO se atenúa
   (atenuar toda la opción la hacía parecer deshabilitada, aunque se puede
   pulsar con normalidad) — solo se distingue el badge del contador. */
.identidad-theme-option.no-info .option-count {
    background: rgba(255, 179, 0, 0.22);
    color: #8d6e63;
}

/* Resaltada por "Sugerir pregunta" — no se autopulsa, solo se señala */
.identidad-theme-option.suggested {
    background: rgba(255, 179, 0, 0.18);
    box-shadow: inset 0 0 0 2px #ffb300;
    animation: suggestedGlow 1.6s ease-in-out infinite;
}

@keyframes suggestedGlow {
    0%, 100% { box-shadow: inset 0 0 0 2px #ffb300; }
    50%      { box-shadow: inset 0 0 0 2px #ffb300, 0 0 10px rgba(255, 179, 0, 0.6); }
}

.identidad-theme-no-results {
    padding: 14px 10px;
    color: rgba(62, 39, 35, 0.6);
    font-family: 'Roboto', sans-serif;
    font-size: 0.9rem;
    font-style: italic;
    text-align: center;
}

/* Badges Sí / No / ? */
.answer-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    padding: 2px 10px;
    border-radius: 50px;
    font-family: 'Pirata One', cursive;
    font-size: 0.95rem;
    letter-spacing: 0.5px;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    animation: badgePop 0.3s ease;
}

@keyframes badgePop {
    0%   { transform: scale(0.4); opacity: 0; }
    70%  { transform: scale(1.15); }
    100% { transform: scale(1); opacity: 1; }
}

.answer-badge.yes {
    background: linear-gradient(145deg, rgba(46, 125, 50, 0.95), rgba(27, 94, 32, 0.95));
}

.answer-badge.no {
    background: linear-gradient(145deg, rgba(198, 40, 40, 0.95), rgba(141, 22, 22, 0.95));
}

.answer-badge.unknown {
    background: linear-gradient(145deg, rgba(97, 97, 97, 0.95), rgba(66, 66, 66, 0.95));
    color: #e0e0e0;
}

/* =========================================
   HISTORIAL de preguntas
   ========================================= */
.identidad-history-wrap {
    margin-bottom: 25px;
}

.identidad-history-title {
    font-family: 'Pirata One', cursive;
    font-size: 1.5rem;
    color: #3e2723;
    text-align: center;
    margin-bottom: 10px;
}

.identidad-history-title.hidden {
    display: none;
}

.identidad-history {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.identidad-history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: rgba(255, 253, 231, 0.95);
    border-left: 5px solid #ffb300;
    border-radius: 6px;
    padding: 10px 16px;
    color: #3e2723;
    font-family: 'Roboto', sans-serif;
    font-weight: 500;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.15);
    animation: fadeIn 0.4s ease;
}

.identidad-history-item .question-num {
    font-family: 'Pirata One', cursive;
    color: #8d6e63;
    flex-shrink: 0;
}

.identidad-history-item .question-text {
    flex: 1;
}

/* =========================================
   Intentos fallidos de adivinar
   ========================================= */
.identidad-guesses {
    list-style: none;
    margin: 15px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.identidad-guess-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(198, 40, 40, 0.12);
    border-left: 5px solid #c62828;
    border-radius: 6px;
    padding: 8px 14px;
    color: #3e2723;
    font-weight: 500;
    animation: fadeIn 0.4s ease;
}

.identidad-guess-item.correct {
    background: rgba(46, 125, 50, 0.12);
    border-left-color: #2e7d32;
}

.identidad-guess-item img {
    width: 42px;
    height: 42px;
    object-fit: cover;
    object-position: top center;
    border-radius: 4px;
    border: 1px solid #8d6e63;
}

/* =========================================
   Animaciones compartidas
   ========================================= */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-8px); }
    40%, 80% { transform: translateX(8px); }
}

/* =========================================
   Responsive
   ========================================= */
@media (max-width: 1039px) {
    .identidad-theme-accordion {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 600px) {
    .identidad-theme-accordion {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    /* 2 columnas dejan poco ancho horizontal: se reduce todo (icono,
       paddings, gap, tipografías) para que icono+label+contador+flecha
       quepan en una sola línea sin desbordar ni verse enorme/vacío. */
    .identidad-theme-trigger {
        gap: 6px;
        padding: 8px 10px;
        border-width: 2px;
    }

    .identidad-theme-trigger-icon {
        width: 22px;
        height: 22px;
        font-size: 0.8rem;
    }

    .identidad-theme-trigger-label {
        font-size: 0.78rem;
        letter-spacing: 0.2px;
    }

    .identidad-theme-trigger-count {
        font-size: 0.68rem;
    }

    .identidad-theme-trigger-arrow {
        width: 7px;
        height: 7px;
        border-right-width: 2px;
        border-bottom-width: 2px;
    }

    .identidad-top {
        gap: 18px;
    }

    .identidad-mystery {
        width: 110px;
        height: 110px;
    }

    .mystery-silhouette {
        width: 70px;
        height: 70px;
    }

    .lives-bar {
        font-size: 1.6rem;
        padding: 6px 16px;
    }

    .identidad-theme-option {
        font-size: 0.88rem;
        padding: 9px 12px;
    }

    /* Padding/gap recortados (no la fuente, que se queda casi igual) para
       que quepan en una sola línea sin verse "pequeño" como las tarjetas. */
    .identidad-toolbar {
        gap: 8px;
    }

    .identidad-remaining {
        font-size: 0.85rem;
        padding: 4px 10px;
        white-space: nowrap;
    }

    .btn-suggest-question {
        font-size: 0.75rem;
        padding: 4px 8px;
        gap: 4px;
        white-space: nowrap;
    }
}

/* Identidad score distribution (histogram) — mirrors .wordle-stats */
.identidad-stats {
    width: 100%;
    margin: 0;
    padding: 14px 18px 16px;
    background: linear-gradient(135deg, #1c1408, #251a0a);
    border: 2px solid rgba(255, 179, 0, 0.45);
    border-radius: 10px;
}

.identidad-stats-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 12px;
}

.identidad-stats-header::before,
.identidad-stats-header::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255, 179, 0, 0.4);
}

.identidad-stats-title {
    font-family: 'Pirata One', cursive;
    font-size: 0.82rem;
    color: #ffd54f;
    letter-spacing: 2px;
    text-transform: uppercase;
    white-space: nowrap;
}

.identidad-stats-rows {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.identidad-stats-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.identidad-stats-label {
    font-family: 'Pirata One', cursive;
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.5);
    width: 22px;
    text-align: center;
    flex-shrink: 0;
    line-height: 1;
}

.identidad-stats-row.is-mine .identidad-stats-label {
    color: #ffd54f;
}

.identidad-stats-bar-wrap {
    flex: 1;
    background: rgba(0, 0, 0, 0.35);
    border-radius: 4px;
    overflow: hidden;
    height: 24px;
}

.identidad-stats-bar {
    height: 100%;
    width: 0;
    border-radius: 4px;
    transition: width 0.65s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(255, 255, 255, 0.32);
}

.identidad-stats-row.is-mine .identidad-stats-bar {
    background: #ffd54f;
    box-shadow: 0 0 10px rgba(255, 213, 79, 0.5);
}

.identidad-stats-bar.is-fail {
    background: rgba(255, 255, 255, 0.15);
}

.identidad-stats-row.is-mine .identidad-stats-bar.is-fail {
    background: #ef5350;
    box-shadow: 0 0 10px rgba(239, 83, 80, 0.5);
}

.identidad-stats-pct {
    font-size: 0.8rem;
    font-weight: bold;
    color: rgba(255, 255, 255, 0.6);
    font-family: 'Roboto', sans-serif;
    width: 36px;
    text-align: right;
    flex-shrink: 0;
}

.identidad-stats-row.is-mine .identidad-stats-pct {
    color: #fff;
}

.identidad-stats-pct.is-zero {
    color: rgba(255, 255, 255, 0.2);
    font-weight: normal;
}

@media (max-width: 600px) {
    .identidad-theme-search,
    .identidad-theme-option {
        font-size: 0.85rem;
    }
}

