.washme-chat,
.washme-chat * {
  box-sizing: border-box;
}

.washme-chat {
  --chat-gold: #d5b45b;
  --chat-gold-bright: #f5d77f;
  --chat-ink: #080806;
  --chat-panel: #11110e;
  --chat-paper: #f6f0df;
  --chat-muted: #a7a294;
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 2147483000;
  color: var(--chat-paper);
  font-family: "Open Sans", ui-sans-serif, system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.45;
}

.washme-chat__launcher {
  position: relative;
  display: grid;
  grid-template-columns: 42px auto;
  align-items: center;
  gap: 10px;
  min-height: 62px;
  padding: 8px 18px 8px 9px;
  color: #171306;
  background: linear-gradient(135deg, var(--chat-gold-bright), var(--chat-gold) 58%, #ae8427);
  border: 1px solid rgba(255, 238, 170, 0.8);
  border-radius: 999px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.38), 0 0 0 5px rgba(213, 180, 91, 0.1);
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  letter-spacing: 0.01em;
  transition: transform 180ms ease, box-shadow 180ms ease, opacity 180ms ease;
}

.washme-chat__launcher:hover {
  transform: translateY(-3px);
  box-shadow: 0 22px 58px rgba(0, 0, 0, 0.46), 0 0 0 7px rgba(213, 180, 91, 0.13);
}

.washme-chat__launcher:active {
  transform: translateY(0) scale(0.98);
}

.washme-chat__launcher-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: var(--chat-gold-bright);
  background: #0a0905;
  border-radius: 50%;
}

.washme-chat__launcher-icon svg,
.washme-chat__icon-button svg,
.washme-chat__microphone svg,
.washme-chat__send svg {
  width: 21px;
  height: 21px;
}

.washme-chat__pulse {
  position: absolute;
  top: 7px;
  left: 42px;
  width: 11px;
  height: 11px;
  background: #70d890;
  border: 2px solid #171306;
  border-radius: 50%;
}

.washme-chat__panel {
  position: absolute;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  width: min(390px, calc(100vw - 28px));
  height: min(650px, calc(100vh - 44px));
  min-height: 460px;
  overflow: hidden;
  background:
    radial-gradient(circle at 90% 0, rgba(213, 180, 91, 0.18), transparent 30%),
    linear-gradient(165deg, #171711, var(--chat-panel) 42%, #090908);
  border: 1px solid rgba(213, 180, 91, 0.48);
  border-radius: 26px;
  box-shadow: 0 32px 90px rgba(0, 0, 0, 0.64), 0 0 0 1px rgba(255, 255, 255, 0.04) inset;
  opacity: 0;
  transform: translateY(18px) scale(0.96);
  transform-origin: bottom right;
  pointer-events: none;
  transition: opacity 180ms ease, transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.washme-chat--open .washme-chat__panel {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.washme-chat--open .washme-chat__launcher {
  opacity: 0;
  pointer-events: none;
}

.washme-chat__header {
  position: relative;
  display: grid;
  grid-template-columns: 48px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 18px 16px;
  background: linear-gradient(100deg, rgba(213, 180, 91, 0.14), transparent 70%);
  border-bottom: 1px solid rgba(213, 180, 91, 0.2);
}

.washme-chat__mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  color: #0c0b07;
  background: linear-gradient(145deg, var(--chat-gold-bright), #b88725);
  border-radius: 15px 15px 15px 5px;
  font-family: Georgia, serif;
  font-size: 19px;
  font-weight: 900;
  box-shadow: 0 8px 22px rgba(213, 180, 91, 0.2);
}

.washme-chat__eyebrow {
  margin: 0 0 2px;
  color: var(--chat-gold-bright);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.washme-chat__title {
  margin: 0;
  color: #fffdf5;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
}

.washme-chat__header-actions {
  display: flex;
  gap: 4px;
}

.washme-chat__icon-button {
  display: grid;
  width: 36px;
  height: 36px;
  padding: 0;
  place-items: center;
  color: #d8d3c5;
  background: transparent;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  transition: color 160ms ease, background 160ms ease;
}

.washme-chat__icon-button:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.washme-chat__tracks {
  display: flex;
  gap: 6px;
  padding: 10px 16px;
  overflow-x: auto;
  background: rgba(0, 0, 0, 0.22);
  border-bottom: 1px solid rgba(213, 180, 91, 0.14);
  scrollbar-width: none;
}

.washme-chat__tracks::-webkit-scrollbar { display: none; }

.washme-chat__track {
  flex: 0 0 auto;
  padding: 6px 12px;
  color: var(--chat-muted);
  background: transparent;
  border: 1px solid rgba(213, 180, 91, 0.22);
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  transition: color 160ms ease, background 160ms ease, border-color 160ms ease;
}

.washme-chat__track:hover {
  color: #f2ead4;
  border-color: rgba(245, 215, 127, 0.5);
}

.washme-chat__track--active {
  color: #0c0b07;
  background: linear-gradient(145deg, var(--chat-gold-bright), #c39a33);
  border-color: transparent;
}

.washme-chat__messages {
  overflow-x: hidden;
  overflow-y: auto;
  padding: 18px 16px 10px;
  scrollbar-color: rgba(213, 180, 91, 0.45) transparent;
  overscroll-behavior: contain;
}

.washme-chat__message {
  display: grid;
  margin-bottom: 13px;
  animation: washme-chat-arrive 220ms ease both;
}

.washme-chat__message--assistant {
  justify-items: start;
}

.washme-chat__message--user {
  justify-items: end;
}

.washme-chat__bubble {
  max-width: 88%;
  padding: 11px 13px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  border-radius: 17px;
}

.washme-chat__message--assistant .washme-chat__bubble {
  color: #eeeade;
  background: #24231e;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-bottom-left-radius: 5px;
}

.washme-chat__message--user .washme-chat__bubble {
  color: #171306;
  background: linear-gradient(135deg, var(--chat-gold-bright), var(--chat-gold));
  border-bottom-right-radius: 5px;
  font-weight: 650;
}

.washme-chat__label {
  margin: 0 0 5px 3px;
  color: #777267;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.washme-chat__typing {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  min-height: 20px;
}

.washme-chat__typing span {
  width: 6px;
  height: 6px;
  background: var(--chat-gold);
  border-radius: 50%;
  animation: washme-chat-dot 900ms infinite ease-in-out;
}

.washme-chat__typing span:nth-child(2) { animation-delay: 120ms; }
.washme-chat__typing span:nth-child(3) { animation-delay: 240ms; }

.washme-chat__suggestions {
  display: flex;
  gap: 8px;
  padding: 4px 16px 10px;
  overflow-x: auto;
  scrollbar-width: none;
}

.washme-chat__suggestions::-webkit-scrollbar { display: none; }

.washme-chat__suggestion {
  flex: 0 0 auto;
  padding: 8px 11px;
  color: #e7dcae;
  background: rgba(213, 180, 91, 0.07);
  border: 1px solid rgba(213, 180, 91, 0.3);
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.washme-chat__suggestion:hover {
  background: rgba(213, 180, 91, 0.16);
  border-color: rgba(245, 215, 127, 0.68);
  transform: translateY(-1px);
}

.washme-chat__composer-wrap {
  padding: 10px 12px 12px;
  background: rgba(0, 0, 0, 0.28);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.washme-chat__composer {
  display: grid;
  grid-template-columns: 1fr 42px;
  align-items: end;
  gap: 8px;
  padding: 5px 5px 5px 13px;
  background: #f5f1e6;
  border: 1px solid transparent;
  border-radius: 18px;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.washme-chat--speech .washme-chat__composer {
  grid-template-columns: 1fr 38px 42px;
}

.washme-chat__composer:focus-within {
  border-color: var(--chat-gold);
  box-shadow: 0 0 0 3px rgba(213, 180, 91, 0.14);
}

.washme-chat__input {
  width: 100%;
  min-height: 40px;
  max-height: 108px;
  padding: 9px 0 7px;
  resize: none;
  overflow-y: auto;
  color: #181711;
  background: transparent;
  border: 0;
  outline: 0;
  font: inherit;
  line-height: 1.35;
}

.washme-chat__input::placeholder { color: #77746b; }

.washme-chat__microphone {
  position: relative;
  display: grid;
  width: 38px;
  height: 38px;
  margin-bottom: 2px;
  padding: 0;
  place-items: center;
  color: #5f594c;
  background: transparent;
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  transition: color 150ms ease, background 150ms ease, transform 150ms ease;
}

.washme-chat__microphone[hidden] { display: none; }

.washme-chat__microphone:hover {
  color: #171306;
  background: rgba(213, 180, 91, 0.22);
}

.washme-chat__microphone--listening {
  color: #fff8df;
  background: #9d392f;
  animation: washme-chat-listening 1.35s ease-in-out infinite;
}

.washme-chat__microphone--listening:hover {
  color: #fff8df;
  background: #843027;
}

.washme-chat__microphone:disabled {
  cursor: wait;
  opacity: 0.4;
}

.washme-chat__send {
  display: grid;
  width: 42px;
  height: 42px;
  padding: 0;
  place-items: center;
  color: #171306;
  background: linear-gradient(145deg, var(--chat-gold-bright), var(--chat-gold));
  border: 0;
  border-radius: 14px;
  cursor: pointer;
  transition: transform 150ms ease, filter 150ms ease;
}

.washme-chat__send:hover { filter: brightness(1.06); transform: translateY(-1px); }
.washme-chat__send:disabled { cursor: wait; filter: grayscale(0.5); opacity: 0.55; transform: none; }

.washme-chat__speech-status {
  min-height: 0;
  margin: 7px 4px 0;
  color: #c9c2af;
  font-size: 11px;
  line-height: 1.35;
  text-align: center;
}

.washme-chat__speech-status:empty { display: none; }
.washme-chat__speech-status[data-state="listening"] { color: #f2d47d; }
.washme-chat__speech-status[data-state="error"] { color: #f2a097; }

.washme-chat__note {
  margin: 8px 4px 0;
  color: #77746c;
  font-size: 10px;
  line-height: 1.35;
  text-align: center;
}

.washme-chat button:focus-visible,
.washme-chat textarea:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 2px;
}

@keyframes washme-chat-arrive {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes washme-chat-dot {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}

@keyframes washme-chat-listening {
  0%, 100% { box-shadow: 0 0 0 0 rgba(157, 57, 47, 0.28); transform: scale(1); }
  50% { box-shadow: 0 0 0 6px rgba(157, 57, 47, 0); transform: scale(1.04); }
}

@media (max-width: 560px) {
  .washme-chat {
    right: 12px;
    bottom: max(12px, env(safe-area-inset-bottom));
  }

  .washme-chat__launcher {
    grid-template-columns: 42px;
    width: 58px;
    min-height: 58px;
    padding: 7px;
    border-radius: 50%;
  }

  .washme-chat__launcher-label { display: none; }
  .washme-chat__pulse { left: 40px; }

  .washme-chat__panel {
    position: fixed;
    inset: 10px 10px max(10px, env(safe-area-inset-bottom));
    width: auto;
    height: auto;
    min-height: 0;
    border-radius: 22px;
    transform-origin: bottom center;
  }

  .washme-chat__header { padding: 14px; }
  .washme-chat__messages { padding: 15px 13px 8px; }
  .washme-chat__suggestions { padding-inline: 13px; }
  .washme-chat__tracks { padding-inline: 13px; }
  .washme-chat__bubble { max-width: 92%; }
}

@media (prefers-reduced-motion: reduce) {
  .washme-chat *,
  .washme-chat *::before,
  .washme-chat *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
