@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700&display=swap');

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

body {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  background: #0a0a0a;
  color: #c0c0c0;
  height: 100vh;
  overflow: hidden;
  font-size: 13px;
}

.hidden { display: none !important; }

::selection { background: #ffffff33; color: #fff; }

/* ---- Auth Screen ---- */
#auth-screen {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0a0a0a;
}

.auth-card {
  background: #0e0e0e;
  border: 1px solid #1a1a1a;
  border-radius: 4px;
  padding: 32px;
  width: 400px;
  max-width: 95vw;
}

.logo {
  color: #ffffff;
  font-size: 12px;
  text-align: center;
  margin-bottom: 24px;
  line-height: 1.2;
}

.auth-tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 20px;
  border-bottom: 1px solid #1a1a1a;
}

.auth-tab {
  flex: 1;
  padding: 8px;
  background: transparent;
  border: none;
  color: #555;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  cursor: pointer;
  transition: color 0.2s;
  border-bottom: 2px solid transparent;
}

.auth-tab:hover { color: #888; }
.auth-tab.active { color: #ffffff; border-bottom-color: #ffffff; }

.auth-form { display: flex; flex-direction: column; gap: 10px; }

.input-row {
  display: flex;
  align-items: center;
  background: #0a0a0a;
  border: 1px solid #1a1a1a;
  border-radius: 2px;
  padding: 0 12px;
}

.prompt {
  color: #666;
  font-weight: 700;
  margin-right: 8px;
  flex-shrink: 0;
}

.input-row input {
  flex: 1;
  padding: 10px 0;
  background: transparent;
  border: none;
  color: #e0e0e0;
  font-family: inherit;
  font-size: 13px;
  outline: none;
}

.input-row input::placeholder { color: #333; }

.action-btn {
  padding: 10px;
  background: #ffffff10;
  border: 1px solid #ffffff25;
  border-radius: 2px;
  color: #ffffff;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1px;
  cursor: pointer;
  transition: background 0.2s;
  margin-top: 4px;
}

.action-btn:hover { background: #ffffff20; }

.error-msg {
  margin-top: 10px;
  padding: 8px;
  background: #ff000015;
  border: 1px solid #ff000033;
  border-radius: 2px;
  color: #ff4444;
  font-size: 12px;
}

/* ---- App Layout ---- */
#app { display: flex; height: 100vh; }

/* ---- Sidebar ---- */
#sidebar {
  width: 220px;
  background: #0c0c0c;
  border-right: 1px solid #1a1a1a;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

#server-header {
  padding: 14px 16px;
  font-size: 13px;
  font-weight: 700;
  color: #ffffff;
  border-bottom: 1px solid #1a1a1a;
  letter-spacing: 1px;
}

.channel-section { padding: 10px 0 4px; }

.channel-section-title {
  padding: 0 14px 6px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1px;
  color: #333;
}

.channel-item {
  display: flex;
  align-items: center;
  padding: 5px 14px;
  cursor: pointer;
  color: #555;
  font-size: 12px;
  transition: color 0.1s, background 0.1s;
  gap: 6px;
}

.channel-item:hover { background: #111; color: #999; }
.channel-item.active { background: #111; color: #ffffff; }

.channel-item .ch-icon { color: #333; flex-shrink: 0; width: 16px; }
.channel-item.active .ch-icon { color: #ffffff; }

.voice-channel-users { padding-left: 36px; }
.voice-channel-user {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 0;
  font-size: 11px;
  color: #444;
}

.voice-channel-user .vc-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #333;
  flex-shrink: 0;
}

.voice-channel-user.speaking .vc-dot { background: #22c55e; box-shadow: 0 0 4px #22c55e; }

/* Online users in sidebar */
#online-users { padding: 0 14px; }
.online-user {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 0;
  font-size: 11px;
  color: #555;
}

.online-user .online-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #888;
  flex-shrink: 0;
}

.online-user .guest-tag {
  color: #555;
  font-size: 9px;
  cursor: help;
}

.online-user .admin-tag {
  color: #ff6600;
  font-size: 9px;
}

/* User panel */
#user-panel {
  margin-top: auto;
  padding: 8px 10px;
  background: #080808;
  border-top: 1px solid #1a1a1a;
}

#user-panel-info {
  display: flex;
  align-items: center;
  gap: 6px;
}

#user-panel-name {
  color: #ffffff;
  font-weight: 500;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#user-panel-tag {
  font-size: 9px;
  color: #555;
  flex: 1;
}

#user-panel button {
  width: 28px;
  height: 28px;
  border-radius: 2px;
  border: 1px solid #1a1a1a;
  background: #0e0e0e;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, border-color 0.2s;
  flex-shrink: 0;
}

#user-panel button:hover { background: #1a1a1a; border-color: #333; }
#user-panel button svg { fill: #555; }
#user-panel button:hover svg { fill: #999; }
#mute-btn.muted { background: #330000; border-color: #ff4444; }
#mute-btn.muted svg { fill: #ff4444; }
#disconnect-voice-btn { border-color: #331111; }
#disconnect-voice-btn:hover { background: #330000; border-color: #ff4444; }
#disconnect-voice-btn svg { fill: #ff4444; }
#admin-btn:hover { border-color: #ff6600; }
#admin-btn:hover svg { fill: #ff6600; }

/* ---- Main Content ---- */
#main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

#text-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#text-header {
  padding: 10px 20px;
  border-bottom: 1px solid #1a1a1a;
  background: #0c0c0c;
  flex-shrink: 0;
}

#text-channel-name {
  font-weight: 600;
  font-size: 13px;
  color: #ffffff;
  letter-spacing: 0.5px;
}

/* Messages */
#messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px 20px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.message { padding: 3px 0; }
.message-header { display: flex; align-items: baseline; gap: 8px; }

.message-time {
  font-size: 10px;
  color: #333;
  flex-shrink: 0;
}

.message-author {
  font-weight: 600;
  font-size: 12px;
}

.message-author .guest-label {
  color: #555;
  font-weight: 400;
  font-size: 10px;
}

.message-text {
  font-size: 13px;
  color: #aaa;
  line-height: 1.4;
  word-wrap: break-word;
  padding-left: 0;
}

.message-text a { color: #4a9eff; text-decoration: none; }
.message-text a:hover { text-decoration: underline; }

/* URL Preview */
.url-preview {
  margin-top: 4px;
  max-width: 400px;
  background: #0e0e0e;
  border-left: 2px solid #4a9eff;
  border-radius: 2px;
  padding: 8px 10px;
  display: flex;
  gap: 10px;
}

.url-preview-body { flex: 1; min-width: 0; }
.url-preview-site { font-size: 10px; color: #444; margin-bottom: 2px; }
.url-preview-title { font-size: 12px; font-weight: 600; color: #4a9eff; margin-bottom: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.url-preview-title a { color: #4a9eff; text-decoration: none; }
.url-preview-title a:hover { text-decoration: underline; }
.url-preview-desc { font-size: 11px; color: #666; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.url-preview-image { width: 50px; height: 50px; border-radius: 2px; object-fit: cover; flex-shrink: 0; }

/* Message input */
#message-input-container {
  padding: 10px 20px 14px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

#message-input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid #1a1a1a;
  border-radius: 2px;
  background: #0e0e0e;
  color: #e0e0e0;
  font-family: inherit;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
}

#message-input:focus { border-color: #ffffff40; }
#message-input::placeholder { color: #333; }

/* ---- Admin Panel ---- */
#admin-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#admin-header {
  padding: 10px 20px;
  border-bottom: 1px solid #1a1a1a;
  background: #0c0c0c;
  font-weight: 600;
  font-size: 13px;
  color: #ff6600;
  letter-spacing: 0.5px;
}

#admin-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}

.admin-section { margin-bottom: 24px; }
.admin-section h3 { color: #ff6600; font-size: 11px; letter-spacing: 1px; margin-bottom: 8px; }

.admin-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.admin-row input {
  flex: 1;
  padding: 6px 10px;
  background: #0e0e0e;
  border: 1px solid #1a1a1a;
  border-radius: 2px;
  color: #e0e0e0;
  font-family: inherit;
  font-size: 12px;
  outline: none;
}

.admin-row button, .admin-item button {
  padding: 4px 10px;
  background: #0e0e0e;
  border: 1px solid #1a1a1a;
  border-radius: 2px;
  color: #888;
  font-family: inherit;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s;
}

.admin-row button:hover, .admin-item button:hover { border-color: #ff6600; color: #ff6600; }

.admin-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 0;
  font-size: 12px;
  color: #888;
  border-bottom: 1px solid #0e0e0e;
}

.admin-item .admin-name { color: #ccc; flex: 1; }
.admin-item .admin-meta { color: #444; font-size: 10px; }
.admin-item .admin-badge { color: #ff6600; font-size: 10px; }

.admin-item button.danger { border-color: #331111; color: #ff4444; }
.admin-item button.danger:hover { border-color: #ff4444; background: #1a0000; }

/* ---- Voice Overlay ---- */
#voice-overlay {
  border-top: 1px solid #1a1a1a;
  background: #0c0c0c;
  flex-shrink: 0;
  max-height: 220px;
  overflow-y: auto;
}

#voice-overlay-header {
  padding: 6px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #111;
}

#voice-channel-label { font-size: 11px; font-weight: 600; color: #ffffff; letter-spacing: 0.5px; }

#mic-meter-container { display: flex; align-items: center; gap: 6px; }
#mic-meter-container > label { font-size: 9px; color: #333; letter-spacing: 1px; }

#mic-meter-wrapper { width: 80px; position: relative; height: 4px; }
#mic-meter { width: 100%; height: 100%; background: #1a1a1a; border-radius: 2px; overflow: hidden; }
#mic-meter-fill { height: 100%; width: 0%; background: #ffffff; border-radius: 2px; transition: width 0.05s linear; }
#threshold-marker { position: absolute; top: -2px; width: 2px; height: 8px; background: #ff4444; border-radius: 1px; left: 30%; pointer-events: none; }

#threshold-control { display: flex; align-items: center; gap: 3px; }
#threshold-control label { font-size: 9px; color: #333; letter-spacing: 0.5px; }

#threshold-slider { width: 40px; height: 2px; -webkit-appearance: none; appearance: none; background: #1a1a1a; border-radius: 1px; outline: none; }
#threshold-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 8px; height: 8px; border-radius: 50%; background: #ff4444; cursor: pointer; }
#threshold-slider::-moz-range-thumb { width: 8px; height: 8px; border-radius: 50%; background: #ff4444; border: none; cursor: pointer; }
#threshold-value { font-size: 9px; color: #333; min-width: 14px; text-align: center; }

#voice-users { padding: 6px 20px; display: flex; flex-wrap: wrap; gap: 6px; }

.voice-user-card {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: #0e0e0e;
  border: 1px solid #1a1a1a;
  border-radius: 2px;
  transition: border-color 0.2s;
}

.voice-user-card.speaking { border-color: #22c55e; }

.voice-user-dot { width: 8px; height: 8px; border-radius: 50%; background: #333; flex-shrink: 0; }
.voice-user-card.speaking .voice-user-dot { background: #22c55e; box-shadow: 0 0 6px #22c55e; }
.voice-user-name { font-size: 12px; font-weight: 500; color: #999; }
.voice-user-card.speaking .voice-user-name { color: #22c55e; }

.voice-user-volume { display: flex; align-items: center; gap: 3px; margin-left: 4px; }
.voice-user-volume svg { fill: #333; }

.volume-slider { width: 50px; height: 2px; -webkit-appearance: none; appearance: none; background: #1a1a1a; border-radius: 1px; outline: none; }
.volume-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 8px; height: 8px; border-radius: 50%; background: #555; cursor: pointer; }
.volume-slider::-moz-range-thumb { width: 8px; height: 8px; border-radius: 50%; background: #555; border: none; cursor: pointer; }
.volume-value { font-size: 9px; color: #333; min-width: 24px; text-align: right; }

.speaking-indicator { display: none; gap: 2px; align-items: center; height: 12px; }
.voice-user-card.speaking .speaking-indicator { display: flex; }
.speaking-indicator span { display: block; width: 2px; height: 5px; background: #22c55e; border-radius: 1px; animation: speak 0.6s ease-in-out infinite; }
.speaking-indicator span:nth-child(2) { animation-delay: 0.1s; height: 10px; }
.speaking-indicator span:nth-child(3) { animation-delay: 0.2s; height: 7px; }
@keyframes speak { 0%, 100% { transform: scaleY(0.5); } 50% { transform: scaleY(1); } }

#audio-container { display: none; }

::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #1a1a1a; border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: #333; }

/* Author colors - neutral palette */
.author-0 { color: #ffffff; }
.author-1 { color: #ff6b9d; }
.author-2 { color: #6bb5ff; }
.author-3 { color: #ffaa55; }
.author-4 { color: #bf7fff; }
.author-5 { color: #ffcc00; }
.author-6 { color: #ff6666; }
.author-7 { color: #77dddd; }
