/*--------------------------------------------------------------
Typography
--------------------------------------------------------------*/

body,
button,
input,
select,
textarea {
	font-family: 'Source Sans Pro', 'Helvetica', Arial, sans-serif;
	font-size: 18px;
	line-height: 1.5;
}

h1,
h2,
h3,
h4,
h5,
h6 {
	clear: both;
}

p {
	margin-bottom: 1.5em;
}

b,
strong {
	font-weight: bold;
}

dfn,
cite,
em,
i {
	font-style: italic;
}

blockquote {
	margin: 0 1.5em;
}

address {
	margin: 0 0 1.5em;
}

pre {
	background: #eee;
	font-family: "Courier 10 Pitch", Courier, monospace;
	font-size: 15px;
	font-size: 1.5rem;
	line-height: 1.6;
	margin-bottom: 1.6em;
	max-width: 100%;
	overflow: auto;
	padding: 1.6em;
}

code,
kbd,
tt,
var {
	font: 15px Monaco, Consolas, "Andale Mono", "DejaVu Sans Mono", monospace;
}

abbr,
acronym {
	border-bottom: 1px dotted #666;
	cursor: help;
}

mark,
ins {
	background: #fff9c0;
	text-decoration: none;
}

sup,
sub {
	font-size: 75%;
	height: 0;
	line-height: 0;
	position: relative;
	vertical-align: baseline;
}

sup {
	bottom: 1ex;
}

sub {
	top: .5ex;
}

small {
	font-size: 75%;
}

big {
	font-size: 125%;
}

/*--------------------------------------------------------------
Layout
--------------------------------------------------------------*/
body {
    margin: 0;
    padding: 0;
}

.masthead {
    padding: 1em 2em;
    background-color: #0D1B2E;
    color: white;
}

.masthead h1 {
    text-align: center;
}

.intro {
    padding: 2em 2em;
    color: #ffffff;
    background: #429890;
}


.intro p,
.test-area {
    margin: 0 auto;
    max-width: 550px;
}

.test-area {
    margin-bottom: 4em;
    padding: 0 2em;
}

/* Border color is changed dynamically by JS to show typing state */
.test-wrapper {
    border: 10px solid grey;
    border-radius: 10px;
    transition: border-color 120ms ease;
    display: flex;
}

#origin-text {
    margin: 1em 0;
    padding: 1em 1em 0;
    background-color: #ededed;
}

#origin-text p {
    margin: 0;
    padding-bottom: 1em;
}

.test-wrapper textarea {
    flex: 1;
    padding: 0.75em;
    border: none;
    outline: none;
    resize: vertical;
    font-size: 1em;
    line-height: 1.5;
}

.meta {
    margin-top: 1em;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1em;
}

.timer {
    font-size: 3em;
    font-weight: bold;
    font-variant-numeric: tabular-nums; /* Keeps digits the same width so timer doesn't jitter */
}

/* WPM and Errors display */
.metrics {
    display: flex;
    gap: 1.5em;
}

.metric {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 60px;
}

.metric-label {
    font-size: 0.8em;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #666;
    font-weight: bold;
}

.metric-value {
    font-size: 1.8em;
    font-weight: bold;
    color: #0D1B2E;
    font-variant-numeric: tabular-nums;
}

#reset {
    padding: .5em 1em;
    font-size: 1.2em;
    font-weight: bold;
    color: #E95D0F;
    background: white;
    border: 10px solid #E95D0F;
    cursor: pointer;
    transition: background-color 120ms ease, color 120ms ease;
}

#reset:hover {
    color: white;
    background-color: #E95D0F;
}

/*--------------------------------------------------------------
Leaderboard — top 3 fastest scores
--------------------------------------------------------------*/
.leaderboard {
    margin-top: 2.5em;
    padding: 1.5em;
    background: #f6f7f9;
    border-radius: 10px;
}

.leaderboard h2 {
    margin: 0 0 0.75em;
    font-size: 1.2em;
    color: #0D1B2E;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

#top-scores {
    list-style: none;
    margin: 0;
    padding: 0;
}

#top-scores li {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 1em;
    padding: 0.75em 1em;
    margin-bottom: 0.5em;
    background: white;
    border-left: 6px solid #429890;
    border-radius: 4px;
}

/* First place gets the orange accent */
#top-scores li:first-child {
    border-left-color: #E95D0F;
}

#top-scores .rank {
    font-weight: bold;
    color: #0D1B2E;
    font-size: 1.1em;
}

#top-scores .wpm-big {
    font-weight: bold;
    color: #0D1B2E;
    font-size: 1.1em;
}

#top-scores .wpm-big small {
    font-size: 0.7em;
    color: #666;
    font-weight: normal;
}

#top-scores .score-meta {
    color: #666;
    font-size: 0.85em;
    text-align: right;
}

#top-scores .no-scores {
    display: block;
    padding: 0.75em 1em;
    background: white;
    border-left: 6px solid #ccc;
    border-radius: 4px;
    color: #666;
    font-style: italic;
}
