/* =============================================
   Naru2day — Character Game Styles
   ============================================= */

/* ── Layout ── */
.container-character {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 12px;
}

.game-container {
    background: url('../img/Fondo_Pergamino.webp') center center / cover no-repeat;
    background-color: #CE9D66;
    border: 2px solid #5A3200;
    border-radius: 18px;
    padding: 20px 16px 16px;
    margin-bottom: 16px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6), inset 0 0 40px rgba(90, 50, 0, 0.2);
}

.game-board {
    margin-top: 8px;
}

/* ── Difficulty bar ── */
.wn-difficulty-bar {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin: 0.75rem 0 0;
    flex-wrap: wrap;
}

.wn-dif-btn {
    background: rgba(255, 255, 255, 0.35);
    border: 2px solid rgba(139, 90, 43, 0.5);
    color: #5A3200;
    border-radius: 20px;
    padding: 5px 18px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all .2s;
    text-decoration: none;
}

.wn-dif-btn:hover {
    border-color: #5A3200;
    color: #3E2000;
    background: rgba(255, 255, 255, 0.65);
}

.wn-dif-btn.active {
    background: #5A3200;
    border-color: #5A3200;
    color: #fff;
}

/* ── Hints + counter row ── */
.hint-container {
    display: flex;
    gap: 10px;
    justify-content: center;
    align-items: center;
    flex-wrap: nowrap;
    margin-bottom: 12px;
}

.hint-box {
    background: rgba(255, 255, 255, 0.35);
    border: 1.5px solid rgba(139, 90, 43, 0.5);
    border-radius: 12px;
    padding: 8px 14px;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    transition: all .2s;
    user-select: none;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(90, 50, 0, 0.15);
}

.hint-box.disabled {
    opacity: 0.65;
    cursor: default;
}

.hint-box.enabled {
    border-color: #8B5A2B;
    cursor: pointer;
}

.hint-box.enabled:hover {
    border-color: #5A3200;
    background: rgba(255, 255, 255, 0.65);
}

.hint-box.active {
    border-color: #5A3200;
    background: rgba(255, 255, 255, 0.65);
}

.hint-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: rgba(90, 50, 0, 0.8);
}

.hint-lock {
    display: flex;
    align-items: center;
    gap: 6px;
    color: rgba(90, 50, 0, 0.8);
    font-size: 0.75rem;
}

/* ── Revealed hints ── */
.revealed-hints-container {
    text-align: center;
    min-height: 0;
    margin-bottom: 8px;
}

.revealed-hint-line {
    font-size: 0.9rem;
    color: #7A3D00;
    margin: 4px 0;
}

.revealed-hint-line strong {
    color: #5A3200;
}

/* ── Control row: input + guess + surrender ── */
.wn-control-row {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    align-items: center;
    max-width: 520px;
    margin: 0 auto;
}

.wn-control-row .wn-search-wrap {
    flex: 1;
    min-width: 0;
    max-width: none;
    margin: 0;
}

.wn-guess-btn {
    flex-shrink: 0;
    background: var(--wn-orange);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 10px 18px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: background .2s, transform .15s;
}

.wn-guess-btn:hover {
    background: var(--wn-orange-dark);
    transform: translateY(-1px);
}

.wn-guess-btn:disabled {
    opacity: 0.4;
    cursor: default;
    transform: none;
}


/* Mobile: input full width, buttons on second row 75/25 */
@media (max-width: 600px) {
    .wn-control-row {
        flex-wrap: wrap;
    }

    .wn-control-row .wn-search-wrap {
        flex: 0 0 100%;
    }

    .wn-guess-btn {
        flex: 3;
    }

    .wn-surrender-btn {
        flex: 1;
        width: auto;
    }
}

/* ── Search ── */
.wn-search-wrap {
    position: relative;
    max-width: 520px;
    margin: 0 auto;
}

.wn-search-input {
    background: rgba(255, 255, 255, 0.35);
    border: 2px solid rgba(139, 90, 43, 0.5);
    color: #3E2000;
    border-radius: 10px;
    padding: 10px 16px;
    font-size: 1rem;
    width: 100%;
    transition: all .2s;
    font-weight: 600;
}

.wn-search-input:focus {
    outline: none;
    border-color: #5A3200;
    background: rgba(255, 255, 255, 0.65);
    box-shadow: 0 0 12px rgba(90, 50, 0, 0.15);
}

.wn-search-input::placeholder {
    color: rgba(90, 50, 0, 0.6);
    font-weight: 500;
}


/* ═══════════════════════════════════
   TABLE
═══════════════════════════════════ */
.table-scroll-wrapper {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    margin-bottom: 20px;
    scrollbar-width: thin;
    scrollbar-color: #8B5A2B rgba(0, 0, 0, 0.1);
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 6px 0;
}

.table-scroll-wrapper::-webkit-scrollbar {
    height: 8px;
}

.table-scroll-wrapper::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 0 0 10px 10px;
}

.table-scroll-wrapper::-webkit-scrollbar-thumb {
    background: #8B5A2B;
    border-radius: 6px;
}

#results {
    width: 100%;
    min-width: 920px;
    border-collapse: separate;
    border-spacing: 8px 10px;
    table-layout: fixed;
    margin-top: -6px;
}

/* -- Headers -- */
#results th {
    background: rgba(0, 0, 0, 0.12);
    color: #4A2E15;
    font-size: 0.75rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 10px 6px;
    border: none;
    border-bottom: 2px solid rgba(90, 50, 0, 0.6);
    position: sticky;
    top: 0;
    z-index: 10;
    text-align: center;
    white-space: normal;
    line-height: 1.2;
    text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.5);
}

/* -- Cells -- */
#results td {
    padding: 10px 6px;
    vertical-align: middle;
    text-align: center;
    border: 1.5px dashed rgba(139, 90, 43, 0.5);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.1);
    height: 90px !important;
    max-height: 90px;
    font-size: 0.82rem;
    font-weight: 700;
    color: #3E2723;
    position: relative;
    overflow: hidden;
    word-break: break-word;
    box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.3);
}

/* -- Photo column -- */
#results th:nth-child(1),
#results td:nth-child(1) {
    width: 72px;
}

#results td.photo-cell {
    padding: 0;
    overflow: hidden;
}

.character-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
    display: block;
    border-radius: 6px;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.5));
}

/* -- Name column -- */
#results th:nth-child(2),
#results td:nth-child(2) {
    width: 110px;
    min-width: 90px;
}

#results td.nombre-cell {
    font-size: 0.75rem;
    font-weight: 800;
    text-align: center;
    word-break: break-word;
    vertical-align: middle;
    padding: 6px 6px;
    color: #3E2723 !important;
    text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.4);
    background: url('../img/Fondo_Pergamino.webp') center center / cover no-repeat !important;
    background-color: #C9A96E !important;
    background-blend-mode: multiply !important;
}

/* -- Status colors -- */
#results td.correct {
    background: url('../img/Fondo_Pergamino.webp') center center / cover no-repeat !important;
    background-color: #a0d4b0 !important;
    background-blend-mode: multiply !important;
    border: 2px solid #3c7355 !important;
    color: #113621 !important;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.4) !important;
}

#results td.partial {
    background: url('../img/Fondo_Pergamino.webp') center center / cover no-repeat !important;
    background-color: #f7b47e !important;
    background-blend-mode: multiply !important;
    border: 2px solid #b85718 !important;
    color: #4f2501 !important;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.4) !important;
}

#results td.incorrect {
    background: url('../img/Fondo_Pergamino.webp') center center / cover no-repeat !important;
    background-color: #eaa4a8 !important;
    background-blend-mode: multiply !important;
    border: 2px solid #a83f47 !important;
    color: #4a1318 !important;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.4) !important;
}

#results td.unknown {
    background: url('../img/Fondo_Pergamino.webp') center center / cover no-repeat !important;
    background-color: #b0aaa6 !important;
    background-blend-mode: multiply !important;
    border: 2px solid #8e827b !important;
    color: #38312d !important;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.4) !important;
}

/* -- Directional arrows as watermark -- */
td.hint-up::after,
td.hint-down::after {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3.2rem;
    font-weight: bold;
    color: rgba(62, 39, 35, 0.18);
    pointer-events: none;
    font-family: sans-serif;
    line-height: 1;
    z-index: 2;
}

td.hint-up::after {
    content: "\2B06\FE0E";
}

td.hint-down::after {
    content: "\2B07\FE0E";
}

.cell-content {
    position: relative;
    z-index: 10;
    display: inline-block;
    width: 100%;
}

/* ═══════════════════════════════════
   ANIMATIONS
═══════════════════════════════════ */

@keyframes cardFlipIn {
    0% {
        opacity: 0;
        transform: perspective(1000px) rotateY(90deg) scale(0.95);
    }

    60% {
        opacity: 1;
        transform: perspective(1000px) rotateY(-5deg) scale(1.02);
    }

    100% {
        opacity: 1;
        transform: perspective(1000px) rotateY(0) scale(1);
    }
}

tr.fade-in td {
    animation-name: cardFlipIn;
    animation-duration: 0.8s;
    animation-fill-mode: both;
    animation-timing-function: cubic-bezier(0.25, 0.46, 0.45, 0.94);
    backface-visibility: hidden;
    will-change: transform, opacity;
    transform-origin: center center;
}

tr.fade-in td:nth-child(1) {
    animation-delay: 0.30s;
}

tr.fade-in td:nth-child(2) {
    animation-delay: 0.60s;
}

tr.fade-in td:nth-child(3) {
    animation-delay: 0.90s;
}

tr.fade-in td:nth-child(4) {
    animation-delay: 1.20s;
}

tr.fade-in td:nth-child(5) {
    animation-delay: 1.50s;
}

tr.fade-in td:nth-child(6) {
    animation-delay: 1.80s;
}

tr.fade-in td:nth-child(7) {
    animation-delay: 2.10s;
}

tr.fade-in td:nth-child(8) {
    animation-delay: 2.40s;
}

tr.fade-in td:nth-child(9) {
    animation-delay: 2.70s;
}

tr.fade-in td:nth-child(10) {
    animation-delay: 3.00s;
}

@media (max-width: 1024px) {
    tr.fade-in td:nth-child(1) {
        animation-delay: 0.5s;
    }

    tr.fade-in td:nth-child(2) {
        animation-delay: 1.0s;
    }

    tr.fade-in td:nth-child(3) {
        animation-delay: 1.5s;
    }

    tr.fade-in td:nth-child(4) {
        animation-delay: 2.0s;
    }

    tr.fade-in td:nth-child(5) {
        animation-delay: 2.5s;
    }

    tr.fade-in td:nth-child(6) {
        animation-delay: 3.0s;
    }

    tr.fade-in td:nth-child(7) {
        animation-delay: 3.5s;
    }

    tr.fade-in td:nth-child(8) {
        animation-delay: 4.0s;
    }

    tr.fade-in td:nth-child(9) {
        animation-delay: 4.5s;
    }

    tr.fade-in td:nth-child(10) {
        animation-delay: 5.0s;
    }
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    20% {
        transform: translateX(-5px);
    }

    40% {
        transform: translateX(5px);
    }

    60% {
        transform: translateX(-3px);
    }

    80% {
        transform: translateX(3px);
    }
}

/* ── Legend ── */
.game-legend-container {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
    padding: 10px 20px;
    background: rgba(90, 50, 0, 0.06);
    border: 1px dashed rgba(139, 90, 43, 0.4);
    border-radius: 50px;
    width: fit-content;
    margin: 0 auto;
}

@media (max-width: 600px) {
    .game-legend-container {
        display: grid;
        grid-template-columns: repeat(2, max-content);
        justify-content: center;
        gap: 12px 24px;
        border-radius: 24px;
        padding: 12px 16px;
    }
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.78rem;
    color: #4A2E15;
    font-weight: 700;
}

.legend-color-box {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    flex-shrink: 0;
}

.legend-color-box.correct {
    background: url('../img/Fondo_Pergamino.webp') center center / cover no-repeat;
    background-color: #a0d4b0;
    background-blend-mode: multiply;
    border: 1.5px solid #3c7355;
}

.legend-color-box.partial {
    background: url('../img/Fondo_Pergamino.webp') center center / cover no-repeat;
    background-color: #f7b47e;
    background-blend-mode: multiply;
    border: 1.5px solid #b85718;
}

.legend-color-box.incorrect {
    background: url('../img/Fondo_Pergamino.webp') center center / cover no-repeat;
    background-color: #eaa4a8;
    background-blend-mode: multiply;
    border: 1.5px solid #a83f47;
}

.legend-color-box.unknown {
    background: url('../img/Fondo_Pergamino.webp') center center / cover no-repeat;
    background-color: #b0aaa6;
    background-blend-mode: multiply;
    border: 1.5px solid #8e827b;
}

.legend-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 4px;
    background: url('../img/Fondo_Pergamino.webp') center center / cover no-repeat;
    background-color: #eaa4a8;
    background-blend-mode: multiply;
    border: 1.5px solid #a83f47;
    font-size: 0.78rem;
    color: #4a1318;
    font-weight: 900;
    flex-shrink: 0;
}

/* ── Yesterday banner: see common.css (.wn-yesterday-banner) ── */
/* Limit width to match the result modal in the wider personaje layout */
.container-character .wn-yesterday-banner {
    max-width: 520px;
    margin: 16px auto;
}

/* ── Level buttons ── */
.levels-container {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin: 20px 0 12px;
}

.btn-level {
    background: var(--wn-bg-card);
    color: var(--wn-text);
    border: 2px solid var(--wn-border);
    padding: 8px 22px;
    border-radius: 24px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 700;
    transition: all .2s;
}

.btn-level:hover {
    border-color: var(--wn-orange);
    color: var(--wn-orange);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 107, 0, .2);
}

.btn-level:disabled,
.btn-level.disabled {
    opacity: 0.35;
    cursor: default;
    pointer-events: none;
    transform: none;
    box-shadow: none;
}

/* ── Chakra nature emojis ── */
.chakra-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 3px;
    width: 100%;
}

.chakra-emoji {
    display: inline-block;
    font-style: normal;
    font-size: 1.25em;
    line-height: 1;
    text-decoration: none !important;
    background: transparent !important;
    /* Prevent iOS blue/grey emoji text-highlight box */
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
    -webkit-text-stroke: 0;
    font-variant-emoji: emoji;
}

/* ── How to play section ── */


.wn-howto-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    margin-bottom: 1.25rem;
    max-width: 840px;
    margin-left: auto;
    margin-right: auto;
}

.wn-howto-card {
    background: url('../img/Fondo_Pergamino.webp') center center / cover no-repeat;
    background-color: #D4AA72;
    border: 1px solid #A07840;
    border-radius: 14px;
    padding: 1.25rem 1.5rem;
    font-size: 0.88rem;
    color: #3E2000;
    line-height: 1.6;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.wn-howto-card p {
    margin-bottom: 0;
}

.wn-howto-card-title {
    font-size: 0.8rem;
    font-weight: 800;
    color: #4A2E15;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin: 0 0 0.85rem;
    display: flex;
    align-items: center;
    gap: 7px;
}

.wn-howto-card-title i {
    color: var(--wn-orange);
    font-size: 1rem;
}

.wn-howto-card-title.mt-3 {
    margin-top: 1.2rem;
}

.wn-howto-legend-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 11px;
}

.wn-howto-legend-list li {
    display: flex;
    align-items: flex-start;
    gap: 11px;
}

.wn-howto-legend-list strong {
    display: block;
    font-size: 0.84rem;
    margin-bottom: 1px;
}

.wn-howto-swatch {
    width: 22px;
    height: 22px;
    border-radius: 5px;
    flex-shrink: 0;
    margin-top: 1px;
}

.wn-howto-swatch.correct {
    background: url('../img/Fondo_Pergamino.webp') center center / cover no-repeat;
    background-color: #a0d4b0;
    background-blend-mode: multiply;
    border: 1.5px solid #3c7355;
}

.wn-howto-swatch.partial {
    background: url('../img/Fondo_Pergamino.webp') center center / cover no-repeat;
    background-color: #f7b47e;
    background-blend-mode: multiply;
    border: 1.5px solid #b85718;
}

.wn-howto-swatch.incorrect {
    background: url('../img/Fondo_Pergamino.webp') center center / cover no-repeat;
    background-color: #eaa4a8;
    background-blend-mode: multiply;
    border: 1.5px solid #a83f47;
}

.wn-howto-swatch.unknown {
    background: url('../img/Fondo_Pergamino.webp') center center / cover no-repeat;
    background-color: #b0aaa6;
    background-blend-mode: multiply;
    border: 1.5px solid #8e827b;
}

.wn-howto-arrow {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    margin-top: 1px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: url('../img/Fondo_Pergamino.webp') center center / cover no-repeat;
    background-color: #eaa4a8;
    background-blend-mode: multiply;
    border: 1.5px solid #a83f47;
    border-radius: 5px;
    font-size: 0.7rem;
    font-weight: 900;
    letter-spacing: -1px;
    color: #4a1318;
}



@media (max-width: 640px) {
    .wn-howto-grid {
        grid-template-columns: 1fr;
    }


}

/* ── Responsive ── */
@media (max-width: 600px) {
    .game-container {
        padding: 14px 10px 12px;
    }

    .hint-container {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
    }

    .hint-box {
        width: 100%;
        padding: 10px 14px;
        justify-content: space-between;
    }

    .legend-item {
        font-size: 0.72rem;
    }

    .game-legend-container {
        border-radius: 12px;
        gap: 10px;
        padding: 8px 14px;
    }

    #results th {
        font-size: 0.65rem;
        padding: 8px 4px;
        letter-spacing: 0.4px;
    }

    #results td {
        font-size: 0.7rem;
        height: 78px !important;
        max-height: 78px;
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.03);
    }

    td.hint-up::after,
    td.hint-down::after {
        font-size: 4rem;
        opacity: 0.18;
    }

    .game-result-title {
        font-size: 1.2rem;
    }

    .character-portrait {
        width: 64px;
        height: 64px;
    }

    .levels-container {
        gap: 10px;
    }

    .btn-level {
        padding: 7px 16px;
        font-size: 0.82rem;
    }
}

/* ── Chakra info popover ── */
.chakra-info-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(90, 50, 0, 0.15);
    border: 1.5px solid rgba(90, 50, 0, 0.5);
    color: #4A2E15;
    font-size: 10px;
    font-family: sans-serif;
    font-style: normal;
    font-weight: bold;
    cursor: pointer;
    vertical-align: middle;
    margin-left: 4px;
    line-height: 1;
    user-select: none;
    transition: background 0.2s, border-color 0.2s;
    flex-shrink: 0;
}

.chakra-info-btn:hover {
    background: rgba(90, 50, 0, 0.35);
    border-color: #5A3200;
}

.chakra-info-popover {
    display: none;
    position: fixed;
    width: 260px;
    background: url('../img/Fondo_Pergamino.webp') center / cover no-repeat;
    background-color: #d4a96a;
    background-blend-mode: multiply;
    border: 1.5px solid rgba(90, 50, 0, 0.55);
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 0.78rem;
    font-weight: normal;
    color: #2e1a08;
    text-align: left;
    z-index: 9999;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
    white-space: normal;
    pointer-events: none;
}

.chakra-info-popover::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 6px solid rgba(90, 50, 0, 0.55);
}

.chakra-info-popover.above::before {
    top: auto;
    bottom: -6px;
    border-bottom: none;
    border-top: 6px solid rgba(90, 50, 0, 0.55);
}

.chakra-info-popover.open {
    display: block;
    pointer-events: auto;
}

.chakra-info-popover-title {
    display: block;
    font-size: 0.8rem;
    font-weight: 900;
    color: #3E2000;
    margin-bottom: 8px;
    text-align: center;
    border-bottom: 1px solid rgba(90, 50, 0, 0.3);
    padding-bottom: 6px;
}

.chakra-info-grid {
    display: grid;
    grid-template-columns: 1.4em 1fr 1.4em 1fr;
    gap: 4px 6px;
    align-items: center;
}

.chakra-info-grid span:nth-child(4n+1),
.chakra-info-grid span:nth-child(4n+3) {
    text-align: center;
    font-size: 1rem;
    line-height: 1;
}
}
}