.ta-typing-test {
    display: block;
    width: 100%;
    max-width: 980px;
    box-sizing: border-box;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    margin: 16px 0;
    background: #fff;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #0f172a;
    line-height: 1.45;
}

.ta-typing-test {
    margin-left: auto;
    margin-right: auto;
}

.ta-typing-test__header h3 {
    margin: 0;
    font-size: 24px;
    line-height: 1.2;
    font-weight: 700;
}

.ta-typing-test__meta {
    color: #64748b;
    margin-top: 4px;
    font-size: 14px;
}

.ta-typing-test__instructions p {
    margin: 0 0 10px;
    font-size: 15px;
    color: #334155;
}

.ta-typing-test__reference pre {
    white-space: pre-wrap;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    line-height: 1.9;
    letter-spacing: 0.01em;
}

.ta-typing-test__reference--hidden {
    display: none;
}

.ta-typing-test__workspace {
    margin-top: 12px;
}

.ta-typing-test__timer {
    font-weight: 600;
    margin-bottom: 8px;
}

.ta-typing-test__progress {
    height: 8px;
    width: 100%;
    border-radius: 999px;
    overflow: hidden;
    background: #e2e8f0;
    margin: 10px 0 14px;
}

.ta-typing-test__progress-fill {
    width: 0;
    height: 100%;
    border-radius: 999px;
    background: #2563eb;
    transition: width 0.2s linear;
}

.ta-typing-test__progress-fill--warning {
    background: #dc2626;
}

.ta-typing-test__metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin: 12px 0;
}

.ta-typing-test__metric-card {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #f8fafc;
    padding: 10px;
    text-align: center;
}

.ta-typing-test__metric-value {
    display: block;
    font-size: 20px;
    line-height: 1.1;
    font-weight: 700;
    color: #0f172a;
}

.ta-typing-test__metric-label {
    display: block;
    margin-top: 4px;
    font-size: 11px;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.ta-typing-test__input {
    width: 100%;
    box-sizing: border-box;
    margin-top: 8px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    padding: 12px;
    min-height: 120px;
    font-size: 15px;
    line-height: 1.7;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.ta-typing-test__input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.ta-typing-test__finish,
.ta-typing-test__start {
    margin-top: 10px;
    border-radius: 8px;
    border: 1px solid #2563eb;
    background: #2563eb;
    color: #fff;
    padding: 8px 12px;
    font-weight: 600;
    cursor: pointer;
}

.ta-typing-test__finish {
    margin-top: 12px;
    background: #fff;
    color: #0f172a;
    border-color: #cbd5e1;
}

.ta-typing-test__start:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
}

.ta-typing-test__finish:hover {
    background: #f8fafc;
}

.ta-typing-test--notice {
    background: #f6f7f7;
    border-color: #dcdcde;
}

.ta-typing-test__result {
    margin-top: 14px;
    padding: 16px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #f8fafc;
}

.ta-typing-test__result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.ta-typing-test__result-title-wrap {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.ta-typing-test__result-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    font-size: 16px;
    font-weight: 700;
}

.ta-typing-test__result-icon.ta-typing-test__result-status--pass {
    background: #dcfce7;
    color: #166534;
}

.ta-typing-test__result-icon.ta-typing-test__result-status--fail {
    background: #fee2e2;
    color: #991b1b;
}

.ta-typing-test__result h4 {
    margin: 0;
    font-size: 18px;
}

.ta-typing-test__result-status {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.ta-typing-test__result-status--pass {
    background: #dcfce7;
    color: #166534;
}

.ta-typing-test__result-status--fail {
    background: #fee2e2;
    color: #991b1b;
}

.ta-typing-test__result-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.ta-typing-test__result-stat {
    border: 1px solid #e2e8f0;
    background: #fff;
    border-radius: 10px;
    padding: 10px;
}

.ta-typing-test__result-stat-label {
    display: block;
    font-size: 12px;
    color: #64748b;
}

.ta-typing-test__result-stat-value {
    display: block;
    margin-top: 2px;
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
}

.ta-typing-test__result-reason {
    margin: 12px 0 0;
    color: #334155;
    font-size: 14px;
}

.ta-typing-test__retry {
    margin-top: 12px;
    border: 1px solid #2563eb;
    border-radius: 9px;
    background: #2563eb;
    color: #fff;
    padding: 9px 14px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.ta-typing-test__retry:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
}

.ta-typing-test__save-status {
    margin-top: 10px;
    font-weight: 600;
}

.ta-typing-test__save-status--pending {
    color: #646970;
}

.ta-typing-test__save-status--success {
    color: #0a7f3f;
}

.ta-typing-test__save-status--error {
    color: #b32d2e;
}

.ta-typing-test__history {
    margin-top: 16px;
    border-top: 1px solid #e2e8f0;
    padding-top: 12px;
}

.ta-typing-test__history h4 {
    margin: 0 0 10px;
}

.ta-typing-test__history-meta,
.ta-typing-test__history-best,
.ta-typing-test__history-empty {
    margin: 6px 0;
}

.ta-typing-test__history-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    table-layout: fixed;
}

.ta-typing-test__history-table th,
.ta-typing-test__history-table td {
    border: 1px solid #e2e8f0;
    padding: 8px;
    text-align: left;
    vertical-align: top;
    font-size: 14px;
}

.ta-typing-test__history-table th {
    background: #f8fafc;
    color: #334155;
    font-weight: 600;
}

.ta-typing-test__history-row--best {
    background: rgba(37, 99, 235, 0.07);
}

.ta-typing-test__history-best-star {
    color: #2563eb;
    margin-left: 4px;
    font-size: 12px;
}

.ta-typing-test__status-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 3px 10px;
    font-size: 12px;
    font-weight: 700;
}

.ta-typing-test__status-badge--pass {
    background: #dcfce7;
    color: #166534;
}

.ta-typing-test__status-badge--fail {
    background: #fee2e2;
    color: #991b1b;
}

.ta-typing-test__history-toggle {
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    width: 28px;
    height: 28px;
    background: #fff;
    color: #0f172a;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.ta-typing-test__history-toggle:hover {
    background: #f8fafc;
}

.ta-typing-test__history-details td {
    background: #f8fafc;
}

.ta-typing-test__history-details-inner {
    padding: 8px 0;
}

.ta-typing-test__history-details-label {
    margin: 0 0 6px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
}

.ta-typing-test__history-details-text {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 13px;
    line-height: 1.65;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    color: #1e293b;
}

.ta-char {
    transition: background-color 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.ta-char--pending {
    color: #94a3b8;
}

.ta-char--correct {
    color: #15803d;
    font-weight: 600;
}

.ta-char--wrong {
    color: #b91c1c;
    background: #fee2e2;
    border-radius: 3px;
}

.ta-char--current {
    color: #0f172a;
    border-bottom: 2px solid #2563eb;
}

.ta-typing-test__history {
    overflow-x: auto;
}

.elementor-widget-container .ta-typing-test {
    margin: 0;
}

@media (max-width: 767px) {
    .ta-typing-test {
        padding: 12px;
    }

    .ta-typing-test__header h3 {
        font-size: 20px;
    }

    .ta-typing-test__metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .ta-typing-test__result-grid {
        grid-template-columns: 1fr;
    }

    .ta-typing-test__history-table th,
    .ta-typing-test__history-table td {
        padding: 6px;
        font-size: 13px;
    }
}
