:root {
    --primary: #48b8d0ff;
    --secondary: #cc0003ff;
    --light: #fbe40eff;
    --secondary-light: #fff;
    --dark: #140f2dff;
    --shadowColor: #333;
    --shadow: 2px 2px 4px var(--shadowColor);
} 

/* default formatting for mobile */

body {
		font-size: 18px;
		color: var(--dark);
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

h1 {
    margin: 0.5em;
    color: var(--secondary);
    text-align: center;
    font-size: 2em;
    font-weight: 700;
    -webkit-text-stroke: 1px #000;
    text-shadow: var(--shadow);
    order: -1;
}

h2 {
    text-align: center;
    font-weight: 650;
    font-size: 1.75rem;
    padding: 0.5em;
	display: flex;
	flex-direction: column;
	align-items: center;
}

h3 {
    font-size: 1.5rem;
    line-height: 1.5rem;
    margin: 0.5rem;
    font-weight: 600;
}

h4 {
    display: inline;
    text-align: right;
    font-size: 1rem;
    padding: 1em;
    font-weight: 600;
    width: 100%;
    color: var(--shadowColor);
}

p {
    margin: 0.5em;
}

ol {
    padding: 1em;
    width: 90%;
    line-height: 1.2em;
    text-align: start;
}

main {
    display: flex;
    flex-direction: column;
    align-items: center;
}

form {
    text-align: center;
}

form > label {
    display: block;
}

form > input {
    max-width: 6em;
    height: 3rem;
    text-align: center;
    border: 3px solid var(--secondary);
    background: var(--light);
    box-shadow: var(--shadow);
}

form > input::placeholder {
    color: var(--shadowColor);
}

form > input:focus::placeholder {
    color: transparent;
}

form > .button {
    height: 3rem;
    font-size: 0.8em;
    margin: 0;
}

.button {
    background-color: var(--dark);
    text-align: center;
    padding: 0.5em;
    margin: 0.5em auto;
    color: var(--light);
    text-decoration: none;
	border: 3px solid var(--secondary);
    border-radius: 0.25em;
    cursor: pointer;
    box-shadow: var(--shadow);
    outline: none;
}

.button:focus {
    background-color: var(--secondary-light);
    color: var(--dark);
}

header > .button {
    margin: 1em;
}

.timer-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    margin: 1em;
    height: 3em;
    font-size: 1.25em;
    font-weight: 600;
}

#timer {
    text-align: center;
    min-width: 4rem;
    line-height: 2rem;
}

#high-scores {
    text-align: center;
    font-weight: 650;
    font-size: 1.5em;
    padding: 0.5em;
    max-width: 6em;
}

main > div {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

/* formatting for code snippets in questions */
.snippet {
    margin-top: 0.25em;
    font-weight: 500;
    line-height: 2em;
    font-size: 0.7em;
    text-align: left;
    padding: 0 0.5em;
    background: #1e1e1e;
    color: #fff;
}

.snippet > .yellow {
    color: #ffd700;
}

.snippet > .pale-yellow {
    color: #e5e8a1;
}

.snippet > .light-blue {
    color: #9CDCFE;
}

.snippet > .blue {
    color: #007acc;
}

.snippet > .orange {
    color: #ce9178;
}

.snippet > .purple {
    color: #bc3fbc;
}

.snippet > .green {
    color: #487e02;
}

.snippet > .pale-green {
    color: #b5cea8;
}

/* hide element */
.hide {
    display: none;
}

/* flash green text on screen when answer is correct */

.correct {
    color: green;
}

/* flash red text when answer is wrong or when timer is low */
.wrong, .low {
    color: red;
}

/* Pulse and fade text for correct, wrong, and low timer */
.correct, .wrong {
    font-weight: 800;
    animation-name: pulseFade;
    animation-duration: 1s;
    animation-fill-mode: forwards;
}

.low {
    font-weight: 700;
    animation-name: pulseFade;
    animation-duration: 1s;
    animation-iteration-count: 10;
}

@keyframes pulseFade {
    0% {font-size: 0.5em; opacity: 1;}
    25% {font-size: 1.5em;opacity: 1;}
    100% {font-size: 1.5em; opacity: 0;}
}

/* pulse animation for end screen while adding timer to score */
.pulse {
    font-weight: 800;
    animation-name: pulse;
    animation-duration: 1s;
    animation-iteration-count: 4;
}

@keyframes pulse {
    0% {font-size: 1em;}
    50% {font-size: 1.5em;}
    100% {font-size: 1em;}
}

/* flash red "-5" when answer is wrong */
.subtract {
    position: relative;
}

.subtract::before {
    content: "-5 ";
    position: absolute;
    right: -0.5rem;
    color: red;;
    animation-name: redFlash;
    animation-fill-mode: forwards;
    animation-duration: 0.75s;
}

@keyframes redFlash {
    0% {font-size: 1em;}
    50% {font-size: 1.25em; opacity: 1;}
    100% {font-size: 1em; opacity: 0;}
}

.answer, .snippet {
    width: 80vw;
}

#response-box {
    height: 4rem;
    line-height: 4rem;
}

#score-box {
    padding: 0.5em 0;
    font-size: 1.5em;
    font-weight: 700;
    height: 4.5rem;
}

@media ( hover ) {

    .button:hover {
        background-color: var(--secondary-light);
        color: var(--dark);
    }

}

/* small screens and laptops */

@media screen and (min-width: 480px) {

    .timer-container {
        flex-direction: row;
        font-size: 1.5em;
        margin: 1em;
    }

    .subtract::before {
        right: -1rem;
    }

    header {
        flex-wrap: nowrap;
    }

    header > .button {
        margin: 1em;
    }

    h1 {
        order: 0;
        margin: 1.5em auto;
    }

    .answer, .snippet {
        width: 60vw;
    }
}

/* large screens */
@media screen and (min-width: 769px) {

    body {
        font-size: 1.5rem;
    }

    h1.hide {
        display: block;
    }

    .answer, .snippet {
        width: 40vw;
    }

    .subtract::before {
        right: -1.75rem;
    }
}