.memory-timeline {
  --tl-accent: var(--accent, #356457);
  --tl-line: var(--line, #dcdfd7);
  --tl-text: var(--ink, #24332e);
  --tl-muted: var(--muted, #65716a);
  position: relative;
  min-width: 0;
  color: var(--tl-text);
  background: var(--surface, #fff);
  border: 1px solid var(--tl-line);
  border-radius: 16px;
  padding: 21px 23px 18px;
}
.memory-timeline *, .memory-timeline *::before, .memory-timeline *::after { box-sizing: border-box; }
.memory-timeline [hidden] { display: none !important; }
.memory-timeline button { font: inherit; cursor: pointer; }
.memory-timeline button[disabled] { cursor: default; opacity: .4; }
.memory-timeline button:focus-visible, .memory-timeline input:focus-visible, .memory-timeline textarea:focus-visible {
  outline: 2px solid var(--tl-accent);
  outline-offset: 3px;
}
.tl-header, .tl-header-actions, .tl-heading, .tl-heading-meta, .tl-tile-foot, .tl-editor-top, .tl-editor-actions, .tl-order-actions {
  display: flex;
  align-items: center;
}
.tl-header { justify-content: space-between; column-gap: 16px; margin-bottom: 18px; }
.tl-heading { min-width: 0; flex-wrap: wrap; gap: 5px 13px; }
.tl-heading h2 { margin: 0; font-size: 1.04rem; font-weight: 650; line-height: 1.3; letter-spacing: -.025em; }
.tl-heading-meta { color: var(--tl-muted); font-size: .78rem; gap: 8px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tl-meta-dot { width: 3px; height: 3px; border-radius: 50%; background: currentColor; opacity: .65; }
.tl-header-actions { gap: 5px; flex-shrink: 0; }
.memory-timeline .tl-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 12px;
  border: 1px solid #cdd8cd;
  border-radius: 8px;
  background: #f3f6f1;
  color: var(--tl-accent);
  font-size: .84rem;
  font-weight: 650;
  line-height: 1.2;
}
.memory-timeline .tl-add:hover { background: #e8efe7; }
.tl-icon { width: 17px; height: 17px; flex: 0 0 auto; display: block; }
.tl-track {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  scrollbar-color: #c6cec5 transparent;
  padding: 3px 3px 8px;
  margin: -3px -3px -5px;
}
.tl-entry { position: relative; flex: 1 0 clamp(127px, 11.4vw, 170px); max-width: 204px; min-width: 0; border-radius: 9px; }
.memory-timeline .tl-tile {
  display: block;
  position: relative;
  width: 100%;
  text-align: left;
  padding: 0;
  border: 0;
  border-radius: 8px;
  color: var(--tl-text);
  background: transparent;
}
.tl-thumb {
  display: block;
  position: relative;
  overflow: hidden;
  aspect-ratio: 1.8;
  width: 100%;
  border-radius: 7px;
  isolation: isolate;
  background: #dde3d9;
  box-shadow: inset 0 0 0 1px rgba(18,39,29,.07);
}
.tl-thumb > img, .tl-thumb > video { width: 100%; height: 100%; display: block; object-fit: cover; pointer-events: none; }
.tl-thumb > img[hidden], .tl-thumb > video[hidden] { display: none; }
.tl-entry.is-current .tl-thumb { outline: 2px solid var(--tl-accent); outline-offset: 2px; }
.tl-entry.is-current .tl-title { color: var(--tl-accent); }
.tl-entry:not(.is-current) .tl-tile:hover .tl-thumb { outline: 1px solid #87998c; outline-offset: 2px; }
.tl-type-chip {
  position: absolute;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  left: 6px;
  bottom: 6px;
  border-radius: 4px;
  padding: 3px 5px;
  background: rgba(30,35,30,.64);
  color: #fff;
  font-size: .7rem;
  font-weight: 550;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}
.tl-type-chip .tl-icon { width: 12px; height: 12px; }
.tl-tile-foot { justify-content: space-between; gap: 5px; margin: 8px 0 0; min-height: 23px; padding: 0 2px; }
.tl-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .8rem; font-weight: 550; }
.tl-start{flex:none;font-size:.72rem;color:var(--tl-muted);font-variant-numeric:tabular-nums}
.tl-clip-controls{display:flex;gap:5px;margin-top:5px}
.memory-timeline .tl-clip-controls .action{flex:1;min-width:0;min-height:44px;padding:5px;font-size:.78rem}
.memory-timeline .tl-more {
  display: grid; place-items: center; position: absolute; right: -1px; bottom: -3px;
  width: 30px; height: 28px; padding: 0; border: 0; border-radius: 5px; background: transparent; color: var(--tl-muted);
}
.tl-more .tl-icon { width: 17px; }
.memory-timeline .tl-more:hover { background: #edf1eb; color: var(--tl-accent); }
.tl-bookend .tl-thumb { background: linear-gradient(120deg, #3f574b, #243d35); }
.tl-bookend .tl-thumb > img { position: absolute; inset: 0; opacity: .55; }
.tl-bookend-art {
  position: absolute; inset: 0; display: grid; align-content: center; justify-items: center;
  gap: 4px; padding: 7px 9px 13px; color: #fffcf3; text-align: center; text-shadow: 0 1px 5px #1e302b;
  background: linear-gradient(0deg, rgba(15,26,21,.32), rgba(15,26,21,.06));
}
.tl-bookend-art .tl-icon { width: 18px; height: 15px; color: #e9e8c8; }
.tl-bookend-art span { font: italic .78rem/1.07 Georgia, serif; max-width: 96%; max-height: 2.2em; overflow: hidden; }
.tl-bookend[data-kind="closing"] .tl-bookend-art { background: radial-gradient(ellipse at 55% 30%, #5b7060, #31483b); }
.tl-bookend[data-kind="closing"][data-theme="ivory"] .tl-bookend-art { background: radial-gradient(ellipse at 55% 30%, #817460, #453a2d); }
.tl-bookend[data-kind="closing"][data-theme="twilight"] .tl-bookend-art { background: radial-gradient(ellipse at 55% 30%, #566074, #252b39); }
.tl-media-fallback { position: absolute; inset: 0; display: grid; place-items: center; color: #667668; z-index: -1; }
.tl-media-fallback .tl-icon { width: 27px; height: 27px; }
.tl-entry.is-dragging { opacity: .5; }
.tl-entry.is-target::before { content: ""; position: absolute; left: -7px; top: 2px; bottom: 4px; width: 3px; border-radius: 3px; background: var(--tl-accent); }
.tl-entry.is-target[data-after="true"]::before { left: auto; right: -7px; }
.memory-timeline.is-file-over { outline: 2px dashed var(--tl-accent); outline-offset: -5px; }
.tl-empty-add {
  display: flex; flex: 1 0 170px; align-self: stretch; align-items: center; justify-content: center; flex-direction: column; gap: 7px;
  max-width: 280px; padding: 10px; border: 1px dashed #a9baab; border-radius: 8px; background: #f6f8f3; color: var(--tl-accent);
}
.memory-timeline .tl-empty-add { font-size: .82rem; }
.tl-editor {
  width: min(420px, calc(100vw - 28px));
  max-height: min(84vh, 680px);
  overflow-y: auto;
  padding: 22px;
  border: 1px solid var(--tl-line);
  border-radius: 15px;
  color: var(--tl-text);
  background: #fff;
  box-shadow: 0 18px 65px rgba(21,36,26,.19);
  margin: auto;
}
.tl-editor::backdrop { background: rgba(20,32,25,.39); }
.tl-editor-top { justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.tl-editor-top h3 { margin: 0; font: 500 1.55rem/1.3 Georgia, serif; }
.tl-editor label { display: grid; gap: 6px; font-size: .88rem; font-weight: 590; margin: 14px 0; }
.tl-editor input:not([type=checkbox]), .tl-editor textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--tl-line); border-radius: 7px; font: inherit; font-weight: 400; font-size: 1rem; line-height: 1.35; color: var(--tl-text); background: white;
}
.tl-editor textarea { resize: vertical; min-height: 54px; }
.tl-editor .tl-check { display: flex; gap: 8px; align-items: center; }
.tl-editor .tl-trim { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.tl-editor .tl-trim label { margin: 0; }
.tl-editor input[type=checkbox] { accent-color: var(--tl-accent); }
.tl-editor .tl-editor-btn, .tl-editor .tl-close {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--tl-line); border-radius: 7px;
  background: #fff; color: var(--tl-text); padding: 7px 10px; font-size: .82rem; font-weight: 570; min-height: 35px;
}
.tl-editor .tl-close { padding: 5px; width: 34px; height: 34px; border-color: transparent; }
.tl-editor .tl-close:hover, .tl-editor .tl-editor-btn:hover { background: #f2f5ef; }
.tl-editor .tl-save { background: var(--tl-accent); border-color: var(--tl-accent); color: white; }
.tl-editor .tl-save:hover { background: #284e43; }
.tl-editor .tl-remove { color: #985041; border-color: transparent; }
.tl-order-actions { gap: 7px; flex-wrap: wrap; }
.tl-order-label { font-size: .88rem; font-weight: 590; margin: 14px 0 6px; }
.tl-editor-actions { justify-content: space-between; gap: 6px; margin-top: 20px; padding-top: 15px; border-top: 1px solid var(--tl-line); }
.tl-editor-error { color: #984b39; font-size: .86rem; }
.tl-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
@media (pointer: coarse) {
  .slide-duration-form input { font-size: max(16px, 1em); }
}
@media (max-width: 710px) {
  .memory-timeline { padding: 17px 16px 14px; border-radius: 13px; }
  .tl-header { margin-bottom: 14px; }
  .tl-heading { display: grid; gap: 4px; }
  .tl-heading h2 { font-size: 1rem; }
  .tl-track { gap: 10px; }
  .tl-entry { flex-basis: 136px; }
  .memory-timeline .tl-more { width: 32px; min-height: 32px; }
  .tl-editor { padding: 18px; }
}
@media (pointer: coarse) {
  .memory-timeline .tl-add, .tl-editor .tl-editor-btn, .tl-editor .tl-close { min-height: 42px; }
  .tl-tile-foot { min-height: 31px; margin-top: 3px; }
  .memory-timeline .tl-more { height: 37px; width: 34px; }
}
