@font-face {
    font-family: Chakra;
    src: url('./assets/fonts/11adc1e13b64939c0f34bd859a5305ebe5c2028d75b1c5bb7a025b91b1d2e08b-ChakraPetch-Regular.ttf')
}

@font-face {
    font-family: Chakra;
    src: url('./assets/fonts/31997978ffb90d04bd1ef65b7e06acae00e136dd5013dfed4deb864b16ee77d8-ChakraPetch-Bold.ttf');
    font-weight: 700
}

.instructions {
    box-sizing: border-box;
    width: min(660px, calc(100% - 32px));
    max-height: calc(100dvh - 32px);
    padding: 30px;
    border: 1px solid #d8c7ed;
    border-radius: 20px;
    background: #faf5ff;
    color: #251D4D;
    box-shadow: 0 24px 100px #251D4D66;
    font-family: Chakra, sans-serif;
    overflow: auto;
    overscroll-behavior: contain;
    text-align: center
}

.instructions::backdrop {
    background: #251D4Da6;
    backdrop-filter: blur(3px)
}

.instructions.complete-dialog {
    position: fixed;
    inset: 0;
    margin: auto;
    width: min(420px, calc(100% - 24px));
    height: auto;
    max-height: calc(100dvh - 24px) !important;
    overflow-y: scroll;
    overflow-x: hidden;
    scrollbar-gutter: stable;
    scrollbar-width: thin;
    scrollbar-color: #715b85 #eee2fa;
    text-align: center;
}
.complete-dialog::-webkit-scrollbar { width: 8px; }
.complete-dialog::-webkit-scrollbar-track { background: #eee2fa; border-radius: 8px; }
.complete-dialog::-webkit-scrollbar-thumb { background: #7542a1; border-radius: 8px; border: 2px solid #eee2fa; }
.complete-dialog::-webkit-scrollbar-thumb:hover { background: #251D4D; }
.complete-content { padding: clamp(18px, 4dvh, 36px) 24px; text-align: center; display: flex; flex-direction: column; align-items: center; }
.complete-count { display: inline-block; margin: 0 0 16px; padding: 10px 22px; border-radius: 999px; background: #eee2fa; font-size: 28px; font-weight: 700; color: #251D4D; }
.complete-message { margin: 12px 0 24px; line-height: 1.7; color: #715b85; font-size: 16px; }
.complete-character { display: block; width: min(100%, 300px); height: auto; max-height: 36dvh; object-fit: contain; margin: 12px auto 0; }
@media (orientation: landscape) {
    .complete-character { width: min(100%, 340px); max-height: 60dvh; }
}
.complete-continue { width: 100%; }
.complete-replay-wrap { position: relative; width: 100%; margin-top: 10px; }
.complete-replay-wrap .complete-replay { margin-top: 0; }
.complete-content { position: relative; z-index: 2; }
.complete-replay { display: block; width: 100%; margin-top: 10px; padding: 10px; border: 1px solid #d8c7ed; border-radius: 10px; background: transparent; color: #251D4D; font: 700 15px Chakra, sans-serif; cursor: pointer; }
.complete-replay:focus-visible { outline: 3px solid #b58bd9; outline-offset: 3px; }
.complete-socials { display: flex; align-items: center; justify-content: center; gap: 14px; }
.complete-contributors { width: 100%; margin: 0 0 24px; padding-top: 18px; border-top: 1px solid #d8c7ed; text-align: center; }
.complete-contributors h2 { margin: 0 0 14px; color: #251D4D; font-size: 18px; }
.complete-contributors ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.complete-contributors li { display: flex; flex-direction: column; gap: 3px; overflow-wrap: anywhere; }
.contributor-name { color: #251D4D; font-size: 15px; font-weight: 700; }
.contributor-name a { color: inherit; text-underline-offset: 3px; }
.contributor-role { color: #715b85; font-size: 13px; }
.complete-social-link { display: inline-flex; align-items: center; justify-content: center; width: 46px; height: 46px; border: 1px solid #d8c7ed; border-radius: 50%; background: #eee2fa; }
.complete-social-link img { display: block; width: 24px; height: 24px; object-fit: contain; }
.complete-social-link[href]:hover { background: #d8c7ed; }
.complete-social-link:focus-visible { outline: 3px solid #b58bd9; outline-offset: 3px; }
@media (max-height: 450px) { .complete-count { margin-bottom: 8px; font-size: 22px; padding: 6px 18px; } .complete-message { margin: 8px 0 14px; font-size: 14px; } }

.instructions-help {
    position: fixed;
    z-index: 10;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    touch-action: manipulation;
}
.instructions-help img { display: block; width: 100%; height: 100%; object-fit: contain; }
.instructions-help:focus-visible { outline: 3px solid #b58bd9; outline-offset: 3px; border-radius: 6px; }

/* The measured inner panel fits the full set of instructions to the viewport. */
.instructions {
    padding: 0 !important;
    max-width: none;
    max-height: none !important;
    overflow: hidden;
}

.instruction-content {
    padding: 22px;
    transform-origin: top left;
    touch-action: pan-x pan-y pinch-zoom;
}

.instruction-icon img {
    display: block;
    width: 54px;
    height: 54px;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    flex: none
}

.instructions * {
    box-sizing: border-box
}

.instructions .eyebrow {
    margin: 0;
    font-size: 10px;
    letter-spacing: 2px;
    color: #806b94
}

.instructions h1 {
    font-size: 28px;
    margin: 8px 0
}

.instructions .intro {
    font-size: 14px;
    color: #715b85;
    margin: 0 0 24px
}

.instruction-steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px
}

.instruction-step {
    padding: 16px 8px;
    border-radius: 12px;
    background: #eee2fa
}

.instruction-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 58px;
    font-size: 38px;
    color: #8050a6;
    letter-spacing: 4px
}

.instructions h2 {
    font-size: 16px;
    margin: 10px 0 6px
}

.instruction-step p {
    font-size: 13px;
    line-height: 1.6;
    margin: 0;
    color: #715b85
}

.instructions .rotate-note {
    margin: 20px 0 12px;
    font-size: 12px;
    color: #806b94
}

.instructions .start {
    font: 700 17px Chakra, sans-serif;
    display: block;
    width: 100%;
    padding: 14px 20px;
    border: 0;
    border-radius: 10px;
    background: #251D4D;
    color: #faf5ff;
    cursor: pointer
}

.instructions .start:hover {
    background: #251D4D;
    filter: brightness(1.15)
}

.instructions .start:disabled {
    opacity: .55;
    cursor: wait
}

.instructions .start:focus-visible {
    outline: 3px solid #b58bd9;
    outline-offset: 4px
}

.instructions .load-status {
    margin: 10px 0 0;
    min-height: 18px;
    font-size: 12px;
    color: #806b94
}

@media(max-width:520px) and (orientation:portrait) {
    .instructions {
        padding: 24px 20px
    }

    .instruction-steps {
        grid-template-columns: 1fr;
        gap: 8px
    }

    .instruction-step {
        display: grid;
        grid-template-columns: 55px 1fr;
        text-align: left;
        padding: 10px 12px;
        column-gap: 12px
    }

    .instruction-icon {
        grid-row: 1/3;
        align-self: center;
        font-size: 32px
    }

    .instructions h2 {
        margin: 0 0 4px
    }

    .instruction-step p br {
        display: none
    }

    .instructions .intro {
        margin-bottom: 16px
    }

    .instructions .rotate-note {
        color: #8050a6
    }
}

@media(max-height:480px) and (orientation:landscape) {
    .instructions {
        padding: 16px 24px;
        max-height: calc(100dvh - 16px)
    }

    .instructions h1 {
        font-size: 23px;
        margin: 4px 0
    }

    .instructions .intro {
        margin-bottom: 12px;
        font-size: 12px
    }

    .instruction-step {
        padding: 8px
    }

    .instruction-icon {
        height: 32px;
        font-size: 28px
    }

    .instructions h2 {
        font-size: 14px;
        margin: 6px 0
    }

    .instruction-step p {
        font-size: 11px
    }

    .instructions .rotate-note {
        margin: 10px 0 8px
    }

    .instructions .start {
        padding: 10px;
        font-size: 15px
    }

    .instructions .load-status {
        margin-top: 6px
    }
}

/* Compact grids keep text readable before the final height fit is applied. */
.instruction-steps { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.instruction-step { display: block; min-width: 0; padding: 12px 8px; text-align: center; }
.instruction-icon { height: 44px; }
.instruction-icon img { width: 44px; height: 44px; }
.instructions h1 { margin: 0 0 6px; font-size: 25px; }
.instructions .intro { margin-bottom: 16px; }
.instructions h2 { font-size: 15px; line-height: 1.4; margin: 8px 0 5px; }
.instruction-step p { font-size: 12px; line-height: 1.5; }
.instructions .rotate-note { margin: 12px 0 10px; }
.instructions .start { padding: 12px 20px; }
@media (max-width: 600px) {
    .instruction-content { padding: 16px; }
    .instruction-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .instruction-step { padding: 10px 8px; }
    .instruction-icon { height: 36px; }
    .instruction-icon img { width: 36px; height: 36px; }
    .instructions h2 { font-size: 14px; }
    .instruction-step p { font-size: 12px; }
    .instructions .intro { font-size: 13px; margin-bottom: 12px; }
}
@media (orientation: landscape) and (max-height: 500px) {
    .instruction-content { padding: 12px 18px; }
    .instructions h1 { font-size: 22px; }
    .instructions .intro { margin-bottom: 10px; }
    .instruction-step { padding: 8px; }
    .instruction-icon { height: 32px; }
    .instruction-icon img { width: 32px; height: 32px; }
    .instructions h2 { font-size: 14px; margin: 5px 0 4px; }
    .instruction-step p { font-size: 11px; }
    .instructions .rotate-note { margin: 8px 0; }
    .instructions .start { padding: 10px; }
}
