:root {
  --ink: #151917;
  --ink-soft: #4f5b54;
  --paper: #f4f6f2;
  --white: #ffffff;
  --line: #dce2dc;
  --green: #3da66c;
  --green-dark: #24764a;
  --blue: #397cad;
  --coral: #e5654f;
  --yellow: #e7ad35;
  --dark: #1c2420;
  --radius: 8px;
  --content: 1180px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}
button, input { font: inherit; letter-spacing: 0; }
a { color: inherit; text-decoration: none; }
svg { width: 20px; height: 20px; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 64px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 28px;
  padding: 0 max(24px, calc((100vw - var(--content)) / 2));
  color: var(--white);
  background: rgba(21, 25, 23, .97);
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 750; white-space: nowrap; }
.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  background: var(--green);
  color: var(--white);
  font-size: 12px;
  font-weight: 900;
  border-radius: 6px;
}
nav { display: flex; align-items: center; gap: 28px; color: #cdd5d0; font-size: 14px; }
nav a:hover { color: var(--white); }
.live-pill { justify-self: end; display: flex; align-items: center; gap: 8px; font-size: 13px; color: #d9e5de; }
.pulse-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--yellow); box-shadow: 0 0 0 4px rgba(231,173,53,.16); }
.live-pill.ok .pulse-dot { background: #54d58b; box-shadow: 0 0 0 4px rgba(84,213,139,.16); }
.live-pill.error .pulse-dot { background: #ff7664; box-shadow: 0 0 0 4px rgba(255,118,100,.16); }

.hero {
  position: relative;
  min-height: 370px;
  height: 47vh;
  max-height: 520px;
  overflow: hidden;
  color: var(--white);
}
.hero > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 54%; }
.hero-scrim { position: absolute; inset: 0; background: rgba(9, 17, 12, .44); }
.hero-content {
  position: relative;
  z-index: 1;
  width: min(var(--content), calc(100% - 48px));
  height: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding-top: 14px;
}
.eyebrow, .section-kicker { margin: 0 0 10px; color: #94e1b7; font-size: 12px; line-height: 1.2; font-weight: 800; text-transform: uppercase; }
.hero h1 { margin: 0; font-size: clamp(48px, 7vw, 86px); line-height: .98; font-weight: 850; }
.hero-copy { margin: 18px 0 24px; max-width: 520px; font-size: clamp(17px, 2vw, 21px); line-height: 1.6; color: #f2f5f3; }
.version-row { display: flex; flex-wrap: wrap; gap: 10px; font-size: 13px; }
.version-row span { padding: 8px 10px; background: rgba(15, 25, 19, .68); border: 1px solid rgba(255,255,255,.18); border-radius: 4px; backdrop-filter: blur(8px); }

.metrics-band {
  position: relative;
  z-index: 2;
  width: min(var(--content), calc(100% - 48px));
  margin: -34px auto 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--white);
  border: 1px solid var(--line);
  box-shadow: 0 16px 40px rgba(32, 49, 39, .12);
  border-radius: var(--radius);
  overflow: hidden;
}
.metric { min-height: 104px; display: flex; align-items: center; gap: 14px; padding: 20px 22px; border-right: 1px solid var(--line); }
.metric:last-child { border-right: 0; }
.metric-icon { flex: 0 0 40px; height: 40px; display: grid; place-items: center; border-radius: 6px; }
.metric-icon.green { color: var(--green-dark); background: #e5f5eb; }
.metric-icon.blue { color: var(--blue); background: #e9f2f8; }
.metric-icon.coral { color: var(--coral); background: #fcece8; }
.metric-icon.yellow { color: #9c6b08; background: #fbf1d8; }
.metric span { display: block; color: var(--ink-soft); font-size: 12px; margin-bottom: 5px; }
.metric strong { display: block; font-size: 24px; line-height: 1; white-space: nowrap; }

.section { width: min(var(--content), calc(100% - 48px)); margin: 0 auto; padding: 82px 0; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
.section-kicker { color: var(--green-dark); }
h2 { margin: 0; font-size: clamp(28px, 4vw, 40px); line-height: 1.15; }
.icon-button {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid #cbd4cd;
  color: var(--ink);
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
}
.icon-button:hover { background: var(--white); }
.icon-button.loading svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.server-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.server-card { padding: 20px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); }
.server-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.server-name { margin: 0; font-size: 17px; line-height: 1.35; }
.server-short { display: block; margin-top: 4px; color: var(--ink-soft); font-size: 12px; }
.status-dot { flex: 0 0 9px; height: 9px; margin-top: 5px; border-radius: 50%; background: #a8b1ab; }
.status-dot.online { background: var(--green); }
.server-count { display: flex; align-items: baseline; justify-content: space-between; margin: 22px 0 8px; }
.server-count strong { font-size: 26px; }
.server-count span { color: var(--ink-soft); font-size: 12px; }
.capacity { height: 7px; overflow: hidden; background: #ebefec; border-radius: 4px; }
.capacity > span { display: block; height: 100%; background: var(--green); border-radius: inherit; }
.server-meta { display: flex; justify-content: space-between; margin-top: 14px; color: var(--ink-soft); font-size: 12px; }
.loading-line { grid-column: 1 / -1; padding: 30px 0; color: var(--ink-soft); list-style: none; }

.ranking-band { padding: 76px max(24px, calc((100vw - var(--content)) / 2)); color: var(--white); background: var(--dark); }
.light-heading .section-kicker { color: #7bd8a5; }
.segmented { display: inline-grid; grid-template-columns: repeat(2, 72px); height: 38px; padding: 3px; background: #303a35; border-radius: 6px; }
.segmented button { border: 0; color: #c9d0cc; background: transparent; border-radius: 4px; cursor: pointer; }
.segmented button.active { color: var(--ink); background: var(--white); font-weight: 700; }
.ranking-layout { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(260px, .7fr); gap: 46px; align-items: start; }
.leaderboard { margin: 0; padding: 0; list-style: none; border-top: 1px solid #3c4741; }
.leader-row { min-height: 64px; display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; align-items: center; gap: 12px; border-bottom: 1px solid #3c4741; }
.rank { color: #9fa9a3; font-size: 14px; font-variant-numeric: tabular-nums; }
.rank.top { color: #ffd36f; font-weight: 800; }
.driver { min-width: 0; }
.driver strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
.driver span { display: block; margin-top: 3px; color: #8f9b94; font-size: 11px; }
.distance { color: #83dfad; font-size: 17px; font-weight: 750; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mileage-note { padding: 24px 0 0 24px; border-left: 3px solid var(--coral); }
.mileage-note > svg { color: #ff8a75; }
.mileage-note h3 { margin: 15px 0 10px; font-size: 18px; }
.mileage-note p { margin: 0 0 10px; color: #b9c2bd; font-size: 13px; line-height: 1.7; }

.request-band { width: min(var(--content), calc(100% - 48px)); margin: 0 auto; padding: 82px 0 34px; }
.docs-link { height: 40px; display: inline-flex; align-items: center; gap: 8px; padding: 0 13px; color: var(--green-dark); background: var(--white); border: 1px solid #cbd4cd; border-radius: 6px; font-size: 13px; font-weight: 700; }
.docs-link:hover { border-color: var(--green); }
.docs-link svg { width: 15px; height: 15px; }
.request-table { overflow: hidden; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); }
.request-head, .request-row { display: grid; grid-template-columns: 154px 72px minmax(160px, .9fr) 112px minmax(180px, 1.2fr) 76px; align-items: center; gap: 12px; min-width: 0; }
.request-head { min-height: 42px; padding: 0 16px; color: #657269; background: #eef2ee; border-bottom: 1px solid var(--line); font-size: 11px; font-weight: 750; }
.request-row { min-height: 52px; padding: 8px 16px; border-bottom: 1px solid #e8ece9; font-size: 12px; }
.request-row:last-child { border-bottom: 0; }
.request-row:hover { background: #f8faf8; }
.request-cell { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.request-time { color: #58635c; font-variant-numeric: tabular-nums; }
.method-badge { width: fit-content; padding: 4px 7px; color: #176a3d; background: #e4f5ea; border-radius: 4px; font-size: 10px; font-weight: 850; }
.request-path { color: #166e9d; font-family: Consolas, "SFMono-Regular", monospace; font-weight: 700; }
.request-ip, .request-param { color: #657269; font-family: Consolas, "SFMono-Regular", monospace; }
.request-latency { justify-self: end; color: var(--green-dark); font-weight: 750; font-variant-numeric: tabular-nums; }
.request-latency.slow { color: var(--coral); }
.privacy-note { display: flex; align-items: center; gap: 7px; margin: 12px 0 0; color: #6d7971; font-size: 11px; }
.privacy-note svg { width: 15px; height: 15px; color: var(--green-dark); }

.player-section { display: grid; grid-template-columns: .85fr 1.15fr; gap: 70px; align-items: stretch; }
.player-query { padding: 18px 0; }
.player-query > p:not(.section-kicker) { color: var(--ink-soft); line-height: 1.7; }
.player-query form { margin-top: 30px; }
.player-query label { display: block; margin-bottom: 8px; font-size: 13px; font-weight: 700; }
.input-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.input-row input { min-width: 0; height: 48px; padding: 0 14px; border: 1px solid #bdc9c0; outline: 0; border-radius: 6px; background: var(--white); }
.input-row input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(61,166,108,.12); }
.input-row button { height: 48px; display: flex; align-items: center; gap: 8px; padding: 0 18px; border: 0; color: var(--white); background: var(--green-dark); border-radius: 6px; cursor: pointer; font-weight: 700; }
.input-row button:hover { background: #1d623c; }
.input-row button:disabled { opacity: .6; cursor: wait; }
.player-result { min-height: 300px; padding: 28px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); }
.player-result.empty, .player-result.loading { display: grid; place-items: center; align-content: center; gap: 10px; color: #829087; }
.player-result.empty > svg, .player-result.loading > svg { width: 34px; height: 34px; }
.player-result.empty p, .player-result.loading p { margin: 0; }
.player-head { display: flex; align-items: center; gap: 16px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.player-avatar { width: 62px; height: 62px; object-fit: cover; border-radius: 6px; background: #e7ebe8; }
.avatar-fallback { display: grid; place-items: center; color: var(--ink-soft); }
.player-head h3 { margin: 0 0 5px; font-size: 21px; }
.player-head p { margin: 0; color: var(--ink-soft); font-size: 13px; }
.player-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; margin: 20px 0; background: var(--line); border: 1px solid var(--line); }
.player-stat { padding: 16px; background: var(--white); }
.player-stat span { display: block; margin-bottom: 6px; color: var(--ink-soft); font-size: 11px; }
.player-stat strong { font-size: 18px; }
.player-details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 24px; }
.detail { min-width: 0; }
.detail span { display: block; margin-bottom: 3px; color: var(--ink-soft); font-size: 11px; }
.detail strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }

footer { min-height: 96px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 24px max(24px, calc((100vw - var(--content)) / 2)); color: #c5cec9; background: #111512; }
footer div { display: flex; align-items: baseline; gap: 12px; }
footer span { color: #7f8c84; font-size: 12px; }
footer a { display: flex; align-items: center; gap: 7px; font-size: 13px; }
footer a:hover { color: var(--white); }
footer svg { width: 15px; height: 15px; }
.toast { position: fixed; right: 20px; bottom: 20px; z-index: 30; max-width: min(360px, calc(100vw - 40px)); padding: 12px 15px; color: var(--white); background: #2c3630; border-radius: 6px; box-shadow: 0 12px 30px rgba(0,0,0,.25); opacity: 0; transform: translateY(10px); pointer-events: none; transition: .2s ease; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: #9c3f32; }

@media (max-width: 900px) {
  .site-header { grid-template-columns: 1fr auto; }
  nav { display: none; }
  .metrics-band { grid-template-columns: repeat(2, 1fr); }
  .metric:nth-child(2) { border-right: 0; }
  .metric:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .server-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ranking-layout { grid-template-columns: 1fr; gap: 30px; }
  .mileage-note { padding-top: 10px; }
  .request-head, .request-row { grid-template-columns: 144px 65px minmax(150px, 1fr) 105px minmax(160px, 1fr) 65px; }
  .request-table { overflow-x: auto; }
  #request-rows, .request-head { min-width: 850px; }
  .player-section { grid-template-columns: 1fr; gap: 28px; }
}

@media (max-width: 600px) {
  .site-header { height: 58px; padding: 0 16px; }
  .brand { font-size: 14px; }
  .brand-mark { width: 30px; height: 30px; }
  .live-pill { font-size: 11px; }
  .hero { min-height: 390px; height: 58vh; max-height: 500px; }
  .hero > img { object-position: 67% center; }
  .hero-content { width: calc(100% - 32px); padding-top: 0; justify-content: flex-end; padding-bottom: 70px; }
  .hero h1 { font-size: 50px; }
  .hero-copy { margin: 12px 0 18px; font-size: 16px; }
  .metrics-band { width: calc(100% - 24px); margin-top: -38px; }
  .metric { min-height: 90px; padding: 15px 12px; gap: 10px; }
  .metric-icon { flex-basis: 34px; height: 34px; }
  .metric-icon svg { width: 18px; height: 18px; }
  .metric strong { font-size: 18px; }
  .section { width: calc(100% - 32px); padding: 62px 0; }
  .server-grid { grid-template-columns: 1fr; }
  .ranking-band { padding: 58px 16px; }
  .request-band { width: calc(100% - 32px); padding: 58px 0 20px; }
  .request-table { overflow: hidden; background: transparent; border: 0; }
  .request-head { display: none; }
  #request-rows { min-width: 0; display: grid; gap: 8px; }
  .request-row { min-width: 0; min-height: 96px; grid-template-columns: auto minmax(0, 1fr) auto; gap: 7px 10px; padding: 13px; background: var(--white); border: 1px solid var(--line); border-radius: 6px; }
  .request-row:last-child { border-bottom: 1px solid var(--line); }
  .request-time { grid-column: 2; grid-row: 1; }
  .method-badge { grid-column: 1; grid-row: 1; }
  .request-latency { grid-column: 3; grid-row: 1; }
  .request-path { grid-column: 1 / -1; grid-row: 2; }
  .request-ip { grid-column: 1; grid-row: 3; }
  .request-param { grid-column: 2 / -1; grid-row: 3; text-align: right; }
  .section-heading { align-items: center; }
  .segmented { grid-template-columns: repeat(2, 60px); }
  .leader-row { grid-template-columns: 34px minmax(0, 1fr) auto; }
  .distance { font-size: 15px; }
  .input-row { grid-template-columns: 1fr; }
  .input-row button { justify-content: center; }
  .player-result { padding: 20px 16px; }
  .player-stats { grid-template-columns: 1fr; }
  .player-details { grid-template-columns: 1fr; }
  footer { align-items: flex-start; flex-direction: column; }
  footer div { align-items: flex-start; flex-direction: column; gap: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
