/* One PTE coaching surface for the Hub and saved results. */
html[data-pte-theme] #bottom-activity-bar.pte-petra-bar {
    position: fixed; inset: auto 0 0; width: 100%; height: min(55dvh, 420px); z-index: 9999;
    background: var(--pte-surface); color: var(--pte-text);
    border: 0; border-top: 1px solid var(--pte-sage-border); border-radius: 16px 16px 0 0; box-shadow: 0 -8px 28px rgba(0,0,0,.08);
    transform: none; box-sizing: border-box; overflow: hidden; transition: height .24s ease;
    font: 400 .875rem/1.7 var(--pte-font); --primary: var(--pte-sage); --primary-light: var(--pte-sage-soft);
}
html[data-pte-theme] #bottom-activity-bar[aria-hidden="false"] { display: flex !important; flex-direction: column; }
html[data-pte-theme] #bottom-activity-bar[aria-hidden="true"] { display: none !important; }
html[data-pte-theme] #bottom-activity-bar.collapsed { height: calc(52px + env(safe-area-inset-bottom)); transform: none; }
html[data-pte-theme] #bottom-activity-bar .bottom-activity-bar-header { position: relative; display: flex; flex: 0 0 52px; align-items: center; justify-content: space-between; height: 52px; padding: 0 12px; background: var(--pte-surface); border-bottom: 1px solid var(--pte-border); cursor: pointer; }
html[data-pte-theme] #bottom-activity-bar :is(.petra-header-title, .header-right) { display: flex; align-items: center; gap: 8px; }
html[data-pte-theme] #bottom-activity-bar .header-right { position: static; inset: auto; transform: none; }
html[data-pte-theme] #bottom-activity-bar .petra-header-title { color: var(--pte-text); font: inherit; font-weight: 500; background: transparent; border: 0; flex: 1; align-self: stretch; text-align: left; cursor: pointer; }
html[data-pte-theme] #bottom-activity-bar .petra-content-area { position: static; height: auto; flex: 1; min-height: 0; }
html[data-pte-theme] #bottom-activity-bar .petra-chat-container { height: 100%; min-height: 0; display: flex; flex-direction: column; }
html[data-pte-theme] #bottom-activity-bar .petra-messages { flex: 1; min-height: 0; overflow-y: auto; padding: 1rem; }
html[data-pte-theme] #bottom-activity-bar :is(.activity-bar-action-btn, .bottom-activity-bar-toggle) { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; padding: 0; border: 1px solid transparent; border-radius: var(--pte-radius-control); background: transparent; color: var(--pte-sage); cursor: pointer; }
html[data-pte-theme] #bottom-activity-bar :is(.activity-bar-action-btn, .bottom-activity-bar-toggle):hover { background: var(--pte-sage-soft); }
html[data-pte-theme] #bottom-activity-bar :is(button, a, textarea):focus-visible { outline: 2px solid var(--pte-focus-ring); outline-offset: -2px; }
html[data-pte-theme] #bottom-activity-bar .bottom-activity-bar-toggle { flex-shrink: 0; position: relative; background: var(--pte-sage-soft); }
html[data-pte-theme] #bottom-activity-bar :is(.expand-btn, .petra-collapsed-label) { display: none; }
html[data-pte-theme] #bottom-activity-bar .toggle-text-expand { display: flex; align-items: center; justify-content: center; }
html[data-pte-theme] #bottom-activity-bar .petra-toggle-chat-icon { display: block; }
html[data-pte-theme] #bottom-activity-bar .toggle-text-collapse { font-size: 0; }
html[data-pte-theme] #bottom-activity-bar.collapsed :is(.history-btn, .petra-content-area) { display: none; }
html[data-pte-theme] #bottom-activity-bar.collapsed .bottom-activity-bar-header { flex-basis: calc(52px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); }
html[data-pte-theme] #bottom-activity-bar.collapsed .header-right { margin: 0; }
html[data-pte-theme] #bottom-activity-bar.collapsed .toggle-text-collapse,
html[data-pte-theme] #bottom-activity-bar:not(.collapsed) .toggle-text-expand,
html[data-pte-theme] #bottom-activity-bar .hidden { display: none !important; }
html[data-pte-theme] #bottom-activity-bar .petra-message { display: flex; align-items: start; gap: .75rem; margin-bottom: 1rem; max-width: min(85%, 80ch); }
html[data-pte-theme] #bottom-activity-bar .petra-message.user { margin-left: auto; flex-direction: row-reverse; }
html[data-pte-theme] #bottom-activity-bar .petra-avatar { display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; flex-shrink: 0; border-radius: 50%; background: var(--pte-sage-soft); color: var(--pte-sage); }
html[data-pte-theme] #bottom-activity-bar .message-bubble { padding: .75rem 1rem; border-radius: var(--pte-radius-card); background: var(--pte-surface-soft); color: var(--pte-text); font-size: .875rem; line-height: 1.75; min-width: 0; overflow-wrap: anywhere; }
html[data-pte-theme] #bottom-activity-bar .petra-message.user .message-bubble { background: var(--pte-sage-soft); color: var(--pte-text); }
html[data-pte-theme] #bottom-activity-bar .petra-message.system .message-bubble { background: var(--pte-negative-bg); color: var(--pte-negative); }
html[data-pte-theme] #bottom-activity-bar .message-content :is(p, ul, ol) { margin: 0 0 .75rem; }
html[data-pte-theme] #bottom-activity-bar .message-content > :last-child { margin-bottom: 0; }
html[data-pte-theme] #bottom-activity-bar .message-content :is(ul, ol) { padding-left: 1.25rem; }
html[data-pte-theme] #bottom-activity-bar .message-content a { color: var(--pte-sage); text-decoration: underline; }
html[data-pte-theme] #bottom-activity-bar .petra-input-area { display: flex; align-items: end; gap: .75rem; border-top: 1px solid var(--pte-border); padding: .75rem 1rem calc(.75rem + env(safe-area-inset-bottom)); background: var(--pte-surface); }
html[data-pte-theme] #bottom-activity-bar #petra-chat-input { flex: 1; min-width: 0; height: 44px; max-height: 80px; resize: none; padding: .6rem .75rem; border: 1px solid var(--pte-border); border-radius: var(--pte-radius-control); font: inherit; }
html[data-pte-theme] #bottom-activity-bar .petra-send-btn { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; border: 0; border-radius: var(--pte-radius-control); background: var(--pte-primary-fill); color: var(--pte-on-primary); cursor: pointer; }
html[data-pte-theme] #bottom-activity-bar .petra-send-btn:disabled { background: var(--pte-surface-soft); color: var(--pte-text-muted); cursor: default; }
html[data-pte-theme] #bottom-activity-bar :is(.petra-empty-state, .petra-loading, .petra-error) { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .5rem; min-height: 100%; color: var(--pte-text-muted); text-align: center; }
html[data-pte-theme] #bottom-activity-bar .petra-error { color: var(--pte-negative); }
html[data-pte-theme] #bottom-activity-bar :is(.empty-hint, .usage-badge, .message-time) { font-size: .75rem; color: var(--pte-text-muted); opacity: 1; }
html[data-pte-theme] #bottom-activity-bar .petra-history-view { height: 100%; overflow-y: auto; background: var(--pte-surface); padding: 1rem; }
html[data-pte-theme] #bottom-activity-bar .petra-history-header { display: flex; align-items: center; justify-content: space-between; padding-bottom: 1rem; }
html[data-pte-theme] #bottom-activity-bar .petra-result-preview { display: flex; flex-direction: column; justify-content: center; gap: 12px; min-height: 100%; }
html[data-pte-theme] #bottom-activity-bar .petra-result-preview-kicker { color: var(--pte-sage); font-size: .7rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
html[data-pte-theme] #bottom-activity-bar .petra-result-preview .petra-message { margin-bottom: 0; }
html[data-pte-theme] #bottom-activity-bar .petra-result-chat-ready { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border: 1px solid var(--pte-sage-border); border-radius: var(--pte-radius-control); background: var(--pte-sage-soft); color: var(--pte-text); font-size: .8rem; }
html[data-pte-theme] #bottom-activity-bar .petra-result-chat-ready svg { flex-shrink: 0; }
html[data-pte-theme] #bottom-activity-bar .petra-result-preview-note { color: var(--pte-text-muted); font-size: .75rem; text-align: center; }
html[data-pte-theme] #bottom-activity-bar .history-back-btn { display: inline-flex; align-items: center; gap: .5rem; border: 0; background: transparent; color: var(--pte-sage); font: inherit; cursor: pointer; }
/* Keep results scrollable above the bottom chat without taking horizontal space. */
html[data-pte-theme] body:has(#bottom-activity-bar[aria-hidden="false"]) .pte-practice-overlay { height: calc(100dvh - var(--prepex-bottom-activity-bar-offset, 52px)); }
html[data-pte-theme] body:has(#bottom-activity-bar[aria-hidden="false"]) .pte-activity-shell { padding-bottom: calc(88px + var(--prepex-bottom-activity-bar-offset, 52px)); }
@media (max-width: 768px) {
    html[data-pte-theme] #bottom-activity-bar.pte-petra-bar:not(.collapsed) { height: min(70dvh, 600px); }
}
@media (prefers-reduced-motion: reduce) { html[data-pte-theme] #bottom-activity-bar { transition: none; } }
