.demo-wrap {
    width: min(100%, 370px);
    min-width: 0;
    text-align: center;
}

.demo-guide {
    z-index: 8;
    padding: 15px 16px 16px;
    border: 1px solid #d9def0;
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 12px 32px rgba(26, 45, 103, .12);
    text-align: left;
}

.demo-guide-top {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    color: #6577e8;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .03em;
    text-transform: uppercase;
}

.demo-guide-top span:nth-child(2) {
    color: #8b93a6;
    font-weight: 600;
}

.demo-guide-progress {
    height: 5px;
    overflow: hidden;
    margin: 10px 0 12px;
    border-radius: 99px;
    background: #e9ecf7;
}

.demo-guide-progress span {
    display: block;
    width: 9.09%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #6577e8, #8c69e3);
    transition: width .25s ease;
}

.demo-guide h2 {
    margin: 0 0 5px;
    color: #18264b;
    font-size: 16px;
    line-height: 1.25;
}

.demo-guide p {
    margin: 0;
    color: #59677e;
    font-size: 12px;
    line-height: 1.45;
}

.demo-guide button {
    margin-top: 12px;
    padding: 8px 12px;
    border: 0;
    border-radius: 9px;
    background: #6577e8;
    color: #fff;
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.demo-guide button[hidden] {
    display: none;
}

#demo-guide-toggle {
    display: none;
}

#demo {
    scroll-margin-top: 90px;
}

.hero-row {
    overflow: clip;
}

.demo-heading {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    max-width: 100%;
    overflow: hidden;
    margin-bottom: 14px;
    padding: 10px 14px;
    border: 1px solid #bac5f6;
    border-radius: 20px;
    background: linear-gradient(115deg, #fff, #eef1ff);
    color: #364468;
    font: inherit;
    font-size: 13px;
    text-align: left;
    box-shadow: 0 6px 24px rgba(23, 32, 51, .06);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: border-color .3s ease, box-shadow .3s ease;
}

.demo-heading > span {
    position: relative;
    z-index: 1;
}

.demo-heading-copy {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 3px;
}

.demo-heading-copy strong {
    font-size: inherit;
    font-weight: 700;
}

.demo-heading-copy small {
    color: #667399;
    font-size: 11px;
    line-height: 1.3;
}

.demo-heading-arrow {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
    border-radius: 50%;
    background: #dde4ff;
    color: #5364ce;
    font-size: 17px;
}

.demo-heading::before {
    position: absolute;
    inset: 0 auto 0 0;
    width: 50%;
    background: linear-gradient(105deg, transparent, rgba(255, 255, 255, .9), transparent);
    opacity: 0;
    content: '';
    pointer-events: none;
}

.demo-wrap:not(.has-started) .demo-heading {
    animation: demo-heading-glow 3.6s ease-in-out infinite;
}

.demo-wrap:not(.has-started) .demo-heading::before {
    animation: demo-heading-sheen 6s ease-in-out infinite;
}

.demo-heading:hover {
    border-color: #8999e8;
}

.demo-heading:focus-visible {
    outline: 3px solid #6577e8;
    outline-offset: 4px;
}

@keyframes demo-heading-glow {
    0%, 100% { box-shadow: 0 6px 24px rgba(101, 119, 232, .1), 0 0 0 0 rgba(101, 119, 232, 0); }
    50% { box-shadow: 0 8px 30px rgba(101, 119, 232, .24), 0 0 0 6px rgba(101, 119, 232, .07); }
}

@keyframes demo-heading-sheen {
    0%, 60% { transform: translateX(-120%); opacity: 0; }
    68% { opacity: .8; }
    85%, 100% { transform: translateX(320%); opacity: 0; }
}

.demo-live-dot {
    width: 8px;
    height: 8px;
    flex: 0 0 8px;
    border-radius: 50%;
    background: #28ae87;
    box-shadow: 0 0 0 4px #e2f6ef;
}

.demo-phone {
    width: min(100%, 360px);
    height: 690px;
    margin: 0 auto;
    padding: 9px;
    border: 2px solid #28325d;
    border-radius: 43px;
    background: #202945;
    box-shadow: 0 28px 70px rgba(21, 35, 79, .25), inset 0 0 0 1px rgba(255,255,255,.18);
    transition: height .25s ease;
}

.demo-phone.is-ai-open {
    height: 805px;
}

.demo-screen {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    border-radius: 33px;
    background: #f8faff;
    color: #202331;
    text-align: left;
    font-family: 'Inter', Arial, sans-serif;
}

.demo-screen button,
.demo-screen input,
.demo-screen textarea {
    font: inherit;
}

.demo-screen button {
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.demo-screen button:disabled {
    cursor: default;
    opacity: .58;
}

.demo-screen .is-guide-target {
    position: relative;
    z-index: 2;
    opacity: 1;
    outline: 2px solid #f6a832;
    outline-offset: 2px;
    box-shadow: 0 0 0 5px rgba(246, 168, 50, .2);
    animation: demo-guide-pulse 1.5s ease-in-out infinite;
}

@keyframes demo-guide-pulse {
    50% { box-shadow: 0 0 0 8px rgba(246, 168, 50, .11); }
}

@media (prefers-reduced-motion: reduce) {
    .demo-wrap:not(.has-started) .demo-heading,
    .demo-wrap:not(.has-started) .demo-heading::before,
    .demo-screen .is-guide-target {
        animation: none;
    }

    .demo-heading {
        transition: none;
    }
}

.demo-screen [hidden] {
    display: none !important;
}

.demo-screen button:focus-visible,
.demo-screen input:focus-visible,
.demo-screen textarea:focus-visible {
    outline: 2px solid #5364ce;
    outline-offset: 1px;
}

.demo-status {
    display: flex;
    justify-content: space-between;
    flex: 0 0 26px;
    padding: 6px 25px 0;
    background: #fff;
    font-size: 11px;
    font-weight: 700;
}

.demo-status-icons {
    font-size: 10px;
    letter-spacing: 1px;
}

.demo-chat-header {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 57px;
    padding: 4px 14px;
    border-bottom: 1px solid #e8ebf2;
    background: #fff;
}

.demo-back {
    color: #6577e8;
    font-size: 32px;
    line-height: 1;
}

.demo-avatar {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    border-radius: 50%;
    background: linear-gradient(145deg, #c8d9ff, #e9dcff);
    color: #5060ab;
    font-size: 17px;
    font-weight: 700;
}

.demo-chat-person {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.demo-chat-person strong {
    font-size: 13px;
}

.demo-chat-person small {
    color: #25a782;
    font-size: 10px;
}

.demo-header-more {
    color: #7a8296;
    font-size: 21px;
}

.demo-chat {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 9px;
    min-height: 0;
    overflow-y: auto;
    padding: 13px 13px 17px;
    background: radial-gradient(circle at 8% 7%, #f6f1ff, transparent 46%), #f7f9ff;
    scrollbar-width: thin;
}

.demo-chat-date {
    align-self: center;
    margin: 2px 0 6px;
    padding: 4px 9px;
    border-radius: 8px;
    background: #e8ebf4;
    color: #757e92;
    font-size: 10px;
}

.demo-bubble {
    max-width: 84%;
    padding: 9px 11px;
    border-radius: 15px;
    font-size: 12px;
    line-height: 1.42;
    overflow-wrap: anywhere;
}

.demo-bubble.them {
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(30, 40, 70, .04);
}

.demo-bubble.me {
    align-self: flex-end;
    border-bottom-right-radius: 4px;
    background: #e0e5ff;
}

.demo-copy-bubble {
    border: 0;
    color: #202331;
    text-align: left;
}

.demo-copy-bubble:disabled {
    opacity: 1 !important;
    color: #202331;
}

.demo-copy-bubble::after {
    display: block;
    margin-top: 6px;
    color: #6577e8;
    content: '⧉  Скопировать';
    font-size: 10px;
    font-weight: 700;
}

.demo-copy-bubble.is-copied::after {
    color: #178c6e;
    content: '✓  Скопировано';
}

.demo-composer {
    display: flex;
    gap: 7px;
    align-items: center;
    flex: 0 0 54px;
    padding: 7px 10px;
    border-top: 1px solid #e8ebf2;
    background: #fff;
}

.demo-composer input {
    width: 0;
    height: 37px;
    flex: 1;
    padding: 0 12px;
    border: 1px solid #dfe3ef;
    border-radius: 20px;
    background: #f8f9fc;
    color: #202331;
    font-size: 12px;
}

.demo-composer button {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    border: 0;
    border-radius: 50%;
    background: #6577e8;
    color: #fff;
    font-size: 18px;
    line-height: 1;
}

.demo-keyboard {
    flex: 0 0 auto;
    padding: 6px 4px 2px;
    border-top: 1px solid #dfe3ef;
    background: #f3f5fa;
}

.demo-selectors {
    display: flex;
    gap: 7px;
    margin: 0 3px 7px;
}

.demo-selector {
    position: relative;
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    height: 46px;
    padding: 6px 23px 5px 9px;
    border: 1px solid #d6daea;
    border-radius: 12px;
    background: #fff;
    text-align: left;
}

.demo-selector small {
    color: #697184;
    font-size: 9px;
}

.demo-selector span {
    overflow: hidden;
    color: #202331;
    font-size: 11px;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.demo-selector b {
    position: absolute;
    top: 13px;
    right: 8px;
    color: #697184;
    font-size: 14px;
}

.demo-ai-panel {
    min-height: 150px;
    padding: 0 3px;
}

.demo-ai-main textarea {
    display: block;
    width: 100%;
    height: 138px;
    padding: 10px;
    resize: none;
    border: 1px solid #d6daea;
    border-radius: 11px;
    background: #fff;
    color: #202331;
    font-size: 12px;
    line-height: 1.45;
}

.demo-ai-main textarea:disabled {
    opacity: 1;
    -webkit-text-fill-color: #202331;
}

.demo-ai-main textarea::placeholder {
    color: #8a92a2;
}

.demo-ai-actions {
    display: flex;
    gap: 4px;
    align-items: center;
    margin-top: 7px;
}

.demo-ai-actions button {
    display: grid;
    place-items: center;
    height: 33px;
    border: 0;
    border-radius: 9px;
    background: #fff;
    color: #333a52;
    box-shadow: 0 1px 3px rgba(15, 20, 50, .11);
}

.demo-ai-actions .demo-generate {
    padding: 0 8px;
    background: #6577e8;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
}

.demo-small-action {
    width: 31px;
    flex: 0 0 31px;
    font-size: 17px !important;
}

.demo-tone-actions {
    display: flex;
    gap: 3px;
    margin-left: auto;
}

.demo-tone-actions button {
    width: 30px;
    font-size: 17px;
}

.demo-tone-actions button[aria-pressed="true"] {
    outline: 2px solid #6577e8;
    outline-offset: -2px;
    background: #e3e7ff;
}

.demo-picker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 27px;
    color: #202331;
    font-size: 12px;
}

.demo-picker-header button {
    width: 26px;
    border: 0;
    background: transparent;
    color: #697184;
    font-size: 22px;
}

.demo-picker-list {
    height: 105px;
    overflow-y: auto;
    border: 1px solid #d6daea;
    border-radius: 10px;
    background: #fff;
}

.demo-picker-list button {
    display: block;
    width: 100%;
    padding: 7px 10px;
    border: 0;
    border-bottom: 1px solid #edf0f5;
    background: #fff;
    color: #202331;
    text-align: left;
    font-size: 11px;
}

.demo-picker-list button[aria-selected="true"] {
    background: #e8ebff;
    color: #5364ce;
    font-weight: 700;
}

.demo-picker-empty {
    margin: 0;
    padding: 15px 10px;
    color: #798298;
    font-size: 11px;
    text-align: center;
}

.demo-picker-form {
    display: flex;
    gap: 7px;
    margin-top: 7px;
}

.demo-picker-form input {
    width: 0;
    height: 31px;
    flex: 1;
    padding: 0 9px;
    border: 1px solid #d6daea;
    border-radius: 9px;
    background: #fff;
    font-size: 11px;
}

.demo-picker-form button {
    width: 31px;
    border: 0;
    border-radius: 9px;
    background: #6577e8;
    color: #fff;
    font-size: 20px;
}

.demo-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 38px;
    padding: 2px 3px 5px;
}

.demo-ai-toggle {
    width: 38px;
    height: 32px;
    flex: 0 0 38px;
    border: 0;
    border-radius: 9px;
    background: #fff;
    color: #5668db;
    font-size: 15px !important;
    font-weight: 800 !important;
    box-shadow: 0 2px 3px rgba(15, 20, 50, .12);
}

.demo-ai-toggle[aria-expanded="true"] {
    background: #6577e8;
    color: #fff;
}

.demo-clipboard {
    flex: 1;
    min-width: 0;
    height: 31px;
    overflow: hidden;
    padding: 0 10px;
    border: 1px solid #d6daea;
    border-radius: 9px;
    background: #fff;
    color: #202331;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 11px !important;
}

.demo-keys {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding-bottom: 4px;
}

.demo-key-row {
    display: flex;
    gap: 3px;
    justify-content: center;
    height: 37px;
}

.demo-key {
    min-width: 0;
    flex: 1 1 0;
    border: 0;
    border-radius: 7px;
    background: #fff;
    color: #202331;
    box-shadow: 0 2px 0 #d4d9e4;
    font-size: 15px !important;
}

.demo-key:active {
    transform: translateY(1px);
    background: #e3e7f8;
    box-shadow: 0 1px 0 #d4d9e4;
}

.demo-key:disabled {
    opacity: .75 !important;
}

.demo-key.special {
    flex: 1.4 1 0;
    background: #e2e7f0;
    font-size: 12px !important;
}

.demo-key.space {
    flex: 4.8 1 0;
}

.demo-key.enter {
    background: #dce2ff;
    color: #5364ce;
}

.demo-home-indicator {
    display: grid;
    place-items: center;
    flex: 0 0 15px;
    background: #f3f5fa;
}

.demo-home-indicator span {
    width: 95px;
    height: 4px;
    border-radius: 999px;
    background: #25314a;
}

.demo-caption {
    margin-top: 13px;
    color: #697184;
    font-size: 12px;
    line-height: 1.4;
}

@media (min-width: 1100px) {
    .hero {
        grid-template-columns: minmax(0, 1fr) 600px;
        gap: 24px;
    }

    .demo-wrap {
        display: grid;
        grid-template-columns: 360px minmax(0, 1fr);
        grid-template-rows: auto auto auto;
        gap: 12px 14px;
        width: 600px;
        align-items: start;
    }

    .demo-heading {
        grid-column: 1;
        justify-self: center;
        margin: 0;
    }

    .demo-phone {
        grid-column: 1;
        grid-row: 2;
    }

    .demo-guide {
        position: sticky;
        top: 95px;
        grid-column: 2;
        grid-row: 2;
        align-self: start;
    }

    .demo-caption {
        grid-column: 1;
        margin: 0;
    }
}

@media (min-width: 901px) and (max-width: 1099px) {
    .demo-guide {
        position: sticky;
        top: 95px;
        margin-bottom: 12px;
    }
}

@media (max-width: 900px), (max-height: 600px) and (pointer: coarse) {
    .demo-heading {
        display: flex;
        width: max-content;
        margin: 0 auto 14px;
    }

    .demo-wrap.is-heading-fixed .demo-heading {
        position: fixed;
        z-index: 90;
        top: calc(var(--demo-navigation-height, 56px) + 12px);
        left: 50%;
        width: max-content;
        max-width: calc(100% - 32px);
        margin: 0;
        transform: translateX(-50%);
    }

    /* Reserve the same space after the heading returns to the normal page flow. */
    .demo-wrap.is-heading-fixed::before {
        display: block;
        height: calc(var(--demo-heading-height, 54px) + 14px);
        content: '';
    }

    .demo-wrap {
        --demo-viewport-height: 100vh;
        --demo-phone-height: calc(var(--demo-viewport-height) - 80px);
        position: relative;
        display: block;
        width: min(100%, 370px);
    }

    @supports (height: 100dvh) {
        .demo-wrap {
            --demo-viewport-height: 100dvh;
        }
    }

    .hero-row {
        padding: 0 16px 48px;
        overflow: clip;
    }

    .hero {
        grid-template-columns: minmax(0, 1fr);
        padding: 100px 0 40px;
        gap: 20px;
    }

    .hero-visual {
        width: 100%;
        min-width: 0;
        margin-top: 10px;
    }

    .demo-guide {
        position: absolute;
        top: var(--demo-guide-top, 100px);
        left: var(--demo-guide-left, 20px);
        width: var(--demo-guide-width, calc(100% - 40px));
        margin: 0;
        padding: 0;
        border-color: #f3c779;
        border-radius: 16px;
        box-shadow: 0 8px 28px rgba(26, 45, 103, .18);
    }

    .demo-guide-content {
        max-height: var(--demo-guide-max-height, 180px);
        overflow-y: hidden;
        padding: 10px 12px;
        border-radius: inherit;
        overscroll-behavior-y: auto;
    }

    .demo-guide.is-space-limited {
        display: none;
    }

    .demo-guide-top {
        align-items: center;
    }

    .demo-guide-top span:nth-child(2),
    .demo-guide.is-collapsed .demo-guide-content > :not(.demo-guide-top) {
        display: none;
    }

    #demo-guide-toggle {
        display: grid;
        place-items: center;
        width: 24px;
        height: 24px;
        margin: 0;
        padding: 0;
        background: #fff3da;
        color: #895c0d;
        font-size: 18px;
        line-height: 1;
    }

    .demo-guide::after {
        position: absolute;
        left: var(--demo-guide-arrow, 50%);
        width: 10px;
        height: 10px;
        background: #fff;
        content: '';
        transform: translateX(-50%) rotate(45deg);
    }

    .demo-guide[data-placement="above"]::after {
        bottom: -6px;
        border-right: 1px solid #f3c779;
        border-bottom: 1px solid #f3c779;
    }

    .demo-guide[data-placement="below"]::after {
        top: -6px;
        border-top: 1px solid #f3c779;
        border-left: 1px solid #f3c779;
    }

    .demo-guide-progress {
        margin: 7px 0;
    }

    .demo-phone,
    .demo-phone.is-ai-open {
        height: var(--demo-phone-height);
        transition: none;
        overflow-anchor: none;
    }

    /* Swipes scroll the page; the lesson can still reveal controls with scrollTop. */
    .demo-screen,
    .demo-chat,
    .demo-picker-list,
    .demo-screen textarea {
        overflow-y: hidden;
        overscroll-behavior-y: auto;
    }

    .demo-screen input,
    .demo-screen textarea {
        font-size: 16px;
    }

    .demo-chat-header {
        flex-basis: 46px;
    }

    .demo-chat {
        min-height: 64px;
    }

    .demo-phone:not(.is-ai-open) .demo-chat {
        min-height: 128px;
    }

    .demo-screen .demo-bubble {
        flex-shrink: 0;
        font-size: 12px;
    }

    .demo-ai-panel {
        min-height: 0;
    }

    .demo-ai-main textarea {
        height: clamp(80px, calc(var(--demo-phone-height) * .18), 138px);
    }

    .demo-picker-list {
        height: clamp(42px, calc(var(--demo-phone-height) - 600px), 105px);
    }

    .demo-picker-form input,
    .demo-picker-form button {
        height: 36px;
    }

    .demo-key-row {
        gap: 2px;
        height: clamp(22px, calc((var(--demo-phone-height) - 550px) / 4), 37px);
    }

    .demo-phone.is-editing .demo-keys,
    .demo-phone.is-compact:not(.is-name-entry) .demo-keys {
        display: none;
    }

    .demo-phone.is-compact.is-ai-open .demo-chat {
        min-height: 0;
        padding-block: 0;
    }
}
