/* ============================================================
   童心日记 Kid Life Diary — 儿童生活记录主题
   完整独立主题，覆盖全部前台页面与组件
   ============================================================ */

:root {
  --color-bg: #fff8f0;
  --color-bg-alt: #fff0f5;
  --color-surface: #ffffff;
  --color-text: #3d3a4a;
  --color-muted: #7a7589;
  --color-primary: #ff6b9d;
  --color-accent: #5ec8ff;
  --color-highlight: #ffd166;
  --color-mint: #7ee8b7;
  --color-border: #ffe0ec;
  --color-border-strong: #ffc9dc;
  --font-display: "ZCOOL KuaiLe", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-sans: "Nunito", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --page-max-width: 1180px;
  --page-max-width-xl: 1320px;
  --sidebar-width: 18rem;
  --layout-gap: 1.5rem;
  --article-readable-width: 46rem;
  --content-width: var(--article-readable-width);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 24px;
  --shadow-soft: 0 8px 32px rgba(255, 107, 157, 0.12);
  --shadow-card: 0 4px 20px rgba(61, 58, 74, 0.08);
  --pattern-dot: radial-gradient(circle, color-mix(in srgb, var(--color-primary) 18%, transparent) 1.5px, transparent 1.5px);
}

[data-theme="dark"] {
  --color-bg: #1a1520;
  --color-bg-alt: #221c2a;
  --color-surface: #2a2436;
  --color-text: #f5eef8;
  --color-muted: #b5a8c4;
  --color-border: #3d3550;
  --color-border-strong: #4a4060;
  --shadow-soft: 0 8px 32px rgba(0, 0, 0, 0.35);
  --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.25);
  --pattern-dot: radial-gradient(circle, rgba(255, 107, 157, 0.15) 1.5px, transparent 1.5px);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --color-bg: #1a1520;
    --color-bg-alt: #221c2a;
    --color-surface: #2a2436;
    --color-text: #f5eef8;
    --color-muted: #b5a8c4;
    --color-border: #3d3550;
    --color-border-strong: #4a4060;
    --shadow-soft: 0 8px 32px rgba(0, 0, 0, 0.35);
    --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.25);
  }
}

[data-theme="light"] {
  --color-bg: #fff8f0;
  --color-bg-alt: #fff0f5;
  --color-surface: #ffffff;
  --color-text: #3d3a4a;
  --color-muted: #7a7589;
  --color-border: #ffe0ec;
  --color-border-strong: #ffc9dc;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font-sans);
  background: var(--color-bg);
  background-image: var(--pattern-dot);
  background-size: 24px 24px;
  color: var(--color-text);
  line-height: 1.75;
  font-size: clamp(1rem, 2.5vw, 1.0625rem);
  min-height: 100vh;
}

a { color: var(--color-primary); text-decoration: none; transition: color 0.15s; }
a:hover { color: color-mix(in srgb, var(--color-primary) 80%, var(--color-accent)); text-decoration: none; }

.container { max-width: var(--page-max-width); margin: 0 auto; padding: 0 1.25rem; }
@media (min-width: 1400px) { .container { max-width: var(--page-max-width-xl); } }

/* —— 漂浮装饰 —— */
.kid-deco-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.deco-star, .deco-bubble, .deco-cloud {
  position: absolute;
  opacity: 0.45;
}
.deco-star {
  width: 20px; height: 20px;
  background: var(--color-highlight);
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
  animation: float-y 6s ease-in-out infinite;
}
.deco-star.s1 { top: 12%; left: 8%; animation-delay: 0s; }
.deco-star.s2 { top: 28%; right: 10%; width: 14px; height: 14px; background: var(--color-accent); animation-delay: 1.2s; }
.deco-star.s3 { bottom: 35%; left: 5%; width: 12px; height: 12px; background: var(--color-primary); animation-delay: 2.4s; }
.deco-bubble {
  border-radius: 50%;
  background: color-mix(in srgb, var(--color-accent) 35%, transparent);
  border: 2px solid color-mix(in srgb, var(--color-accent) 50%, transparent);
  animation: float-y 8s ease-in-out infinite;
}
.deco-bubble.b1 { width: 48px; height: 48px; top: 18%; right: 18%; }
.deco-bubble.b2 { width: 28px; height: 28px; bottom: 22%; right: 8%; animation-delay: 1.5s; }
.deco-bubble.b3 { width: 36px; height: 36px; top: 55%; left: 12%; animation-delay: 3s; }
.deco-cloud {
  width: 80px; height: 32px;
  background: color-mix(in srgb, #fff 70%, var(--color-accent));
  border-radius: 50px;
  opacity: 0.35;
  animation: drift 20s linear infinite;
}
.deco-cloud::before, .deco-cloud::after {
  content: "";
  position: absolute;
  background: inherit;
  border-radius: 50%;
}
.deco-cloud::before { width: 36px; height: 36px; top: -18px; left: 12px; }
.deco-cloud::after { width: 28px; height: 28px; top: -12px; right: 14px; }
.deco-cloud.c1 { top: 8%; right: 25%; }
.deco-cloud.c2 { bottom: 12%; left: 20%; animation-delay: -8s; }
@keyframes float-y {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}
@keyframes drift {
  0% { transform: translateX(0); }
  100% { transform: translateX(30px); }
}
.deco-on .site-header,
.deco-on main,
.deco-on .site-footer { position: relative; z-index: 1; }

/* —— 顶栏 —— */
.site-header {
  background: color-mix(in srgb, var(--color-surface) 92%, transparent);
  border-bottom: 3px solid var(--color-border-strong);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
}
.kid-header .header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 4rem;
}
.kid-logo {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.35rem;
  color: var(--color-text);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.kid-logo .site-logo {
  width: 2.5rem;
  height: 2.5rem;
  object-fit: cover;
  border-radius: 50%;
  border: 3px solid var(--color-highlight);
  box-shadow: var(--shadow-card);
}
.logo-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  color: #fff;
  font-size: 1.35rem;
}
.header-wave {
  height: 6px;
  background: linear-gradient(90deg, var(--color-primary), var(--color-accent), var(--color-highlight), var(--color-mint), var(--color-primary));
  background-size: 200% 100%;
  animation: rainbow-bar 8s linear infinite;
}
@keyframes rainbow-bar {
  0% { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

.nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
}
.nav a, .nav button {
  color: var(--color-muted);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  font-size: 0.95rem;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.nav a.nav-sub { font-size: 0.88em; opacity: 0.9; }
.nav a:hover {
  color: var(--color-primary);
  background: color-mix(in srgb, var(--color-primary) 12%, transparent);
  text-decoration: none;
}
.nav-toggle, .theme-toggle {
  background: var(--color-surface);
  border: 2px solid var(--color-border-strong);
  border-radius: 999px;
  padding: 0.4rem 0.65rem;
  cursor: pointer;
  color: var(--color-text);
  font-size: 1rem;
}
.theme-toggle { background: color-mix(in srgb, var(--color-highlight) 40%, var(--color-surface)); }
.theme-icon-light { display: none; }
[data-theme="dark"] .theme-icon-dark { display: none; }
[data-theme="dark"] .theme-icon-light { display: inline; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-icon-dark { display: none; }
  :root:not([data-theme="light"]) .theme-icon-light { display: inline; }
}
[data-theme="light"] .theme-icon-dark { display: inline; }
[data-theme="light"] .theme-icon-light { display: none; }
.nav-toggle { display: none; }
@media (max-width: 768px) {
  .nav-toggle { display: block; }
  .nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--color-surface);
    border-bottom: 3px solid var(--color-border-strong);
    flex-direction: column;
    align-items: stretch;
    gap: 0.25rem;
    padding: 1rem;
    box-shadow: var(--shadow-soft);
  }
  .nav.open { display: flex; }
  .header-inner { position: relative; flex-wrap: wrap; }
}

/* —— 布局 —— */
.layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--layout-gap);
  padding: 2rem 0 3.5rem;
  align-items: start;
}
@media (min-width: 992px) {
  .layout { grid-template-columns: minmax(0, 1fr) var(--sidebar-width); }
}
.content { min-width: 0; width: 100%; max-width: var(--content-width); }
@media (min-width: 992px) {
  .layout:has(.sidebar) .content { max-width: none; }
}
.layout:not(:has(.sidebar)) .content {
  max-width: min(var(--article-readable-width), 100%);
}
.sidebar { min-width: 0; width: 100%; }

.page-title {
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 400;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--color-text);
}
.page-title i { color: var(--color-primary); }

/* —— Hero —— */
.kid-hero {
  position: relative;
  background: linear-gradient(145deg, var(--color-surface) 0%, color-mix(in srgb, var(--color-primary) 8%, var(--color-surface)) 50%, color-mix(in srgb, var(--color-accent) 10%, var(--color-surface)) 100%);
  border: 3px dashed var(--color-border-strong);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem 2rem;
  margin-bottom: 2.5rem;
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}
.kid-hero::before {
  content: "";
  position: absolute;
  top: -30px;
  right: -30px;
  width: 120px;
  height: 120px;
  background: color-mix(in srgb, var(--color-highlight) 35%, transparent);
  border-radius: 50%;
}
.hero-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  background: var(--color-highlight);
  color: var(--color-text);
  border-radius: 50% 50% 50% 8px;
  font-size: 1.5rem;
  margin-bottom: 0.75rem;
  transform: rotate(-8deg);
  box-shadow: var(--shadow-card);
}
.hero-title {
  font-family: var(--font-display);
  font-size: clamp(1.85rem, 5vw, 2.5rem);
  font-weight: 400;
  line-height: 1.3;
  margin-bottom: 0.5rem;
}
.hero-child {
  color: var(--color-primary);
  display: inline-block;
  position: relative;
}
.hero-child::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 2px;
  height: 8px;
  background: color-mix(in srgb, var(--color-highlight) 60%, transparent);
  border-radius: 4px;
  z-index: -1;
}
.hero-subtitle { font-size: 1.1rem; color: var(--color-muted); margin-bottom: 0.35rem; }
.hero-motto {
  font-size: 1rem;
  color: var(--color-primary);
  margin-bottom: 0.5rem;
  font-weight: 600;
}
.hero-desc { color: var(--color-muted); font-size: 0.95rem; max-width: 36rem; margin-bottom: 1rem; }
.hero-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  border: 2px solid transparent;
}
.chip-pink { background: color-mix(in srgb, var(--color-primary) 18%, var(--color-surface)); color: var(--color-primary); border-color: color-mix(in srgb, var(--color-primary) 30%, transparent); }
.chip-blue { background: color-mix(in srgb, var(--color-accent) 18%, var(--color-surface)); color: color-mix(in srgb, var(--color-accent) 90%, #333); border-color: color-mix(in srgb, var(--color-accent) 35%, transparent); }
.chip-mint { background: color-mix(in srgb, var(--color-mint) 25%, var(--color-surface)); color: #2d8a62; border-color: color-mix(in srgb, var(--color-mint) 50%, transparent); }
.chip-yellow { background: color-mix(in srgb, var(--color-highlight) 35%, var(--color-surface)); color: #9a7b1a; border-color: color-mix(in srgb, var(--color-highlight) 55%, transparent); }

.diary-section { margin-bottom: 2rem; }
.section-title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 400;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}
.section-title i { color: var(--color-accent); }
.section-desc { color: var(--color-muted); font-size: 0.95rem; margin-bottom: 1.5rem; }

/* —— 日记卡片 —— */
.diary-timeline { display: flex; flex-direction: column; gap: 0.25rem; }

.post-card, .diary-card {
  position: relative;
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: transform 0.2s, box-shadow 0.2s;
}
.post-card:hover, .diary-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-soft);
  border-color: var(--color-border-strong);
}

/* 手账贴纸风 */
.card-style-scrapbook .diary-card {
  border-radius: 4px 18px 8px 22px;
  border-style: dashed;
}
.card-style-scrapbook .diary-card::after {
  content: "";
  position: absolute;
  top: 12px;
  right: 16px;
  width: 40px;
  height: 16px;
  background: color-mix(in srgb, var(--color-highlight) 70%, #fff);
  opacity: 0.85;
  transform: rotate(6deg);
  border-radius: 2px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  pointer-events: none;
}

/* 拍立得风 */
.card-style-polaroid .diary-card {
  padding-bottom: 0.5rem;
  border: none;
  box-shadow: 0 6px 24px rgba(0,0,0,0.1), 0 0 0 8px var(--color-surface), 0 0 0 10px var(--color-border-strong);
}
.card-style-polaroid .post-card-cover img,
.card-style-polaroid .diary-cover img {
  border: 8px solid var(--color-surface);
  margin: 8px 8px 0;
  width: calc(100% - 16px);
  border-radius: 2px;
}

/* 简约圆角 */
.card-style-simple .diary-card {
  border-radius: var(--radius-sm);
  border-style: solid;
}

.diary-date-badge {
  position: absolute;
  top: 1rem;
  left: 1rem;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 3.25rem;
  height: 3.25rem;
  background: var(--color-primary);
  color: #fff;
  border-radius: 50% 50% 50% 6px;
  font-weight: 700;
  line-height: 1.1;
  box-shadow: var(--shadow-card);
}
.diary-date-badge .dd { font-size: 1.15rem; }
.diary-date-badge .mm { font-size: 0.65rem; opacity: 0.95; }

.pin-badge {
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  z-index: 3;
  background: var(--color-highlight);
  color: var(--color-text);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  box-shadow: var(--shadow-card);
}
.pin-badge.inline { position: static; margin-bottom: 0.75rem; }

.post-card.is-pinned, .diary-card.is-pinned {
  border-color: color-mix(in srgb, var(--color-highlight) 60%, var(--color-border-strong));
}

.post-card-cover, .diary-cover { display: block; position: relative; }
.post-card-cover img, .diary-cover img {
  width: 100%;
  height: 13rem;
  object-fit: cover;
  display: block;
}
.cover-tape {
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%) rotate(-2deg);
  width: 72px;
  height: 22px;
  background: color-mix(in srgb, var(--color-highlight) 75%, #fffce8);
  opacity: 0.9;
  border-radius: 2px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.post-card-body { padding: 1.35rem 1.35rem 1.25rem; }
.post-card h2 { font-family: var(--font-display); font-size: 1.3rem; font-weight: 400; margin-bottom: 0.5rem; line-height: 1.35; }
.post-card h2 a { color: var(--color-text); text-decoration: none; }
.post-card h2 a:hover { color: var(--color-primary); }
.post-card .excerpt { color: var(--color-muted); margin-bottom: 0.75rem; font-size: 0.95rem; }
.post-card .meta {
  font-size: 0.875rem;
  color: var(--color-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  margin-bottom: 0.5rem;
}
.post-card .meta a, .post-card .meta time, .post-card .meta span {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}
.read-diary-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.75rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-accent);
}
.read-diary-link:hover { color: var(--color-primary); }

.card-tags { margin-top: 0.5rem; display: flex; flex-wrap: wrap; gap: 0.35rem; }

.tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: color-mix(in srgb, var(--color-accent) 12%, var(--color-surface));
  border: 2px solid color-mix(in srgb, var(--color-accent) 25%, transparent);
  color: var(--color-muted);
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  font-size: 0.8rem;
  text-decoration: none;
}
.tag-pill:hover {
  color: var(--color-primary);
  border-color: var(--color-primary);
  background: color-mix(in srgb, var(--color-primary) 10%, var(--color-surface));
}
.tag-pill.sm { font-size: 0.75rem; padding: 0.1rem 0.5rem; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 0.4rem; }

/* —— 文章详情 —— */
.diary-entry { position: relative; }
.diary-entry-header {
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.75rem 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-card);
}
.post-single h1, .diary-entry h1 {
  font-family: var(--font-display);
  font-size: clamp(1.65rem, 4.5vw, 2.15rem);
  font-weight: 400;
  line-height: 1.35;
  margin-bottom: 0.75rem;
}
.post-single .meta, .diary-entry .meta {
  color: var(--color-muted);
  font-size: 0.9rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
}
.post-single .meta a, .post-single .meta time, .post-single .meta span {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}
.post-single .post-tags, .post-single .tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.85rem;
}

.diary-cover-figure { margin-bottom: 1.5rem; }
.diary-cover-figure .cover {
  width: 100%;
  border-radius: var(--radius);
  border: 4px solid var(--color-surface);
  box-shadow: var(--shadow-soft);
}
.cover-caption {
  text-align: center;
  font-size: 0.875rem;
  color: var(--color-muted);
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}

.post-layout, .post-layout > * { min-width: 0; }
.post-content, .diary-content {
  font-size: 1.0625rem;
  max-width: 75ch;
  min-width: 0;
  overflow-wrap: break-word;
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.75rem 1.5rem;
  box-shadow: var(--shadow-card);
}
.post-content img, .post-content video, .post-content iframe,
.post-content embed, .post-content object, .post-content svg {
  max-width: 100%;
  height: auto;
}
.post-content img {
  border-radius: var(--radius-sm);
  border: 3px solid var(--color-border);
}
.post-content pre {
  background: #2d2640;
  color: #f0e8f8;
  padding: 1rem;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  max-width: 100%;
  margin: 1rem 0;
}
.post-content code { font-family: ui-monospace, monospace; font-size: 0.9em; }
.post-content blockquote {
  border-left: 4px solid var(--color-primary);
  margin: 1.25rem 0;
  padding: 0.75rem 0 0.75rem 1.25rem;
  color: var(--color-muted);
  background: color-mix(in srgb, var(--color-primary) 6%, transparent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-style: italic;
}
.post-content h2, .post-content h3, .post-content h4 {
  font-family: var(--font-display);
  font-weight: 400;
  margin: 1.75rem 0 0.75rem;
  line-height: 1.35;
  color: var(--color-text);
}
.post-content ul, .post-content ol { padding-left: 1.5rem; margin: 0.75rem 0; }
.post-content p { margin: 0.75rem 0; }
.post-content table {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.95rem;
  display: block;
  overflow-x: auto;
}
.post-content th, .post-content td {
  border: 2px solid var(--color-border);
  padding: 0.5rem 0.75rem;
  word-break: break-word;
}
.post-content th { background: color-mix(in srgb, var(--color-accent) 10%, var(--color-surface)); }
.post-content pre { position: relative; }
.post-content pre code { background: transparent; color: inherit; }

.post-layout { display: grid; gap: var(--layout-gap); }
@media (min-width: 992px) {
  .post-layout { grid-template-columns: minmax(0, 1fr) 14rem; }
  .post-layout .post-content { max-width: none; }
}
.kid-toc, .toc {
  display: none;
  position: sticky;
  top: 5rem;
  align-self: start;
  font-size: 0.85rem;
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow-card);
}
.kid-toc > strong, .toc > strong {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 400;
  display: block;
  margin-bottom: 0.75rem;
  color: var(--color-primary);
}
.toc ul { list-style: none; padding: 0; margin: 0; }
.toc li { margin-bottom: 0.45rem; line-height: 1.55; }
.toc li.h3 { padding-left: 0.75rem; }
.toc a { color: var(--color-muted); text-decoration: none; }
.toc a:hover { color: var(--color-primary); }

/* —— 侧栏 —— */
.sidebar .widget {
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.15rem;
  margin-bottom: 1.15rem;
  min-width: 0;
  box-shadow: var(--shadow-card);
}
.sidebar .widget h3 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 400;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
  color: var(--color-primary);
}
.sidebar .search-form {
  display: flex;
  gap: 0.5rem;
  width: 100%;
  min-width: 0;
}
.sidebar .search-form input[type="search"] {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0.55rem 0.75rem;
  border: 2px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-bg);
  color: var(--color-text);
}
.sidebar .search-form button {
  flex: 0 0 auto;
  border: none;
  background: var(--color-primary);
  color: #fff;
  border-radius: 999px;
  padding: 0 0.85rem;
  cursor: pointer;
  min-width: 2.5rem;
}

.sidebar-posts, .sidebar-categories { list-style: none; }
.sidebar-posts li, .sidebar-categories li { margin-bottom: 0.45rem; font-size: 0.9rem; }
.sidebar-posts a { color: var(--color-text); text-decoration: none; }
.sidebar-posts a:hover { color: var(--color-primary); }
.sidebar-post-link {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  color: var(--color-text);
  text-decoration: none;
}
.sidebar-post-link:hover { color: var(--color-primary); }
.sidebar-post-idx { flex: 0 0 auto; font-size: 0.72rem; color: var(--color-muted); }
.sidebar-post-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.12rem; }
.sidebar-post-title {
  line-height: 1.4;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.sidebar-post-date { font-size: 0.75rem; color: var(--color-muted); }
.sidebar-categories li { display: flex; justify-content: space-between; gap: 0.5rem; }
.sidebar-categories .count { color: var(--color-muted); font-size: 0.8rem; }
.about-text { color: var(--color-muted); font-size: 0.9rem; line-height: 1.65; }

/* —— 评论 —— */
.kid-comments {
  margin-top: 2.5rem;
  padding: 1.75rem;
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}
.comments h2, .kid-comments h2 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 400;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 1.25rem;
  color: var(--color-primary);
}
.comment-form { display: flex; flex-direction: column; gap: 0.75rem; margin-bottom: 1.5rem; }
.comment-form input, .comment-form textarea {
  padding: 0.65rem 0.85rem;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  color: var(--color-text);
  font-family: inherit;
}
.comment-form input:focus, .comment-form textarea:focus {
  outline: none;
  border-color: var(--color-primary);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
@media (max-width: 480px) { .form-row { grid-template-columns: 1fr; } }
.comment-list { list-style: none; }
.comment-item { padding: 1rem 0; border-bottom: 2px dashed var(--color-border); }
.comment-row { display: flex; gap: 0.85rem; align-items: flex-start; }
.comment-avatar {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--color-highlight);
  box-shadow: var(--shadow-card);
}
.comment-item.reply .comment-avatar { width: 36px; height: 36px; border-color: var(--color-accent); }
.comment-main { flex: 1; min-width: 0; }
.comment-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.65rem;
  margin-bottom: 0.35rem;
}
.comment-author { font-size: 0.95rem; color: var(--color-primary); }
.comment-site { font-size: 0.8rem; color: var(--color-muted); }
.comment-text { margin: 0 0 0.5rem; line-height: 1.65; }
.comment-replies {
  list-style: none;
  margin: 0.75rem 0 0 3.25rem;
  padding-left: 0.85rem;
  border-left: 3px solid var(--color-accent);
}
.comment-item.reply { padding: 0.75rem 0; border-bottom: none; }
.reply-btn {
  background: none;
  border: none;
  color: var(--color-accent);
  cursor: pointer;
  font-size: 0.875rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}
.comment-form button {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.6rem 1.25rem;
  background: linear-gradient(135deg, var(--color-primary), color-mix(in srgb, var(--color-primary) 80%, var(--color-accent)));
  color: #fff;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
  font-family: inherit;
  box-shadow: var(--shadow-card);
}
.comment-form button:hover { opacity: 0.92; transform: translateY(-1px); }
.comment-hint, .comment-closed, .comment-empty { color: var(--color-muted); font-size: 0.875rem; }

/* —— 搜索 / 分页 / 面包屑 —— */
.search-form { display: flex; gap: 0.5rem; }
.search-form input {
  flex: 1;
  padding: 0.65rem 1rem;
  border: 2px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-surface);
  color: var(--color-text);
  font-family: inherit;
}
.search-form button, .btn, .kid-btn {
  padding: 0.6rem 1.25rem;
  background: linear-gradient(135deg, var(--color-primary), color-mix(in srgb, var(--color-primary) 75%, var(--color-accent)));
  color: #fff;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  text-decoration: none;
  box-shadow: var(--shadow-card);
}
.search-form button:hover, .btn:hover, .kid-btn:hover {
  opacity: 0.95;
  text-decoration: none;
  color: #fff;
}
.search-page-form { margin-bottom: 1.5rem; }
.search-result-count { color: var(--color-muted); margin-bottom: 1rem; }
.kid-empty-inline { color: var(--color-muted); padding: 1.5rem 0; }

.breadcrumb {
  font-size: 0.875rem;
  color: var(--color-muted);
  margin-bottom: 1rem;
  padding: 0.5rem 0.85rem;
  background: color-mix(in srgb, var(--color-surface) 80%, transparent);
  border-radius: 999px;
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.15rem;
}
.breadcrumb a { color: var(--color-muted); }
.breadcrumb a:hover { color: var(--color-primary); }
.breadcrumb .sep { margin: 0 0.25rem; opacity: 0.6; }

.kid-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  margin-top: 2rem;
  padding: 1rem;
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  border-radius: var(--radius);
}
.kid-pagination .page-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.45rem 1rem;
  background: color-mix(in srgb, var(--color-accent) 15%, var(--color-surface));
  border: 2px solid color-mix(in srgb, var(--color-accent) 30%, transparent);
  border-radius: 999px;
  color: var(--color-text);
  font-weight: 600;
  text-decoration: none;
}
.kid-pagination .page-btn:hover {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}
.page-info { color: var(--color-muted); font-size: 0.9rem; }

/* —— 作者 / 分类 / 空状态 —— */
.card-panel {
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-card);
}
.kid-author-card { display: flex; gap: 1.25rem; align-items: flex-start; }
.author-avatar {
  width: 4.5rem;
  height: 4.5rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: #fff;
  flex-shrink: 0;
  box-shadow: var(--shadow-card);
}
.author-avatar.sm { width: 3.25rem; height: 3.25rem; font-size: 1.5rem; }
.author-role { font-size: 0.85rem; color: var(--color-accent); font-weight: 600; margin-bottom: 0.25rem; }
.author-bio { color: var(--color-muted); margin-top: 0.35rem; }
.author-grid { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.author-card h2 { font-family: var(--font-display); font-size: 1.15rem; font-weight: 400; margin: 0.5rem 0; }
.author-card p { color: var(--color-muted); font-size: 0.9rem; margin-bottom: 0.75rem; }
.read-more {
  font-size: 0.875rem;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-weight: 600;
  color: var(--color-accent);
}

.taxonomy-desc { color: var(--color-muted); margin: -0.25rem 0 1.5rem; line-height: 1.65; }
.category-children {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 1.5rem;
  padding: 1rem;
  background: var(--color-surface);
  border: 2px dashed var(--color-border-strong);
  border-radius: var(--radius);
}
.category-child-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.9rem;
  font-size: 0.875rem;
  color: var(--color-text);
  text-decoration: none;
  border-radius: 999px;
  background: color-mix(in srgb, var(--color-accent) 12%, var(--color-surface));
  border: 2px solid transparent;
}
.category-child-link:hover {
  color: var(--color-primary);
  border-color: var(--color-primary);
  text-decoration: none;
}
.category-child-link .count { color: var(--color-muted); font-size: 0.8em; }
.category-path-group { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 0.15rem; }
.category-path-group .sep { color: var(--color-muted); margin: 0 0.1rem; }

.empty-state, .kid-empty {
  text-align: center;
  padding: 3.5rem 1.5rem;
  color: var(--color-muted);
  background: var(--color-surface);
  border: 3px dashed var(--color-border-strong);
  border-radius: var(--radius-lg);
}
.empty-illust { font-size: 3rem; display: block; margin-bottom: 0.75rem; }
.empty { color: var(--color-muted); padding: 2rem 0; }

/* —— 404 —— */
.kid-error {
  text-align: center;
  padding: 4rem 1rem;
  background: var(--color-surface);
  border: 3px dashed var(--color-border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
}
.error-illust { margin-bottom: 1rem; position: relative; display: inline-block; }
.err-face { font-size: 3.5rem; display: block; }
.err-star {
  position: absolute;
  top: -8px;
  right: -20px;
  font-size: 1.5rem;
  color: var(--color-highlight);
  animation: float-y 2s ease-in-out infinite;
}
.kid-error h1 {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 400;
  margin-bottom: 0.75rem;
  color: var(--color-primary);
}
.kid-error p { color: var(--color-muted); margin-bottom: 1.5rem; max-width: 24rem; margin-left: auto; margin-right: auto; }

/* —— 页脚 —— */
.kid-footer {
  border-top: 3px solid var(--color-border-strong);
  padding: 2.5rem 0;
  background: color-mix(in srgb, var(--color-bg-alt) 60%, var(--color-surface));
  margin-top: 1rem;
}
.footer-inner { display: grid; gap: 1.25rem; }
.footer-brand { display: flex; flex-direction: column; gap: 0.35rem; }
.footer-star {
  color: var(--color-primary);
  font-size: 1.25rem;
  margin-bottom: 0.25rem;
}
.footer-brand strong { font-family: var(--font-display); font-size: 1.15rem; font-weight: 400; }
.footer-brand p { color: var(--color-muted); font-size: 0.875rem; }
.footer-links { display: flex; flex-wrap: wrap; gap: 0.75rem 1.25rem; }
.footer-links a {
  color: var(--color-muted);
  font-size: 0.875rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}
.footer-links a:hover { color: var(--color-primary); }
.footer-bottom { margin-top: 0.5rem; display: flex; flex-direction: column; gap: 0.35rem; }
.footer-copy { color: var(--color-muted); font-size: 0.8rem; margin: 0; }
.footer-beian { margin: 0; font-size: 0.75rem; color: var(--color-muted); display: flex; flex-wrap: wrap; gap: 0.35rem; }
.footer-beian a { color: var(--color-muted); }
.footer-beian a:hover { color: var(--color-primary); }
.footer-widgets {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}
.footer-widgets .widget { background: transparent; border: 0; padding: 0; margin: 0; }
.footer-widgets .widget h3 {
  font-family: var(--font-display);
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
  color: var(--color-text);
}

/* —— 回到顶部 —— */
.kid-back-top, .back-to-top {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  color: #fff;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s, transform 0.2s;
  z-index: 50;
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.back-to-top.visible { opacity: 1; visibility: visible; }
.back-to-top:hover { transform: scale(1.08); }

/* —— Toast —— */
.toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  transform: translateX(-50%) translateY(20px);
  background: var(--color-text);
  color: var(--color-surface);
  padding: 0.75rem 1.25rem;
  border-radius: 999px;
  font-size: 0.875rem;
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 60;
  pointer-events: none;
  box-shadow: var(--shadow-soft);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* —— 相关文章 / 插件兼容 —— */
.related-posts { margin-top: 2rem; padding-top: 1.5rem; border-top: 2px dashed var(--color-border); }
.related-posts h2, .related-posts h3 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 400;
  margin-bottom: 0.75rem;
  color: var(--color-primary);
}
.related-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.related-card { margin: 0; }
.copy-code-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  cursor: pointer;
}

/* —— 小工具扩展 —— */
.widget-text { font-size: 0.9rem; line-height: 1.7; color: var(--color-muted); }
.widget-text p { margin: 0 0 0.75rem; }
.widget-text-plain {
  white-space: pre-wrap;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--color-muted);
  background: transparent;
  border: 0;
  padding: 0;
  margin: 0;
}
.widget-cta-wrap { margin-top: 0.75rem; }
.widget-cta-btn {
  display: inline-block;
  padding: 0.5rem 1rem;
  background: var(--color-primary);
  color: #fff !important;
  border-radius: 999px;
  font-size: 0.875rem;
  text-decoration: none !important;
  font-weight: 600;
}
.widget-ad .widget-ad-body { line-height: 0; }
.widget-ad-link { display: block; text-decoration: none; }
.widget-ad-media {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius-sm);
}
.widget-ad-caption { margin: 0.5rem 0 0; font-size: 0.8rem; color: var(--color-muted); }
ul.sidebar-categories.tree li { list-style: none; }

/* —— 无障碍：减少动画 —— */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .deco-on .kid-deco-layer { display: none; }
}

/* —— 打印 —— */
@media print {
  .site-header, .sidebar, .comments, .nav-toggle, .theme-toggle,
  .kid-deco-layer, .back-to-top, .header-wave { display: none !important; }
  .layout { display: block; padding: 0; }
  body { background: #fff; }
  a { color: inherit; text-decoration: underline; }
}
