.timeline-editor {
    max-width: 820px;
    margin: 24px auto 48px;
    width: calc(100% - 24px);
    padding: clamp(16px, 4vw, 32px);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 8px 28px rgba(23, 43, 77, .11);
}
.timeline-editor form { margin-top: 16px; }
.timeline-editor label { font-weight: 600; }
.timeline-editor-media {
    border: 1px solid #dce4ee;
    background: #f6f8fc;
    border-radius: 10px;
    margin: 12px 0 20px;
    min-width: 0;
    padding: clamp(12px, 3vw, 20px);
}
.timeline-editor-media legend { width: auto; padding: 0 6px; font-size: 1rem; font-weight: 700; }
.timeline-editor-media [hidden] { display: none !important; }
.timeline-media-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    padding: 4px;
    margin-bottom: 14px;
    border-radius: 10px;
    background: #e7edf6;
}
.timeline-media-tabs label { position: relative; margin: 0; cursor: pointer; }
.timeline-media-tabs input, .timeline-photo-action input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}
.timeline-media-tabs span {
    display: grid;
    place-items: center;
    min-height: 42px;
    border: 1px solid transparent;
    border-radius: 7px;
    color: #334c6b;
    text-align: center;
}
.timeline-media-tabs input:checked + span {
    border-color: #c5d9f7;
    background: #fff;
    color: #1356b0;
    box-shadow: 0 1px 3px #23385a18;
}
.timeline-media-tabs input:focus-visible + span,
.timeline-photo-action:focus-visible,
.timeline-photo-action:has(input:focus-visible),
.timeline-photo-picker:focus-within { outline: 2px solid #165dc0; outline-offset: 2px; }
.timeline-photo-picker {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    margin: 0;
    border: 1px dashed #87a8d8;
    border-radius: 9px;
    background: #fff;
    color: #194f98;
    cursor: pointer;
}
.timeline-photo-picker:hover { background: #edf5ff; }
.timeline-photo-picker input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.timeline-picker-plus {
    display: grid;
    flex: 0 0 34px;
    place-items: center;
    height: 34px;
    border-radius: 8px;
    background: #e7f0fe;
    font: 24px/1 Arial, sans-serif;
}
.timeline-photo-picker small { display: block; font-weight: 400; color: #455976; }
#timeline-photo-count { margin-left: auto; white-space: nowrap; font-size: .85rem; }
.timeline-media-note { color: #495b75; font-size: .9rem; margin: 0 0 10px; }
.timeline-thumbnails { display: grid; grid-template-columns: repeat(auto-fill, minmax(105px, 1fr)); gap: 10px; margin: 12px 0 0; }
.timeline-thumbnails:empty { display: none; }
.timeline-thumbnail { overflow: hidden; border: 1px solid #dce4ee; border-radius: 8px; background: #fff; }
.timeline-thumbnail img { display: block; width: 100%; height: 84px; object-fit: cover; }
.timeline-thumbnail:has(input:checked) img { opacity: .45; }
.timeline-photo-action {
    position: relative;
    display: grid;
    place-items: center;
    width: 100%;
    min-height: 34px;
    margin: 0;
    border: 0;
    border-top: 1px solid #dce4ee;
    background: #fff;
    color: #a52131;
    font-size: .85rem;
    font-weight: 600;
    cursor: pointer;
}
.timeline-photo-action:hover { background: #fff2f3; }
.timeline-photo-action .timeline-undo-text,
.timeline-photo-action input:checked ~ .timeline-remove-text { display: none; }
.timeline-photo-action input:checked ~ .timeline-undo-text { display: inline; color: #194f98; }
#timeline-media-error:empty { display: none; }
.timeline-gallery {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    background: #f0f3f8;
    isolation: isolate;
}
.timeline-slide { position: relative; aspect-ratio: 16 / 10; }
.timeline-slide[hidden] { display: none !important; }
.timeline-slide > a:first-child { display: block; height: 100%; }
.timeline-slide > a:first-child[data-timeline-enlarge] { cursor: zoom-in; }
.timeline-enlarge {
    position: absolute;
    top: 8px;
    right: 8px;
    border-radius: 50%;
    background: #111c30;
    color: #fff;
}
.timeline-enlarge:hover, .timeline-enlarge:focus { color: #fff; background: #23416d; }
.timeline-image-viewer {
    position: fixed;
    inset: 0;
    margin: auto;
    width: min(1100px, calc(100vw - 24px));
    max-width: none;
    max-height: none;
    padding: 0;
    border: 1px solid #51617b;
    border-radius: 12px;
    background: #111c30;
    color: #fff;
    overflow: hidden;
}
.timeline-image-viewer::backdrop { background: rgb(5 11 23 / 84%); }
html:has(.timeline-image-viewer[open]) { overflow: hidden; }
.timeline-viewer-toolbar { display: flex; justify-content: flex-end; gap: 8px; padding: 8px; }
.timeline-enlarge,
.timeline-viewer-toolbar button {
    display: inline-grid;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    font-size: 18px;
    text-decoration: none;
}
.timeline-viewer-toolbar button {
    border: 1px solid #51617b;
    border-radius: 8px;
    background: #233551;
    color: #fff;
}
.timeline-viewer-toolbar button:hover { background: #365581; }
.timeline-viewer-stage { height: 78vh; height: 78dvh; overflow: auto; background: #090f1a; }
.timeline-viewer-stage img { display: block; width: 100%; height: 100%; max-width: none; object-fit: contain; }
.timeline-viewer-stage.is-zoomed img { width: 200%; height: 200%; }
.timeline-gallery .timeline-slide img,
.timeline-gallery .timeline-slide iframe {
    display: block;
    width: 100% !important;
    height: 100% !important;
    object-fit: contain;
    border: 0;
}
.timeline-gallery-controls {
    position: absolute;
    inset: auto 0 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 8px;
    pointer-events: none;
}
.timeline-gallery-controls button, .timeline-gallery-controls span {
    border: 0;
    border-radius: 24px;
    background: rgba(14, 23, 42, .88);
    color: #fff;
    text-align: center;
}
.timeline-gallery-controls button { width: 44px; height: 44px; font: 28px/1 Arial, sans-serif; pointer-events: auto; cursor: pointer; }
.timeline-gallery-controls span { padding: 4px 10px; font-size: 14px; }
.timeline-post-content { white-space: pre-line; overflow-wrap: anywhere; }
