/* Common styles */
body {
    font-family: Arial, Helvetica, sans-serif;
    background-image: url('../images/background3.jpg');
    background-size: cover;
}

.container {
    width: 1000px;
    margin: auto;
}

.head-container {
    display: flex;
    justify-content: center;
    align-items: center;
    perspective: 1000px;
}

.heading {
    font-size: 3rem;
    color: #a35454;
    text-transform: uppercase;
    letter-spacing: 8px;
    transform-style: preserve-3d;
    animation: spin 4s linear infinite;
    margin: 0;
}

@keyframes spin {
    0% {
        transform: rotateY(0deg);
    }

    100% {
        transform: rotateY(360deg);
    }
}

.head-container img {
    width: 100px;
    height: 100px;
    transform-style: preserve-3d;
    animation: spinAdvanced 4s ease-in-out infinite;
}

@keyframes spinAdvanced {
    0% {
        transform: rotateY(0deg) translateX(600px) translateZ(-100px);
    }

    25% {
        transform: rotateY(-180deg) translateX(600px) translateZ(-100px);
    }

    100% {
        transform: rotateY(0deg) translateX(0) translateZ(0);
    }
}

/* Container for stats and controls */
#stats {
    border: 2px solid black;
}

#controls {
    width: 28em;
    float: left;
    padding: 1em;
    font-size: 0.7em;
    background-color: #f5f5f5;
    border-radius: 5px;
}

#controls th {
    text-align: right;
    vertical-align: middle;
}

/* Instructions box */
#instructions {
    clear: left;
    float: left;
    width: 17em;
    padding: 1em;
    border: 1px solid black;
    box-shadow: 0 0 5px black;
    background-color: #f5f5f5;
    border-radius: 15px;
}

/* Racer container */
#racer {
    position: relative;
    z-index: 0;
    width: 640px;
    height: 480px;
    margin-left: 20em;
    border: 2px solid black;
}

#canvas {
    position: absolute;
    width: 100%;
    height: 100%;
    background-color: #72D7EE;
}

/* Mute button */
#mute {
    width: 32px;
    height: 32px;
    background: url(images/mute.png);
    display: inline-block;
    cursor: pointer;
    position: absolute;
    margin-left: 20em;
}

#mute.on {
    background-position: -32px 0px;
}

/* HUD (Heads-Up Display) */
#hud {
    position: absolute;
    z-index: 1;
    width: 640px;
    padding: 5px 0;
    font-family: Verdana, Geneva, sans-serif;
    font-size: 0.8em;
    background-color: rgba(255, 0, 0, 0.4);
    color: black;
    border-bottom: 2px solid black;
    box-sizing: border-box;
    -moz-box-sizing: border-box;
    -webkit-box-sizing: border-box;
}

/* HUD elements */
.hud {
    background-color: rgba(255, 255, 255, 0.6);
    padding: 5px;
    border: 1px solid black;
    margin: 0 5px;
    transition: background-color 2s;
    -webkit-transition: background-color 2s;
}

#hud #speed {
    float: right;
}

#hud #current_lap_time {
    float: left;
}

#hud #last_lap_time {
    float: left;
    display: none;
}

#hud #fast_lap_time {
    display: block;
    width: 12em;
    margin: 0 auto;
    text-align: center;
    transition: background-color 2s;
    -webkit-transition: background-color 2s;
}

.value {
    color: black;
    font-weight: bold;
}

.fastest {
    background-color: rgba(255, 215, 0, 0.5);
}

/* Style the table */
table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    font-family: Arial, sans-serif;
}

/* Style table headers (th) */
th {
    background-color: #333;
    color: #fff;
    text-align: left;
    padding: 10px;
}

/* Style table cells (td) */
td {
    padding: 10px;
    border-bottom: 1px solid #ccc;
}

/* Style the select element */
select,
input[type="range"] {
    width: 100%;
    padding: 5px;
    border: 1px solid #ccc;
    border-radius: 5px;
    background-color: #f2f2f2;
    font-size: 13px;
}

/* Style the select arrow */
select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding-right: 30px;
}

/* Style the range input */
input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    background-color: transparent;
    margin: 0;
    padding: 0;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background-color: #333;
    border: 2px solid #fff;
    border-radius: 50%;
    cursor: pointer;
}

/* Style labels */
label {
    font-weight: bold;
}

/* Style the span inside labels */
label span {
    font-weight: normal;
    color: #15bc2e;
}

/* Add hover effect for table rows */
tr:hover {
    background-color: #f5f5f5;
}

/* Define styles for the performance container */
.performance-container {
    background-color: #333;
    border-radius: 10px;
    padding: 10px;
    margin-top: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: pulse 2s infinite;
    transform: scale(0.95);
}

/* Define styles for the message container */
.message-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Define styles for the message */
.message {
    color: white;
    font-size: 1.5em;
}

/* Define styles for the performance status */
.performance-status {
    color: #fff;
    font-size: 1.5em;
    font-weight: bold;
    transition: color 0.3s ease-in-out;
    margin-left: 5px;
}

@keyframes pulse {
    0% {
        transform: scale(0.95);
    }

    50% {
        transform: scale(1);
    }

    100% {
        transform: scale(0.95);
    }
}

.ctrl-btn {
    padding: 10px;
    margin: 5px;
    border-radius: 5px;
    font-size: 0.9em;
    font-weight: bold;
    border: none;
    cursor: pointer;
}

@media screen and (max-width: 520px) {
    .container {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
    }

    #racer {
        margin-left: 0;
        width: 970px;
        height: 1570px;
    }

    #hud {
        width: 970px;
    }

    #controls {
        display: none;
        font-size: 1.9em;
        width: 25em;
    }

    #instructions {
        display: none;
    }

    .ctrl-btn {
        padding: 15px;
        margin: 10px;
        font-size: 1.9em;
    }

    #mute {
        width: 80px;
        height: 80px;
        position: absolute;
        margin-left: 20em;
        top: 110px;
        left: 310px;
        background-size: cover;
    }

    #mute.on {
        background-position: -80px 0px;
    }

    .advertisement.right {
        display: none;
    }

    .advertisement.left {
        animation: none;
        transform: rotate(90deg);
        left: 235px !important;
        background-image: none;
        font-size: 1.6rem;
    }

    .advertisement.left p {
        background: linear-gradient(140deg, #e40505, #0005ff);
        -webkit-background-clip: text;
        background-clip: text;
    }

    .advertisement.left a {
        color: #f00;
    }
}