.advanced-profile-timeline-modal {
    max-width: 1320px !important;
    width: 97% !important;
    height: min(900px, calc(100dvh - 48px));
    max-height: calc(100dvh - 48px);
    padding: 0 !important;
    overflow: hidden;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
}

.advanced-profile-timeline {
    --apt-bg: rgba(6, 10, 30, 0.98);
    --apt-panel: rgba(14, 20, 50, 0.96);
    --apt-panel-soft: rgba(25, 34, 79, 0.72);
    --apt-line: rgba(145, 161, 255, 0.45);
    --apt-border: rgba(126, 145, 255, 0.38);
    --apt-border-hot: rgba(101, 228, 255, 0.82);
    --apt-text: #eef2ff;
    --apt-muted: #aebaff;
    --apt-soft: #7d89c9;
    --apt-accent: #7d8cff;
    --apt-cyan: #47d9ff;
    --apt-pink: #ff6fbd;
    --apt-orange: #ffbc5f;
    --apt-danger: #ff6f91;
    color: var(--apt-text);
    background:
        radial-gradient(circle at 18% 0%, rgba(71, 217, 255, 0.16), transparent 32%),
        radial-gradient(circle at 82% 6%, rgba(255, 111, 189, 0.14), transparent 30%),
        linear-gradient(135deg, rgba(7, 10, 28, 0.98), rgba(16, 22, 58, 0.98));
    display: grid;
    grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
    min-height: 0;
    height: 100%;
    overflow: hidden;
}

.apt-sidebar {
    border-right: 1px solid var(--apt-border);
    background: rgba(5, 9, 25, 0.58);
    padding: 14px;
    overflow: auto;
    min-height: 0;
}

.apt-stage {
    min-width: 0;
    min-height: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    gap: 10px;
    padding: 14px;
    overflow: hidden;
}

.apt-titlebar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    border-bottom: 1px solid var(--apt-border);
    padding: 14px 16px;
    background: rgba(3, 7, 20, 0.46);
}

.apt-titlebar h3 {
    color: var(--apt-text) !important;
    margin: 0 0 4px !important;
    font-size: 20px;
}

.apt-titlebar p {
    margin: 0;
    color: var(--apt-muted);
    font-size: 12px;
}

.apt-title-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.apt-section {
    border: 1px solid var(--apt-border);
    border-radius: 12px;
    background: var(--apt-panel);
    padding: 12px;
    margin-bottom: 12px;
}

.apt-section h4 {
    margin: 0 0 10px;
    color: var(--apt-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.apt-field {
    display: grid;
    gap: 5px;
    margin-bottom: 9px;
}

.apt-field label {
    color: var(--apt-muted) !important;
    font-size: 12px;
    font-weight: 700;
}

.apt-field input,
.apt-field textarea {
    width: 100%;
    min-height: 36px;
    background: rgba(4, 8, 24, 0.8) !important;
    border: 1px solid var(--apt-border) !important;
    border-radius: 8px;
    color: var(--apt-text) !important;
    padding: 8px 10px;
}

.apt-field textarea {
    min-height: 92px;
    resize: vertical;
}

.apt-two {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.apt-btn {
    min-height: 36px;
    border: 1px solid var(--apt-border);
    border-radius: 9px;
    background: rgba(74, 95, 255, 0.18);
    color: var(--apt-text);
    cursor: pointer;
    padding: 8px 12px;
    transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.apt-btn:hover {
    transform: translateY(-1px);
    border-color: var(--apt-border-hot);
    box-shadow: 0 10px 24px rgba(71, 217, 255, 0.18);
}

.apt-btn.primary {
    border-color: rgba(71, 217, 255, 0.62);
    background: linear-gradient(135deg, rgba(71, 217, 255, 0.34), rgba(125, 140, 255, 0.5));
}

.apt-btn.danger {
    border-color: rgba(255, 111, 145, 0.52);
    background: rgba(255, 111, 145, 0.14);
}

.apt-btn.small {
    min-height: 32px;
    padding: 6px 9px;
    font-size: 12px;
}

.apt-btn[hidden],
.apt-owner-only[hidden] {
    display: none !important;
}

.apt-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.apt-toolbar-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.advanced-profile-timeline.apt-read-only {
    grid-template-columns: 1fr;
}

.advanced-profile-timeline.apt-read-only .apt-sidebar {
    display: none;
}

.advanced-profile-timeline.apt-read-only .apt-stage {
    padding: 16px;
}

.advanced-profile-timeline.apt-read-only .apt-toolbar {
    justify-content: flex-end;
}

.advanced-profile-timeline.apt-read-only .apt-canvas {
    cursor: zoom-in;
}

.apt-context-menu {
    position: fixed;
    z-index: 100000;
    display: none;
    min-width: 178px;
    padding: 7px;
    border: 1px solid rgba(71, 217, 255, 0.55);
    border-radius: 11px;
    background: rgba(8, 12, 34, 0.98);
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.45), 0 0 24px rgba(71, 217, 255, 0.16);
}

.apt-context-menu.active {
    display: grid;
    gap: 6px;
}

.apt-context-menu button {
    width: 100%;
    min-height: 34px;
    border: 1px solid rgba(126, 145, 255, 0.28);
    border-radius: 8px;
    background: rgba(74, 95, 255, 0.18);
    color: var(--apt-text);
    cursor: pointer;
    text-align: left;
    padding: 7px 10px;
}

.apt-context-menu button:hover {
    border-color: rgba(71, 217, 255, 0.72);
    background: rgba(71, 217, 255, 0.16);
}

.apt-photo-viewer {
    position: fixed;
    inset: 0;
    z-index: 100001;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 28px;
    background: rgba(2, 5, 18, 0.84);
    backdrop-filter: blur(12px);
}

.apt-photo-viewer.active {
    display: flex;
}

.apt-photo-viewer-frame {
    display: grid;
    gap: 12px;
    max-width: calc(100vw - 72px);
    max-height: calc(100dvh - 72px);
    margin: 0;
    padding: 12px;
    border: 1px solid rgba(139, 159, 255, 0.38);
    border-radius: 14px;
    background: rgba(8, 12, 34, 0.96);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55), 0 0 34px rgba(74, 95, 255, 0.2);
}

.apt-photo-viewer-frame img {
    display: block;
    width: auto;
    height: auto;
    max-width: calc(100vw - 104px);
    max-height: calc(100dvh - 150px);
    object-fit: contain;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.32);
}

.apt-photo-viewer-frame figcaption {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    color: #dfe5ff;
    font-size: 13px;
    line-height: 1.35;
    min-width: 0;
}

.apt-photo-viewer-frame figcaption strong,
.apt-photo-viewer-frame figcaption span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.apt-photo-viewer-frame figcaption span {
    color: #aebaff;
    flex: 0 0 auto;
}

.apt-photo-viewer-close {
    position: fixed;
    top: 18px;
    right: 18px;
    width: 32px;
    height: 32px;
    border: 1px solid rgba(255, 140, 155, 0.38);
    border-radius: 9px;
    background: rgba(255, 110, 130, 0.14);
    color: #ffc2ca;
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.apt-photo-viewer-close::before,
.apt-photo-viewer-close::after {
    content: "";
    position: absolute;
    left: 9px;
    top: 15px;
    width: 14px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
}

.apt-photo-viewer-close::before {
    transform: rotate(45deg);
}

.apt-photo-viewer-close::after {
    transform: rotate(-45deg);
}

.apt-photo-viewer-close:hover {
    background: rgba(255, 110, 130, 0.24);
    border-color: rgba(255, 160, 170, 0.64);
    box-shadow: 0 10px 24px rgba(255, 90, 110, 0.2);
    transform: translateY(-1px);
}

.apt-status {
    color: var(--apt-muted);
    font-size: 12px;
    min-height: 18px;
}

.apt-canvas-wrap {
    min-height: 0;
    position: relative;
}

.apt-canvas {
    width: 100%;
    height: 100%;
    min-height: 360px;
    display: block;
    border: 1px solid var(--apt-border);
    border-radius: 14px;
    background: rgba(7, 11, 30, 0.92);
}

.apt-profile-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--apt-muted);
    font-size: 12px;
    border: 1px solid var(--apt-border);
    border-radius: 999px;
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.04);
}

.apt-drop-zone {
    position: relative;
    min-height: 118px;
    display: grid;
    place-items: center;
    text-align: center;
    overflow: hidden;
    border: 2px dashed rgba(71, 217, 255, 0.82);
    border-radius: 14px;
    background:
        linear-gradient(135deg, rgba(71, 217, 255, 0.18), rgba(255, 111, 189, 0.18)),
        rgba(10, 14, 39, 0.9);
    color: #ffffff;
    cursor: pointer;
    box-shadow: 0 0 28px rgba(71, 217, 255, 0.2), inset 0 0 22px rgba(255, 255, 255, 0.04);
    isolation: isolate;
}

.apt-drop-zone::before {
    content: "";
    position: absolute;
    inset: -45%;
    background: conic-gradient(from 180deg, transparent, rgba(71, 217, 255, 0.25), transparent, rgba(255, 111, 189, 0.22), transparent);
    animation: aptDropSpin 7s linear infinite;
    z-index: -2;
}

.apt-drop-zone::after {
    content: "";
    position: absolute;
    inset: 3px;
    border-radius: 11px;
    background: rgba(7, 11, 30, 0.66);
    z-index: -1;
}

.apt-drop-zone.dragging,
.apt-drop-zone:hover {
    border-color: rgba(255, 188, 95, 0.95);
    box-shadow: 0 0 32px rgba(255, 188, 95, 0.28), 0 0 44px rgba(71, 217, 255, 0.18);
}

.apt-drop-icon {
    display: block;
    font-size: 34px;
    line-height: 1;
    margin-bottom: 8px;
    color: var(--apt-cyan);
    text-shadow: 0 0 16px rgba(71, 217, 255, 0.8);
}

.apt-drop-main {
    display: block;
    font-weight: 800;
    font-size: 15px;
}

.apt-drop-sub {
    display: block;
    color: var(--apt-muted);
    font-size: 12px;
    margin-top: 3px;
}

.apt-event-list {
    max-height: 190px;
    overflow: auto;
    display: grid;
    gap: 6px;
}

.apt-event-row {
    display: grid;
    grid-template-columns: 74px minmax(0, 1fr);
    gap: 8px;
    align-items: center;
    width: 100%;
    text-align: left;
    border: 1px solid var(--apt-border);
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--apt-text);
    padding: 7px 9px;
    cursor: pointer;
}

.apt-event-row.active {
    border-color: var(--apt-pink);
    background: rgba(255, 111, 189, 0.12);
}

.apt-event-year {
    color: var(--apt-muted);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

.apt-event-title {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.apt-empty {
    color: var(--apt-soft);
    font-size: 12px;
    padding: 6px 2px;
}

.apt-file-input {
    display: none;
}

.timeline-window {
    max-width: 620px;
    min-height: 164px;
    margin: 18px auto 24px;
    border-radius: 14px;
    background:
        linear-gradient(135deg, rgba(13, 19, 48, 0.96), rgba(19, 31, 66, 0.92)),
        radial-gradient(circle at 18% 20%, rgba(71, 217, 255, 0.12), transparent 34%);
}

.timeline-window-header {
    min-height: 44px;
    padding: 9px 12px;
    border-bottom-color: rgba(126, 145, 255, 0.25);
}

.timeline-window-body {
    padding: 0 12px 12px;
}

.timeline-horizontal {
    min-height: 104px;
    margin: 0;
    padding: 16px 46px 18px;
}

.timeline-line {
    left: 46px;
    right: 46px;
    height: 2px;
    background: linear-gradient(90deg, rgba(71, 217, 255, 0.22), rgba(255, 188, 95, 0.66), rgba(255, 111, 189, 0.5));
}

.timeline-label {
    font-size: 10px;
    letter-spacing: 0.6px;
    color: #aebaff;
}

.timeline-posts.apt-preview-track {
    min-height: 72px;
    padding: 0;
}

.apt-window-title,
.apt-window-action {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.apt-window-title {
    color: #f4f7ff;
    font-weight: 800;
    font-size: 13px;
}

.apt-window-action {
    color: #b9c4ff;
    font-size: 11px;
    white-space: nowrap;
}

.apt-timeline-symbol {
    position: relative;
    width: 32px;
    height: 18px;
    display: inline-block;
}

.apt-timeline-symbol::before {
    content: "";
    position: absolute;
    left: 3px;
    right: 3px;
    top: 8px;
    height: 2px;
    background: linear-gradient(90deg, #47d9ff, #ffbc5f, #ff6fbd);
    border-radius: 999px;
}

.apt-timeline-symbol::after,
.apt-timeline-symbol i {
    content: "";
    position: absolute;
    top: 4px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #47d9ff;
    box-shadow: 11px 0 0 #ffbc5f, 22px 0 0 #ff6fbd;
}

.apt-timeline-symbol::after {
    left: 0;
}

.apt-timeline-symbol i {
    display: none;
}

.apt-preview-copy {
    position: absolute;
    left: 46px;
    top: 8px;
    display: grid;
    gap: 2px;
    max-width: calc(100% - 92px);
    pointer-events: none;
}

.apt-preview-copy strong {
    color: #ffffff;
    font-size: 13px;
    line-height: 1.15;
}

.apt-preview-copy span {
    color: #aebaff;
    font-size: 11px;
}

.apt-preview-marker {
    position: absolute;
    top: 48px;
    transform: translateX(-50%);
    width: 58px;
    min-height: 56px;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
}

.apt-preview-pin {
    position: absolute;
    left: 50%;
    top: 22px;
    width: 9px;
    height: 9px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: #ffbc5f;
    box-shadow: 0 0 16px rgba(255, 188, 95, 0.8);
}

.apt-preview-card {
    position: absolute;
    left: 50%;
    top: 0;
    width: 52px;
    height: 48px;
    transform: translateX(-50%);
    display: grid;
    grid-template-rows: 32px 1fr;
    gap: 2px;
    padding: 4px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    background: rgba(5, 9, 25, 0.88);
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.28);
    transition: transform 0.18s ease, border-color 0.18s ease;
}

.apt-preview-marker:hover .apt-preview-card {
    transform: translate(-50%, -5px);
    border-color: rgba(71, 217, 255, 0.78);
}

.apt-preview-card img,
.apt-preview-placeholder {
    width: 100%;
    height: 32px;
    border-radius: 5px;
    object-fit: cover;
    display: block;
}

.apt-preview-card span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #f4f7ff;
    font-size: 8px;
    line-height: 10px;
    text-align: center;
}

.apt-preview-placeholder-a,
.apt-preview-placeholder-1 {
    background: linear-gradient(135deg, #47d9ff, #2756ff);
}

.apt-preview-placeholder-b,
.apt-preview-placeholder-2 {
    background: linear-gradient(135deg, #ffbc5f, #ff6f91);
}

.apt-preview-placeholder-c,
.apt-preview-placeholder-3 {
    background: linear-gradient(135deg, #8fffd2, #4a5fff);
}

.apt-preview-placeholder-d,
.apt-preview-placeholder-4 {
    background: linear-gradient(135deg, #ff6fbd, #7d8cff);
}

.apt-launcher-empty {
    display: grid;
    place-items: center;
    min-height: 130px;
    text-align: center;
    color: #cfd6ff;
}

.apt-launcher-empty strong {
    display: block;
    color: #ffffff;
    font-size: 18px;
    margin-bottom: 5px;
}

.apt-legacy-dots {
    display: none !important;
}

@keyframes aptDropSpin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 900px) {
    .advanced-profile-timeline {
        grid-template-columns: 1fr;
        max-height: none;
    }

    .advanced-profile-timeline-modal {
        width: 100% !important;
        height: calc(100dvh - 24px);
        max-height: calc(100dvh - 24px);
    }

    .apt-sidebar {
        border-right: 0;
        border-bottom: 1px solid var(--apt-border);
        max-height: 44dvh;
    }

    .apt-stage {
        min-height: 0;
    }

    .apt-canvas {
        min-height: 360px;
    }

    .timeline-window {
        max-width: 100%;
        margin: 14px auto 20px;
    }

    .timeline-window-header {
        gap: 6px;
        align-items: flex-start;
    }

    .apt-window-action {
        white-space: normal;
        text-align: right;
    }

    .timeline-horizontal {
        padding-left: 34px;
        padding-right: 34px;
    }

    .timeline-line {
        left: 34px;
        right: 34px;
    }

    .apt-preview-copy {
        left: 34px;
        max-width: calc(100% - 68px);
    }
}
