:root {
  --top100-bg: #c8d0db;
  --top100-panel: #e8edf3;
  --top100-panel-strong: #fff;
  --top100-border: rgba(120, 140, 190, 0.22);
  --top100-text: #505a68;
  --top100-heading: #505a68;
  --top100-link: #4a6b82;
  --top100-link-hover: #2a7ae2;
  --top100-th-bg: #dde3eb;
  --top100-th-text: #505a68;
  --top100-row-hover: rgba(194, 212, 226, 0.45);
  --top100-nav-bg: #5a7d96;
  --top100-nav-bg-hover: #4a6b82;
  --top100-nav-text: #f0f4f8;
  --top100-radius-lg: 18px;
  --top100-radius-md: 12px;
  --top100-shadow: 0 2px 8px rgba(34, 60, 80, 0.12);
}

html.chat-theme-dark {
  --top100-bg: #070b18;
  --top100-panel: rgba(17, 24, 44, 0.88);
  --top100-panel-strong: rgba(15, 20, 39, 0.92);
  --top100-border: rgba(255, 255, 255, 0.08);
  --top100-text: #eef2ff;
  --top100-heading: #eef2ff;
  --top100-link: #eef2ff;
  --top100-link-hover: #fff;
  --top100-th-bg: rgba(124, 140, 255, 0.14);
  --top100-th-text: #eef2ff;
  --top100-row-hover: rgba(124, 140, 255, 0.1);
  --top100-nav-bg: linear-gradient(135deg, #7c8cff 0%, #ff5ca8 55%, #33d6c8 100%);
  --top100-nav-bg-hover: linear-gradient(135deg, #7c8cff 0%, #ff5ca8 55%, #33d6c8 100%);
  --top100-nav-text: #fff;
  --top100-shadow: 0 18px 45px rgba(0, 0, 0, 0.28);
}

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

body.top100-body {
  margin: 0;
  min-height: 100vh;
  padding: 24px 16px 40px;
  font-family: 'Inter', 'Manrope', sans-serif;
  font-size: 14px;
  line-height: 1.45;
  color: var(--top100-text);
  background: var(--top100-bg);
}

html.chat-theme-dark body.top100-body {
  color: #eef2ff;
  background:
    radial-gradient(circle at top left, rgba(124, 140, 255, .15), transparent 28%),
    radial-gradient(circle at top right, rgba(255, 92, 168, .14), transparent 24%),
    radial-gradient(circle at bottom left, rgba(51, 214, 200, .10), transparent 28%),
    linear-gradient(180deg, #090d1b 0%, #0b1020 45%, #070b18 100%);
}

.top100-brand {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto 16px;
  text-align: center;
}

.top100-brand a {
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--top100-heading);
  text-decoration: none;
  letter-spacing: .3px;
}

html:not(.chat-theme-dark) .top100-brand a {
  color: #505a68;
}

.top100-container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 24px 24px;
  background: var(--top100-panel);
  border: 1px solid var(--top100-border);
  border-radius: var(--top100-radius-lg);
  box-shadow: var(--top100-shadow);
}

html.chat-theme-dark .top100-container {
  backdrop-filter: blur(14px);
}

.top100-title {
  margin: 0 0 24px;
  font-family: 'Outfit', sans-serif;
  font-size: 1.65rem;
  font-weight: 800;
  text-align: center;
  color: var(--top100-heading);
  letter-spacing: .02em;
}

.top100-grid-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 24px;
  border-radius: var(--top100-radius-md);
  border: 1px solid var(--top100-border);
  background: rgba(255, 255, 255, 0.35);
}

html.chat-theme-dark .top100-grid-wrap {
  background: rgba(255, 255, 255, 0.03);
}

.top100-grid {
  min-width: 640px;
  background: var(--top100-panel-strong);
}

.top100-grid__head,
.top100-grid__row {
  display: grid;
  grid-template-columns: repeat(var(--top100-cols, 6), minmax(88px, 1fr));
}

.top100-grid__head {
  background: var(--top100-th-bg);
  border-bottom: 1px solid var(--top100-border);
}

.top100-grid__row {
  border-bottom: 1px solid var(--top100-border);
  transition: background .2s ease;
}

.top100-grid__row:last-child {
  border-bottom: none;
}

.top100-grid__row:hover {
  background: var(--top100-row-hover);
}

.top100-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 14px;
  text-align: center;
  font-size: 0.95rem;
  color: var(--top100-text);
  min-height: 48px;
}

.top100-cell--head {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--top100-th-text);
  white-space: nowrap;
}

.top100-cell--head a {
  color: inherit;
  text-decoration: none;
  transition: opacity .2s ease;
}

.top100-cell--head a:hover {
  opacity: .85;
}

.top100-cell a {
  color: var(--top100-link);
  text-decoration: none;
  font-weight: 600;
  transition: color .2s ease;
}

.top100-cell a:hover {
  color: var(--top100-link-hover);
  text-decoration: underline;
}

.top100-nick {
  font-weight: 600;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.top100-cell--nick a {
  max-width: 100%;
}

html.chat-theme-dark .top100-grid .top100-cell,
html.chat-theme-dark .top100-grid .top100-cell a,
html.chat-theme-dark .top100-grid .top100-nick,
html.chat-theme-dark .top100-grid .top100-cell--head,
html.chat-theme-dark .top100-grid .top100-cell--head a {
  color: #eef2ff;
}

html.chat-theme-dark .top100-grid .top100-cell a:hover,
html.chat-theme-dark .top100-grid .top100-cell--head a:hover {
  color: #fff;
}

.top100-nav {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.top100-nav a,
.top100-nav b {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: transform .2s ease, opacity .2s ease, background .2s ease;
}

.top100-nav a {
  background: var(--top100-nav-bg);
  color: var(--top100-nav-text);
  border: 1px solid transparent;
}

html:not(.chat-theme-dark) .top100-nav a {
  box-shadow: 0 2px 6px rgba(34, 60, 80, 0.12);
}

.top100-nav a:hover {
  transform: translateY(-1px);
  opacity: .95;
}

html:not(.chat-theme-dark) .top100-nav a:hover {
  background: var(--top100-nav-bg-hover);
}

.top100-nav b {
  background: rgba(255, 255, 255, 0.08);
  color: var(--top100-heading);
  border: 1px solid var(--top100-border);
  cursor: default;
}

html:not(.chat-theme-dark) .top100-nav b {
  background: #dde3eb;
  color: #505a68;
}

html.chat-theme-dark .top100-nav b {
  color: #eef2ff;
}

@media (max-width: 900px) {
  .top100-grid-wrap {
    position: relative;
  }

  .top100-grid-wrap::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 28px;
    pointer-events: none;
    background: linear-gradient(to left, var(--top100-panel), transparent);
    border-radius: 0 var(--top100-radius-md) var(--top100-radius-md) 0;
  }

  .top100-grid__head .top100-cell--head:first-child,
  .top100-grid__row .top100-cell:first-child {
    position: sticky;
    left: 0;
    z-index: 1;
    background: var(--top100-th-bg);
    box-shadow: 4px 0 8px rgba(0, 0, 0, 0.06);
  }

  .top100-grid__row .top100-cell:first-child {
    background: var(--top100-panel-strong);
  }

  .top100-grid__row:hover .top100-cell:first-child {
    background: var(--top100-row-hover);
  }

  html.chat-theme-dark .top100-grid-wrap::after {
    background: linear-gradient(to left, rgba(15, 20, 39, 0.95), transparent);
  }
}

@media (max-width: 768px) {
  body.top100-body {
    padding: 16px 12px 32px;
  }

  .top100-brand a {
    font-size: 1.05rem;
  }

  .top100-container {
    padding: 20px 16px 18px;
    border-radius: 14px;
  }

  .top100-title {
    font-size: 1.35rem;
    margin-bottom: 18px;
  }

  .top100-grid {
    min-width: 520px;
  }

  .top100-grid__head,
  .top100-grid__row {
    grid-template-columns: repeat(var(--top100-cols, 6), minmax(72px, 1fr));
  }

  .top100-cell {
    padding: 10px 10px;
    font-size: 0.88rem;
    min-height: 44px;
  }

  .top100-cell--head {
    font-size: 0.7rem;
  }
}

@media (max-width: 640px) {
  body.top100-body {
    padding: 12px 10px 28px;
  }

  .top100-container {
    padding: 18px 12px 16px;
    border-radius: 12px;
  }

  .top100-title {
    font-size: 1.2rem;
    margin-bottom: 14px;
  }

  .top100-grid-wrap {
    overflow-x: visible;
    margin-bottom: 18px;
    border: none;
    background: transparent;
  }

  .top100-grid-wrap::after {
    display: none;
  }

  .top100-grid {
    min-width: 0;
  }

  .top100-grid__head {
    display: none;
  }

  .top100-grid__row {
    display: block;
    margin-bottom: 10px;
    padding: 12px 14px;
    border: 1px solid var(--top100-border);
    border-radius: var(--top100-radius-md);
    background: var(--top100-panel-strong);
    box-shadow: 0 1px 4px rgba(34, 60, 80, 0.08);
  }

  html.chat-theme-dark .top100-grid__row {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
  }

  .top100-grid__row:last-child {
    margin-bottom: 0;
  }

  .top100-grid__row:hover {
    background: var(--top100-panel-strong);
  }

  .top100-cell {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: auto;
    padding: 9px 0;
    text-align: right;
    border-bottom: 1px solid var(--top100-border);
  }

  .top100-cell::before {
    content: attr(data-label);
    flex: 0 0 42%;
    max-width: 46%;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--top100-th-text);
    text-align: left;
    text-transform: uppercase;
    letter-spacing: .03em;
    line-height: 1.3;
  }

  html.chat-theme-dark .top100-cell::before {
    color: #aab3d4;
  }

  .top100-cell:last-child {
    border-bottom: none;
    padding-bottom: 0;
  }

  .top100-cell:first-child {
    position: static;
    box-shadow: none;
    background: transparent;
    border-bottom: 1px solid var(--top100-border);
    padding-top: 0;
    font-size: 1.05rem;
    font-weight: 800;
    justify-content: space-between;
  }

  .top100-cell--nick {
    font-size: 0.95rem;
  }

  .top100-cell--nick a {
    text-align: right;
  }

  .top100-nav {
    gap: 8px;
  }

  .top100-nav a,
  .top100-nav b {
    flex: 1 1 calc(50% - 8px);
    min-width: 0;
    padding: 10px 12px;
    font-size: 0.84rem;
  }

  .top100-nav b:nth-child(2) {
    flex: 0 0 52px;
    padding: 10px 8px;
  }
}

@media (max-width: 400px) {
  .top100-container {
    padding: 16px 10px 14px;
  }

  .top100-title {
    font-size: 1.1rem;
  }

  .top100-grid__row {
    padding: 10px 12px;
  }

  .top100-cell {
    padding: 8px 0;
    font-size: 0.84rem;
  }

  .top100-cell::before {
    font-size: 0.68rem;
    flex-basis: 44%;
  }

  .top100-nav a,
  .top100-nav b {
    font-size: 0.8rem;
    padding: 9px 10px;
  }
}
