/* ============ 玲君永恒 · 生平大事记（v3.19） ============ */
/* 沿用 style.css 主题变量：墨绿 --theme、金 --gold */

.tl-page {
  max-width: 900px;
  margin: 0 auto;
  padding: 34px 20px 76px;
}

/* ---------- 页头 ---------- */
.tl-head { margin-bottom: 30px; }
.tl-title {
  font-family: "Songti SC", "STSong", "Noto Serif SC", "SimSun", Georgia, serif;
  font-size: 30px; font-weight: 500; letter-spacing: 2px;
  color: var(--theme-strong); margin: 0 0 6px;
}
.tl-sub { font-size: 14px; color: var(--text-soft); margin: 0 0 8px; }
.tl-progress { font-size: 12.5px; color: var(--text-soft); margin: 0; opacity: .85; }

/* ---------- 时间轴 ---------- */
.tl { position: relative; padding: 6px 0 10px; }
.tl::before {
  content: ""; position: absolute; left: 104px; top: 0; bottom: 0;
  width: 2px; background: var(--line);
}

.tl-item { position: relative; padding: 0 0 26px 136px; }
.tl-year {
  position: absolute; left: 0; top: -3px; width: 84px;
  text-align: right; font-family: "Songti SC", "STSong", Georgia, serif;
  font-size: 21px; color: var(--gold); letter-spacing: 1px; line-height: 1.3;
}
.tl-dot {
  position: absolute; left: 98px; top: 9px;
  width: 8px; height: 8px; border-radius: 50%;
  background: #fff; border: 3px solid var(--gold);
}
.tl-dot::after {
  content: ""; position: absolute; left: 18px; top: 2px;
  width: 16px; height: 2px; background: var(--gold); opacity: .35;
}

.tl-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 18px;
}
.tl-event {
  position: relative; padding-left: 16px; margin: 2px 0;
  font-size: 15px; color: var(--text); line-height: 1.8;
  word-break: break-word;
}
.tl-event::before {
  content: ""; position: absolute; left: 2px; top: .82em;
  width: 5px; height: 5px; border-radius: 50%; background: var(--gold);
}
.tl-event:first-child { margin-top: 0; }
.tl-photo-wrap { margin-top: 12px; }
.tl-photo {
  display: block; width: 100%; max-width: 560px; max-height: 400px;
  object-fit: cover; border-radius: 10px; border: 1px solid var(--line);
  cursor: zoom-in;
}
.tl-photo:hover { opacity: .92; }

/* 空年份：占位细行（年份标签是绝对定位，需给 item 一个最小高度防塌陷） */
.tl-item.empty { padding: 0 0 16px 136px; min-height: 22px; }
.tl-item.empty .tl-year {
  position: absolute; left: 0; top: 2px; width: 84px;
  font-size: 13.5px; color: var(--text-soft); opacity: .55; font-family: inherit;
}
.tl-item.empty .tl-dot {
  top: 8px; width: 4px; height: 4px;
  border-width: 2px; border-color: var(--line);
  background: var(--bg);
}
.tl-item.empty .tl-dot::after { display: none; }

/* ---------- 照片放大 ---------- */
.tl-lightbox {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(18,22,20,.85);
  display: flex; align-items: center; justify-content: center;
  padding: 24px; cursor: zoom-out;
}
.tl-lightbox.hidden { display: none; }
.tl-lb-figure { margin: 0; max-width: 92vw; max-height: 88vh; }
.tl-lb-figure img {
  max-width: 92vw; max-height: 82vh; border-radius: 10px; display: block;
}
.tl-lb-cap { color: #e8e6df; font-size: 13px; text-align: center; margin-top: 10px; }
.tl-lb-close {
  position: absolute; top: 14px; right: 18px;
  width: 44px; height: 44px; border: none; border-radius: 50%;
  background: rgba(255,255,255,.12); color: #fff; font-size: 26px; cursor: pointer;
}
.tl-lb-close:hover { background: rgba(255,255,255,.25); }

/* ---------- 移动端 ---------- */
@media (max-width: 640px) {
  .tl-page { padding: 24px 14px 64px; }
  .tl-title { font-size: 25px; }
  .tl::before { left: 15px; }
  .tl-item { padding: 0 0 20px 40px; }
  .tl-year {
    position: static; width: auto; text-align: left;
    font-size: 18px; margin-bottom: 7px;
  }
  .tl-dot { left: 9px; top: 6px; }
  .tl-dot::after { display: none; }
  .tl-item.empty { padding: 0 0 10px 40px; min-height: 16px; }
  .tl-item.empty .tl-year {
    position: static; width: auto; text-align: left;
    font-size: 12.5px; margin-bottom: 0;
  }
  .tl-item.empty .tl-dot { top: 4px; }
  .tl-card { padding: 12px 14px; }
  .tl-event { font-size: 14px; }
  .tl-photo { max-height: 300px; }
}

/* ================= v3.20 · 前台直接编辑 ================= */

/* ---------- 页头编辑按钮 ---------- */
.tl-head-row {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
}
.tl-edit-btn {
  flex: none; padding: 7px 16px; margin-top: 4px;
  font-family: inherit; font-size: 13.5px; letter-spacing: 1px;
  color: var(--theme-strong); background: transparent;
  border: 1px solid var(--line); border-radius: 999px;
  cursor: pointer; transition: all .2s ease;
}
.tl-edit-btn:hover { border-color: var(--theme); background: var(--theme-soft); }
.tl-edit-btn.is-on {
  color: #fff; background: var(--theme-strong); border-color: var(--theme-strong);
}
.tl-edit-hint {
  margin: 6px 0 0; font-size: 12px; color: var(--gold); letter-spacing: .5px;
}
.tl-edit-hint:empty { display: none; }

/* ---------- 编辑行 ---------- */
.tl-edit-text {
  display: block; width: 100%; box-sizing: border-box;
  padding: 10px 12px; margin: 0;
  font-family: inherit; font-size: 15px; line-height: 1.8; color: var(--text);
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
  resize: vertical; overflow: hidden; min-height: 52px;
  -webkit-appearance: none;
}
.tl-edit-text:focus {
  outline: none; border-color: var(--theme); box-shadow: 0 0 0 2px rgba(80,110,95,.10);
}
/* v3.39：键盘可见焦点（年度事件编辑框） */
.tl-edit-text:focus-visible {
  outline: 2px solid var(--theme, #5c7a6b);
  outline-offset: 2px;
}
.tl-item.is-editing.empty .tl-card {
  background: rgba(255,255,255,.5); border-style: dashed;
}
.tl-item.is-editing.empty .tl-edit-text { background: transparent; }

.tl-edit-foot {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 10px;
}
.tl-photo-add {
  padding: 6px 13px; font-family: inherit; font-size: 13px;
  color: var(--theme-strong); background: transparent;
  border: 1px dashed var(--line); border-radius: 999px; cursor: pointer;
  transition: all .2s ease;
}
.tl-photo-add:hover { border-color: var(--theme); background: var(--theme-soft); }
.tl-file { display: none; }
.tl-state { font-size: 12px; color: var(--text-soft); opacity: .8; }
.tl-state.ok { color: var(--theme); opacity: .9; }
.tl-state.err { color: #b4534b; opacity: 1; cursor: pointer; text-decoration: underline; }
.tl-state.pending { color: var(--gold); opacity: .9; }

/* ---------- 照片网格（v3.22：图片 + 文件名） ---------- */
.tl-photos {
  display: grid; gap: 10px 8px; margin-top: 12px;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
}
.tl-photos-read { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.tl-photo-cell {
  margin: 0; min-width: 0;
  display: flex; flex-direction: column;
}
.tl-photo-frame {
  position: relative; overflow: hidden;
  aspect-ratio: 1 / 1; border-radius: 8px;
  border: 1px solid var(--line); background: var(--theme-soft);
}
.tl-photos-read .tl-photo-frame { aspect-ratio: 4 / 3; }
.tl-photo-frame img {
  display: block; width: 100%; height: 100%; object-fit: cover; cursor: zoom-in;
}
.tl-photo-frame img:hover { opacity: .93; }
.tl-photo-del {
  position: absolute; top: 4px; right: 4px;
  width: 24px; height: 24px; padding: 0; line-height: 1;
  font-size: 16px; color: var(--text);
  background: rgba(255,255,255,.9); border: none; border-radius: 50%;
  cursor: pointer; box-shadow: 0 0 0 1px rgba(0,0,0,.06);
}
.tl-photo-del:hover { background: #b4534b; color: #fff; }

/* 文件名：只读态显示在图片下方 */
.tl-photo-cap {
  margin: 5px 0 0; font-size: 11.5px; line-height: 1.45; text-align: center;
  color: var(--text-soft); letter-spacing: .2px; word-break: break-all;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  cursor: zoom-in;
}
.tl-photos-read .tl-photo-cap { font-size: 12px; color: var(--theme-strong); opacity: .85; }

/* 文件名：编辑态可直接改 */
.tl-photo-name {
  width: 100%; box-sizing: border-box; margin-top: 5px; min-width: 0;
  padding: 5px 6px; font-family: inherit; font-size: 12px; line-height: 1.4;
  color: var(--text); background: #fff; text-align: center;
  border: 1px solid var(--line); border-radius: 6px;
  -webkit-appearance: none;
}
.tl-photo-name::placeholder { color: var(--text-soft); opacity: .55; }
.tl-photo-name:focus { outline: none; border-color: var(--theme); box-shadow: 0 0 0 2px rgba(80,110,95,.10); }
/* v3.39：键盘可见焦点（照片文件名输入框） */
.tl-photo-name:focus-visible {
  outline: 2px solid var(--theme, #5c7a6b);
  outline-offset: 2px;
}

/* ---------- 解锁弹窗 ---------- */
.tl-modal {
  position: fixed; inset: 0; z-index: 320;
  display: flex; align-items: center; justify-content: center;
  padding: 20px; background: rgba(18,22,20,.55);
}
.tl-modal.hidden { display: none; }
.tl-modal-box {
  width: 100%; max-width: 340px; box-sizing: border-box;
  padding: 22px 20px 16px; border-radius: 14px;
  background: var(--card); border: 1px solid var(--line);
  box-shadow: 0 18px 40px rgba(0,0,0,.18);
}
.tl-modal-title {
  margin: 0 0 6px; font-family: "Songti SC", "STSong", Georgia, serif;
  font-size: 18px; font-weight: 500; color: var(--theme-strong); letter-spacing: 1px;
}
.tl-modal-sub { margin: 0 0 14px; font-size: 12.5px; line-height: 1.7; color: var(--text-soft); }
.tl-modal-input {
  width: 100%; box-sizing: border-box; padding: 10px 12px;
  font-family: inherit; font-size: 15px; color: var(--text);
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
}
.tl-modal-input:focus { outline: none; border-color: var(--theme); }
/* v3.39：键盘可见焦点（解锁弹层的密码框） */
.tl-modal-input:focus-visible {
  outline: 2px solid var(--theme, #5c7a6b);
  outline-offset: 2px;
}
.tl-modal-msg { min-height: 16px; margin: 8px 0 0; font-size: 12.5px; color: #b4534b; }
.tl-modal-actions { display: flex; gap: 10px; margin-top: 6px; }
.tl-modal-btn {
  flex: 1; padding: 9px 0; font-family: inherit; font-size: 14px;
  color: var(--text); background: transparent;
  border: 1px solid var(--line); border-radius: 8px; cursor: pointer;
}
.tl-modal-btn-main {
  color: #fff; background: var(--theme-strong); border-color: var(--theme-strong);
}
.tl-modal-btn:disabled { opacity: .6; cursor: default; }

@media (max-width: 640px) {
  .tl-edit-btn { padding: 6px 13px; font-size: 13px; }
  .tl-edit-text { font-size: 16px; }        /* 防 iOS 聚焦自动放大 */
  .tl-modal-input { font-size: 16px; }
  .tl-photos { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 6px; }
  .tl-photos-read { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tl-photo-del { width: 22px; height: 22px; font-size: 15px; }
  .tl-photo-name { font-size: 16px; }       /* 防 iOS 聚焦自动放大 */
  .tl-photo-cap { font-size: 11px; }
}
