/* ==========================================================
   秘密小屋 - 全局样式
   温暖木屋风：奶油底色 + 木质棕 + 琥珀点缀
   ========================================================== */
:root {
  --bg: #faf6ef;
  --bg-soft: #f3ece1;
  --card: #ffffff;
  --ink: #3b3026;
  --ink-soft: #8a7a6a;
  --line: #e8dfd1;
  --primary: #c07a3c;
  --primary-dark: #a05f28;
  --danger: #c0504a;
  --ok: #4e8a5a;
  --shadow: 0 2px 12px rgba(93, 71, 44, .10);
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", sans-serif;
  background:
    radial-gradient(1200px 500px at 50% -120px, rgba(192, 122, 60, .10), transparent 60%),
    var(--bg);
  color: var(--ink);
  min-height: 100vh;
  line-height: 1.6;
}

a { color: var(--primary-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(250, 246, 239, .92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.logo { font-size: 20px; font-weight: 700; color: var(--ink); }
.nav { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-left: auto; }
.nav a {
  color: var(--ink-soft);
  font-size: 14px;
  padding: 4px 2px;
  border-bottom: 2px solid transparent;
}
.nav a:hover { color: var(--primary-dark); text-decoration: none; }
.nav a.active { color: var(--primary-dark); border-bottom-color: var(--primary); font-weight: 600; }
.user-chip {
  font-size: 13px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 12px;
  color: var(--ink-soft);
}

/* ---------- 布局 ---------- */
.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 26px 20px 40px;
}

.welcome {
  margin: 6px 0 22px;
}
.welcome h1 { margin: 0 0 4px; font-size: 26px; }
.welcome p { margin: 0 0 12px; color: var(--ink-soft); }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
  margin-bottom: 22px;
}
.card-title {
  margin: 0 0 14px;
  font-size: 18px;
}

.muted { color: var(--ink-soft); font-size: 13px; }
.strong { font-weight: 700; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-block;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 8px 18px;
  font-size: 14px;
  cursor: pointer;
  text-align: center;
  transition: background .15s, border-color .15s, transform .05s;
  font-family: inherit;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-dark); text-decoration: none; color: #fff; }
.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--ink-soft);
}
.btn-ghost:hover { border-color: var(--primary); color: var(--primary-dark); }
.btn-danger {
  background: #fdf0ee;
  border-color: #f0d2ce;
  color: var(--danger);
}
.btn-danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-sm { padding: 4px 12px; font-size: 13px; border-radius: 8px; }
.btn-block { display: block; width: 100%; }

/* ---------- 表单 ---------- */
.field { display: block; margin-bottom: 14px; }
.field > span {
  display: block;
  font-size: 13px;
  color: var(--ink-soft);
  margin-bottom: 5px;
}
.field input[type="text"],
.field input[type="password"],
.field input[type="file"],
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 14px;
  font-family: inherit;
  background: #fffdfa;
  color: var(--ink);
  outline: none;
}
.field input:focus, .field textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(192, 122, 60, .15);
}
.form-inline {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
}
.form-inline .field { flex: 1; min-width: 170px; margin-bottom: 0; }
.form-actions { margin-top: 6px; display: flex; gap: 10px; align-items: center; }
.form-hint { margin: 10px 0 0; }
.inline-form { display: inline; }
textarea { resize: vertical; }

/* ---------- 登录 / 安装页 ---------- */
.login-page, .install-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}
.login-card, .install-card {
  width: 100%;
  max-width: 400px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 10px 40px rgba(93, 71, 44, .14);
  padding: 34px 32px 26px;
}
.brand { text-align: center; margin-bottom: 20px; }
.brand-mark { font-size: 40px; }
.brand h1 { margin: 6px 0 2px; font-size: 26px; }
.brand p { margin: 0; color: var(--ink-soft); font-size: 13px; }
.login-tip {
  margin-top: 18px;
  text-align: center;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.7;
}
.install-info { margin: 10px 0 16px; font-size: 14px; }
code {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1px 6px;
  font-family: Consolas, monospace;
  font-size: 13px;
}

/* ---------- 提示消息 ---------- */
.alert {
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  margin-bottom: 14px;
  border: 1px solid transparent;
}
.alert-success { background: #eef6ee; border-color: #cfe5d2; color: var(--ok); }
.alert-danger  { background: #fdf0ee; border-color: #f0d2ce; color: var(--danger); }
.alert-warning { background: #fbf3e2; border-color: #ecd9b4; color: #9a6b1f; }

/* ---------- 统计卡 ---------- */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  text-align: center;
}
.stat-num { font-size: 28px; font-weight: 700; color: var(--primary-dark); }
.stat-label { font-size: 13px; color: var(--ink-soft); margin-top: 2px; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.table th, .table td {
  text-align: left;
  padding: 10px 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table th { color: var(--ink-soft); font-weight: 600; font-size: 13px; }
.table tr:last-child td { border-bottom: none; }
.ops { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

.tag {
  display: inline-block;
  font-size: 12px;
  border-radius: 999px;
  padding: 1px 10px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  color: var(--ink-soft);
}
.tag-admin { background: #fdf3e6; border-color: #ecd0a8; color: var(--primary-dark); }
.tag-ok  { background: #eef6ee; border-color: #cfe5d2; color: var(--ok); }
.tag-off { background: #fdf0ee; border-color: #f0d2ce; color: var(--danger); }

/* ---------- 记事 ---------- */
.note-item {
  border-bottom: 1px dashed var(--line);
  padding: 14px 2px;
}
.note-item:last-child { border-bottom: none; }
.note-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}
.note-head h3 { margin: 0; font-size: 17px; }
.note-time { font-size: 12px; color: var(--ink-soft); }
.note-content {
  margin: 8px 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 15px;
}
.note-ops { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------- 相册 ---------- */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}
.photo-card {
  margin: 0;
  background: #fffdfa;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.photo-link {
  display: block;
  height: 200px;
  overflow: hidden;
  background: var(--bg-soft);
}
.photo-link img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .2s;
}
.photo-link:hover img { transform: scale(1.04); }
.photo-card figcaption { padding: 10px 12px 12px; }
.photo-remark {
  font-size: 14px;
  font-weight: 600;
  word-break: break-word;
}
.photo-time { font-size: 12px; color: var(--ink-soft); margin: 2px 0 8px; }
.photo-ops { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(59, 48, 38, .45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 20px;
}
.modal {
  background: var(--card);
  border-radius: 16px;
  box-shadow: 0 14px 50px rgba(0, 0, 0, .25);
  padding: 24px 26px;
  width: 100%;
  max-width: 420px;
}
.modal h3 { margin: 0 0 14px; font-size: 18px; }
.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 18px;
}
.hidden { display: none !important; }

/* 分享弹窗 */
.share-modal { text-align: center; }
.share-body { margin: 6px 0 14px; }
.share-body img {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 8px;
  max-width: 100%;
  height: auto;
}
.share-link {
  display: flex;
  gap: 8px;
}
.share-link input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 12px;
  color: var(--ink-soft);
  background: #fffdfa;
  font-family: Consolas, monospace;
}

/* ---------- 公共分享页 ---------- */
.share-page { background: var(--bg); }
.share-header {
  padding: 22px 20px 0;
  max-width: 1080px;
  margin: 0 auto;
}
.share-brand { font-size: 22px; font-weight: 700; }
.share-from { color: var(--ink-soft); font-size: 13px; margin-top: 2px; }
.share-container { padding-top: 18px; }
.share-item { text-align: center; }
.share-item h2 { margin: 0 0 4px; }
.share-content { text-align: left; }
.share-image {
  max-width: 100%;
  max-height: 75vh;
  width: auto;
  height: auto;
  border-radius: 10px;
  display: block;
  margin: 0 auto;
}
.share-item > a { display: block; text-align: center; }
.share-image-meta { margin-top: 12px; }
.share-page-body .card h2 { margin-top: 0; }

.page-footer {
  text-align: center;
  color: var(--ink-soft);
  font-size: 12px;
  padding: 10px 20px 34px;
}

/* ---------- 公告 ---------- */
.announcement {
  background: #fbf3e2;
  border: 1px solid #ecd9b4;
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 14px;
  color: #7a5a1f;
  margin-bottom: 18px;
  word-break: break-word;
}

/* ---------- 后台页签 ---------- */
.admin-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--line);
  padding-bottom: 8px;
}
.admin-tabs a {
  padding: 6px 16px;
  border-radius: 9px;
  font-size: 14px;
  color: var(--ink-soft);
  background: var(--bg-soft);
  border: 1px solid var(--line);
}
.admin-tabs a:hover { text-decoration: none; color: var(--primary-dark); }
.admin-tabs a.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* ---------- 后台内容管理 ---------- */
.td-clip {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.thumb-link { display: inline-block; }
.thumb {
  width: 56px;
  height: 40px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
  vertical-align: middle;
}
.wechat-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.wechat-preview img {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 4px;
}

/* ---------- 滚动字幕（主页最上方） ---------- */
.ticker {
  overflow: hidden;
  white-space: nowrap;
  background: #3b3026;
  color: #f5e6c8;
  font-size: 13px;
  padding: 7px 0;
}
/* 登录页是 flex 居中布局，字幕需固定在页面最顶部，避免被拉到卡片旁边 */
.login-page .ticker {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 5;
}
.ticker-inner {
  display: inline-block;
  padding-left: 100%;
  animation: ticker-scroll 22s linear infinite;
  will-change: transform;
}
@keyframes ticker-scroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-100%); }
}

/* ---------- 记事配图（响应式，手机上不溢出） ---------- */
.note-images {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 10px 0 4px;
  max-width: 100%;
}
.note-img {
  display: block;
  flex: 1 1 200px;
  max-width: 100%;
  min-width: 120px;
  overflow: hidden;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
}
.note-img img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
  transition: transform .2s;
}
.note-img:hover img { transform: scale(1.05); }
@media (max-width: 640px) {
  .note-img { flex-basis: 46%; }
  .note-img img { height: 150px; }
}

/* ---------- 主页底部：点击联系管理员微信（弹出二维码） ---------- */
.wechat-tap {
  margin-bottom: 14px;
}
.wechat-tap-box summary {
  display: inline-block;
  cursor: pointer;
  font-size: 14px;
  color: var(--primary-dark);
  font-weight: 600;
  padding: 8px 18px;
  border: 1px dashed var(--line);
  border-radius: 20px;
  background: var(--card);
  user-select: none;
}
.wechat-tap-box summary:hover { color: var(--primary); }
.wechat-tap-body {
  margin-top: 12px;
}
.wechat-tap-body img {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 4px;
  width: 160px;
  max-width: 70%;
  height: auto;
}
.wechat-tap-body p { margin: 8px 0 0; }

/* ---------- 注册页微信二维码 ---------- */
.reg-wechat {
  text-align: center;
  margin-bottom: 16px;
}
.reg-wechat img {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 4px;
}

/* ---------- 分享页底部：房子链接 ---------- */
.footer-home {
  margin-bottom: 6px;
}
.footer-home a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
  font-weight: 600;
  color: var(--primary-dark);
}
.footer-home a:hover { text-decoration: underline; }
.footer-home-icon { font-size: 18px; }
.footer-home-click { font-size: 14px; font-weight: 600; }

/* ---------- 登录页：点击获取管理员微信 ---------- */
.login-wechat {
  margin-top: 16px;
  text-align: center;
}
.login-wechat summary {
  display: inline-block;
  cursor: pointer;
  font-size: 14px;
  color: var(--primary-dark);
  font-weight: 600;
  padding: 8px 16px;
  border: 1px dashed var(--line);
  border-radius: 20px;
  background: var(--card);
  user-select: none;
}
.login-wechat summary:hover { color: var(--primary); }
.login-wechat-body {
  margin-top: 12px;
}
.login-wechat-body img {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 4px;
  width: 160px;
  max-width: 70%;
  height: auto;
}
.login-wechat-body p { margin: 8px 0 0; }

/* ---------- 编辑记事时的已挂配图 ---------- */
.note-attach-edit {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.attach-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--ink-soft);
  cursor: pointer;
}
.attach-item img {
  width: 90px;
  height: 68px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
}

/* ---------- 分享页联系管理员 ---------- */
.share-wechat {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px;
}
.share-wechat-inner {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 22px;
  text-align: center;
}
.share-wechat-inner h3 { margin: 0 0 10px; font-size: 16px; color: var(--ink-soft); opacity: .65; }
.share-wechat-inner img.wechat-qr-img {
  width: 130px;
  max-width: 70%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 4px;
  margin: 0 auto;
  display: block;
}
.share-wechat-inner p { margin: 8px 0 0; opacity: .6; }

/* ---------- 响应式 ---------- */
@media (max-width: 640px) {
  .nav { margin-left: 0; width: 100%; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .gallery { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .photo-link { height: 150px; }
}

/* ---------- 网站底部备案号 ---------- */
.site-footer {
  text-align: center;
  padding: 14px 20px 30px;
  color: var(--ink-soft);
  font-size: 12px;
}
.beian-links { margin: 4px 0; }
.beian-links a {
  color: var(--ink-soft);
  text-decoration: none;
  margin: 0 4px;
  white-space: nowrap;
}
.beian-links a:hover { color: var(--primary-dark); text-decoration: underline; }

/* ---------- 音乐 / 视频 ---------- */
.media-list { list-style: none; padding: 0; margin: 0; }
.media-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.media-item:last-child { border-bottom: none; }
.media-info { flex: 1 1 180px; min-width: 150px; }
.media-name { font-weight: 600; }
.media-meta { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }
.media-audio { flex: 1 1 320px; min-width: 240px; height: 40px; }
.media-ops { display: flex; gap: 6px; }

.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}
.video-card {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg);
}
.video-card video { display: block; width: 100%; aspect-ratio: 16 / 9; background: #000; }
.video-card figcaption { padding: 10px 12px 12px; }
.video-title { font-weight: 600; margin-bottom: 4px; }
.video-desc { font-size: 12px; color: var(--ink-soft); margin-bottom: 4px; }

/* ---------- 作品集：编辑 + 实时预览 ---------- */
.story-editor-wrap {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 4fr);
  gap: 18px;
  align-items: start;
}
@media (max-width: 860px) {
  .story-editor-wrap { grid-template-columns: 1fr; }
}
.save-status { font-size: 12px; color: var(--primary-dark); font-weight: normal; margin-left: 8px; }

.story-preview-frame {
  max-width: 420px;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  background: #fffdf8;
  box-shadow: 0 8px 24px rgba(120, 90, 40, 0.12);
}
.story-preview-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.story-preview-logo { font-weight: 600; }
.story-preview-owner { color: var(--ink-soft); font-size: 12px; }
.story-preview-body { padding: 16px 14px; }
.story-preview-title { font-size: 20px; margin: 0 0 8px; }
.story-preview-intro {
  font-size: 14px;
  color: var(--ink);
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  margin-bottom: 12px;
}
.story-preview-placeholder { color: var(--ink-soft); }
.story-preview-media { display: flex; flex-direction: column; gap: 12px; }
.story-preview-foot {
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  background: var(--bg-soft);
  text-align: center;
  font-size: 12px;
  color: var(--ink-soft);
}
.story-preview-qr { margin-bottom: 4px; }
.story-preview-beian .beian-links { margin: 2px 0; }

.story-media-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  background: var(--bg);
}
.story-media-image img {
  display: block;
  width: 100%;
  max-height: 260px;
  object-fit: cover;
  border-radius: 8px;
}
.story-media-music .media-audio { width: 100%; height: 40px; }
.story-media-video video { display: block; width: 100%; aspect-ratio: 16 / 9; background: #000; border-radius: 8px; }
.story-media-name { font-weight: 600; margin-bottom: 6px; font-size: 13px; }
.story-media-caption { font-size: 12px; color: var(--ink-soft); margin: 6px 0 0; }
.story-media-del { margin-top: 8px; text-align: right; }

/* ---------- 作品集：公开分享页 ---------- */
.share-story { display: flex; flex-direction: column; gap: 16px; }
.share-story-title { font-size: 24px; font-weight: 700; margin: 4px 0 0; }
.share-story-intro {
  font-size: 15px;
  line-height: 1.8;
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--bg-soft);
  border-left: 3px solid var(--primary);
  border-radius: 0 10px 10px 0;
  padding: 10px 14px;
}
.share-story-section h2 { margin-top: 0; font-size: 17px; }
.share-story-music-item { margin-bottom: 12px; }
.share-story-music-item .media-audio { width: 100%; height: 40px; }
.share-story-video-item { margin-bottom: 14px; }
.share-story-video-item video { display: block; width: 100%; aspect-ratio: 16 / 9; background: #000; border-radius: 10px; }
.share-story-section .story-media-caption { margin-bottom: 10px; }

/* 分享页自动播放兜底按钮 */
.story-play-float {
  position: fixed;
  right: 16px;
  bottom: 24px;
  z-index: 99;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  border: none;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(120, 90, 40, 0.3);
}
.story-play-float:hover { background: var(--primary-dark); }
