:host {
  all: initial;
}

.launcher {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 2147483000;
  display: grid;
  width: 68px;
  height: 68px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  font: 700 24px system-ui;
  overflow: visible;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.launcher::before {
  position: absolute;
  inset: -8%;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    radial-gradient(
      circle at 32% 24%,
      rgba(255, 255, 255, 0.1),
      rgba(255, 255, 255, 0.03) 28%,
      transparent 48%
    ),
    radial-gradient(
      circle at 68% 76%,
      rgba(105, 132, 170, 0.035),
      transparent 62%
    ),
    rgba(255, 255, 255, 0.012);
  box-shadow:
    0 11px 25px rgba(8, 12, 24, 0.1),
    inset 0 0 0 0.5px rgba(255, 255, 255, 0.12),
    inset 9px 8px 17px rgba(255, 255, 255, 0.025),
    inset -11px -13px 20px rgba(15, 22, 40, 0.06);
  -webkit-backdrop-filter: blur(6px) saturate(1.35) contrast(1.08);
  backdrop-filter: blur(6px) saturate(1.35) contrast(1.08);
  content: "";
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease, box-shadow 0.22s ease;
}

.launcher::after {
  position: absolute;
  inset: -8%;
  z-index: 2;
  border-radius: 50%;
  background:
    radial-gradient(
      ellipse 34% 18% at 31% 18%,
      rgba(255, 255, 255, 0.58),
      rgba(255, 255, 255, 0.2) 32%,
      rgba(255, 255, 255, 0.035) 58%,
      transparent 76%
    ),
    radial-gradient(
      ellipse 18% 9% at 70% 80%,
      rgba(205, 236, 255, 0.16),
      transparent 72%
    ),
    conic-gradient(
      from 205deg at 50% 50%,
      transparent 0 17%,
      rgba(255, 255, 255, 0.06) 23%,
      transparent 31% 75%,
      rgba(255, 255, 255, 0.08) 84%,
      transparent 92%
    );
  box-shadow:
    inset 2px 3px 3px rgba(255, 255, 255, 0.08),
    inset -3px -4px 6px rgba(12, 17, 30, 0.035);
  content: "";
  opacity: 0;
  pointer-events: none;
  transform: rotate(-7deg);
  transition: opacity 0.35s ease, transform 0.22s ease;
}

.launcher-fallback {
  position: relative;
  z-index: 3;
  color: #17162a;
  filter: drop-shadow(0 8px 14px rgba(23, 22, 42, 0.18));
  transition: opacity 0.3s ease;
}

.launcher-soul {
  position: absolute;
  inset: -14%;
  z-index: 1;
  width: 128%;
  height: 128%;
  pointer-events: none;
  opacity: 0;
  filter: drop-shadow(0 9px 14px rgba(23, 22, 42, 0.18));
  transition: opacity 0.35s ease, filter 0.2s ease;
}

.launcher[data-soul-ready="true"] {
  background: transparent;
}

.launcher[data-soul-ready="true"]::before,
.launcher[data-soul-ready="true"]::after {
  opacity: 1;
}

:host([data-soul-shell="false"]) .launcher::before,
:host([data-soul-shell="false"]) .launcher::after {
  display: none;
}

:host([data-surface="light"]) .launcher::before {
  background:
    radial-gradient(circle at 32% 24%, rgba(255, 255, 255, 0.18), transparent 48%),
    rgba(255, 255, 255, 0.035);
  box-shadow:
    0 11px 25px rgba(17, 24, 39, 0.07),
    inset 0 0 0 0.5px rgba(255, 255, 255, 0.16),
    inset -10px -12px 18px rgba(42, 53, 73, 0.05);
  -webkit-backdrop-filter: blur(6px) saturate(1.16) contrast(1.04);
  backdrop-filter: blur(6px) saturate(1.16) contrast(1.04);
}

:host([data-surface="dark"]) .launcher::before {
  border-color: rgba(255, 255, 255, 0.07);
  background:
    radial-gradient(circle at 32% 24%, rgba(255, 255, 255, 0.09), transparent 46%),
    rgba(4, 7, 14, 0.07);
  box-shadow:
    0 11px 26px rgba(0, 0, 0, 0.18),
    inset 0 0 0 0.5px rgba(255, 255, 255, 0.1),
    inset -11px -13px 20px rgba(0, 0, 0, 0.13);
  -webkit-backdrop-filter: blur(6px) saturate(1.28) contrast(1.1);
  backdrop-filter: blur(6px) saturate(1.28) contrast(1.1);
}

.launcher[data-soul-ready="true"] .launcher-fallback {
  opacity: 0;
}

.launcher[data-soul-ready="true"] .launcher-soul {
  opacity: 1;
}

.launcher:hover {
  transform: translateY(-2px);
}

.launcher:hover::after {
  transform: translate(1px, 1px) rotate(-3deg);
}

.launcher:hover .launcher-soul {
  filter: drop-shadow(0 12px 18px rgba(23, 22, 42, 0.22));
}

.launcher:focus-visible {
  outline: 3px solid #818cf8;
  outline-offset: 3px;
}

.launcher[data-open="true"] {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.82);
}

.panel {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 2147482999;
  width: min(390px, calc(100vw - 24px));
  height: min(680px, calc(100dvh - 40px));
  border: 0;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 24px 80px #11182738;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px) scale(0.98);
  transform-origin: bottom right;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.panel[data-open="true"] {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}

:host([data-theme="dark"]) .panel {
  background: #0e0e13;
  box-shadow: 0 26px 86px rgba(0, 0, 0, 0.42);
}

@media (prefers-color-scheme: dark) {
  :host([data-theme="adaptive"]) .panel {
    background: #0e0e13;
  }
}

:host([data-position="left"]) .launcher,
:host([data-position="left"]) .panel {
  right: auto;
  left: 20px;
}

:host([data-position="left"]) .panel {
  transform-origin: bottom left;
}

:host([data-mode="full"]) .launcher {
  display: none;
}

:host([data-mode="full"]) .panel {
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 0;
}

@media (max-width: 520px) {
  .panel,
  :host([data-position="left"]) .panel {
    inset: 8px;
    width: calc(100vw - 16px);
    height: calc(100dvh - 16px);
    border-radius: 18px;
  }

  .launcher {
    right: 16px;
    bottom: 16px;
    width: 60px;
    height: 60px;
  }

  :host([data-position="left"]) .launcher {
    right: auto;
    left: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .launcher,
  .panel,
  .launcher-fallback,
  .launcher-soul,
  .launcher::before,
  .launcher::after {
    transition: none;
  }
}

@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  :host([data-surface="adaptive"]) .launcher::before {
    background:
      radial-gradient(circle at 32% 24%, rgba(255, 255, 255, 0.28), transparent 48%),
      rgba(18, 24, 38, 0.2);
  }
}
