body {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    background-color: #5B518C;
}

header {
    background-image: linear-gradient(to top, #5B518C, #B05896);
    color: #333;
    padding: 10px 20px;
    width: 100%;
    text-align: left;
    position: fixed;
    top: 0;
    left: 0;
    box-sizing: border-box;
    z-index: 10;
}

header nav {
    display: flex;
    justify-content: space-between; /* Pushes content to the edges */
    align-items: center; /* Vertically align the logo and toggle buttons */
    max-width: none;
    margin: 0;
    padding: 0 10px; /* Add padding to the nav instead of the header */
}

header nav a {
    padding: 0;
}

header nav a img {
    height: 62px;
    vertical-align: middle;
    margin-right: 20px;
}

.language-toggle {
    display: flex;
    /*align-items: center; */
    flex-direction: column; /* Stack the buttons vertically */
    align-items: flex-end; /* Align the buttons to the left */
    gap: 5px; /* Spacing between the language buttons */
}

.lang-button {
    font-family: sans-serif;
    font-size: 1em;
    font-weight: bold;
    color: #fff;
    text-decoration: none;
    background-color: rgba(255, 255, 255, 0.2);
    padding: 5px 10px;
    border-radius: 5px;
    transition: background-color 0.1s ease-in-out;
}

.lang-button:hover {
    background-color: rgba(255, 255, 255, 0.4);
}

.lang-button.active {
    background-color: #fff;
    color: #B05896;
}

/* This is the new rule to disable the language buttons */
body.audio-playing .language-toggle .lang-button {
    pointer-events: none;
    cursor: not-allowed;
    opacity: 0.5;
}

.grid-frame {
    min-height: calc(100vh - 40px);
    max-height: calc(100vh - 40px);
    width: 100%;
    max-width: 380px;
    margin-top: 120px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex-shrink: 0;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.button-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(5, 1fr); /* Updated for 10 buttons (2x5) */
    gap: 10px;
    padding: 10px
}

.sound-button {
    width: auto;
    height: 120px;
    border: 2px solid #F8DA86;
    border-top-left-radius: 30px;
    border-top-right-radius: 30px;
    border-bottom-left-radius: 30px;
    border-bottom-right-radius: 30px;
    cursor: pointer;
    box-shadow: 4px 4px 8px rgba(248, 218, 134, 0.6);
    transition: transform 0.1s ease-in-out, box-shadow 0.1s ease-in-out;
    position: relative;
    overflow: hidden;
    /* display: flex; */
    justify-content: center;
    align-items: center;
}

.sound-button img {
    max-width: 100%;
    max-height: 100%;
    display: block;
    top: 0;
    left: 0;
    object-fit: contain;
}

.sound-button span {
    background-color: rgba(255, 255, 255, 0.7);
    color: #B05896;
    font-family: 'Akaya Kanadaka', cursive, sans-serif;
    font-size: 1.3em;
    padding: 1px 10px;
    border-radius: 5px;
    position: absolute;
    top: 5px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    width: calc(100% - 10px);
    box-sizing: border-box;
}

.sound-button.highlight {
    border: 5px solid #F69566;
    box-shadow: 0 0 10px #F69566;
}

.sound-button.pressed {
    transform: scale(0.90);
    box-shadow: 2px 2px 15px rgba(246, 149, 102, 1);
    transform-origin: 50% 50%;
    border-width: 2px;
}

.sound-button.pressed.highlight {
    box-shadow: 0 0 15px #F69566, 2px 2px 15px rgba(246, 149, 102, 1);
}

.sound-button.playing {
    /* Style for the button that is currently playing */
    cursor: pointer;
}

/* Stop button styling */
.stop-button {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgb(0, 0, 0, 0.5); /* Semi-transparent black overlay */
    display: none; /* Hide by default */
    align-items: center;
    justify-content: center;
    z-index: 5;
    cursor: pointer;
}

.stop-button img {
    width: 70%;
    height: 70%;
    object-fit: contain;
    filter: invert(1); /* Invert the colors for better visibility on dark background */
}

/* Show the stop button only when the parent button has the 'playing' class */
.sound-button.playing .stop-button {
    display: flex;
}

body.audio-playing .sound-button:not(.playing) {
    pointer-events: none; /* Disable click events on buttons that are not playing */
    cursor: not-allowed;
    opacity: 0.5; /* Visually indicate that the buttons are disabled */
}

/* Styling for the Footer and Logo Grid */
footer {
    width: 100%;
    padding: 20px 0;
    background-image: linear-gradient(to bottom, #5B518C 90%, #B05896);
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0; /* Prevents the footer from shrinking */
}

.footer-logos {
    display: grid;
    /* This creates the single column grid you requested: one logo under the other */
    grid-template-columns: 1fr; 
    gap: 15px; /* Space between logos */
    padding: 0 10px;
    max-width: 300px; /* Constrain the width for a tidy look on narrow screens */
}

.footer-logos a {
    display: block; /* Ensures each link takes up a full row */
    text-align: center;
}

.footer-logos img {
    /* Rules to handle odd shapes */
    max-width: 100%;
    max-height: 80px; /* Limits the vertical size of any logo */
    width: auto;
    height: auto;
    object-fit: contain; /* Ensures the whole logo is visible without cropping */
    padding: 5px; /* Slight padding inside the container */
    border-radius: 5px;
    //background-color: rgba(255, 255, 255, 0.9); /* Light background to help odd-shaped logos stand out */
}