:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-muted: #f8fafb;
  --text: #17211b;
  --muted: #68736d;
  --border: #dde3df;
  --green: #23864a;
  --green-dark: #176b38;
  --green-soft: #e9f6ee;
  --blue: #2672d9;
  --blue-soft: #eaf2fd;
  --amber: #b86f13;
  --amber-soft: #fff3df;
  --red: #c83d3d;
  --red-soft: #fff0f0;
  --shadow: 0 8px 24px rgba(25, 40, 31, 0.06);
  font-family: Inter, "Microsoft YaHei", "PingFang SC", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

button, input { font: inherit; }
button { cursor: pointer; }

.site-header {
  height: 64px;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--border);
}

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

.header-inner { height: 100%; display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 11px; color: var(--text); text-decoration: none; font-size: 17px; font-weight: 700; }
.brand-mark { display: grid; grid-template-columns: repeat(3, 7px); gap: 2px; padding: 6px; background: var(--green); border-radius: 5px; }
.brand-mark span { width: 7px; height: 7px; background: white; opacity: 0.95; }
.brand-mark span:nth-child(2) { opacity: 0.55; }
.edition-badge { padding: 5px 9px; color: var(--green-dark); background: var(--green-soft); border: 1px solid #cce7d5; border-radius: 4px; font-size: 12px; font-weight: 700; }

.page-shell { padding: 58px 0 48px; }
.intro { margin-bottom: 28px; }
.eyebrow { margin: 0 0 8px; color: var(--green); font-size: 12px; line-height: 1.4; font-weight: 800; }
.intro h1 { margin: 0; font-size: clamp(28px, 4vw, 40px); line-height: 1.2; letter-spacing: 0; }
.intro > p:last-child { margin: 12px 0 0; color: var(--muted); font-size: 15px; }

.search-panel {
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.search-panel label { display: block; margin-bottom: 9px; font-size: 13px; font-weight: 700; }
.search-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.input-wrap { position: relative; min-width: 0; }
.input-wrap svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); fill: none; stroke: #829089; stroke-width: 1.8; stroke-linecap: round; }
.input-wrap input { width: 100%; height: 48px; padding: 0 14px 0 44px; border: 1px solid #cbd4cf; border-radius: 5px; outline: none; color: var(--text); background: white; transition: border-color 0.18s, box-shadow 0.18s; }
.input-wrap input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(35, 134, 74, 0.12); }
.input-wrap input::placeholder { color: #9aa39e; }
.search-row > button { min-width: 120px; height: 48px; padding: 0 20px; border: 1px solid var(--green); border-radius: 5px; background: var(--green); color: white; font-weight: 700; transition: background 0.18s, transform 0.1s; }
.search-row > button:hover { background: var(--green-dark); }
.search-row > button:active { transform: translateY(1px); }
.search-row > button:disabled { opacity: 0.72; cursor: wait; }
.form-hint { margin: 9px 0 0; color: var(--muted); font-size: 12px; }
.spinner { display: none; width: 16px; height: 16px; margin: 0 auto; border: 2px solid rgba(255,255,255,.45); border-top-color: white; border-radius: 50%; animation: spin .7s linear infinite; }
.is-loading .button-label { display: none; }
.is-loading .spinner { display: block; }
@keyframes spin { to { transform: rotate(360deg); } }

.empty-state { min-height: 290px; display: grid; place-items: center; align-content: center; text-align: center; color: var(--muted); }
.empty-icon { display: grid; place-items: center; width: 54px; height: 54px; margin-bottom: 14px; border: 1px solid var(--border); border-radius: 8px; background: white; color: #79857e; }
.empty-icon svg { width: 26px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }
.empty-state h2 { margin: 0; color: #47534c; font-size: 16px; }
.empty-state p { margin: 7px 0 0; font-size: 13px; }

.error-state { margin-top: 20px; padding: 18px 20px; display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; border: 1px solid #f1c8c8; border-radius: 7px; background: var(--red-soft); }
.error-state[hidden] { display: none; }
.error-icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; color: white; background: var(--red); font-weight: 800; }
.error-state h2 { margin: 0 0 4px; font-size: 14px; }
.error-state p { margin: 0; color: #7b4d4d; font-size: 13px; }
.secondary-button { height: 36px; padding: 0 14px; color: var(--red); background: white; border: 1px solid #e4b7b7; border-radius: 4px; font-weight: 700; }

.results { margin-top: 22px; }
.server-summary { padding: 22px; display: flex; justify-content: space-between; gap: 20px; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); }
.server-identity { min-width: 0; display: flex; gap: 16px; align-items: center; }
.server-icon { flex: 0 0 auto; width: 64px; height: 64px; display: grid; grid-template-columns: 1fr 1fr; overflow: hidden; border-radius: 6px; background: #d8e9dd; }
.server-icon span:nth-child(1), .server-icon span:nth-child(4) { background: #388856; }
.server-icon span:nth-child(2) { background: #57a16f; }
.server-icon span:nth-child(3) { background: #286d42; }
.server-icon.has-image { display: block; object-fit: cover; }
.server-title { min-width: 0; }
.status-line { display: flex; align-items: center; gap: 7px; margin-bottom: 5px; color: var(--green); font-size: 12px; font-weight: 800; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #2a9b56; box-shadow: 0 0 0 4px var(--green-soft); }
.server-title h2 { margin: 0; overflow-wrap: anywhere; font-size: 21px; line-height: 1.35; }
.server-title p { max-width: 650px; margin: 5px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; white-space: pre-line; }
.refresh-area { flex: 0 0 auto; display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.refresh-area label { color: var(--muted); white-space: nowrap; }
.refresh-area select { height: 36px; padding: 0 28px 0 9px; border: 1px solid var(--border); border-radius: 4px; outline: none; color: #425047; background: white; font-size: 12px; }
.refresh-area select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(35, 134, 74, 0.1); }
.icon-button { display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid var(--border); border-radius: 5px; color: #59665f; background: white; }
.icon-button:hover { background: var(--surface-muted); }
.icon-button svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.metrics-grid { margin-top: 14px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.metric-card { min-width: 0; min-height: 132px; padding: 20px; display: flex; align-items: center; gap: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
.metric-card > div:last-child { min-width: 0; display: flex; flex-direction: column; }
.metric-icon { flex: 0 0 auto; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 7px; }
.metric-icon svg { width: 23px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.latency-icon { color: var(--green); background: var(--green-soft); }
.players-icon { color: var(--blue); background: var(--blue-soft); }
.version-icon { color: var(--amber); background: var(--amber-soft); }
.metric-label { color: var(--muted); font-size: 12px; }
.metric-card strong { margin: 3px 0 2px; overflow: hidden; text-overflow: ellipsis; font-size: 26px; line-height: 1.25; white-space: nowrap; }
.metric-card strong small { color: #647069; font-size: 14px; font-weight: 600; }
.metric-card .version-value { max-width: 100%; font-size: 17px; }
.metric-caption { color: var(--muted); font-size: 11px; }

.details-grid { margin-top: 14px; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: 14px; }
.detail-section { min-height: 210px; padding: 20px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
.section-heading { min-height: 25px; display: flex; justify-content: space-between; align-items: center; gap: 12px; border-bottom: 1px solid var(--border); padding-bottom: 13px; }
.section-heading h3 { margin: 0; font-size: 14px; }
.section-heading span { color: var(--muted); font-size: 11px; }
.player-list { padding-top: 14px; display: flex; flex-wrap: wrap; gap: 8px; }
.player-chip { max-width: 100%; display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; border: 1px solid var(--border); border-radius: 4px; background: var(--surface-muted); font-size: 12px; }
.player-chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.empty-players { margin: 24px 0 0; color: var(--muted); font-size: 13px; }
.server-details dl { margin: 4px 0 0; }
.server-details dl > div { min-width: 0; padding: 10px 0; display: grid; grid-template-columns: 88px 1fr; gap: 12px; border-bottom: 1px solid #edf0ee; }
.server-details dl > div:last-child { border-bottom: 0; }
.server-details dt { color: var(--muted); font-size: 12px; }
.server-details dd { min-width: 0; margin: 0; text-align: right; overflow-wrap: anywhere; font-size: 12px; font-weight: 600; }

footer { padding: 0 20px 28px; color: #87918b; text-align: center; font-size: 11px; }
[hidden] { display: none !important; }

@media (max-width: 800px) {
  .metrics-grid { grid-template-columns: 1fr; }
  .metric-card { min-height: 104px; }
  .details-grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .header-inner, .page-shell { width: min(100% - 28px, 1120px); }
  .site-header { height: 58px; }
  .page-shell { padding-top: 36px; }
  .intro h1 { font-size: 28px; }
  .search-panel { padding: 16px; }
  .search-row { grid-template-columns: 1fr; }
  .search-row > button { width: 100%; }
  .error-state { grid-template-columns: auto 1fr; }
  .error-state .secondary-button { grid-column: 1 / -1; }
  .server-summary { align-items: flex-start; }
  .server-icon { width: 52px; height: 52px; }
  .server-title h2 { font-size: 17px; }
  .refresh-area { gap: 7px; }
  .refresh-area > span, .refresh-area label { display: none; }
  .refresh-area select { width: 72px; padding-left: 7px; }
  .metric-card { padding: 16px; }
}
