/* Main CSS - Core styles and layout */

/* Base styles */
body {
    background-color: purple;
    color: white;
    font-family: Verdana, sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    text-align: center;
}

.container {
    padding: 40px;
    border-radius: 10px;
    background-color: rgba(128, 0, 128, 0.8);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

/* Typography */
h1 {
    font-size: 2.5em;
    margin-bottom: 20px;
}

/* Common states */
.loading {
    font-size: 1.2em;
}

.error {
    color: #ffcccc;
    font-size: 1.1em;
}

/* Buttons */
.start-button {
    background-color: #8A2BE2;
    color: white;
    border: 2px solid white;
    padding: 15px 30px;
    font-size: 1.5em;
    font-family: Verdana, sans-serif;
    border-radius: 10px;
    cursor: pointer;
    margin-top: 20px;
    transition: all 0.3s ease;
}

.start-button:hover {
    background-color: white;
    color: purple;
}

.repeat-button {
    background-color: transparent;
    color: white;
    border: 2px solid white;
    padding: 8px 15px;
    font-size: 1.2em;
    font-family: Verdana, sans-serif;
    border-radius: 5px;
    cursor: pointer;
    margin: 10px;
    transition: all 0.3s ease;
}

.repeat-button:hover {
    background-color: white;
    color: purple;
}

/* Game interface */
.game-interface {
    display: none;
    padding-top: 20px;
    padding-bottom: 20px;
}

.word-display {
    font-size: 2.5em;
    font-weight: bold;
    margin: 30px 0;
    letter-spacing: 3px;
}

.progress {
    font-size: 2em;
    margin: 20px 0;
    color: white;
    font-weight: bold;
    text-align: center;
}

/* Input fields */
.inline-input {
    background-color: rgba(255, 255, 255, 0.9);
    color: purple;
    border: none;
    border-bottom: 2px solid white;
    padding: 0;
    font-size: 2.5em;
    font-family: Verdana, sans-serif;
    font-weight: bold;
    text-align: center;
    width: 1.2em;
    margin: 0 2px;
    background-color: transparent;
    color: white;
}

.inline-input:focus {
    outline: none;
    border-bottom: 2px solid #90EE90;
    background-color: rgba(255, 255, 255, 0.1);
}

/* When inputs are replaced with spans after answering */
.inline-input.result-letter {
    position: relative;
    display: inline-block;
}

.typed-word-row {
    display: flex;
    justify-content: center;
    gap: 2px;
    margin-bottom: 4px;
}

.result-word-row {
    display: flex;
    justify-content: center;
    gap: 2px;
}

.typed-letter {
    border-bottom: none;
}

.time-spent {
    font-size: 1.1em;
    margin: 10px 0;
}

.time-spent.time-green {
    color: #90EE90;
}

.time-spent.time-yellow {
    color: #FFD700;
}

.time-spent.time-red {
    color: #FF6B6B;
}

.letter-overlay {
    position: absolute;
    top: -1.2em;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.8em;
    color: #dc3545;
    pointer-events: none;
}

.visible-letter {
    font-size: 2.5em;
    font-weight: bold;
    margin: 0 2px;
}

/* Feedback */
.feedback {
    font-size: 1.3em;
    margin: 20px 0;
    min-height: 30px;
}

.correct {
    color: #90EE90;
}

.incorrect {
    color: #FFB6C1;
}

/* Results */
.final-results {
    display: none;
    font-size: 1.5em;
    margin: 30px 0;
}

.score {
    font-size: 2em;
    font-weight: bold;
    margin: 20px 0;
}

.word-count {
    font-size: 3em;
    font-weight: bold;
    margin: 20px 0;
}

/* Animations */
@keyframes glow {
    from {
        box-shadow: 0 0 10px #90EE90;
    }
    to {
        box-shadow: 0 0 20px #90EE90, 0 0 30px #90EE90;
    }
}

@keyframes correctGlow {
    from {
        box-shadow: 0 0 10px rgba(144, 238, 144, 0.5);
    }
    to {
        box-shadow: 0 0 20px rgba(144, 238, 144, 0.8);
    }
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.05); }
}

@keyframes shake {
    10%, 90% {
        transform: translate3d(-1px, 0, 0);
    }
    20%, 80% {
        transform: translate3d(2px, 0, 0);
    }
    30%, 50%, 70% {
        transform: translate3d(-4px, 0, 0);
    }
    40%, 60% {
        transform: translate3d(4px, 0, 0);
    }
}

/* Sentence Feature Styles */
.sentence-context-display {
    margin-bottom: 15px; /* Space between context and input */
    font-size: 1.4em; /* Slightly larger for context */
    text-align: center;
    line-height: 1.6;
}

.sentence-placeholder {
    font-weight: bold;
    color: #777;
    padding: 0 0.2em;
}

.missing-word-input-container {
    margin-bottom: 20px; /* Space below the input */
    text-align: center;
}

.missing-word-input-field {
    font-size: 1.8em; /* Bigger font for the input */
    padding: 10px 15px;
    border: 2px solid #ccc;
    border-radius: 8px;
    text-align: center;
    width: 60%; /* Adjust as needed */
    max-width: 400px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.missing-word-input-field:focus {
    border-color: #007bff;
    outline: none;
    box-shadow: 0 0 0 0.2rem rgba(0,123,255,.25);
}

/* Feedback styles for letter comparison */
.letter-correct {
    color: #28a745; /* Green */
    font-weight: bold;
}

.letter-incorrect {
    color: #dc3545; /* Red */
    font-weight: bold;
    text-decoration: underline;
    text-decoration-color: #dc3545;
    text-decoration-thickness: 2px;
}

.user-answer-display {
    font-style: italic;
    color: #555;
}

/* Ensure word-display (now sentence-context-display) uses its ID if specific styles were tied to #word-display */
#word-display {
    /* Existing styles for #word-display might be here or in other files */
    /* These will now apply to the sentence context. */
    /* Example: if it had text-align, font-size, etc. */
}

/* Styles for Sentence Feature elements */
.sentence-prefix,
.sentence-suffix {
    display: block; /* Ensure prefix and suffix are on their own lines */
    text-align: center; /* Center the prefix/suffix text */
    margin-top: 10px;
    margin-bottom: 10px;
    font-size: 1.2em; /* Make context font a bit larger */
}

.word-guess-area {
    display: flex; /* Align letter inputs/spans in a row */
    justify-content: center; /* Center the row */
    margin-top: 10px;
    margin-bottom: 10px;
    gap: 2px; /* Minimal gap, .inline-input has its own margin */
}

.word-guess-area.show-feedback {
    flex-direction: column;
}

/* Shake animation for input validation */
.word-guess-area.shake {
    animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
    transform: translate3d(0, 0, 0);
    backface-visibility: hidden;
    perspective: 1000px;
}

.feedback .warning-feedback {
    color: #FFD700; /* Yellow/Gold for warning */
    font-style: italic;
    background-color: rgba(0,0,0,0.1);
    padding: 5px 10px;
    border-radius: 4px;
    display: inline-block; /* So padding and background apply nicely */
}

/* Styles for sentence display (placeholders etc from previous iteration - can be removed or adapted) */
/* These .sentence-context-display and .sentence-placeholder might conflict or be redundant now.
   Reviewing and simplifying is a good idea. For now, keeping them but they might not be used directly by the JS anymore.
*/
.sentence-context-display {
    font-size: 1.2em;
    margin-bottom: 15px;
    color: #555;
    text-align: center;
}

.sentence-placeholder {
    font-weight: bold;
    color: #007bff; /* Or your preferred highlight color */
    padding: 0 5px;
    border-bottom: 2px solid #007bff;
    margin: 0 5px;
}

/* Remove or comment out styles for the single missing word input field if no longer needed */
/*
.missing-word-input-container {
    margin-top: 10px;
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
}

.missing-word-input-field {
    padding: 10px 15px;
    font-size: 1.5em; 
    border: 2px solid #ccc;
    border-radius: 5px;
    text-align: center;
    width: 80%;
    max-width: 400px;
}

.missing-word-input-field:focus {
    border-color: #007bff;
    box-shadow: 0 0 8px rgba(0, 123, 255, 0.3);
    outline: none;
}
*/

/* Add new styles for .input-correct and .input-incorrect for the .inline-input fields */
.inline-input.input-correct {
    background-color: #d4edda; /* Light green */
    color: #155724; /* Dark green text */
    border-bottom-color: #28a745; /* Green underline */
}

.inline-input.input-incorrect {
    background-color: #f8d7da; /* Light red */
    color: #721c24; /* Dark red text */
    border-bottom-color: #dc3545; /* Red underline */
}
