:root {
  --bg: #0d1117;
  --surface: #161b22;
  --surface-2: #21262d;
  --text: #e6edf3;
  --muted: #8b949e;
  --faint: #6e7681;
  --border: #30363d;
  --border-2: #444c56;
  --accent: #58a6ff;
  --green: #3fb950;
  --red: #f85149;
  --yellow: #d29922;
  --purple: #bc8cff;
  --gold: #e3b341;
  --success: #238636;
  --success-hi: #2ea043;
  --radius: 12px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --g-0: #161b22; --g-1: #0e4429; --g-2: #006d32; --g-3: #26a641; --g-4: #39d353;
}

[data-theme="light"] {
  --bg: #f6f8fa; --surface: #fff; --surface-2: #f6f8fa;
  --text: #1f2328; --muted: #656d76; --faint: #8c959f;
  --border: #d0d7de; --border-2: #afb8c1;
  --accent: #0969da; --green: #1a7f37; --red: #cf222e;
  --yellow: #9a6700; --purple: #8250df; --gold: #9a6700;
  --success: #1a7f37; --success-hi: #1a7f37;
  --g-0: #ebedf0; --g-1: #9be9a8; --g-2: #40c463; --g-3: #30a14e; --g-4: #216e39;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100vh; }
body {
  background: var(--bg); color: var(--text);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  transition: background .2s, color .2s;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; }
img { display: block; max-width: 100%; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 16px; }

/* ===== Header ===== */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
}
.site-header .container {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  height: 56px;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--text); font-size: 16px; }
.brand:hover { text-decoration: none; }
.brand .dot { width: 10px; height: 10px; border-radius: 3px; background: var(--g-4); box-shadow: 0 0 8px #39d35380; }
.brand small { font-weight: 400; color: var(--muted); font-size: 12px; }
.header-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border: 1px solid var(--border); border-radius: 8px;
  background: transparent; color: var(--muted); transition: .15s;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ===== Filters Bar ===== */
.filters {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  margin: 16px 0;
}
.filters-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filters-row + .filters-row { margin-top: 8px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 11px; color: var(--muted); }
.input, .select {
  background: var(--bg); border: 1px solid var(--border); color: var(--text);
  border-radius: 6px; padding: 6px 10px; font-size: 13px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus { border-color: var(--g-3); box-shadow: 0 0 0 3px #2ea04333; }
.select { cursor: pointer; }
.search-input { flex: 1; min-width: 200px; }
.btn {
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  border-radius: 6px; padding: 6px 14px; font-size: 13px; font-weight: 500;
  transition: .15s; display: inline-flex; align-items: center; gap: 6px;
}
.btn:hover { border-color: var(--border-2); background: var(--border); }
.btn-primary { background: var(--success); border-color: #f0f6fc1a; color: #fff; font-weight: 600; }
.btn-primary:hover { background: var(--success-hi); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-ghost { background: transparent; }

.sort-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.sort-tab {
  padding: 5px 12px; border-radius: 999px; font-size: 12px; font-weight: 500;
  border: 1px solid var(--border); background: transparent; color: var(--muted);
  cursor: pointer; transition: .15s; white-space: nowrap;
}
.sort-tab:hover { color: var(--text); border-color: var(--border-2); }
.sort-tab.active { background: var(--success); border-color: var(--success); color: #fff; }

/* ===== Cards Grid ===== */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
  margin: 16px 0;
}
.card {
  background: radial-gradient(120% 120% at 100% 0%, #39d3530a, transparent 45%), var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  cursor: pointer;
  transition: border-color .15s, transform .15s, box-shadow .15s;
  display: flex; flex-direction: column; gap: 10px;
}
.card:hover { border-color: var(--g-3); transform: translateY(-2px); box-shadow: 0 8px 24px #00000040; }
.card-head { display: flex; align-items: center; gap: 10px; }
.card-avatar { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--border); flex-shrink: 0; }
.card-titles { min-width: 0; flex: 1; }
.card-name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-login { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status-tag {
  font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; white-space: nowrap;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--muted);
}
.status-1 { color: var(--green); background: #0e442940; border-color: #0e442980; }
.status-0 { color: var(--yellow); background: #d2992218; border-color: #d2992280; }
.status-2 { color: var(--faint); background: var(--surface-2); }
.status-regl { color: var(--purple); background: #bc8cff1a; border-color: #bc8cff80; }
.checkbox-row { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.checkbox-row input[type=checkbox] { width: 15px; height: 15px; cursor: pointer; accent-color: var(--g-3); }

.card-age { display: flex; align-items: baseline; gap: 6px; }
.age-num { font-family: var(--mono); font-size: 28px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.age-unit { font-size: 13px; color: var(--muted); }
.age-year { margin-left: auto; font-size: 12px; color: var(--faint); font-family: var(--mono); }
.created-date { font-size: 11px; color: var(--faint); font-family: var(--mono); }

/* mini wall */
.mini-wall { display: grid; grid-template-columns: repeat(auto-fill, 8px); grid-auto-rows: 8px; gap: 2px; height: 34px; overflow: hidden; }
.mini-wall .cell { width: 8px; height: 8px; border-radius: 2px; background: var(--g-0); border: 1px solid #ffffff0a; }
.mini-wall .cell.l1 { background: var(--g-1); border-color: #0000; }
.mini-wall .cell.l2 { background: var(--g-2); border-color: #0000; }
.mini-wall .cell.l3 { background: var(--g-3); border-color: #0000; }
.mini-wall .cell.l4 { background: var(--g-4); border-color: #0000; }

.card-metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.metric-cell { text-align: center; padding: 4px; background: var(--surface-2); border-radius: 6px; }
.metric-cell .num { font-family: var(--mono); font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.metric-cell .lbl { font-size: 10px; color: var(--muted); }

.card-badges { display: flex; gap: 4px; flex-wrap: wrap; min-height: 24px; }
.badge-icon { width: 24px; height: 24px; border-radius: 50%; }
.badge-more { font-size: 11px; color: var(--muted); align-self: center; }

.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 2px; padding-top: 10px; border-top: 1px solid var(--border); }
.price-tag { font-family: var(--mono); font-size: 18px; font-weight: 700; color: var(--gold); }
.price-tag.zero { color: var(--muted); font-size: 14px; }

/* ===== Loading / Empty ===== */
.loading, .empty, .load-more {
  text-align: center; padding: 32px 16px; color: var(--muted); font-size: 13px;
}
.skeleton-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; display: flex; flex-direction: column; gap: 10px;
}
.sk-line { height: 14px; background: var(--border); border-radius: 4px; animation: pulse 1.2s ease-in-out infinite; }
.sk-line.short { width: 60%; }
.sk-block { height: 34px; background: var(--border); border-radius: 6px; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .4; } }

/* ===== Modal ===== */
.modal-overlay {
  position: fixed; inset: 0; background: #000000b3; z-index: 100;
  display: none; align-items: center; justify-content: center; padding: 16px;
  animation: fade .15s;
}
.modal-overlay.open { display: flex; }
@keyframes fade { from { opacity: 0; } }
.modal {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  max-width: 560px; width: 100%; max-height: 90vh; overflow-y: auto; padding: 20px;
  animation: slide .2s;
}
@keyframes slide { from { transform: translateY(20px); opacity: 0; } }
.modal-close {
  position: sticky; top: 0; float: right; margin: -8px -8px 0 0;
  width: 32px; height: 32px; border-radius: 8px; border: none; background: var(--surface-2);
  color: var(--muted); font-size: 18px; display: flex; align-items: center; justify-content: center;
}
.modal-close:hover { color: var(--text); }
.detail-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.detail-avatar { width: 56px; height: 56px; border-radius: 50%; border: 1px solid var(--border); }
.detail-name { font-size: 18px; font-weight: 700; }
.detail-login { font-size: 14px; color: var(--accent); }
.detail-section { margin-top: 16px; }
.detail-section h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-bottom: 8px; }
.detail-wall { display: grid; grid-template-columns: repeat(auto-fill, 12px); grid-auto-rows: 12px; gap: 3px; padding: 12px; background: var(--bg); border-radius: 8px; border: 1px solid var(--border); }
.detail-wall .cell { width: 12px; height: 12px; border-radius: 2px; background: var(--g-0); border: 1px solid #ffffff0d; }
.detail-wall .cell.l1 { background: var(--g-1); border-color: #0000; }
.detail-wall .cell.l2 { background: var(--g-2); border-color: #0000; }
.detail-wall .cell.l3 { background: var(--g-3); border-color: #0000; }
.detail-wall .cell.l4 { background: var(--g-4); border-color: #0000; }
.wall-axis { display: flex; justify-content: space-between; margin-top: 6px; font-family: var(--mono); font-size: 11px; color: var(--faint); }
.detail-metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.detail-metrics .metric-cell { padding: 8px; }
.detail-metrics .num { font-size: 18px; }
.detail-badges { display: flex; flex-wrap: wrap; gap: 8px; }
.detail-badges img { width: 40px; height: 40px; border-radius: 50%; }
.badge-item { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 56px; text-align: center; }
.badge-item span { font-size: 10px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: 100%; }
.detail-bio { font-size: 13px; color: var(--text); }
.detail-meta { font-size: 12px; color: var(--muted); }
.detail-price-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }
.detail-price { font-family: var(--mono); font-size: 32px; font-weight: 700; color: var(--gold); }
.contact-box { text-align: center; padding: 16px; }
.contact-box .ctype { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.contact-box .cval { font-family: var(--mono); font-size: 20px; font-weight: 700; color: var(--accent); word-break: break-all; }

/* ===== Footer ===== */
.site-footer { border-top: 1px solid var(--border); margin-top: 32px; padding: 20px 0; text-align: center; font-size: 12px; color: var(--faint); }

/* ===== Responsive ===== */
@media (max-width: 640px) {
  .grid { grid-template-columns: 1fr; }
  .filters-row { flex-direction: column; align-items: stretch; }
  .field { width: 100%; }
  .detail-metrics { grid-template-columns: repeat(2, 1fr); }
}

/* ===== Utility ===== */
.hidden { display: none !important; }
.flex { display: flex; }
.gap-2 { gap: 8px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.text-muted { color: var(--muted); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
