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

:root {
  --bg: #0d1117;
  --surface: #161b22;
  --border: #30363d;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --accent: #58a6ff;
  --red: #f85149;
  --orange: #d29922;
  --green: #3fb950;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

header {
  text-align: center;
  padding: 2rem 1rem 1rem;
}

header h1 {
  font-size: 2rem;
  background: linear-gradient(135deg, var(--red), var(--orange));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  color: var(--text-muted);
  margin-top: 0.5rem;
  font-size: 0.95rem;
}

.controls {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
  padding: 1rem;
}

.filter-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 0.4rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s;
}

.filter-btn:hover {
  border-color: var(--accent);
  color: var(--text);
}

.filter-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

#chart-container {
  width: 100%;
  max-width: 960px;
  aspect-ratio: 16 / 10;
  position: relative;
  margin: 0 auto;
  padding: 0 1rem;
}

#bubble-canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: default;
}

.tooltip {
  position: fixed;
  z-index: 100;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  pointer-events: none;
  max-width: 280px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.tip-year {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-left: 0.5rem;
}

.tip-loss {
  color: var(--red);
  font-weight: 600;
  margin-top: 0.25rem;
  font-size: 1.1rem;
}

.tip-desc {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-top: 0.35rem;
  line-height: 1.4;
}

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

@media (max-width: 600px) {
  header h1 {
    font-size: 1.4rem;
  }
  #chart-container {
    aspect-ratio: 1 / 1;
  }
}
