/* ============================================================
   X 互关平台 · 浅色主题 + 左右两栏
   ============================================================ */

:root {
  --bg: #f7f9fa;          /* 页面浅灰底 */
  --card: #ffffff;        /* 卡片/面板白 */
  --border: #eff3f4;
  --text: #0f1419;
  --muted: #536471;
  --blue: #1d9bf0;
  --blue-dark: #1a8cd8;
  --blue-soft: rgba(29, 155, 240, 0.1);
  --danger: #f4212e;

  --radius: 14px;
  --radius-lg: 20px;
  --radius-pill: 999px;

  --font-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
               "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --container: 1480px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input { font-family: inherit; }
img { display: block; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.92em; }

:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 6px; }

.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 20px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; border-radius: var(--radius-pill);
  font-size: 15px; font-weight: 700; white-space: nowrap;
  transition: transform 0.15s var(--ease), background 0.15s, opacity 0.15s;
}
.btn--primary { background: var(--blue); color: #fff; }
.btn--primary:hover { background: var(--blue-dark); transform: translateY(-1px); }
.btn--primary:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn--block { width: 100%; }

/* ---------- 导航 ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav__inner { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 18px; color: var(--text); }
.logo__icon { width: 20px; height: 20px; color: var(--text); flex-shrink: 0; }
.nav__count { font-size: 14px; color: var(--muted); }
.nav__count strong { color: var(--blue); }

/* ---------- 两栏布局（列表在左，表单在右）---------- */
.layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  grid-template-areas: "list form";
  gap: 24px;
  align-items: start;
  padding: 20px 20px 48px;
}
.sidebar { position: sticky; top: 76px; grid-area: form; }
.main { grid-area: list; min-width: 0; }

/* ---------- 左栏面板 ---------- */
.panel {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 24px;
  box-shadow: var(--shadow-sm);
}
.panel__title { font-size: 20px; font-weight: 800; }
.panel__sub { font-size: 14px; color: var(--muted); margin-top: 6px; margin-bottom: 18px; }
.addform { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.field input {
  padding: 11px 14px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--bg);
  color: var(--text); font-size: 15px; font-weight: 400;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.field input:focus { outline: none; border-color: var(--blue); background: #fff; box-shadow: 0 0 0 3px var(--blue-soft); }
.field input::placeholder { color: #99a4ad; }
.panel__hint { margin-top: 14px; font-size: 12px; color: var(--muted); line-height: 1.5; }
.panel__hint code { color: var(--blue); }

/* ---------- 右栏 ---------- */
.main__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.main__title { font-size: 22px; font-weight: 800; }
.search {
  width: 280px; max-width: 100%; padding: 10px 16px; border-radius: var(--radius-pill);
  border: 1px solid var(--border); background: var(--card); color: var(--text); font-size: 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
.search::placeholder { color: #99a4ad; }

/* ---------- 网格 ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
}
.grid__loading, .empty { grid-column: 1 / -1; text-align: center; color: var(--muted); padding: 60px 0; font-size: 15px; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px;
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
  animation: pop 0.3s var(--ease) backwards;
}
.card:hover { border-color: var(--blue); transform: translateY(-2px); box-shadow: var(--shadow); }

.card__avatar, .card__avatar-img {
  width: 64px; height: 64px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 800; color: #fff;
  background: linear-gradient(135deg, var(--blue), #0f6fb8);
  margin-bottom: 4px; object-fit: cover;
}
.card__name {
  font-size: 15px; font-weight: 700; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.card__handle { font-size: 13px; color: var(--muted); }
.card__follow {
  margin-top: 6px; display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 16px; border-radius: var(--radius-pill);
  background: var(--text); color: #fff; font-size: 13px; font-weight: 700;
  transition: background 0.15s, transform 0.15s, opacity 0.15s;
}
.card__follow:hover { transform: translateY(-1px); opacity: 0.9; }

@keyframes pop {
  0% { opacity: 0; transform: scale(0.96) translateY(6px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--border); padding: 24px 0; padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
.footer__copy { color: var(--muted); font-size: 13px; text-align: center; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(16px);
  background: var(--text); color: #fff; padding: 11px 18px; border-radius: var(--radius-pill);
  font-size: 14px; box-shadow: var(--shadow);
  opacity: 0; transition: opacity 0.2s, transform 0.2s; z-index: 100; max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast--error { background: var(--danger); }

/* ---------- 响应式 ---------- */
@media (max-width: 1100px) {
  .grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 880px) {
  .layout { grid-template-columns: 1fr; grid-template-areas: "list" "form"; }
  .sidebar { position: static; }
  .grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 640px) {
  .main__head { flex-direction: column; align-items: stretch; }
  .search { width: 100%; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .card { padding: 14px; }
  .card__avatar, .card__avatar-img { width: 56px; height: 56px; font-size: 20px; }
}

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