/* Guide companion. Inherits the page font size. Motion is off when the
   visitor asks for less, and the box is placed in script so it does not
   sit on menus, the footer, or controls. */

.cg-root {
  position: fixed;
  transition: right 0.55s ease, bottom 0.55s ease;
  /* Above the page mascot (70) and the bar (40). Under the phone menu,
     settings, and help layers (80+), so those stay clickable. */
  z-index: 71;
  right: var(--cg-right, 12px);
  bottom: var(--cg-bottom, 12px);
  width: 200px;
  height: 236px;
  margin: 0;
  padding: 0;
  border: 0;
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.45;
  color: var(--ink, #e8eefc);
  pointer-events: none;
}

.cg-monkey,
.cg-nudge,
.cg-panel,
.cg-tour,
.cg-callout,
.cg-callout button {
  pointer-events: auto;
}

.cg-monkey {
  position: relative;
  width: 200px;
  height: 236px;
  padding: 0;
  border: 0;
  border-radius: 36px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  overflow: visible;
}

.cg-monkey:focus-visible,
.cg-panel button:focus-visible,
.cg-panel input:focus-visible,
.cg-panel select:focus-visible,
.cg-nudge button:focus-visible,
.cg-callout button:focus-visible {
  outline: 3px solid #22d3ee;
  outline-offset: 3px;
}

.cg-aura,
.cg-glow {
  display: none;
}

.cg-float {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  animation: cg-float 3.2s ease-in-out infinite;
}

.cg-monkey svg {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  overflow: visible;
  filter: drop-shadow(0 10px 8px rgba(76, 29, 149, 0.28));
}

.cg-eye {
  transform-box: fill-box;
  transform-origin: center;
  animation: cg-blink 4.6s infinite;
}

.cg-spark {
  position: absolute;
  left: 50%;
  top: 46%;
  width: 7px;
  height: 7px;
  margin: -3px 0 0 -3px;
  border-radius: 50%;
  background: #ecfeff;
  box-shadow: 0 0 10px #22d3ee;
  animation: cg-orbit 6.5s linear infinite;
  animation-delay: var(--d, 0s);
  pointer-events: none;
}

.cg-monkey.is-boop .cg-float {
  animation: cg-boop 0.55s ease;
}

.cg-nudge {
  position: fixed;
  z-index: 2;
  right: var(--cg-nudge-right, var(--cg-right, 12px));
  bottom: var(--cg-nudge-bottom, calc(var(--cg-bottom, 12px) + 128px));
  width: min(260px, var(--cg-panel-width, 260px));
  max-height: min(220px, var(--cg-panel-max, 220px));
  overflow: auto;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid var(--line-strong, rgba(255, 255, 255, 0.28));
  background: var(--card-bg, #0b1020);
  color: var(--ink, #e8eefc);
  box-shadow: var(--shadow, 0 16px 40px rgba(0, 0, 0, 0.35));
}

.cg-nudge[hidden],
.cg-panel[hidden],
.cg-tour[hidden],
.cg-voice[hidden] {
  display: none !important;
}

.cg-nudge p {
  margin: 0 0 8px;
}

.cg-nudge-actions,
.cg-chips,
.cg-form,
.cg-voice,
.cg-callout-actions,
.cg-bar,
.cg-tools,
.cg-who {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.cg-chips {
  flex: 0 0 auto;
  flex-wrap: nowrap;
  gap: 8px;
  min-height: 0;
  max-height: none;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 2px 2px 6px;
}

.cg-panel {
  position: fixed;
  z-index: 3;
  right: var(--cg-panel-right, var(--cg-right, 12px));
  bottom: var(--cg-panel-bottom, calc(var(--cg-bottom, 12px) + 128px));
  width: var(--cg-panel-width, min(400px, calc(100vw - 24px)));
  height: auto;
  max-height: min(var(--cg-panel-max, 74vh), calc(100dvh - var(--cg-panel-bottom, 140px) - 12px));
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border-radius: 22px;
  border: 2px solid transparent;
  background:
    linear-gradient(var(--card-bg, #ffffff), var(--card-bg, #ffffff)) padding-box,
    linear-gradient(120deg, #22d3ee, #6366f1, #f59e0b, #f472b6, #22d3ee) border-box;
  background-size: auto, 220% 220%;
  background-position: 0 0, 0% 50%;
  color: var(--ink, #16182b);
  box-shadow:
    0 22px 50px rgba(15, 23, 42, 0.28),
    0 0 28px rgba(34, 211, 238, 0.28);
  font-size: 1em;
  overflow: auto;
  animation: cg-border 8s linear infinite;
}

.cg-pointer {
  position: absolute;
  width: 18px;
  height: 18px;
  background: linear-gradient(135deg, #22d3ee, #6366f1);
  box-shadow: 0 8px 16px rgba(79, 70, 229, 0.35);
  pointer-events: none;
}

.cg-panel.is-above .cg-pointer {
  right: 42px;
  bottom: -8px;
  transform: rotate(45deg);
}

.cg-panel.is-beside .cg-pointer {
  right: -8px;
  bottom: 36px;
  transform: rotate(45deg);
}

.cg-root.is-sheet .cg-panel {
  left: 8px;
  right: 8px;
  width: auto;
  top: auto;
  bottom: 8px;
  height: calc(100dvh - 16px);
  max-height: calc(100dvh - 16px);
  border-radius: 22px;
  padding-bottom: 10px;
  overflow: hidden;
}

html.cg-guide-open .phone-dock {
  display: none !important;
}

.cg-root.is-sheet .cg-offers,
.cg-root.is-sheet .cg-choices,
.cg-root.is-sheet .cg-log,
.cg-root.is-sheet .cg-readbar {
  flex: 1 1 0;
  min-height: 0;
  overflow: auto;
}

.cg-root.is-sheet .cg-form,
.cg-root.is-sheet .cg-bar,
.cg-root.is-sheet .cg-chips,
.cg-root.is-sheet .cg-more {
  flex: 0 0 auto;
}

.cg-root.is-sheet .cg-monkey {
  visibility: hidden;
}

.cg-root.is-sheet .cg-pointer {
  right: calc(var(--cg-right, 12px) + 42px);
  bottom: -8px;
}

.cg-bar,
.cg-form,
.cg-voice {
  flex: 0 0 auto;
}

.cg-bar {
  justify-content: space-between;
  align-items: center;
  flex-wrap: nowrap;
  gap: 8px;
}

.cg-who {
  flex-wrap: nowrap;
  min-width: 0;
}

.cg-avatar {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 40% 30%, #fff7d6, #f6b73c 55%, #d97706);
  box-shadow: 0 0 0 2px rgba(34, 211, 238, 0.7), 0 0 16px rgba(99, 102, 241, 0.45);
}

.cg-avatar svg {
  width: 34px;
  height: 34px;
  display: block;
}

.cg-id {
  min-width: 0;
}

.cg-bar h2 {
  margin: 0;
  font-size: 1.05em;
  line-height: 1.15;
}

.cg-status {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted, #5c657f);
  font-size: 0.78em;
  line-height: 1.2;
}

.cg-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #16a34a;
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.18);
}

.cg-tools {
  flex-wrap: nowrap;
  gap: 6px;
}

.cg-log {
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  flex: 0 1 auto;
  max-height: 180px;
  padding: 4px 2px;
}

.cg-root.is-sheet .cg-log { max-height: 96px; }

.cg-bubble {
  max-width: min(92%, 36rem);
  margin: 0;
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid var(--line, rgba(22, 24, 43, 0.12));
  background: var(--bg-3, #eef2ff);
  color: var(--ink, #16182b);
  overflow: visible;
}

.cg-bubble p {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-break: break-word;
}

.cg-bubble.is-user {
  margin-left: auto;
  border-radius: 16px 16px 4px 16px;
  background: linear-gradient(140deg, #0f9b8e, #4f46e5);
  color: #f8fafc;
  border-color: transparent;
}

.cg-bubble.is-bot {
  margin-right: auto;
  border-radius: 4px 16px 16px 16px;
}

.cg-links {
  margin: 8px 0 0;
}

.cg-links a {
  color: inherit;
  font-weight: 750;
}

.cg-typing {
  display: inline-flex;
  gap: 4px;
  min-height: 1em;
  align-items: center;
}

.cg-typing i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: cg-dot 1s infinite;
}

.cg-typing i:nth-child(2) { animation-delay: 0.15s; }
.cg-typing i:nth-child(3) { animation-delay: 0.3s; }

.cg-chip,
.cg-form button,
.cg-bar button,
.cg-nudge button,
.cg-callout button,
.cg-mic {
  min-width: 44px;
  min-height: 44px;
  border-radius: 14px;
  border: 1px solid var(--line-strong, rgba(255, 255, 255, 0.28));
  background: var(--card-bg, #0b1020);
  color: var(--ink, #e8eefc);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  padding: 8px 12px;
}

.cg-chip {
  flex: 0 0 auto;
  white-space: nowrap;
  text-align: center;
  line-height: 1.2;
  border-radius: 999px;
}

.cg-chip.is-course {
  max-width: none;
  background: linear-gradient(140deg, #22d3ee, #6366f1);
  color: #041018;
  border-color: transparent;
}

.cg-handle { display: none; }

.cg-root.is-sheet .cg-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 28px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: grab;
  flex: 0 0 auto;
}

.cg-root.is-sheet .cg-handle::before {
  content: "";
  width: 72px;
  height: 7px;
  border-radius: 99px;
  background: linear-gradient(90deg, #22d3ee, #7c3aed, #f472b6);
  box-shadow: 0 0 10px rgba(124, 58, 237, 0.45);
}

.cg-offers,
.cg-choices {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 8px;
  flex: 0 1 auto;
  width: 100%;
  min-width: 0;
  max-height: 188px;
  overflow: auto;
  box-sizing: border-box;
}

@media (min-width: 721px) {
  .cg-offers,
  .cg-choices { max-height: none; overflow: visible; }
}

.cg-choice {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  margin: 0;
  padding: 6px 12px;
  border: 0;
  border-radius: 999px;
  background: #fff;
  color: #1b1340;
  font: inherit;
  font-weight: 800;
  line-height: 1.2;
  cursor: pointer;
  box-shadow: 0 0 0 2px #7c3aed;
}

.cg-choice-ico {
  width: 16px;
  height: 16px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cg-choice-clip { background: #e0f2fe; box-shadow: 0 0 0 2px #0284c7; color: #0c4a6e; }
.cg-choice-film { background: #ede9fe; box-shadow: 0 0 0 2px #7c3aed; color: #3b0764; }
.cg-choice-clock { background: #fef3c7; box-shadow: 0 0 0 2px #d97706; color: #78350f; }
.cg-choice-spark { background: #fce7f3; box-shadow: 0 0 0 2px #db2777; color: #831843; }
.cg-choice-quiz { background: #dcfce7; box-shadow: 0 0 0 2px #15803d; color: #14532d; }
.cg-choice-book { background: #cffafe; box-shadow: 0 0 0 2px #0e7490; color: #164e63; }
.cg-choice-mic { background: #fae8ff; box-shadow: 0 0 0 2px #a21caf; color: #701a75; }
.cg-choice-game { background: #ffedd5; box-shadow: 0 0 0 2px #ea580c; color: #7c2d12; }
.cg-choice-read { background: #e0e7ff; box-shadow: 0 0 0 2px #4338ca; color: #312e81; }
.cg-choice-mute { background: #f1f5f9; box-shadow: 0 0 0 2px #475569; color: #0f172a; }

.cg-more {
  flex: 0 0 auto;
  border-radius: 14px;
  background: #f5f3ff;
  color: #1b1340;
}

.cg-more summary {
  cursor: pointer;
  font-weight: 800;
  padding: 8px 12px;
  list-style: none;
}

.cg-more summary::-webkit-details-marker { display: none; }

.cg-more summary::before {
  content: "▸ ";
  color: #7c3aed;
}

.cg-more[open] summary::before { content: "▾ "; }

.cg-more[open] { padding-bottom: 8px; }

.cg-more .cg-tools,
.cg-more .cg-along,
.cg-more .cg-voice,
.cg-more .cg-amb {
  padding: 0 10px;
}

.cg-panel select,
.cg-amb select,
.cg-voice select {
  appearance: none;
  -webkit-appearance: none;
  min-height: 40px;
  border-radius: 999px;
  border: 2px solid #7c3aed;
  background-color: #fff;
  color: #1b1340;
  font: inherit;
  font-weight: 750;
  padding: 6px 34px 6px 12px;
  background-image: linear-gradient(45deg, transparent 50%, #7c3aed 50%), linear-gradient(135deg, #7c3aed 50%, transparent 50%);
  background-position: calc(100% - 16px) 55%, calc(100% - 10px) 55%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

.cg-amb {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0 0;
  color: #1b1340;
  font-weight: 750;
}

.cg-close {
  background: #7c3aed !important;
  color: #fff !important;
  border: 0 !important;
}

.cg-chip:hover,
.cg-form button:hover,
.cg-bar button:hover,
.cg-nudge button:hover {
  border-color: #22d3ee;
}

.cg-form input,
.cg-voice select {
  min-height: 44px;
  border-radius: 14px;
  border: 1px solid var(--line-strong, rgba(255, 255, 255, 0.28));
  background: var(--field, var(--bg, #0b1020));
  color: inherit;
  font: inherit;
  padding: 8px 12px;
}

.cg-form {
  align-items: stretch;
}

.cg-form input {
  flex: 1 1 120px;
  min-width: 0;
}

.cg-voice {
  align-items: end;
}

.cg-voice label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.85em;
  flex: 1 1 120px;
}

.cg-live {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.cg-tour {
  position: fixed;
  inset: 0;
  z-index: 70;
}

.cg-tour-back {
  position: absolute;
  inset: 0;
  background: rgba(4, 8, 20, 0.28);
}

.cg-spot {
  position: fixed;
  z-index: 71;
  border-radius: 16px;
  border: 3px solid #22d3ee;
  box-shadow: 0 0 0 9999px rgba(4, 8, 20, 0.62), 0 0 24px rgba(34, 211, 238, 0.8);
  pointer-events: none;
}

.cg-callout {
  position: fixed;
  z-index: 72;
  width: min(300px, calc(100vw - 24px));
  padding: 12px;
  border-radius: 16px;
  border: 1px solid var(--line-strong, rgba(255, 255, 255, 0.28));
  background: var(--card-bg, #0b1020);
  color: var(--ink, #e8eefc);
  box-shadow: var(--shadow, 0 16px 40px rgba(0, 0, 0, 0.35));
}

.cg-callout p {
  margin: 0 0 8px;
}

.cg-target {
  outline: 3px solid #22d3ee;
  outline-offset: 4px;
}

@keyframes cg-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

@keyframes cg-spin {
  to { transform: rotate(360deg); }
}

@keyframes cg-border {
  0% { background-position: 0 0, 0% 50%; }
  50% { background-position: 0 0, 100% 50%; }
  100% { background-position: 0 0, 0% 50%; }
}

@keyframes cg-pulse {
  0%, 100% { opacity: 0.72; transform: scale(0.96); }
  50% { opacity: 1; transform: scale(1.05); }
}

@keyframes cg-blink {
  0%, 42%, 48%, 100% { transform: scaleY(1); }
  45% { transform: scaleY(0.08); }
}

@keyframes cg-orbit {
  from { transform: rotate(var(--a, 0deg)) translateX(40px) rotate(calc(var(--a, 0deg) * -1)); }
  to { transform: rotate(calc(var(--a, 0deg) + 360deg)) translateX(40px) rotate(calc((var(--a, 0deg) + 360deg) * -1)); }
}

@keyframes cg-boop {
  0% { transform: scale(1) rotate(-6deg); }
  40% { transform: scale(1.08) rotate(8deg) translateY(-6px); }
  100% { transform: scale(1) rotate(0); }
}

@keyframes cg-dot {
  0%, 80%, 100% { opacity: 0.25; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}

@media (prefers-reduced-motion: reduce) {
  .cg-root,
  .cg-root * {
    animation: none !important;
    transition: none !important;
  }
}

html[data-motion="reduce"] .cg-root,
html[data-motion="reduce"] .cg-root * {
  animation: none !important;
  transition: none !important;
}

@media print {
  .cg-root { display: none !important; }
}

/* The page already draws monkeys in the hero and the corner. This companion
   is the one to talk to, so those copies stay out of the way. Shell files
   are left as they are. */
.monkey,
.monkey-note,
.hud-mascot {
  display: none !important;
}

.cg-root.is-greeting {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: auto !important;
  bottom: auto !important;
  width: 100vw !important;
  height: 100vh !important;
  max-width: none !important;
  z-index: 78;
  display: block;
  padding: 0;
  background: transparent;
  pointer-events: none;
}

.cg-root.is-greeting .cg-monkey {
  position: fixed !important;
  left: var(--cg-greet-left, 16px) !important;
  top: var(--cg-greet-top, 16px) !important;
  right: auto !important;
  bottom: auto !important;
  width: 200px;
  height: 236px;
  z-index: 3;
  pointer-events: auto;
}

.cg-root.is-greeting .cg-nudge {
  position: fixed !important;
  left: var(--cg-greet-card-left, 16px) !important;
  top: var(--cg-greet-card-top, 260px) !important;
  right: auto !important;
  bottom: auto !important;
  width: var(--cg-greet-card-width, min(420px, calc(100vw - 24px))) !important;
  max-height: none;
  overflow: visible;
  text-align: center;
  color: #1b1340;
  pointer-events: auto;
  background:
    linear-gradient(#fff, #fff) padding-box,
    linear-gradient(120deg, #22d3ee, #7c3aed, #f472b6, #fbbf24) border-box;
  border: 3px solid transparent;
  box-shadow: 0 24px 50px rgba(27, 19, 64, 0.35);
}

.cg-root.is-greeting .cg-nudge p { color: #1b1340; }
.cg-root.is-greeting .cg-nudge button { background: #7c3aed; color: #fff; }
.cg-root.is-greeting .cg-nudge button:first-of-type { background: #ede9fe; color: #3b0764; }

@media (max-width: 720px) {
  .cg-root.is-greeting {
    width: 100vw !important;
    height: 100vh !important;
  }
  .cg-root, .cg-monkey { width: 156px; height: 184px; }
  .cg-root.is-greeting .cg-monkey { width: 148px; height: 172px; }
  .cg-root.is-greeting .cg-nudge {
    max-height: 150px;
    overflow: hidden;
    padding: 8px 10px;
  }
  .cg-root.is-greeting .cg-nudge p {
    margin: 0 0 6px;
    font-size: 0.78rem;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .cg-root.is-greeting .cg-nudge button {
    padding: 6px 8px;
    font-size: 0.78rem;
  }
}

/* A 156px monkey on a 390px phone sat on the opening lines. Keep a
   small corner control above the phone bar unless the greeting is open. */
@media (max-width: 430px) {
  .cg-root:not(.is-greeting),
  .cg-root:not(.is-greeting) .cg-monkey {
    width: 48px;
    height: 56px;
  }
}

.cg-root.is-menu-away {
  transform: translateX(140%);
}

.cg-root.is-menu-away,
.cg-root.is-menu-away * {
  pointer-events: none !important;
}

.cg-arm {
  transform-box: fill-box;
  transform-origin: center top;
}

.cg-head {
  transform-box: fill-box;
  transform-origin: center center;
}

.cg-pop { opacity: 0; }

.cg-root[data-pose="greet"] .cg-arm-right {
  animation: cg-wave-arm 0.7s ease-in-out infinite;
}

.cg-root[data-pose="think"] .cg-head { transform: rotate(-8deg); }
.cg-root[data-pose="think"] .cg-arm-left { transform: rotate(58deg); }
.cg-root[data-pose="think"] .cg-float { animation: none; }

.cg-root[data-pose="listen"] .cg-arm-right { transform: rotate(-78deg); }
.cg-root[data-pose="listen"] .cg-ear { transform: scale(1.08); }

.cg-root[data-pose="celebrate"] .cg-arm-right { animation: cg-wave-arm 0.55s ease-in-out infinite; }
.cg-root[data-pose="celebrate"] .cg-arm-left { animation: cg-wave-arm-left 0.55s ease-in-out infinite; }
.cg-root[data-pose="celebrate"] .cg-pop { opacity: 1; }
.cg-root[data-pose="celebrate"] .cg-mouth { transform: scale(1.15); }

.cg-root[data-pose="encourage"] .cg-head { animation: cg-nod 1.3s ease-in-out infinite; }
.cg-root[data-pose="encourage"] .cg-arm-right { transform: rotate(-24deg); }
.cg-root[data-pose="encourage"] .cg-arm-left { transform: rotate(24deg); }

@keyframes cg-wave-arm {
  0%, 100% { transform: rotate(-148deg); }
  50% { transform: rotate(-118deg); }
}

@keyframes cg-wave-arm-left {
  0%, 100% { transform: rotate(148deg); }
  50% { transform: rotate(118deg); }
}

@keyframes cg-nod {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(7deg); }
}

.cg-readbar {
  display: grid;
  gap: 8px;
  margin: 0 0 8px;
  padding: 8px;
  border-radius: 16px;
  background: #f5f3ff;
  border: 2px solid #c4b5fd;
  position: sticky;
  top: 0;
  z-index: 4;
}

.cg-voice-live {
  display: flex !important;
  flex-wrap: wrap;
  gap: 8px;
}

.cg-along,
.cg-outline {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.cg-outline {
  display: block;
  max-height: 140px;
  overflow: auto;
  margin: 0;
  padding: 0;
  list-style: none;
}

.cg-outline button,
.cg-along button,
.cg-poke button,
.cg-greet button {
  border: 0;
  border-radius: 999px;
  padding: 6px 10px;
  font: inherit;
  font-weight: 750;
  cursor: pointer;
  background: #ede9fe;
  color: #3b0764;
}

.cg-outline .is-reading button,
.cg-outline button.is-reading {
  background: #7c3aed;
  color: #fff;
  box-shadow: 0 0 12px #c4b5fd;
}

.is-read-along {
  scroll-margin: 140px;
}

.is-read-along-head {
  border-radius: 12px;
  outline: 4px solid #facc15;
  outline-offset: 6px;
  background: #fef9c3 !important;
  color: #1b1340 !important;
  box-shadow: 0 0 0 8px rgba(250, 204, 21, 0.65), 0 0 28px #c4b5fd;
  scroll-margin: 140px;
}

.toc a.is-reading {
  background: #7c3aed;
  color: #fff;
  border-radius: 8px;
  box-shadow: 0 0 12px #c4b5fd;
}

::highlight(spoken) {
  background: #fde68a;
  color: #1b1340;
}

.cg-nudge.cg-poke,
.cg-nudge.cg-greet {
  width: min(280px, calc(100vw - 24px));
  border: 2px solid #c4b5fd;
  box-shadow: 0 12px 30px rgba(49, 10, 90, 0.28);
}

@keyframes cg-wave {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(18deg); }
}

@keyframes cg-shake {
  0%, 100% { transform: translateX(0); }
  30% { transform: translateX(-6px); }
  60% { transform: translateX(6px); }
}

/* Draggable bot: bounce snap, lift, reset button, hidden under the full-screen menu. */
.cg-root.is-snapping { transition: left .5s cubic-bezier(.34,1.56,.64,1), top .5s cubic-bezier(.34,1.56,.64,1) !important; }
.bot-reset {
  position: fixed; z-index: 2147483000; width: 32px; height: 32px; min-height: 32px; padding: 0; border-radius: 50%;
  border: 2px solid #22d3ee; background: #fff; color: #1b1340; font: 800 16px/1 system-ui, sans-serif; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 2px 8px rgba(0,0,0,.3);
}
.bot-reset[hidden] { display: none; }
.bot-reset:focus-visible { outline: 3px solid #082f49; outline-offset: 2px; }
@media (max-width: 800px) { .bot-reset { width: 36px; height: 36px; min-height: 36px; } }
@media (prefers-reduced-motion: reduce) { .cg-root.is-snapping { transition: none !important; } }
html[data-motion="reduce"] .cg-root.is-snapping { transition: none !important; }
body.edge-open .bot-reset, body.phone-menu-open .bot-reset { visibility: hidden; }
.cg-monkey { touch-action: none; user-select: none; -webkit-user-select: none; }
.cg-root.is-snapping { transition: right .5s cubic-bezier(.34,1.56,.64,1), bottom .5s cubic-bezier(.34,1.56,.64,1) !important; }
@media (prefers-reduced-motion: reduce) { .cg-root.is-snapping { transition: none !important; } }
