/* --- Beautified from typing-test.css --- */

/* --- MODIFIED --- Added styles for vertical centering and layout stability */
html {
    height: 100%;
    /* Prevents layout shift when scrollbar appears/disappears */
    overflow-y: scroll; 
}

body {
    min-height: 100%;
    margin: 0;
    display: flex;
    flex-direction: column;
}
/* --- END OF MODIFICATIONS --- */

.main-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 20px;
    /* --- MODIFIED --- These two lines vertically center the content */
    flex-grow: 1;
    justify-content: center;
}

.test-container {
    background-color: var(--light-container-bg);
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, .1);
    width: 100%;
    max-width: 960px; 
    text-align: center;
    transition: background-color .3s, color .3s;
    box-sizing: border-box;
}

.test-container h1 {
    color: var(--light-primary);
    margin-bottom: 20px;
    transition: color .3s;
}

.config-bar {
    justify-content: center;
    display: flex;
    margin-bottom: 25px;
    align-items: center;
    /* --- MODIFIED --- Increased gap for better spacing */
    gap: 30px;
    font-size: 1.2rem;
    flex-wrap: wrap; /* Allows items to wrap on very small screens */
}

.config-bar,
.stat p {
    color: var(--light-secondary);
    font-weight: 700;
}

.config-bar p,
.stat p {
    margin: 0;
}

.time-selector {
    position: relative;
    background-color: #f0f2f5;
    padding: 8px 15px;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color .3s;
    font-size: 1.1rem;
    color: var(--light-text);
    z-index: 10;
}

.time-selector:hover {
    background-color: #e4e6eb;
}

.test-area {
    position: relative;
    margin-bottom: 10px;
}

.overlay-message {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, .65);
    color: #333;
    font-size: 2.5rem;
    font-weight: 700;
    justify-content: center;
    display: flex;
    align-items: center;
    border-radius: 8px;
    z-index: 5;
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s ease-in-out;
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    flex-direction: column;
    line-height: 1.2;
    cursor: pointer;
}

#times-up-overlay,
body.dark-mode #times-up-overlay {
    color: #e74c3c;
    cursor: default;
}

.overlay-message.show {
    opacity: 1;
    pointer-events: auto;
}

.text-display {
    color: #606770;
    padding: 20px;
    border: 1px solid #dddfe2;
    border-radius: 8px;
    height: 15vh;
    min-height: 70px;
    max-height: 120px;
    overflow-y: auto;
    -ms-overflow-style: none;
    scrollbar-width: none;
    pointer-events: none;
    transition: border-color .3s, color .3s, height .3s;
}

#typed-text-display,
.text-display {
    font-size: 1.9rem; 
    line-height: 1.7;
    text-align: left;
}

.text-display::-webkit-scrollbar {
    display: none;
}

.text-display span {
    display: inline;
    padding: 2px 0;
    border-radius: 3px;
}

span.space {
    padding: 2px .25em;
}

#typed-text-display {
    width: 100%;
    margin-top: 10px;
    padding: 7px;
    border-radius: 8px;
    border: 2px solid #e4e6eb;
    box-sizing: border-box;
    font-family: inherit;
    background-color: #f7f7f7;
    color: #333;
    transition: background-color .3s, color .3s, border-color .3s;
    font-size: 1.6rem;
}

.input-field {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
    z-index: -1;
}

.stats {
    display: flex;
    justify-content: center;
    align-items: center; 
    gap: 15px;
    margin: 25px 0;
    flex-wrap: wrap;
    min-height: 58px; 
}

.stat {
    font-size: 1.2rem;
    padding: 10px 20px;
    border-radius: 8px;
    min-width: 130px;
    position: relative;
    transition: background-color .3s, opacity .3s, transform .3s;
    flex: 1;
    background-color: #f0f2f5;
    box-sizing: border-box;
    border: 2px solid rgba(44, 62, 80, 0.080);
}

.stat.hidden {
    display: none; 
}

.stat span {
    font-size: 2rem;
    font-weight: 700;
    color: #1877f2;
}

.stat span.timer-value {
    color: #640d5f;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: var(--light-container-bg);
    border: 1px solid #dddfe2;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .15);
    min-width: 100%;
    z-index: 10;
    margin-top: 5px;
    padding: 5px 0;
}

.dropdown-item {
    padding: 10px 20px;
    cursor: pointer;
    text-align: left;
    font-weight: 600;
    color: var(--light-text);
}

.dropdown-item:hover {
    background-color: #f0f2f5;
}

.dropdown-menu.show {
    display: block;
}

.button-container {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
}

#pause-resume-button,
#reset-button {
    border: none;
    padding: 12px 25px;
    font-size: 1.2rem;
    font-weight: 700;
    border-radius: 8px;
    cursor: pointer;
    color: #fff;
    box-shadow: 0 4px 6px rgba(0, 0, 0, .1);
    transition: .2s ease-in-out;
    text-shadow: 0 1px 2px rgba(0, 0, 0, .2);
}

#reset-button {
    background-image: linear-gradient(to right, #4caf50, #81c784);
}

#pause-resume-button {
    background-image: linear-gradient(to right, #3498db, #5dade2);
}

#pause-resume-button:hover:not(:disabled),
#reset-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 10px rgba(0, 0, 0, .15);
}

#pause-resume-button:active:not(:disabled),
#reset-button:active {
    transform: translateY(0) scale(.98);
    box-shadow: 0 2px 4px rgba(0, 0, 0, .1);
}

#pause-resume-button:disabled {
    background-image: none;
    background-color: #bdc3c7;
    cursor: not-allowed;
    opacity: .7;
    box-shadow: none;
    text-shadow: none;
}

.correct {
    color: #42b72a;
}

.incorrect {
    color: #fa3e3e;
    text-decoration: underline;
    text-decoration-color: #fa3e3e;
}

.current,
span.space.current {
    background-color: rgba(52, 152, 219, .3);
}

body.dark-mode .seo-content-block,
body.dark-mode .test-container {
    background-color: var(--dark-container-bg);
}

body.dark-mode .seo-content-block h2,
body.dark-mode .test-container h1 {
    color: var(--dark-primary);
}

body.dark-mode .config-bar,
body.dark-mode .stat p {
    color: var(--dark-secondary);
}

body.dark-mode .time-selector {
    background-color: var(--dark-bg);
    color: var(--dark-text);
}

body.dark-mode .dropdown-item:hover,
body.dark-mode .time-selector:hover {
    background-color: #5a626f;
}

body.dark-mode .overlay-message {
    background-color: rgba(34, 40, 49, .75);
    color: var(--dark-text);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

body.dark-mode .text-display {
    color: var(--dark-secondary);
    border-color: #4a5a8a;
}

body.dark-mode #typed-text-display {
    background-color: var(--dark-bg);
    color: var(--dark-text);
    border-color: #4a5a8a;
}

body.dark-mode .stat {
    background-color: var(--dark-bg);
    border-color:#4d6da2;;
}

body.dark-mode .dropdown-menu {
    background-color: var(--dark-container-bg);
    border-color: #4a5a8a;
}

body.dark-mode .dropdown-item,
body.dark-mode .seo-content-block p {
    color: var(--dark-text);
}

body.dark-mode #pause-resume-button:disabled {
    background-image: none;
    background-color: #5a626f;
}

body.dark-mode .current,
body.dark-mode span.space.current {
    background-color: rgba(52, 152, 219, .4);
}

.seo-content-container {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    margin-top: 40px;
    width: 100%;
    max-width: 960px;
    box-sizing: border-box;
}

.seo-content-block {
    flex: 1;
    background-color: var(--light-container-bg);
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, .1);
    transition: background-color .3s, transform .3s ease-out, box-shadow .3s ease-out;
}

.seo-content-block:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, .2);
}

.seo-content-block h2 {
    color: var(--light-primary);
    border-bottom: 2px solid var(--light-highlight);
    padding-bottom: 10px;
    margin-top: 0;
    transition: color .3s;
}

.seo-content-block p {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--light-text);
    text-align: justify;
    transition: color .3s;
}

body.dark-mode .seo-content-block:hover {
    box-shadow: 0 8px 25px rgba(52, 152, 219, .25);
}

@media (max-width: 768px) {
    .config-bar {
        flex-direction: column;
        gap: 15px;
    }
    .seo-content-container,
    .test-container {
        width: 90%;
    }
}

@media (min-width: 992px) {
    .stats {
        flex-wrap: nowrap;
    }
}

@media (max-height: 750px) and (max-width: 992px) {
    .main-content {
        padding-top: 20px;
        padding-bottom: 20px; 
    }

    .test-container {
        padding: 20px;
    }

    .text-display {
        /* This fixed height is now controlled by the min-height in the main rule */
        font-size: 1.3rem;
        line-height: 1.6;
    }

    #typed-text-display {
        font-size: 1.5rem;
    }
    
    .stats {
        margin: 15px 0;
        gap: 10px;
    }

    .stat {
        min-width: 120px;
        padding: 8px 15px;

    }

    .button-container {
        margin-top: 15px;
    }
}

.overlay-message .resume-prompt {
    font-size: 1.25rem;
    font-weight: 500;
    margin-top: 15px;
    color: #606770;
}

body.dark-mode .overlay-message .resume-prompt {
    color: var(--dark-secondary);
}