/* assets/css/sopa-letras.css — Naruto theme */

/* ── LAYOUT ──────────────────────────────────────────────── */
.container-sopa {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-height: 80vh;
    width: 100%;
    max-width: 660px;
    margin: 0 auto;
    padding: 0 12px 30px;
    position: relative;
    z-index: 5;
    touch-action: pan-y;
}

/* ── GAME CARD ───────────────────────────────────────────── */
.game-container {
    width: 100%;
    background: url('../img/Fondo_Pergamino.webp') center center / cover no-repeat,
        linear-gradient(160deg, #e8d5b0, #d4b882);
    border: 2px solid #A07840;
    border-radius: 18px;
    padding: 30px 24px 40px;
    box-shadow:
        0 12px 40px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.45),
        inset 0 -2px 0 rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 30px;
}

main {
    width: 100%;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: auto;
    padding: 10px;
}

/* ── BOARD ───────────────────────────────────────────────── */
#sopa-board {
    display: grid;
    grid-template-columns: repeat(14, 1fr);
    width: 100%;
    max-width: 530px;
    aspect-ratio: 1 / 1;
    background-color: rgba(248, 235, 205, 0.9) !important;
    border-radius: 6px;
    padding: 15px;
    box-shadow: inset 0 0 30px rgba(62, 39, 35, 0.12), 0 5px 15px rgba(0, 0, 0, 0.3);
    gap: 0 !important;
    margin: 0 auto;
    user-select: none;
    touch-action: none;
    position: relative;
    border: 1.5px solid rgba(160, 120, 64, 0.4);
}

/* ── LINES LAYER ─────────────────────────────────────────── */
#lines-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
    border-radius: 6px;
}

/* ── BOARD CELLS ─────────────────────────────────────────── */
#sopa-board .cell {
    width: 100%;
    height: 100%;
    background-color: transparent !important;
    border: none !important;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: 'Segoe UI', system-ui, sans-serif;
    font-weight: 900;
    color: #3E2000;
    line-height: 1;
    cursor: pointer;
    font-size: clamp(11px, 3.5vw, 22px) !important;
    position: relative;
    z-index: 2;
}

#sopa-board .cell.found-text {
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
}

/* ── PILL HIGHLIGHT ──────────────────────────────────────── */
.highlight-pill {
    position: absolute;
    height: 70%;
    border-radius: 999px;
    transform-origin: center center;
    pointer-events: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.highlight-pill.current {
    background-color: rgba(255, 107, 0, 0.55);
    border: 1.5px solid #CC5500;
}

/* ── TITLE AREA ──────────────────────────────────────────── */
.page-subtitle {
    font-family: 'Reggae One', cursive;
    font-size: 1.8rem;
    font-weight: 400;
    color: var(--wn-text, #e0e0e0);
    margin: 0;
    text-align: center;
}

.btn-help {
    background: rgba(255, 107, 0, 0.15);
    border: 1.5px solid rgba(255, 107, 0, 0.4);
    color: #FF6B00;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    padding: 0;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    position: absolute;
    right: -38px;
    top: 50%;
    transform: translateY(-50%);
    transition: background 0.2s;
    line-height: 1;
}

.btn-help:hover {
    background: rgba(255, 107, 0, 0.3);
}

.subtitle-wrapper {
    position: relative;
    display: inline-block;
}

.subtitle-wrapper .page-subtitle {
    margin: 0;
    display: inline-block;
    vertical-align: middle;
}

.sopa-subtitle-container {
    flex-direction: column;
    gap: 8px !important;
}

/* ── TIMER ───────────────────────────────────────────────── */
.sopa-timer-display {
    font-family: 'Reggae One', cursive;
    font-size: 20px;
    color: #FF6B00;
    background: rgba(255, 107, 0, 0.08);
    border: 2px solid rgba(255, 107, 0, 0.3);
    border-radius: 8px;
    padding: 4px 14px;
    min-width: 80px;
    text-align: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    margin: 0 auto;
    margin-top: 8px;
    display: inline-block;
    letter-spacing: 2px;
}

/* ── WORD LIST ───────────────────────────────────────────── */
.word-list-title {
    font-family: 'Reggae One', cursive;
    font-size: 1.5rem;
    font-weight: 400;
    margin-bottom: 10px;
    color: #4A2E15;
    text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.4);
}

.word-list-container {
    margin-top: 20px;
    width: 100%;
    max-width: 600px;
    text-align: center;
    border-top: 2px dashed rgba(160, 120, 64, 0.4);
    padding-top: 15px;
}

.word-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    list-style: none;
    padding: 0;
    margin: 0;
}

.word-item {
    background: rgba(255, 255, 255, 0.85);
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    color: #3E2000;
    border: 1.5px solid #C19A6B;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.word-item.found {
    text-decoration: line-through;
    opacity: 0.75;
    color: #fff;
    border-color: transparent;
    box-shadow: none;
}

/* ── WIN MESSAGE (ep-parchment style) ────────────────────── */
.ep-parchment {
    background-image: url('../img/Pergamino_sin_tinta.png');
    background-size: 100% 100%;
    background-repeat: no-repeat;
    background-color: transparent;
    padding: 80px 48px 50px;
    text-align: center;
    position: relative;
}

.ep-parchment-icon {
    font-size: 3rem;
    line-height: 1;
    margin-bottom: 8px;
    display: block;
}

.ep-parchment-title {
    font-family: 'Reggae One', system-ui, sans-serif;
    font-size: clamp(1.3rem, 4vw, 1.7rem);
    color: #3d2b1a;
    margin: 0 0 4px;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
}

.ep-parchment-desc {
    color: #5a3e2b;
    font-size: 0.92rem;
    margin: 0 0 16px;
}

.ep-parchment-score-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #7a5c3e;
    margin: 0 0 6px;
}

.ep-parchment-score {
    font-family: 'Reggae One', system-ui, sans-serif;
    font-size: clamp(2.2rem, 7vw, 3.2rem);
    color: #2a7a3a;
    text-shadow: -1px -1px 0 rgba(42, 122, 58, 0.4), 1px -1px 0 rgba(42, 122, 58, 0.4),
                 -1px  1px 0 rgba(42, 122, 58, 0.4), 1px  1px 0 rgba(42, 122, 58, 0.4),
                 0 0 20px rgba(42, 122, 58, 0.3);
    display: inline-block;
    background: rgba(42, 122, 58, 0.1);
    border: 2px solid rgba(42, 122, 58, 0.35);
    border-radius: 12px;
    padding: 4px 20px;
    margin: 0 0 6px;
    line-height: 1.1;
}

.ep-parchment-comeback {
    color: #7a5c3e;
    font-size: 0.85rem;
    margin: 0;
}

.ep-parchment-divider {
    width: 60px;
    height: 2px;
    background: rgba(100, 65, 30, 0.3);
    border-radius: 2px;
    margin: 16px auto;
}

.ep-countdown-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 14px 0 10px;
    color: #7a5c3e;
    font-size: 0.88rem;
}

.ep-countdown-timer {
    font-family: 'Reggae One', system-ui, sans-serif;
    font-size: 1.25rem;
    color: #2a7a3a;
    min-width: 90px;
    font-variant-numeric: tabular-nums;
}

.ep-share-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    max-width: 340px;
    margin: 14px auto 0;
    padding: 13px 24px;
    background: linear-gradient(135deg, var(--wn-orange) 0%, var(--wn-orange-dark) 100%);
    border: none;
    border-radius: 50px;
    color: #fff;
    font-family: 'Reggae One', system-ui, sans-serif;
    font-size: 1.1rem;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(255, 107, 0, 0.4);
    transition: transform 0.15s, box-shadow 0.15s, filter 0.15s;
}

.ep-share-btn:hover {
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 6px 22px rgba(255, 107, 0, 0.55);
    filter: brightness(1.08);
}

.ep-share-btn i {
    font-size: 1.15rem;
}



/* ── STEP CARDS (info) ───────────────────────────────────── */
.info-steps-visual {
    display: flex;
    justify-content: space-around;
    align-items: center;
    gap: 14px;
    margin: 14px 0;
    flex-wrap: wrap;
}

.static-step {
    background: transparent;
    box-shadow: none;
    padding: 0;
    max-width: 220px;
}

.anim-box {
    background: rgba(248, 235, 205, 0.8);
    border: 2px solid #C19A6B;
    border-radius: 8px;
    padding: 0;
    position: relative;
    height: 68px;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.demo-row {
    display: flex;
    gap: 3px;
    position: relative;
    z-index: 1;
}

.d-cell {
    width: 24px;
    height: 24px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 900;
    color: #3E2000;
    font-size: 14px;
    border: 1px solid rgba(160, 120, 64, 0.3);
    background: rgba(255, 255, 255, 0.4);
    border-radius: 3px;
    transition: background 0.2s;
}

.static-text {
    margin-top: 8px;
    text-align: center;
    line-height: 1.2;
}

.static-text strong {
    display: block;
    color: #FF6B00;
    font-family: 'Reggae One', cursive;
    font-size: 1.1rem;
    margin-bottom: 2px;
}

.static-text span {
    font-size: 0.82rem;
    color: #4A2E15;
}

/* ── HAND ICON ───────────────────────────────────────────── */
.hand-icon {
    font-size: 30px;
    position: absolute;
    z-index: 10;
    pointer-events: none;
    filter: drop-shadow(1px 1px 2px rgba(0, 0, 0, 0.25));
    left: 50%;
    top: 50%;
    margin-left: -76px;
    margin-top: -14px;
}

/* ── DRAG ANIMATION ──────────────────────────────────────── */
.drag-anim {
    animation: dragHandMove 2.5s infinite ease-in-out;
}

@keyframes dragHandMove {
    0% {
        transform: translate(0px, 0px);
    }

    15% {
        transform: translate(0px, 5px) scale(0.9);
    }

    60% {
        transform: translate(120px, 5px) scale(0.9);
    }

    75% {
        transform: translate(120px, 0px) scale(1);
    }

    85% {
        transform: translate(120px, 0px) scale(1);
        opacity: 1;
    }

    100% {
        transform: translate(0px, 0px);
        opacity: 0;
    }
}

.step-card:first-child .d-cell {
    animation: cellLightUp 2.5s infinite;
}

.step-card:first-child .d-cell:nth-child(1) {
    animation-delay: 0.1s;
}

.step-card:first-child .d-cell:nth-child(2) {
    animation-delay: 0.25s;
}

.step-card:first-child .d-cell:nth-child(3) {
    animation-delay: 0.40s;
}

.step-card:first-child .d-cell:nth-child(4) {
    animation-delay: 0.55s;
}

.step-card:first-child .d-cell:nth-child(5) {
    animation-delay: 0.70s;
}

@keyframes cellLightUp {

    0%,
    10% {
        background: rgba(255, 255, 255, 0.3);
        border-color: rgba(160, 120, 64, 0.3);
    }

    15% {
        background: rgba(255, 107, 0, 0.35);
        border-color: #FF6B00;
    }

    75% {
        background: rgba(255, 107, 0, 0.35);
        border-color: #FF6B00;
    }

    85% {
        background: rgba(255, 255, 255, 0.3);
        border-color: rgba(160, 120, 64, 0.3);
    }
}

/* ── TAP ANIMATION ───────────────────────────────────────── */
.tap-anim {
    margin-left: -56px !important;
    animation: tapHandMove 2.5s infinite ease-in-out;
}

@keyframes tapHandMove {
    0% {
        transform: translate(0px, 0px);
    }

    10% {
        transform: translate(0px, 5px) scale(0.9);
    }

    20% {
        transform: translate(0px, 0px) scale(1);
    }

    40% {
        transform: translate(90px, -20px) scale(1.1);
    }

    60% {
        transform: translate(90px, 0px) scale(1);
    }

    70% {
        transform: translate(90px, 5px) scale(0.9);
    }

    80% {
        transform: translate(90px, 0px) scale(1);
        opacity: 1;
    }

    95% {
        transform: translate(90px, 0px);
        opacity: 0;
    }

    100% {
        transform: translate(0px, 0px);
        opacity: 0;
    }
}

.highlight-start {
    animation: tapHighlightStart 2.5s infinite;
}

.highlight-end {
    animation: tapHighlightEnd 2.5s infinite;
}

@keyframes tapHighlightStart {

    0%,
    10% {
        background: rgba(255, 255, 255, 0.3);
        border-radius: 3px;
    }

    11% {
        background: rgba(255, 107, 0, 0.4);
        border-radius: 3px;
        box-shadow: 0 0 0 2px #FF6B00;
    }

    90% {
        background: rgba(255, 107, 0, 0.4);
        border-radius: 3px;
        box-shadow: 0 0 0 2px #FF6B00;
    }

    100% {
        background: rgba(255, 255, 255, 0.3);
        border-radius: 3px;
        box-shadow: none;
    }
}

@keyframes tapHighlightEnd {

    0%,
    69% {
        background: rgba(255, 255, 255, 0.3);
        border-radius: 3px;
    }

    70% {
        background: rgba(255, 107, 0, 0.4);
        border-radius: 3px;
        box-shadow: 0 0 0 2px #FF6B00;
    }

    90% {
        background: rgba(255, 107, 0, 0.4);
        border-radius: 3px;
        box-shadow: 0 0 0 2px #FF6B00;
    }

    100% {
        background: rgba(255, 255, 255, 0.3);
        border-radius: 3px;
        box-shadow: none;
    }
}

.step-card:last-child .d-cell:nth-child(2),
.step-card:last-child .d-cell:nth-child(3) {
    animation: tapMiddleFill 2.5s infinite;
}

@keyframes tapMiddleFill {

    0%,
    69% {
        background: rgba(255, 255, 255, 0.3);
        border-color: rgba(160, 120, 64, 0.3);
    }

    70% {
        background: rgba(255, 107, 0, 0.4);
        border-color: #FF6B00;
    }

    90% {
        background: rgba(255, 107, 0, 0.4);
        border-color: #FF6B00;
    }

    100% {
        background: rgba(255, 255, 255, 0.3);
        border-color: rgba(160, 120, 64, 0.3);
    }
}

/* ── FIRST-CLICK FEEDBACK ────────────────────────────────── */
.cell.selected-start {
    background-color: rgba(255, 107, 0, 0.3) !important;
    border-radius: 50%;
    animation: pulseSelect 1.5s infinite;
}

@keyframes pulseSelect {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 107, 0, 0.6);
    }

    70% {
        transform: scale(1.1);
        box-shadow: 0 0 0 5px rgba(255, 107, 0, 0);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 107, 0, 0);
    }
}

/* ── TUTORIAL MODAL ──────────────────────────────────────── */
.tutorial-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
    backdrop-filter: blur(4px);
}

.tutorial-content {
    background: url('../img/Fondo_Pergamino.webp') center center / cover no-repeat,
        linear-gradient(160deg, #e8d5b0, #d4b882);
    border: 2px solid #A07840;
    border-radius: 18px;
    padding: 28px 24px;
    max-width: 460px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    text-align: center;
}

.tutorial-title {
    font-family: 'Reggae One', cursive;
    font-size: 1.6rem;
    color: #4A2E15;
    margin-bottom: 20px;
    text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.4);
}

.tutorial-steps {
    display: flex;
    gap: 14px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.tutorial-steps .step-card {
    flex: 1;
    min-width: 130px;
    max-width: 180px;
    background: rgba(255, 255, 255, 0.3);
    border: 1.5px solid rgba(160, 120, 64, 0.4);
    border-radius: 12px;
    padding: 14px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.tutorial-steps .step-card h3 {
    font-family: 'Reggae One', cursive;
    font-size: 1rem;
    color: #FF6B00;
    margin: 0;
}

.tutorial-steps .step-card p {
    font-size: 0.8rem;
    color: #4A2E15;
    margin: 0;
}

.btn-play-sopa {
    margin-top: 6px;
    background: linear-gradient(135deg, #FF6B00, #CC5500);
    color: #fff;
    border: none;
    padding: 12px 40px;
    font-family: 'Reggae One', cursive;
    font-size: 1.4rem;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    box-shadow: 0 5px 0 #8B3A00, 0 6px 10px rgba(0, 0, 0, 0.3);
    text-transform: uppercase;
    width: 100%;
    max-width: 260px;
}

.btn-play-sopa:hover {
    background: linear-gradient(135deg, #FF8C33, #FF6B00);
}

.btn-play-sopa:active {
    transform: translateY(4px);
    box-shadow: 0 1px 0 #8B3A00;
}

/* ── WIN MESSAGE ─────────────────────────────────────────── */
#winMsg {
    width: 100%;
}

/* ── RANKING TOP 5 ───────────────────────────────────────── */
#sopa-ranking {
    margin: 20px auto 0;
    width: 100%;
    max-width: 480px;
    background: url('../img/Fondo_Pergamino.webp') center center / cover no-repeat;
    background-color: #CE9D66;
    border: 2px solid #C19A6B;
    border-radius: 16px;
    padding: 20px 20px 16px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

#sopa-ranking.hidden {
    display: none;
}

/* ── HIDDEN HELPER ───────────────────────────────────────── */
.hidden {
    display: none !important;
}

/* ── RESPONSIVE ──────────────────────────────────────────── */
@media (max-width: 500px) {
    .container-sopa {
        padding: 0 4px 20px;
    }

    .game-container {
        padding: 16px 8px 24px;
    }

    #sopa-board {
        padding: 6px;
    }

    #sopa-board .cell {
        font-size: clamp(10px, 4.5vw, 16px) !important;
    }

    .info-steps-visual {
        flex-direction: column;
        align-items: center;
        gap: 16px;
    }

    .static-step {
        width: 100%;
        max-width: 280px;
    }

    /* Tutorial modal: pegar a los bordes y agrandar letras */
    .tutorial-overlay {
        padding: 8px;
    }

    .tutorial-content {
        padding: 18px 12px;
    }

    .tutorial-steps {
        flex-direction: column;
        align-items: center;
    }

    .tutorial-steps .step-card {
        max-width: 100%;
        width: 100%;
    }

    .d-cell {
        width: 27px;
        height: 27px;
        font-size: 15px;
    }

    .anim-box {
        height: 74px;
    }
}