/* ============================================================
   MRN ASSISTANT — the front-desk host (Phase 1 shell)
   James's order, 2026-11-13: the assistant we already approved,
   brought to life on the staged front door. STAGING ONLY.
   White-and-gold Design of Record. Text-first panel: her
   portrait slot is HELD OPEN for the King's approved picture —
   NO face is generated, invented, or substituted here.
   The crown mark (emblem-diamond-crown-r.png) stands in the
   header; the portrait area says plainly her picture is coming.
   Layout: docked bottom-right, ABOVE the greeter's "Your Guide"
   switch (bottom:14px) — the assistant dock rides at
   bottom:100px so the two switches never cover each other.
   The greeter rides bottom-left; the assistant rides the
   right corner. Neither moves a word of the page.
   PARK RULE (QC narrow-phone overlap, 2026-11-13): while the
   assistant panel is open, the shell parks the greeter bubble
   (body.ma-panel-open hides .mrn-greeter). Parking, NOT a
   z-index swap — a swap would only reverse which surface covers
   the other. The greeter's own switch is NOT parked: it sits
   below the panel (bottom:14px vs the panel's bottom:100px)
   and stays visible and tappable. The greeter returns the
   moment the panel closes or minimizes.
   ============================================================ */
.mrn-assistant,
.mrn-assistant-dock,
.mrn-assistant-off {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  box-sizing: border-box;
}
.mrn-assistant *,
.mrn-assistant-dock *,
.mrn-assistant-off * { box-sizing: border-box; }

/* ---------- the panel ---------- */
.mrn-assistant {
  position: fixed;
  right: 14px;
  bottom: 100px;
  z-index: 840;
  width: min(370px, calc(100vw - 28px));
  max-height: min(600px, calc(100vh - 220px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #fffdf8;
  color: #1a1a1a;
  border: 2px solid #c9a227;
  border-radius: 14px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, .45);
}
.mrn-assistant.ma-hidden { display: none; }

/* PARK THE GREETER while the panel is open: the open panel and the
   greeter bubble overlap on phones (panel x 10px -> vw-10px, bottom
   96px up; greeter x 10px -> ~vw-27px, bottom 10px up, z 850 over the
   panel's z 840 -- measured 2026-11-13, 390px viewport). Hiding the
   bubble while the panel is open clears every row of the panel; the
   greeter's switch is a separate node and is NOT hidden. The class
   leaves with the panel (minimize / switch OFF / idle), so the
   greeter returns on its own. !important: greeter.css carries
   !important on the greeter's own positioning rules. */
body.ma-panel-open .mrn-greeter { display: none !important; }
.mrn-assistant.ma-pop { animation: ma-pop .35s ease-out; }
@keyframes ma-pop {
  from { opacity: 0; transform: translateY(12px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.ma-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: linear-gradient(180deg, #fff6d8, #f3e3ac);
  border-bottom: 1px solid #c9a227;
}
.ma-mark { flex: none; width: 40px; height: 40px; }
.ma-mark img { width: 40px; height: 40px; display: block; object-fit: contain; }
.ma-title { flex: 1; min-width: 0; line-height: 1.2; }
.ma-title strong { display: block; font-size: 1rem; letter-spacing: .02em; }
.ma-title small { display: block; font-size: .72rem; color: #5c4d1f; }
.ma-head-btns { flex: none; display: flex; gap: 6px; align-items: center; }
.ma-switch {
  border: 1px solid #8a6d1f;
  background: #1a1a1a;
  color: #f3e3ac;
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .04em;
  border-radius: 999px;
  padding: 5px 9px;
  cursor: pointer;
}
.ma-switch.ma-is-off { background: #e8e2d2; color: #6b6252; }
/* Speaker toggle (Crew 3 module, class .a-voice): same gold pill as
   the assistant switch, in the panel header beside it. */
.a-voice {
  border: 1px solid #8a6d1f;
  background: #fffdf8;
  color: #1a1a1a;
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .04em;
  border-radius: 999px;
  padding: 5px 9px;
  cursor: pointer;
  white-space: nowrap;
}
.ma-min {
  border: 1px solid #8a6d1f;
  background: #fffdf8;
  color: #1a1a1a;
  width: 28px; height: 28px;
  border-radius: 8px;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

.ma-body { overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 12px; }

/* Portrait slot: held open, marked, never a face. */
.ma-portrait-slot {
  border: 1px dashed #c9a227;
  border-radius: 10px;
  background: #fff8e1;
  padding: 10px 12px;
  font-size: .82rem;
  line-height: 1.45;
}
.ma-portrait-slot p { margin: 0; }
.ma-portrait-slot strong { color: #6b5312; }

.ma-greeting {
  font-size: .95rem;
  line-height: 1.5;
  background: #fff;
  border: 1px solid #e3d5a8;
  border-left: 4px solid #c9a227;
  border-radius: 8px;
  padding: 10px 12px;
}
.ma-greeting p { margin: 0; }

.ma-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ma-chip {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid #c9a227;
  background: #1a1a1a;
  color: #f3e3ac;
  font-size: .78rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}
.ma-chip:hover { background: #000; border-color: #e3c766; }
.ma-chip:focus-visible { outline: 2px solid #8a6d1f; outline-offset: 2px; }

.ma-answers { display: flex; flex-direction: column; gap: 8px; }
.ma-answer {
  font-size: .9rem;
  line-height: 1.5;
  background: #fff;
  border: 1px solid #e3d5a8;
  border-radius: 8px;
  padding: 10px 12px;
}
.ma-answer p { margin: 0 0 6px; }
.ma-answer p:last-child { margin-bottom: 0; }
.ma-answer a { color: #6b5312; font-weight: 700; }
.ma-answer .ma-verified {
  display: block;
  margin-top: 6px;
  font-size: .75rem;
  color: #5c4d1f;
}
.ma-answer .ma-source {
  display: block;
  font-size: .75rem;
  color: #6b6252;
}

.ma-ask label {
  display: block;
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .04em;
  margin-bottom: 6px;
  color: #5c4d1f;
}
.ma-ask-row { display: flex; gap: 6px; }
.ma-ask-row input {
  flex: 1;
  min-width: 0;
  font-size: .95rem;
  padding: 9px 10px;
  border: 1px solid #c9a227;
  border-radius: 8px;
  background: #fff;
  color: #1a1a1a;
}
.ma-ask-row input:focus-visible { outline: 2px solid #8a6d1f; outline-offset: 1px; }
.ma-ask-row button {
  flex: none;
  border: 1px solid #8a6d1f;
  border-radius: 8px;
  background: #1a1a1a;
  color: #f3e3ac;
  font-size: .85rem;
  font-weight: 800;
  padding: 0 12px;
  cursor: pointer;
}
.ma-mic { min-width: 40px; font-size: 1.05rem; }
.ma-mic.ma-listening {
  background: #8f1d1d;
  border-color: #8f1d1d;
  color: #fff;
  animation: ma-pulse 1.2s ease-in-out infinite;
}
@keyframes ma-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(143, 29, 29, .45); }
  50% { box-shadow: 0 0 0 7px rgba(143, 29, 29, 0); }
}
.ma-mic-state {
  margin: 6px 0 0;
  font-size: .75rem;
  line-height: 1.4;
  color: #6b6252;
}
.ma-mic-state.ma-on { color: #8f1d1d; font-weight: 700; }

.ma-privacy {
  border-top: 1px solid #e3d5a8;
  padding-top: 10px;
  font-size: .78rem;
  line-height: 1.5;
  color: #4a4438;
}
.ma-privacy p { margin: 0 0 8px; }
.ma-privacy p:last-child { margin-bottom: 0; }
.ma-knowledge-state { font-size: .75rem; color: #6b6252; }
.ma-forget {
  border: 1px solid #b9b4c7;
  background: transparent;
  color: #4a4438;
  font-size: .75rem;
  border-radius: 999px;
  padding: 5px 10px;
  cursor: pointer;
}

/* ---------- the dock (minimized) + the off pill ---------- */
.mrn-assistant-dock,
.mrn-assistant-off {
  position: fixed;
  right: 14px;
  bottom: 100px;
  z-index: 840;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid #c9a227;
  background: #fffdf8;
  color: #1a1a1a;
  font-size: .82rem;
  font-weight: 800;
  letter-spacing: .02em;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(0, 0, 0, .4);
}
.mrn-assistant-dock:hover,
.mrn-assistant-off:hover { border-color: #8a6d1f; }
.mrn-assistant-dock .ma-dock-mark,
.mrn-assistant-off .ma-dock-mark { font-size: 1.05rem; color: #8a6d1f; }
.mrn-assistant-dock.ma-hidden,
.mrn-assistant-off.ma-hidden { display: none; }
.mrn-assistant-off { border-color: #b9b4c7; color: #6b6252; background: rgba(255, 253, 248, .92); }
.mrn-assistant-off .ma-dock-mark { color: #6b6252; }

/* ---------- phones: the panel goes wide, never tall ---------- */
@media (max-width: 480px) {
  .mrn-assistant {
    right: 10px;
    bottom: 96px;
    width: calc(100vw - 20px);
    max-height: min(480px, calc(100vh - 240px));
  }
  .mrn-assistant-dock,
  .mrn-assistant-off { right: 10px; bottom: 96px; }
  .ma-greeting { font-size: .9rem; }
}

/* ---------- reduced motion: she stands calm and still ---------- */
@media (prefers-reduced-motion: reduce) {
  .mrn-assistant.ma-pop { animation: none; }
  .ma-mic.ma-listening { animation: none; box-shadow: 0 0 0 2px rgba(143, 29, 29, .6); }
  .mrn-assistant-dock,
  .mrn-assistant-off,
  .ma-chip,
  .ma-switch { transition: none; }
}
