:root {
    --custom-burgundy: #4a0404;
    --custom-gold: #d4af37;
    --custom-cream: #fffaf3;
    --custom-line: #eadfca;
}

body.customization-page {
    background: #f7f1e8;
}

.customization-page .navbar {
    filter: blur(2px) brightness(0.72);
    opacity: 0.76;
    pointer-events: none;
    position: relative;
    z-index: 2 !important;
}

.customization-backdrop {
    position: fixed;
    inset: 0;
    z-index: 20;
    background: rgba(28, 16, 12, 0.55);
    backdrop-filter: blur(3px);
}

.customize-shell {
    position: relative;
    z-index: 30;
    width: min(1160px, calc(100% - 32px));
    margin: 34px auto;
    overflow: hidden;
    border: 1px solid rgba(212, 175, 55, 0.42);
    border-radius: 8px;
    background: var(--custom-cream);
    box-shadow: 0 28px 70px rgba(0, 0, 0, 0.28);
}

.customize-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 18px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.16);
    background: var(--custom-burgundy);
    color: #fff;
}

.customize-head p,
.customize-head h1,
.preview-kicker,
.preview-note,
.customize-price-block p {
    margin: 0;
}

.customize-head p,
.preview-kicker {
    color: #f4d76b;
    font-size: 0.71rem;
    font-weight: 900;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.customize-head h1 {
    margin-top: 3px;
    color: #fff;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.42rem;
}

.close-link {
    display: inline-flex;
    width: 38px;
    height: 38px;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.46);
    border-radius: 6px;
    background: transparent;
    color: #fff;
    cursor: pointer;
    font-size: 1.7rem;
    line-height: 1;
}

.close-link:hover {
    background: rgba(255, 255, 255, 0.14);
}

.customize-body {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.95fr);
    min-height: 620px;
}

.preview-panel {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 28px;
    border-right: 1px solid var(--custom-line);
    background: #f4ecdf;
}

.canvas-wrap {
    position: sticky;
    top: 24px;
    width: min(100%, 520px);
}

.canvas-title {
    display: -webkit-box;
    min-height: 2.5em;
    margin: 8px 0 14px;
    overflow: hidden;
    color: #321d1a;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.12rem;
    line-height: 1.24;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.canvas-frame {
    overflow: hidden;
    border: 1px solid var(--custom-line);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 14px 34px rgba(74, 4, 4, 0.12);
}

.canvas-frame .canvas-container {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 1 / 1;
}

.canvas-frame canvas,
.canvas-frame .upper-canvas,
.canvas-frame .lower-canvas {
    width: 100% !important;
    height: 100% !important;
}

.preview-note {
    margin-top: 10px;
    color: #6e6257;
    font-size: 0.78rem;
    line-height: 1.45;
}

.options-panel {
    display: flex;
    max-height: 720px;
    flex-direction: column;
    padding: 18px;
    overflow-y: auto;
    background: #fffdf9;
}

#customizationControls {
    min-height: 1px;
}

.option-card {
    margin-bottom: 12px;
    padding: 15px;
    border: 1px solid var(--custom-line);
    border-radius: 7px;
    background: #fff;
}

.option-card h2 {
    margin: 0 0 6px;
    color: var(--custom-burgundy);
    font-size: 0.94rem;
}

.required-mark {
    margin-left: 5px;
    color: #a72727;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
}

.help-text {
    margin: 0 0 11px;
    color: #6e6257;
    font-size: 0.82rem;
    line-height: 1.45;
}

.side-tabs,
.choice-options,
.text-actions,
.customize-action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.side-tab,
.choice-button,
.text-button,
.upload-btn,
.custom-action {
    min-height: 38px;
    border: 1px solid #d8c7ad;
    border-radius: 6px;
    background: #fffaf3;
    color: var(--custom-burgundy);
    cursor: pointer;
    font-size: 0.84rem;
    font-weight: 800;
}

.side-tab,
.choice-button,
.text-button,
.custom-action {
    padding: 9px 12px;
}

.side-tab.active,
.choice-button.active,
.primary-text,
.custom-action.primary {
    border-color: var(--custom-burgundy);
    background: var(--custom-burgundy);
    color: #fff;
}

.field-control {
    display: block;
    width: 100%;
    margin: 0;
    padding: 10px 11px;
    border: 1px solid #d9cdbf;
    border-radius: 6px;
    background: #fffdf9;
    color: #2b1d18;
    font: inherit;
    font-size: 0.88rem;
}

.font-select,
.font-select option {
    font-size: 1.02rem;
}

.field-control:focus,
.color-control input:focus-visible,
.side-tab:focus-visible,
.choice-button:focus-visible,
.text-button:focus-visible,
.upload-btn:focus-visible,
.custom-action:focus-visible,
.close-link:focus-visible {
    outline: 3px solid rgba(212, 175, 55, 0.42);
    outline-offset: 2px;
}

.upload-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.upload-preview {
    width: 64px;
    height: 64px;
    overflow: hidden;
    border: 1px solid #dfd0bd;
    border-radius: 6px;
    background-color: #f8f0e6;
    background-position: center;
    background-size: cover;
    color: #7a6c5e;
    font-size: 0.72rem;
    line-height: 64px;
    text-align: center;
}

.upload-btn {
    display: inline-flex;
    align-items: center;
    padding: 9px 12px;
}

.upload-btn input {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    opacity: 0;
}

.color-control {
    display: flex;
    align-items: center;
    gap: 11px;
}

.color-control input {
    width: 50px;
    height: 38px;
    padding: 2px;
    border: 1px solid #d9cdbf;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
}

.color-control code {
    color: #625549;
    font-size: 0.85rem;
}

.customization-empty {
    margin: 12px 0;
    padding: 12px;
    border: 1px solid #ead9a6;
    border-radius: 6px;
    background: #fff8e8;
    color: #6c5318;
    font-size: 0.86rem;
}

.customize-action-footer {
    position: sticky;
    bottom: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 96px;
    gap: 10px 14px;
    margin-top: auto;
    padding: 14px 0 2px;
    border-top: 1px solid var(--custom-line);
    background: #fffdf9;
    box-shadow: 0 -12px 24px rgba(255, 253, 249, 0.96);
}

.customize-price-block span,
.custom-qty span {
    display: block;
    color: #7d6c5c;
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
}

.customize-price-block strong {
    display: block;
    margin: 2px 0;
    color: var(--custom-burgundy);
    font-size: 1.26rem;
}

.customize-price-block p {
    color: #6e6257;
    font-size: 0.76rem;
    line-height: 1.35;
}

.custom-qty select {
    width: 100%;
    margin-top: 4px;
    padding: 8px;
    border: 1px solid #d9cdbf;
    border-radius: 6px;
    background: #fff;
    color: #2b1d18;
    font-weight: 800;
}

.customize-action-buttons {
    grid-column: 1 / -1;
}

.custom-action {
    flex: 1 1 160px;
}

.custom-action.gold {
    border-color: #b88d16;
    background: var(--custom-gold);
    color: #261b05;
}

.custom-action:disabled {
    cursor: not-allowed;
    border-color: #ddd2c4;
    background: #eee7de;
    color: #9a8e82;
    box-shadow: none;
}

@media (max-width: 860px) {
    .customize-shell {
        width: min(100% - 20px, 680px);
        margin: 16px auto;
    }

    .customize-body {
        grid-template-columns: 1fr;
    }

    .preview-panel {
        padding: 18px;
        border-right: 0;
        border-bottom: 1px solid var(--custom-line);
    }

    .canvas-wrap {
        position: static;
        width: min(100%, 420px);
    }

    .options-panel {
        max-height: none;
        overflow: visible;
    }
}

@media (max-width: 520px) {
    .customize-head {
        padding: 14px 16px;
    }

    .customize-head h1 {
        font-size: 1.18rem;
    }

    .preview-panel,
    .options-panel {
        padding: 14px;
    }

    .option-card {
        padding: 13px;
    }

    .customize-action-footer {
        grid-template-columns: minmax(0, 1fr) 82px;
    }

    .custom-action {
        flex-basis: 100%;
    }
}
