/* ==========================================================
   TypingTutor.Online
   Beginner Hand Placement + Inline Key Introduction v17.0.22
   File: css/lesson-transitions.css
========================================================== */

/* ==========================================================
   INLINE NEW-KEY INTRODUCTION
========================================================== */

/*
 * The introduction now lives inside the lesson card. It replaces the lesson
 * text and controls temporarily, while the real keyboard remains visible.
 */
.lesson-inline-intro {
    box-sizing: border-box;

    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 13px;

    width: 100%;
    min-height: 220px;
    padding: 16px 20px 17px;

    color: #25334a;
    background:
        linear-gradient(
            145deg,
            rgba(247, 251, 255, .98),
            rgba(238, 246, 255, .92)
        );

    border-top:
        1px solid
        var(--border-color, #dbe3ef);

    border-bottom:
        1px solid
        var(--border-color, #dbe3ef);
}

.lesson-inline-intro[hidden] {
    display: none !important;
}

.lesson-inline-intro-heading {
    display: flex;
    justify-content: center;
    text-align: center;
}

.lesson-intro-kicker {
    display: inline-flex;
    gap: 7px;
    align-items: center;

    margin-bottom: 5px;
    padding: 5px 9px;

    color: #2567d9;
    background: #e6f0ff;
    border-radius: 999px;

    font-size: .64rem;
    font-weight: 800;
    letter-spacing: .045em;
    text-transform: uppercase;
}

.lesson-inline-intro h3 {
    margin: 0;

    color: #142139;

    font-size:
        clamp(1.18rem, 1.8vw, 1.55rem);

    line-height: 1.2;
}

#lessonIntroMessage {
    max-width: 700px;
    margin: 5px auto 0;

    color: #607089;

    font-size: .84rem;
    line-height: 1.45;
}

.lesson-intro-keys {
    display: grid;
    grid-template-columns:
        repeat(
            auto-fit,
            minmax(190px, 1fr)
        );

    gap: 10px;
}

.lesson-intro-key-card {
    display: flex;
    gap: 11px;
    align-items: center;

    min-width: 0;
    padding: 11px 12px;

    background:
        rgba(255, 255, 255, .84);

    border:
        1px solid
        #d8e4f3;

    border-radius: 13px;

    box-shadow:
        0 6px 18px
        rgba(37, 74, 126, .06);
}

.lesson-intro-keycap {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;

    min-width: 52px;
    min-height: 48px;
    padding: 7px 10px;

    color: #ffffff;
    background:
        linear-gradient(
            145deg,
            #347df9,
            #1f62de
        );

    border:
        1px solid
        rgba(255, 255, 255, .48);

    border-radius: 11px;

    box-shadow:
        inset 0 1px 0
        rgba(255, 255, 255, .32),
        0 7px 16px
        rgba(38, 103, 222, .20);

    font-family:
        var(--font-mono, monospace);

    font-size: .88rem;
    font-weight: 800;
    text-align: center;
}

.lesson-intro-key-copy {
    display: grid;
    min-width: 0;
    gap: 2px;
}

.lesson-intro-key-copy strong {
    color: #1c2940;
    font-size: .78rem;
    line-height: 1.3;
}

.lesson-intro-key-copy span {
    color: #65748b;
    font-size: .7rem;
    line-height: 1.4;
}

.lesson-intro-review {
    display: flex;
    gap: 7px;
    align-items: flex-start;

    padding: 8px 11px;

    color: #53647c;
    background:
        rgba(255, 255, 255, .62);

    border:
        1px solid
        #dbe7f5;

    border-radius: 10px;

    font-size: .72rem;
    line-height: 1.45;
}

.lesson-intro-review strong {
    flex: 0 0 auto;
    color: #263750;
}

.lesson-intro-bottom {
    display: grid;
    grid-template-columns:
        minmax(0, 1fr)
        auto;
    gap: 14px;
    align-items: center;
}

.lesson-intro-reminders {
    display: flex;
    gap: 8px;
    min-width: 0;
    flex-wrap: wrap;
}

.lesson-intro-reminders span {
    display: inline-flex;
    gap: 6px;
    align-items: center;

    min-height: 34px;
    padding: 7px 9px;

    color: #586980;
    background:
        rgba(255, 255, 255, .78);

    border:
        1px solid
        #dce6f2;

    border-radius: 9px;

    font-size: .69rem;
    line-height: 1.35;
}

.lesson-intro-start {
    min-width: 150px;
    min-height: 42px;
    padding: 9px 18px;

    color: #ffffff;
    background:
        linear-gradient(
            145deg,
            #2e7cff,
            #1f63df
        );

    border: 0;
    border-radius: 11px;

    font-size: .83rem;
    font-weight: 800;

    cursor: pointer;

    box-shadow:
        0 9px 22px
        rgba(39, 105, 225, .22);
}

.lesson-intro-start:hover {
    transform: translateY(-1px);
}

.lesson-intro-start:focus-visible {
    outline:
        3px solid
        rgba(74, 139, 255, .34);

    outline-offset: 3px;
}

/*
 * Replace the practice content—not the entire page—while the introduction
 * is visible. The lesson card keeps almost the same overall height as the
 * normal three-line text viewport plus footer.
 */
body.lesson-inline-intro-open
#lessonText,
body.lesson-inline-intro-open
#mobileKeyboardButton,
body.lesson-inline-intro-open
#mobileTypingInput,
body.lesson-inline-intro-open
.typing-practice-card
.practice-footer {
    display: none !important;
}

/* The stage/time row remains visible and the lesson timer is paused by JS. */
body.lesson-inline-intro-open
.typing-practice-card {
    min-height: 0 !important;
}

/* Highlight introduced keys on the real keyboard below the lesson. */
#keyboardContainer
.key.lesson-intro-key-highlight {
    border-color:
        #4b91ff !important;

    box-shadow:
        inset 0 0 0 2px
        rgba(66, 132, 255, .42),
        0 0 0 4px
        rgba(66, 132, 255, .14)
        !important;
}

/* Review option inside Lesson Tips. */
.review-lesson-keys-button {
    width: 100%;
    min-height: 40px;
    margin-top: 12px;
    padding: 9px 12px;

    color: #245fbe;
    background: #edf5ff;

    border:
        1px solid
        #cfe0f6;

    border-radius: 11px;

    font-size: .78rem;
    font-weight: 800;

    cursor: pointer;
}

.review-lesson-keys-button:hover {
    background: #e2efff;
}

.review-lesson-keys-button[hidden] {
    display: none !important;
}

/* ==========================================================
   LESSON COMPLETION MODAL
========================================================== */

body.lesson-results-open {
    overflow: hidden;
}

.results-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 22px;

    background:
        rgba(8, 17, 33, .74);

    backdrop-filter:
        blur(8px);
    -webkit-backdrop-filter:
        blur(8px);
}

.results-modal.hidden {
    display: none !important;
}

.results-modal[aria-hidden="false"] {
    display: flex !important;
}

.results-card {
    max-height:
        min(
            850px,
            calc(100vh - 44px)
        );

    overflow-y: auto;
}

.next-lesson-preview {
    margin: 2px 0 22px;
    padding: 16px;

    color: #24334d;
    background:
        linear-gradient(
            145deg,
            #f3f8ff,
            #edf5ff
        );

    border:
        1px solid
        #d6e6fb;

    border-radius: 15px;

    text-align: left;
}

.next-lesson-preview-kicker {
    display: block;
    margin-bottom: 4px;

    color: #2670e8;

    font-size: .7rem;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.next-lesson-preview h3 {
    margin: 0;
    color: #15233b;
    font-size: 1.05rem;
}

.next-lesson-preview p {
    margin: 6px 0 0;
    color: #5b6d86;
    font-size: .84rem;
    line-height: 1.5;
}

.next-lesson-preview-keys {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 11px;
}

.next-key-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-height: 32px;
    padding: 6px 10px;

    color: #1f60c9;
    background: #ffffff;

    border:
        1px solid
        #cfe0f7;

    border-radius: 9px;

    font-family:
        var(--font-mono, monospace);

    font-size: .76rem;
    font-weight: 800;
}

.results-actions {
    position: sticky;
    bottom: -1px;
    z-index: 2;

    padding-top: 10px;

    background:
        linear-gradient(
            to bottom,
            rgba(255, 255, 255, 0),
            #ffffff 28%
        );
}

/* ==========================================================
   DARK / SYSTEM-DARK
========================================================== */

html[data-theme="dark"]
.lesson-inline-intro {
    color: #e8eef8;
    background:
        linear-gradient(
            145deg,
            #131f34,
            #101a2c
        );

    border-color: #2a3d57;
}

html[data-theme="dark"]
.lesson-inline-intro h3,
html[data-theme="dark"]
.lesson-intro-key-copy strong,
html[data-theme="dark"]
.lesson-intro-review strong {
    color: #f0f5ff;
}

html[data-theme="dark"]
#lessonIntroMessage,
html[data-theme="dark"]
.lesson-intro-key-copy span,
html[data-theme="dark"]
.lesson-intro-review,
html[data-theme="dark"]
.lesson-intro-reminders span {
    color: #b3c0d3;
}

html[data-theme="dark"]
.lesson-intro-kicker {
    color: #9cc0ff;
    background: #192d4c;
}

html[data-theme="dark"]
.lesson-intro-key-card,
html[data-theme="dark"]
.lesson-intro-reminders span {
    background: #17243a;
    border-color: #2e435f;
}

html[data-theme="dark"]
.lesson-intro-review {
    background: #15243a;
    border-color: #2d425e;
}

html[data-theme="dark"]
.review-lesson-keys-button {
    color: #b8d2ff;
    background: #172a47;
    border-color: #315177;
}

html[data-theme="dark"]
.next-lesson-preview {
    color: #dce8f8;
    background:
        linear-gradient(
            145deg,
            #14243b,
            #122036
        );

    border-color: #2e4564;
}

html[data-theme="dark"]
.next-lesson-preview h3 {
    color: #f0f5ff;
}

html[data-theme="dark"]
.next-lesson-preview p {
    color: #adbbcf;
}

html[data-theme="dark"]
.next-key-badge {
    color: #b7d1ff;
    background: #182941;
    border-color: #355276;
}

html[data-theme="dark"]
.results-actions {
    background:
        linear-gradient(
            to bottom,
            rgba(17, 26, 43, 0),
            #111a2b 28%
        );
}

@media (prefers-color-scheme: dark) {
    html[data-theme="system"]
    .lesson-inline-intro {
        color: #e8eef8;
        background:
            linear-gradient(
                145deg,
                #131f34,
                #101a2c
            );

        border-color: #2a3d57;
    }

    html[data-theme="system"]
    .lesson-inline-intro h3,
    html[data-theme="system"]
    .lesson-intro-key-copy strong,
    html[data-theme="system"]
    .lesson-intro-review strong {
        color: #f0f5ff;
    }

    html[data-theme="system"]
    #lessonIntroMessage,
    html[data-theme="system"]
    .lesson-intro-key-copy span,
    html[data-theme="system"]
    .lesson-intro-review,
    html[data-theme="system"]
    .lesson-intro-reminders span {
        color: #b3c0d3;
    }

    html[data-theme="system"]
    .lesson-intro-key-card,
    html[data-theme="system"]
    .lesson-intro-reminders span {
        background: #17243a;
        border-color: #2e435f;
    }
}

/* ==========================================================
   RESPONSIVE
========================================================== */

@media (max-width: 760px) {
    .lesson-inline-intro {
        min-height: 0;
        padding: 14px 12px 15px;
        gap: 11px;
    }

    .lesson-intro-keys {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .lesson-intro-key-card {
        padding: 10px;
    }

    .lesson-intro-keycap {
        min-width: 54px;
        min-height: 46px;
    }

    .lesson-intro-bottom {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .lesson-intro-reminders {
        display: grid;
        grid-template-columns: 1fr;
        gap: 7px;
    }

    .lesson-intro-start {
        width: 100%;
    }

    .results-modal {
        align-items: flex-end;
        padding: 10px;
    }

    .results-card {
        max-height:
            calc(100vh - 20px);
    }

    .results-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .result-button {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .lesson-intro-start:hover {
        transform: none;
    }
}


/* ==========================================================
   BEGINNER HAND PLACEMENT ONBOARDING v17.0.22
========================================================== */

.lesson-intro-heading-meta {
    display: flex;
    justify-content: center;
    gap: 8px;
    align-items: center;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.lesson-intro-heading-meta
.lesson-intro-kicker {
    margin-bottom: 0;
}

.lesson-intro-step {
    display: inline-flex;
    min-height: 25px;
    padding: 5px 9px;
    align-items: center;

    color: #607089;
    background:
        rgba(255, 255, 255, .72);

    border:
        1px solid
        #d7e3f1;

    border-radius: 999px;

    font-size: .63rem;
    font-weight: 800;
    letter-spacing: .035em;
    text-transform: uppercase;
}

.lesson-intro-step[hidden] {
    display: none !important;
}

.lesson-hand-placement {
    display: grid;
    gap: 12px;
}

.lesson-hand-placement[hidden] {
    display: none !important;
}

.home-row-keyboard-guide {
    display: grid;
    grid-template-columns:
        minmax(235px, 1fr)
        minmax(150px, .58fr)
        minmax(235px, 1fr);

    gap: 12px;
    align-items: stretch;
}

.home-row-hand,
.home-row-center-guide {
    min-width: 0;
    padding: 12px;

    background:
        rgba(255, 255, 255, .86);

    border:
        1px solid
        #d8e4f3;

    border-radius: 14px;

    box-shadow:
        0 6px 20px
        rgba(37, 74, 126, .06);
}

.home-row-hand-label {
    display: block;
    margin-bottom: 9px;

    color: #56667e;

    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .04em;
    text-align: center;
    text-transform: uppercase;
}

.home-row-finger-map {
    display: grid;
    grid-template-columns:
        repeat(4, minmax(0, 1fr));

    gap: 7px;
}

.home-row-finger-map > span {
    display: grid;
    min-width: 0;
    min-height: 68px;
    padding: 8px 4px;
    place-content: center;
    gap: 4px;

    color: #27364e;
    background: #f6f9fd;

    border:
        1px solid
        #dce6f3;

    border-radius: 10px;

    text-align: center;
}

.home-row-finger-map b {
    color: #1f66da;
    font-family:
        var(--font-mono, monospace);
    font-size: 1.12rem;
}

.home-row-finger-map small {
    color: #718097;
    font-size: .58rem;
    font-weight: 700;
}

.home-row-finger-map
.home-anchor {
    background: #eaf3ff;
    border-color: #90b8f5;
    box-shadow:
        inset 0 -3px 0
        rgba(47, 103, 246, .15);
}

.home-row-center-guide {
    display: grid;
    gap: 9px;
    align-content: center;
}

.home-row-bump-guide,
.home-row-space-guide {
    display: grid;
    min-height: 53px;
    padding: 9px;
    place-content: center;

    color: #5b6b82;
    background: #f6f9fd;

    border:
        1px solid
        #dce6f3;

    border-radius: 10px;

    font-size: .68rem;
    line-height: 1.4;
    text-align: center;
}

.home-row-bump-guide b,
.home-row-space-guide b {
    color: #1f63d2;
}

.home-row-space-guide small {
    margin-top: 2px;
    color: #7b899d;
    font-size: .58rem;
    font-weight: 700;
}

.hand-placement-rules {
    display: grid;
    grid-template-columns:
        repeat(3, minmax(0, 1fr));

    gap: 8px;
}

.hand-placement-rules span {
    display: flex;
    min-height: 38px;
    padding: 8px 10px;
    gap: 7px;
    align-items: center;

    color: #586980;
    background:
        rgba(255, 255, 255, .74);

    border:
        1px solid
        #dce6f2;

    border-radius: 10px;

    font-size: .69rem;
    line-height: 1.35;
}

.lesson-intro-actions {
    display: flex;
    justify-content: flex-end;
}

.lesson-intro-actions
.lesson-intro-start[hidden] {
    display: none !important;
}

/* The home row is highlighted as a complete resting position. */
#keyboardContainer
.key.hand-placement-key-highlight {
    background:
        rgba(66, 132, 255, .12) !important;

    border-color:
        rgba(89, 145, 238, .72) !important;

    box-shadow:
        inset 0 0 0 1px
        rgba(255, 255, 255, .22),
        0 0 0 3px
        rgba(66, 132, 255, .09)
        !important;
}

#keyboardContainer
.key.hand-placement-anchor-highlight {
    background:
        rgba(47, 103, 246, .22) !important;

    border-color:
        #5f9cf7 !important;

    box-shadow:
        inset 0 0 0 2px
        rgba(94, 157, 255, .34),
        0 0 0 4px
        rgba(47, 103, 246, .13)
        !important;
}

#keyboardContainer
.key.hand-placement-space-highlight {
    background:
        rgba(241, 177, 71, .16) !important;

    border-color:
        rgba(225, 157, 48, .74) !important;
}

.lesson-tip-review-actions {
    display: grid;
    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 9px;
    margin-top: 12px;
}

.lesson-tip-review-actions
.review-lesson-keys-button {
    margin-top: 0;
}

.review-hand-position-button {
    color: #276a52;
    background: #ecf8f2;
    border-color: #c7e7d8;
}

.review-hand-position-button:hover {
    background: #e0f3ea;
}

/* Dark theme */
html[data-theme="dark"]
.lesson-intro-step {
    color: #b8c5d8;
    background: #17243a;
    border-color: #31455f;
}

html[data-theme="dark"]
.home-row-hand,
html[data-theme="dark"]
.home-row-center-guide {
    background: #17243a;
    border-color: #30445f;
}

html[data-theme="dark"]
.home-row-hand-label,
html[data-theme="dark"]
.home-row-finger-map small,
html[data-theme="dark"]
.home-row-bump-guide,
html[data-theme="dark"]
.home-row-space-guide,
html[data-theme="dark"]
.hand-placement-rules span {
    color: #b5c2d5;
}

html[data-theme="dark"]
.home-row-finger-map > span,
html[data-theme="dark"]
.home-row-bump-guide,
html[data-theme="dark"]
.home-row-space-guide,
html[data-theme="dark"]
.hand-placement-rules span {
    background: #111d31;
    border-color: #30445f;
}

html[data-theme="dark"]
.home-row-finger-map
.home-anchor {
    background: #193156;
    border-color: #4778bc;
}

html[data-theme="dark"]
.review-hand-position-button {
    color: #b9ead5;
    background: #17362d;
    border-color: #2e624f;
}

@media (prefers-color-scheme: dark) {
    html[data-theme="system"]
    .lesson-intro-step {
        color: #b8c5d8;
        background: #17243a;
        border-color: #31455f;
    }

    html[data-theme="system"]
    .home-row-hand,
    html[data-theme="system"]
    .home-row-center-guide {
        background: #17243a;
        border-color: #30445f;
    }

    html[data-theme="system"]
    .home-row-finger-map > span,
    html[data-theme="system"]
    .home-row-bump-guide,
    html[data-theme="system"]
    .home-row-space-guide,
    html[data-theme="system"]
    .hand-placement-rules span {
        background: #111d31;
        border-color: #30445f;
    }
}

@media (max-width: 900px) {
    .home-row-keyboard-guide {
        grid-template-columns:
            minmax(0, 1fr)
            minmax(0, 1fr);
    }

    .home-row-center-guide {
        grid-column: 1 / -1;
        grid-row: 2;
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .home-row-keyboard-guide {
        grid-template-columns:
            minmax(0, 1fr);
    }

    .home-row-center-guide {
        grid-column: auto;
        grid-row: auto;
        grid-template-columns:
            minmax(0, 1fr);
    }

    .hand-placement-rules {
        grid-template-columns:
            minmax(0, 1fr);
    }

    .lesson-intro-actions {
        width: 100%;
    }

    .lesson-intro-actions
    .lesson-intro-start {
        width: 100%;
    }

    .lesson-tip-review-actions {
        grid-template-columns:
            minmax(0, 1fr);
    }
}


/* ==========================================================
   TIPS REVIEW CARD VISIBILITY FIX v17.0.33
========================================================== */

/*
 * Tips reviews pause the real lesson timer, but the ordinary pause notice is
 * irrelevant while the learner is already reading the review. Keep the
 * review card above any older pause layer and hide only the pause presentation.
 */
body.lesson-inline-intro-open
#lessonIntroPanel {
    position: relative;
    z-index: 1100;
}

body.lesson-inline-intro-open
.lesson-review-pause-suppressed-element,
body.lesson-inline-intro-open
.pause-overlay,
body.lesson-inline-intro-open
.paused-overlay,
body.lesson-inline-intro-open
.lesson-pause-overlay,
body.lesson-inline-intro-open
.lesson-paused-overlay,
body.lesson-inline-intro-open
.pause-message,
body.lesson-inline-intro-open
.paused-message,
body.lesson-inline-intro-open
.lesson-pause-message,
body.lesson-inline-intro-open
.lesson-paused-message,
body.lesson-inline-intro-open
[data-pause-overlay],
body.lesson-inline-intro-open
[data-paused-overlay] {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/*
 * LessonEngine stores its pause message on the complete practice card:
 *
 *   .typing-practice-card[data-pause-message]
 *
 * Never hide that element. Hide only the pseudo-elements that display the
 * attribute text, otherwise the review card, lesson header, and controls all
 * disappear together.
 */
body.lesson-inline-intro-open
.typing-practice-card[data-pause-message]::before,
body.lesson-inline-intro-open
.typing-practice-card[data-pause-message]::after,
body.lesson-inline-intro-open
.typing-practice-card.paused::before,
body.lesson-inline-intro-open
.typing-practice-card.paused::after,
body.lesson-inline-intro-open
.typing-practice-card.is-paused::before,
body.lesson-inline-intro-open
.typing-practice-card.is-paused::after,
body.lesson-inline-intro-open
.typing-practice-card[data-paused="true"]::before,
body.lesson-inline-intro-open
.typing-practice-card[data-paused="true"]::after {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    content: none !important;
    pointer-events: none !important;
}

/* Keep both review types visible and distinct while the timer is paused. */
body.lesson-inline-intro-open
.typing-practice-card[data-pause-message] {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

body.lesson-inline-intro-open
#lessonIntroPanel {
    display: block;
    visibility: visible;
    opacity: 1;
}
