.magsy-preview-modal {
    padding-top: 2vh;
    z-index: 20;
}

.magsy-preview-window {
    width: 98vw;
    height: 96vh;
    margin: auto;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.magsy-preview-header {
    min-height: 44px;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
}

.magsy-preview-title {
    min-width: 0;
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 1.25rem;
}

.magsy-preview-actions {
    flex: 0 0 auto;
    white-space: nowrap;
}

.magsy-preview-actions .w3-button {
    padding: 5px 9px;
}

.magsy-preview-body,
.magsy-preview-inline {
    position: relative;
    min-height: 240px;
    overflow: hidden;
    background: #f1f1f1;
}

.magsy-preview-body {
    flex: 1 1 auto;
}

.magsy-preview-frame,
.magsy-preview-media-wrap,
.magsy-preview-image-wrap,
.magsy-preview-fallback,
.magsy-preview-text-wrap {
    width: 100%;
    height: 100%;
    border: 0;
}

.magsy-preview-frame {
    display: block;
    background: #fff;
}

.magsy-preview-image-wrap,
.magsy-preview-media-wrap,
.magsy-preview-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    box-sizing: border-box;
}

.magsy-preview-image {
    display: block;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.magsy-preview-media {
    display: block;
    max-width: 100%;
    max-height: 100%;
}

.magsy-preview-text-wrap {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    overflow: auto;
    background: #0d1117;
    color: #c9d1d9;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    font-size: 13px;
    line-height: 1.45;
}

.magsy-preview-line-numbers,
.magsy-preview-code {
    min-height: 100%;
    box-sizing: border-box;
    margin: 0;
    padding: 12px;
    white-space: pre;
}

.magsy-preview-line-numbers {
    position: sticky;
    left: 0;
    z-index: 1;
    padding-right: 10px;
    color: #8b949e;
    text-align: right;
    user-select: none;
    border-right: 1px solid #30363d;
    background: #161b22;
}

.magsy-preview-code {
    overflow: visible;
}

.magsy-preview-code code.hljs {
    overflow: visible;
    padding: 0;
    background: transparent;
}

.magsy-preview-loader,
.magsy-preview-error {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    text-align: center;
}

.magsy-preview-error {
    color: #b91c1c;
    background: #fff;
}

.magsy-preview-html-tabs {
    position: absolute;
    z-index: 2;
    top: 6px;
    right: 8px;
}

@media (max-width: 600px) {
    .magsy-preview-modal {
        padding-top: 0;
    }

    .magsy-preview-window {
        width: 100vw;
        height: 100vh;
        border-radius: 0;
    }

    .magsy-preview-title {
        font-size: 1rem;
    }

    .magsy-preview-actions .magsy-preview-secondary-action {
        display: none;
    }
}

