:root {
    --primary-color: #FF6B9D;
    --secondary-color: #FFA07A;
    --accent-color: #FFD93D;
    --success-color: #6BCF7F;
    --bg-color: #FFF5F7;
    --surface-color: #FFFFFF;
    --text-color: #2C2C54;
    --text-light: #706C8B;
    --shadow: 0 4px 20px rgba(255, 107, 157, 0.2);
    --shadow-hover: 0 8px 30px rgba(255, 107, 157, 0.35);
    --border-radius: 20px;
    --font-family: 'Tajawal', sans-serif;
    --font-size: 18px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-size);
    background: 
        linear-gradient(135deg, rgba(255, 229, 236, 0.9) 0%, rgba(255, 249, 230, 0.9) 50%, rgba(229, 245, 255, 0.9) 100%),
        url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 800"><defs><linearGradient id="sky" x1="0%" y1="0%" x2="0%" y2="100%"><stop offset="0%" style="stop-color:%2387CEEB;stop-opacity:1" /><stop offset="100%" style="stop-color:%23B0E0E6;stop-opacity:1" /></linearGradient></defs><rect fill="url(%23sky)" width="1200" height="800"/><circle fill="%23FFD700" cx="150" cy="100" r="60" opacity="0.9"/><circle fill="%23FFF" cx="300" cy="120" r="40" opacity="0.8"/><circle fill="%23FFF" cx="340" cy="110" r="50" opacity="0.8"/><circle fill="%23FFF" cx="270" cy="115" r="35" opacity="0.8"/><circle fill="%23FFF" cx="900" cy="150" r="45" opacity="0.8"/><circle fill="%23FFF" cx="940" cy="140" r="55" opacity="0.8"/><circle fill="%23FFF" cx="870" cy="145" r="38" opacity="0.8"/><path d="M0,600 Q150,550 300,600 T600,600 T900,600 T1200,600 L1200,800 L0,800 Z" fill="%2398D8C8" opacity="0.7"/><path d="M0,650 Q200,620 400,650 T800,650 T1200,650 L1200,800 L0,800 Z" fill="%237CB342" opacity="0.8"/><circle fill="%23FF69B4" cx="100" cy="680" r="8"/><circle fill="%23FF1493" cx="105" cy="675" r="6"/><circle fill="%23FFD700" cx="95" cy="683" r="5"/><circle fill="%23FF69B4" cx="350" cy="670" r="8"/><circle fill="%23FF1493" cx="355" cy="665" r="6"/><circle fill="%23FFD700" cx="345" cy="673" r="5"/><circle fill="%23FF69B4" cx="600" cy="685" r="8"/><circle fill="%23FF1493" cx="605" cy="680" r="6"/><circle fill="%23FFD700" cx="595" cy="688" r="5"/><circle fill="%23FF69B4" cx="850" cy="675" r="8"/><circle fill="%23FF1493" cx="855" cy="670" r="6"/><circle fill="%23FFD700" cx="845" cy="678" r="5"/><circle fill="%23FF69B4" cx="1100" cy="680" r="8"/><circle fill="%23FF1493" cx="1105" cy="675" r="6"/><circle fill="%23FFD700" cx="1095" cy="683" r="5"/><polygon points="500,400 520,460 480,460" fill="%238B4513"/><circle fill="%2332CD32" cx="500" cy="380" r="60"/><circle fill="%2332CD32" cx="470" cy="360" r="45"/><circle fill="%2332CD32" cx="530" cy="365" r="50"/></svg>');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    color: var(--text-color);
    line-height: 1.8;
    min-height: 100vh;
    direction: rtl;
    position: relative;
}



.container {
    max-width: 100%;
    margin: 0 auto;
    padding: 0;
    min-height: 100vh;
    position: relative;
    z-index: 2;
}

.header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    padding: 20px;
    text-align: center;
    box-shadow: var(--shadow);
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-section {
    flex: 1;
}

.logo-icon {
    width: 80px;
    height: 80px;
    display: inline-block;
    margin-bottom: 10px;
    border-radius: 50%;
    object-fit: cover;
    filter: drop-shadow(3px 3px 0px rgba(0,0,0,0.3)) 
            drop-shadow(6px 6px 12px rgba(0,0,0,0.25))
            drop-shadow(0px 0px 20px rgba(255,107,157,0.4));
    transform: perspective(600px) rotateY(-8deg) translateZ(15px);
    transition: all 0.4s ease;
    animation: logoFloat 3s ease-in-out infinite;
}

.logo-icon:hover {
    transform: perspective(600px) rotateY(0deg) translateZ(25px) scale(1.1);
    filter: drop-shadow(4px 4px 0px rgba(0,0,0,0.4)) 
            drop-shadow(8px 8px 16px rgba(0,0,0,0.3))
            drop-shadow(0px 0px 30px rgba(255,107,157,0.6));
}

@keyframes logoFloat {
    0%, 100% {
        transform: perspective(600px) rotateY(-8deg) translateZ(15px) translateY(0px);
    }
    50% {
        transform: perspective(600px) rotateY(-8deg) translateZ(15px) translateY(-10px);
    }
}

.app-title {
    color: white;
    font-size: 1.8rem;
    font-weight: 900;
    margin: 10px 0 5px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.teacher-name {
    color: rgba(255,255,255,0.9);
    font-size: 1rem;
    font-weight: 400;
}

.settings-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    font-size: 1.5rem;
    padding: 10px 15px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    filter: drop-shadow(2px 2px 0px rgba(0,0,0,0.25)) 
            drop-shadow(3px 3px 6px rgba(0,0,0,0.15));
    transform: perspective(300px) rotateY(-3deg);
}

.settings-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: perspective(300px) rotateY(-3deg) rotate(90deg) translateZ(5px);
    filter: drop-shadow(3px 3px 0px rgba(0,0,0,0.35)) 
            drop-shadow(5px 5px 10px rgba(0,0,0,0.25));
}

.main-content {
    padding: 20px;
    max-width: 800px;
    margin: 0 auto;
}

.welcome-section {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: var(--border-radius);
    padding: 30px;
    text-align: center;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    animation: fadeInUp 0.6s;
    border: 3px solid transparent;
    background-image: linear-gradient(rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.95)), 
                      linear-gradient(135deg, var(--primary-color), var(--secondary-color), var(--accent-color));
    background-origin: border-box;
    background-clip: padding-box, border-box;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.welcome-animation {
    margin-bottom: 20px;
}

.book-icon {
    font-size: 4rem;
    filter: drop-shadow(3px 3px 0px rgba(0,0,0,0.3)) 
            drop-shadow(5px 5px 10px rgba(0,0,0,0.25));
    transform: perspective(600px) rotateX(10deg) rotateY(-5deg);
    display: inline-block;
}

.welcome-title {
    color: var(--primary-color);
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 15px;
}

.welcome-text {
    color: var(--text-light);
    font-size: 1.1rem;
    line-height: 1.8;
}

.upload-section {
    margin: 20px 0;
}

.upload-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.upload-btn {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(5px);
    border: 3px dashed var(--primary-color);
    border-radius: var(--border-radius);
    padding: 25px 15px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    font-family: var(--font-family);
    font-size: 1rem;
    color: var(--text-color);
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.upload-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,107,157,0.3), transparent);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.upload-btn:hover::before {
    width: 300px;
    height: 300px;
}

.upload-btn:hover {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-color: var(--accent-color);
    transform: translateY(-8px) scale(1.05);
    box-shadow: var(--shadow-hover);
}

.upload-btn:active {
    transform: translateY(-3px) scale(0.98);
}

.btn-icon {
    font-size: 2.5rem;
    transition: transform 0.3s;
    filter: drop-shadow(2px 2px 0px rgba(0,0,0,0.25)) 
            drop-shadow(3px 3px 6px rgba(0,0,0,0.2));
    display: inline-block;
    transform: perspective(400px) translateZ(10px);
}

.upload-btn:hover .btn-icon {
    animation: iconBounce 0.6s ease;
}

@keyframes iconBounce {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-10px) rotate(-5deg); }
    50% { transform: translateY(0) rotate(5deg); }
    75% { transform: translateY(-5px) rotate(-2deg); }
}

.btn-text {
    font-weight: 600;
}

.preview-section, .result-section {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: var(--border-radius);
    padding: 25px;
    box-shadow: var(--shadow);
    margin: 20px 0;
    animation: fadeInUp 0.6s;
}

.preview-header, .result-header, .chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--bg-color);
}

.result-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.preview-header h3, .result-header h3, .chat-header h3 {
    color: var(--primary-color);
    font-size: 1.4rem;
    font-weight: 700;
}

.close-btn {
    background: #ff4444;
    color: white;
    border: none;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s;
}

.close-btn:hover {
    background: #cc0000;
    transform: rotate(90deg);
}

.preview-content {
    margin: 20px 0;
    text-align: center;
}

.preview-content img {
    max-width: 100%;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.action-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-top: 20px;
}

.action-btn {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    padding: 15px 20px;
    border-radius: 12px;
    cursor: pointer;
    font-family: var(--font-family);
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    position: relative;
    overflow: hidden;
}

.action-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0);
    transition: transform 0.5s;
}

.action-btn:hover::after {
    transform: translate(-50%, -50%) scale(2);
}

.action-btn:hover {
    transform: translateY(-5px) scale(1.08);
    box-shadow: var(--shadow-hover);
}

.action-btn:active {
    transform: translateY(-2px) scale(1.02);
}

.action-btn span {
    font-size: 1.5rem;
    transition: transform 0.3s;
    position: relative;
    z-index: 1;
    filter: drop-shadow(2px 2px 0px rgba(0,0,0,0.3)) 
            drop-shadow(3px 3px 5px rgba(0,0,0,0.2));
    display: inline-block;
    transform: perspective(300px) translateZ(8px);
}

.action-btn:hover span {
    transform: perspective(300px) translateZ(15px) scale(1.2) rotate(5deg);
    filter: drop-shadow(3px 3px 0px rgba(0,0,0,0.4)) 
            drop-shadow(4px 4px 8px rgba(0,0,0,0.3));
}

.result-content {
    background: var(--bg-color);
    border-radius: 12px;
    padding: 20px;
    line-height: 2;
    font-size: 1.1rem;
}

.result-content h4 {
    color: var(--primary-color);
    margin: 20px 0 10px;
    font-size: 1.3rem;
}

.result-content ul, .result-content ol {
    margin: 15px 0;
    padding-right: 30px;
}

.result-content li {
    margin: 10px 0;
}

.question-text {
    color: #d32f2f;
    font-weight: 700;
    font-size: 1.15rem;
    display: block;
    padding: 12px 20px;
    background: linear-gradient(135deg, #ffebee, #ffcdd2);
    border-right: 5px solid #d32f2f;
    border-radius: 10px;
    margin: 15px 0;
    box-shadow: 0 3px 10px rgba(211, 47, 47, 0.15);
    transition: all 0.3s ease;
}

.question-text:hover {
    background: linear-gradient(135deg, #ffcdd2, #ef9a9a);
    transform: translateX(-5px);
    box-shadow: 0 5px 15px rgba(211, 47, 47, 0.25);
}

.answer-label {
    color: #ffffff;
    background: #2e7d32;
    font-weight: 700;
    font-size: 1.1rem;
    display: inline-block;
    padding: 8px 16px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(46, 125, 50, 0.3);
    margin-left: 5px;
}

.answer-text {
    color: #2e7d32;
    font-weight: 600;
    font-size: 1.1rem;
    display: inline-block;
    padding: 10px 18px;
    background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
    border-right: 5px solid #388e3c;
    border-radius: 10px;
    margin: 10px 0;
    line-height: 1.8;
    box-shadow: 0 3px 10px rgba(56, 142, 60, 0.15);
    transition: all 0.3s ease;
}

.answer-text:hover {
    background: linear-gradient(135deg, #c8e6c9, #a5d6a7);
    transform: translateX(-5px);
    box-shadow: 0 5px 15px rgba(56, 142, 60, 0.25);
}

.ask-btn, .listen-btn {
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 30px;
    cursor: pointer;
    font-family: var(--font-family);
    font-weight: 700;
    font-size: 1.1rem;
    transition: all 0.3s;
}

.ask-btn {
    background: linear-gradient(135deg, var(--success-color), #4CAF50);
    box-shadow: 0 4px 15px rgba(107, 207, 127, 0.3);
}

.ask-btn:hover {
    background: linear-gradient(135deg, #4CAF50, var(--success-color));
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(107, 207, 127, 0.5);
}

.listen-btn {
    background: linear-gradient(135deg, #9B59B6, #E74C3C);
    box-shadow: 0 4px 15px rgba(155, 89, 182, 0.3);
}

.listen-btn:hover {
    background: linear-gradient(135deg, #E74C3C, #9B59B6);
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(155, 89, 182, 0.5);
}

.listen-btn.active {
    animation: pulse 1s infinite;
    background: linear-gradient(135deg, #E74C3C, #C0392B);
}

.voice-btn, .mic-btn {
    background: linear-gradient(135deg, #9B59B6, #E74C3C);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.3rem;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(155, 89, 182, 0.3);
}

.voice-btn:hover, .mic-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(155, 89, 182, 0.5);
}

.voice-btn.active, .mic-btn.active {
    animation: pulse 1s infinite;
}

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

.copyright {
    text-align: center;
    padding: 30px 20px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    font-size: 1rem;
    font-weight: 600;
    margin-top: 40px;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    box-shadow: 0 -4px 15px rgba(255, 107, 157, 0.2);
}

.copyright strong {
    font-size: 1.2rem;
    display: block;
    margin-top: 5px;
}

.chat-section {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--surface-color);
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    z-index: 200;
    animation: slideUp 0.4s;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

.chat-header {
    padding: 20px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.chat-header h3 {
    color: white;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    max-height: 50vh;
}

.message {
    margin: 15px 0;
    animation: messageSlide 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    position: relative;
}

@keyframes messageSlide {
    0% {
        opacity: 0;
        transform: translateY(30px) scale(0.8);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.message.user {
    text-align: left;
}

.message.assistant {
    text-align: right;
}

.message-bubble {
    display: inline-block;
    padding: 12px 18px;
    border-radius: 18px;
    max-width: 80%;
    word-wrap: break-word;
    line-height: 1.6;
    position: relative;
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
    transition: transform 0.3s;
}

.message-bubble:hover {
    transform: scale(1.02);
}

.message.user .message-bubble {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
}

.message.user .message-bubble::before {
    content: '';
    position: absolute;
    left: -8px;
    bottom: 10px;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 10px 10px 0;
    border-color: transparent var(--primary-color) transparent transparent;
}

.message.assistant .message-bubble {
    background: var(--bg-color);
    color: var(--text-color);
    border: 2px solid var(--primary-color);
}

.message.assistant .message-bubble::before {
    content: '';
    position: absolute;
    right: -10px;
    bottom: 10px;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 10px 0 0 10px;
    border-color: transparent transparent transparent var(--bg-color);
}

.chat-input-container {
    display: flex;
    gap: 10px;
    padding: 15px 20px;
    border-top: 2px solid var(--bg-color);
}

.chat-input {
    flex: 1;
    padding: 12px 20px;
    border: 2px solid var(--primary-color);
    border-radius: 25px;
    font-family: var(--font-family);
    font-size: 1rem;
    outline: none;
}

.chat-input:focus {
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(201, 169, 110, 0.1);
}

.send-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.3rem;
    transition: all 0.3s;
}

.send-btn:hover {
    background: var(--secondary-color);
    transform: scale(1.1);
}

.settings-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 300;
    padding: 20px;
}

.modal-content {
    background: var(--surface-color);
    border-radius: var(--border-radius);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    animation: fadeInUp 0.4s;
}

.modal-header {
    padding: 20px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    color: white;
    font-size: 1.4rem;
}

.modal-body {
    padding: 25px;
}

.setting-group {
    margin-bottom: 25px;
}

.setting-group label {
    display: block;
    margin-bottom: 10px;
    color: var(--primary-color);
    font-weight: 600;
    font-size: 1.1rem;
}

.setting-group input[type="range"] {
    width: 70%;
    margin-left: 10px;
}

.setting-group input[type="color"],
.setting-group input[type="password"],
.setting-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    font-family: var(--font-family);
    font-size: 1rem;
}

.setting-group small {
    display: block;
    margin-top: 8px;
    color: var(--text-light);
    font-size: 0.9rem;
}

.setting-group small a {
    color: var(--primary-color);
    text-decoration: none;
}

.save-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    border-radius: 12px;
    font-family: var(--font-family);
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
}

.save-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(245, 240, 232, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 400;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 5px solid var(--bg-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay p {
    margin-top: 20px;
    color: var(--primary-color);
    font-size: 1.2rem;
    font-weight: 600;
}

.games-section {
    margin-top: 30px;
    padding: 25px;
    background: linear-gradient(135deg, #E8F5E9 0%, #FFF9C4 100%);
    border-radius: var(--border-radius);
    border: 3px solid var(--success-color);
}

.games-section h3 {
    color: var(--success-color);
    text-align: center;
    margin-bottom: 20px;
    font-size: 1.6rem;
    animation: bounce 2s infinite;
}

.games-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.game-btn {
    background: linear-gradient(135deg, var(--success-color), #4CAF50);
    color: white;
    border: none;
    padding: 15px 20px;
    border-radius: 15px;
    cursor: pointer;
    font-family: var(--font-family);
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    box-shadow: 0 4px 15px rgba(107, 207, 127, 0.3);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.game-btn:hover {
    transform: translateY(-5px) scale(1.08);
    box-shadow: 0 8px 25px rgba(107, 207, 127, 0.5);
}

.game-btn span {
    font-size: 2rem;
    filter: drop-shadow(2px 2px 0px rgba(0,0,0,0.3)) 
            drop-shadow(4px 4px 8px rgba(0,0,0,0.2));
    display: inline-block;
    transform: perspective(400px) rotateY(-5deg) translateZ(10px);
}

#gameContainer {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 20px;
    min-height: 200px;
    box-shadow: var(--shadow);
}

.memory-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(60px, 150px));
    gap: 10px;
    margin-top: 20px;
    justify-content: center;
}

.memory-card {
    aspect-ratio: 1;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s;
    transform-style: preserve-3d;
    max-width: 150px;
    max-height: 150px;
    min-width: 60px;
    min-height: 60px;
    padding: 10px;
    word-wrap: break-word;
    overflow: hidden;
    text-align: center;
}

.memory-card:hover {
    transform: scale(1.05);
}

.memory-card.flipped {
    background: white;
    border: 3px solid var(--primary-color);
    color: var(--text-color);
}

.memory-card.matched {
    background: linear-gradient(135deg, #4CAF50, #8BC34A);
    animation: matchPulse 0.5s;
}

@keyframes matchPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

.match-game {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 20px;
}

.match-column {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.match-item {
    padding: 15px;
    background: var(--bg-color);
    border: 2px solid var(--primary-color);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
    font-weight: 500;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.match-item:hover {
    background: var(--primary-color);
    color: white;
    transform: scale(1.05);
}

.match-item.selected {
    background: var(--accent-color);
    border-color: var(--accent-color);
    transform: scale(1.05);
}

.match-item.matched {
    background: linear-gradient(135deg, #4CAF50, #8BC34A);
    color: white;
    border-color: #4CAF50;
}

.word-game {
    margin-top: 20px;
}

.word-scramble {
    font-size: 2rem;
    text-align: center;
    padding: 20px;
    background: var(--bg-color);
    border-radius: 12px;
    margin-bottom: 20px;
    letter-spacing: 8px;
    font-weight: bold;
    color: var(--primary-color);
}

.word-input {
    width: 100%;
    padding: 15px;
    font-size: 1.2rem;
    border: 3px solid var(--primary-color);
    border-radius: 12px;
    text-align: center;
    font-family: var(--font-family);
    direction: rtl;
}

.word-input:disabled {
    background-color: #e8f5e9;
    cursor: not-allowed;
    opacity: 0.8;
}

.game-score {
    text-align: center;
    margin-top: 20px;
    font-size: 1.3rem;
    font-weight: bold;
    color: var(--success-color);
}

@media (max-width: 768px) {
    .app-title {
        font-size: 1.4rem;
    }
    
    .welcome-title {
        font-size: 1.4rem;
    }
    
    .upload-options {
        grid-template-columns: 1fr;
    }
    
    .action-buttons {
        grid-template-columns: 1fr 1fr;
    }
    
    .memory-grid {
        grid-template-columns: repeat(3, minmax(60px, 100px));
    }
    
    .memory-card {
        font-size: 1rem;
        max-width: 100px;
        max-height: 100px;
    }
    
    .match-game {
        grid-template-columns: 1fr;
    }
    
    .word-scramble {
        font-size: 1.5rem;
        letter-spacing: 5px;
    }
    
    .games-buttons {
        grid-template-columns: 1fr;
    }
    
    body::after {
        font-size: 2rem;
    }
    
    .result-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .result-actions button {
        width: 100%;
    }
    
    .header {
        flex-direction: column;
        gap: 15px;
    }
    
    .logo-section {
        width: 100%;
    }
    
    .settings-btn {
        align-self: flex-end;
    }
}

.floating-chat-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    font-size: 2rem;
    border: none;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(255, 107, 157, 0.4);
    z-index: 1000;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    animation: floatPulse 3s ease-in-out infinite;
    display: flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(3px 3px 0px rgba(0,0,0,0.3)) 
            drop-shadow(5px 5px 12px rgba(0,0,0,0.25));
    transform: perspective(500px) translateZ(20px);
}

.floating-chat-btn:hover {
    transform: perspective(500px) translateZ(25px) scale(1.15) rotate(10deg);
    box-shadow: 0 12px 35px rgba(255, 107, 157, 0.6);
    filter: drop-shadow(4px 4px 0px rgba(0,0,0,0.35)) 
            drop-shadow(6px 6px 15px rgba(0,0,0,0.3));
}

.floating-chat-btn:active {
    transform: scale(0.95);
}

@keyframes floatPulse {
    0%, 100% {
        transform: translateY(0) scale(1);
        box-shadow: 0 8px 25px rgba(255, 107, 157, 0.4);
    }
    50% {
        transform: translateY(-10px) scale(1.05);
        box-shadow: 0 15px 35px rgba(255, 107, 157, 0.6);
    }
}

.floating-chat-btn::before {
    content: '';
    position: absolute;
    top: -5px;
    right: -5px;
    width: 20px;
    height: 20px;
    background: #ff4444;
    border-radius: 50%;
    display: none;
    animation: notificationPulse 2s infinite;
}

.floating-chat-btn.has-notification::before {
    display: block;
}

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

@media (min-width: 769px) {
    .container {
        max-width: 900px;
    }
    
    .chat-section {
        left: 50%;
        transform: translateX(-50%);
        max-width: 800px;
        width: 100%;
    }
}

@media (max-width: 768px) {
    .floating-chat-btn {
        width: 60px;
        height: 60px;
        font-size: 1.8rem;
        bottom: 20px;
        right: 20px;
    }
}
