#clubby-root {
  --clubby-green: #2bb673;
  --clubby-green-dark: #22c55e;
  --clubby-amber: #fbb040;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
}

#clubby-root * {
  box-sizing: border-box;
}

.clubby-launcher {
  position: fixed;
  bottom: max(1.5rem, env(safe-area-inset-bottom));
  right: max(1.5rem, env(safe-area-inset-right));
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 9999px;
  background: #fff;
  border: 1px solid #e5e7eb;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.2rem;
  overflow: hidden;
  cursor: pointer;
  z-index: 99999;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.clubby-launcher:hover {
  transform: scale(1.08);
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.22);
}

.clubby-launcher img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.clubby-launcher.is-shaking {
  animation: clubby-shake 0.5s;
}

@keyframes clubby-shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-3px); }
  40%, 80% { transform: translateX(3px); }
}

.clubby-panel {
  position: fixed;
  bottom: max(1.5rem, env(safe-area-inset-bottom));
  right: max(1.5rem, env(safe-area-inset-right));
  width: min(24rem, calc(100vw - 2rem));
  height: min(37.5rem, calc(100vh - 3rem));
  background: #fff;
  border: 2px solid #e5e7eb;
  border-radius: 1rem;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 99999;
}

.clubby-panel.is-minimized {
  height: auto;
}

.clubby-header {
  background: linear-gradient(90deg, var(--clubby-green), var(--clubby-green-dark));
  color: #fff;
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.clubby-header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.clubby-avatar-wrap {
  position: relative;
  flex-shrink: 0;
}

.clubby-avatar {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 9999px;
  background: #fff;
  border: 1px solid #e5e7eb;
  padding: 0.15rem;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.clubby-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.clubby-online {
  position: absolute;
  bottom: -0.15rem;
  right: -0.15rem;
  width: 0.75rem;
  height: 0.75rem;
  background: var(--clubby-amber);
  border: 2px solid var(--clubby-green);
  border-radius: 9999px;
}

.clubby-title {
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1.2;
}

.clubby-subtitle {
  font-size: 0.75rem;
  opacity: 0.85;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.clubby-header-actions {
  display: flex;
  gap: 0.25rem;
}

.clubby-icon-btn {
  background: transparent;
  border: 0;
  color: #fff;
  width: 2rem;
  height: 2rem;
  border-radius: 0.4rem;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
}

.clubby-icon-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

.clubby-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.clubby-panel.is-minimized .clubby-messages,
.clubby-panel.is-minimized .clubby-composer {
  display: none;
}

.clubby-bubble {
  max-width: 85%;
  padding: 0.7rem 0.9rem;
  border-radius: 0.9rem;
  font-size: 0.9rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.clubby-bubble.user {
  align-self: flex-end;
  background: var(--clubby-green);
  color: #fff;
  border-bottom-right-radius: 0.25rem;
}

.clubby-bubble.clubby {
  align-self: flex-start;
  background: #fff;
  color: #111827;
  border: 1px solid #e5e7eb;
  border-bottom-left-radius: 0.25rem;
}

.clubby-bubble.clubby a {
  color: #15803d;
  text-decoration: underline;
  word-break: break-word;
}

.clubby-bubble.clubby a:hover {
  color: #166534;
}

.clubby-bubble.clubby strong {
  font-weight: 700;
}

.clubby-typing {
  align-self: flex-start;
  color: #6b7280;
  font-size: 0.85rem;
  padding: 0.25rem 0.5rem;
}

.clubby-composer {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem;
  border-top: 1px solid #e5e7eb;
  background: #fff;
}

.clubby-composer input {
  flex: 1;
  border: 1px solid #d1d5db;
  border-radius: 0.6rem;
  padding: 0.65rem 0.8rem;
  font-size: 0.9rem;
  outline: none;
}

.clubby-composer input:focus {
  border-color: var(--clubby-green);
  box-shadow: 0 0 0 3px rgba(43, 182, 115, 0.15);
}

.clubby-composer button {
  border: 0;
  background: var(--clubby-green);
  color: #fff;
  border-radius: 0.6rem;
  padding: 0 0.95rem;
  font-weight: 600;
  cursor: pointer;
}

.clubby-composer button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
