﻿/* ── Floating Action Button (FAB) ── */
.fab-btn {
    position: relative;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #6366f1, #a855f7);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    z-index: 99;
    box-shadow: 0 6px 24px rgba(99, 102, 241, 0.55), 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}

    .fab-btn:hover {
        transform: scale(1.1);
        box-shadow: 0 10px 32px rgba(99, 102, 241, 0.7), 0 4px 12px rgba(0, 0, 0, 0.35);
        filter: brightness(1.15);
    }

    .fab-btn:active {
        cursor: grabbing;
        transform: scale(0.96);
        box-shadow: 0 4px 14px rgba(99, 102, 241, 0.45);
    }

    .fab-btn.is-dragging {
        cursor: grabbing;
        transform: scale(1.08);
        box-shadow: 0 14px 40px rgba(99, 102, 241, 0.75), 0 6px 20px rgba(0, 0, 0, 0.4);
        transition: box-shadow 0.15s ease, filter 0.15s ease;
    }

    .fab-btn > img {
        width: 48px;
        height: 48px;
        border-radius: 50%;
    }

/* Animated pulse ring */
.fab-pulse {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid rgba(168, 85, 247, 0.6);
    animation: fab-pulse-ring 2.2s ease-out infinite;
    pointer-events: none;
}

@keyframes fab-pulse-ring {
    0% {
        transform: scale(1);
        opacity: 0.8;
    }

    70% {
        transform: scale(1.5);
        opacity: 0;
    }

    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

/* Modal */
.modal-game {
    display: none;
    /* Hidden by default */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(8px);
    z-index: 100;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

    .modal-game.show {
        display: flex;
        opacity: 1;
    }

.modal-game-content.glass-effect {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 20px;
    width: 90%;
    max-width: 600px;
    min-height: 400px;
    max-height: 90vh;
    padding: 2rem;
    position: relative;
    display: flex;
    flex-direction: column;
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.modal-game.show .modal-game-content {
    transform: scale(1);
}

.close-btn {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
    transition: color 0.3s ease;
}

    .close-btn:hover {
        color: white;
    }

.game-header {
    text-align: center;
    margin-bottom: 2rem;
}

.header-top {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 0.5rem;
}

.game-header h2 {
    font-size: 1.5rem;
    color: #14b8a6;
}

.icon-btn {
    position: absolute;
    top: 1rem;
    left: 1.5rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #94a3b8;
    padding: 0.5rem;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

    .icon-btn:hover {
        background: rgba(255, 255, 255, 0.1);
        color: white;
        transform: rotate(45deg);
    }

    .icon-btn.active {
        color: #6366f1;
        border-color: #6366f1;
    }

.game-area {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    gap: 2rem;
    overflow-y: auto;
    padding-right: 10px;
    padding-top: 10px;
    padding-bottom: 10px;
}

    /* Custom Scrollbar for game-area */
    .game-area::-webkit-scrollbar {
        width: 6px;
    }

    .game-area::-webkit-scrollbar-track {
        background: rgba(255, 255, 255, 0.05);
        border-radius: 4px;
    }

    .game-area::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.2);
        border-radius: 4px;
    }

        .game-area::-webkit-scrollbar-thumb:hover {
            background: rgba(255, 255, 255, 0.4);
        }

.collocations-container {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
    transition: opacity 0.4s ease, transform 0.4s ease, filter 0.4s ease;
}

.sentence-container {
    margin-top: 1rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(236, 72, 153, 0.1));
    border-radius: 16px;
    text-align: center;
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 1s ease, transform 1s ease, filter 0.4s ease;
}

/* Fade-out animation triggered before a new item loads */
/* .fading-out is kept for compatibility but word-dissolve is now used instead */

/* Word-by-word dissolve — animation is set fully inline by JS, CSS only provides display */
.dissolve-word {
    display: inline-block;
}

@keyframes word-dissolve {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1) rotate(0deg);
        filter: blur(0px);
    }

    100% {
        opacity: 0;
        transform: translateY(-36px) scale(0.45) rotate(18deg);
        filter: blur(7px);
    }
}

.col-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
}


.col-eng {
    text-align: center;
    font-size: 1.4rem;
    font-weight: 600;
    color: #fde047;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 1s ease, transform 1s ease;
    /*text-shadow: 1px 1px 0 #bbb, 2px 2px 0 #999, 3px 3px 0 #777*/
}

    .col-eng.typewriter-mode {
        transition: transform 1s ease;
        opacity: 1;
        transform: translateY(0);
    }

.col-trans {
    text-align: center;
    font-size: 1.1rem;
    color: white;
    font-style: italic;
    min-height: 1.2em;
    /* Prevent layout jump */
}



.sentence-container.show {
    opacity: 1;
    transform: scale(1);
}

.full-sentence {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.4;
    background: linear-gradient(to right, #38bdf8, #818cf8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.modal-game-footer {
    display: flex;
    justify-content: space-around;
    margin-top: auto;
    padding-top: 2rem;
}

.glass-btn {
    padding: 0.75rem 2.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

    .glass-btn.primary {
        background: linear-gradient(135deg, #6366f1, #818cf8);
        border: none;
        box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
    }

        .glass-btn.primary:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
            filter: brightness(1.1);
        }

    .glass-btn:active {
        transform: translateY(0);
    }

/* Game Controls */
.game-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.8rem;
    padding: 0.8rem;
    justify-content: center;
    margin-top: 1rem;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    max-height: 500px;
    opacity: 1;
}

    .game-controls.collapsed {
        max-height: 0;
        margin-top: 0;
        padding-top: 0;
        padding-bottom: 0;
        opacity: 0;
        pointer-events: none;
        border-color: transparent;
    }

.control-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    width: 100%;
}

    .control-group label {
        font-size: 0.85rem;
        color: #94a3b8;
        font-weight: 500;
    }

.glass-input {
    background: rgba(15, 23, 42, 0.6);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    outline: none;
    font-family: inherit;
    cursor: pointer;
    transition: border-color 0.3s ease;
    width: 100%;
    padding: 0.4rem 0.6rem;
    font-size: 0.85rem;
}

    .glass-input:focus {
        border-color: #6366f1;
    }

    .glass-input option {
        background-color: #0f172a;
        color: white;
    }

/* --- Quiz UI Styles --- */
.quiz-mini-game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    padding: 2rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: fadeIn 0.5s ease forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.quiz-mini-game-question {
    font-size: 1.2rem;
    color: #f8fafc;
    text-align: center;
    font-weight: 600;
}

.quiz-mini-game-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    width: 100%;
}

.quiz-mini-game-btn {
    padding: 1rem;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    color: #f8fafc;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

    .quiz-mini-game-btn:hover {
        background: rgba(255, 255, 255, 0.15);
        transform: translateY(-2px);
    }

    .quiz-mini-game-btn.correct {
        background: rgba(34, 197, 94, 0.3);
        /* green-500 with opacity */
        border-color: #22c55e;
        color: #fff;
    }

    .quiz-mini-game-btn.wrong {
        background: rgba(239, 68, 68, 0.3);
        /* red-500 with opacity */
        border-color: #ef4444;
        color: #fff;
        animation: shake 0.4s;
    }

@keyframes shake {

    0%, 100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    75% {
        transform: translateX(5px);
    }
}

.quiz-mini-game-feedback {
    font-size: 1rem;
    font-weight: 500;
    opacity: 0;
    transition: opacity 0.3s ease;
    text-align: center;
    min-height: 1.5rem;
}

    .quiz-mini-game-feedback.show {
        opacity: 1;
    }

    .quiz-mini-game-feedback.success {
        color: #4ade80;
        /* green-400 */
    }

    .quiz-mini-game-feedback.error {
        color: #f87171;
        /* red-400 */
    }

/* Mobile Optimizations */
@media (max-width: 600px) {
    .modal-game-content.glass-effect {
        padding: 1.5rem 1rem;
        width: 95%;
        max-height: 95vh;
    }

    .game-header {
        margin-bottom: 1rem;
    }

        .game-header h2 {
            font-size: 1.2rem;
        }

    .control-group label {
        font-size: 0.75rem;
    }

    .game-area {
        gap: 1rem;
    }

    .col-trans {
        font-size: 1rem;
    }

    .col-eng {
        font-size: 1.2rem;
    }

    .full-sentence {
        font-size: 1.3rem;
    }

    .modal-game-footer {
        padding-top: 1rem;
    }

    .glass-btn {
        padding: 0.6rem 2rem;
        font-size: 0.9rem;
    }
}

.generate-btn, .pause {
    background: red !important;
}

.next {
    background: #0000FF !important;
}

.generate-btn, .next-btn {
    width: 220px;
    padding: 0.6rem 2rem;
    font-size: 0.9rem;
}

.title-boost {
    color: white !important;
}

.logo-boost {
    border-radius: 50%;
    border: solid 1px;
    width: 36px;
    height: 36px;
}

.border-active {
    border: solid 1px white;
}

.ic-pointer {
    position: absolute;
    right: 0px;
    top: 70px;
    color: white;
    font-size: 24px;
}
