:root {
  color-scheme: dark;
  --bg: #0f1419;
  --surface: #16202a;
  --surface-2: #1d2a35;
  --border: #2f3b46;
  --text: #e7eef5;
  --muted: #8b98a5;
  --accent: #1d9bf0;
  --accent-hover: #1a8cd8;
  --success: #00ba7c;
  --error: #f4212e;
  --radius: 16px;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at top, rgba(29, 155, 240, 0.12), transparent 32%),
    var(--bg);
  color: var(--text);
  line-height: 1.6;
}

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

img {
  display: block;
  max-width: 100%;
}

.container {
  width: min(1100px, calc(100% - 24px));
  margin: 0 auto;
}

.site-header,
.site-footer {
  padding: 32px 0;
}

.site-header h1 {
  margin: 0 0 8px;
  font-size: clamp(2rem, 4vw, 2.8rem);
}

.lead,
.section-intro,
.disclaimer {
  color: var(--muted);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}

.download-form {
  display: grid;
  gap: 12px;
}

.download-form label {
  font-weight: 600;
}

.download-form input {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 1rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  background: transparent;
  color: var(--text);
}

.button-primary {
  background: var(--accent);
  color: #fff;
}

.button-primary:hover {
  background: var(--accent-hover);
}

.button-secondary {
  border-color: var(--border);
  background: var(--surface-2);
}

.status {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--surface-2);
}

.status[data-type='error'] {
  color: var(--error);
}

.status[data-type='success'] {
  color: var(--success);
}

.result,
.section {
  margin-top: 24px;
}

.section h2 {
  margin: 0 0 8px;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0;
}

.tab {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
}

.tab.is-active {
  background: var(--accent);
  border-color: var(--accent);
}

.tweet-card,
.media-card,
.list-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.tweet-card {
  padding: 20px;
}

.tweet-header {
  display: flex;
  gap: 12px;
  align-items: center;
}

.avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
}

.avatar-placeholder,
.media-placeholder {
  display: grid;
  place-items: center;
  background: var(--surface-2);
  color: var(--muted);
}

.avatar-placeholder {
  width: 48px;
  height: 48px;
  border-radius: 50%;
}

.author-name,
.list-item-title {
  margin: 0;
  font-weight: 700;
}

.author-handle,
.media-subtitle,
.list-item-text {
  margin: 0;
  color: var(--muted);
}

.tweet-text {
  margin: 16px 0;
  white-space: pre-wrap;
}

.tweet-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin: 0;
}

.tweet-stats div {
  display: grid;
  gap: 2px;
}

.tweet-stats dt {
  color: var(--muted);
  font-size: 0.85rem;
}

.tweet-stats dd {
  margin: 0;
  font-weight: 700;
}

.media-grid {
  display: grid;
  gap: 16px;
  margin-top: 16px;
}

.media-card {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 16px;
  padding: 16px;
}

.media-preview img,
.media-placeholder {
  width: 100%;
  aspect-ratio: 9 / 16;
  object-fit: cover;
  border-radius: 12px;
}

.variant-list {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.variant-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.variant-meta {
  display: flex;
  gap: 12px;
  color: var(--muted);
}

.variant-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.list-stack {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, 1fr);
}

.list-stack .empty-state {
  grid-column: 1 / -1;
}

.thumb-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.thumb-card-media {
  position: relative;
}

.thumb-card-handle {
  margin: 0;
  padding: 8px 10px 10px;
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.thumb-wrap {
  position: relative;
  width: 100%;
}

.thumb-link {
  display: block;
}

.list-thumb {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 0;
  background: var(--surface-2);
}

.list-thumb-placeholder {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 0.75rem;
  aspect-ratio: 16 / 9;
}

.x-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.18);
  transition: background 0.15s ease, transform 0.15s ease;
  z-index: 1;
}

.x-badge:hover {
  background: rgba(0, 0, 0, 0.9);
  transform: scale(1.05);
}

.rank-badge-overlay {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  display: grid;
  place-items: center;
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
}

.count-badge-overlay {
  position: absolute;
  bottom: 8px;
  left: 8px;
  z-index: 2;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
}

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

@media (min-width: 721px) {
  .list-stack {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 960px) {
  .list-stack {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 720px) {
  .media-card {
    grid-template-columns: 1fr;
  }
}
