body {
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background 1s ease-in-out;
    margin: 0;
    background-color: #4e4e4e;
    height: 100vh;
    overflow: hidden;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

#word-display {
    display: flex;
    position: relative;
    justify-content: center;
    align-items: center;
    opacity: 1;
    transition:
        color 0.5s ease,
        opacity 0.5s ease;
    cursor: pointer;
    box-sizing: border-box;
    container-type: size;
    box-shadow:
        0 1px 1px rgba(0, 0, 0, 0.1),
        0 8px 16px rgba(0, 0, 0, 0.3);
    border-radius: 10px 40px 40px 10px;
    background-image:
        repeating-linear-gradient(0deg,
            #eee 0.5px,
            transparent 0.5px,
            transparent 20px),
        repeating-linear-gradient(180deg,
            #000 0.1px,
            transparent 0.5px,
            transparent 20px);
    background-size: 20px 20px;
    background-color: lightgrey;
    padding: 0 20px;
    width: 90%;
    max-width: 800px;
    height: auto;
    -webkit-text-stroke: 2px #333;
    overflow: hidden;
    color: black;
    font-weight: bold;
    /* Scales with viewport width to accommodate words */
    line-height: 1;
    letter-spacing: 0.1em;
    user-select: none;
    text-shadow: 4px 4px 8px rgba(0, 0, 0, 0.5);
}

.letter {
    display: inline-block;
    transition: transform 0.2s ease-in-out, color 0.2s ease-in-out, text-shadow 0.2s ease-in-out;
    font-size: clamp(2rem, 15cqw, 8rem);
}

/* The style applied when a letter is being spoken */
.letter.active {
    transform: scale(1.3) translateX(3px) translateY(-25px);
    color: #ffffff !important;
    text-shadow: 4px 15px 16px rgba(0, 0, 0, 0.85);
}

/* Styles for mobile devices */
@media (max-width: 767px) {
    #word-display {
        box-sizing: content-box;
        padding: 20px;
        width: 250px;
        height: 400px;
        -webkit-text-stroke: 1px #333;
        font-size: 15vw;
        /* Slightly larger scale on mobile */
        text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    }
}

/* Styles for desktop */
@media (min-width: 768px) {
    #word-display {
        box-sizing: content-box;
        width: 600px;
        height: 720px;
        -webkit-text-stroke: 3px #333;
        font-size: 8em;
        /* Cap the size on larger screens */
        text-shadow: 6px 6px 12px rgba(0, 0, 0, 0.75);
    }
}

@media (prefers-reduced-motion: reduce) {
    #word-display {
        transition: none !important;
    }
}