@font-face {
    font-family: 'Cinzel';
    src: url('../fonts/Cinzel-Bold.woff2') format('woff2');
}

@font-face {
    font-family: 'Montserrat';
    src: url('../fonts/Montserrat-Regular.woff2') format('woff2');
}

@font-face {
    font-family: 'Trajan';
    src: url('../fonts/TrajanPro-Regular.woff2') format('woff2');
}

@font-face {
    font-family: 'Trajan-bold';
    src: url('../fonts/TrajanPro-Bold.woff2') format('woff2');
}

@font-face {
    font-family: 'Monotype';
    src: url('../fonts/Monotype-Corsiva.woff2') format('woff2');
}

@font-face {
    font-family: 'Gabrielle';
    src: url('../fonts/Gabrielle.woff2') format('woff2');
}

@font-face {
    font-family: 'Sols';
    src: url('../fonts/wm_Sols.ttf') format('truetype');
    font-display: swap;
}

@font-face {
    font-family: 'Nastaliq';
    src: url('../fonts/wm_Nastaliq.ttf') format('truetype');
    font-display: swap;
}

@font-face {
    font-family: 'CapitalisMonumentalis';
    src: url('../fonts/CapitalisMonumentalis.woff2') format('woff2');
    font-display: swap;
}

@font-face {
    font-family: 'Capitalis Quadrat';
    src: url('../fonts/Capitalis Quadrat Normal.ttf') format('truetype');
    font-display: swap;
}

@font-face {
    font-family: 'EB Garamond';
    src: url('../fonts/EBGaramond-Regular.ttf') format('truetype');
    font-display: swap;
}

@font-face {
    font-family: 'EB Garamond';
    src: url('../fonts/EBGaramond-SemiBold.ttf') format('truetype');
    font-weight: 600;
    font-display: swap;
}

@font-face {
    font-family: 'Times New Roman';
    src: url('../fonts/Times New Roman.ttf') format('truetype');
    font-display: swap;
}

@font-face {
    font-family: 'Times New Roman';
    src: url('../fonts/Times New Roman Bold.ttf') format('truetype');
    font-weight: bold;
    font-display: swap;
}


/******************************************/
/* Initials */
/******************************************/

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

html {
    height: 100%;
    width: 100%;
    overflow: hidden;
}

body {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    margin: 0 auto;
    padding: 4px;
    overflow: hidden;
    height: 100%;
    width: 100%;
    min-height: 100vh;
    min-height: -webkit-fill-available;
    font-family: 'Montserrat', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-text-size-adjust: 100%;
    position: relative;
    gap: 10px;
    background:
        /* Glass-Effekt Gradienten */
        radial-gradient(at 90% 94%, hsla(0, 0%, 70%, 0.6) 0px, transparent 50%),
        radial-gradient(at 52% 15%, hsla(0, 0%, 55%, 0.6) 0px, transparent 50%),
        radial-gradient(at 64% 71%, hsla(43, 100%, 86%, 0.6) 0px, transparent 50%),
        radial-gradient(at 47% 56%, hsla(0, 0%, 65%, 0.6) 0px, transparent 50%),
        radial-gradient(at 35% 88%, hsla(0, 0%, 80%, 0.6) 0px, transparent 50%),
        radial-gradient(at 16% 4%, hsla(53, 100%, 88%, 0.6) 0px, transparent 50%),
        radial-gradient(at 39% 25%, hsla(0, 0%, 50%, 0.6) 0px, transparent 50%),
        /* Hintergrundbild als unterste Ebene */
        url(../images/bg2.webp) center center/cover no-repeat;

    /* Weitere Effekte */
    backdrop-filter: blur(35px) saturate(90%);
    -webkit-backdrop-filter: blur(35px) saturate(150%);
    box-shadow: inset 0 0 100px rgba(0, 0, 0, 0.9);
    /* Vignette */
}






@media screen and (max-width: 1024px) {
    body {
        padding: 4px;
    }
}

@media screen and (max-width: 768px) {
    body {
        padding: 4px;
    }
}

@media screen and (max-width: 480px) {
    body {
        padding: 4px;
    }
}

.border {
    border: 1px solid rgb(255, 255, 255, 0.2);
    box-shadow: 0px 2px 5px rgb(0, 0, 0, 0.5);
    padding: 0;
}


hr {
    border: none;
    height: 1.5px;
    background: linear-gradient(90deg,
            rgba(255, 255, 255, 0) 0%,
            rgba(255, 255, 255, 0.7) 20%,
            rgba(255, 255, 255, 0.9) 50%,
            rgba(255, 255, 255, 0.7) 80%,
            rgba(255, 255, 255, 0) 100%);
    border-radius: 2px;
    margin: 1.5rem 0;
    opacity: 0.25;
    backdrop-filter: blur(8px) saturate(120%);
}

/******************************************/
/* Initials */
/******************************************/

/******************************************/
/* Main Container */
/******************************************/

.container {
    width: 100%;
    max-width: 850px;
    aspect-ratio: 1.42 / 1;
    min-height: 370px;
    max-height: min(85vh, 600px);
    box-sizing: border-box;
    background-image: url(/images/bg2.webp);
    border: 1px solid #000;
    border-radius: 12px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    overflow: hidden;
    position: relative;
    z-index: 1;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    -webkit-perspective: 1000;
    perspective: 1000;
    /* Apple-style smooth zoom animation */
    transition: transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);

}

@media screen and (max-width: 1024px) {
    .container {
        max-width: 90vw;
        max-height: 80vh;
    }
}

@media screen and (max-width: 768px) {
    .container {
        width: 100%;
        max-height: 85vh;
        border-radius: 24px;
    }
}

@media screen and (max-width: 480px) {


    /* Mobile-specific fixes for selection outlines */
    .container {
        width: 100vw;
        height: 100%;
        max-height: 90vh;
        border-radius: 12px;
        padding: 8px;
        /* Increased padding to prevent outline cutoff */
        -webkit-overflow-scrolling: touch;
        /* Ensure outlines are fully visible */
        overflow: visible;
    }

    /* Reduced outline-offset for mobile to prevent cutoff */
    .draggable-text.selected-text {
        outline: 2px dashed rgba(255, 200, 0, 0.8);
        outline-offset: 2px;
        animation: selectionPulse 1.5s ease-in-out infinite;
    }

    .calligraphy-preview.selected-calligraphy {
        outline: 2px dashed rgba(255, 255, 255, 0.8);
        outline-offset: 2px;
        /* Reduced from 4px to 2px for mobile */
        animation: selectionPulse 1.5s ease-in-out infinite;
    }

    .preview-container {
        height: 80%;
        overflow: visible;
        /* Ensure outlines are not clipped */
    }
}

/* Optimizations specifically for touch devices */
@media (hover: none) and (pointer: coarse) {

    .container::before,
    .container::after {
        -webkit-filter: blur(2px);
        filter: blur(2px);
        opacity: 0.4;
        -webkit-transform: translate3d(0, 0, 0);
        transform: translate3d(0, 0, 0);
    }

    .container {
        -webkit-overflow-scrolling: touch;
        -webkit-transform: translate3d(0, 0, 0);
        transform: translate3d(0, 0, 0);
    }
}

/******************************************/
/* Main Container */
/******************************************/

/******************************************/
/* Menu Buttons */
/******************************************/

.beta-sign {
    position: absolute;
    top: 0;
    padding: 2px 6px;
    margin: 0;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(255, 225, 0, 0.25);
    color: rgba(255, 255, 255, 0.5);
    font-family: 'Montserrat', sans-serif;
    font-weight: 500;
    font-size: 10px;
    letter-spacing: 0.5px;
    border-radius: 4px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    text-transform: uppercase;
}

.hide-btn,
.show-btn {
    background-size: 100%;
    background-repeat: no-repeat;
    background-position: center;
    width: 44px;
    height: 44px;
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 2rem;
    touch-action: manipulation;
    background-color: transparent;
    border: none;
    pointer-events: auto;
    /* Re-enable events for buttons */
}

.hide-btn {
    background-image: url(../images/icons/hide.svg);
    filter: brightness(0) invert(1) opacity(0.5);

}

.show-btn {
    background-image: url(../images/icons/show.svg);
    filter: brightness(0) invert(1) opacity(0.25);
}

.hide-btn:hover,
.show-btn:hover {
    filter: brightness(0) invert(1) opacity(0.8);

}



.menu-btns {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    z-index: 1000;
    padding: 10px;
    box-sizing: border-box;
    color: #000;
    pointer-events: none;
    /* Allow events to pass through container */
}

.top-btns,
.btm-btns {
    width: 100%;
    display: flex;
    justify-content: space-between;
    position: relative;
    z-index: 1001;
    pointer-events: none;
    /* Allow events to pass through container */
}

.btm-btns>div {
    display: flex;
    gap: 5px;
    pointer-events: none;
    /* Allow events to pass through container */
}

.menu-btn {
    width: 44px;
    height: 44px;
    border-radius: 50px;
    color: #000;
    box-sizing: border-box;
    background-color: rgba(128, 128, 128, 0.5);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    position: relative;
    border: none;
    box-shadow:
        0 4px 15px rgba(0, 0, 0, 0.75);
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center;
    touch-action: manipulation;
    -webkit-transition: all 0.3s ease;
    transition: all 0.3s ease;
    overflow: hidden;
    pointer-events: auto;
    /* Re-enable events for buttons */
}

.menu-btn::before {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    border-radius: 50px;
    border: 2px solid transparent;
    background: linear-gradient(145deg,
            rgba(255, 255, 255, 0.8),
            rgba(0, 0, 0, 0.1) 70%,
            rgba(0, 0, 0, 0.1) 70%,
            rgba(255, 255, 255, 0.8)) border-box;
    -webkit-mask:
        linear-gradient(#fff 0 0) padding-box,
        linear-gradient(#fff 0 0) border-box;
    mask:
        linear-gradient(#fff 0 0) padding-box,
        linear-gradient(#fff 0 0) border-box;
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}


.menu-btn:hover {
    background-color: rgba(255, 200, 0, 0.5);
    backdrop-filter: blur(16px);
    box-shadow:
        inset 0 0 0 0.5px rgba(255, 217, 0, 0.3),
        0 8px 20px rgba(0, 0, 0, 0.15);
}

#einfassung-btn {
    background-image: url(../images/icons/einfassung.svg);
    background-size: 75%;


}

#stein-btn {
    background-image: url(../images/icons/stein.svg);
    background-size: 120%;
}

#abdeckplatten-btn {
    background-image: url(../images/icons/abdeckplatte.svg);
    background-size: 40%;
}

#text-btn {
    background-image: url(../images/icons/letter-case.svg);
    background-size: 70%;

}

#calligraphy-btn {
    background-image: url(../images/icons/calligraphy.svg);
    background-size: 70%;

}

#blumen-btn {
    background-image: url(../images/icons/blumen.svg);
    background-size: 100%;
    background-color: rgba(220, 53, 69, 0.8);
    display: none;
}

#design-btn {
    background-image: url(../images/icons/grab.svg);
    background-size: 90%;

}

#angebot-btn {
    background-image: url(../images/icons/angebot.svg);
    background-size: 60%;

}

#expand-btn {
    background-image: url(../images/icons/expand.svg);
    background-size: 60%;
}

/* Ensure relative positioning for expand button container */
.btm-btns>div:first-child {
    position: relative;
}

@media screen and (max-width: 480px) {

    #expand-btn,
    #angebot-btn {
        display: none;
        /* Adjusted for tablet and larger screens */
    }


}

#download-btn {
    background-image: url(../images/icons/download.svg);
    background-size: 80%;
}

#catalog-btn {
    background-image: url(../images/icons/catalog-magazine.svg);
    background-size: 60%;
}

#img-dl-btn {
    background-image: url(../images/icons/image.svg);
    background-size: 60%;
}

#pdf-dl-btn {
    background-image: url(../images/icons/pdf.svg);
    background-size: 65%;
}


#bin-btn {
    background-image: url(../images/icons/bin-closed.svg);
    background-size: 70%;
    position: relative;
    transition: transform 0.3s ease, filter 0.3s ease, box-shadow 0.3s ease;
    display: none;
}

#bin-btn:hover {
    background-image: url(../images/icons/bin-open.svg);
    background-size: 70%;
    transform: scale(1.1);
}

#bin-btn.dropzone-active {
    background-image: url(../images/icons/bin-open.svg);
    transform: scale(1.15);
    filter: brightness(1.2);
    box-shadow: 0 0 10px rgba(255, 196, 0, 1);
    display: block;
}

/* Show bin button with pulse animation when text elements are being dragged */
body.dragging-text #bin-btn {
    display: block;
    animation: pulse-bin 1.5s infinite;
    pointer-events: auto;

}

@keyframes pulse-bin {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 196, 0, 1);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(255, 0, 0, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(255, 0, 0, 0);
    }
}

/* Animation for bin button when processing deletion */
#bin-btn.receiving-text {
    background-image: url(../images/icons/bin-open.svg) !important;
    transform: scale(1.2) !important;
    filter: brightness(1.3) !important;
    box-shadow: 0 0 15px rgba(255, 196, 0, 1) !important;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.27, 1.55) !important;
}




/******************************************/
/* Menu Buttons */
/******************************************/

/******************************************/
/* Menues */
/******************************************/
.menu-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1001;
    color: #000;
    background-color: rgba(128, 128, 128, 0.5);
    backdrop-filter: blur(12px);
    transition: all 0.3s ease-in-out;
    box-sizing: border-box;
    padding: 0;
    overflow: hidden;

}


/* Calligraphy wrapper - flex layout for better organization */

#calligraphy-wrapper {
    display: flex;
    flex-direction: column;
    padding: 10px;
    padding-bottom: 70px;
}

/* Blumen wrapper - fades in with 33% width on desktop */
.blumen-wrapper {
    width: 33% !important;
    left: auto !important;
    right: 0 !important;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    border-radius: 12px 0 0 12px;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.3);
}

.blumen-wrapper[style*="display: block"] {
    opacity: 1 !important;
}

.blumen-wrapper .menu-close-btn {
    right: 10px;
    left: auto;
}

/* Mobile blumen wrapper - fades in with 50% height */
@media screen and (max-width: 768px) {
    .blumen-wrapper {
        width: 100% !important;
        height: 50% !important;
        left: 0 !important;
        right: auto !important;
        top: 0 !important;
        opacity: 0 !important;
        transition: opacity 0.3s ease-in-out !important;
        border-radius: 0 0 12px 12px;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    }

    .blumen-wrapper[style*="display: block"] {
        opacity: 1 !important;
    }

    .blumen-item img {
        max-width: 250px;
        width: 100%;
        height: auto;
    }

    .blumen-content {
        justify-items: center;
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }



}

.stein-content,
.einfassung-content,
.abdeckplatten-content,
.blumen-content {
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
    overflow-y: auto;
    padding: 25px 0 175px 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
    justify-content: center;
    justify-items: center;
    align-items: center;
}

.einfassung-content {
    align-items: flex-start;
}

.stein-content {
    align-items: flex-end;
}

@media screen and (max-width: 768px) {

    .einfassung-content,
    .abdeckplatten-content,
    .blumen-content {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
        padding: 15px 0 180px 0;
    }

    .stein-content {
        grid-template-columns: repeat(3, 1fr);
    }

}

@media screen and (max-width: 480px) {

    .einfassung-content,
    .abdeckplatten-content,
    .blumen-content {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        padding: 10px 0 80px 0;
        height: auto;
    }

    .stein-content {
        grid-template-columns: repeat(3, 1fr);
        align-items: flex-end;
    }

    .blumen-content {
        padding: 20px 0 80px 0;
    }


}




.einfassung-item,
.abdeckplatten-item,
.blumen-item,
.stein-item {
    width: 100%;
    max-width: 250px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 5px;
    box-sizing: border-box;
}



.stein-item img,
.einfassung-item img,
.abdeckplatten-item img,
.blumen-item img {
    width: 100%;
    max-width: 150px;
    transition: transform 0.3s ease-in-out;
    cursor: pointer;
}

/* Landscape stones in menu - proportionally wider */
.stein-item img.menu-stone-landscape {
    max-width: 210px;
    /* 44% wider than standard 150px */
}

/* Portrait stones in menu - standard size */
.stein-item img.menu-stone-portrait {
    max-width: 150px;
}

.einfassung-item img,
.abdeckplatten-item img {
    max-width: 300px;
}

/* Desktop: Kleinere Bilder für 3-Spalten-Layout */
@media screen and (min-width: 769px) {

    .einfassung-item img,
    .abdeckplatten-item img {
        max-width: 200px;
    }

}




.stein-item h3,
.einfassung-item h3,
.abdeckplatten-item h3 {
    font-size: 16px;
    font-weight: bold;
    text-align: center;
    margin: 0;
    padding: 0;
}


.stein-material-picker,
.einfassung-material-picker,
.abdeckplatte-material-picker {
    position: -webkit-sticky;
    position: -moz-sticky;
    position: -ms-sticky;
    position: -o-sticky;
    position: sticky;
    top: 0;
    left: 0;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: center;
    padding: 8px 16px;
    gap: 12px;
    background-color: rgba(128, 128, 128, 0.2);
    backdrop-filter: blur(12px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    border-bottom-left-radius: 25px;
    border-bottom-right-radius: 25px;
    box-sizing: border-box;
    overflow-x: auto;
    overflow-y: hidden;
    max-width: 100%;
    z-index: 10;
    margin-top: auto;
}




.material-btn {
    flex: 0 0 auto;
    min-width: 50px;
    max-width: 70px;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.material-btn img {
    width: 100%;
    max-width: 50px;
    max-height: 50px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(20px);
    background-color: rgba(255, 255, 255, 0.1);
}

.material-btn h3 {
    font-size: 0.6em;
    margin-top: 0.3em;
    font-weight: 700;
    color: rgba(0, 0, 0, 0.8);
}

.material-btn:hover img,
.material-btn.active img {
    background-color: rgba(255, 200, 0, 0.5);
    backdrop-filter: blur(16px);
    border: 2px solid rgba(255, 200, 0, 0.5);


}




/******************************************/
/* Menues */
/******************************************/


/******************************************/
/* Text and Design Menu */
/******************************************/

.text-menu,
.download-menu {
    width: 44px;
    max-height: 300px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    gap: 5px;
    position: absolute;
    z-index: 1000;
    box-sizing: border-box;
    transition: left 0.3s ease;
    background-color: rgba(128, 128, 128, 0.5);
    backdrop-filter: blur(12px);
    box-shadow:
        inset 0 0 0 0.5px rgba(255, 255, 255, 0.2),
        0 4px 15px rgba(0, 0, 0, 0.75);
    border-radius: 24px;
    color: #000;

}



.download-menu {
    bottom: 65px;
    left: 58px;
}

.text-menu {
    width: fit-content;
    height: auto;
    margin: 0 auto;
    padding: 2rem;
    bottom: 65px;
    right: 10px;
}

@media screen and (max-width: 480px) {
    .download-menu {
        left: 15px;
        /* Adjusted for tablet and larger screens */
    }


}

#schrift-btn {
    background-image: url(../images/icons/letter-case.svg);
    background-size: 75%;
    background-repeat: no-repeat;
    background-position: center;
}



/******************************************/
/* Text and Design Menu */
/******************************************/

/******************************************/
/* Preview Container */
/******************************************/

.preview-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 100;
    pointer-events: none;
    aspect-ratio: 1 / 1;
    max-width: 100%;
    max-height: 100%;
}

.preview-container img {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform-origin: center center;
    z-index: 50;
}

/* Einfassung positioning */
.preview-container img.einfassung-preview {
    z-index: 5;
    transform: translate(-50%, -50%) scale(1.1) translateY(55%);
    width: 100%;
    max-width: var(--base-einfassung-max-width);
    min-width: var(--base-einfassung-min-width);
}

/* Stone positioning - with einfassung */
.preview-container img:not(.einfassung-preview):not(.calligraphy-preview):not(.abdeckplatte-preview):not(.blumen-preview) {
    z-index: 100;
    transform: translate(-50%, -50%) scale(0.35) translateY(-37.5%);
    width: 50%;
    max-width: calc(var(--base-stone-max-width) * var(--stone-max-width-factor));
    min-width: var(--base-stone-min-width);
}

/* Portrait stones specific positioning */
.preview-container img.stone-portrait {
    transform: translate(-50%, -50%) scale(0.32) translateY(-63.75%);
    width: 50%;
    max-width: calc(var(--base-stone-max-width) * var(--stone-max-width-factor));
    min-width: var(--base-stone-min-width);
}

/* Landscape stones (Breitsteine) specific positioning */
.preview-container img.stone-landscape {
    transform: translate(-50%, -50%) scale(0.37) translateY(-36%) !important;
    width: 50%;
    max-width: calc(var(--base-stone-max-width) * var(--stone-max-width-factor));
    min-width: var(--base-stone-min-width);
}

/* Stone positioning - without einfassung (steinnoeinfassung) */
.preview-container:not(:has(.einfassung-preview)) img:not(.calligraphy-preview):not(.abdeckplatte-preview):not(.blumen-preview):not(.stone-landscape) {
    transform: translate(-50%, -50%) scale(1) translateY(10%);
}

/* Portrait stones without einfassung */
.preview-container:not(:has(.einfassung-preview)) img.stone-portrait {
    transform: translate(-50%, -50%) scale(1) translateY(10%);
}

/* Landscape stones without einfassung */
.preview-container:not(:has(.einfassung-preview)) img.stone-landscape {
    transform: translate(-50%, -50%) scale(var(--stone-scale-factor, 1.2)) translateY(5%) !important;
}

.preview-container img.calligraphy-preview {
    z-index: 200;
    width: 75px;
    height: auto;
    min-width: auto;
    pointer-events: auto;
    cursor: move;
    filter: drop-shadow(0 0 5px rgba(0, 0, 0, 0.3));
    transition: width 0.3s ease-out;
}

/* Abdeckplatte positioning */
.preview-container img.abdeckplatte-preview {
    z-index: 10;
    transform: translate(-50%, -50%) scale(1.1) translateY(55%);
    width: 100%;
    max-width: var(--base-einfassung-max-width);
    min-width: var(--base-einfassung-min-width);
}

/* Media Queries for screens under 830px */
@media screen and (max-width: 830px) {

    /* Einfassung positioning */
    .preview-container img.einfassung-preview {
        transform: translate(-50%, -50%) scale(0.9) translateY(55%);
    }

    /* Stone positioning - with einfassung */
    .preview-container img:not(.einfassung-preview):not(.calligraphy-preview):not(.abdeckplatte-preview):not(.blumen-preview) {
        transform: translate(-50%, -50%) scale(0.29) translateY(-38%);
    }

    /* Portrait stones specific positioning */
    .preview-container img.stone-portrait {
        transform: translate(-50%, -50%) scale(0.32) translateY(-63.75%);
    }

    /* Landscape stones (Breitsteine) specific positioning */
    .preview-container img.stone-landscape {
        transform: translate(-50%, -50%) scale(0.35) translateY(-36%) !important;
    }

    /* Stone positioning - without einfassung (steinnoeinfassung) */
    .preview-container:not(:has(.einfassung-preview)) img:not(.calligraphy-preview):not(.abdeckplatte-preview):not(.blumen-preview):not(.stone-landscape) {
        transform: translate(-50%, -50%) scale(0.7) translateY(10%);
    }

    /* Landscape stones without einfassung */
    .preview-container:not(:has(.einfassung-preview)) img.stone-landscape {
        transform: translate(-50%, -50%) scale(var(--stone-scale-factor, 1)) translateY(5%) !important;
    }

    /* Abdeckplatte positioning */
    .preview-container img.abdeckplatte-preview {
        transform: translate(-50%, -50%) scale(0.9) translateY(55%);
    }
}

/* Media Queries for screens under 480px */
@media screen and (min-width: 380px) and (max-width: 480px) {

    /* Einfassung positioning */
    .preview-container img.einfassung-preview {
        transform: translate(-50%, -50%) scale(1) translateY(55%);
    }

    /* Stone positioning - with einfassung */
    .preview-container img:not(.einfassung-preview):not(.calligraphy-preview):not(.abdeckplatte-preview):not(.blumen-preview) {
        transform: translate(-50%, -50%) scale(0.45) translateY(-38%);
    }

    /* Portrait stones specific positioning */
    .preview-container img.stone-portrait {
        transform: translate(-50%, -50%) scale(0.32) translateY(-62%);
    }

    /* Landscape stones (Breitsteine) specific positioning */
    .preview-container img.stone-landscape {
        transform: translate(-50%, -50%) scale(0.65) translateY(-36%) !important;
    }

    /* Stone positioning - without einfassung (steinnoeinfassung) */
    .preview-container:not(:has(.einfassung-preview)) img:not(.calligraphy-preview):not(.abdeckplatte-preview):not(.blumen-preview):not(.stone-landscape) {
        transform: translate(-50%, -50%) scale(1.2) translateY(25%);
    }

    /* Landscape stones without einfassung */
    .preview-container:not(:has(.einfassung-preview)) img.stone-landscape {
        transform: translate(-50%, -50%) scale(1.7) translateY(42.5%) !important;
    }

    /* Abdeckplatte positioning */
    .preview-container img.abdeckplatte-preview {
        transform: translate(-50%, -50%) scale(1) translateY(55%);
    }
}

/* Media Queries for screens under 480px */
@media screen and (max-width: 379px) {

    /* Einfassung positioning */
    .preview-container img.einfassung-preview,
    .preview-container img.abdeckplatte-preview {
        transform: translate(-50%, -50%) scale(0.9) translateY(55%);
    }

    /* Stone positioning - with einfassung */
    .preview-container img:not(.einfassung-preview):not(.calligraphy-preview):not(.abdeckplatte-preview):not(.blumen-preview) {
        transform: translate(-50%, -50%) scale(0.45) translateY(-38%);
    }

    /* Portrait stones specific positioning */
    .preview-container img.stone-portrait {
        transform: translate(-50%, -50%) scale(0.32) translateY(-62%);
    }

    /* Landscape stones (Breitsteine) specific positioning */
    .preview-container img.stone-landscape {
        transform: translate(-50%, -50%) scale(0.65) translateY(-36%) !important;
    }

    /* Stone positioning - without einfassung (steinnoeinfassung) */
    .preview-container:not(:has(.einfassung-preview)) img:not(.calligraphy-preview):not(.abdeckplatte-preview):not(.blumen-preview):not(.stone-landscape) {
        transform: translate(-50%, -50%) scale(1.2) translateY(10%);
    }

    /* Landscape stones without einfassung */
    .preview-container:not(:has(.einfassung-preview)) img.stone-landscape {
        transform: translate(-50%, -50%) scale(1.7) translateY(20%) !important;
    }

}



/******************************************/
/* Preview Container */
/******************************************/


/* Size Slider Styles */
#size-slider {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%) rotate(90deg);
    background-color: rgba(128, 128, 128, 0.5);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 10px 10px;
    border-radius: 12px;
    box-shadow:
        inset 0 0 0 0.5px rgba(255, 255, 255, 0.2),
        0 4px 15px rgba(0, 0, 0, 0.75);
    display: none;
    z-index: 1003;
    pointer-events: auto;
    transition: all 0.3s ease;
}

#size-slider::before {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    border-radius: 12px;
    border: 1px solid transparent;
    background: linear-gradient(145deg,
            rgba(255, 255, 255, 0.4),
            rgba(0, 0, 0, 0.1) 70%,
            rgba(0, 0, 0, 0.1) 70%,
            rgba(255, 255, 255, 0.4)) border-box;
    -webkit-mask:
        linear-gradient(#fff 0 0) padding-box,
        linear-gradient(#fff 0 0) border-box;
    mask:
        linear-gradient(#fff 0 0) padding-box,
        linear-gradient(#fff 0 0) border-box;
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

#width-slider {
    display: flex;
    justify-content: center;
    width: 100px;
    height: 5px;
    appearance: none;
    -webkit-appearance: none;
    background: rgba(255, 255, 255, 0.3);
    outline: none;
    border-radius: 3px;
    cursor: pointer;
    /* Improve touch handling */
    touch-action: none;
    /* Ensure smooth movement on all platforms */
    will-change: transform;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

#width-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    /* Improve smoothness */
    will-change: transform;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

#width-slider::-webkit-slider-thumb:hover {
    background: rgba(255, 255, 255, 0.95);
    transform: scale(1.15) translateZ(0);
    -webkit-transform: scale(1.15) translateZ(0);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);
}

#width-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: rgba(255, 255, 255, 0.8);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    will-change: transform;
    transform: translateZ(0);
}

#width-slider::-moz-range-thumb:hover {
    background: rgba(255, 255, 255, 0.95);
    transform: scale(1.15) translateZ(0);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);
}

/* For IE/Edge (if needed) */
#width-slider::-ms-thumb {
    width: 18px;
    height: 18px;
    background: rgba(255, 255, 255, 0.8);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* Style the track for Firefox */
#width-slider::-moz-range-track {
    height: 5px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

/* Style the track for IE/Edge */
#width-slider::-ms-track {
    height: 5px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

/* Zoom Slider Styles */
#zoom-slider {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 10px;
    background-color: rgba(128, 128, 128, 0.5);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 10px 15px;
    border-radius: 12px;
    box-shadow:
        inset 0 0 0 0.5px rgba(255, 255, 255, 0.2),
        0 4px 15px rgba(0, 0, 0, 0.75);
    display: none;
    z-index: 1003;
    pointer-events: auto;
    transition: all 0.3s ease;
}

#zoom-slider::before {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    border-radius: 12px;
    border: 1px solid transparent;
    background: linear-gradient(145deg,
            rgba(255, 255, 255, 0.4),
            rgba(0, 0, 0, 0.1) 70%,
            rgba(0, 0, 0, 0.1) 70%,
            rgba(255, 255, 255, 0.4)) border-box;
    -webkit-mask:
        linear-gradient(#fff 0 0) padding-box,
        linear-gradient(#fff 0 0) border-box;
    mask:
        linear-gradient(#fff 0 0) padding-box,
        linear-gradient(#fff 0 0) border-box;
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

#zoom-range {
    display: flex;
    justify-content: center;
    width: 120px;
    height: 5px;
    appearance: none;
    -webkit-appearance: none;
    background: rgba(255, 255, 255, 0.3);
    outline: none;
    border-radius: 3px;
    cursor: pointer;
    touch-action: none;
    will-change: transform;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

#zoom-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    will-change: transform;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

#zoom-range::-webkit-slider-thumb:hover {
    background: rgba(255, 255, 255, 0.95);
    transform: scale(1.15) translateZ(0);
    -webkit-transform: scale(1.15) translateZ(0);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);
}

#zoom-range::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: rgba(255, 255, 255, 0.8);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    will-change: transform;
    transform: translateZ(0);
}

#zoom-range::-moz-range-thumb:hover {
    background: rgba(255, 255, 255, 0.95);
    transform: scale(1.15) translateZ(0);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);
}

#zoom-range::-ms-thumb {
    width: 18px;
    height: 18px;
    background: rgba(255, 255, 255, 0.8);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

#zoom-range::-moz-range-track {
    height: 5px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

#zoom-range::-ms-track {
    height: 5px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

/******************************************/
/* Text Menu */
/******************************************/

:root {
    --border-color: rgba(255, 255, 255, 0.2);
    --border-radius: 12px;
    --shadow-sm: 0 1px 3px rgba(255, 255, 255, 0.1);
    --shadow-lg: 0 4px 15px rgba(255, 255, 255, 0.15);
    --shadow-focus: 0 0 0 3px rgba(255, 255, 255, 0.2);
    --shadow-hover: 0 2px 8px rgba(255, 255, 255, 0.15);
    --shadow-inset: inset 0 2px 4px rgba(255, 255, 255, 0.1);

    /* Dynamic stone sizing properties */
    --stone-max-width-factor: 1.0;
    --stone-scale-factor: 1.0;
    --stone-type: 'portrait';

    /* Base sizing values */
    --base-stone-max-width: 250px;
    --base-stone-min-width: 150px;
    --base-einfassung-max-width: 350px;
    --base-einfassung-min-width: 200px;
}

.text-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    gap: 1rem;
    padding: 0 0.25rem;
    backdrop-filter: blur(20px);
    background: rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 1.5rem;

}

.text-controls {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    width: 100%;
}

.font-controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    padding: 0;
}

.font-select {
    width: 100%;
    margin: auto;
    display: flex;
    gap: 10px;
    color: #000;
}

.font-select select,
#add-text-btn {
    width: 100%;
    max-width: 150px;
    border-radius: var(--border-radius);
    margin: 0 auto;
    text-align: center;
    font-size: 1.1rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border-color);
    backdrop-filter: blur(10px);
    padding: 4px 0;
}

.size-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.size-controls label {
    flex-shrink: 0;
    color: #000;
    font-weight: bold;
}

.size-controls select {
    width: fit-content;
    min-width: 60px;
    border-radius: var(--border-radius);
    font-size: 1.1rem;
    color: #000;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border-color);
    backdrop-filter: blur(10px);
    padding: 0.2rem;
    cursor: pointer;
}

.size-controls select option {
    background-color: rgba(51, 51, 51, 0.95);
    color: #fff;
    padding: 0.5rem;
    font-size: 1rem;
}

.font-select select:hover,
.size-controls select:hover,
#add-text-btn:hover {
    border-color: rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.15);
}

.font-select select:focus,
.size-controls select:focus {
    border-color: rgba(255, 255, 255, 0.6);
    outline: none;
    box-shadow: var(--shadow-focus);
}



.color-controls {
    width: 100%;
    display: flex;
    gap: 0.5rem;
    justify-content: space-between;
    padding: 0em;
}

.color-picker {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.color-btn {
    width: 2rem;
    height: 2rem;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
}

.color-btn[data-color="white"] {
    background: rgba(255, 255, 255, 0.8);
}

.color-btn[data-color="silver"] {
    background: linear-gradient(145deg, rgba(245, 245, 245, 0.8), rgba(200, 200, 200, 0.8));
}

.color-btn[data-color="gold"] {
    background: linear-gradient(145deg, rgba(255, 215, 0, 0.8), rgba(218, 165, 32, 0.8));
}

.color-btn[data-color="brown"] {
    background: rgba(139, 69, 19, 0.8);
}

.color-btn[data-color="black"] {
    background: rgba(0, 0, 0, 0.8);
}

.color-btn:hover {
    border-color: rgba(255, 255, 255, 0.8);
    box-shadow: var(--shadow-hover);
    transform: translateY(-1px);
}

.shadow-controls {
    display: flex;
    align-items: center;
    gap: 1em;
}

#white-shadow,
#black-shadow {
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.3);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(10px);
}

#white-shadow {
    color: #000000;
    text-shadow: 0 2px 0px rgba(255, 255, 255, 0.5);
    background: rgba(67, 67, 67, 0.3);
}

#black-shadow {
    text-shadow: 0 2px 0px rgba(0, 0, 0, 0.5);
    color: #ffffff;
    background: rgba(255, 255, 255, 0.3);
}

.shadow-controls button {
    font-weight: 700;
    background-size: 50%;
    background-repeat: no-repeat;
    background-position: center;
    border-radius: 12px;
    min-width: 2.5rem;
    min-height: 2.5rem;
    padding: 0;
    aspect-ratio: 1 / 1;
    font-size: 2rem;
}

.shadow-controls button:hover {
    border-color: rgba(255, 255, 255, 0.4);
    background-color: rgba(255, 255, 255, 0.2);
}

.shadow-controls button.active {
    border: 2px solid rgba(255, 255, 255, 0.6);
    transform: scale(1.1);
    box-shadow: var(--shadow-lg);
}

/* Metallic Effects

.metallic-silver {
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.9) 0%, rgba(229, 229, 229, 0.9) 50%, rgba(221, 221, 221, 0.9) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent !important;
}

.metallic-gold {
    background: linear-gradient(to bottom, rgba(255, 234, 148, 0.9) 0%, rgba(255, 220, 94, 0.9) 50%, rgba(255, 207, 64, 0.9) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent !important;
}

*/


.weight-controls {
    display: flex;
    gap: 1em;
}

.regular-btn,
.bold-btn {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 50px;
    background: rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
}

.regular-btn {
    background: url(../images/icons/regular.svg);
}

.bold-btn {
    background: url(../images/icons/bold.svg);
}

.regular-btn,
.bold-btn {
    font-weight: 700;
    background-size: 50%;
    background-repeat: no-repeat;
    background-position: center;
    min-width: 2.5rem;
    min-height: 2.5rem;
    padding: 0;
    aspect-ratio: 1 / 1;
}

.regular-btn:hover,
.bold-btn:hover {
    border-color: rgba(255, 255, 255, 0.4);
    background-color: rgba(255, 255, 255, 0.2);
}

@media screen and (max-width: 768px) {
    .text-content {
        gap: 1.5rem;
    }

    .font-controls,
    .color-controls {
        flex-direction: row;
        align-items: center;
    }

    #font-select {
        width: 100%;
    }
}

@media screen and (max-width: 480px) {
    .text-controls {
        gap: 1.5em;
    }

    .font-controls,
    .color-controls {
        flex-direction: row;
        align-items: center;
    }

    .color-picker {
        flex-wrap: wrap;
    }
}


/* calligraphy menu */


.calligraphy-color-picker {
    display: flex;
    justify-content: center;
    gap: 12px;
    padding: 8px 16px;
    margin: 0 auto;
    width: fit-content;
    border-radius: 25px;
    background-color: rgba(128, 128, 128, 0.4);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    -webkit-overflow-scrolling: touch;
    backdrop-filter: blur(12px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-sizing: border-box;
}

.calligraphy-color-btn {
    width: 2rem;
    height: 2rem;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
}

.calligraphy-color-btn[data-color="white"] {
    background: rgba(255, 255, 255, 0.8);
}

.calligraphy-color-btn[data-color="silver"] {
    background: linear-gradient(145deg, rgba(245, 245, 245, 0.8), rgba(200, 200, 200, 0.8));
}

.calligraphy-color-btn[data-color="gold"] {
    background: linear-gradient(145deg, #ffd700cc, rgba(218, 165, 32, 0.8));
}

.calligraphy-color-btn[data-color="brown"] {
    background: rgba(139, 69, 19, 0.8);
}

.calligraphy-color-btn[data-color="black"] {
    background: rgba(0, 0, 0, 0.8);
}

.calligraphy-color-btn:hover {
    border-color: rgba(255, 255, 255, 0.8);
    box-shadow: var(--shadow-hover);
    transform: translateY(-1px);
}

.calligraphy-color-btn.active {
    border-color: rgba(255, 255, 255, 0.8);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.calligraphy-content {
    padding: 0.5rem;
    flex: 1;
    overflow-y: auto;
}

.calligraphy-nav {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    margin: 0;
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: fit-content;
    background-color: rgba(128, 128, 128, 0.4);
    backdrop-filter: blur(12px);
    border-radius: 25px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.2);
    z-index: 1100;
}

.calligraphy-nav .nav-buttons {
    display: flex;
    gap: 8px;
    align-items: center;
}

.calligraphy-nav .nav-btn {
    width: auto;
    min-width: 60px;
    height: 35px;
    border-radius: 17.5px;
    color: #ffffff;
    box-sizing: border-box;
    background-color: rgba(128, 128, 128, 0.3);
    backdrop-filter: blur(12px);
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center;
    touch-action: manipulation;
    transition: all 0.3s ease;
    overflow: hidden;
    font-size: 12px;
    font-weight: 600;
    padding: 0 12px;
}

.calligraphy-nav .nav-btn::before {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    border-radius: 50px;
    border: 2px solid transparent;
    background: linear-gradient(145deg,
            rgba(255, 255, 255, 0.8),
            rgba(0, 0, 0, 0.1) 70%,
            rgba(0, 0, 0, 0.1) 70%,
            rgba(255, 255, 255, 0.8)) border-box;
    -webkit-mask:
        linear-gradient(#fff 0 0) padding-box,
        linear-gradient(#fff 0 0) border-box;
    mask:
        linear-gradient(#fff 0 0) padding-box,
        linear-gradient(#fff 0 0) border-box;
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}


.calligraphy-nav .nav-btn:hover,
.calligraphy-nav .nav-btn.active {
    background-color: rgba(255, 200, 0, 0.7);
    border-color: rgba(255, 200, 0, 0.8);
    box-shadow: 0 0 15px rgba(255, 200, 0, 0.4);
    transform: scale(1.05);
}




.calligraphy-section {
    display: none;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    justify-items: center;
}

.calligraphy-section.active {
    display: grid;
}

.calligraphy-item {
    text-align: center;
}

.calligraphy-item img {
    width: 100%;
    max-width: 150px;
    transition: transform 0.2s ease;
    cursor: pointer;
}

.calligraphy-item img:hover {
    transform: scale(1.05);
}

.calligraphy-item h3 {
    margin-top: 0.5rem;

    font-size: 0.9rem;
}

.calligraphy-preview.selected-calligraphy {
    transition: width 0.3s ease-out, outline-color 1.5s ease-in-out;
}

.calligraphy-preview.resizing {
    transition: width 0.1s linear;
}


.calligraphy-preview.dragging {
    opacity: 0.9 !important;
    filter: drop-shadow(0 0 8px rgba(0, 0, 0, 0.5));
}

.calligraphy-preview.selected-calligraphy {
    outline: 2px dashed rgba(255, 255, 255, 0.7);
    outline-offset: 4px;
    animation: selectionPulse 1.5s ease-in-out infinite;
}

.file-drop-zone.highlight {
    border-color: rgba(0, 0, 0, 0.5);
    background-color: rgba(255, 255, 255, 0.2);
}

.calligraphy-nav .file-drop-zone {
    position: static;
    width: auto;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px dashed rgba(255, 255, 255, 0.4);
    border-radius: 17.5px;
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(12px);
    margin: 0;
    box-shadow: none;
    transition: all 0.3s ease;
    cursor: pointer;
    box-sizing: border-box;
}

.calligraphy-nav .drop-zone-inner {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    color: white;
    font-size: 0.7rem;
    padding: 0;
}

.calligraphy-nav .drop-zone-inner p {
    margin: 0;
    font-size: 11px;
    font-weight: 500;
    opacity: 0.9;
}

.calligraphy-nav .upload-btn {
    width: auto;
    height: 32px;
    color: #ffffff;
    font-weight: 600;
    font-size: 12px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-sizing: border-box;
    background-color: rgba(128, 128, 128, 0.4);
    backdrop-filter: blur(12px);
    position: relative;
    padding: 6px 16px;
    touch-action: manipulation;
    transition: all 0.3s ease;
    overflow: hidden;
    cursor: pointer;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 6px;
}



.calligraphy-nav .upload-btn::before {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    border-radius: 13px;
    border: 2px solid transparent;
    background: linear-gradient(145deg,
            rgba(255, 255, 255, 0.8),
            rgba(0, 0, 0, 0.1) 70%,
            rgba(0, 0, 0, 0.1) 70%,
            rgba(255, 255, 255, 0.8)) border-box;
    -webkit-mask:
        linear-gradient(#fff 0 0) padding-box,
        linear-gradient(#fff 0 0) border-box;
    mask:
        linear-gradient(#fff 0 0) padding-box,
        linear-gradient(#fff 0 0) border-box;
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

.calligraphy-nav .upload-btn img {
    margin: 0;
    width: 0.55rem;
    filter: brightness(0) invert(1);
    order: 2;
}

.calligraphy-nav .upload-btn .upload-text {
    order: 1;
}

/* Desktop hover effects only */
@media (hover: hover) and (pointer: fine) {
    .calligraphy-nav .upload-btn:hover {
        background-color: rgba(255, 200, 0, 0.7);
        border-color: rgba(255, 200, 0, 0.8);
        box-shadow: 0 0 15px rgba(255, 200, 0, 0.4);
        transform: scale(1.05);
    }
}

.calligraphy-nav .file-drop-zone:hover {
    background-color: rgba(255, 200, 0, 0.1);
    border-color: rgba(255, 200, 0, 0.7);
    box-shadow: none;
}

@media screen and (max-width: 768px) {
    .calligraphy-nav {
        bottom: 15px;
        padding: 6px 12px;
        gap: 6px;
    }

    .calligraphy-nav .nav-buttons {
        gap: 6px;
    }

    .calligraphy-nav .nav-btn {
        min-width: 50px;
        height: 32px;
        font-size: 11px;
        padding: 0 10px;
        border-radius: 16px;
    }

    .calligraphy-section {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    }
}

@media screen and (max-width: 480px) {
    .calligraphy-nav {
        bottom: 10px;
        padding: 5px 10px;
        gap: 5px;
    }

    .calligraphy-nav .nav-buttons {
        gap: 5px;
    }

    .calligraphy-nav .nav-btn {
        min-width: 45px;
        height: 30px;
        font-size: 10px;
        padding: 0 8px;
        border-radius: 15px;
    }

    .calligraphy-nav .file-drop-zone {
        height: auto;
        padding: 0;
        border: none;
        background: transparent;
        border-radius: 0;
    }

    .calligraphy-nav .upload-btn {
        height: 28px;
        width: 28px;
        font-size: 9px;
        padding: 5px;
        border-radius: 14px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .calligraphy-nav .upload-btn img {
        width: 0.6rem;
        margin: 0;
    }

    .calligraphy-nav .drop-zone-inner .drop-text {
        display: none;
    }

    .calligraphy-nav .upload-btn .upload-text {
        display: none;
    }

    .calligraphy-section {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Ensure uploaded calligraphy images stay within bounds */
    .calligraphy-preview {
        max-width: calc(100% - 20px);
        /* Prevent overflow on mobile */
    }
}


/* Default draggable text styles */

#default-text-elements {
    position: absolute;
    width: 100%;
    height: 100%;
    z-index: 1002;
    pointer-events: none;
    color: #fff;
}

.draggable-text {
    position: absolute;
    cursor: move;
    user-select: none;
    pointer-events: auto;
    white-space: pre-wrap;
    text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.8);
    text-align: center;
    font-family: Arial, sans-serif;
    left: 50%;
    top: 15%;
    transform: translate(-50%, -50%);
    padding: 0.25rem;
    font-size: 0.65rem;
}


.name-text {
    top: 37%;
}


.dates-text {
    top: 42%;
}

.new-text {
    top: 20%;
}

.vertical-center-axis {
    position: absolute;
    top: 0;
    left: 50%;
    width: 2px;
    height: 100%;
    background-color: rgba(255, 215, 0, 0.3);
    transform: translateX(-50%);
    pointer-events: none;
    z-index: 999;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.draggable-text.dragging {
    transition: transform 0.05s ease-out !important;
}

.draggable-text.resizing {
    transition: font-size 0.1s linear;
}

.draggable-text.selected-text {
    outline: 2px dashed rgba(255, 200, 0, 0.7);
    outline-offset: 4px;
    animation: selectionPulse 1.5s ease-in-out infinite;
}

@keyframes selectionPulse {
    0% {
        outline-color: rgba(255, 255, 255, 0.7);
    }

    50% {
        outline-color: rgba(255, 210, 0, 0.7);
    }

    100% {
        outline-color: rgba(255, 255, 255, 0.7);
    }
}

/* Angebot Menu */

.angebot-content {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 15px;
    background-color: rgba(250, 250, 250, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 16px;
    color: #222;
    font-weight: normal;
    font-family: 'Montserrat', sans-serif;
    position: relative;
    overflow-y: auto;
    max-height: 100%;
}

.angebot-header {
    display: flex;
    flex-direction: column;
    align-items: center;
}



.angebot-title,
.angebot-subtitle {
    width: 100%;
    margin: auto;
    text-align: center;
    outline: none;
    border: none;
    background-color: transparent;
    padding: 0.125em;
}

.angebot-title {
    font-size: 1.5rem;
    font-weight: 700;

}

.angebot-title:focus,
.angebot-subtitle:focus {
    background-color: rgba(255, 255, 255, 0.8);
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1);
    outline: none;
}

.angebot-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 15px;
    width: 100%;
    position: relative;
}

/* Bottom section with Lieferdatum and Gesamtpreis */
.angebot-bottom-section {
    display: flex;
    flex-direction: row;
    gap: 8px;
    width: 100%;
    margin-top: auto;
    grid-column: 1 / -1;
    /* Span across all grid columns */
}

.angebot-bottom-section .angebot-item {
    flex: 1;
}

.angebot-item {
    display: flex;
    flex-direction: column;
    background-color: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 12px;
    padding: 0.5em;
    min-height: 80px;
    position: relative;
    border: 1px solid rgba(0, 0, 0, 0.4);
    transition: all 0.2s ease;
    box-sizing: border-box;
}


.angebot-item input {
    background: transparent;
    border: none;
    font-family: 'Montserrat', sans-serif;
    width: 100%;
    outline: none;
    transition: all 0.2s ease;
    border-radius: 4px;
    padding: 0.25em;
}

.angebot-item input:focus,
.item-legal-text:focus {
    background-color: rgba(255, 255, 255, 0.8);
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1);
}

.item-legal-text {
    grid-column: 1/-1;
    width: 100%;
    max-width: 100%;
    margin: auto;
    border: none;
    outline: none;
    background: transparent;
    resize: none;
    font-family: 'Montserrat', sans-serif;
    padding: 3px;
    text-align: center;
    margin: 1em auto;
    font-size: 12px;
    line-height: 1.5;
    color: #555;
    min-height: 80px;
    box-sizing: border-box;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

.angebot-item .item-title {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 5px;
    color: #222;
    text-transform: uppercase;
}

.angebot-item .item-description {
    font-size: 13px;
    color: #444;
    margin-bottom: 3px;
}

.angebot-item .item-price {
    font-size: 15px;
    font-weight: 600;
    color: #222;
    position: absolute;
    right: 15px;
    bottom: 15px;
    max-width: 130px;
    text-align: right;
    padding: 3px 8px;
    border-radius: 20px;
}

.angebot-item.gesamtpreis {
    border: 2px solid #00c21d;
    position: relative;
}

.angebot-item.gesamtpreis .item-title {
    font-size: 15px;
    font-weight: 700;
}

.angebot-item.gesamtpreis .item-price {
    font-size: 18px;
    font-weight: 700;
}

.angebot-item.gesamtpreis .item-description {
    font-size: 13px;
    color: #444;
    margin-bottom: 3px;
}

.angebot-material {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
}

.material-sample {
    text-align: center;
    color: white !important;
    padding: 10px !important;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    width: 70% !important;
    height: 100%;
    max-width: 250px;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
    text-transform: uppercase;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    background-image: url('../images/material/indian-black.jpg');
    background-size: auto;
    background-position: center;
    background-repeat: no-repeat;
    margin-left: auto;
    flex-grow: 1;
    min-width: 120px;
}


@media screen and (max-width: 768px) {
    .material-sample {
        font-size: 12px;
        padding: 8px !important;
        min-width: 100px;
    }
}

@media screen and (max-width: 480px) {
    .material-sample {
        font-size: 11px;
        padding: 6px !important;
        min-width: 80px;
    }
}

.add-item-btn {
    display: flex;
    align-items: center;
    font-family: inherit;
    font-weight: bold;
    cursor: pointer;
    align-self: center;
    max-width: 100px;
    font-weight: 700;
    font-size: 16px;
    padding: 0.7em 1.4em 0.7em 1.1em;
    margin-bottom: 1em;
    color: black;
    background-color: rgba(128, 128, 128, 0.5);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border: none;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
    letter-spacing: 0.05em;
    border-radius: 20em;
}

.add-item-btn:hover {
    background-color: rgba(128, 128, 128, 0.3);

}

.remove-item-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background-color: rgba(255, 0, 0, 0.15);
    color: #d00;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s ease;
    z-index: 2;
}

.angebot-item:hover .remove-item-btn {
    opacity: 0.7;
}

.remove-item-btn:hover {
    opacity: 1 !important;
    background-color: rgba(255, 0, 0, 0.25);
    transform: scale(1.1);
}

/* Responsive adjustments */
@media screen and (max-width: 1024px) {
    .angebot-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }
}

@media screen and (max-width: 768px) {
    .angebot-grid {
        grid-template-columns: 1fr;
    }

    .angebot-title {
        font-size: 20px;
    }

    .angebot-subtitle {
        font-size: 14px;
    }

    .angebot-item {
        padding: 12px;
    }

    .angebot-item .item-price {
        font-size: 14px;
        padding: 2px 6px;
    }
}

@media screen and (max-width: 480px) {
    .angebot-content {
        padding: 15px 10px;
    }

    .angebot-header {
        padding: 10px 0;
    }

    .angebot-item {
        min-height: 70px;
    }
}

/* Animation for adding new items */
@keyframes addItemAnimation {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Animation for removing items */
@keyframes removeItemAnimation {
    from {
        opacity: 1;
        transform: scale(1);
    }

    to {
        opacity: 0;
        transform: scale(0.9);
    }
}

.new-item-animation {
    animation: addItemAnimation 0.4s ease-out forwards;
}

.remove-item-animation {
    animation: removeItemAnimation 0.3s ease-in forwards;
}


.angebot-item input:focus::placeholder,
.item-legal-text:focus::placeholder {
    color: rgba(0, 0, 0, 0.3);
}

.angebot-item input:focus,
.item-legal-text:focus {
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

@media screen and (max-width: 480px) {
    .angebot-actions {
        padding: 10px 0;
    }

    .add-item-btn {
        padding: 6px 16px;
        font-size: 13px;
    }
}

.angebot-actions {
    display: flex;
    justify-content: center;
    margin-top: 10px;
    position: sticky;
    bottom: 0;
    background-color: rgba(250, 250, 250, 0.9);
    padding: 15px 0;
    z-index: 2;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.top-down-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background-color: rgba(212, 175, 55, 0.25);
    color: #996515;
    border: 1px solid rgba(184, 134, 11, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: pointer;
    z-index: 3;
    transition: all 0.2s ease;
    opacity: 0.9;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.top-down-btn:hover {
    opacity: 1;
    transform: scale(1.05);
    background-color: rgba(212, 175, 55, 0.35);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}


@keyframes priceAdjust {
    0% {
        background-color: transparent;
    }

    50% {
        background-color: rgba(212, 175, 55, 0.25);
    }

    100% {
        background-color: transparent;
    }
}

.price-adjusted {
    animation: priceAdjust 1.5s ease;
}


/* Login Menu */

.login-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    z-index: 1003;
    color: #000;
    background-color: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(12px);
    transition: all 0.3s ease-in-out;
    box-sizing: border-box;
    padding: 20px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: none;
    touch-action: pan-y;
    align-self: stretch;
    display: flex;
    justify-content: center;
    align-items: center;
}

.login-form {
    box-sizing: border-box;
    background-color: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(24px);
    box-shadow:
        inset 0 0 0 0.5px rgba(255, 255, 255, 0.2),
        0 4px 15px rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    color: #000;
    margin: 0 auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 15px;
}


.login-form button {
    margin: 0 auto;
    padding: 4px 8px;
    border-radius: 12px;
    color: #000;
    border: 1px solid black;
}

.login-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.login-field input {
    padding: 8px;
    min-width: 250px;
    border: 1px solid #00000075;
    border-radius: 12px;
}

#logout-btn {
    width: 22px;
    height: 22px;
    position: absolute;
    right: 2px;
    top: 2px;
    background-image: url(../images/icons/logout.svg);
    background-repeat: no-repeat;
    background-size: contain;
    background-color: transparent;
    border: none;

}

#logout-btn:hover {
    filter: brightness(0) invert(1) opacity(0.8);

}

.menu-close-btn {
    position: absolute;
    top: 1px;
    right: 1px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(0, 0, 0, 0.5);
    color: white;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    z-index: 9999;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
    pointer-events: auto;
}

.menu-close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
}

.menu-close-btn:active {
    transform: scale(0.95);
}

.einfassung-material-picker .material-btn:hover img,
.einfassung-material-picker .material-btn.active img {
    background-color: rgba(255, 200, 0, 0.5);
    backdrop-filter: blur(16px);
    border: 2px solid rgba(255, 200, 0, 0.5);
}


.stein-item img:hover,
.einfassung-item img:hover,
.blumen-item img:hover {
    transform: scale(0.975);
}





.abdeckplatten-item:hover .item-abdeckplatte,
.abdeckplatten-item:hover .item-einfassung-bg {
    transform: scale(0.975);
}

/* Menu Design Buttons - positioned at bottom center on all devices */
.menu-design-buttons {
    position: absolute;
    justify-content: center;
    bottom: 1px;
    left: 50%;
    transform: translateX(-50%);
    display: none;
    flex-direction: row;
    gap: 12px;
    z-index: 1001;
    pointer-events: auto;
    background-color: rgba(128, 128, 128, 0.4);
    backdrop-filter: blur(12px);
    padding: 4px 8px;
    border-top-right-radius: 25px;
    border-top-left-radius: 25px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.menu-design-buttons .menu-btn {
    width: 45px;
    height: 45px;
    padding: 0;
    border-radius: 50%;
    background-color: rgba(128, 128, 128, 0.3);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.menu-design-buttons .menu-btn:hover {
    background-color: rgba(255, 200, 0, 0.5);
    transform: scale(1.05);
}

.menu-design-buttons .menu-btn.active {
    background-color: rgba(255, 200, 0, 0.7);
    border-color: rgba(255, 200, 0, 0.8);
    box-shadow: 0 0 15px rgba(255, 200, 0, 0.4);
}

/* Ensure buttons have the same background images as the main menu buttons */
.menu-design-buttons button[data-target="einfassung"] {
    background-image: url(../images/icons/einfassung.svg);
    background-size: 75%;
    background-repeat: no-repeat;
    background-position: center;
}

.menu-design-buttons button[data-target="stein"] {
    background-image: url(../images/icons/stein.svg);
    background-size: 120%;
    background-repeat: no-repeat;
    background-position: center;
}

.menu-design-buttons button[data-target="abdeckplatten"] {
    background-image: url(../images/icons/abdeckplatte.svg);
    background-size: 40%;
    background-repeat: no-repeat;
    background-position: center;
}


@media screen and (max-width: 480px) {
    .menu-design-buttons {
        bottom: 1px;
        gap: 10px;
        padding: 6px 12px;
    }

    .menu-design-buttons .menu-btn {
        width: 40px;
        height: 40px;
    }
}


/* Styling für Hintergrund-Einfassung in Abdeckplatten-Items */
.item-einfassung-bg {
    filter: brightness(1) contrast(0.5) !important;
}

.stein-wrapper,
.einfassung-wrapper,
#abdeckplatten-wrapper {}

/* Touch-Performance Optimierung (nur für Touch-Geräte) */
@media (hover: none) and (pointer: coarse) {

    .draggable-text,
    .calligraphy-preview {
        /* Touch-Drag flüssiger machen */
        touch-action: none;
        -webkit-tap-highlight-color: transparent;
        /* Performance-Boost für Touch-Bewegungen */
        will-change: transform;
        transform: translateZ(0);
    }
}

/* Enhanced calligraphy drag and drop styles for smooth experience */
.calligraphy-preview {
    /* GPU acceleration for smooth transforms */
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    perspective: 1000px;
    -webkit-perspective: 1000px;
    will-change: transform;

    /* Smooth transitions for better drag feel */
    transition: transform 0.05s ease-out, opacity 0.2s ease, filter 0.2s ease, box-shadow 0.2s ease;
    -webkit-transition: transform 0.05s ease-out, opacity 0.2s ease, filter 0.2s ease, box-shadow 0.2s ease;
}

/* Enhanced dragging state for calligraphy */
.calligraphy-preview.dragging {
    opacity: 0.95 !important;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.3)) !important;
    transform: translateZ(0) scale(1.02);
    -webkit-transform: translateZ(0) scale(1.02);
    z-index: 9999;
    transition: none;
    /* No transition during active drag for immediate response */
    -webkit-transition: none;
}

/* Special class for calligraphy drag feedback */
.calligraphy-preview.calligraphy-dragging {
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    will-change: transform;
}

/* Near center magnetism effect for calligraphy */
.calligraphy-preview.near-center {
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.4)) drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
    transform: translateZ(0) scale(1.01);
    -webkit-transform: translateZ(0) scale(1.01);
}

/* Snap animation for calligraphy */
.calligraphy-preview.snapped {
    filter: drop-shadow(0 0 12px rgba(255, 255, 255, 0.6)) drop-shadow(0 2px 6px rgba(0, 0, 0, 0.4));
    transform: translateZ(0) scale(1.03);
    -webkit-transform: translateZ(0) scale(1.03);
    transition: transform 0.2s ease-out, filter 0.2s ease-out;
    -webkit-transition: transform 0.2s ease-out, filter 0.2s ease-out;
}

/* Enhanced selection state for calligraphy to match text elements */
.calligraphy-preview.selected-calligraphy {
    outline: 2px dashed rgba(255, 255, 255, 0.8);
    outline-offset: 4px;
    animation: selectionPulse 1.5s ease-in-out infinite;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    transition: width 0.3s ease-out, outline-color 1.5s ease-in-out, transform 0.2s ease-out;
    -webkit-transition: width 0.3s ease-out, outline-color 1.5s ease-in-out, transform 0.2s ease-out;
}

/* Smooth resizing for calligraphy */
.calligraphy-preview.resizing {
    transition: width 0.1s linear, transform 0.1s linear;
    -webkit-transition: width 0.1s linear, transform 0.1s linear;
}

/* Body class for when dragging calligraphy */
body.dragging-calligraphy {
    cursor: grabbing !important;
    -webkit-cursor: grabbing !important;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

body.dragging-calligraphy * {
    cursor: grabbing !important;
    -webkit-cursor: grabbing !important;
}

/* Ensure consistent behavior with text elements */
.calligraphy-preview:hover {
    transform: translateZ(0) scale(1.01);
    -webkit-transform: translateZ(0) scale(1.01);
    transition: transform 0.2s ease-out;
    -webkit-transition: transform 0.2s ease-out;
}

/* Touch-specific optimizations for mobile */
@media (hover: none) and (pointer: coarse) {
    .calligraphy-preview {
        /* Enhanced touch responsiveness */
        transition: transform 0.05s ease-out, opacity 0.15s ease;
        -webkit-transition: transform 0.05s ease-out, opacity 0.15s ease;
        touch-action: none;
        /* Prevent scrolling during drag */
        -webkit-touch-callout: none;
        /* Prevent callout on iOS */
    }

    .calligraphy-preview.dragging {
        opacity: 0.9 !important;
        transform: translateZ(0) scale(1.05);
        -webkit-transform: translateZ(0) scale(1.05);
    }
}

/* Body class for when dragging text elements - same behavior as calligraphy */
body.dragging-text {
    cursor: grabbing !important;
    -webkit-cursor: grabbing !important;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

body.dragging-text * {
    cursor: grabbing !important;
    -webkit-cursor: grabbing !important;
}

/* Enhanced text element dragging state */
.draggable-text.dragging {
    opacity: 0.95 !important;
    transform: translateZ(0) scale(1.02);
    -webkit-transform: translateZ(0) scale(1.02);
    z-index: 9999;
    transition: none;
    /* No transition during active drag for immediate response */
    -webkit-transition: none;
    cursor: grabbing !important;
    -webkit-cursor: grabbing !important;
}

/* Text element hover state for consistency with calligraphy */
.draggable-text:hover {
    transform: translateZ(0) scale(1.01);
    -webkit-transform: translateZ(0) scale(1.01);
    transition: transform 0.2s ease-out;
    -webkit-transition: transform 0.2s ease-out;
}