:root {
  color-scheme: light;
  --ink: #173c36;
  --ink-soft: #49645f;
  --cream: #f6f1e6;
  --paper: #fffdf8;
  --line: #ddd7ca;
  --gold: #d8a93e;
  --gold-soft: #f1dfad;
  --mint: #dfeae2;
  --danger: #a43f36;
  --shadow: 0 22px 60px rgba(29, 49, 43, 0.12);
  --shadow-soft: 0 10px 28px rgba(29, 49, 43, 0.08);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--cream);
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 80% 8%, rgba(216, 169, 62, 0.18), transparent 25rem),
    linear-gradient(rgba(23, 60, 54, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 60, 54, 0.025) 1px, transparent 1px),
    var(--cream);
  background-size: auto, 36px 36px, 36px 36px, auto;
}

button,
input {
  font: inherit;
}

a {
  color: inherit;
}

.page-shell {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 84px;
  border-bottom: 1px solid rgba(23, 60, 54, 0.13);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  font-weight: 800;
  letter-spacing: -0.025em;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: var(--paper);
  font-size: 23px;
  background: var(--ink);
  border-radius: 12px;
  box-shadow: 0 6px 16px rgba(23, 60, 54, 0.18);
}

.source-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-soft);
  font-size: 0.9rem;
  font-weight: 650;
  text-decoration: none;
}

.source-link:hover {
  color: var(--ink);
}

.hero {
  display: grid;
  grid-template-columns: 1fr 310px;
  gap: 70px;
  align-items: center;
  min-height: 430px;
  padding: 68px 8px 52px;
}

.eyebrow {
  margin: 0 0 10px;
  color: #8a6920;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 720px;
  margin-bottom: 20px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(3.35rem, 7.3vw, 6.7rem);
  font-weight: 500;
  letter-spacing: -0.065em;
  line-height: 0.92;
}

.intro {
  max-width: 620px;
  margin-bottom: 0;
  color: var(--ink-soft);
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  line-height: 1.65;
}

.chess-card {
  position: relative;
  display: grid;
  aspect-ratio: 0.88;
  place-items: center;
  overflow: hidden;
  background:
    linear-gradient(135deg, transparent 49.5%, rgba(255, 255, 255, 0.16) 50%),
    var(--ink);
  border-radius: 40px 40px 40px 10px;
  box-shadow: var(--shadow);
}

.chess-card::before,
.chess-card::after {
  position: absolute;
  width: 44%;
  aspect-ratio: 1;
  content: "";
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.chess-card::before {
  top: 0;
  right: 0;
}

.chess-card::after {
  bottom: 0;
  left: 0;
}

.piece,
.piece-shadow {
  position: absolute;
  color: var(--gold-soft);
  font-family: Georgia, serif;
  font-size: 10rem;
  line-height: 1;
}

.piece-shadow {
  color: rgba(0, 0, 0, 0.18);
  transform: translate(12px, 16px);
  filter: blur(2px);
}

.rating-chip {
  position: absolute;
  right: 22px;
  bottom: 22px;
  display: flex;
  align-items: baseline;
  gap: 9px;
  min-width: 118px;
  padding: 13px 17px;
  color: var(--ink);
  background: var(--gold-soft);
  border-radius: 15px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.2);
}

.rating-chip span {
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.1em;
}

.rating-chip strong {
  font-family: Georgia, serif;
  font-size: 1.9rem;
}

.search-panel {
  position: relative;
  z-index: 2;
  padding: 26px;
  background: rgba(255, 253, 248, 0.9);
  border: 1px solid rgba(23, 60, 54, 0.1);
  border-radius: 24px;
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(16px);
}

.search-box {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 0 18px;
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: 16px;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.search-box:focus-within {
  border-color: var(--gold);
  box-shadow: 0 0 0 4px rgba(216, 169, 62, 0.17);
  transform: translateY(-1px);
}

.search-box svg {
  fill: none;
  stroke: var(--ink-soft);
  stroke-linecap: round;
  stroke-width: 1.8;
}

.search-box input {
  width: 100%;
  height: 64px;
  padding: 0;
  color: var(--ink);
  font-size: 1.12rem;
  font-weight: 650;
  background: transparent;
  border: 0;
  outline: 0;
}

.search-box input::placeholder {
  color: #8a9793;
  font-weight: 500;
}

.key-hint {
  padding: 5px 8px;
  color: var(--ink-soft);
  font-size: 0.72rem;
  font-weight: 750;
  background: var(--mint);
  border: 1px solid rgba(23, 60, 54, 0.09);
  border-radius: 7px;
}

.search-meta {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 11px 3px 0;
  color: var(--ink-soft);
  font-size: 0.82rem;
}

.search-meta p {
  margin-bottom: 0;
}

.results-section {
  padding: 74px 0 40px;
}

.results-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.results-heading h2 {
  margin-bottom: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 500;
  letter-spacing: -0.045em;
}

.result-count {
  padding: 8px 12px;
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 800;
  background: var(--mint);
  border-radius: 999px;
}

.state-card {
  display: grid;
  min-height: 260px;
  padding: 52px 24px;
  place-items: center;
  align-content: center;
  text-align: center;
  background: rgba(255, 253, 248, 0.65);
  border: 1px dashed rgba(23, 60, 54, 0.25);
  border-radius: 24px;
}

.state-icon {
  display: grid;
  width: 50px;
  height: 50px;
  margin-bottom: 18px;
  place-items: center;
  color: var(--paper);
  font-size: 1.6rem;
  font-weight: 900;
  background: var(--ink);
  border-radius: 15px;
}

.state-card h3 {
  margin-bottom: 8px;
  font-family: Georgia, serif;
  font-size: 1.5rem;
  font-weight: 600;
}

.state-card p {
  max-width: 480px;
  margin-bottom: 0;
  color: var(--ink-soft);
  line-height: 1.6;
}

.error-state .state-icon {
  background: var(--danger);
}

.error-state button {
  margin-top: 20px;
  padding: 11px 16px;
  color: var(--paper);
  font-weight: 750;
  background: var(--ink);
  border: 0;
  border-radius: 10px;
  cursor: pointer;
}

.results-list {
  display: grid;
  gap: 12px;
}

.player-card {
  display: grid;
  grid-template-columns: minmax(250px, 1.45fr) minmax(270px, 0.85fr);
  gap: 24px;
  align-items: center;
  padding: 22px;
  background: var(--paper);
  border: 1px solid rgba(23, 60, 54, 0.11);
  border-radius: 20px;
  box-shadow: 0 5px 18px rgba(29, 49, 43, 0.045);
  transition: transform 150ms ease, box-shadow 150ms ease, border-color 150ms ease;
}

.player-card:hover {
  border-color: rgba(216, 169, 62, 0.55);
  box-shadow: var(--shadow-soft);
  transform: translateY(-2px);
}

.player-identity {
  display: flex;
  gap: 16px;
  align-items: center;
  min-width: 0;
}

.avatar {
  position: relative;
  display: grid;
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  place-items: center;
  color: var(--ink);
  font-family: Georgia, serif;
  font-size: 1.5rem;
  font-weight: 700;
  background: var(--gold-soft);
  border-radius: 16px 16px 16px 5px;
}

.player-name {
  margin-bottom: 5px;
  overflow: hidden;
  font-size: 1.08rem;
  letter-spacing: -0.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-club {
  margin-bottom: 0;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 0.86rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(64px, 1fr));
  gap: 8px;
}

.stat,
.primary-stat {
  display: flex;
  min-height: 62px;
  padding: 9px 12px;
  flex-direction: column;
  justify-content: center;
  background: var(--cream);
  border-radius: 12px;
}

.primary-stat {
  color: var(--paper);
  background: var(--ink);
}

.stat span,
.primary-stat span {
  margin-bottom: 3px;
  color: var(--ink-soft);
  font-size: 0.62rem;
  font-weight: 850;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.primary-stat span {
  color: rgba(255, 255, 255, 0.62);
}

.stat strong,
.primary-stat strong {
  overflow: hidden;
  font-size: 1rem;
  text-overflow: ellipsis;
}

.primary-stat strong {
  font-family: Georgia, serif;
  font-size: 1.55rem;
}

.membership-list {
  display: flex;
  grid-column: 1 / -1;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: -8px;
  padding-left: 68px;
}

.membership-tag {
  padding: 5px 9px;
  color: var(--ink-soft);
  font-size: 0.73rem;
  font-weight: 650;
  background: var(--mint);
  border-radius: 999px;
}

.membership-tag.passive {
  opacity: 0.68;
}

.loading-list {
  display: grid;
  gap: 12px;
}

.skeleton-card {
  height: 110px;
  background: linear-gradient(100deg, rgba(255, 253, 248, 0.65) 20%, #fff 45%, rgba(255, 253, 248, 0.65) 70%);
  background-size: 200% 100%;
  border: 1px solid rgba(23, 60, 54, 0.08);
  border-radius: 20px;
  animation: shimmer 1.25s infinite linear;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 30px;
  margin-top: 50px;
  padding: 28px 0 38px;
  color: var(--ink-soft);
  font-size: 0.76rem;
  border-top: 1px solid rgba(23, 60, 54, 0.13);
}

footer p {
  margin-bottom: 0;
}

footer a {
  font-weight: 700;
}

[hidden] {
  display: none !important;
}

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

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

@media (max-width: 760px) {
  .page-shell {
    width: min(100% - 24px, 680px);
  }

  .site-header {
    min-height: 72px;
  }

  .source-link {
    font-size: 0;
  }

  .source-link span {
    font-size: 1rem;
  }

  .hero {
    grid-template-columns: 1fr;
    gap: 34px;
    min-height: 0;
    padding: 54px 2px 40px;
  }

  h1 {
    font-size: clamp(3.2rem, 16vw, 5.2rem);
  }

  .chess-card {
    display: none;
  }

  .search-panel {
    padding: 14px;
    border-radius: 20px;
  }

  .search-box {
    grid-template-columns: auto 1fr;
  }

  .key-hint {
    display: none;
  }

  .search-meta {
    display: block;
  }

  #data-status {
    margin-top: 5px;
  }

  .results-section {
    padding-top: 52px;
  }

  .player-card {
    grid-template-columns: 1fr;
    gap: 17px;
    padding: 17px;
  }

  .player-stats {
    grid-template-columns: repeat(3, 1fr);
  }

  .membership-list {
    grid-column: auto;
    margin-top: -5px;
    padding-left: 0;
  }

  footer {
    flex-direction: column;
    gap: 10px;
  }
}

@media (max-width: 430px) {
  .optional-stat {
    display: none;
  }

  .player-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
