:root {
  color-scheme: dark;
  --bg: #090b0e;
  --surface: #11151a;
  --surface-soft: #171c22;
  --line: #2b3139;
  --text: #f4f0e6;
  --muted: #9ca3ad;
  --gold: #dfb75f;
  --gold-bright: #f3d27f;
  --red: #a94538;
  --green: #56b184;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 5%, rgba(169, 69, 56, 0.18), transparent 34rem),
    radial-gradient(circle at 88% 15%, rgba(223, 183, 95, 0.1), transparent 30rem),
    var(--bg);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.page-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 56px 0 32px;
}

.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 36px;
}

.eyebrow,
.section-kicker {
  margin: 0 0 10px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.18em;
}

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

h1 {
  margin-bottom: 12px;
  font-family: "STKaiti", "KaiTi", serif;
  font-size: clamp(44px, 8vw, 78px);
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 0.95;
}

h2 {
  margin-bottom: 0;
  font-size: 24px;
}

.hero-copy,
.personal-intro p {
  max-width: 590px;
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.7;
}

.health-card {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 230px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(17, 21, 26, 0.84);
}

.health-card div {
  display: grid;
  gap: 3px;
}

.health-card span {
  color: var(--muted);
  font-size: 12px;
}

.health-dot {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 5px rgba(223, 183, 95, 0.1);
}

.health-dot.online {
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(86, 177, 132, 0.12);
}

.health-dot.offline {
  background: var(--red);
  box-shadow: 0 0 0 5px rgba(169, 69, 56, 0.12);
}

.panel {
  margin-bottom: 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(23, 28, 34, 0.96), rgba(13, 16, 20, 0.96));
  box-shadow: var(--shadow);
}

.board-switch {
  display: inline-flex;
  gap: 6px;
  padding: 6px;
}

.board-switch-button {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 0 22px;
  color: var(--muted);
  background: transparent;
  font-weight: 700;
  transition: color 140ms ease, border-color 140ms ease, background 140ms ease;
}

.board-switch-button:hover {
  color: var(--text);
}

.board-switch-button.active {
  border-color: rgba(223, 183, 95, 0.38);
  color: var(--gold-bright);
  background: rgba(223, 183, 95, 0.1);
}

.toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 24px;
}

.filter-form,
.personal-form {
  display: flex;
  align-items: flex-end;
  gap: 12px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

input,
select {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 9px;
  outline: none;
  color: var(--text);
  background: var(--surface);
  padding: 0 12px;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

input:focus,
select:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(223, 183, 95, 0.12);
}

.primary-button,
.secondary-button {
  min-height: 42px;
  border-radius: 9px;
  padding: 0 18px;
  font-weight: 700;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.primary-button {
  border: 1px solid var(--gold);
  color: #211a0d;
  background: linear-gradient(135deg, var(--gold-bright), var(--gold));
}

.secondary-button {
  border: 1px solid var(--line);
  color: var(--text);
  background: var(--surface-soft);
}

.primary-button:hover,
.secondary-button:hover {
  transform: translateY(-1px);
}

.ranking {
  overflow: hidden;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px;
  border-bottom: 1px solid var(--line);
}

.ranking-meta {
  display: flex;
  gap: 14px;
  color: var(--muted);
  font-size: 12px;
}

.state-message {
  padding: 68px 24px;
  color: var(--muted);
  text-align: center;
}

.state-message.error {
  color: #ee9385;
}

.table-wrap {
  overflow-x: auto;
}

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

th,
td {
  padding: 15px 24px;
  border-bottom: 1px solid rgba(43, 49, 57, 0.7);
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--muted);
  background: rgba(9, 11, 14, 0.32);
  font-size: 12px;
  font-weight: 600;
}

tbody tr {
  transition: background 140ms ease;
}

tbody tr:hover {
  background: rgba(223, 183, 95, 0.04);
}

.rank {
  color: var(--gold-bright);
  font-family: Georgia, serif;
  font-size: 18px;
  font-weight: 700;
}

.player-name {
  font-weight: 700;
}

.player-uid {
  display: block;
  max-width: 230px;
  overflow: hidden;
  color: var(--muted);
  font-family: Consolas, monospace;
  font-size: 11px;
  text-overflow: ellipsis;
}

.platform-tag {
  display: inline-flex;
  min-width: 34px;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px;
  color: var(--gold-bright);
  font-size: 11px;
  text-transform: uppercase;
}

.number-cell {
  text-align: right;
}

.power-value {
  color: var(--gold-bright);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.load-more {
  display: block;
  margin: 18px auto;
}

.difficulty-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.difficulty-tab {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 14px;
  color: var(--muted);
  background: var(--surface);
  transition: color 140ms ease, border-color 140ms ease, background 140ms ease;
}

.difficulty-tab:hover,
.difficulty-tab.active {
  border-color: var(--gold);
  color: #211a0d;
  background: var(--gold);
}

.time-value {
  color: var(--gold-bright);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.personal {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(520px, 1.8fr);
  gap: 28px;
  padding: 24px;
}

.personal-form {
  align-self: start;
}

.uid-field {
  flex: 1;
}

.uid-field input {
  width: 100%;
}

.personal-result {
  grid-column: 2;
  min-height: 82px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 18px;
  color: var(--muted);
  line-height: 1.6;
}

.personal-result strong {
  color: var(--gold-bright);
  font-size: 24px;
}

.personal-result.error {
  color: #ee9385;
}

.neighbor-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.neighbor {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
  color: var(--muted);
  background: rgba(9, 11, 14, 0.32);
  font-size: 12px;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 4px 0;
  color: #6f7782;
  font-size: 11px;
}

@media (max-width: 900px) {
  .hero,
  .toolbar,
  .section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .health-card {
    align-self: flex-start;
  }

  .filter-form,
  .personal-form {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .filter-form label {
    flex: 1 1 150px;
  }

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

  .personal-result {
    grid-column: 1;
  }
}

@media (max-width: 620px) {
  .page-shell {
    width: min(100% - 20px, 1180px);
    padding-top: 32px;
  }

  .toolbar,
  .section-heading,
  .personal {
    padding: 18px;
  }

  .board-switch {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .board-switch-button {
    padding: 0 12px;
  }

  .filter-form,
  .personal-form {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  th,
  td {
    padding: 13px 16px;
  }

  footer {
    flex-direction: column;
  }
}
