.app-demo {
    width: min(100%, 320px);
    margin: 2rem auto 3rem;
}
.app-demo figcaption {
    margin-bottom: .75rem;
    font-size: .85rem;
    font-weight: 600;
}
.app-demo .demo-player { position: relative; }
.app-demo video {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 9 / 16;
    object-fit: contain;
    border: 2px solid #18181b;
    border-radius: 1.25rem;
    background: #fffdf7;
    box-shadow: 4px 4px 0 #18181b;
}
.app-demo .demo-play {
    position: absolute;
    bottom: 1.25rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    min-height: 48px;
    padding: .7rem 1.15rem;
    border: 2px solid #18181b;
    border-radius: .85rem;
    background: #18181b;
    color: white;
    font: inherit;
    font-weight: 700;
    white-space: nowrap;
    box-shadow: 3px 3px 0 white;
    cursor: pointer;
}
.app-demo .demo-play[hidden], .app-demo .demo-error[hidden] { display: none; }
.app-demo .demo-play:focus-visible, .app-demo video:focus-visible { outline: 3px solid #2563eb; outline-offset: 4px; }
.app-demo .demo-error { font-size: .85rem; line-height: 1.5; }
.app-demo .demo-error a { text-decoration: underline; }

.coach-mascot { position: relative; }
.coach-mascot-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    pointer-events: none;
}
.coach-mascot-video.is-playing { opacity: 1; }

@media (min-width: 820px) {
    .desktop-demo-row {
        display: grid;
        grid-template-columns: minmax(0, 1fr) clamp(280px, 30vw, 360px);
        align-items: center;
        gap: clamp(2rem, 6vw, 6rem);
        margin-bottom: 4rem;
    }
    .desktop-demo-row > .desktop-demo-copy {
        min-width: 0;
        max-width: 48rem;
        margin: 0;
        text-align: left;
    }
    .desktop-demo-row > .app-demo {
        width: 100%;
        margin: 0;
        justify-self: end;
    }

    .compact-demo-row {
        /* Use the top sections' page width and the problem section's column gap. */
        max-width: 80rem;
        margin-inline: auto;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: center;
        gap: 2.5rem;
    }
    .compact-demo-row:last-child {
        margin-bottom: 0;
    }
    .compact-demo-row > .app-demo {
        /* Match the hero's max-w-sm cap while fitting narrower columns. */
        width: min(100%, 24rem);
    }
    .compact-demo-cards {
        display: grid;
        grid-auto-rows: 1fr;
        align-content: start;
        gap: 1rem;
        width: 100%;
        max-width: 36rem;
        min-width: 0;
    }
    .compact-demo-card {
        display: grid;
        grid-template-columns: 2.75rem minmax(0, 1fr);
        column-gap: 1rem;
        row-gap: .625rem;
        align-content: start;
        padding: 1.25rem;
        min-width: 0;
    }
    .compact-demo-icon {
        width: 2.75rem;
        height: 2.75rem;
        align-self: start;
    }
    .compact-demo-icon svg {
        width: 1.5rem;
        height: 1.5rem;
    }
    .planning-cards .compact-demo-icon {
        grid-row: 1 / span 2;
    }
    .planning-cards h3,
    .planning-cards p {
        grid-column: 2;
        margin: 0;
    }
    .planning-cards h3 {
        font-size: 1.25rem;
        line-height: 1.3;
    }
    .planning-cards p {
        font-size: .9375rem;
        line-height: 1.5;
    }
    .social-cards .compact-demo-card {
        align-content: center;
    }
    .social-cards h3 {
        align-self: center;
        font-size: 1.25rem;
        line-height: 1.3;
        margin: 0;
    }
    .social-cards p,
    .social-card-note {
        grid-column: 1 / -1;
        margin: 0;
    }
    .social-cards p {
        font-size: .9375rem;
        line-height: 1.5;
    }
    .social-card-note {
        padding: .625rem .75rem;
        font-size: .8125rem;
        line-height: 1.5;
    }
    .reset-cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .reset-cards .compact-demo-card {
        grid-template-columns: 2.25rem minmax(0, 1fr);
        column-gap: .75rem;
        padding: 1.25rem;
    }
    .reset-cards .compact-demo-icon {
        width: 2.25rem;
        height: 2.25rem;
    }
    .reset-cards h4 {
        align-self: center;
        font-size: 1rem;
        line-height: 1.3;
        margin: 0;
    }
    .reset-cards p {
        grid-column: 1 / -1;
        font-size: .875rem;
        line-height: 1.5;
        margin: 0;
    }
}

@media (min-width: 820px) and (max-width: 1023px) {
    .reset-cards {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (min-width: 1200px) {
    .planning-demo-row,
    .reset-demo-row {
        grid-template-columns: minmax(0, 1fr) 24rem;
    }
    .planning-cards {
        max-width: 46rem;
        justify-self: start;
        gap: 1.5rem;
    }
    .planning-cards .compact-demo-card {
        min-height: 12rem;
        grid-template-columns: 3.25rem minmax(0, 1fr);
        column-gap: 1.25rem;
        row-gap: .875rem;
        align-content: center;
        padding: 1.75rem;
    }
    .planning-cards .compact-demo-icon {
        width: 3.25rem;
        height: 3.25rem;
    }
    .planning-cards .compact-demo-icon svg {
        width: 1.75rem;
        height: 1.75rem;
    }
    .planning-cards h3 {
        font-size: 1.375rem;
    }
    .planning-cards p {
        font-size: 1rem;
    }
    .reset-cards {
        max-width: none;
        gap: 1.25rem;
    }
    .reset-cards .compact-demo-card {
        min-height: 12rem;
        grid-template-columns: 2.75rem minmax(0, 1fr);
        column-gap: 1rem;
        row-gap: .875rem;
        align-content: center;
        padding: 1.5rem;
    }
    .reset-cards .compact-demo-icon {
        width: 2.75rem;
        height: 2.75rem;
    }
    .reset-cards h4 {
        font-size: 1.125rem;
    }
    .reset-cards p {
        font-size: .9375rem;
    }
}
