.kevin-chat-launcher.btn {
  position: fixed;
  right: max(24px, env(safe-area-inset-right));
  bottom: max(24px, env(safe-area-inset-bottom));
  z-index: 40;
  width: 76px;
  height: 76px;
  min-height: 76px;
  padding: 0;
  border: 0;
  border-radius: 12px;
  box-shadow: none;
  color: var(--color-base-content);
  background: transparent;
  scale: 1;
  /* The performer owns movement; a second button transition causes entry flashes. */
  transition: none;
}

.kevin-chat-launcher.btn:active {
  scale: 1;
}

.kevin-chat-launcher[hidden] {
  display: none;
}

.kevin-chat-launcher[aria-expanded='true'] {
  visibility: hidden;
  pointer-events: none;
}

.kevin-chat-launcher canvas {
  width: 76px;
  height: 76px;
  image-rendering: pixelated;
}

.kevin-chat-launcher[data-art='failed'] .kevin-chat-launcher-label {
  position: static;
  opacity: 1;
  transform: none;
}

.kevin-chat-launcher-label {
  position: absolute;
  right: calc(100% + 8px);
  top: 50%;
  white-space: nowrap;
  font-size: 12px;
  color: var(--muted);
  opacity: 0;
  transform: translateY(-50%);
  transition: opacity 160ms ease;
  pointer-events: none;
}

.kevin-chat-launcher:focus-visible {
  outline: 1px solid var(--color-base-content);
  outline-offset: 4px;
}

.kevin-chat-launcher:focus-visible .kevin-chat-launcher-label {
  opacity: 1;
}

.kevin-presence-layer {
  position: fixed;
  z-index: 2147483646;
  pointer-events: none;
  color: var(--color-base-content);
}

.kevin-presence-layer[hidden] {
  display: none;
}

.kevin-presence-layer canvas {
  position: absolute;
  left: -16.666667%;
  top: -16.666667%;
  width: 133.333333%;
  height: 133.333333%;
  image-rendering: pixelated;
}

.kevin-chat-dialog.modal {
  position: fixed;
  inset: 0;
  display: none;
  width: 100%;
  height: 100dvh;
  max-width: none;
  max-height: none;
  padding: 0;
  margin: 0;
  overflow: clip;
  border: 0;
  border-radius: 0;
  outline: none;
  background: transparent;
  color: var(--color-base-content);
  opacity: 1;
  box-shadow: none;
  overscroll-behavior: contain;
}

.kevin-chat-dialog.modal[open] {
  display: block;
  visibility: visible;
  pointer-events: auto;
}

.kevin-chat-dialog::backdrop {
  background: transparent;
}

.kevin-chat-dimmer {
  position: absolute;
  inset: 0;
  background: #000;
  opacity: 0;
  pointer-events: none;
}

.kevin-chat-panel.modal-box {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  max-width: none;
  max-height: none;
  padding: 0;
  margin: 0;
  overflow: visible;
  border: 1px solid var(--color-base-300);
  border-radius: 20px;
  background: var(--color-base-200);
  color: var(--color-base-content);
  transform-origin: 0 0;
  box-shadow: none;
  opacity: 0;
  scale: none;
  translate: none;
  transition: none;
}

.kevin-chat-grip {
  position: absolute;
  left: 0;
  width: 8px;
  height: 20px;
  border-radius: 3px;
  background: var(--color-base-300);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.kevin-chat-actor {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 3;
  image-rendering: pixelated;
  transform-origin: 0 0;
  pointer-events: none;
}

.kevin-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  min-height: 80px;
  padding: 14px 14px 10px 22px;
}

.kevin-chat-header h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.6;
}

.kevin-chat-header p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.kevin-chat-panel .btn {
  min-height: 44px;
  border: 0;
  box-shadow: none;
  color: var(--muted);
  background: transparent;
  font-weight: 400;
  transition:
    color 160ms ease,
    background-color 160ms ease;
}

.kevin-chat-panel .btn:focus-visible {
  outline: 1px solid var(--color-base-content);
  outline-offset: 2px;
}

.kevin-chat-panel svg {
  width: 20px;
  height: 20px;
}

.kevin-chat-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 22px 20px;
  overscroll-behavior: contain;
}

.kevin-chat-welcome {
  margin: 0 0 20px;
  font-size: 23px;
  font-weight: 400;
  line-height: 1.45;
  letter-spacing: -0.03em;
}

.kevin-chat-suggestions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  margin-bottom: 20px;
}

.kevin-chat-suggestions .btn {
  justify-content: space-between;
  padding: 8px 0;
  font-size: 12px;
  text-align: left;
  border-radius: 0;
  height: auto;
}

.kevin-chat-log {
  font-size: 13px;
  line-height: 1.8;
  overflow-wrap: anywhere;
}

.kevin-chat-message {
  margin: 0 0 18px;
}

.kevin-chat-message-user {
  padding-left: 28px;
  text-align: right;
  color: var(--muted);
}

.kevin-chat-composer {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  margin: 0 84px 0 16px;
  padding: 10px 0;
  border-top: 1px solid var(--color-base-300);
}

.kevin-chat-composer .input {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  border: 0;
  outline: none;
  padding: 0 6px;
  background: transparent;
  box-shadow: none;
  font-size: 13px;
  color: var(--color-base-content);
  caret-color: var(--color-base-content);
  user-select: text;
  -webkit-user-select: text;
}

.kevin-chat-composer .input::placeholder {
  color: var(--muted);
}

.kevin-chat-composer:focus-within {
  border-top-color: var(--muted);
}

@media (hover: hover) and (pointer: fine) {
  .kevin-chat-launcher:hover .kevin-chat-launcher-label {
    opacity: 1;
  }

  .kevin-chat-panel .btn:hover {
    color: var(--color-base-content);
  }
}

@media (max-width: 619px) {
  .kevin-chat-launcher.btn {
    right: max(16px, env(safe-area-inset-right));
    bottom: max(16px, env(safe-area-inset-bottom));
  }

  .kevin-chat-welcome {
    font-size: 22px;
  }

  .kevin-chat-composer .input {
    font-size: 16px;
  }
}
