/* 客户端全局样式
   设计约束：纯扁平化，不使用阴影、渐变、发光等装饰效果。
   层次通过 1px 边框与浅灰底色区分。 */

:root {
  --c-bg: #f5f6f8;
  --c-surface: #ffffff;
  --c-border: #e8eaed;
  --c-border-strong: #d8dbe0;
  --c-text: #16181d;
  --c-text-sub: #6b7280;
  --c-text-muted: #9aa0aa;
  --c-ink: #16181d;
  --c-accent: #c8553d;
  --c-success: #1f7a4d;
  --c-gold: #b8860b;
  --radius-lg: 10px;
  --radius: 8px;
  --radius-sm: 6px;
}

* {
  box-sizing: border-box;
  /* 关闭移动端点击时系统默认的蓝色高亮块 */
  -webkit-tap-highlight-color: transparent;
}

/* 图标基础样式：尺寸跟随字号，颜色继承父元素，垂直居中与文字对齐 */
.icon {
  width: 1em;
  height: 1em;
  flex-shrink: 0;
  vertical-align: -0.125em;
  display: inline-block;
}

.icon-sm {
  width: 0.85em;
  height: 0.85em;
}

.icon-lg {
  width: 2em;
  height: 2em;
}

html,
body {
  margin: 0;
  padding: 0;
}

/* 键盘聚焦时保留可见焦点环，鼠标/触摸点击不显示，兼顾可访问性 */
:focus:not(:focus-visible) {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--c-ink);
  outline-offset: 2px;
}

body {
  background: var(--c-bg);
  color: var(--c-text);
  font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

h1, h2, h3 {
  margin: 0;
  font-weight: 600;
  letter-spacing: -.2px;
}

/* ---------- 顶部导航 ---------- */
/* 背景、模糊与描边由 glass.css 的 .glass-bar 提供，这里只负责布局 */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-inner {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 16px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  background: var(--c-ink);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .5px;
}

.logo-text {
  font-size: 15px;
  font-weight: 600;
}

.topnav {
  display: flex;
  gap: 4px;
}

.topnav a {
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 14px;
  color: var(--c-text-sub);
  transition: background-color .15s ease, color .15s ease;
}

.topnav a:hover {
  background: var(--c-bg);
  color: var(--c-text);
}

.topnav a.active {
  background: var(--c-ink);
  color: #fff;
}

/* ---------- 页面容器 ---------- */
.page {
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 16px 40px;
}

/* ---------- 搜索区 ---------- */
.search-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  padding: 16px;
}

.search-title {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 4px;
}

.search-desc {
  font-size: 13px;
  color: var(--c-text-sub);
  margin: 0 0 14px;
}

.search-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 12px;
  display: flex;
  align-items: center;
  color: var(--c-text-muted);
  font-size: 16px;
  line-height: 1;
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 11px 12px 11px 36px;
  border: 1px solid var(--c-border-strong);
  border-radius: var(--radius);
  background: var(--c-surface);
  font-size: 15px;
  outline: none;
  transition: border-color .15s ease;
}

.search-input:focus {
  border-color: var(--c-ink);
}

.search-input::placeholder {
  color: var(--c-text-muted);
}

/* 模式切换（单选按钮组） */
.mode-switch {
  display: flex;
  gap: 8px;
}

.mode-option {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 9px 8px;
  border: 1px solid var(--c-border-strong);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--c-text-sub);
  cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease, color .15s ease;
}

.mode-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.mode-option:hover {
  background: var(--c-bg);
}

.mode-option.checked {
  border-color: var(--c-ink);
  background: var(--c-ink);
  color: #fff;
  font-weight: 500;
}

.search-actions {
  display: flex;
  gap: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 20px;
  border: 1px solid var(--c-border-strong);
  border-radius: var(--radius);
  background: var(--c-surface);
  color: var(--c-text);
  font-size: 15px;
  font-family: inherit;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease;
}

.btn:hover {
  background: var(--c-bg);
}

.btn-primary {
  flex: 1;
  background: var(--c-ink);
  border-color: var(--c-ink);
  color: #fff;
  font-weight: 500;
}

.btn-primary:hover {
  background: #2b2f36;
  border-color: #2b2f36;
}

.btn-sm {
  padding: 7px 14px;
  font-size: 13px;
  border-radius: var(--radius-sm);
}

/* 批量输入 */
.batch-hint {
  font-size: 12px;
  color: var(--c-text-muted);
  margin: -4px 0 0;
}

.textarea {
  width: 100%;
  min-height: 120px;
  padding: 12px;
  border: 1px solid var(--c-border-strong);
  border-radius: var(--radius);
  font-family: "SFMono-Regular", Consolas, Menlo, monospace;
  font-size: 14px;
  line-height: 1.8;
  resize: vertical;
  outline: none;
  transition: border-color .15s ease;
}

.textarea:focus {
  border-color: var(--c-ink);
}

/* ---------- 概览数据 ---------- */
.overview {
  margin-top: 16px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.overview-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--c-border);
}

.overview-title {
  font-size: 14px;
  font-weight: 600;
}

.overview-meta {
  font-size: 12px;
  color: var(--c-text-muted);
}

.overview-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
}

.overview-item {
  padding: 16px;
  border-bottom: 1px solid var(--c-border);
  border-right: 1px solid var(--c-border);
}

.overview-item:nth-child(2n) {
  border-right: none;
}

.overview-item:nth-last-child(-n+2) {
  border-bottom: none;
}

.overview-value {
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -.4px;
  font-variant-numeric: tabular-nums;
}

.overview-label {
  margin-top: 2px;
  font-size: 12px;
  color: var(--c-text-sub);
}

/* ---------- 区块标题 ---------- */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 22px 2px 10px;
}

.section-title {
  font-size: 15px;
  font-weight: 600;
}

.section-link {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 13px;
  color: var(--c-text-sub);
}

.section-link:hover {
  color: var(--c-text);
}

/* ---------- 数据卡片（核心展示单元） ---------- */
.data-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 12px;
}

.data-card-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

/* 头像占位：首字母 + 描边，不使用图片资源 */
.data-avatar {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--c-bg);
  border: 1px solid var(--c-border-strong);
  font-size: 16px;
  font-weight: 600;
  color: var(--c-text-sub);
}

.data-identity {
  flex: 1;
  min-width: 0;
}

.data-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.data-name {
  font-size: 15px;
  font-weight: 600;
  word-break: break-all;
}

.data-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 20px;
  padding: 0 6px;
  border-radius: 4px;
  background: var(--c-ink);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.data-sub {
  margin-top: 3px;
  font-size: 12px;
  color: var(--c-text-muted);
  word-break: break-all;
}

.data-id {
  font-family: "SFMono-Regular", Consolas, Menlo, monospace;
  font-size: 12px;
  color: var(--c-text-sub);
}

/* 数据指标：四列均分，与参考图保持一致的信息密度 */
.data-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--c-border);
}

.metric {
  text-align: center;
}

.metric-value {
  font-size: 16px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.2px;
}

.metric-label {
  margin-top: 2px;
  font-size: 12px;
  color: var(--c-text-muted);
}

.metric-value.accent {
  color: var(--c-accent);
}

/* 标签 */
.chip {
  display: inline-block;
  padding: 1px 8px;
  border: 1px solid var(--c-border-strong);
  border-radius: 4px;
  font-size: 12px;
  color: var(--c-text-sub);
  background: var(--c-surface);
}

.chip-gold {
  border-color: #e6d5a8;
  background: #fdf9ee;
  color: var(--c-gold);
}

/* ---------- 提示条 ---------- */
.notice {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  margin-bottom: 14px;
  border: 1px solid var(--c-border);
  background: var(--c-surface);
  color: var(--c-text-sub);
}

.notice-error {
  border-color: #eccac6;
  background: #fdf4f3;
  color: #a33a2c;
}

.notice-info {
  border-color: #d5dfec;
  background: #f5f8fc;
  color: #2b5aa0;
}

.notice-success {
  border-color: #c6e3d3;
  background: #f3faf6;
  color: var(--c-success);
}

/* ---------- 榜单表格 ---------- */
.rank-list {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.rank-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--c-border);
  transition: background-color .12s ease;
}

.rank-row:last-child {
  border-bottom: none;
}

.rank-row:hover {
  background: #fafbfc;
}

.rank-index {
  flex-shrink: 0;
  width: 24px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--c-text-muted);
  font-variant-numeric: tabular-nums;
}

.rank-index.top {
  color: var(--c-ink);
}

.rank-main {
  flex: 1;
  min-width: 0;
}

.rank-name {
  font-size: 14px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-sub {
  font-size: 12px;
  color: var(--c-text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-value {
  flex-shrink: 0;
  text-align: right;
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.rank-value-sub {
  display: block;
  font-size: 11px;
  font-weight: 400;
  color: var(--c-text-muted);
}

/* 榜单筛选 */
.filter-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  overflow-x: auto;
  padding-bottom: 2px;
  -webkit-overflow-scrolling: touch;
}

.filter-bar::-webkit-scrollbar {
  display: none;
}

.filter-item {
  flex-shrink: 0;
  padding: 7px 14px;
  border: 1px solid var(--c-border-strong);
  border-radius: 999px;
  font-size: 13px;
  color: var(--c-text-sub);
  background: var(--c-surface);
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}

.filter-item:hover {
  border-color: var(--c-ink);
}

.filter-item.active {
  background: var(--c-ink);
  border-color: var(--c-ink);
  color: #fff;
  font-weight: 500;
}

/* ---------- 空状态 ---------- */
.empty {
  padding: 48px 20px;
  text-align: center;
  color: var(--c-text-muted);
  font-size: 14px;
}

.empty-icon {
  display: flex;
  justify-content: center;
  margin-bottom: 8px;
  font-size: 24px;
  color: var(--c-border-strong);
}

/* ---------- 页脚 ---------- */
.site-footer {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 16px 32px;
  text-align: center;
  font-size: 12px;
  color: var(--c-text-muted);
}

.site-footer p {
  margin: 4px 0;
}

/* ---------- 结果页返回 ---------- */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 14px;
  font-size: 14px;
  color: var(--c-text-sub);
}

.back-link:hover {
  color: var(--c-text);
}

/* 未命中列表 */
.miss-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.miss-item {
  padding: 4px 10px;
  border: 1px solid #eccac6;
  border-radius: 4px;
  background: #fdf4f3;
  color: #a33a2c;
  font-family: "SFMono-Regular", Consolas, Menlo, monospace;
  font-size: 12px;
}

/* 数字辅助类 */
.num {
  font-variant-numeric: tabular-nums;
}

/* 响应式：窄屏时指标改为两列 */
@media (max-width: 480px) {
  .data-metrics {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px 8px;
  }

  .overview-value {
    font-size: 19px;
  }
}

/* ---------- 移动端输入框字号 ----------
   iOS Safari 在可输入元素字号小于 16px 时，聚焦会自动把整个页面放大，
   导致输入时页面突然被推大。这里在触屏/窄屏下把输入控件统一提到 16px，
   从根上避免该行为。
   刻意不使用 viewport 的 maximum-scale=1 —— 那会连双指缩放一起禁掉，
   对需要放大阅读的用户是负面影响。 */
@media (max-width: 768px), (hover: none) and (pointer: coarse) {
  .search-input,
  .textarea,
  input,
  select,
  textarea {
    font-size: 16px;
  }
}
