/* ==========================================================
   SAGE mount — the full-viewport WebGL canvas she renders into.
   Fixed so it doesn't scroll with page content (same behavior
   the old CSS orb had), pointer-events: none so the canvas never
   blocks clicks on the actual page underneath — only the small
   hit-zone button below (positioned by sage.js to follow her) is
   actually clickable.
========================================================== */

#sageAvatarMount {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1900;
  pointer-events: none;
background: transparent !important;
background-color: transparent !important;
}

#sageAvatarMount canvas {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
background: transparent !important;
}

.sage {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 2000;
  pointer-events: none;
  transform: translate3d(0, 0, 0);
}

/* ==========================================================
   Hit-zone (formerly the visible CSS orb button). No background,
   no visual of its own now — sage.js repositions this each frame
   to sit exactly where the WebGL butterfly is rendered, purely so
   there's something clickable to open the panel.
========================================================== */

.sage__body {
  position: absolute;
  top: 0;
  left: 0;

  width: 96px;
  height: 96px;
  border: 0;
  padding: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;

  pointer-events: auto;
}

.sage__bubble {
  position: absolute;
  top: -20px;
  left: 50%;

  max-width: 220px;
  padding: 10px 14px;
  border: 1px solid rgba(108, 184, 255, 0.22);
  border-radius: 14px;

  background: rgba(6, 17, 33, 0.92);
  backdrop-filter: blur(16px);

  color: #eef6ff;
  font-size: 0.82rem;
  line-height: 1.45;
  white-space: nowrap;

  transform: translate(-50%, -100%) scale(0.95);
  transform-origin: bottom center;

  opacity: 0;
  pointer-events: none;

  box-shadow:
    0 12px 30px rgba(0, 0, 0, 0.28),
    0 0 20px rgba(61, 131, 255, 0.12);

  transition:
    opacity 220ms ease,
    transform 220ms ease;
}

.sage__bubble.is-visible {
  opacity: 1;
  transform: translate(-50%, -100%) scale(1);
}

.sage__panel {
  position: absolute;

  top: -12px;
  left: auto;
  right: 96px;

  width: 340px;
  padding: 18px;

  border: 1px solid rgba(104, 177, 255, 0.22);
  border-radius: 22px;

  background:
    linear-gradient(
      160deg,
      rgba(10, 21, 40, 0.97),
      rgba(5, 12, 24, 0.97)
    );
  backdrop-filter: blur(16px);

  opacity: 0;
  visibility: hidden;
  transform: translateY(10px) scale(0.98);

  pointer-events: none;

  box-shadow:
    0 25px 60px rgba(0, 0, 0, 0.35),
    0 0 30px rgba(72, 130, 255, 0.08);

  transition:
    opacity 220ms ease,
    visibility 220ms ease,
    transform 220ms ease;
}

.sage__panel.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.sage__panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.sage__eyebrow {
  margin: 0 0 6px;
  color: #6ebcff;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.sage__panel-header h3 {
  margin: 0;
  color: #f5f9ff;
  font-size: 1.15rem;
}

.sage__close {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(104, 177, 255, 0.16);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  color: #ddecff;
  font-size: 1.2rem;
  cursor: pointer;
}

.sage__close:hover {
  background: rgba(47, 131, 255, 0.08);
}

.sage__messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 18px;
  max-height: 250px;
  overflow-y: auto;
}

.sage__message {
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 0.88rem;
  line-height: 1.55;
}

.sage__message--sage {
  align-self: flex-start;
  background: rgba(47, 131, 255, 0.09);
  border: 1px solid rgba(104, 177, 255, 0.12);
  color: #edf6ff;
}

.sage__message--user {
  align-self: flex-end;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.sage__message--typing {
  opacity: 0.6;
  font-style: italic;
}

.sage__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.sage__chip {
  padding: 8px 11px;
  border: 1px solid rgba(104, 177, 255, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  color: #d9ebff;
  font-size: 0.78rem;
  cursor: pointer;
}

.sage__chip:hover {
  border-color: rgba(104, 177, 255, 0.4);
  background: rgba(47, 131, 255, 0.08);
}

.sage__form {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.sage__input {
  flex: 1;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid rgba(104, 177, 255, 0.16);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  color: #f4f8ff;
  outline: none;
}

.sage__input::placeholder {
  color: #8aa4bf;
}

.sage__input:focus {
  border-color: rgba(104, 177, 255, 0.48);
  box-shadow: 0 0 0 3px rgba(47, 131, 255, 0.12);
}

.sage__send {
  padding: 0 16px;
  border: 1px solid rgba(104, 177, 255, 0.22);
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(32, 98, 255, 0.7), rgba(88, 57, 255, 0.7));
  color: white;
  font-weight: 700;
  cursor: pointer;
}

.sage__send:hover {
  filter: brightness(1.08);
}

.sage__dev-note {
  margin: 14px 0 0;
  color: #7893ac;
  font-size: 0.72rem;
  line-height: 1.4;
}

.sage-highlight {
  position: relative;
  z-index: 2;
  box-shadow:
    0 0 0 1px rgba(111, 196, 255, 0.35),
    0 0 28px rgba(75, 132, 255, 0.18) !important;
  transition: box-shadow 220ms ease;
}

@media (max-width: 900px) {
  .sage__panel {
    left: auto;
    right: -10px;
    top: 96px;
    width: min(340px, calc(100vw - 28px));
  }
}

@media (max-width: 680px) {
  .sage__body {
    width: 80px;
    height: 80px;
  }

  .sage__panel {
    width: min(320px, calc(100vw - 22px));
  }

  .sage__bubble {
    white-space: normal;
    width: 190px;
    text-align: center;
  }
}
