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

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

body {
    margin: 0;
    padding: 0;
    background: #f4f7fb;
    color: #1f2937;
}

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

p {
    margin-bottom: 1.5em;
}

button {
    cursor: pointer;
}

/*--------------------------------------------------------------
Header
--------------------------------------------------------------*/

.masthead {
    padding: 2em;
    background: linear-gradient(135deg, #0D1B2E, #1b3a57);
    color: white;
    text-align: center;
}

.masthead h1 {
    margin: 0;
    font-size: 2.8rem;
    font-weight: 900;
}

.masthead p {
    margin: 0.5em 0 0;
    font-size: 1.1rem;
    color: #dbeafe;
}

/*--------------------------------------------------------------
Intro
--------------------------------------------------------------*/

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

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

/*--------------------------------------------------------------
Main Layout
--------------------------------------------------------------*/

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

.panel {
    background: white;
    padding: 2em;
    border-radius: 18px;
    box-shadow: 0 15px 35px rgba(13, 27, 46, 0.15);
}

.panel h2 {
    margin-top: 0;
    color: #0D1B2E;
}

/*--------------------------------------------------------------
Origin Text
--------------------------------------------------------------*/

#origin-text {
    margin: 1em 0;
    padding: 1.2em;
    background-color: #eef2f7;
    border-left: 6px solid #429890;
    border-radius: 10px;
}

#origin-text p {
    margin: 0;
    font-weight: 700;
    color: #111827;
}

/*--------------------------------------------------------------
Typing Area
--------------------------------------------------------------*/

.test-wrapper {
    display: flex;
    border: 10px solid grey;
    border-radius: 14px;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
    overflow: hidden;
}

.test-wrapper:focus-within {
    box-shadow: 0 0 0 4px rgba(66, 152, 144, 0.15);
}

.test-wrapper textarea {
    flex: 1;
    min-height: 150px;
    padding: 1em;
    border: none;
    resize: vertical;
    outline: none;
    font-size: 1.1rem;
}

/*--------------------------------------------------------------
Timer and Reset
--------------------------------------------------------------*/

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

.label {
    margin: 0;
    font-size: 0.8rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6b7280;
}

.timer {
    font-size: 3em;
    font-weight: 900;
    color: #0D1B2E;
}

#reset {
    padding: 0.65em 1.2em;
    font-size: 1.1em;
    font-weight: 900;
    color: #E95D0F;
    background: white;
    border: 5px solid #E95D0F;
    border-radius: 12px;
    transition: all 0.25s ease;
}

#reset:hover {
    color: white;
    background-color: #E95D0F;
    transform: translateY(-2px);
}

/*--------------------------------------------------------------
Stats
--------------------------------------------------------------*/

.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1em;
    margin-top: 1.5em;
}

.stat-card {
    padding: 1em;
    background: #f9fafb;
    border-radius: 14px;
    text-align: center;
    border: 1px solid #e5e7eb;
}

.stat-card p:last-child {
    margin: 0.2em 0 0;
    font-size: 1.8rem;
    font-weight: 900;
    color: #0D1B2E;
}

/*--------------------------------------------------------------
Scoreboard
--------------------------------------------------------------*/

.scoreboard {
    margin-top: 2em;
    padding: 1.5em;
    background: #0D1B2E;
    color: white;
    border-radius: 14px;
}

.scoreboard h2 {
    margin-top: 0;
    color: white;
}

#score-list {
    margin-bottom: 0;
    padding-left: 1.4em;
}

#score-list li {
    margin-bottom: 0.5em;
    padding: 0.4em 0;
}

#score-list li:last-child {
    margin-bottom: 0;
}

/*--------------------------------------------------------------
Responsive Design
--------------------------------------------------------------*/

@media screen and (max-width: 650px) {
    .masthead h1 {
        font-size: 2.1rem;
    }

    .panel {
        padding: 1.2em;
    }

    .timer {
        font-size: 2.3em;
    }

    .stats {
        grid-template-columns: 1fr;
    }

    #reset {
        width: 100%;
    }
}