@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Playfair+Display:ital,wght@0,700;1,700&display=swap');

body {
    font-family: 'Inter', sans-serif;
    background-color: #f8fafc;
    -webkit-tap-highlight-color: transparent;
}

.serif-font {
    font-family: 'Playfair Display', serif;
}

.example-box {
    border-left: 4px solid #6366f1;
    background-color: #f5f7ff;
    padding: 12px 16px;
    margin-top: 8px;
    border-radius: 0 8px 8px 0;
    font-style: italic;
    color: #4b5563;
}

.loader {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #4f46e5;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

/* Modal & UI Transitions */
.modal {
    transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.modal.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

#savedSidebar {
    transition: transform 0.3s ease-in-out;
    transform: translateX(100%);
}

#savedSidebar.active {
    transform: translateX(0);
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: #c7c7c7;
    border-radius: 10px;
}

/* Chat UI */
.chat-bubble {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 12px;
    animation: popIn 0.3s ease-out;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.chat-bubble.bot {
    background-color: #ffffff;
    color: #1f2937;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
    border: 1px solid #e5e7eb;
}

.chat-bubble.user {
    background-color: #4f46e5;
    color: white;
    border-bottom-right-radius: 4px;
    align-self: flex-end;
}

.chat-bubble p {
    margin-bottom: 0.5em;
}

.chat-bubble p:last-child {
    margin-bottom: 0;
}

@keyframes popIn {
    0% {
        transform: scale(0.9);
        opacity: 0;
    }

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

/* Gemini Card */
.gemini-card {
    background: linear-gradient(135deg, #f0fdf4 0%, #ffffff 100%);
    border: 1px solid #bbf7d0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.gemini-card strong {
    color: #15803d;
}

/* Interactive Words */
.interactive-word {
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    display: inline-block;
    padding: 0 1px;
}

.interactive-word:hover {
    background-color: #e0e7ff;
    color: #4338ca;
    border-bottom-color: #818cf8;
}

.word-tooltip {
    position: absolute;
    background-color: #1e293b;
    color: #ffffff;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    z-index: 50;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    white-space: normal;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2);
    animation: fadeInTooltip 0.2s ease-out;
    min-width: 140px;
    text-align: center;
    line-height: 1.4;
}

.word-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -6px;
    border-width: 6px;
    border-style: solid;
    border-color: #1e293b transparent transparent transparent;
}

@keyframes fadeInTooltip {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.reader-content {
    line-height: 1.8;
    font-size: 1.15rem;
    color: #374151;
    font-family: 'Georgia', serif;
}

.reader-content p {
    margin-bottom: 1.25rem;
}

/* Game & Quiz Styles */
.word-tile {
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    color: #334155;
    padding: 10px 16px;
    border-radius: 10px;
    cursor: pointer;
    user-select: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: all 0.2s;
    font-weight: 600;
    text-align: center;
}

.word-tile:hover {
    background-color: #f1f5f9;
    transform: translateY(-2px);
    border-color: #94a3b8;
}

.word-tile.used {
    opacity: 0.5;
    cursor: default;
    background-color: #f1f5f9;
    box-shadow: none;
    transform: none;
    border-color: #e2e8f0;
    color: #94a3b8;
}

.slot-area {
    min-height: 80px;
    background-color: #f8fafc;
    border: 2px dashed #cbd5e1;
    border-radius: 16px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    padding: 16px;
    gap: 8px;
    transition: all 0.3s;
}

.slot-area.correct {
    border-color: #4ade80;
    background-color: #f0fdf4;
    animation: pulse-green 0.5s;
    border-style: solid;
}

.slot-area.wrong {
    border-color: #f87171;
    background-color: #fef2f2;
    border-style: solid;
}

@keyframes pulse-green {
    0% {
        box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.7);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(74, 222, 128, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(74, 222, 128, 0);
    }
}

.progress-bar-bg {
    background-color: #f1f5f9;
    height: 8px;
    border-radius: 99px;
    overflow: hidden;
    margin-bottom: 20px;
}

.progress-bar-fill {
    background: linear-gradient(90deg, #a855f7, #ec4899);
    height: 100%;
    width: 0%;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.score-badge {
    position: absolute;
    top: 20px;
    right: 20px;
    background-color: #fff;
    padding: 6px 14px;
    border-radius: 99px;
    font-size: 13px;
    font-weight: bold;
    color: #eab308;
    border: 1px solid #fef08a;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    gap: 6px;
}

.quiz-option {
    width: 100%;
    text-align: left;
    padding: 1rem;
    border-radius: 0.75rem;
    border: 1px solid #e5e7eb;
    transition: all 150ms ease-in-out;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background-color: white;
}

.quiz-option:hover {
    border-color: #a5b4fc;
    background-color: #eef2ff;
}

.quiz-option.selected {
    border-color: #6366f1;
    background-color: #eef2ff;
    color: #4338ca;
    box-shadow: 0 0 0 1px #6366f1;
}

.quiz-option.correct {
    border-color: #22c55e;
    background-color: #f0fdf4;
    color: #15803d;
    box-shadow: 0 0 0 1px #22c55e;
}

.quiz-option.incorrect {
    border-color: #ef4444;
    background-color: #fef2f2;
    color: #b91c1c;
    box-shadow: 0 0 0 1px #ef4444;
}

/* Install Button Animation */
#installAppBtn {
    animation: bounceIn 1s ease-out;
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }

    60% {
        opacity: 1;
        transform: scale(1.05);
    }

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