:root {
  --ai-navy: #071521;
  --ai-navy-soft: #102536;
  --ai-cyan: #00b8c8;
  --ai-cyan-light: #63e7eb;
  --ai-amber: #ffb21d;
  --ai-text: #10212d;
  --ai-muted: #687985;
  --ai-white: #ffffff;
  --ai-shadow: 0 24px 70px rgb(1 15 25 / 26%);
}

.ai-guide,
.ai-guide *,
.ai-guide *::before,
.ai-guide *::after,
.ai-launcher,
.ai-launcher *,
.ai-launcher *::before,
.ai-launcher *::after {
  box-sizing: border-box;
}

.ai-guide,
.ai-launcher {
  font-family: Arial, Helvetica, sans-serif;
}

.ai-guide button,
.ai-launcher {
  font: inherit;
}

.ai-launcher {
  position: fixed;
  z-index: 9998;
  right: 24px;
  bottom: 24px;
  width: 64px;
  height: 64px;
  padding: 0;
  border: 3px solid #fff;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--ai-cyan), #057785);
  box-shadow: 0 10px 32px rgb(0 88 101 / 35%);
  cursor: pointer;
  transition:
    opacity 220ms ease,
    transform 220ms ease;
}

.ai-launcher:hover {
  transform: translateY(-3px) scale(1.03);
}

.ai-launcher[aria-expanded='true'] {
  pointer-events: none;
  opacity: 0;
  transform: scale(0.72);
}

.ai-launcher img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: cover;
  object-position: top;
}

.ai-launcher-pulse {
  position: absolute;
  z-index: -1;
  inset: -7px;
  border: 2px solid var(--ai-cyan);
  border-radius: 50%;
  animation: ai-pulse 2s ease-out infinite;
}

.ai-launcher-label {
  position: absolute;
  top: 50%;
  right: calc(100% + 12px);
  width: max-content;
  padding: 9px 12px;
  border-radius: 9px;
  background: var(--ai-navy);
  box-shadow: 0 8px 24px rgb(0 0 0 / 18%);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
  transform: translate(8px, -50%);
  transition: 180ms ease;
}

.ai-launcher:hover .ai-launcher-label,
.ai-launcher:focus-visible .ai-launcher-label {
  opacity: 1;
  transform: translate(0, -50%);
}

.ai-guide {
  position: fixed;
  z-index: 9999;
  right: 24px;
  bottom: 24px;
  width: min(370px, calc(100vw - 32px));
  overflow: hidden;
  border: 1px solid rgb(7 21 33 / 10%);
  border-radius: 22px;
  background: #fff;
  box-shadow: var(--ai-shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(24px) scale(0.95);
  transform-origin: bottom right;
  transition:
    opacity 300ms ease,
    transform 420ms cubic-bezier(0.2, 0.9, 0.2, 1.2);
}

.ai-guide.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.ai-guide-top {
  position: relative;
  display: flex;
  min-height: 96px;
  align-items: center;
  gap: 13px;
  padding: 15px 16px;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 30%, rgb(0 184 200 / 25%), transparent 38%),
    linear-gradient(135deg, var(--ai-navy), var(--ai-navy-soft));
  color: #fff;
}

.ai-guide-top::after {
  content: '';
  position: absolute;
  right: -30px;
  bottom: -46px;
  width: 135px;
  height: 135px;
  border: 1px solid rgb(99 231 235 / 18%);
  border-radius: 50%;
}

.ai-avatar-wrap {
  position: relative;
  flex: 0 0 auto;
  width: 66px;
  height: 66px;
}

.ai-avatar {
  position: relative;
  z-index: 2;
  display: block;
  width: 100%;
  height: 100%;
  border: 2px solid rgb(255 255 255 / 85%);
  border-radius: 50%;
  background: #0a3343;
  object-fit: cover;
  object-position: top;
}

.ai-avatar-ring {
  position: absolute;
  inset: -4px;
  border: 1px solid var(--ai-cyan-light);
  border-radius: 50%;
  opacity: 0.65;
}

.ai-guide.is-speaking .ai-avatar-ring {
  animation: ai-speaking-ring 1.2s ease-out infinite;
}

.ai-online {
  position: absolute;
  z-index: 3;
  right: 1px;
  bottom: 2px;
  width: 13px;
  height: 13px;
  border: 2px solid var(--ai-navy);
  border-radius: 50%;
  background: #45df87;
}

.ai-name {
  margin: 0 35px 5px 0;
  font-size: 14px;
  font-weight: 900;
}

.ai-status {
  margin: 0;
  color: #aac3cf;
  font-size: 10px;
}

.ai-close {
  position: absolute;
  z-index: 3;
  top: 12px;
  right: 12px;
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgb(255 255 255 / 10%);
  color: #fff;
  cursor: pointer;
  font-size: 20px;
}

.ai-close:hover {
  background: rgb(255 255 255 / 20%);
}

.ai-content {
  padding: 21px 20px 18px;
}

.ai-wave {
  display: flex;
  height: 18px;
  align-items: center;
  gap: 3px;
  margin-bottom: 10px;
  opacity: 0;
}

.ai-guide.is-speaking .ai-wave {
  opacity: 1;
}

.ai-wave i {
  width: 3px;
  height: 5px;
  border-radius: 4px;
  background: var(--ai-cyan);
}

.ai-guide.is-speaking .ai-wave i {
  animation: ai-wave 800ms ease-in-out infinite alternate;
}

.ai-wave i:nth-child(2),
.ai-wave i:nth-child(4) {
  animation-delay: -250ms !important;
}

.ai-wave i:nth-child(3) {
  animation-delay: -500ms !important;
}

.ai-message {
  min-height: 66px;
  margin: 0;
  color: var(--ai-text);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.47;
}

.ai-message.is-changing {
  animation: ai-message-in 360ms ease both;
}

.ai-progress {
  height: 3px;
  margin: 18px 0;
  overflow: hidden;
  border-radius: 4px;
  background: #e7eef0;
}

.ai-progress span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--ai-cyan), var(--ai-amber));
  transition: width 420ms ease;
}

.ai-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.ai-actions button,
.ai-speaking-actions button {
  min-height: 42px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 900;
}

.ai-primary {
  border: 0;
  background: var(--ai-cyan);
  box-shadow: 0 8px 20px rgb(0 184 200 / 22%);
  color: #fff;
}

.ai-primary:hover {
  background: #009dac;
}

.ai-secondary {
  padding-inline: 13px;
  border: 1px solid #dce5e8;
  background: #fff;
  color: var(--ai-muted);
}

.ai-speaking-actions {
  display: flex;
  justify-content: space-between;
}

.ai-speaking-actions[hidden] {
  display: none;
}

.ai-speaking-actions button {
  padding: 0 12px;
  border: 1px solid #dce5e8;
  background: #f7fafb;
  color: #526570;
}

.ai-footer {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 20px;
  border-top: 1px solid #e8eef0;
  background: #f8fafb;
  color: #83919a;
  font-size: 9px;
}

.ai-shield {
  display: grid;
  width: 15px;
  height: 15px;
  place-items: center;
  border-radius: 50%;
  background: #daf7e6;
  color: #148e4d;
  font-size: 9px;
  font-weight: 900;
}

@keyframes ai-pulse {
  70%,
  100% {
    opacity: 0;
    transform: scale(1.25);
  }
}

@keyframes ai-speaking-ring {
  to {
    opacity: 0;
    transform: scale(1.25);
  }
}

@keyframes ai-wave {
  to {
    height: 17px;
  }
}

@keyframes ai-message-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

@media (max-width: 640px) {
  .ai-guide {
    right: 12px;
    bottom: 12px;
    width: calc(100vw - 24px);
    max-height: calc(100dvh - 24px);
    overflow-y: auto;
  }

  .ai-launcher {
    right: 16px;
    bottom: 16px;
  }

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

  .ai-actions button {
    width: 100%;
    min-height: 44px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ai-guide,
  .ai-guide *,
  .ai-guide *::before,
  .ai-guide *::after,
  .ai-launcher,
  .ai-launcher *,
  .ai-launcher *::before,
  .ai-launcher *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
