:root {
  --ink: #3d1f52;
  --ink-soft: #6b4a80;
  --paper: #fdf4ff;
  --paper-2: #f3e4fb;
  --win-face: #fbefff;
  --win-shadow: #5b2a75;
  --win-light: #ffffff;
  --title-a: #7b3fa0;
  --title-b: #d96ba8;
  --link: #6a3fa8;
  --pink: #c8618b;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  padding: 28px 20px 40px;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Unifont-T", "Courier New", monospace;
  font-size: 14px;
  line-height: 1.8;
  background: linear-gradient(160deg, #1b0b2e 0%, #3d1a5c 32%, #8b3f8f 66%, #e78bb8 100%);
  background-attachment: fixed;
  overflow-x: hidden;
}

/* ---------- 星空背景 ---------- */
#starfield {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}
#starfield span {
  position: absolute;
  color: #fff;
  line-height: 1;
  text-shadow: 0 0 4px rgba(255,255,255,.8);
  animation: twinkle var(--dur, 3s) ease-in-out var(--delay, 0s) infinite alternate;
}
@keyframes twinkle {
  0%, 100% { opacity: .15; transform: scale(.8); }
  50% { opacity: 1; transform: scale(1.15); }
}

a { color: var(--link); text-decoration: none; }
a:hover { color: var(--pink); text-decoration: underline; }
a:visited { color: #8a5fa8; }

.site { max-width: 1120px; margin: 0 auto; position: relative; }

/* ---------- 窗口通用外框 ---------- */
.window {
  border: 3px solid;
  border-color: var(--win-light) var(--win-shadow) var(--win-shadow) var(--win-light);
  background: var(--win-face);
  box-shadow: 6px 6px 0 rgba(20,5,35,.55), inset -1px -1px 0 #c9a8d8, inset 1px 1px 0 #fff;
  padding: 4px;
}
.titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: 26px;
  padding: 0 4px 0 8px;
  background: linear-gradient(90deg, var(--title-a), var(--title-b));
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  text-shadow: 1px 1px 0 rgba(0,0,0,.25);
  user-select: none;
}
.titlebar .tb-title { display: flex; align-items: center; gap: 7px; }
.titlebar .tb-icon {
  width: 14px; height: 14px;
  display: grid; place-items: center;
  background: #fff; color: var(--title-a);
  font-size: 10px; border-radius: 2px;
  text-shadow: none;
}
.win-buttons { display: flex; gap: 3px; }
.win-buttons i {
  width: 18px; height: 18px;
  display: grid; place-items: center;
  background: var(--win-face);
  border: 2px solid;
  border-color: var(--win-light) var(--win-shadow) var(--win-shadow) var(--win-light);
  color: var(--ink);
  font-size: 11px; font-style: normal; font-weight: 700;
  text-shadow: none;
}
.win-buttons i:last-child { background: #e88bb0; }

/* ---------- 顶部标签导航 ---------- */
.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: -3px;
  padding-left: 2px;
  position: relative;
  z-index: 2;
}
.tabs { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 3px; }
.tab {
  display: inline-block;
  min-width: 76px;
  padding: 5px 16px 7px;
  border: 3px solid;
  border-color: var(--win-light) var(--win-shadow) var(--win-shadow) var(--win-light);
  border-bottom: none;
  background: var(--win-face);
  color: var(--ink-soft);
  text-align: center;
  font-size: 14px;
}
.tab:hover { color: var(--ink); text-decoration: none; background: #fff; }
.tab.active {
  background: var(--paper);
  color: var(--title-a);
  font-weight: 700;
  padding-bottom: 10px;
  box-shadow: inset 0 -3px 0 var(--pink);
}
.tab-empty {
  min-width: 58px;
  border-style: dashed;
  color: #a98cba;
  font-size: 12px;
  cursor: default;
}
.deco-gif {
  flex: 0 0 auto;
  width: 64px; height: 48px;
  display: grid; place-items: center;
  border: none;
  background: transparent;
  overflow: visible;
}
.deco-gif img { width: 100%; height: 100%; object-fit: contain; image-rendering: auto; }

/* ---------- 主体布局 ---------- */
.frame-body { padding: 12px; }
.layout {
  display: grid;
  grid-template-columns: 306px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

/* ---------- 内部面板 ---------- */
.panel {
  border: 2px solid;
  border-color: var(--win-shadow) var(--win-light) var(--win-light) var(--win-shadow);
  background: var(--paper);
  box-shadow: inset 1px 1px 0 #c9a8d8;
}
.panel-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 3px 8px;
  background: linear-gradient(90deg, #a86ac0, #d98fb8);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  text-shadow: 1px 1px 0 rgba(0,0,0,.2);
}
.panel-bar .dots { display: flex; gap: 3px; }
.panel-bar .dots i {
  width: 8px; height: 8px;
  border: 1px solid var(--win-shadow);
  background: var(--paper);
  display: block;
}
.panel-bar .dots i:first-child { background: #e88bb0; }
.panel-bar .dots i:nth-child(2) { background: #e8c98a; }
.panel-bar .dots i:last-child { background: #9ecfb0; }
.panel-body { padding: 10px; }
aside .panel + .panel { margin-top: 10px; }

/* ---------- 关于我 ---------- */
.about-top {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 10px;
  align-items: start;
}
.avatar {
  width: 96px; height: 96px;
  object-fit: cover;
  border: 2px solid;
  border-color: var(--win-shadow) var(--win-light) var(--win-light) var(--win-shadow);
  background: #d9bde8;
}
.profile { margin: 0; padding: 0; list-style: none; font-size: 12px; }
.profile li { padding: 1px 0; }
.profile b { color: var(--title-a); font-weight: 700; }

.welcome {
  margin-top: 10px;
  padding: 7px 9px;
  border: 1px dashed #c9a8d8;
  background: #fff9ff;
  font-size: 11px;
  color: var(--ink-soft);
}
.welcome strong { display: block; color: var(--title-b); font-size: 12px; margin-bottom: 2px; }

/* ---------- 友情链接 ---------- */
.link-list { margin: 0; padding: 0; list-style: none; }
.link-list li {
  display: flex; gap: 8px;
  padding: 3px 2px;
  border-bottom: 1px dotted #d4bce0;
  font-size: 12px;
}
.link-list li:last-child { border-bottom: none; }
.link-list .num { color: var(--pink); flex: 0 0 auto; }

/* ---------- 头图 ---------- */
.hero { margin-bottom: 10px; border: 2px solid; border-color: var(--win-shadow) var(--win-light) var(--win-light) var(--win-shadow); background: var(--paper); }
.hero img { display: block; width: 100%; height: auto; }

/* ---------- 下部 ---------- */
.lower {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(150px, 1fr);
  gap: 10px;
  align-items: stretch;
}
.post-item { padding: 8px 2px 10px; border-bottom: 1px dashed #d4bce0; }
.post-item:first-child { padding-top: 2px; }
.post-item:last-of-type { border-bottom: none; }
.post-title { margin: 0 0 2px; font-size: 14px; line-height: 1.5; }
.post-title a { color: var(--ink); }
.post-title a:hover { color: var(--title-b); }
.post-meta { font-size: 11px; color: var(--pink); letter-spacing: 1px; }
.post-excerpt {
  margin: 4px 0 0; font-size: 11px; color: var(--ink-soft);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.posts-more { text-align: right; padding-top: 5px; }
.btn {
  display: inline-block; padding: 3px 11px;
  border: 2px solid;
  border-color: var(--win-light) var(--win-shadow) var(--win-shadow) var(--win-light);
  background: var(--win-face); color: var(--ink); font-size: 11px;
  box-shadow: 2px 2px 0 rgba(20,5,35,.3);
}
.btn:hover { text-decoration: none; background: #fff; }
.btn:active { transform: translate(2px,2px); box-shadow: none; }

.log-list { margin: 0; padding: 0; list-style: none; font-size: 11px; }
.log-list li {
  padding: 5px 0 5px 8px;
  border-left: 3px solid #d4bce0;
  margin-left: 4px; color: var(--ink-soft);
}
.log-list li b { display: block; color: var(--title-b); font-size: 10px; letter-spacing: 1px; }

/* ---------- 页脚 ---------- */
.footer {
  margin-top: 8px;
  padding: 7px 6px 2px;
  border-top: 1px solid #d4bce0;
  font-size: 10px;
  color: var(--ink-soft);
  display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap;
}

/* ---------- About 页 ---------- */
.about-page { padding: 4px 2px; }
.about-avatar {
  display: block;
  width: 220px; height: 220px;
  object-fit: cover;
  margin: 0 auto 18px;
  border: 3px solid;
  border-color: var(--win-light) var(--win-shadow) var(--win-shadow) var(--win-light);
  box-shadow: 4px 4px 0 rgba(20,5,35,.35);
  background: #d9bde8;
}
.about-copy p { margin: 0 0 14px; line-height: 2; }
.about-sign {
  margin-top: 20px;
  padding-top: 10px;
  border-top: 2px dashed #c9a8d8;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 11px;
  color: var(--ink-soft);
}

/* ---------- 二级页面标题 ---------- */
.page-heading {
  margin: 2px 0 14px;
  padding-bottom: 6px;
  border-bottom: 2px dashed #c9a8d8;
  color: var(--title-a);
  font-size: 15px;
  font-weight: 700;
}

/* ---------- 博文页 ---------- */
.post-page { max-width: 1120px; margin: 0 auto; }
.post-page h1 { font-size: 19px; line-height: 1.5; margin: 8px 0 4px; }
.post-page .post-meta { margin-bottom: 14px; }
.post-content p { margin: 0 0 13px; }
.post-content h2 {
  font-size: 15px; margin: 20px 0 8px; padding-left: 10px;
  border-left: 4px solid var(--title-b);
}
.post-content strong { color: var(--title-b); }
.back {
  display: inline-block;
  margin-bottom: 8px;
  padding: 5px 14px;
  border: 3px solid;
  border-color: var(--win-light) var(--win-shadow) var(--win-shadow) var(--win-light);
  background: var(--win-face);
  color: var(--title-a);
  font-size: 12px;
  font-weight: 700;
  text-shadow: none;
  box-shadow: 3px 3px 0 rgba(20,5,35,.4);
}
.back:hover { text-decoration: none; background: #fff; color: var(--title-b); }

@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; }
  .lower { grid-template-columns: 1fr; }
  .deco-gif { display: none; }
  body { padding: 16px 12px 30px; }
}
