/* Exercise 6: Snowball - Cumulative word-by-word memorization */

.snowball-container {
    padding: 1.5rem;
    max-width: 680px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
}

/* Progress Section - AT BOTTOM */
.snowball-progress-section {
    order: 99;
    margin-top: 1.5rem;
    margin-bottom: 0;
}

.snowball-progress-bar {
    background: rgba(0, 0, 0, 0.1);
    height: 4px;
    border-radius: 2px;
    overflow: hidden;
}

.snowball-progress-fill {
    background: #4a9079;
    height: 100%;
    width: 0%;
    transition: width 0.5s ease-out;
    border-radius: 2px;
}

/* Window Display - Shows the sliding word window */
.snowball-window-display {
    text-align: center;
    position: relative;
    padding: 1.5rem 2rem;
    margin-bottom: 1rem;
}

.snowball-window-text {
    font-size: 1.3rem;
    line-height: 1.8;
    margin-bottom: 1.25rem;
    min-height: 2.5rem;
}

.snowball-word {
    color: rgba(0, 0, 0, 0.4);
    transition: all 0.3s ease;
}

.snowball-word.new {
    color: #333;
    font-size: 1.5rem;
    font-weight: 500;
}

/* Deleted word in window display */
.snowball-word.deleted {
    color: #999;
    font-style: italic;
    opacity: 0.5;
}

/* Word info section */
.snowball-word-info {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 0;
    position: relative;
}

.snowball-word-translation {
    font-size: 1.4rem;
    font-weight: 500;
    color: #4a9079;
}

/* ACTION BUTTON - aligned with translation */
.snowball-action-btn {
    position: absolute;
    right: 0;
    min-width: 48px;
    height: 36px;
    padding: 0 14px;
    border-radius: 6px;
    background: rgba(74, 144, 121, 0.15);
    border: 1px solid rgba(74, 144, 121, 0.3);
    color: #4a9079;
    font-size: 1.4rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
    transform: scaleX(-1);
}

.snowball-action-btn:hover {
    background: rgba(74, 144, 121, 0.25);
}

.snowball-action-btn:active {
    background: rgba(74, 144, 121, 0.35);
}

.snowball-action-btn.hidden {
    display: none !important;
}

/* Type Card - Contains all interactive sections */
.snowball-type-card {
    background: #f5f5f5;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.snowball-type-card.hidden {
    display: none;
}

.snowball-type-card.success-state {
    background: transparent;
    padding: 0;
}

/* Type Section */
.snowball-type-section {
    text-align: center;
}

.snowball-type-section.hidden {
    display: none;
}

.snowball-type-prompt {
    font-size: 1.2rem;
    color: #333;
    margin-bottom: 1rem;
    line-height: 1.6;
}

.snowball-type-input-wrapper {
    position: relative;
    width: 100%;
    box-sizing: border-box;
}

.snowball-type-input {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 0.875rem 1rem;
    font-size: 1.1rem;
    color: #333;
    outline: none;
    transition: border-color 0.2s ease;
}

.snowball-type-input::placeholder {
    color: #aaa;
    font-style: italic;
}

.snowball-type-input:focus {
    border-color: #4a9079;
}

.snowball-type-input.error {
    border-color: #c97676;
}

.snowball-type-input.success {
    border-color: #4a9079;
    background: rgba(74, 144, 121, 0.05);
}

.snowball-error-hint {
    margin-top: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: rgba(201, 118, 118, 0.1);
    border-radius: 6px;
    font-size: 0.9rem;
    color: #333;
}

.snowball-error-hint.hidden {
    display: none;
}

/* Correction Section */
.snowball-correction-section {
    text-align: center;
}

.snowball-correction-section.hidden {
    display: none;
}

.snowball-correction-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #c97676;
    margin-bottom: 0.75rem;
}

.snowball-correction-phrase {
    font-size: 1.4rem;
    color: #333;
    line-height: 2.2;
}

.snowball-correction-phrase .correct {
    color: #666;
}

.correction-word-group {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    margin: 0 0.2rem;
    vertical-align: text-top;
}

input.correction-input {
    background: transparent;
    border: none;
    border-bottom: 2px dashed #c97676;
    border-radius: 0;
    padding: 0.1rem 0;
    font-size: 1.25rem;
    color: #333;
    outline: none;
    text-align: center;
    min-width: 2ch;
}

.correction-input:focus {
    border-bottom-color: #c97676;
}

.correction-input.success {
    border-bottom-color: #4a9079;
    border-bottom-style: solid;
    color: #4a9079;
}

.correction-word-group .hint {
    font-family: monospace;
    font-size: 1.1rem;
    color: #4a9079;
    margin-top: 0.3rem;
    opacity: 0.8;
}

/* Checkpoint Section */
.snowball-checkpoint-section {
    text-align: center;
}

.snowball-checkpoint-section.hidden {
    display: none;
}

.snowball-checkpoint-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #4a9079;
    margin-bottom: 0.75rem;
}

.snowball-checkpoint-title {
    font-size: 1.3rem;
    margin-bottom: 0.4rem;
    color: #333;
}

.snowball-checkpoint-subtitle {
    color: #999;
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
}

.snowball-checkpoint-prompt {
    font-size: 0.95rem;
    color: #555;
    margin-bottom: 1.25rem;
    line-height: 1.7;
    text-align: left;
    background: #fff;
    padding: 0.875rem 1rem;
    border-radius: 6px;
    border: 1px solid #e5e5e5;
}

.snowball-checkpoint-textarea {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    min-height: 100px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 0.875rem 1rem;
    font-size: 1rem;
    color: #333;
    outline: none;
    resize: vertical;
    transition: border-color 0.2s ease;
    font-family: inherit;
}

.snowball-checkpoint-textarea::placeholder {
    color: #aaa;
    font-style: italic;
}

.snowball-checkpoint-textarea:focus {
    border-color: #4a9079;
}

.snowball-checkpoint-textarea.error {
    border-color: #c97676;
}

.snowball-checkpoint-textarea.success {
    border-color: #4a9079;
    background: rgba(74, 144, 121, 0.05);
}

.snowball-checkpoint-error-hint {
    margin-top: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: rgba(201, 118, 118, 0.1);
    border-radius: 6px;
    font-size: 0.9rem;
    color: #333;
    text-align: left;
    line-height: 1.8;
}

.snowball-checkpoint-error-hint.hidden {
    display: none;
}

/* Checkpoint word diff highlighting */
.checkpoint-word-correct {
    color: #666;
}

.checkpoint-word-wrong {
    background: rgba(201, 118, 118, 0.25);
    color: #333;
    padding: 0.1em 0.3em;
    border-radius: 3px;
    font-weight: 500;
}

/* Success Section */
.snowball-success-section {
    text-align: center;
    padding: 2rem 0;
    min-height: 200px;
    position: relative;
}

.snowball-success-section.hidden {
    display: none;
}

.snowball-success-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
}

.snowball-success-title {
    font-size: 1.4rem;
    color: #4a9079;
    margin-bottom: 0.4rem;
}

.snowball-success-subtitle {
    color: #999;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

/* Button container for success state - matches Exercise 4 */
.snowball-button-container {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 1rem;
}

.snowball-next-exercise-btn,
.snowball-restart-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    background: rgba(74, 144, 121, 0.1);
    border: 1px solid rgba(74, 144, 121, 0.3);
    color: #4a9079;
    padding: 8px 15px;
    height: 35px;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.snowball-next-exercise-btn:hover,
.snowball-restart-btn:hover {
    background: rgba(74, 144, 121, 0.2);
}

.snowball-next-exercise-btn:focus {
    outline: 2px solid rgba(74, 144, 121, 0.5);
    outline-offset: 2px;
}

/* Empty state message */
.snowball-empty-message {
    text-align: center;
    color: #999;
    padding: 2rem;
}

/* Shake animation for wrong answers */
@keyframes snowball-shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-4px); }
    40%, 80% { transform: translateX(4px); }
}

.shake {
    animation: snowball-shake 0.3s ease-in-out;
}

/* Hidden utility */
.hidden {
    display: none !important;
}

/* =============================================
   DELETED WORD STYLING - Inline in prompts
   ============================================= */

/* Deleted words shown inline in type prompt, correction, and checkpoint */
.deleted-word-inline {
    color: #999;
    font-style: italic;
    opacity: 0.6;
    display: inline;
    margin: 0 0.1em;
}

/* In the type prompt area */
.snowball-type-prompt .deleted-word-inline {
    background-color: rgba(0, 0, 0, 0.03);
    padding: 0.1em 0.3em;
    border-radius: 3px;
}

/* In the correction phrase */
.snowball-correction-phrase .deleted-word-inline {
    font-size: 1.3rem;
    vertical-align: baseline;
}

/* In the checkpoint prompt */
.snowball-checkpoint-prompt .deleted-word-inline {
    background-color: rgba(0, 0, 0, 0.03);
    padding: 0.1em 0.3em;
    border-radius: 3px;
}

/* =============================================
   COLLAPSED STATE SUPPORT
   ============================================= */

#exercise6.collapsed .snowball-container {
    display: none;
}

#exercise6.collapsed {
    cursor: pointer;
}

#exercise6 .exercise-header {
    display: flex;
}

#exercise6.collapsed .exercise-header {
    margin-bottom: 0;
}

/* Mobile responsiveness */
@media (max-width: 600px) {
    .snowball-container {
        padding: 1rem;
    }
    
    .snowball-window-display {
        padding: 1.25rem 1rem;
    }
    
    .snowball-window-text {
        font-size: 1.1rem;
    }
    
    .snowball-word.new {
        font-size: 1.3rem;
    }
    
    .snowball-word-translation {
        font-size: 1.25rem;
    }
    
    .snowball-type-card {
        padding: 1.25rem;
    }
    
    .snowball-type-prompt {
        font-size: 1.05rem;
    }
    
    .snowball-type-input,
    .snowball-checkpoint-textarea {
        font-size: 1rem;
        padding: 0.75rem;
    }
    
    .snowball-correction-phrase {
        font-size: 1.2rem;
    }
    
    .correction-input {
        font-size: 1.1rem;
    }
    
    .snowball-correction-phrase .deleted-word-inline {
        font-size: 1.1rem;
    }
    
    .snowball-action-btn {
        min-width: 44px;
        height: 34px;
        font-size: 1.2rem;
    }
    
    .snowball-button-container {
        flex-direction: column;
        gap: 8px;
    }
    
    .snowball-next-exercise-btn,
    .snowball-restart-btn {
        width: 100%;
        max-width: 200px;
    }
}