/* ============================================
   scrad stats — additions on top of the main site styles
   ============================================ */

/* ---- Homepage ---- */

.stats-hero {
  max-width: 760px;
  margin: 0 auto 44px;
}

.stats-hero h1 {
  margin-bottom: 10px;
}

.stats-hero > p {
  color: var(--text-dim);
  max-width: 65ch;
}

.lookup-form {
  display: flex;
  gap: 10px;
  max-width: none;
  margin: 22px 0 8px;
  padding: 0;
  background: none;
  border: 0;
}

.lookup-form input {
  flex: 1;
  margin: 0;
  height: 46px;
  font-size: 16px;
}

.lookup-form button {
  margin: 0;
  height: 46px;
  padding: 0 18px;
  white-space: nowrap;
}

.lookup-note {
  margin: 0;
}

.quick-links {
  margin: 16px 0 0;
  font-weight: 700;
}

.quick-links a {
  font-weight: 800;
}

.quick-links span {
  color: var(--text-dim);
  margin: 0 4px;
}

/* ---- Saved users ---- */

.saved-section {
  max-width: 760px;
  margin: 0 auto 36px;
}

.saved-section h2 {
  font-size: 18px;
  margin-bottom: 10px;
}

.saved-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.saved-item {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--line-soft);
}

.saved-item a {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  font-weight: 700;
  text-decoration: none;
}

.saved-item a:hover {
  background: var(--panel-2);
  text-decoration: none;
}

.saved-remove {
  margin: 0;
  border: 0;
  border-left: 1px solid var(--line-soft);
  padding: 0 9px;
  background: transparent;
  color: var(--text-dim);
  font-size: 16px;
  line-height: 1;
}

.saved-remove:hover {
  background: var(--panel-2);
  color: var(--text);
}

/* ---- Feature cards ---- */

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  max-width: 1100px;
  margin: 0 auto;
}

.feature-card {
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line-soft);
}

.feature-card strong {
  display: block;
  margin-bottom: 4px;
  font-size: 15px;
  font-weight: 800;
}

.feature-card span {
  display: block;
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1.5;
}

/* ---- User profile ---- */

.profile-head {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  padding: 0 0 22px;
  margin-bottom: 22px;
  border-bottom: 2px solid var(--line-soft);
}

.avatar {
  width: 96px;
  height: 96px;
  object-fit: cover;
  border: 1px solid var(--line-soft);
  background: var(--panel-2);
  flex-shrink: 0;
}

.profile-main {
  flex: 1;
  min-width: 0;
}

.profile-main h1 {
  margin: 0 0 4px;
}

.profile-bio {
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-width: 60ch;
  color: var(--text-dim);
  font-size: 15px;
  white-space: pre-line;
}

.profile-links {
  margin: 8px 0 0;
  font-weight: 700;
}

.profile-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

.profile-actions button {
  margin: 0;
  white-space: nowrap;
}

.btn-alt.saved {
  border-color: var(--orange);
  color: var(--link);
}

/* ---- Stat tiles ---- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 20px 0;
}

.stat-card {
  padding: 14px 14px 12px;
  background: var(--panel);
  border: 1px solid var(--line-soft);
}

.stat-value {
  display: block;
  font-size: 24px;
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.stat-label {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.note {
  margin: 8px 0 0;
  color: var(--text-dim);
  font-size: 13px;
}

.most-loved {
  margin: 6px 0 0;
  font-weight: 700;
}

.most-loved a {
  font-weight: 800;
}

/* ---- Top projects ---- */

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

.project-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px;
  background: var(--panel);
  border: 1px solid var(--line-soft);
  color: var(--text);
  text-decoration: none;
}

.project-item:hover {
  border-color: var(--orange);
  text-decoration: none;
}

.project-thumb {
  width: 96px;
  height: 72px;
  object-fit: cover;
  border: 1px solid var(--line-soft);
  background: var(--panel-2);
  flex-shrink: 0;
}

.project-info {
  min-width: 0;
}

.project-info h3 {
  margin: 0 0 2px;
  overflow: hidden;
  font-size: 16px;
  font-weight: 800;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.project-info p {
  margin: 0;
}

/* ---- Compare ---- */

.compare-form {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 10px;
  max-width: none;
  margin: 0 0 24px;
  padding: 0;
  background: none;
  border: 0;
}

.compare-form input {
  margin: 0;
  height: 44px;
}

.compare-form button {
  margin: 0;
  height: 44px;
  padding: 0 16px;
}

.compare-head {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 16px;
  align-items: center;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--line-soft);
  text-align: center;
}

.compare-user {
  min-width: 0;
}

.compare-user img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border: 1px solid var(--line-soft);
  background: var(--panel-2);
}

.compare-user h2 {
  margin: 6px 0 0;
  font-size: 18px;
  overflow-wrap: anywhere;
}

.compare-vs {
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.compare-rows {
  margin-top: 8px;
}

.compare-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 15px;
}

.compare-label {
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 700;
}

.compare-row strong {
  font-weight: 800;
}

.compare-row .win {
  color: var(--link);
}

/* ---- Project page ---- */

.project-hero {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 22px;
}

.project-image {
  width: 320px;
  max-width: 100%;
  border: 1px solid var(--line-soft);
  background: var(--panel-2);
  flex-shrink: 0;
}

.project-main {
  min-width: 0;
}

.project-main h1 {
  margin: 0 0 6px;
}

.project-desc {
  display: -webkit-box;
  -webkit-line-clamp: 6;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-width: 60ch;
  color: var(--text-dim);
  font-size: 15px;
  white-space: pre-line;
}

.project-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 0;
}

.project-actions .btn {
  text-decoration: none;
}

.project-actions .btn:hover {
  text-decoration: none;
}

/* ---- Loading / empty ---- */

.loading {
  padding: 24px 0;
  color: var(--text-dim);
  font-weight: 700;
}

/* ---- Leaderboard ---- */

.leaderboard {
  display: grid;
  gap: 6px;
  margin: 18px 0 8px;
}

.leader-row {
  display: grid;
  grid-template-columns: 44px 40px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  background: var(--panel);
  border: 1px solid var(--line-soft);
  color: var(--text);
  text-decoration: none;
}

.leader-row:hover {
  border-color: var(--orange);
  text-decoration: none;
}

.leader-rank {
  font-family: "Press Start 2P", monospace;
  font-size: 10px;
  color: var(--text-dim);
}

.leader-row:nth-child(1) .leader-rank {
  color: var(--gold);
}

.leader-row:nth-child(2) .leader-rank,
.leader-row:nth-child(3) .leader-rank {
  color: var(--link);
}

.leader-avatar {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border: 1px solid var(--line-soft);
  background: var(--panel-2);
}

.leader-name {
  font-weight: 800;
  overflow-wrap: anywhere;
}

.leader-followers {
  font-weight: 800;
  text-align: right;
  white-space: nowrap;
}

.leader-followers span {
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* ---- Responsive ---- */

@media (max-width: 760px) {
  .stats-hero {
    margin-bottom: 30px;
  }

  .lookup-form {
    flex-direction: column;
  }

  .lookup-form button {
    width: 100%;
  }

  .feature-grid {
    grid-template-columns: 1fr;
  }

  .profile-head {
    flex-wrap: wrap;
  }

  .avatar {
    width: 80px;
    height: 80px;
  }

  .profile-actions {
    flex-direction: row;
    width: 100%;
  }

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

  .compare-form {
    grid-template-columns: 1fr;
  }

  .compare-form button {
    width: 100%;
  }

  .compare-head {
    gap: 8px;
  }

  .compare-user img {
    width: 48px;
    height: 48px;
  }

  .compare-user h2 {
    font-size: 15px;
  }

  .compare-row {
    gap: 6px;
    font-size: 13px;
  }

  .project-hero {
    flex-direction: column;
  }

  .project-image {
    width: 100%;
  }

  .project-thumb {
    width: 72px;
    height: 54px;
  }
}

@media (max-width: 520px) {
  .leader-row { grid-template-columns: 36px 32px 1fr auto; gap: 8px; padding: 8px; }
  .leader-avatar { width: 32px; height: 32px; }
  .leader-followers span { display: none; }
}
