.maths-race-wrapper {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    width: 100%;
    margin: 0 auto;
    padding: 1rem;
    background: #ccdee1;
    border-radius: 12px;
    color: #00454f;
}

.maths-race-wrapper * {
    box-sizing: border-box;
}

.mr-card {
    background: #fff;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 10px 30px -5px rgba(0,70,79,0.15);
    margin-bottom: 1rem;
    text-align: center;
}

.mr-title {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: #00454f;
}

.mr-question {
    font-size: 2rem;
    font-weight: 700;
    margin: 1.5rem 0;
    color: #00454f;
}

.mr-input {
    padding: 12px;
    border-radius: 8px;
    border: 2px solid #ccdee1;
    font-size: 1.5rem;
    width: 120px;
    text-align: center;
    margin: 1rem auto;
    display: block;
    background: #fff;
    color: #00454f;
}

.mr-input:focus {
    outline: none;
    border-color: #00454f;
}

.mr-feedback {
    min-height: 30px;
    margin: 1rem 0;
    font-weight: 600;
    font-size: 1.1rem;
}

.mr-feedback.correct {
    color: #327f00;
}

.mr-feedback.incorrect {
    color: #7a0035;
}

.mr-buttons {
    margin: 1rem 0;
}

.mr-btn {
    padding: 12px 20px;
    border: none;
    cursor: pointer;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    margin: 0 8px 8px 0;
    transition: all 0.2s ease;
}

.mr-btn-primary {
    background: #00454f;
    color: #fff;
}

.mr-btn-primary:hover {
    background: #003a42;
}

.mr-btn-secondary {
    background: #ccdee1;
    color: #00454f;
}

.mr-btn-secondary:hover {
    background: #b8d1d5;
}

.mr-settings {
    display: none;
    text-align: left;
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #ccdee1;
    margin-top: 1rem;
}

.mr-settings.active {
    display: block;
}

.mr-settings h4 {
    margin-bottom: 1rem;
    color: #00454f;
}

.mr-settings label {
    display: block;
    margin: 0.8rem 0;
    font-weight: 500;
    cursor: pointer;
    color: #00454f;
}

.mr-settings input[type="checkbox"] {
    margin-right: 8px;
}

/* Practice settings grid layout */
.mr-practice-settings {
    margin-bottom: 1.5rem;
}

.mr-practice-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem 1rem;
    margin-bottom: 1rem;
}

@media (max-width: 480px) {
    .mr-practice-grid {
        grid-template-columns: 1fr;
    }
}

.mr-stats {
    margin-top: 1.5rem;
    font-size: 1rem;
    color: #00454f;
    text-align: center;
}

.mr-score {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.mr-countdown {
    font-size: 1.1rem;
    font-weight: 600;
    color: #00454f;
    margin-bottom: 1rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mr-countdown.visible {
    opacity: 1;
}

.mr-countdown.warning {
    color: #7a0035;
}

/* Racing Track Styles */
.mr-race-track {
    display: none;
    margin: 1.5rem 0;
    padding: 1rem;
    background: linear-gradient(90deg, #e8f4f8 0%, #ccdee1 100%);
    border-radius: 8px;
    position: relative;
    height: 80px;
    overflow: hidden;
}

.mr-race-track.active {
    display: block;
}

.mr-track-line {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    background: #00454f;
    transform: translateY(-1px);
}

.mr-track-markers {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100%;
    pointer-events: none;
}

.mr-track-marker {
    position: absolute;
    top: 45%;
    width: 2px;
    height: 10px;
    background: #00454f;
    opacity: 0.3;
}

.mr-avatar {
    position: absolute;
    top: 50%;
    font-size: 1.8rem;
    transform: translateY(-50%);
    transition: left 0.5s ease-out;
    z-index: 2;
}

.mr-opponent {
    position: absolute;
    top: 50%;
    font-size: 1.8rem;
    transform: translateY(-50%);
    transition: left 0.5s ease-out;
    z-index: 2;
}

.mr-finish-line {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.8rem;
}

.mr-ghost {
    position: absolute;
    top: 50%;
    font-size: 1.8rem;
    transform: translateY(-50%);
    opacity: 0.4;
    z-index: 1;
}

.mr-race-info {
    text-align: center;
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: #00454f;
}

/* Avatar Selection - Responsive */
.mr-avatar-selection {
    margin: 1rem 0;
    text-align: center;
}

.mr-avatar-selection h4 {
    text-align: center;
    color: #00454f;
    margin-bottom: 1rem;
}

.mr-avatar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
    gap: 0.75rem;
    max-width: 100%;
    margin: 0 auto;
    justify-items: center;
    justify-content: center;
}

/* Responsive breakpoints for avatar grid */
@media (min-width: 320px) {
    .mr-avatar-grid {
        grid-template-columns: repeat(5, 1fr);
        max-width: 350px;
    }
}

@media (max-width: 480px) {
    .mr-avatar-grid {
        grid-template-columns: repeat(4, 1fr);
        max-width: 280px;
    }
}

@media (max-width: 360px) {
    .mr-avatar-grid {
        grid-template-columns: repeat(3, 1fr);
        max-width: 220px;
    }
}

.mr-avatar-option {
    padding: 0.75rem;
    border: 2px solid #ccdee1;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.8rem;
    background: #fff;
    transition: all 0.2s ease;
    width: 100%;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mr-avatar-option:hover {
    background: #f0f8fa;
}

.mr-avatar-option.selected {
    border-color: #00454f;
    background: #e8f4f8;
}

.mr-avatar-description {
    text-align: center;
    font-size: 0.9rem;
    color: #666;
    margin-top: 1rem;
}

/* Difficulty Slider Styles */
.mr-difficulty-slider {
    margin: 1rem 0;
}

.mr-difficulty-slider label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #00454f;
}

.mr-difficulty-range {
    width: 100%;
    margin: 0.5rem 0;
}

.mr-difficulty-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: #666;
    margin-top: 0.25rem;
}

.mr-difficulty-display {
    text-align: center;
    font-weight: 600;
    color: #00454f;
    margin-top: 0.5rem;
}