/* Keep the next question beside the answer, before optional research material. */
.is-processing::before {
    content: "";
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-inline-end: 8px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    vertical-align: -3px;
    animation: answer-processing-spin .9s linear infinite;
}
@keyframes answer-processing-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
    .is-processing::before { animation: none; border-style: dotted; }
}
#homeAiAnswerProgress {
    margin: 8px 0 0;
    color: #255d91;
    font-size: 14px;
    line-height: 1.5;
}
#homeAiAnswerProgress[hidden] { display: none; }
#homeAiAnswerDialog .home-ai-answer-figure { margin: 0; }
#homeAiAnswerDialog .home-ai-answer-figure img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 260px;
    object-fit: contain;
    background: #071021;
    border-radius: 12px;
}
#homeAiAnswerDialog .home-ai-answer-figure figcaption {
    margin-top: 6px;
    color: #51657b;
    font-size: 12px;
    line-height: 1.6;
}
#homeAiAnswerDialog .home-ai-answer-share {
    margin-bottom: 12px;
    padding: 12px 16px;
    border: 1px solid #d4dfec;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.7;
}
#homeAiAnswerShare summary { cursor: pointer; min-height: 32px; }
#homeAiAnswerShare .secondary-btn { min-height: 44px; white-space: normal; font-size: 14px; }
#homeAiAnswerShare [hidden] { display: none; }
#homeAiAnswerShareStatus, #homeAiAnswerPostStatus { color: #255d91; }
#homeAiAnswerShareStatus.is-error { padding: 12px; border: 1px solid #e7b891; border-radius: 8px; color: #833f13; background: #fff6ed; }
#homeAiAnswerShare .home-ai-share-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
#homeAiAnswerShare .home-ai-share-actions:has(> [hidden]:first-child + [hidden]:last-child) { display: none; }
#homeAiAnswerShareStatus:empty, #homeAiAnswerPostStatus:empty { display: none; }
#homeAiAnswerPublicExcerpt { white-space: pre-wrap; overflow-wrap: anywhere; }
#homeAiAnswerPostImage { width: 100%; height: auto; max-height: 220px; object-fit: contain; border-radius: 8px; background: #08101e; }
#homeAiAnswerShare :is(textarea, select) { box-sizing: border-box; width: 100%; max-width: 100%; resize: vertical; margin: 8px 0; padding: 12px; font: inherit; font-size: 16px; line-height: 1.6; color: #20344c; background: #f4f7fb; border: 1px solid #c5d3e3; border-radius: 8px; overflow-wrap: anywhere; }
#homeAiAnswerShare label { display: block; margin-top: 12px; font-size: 14px; }
#homeAiAnswerShare textarea[readonly] { resize: none; overflow-y: hidden; }
#homeAiAnswerShare :is([hidden]) { display: none !important; }
#homeAiAnswerShare .home-ai-share-consent { display: flex; align-items: flex-start; gap: 10px; margin: 12px 0; padding: 12px; min-height: 44px; box-sizing: border-box; border: 1px solid #c5d3e3; border-radius: 8px; cursor: pointer; }
#homeAiAnswerShareConsent { flex: 0 0 20px; width: 20px; height: 20px; margin-top: 3px; }
#homeAiAnswerShare .primary-btn { min-height: 44px; width: 100%; white-space: normal; }
#homeAiAnswerShare .home-ai-share-note { font-size: 12px; color: #51657b; }

#homeAiAnswerDialog .home-ai-answer-dialog-shell,
#homeAiAnswerDialog .home-ai-answer-dialog-inner {
    box-sizing: border-box;
    min-width: 0;
    max-width: 100%;
    grid-template-columns: minmax(0, 1fr);
}

#homeAiAnswerDialog .home-ai-answer-dialog-inner > *,
#homeAiAnswerDialog .home-ai-answer-dialog-content {
    min-width: 0;
    max-width: 100%;
}

#homeAiAnswerDialog .home-ai-answer-dialog-answer,
#homeAiAnswerDialog .home-ai-answer-dialog-question {
    grid-template-columns: minmax(0, 1fr);
    overflow-wrap: anywhere;
}

#homeAiAnswerDialog .home-ai-followup-composer {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    margin: 2px 0 12px;
    padding: 16px;
    min-width: 0;
    border: 1px solid #d4dfec;
    border-radius: 16px;
    background: #f1f5fb;
    color: #25364c;
}

#homeAiAnswerDialog .home-ai-followup-composer label {
    font-size: 14px;
    font-weight: 500;
    line-height: 1.6;
}

#homeAiFollowupQuestion {
    box-sizing: border-box;
    display: block;
    width: 100%;
    min-width: 0;
    min-height: 96px;
    max-height: 180px;
    padding: 12px;
    border: 1px solid #b8c9dc;
    border-radius: 10px;
    background: #fff;
    color: #17283c;
    font: inherit;
    font-size: 16px;
    line-height: 1.6;
    resize: vertical;
    scroll-margin-block: 16px;
}

#homeAiFollowupQuestion:focus-visible {
    outline: 2px solid #376eaf;
    outline-offset: 2px;
}

#homeAiAnswerDialog .home-ai-followup-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
}

#homeAiFollowupStatus {
    flex: 1;
    margin: 0;
    color: #485c74;
    font-size: 13px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

#homeAiFollowupForm .primary-btn {
    flex: none;
    width: auto;
    min-width: 76px;
    min-height: 44px;
    padding: 10px 18px;
    font-size: 15px;
}

body.home-event-page.research-look-page #homeAiAnswerDialog .home-ai-answer-dialog-footer {
    display: flex;
    justify-content: flex-end;
    align-items: flex-end;
    flex-wrap: wrap;
}

#homeAiAnswerShareFinalAction {
    flex: 1 1 320px;
    min-width: 0;
    max-width: 580px;
}
#homeAiAnswerShareFinalAction[hidden] { display: none; }
#homeAiAnswerShareSubmitHint {
    margin: 0 0 8px;
    color: #334b68;
    font-size: 14px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}
body.home-event-page.research-look-page :is(#homeAiAnswerOfficialPost, #homeAiAnswerCancelPost) {
    width: 100%;
    min-height: 48px;
    padding: 12px 18px;
    font-size: 16px;
    line-height: 1.5;
    white-space: normal;
}
#homeAiAnswerOfficialPost[hidden], #homeAiAnswerCancelPost[hidden] { display: none; }
body.home-event-page.research-look-page #homeAiAnswerCancelPost {
    color: #922d35;
    border-color: #c5858a;
    background: #fff8f8;
}
#homeAiAnswerCancelPost:disabled { opacity: .65; cursor: wait; }
body.home-event-page.research-look-page #homeDiscoveryFeed .home-discovery-delete {
    min-height: 44px;
    margin-top: 0;
    padding: 8px 12px;
    border: 1px solid #c5858a;
    border-radius: 8px;
    color: #922d35;
    background: #fff8f8;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.5;
}
#homeAiAnswerOfficialPost:disabled {
    color: #415571;
    background: #e2eaf4;
    border-color: #c2cfdf;
    opacity: 1;
    cursor: not-allowed;
    box-shadow: none;
}

@media (max-width: 700px) {
    #homeAiAnswerDialog .home-ai-followup-composer { padding: 12px; }
    #homeAiAnswerDialog .home-ai-answer-dialog-header { padding-block: 10px; }
    #homeAiAnswerDialog .home-ai-answer-dialog-header h2 { font-size: 18px; }
    #homeAiAnswerDialog .home-ai-answer-dialog-footer {
        padding-top: 8px;
        padding-bottom: max(8px, env(safe-area-inset-bottom));
    }
}
