/* ═══════ Modals + Gallery + Comments + Toast — 极简暖色 ═══════ */
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}
.modal-overlay { display: none; position: fixed; inset: 0; z-index: 200; background: var(--overlay); align-items: center; justify-content: center; padding: 20px; }
.modal-overlay.on { display: flex; animation: overlayIn 0.2s ease; }
.modal-overlay.on .modal { animation: modalIn 0.32s var(--ease-emph); }
.modal { background: var(--bg-card); border-radius: var(--radius-lg); max-width: 600px; width: 100%; max-height: 85vh; overflow-y: auto; box-shadow: var(--shadow-lg); padding: 28px; position: relative; }
.modal__close { position: absolute; top: 14px; right: 16px; font-size: 1.3rem; color: var(--fg-dim); padding: 4px; transition: all 0.2s; }
.modal__close:hover { color: var(--fg); }
/* 文化库详情正文：保留数据中的 \n\n 段落换行，降低长文本阅读成本 */
#detailModalContent p { white-space: pre-wrap; }
.modal img { border-radius: var(--radius); max-height: 360px; width: 100%; object-fit: contain; background: var(--bg-soft); }
.gdetail { display: none; position: fixed; inset: 0; z-index: 200; background: var(--overlay); overflow-y: auto; padding: 40px 20px; }
.gdetail__inner { max-width: 800px; margin: 0 auto; background: var(--bg-card); border-radius: var(--radius-lg); padding: 28px; box-shadow: var(--shadow-lg); animation: modalIn 0.32s var(--ease-emph); }
.gdetail__header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 16px; }
.gdetail__img { border-radius: var(--radius); max-height: 460px; width: 100%; object-fit: contain; background: var(--bg-soft); margin-bottom: 16px; }
.gdetail__info { font-size: 0.82rem; color: var(--fg-muted); line-height: 1.8; }
.gdetail__actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.comment { padding: 12px 0; border-bottom: 1px solid var(--border); }
.comment:last-child { border: none; }
.comment__head { display: flex; justify-content: space-between; font-size: 0.78rem; margin-bottom: 3px; }
.comment__author { font-weight: 600; color: var(--fg); }
.comment__time { color: var(--fg-dim); }
.comment__body { font-size: 0.84rem; color: var(--fg-muted); }
.comment__actions { display: flex; gap: 12px; margin-top: 5px; }
.comment__actions button { color: var(--fg-dim); font-size: 0.74rem; cursor: pointer; }
.comment__actions button:hover { color: var(--accent); }
.comment-reply { margin-left: 28px; padding-left: 12px; border-left: 2px solid var(--border); margin-top: 10px; }
.comment-form { display: flex; gap: 8px; margin-top: 16px; }
.comment-form input { flex: 1; }
.toast-ctr { position: fixed; top: calc(var(--nav-h) + 8px); right: 16px; z-index: 1000; display: flex; flex-direction: column; gap: 6px; }
.toast { padding: 12px 20px; border-radius: var(--radius); font-size: 0.82rem; font-weight: 400; box-shadow: var(--shadow); max-width: 320px; }
.toast--ok { background: var(--bg-card); color: var(--accent); border: 1px solid var(--border); }
.toast--err { background: var(--bg-card); color: var(--err); border: 1px solid var(--pop-soft); }
.notif-item { display: flex; align-items: flex-start; gap: 10px; padding: 14px 16px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 6px; cursor: pointer; transition: all 0.2s; }
.notif-item:hover { background: var(--bg-hover); }
.notif-item.unread { border-left: 2px solid var(--pop); }
.notif-item__text { flex: 1; }
.notif-item__title { font-size: 0.85rem; font-weight: 500; }
.notif-item__desc { font-size: 0.76rem; color: var(--fg-muted); margin-top: 2px; }
.notif-item__time { font-size: 0.68rem; color: var(--fg-dim); margin-top: 3px; }

/* ═══════ 轻量内容格式（mdLite 渲染产物） ═══════ */
.mdl p { margin: 0 0 0.6em; }
.mdl p:last-child { margin-bottom: 0; }
.mdl-h { font-size: 0.95rem; font-weight: 500; color: var(--fg); margin: 0.9em 0 0.4em; }
.mdl-h:first-child { margin-top: 0; }
.mdl-hr { border: none; border-top: 1px solid var(--border); margin: 1em 0; }
.mdl b { color: var(--fg); font-weight: 500; }

/* ═══════ 站内确认/输入弹窗（confirm.js，替代浏览器原生） ═══════ */
.cfm-overlay {
  position: fixed; inset: 0; z-index: 400;
  background: var(--overlay);
  display: none; align-items: center; justify-content: center; padding: 20px;
}
.cfm-overlay.on { display: flex; animation: overlayIn 0.18s ease; }
.cfm-overlay.on .cfm { animation: modalIn 0.3s var(--ease-emph); }
.cfm {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  max-width: 400px; width: 100%; padding: 24px;
}
.cfm__title { font-size: 1.02rem; font-weight: 500; color: var(--fg); margin-bottom: 10px; }
.cfm__msg { font-size: 0.86rem; color: var(--fg-muted); line-height: 1.7; margin-bottom: 20px; }
.cfm__form { margin-bottom: 20px; }
.cfm__field { margin-bottom: 12px; }
.cfm__field label { display: block; font-size: 0.78rem; color: var(--fg-muted); margin-bottom: 5px; }
.cfm__field input, .cfm__field textarea, .cfm__field select {
  width: 100%; padding: 9px 12px; font-size: 0.86rem;
  background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--fg);
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.cfm__field textarea { min-height: 74px; resize: vertical; }
.cfm__field input:focus, .cfm__field textarea:focus, .cfm__field select:focus {
  outline: none; border-color: var(--fg); background: var(--bg-card); box-shadow: var(--focus-ring);
}
.cfm__actions { display: flex; justify-content: flex-end; gap: 8px; }
.cfm__btn { padding: 8px 18px; font-size: 0.82rem; }
.cfm__btn--primary { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.cfm__btn--primary:hover { background: var(--pop); border-color: var(--pop); }
.cfm__btn--danger { background: var(--pop); color: #fff; border-color: var(--pop); }
.cfm__btn--danger:hover { background: var(--pop-strong); border-color: var(--pop-strong); }
@media (max-width: 500px) {
  .cfm-overlay { align-items: flex-end; padding: 0; }
  .cfm { max-width: 100vw; border-radius: 16px 16px 0 0; padding: 22px 18px calc(22px + env(safe-area-inset-bottom)); }
}

/* ═══════ 顶栏消息预览下拉 ═══════ */
.cr-notif-panel {
  position: fixed; z-index: 300; width: 320px;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 8px;
}
[data-theme="dark"] .cr-notif-panel { background: rgba(26,26,26,0.92); }
.cr-notif-item { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 8px; cursor: pointer; transition: background 0.15s; }
.cr-notif-item:hover { background: var(--bg-hover); }
.cr-notif-item__icon { font-size: 1.05rem; flex-shrink: 0; line-height: 1.4; }
.cr-notif-item__body { flex: 1; min-width: 0; }
.cr-notif-item__title { font-size: 0.82rem; font-weight: 500; color: var(--fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cr-notif-item__time { font-size: 0.66rem; color: var(--fg-dim); margin-top: 2px; }
.cr-notif-footer { text-align: center; padding: 10px; margin-top: 4px; border-top: 1px solid var(--border); font-size: 0.8rem; color: var(--fg-muted); cursor: pointer; }
.cr-notif-footer:hover { color: var(--fg); }
.cr-notif-empty { padding: 24px; text-align: center; color: var(--fg-dim); font-size: 0.85rem; }

/* ═══════ 搜索浮层 ═══════ */
.search-overlay {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(0,0,0,0.4);
  display: none; align-items: flex-start; justify-content: center;
  padding: 80px 20px 20px;
}
.search-overlay.on { display: flex; }
.search-box {
  width: 100%; max-width: 640px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.search-input-row {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.search-input-row .icon-svg { width: 20px; height: 20px; color: var(--fg-muted); flex-shrink: 0; }
.search-input-row input {
  flex: 1; border: none; outline: none; background: none;
  font-size: 1rem; color: var(--fg);
}
.search-input-row input::placeholder { color: var(--fg-dim); }
.search-input-row .esc { font-size: 0.75rem; color: var(--fg-dim); padding: 2px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.search-results { max-height: 60vh; overflow-y: auto; padding: 8px; }
.search-result {
  display: block; padding: 12px 14px; border-radius: var(--radius);
  cursor: pointer; transition: background 0.15s;
}
.search-result:hover { background: var(--bg-hover); }
.search-result__title { font-size: 0.88rem; color: var(--fg); font-weight: 500; }
.search-result__snippet { font-size: 0.76rem; color: var(--fg-muted); margin-top: 3px; line-height: 1.5; }
.search-result mark { background: var(--accent-soft); color: var(--accent); padding: 0 2px; }
.search-empty { padding: 40px 20px; text-align: center; color: var(--fg-dim); font-size: 0.85rem; }

/* ═══════ 需要帮助卡片 ═══════ */
.help-overlay {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(0,0,0,0.4);
  display: none; align-items: center; justify-content: center; padding: 20px;
}
.help-overlay.on { display: flex; }
.help-box {
  background: var(--bg-card); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); padding: 32px; max-width: 720px; width: 100%;
  position: relative;
}
.help-box__close { position: absolute; top: 14px; right: 16px; font-size: 1.3rem; color: var(--fg-dim); cursor: pointer; }
.help-box__title { font-size: 1.4rem; font-weight: 500; margin-bottom: 24px; }
.help-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.help-card {
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 28px 20px; text-align: center;
  transition: all 0.2s; cursor: pointer;
  background: var(--bg);
}
.help-card:hover { border-color: var(--fg); transform: translateY(-2px); box-shadow: var(--shadow); }
.help-card__icon { width: 40px; height: 40px; margin: 0 auto 14px; display: flex; align-items: center; justify-content: center; color: var(--fg); }
.help-card__icon .icon-svg { width: 32px; height: 32px; }
.help-card__name { font-size: 0.95rem; font-weight: 500; margin-bottom: 6px; }
.help-card__desc { font-size: 0.76rem; color: var(--fg-muted); line-height: 1.5; }
@media (max-width: 600px) { .help-cards { grid-template-columns: 1fr; } }

/* ═══════ 灵感大厅/作品 详情子页（左图右信息） ═══════ */
.gdetail { align-items: center !important; justify-content: center !important; padding: 20px !important; overflow: hidden !important; }
.gdetail__inner { max-width: 1100px !important; padding: 20px !important; margin: auto !important; max-height: 90vh; overflow-y: auto; position: relative; }
.gdetail__close-inline { font-size: 1.3rem; color: var(--fg-dim); cursor: pointer; padding: 4px 8px; background: none; border: none; line-height: 1; flex-shrink: 0; transition: color 0.15s; }
.gdetail__close-inline:hover { color: var(--fg); }
.gdetail__layout { display: grid; grid-template-columns: 1fr 340px; gap: 24px; align-items: stretch; }
.gdetail__img-wrap { height: 100%; display: flex; min-height: 300px; }
.gdetail__img { width: 100%; height: 100%; max-height: none; object-fit: cover; border-radius: 12px; background: var(--bg-soft); }
.gdetail__side { display: flex; flex-direction: column; gap: 14px; }
.gdetail__author { display: flex; align-items: center; gap: 10px; }
.gdetail__avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; background: var(--bg-hover); flex-shrink: 0; }
.gdetail__avatar--ph { display: flex; align-items: center; justify-content: center; font-weight: 700; color: var(--fg-dim); font-size: 0.9rem; }
.gdetail__author-name { font-size: 0.88rem; font-weight: 500; color: var(--fg); }
.gdetail__author-id { font-size: 0.72rem; color: var(--fg-dim); }
.gdetail__more { margin-left: auto; }
.gdetail__title { font-size: 1.1rem; font-weight: 500; color: var(--fg); line-height: 1.4; }
.gdetail__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.g-icon-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 999px;
  background: var(--bg-soft); border: 1px solid var(--border);
  color: var(--fg); font-size: 0.8rem; cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.g-icon-btn:hover { background: var(--bg-hover); border-color: var(--border-strong); }
.g-icon-btn .icon-svg { width: 16px; height: 16px; color: var(--fg); }
.g-icon-btn--like.liked { color: var(--pop); border-color: var(--pop); }
.g-icon-btn--like.liked .icon-svg { color: var(--pop); }
.gdetail__prompt { font-size: 0.82rem; color: var(--fg-muted); line-height: 1.7; background: var(--bg-soft); padding: 12px 14px; border-radius: 8px; }
.gdetail__meta { font-size: 0.74rem; color: var(--fg-dim); display: flex; flex-wrap: wrap; gap: 10px; }
.gdetail__meta span { white-space: nowrap; }
@media (max-width: 800px) { .gdetail__layout { grid-template-columns: 1fr; } .gdetail__inner { padding: 16px !important; } .gdetail__img { max-height: 300px; } }
@media (max-width: 500px) {
  .gdetail { padding: 0 !important; }
  .gdetail__inner { max-height: 100vh !important; border-radius: 0 !important; }
  .gdetail__img { max-height: 250px; }
  .cr-notif-panel { width: calc(100vw - 32px); left: 16px !important; right: 16px !important; }
  .search-overlay { padding: 40px 12px 12px; }
  .search-box { max-width: calc(100vw - 32px); }
  .help-box { padding: 24px 16px; }
  .toast-ctr { right: 8px; left: 8px; }
  .toast { max-width: none; }
}
@media (max-width: 600px) {
  .modal-overlay .modal { max-width: 94vw; padding: 20px; }
}

/* ═══════ 我的作品（按日期分组 + 纯图卡片） ═══════ */
.works-wrap { max-width: 1500px; margin: 0; padding: 48px 32px 80px 16px; }
.works-date-group { margin-bottom: 36px; }
.works-date { font-size: 0.88rem; font-weight: 500; color: var(--fg-muted); margin-bottom: 14px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.works-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.works-card {
  position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden;
  cursor: pointer; background: var(--bg-soft);
  /* transform 由 JS tilt/GSAP 驱动，禁 CSS transition 防写入冲突 */
  transition: box-shadow 0.3s ease;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.works-card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.works-card:hover { box-shadow: 0 8px 24px rgba(0,0,0,0.18); }
.works-card__badge {
  position: absolute; top: 8px; right: 8px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 0.66rem; font-weight: 500;
  background: rgba(0,0,0,0.55); color: #fff;
  backdrop-filter: blur(4px);
}
.works-card__badge--pub { background: rgba(56,78,115,0.85); }
