:root {
  --text: #202624;
  --muted: #6f7975;
  --line: #dde5e0;
  --bg: #f6f8f5;
  --soft: #edf3ef;
  --accent: #0f766e;
  --accent-hover: #0b5f59;
  --accent-soft: #dff4ee;
  --warm: #b45309;
  --warm-soft: #fff1d6;
  --admin-bg: #f3f6f3;
  --card: #ffffff;
  --shadow-sm: 0 1px 2px rgba(22,33,28,.04);
  --shadow: 0 10px 24px rgba(22,33,28,.06);
  --shadow-md: 0 16px 40px rgba(22,33,28,.09);
  --shadow-lg: 0 26px 70px rgba(22,33,28,.13);
  --radius: 8px;
  --radius-lg: 12px;
}

* { box-sizing: border-box }

html {
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(135deg, rgba(15,118,110,.06) 0, transparent 260px),
    linear-gradient(180deg, #fbfdfb 0, #f4f8f5 360px, var(--bg) 720px);
  color: var(--text);
  font: 16px/1.85 -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Serif SC", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  letter-spacing: 0;
}

a { color: var(--accent); text-decoration: none; transition: color .18s ease, background .18s ease, border-color .18s ease, box-shadow .18s ease }
a:hover { color: var(--accent-hover) }
img { max-width: 100%; height: auto; display: block }
button, .button, input, textarea, select { font: inherit }

button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 7px 15px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  border-radius: var(--radius);
  cursor: pointer;
  white-space: nowrap;
  transition: all .18s ease;
  box-shadow: var(--shadow-sm);
  font-size: 13px;
  font-weight: 650;
}
button:hover, .button:hover {
  background: #f7faf8;
  border-color: #bacac2;
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff }

.danger { color: #b42318; border-color: #f5c2bc; background: #fff }
.danger:hover { background: #fff3f1; border-color: #ee9b91 }
.link-danger {
  min-height: 32px;
  padding: 4px 10px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: #b42318;
  box-shadow: none;
  font-weight: 700;
}
.link-danger:hover {
  color: #8f1b12;
  background: #fff3f1;
  border-color: #f5c2bc;
}

/* ── Site Header ── */
.site-header {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 16px 28px;
  display: flex;
  gap: 26px;
  align-items: center;
  border-bottom: 1px solid rgba(32,38,36,.07);
}
.brand-block {
  display: grid;
  gap: 2px;
  min-width: 120px;
}
.brand {
  font-weight: 850;
  border: 0;
  color: var(--text);
  font-size: 22px;
  letter-spacing: 0;
  white-space: nowrap;
}
.brand:hover { color: var(--accent) }
.mobile-search-toggle { display: none }
.site-tagline {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  white-space: nowrap;
}
nav { display: flex; gap: 4px; flex-wrap: wrap; align-items: center }
nav a {
  border: 0;
  color: var(--muted);
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 650;
}
nav a:hover { color: var(--accent); background: var(--accent-soft) }
.header-search {
  margin-left: auto;
  display: flex;
  gap: 6px;
  align-items: center;
  min-width: 260px;
}
.header-search-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}
.header-search input {
  width: 100%;
  min-height: 34px;
  padding: 6px 14px;
  font-size: 13px;
  border-color: var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,.82);
}
.header-search input:focus { width: 100% }
.header-search button {
  min-height: 34px;
  padding: 6px 14px;
  font-size: 13px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.header-search button:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff }

/* ── Container ── */
.container { width: 100%; max-width: 1120px; margin: 0 auto; padding: 34px 28px; flex: 1 0 auto }
.container > h1 {
  max-width: 780px;
  margin: 0 auto 30px;
  font-size: 34px;
  line-height: 1.25;
  font-weight: 850;
  letter-spacing: 0;
}
.admin { max-width: 1160px }

.site-footer {
  width: 100%;
  max-width: 1180px;
  margin: 42px auto 0;
  padding: 22px 28px 30px;
  border-top: 1px solid rgba(32,38,36,.08);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}
.site-footer a { color: inherit; text-underline-offset: 3px }
.site-footer a:hover { color: var(--accent); text-decoration-thickness: 2px }

/* ── Home ── */
.home-shell { display: grid; gap: 0 }
.article h1 { font-size: 40px; line-height: 1.18; margin: 0 0 12px; letter-spacing: 0; font-weight: 850 }
.home-layout {
  display: grid;
  grid-template-columns: minmax(0,620px) 220px;
  gap: 34px;
  align-items: start;
  justify-content: center;
  width: 100%;
  max-width: 874px;
  margin-inline: auto;
}
.home-discovery {
  position: sticky;
  top: 20px;
  display: grid;
  gap: 22px;
  border-left: 1px solid rgba(32,38,36,.09);
  padding-left: 22px;
}
.home-discovery section {
  padding-bottom: 22px;
  border-bottom: 1px solid rgba(32,38,36,.08);
}
.home-discovery section:last-child { border-bottom: 0; padding-bottom: 0 }
.home-discovery h2 { font-size: 13px; margin: 0 0 12px; color: #53615b; letter-spacing: 0; font-weight: 850 }
.recent-comments { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px }
.recent-comments li { margin: 0 }
.recent-comments a {
  color: var(--text);
  display: block;
  padding: 9px 0;
  border-bottom: 1px solid rgba(32,38,36,.06);
  transition: color .18s ease, padding .18s ease;
}
.recent-comments strong {
  display: block;
  font-size: 13px;
  line-height: 1.45;
  transition: color .18s ease;
}
.recent-comments span {
  display: -webkit-box;
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.recent-comments a:hover { padding-left: 4px }
.recent-comments a:hover strong { color: var(--accent) }
.recent-comments li:last-child a { border-bottom: 0 }
.archive-months {
  list-style: none;
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
}
.archive-months a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 34px;
  padding: 5px 0;
  border-bottom: 1px solid rgba(32,38,36,.06);
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}
.archive-months a:hover {
  color: var(--accent);
}
.archive-months li:last-child a { border-bottom: 0 }
.count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--soft);
  color: #53615b;
  font-size: 12px;
  font-weight: 850;
}

h1, h2, h3, h4 { line-height: 1.35 }

/* ── Post List ── */
.post-list article {
  padding: 22px 0 24px;
  border-bottom: 1px solid rgba(32,38,36,.09);
}
.post-list:not(.home-posts) {
  max-width: 780px;
  margin-inline: auto;
}
.home-posts { display: block }
.home-posts article {
  position: relative;
  padding: 24px 0 26px;
  border-bottom: 1px solid rgba(32,38,36,.09);
  transition: border-color .18s ease;
}
.home-posts article:hover {
  border-color: rgba(15,118,110,.22);
}
.post-list article:last-child { border-bottom: 0 }
.home-posts article:last-child { border-bottom: 0 }
.post-list h2 { margin: 0 0 9px; font-size: 24px; font-weight: 800; letter-spacing: 0 }
.post-list .post-meta + h2 { margin-top: 8px }
.home-posts h2 { margin-top: 8px; font-size: 26px; line-height: 1.28 }
.post-list h2 a { color: var(--text) }
.post-list h2 a:hover { color: var(--accent) }
.post-list p, .muted, .quiet { color: var(--muted) }
.post-list p { margin: 0; max-width: 620px }
.home-posts p { font-size: 15px; line-height: 1.8 }
.post-list .post-summary {
  max-width: 640px;
  margin: 4px 0 0;
  padding: 2px 0;
}
.post-list .post-summary p {
  max-width: none;
  margin: 0;
  color: #4f625c;
  line-height: 1.7;
}
.ai-summary-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-right: 8px;
  color: var(--accent);
  font-size: inherit;
  font-weight: 800;
  letter-spacing: .05em;
  line-height: inherit;
  white-space: nowrap;
}
.post-list time { display: block; margin-top: 12px; font-size: 13px; color: #7d8782; font-weight: 650 }
.post-meta {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}
.post-meta time { margin: 0; color: var(--accent); font-size: 13px; font-weight: 800 }
.post-meta-separator { color: #a2aaa6 }
.post-author-link { color: inherit; text-decoration: underline; text-decoration-color: rgba(15,118,110,.38); text-underline-offset: 3px }
.post-author-link:hover { color: var(--accent); text-decoration-color: var(--accent) }

/* ── Terms ── */
.term-cloud, .term-links, .article-terms { display: flex; gap: 8px; align-items: center; flex-wrap: wrap }
.term-cloud { margin: 16px 0 6px }
.term-cloud a, .term-links a, .article-terms a {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 13px;
  background: rgba(255,255,255,.72);
  color: var(--muted);
  font-size: 13px;
  transition: all .2s;
  font-weight: 650;
}
.term-cloud a:hover, .term-links a:hover, .article-terms a:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}
.category-cloud {
  gap: 10px 8px;
  padding: 2px 5px 0 0;
}
.category-cloud a {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.category-cloud .count-badge {
  position: absolute;
  top: -7px;
  right: -7px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border: 2px solid var(--bg);
  background: var(--soft);
  font-size: 10px;
  line-height: 1;
  pointer-events: none;
}
.category-cloud a:hover .count-badge {
  background: var(--accent);
  color: #fff;
}
.term-links { margin: 10px 0 }
.article-terms { margin-top: 36px; padding-top: 20px; border-top: 1px solid var(--line) }

/* ── Frontend notices ── */
.site-notice-region {
  width: 100%;
  max-width: 780px;
  margin: 0 auto 24px;
}
.site-notice,
.flash {
  width: fit-content;
  max-width: 100%;
  margin: 0;
  padding: 10px 14px;
  background: var(--accent-soft);
  border: 1px solid #aadfd3;
  border-radius: var(--radius);
  color: #0b5f59;
  font-size: 14px;
  line-height: 1.6;
  font-weight: 650;
  overflow-wrap: anywhere;
}
.site-notice--notice {
  background: var(--warm-soft);
  border-color: #edc98c;
  color: #7c3f0b;
}
.site-notice--error {
  background: #fff0ee;
  border-color: #efb8b1;
  color: #9f2d24;
}

/* ── Search & Actions ── */
.search, .inline-form, .actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap }

.empty-state,
.link-grid:empty {
  display: grid;
  place-items: center;
  max-width: 780px;
  min-height: 132px;
  margin: 18px auto 28px;
  border: 1px dashed #bfd0c8;
  border-radius: var(--radius);
  background: rgba(255,255,255,.55);
  color: var(--muted);
  font-size: 14px;
}
.link-grid:empty::before { content: "暂时还没有友链"; }

/* ── Forms ── */
input, textarea, select {
  width: 100%;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 9px 12px;
  background: var(--card);
  color: var(--text);
  min-height: 38px;
  transition: border-color .2s, box-shadow .2s;
  font-size: 14px;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15,118,110,.14);
}
input[type=checkbox], input[type=radio] { width: auto; min-height: 0; padding: 0; margin-right: 6px; accent-color: var(--accent) }
textarea { resize: vertical }
label { display: block; margin: 10px 0; color: #475569; font-size: 13px; font-weight: 600 }

/* ── Tables ── */
table { width: 100%; border-collapse: collapse; margin: 20px 0 }
th, td { text-align: left; border-bottom: 1px solid var(--line); padding: 12px 14px; vertical-align: top }
th { font-weight: 800; color: #53615b; background: var(--soft); font-size: 12px; text-transform: uppercase; letter-spacing: .05em }
td { font-size: 14px }

/* ── Layout Utils ── */
.stack { display: grid; gap: 12px }
.stack > button,
.stack > .button { justify-self: start }
.grid-2 { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px }
.full { grid-column: 1/-1 }

.admin-create-form {
  max-width: 100%;
  margin-bottom: 14px;
}
.admin-data-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.admin-data-table th,
.admin-data-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.admin-data-table thead th {
  background: #f8faf8;
  color: #53615b;
  font-size: 12px;
  font-weight: 800;
  text-transform: none;
}
.admin-data-table tbody tr:last-child td { border-bottom: 0 }
.admin-data-table tbody tr:hover { background: #fbfdfb }

.protected-page {
  max-width: 1040px;
  margin-inline: auto;
}
.protected-page-header {
  max-width: 760px;
  margin: 0 auto 18px;
}
.protected-page-header h1 {
  margin: 6px 0 10px;
  font-size: 42px;
  line-height: 1.12;
  letter-spacing: 0;
}
.protected-page-header p {
  margin: 0;
}
.protected-page-header .muted {
  margin-top: 8px;
  font-size: 16px;
  line-height: 1.7;
}

.password-lock-panel {
  display: grid;
  grid-template-columns: minmax(180px,260px) minmax(0,1fr);
  gap: 16px;
  align-items: stretch;
  max-width: 760px;
  margin: 0 auto;
  border: 1px solid #c9d8d0;
  border-radius: var(--radius);
  background: rgba(255,255,255,.78);
  box-shadow: var(--shadow-sm);
  padding: 16px;
}
.password-lock-preview {
  min-height: 172px;
  display: grid;
  place-items: center;
  border: 1px dashed #b9cbc2;
  border-radius: 7px;
  background:
    linear-gradient(135deg, rgba(15,118,110,.12), rgba(180,83,9,.08)),
    var(--soft);
  color: #53615b;
  font-size: 12px;
  font-weight: 850;
  letter-spacing: .08em;
}
.password-lock-form {
  display: grid;
  align-content: center;
  gap: 10px;
}
.password-lock-form strong {
  font-size: 20px;
  line-height: 1.3;
}
.password-lock-form p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}
.password-lock-form div {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  gap: 8px;
  margin-top: 2px;
}
.password-lock-form input {
  background: #fbfefd;
  border-color: #b7d4ca;
}
.password-lock-form button {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.password-lock-form button:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
.comment-form,
.comments > form {
  max-width: none;
  margin-top: 26px;
  padding: 22px 0 0;
  border-top: 1px solid rgba(32,38,36,.09);
  background: transparent;
}

.link-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill,minmax(220px,1fr));
  gap: 14px;
  max-width: 780px;
  margin: 18px auto 30px;
}
.links-about {
  max-width: 780px;
  margin: 0 auto 26px;
}
.links-about h2 {
  margin: 0;
  color: var(--text);
  font-size: 22px;
  line-height: 1.35;
}
.links-about p {
  margin: 8px 0 0;
  color: var(--text);
  line-height: 1.8;
  overflow-wrap: anywhere;
}
.link-exchange {
  max-width: 780px;
  margin: 0 auto 34px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255,255,255,.72);
  box-shadow: var(--shadow-sm);
}
.link-exchange-copy h2,
.link-list-title {
  margin: 0;
  color: var(--text);
  font-size: 22px;
  line-height: 1.35;
}
.link-exchange-copy p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}
.site-link-profile {
  display: grid;
  grid-template-columns: 48px minmax(0,1fr);
  gap: 16px;
  align-items: start;
  margin-top: 20px;
  padding: 18px;
  border-radius: var(--radius);
  background: var(--soft);
}
.site-link-identity img,
.site-link-identity span {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  object-fit: cover;
  font-size: 20px;
  font-weight: 800;
  line-height: 1;
}
.site-link-fields {
  display: grid;
  gap: 7px;
  margin: 0;
}
.site-link-fields > div {
  display: grid;
  grid-template-columns: 48px minmax(0,1fr);
  gap: 8px;
}
.site-link-fields dt,
.site-link-fields dd {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
}
.site-link-fields dt { color: var(--muted) }
.site-link-fields dd { color: var(--text); overflow-wrap: anywhere }
.link-order-note {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}
.link-order-note strong { color: var(--text) }
.link-list-title {
  max-width: 780px;
  margin: 0 auto;
}
.friend-link {
  display: grid;
  grid-template-columns: 44px minmax(0,1fr);
  gap: 4px 12px;
  align-items: center;
  min-height: 86px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255,255,255,.72);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
.friend-link:hover { border-color: #a9c7be; box-shadow: var(--shadow); transform: translateY(-1px) }
.friend-link img {
  grid-row: span 2;
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 50%;
  background: var(--soft);
}
.friend-link strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px }
.friend-link span { min-width: 0; color: var(--muted); font-size: 13px; line-height: 1.5 }

/* ── Login ── */
.login-box {
  max-width: 400px;
  margin: 12vh auto;
  padding: 36px 32px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.admin-surface {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--card);
  box-shadow: var(--shadow-sm);
}

/* ── Stats ── */
.stats { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 14px }
.stats p {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  margin: 0;
  background: var(--card);
  box-shadow: var(--shadow-sm);
}
.stats strong { display: block; font-size: 30px; letter-spacing: 0; color: var(--text); font-weight: 850 }
.stats span { color: var(--muted); font-size: 13px; font-weight: 650 }

/* ══════════════════ ADMIN ══════════════════ */
.admin-shell { min-height: 100vh; display: grid; grid-template-columns: 196px minmax(0,1fr); background: var(--admin-bg) }
.admin-sidebar {
  border-right: 1px solid rgba(255,255,255,.08);
  background: #18312d;
  padding: 22px 12px 22px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: none;
}
.admin-sidebar::-webkit-scrollbar { width: 0; height: 0 }
.admin-sidebar .brand { display: block; margin: 0 0 22px; padding: 0 10px; font-size: 17px; color: #fff; font-weight: 850 }
.admin-sidebar nav { display: grid; gap: 2px }
.admin-sidebar nav a {
  padding: 9px 10px;
  border-radius: 8px;
  color: rgba(255,255,255,.68);
  font-size: 13px;
  font-weight: 650;
}
.admin-sidebar nav a:hover,
.admin-sidebar nav a.is-active { background: rgba(255,255,255,.12); color: #fff }
.admin-sidebar nav a.view-site {
  margin-top: 14px;
  border-top: 1px solid rgba(255,255,255,.12);
  border-radius: 0;
  padding-top: 18px;
}

.admin-panel { min-width: 0 }
.admin-topbar {
  min-height: 66px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.86);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 28px;
  gap: 16px;
}
.admin-topbar h1 { font-size: 19px; margin: 0; font-weight: 800 }
.admin-topbar form { margin: 0 }
.admin-account { display: flex; align-items: center; gap: 12px; color: var(--text) }
.admin-account span { font-weight: 800; font-size: 14px }
.admin-account small { color: var(--muted); font-size: 13px }

.admin-content { max-width: 1120px; padding: 30px 30px 58px; display: grid; align-content: start; gap: 18px }
.admin-content .flash { margin-top: 0 }
.admin-content > * { margin: 0 }
.admin-content > * + * { margin-top: 18px }
.admin-content > .flash + * { margin-top: 0 }
.admin-content > section,
.admin-content > article,
.admin-content > form:not(.post-editor):not([id]) {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--card);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}
.admin-content > table {
  margin: 0;
}
.admin-content table { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-sm) }
.admin-content th, .admin-content td { font-size: 13px }
.admin-content td > form {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0;
}
.comment-page-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--card);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}
.comment-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.comment-page-header h2 { margin: 0 0 6px; font-size: 18px; font-weight: 800 }
.comment-page-header .muted { margin: 0; }
.comment-page-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.comment-filter-form,
.comment-batch-form-inline { margin: 0 }
.comment-filter-form .actions,
.comment-batch-form-inline .actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap }
.comment-batch-form-inline { display: flex; align-items: center; gap: 12px; flex-wrap: wrap }
.comment-batch-form-inline label { display: inline-flex; align-items: center; gap: 8px; margin: 0; font-size: 13px; font-weight: 700; color: var(--text) }
.comment-page-card table { margin-top: 0 }
.comment-batch-form td:first-child,
.comment-batch-form th:first-child { width: 34px; text-align: center }
.comment-batch-form td:last-child { min-width: 190px }
.admin-content > form:not(.post-editor):not([id]) {
  max-width: 860px;
  margin-bottom: 0;
}
.admin-content > form.grid-2,
.admin-content > form.stack {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit,minmax(160px,1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.dashboard-grid article {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--card);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}
.dashboard-grid strong {
  display: block;
  font-size: 32px;
  line-height: 1;
  font-weight: 850;
  color: var(--text);
}
.dashboard-grid span {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.page-actions { display: flex; justify-content: flex-start; margin-bottom: 16px }
.row-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap }
.row-actions form { margin: 0 }
.row-actions a:not(.button) {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 4px 10px;
  border-radius: var(--radius);
  font-weight: 700;
}
.row-actions a:not(.button):hover { background: var(--accent-soft) }

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--warm-soft);
  color: var(--warm);
  font-size: 12px;
  font-weight: 700;
}

.admin-record-list { display: grid; gap: 10px }
.admin-record-row {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--card);
  padding: 14px;
  box-shadow: var(--shadow-sm);
}
.admin-record-actions { justify-content: flex-end }

.link-edit-form {
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: 10px;
  align-items: end;
}
.link-edit-form .full { grid-column: 1/-1 }
.link-edit-form .check-field { min-height: 32px }

.pagination { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; max-width: 780px; margin: 20px auto; color: var(--muted) }
.pagination span { font-size: 13px }

/* ── Admin Forms ── */
.admin input, .admin textarea, .admin select,
.admin-content input, .admin-content textarea, .admin-content select { font-size: 13px }
.admin-content .inline-form input { width: 220px }
.admin-content .inline-form button { align-self: stretch }
.admin-content .actions select { width: 110px }
.admin-content .actions button { min-height: 32px; padding: 5px 12px; font-size: 13px }
.admin-content button[name=delete],
.admin-content form[action*="/delete"] button:not(.link-danger) {
  color: #b42318;
  border-color: #f5c2bc;
  background: #fff;
}
.admin-content button[name=delete]:hover,
.admin-content form[action*="/delete"] button:not(.link-danger):hover {
  color: #8f1b12;
  border-color: #ee9b91;
  background: #fff3f1;
}
.admin-content form[action="/admin/backup/import"] button {
  color: #7f1d1d;
  border-color: #f5c2bc;
}
.admin-content form[action="/admin/backup/import"] button:hover { background: #fff3f1 }

/* ══════════════════ POST EDITOR ══════════════════ */
.post-editor { display: block; max-width: 1180px; --editor-field-width: 100%; --block-field-width: 720px }
.post-editor-layout {
  display: grid;
  grid-template-columns: minmax(0,760px) 300px;
  gap: 24px;
  align-items: stretch;
  height: max(560px,calc(100vh - 154px));
  min-height: 0;
}
.editor-main {
  display: grid;
  grid-template-rows: auto minmax(0,1fr);
  gap: 10px;
  min-width: 0;
  min-height: 0;
}
.editor-sidebar {
  display: grid;
  align-content: start;
  gap: 10px;
  min-width: 0;
  min-height: 0;
  max-height: none;
  overflow-x: hidden;
  overflow-y: auto;
  padding-right: 6px;
  scrollbar-width: thin;
}
.editor-sidebar section {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow-sm);
}
.editor-sidebar h2 {
  margin: 0 0 2px;
  color: #53615b;
  font-size: 12px;
  font-weight: 850;
}
.editor-sidebar .field {
  gap: 4px;
  font-size: 12px;
  line-height: 1.25;
}
.editor-sidebar input,
.editor-sidebar textarea,
.editor-sidebar select {
  min-height: 32px;
  padding: 6px 9px;
  font-size: 12px;
  line-height: 1.35;
}
.editor-sidebar textarea {
  min-height: 62px;
  line-height: 1.55;
}
.editor-sidebar .check-field {
  min-height: 22px;
  font-size: 12px;
  line-height: 1.25;
}
.editor-sidebar input[type=checkbox] {
  width: 14px;
  height: 14px;
  min-height: 0;
  margin: 0 5px 0 0;
  padding: 0;
}
.editor-sidebar input[name=title] {
  min-height: 34px;
  font-size: 14px;
  line-height: 1.35;
}
.editor-sidebar .muted {
  margin: 0;
  font-size: 12px;
  line-height: 1.55;
}
.editor-sidebar .publish-panel,
.editor-sidebar .attributes-panel {
  grid-template-columns: repeat(2,minmax(0,1fr));
}
.editor-sidebar .publish-panel h2,
.editor-sidebar .attributes-panel h2,
.editor-sidebar .publish-panel .check-field,
.editor-sidebar .attributes-panel .check-field,
.editor-sidebar .attributes-panel .muted {
  grid-column: 1/-1;
}
.field { display: grid; gap: 6px; margin: 0; color: #475569; font-size: 13px; font-weight: 600 }
.field input, .field textarea, .field select { font-weight: 400; color: var(--text) }
.check-field { display: inline-flex; align-items: center; gap: 5px; margin: 0; color: var(--muted); font-size: 14px }
.field-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px 18px; max-width: var(--editor-field-width) }
.post-editor .editor-main > .field { max-width: var(--editor-field-width) }
.post-editor .block-toolbar, .post-editor .blocks { max-width: 100% }
.post-editor > section > button { justify-self: start }
.post-editor input[name=title] { font-size: 18px; min-height: 38px; font-weight: 700 }
.post-editor .editor-sidebar input[name=title] { min-height: 34px; font-size: 14px; line-height: 1.35 }
.post-editor .editor-main > .field input,
.post-editor .editor-main > .field textarea,
.post-editor .editor-main > .field select { width: 100%; max-width: none }
.field-grid input, .field-grid textarea, .field-grid select { width: 100%; max-width: none }

.block-toolbar {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  overflow: visible;
  max-width: 100%;
  position: static;
  background: rgba(255,255,255,.9);
  backdrop-filter: blur(16px);
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  z-index: 8;
  box-shadow: var(--shadow);
  margin-bottom: 0;
}
.block-toolbar button {
  flex: 0 0 auto;
  min-height: 30px;
  padding: 3px 9px;
  font-size: 12px;
  box-shadow: none;
}
.block-toolbar button[data-add-block="paragraph"],
.block-toolbar button[data-add-block="heading"],
.block-toolbar button[data-add-block="image"] {
  border-color: #a9c7be;
  background: #f7fbf9;
  color: #0b5f59;
}

.blocks {
  display: grid;
  gap: 6px;
  margin: 0;
  overflow-x: hidden;
  overflow-y: auto;
  min-height: 0;
  padding-right: 6px;
  counter-reset: editor-block;
  scrollbar-width: thin;
}
.block {
  counter-increment: editor-block;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 10px;
  background: var(--card);
  box-shadow: var(--shadow-sm);
}
.block.is-sorting { box-shadow: var(--shadow-md); transform: rotate(.3deg); opacity: .96 }
.block-placeholder { border: 1px dashed #cbd5e1; border-radius: var(--radius); background: var(--soft); margin: 0 }
.block-head { display: flex; justify-content: space-between; gap: 6px; align-items: center; margin-bottom: 4px; min-height: 28px }
.block-head strong { font-size: 12px; color: var(--muted); font-weight: 700 }
.block-head strong::before {
  content: counter(editor-block, decimal-leading-zero);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 20px;
  margin-right: 5px;
  border-radius: 999px;
  background: var(--soft);
  color: #53615b;
  font-size: 11px;
  font-weight: 850;
}
.block-head-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  flex-wrap: wrap;
}
.block-head-actions button { min-height: 24px; padding: 1px 7px; font-size: 11px }
.block-head-actions .icon-button {
  width: 24px;
  min-width: 24px;
  padding: 0;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1;
}
.block-head-actions .danger-icon {
  color: #9f1239;
  border-color: #f5c2bc;
}
.block-head-actions .danger-icon:hover {
  background: #fff1f4;
}
.drag-handle { cursor: grab; touch-action: none }
.drag-handle:active { cursor: grabbing }
.inline-toolbar { display: flex; gap: 4px; margin: 2px 0 5px; flex-wrap: wrap }
.inline-toolbar button { min-height: 24px; padding: 2px 7px; font-size: 11px }
.file-field { display: flex; align-items: center; gap: 10px; margin: 10px 0; color: var(--muted); font-size: 13px; font-weight: 600 }
.file-field span { width: 72px }
.block textarea {
  width: 100%;
  max-width: var(--block-field-width);
  min-height: 34px;
  overflow: hidden;
}
.block .code-textarea {
  font-family: "SF Mono", "Fira Code", "Cascadia Code", Consolas, monospace;
  font-size: 12px;
  line-height: 1.55;
  tab-size: 4;
}
.block .field { max-width: var(--block-field-width) }
.block .field input, .block .field select, .block .field textarea { width: 100%; max-width: none }
.block input[type=file] { padding: 5px }
.thumb { max-width: 180px; display: block; margin-top: 10px; border: 1px solid var(--line); border-radius: 8px }

.asset-panel { display: grid; gap: 6px; max-width: var(--block-field-width); margin: 6px 0; padding: 8px 9px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--soft) }
.asset-panel-head { display: grid; gap: 2px }
.asset-panel-head strong { font-size: 12px; color: var(--text) }
.asset-panel-head p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.45 }
.asset-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
.asset-actions button { min-height: 24px; padding: 2px 8px; font-size: 11px; box-shadow: none }
.asset-actions button[data-clear-mood-files],
button[data-remove-nav-row] {
  color: #7f1d1d;
  border-color: #f5c2bc;
}
button[data-remove-nav-row]:hover { background: #fff3f1 }
.asset-slots { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 6px }
.asset-slot { display: grid; gap: 6px; padding: 8px 9px; border: 1px dashed #cbd5e1; border-radius: var(--radius); background: var(--card) }
.asset-slot-head { display: flex; align-items: center; justify-content: space-between; gap: 8px }
.asset-slot-head strong { font-size: 12px; color: var(--text) }
.asset-slot-head span { font-size: 11px; color: var(--muted) }
.asset-empty { margin: 0; color: var(--muted); font-size: 13px }
.block > .muted { margin: 4px 0 0; font-size: 11px; line-height: 1.45 }

.term-picker { max-width: var(--editor-field-width); display: grid; gap: 8px }
.editor-sidebar .term-picker { max-width: none; min-width: 0; gap: 5px }
.term-suggestions { display: flex; gap: 8px; flex-wrap: wrap }
.term-suggestions button { min-height: 28px; padding: 4px 12px; border-radius: 999px; font-size: 13px }
.editor-sidebar .term-suggestions {
  gap: 4px;
  max-height: 24px;
  overflow: hidden;
}
.editor-sidebar .term-suggestions button { min-height: 22px; padding: 1px 7px; font-size: 11px }

.trash-section { margin-bottom: 28px }
.trash-section h2 { font-size: 18px; margin: 0 0 10px }

.user-create-form { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; align-items: end; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px; margin-bottom: 18px }
.user-list { display: grid; gap: 12px; margin-top: 18px }
.user-row { display: block; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--card) }
.user-edit-form { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; align-items: end }

/* ══════════════════ ARTICLE ══════════════════ */
.article { max-width: 780px; margin-inline: auto; font-size: 17px; line-height: 1.9 }
.article header { border-bottom: 1px solid rgba(32,38,36,.09); margin-bottom: 26px; padding-bottom: 18px }
.article p { margin: 1.3em 0 }
.article figure { margin: 32px 0 }
.article figcaption { text-align: center; color: var(--muted); font-size: 14px; margin-top: 10px }
.article img { border-radius: var(--radius); box-shadow: var(--shadow-sm) }
.article video { width: 100%; max-height: 70vh; background: #111816; border-radius: var(--radius) }
.article-list { padding-left: 1.4em }
.article h1, .article h2, .article h3 { margin-top: 2em; margin-bottom: 1em }
.article h1 { font-size: 40px; line-height: 1.18; margin: 0 0 14px; letter-spacing: 0; font-weight: 850 }
.article h2 { font-size: 27px; line-height: 1.32; font-weight: 800; letter-spacing: 0 }
.article h3 { font-size: 21px; line-height: 1.4; font-weight: 800 }
.article .summary { color: #4f5c57; font-size: 18px; line-height: 1.8 }
.article a { text-decoration: underline; text-decoration-color: rgba(15,118,110,.28); text-underline-offset: 3px }
.article a:hover { text-decoration-color: var(--accent) }

.article-gallery { display: grid; grid-template-columns: repeat(6,1fr); gap: 6px; margin: 32px 0 }
.article-gallery a { border: 0 }
.article-gallery a:first-child { grid-column: span 3; grid-row: span 2 }
.article-gallery a:nth-child(2), .article-gallery a:nth-child(3) { grid-column: span 3 }
.article-gallery a:nth-child(n+4) { grid-column: span 2 }
.article-gallery img {
  width: 100%; height: 100%; min-height: 132px;
  aspect-ratio: 1/1; object-fit: cover;
  border: 1px solid var(--line); background: var(--soft);
  border-radius: 6px;
  transition: opacity .2s ease, transform .2s ease;
}
.article-gallery a:first-child img { aspect-ratio: 4/3 }
.article-gallery img:hover { opacity: .85; transform: scale(1.01) }

blockquote {
  margin: 28px 0;
  padding: 16px 18px 16px 22px;
  border-left: 3px solid var(--accent);
  color: #42504a;
  background: var(--accent-soft);
  border-radius: 0 var(--radius) var(--radius) 0;
}
blockquote p { margin: .5em 0 }
blockquote cite { display: block; margin-top: 14px; font-size: 14px; color: var(--muted); font-style: normal; font-weight: 500 }
blockquote cite::before { content: "- "; }

.code-figure {
  margin: 24px 0;
  border: 1px solid #2a3547;
  border-radius: var(--radius);
  overflow: hidden;
  background: #111827;
  box-shadow: 0 6px 18px rgba(27,39,55,.08);
}
.code-figure figcaption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 36px;
  gap: 10px;
  margin: 0;
  padding: 5px 10px 5px 12px;
  border-bottom: 1px solid rgba(148,163,184,.13);
  background: #151e2e;
  color: #aebbcf;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: .01em;
  text-align: left;
}
.code-figure figcaption button {
  min-height: 24px;
  padding: 2px 8px;
  border-color: #36445a;
  border-radius: 6px;
  background: #202c40;
  color: #d7e0ec;
  box-shadow: none;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}
.code-figure figcaption button:hover { background: #2b3a52; border-color: #465974; color: #f8fafc; box-shadow: none }
.code-figure figcaption button:active { transform: scale(.98) }
.code-figure figcaption button:disabled { opacity: .78; cursor: default }
.code-figure-body {
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: #526174 #111827;
}
.code-figure-body::-webkit-scrollbar { height: 7px }
.code-figure-body::-webkit-scrollbar-track { background: #111827 }
.code-figure-body::-webkit-scrollbar-thumb { border-radius: 6px; background: #526174 }
.code-lines {
  margin: 0;
  padding: 8px 0;
  list-style: none;
}
.code-lines li {
  display: grid;
  grid-template-columns: 3em minmax(0,1fr);
  gap: 0;
  align-items: start;
  min-width: max-content;
  padding: 0 12px 0 8px;
  color: #dce4ef;
  font-size: 13.5px;
  line-height: 1.62;
}
.code-lines li:hover { background: rgba(148,163,184,.055) }
.code-line-number {
  color: #65758b;
  text-align: right;
  padding-right: 12px;
  user-select: none;
}
.code-lines code {
  font-family: "SF Mono", "Fira Code", "Cascadia Code", Consolas, monospace;
  font-weight: 400;
  white-space: pre;
  overflow-wrap: normal;
  display: block;
  tab-size: 4;
}
.code-lines .hljs-comment,
.code-lines .hljs-quote { color: #7f8ea3; font-style: italic }
.code-lines .hljs-keyword,
.code-lines .hljs-selector-tag,
.code-lines .hljs-literal,
.code-lines .hljs-section,
.code-lines .hljs-link { color: #ff7b72 }
.code-lines .hljs-string,
.code-lines .hljs-attr,
.code-lines .hljs-addition,
.code-lines .hljs-symbol,
.code-lines .hljs-bullet { color: #a5d6ff }
.code-lines .hljs-number,
.code-lines .hljs-regexp,
.code-lines .hljs-selector-id,
.code-lines .hljs-selector-class { color: #79c0ff }
.code-lines .hljs-title,
.code-lines .hljs-title.class_,
.code-lines .hljs-title.function_ { color: #d2a8ff }
.code-lines .hljs-built_in,
.code-lines .hljs-type,
.code-lines .hljs-variable,
.code-lines .hljs-template-variable { color: #ffa657 }
.code-lines .hljs-meta,
.code-lines .hljs-doctag { color: #7ee787 }
.code-lines .hljs-deletion { color: #ffa198; background: rgba(248,81,73,.12) }
.code-lines .hljs-emphasis { font-style: italic }
.code-lines .hljs-strong { font-weight: 700 }

hr { border: 0; border-top: 1px solid var(--line); margin: 32px 0 }
.attachment { border: 1px solid var(--line); padding: 14px 16px; border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow-sm) }

/* ── Comments ── */
.comments {
  max-width: 780px;
  margin: 46px auto 0;
  border-top: 1px solid var(--line);
  padding-top: 26px;
}
.comments h2 { font-size: 24px; margin: 0 0 22px; font-weight: 800 }
.comments article { border-bottom: 1px solid var(--line); padding: 20px 0 }
.links article { border-bottom: 1px solid var(--line); padding: 16px 0 }
.comment-list { display: grid; gap: 0 }
.comment-item header { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; color: var(--muted); font-size: 14px }
.comment-item header strong { color: var(--text); font-size: 16px; font-weight: 800 }
.comment-author-link { color: inherit; text-decoration: none }
.comment-author-link:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px }
.comment-item time { font-size: 13px }
.comment-item p {
  margin: 10px 0 0;
  color: var(--text);
  font-size: 16px;
  line-height: 1.8;
}
.comment-children {
  margin: 18px 0 0 28px;
  padding-left: 18px;
  border-left: 2px solid #cfdcd5;
}
.link-button {
  min-height: 26px;
  padding: 2px 8px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
  font-size: 13px;
  font-weight: 700;
}
.link-button:hover { background: transparent; color: var(--accent); text-decoration: underline }
.comment-form textarea { min-height: 132px; font-size: 15px; line-height: 1.75 }
.comment-form input { font-size: 14px }
.comment-form button { justify-self: start }

.reply-notice {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-weight: 500;
}
.reply-notice[hidden] { display: none }
.reply-notice button { min-height: 28px; padding: 3px 10px }

/* ── Lightbox ── */
body.lightbox-open { overflow: hidden }
.lightbox {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.88);
  display: flex; align-items: center; justify-content: center;
  padding: 24px; z-index: 1000;
  pointer-events: auto;
  animation: fadeIn .25s ease;
}
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
.lightbox img, .lightbox video { max-height: 92vh; max-width: 92vw; border-radius: 6px }
.live-lightbox { background: rgba(0,0,0,.94) }
.live-lightbox-stage {
  --live-photo-aspect: 4 / 3;
  --live-photo-ratio: 1.333333;
  width: min(92vw, 900px, calc(92vh * var(--live-photo-ratio)));
  max-height: 92vh;
}
.live-photo-trigger {
  position: relative;
  display: block;
  width: 100%;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: var(--radius);
  background: var(--soft);
  box-shadow: none;
}
.live-photo-trigger:hover {
  background: var(--soft);
  border-color: transparent;
  box-shadow: var(--shadow);
  transform: none;
}
.live-photo-trigger img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.live-photo-trigger .live-photo-mark {
  position: absolute;
  left: 10px;
  top: 10px;
  z-index: 2;
  display: block;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  pointer-events: none;
}
.live-photo-trigger span.live-photo-mark {
  visibility: hidden;
}
.live-photo-player {
  width: 100%;
  aspect-ratio: 4/3;
  min-height: 220px;
  overflow: hidden;
  background: #111816;
  border-radius: var(--radius);
}
.live-photo-player img,
.live-photo-player video {
  border-radius: 0;
  box-shadow: none;
}
.live-photo noscript img {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.live-lightbox-player {
  aspect-ratio: var(--live-photo-aspect);
  max-height: 92vh;
  min-height: 0;
}

/* ══════════════════ MOODS ══════════════════ */
.mood-card { border: 1px solid var(--line); background: var(--card); border-radius: var(--radius-lg); padding: 18px; box-shadow: var(--shadow-sm) }
.mood-card header { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 13px; font-weight: 500 }
.mood-feed { display: grid; gap: 0; max-width: 780px; margin-inline: auto }
.mood-entry { display: grid; grid-template-columns: 46px minmax(0,1fr); gap: 16px; padding: 24px 0; border-bottom: 1px solid var(--line); scroll-margin-top: 80px }
.mood-avatar { width: 46px; height: 46px; border-radius: 50%; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 850; font-size: 16px }
.mood-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50% }
.mood-body { min-width: 0 }
.mood-body header { display: flex; align-items: center; gap: 10px; margin: 0 0 8px }
.mood-body header strong { font-size: 15px; font-weight: 700 }
.mood-author-link { color: inherit; text-decoration: underline; text-decoration-color: rgba(15,118,110,.38); text-underline-offset: 3px }
.mood-author-link:hover { color: var(--accent); text-decoration-color: var(--accent) }
.mood-body p { margin: 0 0 12px; color: var(--text); white-space: normal; word-break: break-word; line-height: 1.75 }
.mood-body time { display: block; margin-top: 10px; color: var(--muted); font-size: 13px; font-weight: 500 }
.mood-meta-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 10px }
.mood-meta-row time { margin-top: 0 }
.mood-actions { display: flex; align-items: center; gap: 2px }
.mood-actions form { margin: 0 }
.mood-action-button {
  min-height: 30px;
  padding: 3px 8px;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  border-radius: 6px;
  box-shadow: none;
  font-size: 12px;
  font-weight: 650;
}
.mood-action-button:hover { color: var(--accent); border-color: transparent; background: var(--accent-soft); box-shadow: none; transform: none }
.mood-action-button:active { transform: scale(.97) }
.mood-action-button.is-active { color: var(--accent); background: var(--accent-soft) }
.mood-action-button:disabled { cursor: wait; opacity: .62 }
.mood-action-status {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}
.mood-action-button [hidden],
.mood-social[hidden],
.mood-comment-list[hidden],
.mood-comment-form[hidden],
.mood-comment-status[hidden] { display: none }
.mood-social { margin-top: 8px; border-radius: 8px; background: var(--soft); overflow: hidden }
.mood-comment-list { padding: 8px 12px }
.mood-body .mood-comment { margin: 0; color: var(--text); font-size: 13px; line-height: 1.65; white-space: normal }
.mood-body .mood-comment + .mood-comment { margin-top: 3px }
.mood-comment strong { color: var(--accent-hover); font-weight: 700 }
.mood-comment a { color: inherit }
.mood-reply-button {
  min-height: 24px;
  margin-left: 6px;
  padding: 0 4px;
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 4px;
  box-shadow: none;
  font-size: 11px;
  font-weight: 600;
  vertical-align: baseline;
}
.mood-reply-button:hover { color: var(--accent); background: rgba(15,118,110,.08); border: 0; box-shadow: none; transform: none }
.mood-comment-form {
  display: grid;
  gap: 7px;
  padding: 8px;
  border-top: 1px solid rgba(32,38,36,.08);
}
.mood-body .mood-comment-identity {
  margin: 0;
  padding: 0 2px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.55;
}
.mood-comment-fields { display: grid; grid-template-columns: minmax(90px,.8fr) minmax(130px,1fr) minmax(150px,1.2fr); gap: 7px }
.mood-comment-compose { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 7px }
.mood-comment-form input,
.mood-comment-form textarea {
  min-height: 34px;
  padding: 6px 9px;
  border-color: transparent;
  background: var(--card);
  font-size: 13px;
  line-height: 1.55;
}
.mood-comment-form textarea { resize: none; max-height: 104px }
.mood-comment-form button { min-height: 34px; padding: 5px 11px; box-shadow: none }
.mood-body .mood-reply-notice {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}
.mood-reply-notice[hidden] { display: none }
.mood-reply-notice button { min-height: 24px; padding: 0 5px; border: 0; background: transparent; color: var(--accent); box-shadow: none; font-size: 12px }
.mood-reply-notice button:hover { border: 0; background: var(--accent-soft); box-shadow: none; transform: none }
.mood-body .mood-comment-status { grid-column: 1 / -1; margin: 0; padding: 0 2px; color: var(--muted); font-size: 12px; line-height: 1.5 }
.mood-body .mood-comment-status.is-error { color: #b42318 }
.mood-grid { display: grid; grid-template-columns: repeat(3,minmax(0,112px)); gap: 6px; margin: 10px 0 }
.mood-grid.count-1 { grid-template-columns: minmax(0,240px) }
.mood-grid.count-2 { grid-template-columns: repeat(2,minmax(0,140px)) }
.mood-tile { position: relative; display: block; width: 112px; aspect-ratio: 1/1; border: 0; background: var(--soft); overflow: hidden; border-radius: 8px }
.mood-grid.count-1 .mood-tile { width: 240px; max-height: 300px }
.mood-grid.count-2 .mood-tile { width: 140px }
.mood-grid .selected-file { display: block; padding: 0; border: 0; max-width: none }
.mood-selected-files .mood-tile { cursor: grab; touch-action: none }
.mood-selected-files .mood-tile:active { cursor: grabbing }
.mood-tile img, .mood-tile video { width: 100%; height: 100%; object-fit: cover; display: block }
.mood-tile > span:not(.picker-live-badge):not(.live-photo-mark) {
  position: absolute; left: 6px; bottom: 6px;
  background: rgba(0,0,0,.65); color: #fff;
  border-radius: 999px; padding: 3px 10px; font-size: 12px;
  backdrop-filter: blur(4px);
  font-weight: 500;
}
.mood-tile .picker-live-badge {
  position: absolute;
  left: 6px;
  top: 6px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(0,0,0,.66);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0;
}
.album-tile .picker-live-badge { top: 38px }
.mood-tile b {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 24px 10px 8px;
  background: linear-gradient(transparent,rgba(0,0,0,.7));
  color: #fff; font-size: 11px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-weight: 500;
}
.tile-remove {
  position: absolute; right: 6px; top: 6px; z-index: 2;
  width: 26px; height: 26px; min-height: 0; padding: 0;
  border: 1px solid rgba(255,255,255,.7);
  border-radius: 50%;
  background: rgba(0,0,0,.55);
  color: #fff; line-height: 1;
  backdrop-filter: blur(6px);
}
.tile-remove:hover { background: rgba(0,0,0,.75) }

.mood-tile.live-photo-trigger {
  width: 112px;
  border-radius: 8px;
}
.mood-grid.count-1 .mood-tile.live-photo-trigger { width: 240px }
.mood-grid.count-2 .mood-tile.live-photo-trigger { width: 140px }
.mood-tile.live-photo-trigger img {
  height: 100%;
  aspect-ratio: auto;
  border: 0;
  border-radius: 0;
}
.mood-file-card {
  display: grid;
  grid-template-rows: minmax(0,1fr) auto;
  gap: 0;
  padding: 4px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  text-decoration: none;
  box-shadow: none;
}
.mood-file-card:hover { color: var(--text) }
.mood-file-preview {
  display: grid;
  min-height: 0;
  place-items: center;
  border-radius: 6px;
  background: var(--soft);
}
.mood-file-format {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 30px;
  padding: 0 6px;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .04em;
  line-height: 1;
}
.mood-file-details { display: grid; gap: 3px; min-width: 0; padding: 7px 5px 4px; text-align: left }
.mood-file-details strong { overflow: hidden; color: inherit; font-size: 11px; font-weight: 700; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap }
.mood-grid.count-1 .mood-file-card {
  display: grid;
  grid-template-columns: none;
  grid-template-rows: minmax(0,1fr) auto;
  align-items: stretch;
  gap: 0;
  min-height: 0;
  aspect-ratio: 1/1;
  padding: 5px;
}
.mood-grid.count-1 .mood-file-format {
  min-width: 52px;
  height: 52px;
  padding: 0 9px;
  font-size: 11px;
}
.mood-grid.count-1 .mood-file-details { gap: 5px; padding: 10px 7px 7px }
.mood-grid.count-1 .mood-file-details strong { font-size: 14px }
.term-create-form { display: grid; grid-template-columns: minmax(0,1.2fr) minmax(0,1fr) auto; gap: 10px; align-items: end; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 14px; margin-bottom: 10px }
.term-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.term-table th,
.term-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.term-table thead th {
  background: #f8faf8;
  color: #53615b;
  font-size: 12px;
  font-weight: 800;
  text-transform: none;
}
.term-table tbody tr:hover { background: #fbfdfb }
.term-table tbody tr:last-child td { border-bottom: 0 }
.term-table td input {
  width: 100%;
  min-height: 36px;
  padding: 6px 10px;
  border-radius: 8px;
}
.term-table .term-meta {
  white-space: nowrap;
  font-size: 12px;
}
.term-actions-cell {
  width: 240px;
  white-space: nowrap;
  text-align: right;
}
.term-inline-form,
.term-delete-form { display: inline }
.term-actions-cell button {
  min-height: 34px;
  padding: 5px 12px;
  margin-left: 8px;
}

.mood-live-list { display: flex; gap: 8px; flex-wrap: wrap }
.mood-live-chip {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--soft); padding: 4px 12px;
  color: var(--muted); font-size: 12px;
  font-weight: 500;
}
.mood-live-chip button { width: 22px; height: 22px; min-height: 0; padding: 0; border-radius: 50%; font-size: 12px }

.nav-builder { display: grid; gap: 12px; max-width: 760px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--card); padding: 16px }
.nav-builder-rows { display: grid; gap: 10px }
.nav-builder-row { display: grid; grid-template-columns: 1fr 1.6fr auto; gap: 10px; align-items: center }

.admin-gallery { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px }
.admin-gallery img { width: 72px; height: 72px; object-fit: cover; border: 1px solid var(--line); border-radius: 6px }

/* ══════════════════ ALBUMS ══════════════════ */
.album-list {
  display: grid;
  grid-template-columns: repeat(auto-fill,minmax(220px,1fr));
  gap: 16px;
  max-width: 780px;
  margin-inline: auto;
}
.album-list-item { display: grid; align-content: start; gap: 6px }
.album-list-card {
  display: grid;
  gap: 10px;
  color: var(--text);
}
.album-cover-link,
.album-title-link { color: inherit }
.album-list-card img,
.album-cover-empty {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--soft);
  box-shadow: var(--shadow-sm);
}
.album-list-card:hover img { box-shadow: var(--shadow); transform: translateY(-1px) }
.album-cover-empty {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
}
.album-cover-locked {
  position: relative;
  overflow: hidden;
  color: #53615b;
  background:
    linear-gradient(135deg, rgba(15,118,110,.12), rgba(180,83,9,.08)),
    var(--soft);
}
.album-cover-locked::before {
  content: "";
  position: absolute;
  inset: 12px;
  border: 1px dashed #b9cbc2;
  border-radius: 6px;
}
.album-list-card strong,
.album-list-card small { display: block }
.album-list-card strong { font-size: 17px; font-weight: 800 }
.album-list-card small { color: var(--muted); font-size: 13px }
.album-author-link { width: fit-content; color: var(--muted); font-size: 13px; font-weight: 650; text-decoration: underline; text-decoration-color: rgba(15,118,110,.38); text-underline-offset: 3px }
.album-author-link:hover { color: var(--accent); text-decoration-color: var(--accent) }
.album-list-card .pill {
  width: fit-content;
  margin: 5px 0;
}
.album-detail { max-width: 780px; margin-inline: auto }
.album-detail header { margin-bottom: 24px }
.album-detail h1 { margin: 0 0 10px; font-size: 38px; line-height: 1.2 }
.photo-wall {
  column-count: 3;
  column-gap: 10px;
  max-width: 780px;
  margin-inline: auto;
}
.photo-wall a,
.photo-wall .live-photo-trigger {
  display: block;
  break-inside: avoid;
  margin-bottom: 10px;
  border: 0;
}
.photo-wall img {
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease;
}
.photo-wall img:hover {
  opacity: .9;
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}
.album-editor {
  display: grid;
  gap: 12px;
  max-width: 860px;
  margin-bottom: 20px;
}
.album-composer,
.album-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--card);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}
.admin-albums { display: grid; gap: 16px }
.album-selected-files {
  display: grid;
  grid-template-columns: repeat(auto-fill,minmax(118px,1fr));
  gap: 8px;
  max-width: 760px;
}
.album-selected-files .asset-empty { grid-column: 1/-1 }
.album-tile {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1/1;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--soft);
  padding: 0;
}
.album-selected-files .album-tile { cursor: grab; touch-action: none }
.album-selected-files .album-tile:active { cursor: grabbing }
.album-selected-files .album-tile.is-sorting { box-shadow: var(--shadow-md); transform: rotate(.4deg); opacity: .96 }
.mood-placeholder,
.album-placeholder { display: block; border: 1px dashed #cbd5e1; background: var(--soft); aspect-ratio: 1/1 }
.album-selected-files .album-tile img,
.album-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border: 0;
  border-radius: 0;
  max-width: none;
}
.album-tile b {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 24px 8px 7px;
  background: linear-gradient(transparent,rgba(0,0,0,.72));
  color: #fff;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.album-cover-toggle {
  position: absolute;
  left: 6px;
  top: 6px;
  z-index: 2;
  min-height: 26px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,.9);
  font-size: 11px;
  box-shadow: none;
}

/* ══════════════════ FILE LIBRARY ══════════════════ */
.file-library-tools {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  align-items: end;
  gap: 12px;
  margin-bottom: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--card);
  box-shadow: var(--shadow-sm);
}
.file-filter-form, .file-upload-form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap }
.file-filter-form input { width: 240px }
.file-filter-form select { width: 120px }
.file-upload-form input { width: 260px }
.library-dropzone {
  grid-column: 1/-1;
  display: grid;
  gap: 3px;
  padding: 12px 14px;
  border: 1px dashed #b9cbc2;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(15,118,110,.06), rgba(180,83,9,.05));
  color: #53615b;
}
.library-dropzone strong { font-size: 13px; font-weight: 800 }
.library-dropzone p { margin: 0; font-size: 12px; line-height: 1.45 }
.library-dropzone.is-dragover {
  border-color: var(--accent);
  background: linear-gradient(135deg, rgba(15,118,110,.12), rgba(180,83,9,.08));
  box-shadow: 0 0 0 2px rgba(15,118,110,.1) inset;
}
.file-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(150px,1fr)); gap: 14px }
.file-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 12px; display: grid; gap: 5px; min-width: 0; transition: box-shadow .2s }
.file-card:hover { box-shadow: var(--shadow) }
.file-card img, .file-card video, .picker-file img { width: 100%; aspect-ratio: 1/1; object-fit: cover; background: var(--soft); border-radius: 6px }
.file-card small { color: var(--muted); font-size: 12px; line-height: 1.45 }
.file-card details { font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 6px; margin-top: 4px }
.file-card summary { cursor: pointer; font-weight: 650 }
.file-card strong {
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.picker-file span { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.file-card span { font-size: 12px; color: var(--muted) }
.file-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 5px }
.file-actions .button, .file-actions button { min-height: 32px; padding: 4px 10px; font-size: 13px }
.file-actions button[data-copy-url] {
  border-color: #a9c7be;
  background: #f7fbf9;
  color: #0b5f59;
}
.file-actions form { margin: 0 }
.file-refs { font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 6px; margin-top: 4px }
.file-refs summary { cursor: pointer; font-weight: 500 }
.file-refs a { display: block; border: 0; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.unused-file { color: #16a34a !important }
.file-icon { display: flex; align-items: center; justify-content: center; aspect-ratio: 1/1; background: var(--soft); color: var(--muted); font-size: 13px; border: 1px solid var(--line); border-radius: var(--radius-lg) }

/* ── File Picker Modal ── */
.file-picker {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 40;
  display: flex;
  align-items: center; justify-content: center;
  padding: 24px;
  backdrop-filter: blur(6px);
}
.file-picker-panel {
  width: min(920px,96vw);
  max-height: 88vh; overflow: auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: 0 24px 80px rgba(0,0,0,.12);
}
.file-picker-panel header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px }
.file-picker-panel footer { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line) }
.picker-upload { display: flex; gap: 8px; margin-bottom: 14px }
.picker-upload input { max-width: 360px }
.picker-hint { margin: 0 0 12px }
.file-picker-panel .library-dropzone { margin: 0 0 12px }
.file-picker-panel .library-dropzone p { color: var(--muted) }
.picker-files { display: grid; grid-template-columns: repeat(auto-fill,minmax(130px,1fr)); gap: 12px }
.picker-file { display: grid; height: auto; padding: 8px; text-align: left; gap: 6px; min-width: 0; position: relative; border-radius: 8px; transition: all .2s }
.picker-file.is-selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent) inset }
.picker-file.is-selected::after {
  content: "\5DF2\9009\62E9";
  position: absolute; top: 8px; right: 8px;
  background: var(--accent); color: #fff;
  border-radius: 999px; font-size: 11px; padding: 3px 10px;
  font-weight: 600;
}

.selected-files { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px }
.selected-file {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--card); padding: 6px 10px; max-width: 280px;
}
.selected-file img, .file-mini-icon { width: 34px; height: 34px; object-fit: cover; border: 1px solid var(--line); background: var(--soft); flex: 0 0 auto; border-radius: 6px }
.file-mini-icon { display: inline-flex; align-items: center; justify-content: center; font-size: 11px; color: var(--muted) }
.selected-file span:last-child { display: grid; min-width: 0; font-size: 12px; color: var(--muted) }
.selected-file b { font-size: 12px; color: var(--text); font-weight: 600 }
.selected-file span:last-child:not(.file-mini-icon) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.selected-gallery { display: flex; gap: 8px; flex-wrap: wrap }
.album-selected-files .selected-file { display: block; max-width: none; padding: 0 }
.album-selected-files .selected-file img { width: 100%; height: 100%; flex: none }

.live-photo-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; max-width: 720px; margin: 12px 0 }
.live-photo-pair div { border: 1px dashed #cbd5e1; border-radius: var(--radius); padding: 12px; background: var(--soft) }
.live-photo-pair div.is-ready { border-style: solid; border-color: #94a3b8; background: var(--card) }
.live-photo-pair strong { display: block; font-size: 13px }
.live-photo-pair span { display: block; color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.live-photo-pair p { grid-column: 1/-1; margin: 0; font-size: 13px }
.live-photo-pair .is-ready { color: #16a34a }
.live-photo-pair .is-missing { color: #d97706 }

.editor-sidebar section.editor-actions {
  position: sticky;
  top: 0;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(12px);
}
.editor-sidebar .editor-actions .primary {
  grid-column: 1/-1;
}
.editor-sidebar .editor-actions button {
  width: 100%;
  min-height: 34px;
  padding: 6px 10px;
  font-size: 12px;
}

/* ── Post Preview ── */
.post-preview {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 50;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  backdrop-filter: blur(6px);
}
.post-preview-panel {
  width: min(860px,96vw);
  max-height: 90vh; overflow: auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  box-shadow: 0 24px 80px rgba(0,0,0,.12);
}
.post-preview-panel > header {
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px; margin-bottom: 20px;
}

/* ── Block Delete Confirm ── */
.block-delete-confirm {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0,0,0,.38);
  backdrop-filter: blur(6px);
  z-index: 51;
}
.block-delete-confirm-panel {
  width: min(420px, 96vw);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  box-shadow: 0 24px 80px rgba(0,0,0,.12);
}
.block-delete-confirm-panel > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.block-delete-confirm-panel strong {
  font-size: 16px;
  color: var(--text);
}
.block-delete-confirm-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
  font-size: 14px;
}
.block-delete-confirm-panel footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}
.block-delete-confirm-panel .danger {
  background: #b91c1c;
  border-color: #b91c1c;
  color: #fff;
}
.block-delete-confirm-panel .danger:hover {
  background: #991b1b;
  border-color: #991b1b;
  color: #fff;
}

/* ══════════════════ SYSTEM DARK THEME ══════════════════ */
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --text: #e7eee9;
    --muted: #a9b7b0;
    --line: #34453d;
    --bg: #111815;
    --soft: #1b2823;
    --accent: #70d2c4;
    --accent-hover: #91e0d5;
    --accent-soft: #19372f;
    --warm: #e7aa62;
    --warm-soft: #382919;
    --admin-bg: #111815;
    --card: #17211d;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.24);
    --shadow: 0 10px 28px rgba(0,0,0,.26);
    --shadow-md: 0 18px 44px rgba(0,0,0,.32);
    --shadow-lg: 0 28px 76px rgba(0,0,0,.4);
  }

  body {
    background:
      linear-gradient(135deg, rgba(73,167,153,.09) 0, transparent 280px),
      linear-gradient(180deg, #141d19 0, #111916 380px, var(--bg) 760px);
  }

  button,
  .button {
    background: var(--card);
    color: var(--text);
  }
  button:hover,
  .button:hover {
    background: #202e28;
    border-color: #4c6258;
  }
  .primary,
  .header-search button,
  .password-lock-form button,
  .category-cloud a:hover .count-badge,
  .mood-avatar {
    background: #216f67;
    border-color: #216f67;
    color: #f2faf7;
  }
  .primary:hover,
  .header-search button:hover,
  .password-lock-form button:hover {
    background: #2a8279;
    border-color: #2a8279;
    color: #f2faf7;
  }
  .danger {
    background: #2d1b1b;
    border-color: #79413e;
    color: #ffb4ab;
  }
  .danger:hover,
  .link-danger:hover {
    background: #3a211f;
    border-color: #99534f;
    color: #ffc7c0;
  }
  .link-danger { color: #ffb4ab; }

  .site-header { border-bottom-color: rgba(220,238,229,.11); }
  .site-footer { border-top-color: rgba(220,238,229,.11); }
  .header-search input { background: rgba(23,33,29,.9); }
  .home-discovery { border-left-color: rgba(220,238,229,.13); }
  .home-discovery section { border-bottom-color: rgba(220,238,229,.11); }
  .home-discovery h2,
  .count-badge,
  th { color: #b8c7c0; }
  .recent-comments a,
  .archive-months a { border-bottom-color: rgba(220,238,229,.08); }
  .post-list article,
  .home-posts article,
  .article header,
  .comment-form,
  .comments > form,
  .mood-comment-form { border-color: rgba(220,238,229,.12); }
  .home-posts article:hover { border-color: rgba(112,210,196,.36); }
  .post-list .post-summary p,
  .article .summary,
  blockquote { color: #c3d0ca; }
  .post-list time { color: #9eaca6; }
  .term-cloud a,
  .term-links a,
  .article-terms a,
  .link-exchange,
  .friend-link { background: rgba(23,33,29,.82); }

  .site-notice,
  .flash {
    border-color: #39786e;
    color: #b9eee5;
  }
  .site-notice--notice {
    border-color: #76552f;
    color: #f3c78f;
  }
  .site-notice--error {
    background: #391f1d;
    border-color: #824641;
    color: #ffc0b8;
  }
  .empty-state,
  .link-grid:empty {
    border-color: #496057;
    background: rgba(23,33,29,.62);
  }
  input,
  textarea,
  select { background: var(--card); }
  input::placeholder,
  textarea::placeholder { color: #829089; opacity: 1; }
  label { color: #c0cdc7; }
  .password-lock-panel {
    border-color: #40554c;
    background: rgba(23,33,29,.88);
  }
  .password-lock-preview {
    border-color: #496057;
    color: #b8c7c0;
  }
  .password-lock-form input {
    background: #141e1a;
    border-color: #40584e;
  }
  .friend-link:hover { border-color: #5d7a6e; }
  .comment-children { border-left-color: #40544b; }
  blockquote { background: var(--accent-soft); }
  .mood-reply-button:hover { background: rgba(112,210,196,.1); }
  .mood-body .mood-comment-status.is-error { color: #ffb4ab; }
  .album-cover-locked {
    color: #b8c7c0;
    background:
      linear-gradient(135deg, rgba(112,210,196,.1), rgba(231,170,98,.08)),
      var(--soft);
  }
  .album-cover-locked::before { border-color: #496057; }
}

/* ══════════════════ RESPONSIVE ══════════════════ */
@media (max-width: 900px) {
  .site-header { flex-wrap: wrap }
  .site-header nav { order: 3; width: 100% }
  .header-search { min-width: 240px }
  .home-layout { grid-template-columns: 1fr }
  .home-discovery { display: none }
  .admin-shell { grid-template-columns: 1fr }
  .admin-sidebar { height: auto; position: static; border-right: 0; border-bottom: 1px solid var(--line) }
  .admin-sidebar nav { display: flex; flex-wrap: wrap }
  .admin-topbar { padding: 12px 18px; align-items: flex-start; flex-wrap: wrap }
  .admin-content { padding: 20px 18px }
  .post-editor-layout { grid-template-columns: 1fr; height: auto; min-height: 0; overflow: visible }
  .editor-main { max-height: none; overflow: visible }
  .blocks { overflow: visible; padding-right: 0 }
  .editor-sidebar { position: static; max-height: none; overflow: visible }
}

@media (max-width: 700px) {
  /* iOS Safari zooms the page when a focused form control is smaller than 16px. */
  .site-body input:not([type="checkbox"]):not([type="radio"]),
  .site-body textarea,
  .site-body select { font-size: 16px }
  .site-header { align-items: flex-start; flex-direction: column; gap: 10px; padding: 18px 24px 14px }
  .brand-block { max-width: 100% }
  .site-tagline { white-space: normal }
  .mobile-search-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    padding: 6px 9px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--muted);
    font-size: 13px;
    font-weight: 650;
    line-height: inherit;
  }
  .mobile-search-toggle:hover,
  .mobile-search-toggle[aria-expanded="true"] {
    background: var(--accent-soft);
    color: var(--accent);
  }
  .site-header nav { order: 0; width: 100%; gap: 2px }
  nav a { padding: 6px 9px; font-size: 13px }
  .header-search {
    display: none;
    margin-left: 0;
    width: 100%;
    min-width: 0;
    padding-top: 2px;
  }
  .header-search.is-open { display: flex }
  .header-search input { flex: 1; width: auto }
  .header-search input { min-width: 0 }
  .container { padding: 20px 24px 26px }
  .link-exchange { padding: 18px }
  .site-link-profile { grid-template-columns: 1fr; padding: 16px }
  .article h1 { font-size: 34px }
  .grid-2, .field-grid, .stats, .dashboard-grid, .asset-slots, .live-photo-pair,
  .user-create-form, .user-edit-form, .home-layout,
  .term-create-form, .term-edit-form { grid-template-columns: 1fr }
  .term-row { grid-template-columns: 1fr }
  .admin-account { width: 100%; align-items: flex-start; flex-direction: row; flex-wrap: wrap; gap: 8px 12px }
  .admin-account form { margin-left: 0 }
  .home-posts article { padding: 22px 0 }
  .home-posts h2 { font-size: 24px }
  .article { font-size: 16px }
  .comments { margin-top: 36px; padding-top: 22px }
  .comments h2 { font-size: 22px }
  .comment-item p { font-size: 15px }
  .comment-children { margin-left: 14px; padding-left: 12px }
  table { font-size: 14px }
  .admin-content { overflow-x: auto }
  .file-library-tools { grid-template-columns: 1fr; align-items: stretch }
  .file-filter-form, .file-upload-form { display: grid; grid-template-columns: 1fr; align-items: stretch }
  .file-filter-form input, .file-filter-form select, .file-upload-form input { width: 100% }
  .nav-builder-row { grid-template-columns: 1fr }
  .block-toolbar {
    margin-inline: -8px;
    border-radius: 10px;
    box-shadow: 0 14px 34px rgba(22,33,28,.14);
  }
  .post-editor { --editor-field-width: 100%; --block-field-width: 100% }
  .post-editor-layout { grid-template-columns: 1fr }
  .article-gallery { grid-template-columns: repeat(2,1fr) }
  .article-gallery a, .article-gallery a:first-child, .article-gallery a:nth-child(n) { grid-column: span 1; grid-row: span 1 }
  .mood-grid { grid-template-columns: repeat(3,1fr) }
  .mood-grid.count-1,
  .mood-grid.count-2 { grid-template-columns: repeat(2,1fr) }
  .mood-grid.count-1 { grid-template-columns: 1fr }
  .mood-tile { width: 100% }
  .mood-grid.count-1 .mood-tile,
  .mood-grid.count-2 .mood-tile { width: 100% }
  .mood-grid.count-1 .mood-tile.live-photo-trigger,
  .mood-grid.count-2 .mood-tile.live-photo-trigger { width: 100% }
  .photo-wall { column-count: 2 }
  .album-detail h1 { font-size: 32px }
  .password-lock-panel { grid-template-columns: 1fr; padding: 12px }
  .password-lock-preview { min-height: 140px }
  .password-lock-form div { grid-template-columns: 1fr }
  .password-lock-form input,
  .mood-password-form input { min-width: 0; min-height: 44px; font-size: 16px }
  .password-lock-form button,
  .mood-password-form button { width: 100%; min-height: 44px }
  .mood-password-form { width: 100%; min-width: 0 }
  .mood-password-form > button { justify-self: stretch }
  .mood-entry { grid-template-columns: 40px minmax(0,1fr); gap: 12px; padding: 20px 0 }
  .mood-avatar { width: 40px; height: 40px; font-size: 14px }
  .mood-comment-fields { grid-template-columns: 1fr }
  .term-admin-row { display: grid }
}
