:root {
  --paper: #0b0d10;
  --surface: #11151b;
  --surface-hover: #171c23;
  --ink: #e8eaed;
  --muted: #949ba5;
  --line: #292f38;
  --blue: #7da6ff;
  --blue-soft: #111d36;
  --green: #5bd18c;
  --green-soft: #102a1c;
  --gold: #e6b85a;
  --gold-soft: #2a2110;
  --danger: #ef7468;
  --header-bg: rgba(11, 13, 16, .92);
  --notice-border: #294778;
  --notice-ink: #bfd1ff;
  --input-line: #39414c;
  --hover-row: rgba(255,255,255,.035);
  --subtle: #1c222a;
  --skeleton: #171c22;
  --skeleton-bar: #252c34;
  --shimmer: rgba(255,255,255,.08);
  --occupancy: #242b33;
  --rich-shadow: 0 0 1px rgba(255,255,255,.8);
  font-family: "Segoe UI Variable", "Noto Sans SC", "Microsoft YaHei UI", Arial, sans-serif;
  color: var(--ink);
  background: var(--paper);
  color-scheme: dark;
}

:root[data-theme="light"] {
  --paper: #f7f7f4;
  --surface: #ffffff;
  --surface-hover: #f4f5f2;
  --ink: #1c2024;
  --muted: #646a70;
  --line: #dcdedb;
  --blue: #2459c4;
  --blue-soft: #eaf0ff;
  --green: #217a4b;
  --green-soft: #e7f4ec;
  --gold: #8b6417;
  --gold-soft: #fbf3df;
  --danger: #a3392f;
  --header-bg: rgba(255,255,255,.92);
  --notice-border: #bdcef5;
  --notice-ink: #354566;
  --input-line: #cfd2cf;
  --hover-row: rgba(0,0,0,.025);
  --subtle: #eef0ee;
  --skeleton: #edeeeb;
  --skeleton-bar: #dfe1dd;
  --shimmer: rgba(255,255,255,.7);
  --occupancy: #e2e5e2;
  --rich-shadow: 0 0 1px rgba(0,0,0,.8);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { min-width: 320px; margin: 0; background: var(--paper); }
button, input { font: inherit; }
a { color: var(--blue); text-underline-offset: 3px; }
button, input, a { outline-offset: 3px; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--blue), white 30%); }
[data-lang="zh"] .en, [data-lang="en"] .zh { 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;
}

.skip-link {
  position: fixed;
  z-index: 20;
  top: 10px;
  left: 10px;
  padding: 10px 14px;
  color: white;
  background: var(--ink);
  transform: translateY(-150%);
}
.skip-link:focus { transform: translateY(0); }

.site-header { border-bottom: 1px solid var(--line); background: var(--header-bg); }
.header-inner {
  width: min(1160px, calc(100% - 40px));
  min-height: 64px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.wordmark { color: var(--ink); font-size: 1.03rem; font-weight: 750; letter-spacing: -.025em; text-decoration: none; }
.header-actions { display: flex; align-items: center; gap: 8px; }
.header-button {
  min-width: 50px;
  padding: 7px 11px;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
  font-size: .82rem;
  font-weight: 700;
}
.header-button:hover { border-color: var(--muted); background: var(--surface); }

main { width: min(1160px, calc(100% - 40px)); margin: 0 auto; }
.intro { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 48px; padding: 54px 0 38px; }
.eyebrow { margin: 0 0 9px; color: var(--blue); font-size: .72rem; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; }
h1, h2, h3, p { overflow-wrap: anywhere; }
h1 { max-width: 760px; margin: 0; font-size: clamp(2.35rem, 6vw, 4.75rem); line-height: .98; letter-spacing: -.06em; }
.lede { max-width: 650px; margin: 21px 0 0; color: var(--muted); font-size: 1.06rem; line-height: 1.6; }
.totals { display: flex; gap: 14px; margin: 0; }
.totals div { min-width: 132px; padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.totals dt { color: var(--muted); font-size: .72rem; }
.totals dd { margin: 6px 0 0; font-size: 1.55rem; font-weight: 750; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }

.independence-notice { display: grid; grid-template-columns: 180px 1fr; gap: 24px; align-items: start; margin-top: 22px; padding: 17px 20px; background: var(--blue-soft); border: 1px solid var(--notice-border); border-radius: 8px; }
.independence-notice strong { color: var(--blue); font-size: .88rem; }
.independence-notice p { margin: 0; color: var(--notice-ink); font-size: .86rem; line-height: 1.55; }

.featured, .directory { padding-top: 62px; }
.section-heading, .directory-heading { display: flex; justify-content: space-between; align-items: end; gap: 38px; margin-bottom: 20px; }
h2 { margin: 0; font-size: clamp(1.7rem, 3vw, 2.35rem); letter-spacing: -.045em; }
.section-heading > p, .directory-heading > p { max-width: 400px; margin: 0; color: var(--muted); font-size: .83rem; line-height: 1.5; text-align: right; }
.featured-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 13px; }
.featured-card { position: relative; min-width: 0; padding: 19px; background: var(--surface); border: 1px solid color-mix(in srgb, var(--gold), transparent 50%); border-top: 4px solid var(--gold); border-radius: 8px; }
.featured-card.is-linkable { cursor: pointer; transition: background-color .16s ease, border-color .16s ease; }
.featured-card.is-linkable:hover, .featured-card.is-linkable:focus-within { background: var(--surface-hover); border-color: var(--gold); }
.featured-card-link { position: absolute; z-index: 1; inset: 0; border-radius: inherit; }
.featured-card-link:focus-visible { outline: 3px solid var(--blue); outline-offset: 4px; }
.featured-card > :not(.featured-card-link) { position: relative; z-index: 2; pointer-events: none; }
.featured-card .server-address { pointer-events: auto; }
.featured-card-head { display: flex; justify-content: space-between; gap: 14px; align-items: start; }
.featured-card h3 { min-height: 2.6em; margin: 0; font-size: 1.05rem; line-height: 1.3; letter-spacing: -.02em; }
.featured-details { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; margin-top: 18px; }

.filters { display: flex; align-items: center; gap: 12px; margin: 27px 0 17px; }
.search-field { position: relative; flex: 1 1 500px; }
.search-field svg { position: absolute; left: 14px; top: 50%; color: var(--muted); transform: translateY(-50%); pointer-events: none; }
.search-field input {
  width: 100%;
  min-height: 46px;
  padding: 10px 14px 10px 44px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--input-line);
  border-radius: 7px;
}
.search-field input:focus { border-color: var(--blue); }
.check-filter { min-height: 46px; display: flex; align-items: center; gap: 9px; padding: 0 15px; background: var(--surface); border: 1px solid var(--line); border-radius: 7px; color: var(--ink); cursor: pointer; font-size: .83rem; white-space: nowrap; }
.check-filter input { width: 16px; height: 16px; accent-color: var(--blue); }
.filter-axis { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 12px; align-items: start; }
.filter-axis + .filter-axis { margin-top: 4px; }
.filter-axis-label { margin: 8px 0 0; color: var(--muted); font-size: .7rem; font-weight: 750; letter-spacing: .04em; text-transform: uppercase; }
.filter-chip-nav { display: flex; gap: 7px; overflow-x: auto; padding: 1px 1px 8px; scrollbar-width: thin; }
.filter-chip-nav button { flex: none; padding: 7px 10px; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; cursor: pointer; font-size: .75rem; }
.filter-chip-nav button:hover { color: var(--blue); border-color: var(--blue); }
.filter-chip-nav button.is-active { color: var(--ink); background: var(--blue-soft); border-color: var(--blue); }
.filter-chip-nav b { margin-left: 4px; color: var(--muted); font-variant-numeric: tabular-nums; }
.country-nav button:not(:first-child) { border-radius: 5px; font-weight: 750; letter-spacing: .02em; }
.result-summary { min-height: 1.5em; margin: 7px 0 22px 88px; color: var(--muted); font-size: .8rem; }

.region-section { margin: 0 0 36px; scroll-margin-top: 20px; }
.region-header { display: flex; align-items: baseline; justify-content: space-between; gap: 20px; padding-bottom: 11px; border-bottom: 2px solid var(--ink); }
.region-header h3 { margin: 0; font-size: 1.22rem; letter-spacing: -.025em; }
.region-header span { color: var(--muted); font-size: .75rem; font-variant-numeric: tabular-nums; }
.server-rows { list-style: none; margin: 0; padding: 0; }
.server-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px; align-items: center; min-height: 74px; padding: 13px 8px; border-bottom: 1px solid var(--line); }
.server-row:hover { background: var(--hover-row); }
.server-main { min-width: 0; }
.server-name { display: block; min-width: 0; overflow: hidden; color: var(--ink); font-size: .92rem; font-weight: 690; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.server-name .rich-color, .featured-card h3 .rich-color { text-shadow: var(--rich-shadow); }
.server-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 7px; color: var(--muted); font-size: .72rem; }
.server-address { appearance: none; padding: 0; color: var(--muted); background: transparent; border: 0; border-bottom: 1px dotted var(--muted); cursor: pointer; font-family: inherit; font-size: inherit; }
.server-address:hover { color: var(--blue); }
.server-side { display: flex; align-items: center; gap: 13px; }
.country-code { min-width: 34px; color: var(--muted); font-size: .72rem; font-weight: 750; text-align: center; }
.player-count { min-width: 70px; text-align: right; font-size: .9rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.player-count strong { color: var(--green); }
.occupancy { width: 62px; height: 5px; overflow: hidden; background: var(--occupancy); border-radius: 99px; }
.occupancy span { display: block; height: 100%; background: var(--green); border-radius: inherit; }
.badge { display: inline-flex; align-items: center; min-height: 22px; padding: 3px 7px; border-radius: 4px; background: var(--subtle); color: var(--muted); font-size: .65rem; font-weight: 700; }
.badge-live { background: var(--green-soft); color: var(--green); }
.badge-quiet { background: var(--subtle); color: var(--muted); }
.badge-pin { background: var(--gold-soft); color: var(--gold); }

.featured-placeholder, .loading-row { overflow: hidden; position: relative; background: var(--skeleton); }
.featured-placeholder { height: 145px; padding: 20px; border-radius: 8px; }
.featured-placeholder span { display: block; width: 76%; height: 11px; margin-bottom: 14px; background: var(--skeleton-bar); border-radius: 4px; }
.featured-placeholder span:first-child { width: 34%; }
.loading-row { height: 74px; margin-bottom: 1px; }
.featured-placeholder::after, .loading-row::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 25%, var(--shimmer) 48%, transparent 70%); transform: translateX(-100%); animation: shimmer 1.4s infinite; }
.error-state { padding: 44px 22px; text-align: center; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.error-state h3 { margin: 0; }
.error-state p { color: var(--muted); }
.error-state button, #retry-button { padding: 9px 14px; color: white; background: var(--ink); border: 0; border-radius: 6px; cursor: pointer; font-weight: 700; }
.empty-results { padding: 44px 20px; color: var(--muted); text-align: center; border: 1px solid var(--line); border-radius: 8px; }

.pagination { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 22px; }
.pagination[hidden] { display: none; }
.pagination button { min-width: 88px; padding: 8px 12px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 6px; cursor: pointer; font-size: .78rem; font-weight: 700; }
.pagination button:hover:not(:disabled) { color: var(--blue); border-color: var(--blue); }
.pagination button:disabled { cursor: default; opacity: .42; }
.pagination span { min-width: 110px; color: var(--muted); font-size: .78rem; text-align: center; font-variant-numeric: tabular-nums; }

footer { width: min(1160px, calc(100% - 40px)); margin: 76px auto 0; padding: 24px 0 40px; display: flex; justify-content: space-between; gap: 30px; border-top: 1px solid var(--line); color: var(--muted); font-size: .75rem; line-height: 1.5; }
footer p { margin: 0; }
footer p:first-child { max-width: 700px; }
.toast { position: fixed; z-index: 10; right: 20px; bottom: 20px; max-width: min(360px, calc(100% - 40px)); padding: 11px 14px; color: white; background: var(--ink); border-radius: 7px; box-shadow: 0 10px 30px rgba(0,0,0,.18); font-size: .8rem; }

@keyframes shimmer { to { transform: translateX(100%); } }

@media (max-width: 820px) {
  .intro { grid-template-columns: 1fr; align-items: start; gap: 28px; padding-top: 54px; }
  .totals { width: 100%; }
  .totals div { flex: 1; }
  .featured-grid { grid-template-columns: 1fr; }
  .featured-card h3 { min-height: auto; }
  .independence-notice { grid-template-columns: 1fr; gap: 7px; }
}

@media (max-width: 620px) {
  .header-inner, main, footer { width: min(100% - 26px, 1160px); }
  .intro { padding-top: 42px; }
  h1 { font-size: clamp(2.2rem, 13vw, 3.4rem); }
  .section-heading, .directory-heading { display: block; }
  .section-heading > p, .directory-heading > p { margin-top: 9px; text-align: left; }
  .filters { align-items: stretch; flex-direction: column; }
  .search-field { flex-basis: auto; }
  .check-filter { white-space: normal; }
  .filter-axis { grid-template-columns: 1fr; gap: 4px; }
  .filter-axis + .filter-axis { margin-top: 2px; }
  .filter-axis-label { margin-top: 4px; }
  .result-summary { margin-left: 0; }
  .server-row { grid-template-columns: minmax(0, 1fr); gap: 10px; padding: 14px 4px; }
  .server-side { justify-content: space-between; }
  .country-code { text-align: left; }
  .player-count { margin-left: auto; }
  .occupancy { width: 54px; }
  footer { align-items: flex-start; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .featured-placeholder::after, .loading-row::after { animation: none; }
}
