:root {
  color-scheme: light;
  --ink: #183432;
  --muted: #607573;
  --brand: #168c84;
  --brand-dark: #0d655f;
  --brand-soft: #e7f7f4;
  --line: #d8e4e2;
  --paper: #ffffff;
  --background: #edf4f2;
  --danger: #a62525;
  --increase: #b52323;
  --decrease: #08734d;
  --flat: #526966;
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; color: var(--ink); background: radial-gradient(circle at top right, #d9f2ed 0, transparent 36rem), var(--background); }
button { font: inherit; }
.ranking-shell { width: min(100% - 32px, 1240px); margin: 0 auto; padding: 28px 0 56px; }
.site-nav { display: inline-flex; gap: 4px; padding: 5px; border: 1px solid rgba(22, 140, 132, .14); border-radius: 14px; background: rgba(255, 255, 255, .78); box-shadow: 0 8px 30px rgba(24, 52, 50, .05); }
.site-nav a { padding: 9px 14px; border-radius: 10px; color: var(--muted); font-size: 14px; font-weight: 800; text-decoration: none; }
.site-nav a:hover { color: var(--brand-dark); background: var(--brand-soft); }
.site-nav a[aria-current="page"] { color: #fff; background: var(--brand); }
.ranking-hero { display: flex; align-items: end; justify-content: space-between; gap: 36px; padding: 42px 4px 28px; }
.eyebrow, .step { margin: 0 0 8px; color: var(--brand-dark); font-size: 13px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
h1 { margin: 0; font-size: clamp(40px, 7vw, 72px); line-height: 1; letter-spacing: -.05em; }
.hero-copy { max-width: 620px; margin: 17px 0 0; color: var(--muted); font-size: 17px; line-height: 1.7; }
.price-guide { flex: 0 0 320px; display: grid; gap: 5px; padding: 18px 20px; border: 1px solid rgba(22, 140, 132, .14); border-radius: 18px; background: rgba(255, 255, 255, .76); }
.price-guide strong { color: var(--brand-dark); font-size: 14px; }
.price-guide span { font-weight: 800; }
.price-guide small { color: var(--muted); line-height: 1.55; }
.ranking-panel { overflow: hidden; border: 1px solid rgba(22, 140, 132, .14); border-radius: 24px; background: rgba(255, 255, 255, .96); box-shadow: 0 18px 60px rgba(24, 52, 50, .08); }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; padding: 28px 30px 18px; }
h2 { margin: 0; font-size: clamp(23px, 3vw, 32px); }
.update-meta { display: grid; justify-items: end; gap: 4px; padding-top: 4px; }
.update-meta span { color: var(--muted); font-size: 12px; }
.update-meta time { font-size: 14px; font-weight: 800; font-variant-numeric: tabular-nums; }
.category-filters { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 30px 20px; border-bottom: 1px solid var(--line); }
.category-filters button, .retry-button { border: 1px solid var(--line); border-radius: 999px; cursor: pointer; font-weight: 800; transition: color .16s ease, background-color .16s ease, border-color .16s ease, transform .16s ease; }
.category-filters button { min-width: 66px; padding: 9px 17px; color: var(--muted); background: #fff; }
.category-filters button:hover { border-color: var(--brand); color: var(--brand-dark); background: var(--brand-soft); }
.category-filters button[aria-pressed="true"] { border-color: var(--brand); color: #fff; background: var(--brand); box-shadow: 0 6px 18px rgba(22, 140, 132, .18); }
.search-sort-bar { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 10px; padding: 14px 30px 18px; border-bottom: 1px solid var(--line); }
.ranking-search { position: relative; flex: 1 1 220px; max-width: 380px; margin-right: auto; }
.ranking-search-icon { position: absolute; left: 13px; top: 50%; width: 15px; height: 15px; transform: translateY(-50%); stroke: var(--muted); stroke-width: 2; fill: none; pointer-events: none; }
.ranking-search input { width: 100%; padding: 9px 14px 9px 36px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--ink); font-size: 13px; font-weight: 700; }
.ranking-search input::placeholder { color: #93a5a2; font-weight: 600; }
.ranking-search input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(22, 140, 132, .15); }
.ranking-search input::-webkit-search-cancel-button { cursor: pointer; }
.mobile-sort { padding: 9px 14px; border: 1px solid var(--line); border-radius: 999px; color: var(--brand-dark); background: #fff; font-size: 13px; font-weight: 800; }
.status-bar { display: flex; align-items: center; gap: 14px; min-height: 54px; padding: 10px 30px; background: #f8fbfa; }
.load-status, .filter-status { margin: 0; font-size: 13px; line-height: 1.5; }
.load-status { color: var(--muted); }
.load-status.is-stale, .load-status.is-error { color: var(--danger); font-weight: 800; }
.filter-status { margin-left: auto; color: var(--brand-dark); font-weight: 800; }
.retry-button { padding: 7px 13px; border-color: var(--brand); color: var(--brand-dark); background: var(--brand-soft); }
.retry-button:hover { color: #fff; background: var(--brand-dark); transform: translateY(-1px); }
.table-frame { overflow-x: auto; }
table { width: 100%; min-width: 940px; border-collapse: separate; border-spacing: 0; font-size: 14px; }
caption { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
thead th { position: sticky; top: 0; z-index: 1; padding: 13px 14px; border-bottom: 1px solid #c9d9d6; color: #eefbf9; background: #154c47; font-size: 12px; font-weight: 800; text-align: right; white-space: nowrap; }
thead th[data-sort] { cursor: pointer; user-select: none; transition: background-color .16s ease; }
thead th[data-sort]:hover { background: #1d5c56; }
thead th.sort-active { background: var(--brand); }
.sort-arrow { margin-left: 3px; font-weight: 900; }
thead th:nth-child(-n+4) { text-align: left; }
tbody td { padding: 15px 14px; border-bottom: 1px solid #e4ecea; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
tbody td:nth-child(-n+4) { text-align: left; }
tbody tr:nth-child(even) { background: #f8fbfa; }
tbody tr:hover { background: #eff9f7; }
tbody tr:last-child td { border-bottom: 0; }
.rank-cell { color: var(--muted); font-weight: 800; }
.category-badge { display: inline-block; min-width: 46px; padding: 4px 9px; border-radius: 999px; color: var(--brand-dark); background: var(--brand-soft); font-size: 12px; font-weight: 800; text-align: center; }
.server-cell { color: var(--ink); font-weight: 800; }
.price-cell { color: var(--brand-dark); font-size: 17px; font-weight: 900; letter-spacing: -.02em; }
.price-cell small { margin-left: 4px; color: var(--muted); font-size: 11px; font-weight: 700; }
.price-missing { color: var(--muted); font-size: 13px; }
.change-cell { font-weight: 800; }
.change-up { color: var(--increase); }
.change-down { color: var(--decrease); }
.change-flat { color: var(--flat); }
.change-missing { color: var(--muted); font-size: 12px; font-weight: 600; }
.calc-button { padding: 7px 12px; border: 1px solid var(--brand); border-radius: 999px; cursor: pointer; color: var(--brand-dark); background: var(--brand-soft); font-size: 12px; font-weight: 800; white-space: nowrap; transition: color .16s ease, background-color .16s ease, transform .16s ease; }
.calc-button:hover { color: #fff; background: var(--brand-dark); transform: translateY(-1px); }
.qibao-link { display: inline-block; margin-left: 6px; padding: 7px 12px; border: 1px solid #d69e2e; border-radius: 999px; color: #975a16; background: #fefcbf; font-size: 12px; font-weight: 800; white-space: nowrap; text-decoration: none; transition: color .16s ease, background-color .16s ease, transform .16s ease; }
.qibao-link:hover { color: #fff; background: #d69e2e; transform: translateY(-1px); }

/* 可悬停/点按出走势的行 */
tbody tr.server-row { cursor: pointer; }

/* 扣普通提现列 */
.offline-rate { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; line-height: 1.25; }
.offline-rate-num { color: var(--brand-dark); font-size: 14px; font-weight: 900; font-variant-numeric: tabular-nums; }
.offline-rate small { color: var(--muted); font-size: 11px; font-weight: 700; }
.offline-links { display: flex; justify-content: flex-end; gap: 6px; margin-top: 7px; }
.calc-button-mini { padding: 4px 11px; font-size: 11px; }
.offline-links .qibao-link { margin-left: 0; padding: 4px 11px; font-size: 11px; }

.empty-state { margin: 0; padding: 54px 24px; color: var(--muted); text-align: center; }
.ranking-footer { display: flex; justify-content: space-between; gap: 24px; padding: 18px 5px 0; color: var(--muted); font-size: 12px; line-height: 1.7; }
.ranking-footer p { max-width: 570px; margin: 0; }
.site-nav a:focus-visible, .category-filters button:focus-visible, .retry-button:focus-visible, .calc-button:focus-visible { outline: 3px solid rgba(22, 140, 132, .35); outline-offset: 3px; }

@media (max-width: 860px) {
  .ranking-hero { align-items: stretch; flex-direction: column; gap: 20px; }
  .price-guide { flex-basis: auto; }
  .ranking-footer { flex-direction: column; gap: 6px; }
}

@media (max-width: 720px) {
  .ranking-shell { width: min(100% - 20px, 1240px); padding: 18px 0 36px; }
  .site-nav { display: flex; width: 100%; }
  .site-nav a { flex: 1; text-align: center; }
  .ranking-hero { padding: 32px 4px 22px; }
  .ranking-panel { border-radius: 18px; }
  .panel-heading { display: grid; gap: 14px; padding: 23px 20px 17px; }
  .update-meta { justify-items: start; }
  .category-filters { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; padding: 0 14px 16px; }
  .category-filters button { min-width: 0; padding: 9px 4px; font-size: 13px; }
  .search-sort-bar { justify-content: stretch; padding: 12px 18px 16px; }
  .ranking-search { flex-basis: 100%; max-width: none; margin-right: 0; }
  .mobile-sort { display: block; width: 100%; padding: 10px 14px; border: 1px solid var(--line); border-radius: 999px; color: var(--brand-dark); background: #fff; font-size: 13px; font-weight: 800; }
  .status-bar { align-items: flex-start; flex-wrap: wrap; padding: 11px 18px; }
  .filter-status { width: 100%; margin-left: 0; }
  .table-frame { padding: 12px; overflow: visible; background: #f3f8f7; }
  table, tbody { display: block; min-width: 0; }
  thead { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
  tbody { display: grid; gap: 10px; }
  tbody tr { display: block; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: 0 7px 24px rgba(24, 52, 50, .05); }
  tbody tr:nth-child(even), tbody tr:hover { background: #fff; }
  tbody td { display: grid; grid-template-columns: minmax(84px, .78fr) minmax(0, 1.22fr); align-items: baseline; gap: 12px; padding: 9px 13px; border-bottom: 1px solid #edf2f1; text-align: right; white-space: normal; }
  tbody td:nth-child(-n+4) { text-align: right; }
  tbody td::before { content: attr(data-label); color: var(--muted); font-size: 12px; font-weight: 700; text-align: left; }
  tbody td:first-child { padding-top: 13px; }
  tbody td:last-child { padding-bottom: 13px; border-bottom: 0; }
  .price-cell { padding-top: 13px; padding-bottom: 13px; color: var(--brand-dark); background: var(--brand-soft); font-size: 21px; }  .price-cell::before { color: var(--brand-dark); }
  .empty-state { padding: 42px 20px; background: #fff; }
}

@media (max-width: 420px) {
  h1 { font-size: 42px; }
  .hero-copy { font-size: 15px; }
  .price-guide { padding: 16px; }
}

/* 可点击的区组名（打开历史走势详情） */
.server-trend-btn { padding: 0; border: 0; border-bottom: 1px dashed transparent; background: none; cursor: pointer; color: var(--ink); font: inherit; font-weight: 800; text-align: left; }
.server-trend-btn:hover, .server-trend-btn:focus-visible { color: var(--brand-dark); border-bottom-color: var(--brand); outline: none; }

/* 历史走势详情弹层 */
body.detail-open { overflow: hidden; }
.detail-overlay { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 24px; background: rgba(13, 42, 39, .48); }
.detail-overlay[hidden] { display: none; }
.detail-modal { width: min(720px, 100%); max-height: calc(100vh - 48px); overflow: auto; border: 1px solid var(--line); border-radius: 20px; background: var(--paper); box-shadow: 0 30px 80px rgba(15, 35, 33, .32); }
/* 桌面悬停预览：透明且不阻挡表格，浮层由 JS 定位到光标附近（fixed），仅浮层本身可交互 */
.detail-overlay.is-preview { align-items: flex-start; justify-content: flex-start; padding: 0; background: transparent; pointer-events: none; }
.detail-overlay.is-preview .detail-modal { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(560px, 46vw); max-height: calc(100vh - 24px); pointer-events: auto; box-shadow: 0 24px 64px rgba(15, 35, 33, .28); border-radius: 16px; }
.detail-overlay.is-preview .detail-close { display: none; }
.detail-header { position: sticky; top: 0; z-index: 2; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 20px 24px 14px; border-bottom: 1px solid var(--line); background: var(--paper); }
.detail-name { margin: 0 0 4px; font-size: 22px; letter-spacing: -.01em; }
.detail-area { color: var(--muted); font-size: 13px; font-weight: 700; }
.detail-close { flex: 0 0 auto; padding: 7px 15px; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; color: var(--brand-dark); background: #fff; font-weight: 800; }
.detail-close:hover { border-color: var(--brand); background: var(--brand-soft); }
.detail-body { padding: 18px 24px 24px; }
.detail-loading, .detail-error { margin: 0; padding: 40px 12px; text-align: center; color: var(--muted); }
.detail-error { color: var(--danger); font-weight: 800; }

.detail-stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.stat-cell { padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: #f8fbfa; }
.stat-label { margin: 0 0 5px; color: var(--muted); font-size: 11px; font-weight: 700; }
.stat-value { margin: 0; color: var(--brand-dark); font-size: 15px; font-weight: 900; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-cell.change-up .stat-value { color: var(--increase); }
.stat-cell.change-down .stat-value { color: var(--decrease); }
.stat-cell.change-flat .stat-value { color: var(--flat); }

.range-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.range-tab { padding: 6px 15px; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; color: var(--muted); background: #fff; font-size: 13px; font-weight: 800; }
.range-tab:hover { border-color: var(--brand); color: var(--brand-dark); }
.range-tab.is-active { border-color: var(--brand); color: #fff; background: var(--brand); }

.chart-frame { position: relative; padding: 10px 6px 4px; border: 1px solid var(--line); border-radius: 14px; background: linear-gradient(180deg, #f3faf8, #fff); }
.trend-svg { display: block; width: 100%; height: auto; }
.grid-line { stroke: #e2ecea; stroke-width: 1; }
.axis-label { fill: var(--muted); font-size: 11px; font-weight: 700; text-anchor: end; }
.axis-label.x-label { text-anchor: middle; }
.trend-area { fill: rgba(22, 140, 132, .14); stroke: none; }
.trend-line { fill: none; stroke: var(--brand); stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.trend-point { fill: #fff; stroke: var(--brand); stroke-width: 2; }
.trend-point-last { fill: var(--brand); stroke: #fff; stroke-width: 2; }
.hover-line { stroke: var(--brand-dark); stroke-width: 1; stroke-dasharray: 3 3; pointer-events: none; }
.hover-dot { fill: var(--brand-dark); stroke: #fff; stroke-width: 2; pointer-events: none; }
.hover-catch { fill: transparent; cursor: crosshair; }
.chart-tip { position: absolute; top: 12px; display: flex; flex-direction: column; gap: 2px; padding: 7px 10px; border-radius: 9px; background: rgba(13, 50, 47, .93); color: #fff; font-size: 12px; font-weight: 800; white-space: nowrap; pointer-events: none; z-index: 3; transform: translateX(10px); }
.chart-tip[hidden] { display: none; }
.chart-tip.tip-flip { transform: translateX(calc(-100% - 10px)); }
.tip-date { color: #b6e0da; font-size: 11px; font-weight: 700; }
.tip-change.change-up { color: #ff9d9d; }
.tip-change.change-down { color: #8fe6c4; }
.tip-change.change-flat { color: #d8e4e2; }
.chart-empty { margin: 0; padding: 40px 12px; text-align: center; color: var(--muted); }
.detail-note { margin: 12px 2px 0; color: var(--muted); font-size: 12px; line-height: 1.65; }

@media (max-width: 720px) {
  .detail-overlay { padding: 10px; align-items: flex-end; }
  .detail-modal { width: 100%; max-height: calc(100vh - 20px); border-radius: 18px; }
  .detail-header { padding: 16px 18px 12px; }
  .detail-body { padding: 14px 16px 20px; }
  .detail-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-cell:first-child { grid-column: 1 / -1; }
}

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