/* Shared by the home, catalog and in-game character tutorial. */
#tutorialModal {
    padding: 12px;
    background: rgba(17, 10, 8, .86);
    backdrop-filter: blur(7px);
}

#tutorialModal .character-tutorial-content {
    width: min(780px, 100%);
    max-width: 780px;
    max-height: calc(100dvh - 24px);
    padding: 25px 25px 22px;
    overflow-x: hidden;
    border: 3px solid #ffb300;
    border-radius: 13px;
    color: #fff8e1;
    background:
        radial-gradient(circle at 10% 0%, rgba(255, 179, 0, .09), transparent 34%),
        linear-gradient(145deg, #432c26, #2b1d19 72%);
    box-shadow: 0 20px 65px rgba(0, 0, 0, .72), 0 0 0 1px rgba(255, 202, 40, .12) inset;
    animation: character-tut-enter .34s cubic-bezier(.2, .8, .2, 1) both;
}

#tutorialModal .btn-close-tutorial {
    top: 5px;
    right: 5px;
    display: flex;
    width: 44px;
    height: 44px;
    box-sizing: border-box;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid rgba(255, 202, 40, .3);
    border-radius: 50%;
    color: #ffca28;
    background: rgba(20, 12, 10, .38);
    line-height: 0;
    touch-action: manipulation;
    z-index: 100;
}

/* Amplía el objetivo sin mover el icono. El pseudo-elemento pertenece al
   propio botón, por lo que toda esta superficie dispara el mismo click. */
#tutorialModal .btn-close-tutorial::before {
    content: "";
    position: absolute;
    inset: -6px;
    border-radius: 50%;
}

#tutorialModal .btn-close-tutorial svg {
    display: block;
    width: 18px;
    height: 18px;
    pointer-events: none;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.25;
    stroke-linecap: round;
}

.character-tutorial-heading {
    padding: 0;
    text-align: center;
    pointer-events: none;
}

.character-tutorial-kicker {
    display: inline-flex;
    align-items: center;
    min-height: 27px;
    padding: 5px 13px;
    border: 1px solid rgba(255, 179, 0, .58);
    border-radius: 999px;
    color: #ffca28;
    background: rgba(255, 179, 0, .07);
    font: 800 .69rem/1 'Roboto', sans-serif;
    letter-spacing: .11em;
    text-transform: uppercase;
}

#tutorialModal .character-tutorial-heading h2 {
    margin: 7px 0 5px;
    color: #ffca28;
    font: 400 2rem/1 'Pirata One', cursive;
    text-shadow: 2px 3px 0 #1e1411;
}

#tutorialModal .character-tutorial-heading p {
    margin: 0 34px 15px;
    color: #d7ccc8;
    font: 500 .86rem/1.35 'Roboto', sans-serif;
}

.character-tutorial-steps {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.character-step-card {
    position: relative;
    display: grid;
    grid-template-rows: 70px min-content 1fr;
    gap: 6px;
    min-width: 0;
    padding: 11px 10px 12px;
    overflow: hidden;
    border: 1px solid rgba(255, 179, 0, .34);
    border-radius: 10px;
    background: rgba(255, 248, 225, .045);
    text-align: center;
}

.character-step-card::before {
    content: attr(data-step);
    position: absolute;
    top: 7px;
    left: 7px;
    z-index: 2;
    display: grid;
    width: 25px;
    height: 25px;
    place-items: center;
    border: 1px solid rgba(255, 179, 0, .58);
    border-radius: 50%;
    color: #ffca28;
    background: #34231f;
    font: 800 .57rem/1 'Roboto', sans-serif;
}

.character-step-demo {
    display: flex;
    height: 70px;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid rgba(255, 179, 0, .25);
    border-radius: 8px;
    background: rgba(20, 12, 10, .24);
}

.character-step-card h3 {
    margin: 0;
    color: #ffca28;
    font: 400 1.05rem/1.05 'Pirata One', cursive;
    text-shadow: 1px 2px 0 #1e1411;
}

#tutorialModal .character-step-card p {
    margin: 0;
    padding: 0 5px;
    color: #d7ccc8;
    font: 500 .72rem/1.3 'Roboto', sans-serif;
}

.character-tut-search {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 30px;
    width: min(215px, 78%);
    height: 32px;
    align-items: center;
    overflow: hidden;
    border: 1px solid rgba(255, 179, 0, .5);
    border-radius: 999px;
    background: #281b18;
}

.character-tut-search span {
    display: block;
    max-width: 0;
    padding-left: 10px;
    overflow: hidden;
    color: #fff3c4;
    font: 800 .57rem/1 'Roboto', sans-serif;
    letter-spacing: .02em;
    text-align: left;
    white-space: nowrap;
    animation: character-tut-type 4.3s steps(16, end) infinite;
}

.character-tut-search b {
    display: grid;
    height: 100%;
    place-items: center;
    color: #3e2723;
    background: #ffb300;
    font: 900 .54rem/1 'Roboto', sans-serif;
}

.character-tut-compare {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: min(230px, 84%);
    gap: 5px;
}

.character-tut-compare i {
    display: grid;
    min-width: 0;
    min-height: 43px;
    place-items: center;
    padding: 4px 3px;
    border: 1px solid rgba(255, 248, 225, .18);
    border-radius: 5px;
    color: #efe2d6;
    background: #4a3a35;
    font-style: normal;
    animation: character-tut-cell 4.2s ease-in-out infinite;
}

.character-tut-compare i:nth-child(2) { animation-delay: .35s; }
.character-tut-compare i:nth-child(3) { animation-delay: .7s; }

.character-tut-compare small {
    width: 100%;
    overflow: hidden;
    font: 700 .43rem/1 'Roboto', sans-serif;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.character-tut-compare b {
    font: 900 .88rem/1 'Roboto', sans-serif;
}

.character-tut-compare .is-match {
    --cell-color: color-mix(in srgb, var(--state-correct) 90%, transparent);
    --cell-border: var(--state-correct);
}

.character-tut-compare .is-partial {
    --cell-color: rgba(239, 108, 0, .9);
    --cell-border: #ef6c00;
}

.character-tut-compare .is-higher {
    --cell-color: #67564f;
    --cell-border: rgba(255, 248, 225, .52);
}

.character-tut-hint-unlock {
    position: relative;
    display: grid;
    width: 76px;
    height: 55px;
    place-items: center;
}

.character-tut-bulb {
    display: grid;
    width: 39px;
    height: 39px;
    place-items: center;
    border: 1px solid rgba(255, 202, 40, .5);
    border-radius: 50%;
    color: #6f5a4f;
    background: #281b18;
    box-shadow: 0 3px 0 #1d1311;
    font: 900 1.05rem/1 'Roboto', sans-serif;
    animation: character-tut-bulb 4.8s ease-in-out infinite;
}

.character-tut-lock {
    position: absolute;
    top: 9px;
    right: 6px;
    display: grid;
    width: 23px;
    height: 23px;
    place-items: center;
    border-radius: 50%;
    color: #3e2723;
    background: #9e7c68;
    box-shadow: 0 2px 0 rgba(0, 0, 0, .35);
    transform-origin: 50% 80%;
    animation: character-tut-unlock 4.8s ease-in-out infinite;
}

.character-tut-lock svg {
    width: 13px;
    height: 13px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.character-tut-hint-unlock > i {
    position: absolute;
    bottom: 0;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    width: 48px;
    gap: 4px;
}

.character-tut-hint-unlock > i > u {
    height: 3px;
    border-radius: 999px;
    background: #5d4b44;
    text-decoration: none;
    animation: character-tut-hint-progress 4.8s ease-in-out infinite;
}

.character-tut-hint-unlock > i > u:nth-child(2) { animation-delay: .12s; }
.character-tut-hint-unlock > i > u:nth-child(3) { animation-delay: .24s; }

.character-tut-answer {
    position: relative;
    display: grid;
    width: min(205px, 74%);
    height: 46px;
    place-items: start center;
    overflow: hidden;
    border: 1px solid rgba(255, 179, 0, .5);
    border-radius: 6px;
    background: #281b18;
    box-shadow: 0 3px 0 #1d1311;
}

.character-tut-answer span,
.character-tut-answer b {
    position: absolute;
    top: 11px;
    font: 900 .65rem/1 'Roboto', sans-serif;
    letter-spacing: .12em;
}

.character-tut-answer span {
    color: #8d6e63;
    animation: character-tut-question 4.2s ease-in-out infinite;
}

.character-tut-answer b {
    color: #fff3c4;
    opacity: 0;
    animation: character-tut-answer 4.2s ease-in-out infinite;
}

.character-tut-answer > i {
    position: absolute;
    right: 6px;
    bottom: 5px;
    left: 6px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 3px;
    height: 7px;
}

.character-tut-answer > i > u {
    border-radius: 2px;
    background: #5d4b44;
    text-decoration: none;
    animation: character-tut-result-cell 4.2s ease-in-out infinite;
}

.character-tut-answer > i > u:nth-child(2) { animation-delay: .12s; }
.character-tut-answer > i > u:nth-child(3) { animation-delay: .24s; }
.character-tut-answer > i > u:nth-child(4) { animation-delay: .36s; }

#tutorialModal .tutorial-choose-text {
    margin: 13px 0 7px;
    color: #ffca28;
    font: 400 1.18rem/1 'Pirata One', cursive;
    text-shadow: 1px 2px 0 #1e1411;
}

#tutorialModal .tutorial-options {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-top: 0;
}

#tutorialModal .btn-tutorial-level {
    min-width: 0;
    padding: 12px;
    border: 2px solid #ffe082;
    border-radius: 7px;
    color: #3e2723;
    background: linear-gradient(180deg, #ffca28, #ffb300);
    box-shadow: 0 3px 0 #6d4300;
    font: 400 1.3rem 'Pirata One', cursive;
    letter-spacing: .035em;
    text-shadow: none;
}

#tutorialModal .btn-tutorial-level:hover,
#tutorialModal .btn-tutorial-level:focus-visible {
    border-color: #fff3c4;
    color: #3e2723;
    background: linear-gradient(180deg, #ffe082, #ffc107);
    box-shadow: 0 4px 0 #6d4300;
    outline: none;
    transform: translateY(-1px);
}

@keyframes character-tut-enter {
    from { opacity: 0; transform: translateY(12px) scale(.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes character-tut-type {
    0%, 14%, 100% { max-width: 0; }
    48%, 82% { max-width: 150px; }
}

@keyframes character-tut-cell {
    0%, 22%, 100% { border-color: rgba(255, 248, 225, .18); background: #4a3a35; transform: translateY(0); }
    42%, 76% { border-color: var(--cell-border); background: var(--cell-color); transform: translateY(-2px); }
}

@keyframes character-tut-bulb {
    0%, 35%, 100% { border-color: rgba(255, 202, 40, .35); color: #6f5a4f; box-shadow: 0 3px 0 #1d1311; }
    52%, 80% { border-color: #ffe082; color: #3e2723; background: #ffca28; box-shadow: 0 0 18px rgba(255, 193, 7, .42), 0 3px 0 #6d4300; }
}

@keyframes character-tut-unlock {
    0%, 34%, 100% { opacity: 1; transform: translate(0, 0) rotate(0); }
    48%, 78% { opacity: 0; transform: translate(5px, -7px) rotate(18deg); }
}

@keyframes character-tut-hint-progress {
    0%, 30%, 100% { background: #5d4b44; transform: scaleX(.4); }
    50%, 80% { background: #ffb300; transform: scaleX(1); }
}

@keyframes character-tut-question {
    0%, 40%, 100% { opacity: 1; transform: scale(1); }
    54%, 82% { opacity: 0; transform: scale(.65); }
}

@keyframes character-tut-answer {
    0%, 42%, 100% { opacity: 0; transform: translateY(5px); }
    56%, 82% { opacity: 1; transform: translateY(0); }
}

@keyframes character-tut-result-cell {
    0%, 38%, 100% { background: #5d4b44; transform: scaleX(.35); }
    56%, 82% { background: var(--state-correct); transform: scaleX(1); }
}

/* La sección permanente reutiliza el tutorial, con más aire que el modal. */
.character-howto {
    max-width: 950px;
    margin: 40px auto;
}

.character-howto .character-howto-lead {
    margin: -6px auto 20px;
    color: #d7ccc8;
    text-align: center;
}

.character-howto .character-tutorial-steps {
    gap: 16px;
    margin-bottom: 34px;
}

.character-howto .character-step-card {
    grid-template-rows: 92px min-content 1fr;
    gap: 9px;
    padding: 16px 15px 17px;
    border-color: rgba(255, 179, 0, .42);
    background: rgba(255, 248, 225, .055);
}

.character-howto .character-step-demo {
    height: 92px;
}

.character-howto .character-step-card h3 {
    margin: 0;
    padding: 0;
    border: 0;
    font-size: 1.3rem;
    line-height: 1.05;
}

.character-howto .character-step-card p {
    margin: 0;
    padding: 0 12px;
    color: #d7ccc8;
    font: 500 .88rem/1.4 'Roboto', sans-serif;
}

.character-howto .character-tut-search,
.character-howto .character-tut-compare,
.character-howto .character-tut-hint-unlock,
.character-howto .character-tut-answer {
    transform: scale(1.12);
}

.character-howto > h3:nth-of-type(2) {
    margin-top: 0;
}

@media (max-width: 600px) {
    #tutorialModal { padding: 7px; }
    #tutorialModal .character-tutorial-content { max-height: calc(100dvh - 14px); padding: 17px 11px 15px; }
    #tutorialModal .character-tutorial-heading h2 { margin-top: 5px; font-size: 1.65rem; }
    #tutorialModal .character-tutorial-heading p { margin: 0 18px 10px; font-size: .74rem; }
    .character-tutorial-steps { gap: 7px; }
    .character-step-card { grid-template-rows: 57px min-content 1fr; gap: 4px; padding: 8px 5px 9px; }
    .character-step-demo { height: 57px; }
    .character-step-card h3 { font-size: .91rem; }
    #tutorialModal .character-step-card p { padding: 0 2px; font-size: .64rem; line-height: 1.22; }
    .character-step-card::before { top: 5px; left: 5px; transform: scale(.84); }
    .character-tut-search,
    .character-tut-compare,
    .character-tut-answer { transform: scale(.82); }
    .character-tut-hint-unlock { transform: scale(.8); }
    #tutorialModal .tutorial-choose-text { margin: 9px 0 5px; font-size: 1rem; }
    #tutorialModal .btn-tutorial-level { padding: 8px 4px; font-size: .85rem; }

    .character-howto { margin: 30px 10px; padding: 20px 12px; }
    .character-howto .character-howto-lead { margin-bottom: 14px; font-size: .9rem; }
    .character-howto .character-tutorial-steps { gap: 8px; margin-bottom: 27px; }
    .character-howto .character-step-card { grid-template-rows: 62px min-content 1fr; gap: 5px; padding: 9px 6px 10px; }
    .character-howto .character-step-demo { height: 62px; }
    .character-howto .character-step-card h3 { font-size: .95rem; }
    .character-howto .character-step-card p { padding: 0 2px; font-size: .68rem; line-height: 1.25; }
    .character-howto .character-tut-search,
    .character-howto .character-tut-compare,
    .character-howto .character-tut-answer { transform: scale(.86); }
    .character-howto .character-tut-hint-unlock { transform: scale(.82); }
}

@media (max-height: 680px) {
    #tutorialModal .character-tutorial-content { padding-top: 11px; padding-bottom: 11px; }
    .character-tutorial-kicker { min-height: 22px; padding: 3px 10px; font-size: .58rem; }
    #tutorialModal .character-tutorial-heading h2 { margin: 3px 0; font-size: 1.45rem; }
    #tutorialModal .character-tutorial-heading p { display: none; }
    #tutorialModal .character-step-card { grid-template-rows: 47px min-content 1fr; padding-top: 5px; padding-bottom: 6px; }
    #tutorialModal .character-step-demo { height: 47px; }
    #tutorialModal .character-tut-hint-unlock { transform: scale(.76); }
    .character-tut-answer { transform: scale(.78); }
    #tutorialModal .character-step-card p { font-size: .59rem; }
    #tutorialModal .tutorial-choose-text { margin-top: 6px; }
    #tutorialModal .btn-tutorial-level { padding-block: 5px; }
}

html.tutorial-motion-reduce #tutorialModal .character-tutorial-content,
html.tutorial-motion-reduce .character-tut-search span,
html.tutorial-motion-reduce .character-tut-compare i,
html.tutorial-motion-reduce .character-tut-bulb,
html.tutorial-motion-reduce .character-tut-lock,
html.tutorial-motion-reduce .character-tut-hint-unlock > i > u,
html.tutorial-motion-reduce .character-tut-answer span,
html.tutorial-motion-reduce .character-tut-answer b,
html.tutorial-motion-reduce .character-tut-answer > i > u { animation: none !important; }
html.tutorial-motion-reduce .character-tut-search span { max-width: 150px; }
html.tutorial-motion-reduce .character-tut-compare i { border-color: var(--cell-border); background: var(--cell-color); }
html.tutorial-motion-reduce .character-tut-bulb { border-color: #ffe082; color: #3e2723; background: #ffca28; box-shadow: 0 0 18px rgba(255, 193, 7, .42), 0 3px 0 #6d4300; }
html.tutorial-motion-reduce .character-tut-lock { opacity: 0; }
html.tutorial-motion-reduce .character-tut-hint-unlock > i > u { background: #ffb300; transform: scaleX(1); }
html.tutorial-motion-reduce .character-tut-answer span { opacity: 0; }
html.tutorial-motion-reduce .character-tut-answer b { opacity: 1; }
html.tutorial-motion-reduce .character-tut-answer > i > u { background: var(--state-correct); transform: scaleX(1); }

