:root {
  --hog-chat-gold: #c9a227;
  --hog-chat-gold-light: #e8c766;
  --hog-chat-ink: #101011;
  --hog-chat-panel: #171719;
  --hog-chat-copy: #f7f3e9;
  --hog-chat-muted: #b9b3a6;
}

#hog-ai-chat-root,
#hog-ai-chat-root * { box-sizing: border-box; }

#hog-ai-chat-root {
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 70;
  font-family: Arial, Helvetica, sans-serif;
}

.hog-ai-launcher {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 10px 16px 10px 12px;
  border: 1px solid rgba(232, 199, 102, .75);
  border-radius: 999px;
  background: #111;
  color: #fff;
  box-shadow: 0 12px 34px rgba(0,0,0,.33);
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  letter-spacing: .01em;
}

.hog-ai-launcher:hover { transform: translateY(-1px); }
.hog-ai-launcher:focus-visible,
.hog-ai-close:focus-visible,
.hog-ai-send:focus-visible,
.hog-ai-quick:focus-visible,
.hog-ai-input:focus-visible {
  outline: 3px solid var(--hog-chat-gold-light);
  outline-offset: 2px;
}

.hog-ai-launcher-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #17120a;
  background: linear-gradient(180deg, var(--hog-chat-gold-light), var(--hog-chat-gold));
  font-size: 18px;
  line-height: 1;
}

.hog-ai-panel {
  position: absolute;
  right: 0;
  bottom: 68px;
  width: min(390px, calc(100vw - 28px));
  height: min(590px, calc(100vh - 112px));
  display: none;
  grid-template-rows: auto 1fr auto auto;
  overflow: hidden;
  border: 1px solid rgba(232, 199, 102, .43);
  border-radius: 18px;
  background: var(--hog-chat-panel);
  color: var(--hog-chat-copy);
  box-shadow: 0 24px 70px rgba(0,0,0,.52);
}

.hog-ai-panel.is-open { display: grid; }

.hog-ai-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 14px 13px 16px;
  border-bottom: 1px solid rgba(255,255,255,.09);
  background: #101011;
}

.hog-ai-title { margin: 0; color: #fff; font-size: 16px; font-weight: 900; }
.hog-ai-status { margin: 3px 0 0; color: var(--hog-chat-gold-light); font-size: 11px; font-weight: 700; }

.hog-ai-close {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: rgba(255,255,255,.07);
  color: #fff;
  font: inherit;
  font-size: 24px;
  cursor: pointer;
}

.hog-ai-messages {
  overflow-y: auto;
  padding: 14px;
  scroll-behavior: smooth;
  overscroll-behavior: contain;
}

.hog-ai-message {
  max-width: 86%;
  margin: 0 0 10px;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.48;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.hog-ai-message--assistant {
  margin-right: auto;
  border: 1px solid rgba(232, 199, 102, .18);
  border-bottom-left-radius: 5px;
  background: #222224;
  color: #f5f1e8;
}

.hog-ai-message--user {
  margin-left: auto;
  border-bottom-right-radius: 5px;
  background: linear-gradient(180deg, var(--hog-chat-gold-light), var(--hog-chat-gold));
  color: #17120a;
  font-weight: 700;
}

.hog-ai-message a { color: var(--hog-chat-gold-light); text-decoration: underline; }
.hog-ai-message--user a { color: #17120a; }

.hog-ai-typing { color: var(--hog-chat-muted); font-style: italic; }

.hog-ai-quick-row {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 0 12px 10px;
  scrollbar-width: thin;
}

.hog-ai-quick {
  flex: 0 0 auto;
  padding: 7px 10px;
  border: 1px solid rgba(232, 199, 102, .42);
  border-radius: 999px;
  background: #202022;
  color: #f7f3e9;
  font: inherit;
  font-size: 11.5px;
  font-weight: 800;
  cursor: pointer;
}

.hog-ai-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 10px 10px 9px;
  border-top: 1px solid rgba(255,255,255,.09);
  background: #101011;
}

.hog-ai-input {
  width: 100%;
  min-width: 0;
  height: 42px;
  padding: 0 12px;
  border: 1px solid rgba(255,255,255,.17);
  border-radius: 12px;
  background: #202022;
  color: #fff;
  font: inherit;
  font-size: 13px;
}

.hog-ai-input::placeholder { color: #8f8b83; }

.hog-ai-send {
  min-width: 68px;
  height: 42px;
  padding: 0 13px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(180deg, var(--hog-chat-gold-light), var(--hog-chat-gold));
  color: #17120a;
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.hog-ai-send:disabled { opacity: .55; cursor: wait; }

.hog-ai-safety {
  margin: 0;
  padding: 0 12px 10px;
  background: #101011;
  color: #89857c;
  font-size: 9.5px;
  line-height: 1.35;
}

@media (max-width: 560px) {
  #hog-ai-chat-root {
    right: max(10px, env(safe-area-inset-right));
    bottom: max(10px, env(safe-area-inset-bottom));
  }
  .hog-ai-launcher { min-height: 50px; padding-right: 13px; }
  .hog-ai-launcher-label { font-size: 12px; }
  .hog-ai-panel {
    position: fixed;
    left: 8px;
    right: 8px;
    bottom: 70px;
    width: auto;
    height: min(610px, calc(100dvh - 86px));
  }
}

@media (prefers-reduced-motion: reduce) {
  .hog-ai-launcher:hover { transform: none; }
  .hog-ai-messages { scroll-behavior: auto; }
}
