:root {
  --racor-navy: #062c57;
  --racor-blue: #075fa4;
  --racor-cyan: #00a9df;
  --racor-yellow: #ffd400;
  --racor-white: #fff;
  --racor-shadow: 0 18px 55px rgba(2, 34, 69, .24);
}

.racor-widget {
  position: fixed;
  z-index: 99999;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  font-family: Arial, Helvetica, sans-serif;
  color: var(--racor-navy);
}

.racor-launcher {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 64px;
  padding: 4px 16px 4px 5px;
  border: 0;
  border-radius: 999px;
  color: var(--racor-white);
  background: linear-gradient(135deg, var(--racor-blue), var(--racor-navy));
  box-shadow: var(--racor-shadow);
  cursor: pointer;
  font-size: 15px;
  font-weight: 700;
}

.racor-launcher:focus-visible,
.racor-close:focus-visible,
.racor-form input:focus-visible,
.racor-form button:focus-visible,
.racor-quick-actions button:focus-visible {
  outline: 3px solid var(--racor-yellow);
  outline-offset: 3px;
}

.racor-launcher-media {
  display: grid;
  place-items: end center;
  width: 58px;
  height: 58px;
  overflow: visible;
}

.racor-launcher-media video,
.racor-launcher-media img {
  display: block;
  width: 54px;
  height: 68px;
  object-fit: contain;
  object-position: bottom center;
  pointer-events: none;
}

.racor-panel {
  position: absolute;
  right: 0;
  bottom: 78px;
  width: min(390px, calc(100vw - 28px));
  max-height: min(630px, calc(100vh - 120px));
  overflow: hidden;
  border: 1px solid rgba(7, 95, 164, .16);
  border-radius: 22px;
  background: var(--racor-white);
  box-shadow: var(--racor-shadow);
}

.racor-panel[hidden] {
  display: none !important;
}

.racor-panel:not([hidden]) {
  display: flex;
  flex-direction: column;
}

.racor-widget .screen-reader-text {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.racor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 0 0 auto;
  gap: 0;
  height: auto;
  padding: 17px 18px;
  color: var(--racor-white);
  background: linear-gradient(135deg, var(--racor-navy), var(--racor-blue));
}

.racor-header strong,
.racor-header span {
  display: block;
}

.racor-header strong {
  font-size: 18px;
  letter-spacing: .04em;
}

.racor-header span {
  margin-top: 2px;
  color: #cceeff;
  font-size: 12px;
}

.racor-close {
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .35);
  border-radius: 50%;
  color: var(--racor-white);
  background: rgba(255, 255, 255, .08);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.racor-messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1 1 auto;
  min-height: 140px;
  max-height: 340px;
  padding: 18px;
  overflow-y: auto;
  background: #f4f9fd;
}

.racor-message {
  max-width: 88%;
  padding: 11px 13px;
  border-radius: 15px;
  font-size: 14px;
  line-height: 1.45;
}

.racor-message p {
  margin: 0;
}

.racor-message a {
  display: inline-block;
  margin-top: 8px;
  color: inherit;
  font-weight: 700;
  text-decoration: underline;
}

.racor-message-assistant {
  align-self: flex-start;
  border: 1px solid #d6e7f4;
  border-bottom-left-radius: 4px;
  background: var(--racor-white);
}

.racor-message-user {
  align-self: flex-end;
  border-bottom-right-radius: 4px;
  color: var(--racor-white);
  background: var(--racor-blue);
}

.racor-message.is-thinking {
  color: #65788c;
  font-style: italic;
}

.racor-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 0 18px 14px;
  background: #f4f9fd;
}

.racor-quick-actions[hidden] {
  display: none !important;
}

.racor-quick-actions button {
  padding: 7px 10px;
  border: 1px solid #b8d9ed;
  border-radius: 999px;
  color: var(--racor-navy);
  background: var(--racor-white);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.racor-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 13px;
  border-top: 1px solid #dce8f1;
}

.racor-form input {
  min-width: 0;
  height: 44px;
  padding: 0 13px;
  border: 1px solid #b8cddd;
  border-radius: 12px;
  color: var(--racor-navy);
  background: var(--racor-white);
  font-size: 14px;
}

.racor-form button {
  height: 44px;
  padding: 0 15px;
  border: 0;
  border-radius: 12px;
  color: var(--racor-navy);
  background: var(--racor-yellow);
  font-weight: 800;
  cursor: pointer;
}

.racor-form button:disabled,
.racor-form input:disabled {
  opacity: .6;
  cursor: wait;
}

.racor-note {
  margin: 0;
  padding: 0 15px 13px;
  color: #65788c;
  font-size: 10px;
  line-height: 1.35;
}

@media (max-width: 640px) {
  .racor-widget {
    right: max(10px, env(safe-area-inset-right));
    bottom: max(10px, env(safe-area-inset-bottom));
  }

  .racor-launcher-label {
    display: none;
  }

  .racor-launcher {
    width: 64px;
    padding: 3px;
  }

  .racor-panel {
    position: fixed;
    right: 10px;
    bottom: 84px;
    left: 10px;
    width: auto;
    max-height: calc(100dvh - 104px);
  }

  .racor-messages {
    max-height: calc(100dvh - 330px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .racor-widget *,
  .racor-widget *::before,
  .racor-widget *::after {
    scroll-behavior: auto !important;
    animation: none !important;
    transition: none !important;
  }
}
