/* Y++ 社区子站（独立样式，视觉对齐官网色板，不依赖官网 css 文件） */
:root {
  --bg: #0e1014;
  --bg-elev: #16181d;
  --bg-soft: #1c1f27;
  --line: rgba(255, 255, 255, 0.06);
  --text: #e8eaef;
  --muted: #9aa3b2;
  --faint: #6b7382;
  --accent: #3b9eff;
  --ok: #3ecf8e;
  --danger: #e85d5d;
  --radius: 14px;
  --font-display: "Outfit", "Noto Sans SC", sans-serif;
  --font-body: "Noto Sans SC", "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", Consolas, monospace;
  --max: 1080px;
  --nav-h: 64px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  line-height: 1.65;
  font-size: 16px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
code, pre { font-family: var(--font-mono); font-size: 0.9em; }
pre {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1rem 1.1rem;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.5;
  tab-size: 4;
}
code {
  background: rgba(255,255,255,0.06);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}
pre code {
  background: none;
  padding: 0;
  white-space: inherit;
  font-size: inherit;
  color: inherit;
}
.cm-prose pre {
  margin: 1rem 0;
  max-height: min(70vh, 560px);
  overflow: auto;
}

.cm-nav {
  position: sticky; top: 0; z-index: 40;
  height: var(--nav-h);
  backdrop-filter: blur(14px);
  background: rgba(14, 16, 20, 0.88);
  border-bottom: 1px solid var(--line);
}
.cm-nav-inner {
  width: min(100% - 32px, var(--max));
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.cm-brand {
  display: flex; align-items: baseline; gap: 0.45rem;
  color: var(--text); text-decoration: none; font-weight: 700;
}
.cm-brand:hover { text-decoration: none; }
.cm-brand-mark { font-family: var(--font-display); letter-spacing: 0.02em; }
.cm-brand-text { color: var(--muted); font-weight: 500; font-size: 0.95rem; }
.cm-links {
  display: flex; align-items: center; gap: 0.15rem 1.1rem; list-style: none; margin: 0; padding: 0;
}
.cm-links a {
  color: var(--muted); font-size: 0.95rem; text-decoration: none;
  padding: 0.25rem 0;
}
.cm-links a:hover, .cm-links a.is-active { color: var(--text); }
.cm-back-official {
  margin-left: 0.4rem;
  padding: 0.35rem 0.75rem !important;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text) !important;
}
.cm-nav-toggle {
  display: none; background: none; border: 0; color: var(--text);
  font-size: 1.35rem; cursor: pointer;
}

.cm-main {
  flex: 1;
  width: min(100% - 32px, var(--max));
  margin: 1.75rem auto 3rem;
}
.cm-footer {
  border-top: 1px solid var(--line);
  padding: 1.5rem 0 2rem;
  color: var(--faint);
  font-size: 0.9rem;
}
.cm-footer-inner { width: min(100% - 32px, var(--max)); margin: 0 auto; }
.cm-footer a { color: var(--muted); }
.cm-footer-meta { margin-top: 0.35rem; }

.cm-hero { margin-bottom: 2.25rem; }
.cm-eyebrow {
  font-family: var(--font-display);
  color: var(--accent);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.8rem;
  margin: 0 0 0.5rem;
}
.cm-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  margin: 0 0 0.75rem;
  letter-spacing: -0.02em;
}
.cm-lead { color: var(--muted); max-width: 40rem; margin: 0 0 1.25rem; }
.cm-hero-actions { display: flex; flex-wrap: wrap; gap: 0.65rem; }

.cm-btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0.55rem 1.05rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  text-decoration: none;
}
.cm-btn:hover { text-decoration: none; border-color: rgba(59,158,255,0.45); }
.cm-btn.primary { background: var(--accent); border-color: transparent; color: #061018; font-weight: 600; }
.cm-btn.ghost { background: transparent; }
.cm-btn.danger { background: transparent; border-color: rgba(232,93,93,0.5); color: var(--danger); }

.cm-section-title { font-size: 1.15rem; margin: 0 0 1rem; color: var(--muted); font-weight: 600; }
.cm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}
.cm-card-link { color: inherit; text-decoration: none; display: block; }
.cm-card-link:hover { text-decoration: none; }
.cm-card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem;
}
.cm-card-post {
  position: relative; height: 100%; transition: border-color 0.2s;
  padding: 0; overflow: hidden; display: flex; flex-direction: column;
}
.cm-card-post:not(.has-cover) { padding: 1.15rem 1.25rem; }
.cm-card-link:hover .cm-card-post { border-color: rgba(59,158,255,0.35); }
.cm-card-cover {
  height: 140px;
  background: var(--bg-soft) center/cover no-repeat;
  border-bottom: 1px solid var(--line);
}
.cm-card-body { padding: 1rem 1.15rem 1.15rem; flex: 1; display: flex; flex-direction: column; }
.cm-card-post:not(.has-cover) .cm-card-body { padding: 0; }
.cm-card-post h2 { font-size: 1.1rem; margin: 0.35rem 0 0.5rem; font-family: var(--font-display); }
.cm-card-post p { color: var(--muted); font-size: 0.92rem; margin: 0 0 0.75rem; flex: 1; }
.cm-card-tags { display: flex; flex-wrap: wrap; gap: 0.3rem; margin: 0 0 0.65rem; }
.cm-card-tags span {
  font-size: 0.72rem; color: var(--faint);
  border: 1px solid var(--line); border-radius: 999px; padding: 0.1rem 0.45rem;
}
.cm-tag-cloud {
  display: flex; flex-wrap: wrap; gap: 0.4rem;
  margin: 0 0 1.25rem;
}
.cm-tag-chip {
  font-size: 0.82rem; color: var(--muted);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 0.25rem 0.65rem; text-decoration: none;
  background: var(--bg-elev);
}
.cm-tag-chip:hover, .cm-tag-chip.is-active {
  color: var(--text); border-color: var(--accent); text-decoration: none;
}
.cm-tag-chip small { color: var(--faint); margin-left: 0.15rem; }
.cm-tag-clear { border-style: dashed; }
.cm-preview-page .cm-flash { margin-bottom: 1rem; }
.cm-type {
  display: inline-block;
  font-size: 0.75rem;
  color: var(--accent);
  letter-spacing: 0.04em;
}
.cm-badge {
  position: absolute; top: 0.85rem; right: 0.85rem;
  font-size: 0.7rem; color: #061018; background: var(--ok);
  padding: 0.15rem 0.45rem; border-radius: 6px; font-weight: 600;
}
.cm-meta {
  display: flex; flex-wrap: wrap; gap: 0.75rem;
  color: var(--faint); font-size: 0.85rem;
}
.cm-meta-rich {
  gap: 0.35rem 0.85rem;
  margin-top: auto;
  padding-top: 0.35rem;
}
.cm-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}
.cm-type-pill {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--accent);
  background: rgba(59,158,255,0.1);
  border: 1px solid rgba(59,158,255,0.22);
  border-radius: 999px;
  padding: 0.12rem 0.55rem;
}
.cm-card-top { margin-bottom: 0.15rem; }
.cm-list-meta {
  display: flex; flex-wrap: wrap; gap: 0.75rem;
  align-items: baseline; margin: 0 0 0.85rem;
  font-size: 0.9rem; color: var(--muted);
}
.cm-home-filters {
  margin: 0 0 1.5rem;
  color-scheme: dark;
}
.cm-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0.65rem;
  padding: 0.65rem;
  background: linear-gradient(180deg, rgba(28,31,39,0.95), rgba(22,24,29,0.9));
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.25);
}
.cm-filter-select,
.cm-filter-search {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin: 0;
  min-width: 0;
}
.cm-filter-select { flex: 0 0 auto; width: 140px; }
.cm-filter-search { flex: 1 1 200px; }
.cm-filter-label {
  font-size: 0.72rem;
  color: var(--faint);
  letter-spacing: 0.04em;
  padding-left: 0.15rem;
}
.cm-home-filters select,
.cm-home-filters input[type="search"] {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  background: var(--bg);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  color: var(--text);
  padding: 0.6rem 0.85rem;
  font: inherit;
  font-size: 0.95rem;
  line-height: 1.3;
  color-scheme: dark;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.cm-home-filters select {
  padding-right: 2rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%239aa3b2' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  cursor: pointer;
}
.cm-home-filters select option {
  background: #16181d;
  color: #e8eaef;
}
.cm-home-filters select:focus,
.cm-home-filters input[type="search"]:focus {
  outline: none;
  border-color: rgba(59,158,255,0.55);
  box-shadow: 0 0 0 3px rgba(59,158,255,0.15);
}
.cm-home-filters input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
}
.cm-filter-go {
  align-self: flex-end;
  padding: 0.6rem 1.15rem !important;
  white-space: nowrap;
}
@media (max-width: 560px) {
  .cm-filter-select { width: 100%; flex: 1 1 100%; }
  .cm-filter-go { width: 100%; justify-content: center; }
}
[data-cm-list].is-loading #cmAjaxCards {
  opacity: 0.45;
  pointer-events: none;
  transition: opacity 0.2s;
}
[data-cm-list] #cmAjaxCards { transition: opacity 0.2s; }
.cm-faint { color: var(--faint); }
.cm-list-head {
  display: flex; flex-wrap: wrap; align-items: flex-end;
  justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem;
}
.cm-list-head h1 { margin: 0; font-family: var(--font-display); }
.cm-search {
  display: flex; gap: 0.5rem; align-items: stretch;
  color-scheme: dark;
}
.cm-search input, .cm-form input, .cm-form select, .cm-form textarea {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  padding: 0.55rem 0.75rem;
  font: inherit;
  color-scheme: dark;
}
.cm-search input:focus {
  outline: none;
  border-color: rgba(59,158,255,0.55);
  box-shadow: 0 0 0 3px rgba(59,158,255,0.12);
}
.cm-form label { display: block; margin-bottom: 0.9rem; color: var(--muted); font-size: 0.92rem; }
.cm-form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0.75rem; align-items: end; }
.cm-check { display: flex !important; align-items: center; gap: 0.4rem; margin-bottom: 0.9rem; }
.cm-check input { width: auto; }
.cm-form-wide textarea { min-height: 280px; line-height: 1.5; }
.cm-login-card { max-width: 420px; margin: 2rem auto; }
.cm-flash {
  padding: 0.75rem 1rem; border-radius: 10px; margin-bottom: 1rem;
  border: 1px solid var(--line);
}
.cm-flash.ok { border-color: rgba(62,207,142,0.35); color: var(--ok); }
.cm-flash.err { border-color: rgba(232,93,93,0.35); color: var(--danger); }

.cm-article-head { margin-bottom: 1.25rem; }
.cm-article-head h1 {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3.5vw, 2.1rem);
  margin: 0.25rem 0 0.75rem;
}
.cm-summary {
  color: var(--muted);
  font-size: 1.05rem;
  border-left: 3px solid var(--accent);
  padding-left: 0.9rem;
  margin: 0 0 1.5rem;
}
.cm-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.75rem; }
.cm-tags span {
  font-size: 0.8rem; color: var(--muted);
  border: 1px solid var(--line); border-radius: 999px; padding: 0.15rem 0.55rem;
}
.cm-prose { font-size: 1.02rem; }
.cm-prose h2, .cm-prose h3 { margin-top: 1.6rem; font-family: var(--font-display); }
.cm-prose p { margin: 0.85rem 0; }
.cm-prose ul, .cm-prose ol { padding-left: 1.35rem; }
.cm-prose blockquote {
  margin: 1rem 0; padding: 0.5rem 1rem;
  border-left: 3px solid var(--line); color: var(--muted);
}
.cm-attachments { margin-top: 2rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }
.cm-attachments ul { padding-left: 1.2rem; }
.cm-pager {
  display: flex; flex-wrap: wrap; gap: 0.4rem;
  margin-top: 1.75rem; justify-content: center; align-items: center;
}
.cm-pager a, .cm-pager .cm-page-btn {
  min-width: 2.35rem; text-align: center; padding: 0.45rem 0.7rem;
  border: 1px solid var(--line); border-radius: 10px; color: var(--muted);
  background: var(--bg-elev); font: inherit; cursor: pointer;
  text-decoration: none; transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.cm-pager a:hover, .cm-pager .cm-page-btn:hover:not(.is-disabled):not(.is-active) {
  color: var(--text); border-color: rgba(59,158,255,0.4); text-decoration: none;
}
.cm-pager a.is-active, .cm-pager .cm-page-btn.is-active {
  color: #061018; border-color: transparent;
  background: linear-gradient(135deg, var(--accent), #2563eb);
  font-weight: 600;
}
.cm-pager .cm-page-btn.is-disabled {
  opacity: 0.35; cursor: not-allowed;
}
.cm-pager-fancy {
  padding: 0.35rem;
  background: rgba(18,22,31,0.55);
  border: 1px solid var(--line);
  border-radius: 14px;
  gap: 0.3rem;
}
.cm-page-ellipsis {
  color: var(--faint); padding: 0 0.2rem; user-select: none;
}

.cm-admin-bar {
  display: flex; flex-wrap: wrap; justify-content: space-between;
  gap: 1rem; align-items: flex-start; margin-bottom: 1.25rem;
}
.cm-admin-bar h1 { margin: 0; font-family: var(--font-display); }
.cm-admin-actions { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.cm-filters { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }
.cm-filters select { background: var(--bg-soft); border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 0.4rem 0.6rem; }
.cm-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.cm-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.cm-table th, .cm-table td { padding: 0.65rem 0.75rem; border-bottom: 1px solid var(--line); text-align: left; }
.cm-table th { color: var(--faint); font-weight: 500; background: var(--bg-elev); }
.cm-att-list { padding-left: 1.1rem; color: var(--muted); font-size: 0.9rem; }
.cm-bug-fields { margin: 0.5rem 0 1rem; color: var(--muted); }

.cm-prose .cm-file-attach {
  padding: 0.75rem 1rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-soft);
  margin: 0.85rem 0;
}
.cm-prose .cm-file-link { font-weight: 600; text-decoration: none; }
.cm-prose .cm-file-link:hover { text-decoration: underline; }

.cm-prose img,
.cm-prose .cm-zoom {
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  margin: 0.75rem 0;
  cursor: zoom-in;
  border: 1px solid var(--line);
  display: block;
  background: var(--bg-soft);
}
.cm-prose img:hover,
.cm-prose .cm-zoom:hover {
  border-color: rgba(59,158,255,0.4);
}
.cm-prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.95rem;
}
.cm-prose th, .cm-prose td {
  border: 1px solid var(--line);
  padding: 0.45rem 0.65rem;
}

.cm-lightbox {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0, 0, 0, 0.88);
  display: flex; align-items: center; justify-content: center;
  padding: 1.5rem;
}
.cm-lightbox[hidden] { display: none !important; }
.cm-lightbox img {
  max-width: min(96vw, 1200px);
  max-height: 90vh;
  object-fit: contain;
  border-radius: 8px;
  cursor: default;
}
.cm-lightbox-close {
  position: absolute; top: 1rem; right: 1rem;
  width: 2.5rem; height: 2.5rem;
  border-radius: 999px; border: 1px solid var(--line);
  background: var(--bg-elev); color: var(--text);
  font-size: 1.4rem; line-height: 1; cursor: pointer;
}

.cm-dropzone {
  border: 1.5px dashed var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
  background: var(--bg-soft);
  transition: border-color 0.2s, background 0.2s;
}
.cm-dropzone.is-drag {
  border-color: var(--accent);
  background: rgba(59, 158, 255, 0.08);
}
.cm-dropzone[aria-disabled="true"] { opacity: 0.55; pointer-events: none; }
.cm-file-btn { position: relative; overflow: hidden; display: inline-flex; margin-top: 0.5rem; }
.cm-file-btn input[type="file"] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%;
}
.cm-linkish {
  background: none; border: 0; color: var(--accent); cursor: pointer; padding: 0; font: inherit;
  text-decoration: underline;
}

.cm-modal {
  position: fixed; inset: 0; z-index: 220;
  background: rgba(0, 0, 0, 0.65);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}
.cm-modal[hidden] { display: none !important; }
.cm-modal-box {
  width: min(100%, 560px);
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem;
}
.cm-modal-box h3 { margin: 0 0 0.5rem; font-family: var(--font-display); }
.cm-modal-box textarea {
  width: 100%; min-height: 200px;
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: 10px; color: var(--text); padding: 0.65rem 0.75rem;
  font-family: var(--font-mono); font-size: 0.9rem;
}
.cm-modal-actions {
  display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 0.85rem;
}
.cm-emoji-box { width: min(100%, 440px); }
.cm-emoji-tabs {
  display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0.5rem 0 0.75rem;
}
.cm-emoji-tab {
  padding: 0.3rem 0.65rem; border-radius: 8px;
  border: 1px solid var(--line); background: var(--bg-soft);
  color: var(--muted); cursor: pointer; font: inherit; font-size: 0.88rem;
}
.cm-emoji-tab.is-active {
  color: var(--text); border-color: var(--accent); background: rgba(59,158,255,0.12);
}
.cm-emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 0.25rem;
  max-height: 260px;
  overflow-y: auto;
  padding: 0.25rem;
  background: var(--bg-soft);
  border-radius: 10px;
  border: 1px solid var(--line);
}
.cm-emoji-item {
  border: 0; background: transparent; cursor: pointer;
  font-size: 1.35rem; line-height: 1.6; border-radius: 8px; padding: 0.15rem;
}
.cm-emoji-item:hover { background: rgba(255,255,255,0.08); }

/* TinyMCE 在后台占位 */
.tox-tinymce { border-radius: 10px !important; border-color: var(--line) !important; }

@media (max-width: 720px) {
  .cm-nav-toggle { display: block; }
  .cm-links {
    display: none;
    position: absolute; left: 0; right: 0; top: var(--nav-h);
    flex-direction: column; align-items: stretch;
    background: var(--bg-elev); border-bottom: 1px solid var(--line);
    padding: 0.75rem 1rem 1rem; gap: 0.35rem;
  }
  .cm-links.is-open { display: flex; }
  .cm-back-official { margin-left: 0; text-align: center; }
}
