/* Added component (proposed only): guide assistant corner launcher + panel.
   Tokens come from the live guide CSS (--color-brand, --color-border, …).
   Panel geometry mirrors the private guide-assistant preview (guides-communication):
   bottom sheet on phones, 420px card bottom-right from 1024px. */

.pmga-launch { position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 40; }
.pmga-launch__btn {
  display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 16px 0 14px;
  border: 1px solid var(--color-border, #e5e7eb); border-radius: 999px; background: #fff; color: var(--color-primary, #1a1a1a);
  font: 600 15px/1 var(--font-sans, system-ui, sans-serif); cursor: pointer;
  box-shadow: 0 8px 30px rgb(17 24 39 / 0.14);
}
.pmga-launch__btn:hover { box-shadow: 0 10px 36px rgb(17 24 39 / 0.2); }
.pmga-launch__btn:focus-visible { outline: 2px solid var(--color-brand, #372568); outline-offset: 2px; }
.pmga-launch__btn svg { width: 20px; height: 20px; fill: none; stroke: var(--color-brand, #372568); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.pmga {
  position: fixed; inset: auto 0 0 0; width: 100%; max-width: none; height: min(90dvh, 760px); max-height: none;
  margin: 0; padding: 0; border: 0; border-radius: 20px 20px 0 0; background: #fff; color: var(--color-primary, #1a1a1a);
  box-shadow: 0 -8px 40px rgb(17 24 39 / 0.18); flex-direction: column; font-family: var(--font-sans, system-ui, sans-serif);
}
.pmga[open] { display: flex; }
.pmga::backdrop { background: rgb(17 24 39 / 0.32); }
@media (min-width: 1024px) {
  .pmga { inset: auto 24px 24px auto; width: 420px; height: min(640px, calc(100dvh - 48px)); border: 1px solid var(--color-border, #e5e7eb); border-radius: 20px; box-shadow: 0 16px 48px rgb(17 24 39 / 0.16); }
}
@media (prefers-reduced-motion: no-preference) {
  .pmga[open] { animation: pmga-rise 220ms cubic-bezier(0.2, 0.8, 0.2, 1); }
  .pmga-fade { animation: pmga-fade 240ms ease-out both; }
  .pmga-dots span { animation: pmga-blink 1s infinite ease-in-out; }
  .pmga-dots span:nth-child(2) { animation-delay: 0.15s; }
  .pmga-dots span:nth-child(3) { animation-delay: 0.3s; }
}
@keyframes pmga-rise { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes pmga-fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes pmga-blink { 50% { opacity: 0.15; } }

.pmga__head { display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 16px; border-bottom: 1px solid var(--color-border, #e5e7eb); }
.pmga__titles { min-width: 0; flex: 1; }
.pmga__titles h2 { margin: 0; font-size: 15px; font-weight: 600; line-height: 1.3; }
.pmga__titles p { margin: 0; font-size: 12px; color: var(--color-secondary, #6b7280); }
.pmga__icon { width: 40px; height: 40px; display: grid; place-items: center; border: 0; border-radius: 10px; background: transparent; color: var(--color-secondary, #6b7280); cursor: pointer; }
.pmga__icon:hover { background: var(--color-surface, #f9fafb); }
.pmga svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.pmga__thread { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 16px; display: flex; flex-direction: column; gap: 18px; }
.pmga__empty { margin-top: auto; }
.pmga__empty p { margin: 0 0 6px; font-size: 15px; color: var(--color-secondary, #6b7280); }
.pmga__sugg { list-style: none; margin: 0 -4px; padding: 0; }
.pmga__sugg button { display: flex; gap: 12px; width: 100%; align-items: flex-start; padding: 10px 4px; border: 0; border-radius: 12px; background: transparent; text-align: left; font: inherit; font-size: 15px; line-height: 1.35; color: inherit; cursor: pointer; }
.pmga__sugg button:hover { background: var(--color-surface, #f9fafb); }
.pmga__sugg svg { margin-top: 2px; width: 16px; height: 16px; color: var(--color-secondary, #6b7280); flex-shrink: 0; }
.pmga__q { align-self: flex-end; max-width: 85%; margin: 0; padding: 10px 14px; border-radius: 16px 16px 6px 16px; background: var(--color-surface, #f9fafb); box-shadow: inset 0 0 0 1px var(--color-border, #e5e7eb); font-size: 15px; line-height: 1.4; }
.pmga__a { font-size: 15px; line-height: 1.65; }
.pmga__a p { margin: 0 0 10px; }
.pmga__a h4 { margin: 10px 0 2px; font-size: 15px; }
.pmga__a a { color: var(--color-accent, #2563eb); }
.pmga__actions { display: grid; gap: 8px; margin: 8px 0 12px; }
.pmga__actions a { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 48px; padding: 8px 14px; border-radius: 12px; border: 1px solid var(--color-border, #e5e7eb); background: #fff; color: var(--color-primary, #1a1a1a) !important; text-decoration: none; font-weight: 600; }
.pmga__actions a.is-primary { background: var(--color-brand, #372568); border-color: var(--color-brand, #372568); color: #fff !important; }
.pmga__actions a small { display: block; font-weight: 400; font-size: 12px; opacity: 0.8; }
.pmga__src p { margin: 0 0 4px; font-size: 12px; font-weight: 600; color: var(--color-secondary, #6b7280); }
.pmga__src ol { margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.5; }
.pmga__src .host { margin-left: 6px; color: var(--color-secondary, #6b7280); white-space: nowrap; }
.pmga__follow { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.pmga__follow button { border: 1px solid var(--color-border, #e5e7eb); background: #fff; border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 14px; cursor: pointer; }
.pmga__progress { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 15px; color: var(--color-secondary, #6b7280); }
.pmga-dots { display: inline-flex; gap: 4px; }
.pmga-dots span { width: 4px; height: 4px; border-radius: 50%; background: currentColor; opacity: 0.65; }
.pmga__compose { display: flex; align-items: flex-end; gap: 8px; margin: 4px 12px calc(10px + env(safe-area-inset-bottom)); padding: 6px 6px 6px 14px; border: 1px solid var(--color-border, #e5e7eb); border-radius: 16px; box-shadow: 0 2px 10px rgb(17 24 39 / 0.06); }
.pmga__compose:focus-within { border-color: rgb(55 37 104 / 0.5); box-shadow: 0 0 0 3px rgb(55 37 104 / 0.12); }
.pmga__compose textarea { flex: 1; min-height: 40px; max-height: 120px; padding: 8px 0; border: 0; outline: none; resize: none; background: transparent; font: inherit; font-size: 16px; }
.pmga__send { width: 40px; height: 40px; display: grid; place-items: center; border: 0; border-radius: 12px; background: var(--color-brand, #372568); color: #fff; cursor: pointer; }
.pmga__sim { padding: 6px 16px; border-top: 1px dashed #d1d5db; background: var(--color-surface, #f9fafb); color: var(--color-secondary, #6b7280); font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
@media (min-width: 1024px) { .pmga__sim { border-radius: 0 0 20px 20px; } }
/* Phones: icon-only launcher so it never covers page text (Fable 9A.3) */
@media (max-width: 639px) {
  .pmga-launch { right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); }
  .pmga-launch__btn { width: 52px; height: 52px; padding: 0; justify-content: center; }
  .pmga-launch__btn svg { width: 22px; height: 22px; }
  .pmga-launch__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
