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

:root {
  --bg-primary: #0b0d11;
  --bg-secondary: #12151c;
  --bg-card: #161a24;
  --bg-card-hover: #1c2030;
  --border: #242838;
  --text-primary: #e8eaed;
  --text-secondary: #8a8f98;
  --text-muted: #555a64;
  --green: #00c853;
  --amber: #ffab00;
  --red: #ff1744;
  --font-body: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
  --radius: 12px;
  --radius-sm: 8px;
}

html {
  font-size: 15px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  background: var(--bg-primary);
}

a {
  color: var(--green);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

/* Navbar */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(11, 13, 17, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-icon {
  font-size: 1.4rem;
}
.brand-text {
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
}
.nav-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}
.update-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--green);
  font-weight: 500;
}
.pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* Container */
.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}
.card-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 20px;
}
.card-header h2 {
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.card-subtitle {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* Hero Card */
.hero-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px;
  min-height: 180px;
  position: relative;
  overflow: hidden;
}
.hero-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--green);
  transition: background 0.4s ease;
}
.hero-card.cloudy::before { background: var(--amber); }
.hero-card.stormy::before { background: var(--red); }

.hero-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  height: 120px;
  color: var(--text-secondary);
}
.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

.hero-content {
  display: flex;
  align-items: center;
  gap: 28px;
}
.hero-icon {
  font-size: 4.5rem;
  line-height: 1;
  filter: drop-shadow(0 0 24px rgba(0, 200, 83, 0.3));
  transition: filter 0.4s ease;
}
.hero-card.cloudy .hero-icon { filter: drop-shadow(0 0 24px rgba(255, 171, 0, 0.3)); }
.hero-card.stormy .hero-icon { filter: drop-shadow(0 0 24px rgba(255, 23, 68, 0.4)); }

.hero-info {
  flex: 1;
}
.hero-level {
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--green);
  transition: color 0.4s ease;
}
.hero-card.cloudy .hero-level { color: var(--amber); }
.hero-card.stormy .hero-level { color: var(--red); }

.hero-label {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-top: 2px;
}
.hero-pills {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 500;
  font-family: var(--font-mono);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
}
.pill.critical { color: var(--red); border-color: rgba(255, 23, 68, 0.3); }
.pill.high { color: var(--amber); border-color: rgba(255, 171, 0, 0.3); }
.pill.unfixed { color: #ff6e40; border-color: rgba(255, 110, 64, 0.3); }

.hero-summary {
  margin-top: 10px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.hero-score {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 80px;
}
.score-number {
  font-size: 2.8rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--green);
  line-height: 1;
  transition: color 0.4s ease;
}
.hero-card.cloudy .score-number { color: var(--amber); }
.hero-card.stormy .score-number { color: var(--red); }
.score-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 4px;
}

/* Chart */
.chart-container {
  position: relative;
  width: 100%;
  overflow-x: auto;
}
#historyChart {
  width: 100%;
  height: 200px;
}
.chart-legend {
  display: flex;
  gap: 20px;
  margin-top: 12px;
  font-size: 0.75rem;
  color: var(--text-secondary);
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}
.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

/* CVE List */
.cve-list {
  max-height: 500px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cve-list::-webkit-scrollbar {
  width: 6px;
}
.cve-list::-webkit-scrollbar-track {
  background: transparent;
}
.cve-list::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.cve-loading {
  text-align: center;
  color: var(--text-secondary);
  padding: 32px;
}

.cve-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  border: 1px solid transparent;
  transition: border-color 0.2s, background 0.2s;
}
.cve-item:hover {
  border-color: var(--border);
  background: var(--bg-card-hover);
}

.cve-score-badge {
  min-width: 44px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  font-family: var(--font-mono);
  color: #fff;
  flex-shrink: 0;
}
.cve-score-badge.critical { background: var(--red); }
.cve-score-badge.high { background: var(--amber); color: #1a1a1a; }

.cve-body {
  flex: 1;
  min-width: 0;
}
.cve-top-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.cve-id {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-primary);
}
.cve-id:hover {
  color: var(--green);
}
.cve-ecosystem-tag {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(108, 138, 255, 0.12);
  color: #6c8aff;
  font-weight: 500;
}
.cve-fix-status {
  font-size: 0.72rem;
  font-weight: 500;
}
.cve-fix-status.fixed { color: var(--green); }
.cve-fix-status.unfixed { color: var(--red); }

.cve-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-top: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.cve-time {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.cve-empty {
  text-align: center;
  color: var(--text-secondary);
  padding: 40px 20px;
  font-size: 0.9rem;
}

/* Share Section */
.share-row {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.share-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}
.btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--text-muted);
}
.btn-icon {
  font-size: 1rem;
}

.share-preview {
  flex: 1;
  min-width: 280px;
}
.card-preview-img {
  width: 100%;
  max-width: 480px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  padding: 10px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.82rem;
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
  pointer-events: none;
  z-index: 200;
}
.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* Footer */
.footer {
  max-width: 960px;
  margin: 20px auto 40px;
  padding: 0 24px;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
}
.footer a {
  color: var(--text-secondary);
}
.footer a:hover {
  color: var(--text-primary);
}

/* Chart tooltip */
.chart-tooltip {
  position: absolute;
  padding: 8px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.75rem;
  color: var(--text-primary);
  pointer-events: none;
  z-index: 50;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  display: none;
}

/* Responsive */
@media (max-width: 640px) {
  .hero-content {
    flex-direction: column;
    text-align: center;
    gap: 16px;
  }
  .hero-pills {
    justify-content: center;
  }
  .hero-summary {
    text-align: center;
  }
  .hero-score {
    flex-direction: row;
    gap: 8px;
  }
  .share-row {
    flex-direction: column;
  }
  .nav-inner {
    padding: 12px 16px;
  }
  .container {
    padding: 16px;
  }
}
