/* ============================================================
   个人网站样式 —— 二次元风格
   配色：粉白 / 淡紫 / 蓝白（高明度、低饱和度）
   手法：渐变背景、毛玻璃、柔和阴影、发光、圆角、漂浮光斑、闪烁星星
   ============================================================ */

:root {
  --bg1: #fff5f9;            /* 浅粉 */
  --bg2: #f5efff;            /* 淡紫 */
  --bg3: #eef6ff;            /* 淡蓝 */
  --card: rgba(255, 255, 255, 0.72);
  --card-solid: #ffffff;
  --glass-border: rgba(255, 255, 255, 0.65);
  --accent: #f472b6;         /* 主色：粉 */
  --accent-2: #a78bfa;       /* 辅色：紫 */
  --accent-3: #7cc4f8;       /* 点缀：蓝 */
  --accent-dark: #ec5aa8;
  --accent-soft: rgba(244, 114, 182, 0.10);
  --accent-2-soft: rgba(167, 139, 250, 0.12);
  --text: #3d3a50;
  --text-sub: #7c7a92;
  --text-mute: #a5a3b8;
  --border: rgba(244, 114, 182, 0.14);
  --danger: #f43f5e;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 4px 20px rgba(244, 114, 182, 0.10), 0 2px 8px rgba(167, 139, 250, 0.08);
  --shadow-lg: 0 10px 36px rgba(244, 114, 182, 0.18), 0 4px 14px rgba(167, 139, 250, 0.12);
  --glow: 0 0 18px rgba(244, 114, 182, 0.45);
  --glow-2: 0 0 22px rgba(167, 139, 250, 0.45);
  --sidebar-w: 240px;
}

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

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Yuanti SC", sans-serif;
  /* 柔和的三段渐变背景（粉 → 紫 → 蓝） */
  background: linear-gradient(160deg, var(--bg1) 0%, var(--bg2) 45%, var(--bg3) 100%);
  background-attachment: fixed;
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  overflow-x: hidden;
}

.hidden { display: none !important; }

/* ---------- 装饰：光斑与星星 ---------- */
.deco { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.55;
  animation: orb-float 14s ease-in-out infinite alternate;
}
.orb-1 { width: 380px; height: 380px; background: radial-gradient(circle, rgba(244,114,182,.45), transparent 70%); top: -120px; left: -80px; }
.orb-2 { width: 320px; height: 320px; background: radial-gradient(circle, rgba(167,139,250,.45), transparent 70%); bottom: -100px; right: -60px; animation-delay: -5s; }
.orb-3 { width: 240px; height: 240px; background: radial-gradient(circle, rgba(124,196,248,.4), transparent 70%); top: 40%; right: 18%; animation-delay: -9s; }

@keyframes orb-float {
  0%   { transform: translate(0, 0) scale(1); }
  100% { transform: translate(40px, 30px) scale(1.12); }
}

.star {
  position: absolute;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.9);
  animation: twinkle 3.2s ease-in-out infinite;
  animation-delay: var(--d, 0s);
  opacity: 0;
}
@keyframes twinkle {
  0%, 100% { opacity: 0.15; transform: scale(0.8); }
  50%      { opacity: 0.95; transform: scale(1.15); }
}

/* ---------- 通用组件 ---------- */
.input {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 14px;
  background: rgba(255, 255, 255, 0.85);
  color: var(--text);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  min-height: 40px;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input-search { width: 220px; }
.input-select { padding: 8px 10px; }
.input-sm { width: 140px; }
.input-title { width: 100%; font-size: 20px; font-weight: 700; padding: 10px 14px; }

.btn {
  border: none;
  border-radius: 999px;
  padding: 9px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all .18s ease;
  background: rgba(255, 255, 255, 0.8);
  color: var(--text);
  border: 1px solid var(--border);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  line-height: 1.4;
  gap: 6px;
}
.btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}
.btn:active { transform: translateY(0) scale(0.98); }
.btn-primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  color: #fff;
  border: none;
  box-shadow: var(--glow);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--accent-dark) 0%, var(--accent-2) 100%);
  color: #fff;
  transform: translateY(-1px) scale(1.02);
  box-shadow: var(--glow), 0 6px 18px rgba(244, 114, 182, 0.35);
}
.btn-ghost { border-color: transparent; background: transparent; }
.btn-danger { background: rgba(255, 255, 255, 0.8); color: var(--danger); border-color: rgba(244, 63, 94, 0.3); }
.btn-danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-icon { padding: 6px 12px; min-height: 36px; }
.btn-sm { padding: 4px 12px; font-size: 13px; min-height: 34px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.input-block { width: 100%; margin-bottom: 12px; }
.modal-sm { width: min(380px, 100%); }
.topbar-right { display: flex; align-items: center; gap: 12px; }

.chip {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.7);
  border-radius: 999px;
  padding: 6px 16px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text-sub);
  transition: all .15s;
}
.chip:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }
.chip.active {
  background: linear-gradient(135deg, var(--accent-soft), var(--accent-2-soft));
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

/* ---------- 登录页（毛玻璃卡片） ---------- */
.login-screen {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
}
.login-card {
  background: var(--card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
  padding: 44px 40px;
  width: 360px;
  text-align: center;
  animation: card-in .4s ease;
}
@keyframes card-in {
  from { opacity: 0; transform: translateY(16px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.login-logo {
  font-size: 44px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 14px rgba(244, 114, 182, 0.5));
}
.login-title { font-size: 22px; font-weight: 800; margin: 12px 0 4px; }
.login-sub { color: var(--text-sub); margin-bottom: 22px; }
.login-card .input { width: 100%; margin-bottom: 14px; }
.login-error { color: var(--danger); margin-top: 12px; font-size: 13px; }

/* ---------- 应用框架：侧边栏 + 主区 ---------- */
.app { display: flex; min-height: 100vh; position: relative; z-index: 1; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar-header {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 18px;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo {
  font-size: 24px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.sidebar-name { font-size: 15px; font-weight: 800; }

.sidebar-nav { flex: 1; padding: 14px 10px; display: flex; flex-direction: column; gap: 6px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px;
  border-radius: 14px;
  color: var(--text-sub);
  text-decoration: none;
  cursor: pointer;
  background: none; border: none; font-size: 14px; width: 100%;
  text-align: left;
  transition: all .15s;
  min-height: 42px;
}
.nav-item:hover { background: rgba(255,255,255,.65); color: var(--text); transform: translateX(2px); }
.nav-item.active {
  background: linear-gradient(135deg, var(--accent-soft), var(--accent-2-soft));
  color: var(--accent);
  font-weight: 700;
  box-shadow: inset 0 0 0 1px var(--border);
}
.nav-icon { font-size: 16px; }
.sidebar-footer { padding: 12px 10px; border-top: 1px solid var(--border); }

.sidebar-mask {
  position: fixed; inset: 0; background: rgba(90, 80, 120, 0.35);
  backdrop-filter: blur(4px);
  z-index: 90;
}

/* ---------- 主内容区 ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 28px;
  background: var(--card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--glass-border);
  position: sticky; top: 0; z-index: 10;
}
.page-title { font-size: 18px; font-weight: 800; }
.clickable { cursor: pointer; user-select: none; transition: color .15s; }
.clickable:hover { color: var(--accent); }
.topbar-time { color: var(--text-mute); font-variant-numeric: tabular-nums; font-size: 15px; }
.mobile-only { display: none; }

.view { padding: 24px 28px 40px; max-width: 1080px; width: 100%; margin: 0 auto; }

/* ---------- 工具栏 ---------- */
.toolbar {
  display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.toolbar .btn-primary { margin-left: auto; }

/* ---------- 帖子列表（毛玻璃卡片） ---------- */
.post-list { display: flex; flex-direction: column; gap: 14px; }
.post-card {
  background: var(--card);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 24px;
  cursor: pointer;
  transition: all .2s ease;
  animation: card-in .35s ease both;
}
.post-card:nth-child(2) { animation-delay: .04s; }
.post-card:nth-child(3) { animation-delay: .08s; }
.post-card:nth-child(4) { animation-delay: .12s; }
.post-card:nth-child(5) { animation-delay: .16s; }
.post-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
  border-color: rgba(244, 114, 182, 0.35);
}
.post-card-top { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.post-pin {
  color: var(--accent); font-size: 13px; font-weight: 800;
  text-shadow: 0 0 12px rgba(244, 114, 182, 0.5);
}
.post-card-title { font-size: 17px; font-weight: 700; }
.post-card-excerpt { color: var(--text-sub); font-size: 13px; margin: 6px 0 10px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.post-card-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tag {
  background: linear-gradient(135deg, var(--accent-soft), var(--accent-2-soft));
  color: var(--accent);
  border-radius: 999px;
  padding: 3px 12px;
  font-size: 12px;
  font-weight: 600;
}
.cat {
  background: rgba(124, 196, 248, 0.18);
  color: #4a9ad5;
  border-radius: 999px;
  padding: 3px 12px;
  font-size: 12px;
  font-weight: 600;
}
.post-date { color: var(--text-mute); font-size: 12px; margin-left: auto; }

.empty-tip { text-align: center; color: var(--text-mute); padding: 60px 0; }

.pagination { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 24px; }
.page-info { color: var(--text-sub); font-size: 13px; }

/* ---------- 编辑器 ---------- */
.editor-head { margin-bottom: 12px; }
.editor-meta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.checkbox-label { display: flex; align-items: center; gap: 6px; color: var(--text-sub); cursor: pointer; }
.editor-tabs { display: flex; gap: 4px; margin-bottom: 0; }
.tab-btn {
  border: 1px solid var(--border);
  border-bottom: none;
  background: rgba(255, 255, 255, 0.6);
  padding: 10px 20px;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  cursor: pointer;
  color: var(--text-sub);
  font-size: 14px;
  font-weight: 600;
  transition: all .15s;
}
.tab-btn.active {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.9);
}
.editor-area {
  width: 100%;
  min-height: 420px;
  border: 1px solid var(--border);
  border-radius: 0 var(--radius) var(--radius) var(--radius);
  padding: 16px;
  font-family: "SFMono-Regular", Consolas, "Courier New", monospace;
  font-size: 14px;
  line-height: 1.7;
  resize: vertical;
  outline: none;
  background: rgba(255, 255, 255, 0.85);
}
.editor-area:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.editor-preview {
  background: var(--card);
  backdrop-filter: blur(14px);
  border: 1px solid var(--glass-border);
  border-radius: 0 var(--radius) var(--radius) var(--radius);
  padding: 20px 24px;
  min-height: 420px;
}

/* ---------- 帖子详情 ---------- */
.post-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.post-actions { display: flex; gap: 8px; }
.post-detail-title { font-size: 26px; margin-bottom: 8px; }
.post-detail-meta { color: var(--text-mute); font-size: 13px; margin-bottom: 24px; display: flex; gap: 12px; align-items: center; }

/* ---------- Markdown 渲染 ---------- */
.markdown-body {
  background: var(--card);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 26px 30px;
  animation: card-in .3s ease both;
}
.markdown-body h1, .markdown-body h2, .markdown-body h3 { margin: 1.2em 0 .5em; line-height: 1.35; }
.markdown-body h1 { font-size: 24px; }
.markdown-body h2 { font-size: 20px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.markdown-body h3 { font-size: 17px; }
.markdown-body p { margin: .8em 0; }
.markdown-body a { color: var(--accent); text-decoration: none; }
.markdown-body a:hover { text-decoration: underline; }
.markdown-body img { max-width: 100%; border-radius: var(--radius-sm); box-shadow: var(--shadow); }
.markdown-body ul, .markdown-body ol { padding-left: 1.6em; margin: .8em 0; }
.markdown-body blockquote {
  border-left: 3px solid var(--accent);
  background: linear-gradient(135deg, var(--accent-soft), var(--accent-2-soft));
  padding: 10px 16px;
  margin: .8em 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-sub);
}
.markdown-body code {
  background: rgba(167, 139, 250, 0.15);
  color: #7c5cd6;
  padding: 2px 6px;
  border-radius: 6px;
  font-family: Consolas, monospace;
  font-size: 13px;
}
.markdown-body pre { background: rgba(255, 255, 255, 0.85); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 16px; overflow-x: auto; margin: .8em 0; }
.markdown-body pre code { background: none; padding: 0; color: var(--text); }
.markdown-body table { border-collapse: collapse; width: 100%; margin: .8em 0; }
.markdown-body th, .markdown-body td { border: 1px solid var(--border); padding: 8px 12px; text-align: left; }
.markdown-body th { background: var(--accent-soft); font-weight: 700; }
.markdown-body hr { border: none; border-top: 1px solid var(--border); margin: 1.5em 0; }

/* ---------- 文件管理 ---------- */
.file-type-filter { display: flex; gap: 8px; flex-wrap: wrap; }
.file-hint {
  color: var(--text-sub); font-size: 13px;
  background: linear-gradient(135deg, var(--accent-soft), var(--accent-2-soft));
  border-radius: var(--radius-sm);
  padding: 10px 14px; margin-bottom: 16px;
}
.file-hint code { background: rgba(255,255,255,.8); padding: 1px 6px; border-radius: 4px; font-family: Consolas, monospace; font-size: 12px; }

.drop-zone {
  border: 2px dashed rgba(244, 114, 182, 0.35);
  border-radius: var(--radius);
  background: var(--card);
  backdrop-filter: blur(14px);
  padding: 36px 20px;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  margin-bottom: 20px;
}
.drop-zone:hover { border-color: var(--accent); }
.drop-zone.dragover {
  border-color: var(--accent);
  background: linear-gradient(135deg, var(--accent-soft), var(--accent-2-soft));
  transform: scale(1.01);
}
.drop-icon { font-size: 32px; display: block; margin-bottom: 8px; filter: drop-shadow(0 0 10px rgba(244,114,182,.4)); }
.drop-link { color: var(--accent); text-decoration: underline; font-weight: 600; }

.upload-progress { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.upload-item {
  background: var(--card);
  backdrop-filter: blur(14px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  padding: 10px 14px;
  display: flex; align-items: center; gap: 12px;
}
.upload-item-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.progress-bar { width: 180px; height: 6px; background: rgba(167, 139, 250, 0.15); border-radius: 3px; overflow: hidden; flex-shrink: 0; }
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 3px;
  transition: width .2s;
  width: 0;
  box-shadow: 0 0 8px rgba(244, 114, 182, 0.5);
}
.upload-pct { font-size: 12px; color: var(--text-sub); width: 44px; text-align: right; flex-shrink: 0; }
.upload-status { font-size: 12px; color: var(--text-mute); width: 60px; text-align: right; flex-shrink: 0; }

.file-list { display: flex; flex-direction: column; gap: 10px; }
.file-item {
  background: var(--card);
  backdrop-filter: blur(14px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  padding: 12px 16px;
  display: flex; align-items: center; gap: 14px;
  transition: all .18s;
}
.file-item:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.file-icon { font-size: 22px; flex-shrink: 0; }
.file-info { flex: 1; min-width: 0; }
.file-name { font-size: 14px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-meta { font-size: 12px; color: var(--text-mute); margin-top: 2px; }
.hidden-badge {
  display: inline-block;
  background: rgba(244, 63, 94, 0.12);
  color: var(--danger);
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 11px;
  font-weight: 700;
  margin-left: 6px;
  vertical-align: middle;
}
.btn-hide { color: var(--text-sub); }
.btn-hide:hover { border-color: var(--danger); color: var(--danger); }
.btn-show { color: #4a9ad5; }
.btn-show:hover { border-color: #4a9ad5; color: #4a9ad5; }
.file-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ---------- 预览弹窗 ---------- */
.modal { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; padding: 24px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(80, 70, 110, 0.4); backdrop-filter: blur(6px); }
.modal-content {
  position: relative;
  background: var(--card-solid);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: min(900px, 100%);
  max-height: 90vh;
  display: flex; flex-direction: column;
  overflow: hidden;
  animation: card-in .25s ease;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border); gap: 12px; }
.modal-title { font-weight: 700; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal-actions { display: flex; gap: 8px; flex-shrink: 0; }
.modal-body { padding: 18px; overflow: auto; flex: 1; }
.modal-body img, .modal-body video { max-width: 100%; max-height: 70vh; display: block; margin: 0 auto; border-radius: var(--radius-sm); }
.modal-body iframe { width: 100%; height: 70vh; border: none; border-radius: var(--radius-sm); }
.modal-body pre { white-space: pre-wrap; word-break: break-all; font-size: 13px; line-height: 1.7; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 32px; left: 50%;
  transform: translateX(-50%);
  background: rgba(61, 58, 80, 0.9);
  backdrop-filter: blur(10px);
  color: #fff;
  padding: 10px 22px;
  border-radius: 999px;
  font-size: 13px;
  z-index: 300;
  box-shadow: var(--shadow-lg);
}

/* ---------- 响应式（手机） ---------- */
@media (max-width: 768px) {
  .mobile-only { display: inline-flex; }
  .sidebar {
    position: fixed;
    left: 0; top: 0;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform .2s;
  }
  .sidebar.open { transform: translateX(0); }
  .view { padding: 16px; }
  .topbar { padding: 12px 16px; }
  .input-search { width: 100%; }
  .toolbar .btn-primary { margin-left: 0; width: 100%; }
  .progress-bar { width: 100px; }
  .file-item { flex-wrap: wrap; }
  .file-actions { width: 100%; justify-content: flex-end; }
  .editor-meta .input-sm { flex: 1; }
  .login-card { width: 92%; padding: 32px 24px; }
}
