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

:root {
  --bg: #0d1117;
  --surface: #161b22;
  --border: #30363d;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --accent: #58a6ff;
  --accent-hover: #79c0ff;
  --pink: #f778ba;
  --gradient: linear-gradient(135deg, #58a6ff, #f778ba);
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--accent-hover);
}

/* Hero */
.hero {
  position: relative;
  text-align: center;
  padding: 4rem 1rem 3rem;
  background: radial-gradient(ellipse at 50% 0%, rgba(88, 166, 255, 0.12) 0%, transparent 60%),
              radial-gradient(ellipse at 80% 20%, rgba(247, 120, 186, 0.08) 0%, transparent 50%),
              var(--bg);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 40px,
    rgba(48, 54, 61, 0.3) 40px,
    rgba(48, 54, 61, 0.3) 41px
  );
  pointer-events: none;
}

.hero-inner {
  position: relative;
  z-index: 1;
}

.hero-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--pink);
  margin-bottom: 1rem;
}

.hero-title {
  font-size: 3.2rem;
  font-weight: 900;
  line-height: 1.1;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 1rem;
}

.hero-sub {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.8;
  max-width: 400px;
  margin: 0 auto 1.5rem;
}

.hero-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* Hero compact */
.hero-compact {
  padding: 2.5rem 1rem 2rem;
}

.hero-compact .hero-title {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.hero-compact .hero-sub {
  margin-bottom: 0;
  font-size: 0.85rem;
}

/* Nav row (pills) */
.nav-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.nav-pill {
  padding: 0.4rem 1rem;
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-muted);
  transition: all 0.2s;
}

.nav-pill:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(88, 166, 255, 0.06);
}

/* Year list (compact rows) */
.year-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 2rem;
}

.year-row {
  display: grid;
  grid-template-columns: 3.5rem 1fr auto auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  background: var(--surface);
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--text);
  transition: border-color 0.15s, background 0.15s;
}

.year-row:hover {
  border-color: var(--accent);
  background: rgba(88, 166, 255, 0.04);
  color: var(--text);
}

.year-row-year {
  font-size: 1.1rem;
  font-weight: 700;
}

.year-row-tags {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  overflow: hidden;
}

.year-row-tag {
  font-size: 0.65rem;
  padding: 0.15rem 0.45rem;
  background: var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  white-space: nowrap;
}

.year-row:hover .year-row-tag {
  background: rgba(88, 166, 255, 0.15);
  color: var(--accent);
}

.year-row-count {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  min-width: 1.5rem;
  text-align: right;
}

.year-row-arrow {
  font-size: 1.2rem;
  color: var(--border);
  transition: color 0.15s;
}

.year-row:hover .year-row-arrow {
  color: var(--accent);
}

/* Nav cards */
.nav-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-bottom: 2.5rem;
}

.nav-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  padding: 1.5rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.nav-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: 0 4px 20px rgba(88, 166, 255, 0.12);
  color: var(--accent);
}

.nav-card-icon {
  font-size: 1.6rem;
  margin-bottom: 0.2rem;
}

.nav-card-title {
  font-size: 1rem;
  font-weight: 700;
}

.nav-card-desc {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Pickup section */
.pickup-section {
  margin-bottom: 2.5rem;
}

.section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 1rem;
}

.pickup-scroll {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}

.pickup-scroll::-webkit-scrollbar {
  height: 4px;
}

.pickup-scroll::-webkit-scrollbar-track {
  background: var(--border);
  border-radius: 2px;
}

.pickup-scroll::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 2px;
}

.pickup-card {
  flex: 0 0 220px;
  scroll-snap-align: start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  color: var(--text);
  transition: border-color 0.2s;
  text-decoration: none;
}

.pickup-card:hover {
  border-color: var(--accent);
  color: var(--text);
}

.pickup-card-year {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--pink);
  letter-spacing: 0.05em;
}

.pickup-card-name {
  font-size: 0.9rem;
  font-weight: 700;
  margin: 0.25rem 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pickup-card-buzz {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.4rem;
}

.pickup-card-buzz-track {
  flex: 1;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.pickup-card-buzz-fill {
  height: 100%;
  border-radius: 2px;
}

.pickup-card-buzz-val {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
}

/* Header */
.site-header {
  text-align: center;
  padding: 3rem 1rem 2rem;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(88, 166, 255, 0.04) 0%, transparent 100%);
}

.site-header-link {
  color: inherit;
}

.site-header-link:hover {
  color: inherit;
}

.site-header h1 {
  font-size: 2.4rem;
  font-weight: 800;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.5rem;
}

.site-header p {
  color: var(--text-muted);
  max-width: 480px;
  margin: 0 auto;
  font-size: 0.95rem;
}

/* Container */
.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

/* Stats */
.stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 2rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
}

.stats-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--border);
}

/* About section */
.about {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 2rem;
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.8;
}

.about h2 {
  color: var(--text);
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

/* Year grid */
.year-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
}

.year-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.8rem 1rem;
  color: var(--text);
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.year-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: 0 4px 24px rgba(88, 166, 255, 0.15);
  color: var(--accent);
}

.year-card-year {
  font-size: 1.6rem;
  font-weight: 700;
}

.year-card-count {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.03em;
}

.year-card:hover .year-card-count {
  color: var(--accent);
}

/* Year page nav */
.year-nav {
  margin-bottom: 1rem;
}

/* Back link */
.back-link {
  display: inline-block;
  font-size: 0.9rem;
}

/* Year page header */
.year-title {
  font-size: 2.4rem;
  font-weight: 800;
  margin-bottom: 0.25rem;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Meme count badge */
.meme-count {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

/* Meme card */
.meme-list {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.meme-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.meme-card:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 12px rgba(88, 166, 255, 0.08);
}

/* Fade in animation */
.fade-in {
  animation: fadeSlideIn 0.4s ease both;
}

@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.meme-rank {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--bg);
  background: var(--pink);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.meme-name {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.meme-description {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
  line-height: 1.7;
}

.meme-origin {
  font-size: 0.85rem;
  color: var(--text-muted);
  border-left: 3px solid var(--pink);
  padding-left: 0.75rem;
  margin-bottom: 0.75rem;
  opacity: 0.8;
}

/* Sources */
.meme-sources {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-bottom: 0.75rem;
  padding: 0.6rem 0.75rem;
  background: rgba(88, 166, 255, 0.04);
  border-radius: 6px;
  border: 1px solid rgba(88, 166, 255, 0.1);
}

.meme-sources-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 0.1rem;
}

.meme-source-link,
.meme-source-text {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.5;
  word-break: break-all;
}

.meme-source-link {
  color: var(--accent);
  transition: color 0.15s;
}

.meme-source-link:hover {
  color: var(--accent-hover);
}

.meme-image {
  width: 100%;
  max-width: 400px;
  border-radius: 8px;
  cursor: pointer;
  transition: opacity 0.2s;
}

.meme-image:hover {
  opacity: 0.85;
}

/* Year pager */
.year-pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.pager-link {
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  color: var(--text);
  transition: border-color 0.2s, background 0.2s;
}

.pager-link:hover {
  border-color: var(--accent);
  background: rgba(88, 166, 255, 0.08);
  color: var(--accent);
}

/* Empty state */
.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 3rem 1rem;
}

/* Lightbox */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.92);
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
  animation: fadeIn 0.2s ease;
}

.lightbox.active {
  display: flex;
}

.lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 8px;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.5);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Buzz meter on meme cards */
.meme-buzz {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.meme-buzz-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.meme-buzz-track {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.meme-buzz-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.6s ease;
}

.meme-buzz-value {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  min-width: 1.5rem;
  text-align: right;
}

.meme-peak {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

/* Container wide (for timeline) */
.container-wide {
  max-width: 960px;
}

/* Timeline controls */
.timeline-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.timeline-controls {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 2rem;
}

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

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

.tl-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
  font-weight: 600;
}

.timeline-view.hidden {
  display: none;
}

/* Chart view */
.tl-year-group {
  margin-bottom: 2rem;
}

.tl-year-label {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.tl-year-label a {
  color: var(--text);
}

.tl-year-label a:hover {
  color: var(--accent);
}

.tl-year-bars {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.tl-bar-row {
  display: grid;
  grid-template-columns: 2.5rem 1fr auto auto;
  align-items: center;
  gap: 0.5rem;
}

.tl-bar-month {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-align: right;
}

.tl-bar-track {
  height: 20px;
  background: var(--surface);
  border-radius: 4px;
  overflow: hidden;
}

.tl-bar {
  height: 100%;
  border-radius: 4px;
  min-width: 4px;
  transition: width 0.6s ease;
}

.tl-bar-name {
  font-size: 0.8rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.tl-bar-buzz {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  min-width: 1.2rem;
  text-align: right;
}

/* Heatmap view */
.heatmap-grid {
  display: grid;
  grid-template-columns: 3.5rem repeat(12, 1fr);
  gap: 3px;
}

.hm-corner {
  /* empty top-left */
}

.hm-month-header {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-align: center;
  padding: 0.3rem 0;
}

.hm-year-header {
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
}

.hm-year-header a {
  color: var(--text);
}

.hm-year-header a:hover {
  color: var(--accent);
}

.hm-cell {
  aspect-ratio: 1;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
  transition: transform 0.15s;
  min-height: 36px;
}

.hm-cell:hover {
  transform: scale(1.15);
  z-index: 1;
}

.hm-count {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text);
}

.hm-legend {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin-top: 1.5rem;
  justify-content: center;
}

.hm-legend-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-right: 0.3rem;
}

.hm-legend-cell {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--text);
}

/* History timeline */
.history-timeline {
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

.history-era {
  position: relative;
}

.history-era-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--pink);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--pink);
}

.history-items {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding-left: 0.5rem;
  border-left: 2px solid var(--border);
}

.history-item {
  display: grid;
  grid-template-columns: 4.5rem 1fr;
  gap: 1rem;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: border-color 0.2s;
}

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

.history-year {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent);
  padding-top: 0.15rem;
  white-space: nowrap;
}

.history-content strong {
  display: block;
  font-size: 1rem;
  margin-bottom: 0.3rem;
}

.history-content p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.7;
}

/* Footer */
.site-footer {
  text-align: center;
  padding: 2rem 1rem;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-top: 3rem;
}

/* Responsive */
@media (max-width: 480px) {
  .hero {
    padding: 3rem 1rem 2rem;
  }

  .hero-title {
    font-size: 2.2rem;
  }

  .hero-sub {
    font-size: 0.85rem;
  }

  .nav-cards {
    grid-template-columns: 1fr;
  }

  .pickup-card {
    flex: 0 0 180px;
  }

  .site-header {
    padding: 2rem 1rem 1.5rem;
  }

  .site-header h1 {
    font-size: 1.8rem;
  }

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

  .year-title {
    font-size: 2rem;
  }

  .meme-name {
    font-size: 1.1rem;
  }

  .meme-card {
    padding: 1.2rem;
  }

  .pager-link {
    font-size: 0.85rem;
    padding: 0.4rem 0.75rem;
  }

  .container-wide {
    max-width: 100%;
  }

  .tl-bar-name {
    max-width: 120px;
    font-size: 0.7rem;
  }

  .tl-bar-row {
    grid-template-columns: 2rem 1fr auto auto;
    gap: 0.3rem;
  }

  .hm-month-header {
    font-size: 0.5rem;
  }

  .hm-cell {
    min-height: 28px;
  }

  .hm-year-header {
    font-size: 0.75rem;
  }

  .history-item {
    grid-template-columns: 3.5rem 1fr;
    gap: 0.5rem;
    padding: 0.75rem;
  }

  .history-year {
    font-size: 0.75rem;
  }

  .history-content strong {
    font-size: 0.9rem;
  }
}
