:root {
  --bg: #0f1115;
  --panel: #171a21;
  --panel-2: #1c2029;
  --border: #262a33;
  --fg: #e6e8ee;
  --muted: #8a92a5;
  --accent: #4c9aff;
  --accent-hot: #ff6b6b;
  --danger: #ff5c5c;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--fg); font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", sans-serif; }

header { padding: 20px 24px 16px; border-bottom: 1px solid var(--border); }
.head-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
h1 { margin: 0 0 4px; font-size: 22px; letter-spacing: 0.5px; }
.sub { color: var(--muted); margin: 0; font-size: 13px; }

.head-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.head-actions label { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.head-actions input { background: var(--panel); border: 1px solid var(--border); color: var(--fg); padding: 6px 10px; border-radius: 6px; min-width: 260px; font-family: ui-monospace, monospace; }
.head-actions button { background: var(--accent); color: #fff; border: 0; border-radius: 6px; padding: 6px 14px; cursor: pointer; font-weight: 500; }
.head-actions button:hover { filter: brightness(1.1); }
.head-actions button.ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.head-actions button.ghost:hover { color: var(--fg); border-color: var(--accent); }
.hint { color: var(--muted); font-size: 12px; }
.hint.ok { color: #7ee787; }
.hint.err { color: var(--danger); }

main { padding: 20px 24px 40px; }
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
  max-width: 1600px;
  margin: 0 auto;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 200px;
}
.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-2);
}
.card-head .name { font-weight: 600; font-size: 15px; letter-spacing: 0.3px; }
.card-head .name .badge { display: inline-block; padding: 1px 6px; margin-left: 6px; border-radius: 4px; background: var(--border); color: var(--muted); font-size: 11px; font-weight: 400; font-family: ui-monospace, monospace; }
.card-head .meta { display: flex; gap: 6px; align-items: center; color: var(--muted); font-size: 11px; font-family: ui-monospace, monospace; }
.card-head .refresh {
  background: transparent; border: 0; color: var(--muted); cursor: pointer;
  padding: 2px 6px; border-radius: 4px; font-size: 14px;
}
.card-head .refresh:hover { color: var(--accent); background: var(--border); }
.card-head .refresh.spin { animation: spin 0.8s linear infinite; color: var(--accent); }
@keyframes spin { to { transform: rotate(360deg); } }

.card-body {
  padding: 6px 8px;
  overflow-y: auto;
  max-height: 520px;
  flex: 1;
}
.card-body::-webkit-scrollbar { width: 6px; }
.card-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.card-body::-webkit-scrollbar-thumb:hover { background: var(--muted); }

.list { list-style: none; padding: 0; margin: 0; }
.list li {
  display: flex;
  gap: 8px;
  align-items: baseline;
  padding: 6px 8px;
  border-radius: 6px;
  line-height: 1.4;
}
.list li:hover { background: var(--panel-2); }
.list .rank {
  color: var(--muted);
  font-family: ui-monospace, monospace;
  font-size: 12px;
  min-width: 22px;
  text-align: right;
  flex-shrink: 0;
}
.list .rank.top { color: var(--accent-hot); font-weight: 700; }
.list .title {
  color: var(--fg);
  text-decoration: none;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}
.list .title:hover { color: var(--accent); }
.list .side {
  color: var(--muted);
  font-size: 11px;
  font-family: ui-monospace, monospace;
  white-space: nowrap;
  flex-shrink: 0;
}

.state {
  padding: 24px 14px;
  color: var(--muted);
  text-align: center;
  font-size: 12px;
}
.state.err {
  color: var(--danger);
  font-family: ui-monospace, monospace;
  white-space: pre-wrap;
  text-align: left;
  word-break: break-word;
}
.state .retry { color: var(--accent); cursor: pointer; text-decoration: underline; margin-left: 4px; }

footer { padding: 20px 24px; border-top: 1px solid var(--border); color: var(--muted); font-size: 12px; }
footer code { background: var(--panel); padding: 2px 6px; border-radius: 4px; }
