/* Apply font to entire activity */
#lap-activity * {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
}

#lap-activity {
    border: 0px solid #303030;
    padding: 20px;
    margin: 0 auto;
    border-radius: 3px;
    background: #ffffff;
    max-width: 100%;
    box-shadow: 1px 1px 10px #888888;
    display: block;
    flex-direction: column;
    height: auto;
    min-height: 500px;
}

#lap-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
    flex-wrap: wrap;
    gap: 10px;
}

#lap-timer {
    font-weight: normal;
    color: #000000;
    font-size: 1em;
    margin: 0;
}

#lap-instructions {
    margin-bottom: 5px;
    font-style: italic;
}

#lap-progress {
    margin-bottom: 10px;
    display: none;
}

#lap-progress-bar-container {
    width: 100%;
    background-color: #e9ecef;
    border-radius: 5px;
    margin-bottom: 5px;
}

#lap-progress-bar {
    height: 5px;
    background-color: #0073aa;
    border-radius: 3px;
    width: 0%;
    transition: width 0.5s ease;
}

#lap-progress-text {
    text-align: center;
    font-size: 0.9em;
    color: #6c757d;
}

.lap-sentence {
    min-height: 80px;
    border: 1px dashed #aaa;
    padding: 10px;
    margin: 5px 0;
    border-radius: 3px;
    background: #fff;
    flex: 1;
}

.lap-word-bank {
    min-height: 120px;
    border: 1px dashed #aaa;
    padding: 10px;
    margin: 5px 0;
    border-radius: 3px;
    background: #fff;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 8px;
    flex: 2;
}

.lap-word {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 5px 8px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.5s;
    text-align: center;
    min-height: 35px;
    font-size: 1em;
}
.lap-word:hover {
    background: #e0e0e0;
}

.lap-word-placeholder {
    visibility: hidden;
    padding:5px 5px;
    min-height: 35px;
}

#lap-sentence-construction {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 80px;
    border: 1px dashed #aaa;
    padding: 5px;
    margin: 5px 0;
    border-radius: 3px;
    background: #fff;
    align-items: flex-start;
}

#lap-sentence-construction .lap-word {
    margin: 0;
}

.lap-correct {
    background-color: #baf7c8 !important;
    border-color: #c3e6cb !important;
    color: #155724;
}

.lap-incorrect {
    background-color: #ff96a0 !important;
    border-color: #f5c6cb !important;
    color: #721c24;
}

#lap-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin: 10px 0;
    justify-content: center;
}

#lap-feedback {
    margin-top: 5px;
    font-weight: normal;
    min-height: 24px;
    padding: 5px;
    background: #fafafa;
    border-radius: 3px;
    text-align: center;
}

#lap-correct-sentence {
    margin-top: 8px;
    padding: 8px;
    background: #e9ecef;
    border-radius: 3px;
    text-align: center;
}

.lap-correct-feedback {
    color: #155724;
}

.lap-incorrect-feedback {
    color: #721c24;
}

.lap-correct-answer {
    font-style: italic;
    color: #155724;
}

.lap-completed {
    text-align: center;
    padding: 15px;
    background-color: #e9ecef;
    border-radius: 3px;
    margin: 10px 0;
    display: block !important; /* Force display on mobile */
    width: 100%;
    box-sizing: border-box;
}

.lap-completed h3 {
    margin-top: 0;
    color: #0073aa;
    margin-bottom: 10px;
}

#lap-start-button {
    display: block;
    margin: 25px auto;
    padding: 15px 30px;
    font-size: 1.2em;
}

/* Activity content container */
#lap-activity-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 10px;
}

#lap-activity-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 10px;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    #lap-activity {
        padding: 15px;
        min-height: 400px;
    }
    
    #lap-header {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    #lap-controls {
        flex-direction: column;
    }
    
    #lap-controls .button {
        width: 100%;
        margin-bottom: 8px;
        padding: 12px;
    }
    
    .lap-word-bank {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
        gap: 5px;
        min-height: 100px;
        padding: 5px;
    }
    
    .lap-word, .lap-word-placeholder {
        padding: 4px 6px;
        min-height: 40px;
        font-size: 0.95em;
    }
    
    .lap-sentence, #lap-sentence-construction {
        min-height: 70px;
        padding: 8px;
    }
    
    #lap-feedback, #lap-correct-sentence {
        padding: 5px;
    }
    
    .lap-completed {
        padding: 20px 15px;
        margin: 10px 0;
    }
    
    .lap-completed h3 {
        font-size: 1.3em;
    }
    
    /* Ensure completion results are always visible on mobile */
    #lap-feedback {
        display: block !important;
        position: relative;
        z-index: 10;
    }
}

/* Button styles */
.button {
    padding: 5px 10px;
    border: 1px solid #ccc;
    background: #f8f9fa;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.5s;
}

.button:hover {
    background: #e9ecef;
}

.button-primary {
    background: #0073aa;
    color: white;
    border-color: #005a87;
}

.button-primary:hover {
    background: #005a87;
}

/* Force elements to be hidden on completion */
.lap-activity-completed #lap-header,
.lap-activity-completed #lap-activity-container,
.lap-activity-completed #lap-controls,
.lap-activity-completed #lap-progress {
    display: none !important;
}

.lap-activity-completed #lap-feedback {
    display: block !important;
}