:root {
  --sgv16-yellow: #ffcc00;
  --sgv16-yellow-hover: #e6b800;
  --sgv16-yellow-active: #cca300;
}

.stat-portal {
  padding: 1.2rem;
}

.stat-portal__hero h1 {
  margin: 0 0 .55rem;
  font-size: clamp(1.8rem, 3.4vw, 2.6rem);
}

.stat-portal__hero p {
  max-width: 74ch;
}

.stat-portal__search {
  margin-top: 1.25rem;
  padding: .95rem;
  border: 1px solid #d2d6dc;
  border-radius: 8px;
  background: #fff;
}

.stat-portal__search-row {
  display: flex;
  gap: .65rem;
  margin-top: .35rem;
}

.stat-portal__search input {
  flex: 1;
  border: 1px solid #c2c8d0;
  border-radius: 999px;
  padding: .52rem .85rem;
}

.stat-portal__search button {
  border: 0;
  border-radius: 999px;
  background: #1f2937;
  color: #fff;
  font-weight: 700;
  padding: .52rem .95rem;
}

.stat-portal__loading {
  margin-top: .55rem;
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  color: #374151;
  font-size: .92rem;
}

.stat-portal__spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid #d1d5db;
  border-top-color: var(--sgv16-yellow);
  animation: stat-portal-spin .8s linear infinite;
}

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

.stat-portal__resources {
  margin-top: 1.35rem;
}

.stat-portal__resources h2,
.stat-portal__preview h2 {
  margin: 0 0 .65rem;
  font-size: 1.45rem;
}

.stat-portal__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: .7rem;
}

.stat-portal__card {
  border: 1px solid #d2d6dc;
  padding: .7rem .75rem;
  background: #fff;
  text-decoration: none;
  color: inherit;
  display: block;
}

.stat-portal__card:hover {
  border-color: #9da6b2;
}

.stat-portal__card h3 {
  margin: 0;
  font-size: 1rem;
}

.stat-portal__card p {
  margin: .22rem 0 0;
  font-size: .9rem;
  color: #4b5563;
}

.stat-portal__count {
  margin-top: .35rem;
  font-weight: 800;
  font-size: 1.1rem;
}

.stat-portal__preview {
  margin-top: 1.35rem;
}

.stat-portal__preview .stat-portal__search {
  margin-top: .65rem;
  margin-bottom: .7rem;
}

.stat-seo-snippet {
  margin-top: 1.25rem;
  border: 1px solid #d2d6dc;
  border-radius: 8px;
  background: #fff;
  padding: .85rem .95rem;
}

.stat-seo-snippet h2 {
  margin: 0 0 .45rem;
  font-size: 1.15rem;
}

.stat-seo-snippet p,
.stat-seo-snippet li {
  color: #374151;
  line-height: 1.45;
}

.stat-seo-snippet ul {
  margin: .4rem 0 0;
  padding-left: 1.1rem;
}

.stat-portal__preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.stat-portal__link {
  font-size: .92rem;
}

.stat-portal__table-wrap {
  overflow: auto;
  border: 1px solid #d2d6dc;
  border-radius: 8px;
  background: #fff;
}

.stat-portal__table-wrap table {
  width: 100%;
  border-collapse: collapse;
  font-size: .95rem;
}

.stat-portal__table-wrap th,
.stat-portal__table-wrap td {
  border-top: 1px solid #e4e7ec;
  padding: .5rem .55rem;
  text-align: left;
  vertical-align: top;
}

.stat-portal__table-wrap thead th {
  border-top: 0;
  background: #f4f6f8;
  font-weight: 700;
}

.stat-resource__filters {
  margin-top: 1.2rem;
  margin-bottom: .8rem;
}

.stat-resource__row {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
}

.stat-resource__row input {
  min-width: 180px;
  flex: 1;
  border: 1px solid #c2c8d0;
  border-radius: 999px;
  padding: .5rem .8rem;
}

.stat-resource__row button,
.stat-resource__pager button,
.stat-resource__letters button {
  border: 1px solid #c2c8d0;
  border-radius: 999px;
  background: #fff;
  padding: .45rem .8rem;
  font-weight: 700;
}

.stat-resource__letters {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}

.stat-resource__actions {
  margin-top: .6rem;
  display: flex;
  justify-content: flex-end;
  gap: .5rem;
}

.stat-resource__actions button {
  border: 1px solid var(--sgv16-yellow);
  border-radius: 999px;
  background: var(--sgv16-yellow);
  color: #111827;
  padding: .45rem .9rem;
  font-weight: 700;
}

.stat-resource__actions button:hover {
  background: #ffd84b;
  border-color: #ffd84b;
}

.stat-resource__autocomplete {
  position: absolute;
  z-index: 1200;
  background: #fff;
  border: 1px solid rgba(17, 24, 39, 0.14);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.16);
  overflow: hidden;
}

.stat-resource__autocomplete button {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 9px 10px;
  font-size: 0.92rem;
  color: #111827;
  cursor: pointer;
}

.stat-resource__autocomplete button:hover {
  background: #f4f6f9;
}

.stat-resource__letters button.is-active {
  background: #1f2937;
  border-color: #1f2937;
  color: #fff;
}

.stat-resource__pager {
  margin-top: .85rem;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .55rem;
}

.stat-resource__pager button:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.stat-resource__game-row {
  cursor: pointer;
  transition: background-color .14s ease, box-shadow .14s ease;
}

.stat-resource__game-row:hover {
  background: #f6f8fb;
}

.stat-resource__game-row:focus-visible {
  outline: 2px solid var(--sgv16-yellow);
  outline-offset: -2px;
  background: #f6f8fb;
}

.stat-resource__game-row td:first-child {
  position: relative;
  padding-left: 1.45rem;
}

.stat-resource__game-row td:first-child::before {
  content: '▸';
  position: absolute;
  left: .5rem;
  top: .5rem;
  color: #6b7280;
  transition: transform .16s ease;
}

.stat-resource__game-row.is-open td:first-child::before {
  transform: rotate(90deg);
}

.stat-resource__detail-row td {
  padding: 0;
  background: #fafbfc;
}

.stat-resource__detail-card {
  padding: .85rem .95rem;
  border-top: 1px solid #e5e7eb;
}

.stat-resource__detail-grid {
  margin: 0;
  display: grid;
  grid-template-columns: minmax(140px, 220px) 1fr;
  gap: .35rem .8rem;
}

.stat-resource__detail-grid dt {
  margin: 0;
  font-weight: 700;
  color: #374151;
  padding: .42rem .5rem;
  border-bottom: 1px solid #eceff3;
}

.stat-resource__detail-grid dd {
  margin: 0;
  color: #111827;
  padding: .42rem .5rem;
  border-bottom: 1px solid #eceff3;
}

.stat-resource__detail-grid dt:nth-of-type(odd),
.stat-resource__detail-grid dd:nth-of-type(odd) {
  background: #f7f9fc;
}

.stat-resource__detail-links {
  margin-top: .75rem;
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}

.stat-resource__detail-links a {
  border: 1px solid #d1d5db;
  border-radius: 999px;
  padding: .3rem .7rem;
  text-decoration: none;
  color: #111827;
  font-weight: 700;
}

.stat-resource__detail-links-empty {
  margin: .7rem 0 0;
  color: #6b7280;
}

@media (prefers-color-scheme: dark) {
  .stat-portal__search,
  .stat-portal__card,
  .stat-seo-snippet,
  .stat-portal__table-wrap {
    background: #171a22;
    border-color: #343a46;
  }

  .stat-portal__table-wrap thead th {
    background: #222734;
  }

  .stat-portal__table-wrap th,
  .stat-portal__table-wrap td {
    border-color: #343a46;
  }

  .stat-portal__search input {
    background: #10141d;
    color: #edf0f5;
    border-color: #46505f;
  }

  .stat-portal__loading {
    color: #c4cad7;
  }

  .stat-portal__spinner {
    border-color: #46505f;
    border-top-color: var(--sgv16-yellow);
  }

  .stat-portal__card p {
    color: #9ca6b8;
  }

  .stat-seo-snippet p,
  .stat-seo-snippet li {
    color: #c4cad7;
  }

  .stat-resource__row input,
  .stat-resource__row button,
  .stat-resource__pager button,
  .stat-resource__letters button {
    background: #10141d;
    color: #edf0f5;
    border-color: #46505f;
  }

  .stat-resource__actions button {
    background: var(--sgv16-yellow);
    border-color: var(--sgv16-yellow);
    color: #171a22;
  }

  .stat-resource__actions button:hover {
    background: #ffd84b;
    border-color: #ffd84b;
    color: #171a22;
  }

  .stat-resource__autocomplete {
    background: #1f232b;
    border-color: rgba(255, 255, 255, 0.16);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
  }

  .stat-resource__autocomplete button {
    color: #f3f4f6;
  }

  .stat-resource__autocomplete button:hover {
    background: rgba(244, 202, 39, 0.18);
  }

  .stat-resource__game-row td:first-child::before {
    color: #9ca3af;
  }

  .stat-resource__game-row:hover,
  .stat-resource__game-row:focus-visible {
    background: #232b37;
  }

  .stat-resource__detail-row td {
    background: #1b202a;
  }

  .stat-resource__detail-card {
    border-top-color: #343a46;
  }

  .stat-resource__detail-grid dt {
    color: #cfd5e1;
  }

  .stat-resource__detail-grid dd {
    color: #edf0f5;
    border-bottom-color: #2a3342;
  }

  .stat-resource__detail-grid dt {
    border-bottom-color: #2a3342;
  }

  .stat-resource__detail-grid dt:nth-of-type(odd),
  .stat-resource__detail-grid dd:nth-of-type(odd) {
    background: #202736;
  }

  .stat-resource__detail-links a {
    border-color: #4b5563;
    color: #edf0f5;
  }

  .stat-resource__detail-links-empty {
    color: #9ca6b8;
  }

  .stat-resource__letters button.is-active {
    background: var(--sgv16-yellow);
    border-color: var(--sgv16-yellow);
    color: #171a22;
  }
}
