/* =========================================================
   TYPING MASTER
   PROFESSIONAL + SIMPLE DESIGN
========================================================= */


/* =========================================================
   VARIABLES
========================================================= */

:root {

    --primary: #2563eb;
    --primary-dark: #1d4ed8;

    --secondary: #7c3aed;

    --success: #16a34a;
    --danger: #dc2626;
    --warning: #f59e0b;

    --text: #172033;
    --muted: #64748b;
    --light-text: #94a3b8;

    --background: #f5f7fb;
    --white: #ffffff;

    --border: #e2e8f0;

    --light-blue: #eff6ff;
    --light-red: #fee2e2;
    --light-green: #f0fdf4;

    --radius: 12px;
    --radius-large: 18px;

    --shadow:
        0 10px 35px rgba(
            15,
            23,
            42,
            0.08
        );

}


/* =========================================================
   RESET
========================================================= */

* {

    box-sizing: border-box;

    margin: 0;

    padding: 0;

}


html {

    scroll-behavior: smooth;

}


body {

    font-family:
        Inter,
        Arial,
        Helvetica,
        sans-serif;

    background: var(--background);

    color: var(--text);

    line-height: 1.6;

}


button,
textarea {

    font: inherit;

}


button {

    cursor: pointer;

}


button:focus-visible,
textarea:focus-visible {

    outline:
        3px solid
        rgba(
            37,
            99,
            235,
            0.2
        );

    outline-offset: 2px;

}


/* =========================================================
   HEADER
========================================================= */

.site-header {

    background: var(--white);

    border-bottom:
        1px solid var(--border);

}


.header-container {

    width:
        min(
            1150px,
            calc(100% - 30px)
        );

    min-height: 72px;

    margin: auto;

    display: flex;

    align-items: center;

    justify-content: space-between;

}


.brand {

    display: flex;

    align-items: center;

    gap: 11px;

    text-decoration: none;

    color: var(--text);

}


.brand-icon {

    width: 44px;

    height: 44px;

    display: flex;

    align-items: center;

    justify-content: center;

    border-radius: 11px;

    color: white;

    font-size: 22px;

    background:
        linear-gradient(
            135deg,
            var(--primary),
            var(--secondary)
        );

}


.brand-text {

    display: flex;

    flex-direction: column;

}


.brand-text strong {

    font-size: 20px;

    font-weight: 800;

    line-height: 1.1;

}


.brand-text strong span {

    color: var(--primary);

}


.brand-text small {

    margin-top: 3px;

    color: var(--light-text);

    font-size: 9px;

    text-transform: uppercase;

    letter-spacing: 0.7px;

}


.header-status {

    display: flex;

    align-items: center;

    gap: 8px;

    color: var(--muted);

    font-size: 12px;

    font-weight: 700;

}


.status-dot {

    width: 8px;

    height: 8px;

    border-radius: 50%;

    background: var(--success);

    box-shadow:
        0 0 0 4px
        rgba(
            22,
            163,
            74,
            0.1
        );

}


/* =========================================================
   MAIN
========================================================= */

.main-container {

    width:
        min(
            1100px,
            calc(100% - 30px)
        );

    margin: auto;

}


/* =========================================================
   HERO
========================================================= */

.hero {

    text-align: center;

    padding:
        55px 10px 35px;

}


.hero-badge {

    display: inline-block;

    padding:
        6px 13px;

    border-radius: 30px;

    background: var(--light-blue);

    color: var(--primary);

    border:
        1px solid #dbeafe;

    font-size: 11px;

    font-weight: 800;

}


.hero h1 {

    margin-top: 16px;

    font-size:
        clamp(
            34px,
            5vw,
            52px
        );

    line-height: 1.1;

    letter-spacing: -1.7px;

}


.hero h1 span {

    color: var(--primary);

}


.hero p {

    max-width: 650px;

    margin:
        15px auto 0;

    color: var(--muted);

    font-size: 15px;

}


/* =========================================================
   TYPING CARD
========================================================= */

.typing-card {

    background: white;

    border:
        1px solid var(--border);

    border-radius:
        var(--radius-large);

    padding: 28px;

    box-shadow: var(--shadow);

}


/* =========================================================
   TOOL HEADER
========================================================= */

.tool-header {

    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 20px;

    padding-bottom: 22px;

    border-bottom:
        1px solid var(--border);

}


.tool-header h2 {

    font-size: 23px;

    line-height: 1.2;

}


.tool-header p {

    margin-top: 5px;

    color: var(--muted);

    font-size: 13px;

}


.test-number {

    padding:
        8px 12px;

    border:
        1px solid var(--border);

    border-radius: 8px;

    background: #f8fafc;

    color: var(--muted);

    font-size: 11px;

    white-space: nowrap;

}


.test-number strong {

    color: var(--primary);

}


/* =========================================================
   CONTROLS
========================================================= */

.controls {

    display: flex;

    align-items: flex-end;

    justify-content: space-between;

    gap: 20px;

    padding:
        23px 0;

}


.control-group {

    flex: 1;

}


.control-group label {

    display: block;

    margin-bottom: 9px;

    font-size: 13px;

    font-weight: 800;

}


.duration-buttons {

    display: grid;

    grid-template-columns:
        repeat(4, 1fr);

    gap: 9px;

}


.duration-btn {

    border:
        1px solid var(--border);

    background: #f8fafc;

    border-radius: 9px;

    padding: 11px;

    color: var(--muted);

    transition: 0.2s;

}


.duration-btn strong {

    color: var(--text);

    font-size: 17px;

}


.duration-btn span {

    margin-left: 3px;

    font-size: 10px;

}


.duration-btn:hover {

    border-color: var(--primary);

}


.duration-btn.active {

    background: var(--primary);

    border-color: var(--primary);

    color: white;

}


.duration-btn.active strong {

    color: white;

}


.sample-control {

    max-width: 180px;

}


.sample-button {

    width: 100%;

    border:
        1px solid var(--border);

    background: white;

    border-radius: 9px;

    padding: 11px;

    color: var(--text);

    font-weight: 700;

}


.sample-button:hover {

    color: var(--primary);

    border-color: var(--primary);

}


/* =========================================================
   STATISTICS
========================================================= */

.stats-grid {

    display: grid;

    grid-template-columns:
        repeat(4, 1fr);

    gap: 12px;

}


.stat-card {

    padding: 15px;

    background: #f8fafc;

    border:
        1px solid var(--border);

    border-radius: 10px;

}


.stat-card span {

    color: var(--muted);

    font-size: 10px;

    font-weight: 800;

    text-transform: uppercase;

    letter-spacing: 0.5px;

}


.stat-card strong {

    display: block;

    margin-top: 2px;

    font-size: 25px;

}


.stat-card small {

    color: var(--muted);

    font-size: 10px;

}


/* =========================================================
   PROGRESS
========================================================= */

.progress-section {

    margin-top: 20px;

}


.progress-header {

    display: flex;

    justify-content: space-between;

    margin-bottom: 7px;

    color: var(--muted);

    font-size: 10px;

    font-weight: 700;

}


.progress-track {

    height: 7px;

    overflow: hidden;

    border-radius: 20px;

    background: #e5e7eb;

}


.progress-bar {

    width: 0%;

    height: 100%;

    background:
        linear-gradient(
            90deg,
            var(--primary),
            var(--secondary)
        );

    transition:
        width 0.2s linear;

}


/* =========================================================
   PASSAGE
========================================================= */

.passage-section {

    margin-top: 27px;

}


.section-heading {

    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 15px;

    margin-bottom: 9px;

}


.section-heading h3 {

    font-size: 14px;

}


.section-heading p {

    color: var(--muted);

    font-size: 10px;

}


.sample-label {

    padding:
        5px 8px;

    border-radius: 6px;

    background: var(--light-blue);

    color: var(--primary);

    font-size: 9px;

    font-weight: 800;

}


.text-display {

    min-height: 250px;

    max-height: 380px;

    overflow-y: auto;

    padding: 21px;

    border:
        1px solid var(--border);

    border-radius: 11px;

    background: #f8fafc;

    color: #64748b;

    font-family:
        Consolas,
        "Courier New",
        monospace;

    font-size: 16px;

    line-height: 1.9;

}


/* Correct */

.text-display .correct {

    color: var(--success);

}


/* Incorrect */

.text-display .wrong {

    color: var(--danger);

    background: var(--light-red);

    border-radius: 2px;

}


/* Current */

.text-display .current {

    color: var(--primary);

    background: #dbeafe;

    border-radius: 2px;

}


/* =========================================================
   INPUT
========================================================= */

.input-section {

    margin-top: 20px;

}


.input-heading {

    display: flex;

    align-items: center;

    justify-content: space-between;

    margin-bottom: 8px;

}


.input-heading label {

    font-size: 14px;

    font-weight: 800;

}


#typingStatus {

    color: var(--muted);

    font-size: 10px;

    font-weight: 700;

}


#typingStatus.running {

    color: var(--success);

}


#typingStatus.stopped {

    color: var(--danger);

}


#typingInput {

    width: 100%;

    min-height: 155px;

    resize: vertical;

    padding: 17px;

    border:
        2px solid var(--border);

    border-radius: 11px;

    background: white;

    color: var(--text);

    font-family:
        Consolas,
        "Courier New",
        monospace;

    font-size: 15px;

    line-height: 1.7;

}


#typingInput:focus {

    outline: none;

    border-color: var(--primary);

    box-shadow:
        0 0 0 4px
        rgba(
            37,
            99,
            235,
            0.08
        );

}


#typingInput:disabled {

    background: #f8fafc;

    cursor: not-allowed;

}


.input-statistics {

    display: flex;

    flex-wrap: wrap;

    gap: 18px;

    padding-top: 8px;

    color: var(--muted);

    font-size: 10px;

}


.input-statistics strong {

    color: var(--text);

}


/* =========================================================
   ACTION BUTTONS
========================================================= */

.action-buttons {

    display: flex;

    justify-content: center;

    gap: 10px;

    margin-top: 23px;

}


.start-button,
.stop-button,
.reset-button {

    border: none;

    border-radius: 9px;

    padding:
        12px 22px;

    font-size: 13px;

    font-weight: 800;

    transition: 0.2s;

}


.start-button {

    background:
        linear-gradient(
            135deg,
            var(--primary),
            #4f46e5
        );

    color: white;

    box-shadow:
        0 7px 18px
        rgba(
            37,
            99,
            235,
            0.25
        );

}


.start-button:hover {

    transform: translateY(-1px);

}


.start-button:disabled {

    opacity: 0.6;

    cursor: not-allowed;

    transform: none;

}


.stop-button {

    background: var(--danger);

    color: white;

}


.stop-button:hover:not(:disabled) {

    background: #b91c1c;

}


.stop-button:disabled {

    opacity: 0.4;

    cursor: not-allowed;

}


.reset-button {

    border:
        1px solid var(--border);

    background: white;

    color: var(--text);

}


.reset-button:hover {

    border-color: var(--primary);

    color: var(--primary);

}


.keyboard-tip {

    margin-top: 8px;

    text-align: center;

    color: var(--muted);

    font-size: 10px;

}


/* =========================================================
   RESULT
========================================================= */

.result-panel {

    display: none;

    margin-top: 25px;

    padding: 30px;

    text-align: center;

    background: #eff6ff;

    border:
        1px solid #bfdbfe;

    border-radius: 14px;

}


.result-panel.show {

    display: block;

    animation:
        resultAppear 0.3s ease;

}


@keyframes resultAppear {

    from {

        opacity: 0;

        transform: translateY(10px);

    }

    to {

        opacity: 1;

        transform: translateY(0);

    }

}


.result-icon {

    font-size: 38px;

}


.result-panel h2 {

    margin-top: 6px;

    font-size: 24px;

}


.result-panel > p {

    color: var(--muted);

    font-size: 12px;

}


.final-speed {

    margin: 22px 0;

}


.final-speed span {

    display: block;

    color: var(--muted);

    font-size: 10px;

    font-weight: 800;

    text-transform: uppercase;

}


.final-speed strong {

    display: block;

    margin: 3px 0;

    color: var(--primary);

    font-size: 65px;

    line-height: 1;

}


.final-speed small {

    color: var(--muted);

    font-size: 10px;

}


.result-grid {

    max-width: 650px;

    margin: auto;

    display: grid;

    grid-template-columns:
        repeat(4, 1fr);

    gap: 9px;

}


.result-grid div {

    padding: 12px;

    background: white;

    border:
        1px solid var(--border);

    border-radius: 9px;

}


.result-grid span {

    display: block;

    color: var(--muted);

    font-size: 9px;

    font-weight: 700;

    text-transform: uppercase;

}


.result-grid strong {

    display: block;

    margin-top: 2px;

    font-size: 18px;

}


.result-buttons {

    display: flex;

    justify-content: center;

    gap: 10px;

    margin-top: 22px;

}


.again-button,
.next-button {

    border: none;

    border-radius: 8px;

    padding:
        10px 18px;

    color: white;

    font-size: 12px;

    font-weight: 800;

}


.again-button {

    background: var(--text);

}


.next-button {

    background: var(--primary);

}


/* =========================================================
   INFORMATION
========================================================= */

.information {

    display: grid;

    grid-template-columns:
        repeat(3, 1fr);

    gap: 15px;

    margin:
        30px 0 55px;

}


.info-card {

    padding: 22px;

    background: white;

    border:
        1px solid var(--border);

    border-radius: 12px;

}


.info-icon {

    width: 40px;

    height: 40px;

    display: flex;

    align-items: center;

    justify-content: center;

    border-radius: 9px;

    background: var(--light-blue);

    font-size: 18px;

}


.info-card h3 {

    margin-top: 12px;

    font-size: 16px;

}


.info-card p {

    margin-top: 6px;

    color: var(--muted);

    font-size: 12px;

    line-height: 1.7;

}


/* =========================================================
   FOOTER
========================================================= */

.footer {

    padding: 23px;

    text-align: center;

    background: white;

    border-top:
        1px solid var(--border);

}


.footer p {

    color: var(--muted);

    font-size: 10px;

}


/* =========================================================
   TIMER WARNING
========================================================= */

.timer-warning {

    color: var(--warning) !important;

}


.timer-danger {

    color: var(--danger) !important;

}


/* =========================================================
   RESPONSIVE
========================================================= */

@media (max-width: 800px) {

    .controls {

        flex-direction: column;

        align-items: stretch;

    }


    .sample-control {

        max-width: none;

    }


    .stats-grid {

        grid-template-columns:
            repeat(2, 1fr);

    }


    .information {

        grid-template-columns:
            repeat(2, 1fr);

    }


    .info-card:last-child {

        grid-column: 1 / -1;

    }

}


@media (max-width: 600px) {

    .header-container,
    .main-container {

        width:
            calc(100% - 20px);

    }


    .header-status {

        display: none;

    }


    .hero {

        padding:
            40px 5px 28px;

    }


    .hero h1 {

        font-size: 34px;

        letter-spacing: -1px;

    }


    .typing-card {

        padding: 16px;

        border-radius: 14px;

    }


    .tool-header {

        align-items: flex-start;

        flex-direction: column;

    }


    .test-number {

        width: 100%;

        text-align: center;

    }


    .duration-buttons {

        grid-template-columns:
            repeat(2, 1fr);

    }


    .stats-grid {

        grid-template-columns:
            repeat(2, 1fr);

    }


    .text-display {

        min-height: 220px;

        max-height: 350px;

        padding: 15px;

        font-size: 14px;

        line-height: 1.8;

    }


    #typingInput {

        min-height: 160px;

        font-size: 14px;

    }


    .action-buttons {

        display: grid;

        grid-template-columns: 1fr;

    }


    .start-button,
    .stop-button,
    .reset-button {

        width: 100%;

    }


    .information {

        grid-template-columns: 1fr;

    }


    .info-card:last-child {

        grid-column: auto;

    }


    .result-grid {

        grid-template-columns:
            repeat(2, 1fr);

    }


    .result-buttons {

        flex-direction: column;

    }


    .again-button,
    .next-button {

        width: 100%;

    }

}


@media (max-width: 380px) {

    .stats-grid {

        grid-template-columns: 1fr;

    }


    .typing-card {

        padding: 13px;

    }


    .final-speed strong {

        font-size: 54px;

    }

}