html,
body {
  background: #515bab;
}

/* 动态页的底色和 Safari 顶栏色保持一致，避免 iOS 弹性滚动时露出突兀空白。 */
.dynamic-page {
  min-height: 100svh;
  background: #515bab !important;
}

/* 视频固定在最底层；svh/dvh/lvh 配合处理 iOS 地址栏收放造成的高度变化。 */
.dynamic-page #bg-video {
  height: 100vh;
  height: 100dvh;
  min-height: 100svh;
  transform: translateZ(0);
}

.dynamic-article-shell,
.dynamic-lock-shell,
.admin-shell {
  /* 给 iPhone 底部安全区留空间，避免工具栏或 Home Indicator 遮住正文和按钮。 */
  padding-bottom: max(72px, env(safe-area-inset-bottom));
}

.dynamic-article,
.lock-card,
.admin-card {
  overflow-wrap: anywhere;
}

.editable-content p,
.editable-content li {
  color: rgba(255,255,255,0.72);
  font-size: 1.04rem;
  line-height: 1.95;
}

.editable-content a,
.admin-inline-link a {
  color: rgba(255,255,255,0.94);
  text-decoration: underline;
  text-underline-offset: 0.22em;
}

.lock-card h1 {
  font-family: 'Noto Serif SC', Georgia, serif;
  font-size: 1.35rem;
  margin: 0 0 8px;
  color: rgba(255,255,255,0.92);
}

.lock-icon {
  display: none !important;
}

.form-message,
.save-message {
  margin: 14px 0 0;
  color: rgba(255,255,255,0.72);
  font-size: 0.9rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.admin-shell {
  /* 后台也使用玻璃层，但宽度收住，桌面和移动端都不会太散。 */
  position: relative;
  z-index: 2;
  width: min(100% - 32px, 920px);
  min-height: 100svh;
  margin: 0 auto;
  padding-top: 104px;
}

.admin-card {
  background: rgba(255,255,255,0.10);
  backdrop-filter: blur(32px) saturate(180%);
  -webkit-backdrop-filter: blur(32px) saturate(180%);
  border: 1px solid rgba(255,255,255,0.18);
  border-top-color: rgba(255,255,255,0.34);
  border-radius: 24px;
  box-shadow: 0 18px 60px rgba(0,0,0,0.25);
  padding: clamp(22px, 4vw, 40px);
}

.admin-wide,
.admin-editor {
  width: 100%;
}

.admin-card h1 {
  margin: 0 0 20px;
  color: rgba(255,255,255,0.94);
  font-family: 'Noto Serif SC', Georgia, serif;
  font-size: clamp(1.5rem, 4vw, 2.2rem);
  line-height: 1.25;
}

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

.admin-actions {
  /* 后台右上角常用操作：新建文章和退出，手机上会自动上下排列。 */
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-actions {
  pointer-events: auto;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.manage-link {
  pointer-events: auto;
  flex: 0 0 auto;
  display: block;
  color: rgba(255,255,255,0.93);
  font-size: 0.95rem;
  font-family: 'Noto Serif SC', Georgia, serif;
  padding: 7px 18px;
  background: rgba(255,255,255,0.14);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid rgba(255,255,255,0.42);
  border-top-color: rgba(255,255,255,0.65);
  border-radius: 999px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.14), inset 0 1px 0 rgba(255,255,255,0.55);
  white-space: nowrap;
}

.admin-note {
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 14px;
  background: rgba(255,255,255,0.07);
  color: rgba(255,255,255,0.66);
  padding: 12px 14px;
  margin-bottom: 18px;
  font-size: 0.92rem;
}

.admin-section-title {
  margin: 22px 0 10px;
  color: rgba(255,255,255,0.86);
  font-family: 'Noto Serif SC', Georgia, serif;
  font-size: 1rem;
}

.admin-form {
  display: grid;
  gap: 12px;
}

.admin-form label {
  color: rgba(255,255,255,0.74);
  font-size: 0.92rem;
}

.admin-form input[type="text"],
.admin-form input[type="password"],
.admin-form input:not([type]),
.admin-form select,
.admin-form textarea,
.admin-form input[name="title"],
.admin-form input[name="eyebrow"] {
  width: 100%;
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 14px;
  background: rgba(10,14,32,0.42);
  color: rgba(255,255,255,0.92);
  padding: 12px 14px;
  font: inherit;
  outline: none;
}

.admin-form select {
  appearance: none;
}

.admin-form textarea {
  /* 正文目前直接编辑 HTML，保留等宽字体便于看清标签结构。 */
  min-height: 42vh;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92rem;
  line-height: 1.65;
}

.editor-toolbar {
  /* 编辑工具栏保持按钮少、功能明确，手机上会自动换行。 */
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 4px;
}

.editor-toolbar button {
  min-height: 36px;
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 999px;
  background: rgba(255,255,255,0.10);
  color: rgba(255,255,255,0.88);
  padding: 7px 13px;
  font-family: 'Noto Serif SC', Georgia, serif;
}

.content-editor {
  /* 可视化正文编辑区：保存的是 HTML，但用户看到的是排版后的内容。 */
  min-height: 42vh;
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 18px;
  background: rgba(10,14,32,0.38);
  color: rgba(255,255,255,0.84);
  padding: 18px;
  outline: none;
  line-height: 1.9;
  overflow-wrap: anywhere;
}

.content-editor:focus {
  border-color: rgba(255,255,255,0.58);
  box-shadow: 0 0 0 3px rgba(255,255,255,0.12);
}

.content-editor p,
.content-editor h2,
.content-editor ul,
.content-editor figure {
  margin: 0 0 16px;
}

.content-editor h2 {
  color: rgba(255,255,255,0.94);
  font-family: 'Noto Serif SC', Georgia, serif;
  font-size: 1.35rem;
}

.content-editor img,
.editable-content img {
  max-width: 100%;
  height: auto;
  border-radius: 16px;
  display: block;
  margin: 10px auto;
}

.content-editor figcaption,
.editable-content figcaption {
  color: rgba(255,255,255,0.52);
  font-size: 0.85rem;
  text-align: center;
}

.admin-form input:focus,
.admin-form textarea:focus,
.lock-input:focus {
  border-color: rgba(255,255,255,0.58);
  box-shadow: 0 0 0 3px rgba(255,255,255,0.12);
}

.admin-form button,
.ghost-button,
.ghost-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1px solid rgba(255,255,255,0.26);
  border-radius: 999px;
  background: rgba(255,255,255,0.16);
  color: rgba(255,255,255,0.94);
  padding: 9px 18px;
  font-family: 'Noto Serif SC', Georgia, serif;
  font-size: 0.95rem;
  cursor: pointer;
}

.ghost-button,
.ghost-link {
  background: rgba(255,255,255,0.08);
  text-decoration: none;
}

.page-list {
  display: grid;
  gap: 10px;
}

.page-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 16px;
  background: rgba(255,255,255,0.08);
  padding: 14px 16px;
}

.page-row strong,
.page-row small,
.page-row em {
  display: block;
}

.page-row small,
.page-row em {
  color: rgba(255,255,255,0.54);
  font-size: 0.82rem;
  font-style: normal;
}

.danger-form {
  margin-top: 18px;
  border-top: 1px solid rgba(255,255,255,0.10);
  padding-top: 18px;
}

.danger-form button {
  border: 1px solid rgba(255,120,120,0.34);
  border-radius: 999px;
  background: rgba(160,30,30,0.18);
  color: rgba(255,235,235,0.88);
  padding: 9px 16px;
  font-family: 'Noto Serif SC', Georgia, serif;
}

.switch-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin: 4px 0 8px;
}

.switch-row label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.admin-inline-link {
  margin-top: 28px;
  font-size: 0.9rem;
}

.reader-logout-form {
  margin-top: 28px;
}

.reader-logout-form button {
  /* 私密页手动退出按钮：不抢正文视觉，但方便在手机上立刻锁回去。 */
  border: 1px solid rgba(255,255,255,0.20);
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.74);
  padding: 8px 16px;
  font-family: 'Noto Serif SC', Georgia, serif;
}

.admin-login-link {
  margin: 16px 0 0;
  color: rgba(255,255,255,0.58);
  font-size: 0.86rem;
}

.private-post-list {
  grid-template-columns: 1fr;
  padding: 20px 0 4px;
}

.private-post-card {
  display: block;
  padding: 18px 20px;
}

.private-post-card .post-meta,
.dynamic-article .eyebrow {
  color: rgba(255,255,255,0.72) !important;
}

.empty-posts {
  border: 1px dashed rgba(255,255,255,0.20);
  border-radius: 16px;
  color: rgba(255,255,255,0.58);
  padding: 16px;
}

@media (max-width: 768px) {
  html,
  body,
  .dynamic-page {
    min-height: 100svh;
    background-color: #515bab !important;
    background-image: none !important;
  }

  .dynamic-page #bg-video {
    /* 动态页也保持单层视频背景，不再叠第二层静态壁纸。 */
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    object-fit: cover;
    transform: none;
  }

  .dynamic-page .article-shell,
  .dynamic-page .lock-shell,
  .admin-shell {
    min-height: 100svh;
    padding-top: 96px !important;
    padding-bottom: max(88px, env(safe-area-inset-bottom)) !important;
  }

  .dynamic-page main,
  .dynamic-footer {
    background: transparent !important;
  }

  .site-footer,
  .dynamic-footer {
    align-items: flex-start !important;
    text-align: left !important;
    padding-left: 20px !important;
    padding-right: 20px !important;
  }

  .site-footer span,
  .dynamic-footer span {
    display: block !important;
    margin-left: 0 !important;
    padding-left: 0 !important;
    text-align: left !important;
  }

  .admin-shell {
    width: min(100% - 24px, 920px);
  }

  .admin-topbar,
  .page-row {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .header-actions {
    gap: 5px;
  }

  .manage-link {
    padding: 5px 10px;
    font-size: 0.72rem;
  }

  .admin-form button,
  .ghost-button,
  .ghost-link,
  .mobile-full {
    width: 100%;
  }

  .content-editor {
    min-height: 50vh;
    padding: 15px;
  }
}

@supports (-webkit-touch-callout: none) {
  .dynamic-page #bg-video {
    height: 100lvh;
    min-height: 100dvh;
  }
}

@media (max-width: 1180px) {
  html,
  body,
  .dynamic-page {
    /* 不给页面本身加壁纸，避免出现第二层跟着滚动的背景。 */
    background-color: #515bab !important;
    background-image: none !important;
    background-attachment: scroll !important;
  }

  .dynamic-page #bg-video {
    /* 单一视频层负责覆盖：iPhone/iPad 都用 fixed + 全视口，不再依赖 body 背景。 */
    position: fixed !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100vh !important;
    height: 100dvh !important;
    min-height: 100lvh !important;
    object-fit: cover !important;
    transform: none !important;
    z-index: 0 !important;
  }

  .dynamic-page main,
  .dynamic-footer {
    background: transparent !important;
  }
}

/* 030599-dynamic-mobile-wallpaper-clean-v7-2026-05-20
   动态页使用同一层视频背景，并在移动端多铺 180px；
   另外增加透明底部缓冲区，减少滑到页面末尾时露出纯色。 */
:root {
  --mobile-video-bleed: 180px;
  --mobile-scroll-buffer: 260px;
}

@media (max-width: 1180px) {
  .dynamic-page {
    min-height: calc(100svh + var(--mobile-scroll-buffer)) !important;
  }

  .dynamic-page #bg-video {
    top: 0 !important;
    left: 0 !important;
    right: auto !important;
    bottom: auto !important;
    width: 100vw !important;
    height: calc(100vh + var(--mobile-video-bleed)) !important;
    min-height: calc(100svh + var(--mobile-video-bleed)) !important;
    object-fit: cover !important;
    transform: translate3d(0, 0, 0) !important;
  }
}

@supports (-webkit-touch-callout: none) {
  .dynamic-page #bg-video {
    height: calc(100lvh + var(--mobile-video-bleed)) !important;
    min-height: calc(100dvh + var(--mobile-video-bleed)) !important;
  }
}

@media (max-width: 768px) {
  .dynamic-page .site-header {
    top: max(10px, calc(env(safe-area-inset-top, 0px) + 8px)) !important;
  }

  body.dynamic-page::after {
    content: "" !important;
    position: relative !important;
    z-index: 2 !important;
    display: block !important;
    height: var(--mobile-scroll-buffer) !important;
    background: transparent !important;
    pointer-events: none !important;
  }

  .dynamic-footer {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    justify-content: flex-start !important;
    gap: 6px !important;
    width: 100% !important;
    max-width: 100% !important;
    text-align: left !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: max(20px, env(safe-area-inset-left, 0px)) !important;
    padding-right: max(20px, env(safe-area-inset-right, 0px)) !important;
  }

  .dynamic-footer span {
    display: block !important;
    margin-left: 0 !important;
    padding-left: 0 !important;
    text-align: left !important;
    width: 100% !important;
  }
}

/* 030599-dynamic-spacing-footer-v8-2026-05-20
   顶部导航下移后，动态页正文同步下移；手机页脚恢复左右分布。 */
@media (min-width: 769px) {
  .dynamic-page .article-shell,
  .dynamic-page .lock-shell,
  .admin-shell {
    padding-top: 132px !important;
  }
}

@media (max-width: 768px) {
  .dynamic-page .article-shell,
  .dynamic-page .lock-shell,
  .admin-shell {
    padding-top: 136px !important;
  }

  .dynamic-footer {
    display: flex !important;
    flex-direction: row !important;
    align-items: flex-end !important;
    justify-content: space-between !important;
    gap: 16px !important;
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: max(20px, env(safe-area-inset-left, 0px)) !important;
    padding-right: max(20px, env(safe-area-inset-right, 0px)) !important;
  }

  .dynamic-footer span {
    width: auto !important;
    min-width: 0 !important;
  }

  .dynamic-footer span:first-child {
    text-align: left !important;
  }

  .dynamic-footer span:last-child {
    text-align: right !important;
  }
}
