:root {
  --bg: #f6f4ef;
  --bg-elev: #fffcf7;
  --bg-card: #ffffff;
  --border: #e6e0d4;
  --text: #1c1917;
  --text-muted: #6b6560;
  --accent: #c45c26;
  --accent-soft: rgba(196, 92, 38, 0.08);
  --warn-bg: rgba(196, 92, 38, 0.08);
  --warn-border: #d4a574;
  --link: #b45309;
  --code-bg: #f0ebe3;
  --shadow: 0 1px 2px rgba(28, 25, 23, 0.04), 0 4px 16px rgba(28, 25, 23, 0.05);
  --radius: 12px;
  --max: 700px;
  --font: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Noto Sans SC", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", "Sarasa Mono SC", Consolas,
    monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121110;
    --bg-elev: #1a1816;
    --bg-card: #1e1c1a;
    --border: #2e2a26;
    --text: #f5f0e8;
    --text-muted: #a89f94;
    --accent: #e8956a;
    --accent-soft: rgba(232, 149, 106, 0.12);
    --warn-bg: rgba(232, 149, 106, 0.1);
    --warn-border: #8a5a3a;
    --link: #f0a878;
    --code-bg: #0e0d0c;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.25), 0 8px 24px rgba(0, 0, 0, 0.2);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.75;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--link);
  text-decoration: none;
  text-underline-offset: 0.15em;
}
a:hover {
  text-decoration: underline;
}

.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 1.35rem;
}

.site-header {
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-elev) 88%, transparent);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(12px) saturate(1.2);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
}

.site-header .inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0.9rem 1.35rem;
}

.brand {
  font-weight: 700;
  font-size: 1.08rem;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.01em;
}
.brand:hover {
  text-decoration: none;
  color: var(--accent);
}
.brand span {
  color: var(--text-muted);
  font-weight: 400;
  font-size: 0.82rem;
  margin-left: 0.45rem;
}

.nav {
  display: flex;
  gap: 1.15rem;
  font-size: 0.92rem;
}
.nav a {
  color: var(--text-muted);
  padding: 0.2rem 0;
  border-bottom: 2px solid transparent;
}
.nav a:hover,
.nav a.active {
  color: var(--accent);
  text-decoration: none;
  border-bottom-color: var(--accent);
}

.hero {
  padding: 3rem 0 1.75rem;
}
.hero h1 {
  margin: 0 0 0.55rem;
  font-size: 2rem;
  letter-spacing: -0.03em;
  font-weight: 750;
  line-height: 1.25;
}
.hero .tagline {
  margin: 0;
  color: var(--text-muted);
  font-size: 1.05rem;
  line-height: 1.6;
}

.section-title {
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin: 1.75rem 0 0.9rem;
  font-weight: 600;
}

.post-list {
  list-style: none;
  padding: 0;
  margin: 0 0 3.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.post-list li {
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}
.post-list li:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(28, 25, 23, 0.08), 0 8px 24px rgba(28, 25, 23, 0.06);
}
.post-list a {
  display: block;
  padding: 1.15rem 1.25rem;
  color: var(--text);
  text-decoration: none;
}
.post-list a:hover {
  text-decoration: none;
}
.post-list .title {
  font-weight: 650;
  font-size: 1.08rem;
  margin-bottom: 0.35rem;
  letter-spacing: -0.01em;
  line-height: 1.4;
}
.post-list .meta {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.55;
}

.article {
  padding: 1.85rem 0 3.5rem;
}
.article-header {
  margin-bottom: 1.85rem;
  padding-bottom: 1.35rem;
  border-bottom: 1px solid var(--border);
}
.article-header h1 {
  margin: 0 0 0.65rem;
  font-size: 1.75rem;
  line-height: 1.3;
  letter-spacing: -0.025em;
  font-weight: 750;
}
.article-header .meta {
  color: var(--text-muted);
  font-size: 0.92rem;
}
.back {
  display: inline-block;
  margin-bottom: 1.1rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}
.back:hover {
  color: var(--accent);
}

.disclaimer {
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  border-radius: var(--radius);
  padding: 0.85rem 1.1rem;
  margin: 0 0 1.6rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.content h1,
.content h2,
.content h3,
.content h4 {
  line-height: 1.35;
  margin: 2rem 0 0.8rem;
  scroll-margin-top: 4.5rem;
  letter-spacing: -0.015em;
  font-weight: 700;
}
.content h1 {
  font-size: 1.5rem;
}
.content h2 {
  font-size: 1.3rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.4rem;
}
.content h3 {
  font-size: 1.12rem;
  font-weight: 650;
}
.content h4 {
  font-size: 1.02rem;
  color: var(--text-muted);
}
.content p {
  margin: 0.9rem 0;
}
.content ul,
.content ol {
  padding-left: 1.45rem;
  margin: 0.85rem 0;
}
.content li {
  margin: 0.4rem 0;
}
.content li > ul,
.content li > ol {
  margin: 0.25rem 0;
}
.content blockquote {
  margin: 1.15rem 0;
  padding: 0.75rem 1.15rem;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  color: var(--text-muted);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.content blockquote p {
  margin: 0.4rem 0;
}
.content code {
  font-family: var(--mono);
  font-size: 0.86em;
  background: var(--code-bg);
  padding: 0.15em 0.4em;
  border-radius: 5px;
  border: 1px solid var(--border);
  word-break: break-word;
}
.content pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.05rem 1.15rem;
  overflow-x: auto;
  margin: 1.15rem 0;
  line-height: 1.55;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.content pre code {
  border: none;
  padding: 0;
  background: none;
  font-size: 0.84rem;
  word-break: normal;
}
.content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.15rem 0;
  font-size: 0.92rem;
  display: block;
  overflow-x: auto;
  border-radius: var(--radius);
}
.content th,
.content td {
  border: 1px solid var(--border);
  padding: 0.55rem 0.75rem;
  text-align: left;
  vertical-align: top;
}
.content th {
  background: var(--bg-elev);
  font-weight: 650;
}
.content tr:nth-child(even) td {
  background: color-mix(in srgb, var(--bg) 55%, var(--bg-card));
}
.content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin: 0.85rem 0;
  box-shadow: var(--shadow);
}
.content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.25rem 0;
}
.content a {
  word-break: break-word;
}
.content strong {
  font-weight: 650;
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.75rem 0 2.25rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  text-align: center;
}

.about-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem 1.5rem;
  margin: 1.75rem 0 3.5rem;
  box-shadow: var(--shadow);
}
.about-card h1 {
  margin-top: 0;
  font-size: 1.55rem;
  letter-spacing: -0.02em;
}
.about-card p {
  color: var(--text-muted);
  line-height: 1.7;
}

@media (max-width: 560px) {
  body {
    font-size: 16px;
  }
  .hero {
    padding: 2.25rem 0 1.25rem;
  }
  .hero h1 {
    font-size: 1.6rem;
  }
  .article-header h1 {
    font-size: 1.4rem;
  }
  .site-header .inner {
    flex-wrap: wrap;
  }
  .post-list a {
    padding: 1rem 1.05rem;
  }
  .wrap,
  .site-header .inner {
    padding-left: 1.1rem;
    padding-right: 1.1rem;
  }
}

/* —— Guestbook & Stats —— */
.page-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem 1.5rem;
  margin: 1.75rem 0 2rem;
  box-shadow: var(--shadow);
}
.page-card h1 {
  margin-top: 0;
  font-size: 1.55rem;
  letter-spacing: -0.02em;
}
.page-card .lede {
  color: var(--text-muted);
  margin: 0 0 1.25rem;
  line-height: 1.7;
}

.gb-form label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  margin: 0.85rem 0 0.35rem;
}
.gb-form input[type="text"],
.gb-form textarea {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.65rem 0.8rem;
}
.gb-form textarea {
  min-height: 7rem;
  resize: vertical;
}
.gb-form .hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}
.gb-form button[type="submit"] {
  margin-top: 1rem;
  font: inherit;
  font-weight: 650;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: 8px;
  padding: 0.6rem 1.25rem;
  cursor: pointer;
}
.gb-form button[type="submit"]:hover {
  filter: brightness(1.05);
}
.gb-form button[type="submit"]:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.form-status {
  margin-top: 0.85rem;
  font-size: 0.92rem;
  min-height: 1.4em;
}
.form-status.ok {
  color: var(--accent);
}
.form-status.err {
  color: #b91c1c;
}
@media (prefers-color-scheme: dark) {
  .form-status.err {
    color: #fca5a5;
  }
}

.gb-list {
  margin: 0 0 3rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.gb-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  box-shadow: var(--shadow);
}
.gb-item header {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.45rem;
  font-size: 0.92rem;
}
.gb-item time {
  color: var(--text-muted);
  font-size: 0.85rem;
}
.gb-item p {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.muted {
  color: var(--text-muted);
}
.tiny {
  font-size: 0.82rem;
}

.stats-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
  margin: 0 0 1.5rem;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.15rem 1.2rem;
  box-shadow: var(--shadow);
  text-align: center;
}
.stat-num {
  font-size: 1.85rem;
  font-weight: 750;
  letter-spacing: -0.03em;
  color: var(--accent);
}
.stat-label {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-top: 0.25rem;
}
.stats-table-wrap {
  overflow-x: auto;
  margin-bottom: 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  box-shadow: var(--shadow);
}
.stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
.stats-table th,
.stats-table td {
  padding: 0.55rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.stats-table th {
  background: var(--bg-elev);
  font-weight: 650;
}
.stats-table tr:last-child td {
  border-bottom: none;
}
.stats-table code {
  font-family: var(--mono);
  font-size: 0.86em;
}
@media (max-width: 560px) {
  .stats-cards {
    grid-template-columns: 1fr;
  }
}

/* —— Likes —— */
.like-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 2rem 0 0.5rem;
  padding: 1rem 1.15rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.like-btn {
  font: inherit;
  font-weight: 650;
  font-size: 0.95rem;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
  border-radius: 999px;
  padding: 0.4rem 1.1rem;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}
.like-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.03);
}
.like-btn.liked,
.like-btn:disabled.liked {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.like-count {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  font-size: 0.95rem;
}
.like-count::before {
  content: "♥ ";
  color: var(--accent);
}
.article .like-bar {
  margin-top: 2.5rem;
}
.engage-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
}
.view-stat {
  font-size: 0.95rem;
  color: var(--text-muted);
  font-weight: 550;
}
.view-stat .view-count {
  color: var(--text);
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  margin-left: 0.2rem;
}
.engage-sep {
  width: 1px;
  height: 1.25rem;
  background: var(--border);
}
