html.advisor-open { overflow: hidden; overscroll-behavior: none; }
:is(#chat-dialog, #advisor-dialog) { overflow: hidden; }
:is(#chat-dialog, #advisor-dialog) > :not(.chat-messages) { flex-shrink: 0; }
:is(#chat-dialog, #advisor-dialog) .chat-messages { min-height: 0; min-width: 0; overscroll-behavior: contain; scroll-behavior: auto; }
[data-chat-heading]:focus { outline: none; }
.chat-icon { display: block; width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.specialist-icon .chat-icon { width: 27px; height: 27px; }
.advisor-avatar .chat-icon { width: 31px; height: 31px; }
:is(.advisor-header, .chat-header) > button { display: grid; place-items: center; min-width: 44px; min-height: 44px; }
#chat-send { display: grid; place-items: center; }
.advisor-button > .chat-icon { display: inline-block; width: 16px; height: 16px; vertical-align: middle; margin-left: 8px; }
.chat-launcher > .chat-icon { width: 20px; height: 20px; }

@media (max-width: 700px) {
  :is(#chat-dialog, #advisor-dialog) {
    position: fixed;
    inset: auto;
    top: var(--chat-top, 0px);
    left: var(--chat-left, 0px);
    width: var(--chat-width, 100vw);
    max-width: none;
    height: var(--chat-height, 100dvh);
    max-height: none;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: var(--paper);
    box-shadow: none;
  }
  :is(#chat-dialog, #advisor-dialog)::backdrop { background: var(--paper); backdrop-filter: none; }
  :is(.chat-header, .advisor-header) { padding: max(12px, env(safe-area-inset-top)) 14px 12px; gap: 10px; }
  .advisor-header > div:nth-child(2), .chat-header > div:nth-child(2) { min-width: 0; }
  .advisor-header h2 { font-size: 18px; }
  .advisor-avatar { width: 42px; height: 42px; }
  .chat-messages { padding: 20px 18px; }
  :is(#chat-dialog, #advisor-dialog) #chat-input { font-size: 16px; line-height: 1.5; min-height: 44px; max-height: 96px; width: 0; flex: 1 1 0; padding: 5px 0; }
  :is(#chat-dialog, #advisor-dialog) #chat-input:focus-visible { outline: none; }
  :is(#chat-dialog, #advisor-dialog) #chat-form:focus-within { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
  #chat-form { min-width: 0; gap: 10px; padding: 10px 12px; border-radius: 10px; }
  #chat-send { width: 44px; height: 44px; }
  .chat-profile { padding: 0 16px; }
  .chat-note { padding-bottom: max(10px, env(safe-area-inset-bottom)); font-size: 9px; }
  .advisor-bottom { padding: 0 12px; }
  #chat-dialog #chat-form { margin: 0 12px; }
}

.advisor-art > .chat-icon { width: 68px; height: 68px; }
.welcome-wave > .chat-icon { width: 64px; height: 64px; }
.story-icon > .chat-icon { width: 45px; height: 45px; }
.assessment-mark .chat-icon { width: 20px; height: 20px; }

.brand > svg { display: block; width: 34px; height: 34px; flex: 0 0 34px; stroke-linecap: round; }
.advisor-avatar { display: grid; place-items: center; padding: 0; }
.advisor-avatar > svg { margin: 0; }

/* Pointer interaction must not inherit a keyboard ring from an earlier field. */
html[data-input-mode="pointer"] :is(button, a, [role="button"]):focus { outline: none; }
html[data-input-mode="keyboard"] :is(button, a, [role="button"]):focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
:is(#chat-dialog, #advisor-dialog) #chat-input:focus-visible { outline: none; }
:is(#chat-dialog, #advisor-dialog) #chat-form:focus-within { border-color: var(--ink); }

/* Compact welcome: the question and starting points belong above the fold. */
#advisor-dialog .advisor-welcome { padding: 0; }
#advisor-dialog .welcome-wave { display: none; }
#advisor-dialog .advisor-welcome h3 { font-size: clamp(32px, 4.5vh, 43px); margin: 12px 0; }
#advisor-dialog .advisor-welcome > p:not(.eyebrow) { line-height: 1.55; }
#advisor-dialog .chat-suggestions { margin-top: 18px; gap: 7px; }
#advisor-dialog .chat-suggestions button { padding: 13px 15px; }
@media (max-height: 720px) {
  #advisor-dialog .advisor-header { padding-top: max(10px, env(safe-area-inset-top)); padding-bottom: 10px; }
  #advisor-dialog .chat-messages { padding-top: 16px; padding-bottom: 16px; }
  #advisor-dialog .advisor-welcome h3 { font-size: 30px; margin: 9px 0; }
  #advisor-dialog .chat-suggestions { margin-top: 12px; }
  #advisor-dialog .chat-suggestions button { padding: 10px 12px; }
}
