.ttp-preview-overlay {
    --ttp-heading: #060318;
    --ttp-title: #262626;
    --ttp-paragraph: #3c3f40;
    --ttp-disable: #7a7b8e;
    --ttp-placeholder: #9a9cac;
    --ttp-placeholder-2: #aaacb7;
    --ttp-stroke: #e8e8e8;
    --ttp-light: #f4f5fb;
    --ttp-light-disabled: #f3f5f9;
    --ttp-bg-1: #f8fafc;
    --ttp-white: #ffffff;
}

.ttp-preview-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.2);
}

.ttp-preview-overlay[hidden] {
    display: none;
}

.ttp-preview-modal {
    width: 1120px;
    max-width: 100%;
    max-height: 100%;
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 20px;
    border-radius: 16px;
    background: var(--ttp-white);
    overflow: hidden;
}

.ttp-preview-head {
    flex: 0 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    row-gap: 8px;
}

.ttp-preview-heading {
    flex: 1 1 0;
    min-width: 300px;
    max-width: 390px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    white-space: nowrap;
}

.ttp-preview-heading .ttp-preview-title {
    margin: 0;
    font-size: 20px;
    line-height: 24px;
    font-weight: 700;
    color: var(--ttp-title);
}

.ttp-preview-heading .ttp-preview-meta {
    margin: 0;
    font-size: 16px;
    line-height: 24px;
    font-weight: 400;
    color: var(--ttp-paragraph);
}

.ttp-preview-head-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ttp-preview-body {
    flex: 0 1 600px;
    height: 600px;
    min-height: 0;
    display: flex;
    border: 1px solid var(--ttp-stroke);
    border-radius: 12px;
    overflow: hidden;
}

.ttp-preview-settings {
    flex: 0 0 360px;
    width: 360px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 16px;
    border-right: 1px solid var(--ttp-stroke);
    overflow-y: auto;
}

.ttp-setting {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ttp-setting .ttp-setting-title {
    margin: 0;
    font-size: 16px;
    line-height: 24px;
    font-weight: 700;
    color: var(--ttp-heading);
}

.ttp-segment {
    display: flex;
    gap: 8px;
}

.ttp-segment button {
    flex: 1 1 0;
    min-width: 0;
    height: 32px;
    padding: 6px 12px;
    border: 0;
    border-radius: 999px;
    background: var(--ttp-light);
    font-size: 14px;
    line-height: 20px;
    font-weight: 500;
    color: var(--ttp-heading);
    white-space: nowrap;
    overflow: hidden;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.ttp-segment button:hover:not(.is-active) {
    background: #e9ebf5;
}

.ttp-segment button.is-active {
    background: var(--ttp-heading);
    color: var(--ttp-white);
}

.ttp-custom-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 14px;
    line-height: 20px;
    font-weight: 500;
    color: var(--ttp-disable);
}

.ttp-custom-row[hidden] {
    display: none;
}

.ttp-custom-row input {
    width: 100%;
    min-width: 0;
    height: 32px;
    padding: 6px 12px;
    border: 1px solid var(--ttp-stroke);
    border-radius: 999px;
    font-size: 14px;
    line-height: 20px;
    font-weight: 500;
    color: var(--ttp-heading);
    outline: none;
}

.ttp-custom-row input:focus {
    border-color: var(--ttp-heading);
}

.ttp-size-select {
    width: 100%;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 12px;
    border: 1px solid var(--ttp-stroke);
    border-radius: 999px;
    background: var(--ttp-white);
    cursor: pointer;
}

.ttp-size-select img {
    transition: transform 0.2s ease;
}

.ttp-size-select[aria-expanded="true"] img {
    transform: rotate(180deg);
}

@media (prefers-reduced-motion: reduce) {
    .ttp-size-select img {
        transition: none;
    }
}

.ttp-size-value,
.ttp-size-option {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    white-space: nowrap;
}

.ttp-size-value b,
.ttp-size-option b {
    font-size: 14px;
    line-height: 20px;
    font-weight: 500;
    color: var(--ttp-heading);
}

.ttp-size-value small,
.ttp-size-option small {
    font-size: 12px;
    line-height: 18px;
    font-weight: 400;
    color: var(--ttp-disable);
}

.ttp-size-dropdown {
    position: absolute;
    top: 72px;
    left: 0;
    right: 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px;
    border-radius: 16px;
    background: var(--ttp-white);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
    box-shadow: 0 1px 4px 0 rgba(64, 110, 243, 0.06), 0 4px 15px 0 rgba(64, 110, 243, 0.1);
}

.ttp-size-dropdown[hidden] {
    display: none;
}

.ttp-size-option {
    width: 100%;
    align-items: center;
    padding: 8px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    text-align: left;
    cursor: pointer;
}

.ttp-size-option:hover,
.ttp-size-option.is-active {
    background: var(--ttp-light);
}

.ttp-size-option.ttp-size-custom b {
    flex: 1 1 auto;
}

.ttp-size-edit {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ttp-preview-stage {
    flex: 1 1 0;
    min-width: 0;
    background: var(--ttp-bg-1);
    overflow: auto;
}

@supports not selector(::-webkit-scrollbar) {
    .ttp-preview-stage,
    .ttp-preview-settings,
    .ttp-preview-overlay {
        scrollbar-width: thin;
        scrollbar-color: #EAEAEA transparent;
    }
}

.ttp-preview-stage::-webkit-scrollbar,
.ttp-preview-settings::-webkit-scrollbar,
.ttp-preview-overlay::-webkit-scrollbar {
    width: 6px;
    height: 6px;
    background: transparent;
}

.ttp-preview-stage::-webkit-scrollbar-track,
.ttp-preview-settings::-webkit-scrollbar-track,
.ttp-preview-overlay::-webkit-scrollbar-track {
    background: transparent;
}

.ttp-preview-stage::-webkit-scrollbar-track,
.ttp-preview-settings::-webkit-scrollbar-track {
    margin: 10px 0;
}

.ttp-preview-stage::-webkit-scrollbar-thumb,
.ttp-preview-settings::-webkit-scrollbar-thumb,
.ttp-preview-overlay::-webkit-scrollbar-thumb {
    background: #EAEAEA;
    border-radius: 3px;
}

.ttp-preview-pages {
    min-height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    padding: 32px 10px;
}

.ttp-page-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.ttp-page {
    position: relative;
    flex-shrink: 0;
    overflow: hidden;
    background: var(--ttp-white);
    box-shadow: 0 0 2px rgba(0, 0, 0, 0.12);
}

.ttp-page-inner {
    position: absolute;
    top: 0;
    left: 0;
    transform-origin: 0 0;
    background: var(--ttp-white);
}

.ttp-page-area {
    position: absolute;
    outline: 1px dashed var(--ttp-stroke);
    box-shadow: 0 0 4px 0 rgba(0, 0, 0, 0.06);
    overflow: hidden;
}

.ttp-page-window {
    overflow: hidden;
}

.ttp-page-label {
    margin: 0;
    font-size: 12px;
    line-height: 16px;
    font-weight: 400;
    color: var(--ttp-disable);
    text-align: center;
}

.ttp-measure {
    position: fixed;
    left: -99999px;
    top: 0;
    visibility: hidden;
    pointer-events: none;
}

@media screen and (max-width: 991px) {
    .ttp-preview-settings {
        flex-basis: 300px;
        width: 300px;
    }
}

@media screen and (max-width: 767px) {
    .ttp-preview-overlay {
        align-items: flex-start;
        padding: 16px;
        overflow-y: auto;
    }

    .ttp-preview-modal {
        max-height: none;
        padding: 16px;
        overflow: visible;
    }

    .ttp-preview-heading {
       display: none;
    }

    .ttp-preview-head-actions {
        flex: 1 1 100%;
    }

    .ttp-preview-head-actions .ttp-pill-btn {
        flex: 1 1 0;
        min-width: 0;
    }

    .ttp-preview-body {
        flex-direction: column;
        height: auto;
        flex-basis: auto;
    }

    .ttp-preview-stage {
        order: -1;
        flex: 0 0 420px;
        height: 420px;
    }

    .ttp-preview-pages {
        padding: 12px 10px;
        gap: 12px;
    }

    .ttp-page-wrap {
        gap: 6px;
    }

    .ttp-preview-settings {
        flex-basis: auto;
        width: auto;
        border-right: 0;
        overflow: visible;
    }

    .ttp-segment button {
        padding: 6px 4px;
    }

    .ttp-size-dropdown {
        top: auto;
        bottom: calc(100% - 24px);
    }
}

