/* Shared optional Advanced disclosure (first Talk + New Project step 3) */

.st-advanced-disclosure {
    margin: 12px 0 0;
    border: 0;
    width: 100%;
    text-align: left;
}

.st-advanced-disclosure-summary {
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: var(--st-ink, #111);
    list-style: none;
    padding: 8px 0;
    user-select: none;
}

.st-advanced-disclosure-summary::-webkit-details-marker {
    display: none;
}

.st-advanced-disclosure-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.st-advanced-disclosure-chevron {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-right: 1.5px solid currentColor;
    border-top: 1.5px solid currentColor;
    transform: rotate(45deg);
    opacity: 0.72;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.st-advanced-disclosure[open] .st-advanced-disclosure-chevron {
    transform: rotate(135deg);
}

.st-advanced-disclosure-body {
    padding-top: 4px;
}

.st-advanced-section-heading {
    margin: 0 0 8px;
    font-size: 15px;
    font-weight: 600;
    color: var(--st-ink, #111);
}

.st-author-work-heading {
    margin: 0 0 10px;
    font-size: 15px;
    font-weight: 600;
    text-align: left;
    color: var(--st-ink, #111);
}

.st-author-work-modes {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    text-align: left;
}

.st-author-work-modes--explainer {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
}

.st-author-work-modes--explainer .st-author-work-option--info {
    flex: 1 1 200px;
    max-width: 240px;
    pointer-events: none;
    cursor: default;
    user-select: none;
    border-color: var(--st-border, #e8e8e8);
    background: #fff;
}

.st-author-work-modes--explainer .st-author-work-option--info .st-author-work-copy {
    width: 100%;
}

.st-author-work-modes--control {
    flex-direction: column;
    gap: 10px;
}

.st-advanced-disclosure-body .projects-writing-style-section,
.st-advanced-disclosure-body .projects-series-section {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.st-advanced-add-material-btn {
    margin-top: 4px;
}

.st-advanced-options-stack > * + * {
    margin-top: var(--st-space-4, 24px);
}

/* Shared Add Material button → Writing Style heading (First Talk + New Project). */
.st-advanced-options-stack > .projects-writing-style-section {
    margin-top: 20px;
}

.st-advanced-writing-mode {
    margin-top: var(--st-space-4, 24px);
    margin-bottom: 0;
}

.st-advanced-mode-lead {
    margin: 0 0 10px;
}

.st-author-work-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid var(--st-rule, #e8e8e8);
    border-radius: 12px;
    cursor: pointer;
    background: #fff;
}

.st-author-work-option:has(input:checked) {
    border-color: #111;
    background: #fafafa;
}

.st-author-work-copy {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.st-author-work-title {
    font-size: 15px;
    font-weight: 600;
    color: #111;
}

.st-author-work-desc {
    font-size: 14px;
    line-height: 1.45;
    color: #555;
}

.st-advanced-add-material-row {
    margin-top: 0;
}

.st-advanced-add-material-copy {
    margin: 0 0 10px;
}

/* First-time Talk — intro in row 1; mic/status/composer use default voice-stage rows 2–4 */

/*
 * Match #screen-app: definite viewport height so grid row 1 is 1fr, not content-sized.
 * Without this, expanded Advanced grows the stage and pushes mic/composer off-screen.
 */
#screen-story.is-active {
    padding: var(--st-page-pad-y) var(--st-page-pad-x);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    box-sizing: border-box;
    overflow: hidden;
    animation: none;
    transform: none;
}

#screen-story.is-active > .brand-bar {
    flex: 0 0 auto;
}

#screen-story.is-active > .project-title-offer:not([hidden]) {
    flex: 0 0 auto;
}

#screen-story.is-active > .layout-story.voice-stage {
    flex: 1 1 0%;
    min-height: 0;
    width: 100%;
    max-width: var(--st-measure);
    align-self: center;
}

/* Use default voice-stage grid (flexible row 1 + fixed mic/status/composer). */
.voice-stage.is-talk-fresh-welcome {
    text-align: center;
    margin: 0 auto;
}

.voice-stage:not(.is-talk-fresh-welcome) > .talk-fresh-intro {
    display: none !important;
}

.voice-stage.is-talk-fresh-welcome > #story-copy[hidden],
.voice-stage.is-talk-fresh-welcome > .copy-story[hidden] {
    display: none !important;
}

.voice-stage.is-talk-fresh-welcome > .talk-fresh-intro {
    grid-row: 1;
    grid-column: 1;
    align-self: stretch;
    justify-self: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    width: min(680px, 100%);
    height: 100%;
    min-height: 0;
    max-height: 100%;
    margin: 0;
    padding: var(--st-space-4, 24px) 0 var(--st-space-2, 12px);
    overflow-x: hidden;
    overflow-y: auto;
    position: relative;
    z-index: 2;
    text-align: center;
    box-sizing: border-box;
}

.voice-stage.is-talk-fresh-welcome > .talk-fresh-intro[hidden] {
    display: none !important;
}

.talk-fresh-intro > .talk-fresh-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: min(680px, 100%);
    flex: 0 0 auto;
    margin: 0;
    padding: 0;
}

.talk-fresh-intro > .talk-welcome-advanced {
    flex: 0 0 auto;
    width: 100%;
    max-width: none;
    margin: var(--st-space-4, 24px) 0 0;
    box-sizing: border-box;
}

.voice-stage.is-talk-fresh-welcome
    #talk-welcome-advanced[open]
    .st-advanced-disclosure-body {
    max-height: min(38vh, 304px);
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.voice-stage.is-talk-fresh-welcome .talk-welcome-heading {
    margin: 0 0 12px;
    font-size: clamp(26px, 4vw, 32px);
    font-weight: 400;
    letter-spacing: -0.03em;
    line-height: 1.2;
    color: var(--st-ink, #111);
}

.voice-stage.is-talk-fresh-welcome .talk-welcome-lead,
.voice-stage.is-talk-fresh-welcome .talk-welcome-body {
    margin: 0 0 10px;
    font-size: var(--st-size-meta, 15px);
    line-height: 1.6;
    color: var(--st-text-secondary, #666);
}

.voice-stage.is-talk-fresh-welcome .talk-welcome-invitation {
    margin: 12px 0 0;
    font-size: var(--st-size-meta, 15px);
    font-weight: 400;
    line-height: 1.6;
    color: var(--st-text-secondary, #666);
}

.voice-stage.is-talk-fresh-welcome > .voice-recorder-anchor {
    margin-top: 0;
}

.voice-stage.is-talk-fresh-welcome > #story-say,
.voice-stage.is-talk-fresh-welcome > .app-say {
    width: 100%;
    max-width: var(--st-measure-reader, 860px);
}

.voice-stage.is-talk-fresh-welcome .app-say-label {
    display: none;
}

.voice-stage.is-talk-fresh-welcome .voice-recorder-anchor .btn-mic {
    box-shadow: none;
}

.voice-stage.is-talk-fresh-welcome #msg-thankyou {
    font-size: var(--st-size-caption, 13px);
    color: var(--st-muted, #888);
}

@media (min-width: 768px) {
    #screen-story.is-active
        .voice-stage.is-talk-fresh-welcome
        #msg-thankyou {
        margin-bottom: 8px;
    }
}

@media (max-width: 767px) {
    .voice-stage.is-talk-fresh-welcome {
        max-width: var(--st-measure-narrow, 520px);
    }
}

/* Desktop: Advanced body matches New Project Step 3 canvas (WorkspaceLayout: Talk grid). */
@media (min-width: 768px) {
    .voice-stage.is-talk-fresh-welcome > .talk-fresh-intro {
        width: 100%;
        max-width: var(--st-desktop-workspace);
        margin-left: auto;
        margin-right: auto;
        align-items: stretch;
        box-sizing: border-box;
        padding-left: max(
            var(--st-page-pad-x, 24px),
            calc((100% - var(--st-desktop-canvas)) / 2)
        );
        padding-right: max(
            var(--st-page-pad-x, 24px),
            calc((100% - var(--st-desktop-canvas)) / 2)
        );
    }

    .talk-fresh-intro > .talk-fresh-welcome {
        align-self: center;
        width: min(100%, var(--st-desktop-canvas));
    }

    #screen-story.is-active
        .voice-stage.is-talk-fresh-welcome
        #talk-welcome-advanced.talk-welcome-advanced {
        align-self: stretch;
        width: 100%;
        max-width: none;
        margin-left: 0;
        margin-right: 0;
    }

    #screen-story.is-active
        .voice-stage.is-talk-fresh-welcome
        #talk-welcome-advanced
        .st-advanced-disclosure-body,
    #screen-story.is-active
        .voice-stage.is-talk-fresh-welcome
        #talk-welcome-advanced
        .st-advanced-options-stack {
        width: 100%;
        max-width: none;
        box-sizing: border-box;
    }
}