.flashcard-container {
    margin-top: 5rem;
    margin-left: auto;
    margin-right: auto;
    width: 50rem; /* Match the child elements */
    height: 50rem;
    perspective: 1000px; /* Added for 3D effect */
    transition: transform 0.8s;
    cursor: pointer;
    position: relative;
  }


.flashcard-container.flipped .front:hover::after {
    visibility: hidden;
    opacity: 0;
}

.flashcard-container:hover {
    transform: scale(1.05);
}

.flashcard-container.flipped .front {
    transform: rotateY(180deg);
}

.flashcard-container.flipped .back {
    transform: rotateY(360deg);
}

.front, .back {
    backface-visibility: hidden;
    transition: transform 0.8s;
    transform-style: preserve-3d;
    transform-style: preserve-3d;
    width: 100%; /* Match the child elements */
    height: 100%;
    background-size: cover;
    background-position: center;
    border-radius: 10px; /* Rounded corners for a fancy look */

    background-color: #fff;
    border: 2px solid #59616a; /* Solid blue border */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); /* Subtle shadow for depth */

    position: absolute; /* Changed to absolute */
    top: 0;
    left: 0;
}

.front::after {
    content: var(--bubble-content, ''); /* Use a CSS variable, default to empty */
    position: relative;
    left: 50%;
    top: -0%;
    transform: translate(-50%, -50%);
    visibility: hidden;
    opacity: 0;
    background-color: #007bff;
    color: white;
    text-align: center;
    border-radius: 6px;
    padding: 5px 10px;
    box-shadow: 0px 0px 10px rgba(0,0,0,0.1);
    transition: opacity 0.3s, visibility 0.3s;
    display: inline-flex; /* Adjusted to inline-flex to wrap content */
    align-items: center;
    justify-content: center;
    font-family: 'IM Fell English SC', serif;
    font-weight: bold;
    font-size: 2rem; /* Adjust size as needed */
}

.front:hover::after {
    visibility: visible;
    opacity: .9;
}

.back {
    transform: rotateY(180deg);
}

.back-content {
    margin-left: auto;
    margin-right: auto;
    width: 100%;
    height: 100%;
    position: absolute;
}

@media only screen
and (-webkit-device-pixel-ratio: 3)
and (orientation: portrait) {
    .flashcard-container {
        width: 35rem;
        height: 45rem;
    }
}

@media only screen
and (-webkit-device-pixel-ratio: 2)
and (orientation: portrait) {
    .flashcard-container {
        width: 42rem;
        height: 50rem;
    }
}
