/* WRITING MODE STYLES */

/* SCRAMBLE MODE STYLES */
#writing-slots .slot {
    width: 50px;
    height: 50px;
    border: 2px dashed var(--border-glass);
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
    background: rgba(255, 255, 255, 0.05);
}

#writing-slots .slot.filled {
    border-style: solid;
    border-color: var(--accent-gold);
    background: rgba(245, 158, 11, 0.2);
}

#writing-pool .letter-tile {
    width: 45px;
    height: 45px;
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
}

#writing-pool .letter-tile:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--text-primary);
}


/* ACTION BUTTONS */
.btn-action {
    padding: 1rem 2rem;
    border-radius: var(--radius-md);
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid var(--border-glass);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-action.check {
    background: var(--bg-card);
    color: white;
    width: 100%;
}

.btn-action.check:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--neon-blue);
    transform: translateY(-2px);
}

.btn-action.next {
    background: linear-gradient(135deg, var(--neon-green, #22c55e), #15803d);
    color: white;
    width: 100%;
    font-size: 1.5rem;
    /* Larger font */
    padding: 1.5rem 2rem;
    /* Larger padding */
    box-shadow: 0 4px 20px rgba(34, 197, 94, 0.4);
    border-color: rgba(255, 255, 255, 0.2);
    animation: pulse 2s infinite;
}

.btn-action.next:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 10px 30px rgba(34, 197, 94, 0.6);
    filter: brightness(1.1);
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(34, 197, 94, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
    }
}

@keyframes pop {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes shake-hard {
    0% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-10px) rotate(-5deg);
    }

    50% {
        transform: translateX(10px) rotate(5deg);
    }

    75% {
        transform: translateX(-10px) rotate(-5deg);
    }

    100% {
        transform: translateX(0);
    }
}

.correct-anim {
    animation: pop 0.4s ease-out;
    border-color: var(--neon-green) !important;
    box-shadow: 0 0 20px rgba(34, 197, 94, 0.5) !important;
}

.wrong-anim {
    animation: shake-hard 0.4s ease-in-out;
    border-color: var(--neon-red) !important;
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.5) !important;
}


/* RESPONSIVE / MOBILE STYLES */
@media (max-width: 768px) {
    .split-screen-container {
        flex-direction: column;
        height: 100vh;
        /* Fixed height to prevent scroll issues */
    }

    .task-pane {
        flex: 1;
        /* Takes remaining space */
        padding: 1rem;
        order: 2;
        /* Show task below chat */
        border-right: none;
        border-bottom: 1px solid var(--border-glass);
    }

    .chat-pane {
        width: 100%;
        height: 35vh;
        /* Fixed height for chat on top */
        order: 1;
        /* Show chat first */
        border-left: none;
        border-top: none;
        border-bottom: 1px solid var(--border-glass);
    }

    .task-question-text {
        font-size: 1.5rem;
        /* Smaller text on mobile */
        margin-bottom: 1rem;
    }

    .task-textarea {
        font-size: 1.1rem;
        padding: 1rem;
    }

    .btn-action.next {
        font-size: 1.2rem;
        padding: 1rem;
    }

    /* ONLY Reduce Icons in Writing Mode Menu (User Request) */
    #view-writing-modes .mode-icon {
        font-size: 2rem !important;
        /* Reduced from 3rem */
        margin-bottom: 0.5rem !important;
    }
}

/* AI TEACHER STYLES (Production Ready) */
.ai-overlay {
    position: absolute;
    inset: 0;
    z-index: 20;
    transition: all 0.5s ease;
}

.ai-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.ai-overlay:not(.active) {
    opacity: 0;
    pointer-events: none;
    transform: scale(1.1);
}

.ai-content-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    animation: fadeIn 0.5s ease-out;
}

.ai-avatar-large {
    filter: drop-shadow(0 0 20px rgba(139, 92, 246, 0.5));
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.btn-ai-start {
    position: relative;
    overflow: hidden;
    transform-style: preserve-3d;
}

.btn-ai-start:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(139, 92, 246, 0.6);
}

.btn-ai-start .shine {
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    animation: shine 3s infinite;
}

@keyframes shine {
    0% {
        left: -100%;
    }

    20% {
        left: 100%;
    }

    100% {
        left: 100%;
    }
}

/* Game Interface */
.ai-game-container {
    opacity: 1;
    transition: opacity 0.5s ease;
}

.ai-game-container.hidden {
    display: none !important;
}

.ai-card-glass {
    min-height: 400px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.ai-question-area .pulse {
    animation: pulseText 1.5s infinite;
    opacity: 0.7;
}

@keyframes pulseText {

    0%,
    100% {
        opacity: 0.7;
    }

    50% {
        opacity: 0.3;
    }
}

.feedback-message {
    padding: 1rem;
    border-radius: 12px;
    text-align: center;
    animation: slideUp 0.3s ease-out;
}

.feedback-message.success {
    background: rgba(34, 197, 94, 0.2);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.feedback-message.error {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

@keyframes slideUp {
    from {
        transform: translateY(10px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}