/* ============================================================
   Simple Markdown Blog — Stylesheet
   Zero JavaScript, pure CSS.
   ============================================================ */

/* ---------- Reset & Base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg:          #f8f6f3;
  --card-bg:     #ffffff;
  --text:        #1e1e24;
  --text-muted:  #6b7280;
  --text-light:  #9ca3af;
  --accent:      #6366f1;
  --accent-hover:#4f46e5;
  --accent-soft: #eef2ff;
  --border:      #e5e0d8;
  --border-light:#f0ece5;
  --code-bg:     #1e1e2e;
  --code-text:   #cdd6f4;
  --red:         #ef4444;
  --red-bg:      #fef2f2;
  --red-border:  #fecaca;
  --radius:      12px;
  --radius-sm:   8px;
  --shadow-sm:   0 1px 2px rgba(0,0,0,.04);
  --shadow:      0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:   0 4px 6px rgba(0,0,0,.05), 0 2px 4px rgba(0,0,0,.04);
  --shadow-lg:   0 10px 15px rgba(0,0,0,.06), 0 4px 6px rgba(0,0,0,.04);
  --font-sans:   -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
                 "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC",
                 sans-serif;
  --font-mono:   "SF Mono", "Fira Code", "Fira Mono", "Cascadia Code",
                 "JetBrains Mono", "Noto Sans Mono SC", Consolas, monospace;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color .2s;
}

a:hover {
  color: var(--accent-hover);
}

/* ---------- Header ---------- */
.site-header {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(8px);
  background: rgba(255,255,255,.88);
}

.header-inner {
  max-width: 1060px;
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text) !important;
  letter-spacing: -.01em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.site-logo {
  flex-shrink: 0;
}

.site-title:hover .site-logo {
  opacity: .85;
}

.site-title:hover {
  color: var(--accent) !important;
}

.header-nav {
  display: flex;
  gap: 20px;
  align-items: center;
}

.header-nav a {
  font-size: .925rem;
  font-weight: 500;
  color: var(--text-muted);
  position: relative;
}

.header-nav a:hover {
  color: var(--accent);
}

.btn-publish-nav {
  display: inline-block !important;
  background: var(--accent) !important;
  color: #fff !important;
  padding: 6px 16px !important;
  border-radius: var(--radius-sm) !important;
  font-weight: 600 !important;
  transition: background .2s, transform .1s !important;
}

.btn-publish-nav:hover {
  background: var(--accent-hover) !important;
  color: #fff !important;
}

.btn-publish-nav:active {
  transform: scale(.96);
}

/* ---------- Main ---------- */
.site-main {
  flex: 1;
  max-width: 780px;
  width: 100%;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

/* ---------- Footer ---------- */
.site-footer {
  text-align: center;
  padding: 32px 24px;
  border-top: 1px solid var(--border-light);
  color: var(--text-light);
  font-size: .85rem;
}

/* ---------- Page Intro ---------- */
.page-intro {
  margin-bottom: 36px;
}

.page-intro h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -.02em;
}

.intro-sub {
  margin-top: 6px;
  color: var(--text-muted);
  font-size: .95rem;
}

/* ---------- Search Modal ---------- */
.modal-search-card {
  max-width: 440px;
  padding: 32px 30px 28px;
}

.search-modal-body {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.sm-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sm-field label {
  font-weight: 600;
  font-size: .875rem;
  color: var(--text);
}

.sm-input-icon {
  position: relative;
  display: flex;
  align-items: center;
}

.sm-icon {
  position: absolute;
  left: 13px;
  font-size: 1rem;
  pointer-events: none;
  z-index: 1;
}

.sm-input-icon input {
  width: 100%;
  font-family: var(--font-sans);
  font-size: .95rem;
  padding: 11px 14px 11px 38px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fdfcfb;
  color: var(--text);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}

.sm-input-icon input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, .12);
  background: #fff;
}

.sm-date-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sm-date {
  flex: 1;
  font-family: var(--font-sans);
  font-size: .9rem;
  padding: 11px 10px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fdfcfb;
  color: var(--text);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  cursor: pointer;
}

.sm-date:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, .12);
  background: #fff;
}

.sm-date-sep {
  color: var(--text-muted);
  font-size: .85rem;
  user-select: none;
  flex-shrink: 0;
}

.sm-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
}

.sm-actions .btn-primary {
  flex: 1;
  padding: 11px 20px;
  text-align: center;
}

.btn-sm-clear {
  font-size: .875rem;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-sm-clear:hover {
  color: var(--red);
}

/* ---------- Post List / Cards ---------- */
.post-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.post-card {
  background: var(--card-bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 28px 30px;
  transition: transform .15s, box-shadow .15s, border-color .15s;
  box-shadow: var(--shadow-sm);
}

.post-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border);
}

.post-card-title {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 6px;
}

.post-card-title a {
  color: var(--text);
}

.post-card-title a:hover {
  color: var(--accent);
}

.post-card-date {
  display: block;
  font-size: .85rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.post-card-excerpt {
  color: var(--text-muted);
  font-size: .925rem;
  line-height: 1.7;
  margin-bottom: 14px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-card-link {
  font-size: .9rem;
  font-weight: 600;
  color: var(--accent);
}

.post-card-link:hover {
  text-decoration: underline;
}

/* ---------- Empty State ---------- */
.empty-state {
  text-align: center;
  padding: 80px 24px;
}

.empty-icon {
  font-size: 4rem;
  margin-bottom: 20px;
}

.empty-state h2 {
  font-size: 1.4rem;
  margin-bottom: 8px;
}

.empty-state p {
  color: var(--text-muted);
  margin-bottom: 28px;
  font-size: 1.05rem;
}

/* ---------- Buttons ---------- */
.btn-primary {
  display: inline-block;
  background: var(--accent);
  color: #fff !important;
  padding: 12px 28px;
  border-radius: var(--radius-sm);
  font-size: .95rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background .2s, transform .1s;
  text-align: center;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-primary:active {
  transform: scale(.98);
}

.btn-full {
  display: block;
  width: 100%;
  padding: 14px;
  font-size: 1.05rem;
}

/* ---------- Post Full View ---------- */
.post-layout {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.post-layout-main {
  flex: 1 1 0;
  min-width: 0;
  max-width: 720px;
}

/* ---------- Left Edit Sidebar ---------- */
.edit-sidebar {
  width: 52px;
  flex-shrink: 0;
  position: sticky;
  top: 50vh;
  margin-top: -40px;
  z-index: 1;
}

.edit-sidebar-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 10px;
  background: var(--card-bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--accent) !important;
  font-size: .75rem;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  transition: all .2s;
  box-shadow: var(--shadow-sm);
}

.edit-sidebar-btn:hover {
  background: var(--accent-soft);
  border-color: #c7d2fe;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.esb-icon {
  font-size: 1.1rem;
}

.esb-text {
  line-height: 1.3;
}

/* ---------- Post Meta (date + edit time) ---------- */
.post-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.post-meta-sep {
  color: var(--text-light);
  font-size: .85rem;
}

.post-updated {
  font-size: .875rem;
  color: var(--text-light);
}

/* ---------- Thoughts Card ---------- */
.thoughts-card {
  width: 240px;
  flex-shrink: 0;
  background: linear-gradient(135deg, #fefcf5 0%, #fdf8ed 100%);
  border: 1px solid #f0e4c8;
  border-radius: var(--radius);
  padding: 22px 20px;
  position: sticky;
  top: 76px;
  box-shadow: 0 1px 3px rgba(0,0,0,.03);
}

.thoughts-heading {
  font-size: .9rem;
  font-weight: 700;
  color: #b8860b;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid #f0e4c8;
  letter-spacing: .01em;
}

.thoughts-body {
  font-size: .875rem;
  line-height: 1.7;
  color: #6b5e3e;
}

.thoughts-body p {
  margin-bottom: .8em;
}

.thoughts-body p:last-child {
  margin-bottom: 0;
}

.thoughts-body a {
  color: #b8860b;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.thoughts-body ul,
.thoughts-body ol {
  padding-left: 1.2em;
  margin-bottom: .8em;
}

.thoughts-body li {
  margin-bottom: .2em;
}

.thoughts-body code {
  font-family: var(--font-mono);
  font-size: .85em;
  background: rgba(0,0,0,.05);
  padding: 1px 5px;
  border-radius: 3px;
}

.thoughts-body blockquote {
  border-left: 2px solid #e8d5a0;
  margin: .6em 0;
  padding: 6px 12px;
  color: #8b7d5e;
  font-style: italic;
}

.post-full {
  background: var(--card-bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 40px 36px;
  box-shadow: var(--shadow-sm);
}

.post-header {
  margin-bottom: 24px;
}

.post-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.post-header-bar .back-link {
  margin-bottom: 0;
}

.post-header-bar .post-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

.back-link {
  display: inline-block;
  font-size: .9rem;
  color: var(--text-muted);
  font-weight: 500;
}

.back-link:hover {
  color: var(--accent);
}

.post-title {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.3;
  letter-spacing: -.02em;
  margin-bottom: 10px;
}

.post-date {
  font-size: .9rem;
  color: var(--text-muted);
}

.post-footer {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border-light);
}


.btn-edit {
  display: inline-block;
  color: var(--accent) !important;
  font-size: .9rem;
  font-weight: 500;
  padding: 6px 14px;
  border: 1.5px solid #c7d2fe;
  border-radius: var(--radius-sm);
  transition: background .2s;
}

.btn-edit:hover {
  background: var(--accent-soft);
  color: var(--accent-hover) !important;
}

.btn-delete {
  display: inline-block;
  color: var(--red) !important;
  font-size: .9rem;
  font-weight: 500;
  padding: 6px 14px;
  border: 1.5px solid var(--red-border);
  border-radius: var(--radius-sm);
  transition: background .2s, color .2s;
}

.btn-delete:hover {
  background: var(--red-bg);
  color: #dc2626 !important;
}

/* ---------- Post Body / Markdown Rendered ---------- */
.post-body {
  font-size: 1.05rem;
  line-height: 1.85;
}

.post-body h1 { font-size: 1.75rem; font-weight: 700; margin: 2em 0 .5em; }
.post-body h2 { font-size: 1.45rem; font-weight: 700; margin: 1.8em 0 .5em; padding-bottom: .3em; border-bottom: 2px solid var(--border-light); }
.post-body h3 { font-size: 1.2rem;  font-weight: 700; margin: 1.5em 0 .4em; }
.post-body h4 { font-size: 1.05rem; font-weight: 700; margin: 1.3em 0 .3em; }
.post-body h5, .post-body h6 { font-size: .95rem; font-weight: 700; margin: 1em 0 .3em; }

.post-body h1:first-child,
.post-body h2:first-child,
.post-body h3:first-child { margin-top: 0; }

.post-body p {
  margin: 0 0 1em;
}

.post-body a {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.post-body ul, .post-body ol {
  margin: 0 0 1em 0;
  padding-left: 1.5em;
}

.post-body li {
  margin-bottom: .3em;
}

.post-body blockquote {
  border-left: 4px solid var(--accent);
  background: var(--accent-soft);
  margin: 1.2em 0;
  padding: 14px 20px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: #4338ca;
  font-style: italic;
}

.post-body blockquote p:last-child {
  margin-bottom: 0;
}

.post-body img {
  max-width: 100%;
  border-radius: var(--radius-sm);
  margin: 1em 0;
}

.post-body hr {
  border: none;
  border-top: 2px solid var(--border-light);
  margin: 2em 0;
}

/* ---------- Inline Code ---------- */
.post-body code {
  font-family: var(--font-mono);
  font-size: .9em;
  background: #f1f0ee;
  color: #d6336c;
  padding: 2px 7px;
  border-radius: 4px;
}

/* ---------- Tables ---------- */
.post-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.2em 0;
  font-size: .925rem;
}

.post-body th,
.post-body td {
  border: 1px solid var(--border);
  padding: 10px 14px;
  text-align: left;
}

.post-body th {
  background: #faf9f7;
  font-weight: 700;
}

.post-body tr:nth-child(even) td {
  background: #fdfdfc;
}

/* ---------- Code Blocks (Pygments highlight) ---------- */
.post-body .highlight,
.post-body pre {
  background: var(--code-bg);
  color: var(--code-text);
  border-radius: var(--radius-sm);
  padding: 18px 22px;
  margin: 1.2em 0;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: .88rem;
  line-height: 1.6;
  -webkit-overflow-scrolling: touch;
}

.post-body pre code {
  background: transparent;
  color: inherit;
  padding: 0;
  font-size: inherit;
}

/* Pygments codehilite overrides */
.post-body .highlight pre { margin: 0; padding: 0; background: transparent; }

/* Inline code inside links */
.post-body a code {
  color: var(--accent);
}

/* ---------- Publish Page ---------- */
.publish-page {
  max-width: 680px;
  margin: 0 auto;
}

.publish-card {
  background: var(--card-bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 36px 36px 40px;
  box-shadow: var(--shadow-sm);
}

.publish-card h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.publish-hint {
  color: var(--text-muted);
  font-size: .925rem;
  margin-bottom: 28px;
}

/* ---------- Form ---------- */
.publish-form {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-weight: 600;
  font-size: .925rem;
  color: var(--text);
}

.label-hint {
  font-weight: 400;
  color: var(--text-muted);
  font-size: .85rem;
}

.form-group input,
.form-group textarea {
  font-family: var(--font-sans);
  font-size: .95rem;
  padding: 11px 15px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fdfcfb;
  color: var(--text);
  transition: border-color .2s, box-shadow .2s;
  outline: none;
  resize: vertical;
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, .12);
  background: #fff;
}

.form-group textarea {
  font-family: var(--font-mono);
  font-size: .9rem;
  line-height: 1.8;
  min-height: 400px;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: #c4bfb8;
}

/* ---------- Form Error ---------- */
.form-error {
  background: var(--red-bg);
  border: 1px solid var(--red-border);
  color: var(--red);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: .925rem;
  margin-bottom: 4px;
}

/* ---------- Image Upload Section ---------- */
.upload-section {
  margin-top: 36px;
  padding-top: 28px;
  border-top: 1px solid var(--border-light);
}

.upload-section h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.upload-hint {
  color: var(--text-muted);
  font-size: .875rem;
  margin-bottom: 14px;
}

.upload-form {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.upload-input {
  flex: 1 1 200px;
  font-family: var(--font-sans);
  font-size: .9rem;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fdfcfb;
  color: var(--text);
  cursor: pointer;
}

.upload-input::file-selector-button {
  background: var(--accent-soft);
  color: var(--accent);
  border: none;
  border-radius: 4px;
  padding: 5px 12px;
  margin-right: 10px;
  font-weight: 600;
  font-size: .85rem;
  cursor: pointer;
  transition: background .2s;
}

.upload-input::file-selector-button:hover {
  background: #dde4ff;
}

.btn-upload {
  padding: 10px 22px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s;
  white-space: nowrap;
}

.btn-upload:hover {
  background: var(--accent-hover);
}

.edit-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.edit-actions .btn-cancel {
  padding: 11px 24px;
  background: #f3f4f6;
  color: var(--text-muted);
  border: none;
  border-radius: var(--radius-sm);
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: background .2s;
  text-decoration: none;
}

.edit-actions .btn-cancel:hover {
  background: #e5e7eb;
  color: var(--text);
}

.edit-actions .btn-primary {
  flex: 1;
  padding: 11px;
  text-align: center;
}

.upload-result {
  margin-top: 16px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-sm);
  padding: 16px 18px;
}

.upload-ok {
  font-size: .9rem;
  font-weight: 600;
  color: #16a34a;
  margin-bottom: 8px;
}

.upload-code {
  display: block;
  font-family: var(--font-mono);
  font-size: .875rem;
  background: #f1f0ee;
  color: var(--text);
  padding: 8px 12px;
  border-radius: 4px;
  margin-bottom: 12px;
  word-break: break-all;
}

.upload-preview {
  max-width: 200px;
  max-height: 150px;
  border-radius: 6px;
  border: 1px solid var(--border);
}

/* ---------- Inline Collections (Homepage) ---------- */
.collections-inline {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 20px;
}

.collections-inline-label {
  font-size: .9rem;
  color: var(--text-muted);
  margin-right: 4px;
}

.collections-inline-item {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: .84rem;
  font-weight: 500;
  color: var(--text-muted);
  padding: 2px 8px;
  border-radius: 10px;
  transition: all .15s;
}

.collections-inline-item:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.collections-inline-count {
  font-size: .72rem;
  color: var(--text-light);
}

.collections-inline-more {
  font-size: .8rem;
  color: var(--text-light);
  padding: 2px 6px;
}

.collections-inline-more:hover {
  color: var(--accent);
}

.collections-inline-add {
  font-size: .8rem;
  color: var(--accent);
  font-weight: 600;
  padding: 2px 8px;
  border: 1px dashed var(--accent);
  border-radius: 12px;
  margin-left: 4px;
}

.collections-inline-add:hover {
  background: var(--accent-soft);
}

.collections-inline-empty {
  margin-bottom: 16px;
}

/* ---------- Post Footer ---------- */
.post-footer {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border-light);
}

.post-footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.post-footer-row .back-link {
  margin-bottom: 0;
  flex-shrink: 0;
}

.footer-nav-spacer {
  flex: 1;
}

.chapter-nav {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.chapter-btn {
  display: inline-block;
  padding: 6px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-weight: 500;
  color: var(--accent);
  transition: all .15s;
}

.chapter-btn:hover {
  background: var(--accent-soft);
  border-color: #c7d2fe;
  color: var(--accent-hover);
}

.chapter-prev {
  color: var(--text-muted);
}

.chapter-prev:hover {
  color: var(--accent);
}

/* ---------- Pagination ---------- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 36px;
  padding-top: 24px;
  border-top: 1px solid var(--border-light);
}

.page-btn {
  display: inline-block;
  padding: 8px 20px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-weight: 500;
  color: var(--accent);
  transition: all .15s;
}

.page-btn:hover {
  background: var(--accent-soft);
  border-color: #c7d2fe;
  color: var(--accent-hover);
}

.page-info {
  font-size: .9rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* ---------- Checkbox Form Group ---------- */
.form-group-check {
  background: #faf9f7;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}

.check-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: .925rem;
  cursor: pointer;
  margin-bottom: 4px;
}

.check-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

.check-label input[type="checkbox"]:focus {
  box-shadow: none;
}

/* ---------- Post Card Badge ---------- */
.post-card-badge {
  display: inline-block;
  font-size: .75rem;
  font-weight: 500;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 2px 10px;
  border-radius: 10px;
  margin-left: 8px;
  vertical-align: middle;
  transition: background .2s;
}

.post-card-badge:hover {
  background: #dde4ff;
}

/* ---------- Collection Full Grid ---------- */
.collections-full-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}

.collection-card-full {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  background: var(--card-bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 24px;
  transition: transform .15s, box-shadow .15s, border-color .15s;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  color: var(--text);
}

.collection-card-full:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border);
  color: var(--text);
}

.collection-card-full-emoji {
  font-size: 2.2rem;
  flex-shrink: 0;
  line-height: 1;
}

.collection-card-full-body {
  min-width: 0;
}

.collection-card-full-name {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.collection-card-full-desc {
  font-size: .85rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.collection-card-full-count {
  font-size: .8rem;
  color: var(--text-light);
}

.collection-create-footer {
  text-align: center;
  margin-top: 32px;
}

/* ---------- Collection Hero ---------- */
.collection-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 24px;
  font-size: .9rem;
}

.collection-header .back-link {
  color: var(--text-muted);
}

.back-sep {
  color: var(--text-light);
}

.collection-hero {
  text-align: center;
  padding: 40px 24px;
  background: var(--card-bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: 32px;
}

.collection-hero-emoji {
  font-size: 3.5rem;
  display: block;
  margin-bottom: 12px;
}

.collection-hero-title {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -.02em;
  margin-bottom: 8px;
}

.collection-hero-desc {
  color: var(--text-muted);
  font-size: .95rem;
  margin-bottom: 10px;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

.collection-hero-meta {
  color: var(--text-light);
  font-size: .85rem;
  margin-bottom: 0;
}

.collection-hero-actions {
  margin-top: 18px;
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn-export {
  display: inline-block;
  color: #059669 !important;
  font-size: .9rem;
  font-weight: 500;
  padding: 6px 14px;
  border: 1.5px solid #a7f3d0;
  border-radius: var(--radius-sm);
  transition: background .2s;
}

.btn-export:hover {
  background: #ecfdf5;
  color: #047857 !important;
}

/* ---------- Collection Posts ---------- */
.collection-posts {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.collection-post-card .post-card-title {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.collection-post-index {
  color: var(--accent);
  font-weight: 700;
  font-size: .95rem;
  flex-shrink: 0;
  min-width: 2em;
}

/* ---------- Post Collection Badge ---------- */
.post-collection-badge {
  margin-bottom: 10px;
}

.post-collection-badge a {
  display: inline-block;
  font-size: .85rem;
  font-weight: 500;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 4px 14px;
  border-radius: 14px;
  transition: background .2s;
}

.post-collection-badge a:hover {
  background: #dde4ff;
  color: var(--accent-hover);
}

/* ---------- Form Select ---------- */
.form-select {
  font-family: var(--font-sans);
  font-size: .95rem;
  padding: 11px 15px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fdfcfb;
  color: var(--text);
  outline: none;
  cursor: pointer;
  transition: border-color .2s, box-shadow .2s;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, .12);
  background-color: #fff;
}

.form-hint {
  font-size: .825rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .header-inner {
    padding: 0 16px;
    height: 52px;
  }

  .site-main {
    padding: 24px 16px 60px;
  }

  .post-card {
    padding: 20px 20px;
  }

  .post-card-title {
    font-size: 1.1rem;
  }

  .post-full {
    padding: 24px 20px;
  }

  .post-title {
    font-size: 1.5rem;
  }

  .publish-card {
    padding: 24px 20px;
  }

  .post-body {
    font-size: 1rem;
  }

  .post-body h1 { font-size: 1.4rem; }
  .post-body h2 { font-size: 1.2rem; }
  .post-body h3 { font-size: 1.05rem; }

  .post-layout {
    flex-direction: column;
  }

  .edit-sidebar {
    width: 100%;
    position: static;
    order: -2;
  }

  .edit-sidebar-btn {
    flex-direction: row;
    justify-content: center;
    gap: 6px;
    padding: 10px 16px;
    font-size: .875rem;
  }

  .thoughts-card {
    width: 100%;
    position: static;
    order: -1;
  }

  .header-nav {
    gap: 10px;
  }

  .btn-publish-nav {
    padding: 5px 12px !important;
    font-size: .85rem !important;
  }

  .modal-card {
    max-width: 90vw;
    padding: 24px 20px;
    margin: 20px;
  }
}

/* ---------- Modal ---------- */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 999;
  align-items: center;
  justify-content: center;
}

.modal.show {
  display: flex !important;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(2px);
  animation: fadeIn .2s ease;
}

.modal-card {
  position: relative;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 32px 30px;
  width: 100%;
  max-width: 400px;
  z-index: 1;
  animation: slideUp .25s ease;
}

.modal-card h2 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 18px;
  text-align: center;
}

.modal-card input[type="password"] {
  width: 100%;
  font-family: var(--font-sans);
  font-size: 1rem;
  padding: 12px 15px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fdfcfb;
  color: var(--text);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  margin-bottom: 16px;
}

.modal-card input[type="password"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, .12);
  background: #fff;
}

.modal-card .form-error {
  margin-bottom: 12px;
}

.modal-desc {
  text-align: center;
  color: var(--text-muted);
  font-size: .925rem;
  margin-bottom: 14px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

.modal-actions .btn-cancel,
.modal-actions .btn-danger {
  flex: 1;
  padding: 11px;
  border-radius: var(--radius-sm);
  font-size: .95rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background .2s, transform .1s;
}

.btn-cancel {
  background: #f3f4f6;
  color: var(--text-muted);
}

.btn-cancel:hover {
  background: #e5e7eb;
}

.btn-danger {
  background: var(--red);
  color: #fff;
}

.btn-danger:hover {
  background: #dc2626;
}

.btn-danger:active,
.btn-cancel:active {
  transform: scale(.97);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
