/* ED-202/DS-16 (with PRN-58, WIZ-40, LND-102, CLD-74): Pip's status
   bubble, drawn by static/pip-msg.js. Its own file because the landing
   page doesn't load theme.css; every page that speaks links it after its
   own styles. The tokens fall back to the palette's values. */
#pip-msg {
  position: fixed; z-index: 95; box-sizing: border-box;
  max-width: min(320px, calc(100vw - 24px));
  background: var(--surface, #fff); color: var(--text, #1F2418);
  border-radius: 18px; box-shadow: var(--sh-float, 0 12px 32px rgba(65,78,38,.16));
  padding: 11px 15px; font: 500 15px/1.4 var(--f-ui, inherit);
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px;
  animation: pipmsg-in .28s cubic-bezier(.34,1.3,.64,1);
}
#pip-msg[hidden] { display: none; }
@keyframes pipmsg-in { from { opacity: 0; transform: translateY(8px) scale(.96); } }
#pip-msg::after {                       /* the tail, pointing at him */
  content: ''; position: absolute; bottom: -7px; left: var(--tail-x, calc(100% - 34px));
  width: 14px; height: 14px; background: inherit; transform: rotate(45deg);
  border-radius: 0 0 3px 0; box-shadow: 4px 4px 8px rgba(65,78,38,.06);
}
#pip-msg.no-tail::after, #pip-msg.in-panel::after { display: none; }
/* ED-420: a bubble with nothing to answer closes with a ✕ (or a tap anywhere
   on it). The ✕ looks small and is a 44px target */
#pip-msg-x { display: none; }
#pip-msg.closable { padding-right: 46px; cursor: pointer; }
#pip-msg.closable #pip-msg-x { display: flex; position: absolute; top: 6px; right: 6px;
  width: 30px; height: 30px; padding: 0; border: 0; border-radius: 50%;
  background: var(--surface-2, #F2F4EC); color: var(--text-2, #5B6150);
  align-items: center; justify-content: center; cursor: pointer; }
#pip-msg.closable #pip-msg-x::before { content: ''; position: absolute; inset: -7px; }
#pip-msg.closable #pip-msg-x:hover { background: var(--green-50, #EDF1DE); color: var(--green-800, #414E26); }
#pip-msg-text { margin: 0; flex: 1 1 auto; min-width: 0; }
#pip-msg .pm-dots { display: none; flex: 0 0 auto; }
#pip-msg.work .pm-dots { display: inline-flex; gap: 4px; }
#pip-msg .pm-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--green-500, #677E32);
  animation: pipmsg-dot 1.2s infinite; }
#pip-msg .pm-dots i:nth-child(2) { animation-delay: .15s; }
#pip-msg .pm-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes pipmsg-dot { 0%, 80%, 100% { opacity: .25; transform: none; } 40% { opacity: 1; transform: translateY(-3px); } }
#pip-msg-row { display: flex; gap: 8px; flex-wrap: wrap; }
#pip-msg-row:empty { display: none; }
#pip-msg-row button { border: 1px solid var(--line, #E6E8DF); border-radius: 999px; background: #fff;
  color: var(--green-800, #414E26); font: 600 14px/1 var(--f-ui, inherit); padding: 10px 14px;
  min-height: 40px; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; }
#pip-msg-row button.primary { background: var(--green-500, #677E32); border-color: transparent; color: #fff; }
#pip-msg-row button.soft { background: var(--green-50, #EDF1DE); border-color: transparent; }
#pip-msg-row button.link { border: 0; background: none; padding: 6px 0; min-height: 0; color: var(--green-500, #677E32); }
#pip-msg.done:has(.soft) { padding: 6px 6px 6px 15px; flex-wrap: nowrap; }
#pip-msg .ring { width: 18px; height: 18px; flex: 0 0 auto; }
#pip-msg .ring circle:last-child { stroke-dasharray: 88; stroke-dashoffset: 88;
  animation: pipmsg-ring var(--ring-s, 8s) linear forwards; }
#pip-msg:hover .ring circle:last-child { animation-play-state: paused; }
@keyframes pipmsg-ring { to { stroke-dashoffset: 0; } }
#pip-msg.need, #pip-msg.long { flex-direction: column; align-items: stretch; padding: 14px 16px; }
#pip-msg.need { border-top: 3px solid var(--amber-400, #F5A524); }
#pip-msg.wide { max-width: none; }
#pip-msg.wide #pip-msg-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
#pip-msg.wide #pip-msg-row button { justify-content: center; min-height: 46px; }
#pip-msg.in-panel { background: var(--surface-2, #F7F8F3); box-shadow: none; border-radius: 14px;
  font-size: 14px; padding: 9px 13px; max-width: none; }
#pip-msg.in-panel.need { border-top: 0; border-left: 0; box-shadow: inset 0 0 0 1.5px rgba(245,165,36,.6); }
@media (prefers-reduced-motion: reduce) {
  #pip-msg, #pip-msg .pm-dots i { animation: none; }
  #pip-msg .ring circle:last-child { animation: none; stroke-dashoffset: 0; }
}
/* PRN-58, WIZ-40: a page with no Pip of its own (/print, /new): he appears in the
   corner with his words and goes with them */
#pip-corner { position: fixed; right: 16px; bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  z-index: 94; pointer-events: none; animation: pipmsg-in .28s cubic-bezier(.34,1.3,.64,1);
  /* a fixed box: owls.js draws him a moment after he is added, and the
     bubble is placed from this box before that */
  width: 64px; height: 80px; display: flex; align-items: flex-end; justify-content: center; }
#pip-corner[hidden] { display: none; }
#pip-corner .owl { --s: 64px; filter: drop-shadow(0 8px 14px rgba(65,78,38,.25)); }
@media (prefers-reduced-motion: reduce) { #pip-corner { animation: none; } }
