.typing-engine-page {
    padding: 80px 0;
    background:
        radial-gradient(circle at 15% 10%, rgba(37,99,235,.18), transparent 30%),
        radial-gradient(circle at 85% 20%, rgba(124,58,237,.18), transparent 30%),
        linear-gradient(135deg, #f8fbff, #eef4ff, #faf5ff);
}

.typing-engine-hero {
    text-align: center;
    margin-bottom: 40px;
}

.typing-engine-hero span {
    display: inline-block;
    background: #dbeafe;
    color: #1d4ed8;
    padding: 8px 16px;
    border-radius: 999px;
    font-weight: 900;
}

.typing-engine-hero h1 {
    font-size: 56px;
    font-weight: 950;
    color: #0f172a;
    margin: 16px 0 10px;
}

.typing-engine-hero p {
    color: #64748b;
    font-size: 18px;
}

.typing-engine {
    background: #0f172a;
    color: #fff;
    border-radius: 34px;
    padding: 34px;
    box-shadow: 0 35px 90px rgba(15,23,42,.32);
}

.engine-top {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: center;
    margin-bottom: 28px;
}

.engine-top h3 {
    margin: 0;
    font-weight: 950;
}

.engine-top small {
    color: #94a3b8;
}

.time-options {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.time-options button {
    border: 0;
    background: rgba(255,255,255,.08);
    color: #cbd5e1;
    padding: 10px 15px;
    border-radius: 12px;
    font-weight: 900;
}

.time-options button.active {
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    color: #fff;
}

.timer-circle {
    width: 170px;
    height: 170px;
    margin: 0 auto 25px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: radial-gradient(circle, #2563eb, #111827);
    box-shadow: 0 0 0 12px rgba(37,99,235,.12), 0 25px 60px rgba(37,99,235,.35);
    animation: enginePulse 1.2s infinite;
}

.timer-circle strong {
    display: block;
    font-size: 54px;
    line-height: 1;
    font-weight: 950;
    text-align: center;
}

.timer-circle span {
    display: block;
    text-align: center;
    color: #bfdbfe;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 900;
}

@keyframes enginePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.04); }
}

.engine-progress {
    height: 10px;
    background: rgba(255,255,255,.1);
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 24px;
}

.engine-progress div {
    width: 0%;
    height: 100%;
    background: linear-gradient(135deg, #22c55e, #2563eb, #7c3aed);
    transition: width .25s ease;
}

.engine-text {
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.12);
    padding: 24px;
    border-radius: 22px;
    font-size: 24px;
    line-height: 1.8;
    min-height: 160px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.engine-text .char {
    padding: 2px 1px;
    border-radius: 4px;
}

.engine-text .char.correct {
    color: #22c55e;
    background: rgba(34,197,94,.13);
}

.engine-text .char.wrong {
    color: #fff;
    background: #ef4444;
}

.engine-text .char.current {
    border-bottom: 4px solid #38bdf8;
}

.engine-input {
    width: 100%;
    min-height: 130px;
    margin-top: 22px;
    padding: 20px;
    border: 0;
    border-radius: 20px;
    font-size: 18px;
    outline: none;
    resize: vertical;
}

.engine-actions {
    display: flex;
    gap: 14px;
    margin-top: 22px;
}

.engine-start,
.engine-restart {
    border: 0;
    padding: 14px 24px;
    border-radius: 14px;
    font-weight: 950;
}

.engine-start {
    background: linear-gradient(135deg, #22c55e, #2563eb);
    color: #fff;
}

.engine-restart {
    background: rgba(255,255,255,.1);
    color: #fff;
}

.engine-stats,
.finish-results {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    margin-top: 24px;
}

.engine-stats div,
.finish-results div {
    background: #fff;
    color: #0f172a;
    padding: 22px;
    border-radius: 22px;
    text-align: center;
}

.engine-stats strong,
.finish-results strong {
    display: block;
    font-size: 34px;
    color: #2563eb;
    font-weight: 950;
}

.engine-stats span,
.finish-results span {
    font-size: 12px;
    color: #64748b;
    font-weight: 900;
}

.finish-box {
    display: none;
    margin-top: 26px;
    padding: 28px;
    border-radius: 26px;
    background: linear-gradient(135deg, #ffffff, #eef4ff);
    color: #0f172a;
    text-align: center;
}

.mistake-history {
    margin-top: 24px;
    padding: 20px;
    border-radius: 20px;
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.12);
}

.mistake-history h4 {
    margin-bottom: 12px;
}

.mistake-history li {
    color: #fecaca;
    margin-bottom: 6px;
}

@media(max-width: 768px) {
    .typing-engine-hero h1 {
        font-size: 38px;
    }

    .engine-top {
        flex-direction: column;
        align-items: flex-start;
    }

    .engine-stats,
    .finish-results {
        grid-template-columns: 1fr 1fr;
    }

    .engine-text {
        font-size: 18px;
    }
}
/* Compact typing test layout - keep buttons and stats visible */
.typing-engine-page{
    padding: 40px 0 40px !important;
    min-height: auto !important;
}

.typing-engine{
    padding: 24px 34px 28px !important;
    border-radius: 28px !important;
}

.typing-engine-hero{
    margin-bottom: 14px !important;
}

.typing-engine-hero h1{
    display: none !important;
}

.typing-engine-hero p{
    margin: 10px 0 14px !important;
    font-size: 15px !important;
}

.engine-top{
    margin-bottom: 14px !important;
    align-items: center !important;
}

.timer-circle{
    width: 120px !important;
    height: 120px !important;
    margin: 0 auto 8px !important;
}

.timer-circle strong{
    font-size: 38px !important;
}

.timer-circle span{
    font-size: 11px !important;
}

.engine-progress{
    margin: 12px 0 16px !important;
}

.engine-text{
    min-height: 92px !important;
    padding: 22px !important;
    font-size: 23px !important;
    margin-bottom: 16px !important;
}

.engine-input{
    min-height: 86px !important;
    padding: 20px !important;
    margin-bottom: 16px !important;
}

.engine-actions{
    margin-bottom: 16px !important;
}

.engine-stats{
    gap: 14px !important;
}

.engine-stats div{
    padding: 18px 12px !important;
    min-height: 78px !important;
}