:root {
  --bg: #050505;
  --surface: #0e0e0e;
  --surface-raised: #181818;
  --text: #ffffff;
  --muted: #a0a0a0;
  --line: #242424;
  --line-strong: #3a3a3a;
  --accent: #c0202a;
  --accent-bright: #ff4d5b;
  --kick-hover: #53fc18;
  --offline: #777777;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --max: 1500px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scrollbar-color: var(--accent) var(--bg);
  scrollbar-width: thin;
}

body {
  min-width: 320px;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Barlow Semi Condensed", sans-serif;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: var(--accent);
  color: var(--text);
}

::-webkit-scrollbar {
  width: 7px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--accent);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 12px;
  left: 12px;
  padding: 12px 16px;
  background: var(--accent);
  color: var(--text);
  font-weight: 700;
  transform: translateY(-180%);
}

.skip-link:focus {
  transform: translateY(0);
}

.scroll-progress {
  position: fixed;
  z-index: 90;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  pointer-events: none;
}

.site-header {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  width: min(100% - 32px, var(--max));
  min-height: 72px;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-top: 0;
  background: rgba(7, 9, 7, 0.92);
  backdrop-filter: blur(16px);
}

.brand,
.stream-state {
  display: flex;
  align-items: center;
  min-height: 71px;
  padding: 0 24px;
}

.brand {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.brand span {
  position: relative;
  display: inline-block;
  color: var(--accent);
}

.brand span::after {
  content: "KK";
  position: absolute;
  inset: 0;
  overflow: hidden;
  color: var(--kick-hover);
  clip-path: inset(0 100% 0 0);
  transition: clip-path 900ms var(--ease);
}

.brand:hover span::after,
.brand:focus-visible span::after {
  clip-path: inset(0 0 0 0);
}

.stream-state {
  gap: 11px;
  border-left: 1px solid var(--line);
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: background-color 240ms var(--ease), color 240ms var(--ease);
}

.stream-state svg,
.search-field svg,
.refresh-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: square;
  stroke-linejoin: miter;
}

.stream-state:hover {
  background: var(--accent);
  color: var(--text);
}

.live-pulse {
  width: 8px;
  height: 8px;
  background: var(--muted);
}

.stream-state.is-live .live-pulse {
  background: var(--accent);
  box-shadow: 0 0 0 5px rgba(192, 32, 42, 0.18);
  animation: live-pulse 1.8s ease-out infinite;
}

.stream-state.is-offline .live-pulse {
  background: var(--offline);
}

main {
  width: min(100% - 32px, var(--max));
  margin: 40px auto 80px;
}

.leaderboard {
  position: relative;
  overflow: clip;
  border: 1px solid var(--line);
  background: var(--surface);
}

.board-titlebar {
  display: grid;
  grid-template-columns: 1fr minmax(380px, 560px);
  gap: 48px;
  align-items: end;
  min-height: 190px;
  padding: 42px 40px 34px;
  border-bottom: 1px solid var(--line);
}

.board-titlebar h1 {
  max-width: 100%;
  margin: 0;
  font-size: clamp(2.8rem, 6vw, 5.6rem);
  font-weight: 600;
  line-height: 0.86;
  letter-spacing: -0.04em;
  text-transform: uppercase;
}

.board-actions {
  display: grid;
  grid-template-columns: 1fr 52px;
  gap: 8px;
}

.search-field {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 52px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  background: var(--bg);
  color: var(--muted);
  transition: border-color 200ms ease, color 200ms ease;
}

.search-field:focus-within {
  border-color: var(--accent);
  color: var(--accent-bright);
}

.search-field input {
  min-width: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  caret-color: var(--accent-bright);
  font-size: 15px;
}

.search-field input::placeholder {
  color: #9ba298;
  opacity: 1;
}

.search-field input::-webkit-search-cancel-button {
  filter: invert(1);
}

.refresh-button {
  display: grid;
  width: 52px;
  height: 52px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--accent);
  border-radius: 2px;
  background: transparent;
  color: var(--accent-bright);
  cursor: pointer;
  transition: background-color 220ms var(--ease), color 220ms var(--ease), transform 220ms var(--ease);
}

.refresh-button:hover {
  background: var(--accent);
  color: var(--text);
  transform: translateY(-2px);
}

.refresh-button:disabled {
  cursor: wait;
  opacity: 0.55;
  transform: none;
}

.refresh-button:disabled svg {
  animation: spin 700ms linear infinite;
}

.board-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 40px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.table-viewport {
  min-height: 380px;
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

thead {
  position: sticky;
  z-index: 4;
  top: 72px;
  background: var(--surface);
}

th {
  height: 46px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-align: left;
  text-transform: uppercase;
}

th:first-child,
td:first-child {
  width: 110px;
}

th:nth-child(3),
td:nth-child(3) {
  width: 170px;
}

th:last-child,
td:last-child {
  width: 220px;
}

.points-heading,
.points {
  text-align: right;
}

td {
  height: 80px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  transition: background-color 280ms var(--ease), color 280ms var(--ease);
}

.rank-row {
  --row-delay: 0ms;
  animation: row-enter 540ms var(--ease) both;
  animation-delay: var(--row-delay);
}

.rank-row:hover td {
  background: var(--accent);
  color: var(--text);
}

.rank {
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.rank-row:nth-child(-n + 3) .rank {
  color: var(--accent-bright);
}

.rank-row:hover .rank,
.rank-row:hover .status-tag {
  color: var(--text);
}

.user {
  overflow: hidden;
  font-size: clamp(1.1rem, 2vw, 1.55rem);
  font-weight: 600;
  letter-spacing: -0.025em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-tag {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid currentColor;
  border-radius: 2px;
  color: var(--text);
  font-family: "IBM Plex Mono", monospace;
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.08em;
}

.status-tag.viewer {
  color: var(--muted);
}

.points {
  font-family: "IBM Plex Mono", monospace;
  font-size: clamp(1.1rem, 2vw, 1.55rem);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.points small {
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.08em;
}

.rank-row:hover .points small {
  color: var(--text);
}

.table-status {
  margin: 0;
  padding: 100px 20px;
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  text-align: center;
  text-transform: uppercase;
}

.table-status:empty {
  display: none;
}

.skeleton td {
  height: 80px;
}

.skeleton-line {
  display: block;
  width: min(260px, 70%);
  height: 10px;
  background: var(--surface-raised);
  animation: skeleton 1.1s ease-in-out infinite alternate;
}

.skeleton td:last-child .skeleton-line {
  width: 90px;
  margin-left: auto;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

:focus-visible {
  outline: 2px solid var(--accent-bright);
  outline-offset: 3px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes skeleton {
  to { background: #1c221b; }
}

@keyframes live-pulse {
  70%, 100% { box-shadow: 0 0 0 9px rgba(192, 32, 42, 0); }
}

@keyframes row-enter {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
}

@media (max-width: 760px) {
  .site-header,
  main {
    width: 100%;
  }

  .site-header {
    border-right: 0;
    border-left: 0;
  }

  main {
    margin-top: 16px;
  }

  .leaderboard {
    border-right: 0;
    border-left: 0;
  }

  .board-titlebar {
    grid-template-columns: 1fr;
    gap: 30px;
    min-height: 0;
    padding: 38px 18px 20px;
  }

  .board-actions {
    grid-template-columns: 1fr 48px;
  }

  .search-field,
  .refresh-button {
    height: 48px;
  }

  .refresh-button {
    width: 48px;
  }

  th,
  td {
    padding-inline: 12px;
  }

  th:first-child,
  td:first-child {
    width: 64px;
  }

  th:nth-child(3),
  td:nth-child(3) {
    display: none;
  }

  th:last-child,
  td:last-child {
    width: 120px;
  }

  td {
    height: 70px;
  }
}

@media (max-width: 430px) {
  .brand,
  .stream-state {
    min-height: 64px;
    padding-inline: 16px;
  }

  .brand {
    font-size: 21px;
  }

  .stream-state {
    font-size: 10px;
  }

  thead {
    top: 64px;
  }

  .board-titlebar h1 {
    font-size: 2.55rem;
  }

  .board-meta {
    padding-inline: 12px;
  }

  .table-status {
    padding-block: 80px;
  }
}

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

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

}
