.mc-wrap {
    font-family: Arial, sans-serif;
    margin: 30px 0;
}

.mc-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) 420px;
    gap: 24px;
    align-items: start;
}

.mc-stage-card,
.mc-panel {
    background: #fff;
    border-radius: 18px; 
    box-shadow: 0 8px 24px rgba(0, 0, 0, .08);
} 

.mc-stage-card {
    padding: 20px;
    border: 2px solid #2f4b7352;
} 

.mc-stage {
    background: white;
    border-radius: 22px;
    padding: 32px;
}

.mc-preview-area {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.mc-monument-box {
    position: relative;
    width: 420px;
    height: 620px;
}

.mc-monument {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 300px;
    height: 600px;
    color: #fff;
    overflow: visible;
    background: transparent;
    box-shadow: none;
}

.mc-monument-image-wrap {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}

.mc-monument-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    user-select: none;
    -webkit-user-drag: none;
    pointer-events: none;
    
}

.mc-cross {
    position: absolute;
    top: 34px;
    left: 50%;
    transform: translateX(-50%);
    width: 42px;
    height: 42px;
    font-size: 42px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
}

.mc-portrait {
    position: absolute;
    top: 114px;
    left: 50%;
    transform: translateX(-50%);
    width: 88px;
    height: 120px;

    border: none;
    border-radius: 0;
    background: transparent;

    display: flex;
    align-items: center;
    justify-content: center;
    
    z-index: 999;
}

.mc-portrait img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: none;
}

.mc-text {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    color: #fff;
    z-index: 5;
}

.mc-name-block {
    bottom: 132px;
    width: 165px;
    padding: 0 4px;
}

.mc-name-block div {
    margin: 3px 0;
}

.mc-name-block #mcLastName {
    font-size: 20px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.mc-dates {
    margin-top: 10px;
    font-size: 14px;
    opacity: .92;
}

.mc-epitaph {
    bottom: 82px;
    width: 170px;
    font-size: 14px;
    font-style: italic;
    opacity: .92;
    padding: 0 4px;
}

.mc-decor {
    position: absolute;
    z-index: 5;
}

.mc-candle {
    bottom: 92px;
    left: 22px;
    width: 48px;
    height: 48px;
}

.mc-bird {
    top: 76px;
    right: 16px;
    width: 48px;
    height: 48px;
}

.mc-branch {
    bottom: 112px;
    right: 16px;
    width: 56px;
    height: 56px;
}

.mc-flower {
    bottom: 18px;
    left: 50%;
    transform: translateX(-50%);
    width: 52px;
    height: 52px;
}

.mc-draggable {
    cursor: move;
    user-select: none;
    touch-action: none;
}

.mc-draggable.selected {
    outline: 1px dashed rgba(255, 255, 255, .75);
}

.mc-resizable {
    min-width: 28px;
    min-height: 28px;
}

.mc-element-content {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.mc-element-content img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    pointer-events: none;
}

.mc-resize-handle {
    position: absolute;
    right: -6px;
    bottom: -6px;
    width: 12px;
    height: 12px;
    background: #fff;
    border: 1px solid #222;
    border-radius: 50%;
    cursor: nwse-resize;
    opacity: 0;
    z-index: 6;
}

.mc-draggable:hover .mc-resize-handle,
.mc-draggable.selected .mc-resize-handle {
    opacity: 1;
}

.mc-shapes {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    margin-top: 20px;
    width: 100%;
    max-width: 620px;
}

.mc-shape-btn {
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 12px;
    padding: 10px;
    cursor: pointer;
    transition: .2s ease;
    height: 88px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mc-shape-btn:hover {
    transform: translateY(-1px);
}

.mc-shape-thumb-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}

.mc-shape-empty {
    font-size: 12px;
    color: #666;
    text-align: center;
}

.mc-sidebar {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.mc-panel {
    padding: 18px;
}

.mc-panel h3 {
    margin: 0 0 14px;
    font-size: 18px;
}

.mc-portrait-options {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}

.mc-tab,
.mc-thumb,
.mc-btn {
    transition: .2s ease;
}

.mc-tab:hover,
.mc-thumb:hover,
.mc-btn:hover {
    transform: translateY(-1px);
}

.mc-tab {
    border: 1px solid #ddd;
    background: #fafafa;
    border-radius: 10px;
    padding: 10px 6px;
    cursor: pointer;
    font-size: 12px;
}

.mc-input,
.mc-select {
    width: 100%;
    border: 1px solid #d9d9d9;
    border-radius: 10px;
    padding: 10px 12px;
    background: #fff;
    box-sizing: border-box;
    margin-top: 8px;
}

.mc-field-grid {
    display: grid;
    gap: 12px;
}

.mc-font-select {
    margin-top: 8px;
}

.mc-thumb-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-top: 10px;
}

.mc-thumb {
    height: 64px;
    border: 1px solid #ddd;
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    font-size: 11px;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    overflow: hidden;
}

.mc-thumb-image {
    width: 100%;
    height: 100%!important;
    object-fit: contain;
    display: block;
}

.mc-actions {
    display: grid;
    gap: 10px;
}

.mc-btn {
    border: 0;
    border-radius: 12px;
    padding: 12px 14px;
    cursor: pointer;
    color: #fff;
    font-weight: 600;
}

.mc-btn-primary {
    background: #1e73be;
}

.mc-btn-dark {
    background: #6c0e0e;
}

.mc-btn-danger {
    background: #d81919;
}

.mc-status {
    margin-top: 12px;
    font-size: 14px;
}

details {
    margin-bottom: 14px;
}

summary {
    cursor: pointer;
    font-weight: 600;
}


@page {
    size: A4 portrait;
    margin: 0;
}

@media print {

    html,
    body {
        margin: 0 !important;
        padding: 0 !important;
        background: white !important;
        height: auto !important;
    }

    /* скрываем header/footer темы */
    header,
    footer,
    nav,
    aside,
    .site-header,
    .site-footer,
    .mc-sidebar {
        display: none !important;
    }

    /* ломаем сетку страницы */
    .mc-grid {
        display: block !important;
    }

    .mc-wrap,
    .mc-stage-card,
    .mc-stage {
        margin: 0 !important;
        padding: 0 !important;
        border: 0 !important;
        box-shadow: none !important;
        background: transparent !important;
    }

    /* центрируем макет */
    #memorial-constructor {
        width: 100% !important;
        text-align: center !important;
    }

    .mc-preview-area {
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
    }

    #mcCaptureArea {
        margin: 0 auto !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }

    /* скрываем служебные элементы */
    .mc-delete-handle,
    .mc-resize-handle,
    .mc-actions,
    .mc-status,
    .mc-shapes {
        display: none !important;
    }

    /* сохраняем белый текст */
    .mc-text,
    .mc-text *,
    #mcLastName,
    #mcFirstName,
    #mcMiddleName,
    #mcDates,
    .mc-epitaph-text {
        color: #fff !important;
        -webkit-text-fill-color: #fff !important;
    }

    /* включаем печать цветов */
    body {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

}

@media (max-width: 1100px) {
    .mc-grid {
        grid-template-columns: 1fr;
    }

    .mc-sidebar {
        order: 2;
    }

    .mc-stage-card {
        order: 1;
    }
}

.mc-delete-handle {
    position: absolute;
    top: -8px;
    left: -8px;
    width: 18px;
    height: 18px;
    border: 0;
    border-radius: 50%;
    background: #d81919;
    color: #fff;
    font-size: 14px;
    line-height: 18px;
    text-align: center;
    cursor: pointer;
    padding: 0;
    opacity: 0;
    z-index: 7;
}

.mc-draggable:hover .mc-delete-handle,
.mc-draggable.selected .mc-delete-handle {
    opacity: 1;
} 

.mc-hidden-element {
    display: none !important;
}
.mc-grid button:hover, .mc-grid button:focus{
	background-color: #1F2A46!important;
}
.mc-grid .mc-sidebar button{
	background-color: #2F4B73;
}
.mc-grid .mc-stage-card button:hover, .mc-grid .mc-stage-card button:focus{
	background-color: #2F4B73!important;
}
.mc-grid button[data-type="portrait"]{
	background-color: #2F4B73;
}


@media (max-width: 768px){
	.mc-monument-box{
    	width: 100%;
    }
    .mc-stage{
    	padding-left: 0;
    	padding-right: 0;
    }
}