:root {
  --bg: #0d1117;
  --bg-elevated: #11181f;
  --card: #161f2b;
  --card-hover: #1a2533;
  --border: #1e2a3a;
  --border-bright: #2b3b50;
  --text: #f3f6fb;
  --text-muted: #8b99ac;
  --text-faint: #5d6b7e;
  --accent-a: #8a3ab9;
  --accent-b: #e1306c;
  --accent-c: #fcaf45;
  --gradient: linear-gradient(120deg, #8a3ab9 0%, #e1306c 52%, #fcaf45 100%);
  --radius: 16px;
  --shadow: 0 18px 40px -22px rgba(0, 0, 0, 0.85);
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  position: relative;
  overflow-x: hidden;
}

/* Ambient gradient glow behind the masthead */
.glow {
  position: fixed;
  inset: -30% 0 auto 0;
  height: 60vh;
  background: radial-gradient(60% 60% at 50% 0%, rgba(225, 48, 108, 0.18), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

main,
.masthead,
.footnote {
  position: relative;
  z-index: 1;
}

/* ---------- Masthead ---------- */
.masthead {
  max-width: 1080px;
  margin: 0 auto;
  padding: 64px 24px 28px;
  text-align: center;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 14px;
}

.wordmark__icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: #fff;
  background: var(--gradient);
  box-shadow: 0 8px 22px -8px rgba(225, 48, 108, 0.6);
}

.wordmark__icon svg {
  width: 24px;
  height: 24px;
}

.masthead h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: clamp(2.2rem, 6vw, 3rem);
  letter-spacing: -0.02em;
  margin: 0;
  background: linear-gradient(90deg, #fff, #c9d3e0);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.tagline {
  margin: 14px auto 0;
  max-width: 42ch;
  color: var(--text-muted);
  font-size: 1.4rem;
}

/* ---------- Search form ---------- */
main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px 80px;
}

.search {
  background: linear-gradient(180deg, var(--bg-elevated), rgba(17, 24, 31, 0.4));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}

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

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.field__label {
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.field input {
  width: 100%;
  padding: 12px 14px;
  background: #0c1219;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font: inherit;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.field input::placeholder {
  color: var(--text-faint);
}

.field input:focus {
  outline: none;
  border-color: var(--accent-b);
  box-shadow: 0 0 0 3px rgba(225, 48, 108, 0.18);
}

.search__button {
  margin-top: 18px;
  width: 100%;
  border: none;
  border-radius: 11px;
  padding: 14px 20px;
  font: inherit;
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: 0.01em;
  color: #fff;
  background: var(--gradient);
  background-size: 160% 160%;
  background-position: 0% 50%;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background-position 0.5s ease;
  box-shadow: 0 10px 26px -12px rgba(225, 48, 108, 0.7);
}

.search__button:hover {
  background-position: 100% 50%;
  box-shadow: 0 14px 30px -10px rgba(225, 48, 108, 0.8);
}

.search__button:active {
  transform: translateY(1px);
}

.search__button:disabled {
  opacity: 0.6;
  cursor: progress;
}

.search__button-icon {
  width: 18px;
  height: 18px;
}

/* ---------- Gender toggle ---------- */
.gender {
  margin: 16px 0 0;
  padding: 0;
  border: 0;
}

.gender legend {
  padding: 0;
  margin-bottom: 7px;
}

.gender__options {
  display: inline-flex;
  padding: 4px;
  gap: 4px;
  background: #0c1219;
  border: 1px solid var(--border);
  border-radius: 11px;
}

.gender__option {
  position: relative;
}

.gender__option input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.gender__option span {
  display: block;
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.18s ease, background 0.18s ease;
  user-select: none;
}

.gender__option span:hover {
  color: var(--text);
}

.gender__option input:checked + span {
  color: #fff;
  background: var(--gradient);
  box-shadow: 0 8px 18px -10px rgba(225, 48, 108, 0.7);
}

.gender__option input:focus-visible + span {
  outline: 2px solid var(--accent-b);
  outline-offset: 2px;
}

/* ---------- Results ---------- */
.results {
  margin-top: 30px;
}

.results__status {
  margin: 0 0 18px;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.results__status.is-error {
  color: #ff8095;
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  width: 100%;
}

/* ---------- Profile card ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  /* Allow the card to shrink inside its grid track instead of overflowing. */
  min-width: 0;
  /* Fixed, uniform card size so the grid stays tidy regardless of bio length. */
  min-height: 184px;
  text-decoration: none;
  color: inherit;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
  animation: rise 0.4s ease both;
}

.card:hover {
  transform: translateY(-4px);
  background: var(--card-hover);
  border-color: var(--border-bright);
  box-shadow: var(--shadow);
}

.card:focus-visible {
  outline: 2px solid var(--accent-b);
  outline-offset: 2px;
}

.avatar {
  flex: 0 0 auto;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  object-fit: cover;
  background: #0c1219;
  border: 2px solid transparent;
  background-clip: padding-box;
  position: relative;
}

/* Gradient ring wrapper for the avatar */
.avatar-ring {
  flex: 0 0 auto;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  padding: 2px;
  background: var(--gradient);
  display: grid;
  place-items: center;
}

.avatar-ring .avatar {
  width: 60px;
  height: 60px;
  border: 2px solid var(--card);
}

.avatar-fallback {
  display: grid;
  place-items: center;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 1.4rem;
  color: #fff;
  text-transform: uppercase;
}

.card__body {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* ---------- Platform badge ---------- */
.platform-badge {
  --platform-color: var(--accent-b);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  align-self: flex-start;
  margin-bottom: 8px;
  padding: 3px 9px 3px 7px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--platform-color);
  background: color-mix(in srgb, var(--platform-color) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--platform-color) 38%, transparent);
}

.platform-badge__icon {
  display: inline-flex;
  width: 13px;
  height: 13px;
}

.platform-badge__icon svg {
  width: 100%;
  height: 100%;
}

.platform-badge__label {
  line-height: 1;
}

.card__name {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 1.02rem;
  margin: 0;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card__handle {
  display: inline-block;
  margin-top: 2px;
  font-size: 0.86rem;
  font-weight: 500;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.card__bio {
  margin: 10px 0 0;
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------- Skeletons ---------- */
.skeleton {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  gap: 14px;
}

.skeleton__avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.skeleton__lines {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding-top: 4px;
}

.skeleton__line {
  height: 11px;
  border-radius: 6px;
}

.skeleton__line.w-60 { width: 60%; }
.skeleton__line.w-40 { width: 40%; }
.skeleton__line.w-90 { width: 90%; }
.skeleton__line.w-75 { width: 75%; }

.skeleton__avatar,
.skeleton__line {
  background: linear-gradient(90deg, #161f2b 25%, #1f2b3b 50%, #161f2b 75%);
  background-size: 200% 100%;
  animation: shimmer 1.3s infinite linear;
}

/* ---------- State panel ---------- */
.state {
  border: 1px dashed var(--border-bright);
  border-radius: var(--radius);
  padding: 48px 28px;
  text-align: center;
}

.state__title {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 1.15rem;
  margin: 0 0 8px;
}

.state__body {
  margin: 0 auto;
  max-width: 42ch;
  color: var(--text-muted);
}

/* ---------- Load more ---------- */
.load-more {
  display: block;
  margin: 28px auto 0;
  padding: 12px 26px;
  border-radius: 11px;
  border: 1px solid var(--border-bright);
  background: var(--bg-elevated);
  color: var(--text);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease;
}

.load-more:hover {
  border-color: var(--accent-b);
  background: var(--card-hover);
}

.load-more:disabled {
  opacity: 0.6;
  cursor: progress;
}

/* ---------- Footer ---------- */
.footnote {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px 56px;
  text-align: center;
}

.footnote p {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-faint);
}

/* ---------- Animations ---------- */
@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .search__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  .masthead { padding-top: 44px; }
  .grid { grid-template-columns: minmax(0, 1fr); }
  .search__grid { grid-template-columns: minmax(0, 1fr); }
}
