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

:root {
  --bg: #0f0f12;
  --surface: #18181d;
  --surface-hover: #1f1f26;
  --border: #2a2a32;
  --text: #e8e8ed;
  --text-muted: #8b8b98;
  --accent: #6366f1;
  --accent-dim: #4f46e5;
  --success: #22c55e;
  --error: #ef4444;
  --previous: #a78bfa;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

header {
  text-align: center;
  padding: 2.5rem 1rem 1.5rem;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.site-logo {
  width: 56px;
  height: 56px;
  margin-bottom: 10px;
  border-radius: 12px;
}

.server-badge {
  margin-top: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
}

.server-badge .server-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.server-badge.connected {
  background: rgba(34, 197, 94, 0.15);
  color: var(--success);
}

.server-badge.connected .server-dot {
  background: var(--success);
  animation: pulse 2s ease-in-out infinite;
}

.server-badge.disconnected {
  background: rgba(239, 68, 68, 0.15);
  color: var(--error);
}

.server-badge.disconnected .server-dot {
  background: var(--error);
}

.server-badge:not(.connected):not(.disconnected) {
  background: rgba(139, 139, 152, 0.15);
  color: var(--text-muted);
}

.server-badge:not(.connected):not(.disconnected) .server-dot {
  background: var(--text-muted);
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

h1 {
  font-size: 1.95rem;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.02em;
}

.subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0.25rem 0 0;
}

main {
  flex: 1;
  width: 100%;
  max-width: 680px;
  padding: 0 1.5rem 2rem;
  display: flex;
  flex-direction: column;
}

#search-wrap {
  margin-bottom: 1rem;
}

#search {
  width: 100%;
  padding: 0.6rem 1rem;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  transition: border-color 0.2s;
}

#search::placeholder {
  color: var(--text-muted);
}

#search:focus {
  border-color: var(--accent);
}

.search-empty {
  color: var(--text-muted);
  font-size: 0.9rem;
  text-align: center;
  padding: 2rem;
  margin: 0;
}

#disconnected {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.connect-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
}

.connect-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  border: 4px solid rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.08);
  color: var(--error);
  cursor: pointer;
  transition: all 0.25s ease;
  font-family: inherit;
  font-size: 1.25rem;
  font-weight: 600;
}

.connect-btn:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: var(--error);
  transform: scale(1.02);
}

.connect-btn.connected {
  border-color: rgba(34, 197, 94, 0.5);
  background: rgba(34, 197, 94, 0.12);
  color: var(--success);
  cursor: default;
}

.connect-btn.connected:hover {
  transform: none;
}

.connect-btn-circle {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: currentColor;
  margin-bottom: 8px;
  opacity: 0.9;
}

.connect-btn.connected .connect-btn-circle {
  animation: pulse 2s ease-in-out infinite;
}

.connect-btn.connecting {
  pointer-events: none;
  opacity: 0.8;
}

.connect-hint {
  margin-top: 1.5rem;
  font-size: 0.95rem;
  color: var(--text-muted);
  max-width: 280px;
  line-height: 1.5;
}

.connect-download-link {
  margin-top: 1rem;
  font-size: 0.9rem;
  color: var(--accent);
  text-decoration: none;
}

.connect-download-link:hover {
  text-decoration: underline;
}

#loading {
  text-align: center;
  color: var(--text-muted);
  padding: 2rem;
}

#error {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--error);
  padding: 1rem 1.25rem;
  border-radius: 10px;
  font-size: 0.9rem;
}

#profiles {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.profile-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.25rem 1.5rem;
  transition: border-color 0.2s, background 0.2s;
}

.profile-card:hover {
  background: var(--surface-hover);
  border-color: #36363f;
}

.profile-info {
  flex: 1;
  min-width: 0;
}

.open-btn {
  flex-shrink: 0;
  padding: 0.5rem 1rem;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
  background: var(--accent);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
}

.open-btn:hover:not(:disabled) {
  background: var(--accent-dim);
}

.open-btn:disabled {
  opacity: 0.7;
  cursor: default;
}

.profile-name {
  font-weight: 500;
  font-size: 1.05rem;
  margin: 0 0 0.25rem;
}

.profile-id {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin: 0 0 0.5rem;
}

.profile-accounts {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.profile-email {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--accent);
}

.profile-email.has-email {
  color: var(--success);
}

.profile-email.no-email {
  color: var(--text-muted);
  font-style: italic;
}

.profile-email.previous-email {
  color: var(--text-muted);
  font-style: italic;
}

.profile-email svg {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
}

.email-tag {
  display: inline-block;
  font-size: 0.65rem;
  font-style: normal;
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 6px;
  vertical-align: middle;
}

.email-tag.signed-out {
  background: rgba(239, 68, 68, 0.12);
  color: var(--error);
}

.hidden {
  display: none !important;
}

.ad-container {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
}

footer {
  padding: 1rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.75rem;
}
