/* Boblics, the study companion: a soap-bubble robot in the corner, one speech bubble, one explain popup. */
.bx { position: fixed; right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom)); z-index: 230;
  display: flex; flex-direction: column; align-items: flex-end; gap: 6px; pointer-events: none; font-family: var(--font); }
.bx[hidden], .bx-catch[hidden], .bx-bubble[hidden], .bx-menu[hidden], .bx-actions[hidden] { display: none !important; }
.bx > * { pointer-events: auto; }
.bx-catch { position: fixed; inset: 0; z-index: 229; background: transparent; cursor: default; }

.bx-bot { width: 116px; height: 116px; margin: -14px -14px -18px 0; padding: 0; border: 0; background: none; cursor: pointer; border-radius: 50%;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation; filter: drop-shadow(0 8px 14px rgba(29, 78, 216, .22)); }
.bx-bot svg { width: 100%; height: 100%; display: block; overflow: visible; }
.bx-bot:focus-visible { outline: 3px solid var(--blue, #2f6bff); outline-offset: 2px; }
.bx-bot [data-p="eyes"] { transition: transform .12s ease-out; }
.bx-bot [data-p="sym"] { font-family: var(--display); }
.bx-float { animation: bx-float 4s ease-in-out infinite; }
@keyframes bx-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
.bx-shadow { animation: bx-shadow 4s ease-in-out infinite; transform-origin: 200px 372px; }
@keyframes bx-shadow { 0%, 100% { transform: scale(1); opacity: .25; } 50% { transform: scale(.8); opacity: .14; } }
.bx-squisher { transform-origin: 200px 330px; }
.bx-squish { animation: bx-squish .55s ease-out; }
@keyframes bx-squish { 0% { transform: scale(1, 1); } 25% { transform: scale(1.12, .86); } 55% { transform: scale(.94, 1.08); } 100% { transform: scale(1, 1); } }

/* the speech bubble, with its tail pointing down at Boblics */
/* its width is what is left beside Boblics: the screen, less his 16px corner gap, the bubble's offset and a 16px edge */
.bx { --bx-mr: 40px; }
.bx-bubble { position: relative; width: min(300px, calc(100vw - var(--bx-mr) - 32px - env(safe-area-inset-left) - env(safe-area-inset-right))); background: #fff; color: var(--ink, #0f1a3d);
  border: 2px solid transparent; border-radius: 18px 18px 6px 18px; padding: 10px 14px 12px; margin-right: var(--bx-mr); overflow-wrap: anywhere;
  background-image: linear-gradient(#fff, #fff), linear-gradient(120deg, #ff6ad5, #8f7bff 30%, #4fd4ff 55%, #5dffb0 78%, #ffe066);
  background-origin: border-box; background-clip: padding-box, border-box; box-shadow: 0 14px 34px rgba(10, 18, 56, .2);
  animation: bx-pop .22s ease-out; }
.bx-bubble::after { content: ""; position: absolute; right: -2px; bottom: -11px; width: 18px; height: 12px; background: #fff;
  clip-path: polygon(0 0, 100% 0, 100% 100%); }
@keyframes bx-pop { from { opacity: 0; transform: translateY(6px) scale(.96); } to { opacity: 1; transform: none; } }
.bx-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.bx-name { font-family: var(--display); font-size: .78rem; font-weight: 700; color: #6a5cff; letter-spacing: .02em; }
.bx-more { border: 0; background: none; color: var(--mute, #5a6788); font-size: 1.1rem; line-height: 1; width: 32px; height: 28px;
  border-radius: 8px; cursor: pointer; }
.bx-more:hover, .bx-more:focus-visible { background: var(--soft, #f1f5ff); }
.bx-text { margin: 2px 0 0; font-size: .95rem; line-height: 1.45; }
.bx-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.bx-act { font: inherit; font-size: .82rem; font-weight: 600; border: 0; border-radius: 999px; padding: 7px 12px; min-height: 34px;
  background: #eef3ff; color: var(--blue-d, #1d4ed8); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; }
.bx-act:first-child { background: var(--blue, #2f6bff); color: #fff; }
.bx-act:focus-visible { outline: 3px solid var(--gold, #ffb547); outline-offset: 1px; }
.bx-menu { display: flex; gap: 6px; margin-top: 9px; padding-top: 9px; border-top: 1px dashed var(--edge, #dbe4fb); }
.bx-menu button { font: inherit; font-size: .8rem; border: 1px solid var(--edge, #dbe4fb); background: #fff; color: var(--ink, #0f1a3d);
  border-radius: 999px; padding: 6px 11px; min-height: 32px; cursor: pointer; }
.bx-menu button[aria-pressed="true"] { background: var(--soft, #f1f5ff); border-color: var(--blue, #2f6bff); }

/* in the corner of the Dashboard and Profile Boblics stays a little smaller until it speaks */
.bx.docked .bx-bot { width: 104px; height: 104px; }
.bx.in-wizard { bottom: max(16px, env(safe-area-inset-bottom)); }

/* the explain popup */
.bx-modal-back { position: fixed; inset: 0; z-index: 240; display: grid; place-items: center; padding: 16px; background: rgba(6, 11, 36, .58); }
.bx-modal { width: min(100%, 480px); max-height: calc(100dvh - 32px); overflow: auto; background: #fff; color: var(--ink, #0f1a3d);
  border-radius: 18px; padding: 22px 22px 18px; box-shadow: 0 24px 60px rgba(0, 0, 0, .35); border-top: 4px solid #8f7bff; animation: bx-pop .2s ease-out; }
.bx-modal-top { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.bx-mini svg { width: 36px; height: 36px; display: block; }
.bx-modal h3 { margin: 0; font-size: 1.15rem; }
.bx-modal-p { line-height: 1.6; margin: 8px 0; }
.bx-steps { margin: 10px 0 4px; padding-left: 22px; line-height: 1.55; }
.bx-steps li { margin: 4px 0; }
.bx-gotit { margin-top: 12px; width: 100%; }

/* a small "Ask Boblics" button on results */
.bx-ask { font: inherit; font-size: .8rem; font-weight: 600; border: 1px solid #d9d2ff; background: #f6f3ff; color: #5b4bd6;
  border-radius: 999px; padding: 5px 11px; min-height: 32px; cursor: pointer; margin-top: 6px; }
.bx-ask:hover { background: #eee9ff; }

@media (max-width: 640px) {
  .bx-bot, .bx.docked .bx-bot { width: 84px; height: 84px; }
  .bx { --bx-mr: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  .bx-float, .bx-shadow, .bx-bubble, .bx-modal { animation: none; }
}

/* moving about: Boblics glides between spots and to the thing he is pointing at */
.bx { transition: left .85s cubic-bezier(.45, -0.25, .3, 1.25), top .85s cubic-bezier(.45, -0.25, .3, 1.25); }
.bx.away { --bx-mr: 0px; }
.bx.point-right { align-items: flex-start; }
.bx.point-right .bx-bubble { border-radius: 18px 18px 18px 6px; }
.bx.point-right .bx-bubble::after { right: auto; left: -2px; clip-path: polygon(0 0, 100% 0, 0 100%); }
.bx-spot { outline: 3px solid #8f7bff !important; outline-offset: 4px; border-radius: 10px; box-shadow: 0 0 0 8px rgba(143, 123, 255, .18); transition: outline-color .3s, box-shadow .3s; }
@media (prefers-reduced-motion: reduce) { .bx { transition: none; } }

/* "Report a problem": in the menu, and its form */
.bx-menu { flex-wrap: wrap; }
.bx-menu .bx-report { color: #b3261e; }
.bx-report-card { display: grid; gap: 10px; }
.bx-report-card textarea { width: 100%; resize: vertical; }
.bx-report-card .btn.sm { justify-self: start; }
