@font-face {
    font-family: 'Anton';
    src: url('fonts/Anton-Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'Funnel Sans';
    src: url('fonts/FunnelSans-Medium.ttf') format('truetype');
    font-weight: 500;
    font-style: normal;
}

body {
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: #0e0e0e;
    font-family: 'Arial', sans-serif;
    overflow: auto;
}

.wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    overflow: visible;
}

/* Mobile scaling */
@media only screen and (max-width: 768px) {
    .wrapper {
        transform: scale(0.5);
        transform-origin: top center;
        width: 200%; /* Compensate for scaling to maintain layout width */
        position: relative;
        top: 0; /* Ensure it starts at the top without jumping */
    }
    body {
        height: auto; /* Allow body to expand with scaled content */
        align-items: flex-start; /* Align to top on mobile to prevent centering shift */
        padding-top: 10vh; /* Add some padding to ensure visibility */
    }
}

.top-container {
    text-align: center;
    background: #1b1b1b;
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    width: 475px;
    height: 500px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    z-index: 1;
    transition: opacity 0.5s ease;
}

.bottom-container {
    background: #1b1b1b;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    width: 515px;
    height: 100px;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 1;
    transition: opacity 0.5s ease;
}

h1 {
    color: #ffffff;
    font-size: 5.0em;
    margin-bottom: 70px;
    text-transform: uppercase;
    letter-spacing: 2px;
    animation: fadeIn 1s ease-in;
    font-family: 'Anton', sans-serif;
    text-shadow: 0 0 50px rgba(255, 255, 255, 0.15);
}

.play-area {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
    flex-direction: column;
    position: absolute;
    top: 317px;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
}

.button-container {
    display: flex;
    gap: 18px;
    justify-content: center;
    align-items: center;
    position: relative;
}

#playButton {
    background: #ffffff;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, background 0.3s ease;
    padding: 0;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.1);
}

#playButton img {
    width: 18.468px;
    height: 18.468px;
}

#playButton:hover:not(:disabled) {
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.1);
}

#playButton:disabled {
    background: #666666;
    cursor: not-allowed;
    box-shadow: none;
}

#extendButton {
    background: #ffffff;
    border: none;
    border-radius: 25px;
    font-size: 20px;
    cursor: pointer;
    transition: transform 0.2s ease;
    height: 40px;
    width: 125px;
    display: flex;
    align-items: center;
    initial-scale=1.0, justify-content: center;
    padding: 0;
    font-family: 'Funnel Sans', 'Helvetica', 'Arial', sans-serif;
    text-align: center;
}

#extendButton:hover:not(:disabled) {
    transform: scale(1.05);
}

#extendButton:disabled {
    background: #666666;
    cursor: not-allowed;
    opacity: 0.7;
}

#volumeButton {
    background: #ffffff;
    border: none;
    border-radius: 25px;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: width 0.16s ease;
    padding: 0;
    position: relative;
    overflow: hidden;
    margin-left: 0;
    transform-origin: left center;
    font-family: 'Funnel Sans', 'Helvetica', 'Arial', sans-serif radiographic;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.1);
}

#volumeButton:hover:not(:disabled) {
    width: 100px;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.1);
}

#volumeButton:disabled {
    background: #666666;
    cursor: not-allowed;
    pointer-events: none;
    box-shadow: none;
}

#volumeButton img {
    width: 19.3914px;
    height: 19.3914px;
    transition: opacity 0.16s ease;
}

#volumeButton:hover:not(:disabled) img {
    opacity: 0;
}

#volumeButton::before {
    content: '-';
    position: absolute;
    left: 19px;
    top: 45%;
    transform: translate(-50%, -50%);
    font-size: 30px;
    color: #000000;
    opacity: 0;
    transition: opacity 0.16s ease;
    font-family: 'Funnel Sans', 'Helvetica', 'Arial', sans-serif;
}

#volumeButton:hover:not(:disabled)::before {
    opacity: 1;
}

#volumeButton::after {
    content: '+';
    position: absolute;
    left: 81px;
    top: 50%;
    transform: translate(-50%, -50%);
    font-size: 30px;
    color: #000000;
    opacity: 0;
    transition: opacity 0.16s ease;
    font-family: 'Funnel Sans', 'Helvetica', 'Arial', sans-serif;
}

#volumeButton:hover:not(:disabled)::after {
    opacity: 1;
}

#volumeButton::after::before {
    content: '';
    position: absolute;
    left: 50px;
    top: 50%;
    transform: translateY(-50%);
    border-left: 1px solid #000000;
    height: 20px;
    opacity: 0;
    width: 0;
    z-index: 0;
    transition: opacity 0.16s ease;
}

#volumeButton:hover:not(:disabled)::after::before {
    opacity: 1;
}

#volumeButton .volume-number {
    position: absolute;
    left: 48%;
    top: 50%;
    transform: translate(-50%, -50%);
    font-size: 21px;
    color: #000000;
    opacity: 0;
    transition: opacity 0.16s ease;
    z-index: 1;
    font-family: 'Funnel Sans', 'Helvetica', 'Arial', sans-serif;
}

#volumeButton:hover:not(:disabled) .volume-number {
    opacity: 1;
}

.search-container {
    --search-offset: 150px;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: calc(-30px + var(--search-offset));
    left: -10px;
}

.search-input-wrapper {
    position: relative;
    width: 277px;
    height: 40px;
}

#songInput {
    width: 100%;
    padding: 12px;
    font-size: 1.1em;
    border: none;
    border-radius: 25px;
    background-color: #2d2d2d;
    color: #ffffff;
    outline: none;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
    transition: box-shadow 0.2s ease;
}

#songInput:focus {
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

#songInput::placeholder {
    color: #aaaaaa;
    transition: color 0.3s ease;
}

#suggestions {
    position: absolute;
    top: 115%;
    left: 52.5%;
    transform: translateX(-50%);
    width: 310px;
    background: rgba(44, 44, 44, 1);
    border-radius: 10px;
    max-height: 120px;
    overflow-y: auto;
    display: none;
    z-index: 10;
}

.suggestion {
    padding: 10px;
    color: #ffffff;
    cursor: pointer;
    transition: background 0.2s ease;
}

.suggestion:hover {
    background: #4d4d4d;
}

.album-info {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    height: 100%;
    opacity: 0;
    transition: opacity 0.3s ease;
    position: relative;
    width: 700px;
}

#albumCover {
    width: 100px;
    height: 100px;
    margin-left: 7px;
    border-radius: 15px;
    flex-shrink: 0;
    transition: opacity 0.3s ease;
    opacity: 0;
}

.song-details {
    position: absolute;
    left: 123px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    max-width: 550px;
}

.song-title {
    color: #ffffff;
    font-size: 1.44em;
    font-weight: bold;
}

.album-name {
    color: #cccccc;
    font-size: 1.2em;
}

#resultDisplay {
    color: #ffffff;
    font-size: 1.2em;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    margin-right: 20px;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#roundDisplay {
    color: #ffffff;
    font-size: 1.44em;
    text-align: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
}

#finalScreen {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #1b1b1b;
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    width: 475px;
    height: 550px;
    z-index: 2;
    display: flex;
    flex-direction: column;
}

.final-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-grow: 1;
}

.final-songs {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    margin-bottom: 30px;
}

.final-song {
    --final-offset: -20px;
    --final-offset-height: 15px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    width: 85%;
    opacity: 0;
    transition: opacity 0.5s ease;
    margin-bottom: 15px;
    padding-left: 10px;
    transform: translateX(var(--final-offset)) translateY(var(--final-offset-height));
}

.final-song img {
    width: 75px;
    height: 75px;
    border-radius: 15px;
    margin-right: 10px;
}

.final-song-details {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    flex-grow: 1;
}

.final-song-title {
    color: #ffffff;
    font-size: 1.296em;
    font-weight: bold;
}

.final-album-name {
    color: #cccccc;
    font-size: 1.08em;
}

.final-song-score {
    --score-offset: 15px;
    --final-offset-height: 0px;
    color: #ffffff;
    font-size: 1.2em;
    margin-left: 10px;
    transform: translateX(var(--score-offset)) translateY(var(--final-offset-height));
}

.final-score {
    color: #ffffff;
    font-size: 1.8em;
    text-align: center;
    margin-top: 20px;
    font-family: 'Funnel Sans', 'Helvetica', 'Arial', sans-serif;
    opacity: 0;
}

.post-game-timer {
    color: #d3d3d3;
    font-size: 2em;
    text-align: center;
    font-family: 'Courier New', 'Courier', monospace;
    font-weight: bold;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
}

.bg-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #0e0e0e;
    overflow: hidden;
    z-index: 0;
}

#bgProgress {
    width: 0;
    height: 100%;
    background: #191919;
    transition: opacity 0.3s ease-out;
    opacity: 1;
}

.play-again-button {
    background: #ffffff;
    border: none;
    border-radius: 25px;
    font-size: 1.35em;
    padding: 10px 20px;
    cursor: pointer;
    color: #000000;
    font-family: 'Funnel Sans', 'Helvetica', 'Arial', sans-serif;
    transition: transform 0.3s ease;
    position: absolute;
    bottom: 20px;
    right: 20px;
}

.play-again-button:hover {
    transform: scale(1.05);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInScoreTimer {
    from { opacity: 0; }
    to { opacity: 1; }
}