:root {
  --bg: #0b0b10;
  --ink: #f4f1ff;
  --muted: #c7bfe4;
  --accent: #a88eff;
  --accent-2: #cba8f2;
  --border: #2a2340;
}

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

body {
  background: radial-gradient(
      1200px 600px at 10% -10%,
      rgba(138, 77, 255, 0.25),
      transparent 60%
    ),
    radial-gradient(
      900px 500px at 90% -20%,
      rgba(181, 140, 255, 0.2),
      transparent 60%
    ),
    var(--bg);
  color: var(--muted);
  font-family: "Space Grotesk", system-ui, sans-serif;
  line-height: 1.7;
}

.wrap {
  max-width: 800px;
  margin: 0 auto;
  padding: 56px 24px 64px;
}

.section-label {
  font-family: "IBM Plex Mono", monospace;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.hero {
  margin-bottom: 32px;
}

.badge {
  font-family: "IBM Plex Mono", monospace;
  font-size: 15px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-2);
  margin-bottom: 14px;
}

h1 {
  font-size: 48px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-bottom: 28px;
}

.hero-sub {
  font-size: 16px;
  line-height: 1.75;
  max-width: 620px;
  color: var(--muted);
  opacity: 0.86;
}

.divider {
  border: none;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--accent),
    transparent
  );
  opacity: 0.3;
  margin-bottom: 32px;
}

.panel {
  background: linear-gradient(
      180deg,
      rgba(21, 21, 34, 0.95),
      rgba(13, 13, 20, 0.95)
    ),
    radial-gradient(
      800px 400px at 20% 10%,
      rgba(138, 77, 255, 0.06),
      transparent 60%
    );
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 48px;
}

.panel-section {
  padding: 20px 0;
  border-top: 1px solid var(--border);
}

.panel-section:first-child {
  border-top: none;
  padding-top: 0;
}

.panel-section:last-child {
  padding-bottom: 0;
}

.panel h2 {
  font-family: "IBM Plex Mono", monospace;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.panel-section .helper {
  font-size: 12px;
  color: var(--muted);
  opacity: 0.6;
  margin: 0 0 10px 0;
}

/* ─── Stats grid ─── */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: linear-gradient(
      180deg,
      rgba(21, 21, 34, 0.95),
      rgba(13, 13, 20, 0.95)
    ),
    radial-gradient(
      800px 400px at 20% 10%,
      rgba(138, 77, 255, 0.06),
      transparent 60%
    );
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  transition: border-color 0.2s, transform 0.2s;
}

.stat-card:hover {
  border-color: rgba(168, 142, 255, 0.4);
  transform: translateY(-2px);
}

.stat-label {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 0.7;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

/* ─── Breakdown ─── */

.breakdown-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
}

.breakdown-item {
  display: grid;
  grid-template-columns: 140px 1fr 60px;
  align-items: center;
  gap: 12px;
  font-size: 14px;
}

.breakdown-item.skeleton {
  opacity: 0.5;
}

.breakdown-name {
  color: var(--muted);
  font-size: 13px;
}

.breakdown-bar {
  height: 6px;
  background: rgba(42, 35, 64, 0.6);
  border-radius: 3px;
  overflow: hidden;
}

.breakdown-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 3px;
  transition: width 0.6s ease;
}

.breakdown-count {
  text-align: right;
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
  color: var(--ink);
  font-weight: 500;
}

/* ─── Timeline ─── */

.timeline-chart {
  margin-top: 16px;
  min-height: 160px;
  display: flex;
  align-items: flex-end;
  gap: 4px;
  padding: 16px;
  background: rgba(8, 8, 12, 0.4);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.timeline-bar {
  flex: 1;
  min-width: 8px;
  background: linear-gradient(180deg, var(--accent), rgba(168, 142, 255, 0.3));
  border-radius: 3px 3px 0 0;
  transition: height 0.5s ease, opacity 0.2s;
  position: relative;
  cursor: pointer;
}

.timeline-bar:hover {
  opacity: 0.8;
}

.timeline-bar::after {
  content: attr(data-label);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  padding-bottom: 4px;
}

.timeline-bar:hover::after {
  opacity: 1;
}

.timeline-placeholder {
  width: 100%;
  text-align: center;
  color: var(--muted);
  opacity: 0.5;
  font-size: 14px;
  padding: 48px 0;
}

/* ─── Activity ─── */

.activity-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.activity-item {
  display: flex;
  gap: 16px;
  align-items: baseline;
  font-size: 14px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(8, 8, 12, 0.3);
  border: 1px solid transparent;
  transition: border-color 0.15s;
}

.activity-item:hover {
  border-color: var(--border);
}

.activity-item.skeleton {
  opacity: 0.5;
}

.activity-date {
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  color: var(--accent);
  white-space: nowrap;
  min-width: 90px;
}

.activity-text {
  color: var(--muted);
}

/* ─── Supabase status ─── */

#supabase-status-panel .helper {
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
}

#supabase-status-panel .helper.is-connected {
  color: #7ee787;
}

#supabase-status-panel .helper.is-error {
  color: #ff7a9a;
}

/* ─── Footer ─── */

.site-footer {
  text-align: center;
  font-size: 13px;
}

.footer-links {
  margin-bottom: 12px;
}

.footer-links a {
  color: var(--accent-2);
  text-decoration: none;
  transition: color 0.15s;
}

.footer-links a:hover {
  color: var(--ink);
}

.footer-sep {
  margin: 0 10px;
  color: var(--border);
}

/* ─── Responsive ─── */

@media (max-width: 640px) {
  .wrap {
    padding: 32px 16px 48px;
  }

  h1 {
    font-size: 34px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .stat-value {
    font-size: 22px;
  }

  .breakdown-item {
    grid-template-columns: 100px 1fr 50px;
    gap: 8px;
  }

  .timeline-chart {
    gap: 2px;
    padding: 12px;
  }

  .activity-item {
    flex-direction: column;
    gap: 4px;
  }

  .activity-date {
    min-width: auto;
  }
}
