/* ========== 设计基调：蓝紫渐变 + 玻璃拟态卡片 ========== */
:root {
  --accent: #4f6df5;
  --accent-2: #8b5cf6;
  --gradient: linear-gradient(120deg, var(--accent), var(--accent-2));
  --bg: #eef2fb;
  --card-bg: rgba(255, 255, 255, 0.78);
  --card-border: rgba(255, 255, 255, 0.65);
  --text: #1f2a44;
  --text-muted: #6b7794;
  --border: #e3e8f4;
  --danger: #e11d48;
  --radius: 18px;
  --shadow: 0 8px 30px rgba(79, 109, 245, 0.10);
  --shadow-hover: 0 14px 40px rgba(79, 109, 245, 0.18);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--text);
  line-height: 1.65;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(79, 109, 245, 0.14), transparent 60%),
    radial-gradient(1000px 500px at 100% 0%, rgba(139, 92, 246, 0.14), transparent 55%),
    var(--bg);
  min-height: 100vh;
}

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- 背景装饰光斑 ---------- */
.bg-decor {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.35;
  animation: blob-float 14s ease-in-out infinite alternate;
}
.blob-1 { width: 340px; height: 340px; background: #93b4fd; top: -80px; left: -60px; }
.blob-2 { width: 300px; height: 300px; background: #c4b5fd; top: 30%; right: -100px; animation-delay: -5s; }
.blob-3 { width: 260px; height: 260px; background: #a5d8ff; bottom: -80px; left: 30%; animation-delay: -9s; }

@keyframes blob-float {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(40px, 30px) scale(1.12); }
}

/* ---------- 顶栏 ---------- */
.topbar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 18px;
  padding-bottom: 6px;
}
.topbar-brand {
  font-weight: 700;
  letter-spacing: 0.05em;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.auth-area { display: flex; align-items: center; gap: 10px; min-height: 36px; }
.auth-user { display: flex; align-items: center; gap: 8px; }
.auth-user img {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 2px 8px rgba(79, 109, 245, 0.25);
  transition: transform 0.2s;
}
.auth-user img:hover { transform: scale(1.1) rotate(-4deg); }
.badge-admin {
  background: var(--gradient);
  color: #fff;
  border-radius: 999px;
  padding: 1px 9px;
  font-size: 0.72rem;
}

/* ---------- 布局网格 ---------- */
main.container {
  position: relative;
  z-index: 1;
  padding-top: 14px;
  padding-bottom: 28px;
}

.grid-top {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  grid-template-areas:
    "hero github"
    "intro github";
  gap: 20px;
  margin-bottom: 20px;
}
.hero { grid-area: hero; }
.intro-card { grid-area: intro; }
.github-card { grid-area: github; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card-bg);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 26px;
  box-shadow: var(--shadow);
  transition: box-shadow 0.25s, transform 0.25s;
}
.card:hover { box-shadow: var(--shadow-hover); }

.card h2 {
  margin: 0 0 14px;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  gap: 8px;
}
.head-icon { font-size: 1.1em; }

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.section-head h2 { margin: 0; }

/* ---------- Hero 标题区 ---------- */
.hero {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.hero-eyebrow {
  margin: 0;
  font-size: 0.78rem;
  letter-spacing: 0.35em;
  color: var(--text-muted);
}
.hero-title {
  margin: 4px 0 8px;
  font-size: 2.6rem;
  letter-spacing: 0.12em;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-tagline { margin: 0; color: var(--text-muted); }
.hero-wave {
  position: absolute;
  right: -40px;
  bottom: -60px;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(79, 109, 245, 0.18), transparent 70%);
  animation: hero-pulse 5s ease-in-out infinite;
}
@keyframes hero-pulse {
  0%, 100% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.25); opacity: 0.4; }
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-block;
  border-radius: 999px;
  padding: 7px 18px;
  font-size: 0.9rem;
  cursor: pointer;
  text-decoration: none;
  border: 1px solid transparent;
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s, color 0.15s;
}
.btn:active { transform: scale(0.96); }

.btn-primary {
  background: var(--gradient);
  color: #fff;
  box-shadow: 0 4px 14px rgba(79, 109, 245, 0.35);
}
.btn-primary:hover { box-shadow: 0 6px 20px rgba(79, 109, 245, 0.5); transform: translateY(-1px); }
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-ghost {
  background: rgba(79, 109, 245, 0.08);
  color: var(--accent);
}
.btn-ghost:hover { background: rgba(79, 109, 245, 0.16); }

.hidden { display: none !important; }

/* ---------- 自我介绍 + 悬浮点赞 ---------- */
.intro-card { position: relative; }

.like-btn {
  position: absolute;
  top: 18px;
  right: -18px;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  border: 3px solid #fff;
  background: #fff;
  color: #c6cfe4;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  box-shadow: 0 6px 18px rgba(79, 109, 245, 0.22);
  transition: transform 0.18s, background 0.2s, color 0.2s;
  z-index: 2;
}
.like-btn:hover { transform: scale(1.08); }
.like-btn:active { transform: scale(0.94); }
.like-heart { font-size: 1.25rem; line-height: 1; }
.like-count { font-size: 0.72rem; font-weight: 700; line-height: 1.2; }
.like-btn.liked {
  background: var(--gradient);
  color: #fff;
}
.like-btn.liked .like-heart { animation: heart-pop 0.45s ease; }
@keyframes heart-pop {
  0% { transform: scale(1); }
  35% { transform: scale(1.6) rotate(-10deg); }
  65% { transform: scale(0.85); }
  100% { transform: scale(1); }
}

/* ---------- Markdown ---------- */
.markdown-body img { max-width: 100%; border-radius: 10px; }
.markdown-body pre {
  background: #1f2a44;
  color: #e6ebf7;
  padding: 12px;
  border-radius: 10px;
  overflow-x: auto;
}
.markdown-body code {
  background: rgba(79, 109, 245, 0.1);
  color: var(--accent);
  padding: 1px 5px;
  border-radius: 5px;
  font-size: 0.9em;
}
.markdown-body pre code { background: transparent; color: inherit; padding: 0; }
.markdown-body a { color: var(--accent); text-decoration: none; border-bottom: 1px dashed rgba(79, 109, 245, 0.4); }
.markdown-body a:hover { border-bottom-style: solid; }
.markdown-body blockquote {
  margin: 0;
  padding: 4px 14px;
  border-left: 4px solid rgba(79, 109, 245, 0.35);
  color: var(--text-muted);
}
.markdown-body h1, .markdown-body h2, .markdown-body h3 { line-height: 1.35; }

/* ---------- 编辑区 ---------- */
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 0.95rem;
  resize: vertical;
  background: rgba(255, 255, 255, 0.85);
  transition: border-color 0.15s, box-shadow 0.15s;
}
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 109, 245, 0.15);
}

.editor-actions { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.status-text { font-size: 0.85rem; color: var(--text-muted); }
.status-text.error { color: var(--danger); }

/* ---------- GitHub 仓库 ---------- */
.repo-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 560px;
  overflow-y: auto;
  padding-right: 6px;
}
.repo-list::-webkit-scrollbar { width: 6px; }
.repo-list::-webkit-scrollbar-thumb { background: rgba(79, 109, 245, 0.25); border-radius: 3px; }

.repo-card {
  display: block;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  text-decoration: none;
  color: inherit;
  background: rgba(255, 255, 255, 0.65);
  transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s;
}
.repo-card:hover {
  transform: translateY(-3px);
  border-color: rgba(79, 109, 245, 0.5);
  box-shadow: 0 8px 22px rgba(79, 109, 245, 0.16);
}
.repo-name {
  font-weight: 650;
  color: var(--accent);
  word-break: break-all;
}
.repo-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 6px 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.6em;
}
.repo-meta { display: flex; gap: 14px; font-size: 0.8rem; color: var(--text-muted); }
.repo-lang-dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  margin-right: 4px;
  background: var(--accent);
}

/* ---------- 留言板 ---------- */
.message-form { margin-bottom: 20px; }

.message-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.message-item { display: flex; gap: 12px; animation: msg-in 0.35s ease both; }
@keyframes msg-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.message-item img {
  width: 42px; height: 42px;
  border-radius: 50%;
  flex-shrink: 0;
  background: rgba(79, 109, 245, 0.12);
  border: 2px solid #fff;
  box-shadow: 0 2px 8px rgba(31, 42, 68, 0.12);
}

.message-body { flex: 1; min-width: 0; }

.message-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.message-nick { font-weight: 650; }
.message-time { font-size: 0.78rem; color: var(--text-muted); }
.message-content {
  margin-top: 4px;
  white-space: pre-wrap;
  word-break: break-word;
  background: rgba(79, 109, 245, 0.05);
  border-radius: 4px 14px 14px 14px;
  padding: 8px 14px;
}
.reply-to {
  font-size: 0.82rem;
  color: var(--accent);
  margin-bottom: 2px;
}

.message-ops { margin-top: 6px; }
.reply-btn {
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 0.82rem;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}
.reply-btn:hover { color: var(--accent); background: rgba(79, 109, 245, 0.08); }

.reply-form { margin-top: 8px; }
.reply-form textarea { font-size: 0.9rem; }

/* 子回复：缩进 + 左侧渐变线 */
.reply-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0 0 0 16px;
  border-left: 2px solid rgba(79, 109, 245, 0.2);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.reply-list .message-item img { width: 32px; height: 32px; }

.empty-text { color: var(--text-muted); font-size: 0.9rem; }

/* ---------- 滚动入场动效 ---------- */
.reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
.reveal.visible { opacity: 1; transform: translateY(0); }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .blob, .hero-wave { animation: none; }
}

/* ---------- 页脚 ---------- */
.site-footer {
  position: relative;
  z-index: 1;
  padding: 10px 0 34px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ---------- 响应式 ---------- */
@media (max-width: 760px) {
  .grid-top {
    grid-template-columns: 1fr;
    grid-template-areas: "hero" "intro" "github";
  }
  .like-btn {
    position: static;
    width: auto;
    height: auto;
    border-radius: 999px;
    flex-direction: row;
    gap: 8px;
    padding: 8px 20px;
    margin-top: 14px;
  }
  .hero-title { font-size: 2rem; }
  .card { padding: 18px; }
  .repo-list { max-height: none; }
}
