body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    font-family: 'MS P Gothic', sans-serif;
    overflow: hidden;
    background-color: #f0f0f0;
}

#trial-header {
    background-color: #d32f2f; /* Red background for trial header */
    color: white;
    text-align: center;
    padding: 2px; /* Reduced padding */
    font-size: 1em; /* Reduced font size */
    font-weight: bold;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000; /* Ensure it's on top */
}

#trial-header a {
    color: white;
    text-decoration: none;
}

#ad-footer {
    background-color: #333;
    color: white;
    text-align: center;
    padding: 10px;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
}

#ad-footer img {
    max-width: 100%;
    height: auto;
}

#splash-screen, #settings-screen, #game-screen {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

#splash-screen {
    background-color: #000;
    color: #fff;
}

#splash-screen img {
    width: 50%;
    max-width: 400px;
}

#settings-screen h2 {
    font-size: 1.5em; /* Further reduced font size */
    margin-bottom: 2px; /* Minimal margin */
    line-height: 0.5; /* Tighter line height */
}

.settings-container {
    display: flex;
    justify-content: space-around;
    width: 80%;
    margin-bottom: 15px; /* Reduced space between team and time settings */
}

.team-settings {
    width: 45%;
}

.team-settings h3 {
    margin-bottom: 2px; /* Tighter spacing */
}

.team-settings label {
    display: block;
    margin-bottom: 2px; /* Tighter spacing */
}

.team-settings input, #time-limit {
    width: 80%;
    padding: 5px;
    font-size: 1.2em;
}

#time-limit {
    width: 60px; /* 3-digit width */
}

.time-input-container {
    margin-bottom: 5px; /* Reduced space below the input */
}

.time-presets button {
    font-size: 1.2em; /* Increase font size */
    padding: 5px 10px;
}

.game-settings {
    margin: 8px 0; /* Tighter vertical margin */
}

#start-game, #go-to-bgm {
    padding: 15px 30px;
    font-size: 1.5em;
    cursor: pointer;
}

#bgm-selection-screen {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    background-color: #f0f0f0;
}

#bgm-selection-screen h2 {
    font-size: 2em;
    margin-bottom: 20px;
}

.genre-buttons {
    margin: 20px 0;
    display: flex;
    flex-direction: column; /* Arrange rows vertically */
    align-items: center; /* Center rows horizontally */
    gap: 15px;
}

.genre-row {
    display: flex;
    justify-content: center; /* Center buttons within a row */
    gap: 15px;
}

.genre-btn {
    padding: 15px 25px;
    font-size: 1.2em;
    border: 2px solid transparent;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    width: 200px; /* Add this line */
}

.genre-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.genre-btn.selected {
    border-color: #000;
    box-shadow: 0 0 15px rgba(0,0,0,0.5);
    transform: scale(1.05);
}

.genre-btn[data-genre="all"] { background-color: #8e44ad; } /* Purple */
.genre-btn[data-genre="kids"] { background-color: #3498db; } /* Blue */
.genre-btn[data-genre="teens"] { background-color: #e67e22; } /* Orange */
.genre-btn[data-genre="popular"] { background-color: #e74c3c; } /* Red */
.genre-btn[data-genre="beginning"] { background-color: #2ecc71; } /* Green */
.genre-btn[data-genre="climax"] { background-color: #f1c40f; } /* Yellow */
.genre-btn[data-genre="international"] { background-color: #9b59b6; } /* Amethyst */


#game-screen {
    background: linear-gradient(to right, #e0e8ff, #ffe0e0);
}

.top-bar {
    position: absolute;
    top: 0;
    width: 100%;
    padding: 10px;
    padding-top: 40px; /* Add padding to push timer down */
    box-sizing: border-box;
}

.timer {
    font-size: 4em;
    font-weight: bold;
    color: #333;
    cursor: pointer;
}

.main-content {
    display: flex;
    justify-content: space-around;
    align-items: center;
    width: 100%;
}

.team {
    width: 45%;
    position: relative; /* Establish a positioning context */
    height: 80vh;     /* Give a consistent height for alignment */
}

.team-name {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 20%; /* Allocate top 20% for the name */
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 3.5em;
    font-weight: bold;
    word-wrap: break-word;
}

/* Responsive font size for team names in portrait mode */
@media (orientation: portrait) {
    .team-name {
        font-size: 2.5em; /* Smaller font for vertical screens */
    }
}

.score {
    position: absolute;
    top: 20%;
    left: 0;
    right: 0;
    height: 55%; /* Allocate middle 55% for the score */
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 8em;
    font-weight: bold;
    cursor: pointer;
}

.penalty-section {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 25%; /* Allocate bottom 25% for penalty */
}

.blue .team-name { color: #000080; }
.red .team-name { color: #800000; }

.blue .score { color: #4444ff; }
.red .score { color: #ff4444; }

.vs {
    font-size: 2em;
    font-weight: bold;
    align-self: center; /* Center VS vertically in the flex container */
}

.penalty-label {
    font-size: 2em;
}

.penalty-count {
    font-size: 3em;
    font-weight: bold;
    cursor: pointer;
}

#pause-overlay {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-color: rgba(0,0,0,0.5);
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column; /* Allow items to stack vertically */
    font-size: 2em;
}

#pause-overlay p {
    cursor: pointer;
}

.pause-buttons {
    margin-top: 20px;
    display: flex; /* Use flexbox for centering */
    justify-content: center; /* Center buttons horizontally */
    width: 100%; /* Ensure the container takes full width */
}

.pause-buttons button {
    font-size: 0.8em;
    padding: 10px 20px;
    margin: 0 15px;
    cursor: pointer;
}
