/* ============================================================
 *  样式 —— 默认跟随系统明暗，可用右上角按钮手动切换
 *  全部平铺：无分组、无 Agent 筛选
 * ============================================================ */

:root {
  --bg: #f5f6fa;
  --bg-grad-1: #e8ecff;
  --bg-grad-2: #f5f6fa;
  --surface: #ffffff;
  --surface-hover: #ffffff;
  --text: #1a1c2e;
  --text-soft: #5b6072;
  --text-faint: #8a90a6;
  --border: #e6e8f0;
  --accent: #4f6ef7;
  --accent-soft: #eef1ff;
  --shadow: 0 6px 20px rgba(30, 35, 70, 0.08);
  --shadow-hover: 0 12px 30px rgba(30, 35, 70, 0.16);
  --chip-bg: #eef0f6;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1018;
    --bg-grad-1: #161a2e;
    --bg-grad-2: #0e1018;
    --surface: #181b27;
    --surface-hover: #1e2230;
    --text: #eef0f7;
    --text-soft: #aab0c5;
    --text-faint: #6f768f;
    --border: #262a3a;
    --accent: #6b86ff;
    --accent-soft: #1b2036;
    --shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
    --shadow-hover: 0 12px 30px rgba(0, 0, 0, 0.5);
    --chip-bg: #202434;
  }
}

/* 手动强制覆盖（点击切换后加在 <html> 上） */
html.theme-light {
  --bg: #f5f6fa; --bg-grad-1: #e8ecff; --bg-grad-2: #f5f6fa;
  --surface: #ffffff; --surface-hover: #ffffff;
  --text: #1a1c2e; --text-soft: #5b6072; --text-faint: #8a90a6;
  --border: #e6e8f0; --accent: #4f6ef7; --accent-soft: #eef1ff;
  --shadow: 0 6px 20px rgba(30, 35, 70, 0.08); --shadow-hover: 0 12px 30px rgba(30, 35, 70, 0.16);
  --chip-bg: #eef0f6;
}
html.theme-dark {
  --bg: #0e1018; --bg-grad-1: #161a2e; --bg-grad-2: #0e1018;
  --surface: #181b27; --surface-hover: #1e2230;
  --text: #eef0f7; --text-soft: #aab0c5; --text-faint: #6f768f;
  --border: #262a3a; --accent: #6b86ff; --accent-soft: #1b2036;
  --shadow: 0 6px 20px rgba(0, 0, 0, 0.35); --shadow-hover: 0 12px 30px rgba(0, 0, 0, 0.5);
  --chip-bg: #202434;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

.bg-gradient {
  position: fixed;
  inset: 0;
  background: radial-gradient(1200px 600px at 80% -10%, var(--bg-grad-1), transparent),
              radial-gradient(900px 500px at 0% 0%, var(--bg-grad-2), transparent);
  z-index: -1;
  opacity: 0.9;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: saturate(180%) blur(12px);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}
.title-block h1 {
  margin: 0;
  font-size: 26px;
  letter-spacing: 0.5px;
}
.subtitle {
  margin: 4px 0 0;
  color: var(--text-soft);
  font-size: 14px;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  justify-content: flex-end;
  min-width: 120px;
}
.theme-toggle {
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 18px;
  cursor: pointer;
  transition: transform 0.15s, background 0.15s;
}
.theme-toggle:hover { background: var(--surface-hover); transform: translateY(-1px); }

/* ---------- Grid（平铺容器） ---------- */
.grid {
  max-width: 1200px;
  margin: 18px auto 36px;
  padding: 0 24px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(176px, 1fr));
  grid-auto-rows: 1fr;
  gap: 12px;
}

/* ---------- 卡片 ---------- */
.card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
  transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s;
  position: relative;
  height: 100%;
  box-sizing: border-box;
  cursor: pointer;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
  border-color: color-mix(in srgb, var(--accent) 50%, var(--border));
}
.card-top {
  display: flex;
  align-items: center;
  gap: 10px;
}
.card-top .card-title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card.has-demo .card-top .card-title { padding-right: 64px; }
.card-icon {
  font-size: 18px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--accent-soft);
  flex: none;
}
.card-title {
  font-size: 14px;
  font-weight: 600;
  margin: 0;
}
.card-title a { color: inherit; text-decoration: none; transition: color 0.15s; }
.card-title a:hover { color: var(--accent); }
.card-desc {
  margin: 0;
  font-size: 12px;
  color: var(--text-soft);
  line-height: 1.45;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
}
.card-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.card-date {
  font-size: 12px;
  color: var(--accent);
  font-weight: 600;
}
.card-manager {
  font-size: 11px;
  color: var(--text-faint);
  background: var(--chip-bg);
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.card-demo {
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 3px 10px;
  border-radius: 999px;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 0.15s, box-shadow 0.15s;
  z-index: 2;
}
.card-demo:hover { transform: translateY(-1px); box-shadow: var(--shadow); }

.empty-hint {
  text-align: center;
  color: var(--text-faint);
  margin: 40px auto;
  font-size: 15px;
}

/* ---------- Footer ---------- */
.site-footer {
  max-width: 1200px;
  margin: 0 auto 30px;
  padding: 0 24px;
  color: var(--text-faint);
  font-size: 13px;
  text-align: center;
}
.site-footer .footer-sep {
  margin: 0 8px;
  opacity: 0.5;
}
.site-footer .footer-link {
  color: var(--text-soft);
  text-decoration: none;
  transition: color 0.15s;
}
.site-footer .footer-link:hover {
  color: var(--accent);
  text-decoration: underline;
}

@media (max-width: 600px) {
  .header-inner { padding: 14px 16px; }
  .grid { padding: 0 16px; grid-template-columns: 1fr 1fr; gap: 10px; }
  .card { padding: 14px; }
}

/* ---------- 访问密码遮罩 ---------- */
html.nav-locked { overflow: hidden; }
html.nav-locked .site-header,
html.nav-locked #grid,
html.nav-locked .site-footer { visibility: hidden; }

.access-gate {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: linear-gradient(160deg, #1b2440, #0f1626);
}
.access-gate .gate-box {
  width: min(360px, 100%);
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 30px 26px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  text-align: center;
}
.access-gate .gate-icon { font-size: 34px; margin-bottom: 8px; }
.access-gate .gate-title { font-size: 18px; font-weight: 700; margin-bottom: 18px; }
.access-gate .gate-input {
  width: 100%;
  box-sizing: border-box;
  padding: 11px 14px;
  font-size: 15px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-hover);
  color: var(--text);
  outline: none;
}
.access-gate .gate-input:focus { border-color: var(--accent); }
.access-gate .gate-btn {
  width: 100%;
  margin-top: 14px;
  padding: 11px;
  font-size: 15px;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  background: var(--accent);
  color: #fff;
}
.access-gate .gate-btn:hover { opacity: 0.92; }
.access-gate .gate-err { color: #e5484d; font-size: 13px; margin-top: 10px; min-height: 18px; }
