:root {
  --lw-nexo-accent: #22b8ff;
  --lw-nexo-accent-2: #6a5cff;
  --lw-nexo-surface: rgba(4, 17, 34, .96);
  --lw-nexo-surface-2: rgba(9, 29, 54, .97);
  --lw-nexo-border: rgba(74, 184, 255, .46);
  --lw-nexo-text: #f7fbff;
  --lw-nexo-muted: #9db4cc;
  --lw-nexo-danger: #ff5f7c;
  --lw-nexo-success: #36e499;
  --lw-nexo-shadow: 0 24px 70px rgba(0, 0, 0, .46);
  --lw-nexo-z: 2147482000;
}

html[data-lw-theme="legalworks-gold"] {
  --lw-nexo-accent: #f4bd4d;
  --lw-nexo-accent-2: #dc8b22;
  --lw-nexo-surface: rgba(20, 19, 16, .97);
  --lw-nexo-surface-2: rgba(35, 29, 17, .97);
  --lw-nexo-border: rgba(244, 189, 77, .52);
}

html[data-lw-theme="legalworks-emerald"] {
  --lw-nexo-accent: #21e6bb;
  --lw-nexo-accent-2: #0e9679;
  --lw-nexo-surface: rgba(3, 25, 22, .97);
  --lw-nexo-surface-2: rgba(8, 49, 42, .97);
  --lw-nexo-border: rgba(33, 230, 187, .50);
}

html[data-lw-theme="legalworks-indigo"] {
  --lw-nexo-accent: #a95cff;
  --lw-nexo-accent-2: #39d5ff;
  --lw-nexo-surface: rgba(14, 8, 43, .97);
  --lw-nexo-surface-2: rgba(36, 13, 79, .97);
  --lw-nexo-border: rgba(169, 92, 255, .53);
}

html[data-lw-theme="legalworks-white"] {
  --lw-nexo-accent: #168cff;
  --lw-nexo-accent-2: #725dff;
  --lw-nexo-surface: rgba(247, 251, 255, .98);
  --lw-nexo-surface-2: rgba(226, 241, 255, .98);
  --lw-nexo-border: rgba(22, 140, 255, .42);
  --lw-nexo-text: #07192e;
  --lw-nexo-muted: #567089;
  --lw-nexo-shadow: 0 24px 70px rgba(39, 79, 120, .25);
}

.lw-nexo-root,
.lw-nexo-root * {
  box-sizing: border-box;
}

.lw-nexo-root {
  position: fixed;
  inset: 0;
  z-index: var(--lw-nexo-z);
  pointer-events: none;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

.lw-nexo-root[hidden] {
  display: none !important;
}

.lw-nexo-dim {
  position: absolute;
  inset: 0;
  background: rgba(0, 8, 20, .50);
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity .28s ease;
}

.lw-nexo-root.is-open .lw-nexo-dim {
  opacity: 1;
}

.lw-nexo-spotlight {
  position: fixed;
  left: -9999px;
  top: -9999px;
  width: 0;
  height: 0;
  z-index: calc(var(--lw-nexo-z) + 3);
  border: 2px solid var(--lw-nexo-accent);
  border-radius: 16px;
  box-shadow:
    0 0 0 9999px rgba(0, 7, 18, .64),
    0 0 0 5px color-mix(in srgb, var(--lw-nexo-accent) 17%, transparent),
    0 0 32px color-mix(in srgb, var(--lw-nexo-accent) 55%, transparent);
  opacity: 0;
  transition:
    left .28s ease,
    top .28s ease,
    width .28s ease,
    height .28s ease,
    opacity .22s ease;
  pointer-events: none;
}

.lw-nexo-spotlight.has-target {
  opacity: 1;
  animation: lwNexoFocusPulse 1.65s ease-in-out infinite;
}

.lw-nexo-guide-line {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: calc(var(--lw-nexo-z) + 4);
  overflow: visible;
  pointer-events: none;
}

.lw-nexo-guide-line path {
  fill: none;
  stroke: var(--lw-nexo-accent);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 8 9;
  filter: drop-shadow(0 0 8px var(--lw-nexo-accent));
  animation: lwNexoDash 1.1s linear infinite;
}

.lw-nexo-stage {
  position: fixed;
  right: 28px;
  bottom: 82px;
  width: min(318px, 28vw);
  height: min(430px, 58vh);
  z-index: calc(var(--lw-nexo-z) + 8);
  display: grid;
  place-items: end center;
  perspective: 1000px;
  pointer-events: none;
  transition: transform .28s ease, opacity .25s ease;
}

.lw-nexo-avatar-shell {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transform:
    rotateX(var(--lw-nexo-tilt-y, 0deg))
    rotateY(var(--lw-nexo-tilt-x, 0deg))
    translateY(0);
  transition: transform .14s ease-out;
  animation: lwNexoFloat 4s ease-in-out infinite;
  pointer-events: auto;
}

.lw-nexo-avatar-shell::before {
  content: "";
  position: absolute;
  left: 15%;
  right: 15%;
  bottom: 2%;
  height: 28px;
  border-radius: 50%;
  background:
    radial-gradient(
      ellipse at center,
      color-mix(in srgb, var(--lw-nexo-accent) 72%, transparent) 0%,
      color-mix(in srgb, var(--lw-nexo-accent) 22%, transparent) 42%,
      transparent 74%
    );
  filter: blur(3px);
  animation: lwNexoHalo 2.4s ease-in-out infinite;
}

.lw-nexo-avatar,
.lw-nexo-rive-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: bottom center;
  filter:
    drop-shadow(0 20px 22px rgba(0, 0, 0, .42))
    drop-shadow(0 0 15px color-mix(in srgb, var(--lw-nexo-accent) 28%, transparent));
  transform: translateZ(36px);
  user-select: none;
  -webkit-user-drag: none;
}

.lw-nexo-avatar {
  opacity: 1;
  transition: opacity .25s ease, transform .34s cubic-bezier(.2,.9,.25,1.2);
}

.lw-nexo-avatar.is-switching {
  opacity: 0;
  transform: translateZ(36px) scale(.96);
}

.lw-nexo-rive-canvas {
  display: none;
}

.lw-nexo-root.has-rive .lw-nexo-rive-canvas {
  display: block;
}

.lw-nexo-root.has-rive .lw-nexo-avatar {
  display: none;
}

.lw-nexo-dialog {
  position: fixed;
  right: 330px;
  bottom: 72px;
  width: min(430px, calc(100vw - 48px));
  z-index: calc(var(--lw-nexo-z) + 10);
  color: var(--lw-nexo-text);
  background:
    radial-gradient(circle at 10% 0%, color-mix(in srgb, var(--lw-nexo-accent) 14%, transparent), transparent 30%),
    linear-gradient(145deg, var(--lw-nexo-surface-2), var(--lw-nexo-surface));
  border: 1px solid var(--lw-nexo-border);
  border-radius: 22px;
  box-shadow: var(--lw-nexo-shadow);
  padding: 20px 20px 17px;
  pointer-events: auto;
  opacity: 0;
  transform: translateY(18px) scale(.97);
  transition: opacity .25s ease, transform .28s cubic-bezier(.2,.85,.2,1.15);
  overflow: hidden;
}

.lw-nexo-root.is-open .lw-nexo-dialog {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.lw-nexo-dialog::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--lw-nexo-accent), var(--lw-nexo-accent-2), transparent);
}

.lw-nexo-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.lw-nexo-step {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--lw-nexo-accent);
}

.lw-nexo-close {
  appearance: none;
  border: 1px solid color-mix(in srgb, var(--lw-nexo-border) 70%, transparent);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: var(--lw-nexo-text);
  background: color-mix(in srgb, var(--lw-nexo-surface-2) 75%, transparent);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}

.lw-nexo-close:hover {
  border-color: var(--lw-nexo-accent);
  box-shadow: 0 0 18px color-mix(in srgb, var(--lw-nexo-accent) 30%, transparent);
}

.lw-nexo-title {
  margin: 0 0 9px;
  font-size: clamp(21px, 2vw, 29px);
  line-height: 1.12;
  font-weight: 850;
  letter-spacing: -.025em;
}

.lw-nexo-copy {
  margin: 0;
  color: var(--lw-nexo-muted);
  font-size: 15px;
  line-height: 1.55;
}

.lw-nexo-hint {
  display: none;
  align-items: center;
  gap: 8px;
  margin-top: 13px;
  color: var(--lw-nexo-accent);
  font-size: 12px;
  font-weight: 750;
}

.lw-nexo-hint.is-visible {
  display: flex;
}

.lw-nexo-hint-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--lw-nexo-accent);
  box-shadow: 0 0 13px var(--lw-nexo-accent);
  animation: lwNexoFocusPulse 1.2s ease-in-out infinite;
}

.lw-nexo-progress-track {
  height: 5px;
  margin: 18px 0 15px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--lw-nexo-muted) 22%, transparent);
  overflow: hidden;
}

.lw-nexo-progress-bar {
  width: 16.666%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--lw-nexo-accent), var(--lw-nexo-accent-2));
  box-shadow: 0 0 14px color-mix(in srgb, var(--lw-nexo-accent) 42%, transparent);
  transition: width .35s ease;
}

.lw-nexo-actions {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
}

.lw-nexo-button {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 12px;
  min-height: 43px;
  padding: 0 15px;
  font-weight: 800;
  cursor: pointer;
  transition: transform .16s ease, box-shadow .18s ease, border-color .18s ease;
}

.lw-nexo-button:hover {
  transform: translateY(-1px);
}

.lw-nexo-button:focus-visible,
.lw-nexo-close:focus-visible,
.lw-nexo-help:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--lw-nexo-accent) 35%, transparent);
  outline-offset: 2px;
}

.lw-nexo-button.is-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--lw-nexo-accent), var(--lw-nexo-accent-2));
  box-shadow: 0 10px 25px color-mix(in srgb, var(--lw-nexo-accent) 27%, transparent);
}

.lw-nexo-button.is-secondary {
  color: var(--lw-nexo-text);
  background: color-mix(in srgb, var(--lw-nexo-surface-2) 74%, transparent);
  border-color: color-mix(in srgb, var(--lw-nexo-border) 74%, transparent);
}

.lw-nexo-button.is-ghost {
  color: var(--lw-nexo-muted);
  background: transparent;
  padding-inline: 8px;
}

.lw-nexo-button[disabled] {
  opacity: .42;
  pointer-events: none;
}

.lw-nexo-help {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: calc(var(--lw-nexo-z) + 12);
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  border: 1px solid color-mix(in srgb, var(--lw-nexo-accent) 60%, transparent);
  border-radius: 999px;
  color: #fff;
  background:
    radial-gradient(circle at 20% 10%, rgba(255,255,255,.22), transparent 30%),
    linear-gradient(135deg, var(--lw-nexo-accent), var(--lw-nexo-accent-2));
  box-shadow:
    0 14px 35px rgba(0, 0, 0, .32),
    0 0 24px color-mix(in srgb, var(--lw-nexo-accent) 28%, transparent);
  padding: 7px 17px 7px 8px;
  font-weight: 850;
  cursor: pointer;
  pointer-events: auto;
  transition: transform .18s ease, box-shadow .2s ease;
}

.lw-nexo-help:hover {
  transform: translateY(-2px) scale(1.015);
}

.lw-nexo-help-face {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  object-position: 50% 18%;
  background: rgba(1, 14, 29, .85);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.22);
}

.lw-nexo-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: calc(var(--lw-nexo-z) + 20);
  color: var(--lw-nexo-text);
  background: var(--lw-nexo-surface);
  border: 1px solid var(--lw-nexo-border);
  border-radius: 12px;
  box-shadow: var(--lw-nexo-shadow);
  padding: 12px 16px;
  opacity: 0;
  transform: translate(-50%, 18px);
  transition: opacity .2s ease, transform .2s ease;
  pointer-events: none;
}

.lw-nexo-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@keyframes lwNexoFloat {
  0%, 100% { transform: rotateX(var(--lw-nexo-tilt-y, 0deg)) rotateY(var(--lw-nexo-tilt-x, 0deg)) translateY(0); }
  50% { transform: rotateX(var(--lw-nexo-tilt-y, 0deg)) rotateY(var(--lw-nexo-tilt-x, 0deg)) translateY(-9px); }
}

@keyframes lwNexoHalo {
  0%, 100% { opacity: .66; transform: scaleX(.92); }
  50% { opacity: 1; transform: scaleX(1.08); }
}

@keyframes lwNexoFocusPulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.35); }
}

@keyframes lwNexoDash {
  to { stroke-dashoffset: -34; }
}

@media (max-width: 960px) {
  .lw-nexo-stage {
    right: 8px;
    bottom: 86px;
    width: 205px;
    height: 300px;
    opacity: .98;
  }

  .lw-nexo-dialog {
    left: 16px;
    right: 16px;
    bottom: 18px;
    width: auto;
    padding: 17px;
  }

  .lw-nexo-help {
    right: 12px;
    bottom: 12px;
  }

  .lw-nexo-root.is-open .lw-nexo-help {
    display: none;
  }
}

@media (max-width: 600px) {
  .lw-nexo-stage {
    width: 155px;
    height: 225px;
    right: 4px;
    bottom: 230px;
  }

  .lw-nexo-dialog {
    max-height: 45vh;
    overflow-y: auto;
  }

  .lw-nexo-title {
    font-size: 20px;
  }

  .lw-nexo-copy {
    font-size: 14px;
  }

  .lw-nexo-actions {
    grid-template-columns: 1fr 1fr;
  }

  .lw-nexo-button.is-ghost {
    grid-column: 1 / -1;
    order: 3;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lw-nexo-avatar-shell,
  .lw-nexo-avatar-shell::before,
  .lw-nexo-spotlight,
  .lw-nexo-guide-line path,
  .lw-nexo-hint-dot {
    animation: none !important;
  }

  .lw-nexo-root *,
  .lw-nexo-root *::before,
  .lw-nexo-root *::after {
    transition-duration: .01ms !important;
  }
}
