* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, "Microsoft YaHei", sans-serif;
  background:
    linear-gradient(rgba(255, 240, 246, 0.58), rgba(255, 228, 236, 0.58)),
    url("/static/bg.png");
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  color: #4a2a35;
  line-height: 1.8;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font-family: inherit;
}

.shell,
.admin-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr);
  gap: 24px;
  padding: 0 32px;
  align-items: start;
}

.sidebar,
.admin-sidebar {
  height: 100vh;
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.32);
  border: 1px solid rgba(255, 255, 255, 0.36);
  border-top: none;
  border-bottom: none;
  box-shadow: 0 24px 70px rgba(236, 72, 153, 0.10);
  overflow: hidden;
}

.profile {
  position: relative;
  flex: 0 0 auto;
  min-height: 0;
  padding: 30px 24px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid rgba(244, 114, 182, 0.18);
  text-align: center;
}

.avatar {
  width: 92px;
  height: 92px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid rgba(255, 255, 255, 0.92);
  box-shadow: 0 10px 28px rgba(236, 72, 153, 0.18);
  background: rgba(255, 255, 255, 0.78);
}

.name {
  margin: 16px 0 4px;
  font-size: 22px;
  font-weight: 800;
  color: #db2777;
}

.desc,
.muted,
.hint {
  color: #7a3d57;
}

.desc {
  margin: 0;
  font-size: 13px;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
}

.tags span,
.eyebrow,
.article-meta {
  padding: 4px 10px;
  border-radius: 999px;
  color: #db2777;
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid rgba(244, 114, 182, 0.22);
}

.tags span {
  font-size: 12px;
}

.sidebar-awards {
  width: 100%;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid rgba(244, 114, 182, 0.18);
  text-align: left;
  max-height: 150px;
  overflow-y: auto;
  padding-right: 6px;
}

.sidebar-awards::-webkit-scrollbar {
  width: 5px;
}

.sidebar-awards::-webkit-scrollbar-thumb {
  background: rgba(236, 72, 153, 0.28);
  border-radius: 999px;
}

.sidebar-awards-title {
  margin-bottom: 10px;
  color: #db2777;
  font-size: 13px;
  font-weight: 800;
}

.sidebar-award {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 8px;
  padding: 7px 0;
  border-top: 1px solid rgba(244, 114, 182, 0.10);
}

.sidebar-award:first-of-type {
  border-top: none;
}

.sidebar-award time {
  color: #db2777;
  font-size: 11px;
  font-weight: 800;
}

.sidebar-award span {
  color: #6b4252;
  font-size: 12px;
  line-height: 1.55;
}

.catalog,
.admin-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 18px 14px 28px;
}

.catalog::-webkit-scrollbar,
.admin-scroll::-webkit-scrollbar,
textarea::-webkit-scrollbar,
.markdown-body pre::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.catalog::-webkit-scrollbar-thumb,
.admin-scroll::-webkit-scrollbar-thumb,
textarea::-webkit-scrollbar-thumb,
.markdown-body pre::-webkit-scrollbar-thumb {
  background: rgba(236, 72, 153, 0.28);
  border-radius: 999px;
}

.home-link,
.nav-title,
.admin-catalog h2 {
  display: block;
  margin: 0 8px 14px;
  color: #db2777;
  font-size: 15px;
  font-weight: 700;
}

.home-link {
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.46);
  border: 1px solid rgba(244, 114, 182, 0.12);
}

.home-link.active,
.home-link:hover {
  color: white;
  background: #ec4899;
  border-color: #ec4899;
}

details > summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
}

details > summary::-webkit-details-marker {
  display: none;
}

.category > summary,
.group > summary,
.admin-catalog summary {
  padding: 8px 10px;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 700;
  color: #db2777;
  background: rgba(255, 255, 255, 0.56);
  border-left: 3px solid #ec4899;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.group > summary,
.admin-catalog summary.sub {
  margin: 10px 8px 6px;
  border: 1px solid rgba(244, 114, 182, 0.14);
  border-left: 1px solid rgba(244, 114, 182, 0.14);
  background: rgba(255, 255, 255, 0.42);
}

.note-list,
.latest ul,
.admin-catalog ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.note-list a,
.admin-catalog a {
  display: block;
  margin-bottom: 6px;
  padding: 8px 10px;
  border-radius: 10px;
  color: #6b4252;
  font-size: 13px;
  line-height: 1.5;
  word-break: break-word;
  background: rgba(255, 255, 255, 0.46);
  border: 1px solid rgba(244, 114, 182, 0.12);
  transition: 0.18s ease;
}

.note-list a:hover,
.note-list a.active,
.admin-catalog a:hover,
.admin-catalog a.active {
  color: #db2777;
  background: rgba(255, 255, 255, 0.76);
  border-color: rgba(244, 114, 182, 0.25);
  transform: translateX(3px);
  box-shadow: 0 8px 18px rgba(236, 72, 153, 0.10);
}

.note-list a.active,
.admin-catalog a.active {
  color: white;
  background: #ec4899;
  border-color: #ec4899;
}

.main,
.admin-main {
  min-width: 0;
}

.home-main {
  min-height: 100vh;
  padding: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto auto;
}

.home-hero,
.reader,
.editor-panel,
.login-card,
.admin-box,
.category-cards a {
  background: rgba(255, 255, 255, 0.32);
  border: 1px solid rgba(255, 255, 255, 0.36);
  box-shadow: 0 24px 70px rgba(236, 72, 153, 0.10);
}

.home-hero {
  min-height: 0;
  padding: 56px 64px;
  display: flex;
  align-items: center;
  border-radius: 0 0 16px 16px;
  border-top: none;
  border-bottom: none;
}

.eyebrow {
  display: inline-flex;
  width: fit-content;
  margin: 0 0 12px;
  font-size: 12px;
  font-weight: 700;
}

.home-hero h1 {
  margin: 0;
  color: #db2777;
  font-size: 48px;
  line-height: 1.15;
}

.hero-subtitle {
  max-width: 920px;
  margin: 20px 0 0;
  color: #7a3d57;
  font-size: 17px;
  line-height: 1.95;
}

.category-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 14px 0 0;
}

.category-cards a {
  padding: 14px 16px;
  border-radius: 14px;
  transition: transform 0.18s ease, background 0.18s ease;
}

.category-cards a:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.48);
}

.category-cards strong {
  display: block;
  color: #db2777;
  font-size: 16px;
}

.category-cards span {
  color: #7a3d57;
}

.site-footer {
  margin: 14px 0 0;
  padding: 14px 22px;
  border-radius: 16px 16px 0 0;
  text-align: center;
  background: rgba(255, 255, 255, 0.30);
  border: 1px solid rgba(255, 255, 255, 0.36);
  box-shadow: 0 18px 42px rgba(236, 72, 153, 0.08);
}

.site-footer p {
  margin: 4px 0;
  color: #7a3d57;
  font-size: 13px;
  line-height: 1.7;
}

.site-footer a {
  color: #db2777;
  font-weight: 700;
}

.reader {
  min-height: 100vh;
  padding: 44px 46px;
  border-top: none;
  border-bottom: none;
}

.article-head {
  max-width: 1400px;
  margin-bottom: 30px;
  padding-bottom: 22px;
  border-bottom: 1px solid rgba(244, 114, 182, 0.18);
}

.article-meta {
  display: inline-flex;
  margin-bottom: 14px;
  font-size: 13px;
}

.article-head h1 {
  margin: 0 0 10px;
  font-size: 38px;
  line-height: 1.25;
  color: #db2777;
}

.article-head p {
  margin: 0;
  color: #7a3d57;
  font-size: 16px;
}

.markdown-body {
  max-width: 1400px;
  color: #5f4050;
  font-size: 16.5px;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
  color: #db2777;
  margin-top: 32px;
  margin-bottom: 14px;
  line-height: 1.35;
  scroll-margin-top: 24px;
}

.markdown-body h2 {
  padding-left: 12px;
  border-left: 4px solid #ec4899;
}

.markdown-body p {
  margin: 13px 0;
}

.markdown-body a {
  color: #db2777;
  border-bottom: 1px dashed rgba(236, 72, 153, 0.45);
}

.markdown-body ul,
.markdown-body ol {
  padding-left: 24px;
}

.markdown-body li {
  margin-bottom: 8px;
}

.markdown-body blockquote {
  margin: 18px 0;
  padding: 14px 18px;
  border-left: 4px solid #ec4899;
  background: rgba(255, 255, 255, 0.55);
  border-radius: 12px;
  color: #7a3d57;
}

.markdown-body code {
  background: rgba(255, 247, 251, 0.88);
  padding: 2px 6px;
  border-radius: 6px;
  font-family: Consolas, Monaco, monospace;
  font-size: 14px;
  color: #be185d;
  border: 1px solid rgba(244, 114, 182, 0.14);
}

.markdown-body pre,
.markdown-body .codehilite {
  max-width: 100%;
  margin: 18px 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.54), rgba(255, 247, 251, 0.88)),
    #fff7fb;
  border-radius: 14px;
  overflow-x: auto;
  border: 1px solid rgba(236, 72, 153, 0.24);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.72),
    0 10px 24px rgba(236, 72, 153, 0.08);
}

.markdown-body pre {
  padding: 18px;
}

.markdown-body .codehilite pre {
  margin: 0;
  border: none;
  border-radius: 0;
  background: transparent;
}

.markdown-body pre code {
  background: transparent;
  padding: 0;
  border: none;
  color: #4a2a35;
}

.markdown-body table {
  display: block;
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  overflow-x: auto;
}

.markdown-body th,
.markdown-body td {
  border: 1px solid rgba(244, 114, 182, 0.18);
  padding: 10px 12px;
  text-align: left;
}

.markdown-body th {
  background: rgba(236, 72, 153, 0.12);
  color: #db2777;
}

.codehilite .hll { background-color: rgba(236, 72, 153, 0.12) }
.codehilite .c,
.codehilite .ch,
.codehilite .cm,
.codehilite .cpf,
.codehilite .c1,
.codehilite .cs { color: #8b6f7d; font-style: italic }
.codehilite .err { color: #b91c1c; background-color: rgba(254, 226, 226, 0.80) }
.codehilite .k,
.codehilite .kc,
.codehilite .kd,
.codehilite .kn,
.codehilite .kp,
.codehilite .kr,
.codehilite .kt { color: #d81b60; font-weight: 800 }
.codehilite .o,
.codehilite .ow { color: #ad1457; font-weight: 700 }
.codehilite .p { color: #7a3d57 }
.codehilite .m,
.codehilite .mb,
.codehilite .mf,
.codehilite .mh,
.codehilite .mi,
.codehilite .mo,
.codehilite .il { color: #7b1fa2; font-weight: 700 }
.codehilite .s,
.codehilite .sa,
.codehilite .sb,
.codehilite .sc,
.codehilite .dl,
.codehilite .sd,
.codehilite .s2,
.codehilite .se,
.codehilite .sh,
.codehilite .si,
.codehilite .sx,
.codehilite .sr,
.codehilite .s1,
.codehilite .ss { color: #00897b }
.codehilite .se,
.codehilite .si { font-weight: 700 }
.codehilite .na,
.codehilite .nt { color: #c2185b; font-weight: 700 }
.codehilite .nb,
.codehilite .bp { color: #6a1b9a }
.codehilite .nc,
.codehilite .nn { color: #8e24aa; font-weight: 700 }
.codehilite .no,
.codehilite .nd,
.codehilite .ne,
.codehilite .ni,
.codehilite .nl { color: #be185d; font-weight: 700 }
.codehilite .nf,
.codehilite .fm { color: #ec407a; font-weight: 800 }
.codehilite .nv,
.codehilite .vc,
.codehilite .vg,
.codehilite .vi,
.codehilite .vm { color: #0f766e }
.codehilite .gd { color: #b91c1c }
.codehilite .gi { color: #15803d }
.codehilite .gh,
.codehilite .gu { color: #db2777; font-weight: 800 }
.codehilite .go { color: #7a3d57 }
.codehilite .gp { color: #6a1b9a; font-weight: 800 }

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px;
}

.login-card {
  width: 420px;
  max-width: 100%;
  padding: 34px 30px;
  border-radius: 22px;
}

.admin-sidebar header {
  padding: 24px 20px 18px;
  border-bottom: 1px solid rgba(244, 114, 182, 0.18);
}

.admin-sidebar h1,
.login-card h1 {
  margin: 0 0 8px;
  color: #db2777;
}

.admin-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.admin-main {
  min-height: 100vh;
}

.editor-panel {
  min-height: 100vh;
  padding: 30px;
  border-top: none;
  border-bottom: none;
}

.editor-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.editor-head h1 {
  margin: 0 0 6px;
  color: #db2777;
  font-size: 32px;
  line-height: 1.25;
}

.editor-head p {
  margin: 0;
  color: #7a3d57;
  font-size: 14px;
  word-break: break-all;
}

.admin-box {
  margin-bottom: 18px;
  padding: 14px;
  border-radius: 14px;
}

label {
  display: block;
  margin-bottom: 12px;
  color: #7a3d57;
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid rgba(244, 114, 182, 0.22);
  border-radius: 10px;
  padding: 9px 10px;
  background: rgba(255, 255, 255, 0.68);
  color: #4a2a35;
  outline: none;
  font-size: 14px;
  margin-top: 5px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #ec4899;
  box-shadow: 0 0 0 3px rgba(236, 72, 153, 0.12);
}

textarea {
  min-height: 180px;
  resize: vertical;
  line-height: 1.7;
  font-family: Consolas, Monaco, "Microsoft YaHei", monospace;
}

.main-editor {
  min-height: 520px;
}

.short-editor {
  min-height: 150px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 999px;
  padding: 9px 15px;
  cursor: pointer;
  font-size: 14px;
  transition: 0.18s ease;
}

.btn.primary {
  background: #ec4899;
  color: white;
  box-shadow: 0 8px 18px rgba(236, 72, 153, 0.16);
}

.btn.secondary,
.btn.ghost {
  background: rgba(255, 255, 255, 0.62);
  color: #db2777;
  border: 1px solid rgba(244, 114, 182, 0.20);
}

.btn.danger {
  background: #ef4444;
  color: white;
}

.btn.full {
  width: 100%;
}

.btn:hover {
  transform: translateY(-1px);
}

.flash-list {
  margin: 0 0 18px;
}

.flash {
  margin-bottom: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 14px;
  border: 1px solid rgba(244, 114, 182, 0.16);
  background: rgba(255, 255, 255, 0.62);
  color: #7a3d57;
}

.flash.success {
  color: #166534;
  background: rgba(220, 252, 231, 0.72);
}

.flash.error {
  color: #991b1b;
  background: rgba(254, 226, 226, 0.72);
}

.tool-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 18px;
}

@media (max-width: 900px) {
  body {
    background-attachment: scroll;
  }

  .shell,
  .admin-shell {
    grid-template-columns: 1fr;
    padding: 0 16px 16px;
    gap: 16px;
  }

  .sidebar,
  .admin-sidebar {
    position: static;
    height: auto;
    border-radius: 0 0 20px 20px;
  }

  .profile {
    min-height: auto;
    padding: 28px 20px;
  }

  .catalog,
  .admin-scroll {
    max-height: 360px;
  }

  .home-hero {
    grid-template-columns: 1fr;
    min-height: auto;
    padding: 30px 22px;
    border-radius: 0 0 20px 20px;
  }

  .home-hero h1 {
    font-size: 34px;
  }

  .category-cards,
  .tool-grid {
    grid-template-columns: 1fr;
  }

  .reader,
  .editor-panel {
    padding: 28px 20px;
    min-height: auto;
    border-radius: 0 0 20px 20px;
  }

  .article-head h1 {
    font-size: 30px;
  }

  .editor-head {
    flex-direction: column;
  }

}
