/* FrenZY Chat Widget */
.frenzy-chat-fab {
  position: fixed;
  bottom: max(16px, env(safe-area-inset-bottom));
  right: max(12px, env(safe-area-inset-right));
  z-index: 9998;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}
.frenzy-chat-fab[hidden] {
  display: none !important;
}
.frenzy-chat-cue {
  font-family: 'Righteous', cursive;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  color: #fff;
  background: rgba(0, 0, 0, 0.78);
  border: 1px solid rgba(255, 10, 132, 0.55);
  border-radius: 999px;
  padding: 0.28rem 0.7rem;
  white-space: nowrap;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}
.frenzy-chat-btn {
  position: relative;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: url('/img/amos-bar.png') no-repeat center center / cover;
  border: 3px solid #ff0a84;
  color: transparent;
  font-size: 0;
  cursor: pointer;
  box-shadow: 0 4px 22px rgba(255, 10, 132, 0.7), 0 0 0 3px rgba(10, 255, 212, 0.25);
  transition: transform 0.2s;
}

.frenzy-chat-btn:hover {
  transform: scale(1.05);
}

.frenzy-chat-drawer {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  width: min(400px, calc(100vw - 48px));
  height: var(--chat-drawer-height, min(420px, calc(100dvh - 48px)));
  max-height: var(--chat-drawer-max-height, min(72dvh, 680px));
  background: rgba(10, 10, 20, 0.98);
  border: 1px solid rgba(255, 10, 132, 0.3);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.frenzy-chat-drawer[hidden] {
  display: none;
}

.frenzy-chat-header {
  background: linear-gradient(135deg, #ff0a84, #9333ea);
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 0 0 auto;
}

.frenzy-chat-header h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
}

.frenzy-chat-header .subtitle {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  margin-top: 2px;
  opacity: 0.9;
}

.frenzy-chat-close {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s;
}

.frenzy-chat-close:hover {
  background: rgba(255, 255, 255, 0.15);
}

.frenzy-chat-log {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.frenzy-chat-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 12px;
  line-height: 1.4;
  font-size: 0.95rem;
}

.frenzy-chat-msg p {
  margin: 0;
}

.frenzy-chat-msg--tidbit {
  border-left: 3px solid rgba(255, 200, 80, 0.85);
}

.frenzy-chat-tidbit-media {
  display: block;
  max-width: 100%;
  margin-top: 8px;
  border-radius: 8px;
}

.frenzy-chat-tidbit-link {
  display: inline-block;
  margin-top: 8px;
  color: #ffd966;
  font-weight: 700;
  text-decoration: underline;
}

.frenzy-chat-sticker {
  display: block;
  width: 148px;
  height: auto;
  max-width: 70%;
  margin-top: 8px;
  background: transparent;
}

.frenzy-chat-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.frenzy-chat-action {
  display: inline-block;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 217, 102, 0.65);
  background: rgba(255, 10, 132, 0.28);
  color: #fff;
  font-weight: 700;
  font-size: 0.88rem;
  line-height: 1.2;
  text-decoration: none;
}

.frenzy-chat-action:hover,
.frenzy-chat-action:focus-visible {
  background: rgba(255, 10, 132, 0.45);
  outline: 2px solid #ffd966;
  outline-offset: 2px;
}

.frenzy-chat-msg--user {
  align-self: flex-end;
  background: rgba(255, 10, 132, 0.25);
  border: 1px solid rgba(255, 10, 132, 0.5);
  color: #fff;
}

.frenzy-chat-msg--bot {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #f1f5f9;
}

.frenzy-chat-form {
  flex: 0 0 auto;
  padding: 12px;
  background: rgba(0, 0, 0, 0.3);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  gap: 8px;
}

.frenzy-chat-input {
  flex: 1;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  font-size: 0.95rem;
}

.frenzy-chat-input:focus {
  outline: none;
  border-color: #0affd4;
  box-shadow: 0 0 0 2px rgba(10, 255, 212, 0.2);
}

.frenzy-chat-send {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  background: linear-gradient(135deg, #ff0a84, #9333ea);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s;
}

.frenzy-chat-send:hover {
  transform: scale(1.05);
}

html.frenzy-chat-scroll-lock,
html.frenzy-chat-scroll-lock body {
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
}

html.frenzy-chat-scroll-lock .frenzy-chat-drawer,
html.frenzy-chat-scroll-lock .frenzy-chat-fab {
  touch-action: auto;
}

html.frenzy-chat-scroll-lock .hero-gaga,
html.frenzy-chat-scroll-lock .hero-gaga-frame,
html.frenzy-chat-scroll-lock .bg,
html.frenzy-chat-scroll-lock .sparkle,
html.frenzy-chat-scroll-lock .orb,
html.frenzy-chat-scroll-lock .frenzy-float {
  animation-play-state: paused !important;
}

@media (max-width: 480px) {
  .frenzy-chat-fab {
    bottom: max(14px, env(safe-area-inset-bottom, 0px));
    right: max(10px, env(safe-area-inset-right, 0px));
  }

  .frenzy-chat-btn {
    width: 76px;
    height: 76px;
  }

  .frenzy-chat-drawer {
    top: auto;
    left: max(16px, env(safe-area-inset-left, 0px));
    right: max(16px, env(safe-area-inset-right, 0px));
    width: auto;
    height: var(--chat-drawer-height, 380px);
    max-height: var(--chat-drawer-max-height, calc(100dvh - 28px));
    bottom: var(--chat-drawer-bottom, max(16px, env(safe-area-inset-bottom, 0px)));
  }

  .frenzy-chat-log {
    flex: 1 1 0;
    min-height: 72px;
    max-height: none;
  }
}
