.jpt-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 2rem;
    margin-block: 2rem 3rem;
}

@media (max-width: 900px) {
    .jpt-layout {
        grid-template-columns: minmax(0, 1fr);
    }
}

.jpt-page {
    display: grid;
    gap: 1rem;
}

.jpt-layout .breadcrumbs {
    margin-bottom: 0;
}

.jpt-layout .breadcrumb-list {
    padding-block: 0 .25rem;
}

.jpt-hero {
    padding: clamp(1.25rem, 3vw, 2rem);
    border-radius: 8px;
    background: #d7c2a3;
    color: #2a2018;
    text-align: center;
}

.jpt-kicker {
    margin: 0 0 .5rem;
    color: #8f2f22;
    font-size: .85rem;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
}

.jpt-game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 1rem;
}

.jpt-game-card,
.jpt-ranking,
.jpt-game-shell,
.jpt-rules {
    padding: 1rem;
    border: 1px solid rgba(0, 0, 0, .12);
    border-radius: 8px;
    background: #fff;
}

.jpt-game-card h2 {
    margin-top: 0;
}

.jpt-button,
.jpt-game-toolbar button,
.jpt-modal-close,
.jpt-board > button,
.jpt-crossword-check,
.jpt-chain-bank button,
.jpt-chain-drop button,
.jpt-word-list button,
.jpt-letters button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: .65rem 1rem;
    border: 1px solid #8f2f22;
    border-radius: 6px;
    background: #8f2f22;
    color: #fff;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

.jpt-game-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    align-items: center;
}

.jpt-game-toolbar select {
    min-height: 40px;
}

.jpt-ranking ol {
    margin: 0;
    padding-left: 1.4rem;
}

.jpt-rules {
    margin-top: 1rem;
}

.jpt-rules-grid {
    display: grid;
    gap: 1rem;
    margin-top: 1rem;
}

.jpt-rules-grid img {
    display: block;
    max-width: 100%;
    height: auto;
}

.jpt-modal[hidden] {
    display: none;
}

.jpt-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: grid;
    place-items: center;
    padding: 1rem;
    background: rgba(0, 0, 0, .65);
}

.jpt-modal-panel {
    position: relative;
    width: min(1180px, 96vw);
    max-height: 92vh;
    overflow: auto;
    padding: 1rem;
    border-radius: 8px;
    background: #f8f4ed;
    color: #221a14;
}

.jpt-modal-close {
    position: absolute;
    top: .7rem;
    right: .7rem;
    min-width: 36px;
    min-height: 36px;
    padding: 0;
}

.jpt-modal-head {
    display: flex;
    gap: 1rem;
    align-items: center;
    justify-content: space-between;
    padding-right: 3rem;
}

.jpt-board {
    display: grid;
    gap: 1rem;
}

.jpt-hangman {
    display: grid;
    gap: 1rem;
    justify-items: center;
}

.jpt-hangman-drawing {
    width: min(280px, 82vw);
    height: auto;
}

.jpt-hangman-lines path,
.jpt-hangman-lines circle {
    fill: none;
    stroke: #3f2a1d;
    stroke-width: 8;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: 0;
    transition: opacity .18s ease;
}

.jpt-hangman-lines circle {
    stroke-width: 7;
}

.jpt-hangman-lines .is-visible {
    opacity: 1;
}

.jpt-word {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    justify-content: center;
    font-size: 1.6rem;
    font-weight: 700;
}

.jpt-word span {
    min-width: 1.6rem;
    border-bottom: 2px solid currentColor;
    text-align: center;
}

.jpt-word span.jpt-word-separator {
    min-width: .75rem;
    border-bottom: 0;
}

.jpt-letters {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    justify-content: center;
}

.jpt-letters button {
    min-width: 38px;
    padding: .35rem;
}

.jpt-letters button.is-correct,
.jpt-letters button.is-correct:disabled,
.jpt-letters button.is-correct[disabled] {
    border-color: #247a3f !important;
    background: #247a3f !important;
    color: #fff !important;
    opacity: 1 !important;
}

.jpt-letters button.is-wrong,
.jpt-letters button.is-wrong:disabled,
.jpt-letters button.is-wrong[disabled] {
    border-color: #9d2c24 !important;
    background: #9d2c24 !important;
    color: #fff !important;
    opacity: 1 !important;
}

.jpt-wordsearch-layout {
    display: grid;
    grid-template-columns: minmax(280px, 520px) minmax(180px, .6fr);
    gap: 1.25rem;
    align-items: start;
}

.jpt-wordsearch-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 2px;
    max-width: 520px;
    touch-action: none;
    user-select: none;
}

.jpt-wordsearch-grid button {
    display: grid;
    aspect-ratio: 1;
    place-items: center;
    background: #fff;
    border: 1px solid #d4c6b4;
    border-radius: 0;
    color: #2b1b12;
    cursor: pointer;
    font-weight: 700;
    min-width: 0;
    padding: 0;
}

.jpt-wordsearch-grid button.is-selected {
    background: #d8a457;
    border-color: #8a4f22;
    color: #1f130b;
}

.jpt-wordsearch-grid button.is-found {
    background: #7a4a25;
    border-color: #7a4a25;
    color: #fff;
}

.jpt-wordsearch-grid button.is-found.is-selected {
    background: #d8a457;
    border-color: #8a4f22;
    color: #1f130b;
}

.jpt-wordsearch-grid button.is-invalid {
    background: #b34c36;
    border-color: #7d2d1e;
    color: #fff;
}

.jpt-word-list {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    align-content: start;
}

.jpt-word-list span {
    background: #f5efe6;
    border: 1px solid #d4c6b4;
    color: #2b1b12;
    display: inline-flex;
    font-weight: 700;
    padding: .35rem .55rem;
}

.jpt-word-list span.is-found {
    opacity: .45;
    text-decoration: line-through;
}

.jpt-crossword-layout {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) minmax(240px, .8fr);
    gap: 1.25rem;
    align-items: start;
}

.jpt-crossword-grid {
    display: grid;
    gap: 0;
    width: min(100%, 560px);
    border: 3px solid #d8c39f;
    background: #d8c39f;
}

.jpt-crossword-cell {
    position: relative;
    display: grid;
    aspect-ratio: 1;
    min-width: 0;
    border: 1px solid #333;
    background: #fffdf8;
}

.jpt-crossword-cell--empty {
    border-color: #d8c39f;
    background: #d8c39f;
}

.jpt-crossword-cell span {
    position: absolute;
    top: 1px;
    left: 3px;
    z-index: 1;
    color: #241a13;
    font-size: .65rem;
    font-weight: 700;
    line-height: 1;
}

.jpt-crossword-cell input {
    width: 100%;
    min-width: 0;
    height: 100%;
    padding: .45rem .15rem .1rem;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #1f1711;
    font-size: clamp(1rem, 3vw, 1.5rem);
    font-weight: 700;
    line-height: 1;
    text-align: center;
    text-transform: uppercase;
}

.jpt-crossword-cell input:focus {
    outline: 3px solid #8f2f22;
    outline-offset: -3px;
    background: #fff2cf;
}

.jpt-crossword-clues {
    display: grid;
    gap: 1rem;
    align-content: start;
}

.jpt-crossword-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .4rem;
}

.jpt-crossword-tabs button {
    min-height: 40px;
    padding: .5rem .7rem;
    border: 1px solid #8f2f22;
    border-radius: 6px;
    background: #fffdf8;
    color: #8f2f22;
    font-weight: 700;
    cursor: pointer;
}

.jpt-crossword-tabs button[aria-selected="true"] {
    background: #8f2f22;
    color: #fff;
}

.jpt-crossword-tabs button:focus-visible {
    outline: 3px solid #d8a457;
    outline-offset: 2px;
}

.jpt-crossword-check {
    width: 100%;
    margin-top: .25rem;
}

.jpt-crossword-clues section {
    display: grid;
    gap: .5rem;
}

.jpt-crossword-clues section[hidden] {
    display: none;
}

.jpt-crossword-clues h3 {
    margin: 0;
    color: #8f2f22;
    font-size: 1rem;
    text-transform: uppercase;
}

.jpt-crossword-clues ol {
    margin: 0;
    padding-left: 1.5rem;
}

.jpt-crossword-clues li {
    margin-bottom: .45rem;
}

.jpt-chain-layout {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) minmax(220px, .8fr);
    gap: 1.25rem;
    align-items: start;
}

.jpt-chain-slots,
.jpt-chain-bank {
    display: grid;
    gap: .55rem;
}

.jpt-chain-slot {
    display: grid;
    grid-template-columns: 2rem 1fr;
    gap: .5rem;
    align-items: center;
}

.jpt-chain-slot span {
    display: grid;
    width: 2rem;
    height: 2rem;
    place-items: center;
    border-radius: 50%;
    background: #8f2f22;
    color: #fff;
    font-weight: 700;
}

.jpt-chain-drop {
    display: flex;
    align-items: center;
    min-height: 42px;
    padding: .25rem;
    border: 1px solid #d4c6b4;
    border-radius: 6px;
    background: #fffdf8;
}

.jpt-chain-drop.is-dragover,
.jpt-chain-bank.is-dragover {
    outline: 3px solid #d8a457;
    outline-offset: 2px;
}

.jpt-chain-bank {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    min-height: 56px;
    padding: .5rem;
    border: 1px dashed #d4c6b4;
    border-radius: 6px;
    background: #f5efe6;
}

.jpt-chain-tile {
    min-height: 38px;
    padding: .45rem .65rem;
    width: 100%;
}

.jpt-chain-tile.is-selected {
    outline: 3px solid #d8a457;
    outline-offset: 2px;
    background: #6f241b;
}

.jpt-chain-drop .jpt-chain-tile {
    width: 100%;
}

.jpt-chain-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: .75rem;
}

.jpt-chain-actions button {
    min-height: 42px;
    padding: .65rem 1rem;
    border: 1px solid #b79a68;
    border-radius: 6px;
    background: #d8c39f;
    color: #2a2018;
    font-weight: 700;
    cursor: pointer;
}

.jpt-crypto-layout {
    display: grid;
    grid-template-columns: minmax(320px, 1fr) minmax(240px, .75fr);
    gap: 1.25rem;
    align-items: start;
}

.jpt-crypto-main {
    display: grid;
    gap: 1rem;
}

.jpt-crypto-help {
    padding: .7rem .9rem;
    border: 1px solid #d4c6b4;
    border-radius: 6px;
    background: #f5efe6;
    color: #2a2018;
}

.jpt-crypto-slots {
    display: flex;
    flex-wrap: wrap;
    gap: .55rem;
    align-items: center;
    padding: 1rem;
    border: 1px solid #d4c6b4;
    border-radius: 6px;
    background: #fffdf8;
}

.jpt-crypto-slot {
    display: grid;
    width: 54px;
    height: 58px;
    place-items: center;
    padding: 0;
    border: 2px solid #d4c6b4;
    border-radius: 6px;
    background: #fffdf8;
    cursor: pointer;
}

.jpt-crypto-slot.is-dragover {
    border-color: #b6813a;
    outline: 3px solid rgba(216, 164, 87, .35);
    outline-offset: 2px;
}

.jpt-crypto-space {
    width: 1rem;
    height: 1px;
}

.jpt-crypto-answer {
    display: grid;
    gap: .35rem;
    font-weight: 700;
}

.jpt-crypto-answer input {
    min-height: 42px;
    padding: .55rem .7rem;
    border: 1px solid #d4c6b4;
    border-radius: 6px;
    background: #fffdf8;
    color: #221a14;
    font-weight: 700;
    text-transform: uppercase;
}

.jpt-crypto-alphabet {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(72px, 1fr));
    gap: .5rem;
    padding: .6rem;
    border: 1px dashed #d4c6b4;
    border-radius: 6px;
    background: #f5efe6;
}

.jpt-crypto-tile {
    display: grid;
    gap: .15rem;
    min-height: 76px;
    place-items: center;
    padding: .35rem;
    border: 1px solid #8f2f22;
    border-radius: 6px;
    background: #fffdf8;
    color: #2a2018;
    font-weight: 700;
    cursor: grab;
}

.jpt-crypto-tile.is-selected {
    border-color: #b6813a;
    outline: 3px solid rgba(216, 164, 87, .32);
    outline-offset: 2px;
}

.jpt-crypto-tile:active {
    cursor: grabbing;
}

.jpt-angerthas-glyph {
    display: block;
    width: 42px;
    height: 42px;
    object-fit: contain;
    pointer-events: none;
}

.jpt-puzzle-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0;
    max-width: 760px;
}

.jpt-puzzle-piece {
    display: block;
    min-height: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: inherit;
    font-weight: inherit;
    line-height: 0;
    text-decoration: none;
    cursor: pointer;
}

.jpt-puzzle-piece.is-selected {
    outline: 3px solid #8f2f22;
    outline-offset: -3px;
    z-index: 1;
}

.jpt-puzzle-piece img {
    display: block;
    width: 100%;
    height: auto;
}

.jpt-puzzle-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
    justify-content: center;
}

.jpt-puzzle-actions [data-jpt-puzzle-timer] {
    font-weight: 700;
    color: #2a2018;
}

.jpt-notice {
    padding: .75rem 1rem;
    border-left: 4px solid #8f2f22;
    background: #fff4ef;
}

.jpt-game-message {
    margin: 0 0 1rem;
    padding: .85rem 1rem;
    border-left: 4px solid #7a5a24;
    border-radius: 6px;
    background: #fff8e8;
    color: #241b12;
    font-weight: 700;
}

.jpt-game-message--success {
    border-left-color: #247a3f;
    background: #edf9f0;
}

.jpt-game-message--error {
    border-left-color: #9d2c24;
    background: #fff0ee;
}

@media (max-width: 760px) {
    .jpt-wordsearch-layout {
        grid-template-columns: 1fr;
    }

    .jpt-crossword-layout {
        grid-template-columns: 1fr;
    }

    .jpt-chain-layout {
        grid-template-columns: 1fr;
    }

    .jpt-crypto-layout {
        grid-template-columns: 1fr;
    }

    .jpt-crossword-grid {
        width: 100%;
    }

    .jpt-crossword-cell input {
        padding-top: .5rem;
        font-size: .95rem;
    }
}

/* Escritorios de poca altura (por ejemplo, 1366 x 768): el juego completo
 * permanece visible sin convertir el modal en una zona desplazable. */
@media (min-width: 901px) and (max-height: 800px) {
    .jpt-modal { padding: .75rem; }

    .jpt-modal-panel {
        max-height: calc(100dvh - 1.5rem);
        padding: .75rem 1rem;
        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    .jpt-modal-head h2 {
        margin-block: .35rem .65rem;
        font-size: 1.45rem;
    }

    .jpt-board { gap: .65rem; }
    .jpt-hangman { gap: .55rem; }
    .jpt-hangman p { margin-block: 0; }
    .jpt-hangman-drawing { width: min(215px, 82vw); }
    .jpt-word { font-size: 1.35rem; }
    .jpt-word span { min-width: 1.35rem; }
    .jpt-wordsearch-grid { width: min(480px, calc(100dvh - 12.5rem)); }

    .jpt-crossword-grid {
        width: min(520px, 100%, calc((100dvh - 13.75rem) * var(--jpt-crossword-ratio, 1)));
    }

    .jpt-crossword-clues {
        gap: .5rem;
        font-size: .88rem;
        line-height: 1.2;
    }

    .jpt-crossword-clues section { gap: .25rem; }
    .jpt-crossword-clues li { margin-bottom: .2rem; }
    .jpt-crossword-tabs button {
        min-height: 36px;
        padding: .35rem .55rem;
    }

    .jpt-chain-layout,
    .jpt-crypto-layout { gap: .85rem; }

    .jpt-chain-slots,
    .jpt-chain-bank { gap: .35rem; }

    .jpt-chain-drop {
        min-height: 36px;
        padding: .15rem;
    }

    .jpt-chain-tile {
        min-height: 34px;
        padding: .3rem .55rem;
    }

    .jpt-crypto-main { gap: .6rem; }

    .jpt-crypto-help,
    .jpt-crypto-slots,
    .jpt-crypto-alphabet { padding: .45rem; }

    .jpt-crypto-slots { gap: .35rem; }

    .jpt-crypto-slot {
        width: 46px;
        height: 48px;
    }

    .jpt-crypto-alphabet {
        grid-template-columns: repeat(auto-fit, minmax(62px, 1fr));
        gap: .35rem;
    }

    .jpt-crypto-tile {
        min-height: 62px;
        padding: .2rem;
    }

    .jpt-angerthas-glyph {
        width: 34px;
        height: 34px;
    }

    .jpt-puzzle-grid {
        width: min(720px, 100%, calc((100dvh - 11.875rem) * 1.25));
    }

    .jpt-puzzle-actions { gap: .75rem; }
}
