/* Fallback styles and root styles */
:root {
    background-color: black;
    font-family: Arial, Helvetica, sans-serif;
}

/* Center the body content */
body {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding-bottom: 15vh;

}

body.adv-open {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding-bottom: 35vh;

}

/* Logo styles */
.logo {
    color: white;
    text-align: center;
    font-family: 'Libre Franklin', sans-serif;
}

/* container for the canvas */
#canvasHolder {
    display: block;
    justify-content: center;
    align-items: center;
    border: 2px solid white;
    box-shadow: 0 0 10px white;
    border-radius: 1%;
    width: 45vw;
    height: auto;
    overflow: hidden;
    margin-top: 0%;
    cursor: pointer;
}

/* canvas element styles */
#memeEditor {
    display: block;
    width: 100%;
    height: auto;
    user-select: none;
    overflow: inherit;
}

/* controls container */
.controls {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);

    width: 45vw;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem;

    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(3px);
    box-shadow: 0 0 0 rgba(0, 0, 0, 0);
    border-radius: 5%;
    z-index: 99999;
    --controls-h: calc(100%);
}

/* Text input styles */
.textInput {
    width: 100%;
    padding: 10px;
    font-size: 1rem;
    border: 2px solid white;
    border-radius: 5px;
    background-color: black;
    color: white;
    font-family: 'Libre Franklin', sans-serif;
    box-sizing: border-box;
    text-align: center;
}

#exportBtn {
    padding: 10px 20px;
    font-size: 1rem;
    border: 2px solid white;
    border-radius: 5px;
    background-color: black;
    color: white;
    font-family: 'Libre Franklin', sans-serif;
    cursor: pointer;
}

.horizGroupImpact {
    display: flex;
    flex-direction: row;
    gap: 1rem;
}

#advBtn {
    padding: 10px 20px;
    font-size: 1rem;
    border: 2px solid white;
    border-radius: 5px;
    background-color: black;
    color: white;
    font-family: 'Libre Franklin', sans-serif;
    cursor: pointer;
}

button {
    transition: transform 0.15s ease, background 0.15s ease;
}

button:active {
    transform: scale(0.97);
}

#advancedSettingsHandler {
    /* hidden state */
    max-height: 0;
    opacity: 0;
    transform: translateY(10px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: max-height 0.5s ease-in-out, opacity 0.1s ease-in-out, transform 0.1s ease-in-out;
    pointer-events: none;
}

#advancedSettingsHandler.visible {
    /* visible state */
    max-height: 400px;
    /* large enough to fit contents — adjust if needed */
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.advGroup {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.advLabel {
    color: white;
    font-family: 'Libre Franklin', sans-serif;
}

.advInput {
    padding: 10px 20px;
    font-size: 1rem;
    border: 2px solid white;
    border-radius: 5px;
    background-color: black;
    color: white;
    font-family: 'Libre Franklin', sans-serif;
    cursor: pointer;
}

#mobilePlaceholder {
    color: white;
    text-align: center;
    padding: 2rem;
    font-family: sans-serif;
}

.hidden {
    display: none;
}

@media (max-width: 600px) {

    /* Center the body content */
    body {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding-bottom: 30vh;

    }

    body.adv-open {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding-bottom: 55vh;
    }

    /* Mobile layout: show canvas and controls, hide the placeholder */

    #canvasHolder {
        display: block;
        width: 95vw;
        max-width: 1200px;
        margin: 0.5rem auto;
        border-radius: 8px;
        border: 1px solid white;
        box-shadow: 0 0 10px white;
        cursor: pointer;
    }

    /* Make canvas scale to container width while keeping aspect ratio */
    #memeEditor {
        width: 100%;
        height: auto;
        touch-action: manipulation;
        /* improve touch responsiveness */
    }

    .controls {
        display: flex;
        width: 95vw;
        max-width: 1200px;
        left: 50%;
        transform: translateX(-50%);
        bottom: 0.5rem;
        padding: 0.75rem;
        gap: 0.5rem;
        border-radius: 10px;
    }

    .horizGroupImpact {
        flex-direction: column;
        gap: 0.5rem;
    }

    .textInput {
        width: 100%;
        padding: 0.85rem 0.75rem;
        font-size: 1.05rem;
        border-radius: 8px;
    }

    button,
    .advInput {
        width: 100%;
        padding: 0.8rem;
        font-size: 1.05rem;
        border-radius: 8px;
    }

    #mobilePlaceholder {
        display: none;
    }
}

.adjustRow {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.advLabel {
    color: white;
    font-size: 1rem;
    margin-left: 0.3rem;
}

.adjustBar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 2px solid white;
    border-radius: 999px; /* pill shape */
    padding: 0.4rem 1rem;
    width: 100%;
    box-sizing: border-box;
}

.adjustValue {
    flex-grow: 1;
    text-align: center;
    color: white;
    font-size: 1.1rem;
    pointer-events: none;
}

.adjustBtn {
    background: none;
    border: none;
    color: white;
    font-size: 1.4rem;
    padding: 0.2rem 0.8rem;
    cursor: pointer;
}
.adjustBtn:active {
    transform: scale(0.9);
}
#strokeValue, #fontSizeValue {
    color: white;
    font-family: 'Libre Franklin', sans-serif;
    font-size: 1rem;
    min-width: 40px;
    text-align: center;
}

