:root {
  --bg: #070a18;
  --bg-2: #0d1226;
  --card: rgba(23, 30, 58, 0.72);
  --card-solid: #151b36;
  --border: rgba(148, 163, 255, 0.14);
  --fg: #dfe6ff;
  --muted: #8b93b5;
  --accent: #7aa2ff;
  --accent-2: #9d7bff;
  --gold: #f6c96b;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(1200px 800px at 80% -10%, rgba(80, 60, 180, 0.18), transparent 60%),
    radial-gradient(900px 700px at 10% 30%, rgba(30, 90, 160, 0.16), transparent 55%),
    radial-gradient(700px 600px at 60% 110%, rgba(120, 60, 180, 0.14), transparent 60%),
    var(--bg);
  color: var(--fg);
  line-height: 1.8;
  min-height: 100vh;
}

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

/* ---------- starfield backdrop ---------- */
#stars {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
#stars i {
  position: absolute;
  display: block;
  border-radius: 50%;
  background: #fff;
  animation: twinkle var(--tw, 3s) ease-in-out infinite;
  opacity: 0.5;
}
@keyframes twinkle {
  0%, 100% { opacity: 0.12; transform: scale(0.7); }
  50% { opacity: 0.9; transform: scale(1.15); }
}

#shooting-stars .shoot {
  position: absolute;
  width: 120px;
  height: 2px;
  background: linear-gradient(90deg, rgba(255,255,255,0.9), transparent);
  border-radius: 2px;
  transform: rotate(-35deg);
  opacity: 0;
  animation: shoot 6s linear infinite;
}
@keyframes shoot {
  0% { transform: rotate(-35deg) translateX(0); opacity: 0; }
  3% { opacity: 1; }
  10% { transform: rotate(-35deg) translateX(-420px); opacity: 0; }
  100% { transform: rotate(-35deg) translateX(-420px); opacity: 0; }
}

/* ---------- loading ---------- */
#loading {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #070a18;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  transition: opacity 0.6s ease;
}
#loading.done { opacity: 0; pointer-events: none; }
#loading svg.fish {
  width: 150px;
  animation: swim 2.4s ease-in-out infinite;
}
@keyframes swim {
  0%, 100% { transform: translateX(-14px) rotate(-4deg); }
  50% { transform: translateX(14px) rotate(4deg); }
}
#loading .bar {
  width: 180px;
  height: 4px;
  border-radius: 4px;
  background: rgba(148, 163, 255, 0.2);
  overflow: hidden;
}
#loading .bar i {
  display: block;
  height: 100%;
  width: 40%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  animation: load 1.4s ease-in-out infinite;
}
@keyframes load {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(350%); }
}

/* ---------- layout ---------- */
#container { position: relative; z-index: 1; }
.inner { max-width: 1120px; margin: 0 auto; padding: 0 20px; }

/* ---------- header ---------- */
#header { position: relative; overflow: hidden; margin-bottom: 28px; }
#header .scenes { position: absolute; inset: 0; }
#header .scene {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 1.6s ease;
}
#header .scene.active { opacity: 1; }
.scene-1 { background: radial-gradient(1000px 500px at 70% 20%, rgba(150,90,220,0.35), transparent 60%), linear-gradient(180deg, #0b1026, #101a3c 70%, #0a0f24); }
.scene-2 { background: radial-gradient(800px 460px at 25% 35%, rgba(70,140,230,0.3), transparent 60%), linear-gradient(180deg, #081020, #0f2140 70%, #0a0f24); }
.scene-3 { background: radial-gradient(900px 500px at 50% 50%, rgba(220,120,80,0.22), transparent 60%), linear-gradient(180deg, #0d0a20, #2a1640 70%, #0a0f24); }

#header .inner {
  position: relative;
  padding-top: 56px;
  padding-bottom: 64px;
  text-align: center;
}
#brand .artboard {
  margin: 0;
  font-size: 13px;
  letter-spacing: 6px;
  color: var(--gold);
  font-weight: 600;
  text-transform: uppercase;
}
#brand .title {
  margin: 8px 0 0;
  font-size: 44px;
  font-weight: 800;
  letter-spacing: 8px;
  background: linear-gradient(90deg, #cfe0ff, #9db4ff, #d4b6ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
#brand .sub {
  margin: 10px 0 0;
  font-size: 15px;
  color: var(--muted);
}
#header .nav-bar {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 20px;
  gap: 4px;
}
#header .nav-bar a.menu-item,
#header .nav-bar .menu-group > span {
  display: inline-block;
  padding: 6px 16px;
  color: var(--fg);
  font-size: 14px;
  border-radius: 999px;
  cursor: pointer;
}
#header .nav-bar a.menu-item:hover { background: rgba(148,163,255,0.14); color: #fff; }
.menu-group { position: relative; }
.menu-group .sub {
  display: none;
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--card-solid);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px;
  box-shadow: var(--shadow);
  min-width: 130px;
}
.menu-group:hover .sub, .menu-group:focus-within .sub { display: block; }
.menu-group .sub a { display: block; padding: 6px 14px; color: var(--fg); font-size: 13px; border-radius: 6px; }
.menu-group .sub a:hover { background: rgba(148,163,255,0.14); }
.nav-right { position: absolute; right: 20px; top: 50%; transform: translateY(-50%); display: flex; gap: 8px; }
.nav-right button {
  border: 1px solid var(--border);
  background: rgba(21,27,54,0.6);
  color: var(--fg);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 15px;
}
.nav-right button:hover { background: rgba(148,163,255,0.18); }

/* ---------- main columns ---------- */
main .inner { display: flex; gap: 28px; align-items: flex-start; }
#main { flex: 1; min-width: 0; }
#sidebar { width: 300px; flex-shrink: 0; }

.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
  margin: 30px 0 16px;
}
.section-title::before {
  content: "";
  width: 18px;
  height: 3px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}
.section-title .en { font-size: 12px; color: var(--muted); letter-spacing: 2px; font-weight: 400; }

/* ---------- post cards ---------- */
.post-grid { display: flex; flex-direction: column; gap: 18px; }

.card {
  display: flex;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.25s ease, border-color 0.25s ease;
}
.card:hover { transform: translateY(-3px); border-color: rgba(148,163,255,0.4); }

.card .cover {
  position: relative;
  width: 240px;
  flex-shrink: 0;
  overflow: hidden;
  min-height: 150px;
}
.card .cover a { display: block; width: 100%; height: 100%; position: absolute; inset: 0; }
.card .cover .pinned-tag {
  position: absolute;
  left: 10px;
  top: 10px;
  z-index: 2;
  background: rgba(10, 14, 30, 0.75);
  color: var(--gold);
  font-size: 12px;
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid rgba(246,201,107,0.4);
}

/* cover scenes */
.cover-scene { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.cv-1 { background: linear-gradient(135deg, #1b2a6b, #0c1440 55%, #2c1a5e); }
.cv-2 { background: linear-gradient(135deg, #14355e, #0a1d40 55%, #1a3b66); }
.cv-3 { background: linear-gradient(135deg, #4a1e5e, #1c1145 55%, #3d1a6e); }
.cv-4 { background: linear-gradient(135deg, #1a3f5e, #0c2038 55%, #16616e); }
.cv-5 { background: linear-gradient(135deg, #3e2b6e, #171048 55%, #6e3a6e); }
.cv-6 { background: linear-gradient(135deg, #6e4a1e, #301a10 55%, #5e2a1a); }
.cover-scene .planet {
  position: absolute;
  right: -24px;
  top: -24px;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  opacity: 0.55;
}
.cover-scene .ring {
  position: absolute;
  right: -30px;
  top: 6px;
  width: 130px;
  height: 40px;
  border: 3px solid rgba(255,255,255,0.35);
  border-radius: 50%;
  transform: rotate(-18deg);
}
.cover-scene .star-dot {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #fff;
  opacity: 0.8;
}

.card .info { padding: 16px 20px; flex: 1; min-width: 0; }
.card .meta { display: flex; flex-wrap: wrap; gap: 14px; color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.card .title { margin: 0 0 8px; font-size: 20px; font-weight: 700; }
.card .title a { color: var(--fg); }
.card .title a:hover { color: var(--accent); }
.card .excerpt { color: var(--muted); font-size: 14px; margin: 0 0 12px; }
.card .foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card .cat { font-size: 13px; color: var(--accent); }
.card .tags { display: flex; gap: 6px; flex-wrap: wrap; }
.card .tag { font-size: 12px; color: var(--muted); border: 1px solid var(--border); padding: 1px 8px; border-radius: 999px; }
.card .more { font-size: 13px; white-space: nowrap; }
.card .more::after { content: " →"; }

/* ---------- category cards ---------- */
.cat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.cat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.25s ease, border-color 0.25s ease;
}
.cat-card:hover { transform: translateY(-3px); border-color: rgba(148,163,255,0.4); }
.cat-card .cover { position: relative; height: 96px; overflow: hidden; }
.cat-card .cover h3 { position: relative; z-index: 2; margin: 0; padding: 14px 16px; font-size: 17px; color: #fff; text-shadow: 0 2px 8px rgba(0,0,0,0.5); }
.cat-card .body { padding: 12px 16px; }
.cat-card .body ul { list-style: none; margin: 0; padding: 0; }
.cat-card .body li { font-size: 13px; padding: 4px 0; border-bottom: 1px dashed rgba(148,163,255,0.12); }
.cat-card .body li:last-child { border-bottom: none; }
.cat-card .body li a { color: var(--fg); }
.cat-card .body li a:hover { color: var(--accent); }
.cat-card .count { font-size: 12px; color: var(--muted); margin-top: 8px; display: block; }

/* ---------- pagination ---------- */
.pagination { display: flex; gap: 8px; justify-content: center; margin: 30px 0 10px; }
.pagination .page {
  min-width: 34px;
  height: 34px;
  line-height: 32px;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--fg);
  font-size: 14px;
  padding: 0 8px;
}
.pagination .page.current { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; color: #fff; font-weight: 700; }

/* ---------- sidebar ---------- */
.side-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.side-card h4 { margin: 0 0 12px; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.side-card h4::before { content: ""; width: 14px; height: 3px; border-radius: 3px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }

.author-box { text-align: center; }
.author-box .avatar { width: 92px; height: 92px; margin: 0 auto 10px; display: block; border-radius: 50%; }
.author-box .name { font-size: 18px; font-weight: 700; margin: 0; }
.author-box .role { font-size: 13px; color: var(--muted); margin: 2px 0 10px; }
.author-box .desc { font-size: 13px; color: var(--muted); margin: 0; }

.stat-row { display: flex; border-top: 1px solid var(--border); margin-top: 14px; padding-top: 12px; }
.stat-row a { flex: 1; text-align: center; color: var(--fg); }
.stat-row .count { display: block; font-size: 20px; font-weight: 700; color: var(--accent); }
.stat-row .label { font-size: 12px; color: var(--muted); }

.social-row { display: flex; justify-content: center; gap: 10px; margin-top: 12px; }
.social-row a {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--fg);
  font-size: 13px;
  background: rgba(21,27,54,0.6);
}
.social-row a:hover { border-color: var(--accent); color: var(--accent); }

.side-menu { list-style: none; margin: 0; padding: 0; }
.side-menu .item a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--fg); font-size: 14px; }
.side-menu .item a:hover { background: rgba(148,163,255,0.12); }
.side-menu .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.side-menu .sub { padding-left: 22px; }
.side-menu .sub .item a { font-size: 13px; color: var(--muted); }

.side-links { list-style: none; margin: 0; padding: 0; }
.side-links li { font-size: 14px; padding: 6px 0; border-bottom: 1px dashed rgba(148,163,255,0.12); }
.side-links li:last-child { border-bottom: none; }

/* ---------- article ---------- */
.article-wrap { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px 34px; box-shadow: var(--shadow); }
.breadcrumb { font-size: 13px; color: var(--muted); margin-bottom: 18px; }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb .sep { margin: 0 6px; }

.article h1 { font-size: 30px; margin: 0 0 6px; line-height: 1.4; }
.article .post-meta { color: var(--muted); font-size: 13px; margin-bottom: 24px; display: flex; gap: 14px; flex-wrap: wrap; }
.article .post-meta a { color: var(--muted); }
.article .post-meta a:hover { color: var(--accent); }
.article h2 { font-size: 23px; margin: 32px 0 12px; padding-left: 12px; border-left: 4px solid var(--accent); }
.article h3 { font-size: 19px; margin: 24px 0 10px; }
.article h4 { font-size: 16px; margin: 20px 0 8px; }
.article p { margin: 12px 0; }
.article a { color: var(--accent); border-bottom: 1px dashed rgba(122,162,255,0.4); }
.article img { max-width: 100%; height: auto; border-radius: 10px; }
.article code {
  background: rgba(148,163,255,0.12);
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 0.9em;
  font-family: Consolas, "Courier New", monospace;
  color: #ffd7a8;
}
.article pre {
  background: #0b1026;
  border: 1px solid var(--border);
  color: #e2e8f0;
  padding: 16px;
  border-radius: 10px;
  overflow-x: auto;
  font-size: 14px;
  line-height: 1.6;
}
.article pre code { background: none; padding: 0; color: inherit; font-size: inherit; }
.article blockquote {
  margin: 16px 0;
  padding: 8px 16px;
  border-left: 3px solid var(--gold);
  background: rgba(246,201,107,0.08);
  border-radius: 0 8px 8px 0;
}
.article blockquote p { margin: 6px 0; }
.article ul, .article ol { padding-left: 24px; margin: 12px 0; }
.article li { margin: 4px 0; }
.article hr { border: none; border-top: 1px solid var(--border); margin: 28px 0; }

/* TOC */
.toc-list { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.toc-list li { padding: 4px 0; }
.toc-list li.lv-2 { padding-left: 6px; }
.toc-list li.lv-3 { padding-left: 18px; }
.toc-list a { color: var(--muted); }
.toc-list a:hover { color: var(--accent); }

/* ---------- about / list pages ---------- */
.page-hero { text-align: center; padding: 30px 0 10px; }
.page-hero .avatar { width: 130px; height: 130px; margin: 0 auto; display: block; }
.page-hero h1 { font-size: 30px; margin: 14px 0 4px; }
.page-hero .role { color: var(--muted); font-size: 15px; }

.about-mascot { text-align: center; padding: 10px 0 6px; }
.about-mascot .avatar { width: 180px; height: 180px; margin: 0 auto; display: block; }
.about-mascot .name { font-size: 24px; font-weight: 800; margin: 16px 0 2px; }
.about-mascot .role { color: var(--muted); margin-bottom: 12px; }
.about-mascot .intro { max-width: 560px; margin: 0 auto; color: var(--fg); }

.archives ul { list-style: none; margin: 0; padding: 0; }
.archives .year { font-size: 20px; font-weight: 700; margin: 22px 0 8px; color: var(--accent); }
.archives li { padding: 8px 0; border-bottom: 1px dashed rgba(148,163,255,0.12); display: flex; gap: 16px; align-items: baseline; }
.archives li .date { color: var(--muted); font-size: 13px; min-width: 90px; }

/* ---------- footer ---------- */
#footer { margin-top: 50px; border-top: 1px solid var(--border); background: rgba(9,12,28,0.6); }
#footer .widgets { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; padding: 26px 0; }
#footer h4 { margin: 0 0 12px; font-size: 15px; }
#footer .wlist { list-style: none; margin: 0; padding: 0; }
#footer .wlist li { font-size: 13px; padding: 4px 0; }
#footer .wlist a { color: var(--muted); }
#footer .wlist a:hover { color: var(--accent); }
#footer .status { display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; align-items: center; padding: 16px 0; border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; }

/* ---------- search overlay ---------- */
#search-overlay {
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: rgba(5, 8, 20, 0.9);
  backdrop-filter: blur(6px);
  display: none;
  padding: 12vh 20px 20px;
}
#search-overlay.open { display: block; }
#search-overlay .box { max-width: 620px; margin: 0 auto; background: var(--card-solid); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
#search-overlay input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(10,14,30,0.7);
  color: var(--fg);
  font-size: 16px;
  outline: none;
}
#search-overlay input:focus { border-color: var(--accent); }
#search-overlay .results { margin-top: 14px; max-height: 60vh; overflow-y: auto; }
#search-overlay .result { padding: 10px 12px; border-radius: 8px; cursor: pointer; }
#search-overlay .result:hover { background: rgba(148,163,255,0.12); }
#search-overlay .result .r-title { font-size: 15px; color: var(--fg); }
#search-overlay .result .r-cat { font-size: 12px; color: var(--muted); }
#search-overlay .close {
  position: absolute;
  top: 4vh;
  right: 5vw;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--fg);
  font-size: 18px;
  cursor: pointer;
}

/* ---------- misc ---------- */
.empty-tip { color: var(--muted); text-align: center; padding: 50px 0; }
.hidden { display: none !important; }
.to-top {
  position: fixed;
  right: 22px;
  bottom: 26px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(21,27,54,0.85);
  color: var(--fg);
  cursor: pointer;
  z-index: 900;
  display: none;
}
.to-top.show { display: block; }

/* ---------- click stars ---------- */
.click-star {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 6px 1px rgba(255, 255, 255, 0.9), 0 0 14px 4px rgba(246, 201, 107, 0.55);
  animation: clickStar 0.85s ease-out forwards;
}
@keyframes clickStar {
  0% { transform: translate(0, 0) scale(1); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(0.15); opacity: 0; }
}

/* ---------- avatar photo ---------- */
.author-box .avatar, .about-mascot .avatar {
  overflow: hidden;
  border: 2px solid rgba(148, 163, 255, 0.4);
}
.author-box .avatar img, .about-mascot .avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.about-mascot .avatar img { border-radius: 50%; }

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  main .inner { flex-direction: column; }
  #sidebar { width: 100%; }
  .cat-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  #brand .title { font-size: 30px; letter-spacing: 4px; }
  #header .inner { padding-top: 40px; padding-bottom: 44px; }
  .card { flex-direction: column; }
  .card .cover { width: 100%; min-height: 130px; }
  .cat-grid { grid-template-columns: 1fr; }
  #footer .widgets { grid-template-columns: 1fr; }
  .article-wrap { padding: 20px; }
  .nav-right { position: static; transform: none; margin-top: 14px; justify-content: center; }
}