:root {
  --page-bg: #eef0f2;
  --card-bg: #fff;
  --nav-bg: rgba(47, 65, 84, .96);
  --text: #3c4858;
  --muted: #718096;
  --accent: #30a9de;
  --line: #e8ebef;
  --code-bg: #f5f7f9;
  --code-block-bg: #f6f8fa;
  --code-block-text: #273142;
  --code-border: #dfe4ea;
  --code-comment: #6e7781;
  --code-keyword: #cf222e;
  --code-string: #0a6b4f;
  --code-number: #0550ae;
  --code-title: #8250df;
  --code-built-in: #953800;
  --code-variable: #953800;
  --code-meta: #1f6feb;
  --code-deletion: #82071e;
  --shadow: 0 10px 24px rgba(31, 45, 61, .16), 0 20px 54px rgba(31, 45, 61, .13);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page-bg: #181d25;
  --card-bg: #252d38;
  --nav-bg: rgba(31, 49, 68, .97);
  --text: #d5d9de;
  --muted: #a7afb8;
  --line: #3c4858;
  --code-bg: #303946;
  --code-block-bg: #222a35;
  --code-block-text: #d8dee9;
  --code-border: #3d4857;
  --code-comment: #8b949e;
  --code-keyword: #ff7b72;
  --code-string: #a5d6ff;
  --code-number: #79c0ff;
  --code-title: #d2a8ff;
  --code-built-in: #ffa657;
  --code-variable: #ffa657;
  --code-meta: #79c0ff;
  --code-deletion: #ffa198;
  --shadow: 0 12px 35px rgba(0, 0, 0, .32);
}
:root[data-theme="light"] { color-scheme: light; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --page-bg: #181d25;
    --card-bg: #252d38;
    --nav-bg: rgba(31, 49, 68, .97);
    --text: #d5d9de;
    --muted: #a7afb8;
    --line: #3c4858;
    --code-bg: #303946;
    --code-block-bg: #222a35;
    --code-block-text: #d8dee9;
    --code-border: #3d4857;
    --code-comment: #8b949e;
    --code-keyword: #ff7b72;
    --code-string: #a5d6ff;
    --code-number: #79c0ff;
    --code-title: #d2a8ff;
    --code-built-in: #ffa657;
    --code-variable: #ffa657;
    --code-meta: #79c0ff;
    --code-deletion: #ffa198;
    --shadow: 0 12px 35px rgba(0, 0, 0, .32);
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--text);
  background: var(--page-bg);
  font: 16px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  transition: color .25s ease, background-color .25s ease;
}
a { color: inherit; text-decoration: none; transition: color .2s ease; }
a:hover { color: var(--accent); }
img { max-width: 100%; }
button, input { font: inherit; }
::selection { color: #fff; background: rgba(48, 169, 222, .82); }
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-thumb { background: #aab1b8; border-radius: 8px; }

.navbar {
  position: fixed;
  z-index: 1000;
  inset: 0 0 auto;
  padding: 13px 0;
  color: #fff;
  transition: padding .35s ease, background .35s ease, box-shadow .35s ease;
}
.navbar.scrolled, .navbar.navbar-solid {
  padding: 6px 0;
  background: var(--nav-bg);
  box-shadow: 0 2px 10px rgba(0, 0, 0, .2);
}
.navbar-inner {
  width: min(1080px, calc(100% - 40px));
  min-height: 36px;
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.navbar-brand { color: #fff; font-size: 1.08rem; font-weight: 700; letter-spacing: .02em; }
.navbar-brand:hover { color: #fff; }
.navbar-links { display: flex; align-items: center; gap: 4px; }
.navbar-links a {
  position: relative;
  padding: 6px 11px;
  color: rgba(255, 255, 255, .9);
  font-size: .88rem;
}
.navbar-links a::after {
  content: "";
  position: absolute;
  left: 11px;
  right: 11px;
  bottom: 2px;
  height: 1px;
  background: #fff;
  transform: scaleX(0);
  transition: transform .2s ease;
}
.navbar-links a:hover, .navbar-links a.active { color: #fff; }
.navbar-links a:hover::after, .navbar-links a.active::after { transform: scaleX(1); }
.theme-toggle {
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: rgba(255, 255, 255, .94);
  background: transparent;
  cursor: pointer;
  font-size: 1.05rem;
  line-height: 1;
  transition: color .2s ease, background .2s ease, transform .2s ease;
}
.theme-toggle:hover { color: #fff; background: rgba(255, 255, 255, .13); transform: rotate(12deg); }
.theme-toggle:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.navbar-toggle { display: none; padding: 5px; border: 0; background: transparent; }
.navbar-toggle span { display: block; width: 23px; height: 2px; margin: 5px; border-radius: 2px; background: #fff; }

.hero {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: #fff;
  background: var(--hero-image) center/cover no-repeat;
}
.hero-home {
  height: 100vh;
  height: 100svh;
  min-height: 520px;
}
.hero-compact { height: clamp(300px, 42vh, 440px); min-height: 300px; }
.hero-mask { position: absolute; inset: 0; background: rgba(13, 20, 27, .35); }
.hero-content { position: relative; z-index: 1; width: min(900px, 84%); text-align: center; text-shadow: 0 2px 16px rgba(0, 0, 0, .45); }
.hero-title { margin: 0; font-size: clamp(2rem, 4vw, 3.1rem); line-height: 1.28; letter-spacing: .04em; }
.hero-content p { margin: 12px 0 0; font-size: 1.08rem; opacity: .94; }
.typing-cursor { animation: blink .85s step-end infinite; }
@keyframes blink { 50% { opacity: 0; } }
.scroll-down {
  position: absolute;
  z-index: 2;
  bottom: 16px;
  color: #fff;
  font-size: 2.3rem;
  line-height: 1;
  animation: float 1.8s ease-in-out infinite;
}
@keyframes float { 50% { transform: translateY(7px); } }

.page-shell { width: min(960px, calc(100% - 40px)); margin: 0 auto; }
.home-shell { position: relative; z-index: 3; margin-top: 0; }
.home-content-raised .home-shell { margin-top: -48px; }
.board {
  padding: 38px 42px;
  border-radius: 7px;
  background: var(--card-bg);
  box-shadow: var(--shadow);
}
.post-board { min-height: 220px; scroll-margin-top: 52px; }
.post-list { display: flex; flex-direction: column; gap: 25px; }
.post-card { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 22px; align-items: center; min-height: 130px; }
.post-cover {
  position: relative;
  display: block;
  height: 130px;
  overflow: hidden;
  border-radius: 4px;
  background: linear-gradient(135deg, #d8e4e9, #8db8c7);
  box-shadow: 0 4px 10px rgba(0, 0, 0, .2);
}
.post-cover img { width: 100%; height: 100%; display: block; object-fit: cover; transition: transform .4s ease; }
.post-card:hover .post-cover img { transform: scale(1.035); }
.post-cover.image-failed img { display: none; }
.cover-placeholder::after, .post-cover.image-failed::after {
  content: "Haruko386";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, .88);
  font-weight: 700;
  letter-spacing: .08em;
}
.post-summary { min-width: 0; }
.post-summary h2 { margin: 0 0 7px; font-size: 1.24rem; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.post-summary p {
  margin: 0 0 9px;
  color: var(--muted);
  font-size: .88rem;
  line-height: 1.48;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.post-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 11px; color: var(--muted); font-size: .75rem; }
.meta-item::before { margin-right: 5px; opacity: .72; }
.meta-date::before { content: "▣"; }
.meta-category::before { content: "◇"; }
.meta-tag::before { content: "#"; }
.meta-tag { color: var(--muted); }
.pagination { display: flex; justify-content: center; gap: 4px; margin-top: 34px; }
.page-link { min-width: 34px; padding: 5px 9px; border-radius: 3px; text-align: center; font-size: .88rem; }
.page-link:hover, .page-link.active { color: var(--text); background: var(--page-bg); }
.loading-state, .empty-state, .error-state { padding: 70px 20px; color: var(--muted); text-align: center; }
.error-state { color: #c85a5a; }

.scroll-top {
  position: fixed;
  z-index: 90;
  right: 28px;
  bottom: -60px;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 4px;
  color: var(--muted);
  background: var(--card-bg);
  box-shadow: 0 2px 10px rgba(0, 0, 0, .18);
  cursor: pointer;
  font-size: 1.55rem;
  transition: bottom .28s ease, color .2s ease;
}
.scroll-top.visible { bottom: 25px; }
.scroll-top:hover { color: var(--accent); }
.site-footer { padding: 42px 20px 26px; color: var(--muted); text-align: center; font-size: .78rem; line-height: 1.9; }

.simple-shell { position: relative; z-index: 3; margin-top: -30px; }
.page-board { min-height: 300px; }
.page-title { margin: 0 0 30px; text-align: center; font-size: 1.8rem; }
.archive-group + .archive-group { margin-top: 30px; }
.archive-year { margin-bottom: 8px; color: var(--muted); font-size: 1.35rem; font-weight: 700; }
.archive-row { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 14px; padding: 9px 8px; border-bottom: 1px solid var(--line); }
.archive-row time { color: var(--muted); font-size: .82rem; }

.about-card { text-align: center; }
.about-avatar { width: 124px; height: 124px; margin: 4px auto 20px; overflow: hidden; border: 4px solid rgba(255,255,255,.75); border-radius: 50%; box-shadow: 0 5px 18px rgba(0,0,0,.2); }
.about-avatar img { width: 100%; height: 100%; object-fit: cover; }
.about-name { font-size: 1.6rem; font-weight: 700; }
.about-intro { max-width: 660px; margin: 12px auto 22px; color: var(--muted); }
.profile-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.profile-links a { padding: 6px 13px; border: 1px solid var(--line); border-radius: 20px; font-size: .85rem; }

.links-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.link-card { display: flex; align-items: center; gap: 14px; min-height: 92px; padding: 16px; border: 1px solid var(--line); border-radius: 6px; transition: transform .2s ease, box-shadow .2s ease; }
.link-card:hover { transform: translateY(-2px); box-shadow: 0 7px 18px rgba(0,0,0,.09); }
.link-avatar { width: 52px; height: 52px; flex: 0 0 auto; border-radius: 50%; object-fit: cover; background: var(--page-bg); }
.link-name { font-weight: 700; }
.link-desc { margin-top: 2px; color: var(--muted); font-size: .82rem; }

.post-hero-title { font-size: clamp(1.8rem, 3.7vw, 2.8rem); }
.post-hero-meta { display: flex; justify-content: center; flex-wrap: wrap; gap: 7px 15px; margin-top: 14px; font-size: .86rem; opacity: .92; }
.article-shell { position: relative; z-index: 3; width: min(1080px, calc(100% - 40px)); margin: -30px auto 0; }
.article-board { padding: 44px 48px 48px; }
.article-grid { display: grid; grid-template-columns: minmax(0, 1fr) 210px; gap: 42px; align-items: start; }
.markdown-body { min-width: 0; color: var(--text); overflow-wrap: anywhere; }
.markdown-body > :first-child { margin-top: 0; }
.markdown-body h1, .markdown-body h2, .markdown-body h3, .markdown-body h4 { margin: 1.55em 0 .72em; line-height: 1.35; }
.markdown-body h1, .markdown-body h2 { padding-bottom: .35em; border-bottom: 1px solid var(--line); }
.markdown-body h1 { font-size: 1.75rem; }
.markdown-body h2 { font-size: 1.45rem; }
.markdown-body h3 { font-size: 1.2rem; }
.markdown-body p, .markdown-body ul, .markdown-body ol, .markdown-body blockquote { margin: 0 0 1em; }
.markdown-body a { color: #278fbd; }
.markdown-body img { display: block; height: auto; margin: 22px auto; border-radius: 4px; box-shadow: 0 4px 15px rgba(0,0,0,.13); }
.markdown-body blockquote { padding: 11px 17px; border-left: 4px solid var(--accent); color: var(--muted); background: var(--code-bg); }
.markdown-body blockquote > :last-child { margin-bottom: 0; }
.markdown-body code { padding: .15em .38em; border-radius: 3px; background: var(--code-bg); font: .9em/1.5 "SFMono-Regular", Consolas, "Liberation Mono", Monaco, monospace; }
.markdown-body pre {
  overflow: auto;
  margin: 1.2em 0;
  padding: 18px 20px;
  border: 1px solid var(--code-border);
  border-radius: 6px;
  color: var(--code-block-text);
  background: var(--code-block-bg);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04);
  scrollbar-color: var(--muted) transparent;
  transition: color .25s ease, background-color .25s ease, border-color .25s ease;
}
.markdown-body pre code {
  display: block;
  min-width: max-content;
  padding: 0;
  color: var(--code-block-text);
  background: transparent;
  font-size: .9rem;
  line-height: 1.68;
  tab-size: 4;
}
.hljs-comment, .hljs-quote { color: var(--code-comment); font-style: italic; }
.hljs-keyword, .hljs-selector-tag, .hljs-literal, .hljs-type { color: var(--code-keyword); }
.hljs-string, .hljs-regexp, .hljs-addition, .hljs-attribute { color: var(--code-string); }
.hljs-number, .hljs-symbol, .hljs-bullet { color: var(--code-number); }
.hljs-title, .hljs-section, .hljs-title.function_, .hljs-function .hljs-title { color: var(--code-title); }
.hljs-built_in, .hljs-builtin-name { color: var(--code-built-in); }
.hljs-variable, .hljs-template-variable, .hljs-params { color: var(--code-variable); }
.hljs-meta, .hljs-template-tag, .hljs-doctag { color: var(--code-meta); }
.hljs-deletion { color: var(--code-deletion); }
.hljs-emphasis { font-style: italic; }
.hljs-strong { font-weight: 700; }
.markdown-body table { display: block; width: max-content; max-width: 100%; overflow: auto; border-collapse: collapse; }
.markdown-body th, .markdown-body td { padding: 7px 11px; border: 1px solid var(--line); }
.markdown-body hr { height: 1px; margin: 28px 0; border: 0; background: var(--line); }
.article-tags { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 34px; }
.article-tag { padding: 3px 9px; border-radius: 3px; color: var(--muted); background: var(--code-bg); font-size: .78rem; }
.article-note { margin-top: 35px; padding: 16px 18px; border-left: 4px solid var(--accent); color: var(--muted); background: var(--code-bg); font-size: .85rem; }
.toc { position: sticky; top: 78px; max-height: calc(100vh - 100px); overflow: auto; padding-left: 18px; border-left: 1px solid var(--line); }
.toc-title { margin-bottom: 10px; font-weight: 700; }
.toc a { display: block; padding: 4px 0; color: var(--muted); font-size: .78rem; line-height: 1.4; }
.toc a.level-3 { padding-left: 12px; }
.toc a.active, .toc a:hover { color: var(--accent); }
.article-loading { padding: 60px 0; color: var(--muted); text-align: center; }

@media (max-width: 760px) {
  .navbar { padding: 7px 0; }
  .navbar-inner { width: calc(100% - 28px); }
  .navbar-toggle { display: block; cursor: pointer; }
  .navbar-links {
    position: absolute;
    top: 50px;
    left: 0;
    right: 0;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0;
    padding: 8px 14px 12px;
    background: var(--nav-bg);
    box-shadow: 0 7px 12px rgba(0,0,0,.16);
    transform: translateY(-12px);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease, transform .2s ease;
  }
  .navbar-links.open { transform: translateY(0); opacity: 1; pointer-events: auto; }
  .navbar-links a { text-align: center; }
  .theme-toggle { justify-self: center; }
  .hero-home { height: 100vh; height: 100svh; min-height: 520px; }
  .hero-compact { height: 330px; }
  .page-shell, .article-shell { width: calc(100% - 24px); }
  .home-shell { margin-top: 0; }
  .home-content-raised .home-shell { margin-top: -30px; }
  .simple-shell, .article-shell { margin-top: -22px; }
  .board { padding: 24px 18px; border-radius: 6px; }
  .post-list { gap: 30px; }
  .post-card { display: block; }
  .post-cover { height: clamp(160px, 52vw, 260px); margin-bottom: 15px; }
  .post-summary h2 { font-size: 1.15rem; white-space: normal; }
  .post-summary p { -webkit-line-clamp: 2; }
  .links-grid { grid-template-columns: 1fr; }
  .article-board { padding: 28px 20px 35px; }
  .article-grid { display: block; }
  .toc { display: none; }
  .archive-row { grid-template-columns: 78px minmax(0, 1fr); gap: 9px; padding-inline: 0; }
  .scroll-top { right: 15px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
