:root {
  --bg: #000000;
  --bg-soft: #0a0a0a;
  --panel: rgba(8, 8, 8, 0.88);
  --panel-strong: rgba(14, 14, 14, 0.95);
  --border: rgba(207, 255, 4, 0.12);
  --border-subtle: rgba(255, 255, 255, 0.06);
  --text: #f0f0f0;
  --muted: #8a8a8a;
  --accent: #cfff04;
  --accent-dim: rgba(207, 255, 4, 0.15);
  --accent-soft: #7ec7a2;
  --accent-cool: #7aa6ff;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 12px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  font-family: "Space Grotesk", sans-serif;
  color: var(--text);
  background: #000;
}

/* ── Grid backdrop ───────────────────────────────────── */

.backdrop {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(207, 255, 4, 0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(207, 255, 4, 0.015) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.6), transparent 70%);
  pointer-events: none;
}

/* ── Shell ───────────────────────────────────────────── */

.shell {
  position: relative;
  width: min(1180px, calc(100vw - 40px));
  margin: 0 auto;
  padding: 48px 0 80px;
}

/* ── Hero ────────────────────────────────────────────── */

.hero,
.panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 32px 40px;
}

.hero h1,
.section-heading h2,
.chart-card h3 {
  margin: 0;
}

.hero h1 {
  font-size: clamp(2.2rem, 5vw, 4.2rem);
  line-height: 0.95;
  letter-spacing: -0.05em;
  max-width: 14ch;
  color: var(--text);
}

.hero h1 span {
  color: var(--accent);
}

.eyebrow {
  font-family: "IBM Plex Mono", monospace;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 500;
  margin-bottom: 12px;
  display: block;
}

.hero-copy {
  max-width: 52ch;
  color: var(--muted);
  line-height: 1.7;
  margin-top: 16px;
  font-size: 0.95rem;
}

.hero-meta {
  display: grid;
  gap: 14px;
  align-content: end;
  justify-items: end;
  width: min(420px, 100%);
}

.hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.hero-action {
  appearance: none;
  border: 1px solid rgba(207, 255, 4, 0.28);
  background: linear-gradient(180deg, rgba(207, 255, 4, 0.16), rgba(207, 255, 4, 0.05));
  color: var(--text);
  border-radius: 999px;
  padding: 10px 16px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.74rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, opacity 180ms ease;
}

.hero-action:hover,
.hero-action:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(207, 255, 4, 0.52);
}

.hero-action:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.hero-action--ghost {
  background: rgba(255, 255, 255, 0.02);
  border-color: var(--border-subtle);
  color: var(--muted);
}

.hero-action--small {
  padding: 8px 14px;
}

.refresh-config {
  display: grid;
  gap: 12px;
  width: 100%;
  padding: 16px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.03);
}

.refresh-field {
  display: grid;
  gap: 6px;
  text-align: left;
}

.refresh-field span {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.refresh-field input {
  width: 100%;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.45);
  color: var(--text);
  padding: 12px 14px;
  font: inherit;
}

.refresh-field input:focus {
  outline: none;
  border-color: rgba(207, 255, 4, 0.35);
  box-shadow: 0 0 0 3px rgba(207, 255, 4, 0.08);
}

.refresh-config__actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.muted[data-tone="error"] {
  color: #ffb49f;
}

.muted[data-tone="success"] {
  color: #cfff04;
}

.muted[data-tone="warning"] {
  color: #ffd272;
}

.muted[data-tone="progress"] {
  color: #8bdff1;
}

.muted a {
  color: inherit;
  text-decoration-color: currentColor;
}

.snapshot-status {
  justify-self: end;
  max-width: min(420px, 100%);
}

.snapshot-meta {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.45rem;
  position: relative;
}

.snapshot-hover {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.snapshot-trigger {
  cursor: help;
  transition: color 180ms ease, text-decoration-color 180ms ease;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-decoration-color: transparent;
  text-underline-offset: 0.22em;
}

.snapshot-hover:hover .snapshot-trigger,
.snapshot-hover:focus-within .snapshot-trigger {
  color: var(--text);
  text-decoration-color: rgba(207, 255, 4, 0.55);
}

.snapshot-separator {
  opacity: 0.6;
}

.snapshot-tooltip {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 20;
  width: min(420px, calc(100vw - 48px));
  padding: 12px 14px;
  border: 1px solid rgba(207, 255, 4, 0.18);
  border-radius: var(--radius-sm);
  background: rgba(7, 7, 7, 0.96);
  box-shadow: 0 22px 40px rgba(0, 0, 0, 0.45);
  line-height: 1.55;
  text-align: left;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease, visibility 180ms ease;
}

.snapshot-hover:hover .snapshot-tooltip,
.snapshot-hover:focus-within .snapshot-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.status-banner {
  display: grid;
  gap: 14px;
  margin-top: 20px;
  padding: 22px 24px;
  border: 1px solid rgba(255, 184, 77, 0.22);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(135deg, rgba(255, 184, 77, 0.08), rgba(255, 184, 77, 0.02)),
    var(--panel);
  box-shadow: var(--shadow);
}

.status-banner__header {
  display: grid;
  gap: 6px;
}

.status-banner__title {
  font-size: 1rem;
  letter-spacing: -0.01em;
}

.status-banner__list {
  display: grid;
  gap: 10px;
}

.status-banner__item {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
}

.status-banner__item strong {
  font-size: 0.92rem;
}

.status-banner__item span {
  color: var(--muted);
  line-height: 1.55;
  font-size: 0.86rem;
}

.status-banner__item--error {
  border-color: rgba(255, 108, 89, 0.25);
}

.status-banner__item--error strong {
  color: #ffb49f;
}

.status-banner__item--warning {
  border-color: rgba(255, 200, 87, 0.24);
}

.status-banner__item--warning strong {
  color: #ffd272;
}

/* ── Shared card base ────────────────────────────────── */

.meta-card,
.stat-card,
.mini-card,
.account-chip,
.post-row {
  border: 1px solid var(--border-subtle);
  background: var(--panel-strong);
  transition: border-color 220ms ease, transform 220ms ease, box-shadow 220ms ease;
}

.meta-card {
  border-radius: var(--radius-md);
  padding: 18px 20px;
}

/* ── Typography helpers ──────────────────────────────── */

.meta-card span,
.stat-card span,
.mini-card span,
.muted,
.post-date {
  font-family: "IBM Plex Mono", monospace;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  font-size: 0.72rem;
}

.meta-card strong {
  display: block;
  margin-top: 8px;
  font-size: 1.05rem;
}

/* ── Section heading ─────────────────────────────────── */

.section-heading {
  display: flex;
  gap: 16px;
  align-items: start;
  justify-content: space-between;
  margin-bottom: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(207, 255, 4, 0.06);
}

.section-heading h2 {
  font-size: 1.45rem;
  letter-spacing: -0.02em;
  font-weight: 600;
}

.detail-heading {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.detail-avatar,
.chip-avatar {
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid rgba(207, 255, 4, 0.18);
  background: rgba(255, 255, 255, 0.04);
}

.detail-avatar {
  width: 68px;
  height: 68px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.24);
}

.chip-avatar {
  width: 42px;
  height: 42px;
}

.detail-avatar--placeholder,
.chip-avatar--placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: "IBM Plex Mono", monospace;
  text-transform: uppercase;
  color: var(--accent);
}

/* ── Layout ──────────────────────────────────────────── */

.layout {
  display: grid;
  gap: 20px;
  margin-top: 20px;
}

.panel {
  padding: 32px;
}

/* ── Stat cards ──────────────────────────────────────── */

.stats-grid,
.detail-meta {
  display: grid;
  gap: 14px;
}

.stats-grid {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.detail-meta {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.detail-notes {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.stat-card,
.mini-card {
  border-radius: var(--radius-md);
  padding: 22px;
  position: relative;
  overflow: hidden;
}

.stat-card:hover,
.mini-card:hover {
  border-color: rgba(207, 255, 4, 0.2);
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(207, 255, 4, 0.04);
}

.stat-card strong,
.mini-card strong {
  display: block;
  margin-top: 10px;
  font-size: clamp(1.4rem, 3vw, 2.1rem);
  letter-spacing: -0.02em;
}

.stat-card.accent strong {
  color: var(--accent);
}

.mini-card--accent {
  border-color: rgba(207, 255, 4, 0.15);
}

.mini-card--accent strong {
  color: var(--accent);
}

/* ── Chart grid ──────────────────────────────────────── */

.chart-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.chart-card {
  min-height: 300px;
  border-radius: var(--radius-lg);
  padding: 24px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  position: relative;
  overflow: hidden;
}

.chart-card::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 15%;
  right: 15%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(207, 255, 4, 0.2), transparent);
  pointer-events: none;
}

.chart-card h3 {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.01em;
  margin-bottom: 16px;
}

.chart-kicker {
  font-weight: 400;
  color: var(--muted);
  font-size: 0.78rem;
}

.chart-card canvas {
  width: 100% !important;
  height: 240px !important;
}

/* ── Account chips ───────────────────────────────────── */

.account-list {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.account-chip {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 200px;
  padding: 20px;
  border-radius: var(--radius-md);
  color: var(--text);
  cursor: pointer;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    background 180ms ease,
    box-shadow 180ms ease;
}

.chip-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.account-chip:hover,
.account-chip:focus-visible,
.account-chip.active {
  transform: translateY(-3px);
  border-color: rgba(207, 255, 4, 0.35);
  background: linear-gradient(180deg, rgba(207, 255, 4, 0.06), transparent);
  box-shadow: 0 8px 32px rgba(207, 255, 4, 0.06);
}

.chip-topline {
  display: flex;
  align-items: center;
  gap: 12px;
}

.account-name {
  font-weight: 700;
  font-size: 1rem;
}

.chip-header-text {
  display: grid;
  gap: 6px;
}

.chip-badges,
.detail-note-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip-badge,
.detail-note-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.66rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.chip-badge--manual,
.detail-note-badge--manual {
  border-color: rgba(0, 229, 255, 0.22);
  color: var(--accent-cool);
}

.chip-badge--placeholder,
.detail-note-badge--placeholder {
  border-color: rgba(255, 200, 87, 0.24);
  color: #ffd272;
}

.account-followers {
  color: var(--muted);
  font-size: 0.88rem;
  margin-top: 2px;
}

.account-engagement {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.75rem;
  color: var(--accent);
  margin-top: 2px;
}

/* ── Profile link ────────────────────────────────────── */

.profile-link {
  color: var(--accent);
  text-decoration: none;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 8px 18px;
  border: 1px solid rgba(207, 255, 4, 0.25);
  border-radius: 10px;
  transition: background 200ms ease, border-color 200ms ease;
}

.profile-link:hover {
  background: rgba(207, 255, 4, 0.06);
  border-color: rgba(207, 255, 4, 0.5);
}

/* ── History snapshot (insufficient data) ────────────── */

.history-snapshot {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 200px;
  padding: 32px 24px;
}

.snapshot-icon {
  font-size: 2.4rem;
  margin-bottom: 16px;
  opacity: 0.6;
}

.snapshot-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.snapshot-hint {
  font-size: 0.82rem;
  color: var(--muted);
  max-width: 28ch;
  line-height: 1.5;
}

/* ── Detail grid ─────────────────────────────────────── */

.detail-grid {
  align-items: stretch;
  margin-top: 20px;
}

.detail-note {
  display: grid;
  gap: 10px;
  padding: 16px 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.025);
}

.detail-note strong {
  font-size: 0.9rem;
}

.detail-note p {
  color: var(--muted);
  line-height: 1.55;
  font-size: 0.88rem;
}

/* ── Posts list ───────────────────────────────────────── */

.posts-list {
  display: grid;
  gap: 10px;
}

.post-row {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr auto;
  border-radius: var(--radius-md);
  padding: 18px 20px;
  transition: border-color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.post-row:hover {
  border-color: rgba(255, 255, 255, 0.1);
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.post-row--top {
  border-color: rgba(207, 255, 4, 0.2);
  background: linear-gradient(135deg, rgba(207, 255, 4, 0.03), transparent);
}

.post-content {
  min-width: 0;
}

.post-link {
  color: var(--accent);
  text-decoration: none;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  display: inline-block;
  margin-top: 6px;
}

.post-link:hover {
  text-decoration: underline;
}

.post-caption {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.55;
  font-size: 0.88rem;
}

.post-date {
  display: block;
  margin: 6px 0 4px;
}

/* ── Badges ──────────────────────────────────────────── */

.top-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  background: rgba(207, 255, 4, 0.12);
  color: var(--accent);
  border: 1px solid rgba(207, 255, 4, 0.25);
  letter-spacing: 0.02em;
}

.rank-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
}

/* ── Post metrics ────────────────────────────────────── */

.post-metrics {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
  justify-content: center;
}

.metric {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
}

.metric--likes {
  color: var(--accent);
}

.metric--comments {
  color: var(--accent-cool);
}

.metric svg {
  opacity: 0.65;
}

/* ── Utilities ───────────────────────────────────────── */

.empty-state {
  color: var(--muted);
}

.hidden {
  display: none;
}

/* ── Reveal animation ────────────────────────────────── */

.reveal {
  opacity: 0;
  transform: translateY(16px);
}

.reveal.visible {
  animation: rise-in 650ms cubic-bezier(0.2, 0.9, 0.25, 1) forwards;
}

@keyframes rise-in {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Responsive ──────────────────────────────────────── */

@media (max-width: 980px) {
  .hero,
  .chart-grid,
  .stats-grid,
  .detail-meta,
  .post-row {
    grid-template-columns: 1fr;
  }

  .shell {
    width: min(100vw - 20px, 1180px);
    padding-top: 24px;
    padding-bottom: 40px;
  }

  .hero,
  .panel {
    padding: 24px;
    border-radius: 20px;
  }

  .hero {
    gap: 20px;
  }

  .detail-heading {
    align-items: flex-start;
  }

  .hero-meta {
    justify-items: start;
    width: 100%;
  }

  .snapshot-status {
    justify-self: start;
  }

  .snapshot-meta {
    justify-content: flex-start;
  }

  .snapshot-tooltip {
    right: auto;
    left: 0;
    width: min(360px, calc(100vw - 48px));
  }

  .hero-actions,
  .refresh-config__actions {
    justify-content: flex-start;
  }

  .post-metrics {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .account-chip,
  .reveal,
  .reveal.visible {
    animation: none;
    transition: none;
    transform: none;
    opacity: 1;
  }
}
