* {
    margin: 0;
    padding: 0;
}
body {
    font-family: sans-serif;
}
/* HEADER */
header {
    margin: 5px;
    display: flex;
    flex-direction: column;
    align-items: center;
}
header h1 {
    margin-bottom: 5px;
    font-size: 1.7em;
    text-align: center;
    background-image: linear-gradient(90deg, rgb(95, 63, 50) 0%, 
        rgb(255, 64, 0) 19%, #d3cf00 56%, rgb(113, 18, 177) 86%);
    color: transparent;
    background-clip: text;
}
header h1 a {
    color: inherit;  /* prevent colorful text override */
    text-decoration: none;
}
header nav {
    width: 100%;
}
header nav ul {
    display: flex;
    column-gap: 1vw;
}
header button {
    width: 33%;
    cursor: pointer;
    border-radius: 3px;
    border: none;
    padding: 5px;
    font-size: 1.5em;
    font-weight: 500;
}
header button:hover {
    filter: brightness(105%);
}
/* SETTINGS (and CTA) */
#home {
    background-color: #202f36;
    padding: .2em .3em;
    border-radius: 5px;
}
#home a {
    display: inline-block;
    font-family: sans-serif;
    margin: 2% 0;
    /* little background hack for cross-browser support */
    background: linear-gradient(45deg, rgb(209, 66, 0), yellow, red);
    color: transparent;
    background-clip: text;
}
#settings {
    margin: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}
#settings #sizeSelectorSpan {
    display: flex;
    width: 30%;
    align-items: center;
    gap: 5%;
}
#settings #sizeSelectorSpan input {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    background: #bdbdbd;
    opacity: 0.7;
    transition: opacity .2s;
    border-radius: 2px;
}
#settings #sizeSelectorSpan input:hover {
    opacity: 1;
}
#settings #sizeSelectorSpan input::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: #797979;
    cursor: pointer;
    border-radius: 50%;
}
#settings #sizeSelectorSpan input::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: #797979;
    cursor: pointer;
    border-radius: 50%;
}
#settings #speedChoice {
    font-size: 1.2em;
    display: flex;
    align-items: center;
    gap: 10px;
}
#settings #speedChoice select {
    font-size: .9em;
    padding: 0.3em 0.5em;
    border: 1px solid #e2e2e2;
    border-radius: 5px;
    background-color: #fff;
    cursor: pointer;
}
#settings #speedChoice select:hover {
    border-color: #bebebe;
}

/* VISUALS */
#visual {
    display: flex;
    flex-direction: column;
    min-height: 60px;
    display: flex;
    align-items: center;
}
#steps {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    border: 1px solid #ccc;
    box-sizing: border-box;
    width: 100%;
    max-height: 200px;
    background: #f9f9f9;
}
#steps p {
    margin: 0;
    padding: 5px;
    animation: fade-in 0.5s; /* Smooth fade-in for new steps */
}
#graph {
    flex: 5;
    height: 100%;
    display: flex;
    align-items: flex-end;
    gap: 1px;
    justify-content: center;
}
.bar {
    width: 3vw;
    background-color: black;
    transition: background-color 0.5s; /* Smooth transition for color changes */
}

.highlight-compare {
    background-color: red !important;
}

.highlight-swap {
    background-color: green !important;
}

/* Less than 180px isn't supported */
/* XXS: 0-319px*/
@media (min-width: 0px) {
    body {
        font-size: .8em;
    }
}
/* Mobile: 320px-479px */
@media (min-width: 320px) {
    body {
        font-size: 1em;
    }
    #graph {
        gap: 2px;
    }
}
/* Tablet: 480px-769px */
@media (min-width: 480px) {
    #settings {
        justify-content: center;
        gap: 5vw;
        flex-direction: row;
    }
    header nav {
        width: 80%;
        max-width: 480px;
    }
    #graph {
        gap: 3px;
    }
}
/* Laptop: 770px-1024px */
@media (min-width: 770px) {
    body {
        font-size: 1.2em;
    }
    header {
        font-size: .7em;
        flex-direction: row;
        margin: 10px;
    }
    header h1 {
        width: 40%;
        margin-bottom: 0;
    }
    header nav {
        max-width: none;
    }
    #settings {
        font-size: 1.1em;
    }
    #graph {
        gap: 4px;
    }
}
/* Large screens: 1025px-1200px */
@media (min-width: 1025px) {
    header {
        font-size: .9em;
    }
    body {
        font-size: 1.2em;
    }
    #graph {
        gap: 5px;
    }
}
/* To infinity and beyond: 1201px++ */
@media (min-width: 1201px) {
    body {
        font-size: 1.4em;
    }
}