@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg: #070b14;
  --bg-card: rgba(15, 23, 42, 0.72);
  --bg-card-hover: rgba(20, 30, 52, 0.85);
  --border: rgba(148, 163, 184, 0.12);
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --accent-glow: rgba(99, 102, 241, 0.35);
  --success: #22c55e;
  --success-bg: rgba(34, 197, 94, 0.12);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.12);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.12);
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 24px 48px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% -10%, rgba(99, 102, 241, 0.22), transparent),
    radial-gradient(ellipse 60% 50% at 80% 110%, rgba(168, 85, 247, 0.15), transparent);
  pointer-events: none;
  z-index: 0;
}

.page {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}

.page-narrow { max-width: 440px; padding-top: 10vh; }

h1, h2, h3 { line-height: 1.25; font-weight: 700; }
h1 { font-size: 2rem; letter-spacing: -0.03em; }
h2 { font-size: 1.25rem; margin-bottom: 16px; }
h3 { font-size: 1rem; margin-bottom: 12px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.75rem; }

p { color: var(--text-muted); }

a { color: var(--accent-hover); text-decoration: none; }
a:hover { text-decoration: underline; }

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
}

.card + .card { margin-top: 20px; }

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.logo-icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--accent), #a855f7);
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 22px;
  box-shadow: 0 8px 24px var(--accent-glow);
}

.logo-text { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.02em; }
.logo-sub { font-size: 0.85rem; color: var(--text-muted); font-weight: 400; }

label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
}

input, textarea, select {
  width: 100%;
  padding: 12px 14px;
  margin-bottom: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(7, 11, 20, 0.6);
  color: var(--text);
  font: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

textarea { resize: vertical; min-height: 96px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, background 0.2s, box-shadow 0.2s;
}

.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  color: #fff;
  box-shadow: 0 8px 24px var(--accent-glow);
}

.btn-primary:hover:not(:disabled) { background: linear-gradient(135deg, var(--accent-hover), #8b5cf6); }

.btn-secondary {
  background: rgba(148, 163, 184, 0.1);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) { background: rgba(148, 163, 184, 0.16); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid transparent;
  padding: 8px 14px;
  font-size: 0.875rem;
}

.btn-ghost:hover { color: var(--text); background: rgba(148, 163, 184, 0.08); }

.btn-group { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-group .btn { flex: 1; min-width: 120px; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  backdrop-filter: blur(12px);
}

.stat-value {
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, #fff, var(--accent-hover));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-label { font-size: 0.875rem; color: var(--text-muted); margin-top: 4px; }

.header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
  flex-wrap: wrap;
  gap: 16px;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #a855f7);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.875rem;
  color: #fff;
}

.site-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; min-height: 36px; }

.site-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 500;
  background: rgba(148, 163, 184, 0.08);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}

.site-tag:hover { border-color: var(--accent); background: rgba(99, 102, 241, 0.1); }
.site-tag.selected { background: var(--accent); border-color: var(--accent); color: #fff; }
.site-tag .count { opacity: 0.7; font-size: 0.75rem; }

.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

@media (max-width: 640px) {
  .row-2 { grid-template-columns: 1fr; }
  h1 { font-size: 1.5rem; }
}

.result-box {
  background: rgba(7, 11, 20, 0.5);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 0.8125rem;
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 72px;
  color: var(--text-muted);
}

.result-box.success { border-color: rgba(34, 197, 94, 0.3); background: var(--success-bg); color: #86efac; }
.result-box.error { border-color: rgba(239, 68, 68, 0.3); background: var(--danger-bg); color: #fca5a5; }

.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  margin-bottom: 18px;
}

.alert-error { background: var(--danger-bg); border: 1px solid rgba(239, 68, 68, 0.25); color: #fca5a5; }
.alert-success { background: var(--success-bg); border: 1px solid rgba(34, 197, 94, 0.25); color: #86efac; }
.alert-info { background: rgba(99, 102, 241, 0.1); border: 1px solid rgba(99, 102, 241, 0.25); color: #c7d2fe; }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 20px;
}

.status-pill.ok { background: var(--success-bg); color: #86efac; border: 1px solid rgba(34, 197, 94, 0.25); }
.status-pill.warn { background: var(--warning-bg); color: #fcd34d; border: 1px solid rgba(245, 158, 11, 0.25); }
.status-pill.err { background: var(--danger-bg); color: #fca5a5; border: 1px solid rgba(239, 68, 68, 0.25); }

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

pre.code-block {
  background: rgba(7, 11, 20, 0.6);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  overflow-x: auto;
  font-size: 0.8125rem;
  line-height: 1.7;
  color: #c7d2fe;
  margin-top: 12px;
}

.hero { text-align: center; padding: 48px 0 32px; }
.hero h1 { font-size: 2.75rem; margin-bottom: 16px; }
.hero p { font-size: 1.125rem; max-width: 520px; margin: 0 auto 32px; }

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  margin: 40px 0;
}

.feature {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  backdrop-filter: blur(12px);
}

.feature-icon { font-size: 1.75rem; margin-bottom: 12px; }
.feature h3 { text-transform: none; letter-spacing: 0; font-size: 1rem; color: var(--text); margin-bottom: 8px; }
.feature p { font-size: 0.875rem; }

.nav-links { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 24px; }
.nav-links .btn { min-width: 160px; }

.hidden { display: none !important; }

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.login-footer {
  text-align: center;
  margin-top: 24px;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.empty-state {
  color: var(--text-muted);
  font-size: 0.875rem;
  font-style: italic;
}

.embed-hint {
  margin-top: 12px;
  font-size: 0.8125rem;
  color: var(--text-muted);
}
