:root {
  --tg-archive-bg: #f4f6fb;
  --tg-archive-surface: #ffffff;
  --tg-archive-surface-soft: #f8fafc;
  --tg-archive-border: #e2e8f0;
  --tg-archive-text: #111827;
  --tg-archive-muted: #64748b;
  --tg-archive-accent: #06b6d4;
  --tg-archive-stock: #2563eb;
  --tg-archive-coin: #f59e0b;
  --tg-archive-positive: #10b981;
  --tg-archive-shadow: 0 16px 38px rgba(15, 23, 42, 0.08);
}

.dark {
  --tg-archive-bg: #0b0d17;
  --tg-archive-surface: #15182a;
  --tg-archive-surface-soft: #101321;
  --tg-archive-border: #262b43;
  --tg-archive-text: #eef2ff;
  --tg-archive-muted: #9ca3af;
  --tg-archive-shadow: 0 18px 42px rgba(0, 0, 0, 0.28);
}

body {
  background: var(--tg-archive-bg);
}

.tg-archive-main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 16px 56px;
  color: var(--tg-archive-text);
}

.tg-archive-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 430px);
  gap: 18px;
  align-items: stretch;
  margin-bottom: 18px;
}

.tg-archive-hero > div:first-child,
.tg-archive-summary,
.tg-archive-toolbar,
.tg-archive-status,
.tg-card,
.tg-post-article {
  background: var(--tg-archive-surface);
  border: 1px solid var(--tg-archive-border);
  box-shadow: var(--tg-archive-shadow);
}

.tg-archive-hero > div:first-child {
  border-radius: 8px;
  padding: 28px;
}

.tg-archive-kicker {
  display: inline-flex;
  align-items: center;
  height: 26px;
  border-radius: 999px;
  border: 1px solid rgba(6, 182, 212, 0.35);
  color: var(--tg-archive-accent);
  padding: 0 11px;
  font-size: 12px;
  font-weight: 800;
}

.tg-archive-hero h1 {
  margin: 14px 0 10px;
  font-size: 34px;
  line-height: 1.18;
  letter-spacing: 0;
}

.tg-archive-hero p {
  margin: 0;
  color: var(--tg-archive-muted);
  font-size: 15px;
  line-height: 1.75;
}

.tg-archive-summary {
  border-radius: 8px;
  padding: 18px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.tg-archive-summary div {
  background: var(--tg-archive-surface-soft);
  border: 1px solid var(--tg-archive-border);
  border-radius: 8px;
  padding: 14px;
}

.tg-archive-summary strong {
  display: block;
  font-size: 22px;
  line-height: 1.1;
}

.tg-archive-summary span {
  display: block;
  margin-top: 8px;
  color: var(--tg-archive-muted);
  font-size: 12px;
  font-weight: 700;
}

.tg-archive-toolbar {
  border-radius: 8px;
  padding: 14px;
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto 160px;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}

.tg-archive-search {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  background: var(--tg-archive-surface-soft);
  border: 1px solid var(--tg-archive-border);
  border-radius: 8px;
  padding: 0 12px;
}

.tg-archive-search span {
  color: var(--tg-archive-muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.tg-archive-search input,
.tg-archive-toolbar select {
  width: 100%;
  height: 44px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--tg-archive-text);
  font: inherit;
  font-size: 14px;
}

.tg-archive-toolbar select {
  border: 1px solid var(--tg-archive-border);
  border-radius: 8px;
  background: var(--tg-archive-surface-soft);
  padding: 0 12px;
}

.tg-archive-filters {
  display: inline-flex;
  border: 1px solid var(--tg-archive-border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--tg-archive-surface-soft);
}

.tg-archive-filters button {
  height: 44px;
  border: 0;
  border-right: 1px solid var(--tg-archive-border);
  background: transparent;
  color: var(--tg-archive-muted);
  padding: 0 16px;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.tg-archive-filters button:last-child {
  border-right: 0;
}

.tg-archive-filters button.active {
  background: var(--tg-archive-accent);
  color: #fff;
}

.tg-archive-status {
  border-radius: 8px;
  padding: 14px 16px;
  color: var(--tg-archive-muted);
  font-size: 13px;
  margin-bottom: 14px;
}

.tg-archive-status[hidden] {
  display: none;
}

.tg-archive-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.tg-card {
  display: block;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.tg-card:hover {
  transform: translateY(-2px);
  border-color: rgba(6, 182, 212, 0.45);
}

.tg-card-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--tg-archive-surface-soft);
  border: 1px solid var(--tg-archive-border);
  border-radius: 8px;
  overflow: hidden;
  margin: 0 0 12px;
}

.tg-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.tg-card-image-count {
  position: absolute;
  right: 10px;
  bottom: 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.72);
  color: #fff;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 800;
}

.tg-card-body {
  padding: 15px;
}

.tg-card-channel {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  margin-bottom: 12px;
}

.tg-card-avatar {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: rgba(6, 182, 212, 0.12);
  color: var(--tg-archive-accent);
  font-weight: 900;
  overflow: hidden;
}

.tg-card-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.tg-card-channel strong,
.tg-card-title {
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-box-orient: vertical;
}

.tg-card-channel strong {
  -webkit-line-clamp: 1;
  font-size: 13px;
}

.tg-card-channel span {
  display: block;
  margin-top: 1px;
  color: var(--tg-archive-muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tg-card-title {
  -webkit-line-clamp: 2;
  min-height: 44px;
  margin-bottom: 12px;
  color: var(--tg-archive-text);
  font-size: 16px;
  line-height: 1.42;
  font-weight: 900;
}

.tg-card-excerpt {
  margin: 9px 0 0;
  color: var(--tg-archive-muted);
  font-size: 13px;
  line-height: 1.58;
  min-height: 42px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.tg-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 13px;
  color: var(--tg-archive-muted);
  font-size: 12px;
}

.tg-card-category {
  border-radius: 999px;
  padding: 4px 8px;
  font-weight: 900;
}

.tg-card-category.coin {
  color: var(--tg-archive-coin);
  background: rgba(245, 158, 11, 0.12);
}

.tg-card-category.stock {
  color: var(--tg-archive-stock);
  background: rgba(37, 99, 235, 0.12);
}

.tg-post-article {
  max-width: 860px;
  margin: 0 auto;
  border-radius: 8px;
  padding: 26px;
}

.tg-post-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--tg-archive-border);
  margin: -4px 0 18px;
  padding-bottom: 14px;
  color: var(--tg-archive-muted);
  font-size: 12px;
  font-weight: 800;
}

.tg-detail-gallery {
  display: grid;
  gap: 10px;
  margin: 0 0 18px;
}

.tg-detail-gallery img {
  width: 100%;
  border-radius: 8px;
  border: 1px solid var(--tg-archive-border);
  background: var(--tg-archive-surface-soft);
}

.tg-detail-header {
  display: flex;
  gap: 12px;
  align-items: center;
  margin: 0 0 18px;
}

.tg-channel-insight {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 0.9fr);
  gap: 14px;
  border: 1px solid var(--tg-archive-border);
  border-radius: 8px;
  background: var(--tg-archive-surface-soft);
  padding: 14px;
  margin: 0 0 18px;
}

.tg-channel-insight-main {
  min-width: 0;
}

.tg-channel-insight-label {
  display: inline-flex;
  align-items: center;
  height: 24px;
  border-radius: 999px;
  background: rgba(6, 182, 212, 0.12);
  color: var(--tg-archive-accent);
  padding: 0 9px;
  font-size: 11px;
  font-weight: 900;
}

.tg-channel-insight-main strong {
  display: block;
  margin-top: 10px;
  font-size: 18px;
  line-height: 1.35;
}

.tg-channel-insight-main p {
  margin: 7px 0 0;
  color: var(--tg-archive-muted);
  font-size: 13px;
  line-height: 1.65;
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.tg-channel-insight-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.tg-channel-insight-grid div {
  border: 1px solid var(--tg-archive-border);
  border-radius: 8px;
  background: var(--tg-archive-surface);
  padding: 11px;
}

.tg-channel-insight-grid span {
  display: block;
  color: var(--tg-archive-muted);
  font-size: 11px;
  font-weight: 800;
}

.tg-channel-insight-grid strong {
  display: block;
  margin-top: 6px;
  color: var(--tg-archive-text);
  font-size: 18px;
  line-height: 1.2;
}

.tg-channel-insight-grid strong.positive {
  color: var(--tg-archive-positive);
}

.tg-channel-insight-grid strong.negative {
  color: #ef4444;
}

.tg-post-article h1 {
  margin: 0 0 12px;
  font-size: 30px;
  line-height: 1.38;
  letter-spacing: 0;
}

.tg-detail-text {
  color: var(--tg-archive-text);
  font-size: 15px;
  line-height: 1.8;
  white-space: pre-wrap;
  word-break: break-word;
}

.tg-detail-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border-top: 1px solid var(--tg-archive-border);
  margin-top: 22px;
  padding-top: 16px;
  color: var(--tg-archive-muted);
  font-size: 12px;
}

.tg-detail-actions a {
  display: inline-flex;
  align-items: center;
  height: 38px;
  border-radius: 8px;
  border: 1px solid rgba(6, 182, 212, 0.45);
  color: var(--tg-archive-accent);
  padding: 0 13px;
  font-weight: 900;
}

.tg-detail-text a {
  color: var(--tg-archive-accent);
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
  word-break: break-all;
}

.tg-related-posts {
  border-top: 1px solid var(--tg-archive-border);
  margin-top: 22px;
  padding-top: 18px;
}

.tg-related-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.tg-related-heading span {
  color: var(--tg-archive-accent);
  font-size: 12px;
  font-weight: 900;
}

.tg-related-heading strong {
  color: var(--tg-archive-text);
  font-size: 15px;
  text-align: right;
}

.tg-related-list {
  display: grid;
  gap: 8px;
}

.tg-related-item {
  display: block;
  border: 1px solid var(--tg-archive-border);
  border-radius: 8px;
  background: var(--tg-archive-surface-soft);
  color: inherit;
  padding: 12px;
  text-decoration: none;
}

.tg-related-item:hover {
  border-color: rgba(6, 182, 212, 0.45);
}

.tg-related-item strong {
  display: -webkit-box;
  overflow: hidden;
  color: var(--tg-archive-text);
  font-size: 14px;
  line-height: 1.45;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.tg-related-item span {
  display: block;
  margin-top: 6px;
  color: var(--tg-archive-muted);
  font-size: 12px;
}

.tg-post-back {
  display: inline-flex;
  align-items: center;
  height: 38px;
  border-radius: 8px;
  color: var(--tg-archive-accent);
  padding: 0;
  text-decoration: none;
  font-size: 13px;
  font-weight: 900;
}

.tg-post-back::before {
  content: "<";
  margin-right: 7px;
}

@media (max-width: 900px) {
  .tg-archive-hero,
  .tg-archive-toolbar,
  .tg-channel-insight {
    grid-template-columns: 1fr;
  }

  .tg-archive-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .tg-archive-main {
    padding: 18px 12px 40px;
  }

  .tg-archive-hero > div:first-child {
    padding: 20px;
  }

  .tg-archive-hero h1 {
    font-size: 28px;
  }

  .tg-archive-summary {
    grid-template-columns: 1fr;
  }

  .tg-archive-filters {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .tg-archive-filters button {
    padding: 0 8px;
  }

  .tg-archive-grid {
    grid-template-columns: 1fr;
  }

  .tg-post-article {
    padding: 20px;
  }

  .tg-post-article h1 {
    font-size: 21px;
  }

  .tg-detail-actions {
    display: grid;
  }
}
