/* Messages stay in the shared log; these scene-local bubbles expire visually. */
.thoc-bubbles { position: absolute; inset: 0; z-index: 7; pointer-events: none; overflow: hidden; }
.thoc-bubble-stack { position: absolute; display: flex; flex-direction: column; align-items: center; gap: 6px; width: min(160px, 40%); transform: translate(-50%, -100%); }
.thoc-bubble {
    flex: none; width: fit-content; max-width: 100%; padding: 7px 10px; border-radius: 12px;
    background: var(--tho-paper); color: var(--tho-ink); font-size: 12px; line-height: 1.5;
    overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden;
    box-shadow: 0 2px 7px #132c292b; animation: thoc-appear .18s ease-out;
}
.thoc-bubble.is-user { background: #e8efe5; }
.thoc-composer {
    position: absolute; z-index: 9; inset-inline: 12px;
    bottom: calc(12px + max(var(--thg-safe-area-bottom, env(safe-area-inset-bottom, 0px)), var(--thg-viewport-inset-bottom, 0px), var(--thoc-keyboard-inset, 0px)));
    max-height: calc(100% - max(76px, 24px + var(--thoc-visible-top, 0px)) - max(var(--thg-safe-area-bottom, env(safe-area-inset-bottom, 0px)), var(--thg-viewport-inset-bottom, 0px), var(--thoc-keyboard-inset, 0px))); overflow-y: auto; overscroll-behavior: contain;
    padding: 12px; border: 1px solid #c8c3ae; border-radius: 18px; color: var(--tho-ink); background: var(--tho-paper);
    font: 13px/1.5 var(--app-font-family, sans-serif); box-shadow: 0 5px 24px #142d2333; touch-action: pan-y; animation: thoc-appear .18s ease-out;
}
.thoc-heading { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.thoc-title { min-width: 0; flex: 1; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tho-root .thoc-composer button { min-height: 44px; border-radius: 10px; border: 0; background: transparent; color: var(--tho-ink); font: inherit; cursor: pointer; touch-action: manipulation; }
.thoc-history { flex: none; padding: 0 8px; text-decoration: underline; text-underline-offset: 3px; }
.thoc-close { flex: none; min-width: 44px; font-size: 22px !important; }
.thoc-form { display: flex; align-items: stretch; gap: 8px; }
.thoc-input { display: block; flex: 1; min-width: 0; width: 100%; min-height: 60px; max-height: 120px; margin: 0; padding: 9px 10px; border: 1px solid #b8b9a6; border-radius: 12px; background: #fff; color: var(--tho-ink); font: inherit; font-size: 16px; line-height: 1.45; resize: none; touch-action: auto; }
.thoc-input:focus-visible { outline: 3px solid var(--tho-focus); outline-offset: 2px; }
.tho-root .thoc-send { flex: none; padding: 0 14px; background: #566e59; color: #fff; font-weight: 600; }
.thoc-footer { display: flex; align-items: center; gap: 8px; min-height: 28px; margin-top: 6px; }
.thoc-status { flex: 1; min-width: 0; font-size: 12px; overflow-wrap: anywhere; }
.thoc-composer.has-error .thoc-status { color: #853d32; }
.tho-root .thoc-retry { padding: 0 8px; text-decoration: underline; }
.thoc-failed { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding-top: 6px; border-top: 1px solid #c8c3ae; }
.thoc-failed-text { flex: 1 1 100%; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thoc-failed button { text-decoration: underline; }
.tho-root .thoc-composer button:disabled, .thoc-input:disabled { opacity: .5; cursor: default; }
.tho-root .thoc-composer button:not(:disabled):active { transform: translateY(1px); }
.tho-root.thoc-input-open .thoa-toggle,
.tho-root.thoc-input-open .thm-tab { visibility: hidden; pointer-events: none; }
.thoc-composer.is-compact { padding: 8px 12px; }
.thoc-composer.is-compact .thoc-heading { margin-bottom: 2px; }
.thoc-composer.is-compact .thoc-input { min-height: 46px; height: 46px; }
.thoc-composer.is-compact .thoc-footer { min-height: 20px; margin-top: 2px; }
@media (hover: hover) { .tho-root .thoc-composer button:not(:disabled):hover { background: #e8efe5; } .tho-root .thoc-send:not(:disabled):hover { background: #405b45; } }
@media (max-width: 320px) { .thoc-composer { inset-inline: 8px; padding: 10px; } .thoc-heading { gap: 3px; } .thoc-history { padding-inline: 4px; font-size: 12px !important; } .thoc-close { min-width: 36px; } .tho-root .thoc-send { padding-inline: 10px; } }
@media (max-height: 430px) { .thoc-composer { inset-inline: max(12px, calc((100% - 500px) / 2)); padding: 8px 12px; } .thoc-heading { margin-bottom: 2px; } .thoc-input { min-height: 46px; height: 46px; } }
@keyframes thoc-appear { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) { .thoc-bubble, .thoc-composer { animation: none; } .tho-root .thoc-composer button:not(:disabled):active { transform: none; } }
