body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f4f4f9;
    color: #333;
}

header {
    background-color: #007bff;
    color: white;
    padding: 10px 0;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.container {
    display: grid;
    grid-template-columns: 1fr 270px;
    gap: 30px;
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 20px;
}

.sidebar {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
}

.sidebar h2 {
    color: #007bff;
    margin-top: 0;
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
    margin-bottom: 15px;
}

.control-group {
    display: grid;
    gap: 8px;
}

.btn {
    display: block;
    width: 100%;
    padding: 10px;
    margin-top: 20px;
    background-color: #28a745;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1.05em;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn:hover {
    background-color: #218838;
}

.typing-area {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 0;
}

.track {
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    height: 90px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    width: 100%;
    box-sizing: border-box;
    position: relative;
}

#target-track {
    display: flex;
    align-items: center;
}

.center-guide {
    position: absolute;
    left: 50%;
    top: 12px;
    bottom: 12px;
    width: 0;
    border-left: 3px solid #007bff;
    opacity: 0.35;
    z-index: 2;
    pointer-events: none;
}

#target-text-container {
    white-space: nowrap;
    font-size: 2.5em;
    line-height: 1;
    font-family: 'Courier New', monospace;
    transition: transform 0.08s linear;
    will-change: transform;
    padding-left: 0;
}

.placeholder {
    color: #888;
    font-size: 0.7em;
}

#user-input {
    width: 100%;
    height: 100%;
    padding: 5px 10px;
    font-size: 2em;
    box-sizing: border-box;
    border: none;
    outline: none;
    font-family: 'Courier New', monospace;
    color: #007bff;
}

#keyboard-reference {
    text-align: center;
    padding: 20px;
    border: 1px dashed #ccc;
    background-color: #fff;
    border-radius: 8px;
    min-height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2em;
    color: #888;
}

.correct {
    color: #4CAF50;
    opacity: 0.5;
}

.incorrect {
    color: #fff;
    background-color: #F44336;
    padding: 0 1px;
}

.current {
    font-weight: bold;
    text-decoration: underline solid #007bff 3px;
    text-underline-offset: 4px;
}

.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.hidden {
    display: none;
}

.modal-card {
    width: min(460px, 92vw);
    background: #fff;
    border-radius: 10px;
    padding: 24px;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.25);
}

.modal-card h2 {
    margin-top: 0;
    color: #007bff;
}

.modal-card p {
    margin: 8px 0;
}

@media (max-width: 900px) {
    .container {
        grid-template-columns: 1fr;
    }

    .track {
        height: 80px;
    }

    #target-text-container {
        font-size: 2em;
    }
}
