:root {
  --bg-dark: #0f0f12;
  --bg-card: #18181c;
  --bg-input: #222228;
  --accent: #3b82f6;
  --accent-dim: rgba(59, 130, 246, 0.15);
  --text: #e8e8ed;
  --text-muted: #8b8b96;
  --border: #2a2a32;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Outfit', sans-serif;
  background: var(--bg-dark);
  color: var(--text);
  margin: 0;
  min-height: 600px;
}

/* Chat widget - 360px × 600px */
#chat-widget {
  display: flex;
  flex-direction: column;
  width: 360px;
  height: 600px;
  min-height: 600px;
  background: var(--bg-dark);
}

.chat-header {
  padding: 0.75rem 1rem;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.status-indicator {
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.1); }
}

.chat-header h2 {
  font-size: 1rem;
  font-weight: 600;
  flex: 1;
}

.user-count {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.chat-rules {
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 0.25rem 1rem 0.5rem;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}

.admin-panel {
  display: flex;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--bg-input);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.admin-panel input {
  flex: 1;
  font-size: 0.85rem;
  padding: 0.4rem 0.6rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
}

.admin-panel button {
  font-size: 0.85rem;
  padding: 0.4rem 0.8rem;
  background: var(--accent);
  color: var(--bg-dark);
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

.admin-panel button:hover {
  opacity: 0.9;
}

/* Messages - fills space above register */
.messages {
  flex: 1;
  min-height: 400px;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  background: var(--bg-dark);
}

/* Live chat feed - username: message, all left-aligned, NO bubbles */
.message {
  font-size: 0.9rem;
  line-height: 1.5;
  padding: 0.2rem 0;
  word-break: break-word;
  text-align: left;
  align-self: flex-start;
  width: 100%;
  max-width: 100%;
  animation: fadeIn 0.2s ease;
}


@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.message-username {
  color: var(--accent);
  font-weight: 600;
}

.message-text {
  color: var(--text);
}

/* Admin announcements - green */
.message-admin .message-username,
.message-admin .message-text {
  color: #22c55e;
  font-weight: 600;
}

.message-admin .message-text a {
  color: #4ade80;
  text-decoration: underline;
}

.message-admin .message-text a:hover {
  color: #86efac;
}

/* Username form - below chat */
.username-form {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.username-form input {
  flex: 1;
  font-family: inherit;
  font-size: 0.9rem;
  padding: 0.6rem 0.9rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
}

.username-form input:focus {
  outline: none;
  border-color: var(--accent);
}

.username-form input::placeholder {
  color: var(--text-muted);
}

.username-form button {
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.6rem 1.25rem;
  background: var(--accent);
  color: var(--bg-dark);
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

.username-form button:hover {
  opacity: 0.9;
}

.username-form.hidden {
  display: none !important;
}

/* Message form - appears after register */
.message-form {
  padding: 0.75rem 1rem 1rem;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  display: flex;
  gap: 0.5rem;
  position: relative;
  flex-shrink: 0;
}

.message-form input {
  flex: 1;
  font-family: inherit;
  font-size: 0.95rem;
  padding: 0.7rem 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
}

.message-form input:focus {
  outline: none;
  border-color: var(--accent);
}

.message-form input::placeholder {
  color: var(--text-muted);
}

.message-form button {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: var(--bg-dark);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  flex-shrink: 0;
}

.message-form button:hover {
  opacity: 0.9;
}

#emoji-btn {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 1.2rem;
}

#emoji-btn:hover {
  border-color: var(--accent);
}

.hidden {
  display: none !important;
}

/* Emoji picker */
.emoji-picker {
  position: absolute;
  bottom: 100%;
  right: 1rem;
  margin-bottom: 0.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.6rem;
  max-height: 180px;
  overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 0.2rem;
}

.emoji-item {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 6px;
  font-size: 1.1rem;
  cursor: pointer;
}

.emoji-item:hover {
  background: var(--bg-input);
}

/* Scrollbar */
.messages::-webkit-scrollbar {
  width: 6px;
}

.messages::-webkit-scrollbar-track {
  background: transparent;
}

.messages::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}
