/*
 * Storyfellow — unified full-page conversation shell (mobile).
 * Loads after WorkspaceLayout / TalkJourneyIntro so one contract wins
 * over legacy grid centering and narrow --st-measure stage cages.
 */

@media (max-width: 767px) {
    #screen-app.is-active > .app-layout.voice-stage:not(.is-writing-desk),
    #screen-story.is-active > .layout-story.voice-stage {
        max-width: 100%;
        width: 100%;
        align-self: stretch;
        --st-talk-measure: min(920px, calc(100% - 2 * var(--st-page-pad-x)));
    }

    #screen-app.is-active .voice-stage:not(.is-writing-desk),
    #screen-story.is-active .layout-story.voice-stage:not(.is-writing-desk) {
        justify-items: stretch;
        align-items: stretch;
    }

    .voice-stage:not(.is-writing-desk).is-talk-document-flow.is-talk-history,
    .voice-stage:not(.is-writing-desk).is-early-author-gathering.is-talk-history,
    .voice-stage:not(.is-writing-desk).is-continuous-response,
    .voice-stage:not(.is-writing-desk).is-talk-history:not(.is-early-author-gathering) {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        grid-template-rows: none;
        grid-template-columns: none;
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .voice-stage:not(.is-writing-desk) > .continuous-response-panel,
    .voice-stage:not(.is-writing-desk) > .app-talk-scroll,
    .voice-stage:not(.is-writing-desk) .app-talk-scroll-inner {
        width: 100%;
        max-width: 100%;
        margin-left: 0;
        margin-right: 0;
        box-sizing: border-box;
        padding-left: 0;
        padding-right: 0;
    }

    .voice-stage:not(.is-writing-desk) .continuous-response-panel {
        width: 100%;
        max-width: 100%;
        margin-left: 0;
        margin-right: 0;
        box-sizing: border-box;
        padding-left: var(--st-page-pad-x);
        padding-right: var(--st-page-pad-x);
    }

    .voice-stage:not(.is-writing-desk)
        .continuous-response-body.editorial-prose,
    .voice-stage:not(.is-writing-desk) .app-talk-history-turns {
        width: 100%;
        max-width: 100%;
        margin-left: 0;
        margin-right: 0;
        box-sizing: border-box;
        padding-left: var(--st-page-pad-x);
        padding-right: var(--st-page-pad-x);
    }

    #screen-story.is-active {
        padding-left: 0;
        padding-right: 0;
    }

    #screen-story.is-active > .layout,
    #screen-story.is-active > .layout-story.voice-stage,
    #screen-story.is-active > .layout.layout-story.voice-stage {
        width: 100%;
        max-width: 100%;
        align-self: stretch;
        margin-left: 0;
        margin-right: 0;
    }

    #screen-story.is-active .layout-story.voice-stage,
    #screen-story.is-active .voice-stage.layout-story {
        justify-items: stretch;
        align-items: stretch;
    }

    #screen-story.is-active .copy-story,
    #screen-story.is-active .talk-fresh-welcome,
    #screen-story.is-active .continuous-response-panel,
    #screen-story.is-active .btn-mic,
    #screen-story.is-active .voice-stage > .app-question {
        width: 100%;
        max-width: 100%;
        padding-left: var(--st-page-pad-x);
        padding-right: var(--st-page-pad-x);
        box-sizing: border-box;
    }

    #screen-app.is-active .voice-stage:not(.is-writing-desk) .app-talk-walk-control {
        width: 100%;
        max-width: 100%;
        margin-left: 0;
        margin-right: 0;
        padding-left: var(--st-page-pad-x);
        padding-right: var(--st-page-pad-x);
        box-sizing: border-box;
    }

  .voice-stage.is-continuous-response:not(.is-writing-desk)
        .continuous-response-body.editorial-prose,
    .app-talk-history-body.editorial-prose {
        text-align: left;
    }

    .voice-stage.is-continuous-response:not(.is-writing-desk)
        .continuous-response-title,
    .voice-stage.is-continuous-response:not(.is-writing-desk)
        .app-question.is-centered-opening {
        text-align: center;
    }

    #screen-app.is-active .continuous-response-eyebrow,
    .app-talk-history-speaker {
        color: var(--st-text-secondary, #666);
    }

    #screen-app.is-active > .brand-bar,
    #screen-story.is-active > .brand-bar {
        position: sticky;
        top: 0;
        z-index: 20;
        transition: transform 200ms ease;
        will-change: transform;
    }

    #screen-app.is-active > .brand-bar.is-retracted,
    #screen-story.is-active > .brand-bar.is-retracted {
        transform: translateY(calc(-100% - 2px));
    }

    #screen-app.is-active > .brand-bar.is-retracted.is-reveal,
    #screen-story.is-active > .brand-bar.is-retracted.is-reveal {
        transform: translateY(0);
    }
}

.editors-note-story-shape-panel-load-error {
    color: var(--st-danger, #8b2500);
    font-weight: 600;
}

/* Editorial Guide — Safari must not paint workspace controls as link blue */
.editors-note-guide-nav-back,
.editors-note-guide-nav-link,
.editors-note-guide-chapter-context button,
.project-home-layout.is-editorial-home .editorial-overview-editorial-panel summary,
.en-visual-category,
.en-visual-whole-book,
.editors-note-guide-whole-book {
    color: var(--st-ink, #111);
    -webkit-text-fill-color: var(--st-ink, #111);
}

.project-home-layout.is-editorial-home .en-visual-error {
    color: var(--st-danger, #8b2500);
    font-weight: 600;
}

.project-home-layout.is-editorial-home .en-visual-empty {
    color: var(--st-text-secondary, #555);
}

.editors-note-story-shape-panel-empty {
    color: var(--st-text-secondary, #555);
    font-size: 14px;
    line-height: 1.45;
}