/* ============ 主题变量 · 深空极光（暗色玻璃拟态） ============ */
:root {
  --bg: #070b16;
  --bg2: #0b1224;
  --surface: rgba(255, 255, 255, 0.045);
  --surface-solid: #0d1528;
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(139, 92, 246, 0.45);
  --text: #e8edf7;
  --text-soft: #8b96ad;
  --brand: #6366f1;
  --brand2: #a855f7;
  --accent: #22d3ee;
  --danger: #f87171;
  --code-bg: rgba(139, 92, 246, 0.16);
  --code-text: #c4b5fd;
  --radius: 16px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 12px 40px -16px rgba(0, 0, 0, 0.55);
  --glow: 0 20px 60px -20px rgba(99, 102, 241, 0.55);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: none; }

/* 背景光晕 */
.bg {
  position: fixed; inset: 0; z-index: -1; background: var(--bg);
}
.bg::before, .bg::after {
  content: ""; position: absolute; border-radius: 50%; filter: blur(120px); opacity: 0.55;
}
.bg::before {
  width: 560px; height: 560px; top: -180px; left: -120px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.55), transparent 70%);
}
.bg::after {
  width: 640px; height: 640px; bottom: -240px; right: -160px;
  background: radial-gradient(circle, rgba(34, 211, 238, 0.35), transparent 70%);
}

/* ============ 顶栏 ============ */
.topbar {
  position: sticky; top: 0; z-index: 10;
  backdrop-filter: blur(18px) saturate(160%);
  background: rgba(7, 11, 22, 0.6);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 1060px; margin: 0 auto; padding: 15px 28px;
  display: flex; align-items: center; justify-content: space-between;
}
.brand {
  font-weight: 800; font-size: 18px; letter-spacing: 0.3px; color: #fff;
  background: linear-gradient(135deg, #fff, #a5b4fc);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  display: flex; align-items: center; gap: 9px;
}
.brand::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--accent));
  box-shadow: 0 0 12px var(--accent);
}
.topnav a {
  color: var(--text-soft); margin-left: 22px; font-size: 14px; transition: 0.2s;
}
.topnav a:hover { color: #fff; }
.topnav a.pill {
  color: #fff; padding: 7px 16px; border-radius: 999px; border: 1px solid var(--border);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(34, 211, 238, 0.12));
}

/* ============ 布局 ============ */
.container {
  flex: 1; width: 100%; max-width: 1060px; margin: 0 auto; padding: 48px 28px 72px;
}
.footer {
  text-align: center; color: var(--text-soft); font-size: 13px; padding: 20px;
  border-top: 1px solid var(--border);
}

/* ============ 首页 ============ */
.hero { position: relative; margin: 12px 0 44px; }
.hero h1 {
  font-size: clamp(32px, 5vw, 50px); line-height: 1.15; margin: 0 0 16px; font-weight: 800;
  background: linear-gradient(120deg, #fff 0%, #c7d2fe 45%, #7dd3fc 100%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.hero .desc { color: var(--text-soft); font-size: 17px; max-width: 620px; margin: 0; }

.group-title {
  display: flex; align-items: center; gap: 12px; font-size: 13px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--text-soft); margin: 38px 0 16px; font-weight: 600;
}
.group-title::after {
  content: ""; flex: 1; height: 1px;
  background: linear-gradient(90deg, var(--border), transparent);
}

.card-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px;
}
.card {
  position: relative; display: block; padding: 22px 22px 20px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  backdrop-filter: blur(10px); transition: 0.2s ease; overflow: hidden;
}
.card::before {
  content: ""; position: absolute; inset: 0; opacity: 0; transition: 0.25s;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.16), rgba(34, 211, 238, 0.08));
}
.card::after {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 1px; opacity: 0; transition: 0.25s;
  background: linear-gradient(90deg, transparent, var(--brand2), var(--accent), transparent);
}
.card:hover {
  transform: translateY(-4px); border-color: var(--border-strong); box-shadow: var(--glow);
}
.card:hover::before { opacity: 1; }
.card:hover::after { opacity: 1; }
.card-icon {
  width: 40px; height: 40px; border-radius: 11px; display: flex; align-items: center; justify-content: center;
  font-size: 17px; font-weight: 700; color: #fff; margin-bottom: 16px;
  background: linear-gradient(135deg, var(--brand), var(--brand2));
  box-shadow: 0 6px 18px -6px rgba(99, 102, 241, 0.6);
}
.card-title { color: var(--text); font-weight: 600; font-size: 16px; }
.card-path {
  color: var(--text-soft); font-size: 12px; margin-top: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.card-arrow {
  position: absolute; right: 18px; top: 20px; color: var(--text-soft); transition: 0.2s;
}
.card:hover .card-arrow { color: var(--accent); transform: translateX(3px); }

.empty {
  background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius);
  padding: 40px; text-align: center; color: var(--text-soft);
}

/* ============ 文章 / markdown 正文 ============ */
.article {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 40px 44px; box-shadow: var(--shadow); backdrop-filter: blur(10px);
}
.article-title { margin: 0 0 6px; font-size: 26px; color: #fff; }
.article-meta {
  color: var(--text-soft); font-size: 13px; margin-bottom: 24px; padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.markdown-body { font-size: 16px; }
.markdown-body h1, .markdown-body h2, .markdown-body h3,
.markdown-body h4, .markdown-body h5, .markdown-body h6 {
  line-height: 1.4; margin: 1.6em 0 0.6em; font-weight: 700; color: #dbe4f5;
}
.markdown-body h1 { font-size: 1.7em; border-bottom: 1px solid var(--border); padding-bottom: 0.3em; }
.markdown-body h2 { font-size: 1.4em; border-bottom: 1px solid var(--border); padding-bottom: 0.3em; }
.markdown-body h3 { font-size: 1.2em; }
.markdown-body p { margin: 0.8em 0; color: #b7c2d6; }
.markdown-body a { color: var(--accent); }
.markdown-body ul, .markdown-body ol { padding-left: 1.6em; margin: 0.8em 0; color: #b7c2d6; }
.markdown-body li { margin: 0.3em 0; }
.markdown-body blockquote {
  margin: 1em 0; padding: 0.5em 1.2em; color: var(--text-soft);
  border-left: 3px solid var(--brand2); background: rgba(99, 102, 241, 0.1);
  border-radius: 0 10px 10px 0;
}
.markdown-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: var(--code-bg); color: var(--code-text); padding: 0.15em 0.45em;
  border-radius: 6px; font-size: 0.9em;
}
.markdown-body pre {
  background: #0a0f1e; color: #a5d8ff; padding: 16px 18px; border-radius: 12px;
  overflow-x: auto; line-height: 1.55; border: 1px solid var(--border);
}
.markdown-body pre code { background: transparent; color: inherit; padding: 0; font-size: 0.88em; }
.markdown-body table { border-collapse: collapse; width: 100%; margin: 1em 0; }
.markdown-body th, .markdown-body td {
  border: 1px solid var(--border); padding: 9px 13px; text-align: left;
}
.markdown-body th { background: rgba(255, 255, 255, 0.04); color: #dbe4f5; font-weight: 600; }
.markdown-body td { color: #b7c2d6; }
.markdown-body img { max-width: 100%; border-radius: 8px; }
.markdown-body hr { border: none; border-top: 1px solid var(--border); margin: 2em 0; }

.back { margin-top: 20px; font-size: 14px; }

/* ============ 登录 ============ */
.login-box {
  max-width: 400px; margin: 48px auto; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 38px; box-shadow: var(--shadow); text-align: center; backdrop-filter: blur(10px);
}
.login-box h2 { margin: 0 0 6px; color: #fff; }
.login-hint { color: var(--text-soft); font-size: 14px; margin: 0 0 20px; }
.error { color: var(--danger); font-size: 14px; }
.login-box input[type="password"] {
  width: 100%; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px;
  font-size: 15px; margin-bottom: 14px; background: var(--bg2); color: var(--text); outline: none;
}
.login-box input[type="password"]:focus { border-color: var(--brand); }
.login-box button {
  width: 100%; padding: 12px; border: none; border-radius: 10px;
  background: linear-gradient(135deg, var(--brand), var(--brand2));
  color: #fff; font-size: 15px; font-weight: 600; cursor: pointer;
}
.login-box button:hover { opacity: 0.92; }

/* ============ 管理后台 ============ */
.admin-head { display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 16px; margin-bottom: 16px; }
.admin-head h1 { margin: 0; font-size: 24px; color: #fff; }
.create-form { display: flex; gap: 8px; }
.create-form input {
  padding: 10px 14px; border: 1px solid var(--border); border-radius: 10px;
  font-size: 14px; min-width: 260px; background: var(--bg2); color: var(--text); outline: none;
}
.create-form input:focus { border-color: var(--brand); }
.tip { color: var(--text-soft); font-size: 13px; }
.tip code { background: var(--code-bg); color: var(--code-text); padding: 1px 6px; border-radius: 4px; }

.admin-list { background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; margin-bottom: 20px; backdrop-filter: blur(10px); }
.admin-row { display: flex; align-items: center; gap: 16px; padding: 14px 20px;
  border-bottom: 1px solid var(--border); }
.admin-row:last-child { border-bottom: none; }
.admin-title { flex: 1; font-weight: 600; color: var(--text); }
.admin-path { color: var(--text-soft); font-size: 12px;
  font-family: ui-monospace, Menlo, monospace; }
.admin-actions { display: flex; gap: 8px; }

.btn {
  display: inline-block; padding: 7px 14px; border-radius: 10px; font-size: 13px;
  border: 1px solid var(--border); background: transparent; color: var(--text);
  cursor: pointer; font-weight: 500;
}
.btn:hover { border-color: var(--brand); color: var(--accent); text-decoration: none; }
.btn-primary { background: linear-gradient(135deg, var(--brand), var(--brand2));
  color: #fff; border: none; }
.btn-primary:hover { color: #fff; opacity: 0.92; }
.btn-danger { color: var(--danger); }
.btn-danger:hover { border-color: var(--danger); color: var(--danger); }

/* ============ 编辑器 ============ */
.edit-head { display: flex; align-items: flex-start; justify-content: space-between;
  flex-wrap: wrap; gap: 16px; margin-bottom: 16px; }
.edit-head h1 { margin: 0; font-size: 22px; color: #fff; }
.edit-actions { display: flex; gap: 8px; }

.editor { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; min-height: 70vh; }
.editor-pane { display: flex; flex-direction: column; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
  backdrop-filter: blur(10px); }
.pane-label { padding: 8px 16px; font-size: 12px; color: var(--text-soft);
  background: var(--bg2); border-bottom: 1px solid var(--border); letter-spacing: 0.05em; }
#md-input {
  flex: 1; border: none; resize: none; padding: 18px; font-size: 14px;
  line-height: 1.7; color: var(--text); outline: none; background: transparent;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.preview-body { flex: 1; overflow-y: auto; padding: 18px 22px; }

@media (max-width: 720px) {
  .editor { grid-template-columns: 1fr; }
  .article { padding: 28px 20px; }
}
