.chat { position: fixed; right: max(1rem, env(safe-area-inset-right)); bottom: max(1rem, env(safe-area-inset-bottom)); z-index: 4; }
.chat [hidden], .chat[hidden] { display: none; }
.chat button, .chat input { font: inherit; }
.chat button { cursor: pointer; }
.chat-launch { display: flex; align-items: center; gap: .7rem; padding: .76rem 1.15rem; border: 1px solid var(--line); border-radius: 2rem; color: #fff; background: var(--plum); box-shadow: 0 3px 14px #40263724; }
.chat-icon { width: 1.05rem; height: .83rem; border: 1.5px solid currentColor; border-radius: .3rem .3rem .3rem 0; }
.chat-panel { width: min(23rem, calc(100vw - 2rem)); max-height: min(34rem, calc(100dvh - 2rem)); display: flex; flex-direction: column; background: var(--paper); border: 1px solid var(--line); border-radius: .85rem; overflow: hidden; box-shadow: 0 12px 38px #40263730; }
.chat-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; background: var(--plum); color: white; padding: .95rem 1.1rem; }
.chat-head h2 { color: white; font: 1.8rem/1.1 var(--serif); }
.chat-head span { font-size: .84rem; color: #f3e4eb; }
.chat-close { background: transparent; border: 0; color: white; font-size: 1.7rem !important; width: 2.6rem; min-height: 2.6rem; }
.chat-log { flex: auto; min-height: 4rem; max-height: 16rem; overflow-y: auto; overscroll-behavior: contain; padding: 1rem 1rem .25rem; }
.chat-log p { border-radius: .8rem; padding: .65rem .8rem; margin: 0 0 .65rem; width: fit-content; max-width: 94%; overflow-wrap: anywhere; }
.chat-log .reply { background: var(--blush); }
.chat-log .question { background: var(--plum); color: white; margin-left: auto; }
.chat-prompts { display: flex; flex-wrap: wrap; gap: .35rem; padding: .4rem .9rem; }
.chat-prompts button { background: transparent; border: 1px solid #b6a5ae; border-radius: 1rem; color: var(--ink); padding: .25rem .65rem; font-size: .84rem; }
.chat-form { display: flex; gap: .45rem; padding: .45rem .9rem 0; }
.chat-form input { flex: 1; min-width: 0; border: 1px solid #a28b98; border-radius: .3rem; padding: .5rem; color: var(--ink); background: white; }
.chat-form button { padding: .4rem .8rem; border: 0; border-radius: .3rem; color: white; background: var(--plum); }
.chat-note { margin: .6rem .95rem .85rem; font-size: .81rem; color: var(--muted); }
.chat-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.footer-row { padding-bottom: 5rem; }
@media (max-height: 420px) {
  .chat-head { padding-block: .45rem; }
  .chat-note { margin-block: .3rem; }
}
@media (max-width: 740px), (max-width: 960px) and (max-height: 540px) {
  .chat { position: static; width: min(90%, 34rem); margin: 1.5rem auto 0; }
  .chat-panel { width: 100%; max-height: none; box-shadow: none; }
  .chat-launch { box-shadow: none; }
  .chat-panel:focus:not(:focus-visible) { outline: none; }
  .chat-head { padding: .6rem 1rem; }
  .chat-close, .chat-form button, .chat-prompts button { min-height: 2.75rem; }
  .chat-log { max-height: 12rem; }
  .chat-form input { font-size: 1rem; }
  .footer-row { padding-bottom: 2rem; }
}
